In my Basic Mocking with Pytest post I showed simple cases. Now let’s do more mocking. First I’ll create the environment for my code: $ mkdir more-mocking$ cd more-mocking$ python3 -m venv venv$ . venv/bin/activate(venv)$ pip install -U pip wheel…Successfully installed pip-24.0 wheel-0.43.0(venv)$ pip install pynetbox pytest…Successfully installed certifi-2024.2.2 charset-normalizer-3.3.2 idna-3.7 iniconfig-2.0.0 packaging-23.2 pluggy-1.5.0 pynetbox-7.3.3 […]
Tag: pynetbox
Selecting Pynetbox Version
If you have: And you need: Then you need to use: Because: NetBox 3.7.0 or newer VPNs pynetbox 7.3.3 or newer vpn app was added in pynetbox NetBox 3.5.0 or newer ASN ranges pynetbox 7.1.0 or newer asn_ranges.available_asns was added in pynetbox NetBox 3.3.0 or newer Cable terminations pynetbox 7.0.0 or newer Cable terminations were […]
Using Tags with Pynetbox in NetBox 2.9+
I wrote earlier about using tags with pynetbox in NetBox 2.8. After that in NetBox 2.9 tag handling was significantly changed: tags must now be separately created before they can be assigned to objects. Previously tags were automatically created if you assigned a nonexisting tag to an object. Another change is that when returning objects […]
Timeout and Self-signed CA Handling in Pynetbox 5.x
Since pynetbox 5.0 it is possible to set the HTTP request connect timeout in your pynetbox.Api instance. Actually, it is not just a timeout value but you can instantiate a full requests.Session() object to customize the HTTP calls. As a side effect, since the SSL/TLS certificate checking parameter can also be set in the session […]
Hints for Pynetbox
Note: I don’t yet have extensive experience on NetBox 2.9.x but these have been shown useful in earlier NetBox versions. I’ll update the page later if I find some further comments about the performance in NetBox 2.9.x. Speeding up fetching the devices Fetching lots of devices (hundreds or thousands, depending on the environment) with netbox.dcim.devices.all() […]
Using Pynetbox
Pynetbox is a Python API client library for NetBox. Here are some basic examples of using pynetbox. In this page: Getting started Creating and changing something Retrieving objects Deleting objects Handling object status Using tags Referring to other objects Here we assume that you already have NetBox running (I have NetBox 2.8.6 in this demo), […]