Bulk Import Circuit and Terminations #7492

Closed
opened 2025-12-29 20:24:05 +01:00 by adam · 5 comments
Owner

Originally created by @aslater3 on GitHub (Jan 11, 2023).

NetBox version

3.4.2

Python version

3.8

Steps to Reproduce

Click Circuits
Click bulk import
The fields for termination_a/z dont appear on the CSV / Field Options on that page
Can't find any documentation around the JSON import functionality for terminations.

Expected Behavior

{
"cid": "ID-TEST",
"provider": "Lumen",
"type": "DIA",
"commit_rate": 200000,
"status":"decommissioned",
"description": "Testing Import",
"termination_a": {
"site": {
"name": "Test Site",
"slug": "test-bed"
},
"termination_z": {
"provider_network": {
"id": 1}
}
}
}

Should import circuit with relevant terminations?

Observed Behavior

Imports the circuit but no terminations are added.

Originally created by @aslater3 on GitHub (Jan 11, 2023). ### NetBox version 3.4.2 ### Python version 3.8 ### Steps to Reproduce Click Circuits Click bulk import The fields for termination_a/z dont appear on the CSV / Field Options on that page Can't find any documentation around the JSON import functionality for terminations. ### Expected Behavior { "cid": "ID-TEST", "provider": "Lumen", "type": "DIA", "commit_rate": 200000, "status":"decommissioned", "description": "Testing Import", "termination_a": { "site": { "name": "Test Site", "slug": "test-bed" }, "termination_z": { "provider_network": { "id": 1} } } } Should import circuit with relevant terminations? ### Observed Behavior Imports the circuit but no terminations are added.
adam added the status: duplicate label 2025-12-29 20:24:05 +01:00
adam closed this issue 2025-12-29 20:24:05 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 12, 2023):

This is being addressed under #11204. You're welcome to volunteer to own that issue if interested.

@jeremystretch commented on GitHub (Jan 12, 2023): This is being addressed under #11204. You're welcome to volunteer to own that issue if interested.
Author
Owner

@aslater3 commented on GitHub (Jan 12, 2023):

But to confirm, this should work? We are just lacking the documentation?

@aslater3 commented on GitHub (Jan 12, 2023): But to confirm, this should work? We are just lacking the documentation?
Author
Owner

@jeremystretch commented on GitHub (Jan 12, 2023):

Correct; this was added in NetBox v3.4.0 under #815. You can specify a list of terminations under the terminations attribute on each circuit.

@jeremystretch commented on GitHub (Jan 12, 2023): Correct; this was added in NetBox v3.4.0 under #815. You can specify a list of terminations under the `terminations` attribute on each circuit.
Author
Owner

@pehan-dotcom commented on GitHub (Mar 7, 2023):

Hello, upgraded netbox from 3.3.5 -> 3.4.5 to get functionality of bulk circuit import with terminations. However, attribute is not show in Field Options: Circuits > Circuits > Import > Circuit Bulk Import > Upload file. When I try to use csv file:

cid,provider,type,status,commit_rate,terminations
3141,testprovider,L2VPN,active,30000,testsite

I get an error:
<class 'AttributeError'>
'str' object has no attribute 'update'

Am I missing something? Thanks.

@pehan-dotcom commented on GitHub (Mar 7, 2023): Hello, upgraded netbox from 3.3.5 -> 3.4.5 to get functionality of bulk circuit import with terminations. However, attribute is not show in Field Options: Circuits > Circuits > Import > Circuit Bulk Import > Upload file. When I try to use csv file: cid,provider,type,status,commit_rate,terminations 3141,testprovider,L2VPN,active,30000,testsite I get an error: <class 'AttributeError'> 'str' object has no attribute 'update' Am I missing something? Thanks.
Author
Owner

@candlerb commented on GitHub (Apr 30, 2023):

@pehan-dotcom: As far as I know, this only works with JSON/YAML import (or if it did work for CSV, the "terminations" column would have to be structured data)

@aslater3: After some experimentation, I believe the following should work for you:

[

{
"cid": "ID-TEST",
"provider": "Lumen",
"type": "DIA",
"commit_rate": 200000,
"status":"decommissioned",
"description": "Testing Import",
"terminations": [{
  "term_side": "A",
  "site": "Test Site"
}, {
  "term_side": "Z",
  "provider_network": "Blah"
}]
}

]

where "Blah" is the name of the provider network with id 1; using {"id": 1} doesn't work here.

Note that currently if there is any error in the termination definitions, no error message is displayed and Netbox just returns to the import page - see #12402.

Imports the circuit but no terminations are added.

That's because "termination_a" and "termination_z" are ignored, presumably as invalid attributes. (This is different to the REST API, which still does return "termination_a" and "termination_z")

@candlerb commented on GitHub (Apr 30, 2023): @pehan-dotcom: As far as I know, this only works with JSON/YAML import (or if it did work for CSV, the "terminations" column would have to be structured data) @aslater3: After some experimentation, I believe the following should work for you: ``` [ { "cid": "ID-TEST", "provider": "Lumen", "type": "DIA", "commit_rate": 200000, "status":"decommissioned", "description": "Testing Import", "terminations": [{ "term_side": "A", "site": "Test Site" }, { "term_side": "Z", "provider_network": "Blah" }] } ] ``` where "Blah" is the _name_ of the provider network with id 1; using `{"id": 1}` doesn't work here. Note that currently if there is any error in the termination definitions, no error message is displayed and Netbox just returns to the import page - see #12402. > Imports the circuit but no terminations are added. That's because "termination_a" and "termination_z" are ignored, presumably as invalid attributes. (This is different to the REST API, which still *does* return "termination_a" and "termination_z")
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7492