nautobot icon indicating copy to clipboard operation
nautobot copied to clipboard

Add API calls for VLAN groups available-vlans functionality

Open jasonjuenger opened this issue 3 years ago • 2 comments

Environment

  • Python version: 3.8.8
  • Nautobot version: 1.2.5

Proposed Functionality

The VLAN Groups page show the available VLANs within a specific VLAN group. Clicking on the "# VLANs available" link brings the user to a new page to reserve the next available VLAN from that range. This functionality should be exposed via API to allow for automated VLAN assignment.

This functionality has been implemented in Netbox #2658 with an additional enhancement to add scoping for min/max VLAN IDs in #8168.

Use Case

As a Nautobot user, I would like to programmatically assign VLANs to new tenant buildouts using a single API call so that I can avoid race conditions querying then reserving VLANs when multiple workflows are reserving VLANs at the same time.

Database Changes

New method is required in VLANGroup model to get available VLANs. To implement the min/max VLAN ID scoping two new fields are required in the VLANGroup model, min_vid and max_vid.

External Dependencies

None

jasonjuenger avatar Feb 15 '22 19:02 jasonjuenger

Thanks for the submission. The NetBox feature solves the problem, however we would likely do it in a slightly different way by implementing the nested endpoint as a viewset method (e.g. VLANGroupViewSet.available_vlans) so that we can reduce code duplication.

jathanism avatar Mar 08 '22 20:03 jathanism

This would be a great feature to have, a min/max VLAN ID, so we can programmatically get the next available VLAN ID

joaopsys avatar Jul 26 '22 13:07 joaopsys

Is this on the roadmap for any upcoming releases? Would love to see this feature, I'd happily pay a bounty if that would help?

foxx avatar Aug 20 '22 22:08 foxx

I would also love this feature to be able to automate vlan assignments!

Senetus avatar Dec 30 '22 10:12 Senetus

The company I work for could use this feature very much. It is one of the points of debate about choosing Nautobot VS Netbox. Being able to limit the available vlans in a group without actually reserving all vlans would be useful.

In our case we have several vlan groups within a layer 2 domain. All groups together on a "site" form all vlans in the l2 domain (if that makes sense). (in our case that is, a site equals a routing edge for us.)

martijn-gr avatar Feb 23 '23 07:02 martijn-gr