-
Notifications
You must be signed in to change notification settings - Fork 263
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
Raise an exception if the interface contains a tagged vlan but the mode is not set to tagged #2688
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to also cover the case where an interface is initially tagged mode and has tagged_vlans, then the user changes the mode to untagged but doesn't clear the vlans? More generally, how does this impact the UI flow when creating or editing interfaces?
The |
Isn't that the original problem described by #2253 though? It silently clears and discards |
Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the description of #2253 I would have expected some change to Interface.clean()
and/or Interface.save()
. At the very least it would seem like the logic to remove tagged vlans when changing interface mode should no longer be needed?
Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>
I think this needs to go in the form and serializer validation since |
6877fca
to
7a95659
Compare
Because the UI clears values in the |
if self.tagged_vlans.exists() and self.mode != InterfaceModeChoices.MODE_TAGGED: | ||
raise ValidationError({"tagged_vlans": f"Clear tagged_vlans to set mode to {self.mode}"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this make the self.tagged_vlans.clear()
in save()
below now redundant? Should it be removed?
Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>
Hi After implementing this fix, I'm unable to change an interface from mode 'tagged' with assigned vlans to mode 'access' in one api call (e.g. via pynautobot). I have to remove all the vlans from the interface in the first api call, save it and then change the mode to untagged and save it again. The same issue occurs in the nautobot gui. Is this an expected behaviour? Thanks |
Doesn't sound like expected behavior to me! @timizuoebideri1 can you please look into this? |
Closes: #2253
What's Changed
TODO