Fixed an issue where idempotency was not maintained due to discrepancies in the notation of IP prefixes. By introducing the ipaddress module to standardize prefixes, we ensure that the playbook and running-config prefixes are compared accurately, preventing unnecessary configuration changes.
For example, previously, a playbook specifying prefix: ::0/ and a running-config showing ipv6 prefix-list plist1 seq 10 permit 0::/0, or a playbook specifying prefix: 10.0.0.8/24 and a running-config showing ip prefix-list plist2 seq 10 permit 10.0.0.0/24, would result in unnecessary changes. With this update, such discrepancies are handled, maintaining idempotency and ensuring existing configurations are not repeatedly deleted and re-added.
Supplementary Information:
The notation you enter in configure terminal and the notation in the show run output may differ on Nexus devices. Therefore, a simple text comparison could break idempotency.
An example is shown below.
# conf t
(config)# ipv6 prefix-list plist1 seq 10 permit ::/0
(config)# ip prefix-list plist2 seq 10 permit 10.0.0.8/24
(config)# exit
# show run | inc plist
ip prefix-list plist2 seq 10 permit 10.0.0.0/24
ipv6 prefix-list plist1 seq 10 permit 0::/0
ISSUE TYPE
Bugfix Pull Request
COMPONENT NAME
nxos_prefix_lists
ADDITIONAL INFORMATION
Before this change, when I executed the playbook below multiple times, the result would always be changed, and plist1 would be deleted and added each time.
SUMMARY
Fixed an issue where idempotency was not maintained due to discrepancies in the notation of IP prefixes. By introducing the
ipaddress
module to standardize prefixes, we ensure that the playbook and running-config prefixes are compared accurately, preventing unnecessary configuration changes.For example, previously, a playbook specifying
prefix: ::0/
and a running-config showingipv6 prefix-list plist1 seq 10 permit 0::/0
, or a playbook specifyingprefix: 10.0.0.8/24
and a running-config showingip prefix-list plist2 seq 10 permit 10.0.0.0/24
, would result in unnecessary changes. With this update, such discrepancies are handled, maintaining idempotency and ensuring existing configurations are not repeatedly deleted and re-added.Supplementary Information: The notation you enter in configure terminal and the notation in the
show run
output may differ on Nexus devices. Therefore, a simple text comparison could break idempotency.An example is shown below.
ISSUE TYPE
COMPONENT NAME
nxos_prefix_lists
ADDITIONAL INFORMATION
Before this change, when I executed the playbook below multiple times, the result would always be changed, and plist1 would be deleted and added each time.