Skip to content

fix: special cases for ip network defaulting #81

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

Merged
merged 2 commits into from
Apr 13, 2025

Conversation

ltucker
Copy link

@ltucker ltucker commented Apr 13, 2025

ip address fields and ip network fields have special defaulting in place that makes them appear to differ.
eg if 192.168.1.1 is specified in an ip address field, it will be stored (and the prior value will appear as) 192.168.1.1/32 this add some special handling to use the defaulted network when comparing.

secondarily, this uses special matchers for ip address that ignore the mask given on the address. This is the actual uniqueness check that is performed during the model validation.

this also resolves an issue rendering the prior state of an ipaddress which cannot directly be json serialized since it is sent back as an instance of netddr.IPNetwork

Copy link

github-actions bot commented Apr 13, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
2535 2323 92% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
netbox_diode_plugin/api/common.py 86% 🟢
netbox_diode_plugin/api/differ.py 90% 🟢
netbox_diode_plugin/api/matcher.py 82% 🟢
netbox_diode_plugin/api/plugin_utils.py 82% 🟢
netbox_diode_plugin/tests/test_api_diff_and_apply.py 100% 🟢
TOTAL 88% 🟢

updated for commit: fe5841e by action🐍

@ltucker ltucker merged commit 9b01b3e into feat-diode-data-plugin Apr 13, 2025
3 checks passed
@ltucker ltucker deleted the fix_ip_network_default branch April 13, 2025 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants