diff options
author | matthew.hodgins <matthew.hodgins@calxeda.com> | 2013-12-11 13:29:03 -0600 |
---|---|---|
committer | matthew.hodgins <matthew.hodgins@calxeda.com> | 2013-12-11 13:29:03 -0600 |
commit | 03b63ab36f7ea81e7cf88447f2f8af3fecd5e7f8 (patch) | |
tree | cb13c3ba758a92011136046c632d9d74c0c7cec0 | |
parent | 065b3f2f0d8aa70d5498429ecc98f4daea77aa89 (diff) | |
download | cxmanage-03b63ab36f7ea81e7cf88447f2f8af3fecd5e7f8.tar.gz |
CXMAN-258 moving uplink_status from node to fab
Signed-off-by: matthew.hodgins <matthew.hodgins@calxeda.com>
-rw-r--r-- | cxmanage_api/fabric.py | 21 | ||||
-rw-r--r-- | cxmanage_api/node.py | 25 |
2 files changed, 23 insertions, 23 deletions
diff --git a/cxmanage_api/fabric.py b/cxmanage_api/fabric.py index 29156b0..96ac9f8 100644 --- a/cxmanage_api/fabric.py +++ b/cxmanage_api/fabric.py @@ -601,6 +601,27 @@ class Fabric(object): """ return self._run_on_all_nodes(async, "get_sensors", search) + 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.primary_node.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 get_firmware_info(self, async=False): """Gets the firmware info from all nodes. diff --git a/cxmanage_api/node.py b/cxmanage_api/node.py index 2eb9d11..2ccfa20 100644 --- a/cxmanage_api/node.py +++ b/cxmanage_api/node.py @@ -1185,13 +1185,13 @@ communication. try: node_id = int(node_id) except ValueError: - pass # may be a physical node ID, "0.0" for example + pass # may be a physical node ID, "0.0" for example ip_address = elements[2] except IndexError: raise ParseError("Failed to parse ipinfo\n%s" % contents) try: - socket.inet_aton(ip_address) # IP validity check + socket.inet_aton(ip_address) # IP validity check except socket.error: if allow_errors: continue @@ -1586,27 +1586,6 @@ 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. |