Skip to content

Commit a793381

Browse files
committed
Changes moved to a different PR : sonic-net#17530
1 parent 7f922d5 commit a793381

6 files changed

Lines changed: 8 additions & 35 deletions

File tree

ansible/config_sonic_basedon_testbed.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@
590590
topo_name: "{{ topo }}"
591591
port_index_map: "{{ port_index_map | default({}) }}"
592592
become: true
593+
when: "'t2' not in topo"
593594

594595
- name: Copy macsec profile json to dut
595596
copy: src=../tests/common/macsec/profile.json

ansible/library/generate_golden_config_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ def generate(self):
386386
elif self.topo_name == "t1-28-lag" or self.topo_name == "smartswitch-t1":
387387
config = self.generate_smartswitch_golden_config_db()
388388
self.module.run_command("sudo rm -f {}".format(TEMP_SMARTSWITCH_CONFIG_PATH))
389-
elif "t2" in self.topo_name and self.macsec_profile:
389+
elif "t2" in self.topo_name:
390390
config = self.generate_t2_golden_config_db()
391391
self.module.run_command("sudo rm -f {}".format(MACSEC_PROFILE_PATH))
392392
self.module.run_command("sudo rm -f {}".format(GOLDEN_CONFIG_TEMPLATE_PATH))

ansible/library/get_macsec_profile.py

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,22 @@
55
from ansible.module_utils.basic import AnsibleModule
66

77

8-
def convert_to_eos(cipher_name):
9-
# Set the cipher suite as 256 xpn by default
10-
eos_cipher_name = 'aes256-gcm-xpn'
11-
12-
if cipher_name == 'GCM-AES-XPN-256':
13-
eos_cipher_name = 'aes256-gcm-xpn'
14-
elif cipher_name == 'GCM-AES-128':
15-
eos_cipher_name = 'aes128-gcm'
16-
elif cipher_name == 'GCM-AES-256':
17-
eos_cipher_name = 'aes256-gcm'
18-
elif cipher_name == 'GCM-AES-XPN-128':
19-
eos_cipher_name = 'aes128-gcm-xpn'
20-
21-
return eos_cipher_name
22-
23-
24-
# This API support EoS based templates now
25-
def get_macsec_profile(module, macsec_profile, vm_type):
8+
def get_macsec_profile(module, macsec_profile):
269
with open('/tmp/profile.json') as f:
2710
macsec_profiles = json.load(f)
2811

2912
profile = macsec_profiles.get(macsec_profile)
3013
if profile:
3114
profile['macsec_profile'] = macsec_profile
3215

33-
# Currently handling ceos, add more cases for vsonic etc
34-
if vm_type == 'ceos':
35-
# Get the cipher suite in eos terminology
36-
eos_cipher_suite_name = convert_to_eos(profile['cipher_suite'])
37-
profile['cipher_suite'] = eos_cipher_suite_name
38-
3916
return profile
4017

4118

4219
def main():
43-
module = AnsibleModule(argument_spec=dict(
44-
macsec_profile=dict(required=True, type='str'),
45-
vm_type=dict(required=True, type='str')))
20+
module = AnsibleModule(argument_spec=dict(macsec_profile=dict(required=True, type='str')))
4621

4722
macsec_profile = module.params['macsec_profile']
48-
vm_type = module.params['vm_type']
49-
module.exit_json(profile=get_macsec_profile(module, macsec_profile, vm_type), changed=False)
23+
module.exit_json(profile=get_macsec_profile(module, macsec_profile), changed=False)
5024

5125

5226
if __name__ == "__main__":

ansible/roles/eos/tasks/ceos_config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
- name: Get the macsec profile data from profile_name
4343
get_macsec_profile:
4444
macsec_profile: "{{ macsec_profile }}"
45-
vm_type: "{{ vm_type }}"
4645
register: profile_raw
4746
become: true
4847
when: "'t2' == base_topo and enable_macsec is defined"

ansible/templates/minigraph_link_meta.j2

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{%- set ns = namespace(link_metadata_defined=False) -%}
22

3-
{% if 'dualtor' in topo or
4-
(macsec_card is defined and enable_macsec is defined and macsec_card == True and 't2' in topo) %}
3+
{%- if 'dualtor' in topo or (macsec_card is defined and macsec_card == True and 't2' in topo) -%}
54
{% set ns.link_metadata_defined = True %}
65
{%- endif -%}
76

@@ -39,7 +38,7 @@
3938
</a:LinkMetadata>
4039
{% endfor %}
4140
{% endif %}
42-
{% if macsec_card is defined and enable_macsec is defined and macsec_card == True and 't2' in topo %}
41+
{% if macsec_card is defined and macsec_card == True and 't2' in topo %}
4342
{% for index in range(vms_number) %}
4443
{% set vm_intfs=vm_topo_config['vm'][vms[index]]['intfs'][dut_index|int]|sort %}
4544
{% set dut_intfs=vm_topo_config['vm'][vms[index]]['interface_indexes'][dut_index|int]|sort %}

ansible/templates/minigraph_meta.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@
226226
<a:Value>{{ switch_type }}</a:Value>
227227
</a:DeviceProperty>
228228
{% endif %}
229-
{% if macsec_card is defined and enable_macsec is defined and macsec_card == True and 't2' in topo %}
229+
{% if macsec_card is defined and macsec_card == True and 't2' in topo %}
230230
<a:DeviceProperty>
231231
<a:Name>MacSecProfile</a:Name>
232232
<a:Value>PrimaryKey="MACSEC_PROFILE" FallbackKey="macsec-profile2" MacsecPolicy=""</a:Value>

0 commit comments

Comments
 (0)