From ef5e97ef5abbfc12d8fce14d7e198af00d939f95 Mon Sep 17 00:00:00 2001 From: Bruno Date: Tue, 20 Feb 2018 21:09:53 -0800 Subject: [PATCH] aci_static_binding_to_epg fixes (#36478) * aci_static_binding_to_epg fixes (documentation and logic for interface_mode) * additional fixes after review --- .../network/aci/aci_static_binding_to_epg.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/network/aci/aci_static_binding_to_epg.py b/lib/ansible/modules/network/aci/aci_static_binding_to_epg.py index af23b75df0..aaa019ad86 100644 --- a/lib/ansible/modules/network/aci/aci_static_binding_to_epg.py +++ b/lib/ansible/modules/network/aci/aci_static_binding_to_epg.py @@ -60,7 +60,7 @@ options: description: - Determines how layer 2 tags will be read from and added to frames. - The APIC defaults the mode to C(trunk). - choices: [ access, trunk, 802.1p ] + choices: [ untagged, 802.1p, trunk, regular, native, tagged, access ] default: trunk aliases: [ mode, interface_mode_name ] interface_type: @@ -237,7 +237,7 @@ def main(): encap_id=dict(type='int', aliases=['vlan', 'vlan_id']), primary_encap_id=dict(type='int', aliases=['primary_vlan', 'primary_vlan_id']), deploy_immediacy=dict(type='str', choices=['immediate', 'lazy']), - interface_mode=dict(type='str', choices=['access', 'tagged', '802.1p'], aliases=['mode', 'interface_mode_name']), + interface_mode=dict(type='str', choices=['untagged', '802.1p', 'trunk', 'regular', 'native', 'tagged', 'access'], aliases=['mode', 'interface_mode_name']), interface_type=dict(type='str', choices=['switch_port', 'vpc', 'port_channel', 'fex'], required=True), # NOTE: C(pod) is usually an integer below 10. pod=dict(type='int', aliases=['pod_number']), @@ -302,6 +302,15 @@ def main(): else: module.fail_json(msg='Valid VLAN assigments are from 1 to 4096') + INTERFACE_MODE_MAPPING = { + 'access': 'untagged', + 'untagged': 'untagged', + 'tagged': 'regular', + 'trunk': 'regular', + 'regular': 'regular', + '802.1p': 'native', + 'native': 'native', + } INTERFACE_TYPE_MAPPING = dict( # NOTE: C(interface) can be a policy group like: 'test-IntPolGrp' or of following format: '1/7', C(leafs) can only be something like '101' switch_port='topology/pod-{0}/paths-{1}/pathep-[eth{2}]'.format(pod, leafs, interface), @@ -314,6 +323,8 @@ def main(): ) static_path = INTERFACE_TYPE_MAPPING[interface_type] + if interface_mode is not None: + interface_mode = INTERFACE_MODE_MAPPING[interface_mode] aci = ACIModule(module) aci.construct_url(