summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatthew.hodgins <matthew.hodgins@calxeda.com>2013-12-10 15:17:25 -0600
committermatthew.hodgins <matthew.hodgins@calxeda.com>2013-12-11 10:38:12 -0600
commitfcb86f86eb71e273ba6229885c8d24c397aa53d5 (patch)
treef9717cc69bdac3bb28147fc9b74fa77cb10185e9
parentfb10ac5c717e591ef205a4b7a3aea3395468ff21 (diff)
downloadcxmanage-fcb86f86eb71e273ba6229885c8d24c397aa53d5.tar.gz
AIT-527 expose uplink status
Signed-off-by: matthew.hodgins <matthew.hodgins@calxeda.com>
-rw-r--r--cxmanage_api/node.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/cxmanage_api/node.py b/cxmanage_api/node.py
index 36c423a..2eb9d11 100644
--- a/cxmanage_api/node.py
+++ b/cxmanage_api/node.py
@@ -913,7 +913,7 @@ communication.
except IpmiError as error:
if str(error) != "Error resetting firmware to factory default":
raise
- time.sleep(5) # pausing between retries seems to help a little
+ time.sleep(5) # pausing between retries seems to help a little
else:
self.bmc.reset_firmware()
@@ -1586,6 +1586,27 @@ obtained.
return results
+ def get_uplink_status(self):
+ """Get the uplink status for this node
+
+ >>> node.get_uplink_status()
+ {0: True, 1: False, 2: True, 3: True}
+
+ :return: A dictionary mapping uplink to status
+ :rtype: dict
+
+ """
+ results = {}
+ uplink_status = self.bmc.fabric_get_uplink_status()
+ regex = re.compile(r'U(\d+)\(N\d+\) (\w+):')
+ for uplink, status in regex.findall(uplink_status):
+ if(status == 'Good'):
+ results[uplink] = True
+ else:
+ results[uplink] = False
+
+ return results
+
def read_fru(self, fru_number, offset=0, bytes_to_read=-1):
"""Read from node's fru starting at offset.
This is equivalent to the ipmitool fru read command.