ansible-collections / cisco.nxos

Ansible Network Collection for Cisco NXOS
GNU General Public License v3.0
115 stars 109 forks source link

[nxapi] Add `vrf` option to `nxos_nxapi` module #877

Open Miyoshi-Ryota opened 1 month ago

Miyoshi-Ryota commented 1 month ago
SUMMARY

Add vrf option to nxos_nxapi module.

Comments on the design:

It's an old module with only state: present / absent. As far as I can see, when state: present is specified, it does not change parameters that are not mentioned. For example, if the nxapi sandbox command is already present on the device but the sandbox parameter is not specified in the playbook, it results that no deletion or other actions are taken.

Therefore, the vrf option follows this design.

Not applying the nxapi use-vrf command at all means enabling nxapi for all VRFs. However, in my implementation of this module, there is currently no way to remove an already applied nxapi use-vrf configuration at all. This is because while it is possible to specify another VRF, but there is no way to reflect the absence of a parameter. This aligns with the aforementioned behavior of state: present where nothing is done if a parameter is not specified.

This implementation method was chosen to maintain consistency within the module, avoid disrupting environments using the existing nxos_nxapi module, and keep the parameters simple.

Other possible approaches:

If you prefer to select one of other two approaches I mentioned, or an entirely different approach, please let me know. I am willing to make adjustments accordingly.

Reference for the supported versions of use-vrf:
ISSUE TYPE
COMPONENT NAME

nxos_nxapi_module

ADDITIONAL INFORMATION
Miyoshi-Ryota commented 1 month ago

It's a WIP. I will test this change for real device.

Miyoshi-Ryota commented 1 month ago

All my work is completed and it is ready for review.

Since Version class bug also affects the functionality I want to add this time, I have made the corrections within the same PR. However, if it needs to be split into two separate PRs, please let me know. https://github.com/ansible-collections/cisco.nxos/pull/877/commits/3cb4fef5bb939c584aef49db8774c5f9d4a47f24