Skip to content

Commit 31da804

Browse files
lolyuyxieca
authored andcommitted
[dualtor-mixed] Set grpc config as insecure for testing (#6412)
Approach What is the motivation for this PR? Use insecure config for grpc connections from ycabled in tests. How did you do it? Modify /etc/sonic/grpc_secrets.json How did you verify/test it? This depends on sonic-net/sonic-platform-daemons#298 Any platform specific information? Supported testbed topology if it's a new test case?
1 parent 8b4cfb4 commit 31da804

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

ansible/config_sonic_basedon_testbed.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,53 @@
525525
shell: bash "/etc/sonic/apply_clet.sh"
526526
when: stat_result.stat.exists is defined and stat_result.stat.exists
527527

528+
- block:
529+
- name: set the default grpc credential file path
530+
set_fact:
531+
grpc_credential_file: /etc/sonic/grpc_secrets.json
532+
533+
- name: check if grpc credential file exists
534+
stat:
535+
path: "{{ grpc_credential_file }}"
536+
register: stat_result
537+
538+
- block:
539+
- name: collect initial grpc credentials
540+
slurp:
541+
path: "{{ grpc_credential_file }}"
542+
register: grpc_credential_content
543+
544+
- name: parse initial grpc credentials
545+
set_fact:
546+
grpc_secrets: "{{ grpc_credential_content.content | b64decode | from_json }}"
547+
548+
- name: use insecure grpc for testing
549+
set_fact:
550+
grpc_secrets: "{{ grpc_secrets | combine(new_item, recursive=true) }}"
551+
vars:
552+
new_item: "{ '{{ item.key }}': { 'config': 'insecure' } }"
553+
with_dict: "{{ grpc_secrets }}"
554+
555+
- name: show new grpc setting
556+
debug:
557+
var: grpc_secrets
558+
559+
- name: save new grpc setting
560+
copy:
561+
content: "{{ grpc_secrets | to_nice_json }}"
562+
dest: "{{ grpc_credential_file }}"
563+
become: true
564+
565+
- name: restart the pmon service
566+
service:
567+
name: pmon
568+
state: restarted
569+
become: true
570+
571+
when: stat_result.stat.exists
572+
573+
when: "'dualtor-mixed' in topo"
574+
528575
- name: execute cli "config save -y" to save current minigraph as startup-config
529576
become: true
530577
shell: config save -y

0 commit comments

Comments
 (0)