Fabric

Fabric The Fabric class provides management of multiple nodes.
Fabric.add_macaddr Add a new macaddr to a node/interface in the fabric.
Fabric.apply_factory_default_config Sets the fabric config to factory default
Fabric.config_reset Resets the configuration on all nodes to factory defaults.
Fabric.get_boot_order Gets the boot order from all nodes.
Fabric.get_depth_chart Get the depth_chart for the fabric.
Fabric.get_firmware_info Gets the firmware info from all nodes.
Fabric.get_firmware_info_dict Gets the firmware info from all nodes.
Fabric.get_ipaddr_base The base IPv4 address for a range of static IP addresses used
Fabric.get_ipsrc Return the ipsrc for the fabric.
Fabric.get_link_stats Get the link_stats for each node in the fabric.
Fabric.get_link_users_factor Get the global link users factor for the fabric.
Fabric.get_linkmap Get the linkmap for each node in the fabric.
Fabric.get_linkspeed Get the global linkspeed for the fabric.
Fabric.get_linkspeed_policy Get the global linkspeed policy for the fabric.
Fabric.get_mac_addresses Gets MAC addresses from all nodes.
Fabric.get_power Returns the power status for all nodes.
Fabric.get_power_policy Gets the power policy from all nodes.
Fabric.get_routing_table Get the routing_table for the fabric.
Fabric.get_sensors Gets sensors from all nodes.
Fabric.get_server_ip Get the server IP address from all nodes. The nodes must be powered
Fabric.get_ubootenv Gets the u-boot environment from all nodes.
Fabric.get_uplink Get the uplink for an interface to xmit a packet out of the cluster.
Fabric.get_uplink_info Gets the fabric uplink info.
Fabric.get_versions Gets the version info from all nodes.
Fabric.get_versions_dict Gets the version info from all nodes.
Fabric.ipmitool_command Run an arbitrary IPMItool command on all nodes.
Fabric.is_updatable Checks to see if all nodes can be updated with this fw package.
Fabric.mc_reset Resets the management controller on all nodes.
Fabric.nodes List of nodes in this fabric.
Fabric.primary_node The node to use for fabric config operations.
Fabric.rm_macaddr Remove a macaddr to a node/interface in the fabric.
Fabric.set_boot_order Sets the boot order on all nodes.
Fabric.set_ipsrc Set the ipsrc for the fabric.
Fabric.set_link_users_factor Set the global link users factor for the fabric.
Fabric.set_linkspeed Set the global linkspeed for the fabric.
Fabric.set_linkspeed_policy Set the global linkspeed policy for the fabric.
Fabric.set_power Send an IPMI power command to all nodes.
Fabric.set_power_policy Sets the power policy on all nodes.
Fabric.set_uplink Set the uplink for an interface to xmit a packet out of the cluster.
Fabric.tftp Returns the tftp server for this Fabric.
Fabric.update_config Push out updated configuration data for all nodes in the fabric.
Fabric.update_firmware Updates the firmware on all nodes.
class Fabric(ip_address, username='admin', password='admin', tftp=None, ecme_tftp_port=5001, task_queue=None, verbose=False, node=None)[source]

Bases: object

The Fabric class provides management of multiple nodes.

>>> from cxmanage_api.fabric import Fabric
>>> fabric = Fabric('10.20.1.9')
Parameters:
  • ip_address (string) – The ip_address of ANY known node for the Fabric.
  • username (string) – The login username credential. [Default admin]
  • password (string) – The login password credential. [Default admin]
  • tftp (Tftp) – Tftp server to facilitate IPMI command responses.
  • task_queue (TaskQueue) – TaskQueue to use for sending commands.
  • verbose (boolean) – Flag to turn on verbose output (cmd/response).
  • node (Node) – Node type, for dependency integration.
add_macaddr(nodeid, iface, macaddr)[source]

Add a new macaddr to a node/interface in the fabric.

>>> fabric.add_macaddr(3, 1, "66:55:44:33:22:11")
Parameters:
  • nodeid (integer) – Node id to which the macaddr is to be added
  • iface (integer) – interface on the node to which the macaddr is to be added
  • macaddr (string) – mac address to be added
apply_factory_default_config()[source]

Sets the fabric config to factory default

>>> fabric.apply_factory_default_config()
config_reset(async=False)[source]

Resets the configuration on all nodes to factory defaults.

>>> fabric.config_reset()
{0: None, 1: None, 2: None, 3: None}
Parameters:async (boolean) – Flag that determines if the command result (dictionary) is returned or a Command object (can get status, etc.).
get_boot_order(async=False)[source]

Gets the boot order from all nodes.

>>> fabric.get_boot_order()
{
 0: ['disk', 'pxe'],
 1: ['disk', 'pxe'],
 2: ['disk', 'pxe'],
 3: ['disk', 'pxe']
}
Parameters:async (boolean) – Flag that determines if the command result (dictionary) is returned or a Command object (can get status, etc.).
Returns:The boot order of each node on this fabric.
Return type:dictionary or Task
get_depth_chart(async=False)[source]

Get the depth_chart for the fabric.

Parameters:async (boolean) – Flag that determines if the command result (dictionary) is returned or a Task object (can get status, etc.).
Returns:The depth_chart for the fabric.
Return type:dictionary
get_firmware_info(async=False)[source]

Gets the firmware info from all nodes.

>>> fabric.get_firmware_info()
{
 0: [<pyipmi.fw.FWInfo object at 0x2808110>, ...],
 1: [<pyipmi.fw.FWInfo object at 0x28080d0>, ...],
 2: [<pyipmi.fw.FWInfo object at 0x2808090>, ...],
 3: [<pyipmi.fw.FWInfo object at 0x7f35540660d0>, ...]
}
Parameters:async (boolean) – Flag that determines if the command result (dictionary) is returned or a Command object (can get status, etc.).
Returns:THe firmware info for all nodes.
Return type:dictionary or Task
get_firmware_info_dict(async=False)[source]

Gets the firmware info from all nodes.

>>> fabric.get_firmware_info_dict()
{0:
   [
    #
    # Each dictionary (in order) in this list represents the
    # corresponding partition information
    #
     {# Partition 0
      'daddr'     : '20029000',
      'flags'     : 'fffffffd',
      'in_use'    : 'Unknown',
      'offset'    : '00000000',
      'partition' : '00',
      'priority'  : '0000000c',
      'size'      : '00005000',
      'type'      : '02 (S2_ELF)',
      'version'   : 'v0.9.1'
     },
     # Partitions 1 - 17
   ],
 #
 # Output trimmed for brevity ... The remaining Nodes in the Fabric
 # would display all the partition format in the same manner.
 #
}
Parameters:async (boolean) – Flag that determines if the command result (dictionary) is returned or a Command object (can get status, etc.).
Returns:The firmware info for all nodes.
Return type:dictionary or Task
get_ipaddr_base()[source]

The base IPv4 address for a range of static IP addresses used for the nodes in the fabric

>>> fabric.get_ipaddr_base()
'192.168.100.1'
Returns:The first IP address in the range of static IP addresses
Return type:string
get_ipsrc()[source]

Return the ipsrc for the fabric.

>>> fabric.get_ipsrc()
2
Returns:1 for static, 2 for DHCP
Return type:integer

Get the link_stats for each node in the fabric.

Parameters:
  • link (integer) – The link to get stats for (0-4).
  • async (boolean) – Flag that determines if the command result (dictionary) is returned or a Task object (can get status, etc.).
Returns:

The link_stats for each link on each node.

Return type:

dictionary

Get the global link users factor for the fabric. In the partition world this means the link users factor for Configuration 0, Partition 0, Profile 0.

>>> fabric.get_link_users_factor()
1
Returns:Link users factor for the fabric.
Return type:integer
get_linkmap(async=False)[source]

Get the linkmap for each node in the fabric.

Parameters:async (boolean) – Flag that determines if the command result (dictionary) is returned or a Task object (can get status, etc.).
Returns:The linkmap for each node.
Return type:dectionary
get_linkspeed()[source]

Get the global linkspeed for the fabric. In the partition world this means the linkspeed for Configuration 0, Partition 0, Profile 0.

>>> fabric.get_linkspeed()
2.5
Returns:Linkspeed for the fabric.
Return type:float
get_linkspeed_policy()[source]

Get the global linkspeed policy for the fabric. In the partition world this means the linkspeed for Configuration 0, Partition 0, Profile 0.

>>> fabric.get_linkspeed_policy()
1
Returns:Linkspeed Policy for the fabric.
Return type:integer
get_mac_addresses()[source]

Gets MAC addresses from all nodes.

>>> fabric.get_mac_addresses()
{
 0: ['fc:2f:40:3b:ec:40', 'fc:2f:40:3b:ec:41', 'fc:2f:40:3b:ec:42'],
 1: ['fc:2f:40:91:dc:40', 'fc:2f:40:91:dc:41', 'fc:2f:40:91:dc:42'],
 2: ['fc:2f:40:ab:f7:14', 'fc:2f:40:ab:f7:15', 'fc:2f:40:ab:f7:16'],
 3: ['fc:2f:40:88:b3:6c', 'fc:2f:40:88:b3:6d', 'fc:2f:40:88:b3:6e']
}
Parameters:async (boolean) – Flag that determines if the command result (dictionary) is returned or a Task object (can get status, etc.).
Returns:The MAC addresses for each node.
Return type:dictionary
get_power(async=False)[source]

Returns the power status for all nodes.

>>> fabric.get_power()
{0: False, 1: False, 2: False, 3: False}
Parameters:async (boolean) – Flag that determines if the command result (dictionary) is returned or a Command object (for cmd status, etc.).
Returns:The power status of each node.
Return type:dictionary or Task
get_power_policy(async=False)[source]

Gets the power policy from all nodes.

>>> fabric.get_power_policy()
{0: 'always-on', 1: 'always-on', 2: 'always-on', 3: 'always-on'}
Parameters:async (boolean) – Flag that determines if the command result (dictionary) is returned or a Command object (can get status, etc.).
Returns:The power policy for all nodes on this fabric.
Return type:dictionary or Task
get_routing_table(async=False)[source]

Get the routing_table for the fabric.

Parameters:async (boolean) – Flag that determines if the command result (dictionary) is returned or a Task object (can get status, etc.).
Returns:The routing_table for the fabric.
Return type:dictionary
get_sensors(search='', async=False)[source]

Gets sensors from all nodes.

>>> fabric.get_sensors()
{
 0: {
     'DRAM VDD Current' : <pyipmi.sdr.AnalogSdr object at 0x1a1eb50>,
     'DRAM VDD Voltage' : <pyipmi.sdr.AnalogSdr object at 0x1a1ef10>,
     'MP Temp 0'        : <pyipmi.sdr.AnalogSdr object at 0x1a1ec90>,
     'Node Power'       : <pyipmi.sdr.AnalogSdr object at 0x1a1ed90>,
     'TOP Temp 0'       : <pyipmi.sdr.AnalogSdr object at 0x1a1ecd0>,
     'TOP Temp 1'       : <pyipmi.sdr.AnalogSdr object at 0x1a1ed50>,
     'TOP Temp 2'       : <pyipmi.sdr.AnalogSdr object at 0x1a1edd0>,
     'Temp 0'           : <pyipmi.sdr.AnalogSdr object at 0x1a1ead0>,
     'Temp 1'           : <pyipmi.sdr.AnalogSdr object at 0x1a1ebd0>,
     'Temp 2'           : <pyipmi.sdr.AnalogSdr object at 0x1a1ec10>,
     'Temp 3'           : <pyipmi.sdr.AnalogSdr object at 0x1a1ec50>,
     'V09 Current'      : <pyipmi.sdr.AnalogSdr object at 0x1a1ef90>,
     'V09 Voltage'      : <pyipmi.sdr.AnalogSdr object at 0x1a1ee90>,
     'V18 Current'      : <pyipmi.sdr.AnalogSdr object at 0x1a1ef50>,
     'V18 Voltage'      : <pyipmi.sdr.AnalogSdr object at 0x1a1ee50>,
     'VCORE Current'    : <pyipmi.sdr.AnalogSdr object at 0x1a1efd0>,
     'VCORE Power'      : <pyipmi.sdr.AnalogSdr object at 0x1a1ee10>,
     'VCORE Voltage'    : <pyipmi.sdr.AnalogSdr object at 0x1a1eed0>
    },
    #
    # Output trimmed for brevity ... The output would be the same
    # (format) for the remaining 3 ECMEs on this system.
    #
},

Note

  • Output condensed for brevity.
  • If the name parameter is not specified, all sensors are returned.
Parameters:
  • name (string) – Name of the sensor to get. (for all nodes)
  • async (boolean) – Flag that determines if the command result (dictionary) is returned or a Command object (can get status, etc.).
get_server_ip(interface=None, ipv6=False, user='user1', password='1Password', aggressive=False, async=False)[source]

Get the server IP address from all nodes. The nodes must be powered on for this to work.

>>> fabric.get_server_ip()
{
 0: '192.168.100.100',
 1: '192.168.100.101',
 2: '192.168.100.102',
 3: '192.168.100.103'
}
Parameters:
  • interface (string) – Network interface to check (e.g. eth0).
  • ipv6 (boolean) – Return an IPv6 address instead of IPv4.
  • user (string) – Linux username.
  • password (string) – Linux password.
  • aggressive (boolean) – Discover the IP aggressively (may power cycle node).
  • async (boolean) – Flag that determines if the command result (dictionary) is returned or a Task object (can get status, etc.).
Returns:

Server IP addresses for all nodes..

Return type:

dictionary or Task

get_ubootenv(async=False)[source]

Gets the u-boot environment from all nodes.

>>> fabric.get_ubootenv()
{
 0: <cxmanage_api.ubootenv.UbootEnv instance at 0x7fc2d4058098>,
 1: <cxmanage_api.ubootenv.UbootEnv instance at 0x7fc2d4058908>,
 2: <cxmanage_api.ubootenv.UbootEnv instance at 0x7fc2d40582d8>,
 3: <cxmanage_api.ubootenv.UbootEnv instance at 0x7fc2d40589e0>
}
Parameters:async (boolean) – Flag that determines if the command result (dictionary) is returned or a Task object (can get status, etc.).
Returns:UBootEnvironment objects for all nodes.
Return type:dictionary or Task

Get the uplink for an interface to xmit a packet out of the cluster.

>>> fabric.get_uplink(0)
0
Parameters:iface (integer) – The interface for the uplink.
Returns:The uplink iface is using.
Return type:integer

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}
}
Parameters:async (boolean) – Flag that determines if the command result (dictionary) is returned or a Task object (can get status, etc.).
Returns:The uplink info for each node.
Return type:dictionary
get_versions(async=False)[source]

Gets the version info from all nodes.

>>> fabric.get_versions()
{
 0: <pyipmi.info.InfoBasicResult object at 0x1f74150>,
 1: <pyipmi.info.InfoBasicResult object at 0x1f745d0>,
 2: <pyipmi.info.InfoBasicResult object at 0x1f743d0>,
 3: <pyipmi.info.InfoBasicResult object at 0x1f74650>
}
Parameters:async (boolean) – Flag that determines if the command result (dictionary) is returned or a Command object (can get status, etc.).
Returns:The basic SoC info for all nodes.
Return type:dictionary or Task
get_versions_dict(async=False)[source]

Gets the version info from all nodes.

>>> fabric.get_versions_dict()
{0:
    {
     'a9boot_version'   : 'v2012.10.16',
     'bootlog_version'  : 'v0.9.1-39-g7e10987',
     'build_number'     : '7E10987C',
     'card'             : 'EnergyCard X02',
     'cdb_version'      : 'v0.9.1-39-g7e10987',
     'dtb_version'      : 'v3.6-rc1_cx_2012.10.02',
     'header'           : 'Calxeda SoC (0x0096CD)',
     'soc_version'      : 'v0.9.1',
     'stage2_version'   : 'v0.9.1',
     'timestamp'        : '1352911670',
     'uboot_version'    : 'v2012.07_cx_2012.10.29',
     'ubootenv_version' : 'v2012.07_cx_2012.10.29',
     'version'          : 'ECX-1000-v1.7.1'
    },
 #
 # Output trimmed for brevity ... Each remaining Nodes get_versions
 # dictionary would be printed.
 #
}
Parameters:async (boolean) – Flag that determines if the command result (dictionary) is returned or a Task object (can get status, etc.).
Returns:The basic SoC info for all nodes.
Return type:dictionary or Task
ipmitool_command(ipmitool_args, asynchronous=False)[source]

Run an arbitrary IPMItool command on all nodes.

>>> # Gets eth0's MAC Address for each node ...
>>> fabric.ipmitool_command(['cxoem', 'fabric', 'get', 'macaddr',
>>> ...'interface', '0'])
{
 0: 'fc:2f:40:3b:ec:40',
 1: 'fc:2f:40:91:dc:40',
 2: 'fc:2f:40:ab:f7:14',
 3: 'fc:2f:40:88:b3:6c'
}
Parameters:
  • ipmitool_args (list) – Arguments to pass on to the ipmitool command.
  • async (boolean) – Flag that determines if the command result (dictionary) is returned or a Task object (can get status, etc.).
Returns:

IPMI command response.

Return type:

string

is_updatable(package, partition_arg='INACTIVE', priority=None, async=False)[source]

Checks to see if all nodes can be updated with this fw package.

>>> fabric.is_updatable(package=fwpkg)
{0: True, 1: True, 2: True, 3: True}
Parameters:
  • package (FirmwarePackage) – Firmware package to test for updating.
  • partition (string) – Partition to test for updating.
  • priority (integer) – SIMG Header priority.
  • async (boolean) – Flag that determines if the command result (dictionary) is returned or a Command object (can get status, etc.).
Returns:

Whether or not a node can be updated with the specified firmware package.

Return type:

dictionary or Task

mc_reset(wait=False, async=False)[source]

Resets the management controller on all nodes.

>>> fabric.mc_reset()
Parameters:
  • wait (boolean) – Wait for the nodes to come back up.
  • async (boolean) – Flag that determines if the command result (dictionary) is returned or a Command object (can get status, etc.).
nodes[source]

List of nodes in this fabric.

>>> fabric.nodes
{
 0: <cxmanage_api.node.Node object at 0x2052710>,
 1: <cxmanage_api.node.Node object at 0x2052790>,
 2: <cxmanage_api.node.Node object at 0x2052850>,
 3: <cxmanage_api.node.Node object at 0x2052910>
}

Note

  • Fabric nodes are lazily initialized.
Returns:A mapping of node ids to node objects.
Return type:dictionary
primary_node[source]

The node to use for fabric config operations.

Today, this is always node 0.

>>> fabric.primary_node
<cxmanage_api.node.Node object at 0x210d790>
Returns:Node object for primary node
Return type:Node object
rm_macaddr(nodeid, iface, macaddr)[source]

Remove a macaddr to a node/interface in the fabric.

>>> fabric.rm_macaddr(3, 1, "66:55:44:33:22:11")
Parameters:
  • nodeid (integer) – Node id from which the macaddr is to be remove
  • iface (integer) – interface on the node from which the macaddr is to be removed
  • macaddr (string) – mac address to be removed
set_boot_order(boot_args, async=False)[source]

Sets the boot order on all nodes.

>>> fabric.set_boot_order(boot_args=['pxe', 'disk'])
Parameters:
  • boot_args (list) – Boot order list.
  • async (boolean) – Flag that determines if the command result (dictionary) is returned or a Command object (can get status, etc.).
set_ipsrc(ipsrc_mode)[source]

Set the ipsrc for the fabric.

>>> fabric.set_ipsrc(2)
Parameters:ipsrc_mode (integer) – 1 for static, 2 for DHCP

Set the global link users factor for the fabric. In the partition world this means the link users factor for Configuration 0, Partition 0, Profile 0.

>>> fabric.set_link_users_factor(10)
Parameters:lu_factor (integer) – Multiplying factor for topological linkspeeds
set_linkspeed(linkspeed)[source]

Set the global linkspeed for the fabric. In the partition world this means the linkspeed for Configuration 0, Partition 0, Profile 0.

>>> fabric.set_linkspeed(10)
Parameters:linkspeed (float) – Linkspeed specified in Gbps.
set_linkspeed_policy(ls_policy)[source]

Set the global linkspeed policy for the fabric. In the partition world this means the linkspeed policy for Configuration 0, Partition 0, Profile 0.

>>> fabric.set_linkspeed_policy(1)
Parameters:linkspeed (integer) – Linkspeed Policy. 0: Fixed, 1: Topological
set_power(mode, async=False)[source]

Send an IPMI power command to all nodes.

>>> # On ...
>>> fabric.set_power(mode='on')
>>> # Off ...
>>> fabric.set_power(mode='off')
>>> # Sanity check ...
>>> fabric.get_power()
{0: False, 1: False, 2: False, 3: False}
Parameters:
  • mode (string) – Mode to set the power to (for all nodes).
  • async (boolean) – Flag that determines if the command result (dictionary) is returned or a Command object (can get status, etc.).
set_power_policy(state, async=False)[source]

Sets the power policy on all nodes.

>>> fabric.set_power_policy(state='always-off')
>>> # Check to see if it took ...
>>> fabric.get_power_policy()
{0: 'always-off', 1: 'always-off', 2: 'always-off', 3: 'always-off'}
Parameters:
  • state (string) – State to set the power policy to for all nodes.
  • async (boolean) – Flag that determines if the command result (dictionary) is returned or a Command object (can get status, etc.).

Set the uplink for an interface to xmit a packet out of the cluster.

>>> fabric.set_uplink(0,0)
Parameters:
  • uplink (integer) – The uplink to set.
  • iface (integer) – The interface for the uplink.
tftp[source]

Returns the tftp server for this Fabric.

>>> fabric.tftp
<cxmanage_api.tftp.InternalTftp object at 0x7f5ebbd20b10>
Returns:The tftp server.
Return type:Tftp
update_config()[source]

Push out updated configuration data for all nodes in the fabric.

>>> fabric.update_config()
update_firmware(package, partition_arg='INACTIVE', priority=None, async=False)[source]

Updates the firmware on all nodes.

>>> fabric.update_firmware(package=fwpkg)
Parameters:
  • package – Firmware package to update to.
  • partition_arg (string) – Which partition to update.
  • priority (integer) – SIMG header Priority setting.
  • async (boolean) – Flag that determines if the command result (dictionary) is returned or a Command object (can get status, etc.).

Previous topic

Node

Next topic

Tasks