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

aci_domain_to_vlan_pool "absent" state removes the whole domain and not only the binding (DCNE-207) #694

Open
edudppaz opened this issue Oct 15, 2024 · 2 comments
Labels
bug Something isn't working jira-sync Sync this issue to Jira

Comments

@edudppaz
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Setting state "absent" on a aci_domain_to_vlan_pool task removes the whole domain and not only the binding to the vlan pool

Affected Module Name(s):

  • aci_domain_to_vlan_pool

APIC version and APIC Platform

  • V 5.2(8e) and on-prem.

Collection versions

  • cisco.aci 2.10.1

Output/ Error message

Expected Behavior

  • Setting an "absent" state on the task should only remove the vlan_pool to domain binding, not the whole domain

Actual Behavior

  • The whole domain is removed from the APIC

Playbook tasks to Reproduce

First:

- name: Bind a physical domain to VLAN pool
  cisco.aci.aci_domain_to_vlan_pool:
    host: apic
    username: admin
    password: SomeSecretPassword
    domain: phys_dom
    domain_type: phys
    pool: phys_pool
    pool_allocation_mode: static
    state: present
  delegate_to: localhost

Then:

- name: Remove binding from physical domain to VLAN pool
cisco.aci.aci_domain_to_vlan_pool:
  host: apic
  username: admin
  password: SomeSecretPassword
  domain: phys_dom
  domain_type: phys
  pool: phys_pool
  pool_allocation_mode: static
  state: absent
delegate_to: localhost

Important Factoids

From the code i can see that on the module, the url endpoint is being build using the whole domain as an object:

    aci.construct_url(
        root_class=dict(
            aci_class=domain_class,
            aci_rn=domain_rn,
            module_object=domain_mo,
            target_filter={"name": domain},
        ),
        child_classes=["infraRsVlanNs"],
    )

So it makes sense that setting "absent" and running aci.delete_config() deletes the whole domain
The state absent should be a new payload that removes the binding, something like this (just writing it on the fly, must be checked and tested:

    elif state == "absent":
        aci.payload(
            aci_class=domain_class,
            class_config=dict(name=domain),
            child_configs=[
                {"infraRsVlanNs": {"status": "deleted" }},
            ],
        )
        aci.post_config()

This is based on a test done directly on the GUI with the API inspector:

method: POST
url: https://10.10.10.10/api/node/mo/uni/phys-phydom_ep_test/rsvlanNs.json
payload{"infraRsVlanNs":{"attributes":{"dn":"uni/phys-phydom_ep_test/rsvlanNs","status":"deleted"},"children":[]}}

References

  • #0000
@edudppaz edudppaz added the bug Something isn't working label Oct 15, 2024
@akinross akinross added the jira-sync Sync this issue to Jira label Oct 15, 2024
@github-actions github-actions bot changed the title aci_domain_to_vlan_pool "absent" state removes the whole domain and not only the binding aci_domain_to_vlan_pool "absent" state removes the whole domain and not only the binding (DCNE-207) Oct 15, 2024
@akinross
Copy link
Collaborator

Hi @edudppaz,

Thank you for raising this issue, I have added it to the backlog. If you would like to work on it yourself and push a PR please let me know.

@edudppaz
Copy link
Contributor Author

Hi @akinross , i have created this pr #695 , tested on my local environment and seems to be working as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working jira-sync Sync this issue to Jira
Projects
None yet
Development

No branches or pull requests

2 participants