Open hashi825 opened 1 month ago
hi @hashi825, Results shown above mentions about the error i.e. the port cannot be used because it is currently the home port or the current port of a LIF. Can you please refer to the below KB and try running this module again? https://kb.netapp.com/on-prem/ontap/OHW/OHW-KBs/Unable_to__add_a_port_to_broadcast_domain
hi @hashi825, Results shown above mentions about the error i.e. the port cannot be used because it is currently the home port or the current port of a LIF. Can you please refer to the below KB and try running this module again? https://kb.netapp.com/on-prem/ontap/OHW/OHW-KBs/Unable_to__add_a_port_to_broadcast_domain
Hey @csahu1 thats not the issue, the module is attempting to remove existing ports in the broadcast domain instead of adding the missing ports. I've pointed the problem out in the code. This doesn't happen when using the module in ZAPI as the ZAPI call in this situation would add ports where as the REST function uses a PATCH request which would run on the existing ports in the list resulting in attempting to remove the ports.
Summary
When providing a broadcast domain that already contains existing ports and requires adding new ports, using REST will add ALL ports to the REST Patch request due to this statement which prevents actually only returning the ports to add https://github.com/ansible-collections/netapp.ontap/blob/78486a16018f1c3f1d8cf133f6f4b0b39ba4bcb9/plugins/modules/na_ontap_broadcast_domain.py#L586-L599
https://github.com/ansible-collections/netapp.ontap/blob/78486a16018f1c3f1d8cf133f6f4b0b39ba4bcb9/plugins/modules/na_ontap_broadcast_domain.py#L466-L474
ports_to_add
provides the correct list of ports to addget_ports_rest
then checksself.desired_ports
which contains all ports found from theports
parameter of the module. This causes the module to send a patch request toapi/network/ethernet/ports
that essentially removes/readds ports that were already in the broadcast domain.Removing the if statement seems to provide the desired behaviour.
Component Name
na_ontap_broadcast_domain
Ansible Version
ONTAP Collection Version
ONTAP Version
Playbook
Steps to Reproduce
Expected Results
Expected that module will only add MISSING broadcast domain ports and not try and PATCH existing ports.
Actual Results