I’am writing a new module and the argument spec is like this
member_spec = dict(
pwwn=dict(required=True, type=‘str’, aliases=[‘interface’, ‘device-alias’]),
devtype=dict(type=‘str’, choices=[‘initiator’, ‘target’, ‘both’])
)
zoneadd_spec = dict(
zonename=dict(type=‘str’, required=True),
members=dict(type=‘list’, element=‘dict’, options=member_spec)
)
zonedetails_spec = dict(
vsanid=dict(required=True, type=‘int’),
mode=dict(type=‘str’, choices=[‘enhanced’, ‘basic’]),
default_zone=dict(type=‘str’, choices=[‘permit’, ‘deny’]),
smart_zoning=dict(type=‘bool’),
zone_remove=dict(type=‘list’, elements=‘str’),
zone_add=dict(type=‘list’, elements=‘dict’, options=zoneadd_spec)
)
argument_spec = dict(
zone_details=dict(type=‘list’, elements=‘dict’, options=zonedetails_spec)
)
My play is like this:
- name: Test that zone module works
nxos_zone:
provider: “{{ creds }}”
zone_details: - vsanid: 1
mode: enhanced
smart_zoning: yes
default_zone: permit
zone_add: - zonename: zone1
members: - {device-alias: ‘abc’, devtype: ‘bo’}
- {pwn: ‘11:11:11:11:11:11:11:11’, dvtype: ‘initiator’}
- {interface: ‘fc1/2’, devtype: ‘target’}
- zonename: zone2
members: - {device-alias: ‘abc’}
- {pwwn: ‘11:11:11:11:11:11:11:11’}
- vsanid: 2
mode: basic
smart_zoning: no
default_zone: deny
zone_remove: - zone32
- zone56
When i run this play there was no error seen, i was expecting an error because
Notice that the devtype is ‘bo’ instead of ‘both’ and key is ‘pwn’ instead of ‘pwwn’ and instead of ‘devtype’ i have ‘dvtype’
So looks like basically ‘member_spec’ is not getting validated, any reason?