Skip to content

Commit

Permalink
[minor_change] Add option to set delimiter to '_' in aci_epg_to_domai…
Browse files Browse the repository at this point in the history
…n module
  • Loading branch information
akinross authored and lhercot committed Feb 27, 2024
1 parent 590104a commit 505ca19
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 4 deletions.
4 changes: 2 additions & 2 deletions plugins/modules/aci_epg_to_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
description:
- The delimiter.
type: str
choices: [ "|", "~", "!", "@", "^", "+", "=" ]
choices: [ "|", "~", "!", "@", "^", "+", "=", "_" ]
untagged_vlan:
description:
- The access vlan is untagged.
Expand Down Expand Up @@ -384,7 +384,7 @@ def main():
vm_provider=dict(type="str", choices=["cloudfoundry", "kubernetes", "microsoft", "openshift", "openstack", "redhat", "vmware"]),
promiscuous=dict(type="str", default="reject", choices=["accept", "reject"]),
custom_epg_name=dict(type="str"),
delimiter=dict(type="str", choices=["|", "~", "!", "@", "^", "+", "="]),
delimiter=dict(type="str", choices=["|", "~", "!", "@", "^", "+", "=", "_"]),
untagged_vlan=dict(type="bool"),
port_binding=dict(type="str", choices=["dynamic", "ephemeral", "static"]),
port_allocation=dict(type="str", choices=["elastic", "fixed"]),
Expand Down
46 changes: 44 additions & 2 deletions tests/integration/targets/aci_epg_to_domain/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@
- delimeter.results.6 is changed
- delimeter.results.6.current.0.fvRsDomAtt.attributes.delimiter == "="
- delimiter_not_allowed is not changed
- 'delimiter_not_allowed.msg == "value of delimiter must be one of: |, ~, !, @, ^, +, =, got: not_allowed"'
- 'delimiter_not_allowed.msg == "value of delimiter must be one of: |, ~, !, @, ^, +, =, _, got: not_allowed"'
- delimeter_absent.results.0 is changed
- delimeter_absent.results.0.current == []
- delimeter_absent.results.1 is changed
Expand Down Expand Up @@ -732,4 +732,46 @@
cisco.aci.aci_tenant:
<<: *aci_tenant_present
state: absent
when: tenant_present is changed
when: tenant_present is changed

# Seperate underscore delimiter tests
# All other tests use underscore delimiters in naming of parents whiches causes tests fail
# Error: 400 - Validation failed: Tenant/Application/EPG name contains _. Please use another delimiter or rename
- name: Ensure tenant exists for testing underscore delimiter
cisco.aci.aci_tenant: &underscore_tenant
<<: *aci_info
tenant: underscore
state: present
register: tenant_present

- name: Ensure ap exists for testing underscore delimiter
cisco.aci.aci_ap: &underscore_ap
<<: *underscore_tenant
ap: underscore
register: ap_present

- name: Ensure epg exists for testing underscore delimiter
cisco.aci.aci_epg: &underscore_epg
<<: *underscore_ap
epg: underscore

- name: Create domain with underscore delimiter delimiter
cisco.aci.aci_epg_to_domain:
<<: *underscore_epg
domain: anstest
domain_type: vmm
vm_provider: vmware
delimiter: "_"
register: underscore

- name: Assert underscore delimiter
ansible.builtin.assert:
that:
- underscore is changed
- underscore.current.0.fvRsDomAtt.attributes.delimiter == "_"

- name: Remove tenant used for testing underscore delimiter
cisco.aci.aci_tenant:
<<: *underscore_tenant
state: absent
register: tenant_present

0 comments on commit 505ca19

Please sign in to comment.