diff options
author | Sheldon Sandbekkhaug <sheldon.sandbekkhaug@calxeda.com> | 2013-07-22 14:51:04 -0500 |
---|---|---|
committer | Sheldon Sandbekkhaug <sheldon.sandbekkhaug@calxeda.com> | 2013-07-22 14:51:04 -0500 |
commit | befd8737f2c89e6ab74f79796f9520c2a82a90f0 (patch) | |
tree | 5929de824ac65fe1959b5384f82a2d879f1d650b | |
parent | f5628b1b260167d6823e0a5c0839d516c4a95914 (diff) | |
download | cxmanage-befd8737f2c89e6ab74f79796f9520c2a82a90f0.tar.gz |
Add a function to get uplink info through cxmanage_api
Added a function to get uplink info through node.py
Changed fabric.get_uplink_info() to use node.py's new function
(node.get_fabric_uplink_info() is untouched)
-rw-r--r-- | cxmanage_api/fabric.py | 14 | ||||
-rw-r--r-- | cxmanage_api/node.py | 11 |
2 files changed, 17 insertions, 8 deletions
diff --git a/cxmanage_api/fabric.py b/cxmanage_api/fabric.py index 5b3e5e2..2e140f5 100644 --- a/cxmanage_api/fabric.py +++ b/cxmanage_api/fabric.py @@ -193,16 +193,14 @@ class Fabric(object): """ return self.primary_node.get_fabric_macaddrs() - def get_uplink_info(self): + def get_uplink_info(self, async=False): """Gets the fabric uplink info. >>> fabric.get_uplink_info() - { - 0: {0: 0, 1: 0, 2: 0} - 1: {0: 0, 1: 0, 2: 0} - 2: {0: 0, 1: 0, 2: 0} - 3: {0: 0, 1: 0, 2: 0} - } + {0: 'Node 0: eth0 0, eth1 0, mgmt 0', + 1: 'Node 1: eth0 0, eth1 0, mgmt 0', + 2: 'Node 2: eth0 0, eth1 0, mgmt 0', + 3: 'Node 3: eth0 0, eth1 0, mgmt 0'} :param async: Flag that determines if the command result (dictionary) is returned or a Task object (can get status, etc.). @@ -212,7 +210,7 @@ class Fabric(object): :rtype: dictionary """ - return self.primary_node.get_fabric_uplink_info() + return self._run_on_all_nodes(async, "get_uplink_info") def get_uplink_speed(self, async=False): """Gets the uplink speed of every node in the fabric. diff --git a/cxmanage_api/node.py b/cxmanage_api/node.py index 186c149..9edd672 100644 --- a/cxmanage_api/node.py +++ b/cxmanage_api/node.py @@ -1429,6 +1429,17 @@ class Node(object): """ return self.bmc.fabric_get_uplink_speed() + def get_uplink_info(self): + """Get the uplink information for this node. + >>> node.get_uplink_info() + 'Node 0: eth0 0, eth1 0, mgmt 0' + + :return: The uplink information for this node + :rtype: string + + """ + return self.bmc.fabric_get_uplink_info().strip() + def _run_fabric_command(self, function_name, **kwargs): """Handles the basics of sending a node a command for fabric data.""" filename = temp_file() |