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

Bulk Import Circuit and Terminations #11469

Closed
aslater3 opened this issue Jan 11, 2023 · 5 comments
Closed

Bulk Import Circuit and Terminations #11469

aslater3 opened this issue Jan 11, 2023 · 5 comments
Labels
status: duplicate This issue has already been raised

Comments

@aslater3
Copy link

aslater3 commented 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.

@aslater3 aslater3 added the type: bug A confirmed report of unexpected behavior in the application label Jan 11, 2023
@jeremystretch
Copy link
Member

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

@jeremystretch jeremystretch closed this as not planned Won't fix, can't repro, duplicate, stale Jan 12, 2023
@jeremystretch jeremystretch added status: duplicate This issue has already been raised and removed type: bug A confirmed report of unexpected behavior in the application labels Jan 12, 2023
@aslater3
Copy link
Author

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

@jeremystretch
Copy link
Member

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.

@pehan-dotcom
Copy link

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.

@candlerb
Copy link
Contributor

@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")

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: duplicate This issue has already been raised
Projects
None yet
Development

No branches or pull requests

4 participants