Adding Stuff to Netbox with Pynetbox
As a warning to everyone, I am not a developer. I am a network engineer who is trying to do some automation stuff. Some of what I’m doing sounds logical to me, but I would not trust my own opinions for production work. I’m sure you can find a Slack channel or Mastodon instance with people who can tell you how to do things properly.
I think there’s a theme in the last few posts. I can’t quite put my finger on it, though. 🙂 We’ve talked about querying Netbox, but it’s pretty useless without data actually in it. Let’s look at how to get stuff in there using pynetbox.
Here’s the environment I’m running. All this code is in my Github repo.
Python : 3.9.10
Pynetbox : 7.0.0
Netbox version : 3.4.2 (Docker)
Adding sites is pretty logical first step in a new Netbox install. They don’t have any required fields that have to be created first, so let’s start there. I’ve got a YAML file called sites.yml that contains the site data I want to import. Here’s what that looks like.
### sites.yml
- name: NYC
description: New York Continue reading
We’ve talked about querying 

A skill that more people should have

