Especially in the web app world it is important to use a templating engine to handle the output finalization. It makes it possible to manage consistent headers, footers and styling details across all the pages in the app. You know, all those <div>, <span>, <h1> and other tags that are used to format the output […]
Cisco Nexus 9000 Routing Limitations
This is a memo and reminder about the routing limitations that I stumbled into when working with Nexus 9000 series switches running NX-OS. Feature Limitation Link to documentation PBR You cannot configure PBR on port-channel subinterfaces Interfaces configuration guide for 9.3(x) QoS You cannot configure QoS on port-channel subinterfaces QoS configuration guide for 9.3(x) QoS […]
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 […]
Revisited: Version Numbering in Python Package
In Version Numbering in Python Package I showed a way to store the package version number in the code. The method is in hindsight not exactly the best one (who knew!), so here is another try for simple projects. Here I have mypackage/ (the package directory) mypackage/__init__.py mypackage/version.py setup.py with contents: mypackage/version.py: mypackage/__init__.py: setup.py: What […]
Creating Excel Sheets in Python
I cannot believe I’m posting this, but anyway, this is about creating Excel files (.xlsx) in Python 😂 (see also my earlier post about avoiding using Excel 👍) This is what it outputs as Excel sheet: Let’s see what we have here in the code. First, this is using xlsxwriter package. It includes everything I […]
Systemd Setup for FastAPI Webhook Listener
In my previous post I showed a simple NetBox webhook listener using FastAPI. In this post I’ll show the configurations to run the API using systemd. Let’s get into it, on my Debian 10 system. Let’s save the webhook_listener.py from the previous post in the same folder (webhook). Now we can try starting the webhook […]
Webhook Listener with FastAPI
Last year I wrote a webhook listener using Flask-RESTPlus. Now I wrote the same using FastAPI: There is so much to unpack there! Some of the FastAPI features I used (there are some links to FastAPI documentation): Request validation: I defined my own WebhookData class that defines the expected data in the webhook request. For […]
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 […]
Python Loggers
This is a memo about my current standard way of logging in Python, especially when multiple modules are involved. In the main application (app.py): When app.py is started it gets the root logger in line 7. In main() it sets the logging configurations: logging level, formatter and handler. Here the handler is just outputting to […]
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() […]