Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug_fix]: Add subclass to aci_domain_to_vlan_pool to fix deletion of binding (DCNE-207) #695

Merged
merged 6 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions plugins/modules/aci_domain_to_vlan_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,21 +330,23 @@ def main():
module_object=domain_mo,
target_filter={"name": domain},
),
child_classes=["infraRsVlanNs"],
subclass_1=dict(
aci_class="infraRsVlanNs",
aci_rn="rsvlanNs",
module_object=aci_mo if pool_name else None,
target_filter={"tDn": aci_mo} if pool_name else {},
),
)

aci.get_existing()

if state == "present":
aci.payload(
aci_class=domain_class,
class_config=dict(name=domain),
child_configs=[
{"infraRsVlanNs": {"attributes": {"tDn": aci_mo}}},
],
aci_class="infraRsVlanNs",
class_config=dict(tDn=aci_mo),
)

aci.get_diff(aci_class=domain_class)
aci.get_diff(aci_class="infraRsVlanNs")
edudppaz marked this conversation as resolved.
Show resolved Hide resolved

aci.post_config()

Expand Down
59 changes: 36 additions & 23 deletions tests/integration/targets/aci_domain_to_vlan_pool/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,25 @@
description: Test VLAN pool
state: present

- name: Create domains
cisco.aci.aci_domain:
<<: *aci_info
domain: "{{ item.domain }}"
domain_type: "{{ item.domain_type }}"
state: present
loop:
- {domain: phys_dom, domain_type: phys}
- {domain: fc_dom, domain_type: fc}
- {domain: l2dom_dom, domain_type: l2dom}
- {domain: l3dom_dom, domain_type: l3dom}

- name: Add VMM domain
cisco.aci.aci_domain:
<<: *aci_info
domain: anstest
domain_type: vmm
vm_provider: vmware
state: present

# ADD BINDING
- name: Add domain to VLAN pool binding (check_mode)
Expand All @@ -85,15 +104,11 @@
that:
- cm_add_binding is changed
- nm_add_binding is changed
- cm_add_binding.sent.physDomP.attributes.name == nm_add_binding.sent.physDomP.attributes.name == 'phys_dom'
- cm_add_binding.sent.physDomP.children.0.infraRsVlanNs.attributes.tDn == nm_add_binding.sent.physDomP.children.0.infraRsVlanNs.attributes.tDn == 'uni/infra/vlanns-[test_pool]-dynamic'
- cm_add_binding.proposed.physDomP.attributes.name == nm_add_binding.proposed.physDomP.attributes.name == 'phys_dom'
- cm_add_binding.proposed.physDomP.children.0.infraRsVlanNs.attributes.tDn == nm_add_binding.proposed.physDomP.children.0.infraRsVlanNs.attributes.tDn == 'uni/infra/vlanns-[test_pool]-dynamic'
- cm_add_binding.proposed.infraRsVlanNs.attributes.tDn == nm_add_binding.proposed.infraRsVlanNs.attributes.tDn == 'uni/infra/vlanns-[test_pool]-dynamic'
- cm_add_binding.current == cm_add_binding.previous == nm_add_binding.previous == []
- nm_add_binding.current.0.physDomP.attributes.annotation == 'orchestrator:ansible'
- nm_add_binding.current.0.physDomP.attributes.name == 'phys_dom'
- nm_add_binding.current.0.physDomP.attributes.dn == 'uni/phys-phys_dom'
- nm_add_binding.current.0.physDomP.children.0.infraRsVlanNs.attributes.tDn == 'uni/infra/vlanns-[test_pool]-dynamic'
- nm_add_binding.current.0.infraRsVlanNs.attributes.annotation == 'orchestrator:ansible'
- nm_add_binding.current.0.infraRsVlanNs.attributes.dn == 'uni/phys-phys_dom/rsvlanNs'
- nm_add_binding.current.0.infraRsVlanNs.attributes.tDn == 'uni/infra/vlanns-[test_pool]-dynamic'

- name: Add domain to VLAN pool binding again (check_mode)
cisco.aci.aci_domain_to_vlan_pool: *binding_present
Expand Down Expand Up @@ -155,17 +170,17 @@
- err_not_vmm_with_vm_provider is not changed
- err_not_vmm_with_vm_provider.msg == "Domain type 'phys' cannot have a 'vm_provider'"
- nm_fc_type is changed
- nm_fc_type.current.0.fcDomP.attributes.dn == "uni/fc-fc_dom"
- nm_fc_type.current.0.fcDomP.children.0.infraRsVlanNs.attributes.tDn == "uni/infra/vlanns-[test_pool]-static"
- nm_fc_type.current.0.infraRsVlanNs.attributes.dn == "uni/fc-fc_dom/rsvlanNs"
- nm_fc_type.current.0.infraRsVlanNs.attributes.tDn == "uni/infra/vlanns-[test_pool]-static"
- nm_l2dom_type is changed
- nm_l2dom_type.current.0.l2extDomP.attributes.dn == "uni/l2dom-l2dom_dom"
- nm_l2dom_type.current.0.l2extDomP.children.0.infraRsVlanNs.attributes.tDn == "uni/infra/vlanns-[test_pool]-dynamic"
- nm_l2dom_type.current.0.infraRsVlanNs.attributes.dn == "uni/l2dom-l2dom_dom/rsvlanNs"
- nm_l2dom_type.current.0.infraRsVlanNs.attributes.tDn == "uni/infra/vlanns-[test_pool]-dynamic"
- nm_l3dom_type is changed
- nm_l3dom_type.current.0.l3extDomP.attributes.dn == "uni/l3dom-l3dom_dom"
- nm_l3dom_type.current.0.l3extDomP.children.0.infraRsVlanNs.attributes.tDn == "uni/infra/vlanns-[test_pool]-dynamic"
- nm_l3dom_type.current.0.infraRsVlanNs.attributes.dn == "uni/l3dom-l3dom_dom/rsvlanNs"
- nm_l3dom_type.current.0.infraRsVlanNs.attributes.tDn == "uni/infra/vlanns-[test_pool]-dynamic"
- nm_vmm_type is changed
- nm_vmm_type.current.0.vmmDomP.attributes.dn == "uni/vmmp-VMware/dom-anstest"
- nm_vmm_type.current.0.vmmDomP.children.0.infraRsVlanNs.attributes.tDn == "uni/infra/vlanns-[test_pool]-dynamic"
- nm_vmm_type.current.0.infraRsVlanNs.attributes.dn == "uni/vmmp-VMware/dom-anstest/rsvlanNs"
- nm_vmm_type.current.0.infraRsVlanNs.attributes.tDn == "uni/infra/vlanns-[test_pool]-dynamic"

# QUERY ALL BINDINGS
- name: Query all domain to VLAN pool bindings (check_mode)
Expand Down Expand Up @@ -214,10 +229,9 @@
- cm_query_binding is not changed
- nm_query_binding is not changed
- cm_query_binding == nm_query_binding
- nm_query_binding.current.0.physDomP.attributes.dn == 'uni/phys-phys_dom'
- nm_query_binding.current.0.physDomP.attributes.name == 'phys_dom'
- nm_query_binding.current.0.physDomP.children.0.infraRsVlanNs.attributes.tCl == 'fvnsVlanInstP'
- nm_query_binding.current.0.physDomP.children.0.infraRsVlanNs.attributes.tDn == 'uni/infra/vlanns-[test_pool]-dynamic'
- nm_query_binding.current.0.infraRsVlanNs.attributes.dn == 'uni/phys-phys_dom/rsvlanNs'
- nm_query_binding.current.0.infraRsVlanNs.attributes.tCl == 'fvnsVlanInstP'
- nm_query_binding.current.0.infraRsVlanNs.attributes.tDn == 'uni/infra/vlanns-[test_pool]-dynamic'


# REMOVE BINDING
Expand All @@ -235,9 +249,8 @@
that:
- cm_remove_binding is changed
- nm_remove_binding is changed
- cm_remove_binding.current.0.physDomP.attributes.dn == cm_remove_binding.previous.0.physDomP.attributes.dn == nm_remove_binding.previous.0.physDomP.attributes.dn == 'uni/phys-phys_dom'
- cm_remove_binding.current.0.physDomP.attributes.name == cm_remove_binding.previous.0.physDomP.attributes.name == nm_remove_binding.previous.0.physDomP.attributes.name == 'phys_dom'
- cm_remove_binding.current.0.physDomP.children.0.infraRsVlanNs.attributes.tDn == cm_remove_binding.previous.0.physDomP.children.0.infraRsVlanNs.attributes.tDn == nm_remove_binding.previous.0.physDomP.children.0.infraRsVlanNs.attributes.tDn == 'uni/infra/vlanns-[test_pool]-dynamic'
- cm_remove_binding.current.0.infraRsVlanNs.attributes.dn == cm_remove_binding.previous.0.infraRsVlanNs.attributes.dn == nm_remove_binding.previous.0.infraRsVlanNs.attributes.dn == 'uni/phys-phys_dom/rsvlanNs'
- cm_remove_binding.current.0.infraRsVlanNs.attributes.tDn == cm_remove_binding.previous.0.infraRsVlanNs.attributes.tDn == nm_remove_binding.previous.0.infraRsVlanNs.attributes.tDn == 'uni/infra/vlanns-[test_pool]-dynamic'
- nm_remove_binding.current == []

- name: Remove domain to VLAN pool binding again (check_mode)
Expand Down
Loading