diff --git a/nebula/netbox.py b/nebula/netbox.py index 567298b..54eedef 100644 --- a/nebula/netbox.py +++ b/nebula/netbox.py @@ -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) @@ -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"""