Add primary IPAddressRoleChoices for VM server puprposes #4711

Closed
opened 2025-12-29 19:19:44 +01:00 by adam · 2 comments
Owner

Originally created by @cernymi on GitHub (Mar 31, 2021).

NetBox version

v2.10.5

Feature type

Data model extension

Proposed functionality

v2.10.5

Use case

Add primary IPAddressRoleChoices for VM server puprposes

Database changes

none

External dependencies

none

diff --git a/netbox/ipam/choices.py b/netbox/ipam/choices.py
index 5b7dd16b..8a4ca406 100644
--- a/netbox/ipam/choices.py
+++ b/netbox/ipam/choices.py
@@ -70,6 +70,7 @@ class IPAddressStatusChoices(ChoiceSet):
 class IPAddressRoleChoices(ChoiceSet):
 
     ROLE_LOOPBACK = 'loopback'
+    ROLE_PRIMARY = 'primary'
     ROLE_SECONDARY = 'secondary'
     ROLE_ANYCAST = 'anycast'
     ROLE_VIP = 'vip'
@@ -80,6 +81,7 @@ class IPAddressRoleChoices(ChoiceSet):
 
     CHOICES = (
         (ROLE_LOOPBACK, 'Loopback'),
+        (ROLE_PRIMARY, 'Primary'),
         (ROLE_SECONDARY, 'Secondary'),
         (ROLE_ANYCAST, 'Anycast'),
         (ROLE_VIP, 'VIP'),
@@ -91,6 +93,7 @@ class IPAddressRoleChoices(ChoiceSet):
 
     CSS_CLASSES = {
         ROLE_LOOPBACK: 'default',
+        ROLE_PRIMARY: 'primary',
         ROLE_SECONDARY: 'primary',
         ROLE_ANYCAST: 'warning',
         ROLE_VIP: 'success',

http:///ipam/ip-addresses//

Family IPv4
VRF Global
Tenant None
Status Active
Role Primary
Originally created by @cernymi on GitHub (Mar 31, 2021). ### NetBox version v2.10.5 ### Feature type Data model extension ### Proposed functionality v2.10.5 ### Use case Add primary IPAddressRoleChoices for VM server puprposes ### Database changes none ### External dependencies none ``` diff --git a/netbox/ipam/choices.py b/netbox/ipam/choices.py index 5b7dd16b..8a4ca406 100644 --- a/netbox/ipam/choices.py +++ b/netbox/ipam/choices.py @@ -70,6 +70,7 @@ class IPAddressStatusChoices(ChoiceSet): class IPAddressRoleChoices(ChoiceSet): ROLE_LOOPBACK = 'loopback' + ROLE_PRIMARY = 'primary' ROLE_SECONDARY = 'secondary' ROLE_ANYCAST = 'anycast' ROLE_VIP = 'vip' @@ -80,6 +81,7 @@ class IPAddressRoleChoices(ChoiceSet): CHOICES = ( (ROLE_LOOPBACK, 'Loopback'), + (ROLE_PRIMARY, 'Primary'), (ROLE_SECONDARY, 'Secondary'), (ROLE_ANYCAST, 'Anycast'), (ROLE_VIP, 'VIP'), @@ -91,6 +93,7 @@ class IPAddressRoleChoices(ChoiceSet): CSS_CLASSES = { ROLE_LOOPBACK: 'default', + ROLE_PRIMARY: 'primary', ROLE_SECONDARY: 'primary', ROLE_ANYCAST: 'warning', ROLE_VIP: 'success', ``` http://<netbox>/ipam/ip-addresses/<ID>/ Family | IPv4 -- | -- VRF | Global Tenant | None Status | Active Role | **Primary**
adam added the type: featurestatus: revisions needed labels 2025-12-29 19:19:44 +01:00
adam closed this issue 2025-12-29 19:19:44 +01:00
Author
Owner

@jeremystretch commented on GitHub (Mar 31, 2021):

This issue is pending closure as it does not conform to one of the provided templates as required by the contributing guide. If you'd like to request that your issue be re-opened, please first update the content so that it matches the appropriate template (this may require rewriting your issue entirely).

@jeremystretch commented on GitHub (Mar 31, 2021): This issue is pending closure as it does not conform to one of the [provided templates](https://github.com/netbox-community/netbox/issues/new/choose) as required by the [contributing guide](https://github.com/netbox-community/netbox/blob/master/CONTRIBUTING.md). If you'd like to request that your issue be re-opened, please first update the content so that it matches the appropriate template (this may require rewriting your issue entirely).
Author
Owner

@cernymi commented on GitHub (Mar 31, 2021):

Okey Role | Loopback looks fair enough

@cernymi commented on GitHub (Mar 31, 2021): Okey `Role | Loopback` looks fair enough
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4711