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

Support using long interface names with IPFabric #309

Merged
merged 4 commits into from Jan 4, 2024

Conversation

jmcgill298
Copy link
Contributor

No description provided.

@jmcgill298 jmcgill298 requested review from alhogan and a team as code owners December 19, 2023 19:17
@jmcgill298 jmcgill298 linked an issue Dec 19, 2023 that may be closed by this pull request
@@ -83,3 +83,28 @@ def test_data_loading(self):
self.assertTrue(hasattr(interface, "ip_address"))
self.assertTrue(hasattr(interface, "subnet_mask"))
self.assertTrue(hasattr(interface, "type"))

@patch("nautobot_ssot.integrations.ipfabric.diffsync.adapter_ipfabric.IP_FABRIC_ELONGATE_INTERFACE_NAME", True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not requiring to swap out but would be good to patch the setting instead of the constant. Should be the same net effect. TBH how we do constants for plugin config kinda negates the lazy loading part of Django settings BUT that pattern is everywhere and we don't document or expect users to relying on lazy loading

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya, I'm not a fan either, but following convention. As for patching the setting, as far as I know, I would have to patch all of nautobot_ssot settings, which seems a bit excessive; is there another solution?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it's a patch of all plugin config but all tests should run against the default config so if you pass in just the one toggle that's all that changed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently tests are being impacted by the settings in PLUGINS_CONFIG so it might be necessary to patch the specific setting. We are planning on addressing that issue in the near future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should fix the tests to be in a state that do not have to have the settings changed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree and it's on the todo list.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree on this one, this is testing a setting change so it should be tested from the PLUGIN_CONFIG side. Intercepting the constant definition could mask an improperly defined plugin config in the NautobotAppConfig.

I am okay resolving this item, whatever we do in the future should test making the setting change in nautobot config and not patching elsewhere. Django lazy loading + default values for plugin config + patching the constant that pulls out a value from plugin config could be a false sense of coverage. I would vote this is a feature request into the nautobot testing framework.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, this is testing whatever the value of the constant is since that is what is imported/used. There should be a separate set of tests for constants.py that tests the constants are set correctly

@whitej6 whitej6 force-pushed the jacobm/ipfabric/elongate-interface-names branch from 1281bf9 to 2ecb5ca Compare December 22, 2023 20:32
@jmcgill298 jmcgill298 force-pushed the jacobm/ipfabric/elongate-interface-names branch 2 times, most recently from eaadc6d to 4b0d3ac Compare December 22, 2023 21:40
@jmcgill298 jmcgill298 force-pushed the jacobm/ipfabric/elongate-interface-names branch from 4b0d3ac to 257210b Compare December 22, 2023 23:35
@jmcgill298 jmcgill298 force-pushed the jacobm/ipfabric/elongate-interface-names branch from c749641 to 9da16ff Compare January 2, 2024 22:31
Copy link
Contributor

@jdrew82 jdrew82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jdrew82 jdrew82 merged commit 7ae2223 into develop Jan 4, 2024
15 checks passed
@jdrew82 jdrew82 deleted the jacobm/ipfabric/elongate-interface-names branch January 4, 2024 20:26
@jdrew82 jdrew82 mentioned this pull request Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use full names on interfaces with ipfabric
5 participants