mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-21 12:52:21 -06:00
Oob ip (devices) (#13013)
* initial oob_ip support for devices * add primary ip and oob ip checkmark to ip address view * add oob ip to device view and device edit view * pep8 * make is_oob_ip and is_primary_ip generic for other models * refactor oob_ip * fix oob ip signal * string capitalisation * Misc cleanup --------- Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
committed by
GitHub
parent
7600d7b344
commit
154b8236a2
@@ -849,6 +849,24 @@ class IPAddress(PrimaryModel):
|
||||
return self.address.version
|
||||
return None
|
||||
|
||||
@property
|
||||
def is_oob_ip(self):
|
||||
if self.assigned_object:
|
||||
parent = getattr(self.assigned_object, 'parent_object', None)
|
||||
if parent.oob_ip_id == self.pk:
|
||||
return True
|
||||
return False
|
||||
|
||||
@property
|
||||
def is_primary_ip(self):
|
||||
if self.assigned_object:
|
||||
parent = getattr(self.assigned_object, 'parent_object', None)
|
||||
if self.family == 4 and parent.primary_ip4_id == self.pk:
|
||||
return True
|
||||
if self.family == 6 and parent.primary_ip6_id == self.pk:
|
||||
return True
|
||||
return False
|
||||
|
||||
def _set_mask_length(self, value):
|
||||
"""
|
||||
Expose the IPNetwork object's prefixlen attribute on the parent model so that it can be manipulated directly,
|
||||
|
||||
Reference in New Issue
Block a user