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

Closes: #7854 - Add VDC/Instances/etc #10787

Merged
merged 46 commits into from
Nov 11, 2022
Merged

Closes: #7854 - Add VDC/Instances/etc #10787

merged 46 commits into from
Nov 11, 2022

Conversation

DanSheps
Copy link
Member

Closes: #7854

This PR adds VDC/Instance/etc support to NetBox

  • Adds VDC Model
  • Adds vdc M2M field on Interfaces
  • Adds vdc_type field to device_type

Not stuck on the names, could be renamed "VirtualDeviceInstance" easily enough to be more encompassing and less Ciscoy

@DanSheps DanSheps changed the title Closes: #7854 - Add Closes: #7854 - Add VDC/Instances/etc Oct 28, 2022
@DanSheps DanSheps linked an issue Oct 31, 2022 that may be closed by this pull request
@jeremystretch jeremystretch added the beta Concerns a bug/feature in a beta release label Oct 31, 2022
netbox/dcim/models/devices.py Outdated Show resolved Hide resolved
netbox/dcim/models/devices.py Show resolved Hide resolved
netbox/dcim/models/devices.py Outdated Show resolved Hide resolved
netbox/dcim/choices.py Outdated Show resolved Hide resolved
netbox/dcim/signals.py Outdated Show resolved Hide resolved
@jeremystretch
Copy link
Member

As noted in #7854, some VDC implementations permit the assignment of an interface to multiple VDCs whereas others do not. This might be something we want to track per VDC instance as a configurable attribute.

@DanSheps
Copy link
Member Author

DanSheps commented Nov 1, 2022

As noted in #7854, some VDC implementations permit the assignment of an interface to multiple VDCs whereas others do not. This might be something we want to track per VDC instance as a configurable attribute.

I can see a couple of options for tracking this, by a atribute on:

  1. Device Type
  2. Device
  3. VDC
  4. Interface
  5. Interface.vdcs.through

For DeviceType, I think this makes the most sense. It allows you to define your Device as allowing interface sharing. Device seems like an awkward place to track this type of setting. VDC, typically either the platform (Nexus 7700 for example, which doesn't) allows VDC interface sharing or not. Interface, I think would be a great place for a "Shared Interface" checkbox but I don't think it would make sense to use this to track whether the platform allows sharing. Similar to "Device", I don't think the through model is the best place to track this

I think a combination of "Can interface share" on the device type and a "Shared inteface" attribute on the Interface is the best way go. We could infer whether it is a shared interface too, just based on how many VDC's are assigned (>1 == Shared), but there could be a case where the interface is set to allow sharing but currently only one device context is created.

Thoughts?

@jeremystretch
Copy link
Member

I think we should avoid over-rotating on this, and just stick with permitting the assignment of an interface to multiple VDCs. If there's a strong need for some conditional logic there, I'm sure we'll hear of it during the beta evaluation.

@jeremystretch jeremystretch marked this pull request as ready for review November 10, 2022 14:09
netbox/dcim/models/devices.py Outdated Show resolved Hide resolved
netbox/dcim/models/devices.py Outdated Show resolved Hide resolved
netbox/dcim/signals.py Outdated Show resolved Hide resolved
netbox/netbox/navigation/menu.py Outdated Show resolved Hide resolved
netbox/dcim/models/devices.py Show resolved Hide resolved
netbox/dcim/tests/test_models.py Outdated Show resolved Hide resolved
netbox/dcim/tests/test_views.py Outdated Show resolved Hide resolved
netbox/dcim/tests/test_views.py Outdated Show resolved Hide resolved
netbox/dcim/views.py Outdated Show resolved Hide resolved
netbox/templates/dcim/virtualdevicecontext.html Outdated Show resolved Hide resolved
@DanSheps
Copy link
Member Author

DanSheps commented Nov 10, 2022

Once thing I thought of... We may have a situation now where an interface needs to be created in a VDC but is not shared, we might need to investigate the uniqueness parameters for interfaces now and add VDC when VDC is not null as a uniqueness component.

You might have:

Vlan293 and Vlan294 in VDC 1, Vlan293 and Vlan295 in VDC 2 with Vlan293 being unique to the VDC's themselves. This would result in two Vlan293's on the device, but they are only contained within the VDC.

Thoughts @jeremystretch?

@jeremystretch
Copy link
Member

Interfaces simply need to have unique names per device/VM; no way around that, and I think that's a reasonable limitation.

netbox/dcim/forms/bulk_edit.py Show resolved Hide resolved
netbox/dcim/tables/devices.py Outdated Show resolved Hide resolved
netbox/dcim/tests/test_filtersets.py Outdated Show resolved Hide resolved
Copy link
Member

@jeremystretch jeremystretch left a comment

Choose a reason for hiding this comment

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

Great work, thanks @DanSheps!

@jeremystretch jeremystretch merged commit b374351 into feature Nov 11, 2022
@jeremystretch jeremystretch deleted the 7854-vdc branch November 11, 2022 12:55
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
beta Concerns a bug/feature in a beta release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Virtual Device Context
2 participants