ACI_DOMAIN: Additional params per MIM (#34839)
This commit is contained in:
parent
b7906f9c27
commit
179012caf3
1 changed files with 53 additions and 2 deletions
|
@ -37,6 +37,19 @@ options:
|
|||
- 'C(vmm): The VMM domain profile is a policy for grouping VM controllers with similar networking policy requirements.'
|
||||
choices: [ fc, l2dom, l3dom, phys, vmm ]
|
||||
aliases: [ type ]
|
||||
dscp:
|
||||
description:
|
||||
- The target Differentiated Service (DSCP) value.
|
||||
choices: [ AF11, AF12, AF13, AF21, AF22, AF23, AF31, AF32, AF33, AF41, AF42, AF43, CS0, CS1, CS2, CS3, CS4, CS5, CS6, CS7, EF, VA, unspecified ]
|
||||
default: unspecified
|
||||
aliases: [ target ]
|
||||
encap_mode:
|
||||
description:
|
||||
- The layer 2 encapsulation protocol to use with the virtual switch.
|
||||
choices: [ unknown, vlan, vxlan ]
|
||||
multicast_address:
|
||||
description:
|
||||
- The muticast IP address to use for the virtual switch.
|
||||
state:
|
||||
description:
|
||||
- Use C(present) or C(absent) for adding or removing.
|
||||
|
@ -47,6 +60,11 @@ options:
|
|||
description:
|
||||
- The VM platform for VMM Domains.
|
||||
choices: [ microsoft, openstack, redhat, vmware ]
|
||||
vswitch:
|
||||
description:
|
||||
- The virtual switch to use for vmm domains.
|
||||
choices: [ avs, default, dvs, unknown ]
|
||||
default: default
|
||||
extends_documentation_fragment: aci
|
||||
'''
|
||||
|
||||
|
@ -117,15 +135,28 @@ VM_PROVIDER_MAPPING = dict(
|
|||
redhat="Redhat",
|
||||
vmware="VMware",
|
||||
)
|
||||
VSWITCH_MAPPING = dict(
|
||||
avs='n1kv',
|
||||
default='default',
|
||||
dvs='default',
|
||||
unknown='unknown',
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
argument_spec = aci_argument_spec
|
||||
argument_spec.update(
|
||||
dscp=dict(type='str',
|
||||
choices=['AF11', 'AF12', 'AF13', 'AF21', 'AF22', 'AF23', 'AF31', 'AF32', 'AF33', 'AF41', 'AF42', 'AF43',
|
||||
'CS0', 'CS1', 'CS2', 'CS3', 'CS4', 'CS5', 'CS6', 'CS7', 'EF', 'VA', 'unspecified'],
|
||||
aliases=['target']),
|
||||
domain=dict(type='str', aliases=['domain_name', 'domain_profile', 'name']),
|
||||
domain_type=dict(type='str', choices=['fc', 'l2dom', 'l3dom', 'phys', 'vmm'], aliases=['type']),
|
||||
encap_mode=dict(type='str', choices=['unknown', 'vlan', 'vxlan']),
|
||||
multicast_address=dict(type='str'),
|
||||
state=dict(type='str', default='present', choices=['absent', 'present', 'query']),
|
||||
vm_provider=dict(type='str', choices=['microsoft', 'openstack', 'redhat', 'vmware']),
|
||||
vswitch=dict(type='str', choices=['avs', 'default', 'dvs', 'unknown']),
|
||||
)
|
||||
|
||||
module = AnsibleModule(
|
||||
|
@ -138,13 +169,29 @@ def main():
|
|||
],
|
||||
)
|
||||
|
||||
dscp = module.params['dscp']
|
||||
domain = module.params['domain']
|
||||
domain_type = module.params['domain_type']
|
||||
encap_mode = module.params['encap_mode']
|
||||
multicast_address = module.params['multicast_address']
|
||||
vm_provider = module.params['vm_provider']
|
||||
vswitch = module.params['vswitch']
|
||||
if vswitch is not None:
|
||||
vswitch = VSWITCH_MAPPING[vswitch]
|
||||
state = module.params['state']
|
||||
|
||||
if domain_type != 'vmm' and vm_provider is not None:
|
||||
module.fail_json(msg="Domain type '{0}' cannot have a 'vm_provider'".format(domain_type))
|
||||
if domain_type != 'vmm':
|
||||
if vm_provider is not None:
|
||||
module.fail_json(msg="Domain type '{0}' cannot have a 'vm_provider'".format(domain_type))
|
||||
if encap_mode is not None:
|
||||
module.fail_json(msg="Domain type '{0}' cannot have an 'encap_mode'".format(domain_type))
|
||||
if multicast_address is not None:
|
||||
module.fail_json(msg="Domain type '{0}' cannot have a 'multicast_address'".format(domain_type))
|
||||
if vswitch is not None:
|
||||
module.fail_json(msg="Domain type '{0}' cannot have a 'vswitch'".format(domain_type))
|
||||
|
||||
if dscp is not None and domain_type not in ['l2dom', 'l3dom']:
|
||||
module.fail_json(msg="DSCP values can only be assigned to 'l2ext and 'l3ext' domains")
|
||||
|
||||
# Compile the full domain for URL building
|
||||
if domain_type == 'fc':
|
||||
|
@ -185,7 +232,11 @@ def main():
|
|||
aci.payload(
|
||||
aci_class=domain_class,
|
||||
class_config=dict(
|
||||
encapMode=encap_mode,
|
||||
mcastAddr=multicast_address,
|
||||
mode=vswitch,
|
||||
name=domain,
|
||||
targetDscp=dscp,
|
||||
),
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue