Can not add a second instance of the same linecard into a module bay #6416

Closed
opened 2025-12-29 19:40:26 +01:00 by adam · 5 comments
Owner

Originally created by @c-po on GitHub (Apr 27, 2022).

NetBox version

v3.2.1

Python version

3.9

Steps to Reproduce

Found while implementing and testing https://github.com/netbox-community/devicetype-library/pull/770

When a line-card is defined with module variable to mark the slot where it's installed this is not reflected in netbox.

  • Import the module types and the device (DCS-7368) from above PR.
  • Create an instance of DCS-7368
  • Assign a supervisor module
  • Assign a line-card DCS-7368-16C-LC to any one slot

The slot ID is not reference in the interface name

interfaces:
# QSFP28(100G) ports can be broke into 4x25 with a model of [1-16]/[1-4]
  - name: Ethernet{module}/1/1
    type: 100gbase-x-qsfp28

image

Expected Behavior

Interfaces should be called with the slot id in place, so Ethernet/1/1 should actually be Ethernet2/1/1

Observed Behavior

When adding a second linecard to a module bay one will get

image

<class 'django.db.utils.IntegrityError'>

duplicate key value violates unique constraint "dcim_interface_device_id_name_bffc4ec4_uniq"
DETAIL:  Key (device_id, name)=(118, Ethernet/1/1) already exists.


Python version: 3.8.10
NetBox version: 3.2.1
Originally created by @c-po on GitHub (Apr 27, 2022). ### NetBox version v3.2.1 ### Python version 3.9 ### Steps to Reproduce Found while implementing and testing https://github.com/netbox-community/devicetype-library/pull/770 When a line-card is defined with module variable to mark the slot where it's installed this is not reflected in netbox. * Import the module types and the device (DCS-7368) from above PR. * Create an instance of DCS-7368 * Assign a supervisor module * Assign a line-card DCS-7368-16C-LC to any one slot The slot ID is not reference in the interface name ``` interfaces: # QSFP28(100G) ports can be broke into 4x25 with a model of [1-16]/[1-4] - name: Ethernet{module}/1/1 type: 100gbase-x-qsfp28 ``` ![image](https://user-images.githubusercontent.com/25299219/165604855-51711404-a69c-4e84-a60c-cbb829117182.png) ### Expected Behavior Interfaces should be called with the slot id in place, so `Ethernet/1/1` should actually be `Ethernet2/1/1` ### Observed Behavior When adding a second linecard to a module bay one will get ![image](https://user-images.githubusercontent.com/25299219/165605134-6acfa2dc-c795-4706-9256-dad8b1bcea70.png) ``` <class 'django.db.utils.IntegrityError'> duplicate key value violates unique constraint "dcim_interface_device_id_name_bffc4ec4_uniq" DETAIL: Key (device_id, name)=(118, Ethernet/1/1) already exists. Python version: 3.8.10 NetBox version: 3.2.1 ```
adam added the type: bugstatus: revisions needed labels 2025-12-29 19:40:26 +01:00
adam closed this issue 2025-12-29 19:40:26 +01:00
Author
Owner

@jeremystretch commented on GitHub (Apr 27, 2022):

Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.

@jeremystretch commented on GitHub (Apr 27, 2022): Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.
Author
Owner

@ryanmerolle commented on GitHub (Apr 27, 2022):

I actually looked into this with the user on the side.

Let me add my write up to reproduce, since I noticed the same thing on demo.netbox.dev and my personal install of netbox.

1.) Add a devicetype Arista DCS-7368:

---
manufacturer: Arista
model: DCS-7368
slug: dcs-7368
part_number: DCS-7368
u_height: 4
is_full_depth: false
comments: '[Arista 7368X4 Series 100/200/400G Data Center Switches](https://www.arista.com/assets/data/pdf/Datasheets/7368X4-Datasheet.pdf'
power-ports:
  - name: PS1
    type: iec-60320-c20
    maximum_draw: 2000
  - name: PS2
    type: iec-60320-c20
    maximum_draw: 2000
  - name: PS3
    type: iec-60320-c20
    maximum_draw: 2000
  - name: PS4
    type: iec-60320-c20
    maximum_draw: 2000
module-bays:
  - name: Slot 1
    label: Supervisor
  - name: Slot 2
    label: Line Card 1
  - name: Slot 3
    label: Line Card 2
  - name: Slot 4
    label: Line Card 3
  - name: Slot 5
    label: Line Card 4
  - name: Slot 6
    label: Line Card 5
  - name: Slot 7
    label: Line Card 6
  - name: Slot 8
    label: Line Card 7
  - name: Slot 9
    label: Line Card 8

2.) Add a moduletype Arista DCS-7368-16C:

---
manufacturer: Arista
model: DCS-7368-16C
part_number: DCS-7368-16C
comments: '[Arista 7368 Series Overview](https://www.arista.com/en/qsg-7368x-series/7368x-series-overview)'
interfaces:
  - name: Ethernet{module}/1/1
    type: 100gbase-x-qsfp28
  - name: Ethernet{module}/2/1
    type: 100gbase-x-qsfp28
  - name: Ethernet{module}/3/1
    type: 100gbase-x-qsfp28
  - name: Ethernet{module}/4/1
    type: 100gbase-x-qsfp28
  - name: Ethernet{module}/5/1
    type: 100gbase-x-qsfp28
  - name: Ethernet{module}/6/1
    type: 100gbase-x-qsfp28
  - name: Ethernet{module}/7/1
    type: 100gbase-x-qsfp28
  - name: Ethernet{module}/8/1
    type: 100gbase-x-qsfp28
  - name: Ethernet{module}/9/1
    type: 100gbase-x-qsfp28
  - name: Ethernet{module}/10/1
    type: 100gbase-x-qsfp28
  - name: Ethernet{module}/11/1
    type: 100gbase-x-qsfp28
  - name: Ethernet{module}/12/1
    type: 100gbase-x-qsfp28
  - name: Ethernet{module}/13/1
    type: 100gbase-x-qsfp28
  - name: Ethernet{module}/14/1
    type: 100gbase-x-qsfp28
  - name: Ethernet{module}/15/1
    type: 100gbase-x-qsfp28
  - name: Ethernet{module}/16/1
    type: 100gbase-x-qsfp28

3.) Add a device using the model Arista DC-7368

4.) Add a module to the newly created device using the model Arista DCS-7368-16C

5.) Observe The module # never gets populated

@ryanmerolle commented on GitHub (Apr 27, 2022): I actually looked into this with the user on the side. Let me add my write up to reproduce, since I noticed the same thing on demo.netbox.dev and my personal install of netbox. **1.) Add a devicetype Arista DCS-7368:** ```yaml --- manufacturer: Arista model: DCS-7368 slug: dcs-7368 part_number: DCS-7368 u_height: 4 is_full_depth: false comments: '[Arista 7368X4 Series 100/200/400G Data Center Switches](https://www.arista.com/assets/data/pdf/Datasheets/7368X4-Datasheet.pdf' power-ports: - name: PS1 type: iec-60320-c20 maximum_draw: 2000 - name: PS2 type: iec-60320-c20 maximum_draw: 2000 - name: PS3 type: iec-60320-c20 maximum_draw: 2000 - name: PS4 type: iec-60320-c20 maximum_draw: 2000 module-bays: - name: Slot 1 label: Supervisor - name: Slot 2 label: Line Card 1 - name: Slot 3 label: Line Card 2 - name: Slot 4 label: Line Card 3 - name: Slot 5 label: Line Card 4 - name: Slot 6 label: Line Card 5 - name: Slot 7 label: Line Card 6 - name: Slot 8 label: Line Card 7 - name: Slot 9 label: Line Card 8 ``` **2.) Add a moduletype Arista DCS-7368-16C:** ```yaml --- manufacturer: Arista model: DCS-7368-16C part_number: DCS-7368-16C comments: '[Arista 7368 Series Overview](https://www.arista.com/en/qsg-7368x-series/7368x-series-overview)' interfaces: - name: Ethernet{module}/1/1 type: 100gbase-x-qsfp28 - name: Ethernet{module}/2/1 type: 100gbase-x-qsfp28 - name: Ethernet{module}/3/1 type: 100gbase-x-qsfp28 - name: Ethernet{module}/4/1 type: 100gbase-x-qsfp28 - name: Ethernet{module}/5/1 type: 100gbase-x-qsfp28 - name: Ethernet{module}/6/1 type: 100gbase-x-qsfp28 - name: Ethernet{module}/7/1 type: 100gbase-x-qsfp28 - name: Ethernet{module}/8/1 type: 100gbase-x-qsfp28 - name: Ethernet{module}/9/1 type: 100gbase-x-qsfp28 - name: Ethernet{module}/10/1 type: 100gbase-x-qsfp28 - name: Ethernet{module}/11/1 type: 100gbase-x-qsfp28 - name: Ethernet{module}/12/1 type: 100gbase-x-qsfp28 - name: Ethernet{module}/13/1 type: 100gbase-x-qsfp28 - name: Ethernet{module}/14/1 type: 100gbase-x-qsfp28 - name: Ethernet{module}/15/1 type: 100gbase-x-qsfp28 - name: Ethernet{module}/16/1 type: 100gbase-x-qsfp28 ``` **3.) Add a device using the model Arista DC-7368** **4.) Add a module to the newly created device using the model Arista DCS-7368-16C** **5.) Observe The module # never gets populated**
Author
Owner

@ryanmerolle commented on GitHub (Apr 27, 2022):

Disregard. User error for both of us. The module bay is missing a position.

@ryanmerolle commented on GitHub (Apr 27, 2022): Disregard. User error for both of us. The module bay is missing a position.
Author
Owner

@jeremystretch commented on GitHub (Apr 27, 2022):

FYI #9190 has been opened so that creating components with {module} in their name will fail validation if no position has been defined for the bay, for exactly this reason.

@jeremystretch commented on GitHub (Apr 27, 2022): FYI #9190 has been opened so that creating components with `{module}` in their name will fail validation if no position has been defined for the bay, for exactly this reason.
Author
Owner

@c-po commented on GitHub (Apr 28, 2022):

After adding position into the device-type YAML definitions all works as expected. Sorry for the noise.

@c-po commented on GitHub (Apr 28, 2022): After adding position into the device-type YAML definitions all works as expected. Sorry for the noise.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6416