mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-11 21:10:29 +01:00
Patching front port to virtual chassis member interface is broken in UI #7503
Closed
opened 2025-12-29 20:24:21 +01:00 by adam
·
29 comments
No Branch/Tag Specified
main
update-changelog-comments-docs
feature-removal-issue-type
20911-dropdown
20239-plugin-menu-classes-mutable-state
21097-graphql-id-lookups
feature
fix_module_substitution
20923-dcim-templates
20044-elevation-stuck-lightmode
feature-ip-prefix-link
v4.5-beta1-release
20068-import-moduletype-attrs
20766-fix-german-translation-code-literals
20378-del-script
7604-filter-modifiers-v3
circuit-swap
12318-case-insensitive-uniqueness
20637-improve-device-q-filter
20660-script-load
19724-graphql
20614-update-ruff
14884-script
02496-max-page
19720-macaddress-interface-generic-relation
19408-circuit-terminations-export-templates
20203-openapi-check
fix-19669-api-image-download
7604-filter-modifiers
19275-fixes-interface-bulk-edit
fix-17794-get_field_value_return_list
11507-show-aggregate-and-rir-on-api
9583-add_column_specific_search_field_to_tables
v4.5.0
v4.4.10
v4.4.9
v4.5.0-beta1
v4.4.8
v4.4.7
v4.4.6
v4.4.5
v4.4.4
v4.4.3
v4.4.2
v4.4.1
v4.4.0
v4.3.7
v4.4.0-beta1
v4.3.6
v4.3.5
v4.3.4
v4.3.3
v4.3.2
v4.3.1
v4.3.0
v4.2.9
v4.3.0-beta2
v4.2.8
v4.3.0-beta1
v4.2.7
v4.2.6
v4.2.5
v4.2.4
v4.2.3
v4.2.2
v4.2.1
v4.2.0
v4.1.11
v4.1.10
v4.1.9
v4.1.8
v4.2-beta1
v4.1.7
v4.1.6
v4.1.5
v4.1.4
v4.1.3
v4.1.2
v4.1.1
v4.1.0
v4.0.11
v4.0.10
v4.0.9
v4.1-beta1
v4.0.8
v4.0.7
v4.0.6
v4.0.5
v4.0.3
v4.0.2
v4.0.1
v4.0.0
v3.7.8
v3.7.7
v4.0-beta2
v3.7.6
v3.7.5
v4.0-beta1
v3.7.4
v3.7.3
v3.7.2
v3.7.1
v3.7.0
v3.6.9
v3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-r1
v1.0.3
1.0.0
Labels
Clear labels
beta
breaking change
complexity: high
complexity: low
complexity: medium
needs milestone
netbox
pending closure
plugin candidate
pull-request
severity: high
severity: low
severity: medium
status: accepted
status: backlog
status: blocked
status: duplicate
status: needs owner
status: needs triage
status: revisions needed
status: under review
topic: GraphQL
topic: Internationalization
topic: OpenAPI
topic: UI/UX
topic: cabling
topic: event rules
topic: htmx navigation
topic: industrialization
topic: migrations
topic: plugins
topic: scripts
topic: templating
topic: testing
type: bug
type: deprecation
type: documentation
type: feature
type: housekeeping
type: translation
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/netbox#7503
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @cs-1 on GitHub (Jan 12, 2023).
Originally assigned to: @DanSheps on GitHub.
NetBox version
v3.4.2
Python version
3.8
Steps to Reproduce
Expected Behavior
The cable should be attached between front port and VC member's interface. Only the interfaces of selected VC member are shown.
Observed Behavior
The interface selection always show all interfaces of all VC members even if selected VC member is no master. This can lead to confusion because you don't expect to see other VC members' interfaces.
We've made the following observations.
I believe that this is an UI issue. My guess is that in
/dcim/cables/add, the Interface selector always displays VC member 1's interfaces instead the actual selected VC member.@DanSheps commented on GitHub (Jan 20, 2023):
So what is happening is we are actually getting all interfaces from the VC when querying this method (if you search for chassis specific interfaces, you will see them). I will need to confirm that this is the intended result, I don't believe so though.
@cs-1 commented on GitHub (Jan 23, 2023):
Hi Dan! The behaviour was different in earlier versions. Regarding the intended result: the observed behaviour would be correct for a master chassis where all interfaces of members of the same VC should be listed. For non-master chassis it should only list the interfaces of that particular chassis. (We don't use the master chassis functionality in our scenario.)
@cs-1 commented on GitHub (Jan 23, 2023):
Quick P.S.: the problem also exists in v3.4.3.
@lp-2 commented on GitHub (Jan 30, 2023):
hi @DanSheps
Could you please tell me the exact path in the source code where the problem is located? I would like to try to fix it.
Thanks in advance
@kkthxbye-code commented on GitHub (Feb 8, 2023):
Seems to be caused by: https://github.com/netbox-community/netbox/pull/10743
Changing the API to always return all VC interfaces when filtering on device id seems like an error, though I get why it was needed for LAG assignment. Not sure what the correct solution is here. Reverting the change would break LAG assignment again I assume.
@cs-1 commented on GitHub (Feb 13, 2023):
The change definitely breaks what used to work in the UI. Does it make sense to discuss this with @jeremystretch ? @lp-2 is currently trying to figure out a solution but we probably don't have enough insight into the design of NetBox to tell whether our proposed solution is acceptable (if we find one, that is).
@kkthxbye-code commented on GitHub (Feb 13, 2023):
@cs-1 - A couple of things:
This is not the case for me. When attaching the cable, all interfaces show up but it's still possible to attach them to the right device, it's just impossible to know which device is which if the interfaces are named the same.
I guess one option is to:
Wether this makes sense in a modelling sense I can't tell you, I know next to nothing about VC's.
@cs-1 commented on GitHub (Feb 13, 2023):
Yes, same here. But that's exactly the problem. In VC scenarios, interface numbers "y" can be the same on each individual VC member. Only the VC chassis position "x" gives your an identification "x/y" of an interface. There's typically no need to add "x" to each chassis member's interface name, it's redundant information and it also makes using "Device Type" templating difficult to use because in these templates, interfaces are numerated as if not part of a VC (y = 1..48).
These two options sound reasonable. I tend to think that refixing the LAG select field issue is the most plausible solution. It's not logical to get all interfaces of all VC members when querying only a single, non-master VC member.
@kkthxbye-code commented on GitHub (Feb 13, 2023):
I understand the issue, just wanted to clarify that what I quoted from the original issue wasn't correct, as it makes it seem like regardless of which interface you pick it is always connected to the lowest index VC member. If you don't mind, please update the issue text for posterity.
I agree, and I'm sure it was unintended, and thus a bug. Let me know if you want to try to contribute a fix yourself :)
@cs-1 commented on GitHub (Feb 13, 2023):
Oops! Yes, I'll fix the description. Sorry for the confusion.
Yes, that's what we try to figure out whether we can help to fix it. @lp-2 is currently looking into the code.
@lp-2 commented on GitHub (Feb 16, 2023):
I looked at the code in the /dcim/filtersets.py file. In the filter_device_id function, you could add an optional passing parameter that sets the filter if_master to true for the virtual chassis and false for the LAG setting,
but I couldn't find a call to this function, as it seems to be abstracted away by MultiValueNumberFilter.
@kkthxbye-code commented on GitHub (Feb 16, 2023):
The filterset doesn't really know if it's being used by the cable form or the interface form, as the fields are DynamicModelChoiceFields which just call the API to get the data. As I said the solution is probably to add a toggle to the interface API signifying if LAG members should be included for non-master members and then the new toggle could be added to query_params for the lag field of the InterfaceForm.
@cs-1 commented on GitHub (Feb 16, 2023):
We'd like to help solve this but our Django knowledge is still a little limited. Could you be so kind to point us to the InterfaceForm that you speak of? The idea you mention is what we have in mind but we simply don't seem to find the right "entry point" in the code where to implement it. :) Thanks for your patience, we're slowly but surely getting the hang of it. :)
@kkthxbye-code commented on GitHub (Feb 16, 2023):
This is the problematic lag field on the InterfaceForm:
https://github.com/netbox-community/netbox/blob/develop/netbox/dcim/forms/model_forms.py#L1353-L1361
You can pass API parameters to the query_params dict. Not sure of the best way to modify the filter/api though.
@cs-1 commented on GitHub (Feb 16, 2023):
Thanks for the pointer. We looked at the code and we can say for sure that the patch in https://github.com/netbox-community/netbox/pull/10743 needs to be reverted because of its side-effects. We're currently trying to figure out how to modify the queryset / query_params to get all cross-VC interfaces in case a device is part of a VC. But we're pretty sure that modifying
3150c1f8b3/netbox/dcim/filtersets.py (L1452)withif_master=Falseis not the correct way to do this.@DanSheps commented on GitHub (Feb 17, 2023):
Not sure what platform you are using, but on Cisco, switch(or fex or whatever)/slot/interface are all critical to proper interface naming and you shouldn't be skipping on them. Yes, you have to rename them after, but you could easily handle that with a plugin that functions on a trigger or something and a bulk rename is not difficult. Not sure what other platforms do, TBH, but I imagine they are similar in that it is a integral part of the name.
Now, if you are using VC for it's non-intended purpose (MC-LAG, VPC, etc), then that is, unfortunately not something we can account for.
@cs-1 commented on GitHub (Feb 20, 2023):
We don't use VC in a non-intended purpose, see below. What I'm saying is that the patch in https://github.com/netbox-community/netbox/pull/10743 renders the purpose of a master chassis in a VC obsolete because it will turn every chassis into a master chassis when using the
filter_device_id()function. That clearly doesn't make sense and it has side effects for every part of NetBox wherefilter_device_id()is called. Inmodel_forms.pyfor example, it makes no sense: when attaching a cable, NetBox lets you select a specific device so that NetBox's UI only shows you interfaces on that particular device. With the current patch forfilter_device_id(), every interface of a VC is listed instead of only the interface of the selected device (which may be part of a VC). So https://github.com/netbox-community/netbox/pull/10743 breaks the selection of a single device in the UI. This was not the behaviour of the UI before the patch was introduced. This has nothing to do with interface naming in VCs. It's only about breaking the UI when adding a cable (and maybe other places wherefilter_device_id()is used which we haven't found yet). Note that @arthanson himself says in in https://github.com/netbox-community/netbox/pull/10743 that he doesn't know if the patch may have side effects.RE: VCs (though this is independent of what's stated above): we do use the VC function as intended. We chose not to make a chassis a master chassis in NetBox because our configuration management will look at every member of a VC to determine the interface configuration to use. The "x/y" notation of an interface is derived from x = position number of VC member in NetBox / y = interface number (as it is done by most switch vendors; x will change when changing the position of a chassis in a stack which is analogue to changing the VC position of a chassis in NetBox). I don't see how that is a problem. We don't use MC-LAG or VPC in that context. That way we don't need to do any interface renaming and can simply use Device Types without changes. I can't find NetBox documentation that states that this is an unintended approach. Using a master chassis and the functionality that comes with it is clearly optional in the docs.
@cs-1 commented on GitHub (Mar 7, 2023):
@kkthxbye-code sorry for the confusion in https://github.com/netbox-community/netbox/issues/11838
My main concern was that changing the filterset may have unintended effects elsewhere, not only in this cable adding UI issue. I'll patiently wait for the UI issue to be fixed. We tried to fix the cable UI issue ourself but found no other way than to revert the filterset.py patch and to patch the LAG issue in model_forms.py rather than changing the UI for adding cables. However, we're not familiar enough with the code yet to find a good fix. Sorry for the fuss, wasn't my intention.
@amk1969 commented on GitHub (Mar 20, 2023):
This bug is leading to unexpected outcomes in the API as well as GUI. Compare results of
https://demo.netbox.dev/dcim/interfaces/?device=mysampledevice2 and
https://demo.netbox.dev/dcim/interfaces/?device_id=110
The proposal from kkthxbye-code appears very reasonable. Allow an additional parameter to the query where the caller can specify whether all interfaces of the virtual-chassis or of the member only should be returned. Defaulting to True on the master and False on the rest. Challenge comes when not specified and devices from different VCs are requested but then it can return 400 error for "ambiguous query".
LAG selection or other GUI/API use cases can select what is appropriate for them.
@AnythingOverIP commented on GitHub (Mar 20, 2023):
I understand that one day it was decided to go a different path, but to me, all this would have been easier to deal with if the complete listing of interfaces would happen on the VC instead of the master member.
In our use case, I have to model a device without any physical interfaces (including power) to represent the stack/VC. This non-racked "device" contains only the virtual interfaces (VLAN interfaces, loopbacks, lags, etc) of the stack. Then I add the physical members to the stack and rack them. This way, each member only holds their physical interfaces. Ideally, the information I put in the device I create first to represent the stack would lie under the VC.
Putting all interfaces under the master member of VC is like mixing the concept of virtual and physical device.
Not sure if it would be too much of a breaking change to consider this again...
@troeger commented on GitHub (Mar 21, 2023):
@thefreakquency Totally agreed, here is my argument for having interface listings on virtual chassis ...
https://github.com/netbox-community/netbox/discussions/10953#discussioncomment-4935174
@cs-1 commented on GitHub (Mar 21, 2023):
@thefreakquency Yes, that's the reason why we completely avoid using the "master chassis" option in NetBox because it's no logical that a physical chassis seems to have more interfaces than it actually has. Not using the master chassis option may create other problems but for us that approach works. @troeger I agree what you write in the comment that you linked to. That being said, I think it would be a good idea to start a discussion on the Discussions page. My hope still is that the patch that causes unwanted side effects (on top of the UI issues described here) will be reverted.
@DanSheps commented on GitHub (Mar 30, 2023):
Put in a FR for this, this somewhat makes sense but we still need to include master interfaces for lags and other devices in the API queries so this likely won't solve the problem you are seeking to resolve.
I understand you have a specific use case, however from your description you are likely, for lack of a better word, abusing how the virtual chassis and devices are suppose to be used.
This isn't going to happen. As mentioned, it needs to be properly resolved and not just reverted to the previous bad state.
Personally, my view is this:
All members queried should return all members of the stack no matter which member you are quering as this is how it behaves in real life with a shared management and control plane, which is what VirtualChassis is for.
In an instance where there is separate management and control, you should not be using VirtualChassis.
@AnythingOverIP commented on GitHub (Mar 30, 2023):
@DanSheps Having all interfaces under each members would be a really good idea, as long we are able to have a management IP on the VC. Stacked switches or firewalls can have both separate & shared management.
In an ideal world full of unicorns, the VC should represent the virtual instance of that switch, which has management. A few more items would be also needed to represent the non-physical characteristics of a stack/cluster, like:
This would replicate real-life scenario where you document & manage both the physical device (Rack, serial number, interfaces and anything tangible), and the virtual stack (Configuration, management, etc...). Each physical device could have it's own primary management IP, as it is sometime possible to manage each member individually, while having a Stack management IP).
This is not technically a separate management and control per se. They share the control plane as they are aggregated in one logical instance (VC), but have separate physical characteristics.
As an example, in Juniper world, each physical management IP would likely be on me0 or fxp0 of each device, and the shared management would be on vme0. In Fortinet, you would assign an IP to mgmt port of each device, while having a cluster management IP.
@DanSheps commented on GitHub (Apr 13, 2023):
Can you give me an example of this? I have never met a stacked switch that has a separate MP. I have also never met a stacked firewall.
@DanSheps commented on GitHub (Jun 19, 2023):
If we changed the serializer to provide the device name as part of the interface lookup, would that suffice for most people?
@cs-1 commented on GitHub (Jun 20, 2023):
Yes, that would be a very useful and a good solution.
@DanSheps commented on GitHub (Jul 27, 2023):
After discussion in the maintainers meeting, we are going to shift the direction:
@jeremystretch commented on GitHub (Aug 30, 2023):
Because this results in a breaking change to the
deviceanddevice_idfilters for interfaces, it's being introduced in NetBox v3.6.0. Thevirtual_chassis_memberandvirtual_chassis_member_idfilters introduced in PR #13296 can be used to replicate the previous behavior.