From 77377d5e9362bd35a3b300df231e82ee974675e1 Mon Sep 17 00:00:00 2001 From: Parker Berberian Date: Thu, 19 Dec 2019 12:39:01 -0500 Subject: Comments and Documentation This change adds a ton of comments and documentation across all the code. Change-Id: Ifee0a2f534e8584f14b0f13af4dda8dc70eb7553 Signed-off-by: Parker Berberian --- src/resource_inventory/models.py | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) (limited to 'src/resource_inventory/models.py') diff --git a/src/resource_inventory/models.py b/src/resource_inventory/models.py index d152698..4bc9bf3 100644 --- a/src/resource_inventory/models.py +++ b/src/resource_inventory/models.py @@ -111,24 +111,20 @@ class Resource(models.Model): def get_configuration(self, state): """ + Get configuration of Resource. + Returns the desired configuration for this host as a JSON object as defined in the rest api spec. state is a ConfigState - TODO: single method, or different methods for hw, network, snapshot, etc? """ raise NotImplementedError("Must implement in concrete Resource classes") def reserve(self): - """ - Reserves this resource for its currently - assigned booking. - """ + """Reserve this resource for its currently assigned booking.""" raise NotImplementedError("Must implement in concrete Resource classes") def release(self): - """ - Makes this resource available again for new boookings - """ + """Make this resource available again for new boookings.""" raise NotImplementedError("Must implement in concrete Resource classes") @@ -170,15 +166,14 @@ class PhysicalNetwork(Resource): def get_configuration(self, state): """ - Returns the network configuration + Get the network configuration. + Collects info about each attached network interface and vlan, etc """ return {} def reserve(self): - """ - Reserves vlan(s) associated with this network - """ + """Reserve vlan(s) associated with this network.""" # vlan_manager = self.bundle.lab.vlan_manager return False @@ -329,9 +324,8 @@ class OPNFVRole(models.Model): class Image(models.Model): - """ - model for representing OS images / snapshots of hosts - """ + """Model for representing OS images / snapshots of hosts.""" + id = models.AutoField(primary_key=True) lab_id = models.IntegerField() # ID the lab who holds this image knows from_lab = models.ForeignKey(Lab, on_delete=models.CASCADE) @@ -354,10 +348,8 @@ def get_sentinal_opnfv_role(): class HostConfiguration(models.Model): - """ - model to represent a complete configuration for a single - physical host - """ + """Model to represent a complete configuration for a single physical host.""" + id = models.AutoField(primary_key=True) host = models.ForeignKey(GenericHost, related_name="configuration", on_delete=models.CASCADE) image = models.ForeignKey(Image, on_delete=models.PROTECT) @@ -438,8 +430,7 @@ class Interface(models.Model): class OPNFV_SETTINGS(): - """ - This is a static configuration class - """ + """This is a static configuration class.""" + # all the required network types in PDF/IDF spec NETWORK_ROLES = ["public", "private", "admin", "mgmt"] -- cgit 1.2.3-korg