summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kraft <george.kraft@calxeda.com>2013-05-01 16:35:14 -0500
committerGeorge Kraft <george.kraft@calxeda.com>2013-05-01 16:35:14 -0500
commita9464db8689fc76cd21809cc0bb7f1ecfb3ca007 (patch)
tree9d00e6596c2ed3cb97665ad8a81d3e405342577b
parentf8b64ece449102e6f38bf31cbe48f2e509633916 (diff)
downloadcxmanage-a9464db8689fc76cd21809cc0bb7f1ecfb3ca007.tar.gz
fabric/node: Clean up macaddr commands
Removed set_interface_mac_address and get_interface_mac_address, since they were broken and don't align with anything in ipmi that I can see. Added Node.add_macaddr and Node.rm_macaddr. Fixed the Node.node_id property.
-rw-r--r--cxmanage_api/fabric.py6
-rw-r--r--cxmanage_api/node.py40
2 files changed, 22 insertions, 24 deletions
diff --git a/cxmanage_api/fabric.py b/cxmanage_api/fabric.py
index 0c46dd9..05607c9 100644
--- a/cxmanage_api/fabric.py
+++ b/cxmanage_api/fabric.py
@@ -739,7 +739,8 @@ class Fabric(object):
"""
# This command is a case where we should avoid using _run_command,
# because we can just add the macaddr using primary node
- self.primary_node.bmc.fabric_add_macaddr(nodeid, iface, macaddr)
+ self.primary_node.bmc.fabric_add_macaddr(nodeid=nodeid, iface=iface,
+ macaddr=macaddr)
def rm_macaddr(self, nodeid, iface, macaddr):
"""Remove a macaddr to a node/interface in the fabric.
@@ -756,7 +757,8 @@ class Fabric(object):
"""
# This command is a case where we should avoid using _run_command,
# because we can just add the macaddr using primary node
- self.primary_node.bmc.fabric_rm_macaddr(nodeid, iface, macaddr)
+ self.primary_node.bmc.fabric_rm_macaddr(nodeid=nodeid, iface=iface,
+ macaddr=macaddr)
def get_linkspeed_policy(self):
"""Get the global linkspeed policy for the fabric. In the partition
diff --git a/cxmanage_api/node.py b/cxmanage_api/node.py
index 1b7ad55..b25a37b 100644
--- a/cxmanage_api/node.py
+++ b/cxmanage_api/node.py
@@ -143,7 +143,7 @@ class Node(object):
"""
if self._node_id == None:
- self._node_id = self.bmc.get_fabric_node_id()
+ self._node_id = self.bmc.fabric_get_node_id()
return self._node_id
@node_id.setter
@@ -160,7 +160,7 @@ class Node(object):
"""Gets a dictionary of MAC addresses for this node. The dictionary
maps each port/interface to a list of MAC addresses for that interface.
- >>> node.get_macaddrs()
+ >>> node.get_mac_addresses()
{
0: ['fc:2f:40:3b:ec:40'],
1: ['fc:2f:40:3b:ec:41'],
@@ -173,39 +173,35 @@ class Node(object):
"""
return self.get_fabric_macaddrs()[self.node_id]
- def set_interface_mac_address(self, interface, macaddr):
- """set mac address for an interface
+ def add_macaddr(self, iface, macaddr):
+ """Add mac address on an interface
- >>> node.set_interface_mac_address(interface, macaddr)
- fc:2f:40:d8:e3:14
+ >>> node.add_macaddr(iface, macaddr)
- :return: The Node's current mac address for specified interface
- :rtype: string
+ :param iface: Interface to add to
+ :type iface: integer
+ :param macaddr: MAC address to add
+ :type macaddr: string
:raises IpmiError: If errors in the command occur with BMC communication.
"""
- try:
- return self.bmc.set_node_interface_macaddr(interface, macaddr)
- except IpmiError as e:
- raise IpmiError(self._parse_ipmierror(e))
+ self.bmc.fabric_add_macaddr(iface=iface, macaddr=macaddr)
- def get_interface_mac_address(self, interface):
- """Return mac address for an interface
+ def rm_macaddr(self, iface, macaddr):
+ """Remove mac address from an interface
- >>> node.get_interface_mac_address(interface)
- fc:2f:40:d8:e3:14
+ >>> node.rm_macaddr(iface, macaddr)
- :return: The Node's current mac address for specified interface
- :rtype: string
+ :param iface: Interface to remove from
+ :type iface: integer
+ :param macaddr: MAC address to remove
+ :type macaddr: string
:raises IpmiError: If errors in the command occur with BMC communication.
"""
- try:
- return self.bmc.get_node_interface_macaddr(interface)
- except IpmiError as e:
- raise IpmiError(self._parse_ipmierror(e))
+ self.bmc.fabric_rm_macaddr(iface=iface, macaddr=macaddr)
def get_power(self):
"""Returns the power status for this node.