Enforcing custom naming convention with plugin #14932
Unanswered
llamafilm
asked this question in
Help Wanted!
Replies: 1 comment 1 reply
-
Have you looked at the new Event Rules feature in NetBox 3.7? On creation of a device you can trigger a custom script which enforces this logic. I'm looking at this for automatically creating tags based on device attributes. I think it might be a simpler way to do it than creating a plugin. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I’d like to use a naming convention for devices, where the name consists of the Device Role plus a 3 digit number that auto increments starting from 001 within each site.
For example, I have device roles ASW, LR, PDU, TV. The first TV in the site should be named TV001. With hundreds of devices, it will be difficult to know what the next number is, so I want Netbox to pick the number automatically.
I read through the plugin guide, and it seems like this should be pretty simple. I think I just need to use signals.py to receive the
pre_save
signal, check if the name=None then assign the right name after counting the existing devices.So when I create a new device, I should always leave the name blank and then the plugin will name it correctly.
Does this sound like it would work, or does anybody see any red flags?
Beta Was this translation helpful? Give feedback.
All reactions