aci_static_binding_to_epg fixes (#36478)

* aci_static_binding_to_epg fixes (documentation and logic for interface_mode)

* additional fixes after review
This commit is contained in:
Bruno 2018-02-20 21:09:53 -08:00 committed by ansibot
parent 47a92386c9
commit ef5e97ef5a

View file

@ -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(