Using Netbox as a RoyalTS backend

In: Automation

For those of us using a terminal manager and Netbox, we often find ourselves duplicating work; add the device to Netbox, then add the device to our terminal manager. The situation gets a little more complicated when other teams add devices autonomously. In this post, I present a simple solution I've developed for Netbox users to import their device data straight into RoyalTS without having to manually add devices.

💡
This would make a great Netbox plugin with a dashboard to customize the layout of the export and change the way the devices are created in Royal.

RoyalTS provides dynamic-folder as an option to call a script that returns JSON describing a list of devices, credentials, folders, etc. We can use this feature along with the Netbox API to pull our interesting devices into RoyalTS

https://github.com/MajesticFalcon/RoyalTS_Netbox_Integration/blob/main/main.py

To create a dynamic-folder in RoyalTS, right-click connections, click 'Add' and select "dynamic folder." In the new pop-up window, select 'Dynamic Folder Script' and paste the script found above. Adjust the script with your Netbox URL and token. You may also adjust some filters and device_roles to match your environment.

💡
Warning: If you do not have a cert on your Netbox, you will need to add the following to your code:

import urllib3
nb.http_session.verify = False
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

Once created, right-click the new folder and select 'reload.'

💡
I recommend you paste the script into a text editor and run it locally first. Add filters where needed, but make sure you only have a single print statement. RoyalTS reads the JSON from stdout.

For purposes of this demo, I have created several new sites – Site A, Site B, etc. Each site has at least one switch.

Old workflow:

0:00
/
The standard device creation workflow

New workflow:

0:00
/
The new device creation workflow

Now you and your teammates can have a 'single-source-of-truth' backed terminal manager!

Comments
More from Schy Networks
Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Schy Networks.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.