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

[EPG Static Port] Make VLAN parameter optional when the state is absent (DCNE-300) #607

Open
noppanut15 opened this issue Jan 29, 2025 · 3 comments · May be fixed by #608
Open

[EPG Static Port] Make VLAN parameter optional when the state is absent (DCNE-300) #607

noppanut15 opened this issue Jan 29, 2025 · 3 comments · May be fixed by #608
Labels
enhancement New feature or request jira-sync Sync this issue to Jira

Comments

@noppanut15
Copy link

noppanut15 commented Jan 29, 2025

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

Currently, the vlan parameter is required regardless of the state value. This causes unnecessary constraints and potential errors when the state is set to absent. The vlan parameter should be optional when the state is absent. The current workaround for the users is to put random VLAN numbers to get past the check.

Only pod, leaf and path should be enough to remove the static port.

Steps to Reproduce:

  1. Set the state parameter to absent. (with the existing resource on NDO)
  2. Do not provide a vlan parameter.
  3. Observe the error indicating that the vlan parameter is required.

Option 1: Using static_ports

- name: EPG Static Ports Binding
  hosts: mso
  connection: local
  gather_facts: false
  tasks:
  - name: Remove a static port from a site EPG
    cisco.mso.mso_schema_site_anp_epg_staticport:
      host: "{{ ansible_host }}"
      username: "{{ username }}"
      password: "{{ password }}"
      schema: "noppanut-test-schema-01"
      site: "apic-a"
      template: "noppanut-test-template-01"
      anp: AP1
      epg: EPG-A
      static_ports:
        - pod: pod-1
          leaf: 101
          path: eth1/1
          # vlan: 3003
      deployment_immediacy: immediate
      state: absent 

Option 2: Global config

- name: EPG Static Ports Binding
  hosts: mso
  connection: local
  gather_facts: false
  tasks:
  - name: Remove a static port from a site EPG
    cisco.mso.mso_schema_site_anp_epg_staticport:
      host: "{{ ansible_host }}"
      username: "{{ username }}"
      password: "{{ password }}"
      schema: "noppanut-test-schema-01"
      site: "apic-a"
      template: "noppanut-test-template-01"
      anp: AP1
      epg: EPG-A
      pod: pod-1
      leaf: 101
      path: eth1/1
      # vlan: 3003
      deployment_immediacy: immediate
      state: absent 

Expected Behavior:
When the state is absent, the vlan parameter should not be required, and the code should handle its absence gracefully.

Actual Behavior:
An error is thrown indicating that the vlan parameter is required even when the state is absent.

Proposed Solution:
Update the code to make the vlan parameter optional when the state is absent. Add appropriate checks to handle the absence of the vlan parameter.

Additional Context:
This change will improve the flexibility and usability of the module by removing unnecessary constraints when the state is absent. The user doesn't need to look up the VLAN or put random VLAN IDs.

New or Affected Module(s):

  • mso_schema_site_anp_epg_staticport

Collection versions

  • cisco.mso 2.9.0

References

@noppanut15 noppanut15 added the enhancement New feature or request label Jan 29, 2025
@akinross akinross added the jira-sync Sync this issue to Jira label Jan 29, 2025
@github-actions github-actions bot changed the title [EPG Static Port] Make VLAN parameter optional when the state is absent [EPG Static Port] Make VLAN parameter optional when the state is absent (DCNE-300) Jan 29, 2025
@akinross
Copy link
Collaborator

Hi @noppanut15,

Thank you for raising this issue, I have added it to the backlog.

@noppanut15
Copy link
Author

Hi @akinross ,

I've just submitted a PR regarding this issue as well.

#608

Feel free to check it out and let me know if you need any help from my side. Thank you!

@akinross
Copy link
Collaborator

Hi @noppanut15,

Thank you that is even better, will link the PR to the issue and will place it in the review phase of current sprint.

Kind regards,

Akini

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request jira-sync Sync this issue to Jira
Projects
None yet
2 participants