Adding Server / Network cable runs in bulk to Netbox?

870 views
Skip to first unread message

David Szydloski

unread,
May 20, 2019, 1:03:37 PM5/20/19
to NetBox
Netbox: 2.5.12
python: 3.5.2


I'm having a hard time trying to figure out if it is still possible to do a bulk updates of cable connections (server -> server; network device -> network device; server -> network device cabling)? 

Previously, with Netbox versions < 2.5.* I was able to do take my cable cut sheet, run a  python script on it to spit out cable run CSVs for power, console, and interface cabling and import those connections via the webUI. 

While I understand that the input method I used to use is currently obsolete, I'm not sure what I can replace it with. I'm even having problems adding individual cable runs to Netbox via the API or at least I'm not sure why this is currently failing:

curl -k -H "Authorization: Token <...> " -H "Accept: application/json; indent=4" https://<FQDN>/api/dcim/cables/ --data '{ "termination_a_type": "dcim.interface", "termination_a_id": "177341", "termination_b_type": "dcim.interface", "termination_b_id": "179578"}'

Which produces the following response:

{
    "termination_a_type": [
        "This field is required."
    ],
    "termination_a_id": [
        "This field is required."
    ],
    "termination_b_id": [
        "This field is required."
    ],
    "termination_b_type": [
        "This field is required."
    ]
}

Is anyone actively doing bulk cabling updates for server / network gear connections? Which method works for you?

Thanks,
David

Jeremy Stretch

unread,
May 20, 2019, 6:16:50 PM5/20/19
to David Szydloski, NetBox
The response suggests that NetBox doesn't recognize the data provided in the request. It looks like you're missing the Content-Type header. Try adding this to the curl command:

-H "Content-Type: application/json"


--
You received this message because you are subscribed to the Google Groups "NetBox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netbox-discus...@googlegroups.com.
To post to this group, send email to netbox-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netbox-discuss/64ce5ca7-0459-4b92-abc3-ba27c555398a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brian Candler

unread,
May 21, 2019, 2:28:27 AM5/21/19
to NetBox
On Monday, 20 May 2019 18:03:37 UTC+1, David Szydloski wrote:
Is anyone actively doing bulk cabling updates for server / network gear connections? Which method works for you?

CSV upload of Cables works for me.

Vincent Huet

unread,
May 23, 2019, 3:00:47 AM5/23/19
to NetBox
It seems that you have the same problem as me for cabling creation with newer Netbox release.
Checking Brian's Answer in thread "Cannot create InterfaceConnection/Cable since Netbox upgrade in 2.5.10" may help you.
Best regards
Reply all
Reply to author
Forward
0 new messages