|
5 | 5 | from ansible.module_utils.basic import AnsibleModule |
6 | 6 |
|
7 | 7 |
|
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): |
26 | 9 | with open('/tmp/profile.json') as f: |
27 | 10 | macsec_profiles = json.load(f) |
28 | 11 |
|
29 | 12 | profile = macsec_profiles.get(macsec_profile) |
30 | 13 | if profile: |
31 | 14 | profile['macsec_profile'] = macsec_profile |
32 | 15 |
|
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 | | - |
39 | 16 | return profile |
40 | 17 |
|
41 | 18 |
|
42 | 19 | 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'))) |
46 | 21 |
|
47 | 22 | 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) |
50 | 24 |
|
51 | 25 |
|
52 | 26 | if __name__ == "__main__": |
|
0 commit comments