Skip to content

Commit

Permalink
expose device status
Browse files Browse the repository at this point in the history
Signed-off-by: kimpaller <[email protected]>
  • Loading branch information
kimpaller committed Oct 23, 2024
1 parent 8af9e71 commit 4ca24c5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nebula/netbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ def get_devices(self, **filters):

def get_tag(self, id=None, name=None, slug=None):
return self.nb.extras.tags.get(id=id, name=name, slug=slug)

def get_status(self, id):
device = self.get_device(id)
return device.status

def update_device(self, id, fields):
device = self.get_device(id)
Expand Down Expand Up @@ -574,6 +578,9 @@ def disable(self, reason="nebula: Disable device", failed=False):
self.nbi.update_status(device_id=device_id, status="offline")
self.nbi.log_journal(device_id=device_id, author_id=author.id, comments=reason)

def status(self):
device_id = self.data["devices"]["id"]
return self.nbi.get_status(device_id)

class NetboxDevices:
"""List of NetboxDevice"""
Expand Down

0 comments on commit 4ca24c5

Please sign in to comment.