summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatthew.hodgins <matthew.hodgins@calxeda.com>2013-11-20 14:14:24 -0600
committermatthew.hodgins <matthew.hodgins@calxeda.com>2013-11-20 14:14:24 -0600
commitc2a4b107a3ce7e12976f5709799c1e3349748363 (patch)
tree0fb998a3af51f1feab0ff00e46adce99a9f37108
parent2bad85148796571933fbd7ac7ab03a0517d1e8c4 (diff)
downloadcxmanage-c2a4b107a3ce7e12976f5709799c1e3349748363.tar.gz
AIT-525 making guid a lazy init property
Signed-off-by: matthew.hodgins <matthew.hodgins@calxeda.com>
-rw-r--r--cxmanage_api/node.py16
-rw-r--r--cxmanage_test/fabric_test.py5
2 files changed, 21 insertions, 0 deletions
diff --git a/cxmanage_api/node.py b/cxmanage_api/node.py
index 0176ee7..b96e440 100644
--- a/cxmanage_api/node.py
+++ b/cxmanage_api/node.py
@@ -114,6 +114,7 @@ class Node(object):
self.ipretriever = ipretriever
self._node_id = None
+ self._guid = None
def __eq__(self, other):
return isinstance(other, Node) and self.ip_address == other.ip_address
@@ -153,6 +154,21 @@ class Node(object):
self._node_id = self.bmc.fabric_get_node_id()
return self._node_id
+ @property
+ def guid(self):
+ """Returns the node GUID
+
+ >>> node.guid
+ '99cfa980-2076-11e3-d5c7-76db821cea20'
+
+ :returns: The node GUID
+ :rtype: string
+
+ """
+ if(self._guid is None):
+ self._guid = self.bmc.guid().system_guid
+ return self._guid
+
@node_id.setter
def node_id(self, value):
""" Sets the ID for this node.
diff --git a/cxmanage_test/fabric_test.py b/cxmanage_test/fabric_test.py
index 96f76e6..0f68f23 100644
--- a/cxmanage_test/fabric_test.py
+++ b/cxmanage_test/fabric_test.py
@@ -456,6 +456,11 @@ class DummyNode(object):
password=password, verbose=False)
@property
+ def guid(self):
+ """Returns the node GUID"""
+ return self.bmc.guid().system_guid
+
+ @property
def chassis_id(self):
"""Returns 0 for chasis ID."""
return 0