diff options
-rw-r--r-- | src/resource_inventory/models.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/resource_inventory/models.py b/src/resource_inventory/models.py index f462ac5..a8b75d9 100644 --- a/src/resource_inventory/models.py +++ b/src/resource_inventory/models.py @@ -127,6 +127,13 @@ class Resource(models.Model): """Make this resource available again for new boookings.""" raise NotImplementedError("Must implement in concrete Resource classes") + def get_interfaces(self): + """ + Returns a list of interfaces on this resource. + The ordering of interfaces should be consistent. + """ + raise NotImplementedError("Must implement in concrete Resource classes") + # Generic resource templates class GenericResourceBundle(models.Model): @@ -420,6 +427,9 @@ class Host(Resource): self.booked = False self.save() + def get_interfaces(self): + return list(self.interfaces.all().order_by('bus_address')) + class Interface(models.Model): id = models.AutoField(primary_key=True) |