Node

Node A node is a single instance of an ECME.
Node.add_macaddr Add mac address on an interface
Node.config_reset Resets configuration to factory defaults.
Node.get_boot_order Returns the boot order for this node.
Node.get_depth_chart Gets a table indicating the distance from a given node to all other nodes on each fabric link.
Node.get_fabric_ipinfo Gets what ip information THIS node knows about the Fabric.
Node.get_fabric_macaddrs Gets what macaddr information THIS node knows about the Fabric.
Node.get_fabric_uplink_info Gets what uplink information THIS node knows about the Fabric.
Node.get_firmware_info Gets firmware info for each partition on the Node.
Node.get_firmware_info_dict Gets firmware info for each partition on the Node.
Node.get_link_stats Gets the linkstats for the link specified.
Node.get_linkmap Gets the src and destination of each link on a node.
Node.get_linkspeed Get the linkspeed for the node.
Node.get_mac_addresses Gets a dictionary of MAC addresses for this node. The dictionary
Node.get_power Returns the power status for this node.
Node.get_power_policy Return power status reported by IPMI.
Node.get_routing_table Gets the routing table as instantiated in the fabric switch.
Node.get_sensors Get a list of sensor objects that match search criteria.
Node.get_sensors_dict Get a list of sensor dictionaries that match search criteria.
Node.get_server_ip Get the IP address of the Linux server. The server must be powered
Node.get_ubootenv Get the active u-boot environment.
Node.get_uplink Get the uplink a MAC will use when transmitting a packet out of the
Node.get_versions Get version info from this node.
Node.get_versions_dict Get version info from this node.
Node.ipmitool_command Send a raw ipmitool command to the node.
Node.is_updatable Checks to see if the node can be updated with this firmware package.
Node.mc_reset Sends a Master Control reset command to the node.
Node.node_id Returns the numerical ID for this node.
Node.rm_macaddr Remove mac address from an interface
Node.set_boot_order Sets boot-able device order for this node.
Node.set_power Send an IPMI power command to this target.
Node.set_power_policy Set default power state for Linux side.
Node.set_uplink Set the uplink a MAC will use when transmitting a packet out of the
Node.tftp_address Returns the tftp_address (ip:port) that this node is using.
Node.update_firmware Update firmware on this target.
class Node(ip_address, username='admin', password='admin', tftp=None, ecme_tftp_port=5001, verbose=False, bmc=None, image=None, ubootenv=None, ipretriever=None)[source]

Bases: object

A node is a single instance of an ECME.

>>> # Typical usage ...
>>> from cxmanage_api.node import Node
>>> node = Node(ip_adress='10.20.1.9', verbose=True)
Parameters:
  • ip_address (string) – The ip_address of the Node.
  • username (string) – The login username credential. [Default admin]
  • password (string) – The login password credential. [Default admin]
  • tftp (Tftp) – The internal/external TFTP server to use for data xfer.
  • verbose (boolean) – Flag to turn on verbose output (cmd/response).
  • bmc (BMC) – BMC object for this Node. Default: pyipmi.bmc.LanBMC
  • image (Image) – Image object for this node. Default cxmanage_api.Image
  • ubootenv (UbootEnv) – UbootEnv for this node. Default cxmanage_api.UbootEnv
add_macaddr(iface, macaddr)[source]

Add mac address on an interface

>>> node.add_macaddr(iface, macaddr)
Parameters:
  • iface (integer) – Interface to add to
  • macaddr (string) – MAC address to add
Raises IpmiError:
 

If errors in the command occur with BMC communication.

config_reset()[source]

Resets configuration to factory defaults.

>>> node.config_reset()
Raises:
  • IpmiError – If errors in the command occur with BMC communication.
  • Exception – If there are errors within the command response.
get_boot_order()[source]

Returns the boot order for this node.

>>> node.get_boot_order()
['pxe', 'disk']
get_depth_chart()[source]

Gets a table indicating the distance from a given node to all other nodes on each fabric link.

Returns:

Returns a map of target->(neighbor, hops), [other (neighbors,hops)]

Return type:

dictionary

Raises:
  • IpmiError – If the IPMI command fails.
  • TftpException – If the TFTP transfer fails.
get_fabric_ipinfo()[source]

Gets what ip information THIS node knows about the Fabric.

>>> node.get_fabric_ipinfo()
{0: '10.20.1.9', 1: '10.20.2.131', 2: '10.20.0.220', 3: '10.20.2.5'}
Returns:

Returns a map of node_ids->ip_addresses.

Return type:

dictionary

Raises:
  • IpmiError – If the IPMI command fails.
  • TftpException – If the TFTP transfer fails.
get_fabric_macaddrs()[source]

Gets what macaddr information THIS node knows about the Fabric.

Returns:

Returns a map of node_ids->ports->mac_addresses.

Return type:

dictionary

Raises:
  • IpmiError – If the IPMI command fails.
  • TftpException – If the TFTP transfer fails.

Gets what uplink information THIS node knows about the Fabric.

>>> node.get_fabric_uplink_info()
{'0': {'eth0': '0', 'eth1': '0', 'mgmt': '0'},
 '1': {'eth0': '0', 'eth1': '0', 'mgmt': '0'},
 '2': {'eth0': '0', 'eth1': '0', 'mgmt': '0'},
 '3': {'eth0': '0', 'eth1': '0', 'mgmt': '0'},
 '4': {'eth0': '0', 'eth1': '0', 'mgmt': '0'}}
Returns:

Returns a map of {node_id : {interface : uplink}}

Return type:

dictionary

Raises:
  • IpmiError – If the IPMI command fails.
  • TftpException – If the TFTP transfer fails.
get_firmware_info()[source]

Gets firmware info for each partition on the Node.

>>> node.get_firmware_info()
[<pyipmi.fw.FWInfo object at 0x2019850>,
<pyipmi.fw.FWInfo object at 0x2019b10>,
<pyipmi.fw.FWInfo object at 0x2019610>, ...]
Returns:

Returns a list of FWInfo objects for each

Return type:

list

Raises:
  • NoFirmwareInfoError – If no fw info exists for any partition.
  • IpmiError – If errors in the command occur with BMC communication.
get_firmware_info_dict()[source]

Gets firmware info for each partition on the Node.

Note

  • This function is the same as get_firmware_info(), only a dictionary of {attributes : values} is returned instead of an resultant FWInfo object.
>>> node.get_firmware_info_dict()
[
    {'daddr'     : '20029000',
     'in_use'    : 'Unknown',
     'partition' : '00',
     'priority'  : '0000000c',
     'version'   : 'v0.9.1',
     'flags'     : 'fffffffd',
     'offset'    : '00000000',
     'type'      : '02 (S2_ELF)',
     'size'      : '00005000'},
     .... # Output trimmed for brevity.
     .... # partitions
     .... # 1 - 16
    {'daddr'     : '20029000',
     'in_use'    : 'Unknown',
     'partition' : '17',
     'priority'  : '0000000b',
     'version'   : 'v0.9.1',
     'flags'     : 'fffffffd',
     'offset'    : '00005000',
     'type'      : '02 (S2_ELF)',
     'size'      : '00005000'}
]
Returns:

Returns a list of FWInfo objects for each

Return type:

list

Raises:
  • NoFirmwareInfoError – If no fw info exists for any partition.
  • IpmiError – If errors in the command occur with BMC communication.

Gets the linkstats for the link specified.

Parameters:link (integer) – The link to get stats for (0-4).
Returns:The linkstats for the link specified.
Return type:dictionary
Raises IpmiError:
 If the IPMI command fails.
get_linkmap()[source]

Gets the src and destination of each link on a node.

Returns:

Returns a map of link_id->node_id.

Return type:

dictionary

Raises:
  • IpmiError – If the IPMI command fails.
  • TftpException – If the TFTP transfer fails.
get_linkspeed(link=None, actual=False)[source]

Get the linkspeed for the node. This returns either the actual linkspeed based on phy controller register settings, or if sent to a primary node, the linkspeed setting for the Profile 0 of the currently active Configuration.

>>> fabric.get_linkspeed()
2.5
Parameters:
  • link (integer) – The fabric link number to read the linkspeed for.
  • actual (boolean) – WhetherThe fabric link number to read the linkspeed for.
Returns:

Linkspeed for the fabric..

Return type:

float

get_mac_addresses()[source]

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_mac_addresses()
{
 0: ['fc:2f:40:3b:ec:40'],
 1: ['fc:2f:40:3b:ec:41'],
 2: ['fc:2f:40:3b:ec:42']
}
Returns:MAC Addresses for all interfaces.
Return type:dictionary
get_power()[source]

Returns the power status for this node.

>>> # Powered ON system ...
>>> node.get_power()
True
>>> # Powered OFF system ...
>>> node.get_power()
False
Returns:The power state of the Node.
Return type:boolean
get_power_policy()[source]

Return power status reported by IPMI.

>>> node.get_power_policy()
'always-off'
Returns:The Nodes current power policy.
Return type:string
Raises IpmiError:
 If errors in the command occur with BMC communication.
get_routing_table()[source]

Gets the routing table as instantiated in the fabric switch.

Returns:

Returns a map of node_id->rt_entries.

Return type:

dictionary

Raises:
  • IpmiError – If the IPMI command fails.
  • TftpException – If the TFTP transfer fails.
get_sensors(search='')[source]

Get a list of sensor objects that match search criteria.

Note

  • If no sensor name is specified, ALL sensors will be returned.
>>> # Get ALL sensors ...
>>> node.get_sensors()
{
 'MP Temp 0'        : <pyipmi.sdr.AnalogSdr object at 0x1e63890>,
 'Temp 0'           : <pyipmi.sdr.AnalogSdr object at 0x1e63410>,
 'Temp 1'           : <pyipmi.sdr.AnalogSdr object at 0x1e638d0>,
 'Temp 2'           : <pyipmi.sdr.AnalogSdr object at 0x1e63690>,
 'Temp 3'           : <pyipmi.sdr.AnalogSdr object at 0x1e63950>,
 'VCORE Voltage'    : <pyipmi.sdr.AnalogSdr object at 0x1e63bd0>,
 'TOP Temp 2'       : <pyipmi.sdr.AnalogSdr object at 0x1e63ad0>,
 'TOP Temp 1'       : <pyipmi.sdr.AnalogSdr object at 0x1e63a50>,
 'TOP Temp 0'       : <pyipmi.sdr.AnalogSdr object at 0x1e639d0>,
 'VCORE Current'    : <pyipmi.sdr.AnalogSdr object at 0x1e63710>,
 'V18 Voltage'      : <pyipmi.sdr.AnalogSdr object at 0x1e63b50>,
 'V09 Current'      : <pyipmi.sdr.AnalogSdr object at 0x1e63990>,
 'Node Power'       : <pyipmi.sdr.AnalogSdr object at 0x1e63cd0>,
 'DRAM VDD Current' : <pyipmi.sdr.AnalogSdr object at 0x1e63910>,
 'DRAM VDD Voltage' : <pyipmi.sdr.AnalogSdr object at 0x1e634d0>,
 'V18 Current'      : <pyipmi.sdr.AnalogSdr object at 0x1e63c50>,
 'VCORE Power'      : <pyipmi.sdr.AnalogSdr object at 0x1e63c90>,
 'V09 Voltage'      : <pyipmi.sdr.AnalogSdr object at 0x1e63b90>
}
>>> # Get ANY sensor that 'contains' the substring of search in it ...
>>> node.get_sensors(search='Temp 0')
{
 'MP Temp 0'  : <pyipmi.sdr.AnalogSdr object at 0x1e63810>,
 'TOP Temp 0' : <pyipmi.sdr.AnalogSdr object at 0x1e63850>,
 'Temp 0'     : <pyipmi.sdr.AnalogSdr object at 0x1e63510>
}
Parameters:search (string) – Name of the sensor you wish to search for.
Returns:Sensor information.
Return type:dictionary of pyipmi objects
get_sensors_dict(search='')[source]

Get a list of sensor dictionaries that match search criteria.

>>> node.get_sensors_dict()
{
 'DRAM VDD Current':
    {
     'entity_id'              : '7.1',
     'event_message_control'  : 'Per-threshold',
     'lower_critical'         : '34.200',
     'lower_non_critical'     : '34.200',
     'lower_non_recoverable'  : '34.200',
     'maximum_sensor_range'   : 'Unspecified',
     'minimum_sensor_range'   : 'Unspecified',
     'negative_hysteresis'    : '0.800',
     'nominal_reading'        : '50.200',
     'normal_maximum'         : '34.200',
     'normal_minimum'         : '34.200',
     'positive_hysteresis'    : '0.800',
     'sensor_name'            : 'DRAM VDD Current',
     'sensor_reading'         : '1.200 (+/- 0) Amps',
     'sensor_type'            : 'Current',
     'status'                 : 'ok',
     'upper_critical'         : '34.200',
     'upper_non_critical'     : '34.200',
     'upper_non_recoverable'  : '34.200'
    },
     ... #
     ... # Output trimmed for brevity ... many more sensors ...
     ... #
 'VCORE Voltage':
     {
      'entity_id'             : '7.1',
      'event_message_control' : 'Per-threshold',
      'lower_critical'        : '1.100',
      'lower_non_critical'    : '1.100',
      'lower_non_recoverable' : '1.100',
      'maximum_sensor_range'  : '0.245',
      'minimum_sensor_range'  : 'Unspecified',
      'negative_hysteresis'   : '0.020',
      'nominal_reading'       : '1.000',
      'normal_maximum'        : '1.410',
      'normal_minimum'        : '0.720',
      'positive_hysteresis'   : '0.020',
      'sensor_name'           : 'VCORE Voltage',
      'sensor_reading'        : '0 (+/- 0) Volts',
      'sensor_type'           : 'Voltage',
      'status'                : 'ok',
      'upper_critical'        : '0.675',
      'upper_non_critical'    : '0.695',
      'upper_non_recoverable' : '0.650'
     }
}
>>> # Get ANY sensor name that has the string 'Temp 0' in it ...
>>> node.get_sensors_dict(search='Temp 0')
{
 'MP Temp 0':
    {
     'entity_id'              : '7.1',
     'event_message_control'  : 'Per-threshold',
     'lower_critical'         : '2.000',
     'lower_non_critical'     : '5.000',
     'lower_non_recoverable'  : '0.000',
     'maximum_sensor_range'   : 'Unspecified',
     'minimum_sensor_range'   : 'Unspecified',
     'negative_hysteresis'    : '4.000',
     'nominal_reading'        : '25.000',
     'positive_hysteresis'    : '4.000',
     'sensor_name'            : 'MP Temp 0',
     'sensor_reading'         : '0 (+/- 0) degrees C',
     'sensor_type'            : 'Temperature',
     'status'                 : 'ok',
     'upper_critical'         : '70.000',
     'upper_non_critical'     : '55.000',
     'upper_non_recoverable'  : '75.000'
    },
 'TOP Temp 0':
     {
      'entity_id'             : '7.1',
      'event_message_control' : 'Per-threshold',
      'lower_critical'        : '2.000',
      'lower_non_critical'    : '5.000',
      'lower_non_recoverable' : '0.000',
      'maximum_sensor_range'  : 'Unspecified',
      'minimum_sensor_range'  : 'Unspecified',
      'negative_hysteresis'   : '4.000',
      'nominal_reading'       : '25.000',
      'positive_hysteresis'   : '4.000',
      'sensor_name'           : 'TOP Temp 0',
      'sensor_reading'        : '33 (+/- 0) degrees C',
      'sensor_type'           : 'Temperature',
      'status'                : 'ok',
      'upper_critical'        : '70.000',
      'upper_non_critical'    : '55.000',
      'upper_non_recoverable' : '75.000'
     },
 'Temp 0':
     {
      'entity_id'             : '3.1',
      'event_message_control' : 'Per-threshold',
      'lower_critical'        : '2.000',
      'lower_non_critical'    : '5.000',
      'lower_non_recoverable' : '0.000',
      'maximum_sensor_range'  : 'Unspecified',
      'minimum_sensor_range'  : 'Unspecified',
      'negative_hysteresis'   : '4.000',
      'nominal_reading'       : '25.000',
      'positive_hysteresis'   : '4.000',
      'sensor_name'           : 'Temp 0',
      'sensor_reading'        : '0 (+/- 0) degrees C',
      'sensor_type'           : 'Temperature',
      'status'                : 'ok',
      'upper_critical'        : '70.000',
      'upper_non_critical'    : '55.000',
      'upper_non_recoverable' : '75.000'
     }
}

Note

  • This function is the same as get_sensors(), only a dictionary of {sensor : {attributes :values}} is returned instead of an resultant pyipmi object.
Parameters:search (string) – Name of the sensor you wish to search for.
Returns:Sensor information.
Return type:dictionary of dictionaries
get_server_ip(interface=None, ipv6=False, user='user1', password='1Password', aggressive=False)[source]

Get the IP address of the Linux server. The server must be powered on for this to work.

>>> node.get_server_ip()
'192.168.100.100'
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).
Returns:

The IP address of the server.

Return type:

string

Raises:
  • IpmiError – If errors in the command occur with BMC communication.
  • IPDiscoveryError – If the server is off, or the IP can’t be obtained.
get_ubootenv()[source]

Get the active u-boot environment.

>>> node.get_ubootenv()
<cxmanage_api.ubootenv.UbootEnv instance at 0x209da28>
Returns:U-Boot Environment object.
Return type:UBootEnv

Get the uplink a MAC will use when transmitting a packet out of the cluster.

>>> fabric.get_uplink(iface=1)
0
Parameters:iface (integer) – The interface for the uplink.
Returns:The uplink iface is connected to.
Return type:integer
Raises IpmiError:
 When any errors are encountered.
get_versions()[source]

Get version info from this node.

>>> node.get_versions()
<pyipmi.info.InfoBasicResult object at 0x2019b90>
>>> # Some useful information ...
>>> info.a9boot_version
'v2012.10.16'
>>> info.cdb_version
'v0.9.1'
Returns:

The results of IPMI info basic command.

Return type:

pyipmi.info.InfoBasicResult

Raises:
  • IpmiError – If errors in the command occur with BMC communication.
  • Exception – If there are errors within the command response.
get_versions_dict()[source]

Get version info from this node.

Note

  • This function is the same as get_versions(), only a dictionary of {attributes : values} is returned instead of an resultant pyipmi object.
>>> n.get_versions_dict()
{'soc_version'      : 'v0.9.1',
 'build_number'     : '7E10987C',
 'uboot_version'    : 'v2012.07_cx_2012.10.29',
 'ubootenv_version' : 'v2012.07_cx_2012.10.29',
 'timestamp'        : '1352911670',
 'cdb_version'      : 'v0.9.1-39-g7e10987',
 'header'           : 'Calxeda SoC (0x0096CD)',
 'version'          : 'ECX-1000-v1.7.1',
 'bootlog_version'  : 'v0.9.1-39-g7e10987',
 'a9boot_version'   : 'v2012.10.16',
 'stage2_version'   : 'v0.9.1',
 'dtb_version'      : 'v3.6-rc1_cx_2012.10.02',
 'card'             : 'EnergyCard X02'
}
Returns:

The results of IPMI info basic command.

Return type:

dictionary

Raises:
  • IpmiError – If errors in the command occur with BMC communication.
  • Exception – If there are errors within the command response.
ipmitool_command(ipmitool_args)[source]

Send a raw ipmitool command to the node.

>>> node.ipmitool_command(['cxoem', 'info', 'basic'])
'Calxeda SoC (0x0096CD)\n  Firmware Version: ECX-1000-v1.7.1-dirty\n
SoC Version: 0.9.1\n  Build Number: A69523DC \n
Timestamp (1351543656): Mon Oct 29 15:47:36 2012'
Parameters:ipmitool_args (list) – Arguments to pass to the ipmitool.
is_updatable(package, partition_arg='INACTIVE', priority=None)[source]

Checks to see if the node can be updated with this firmware package.

>>> from cxmanage_api.firmware_package import FirmwarePackage
>>> fwpkg = FirmwarePackage('ECX-1000_update-v1.7.1-dirty.tar.gz')
>>> fwpkg.version
'ECX-1000-v1.7.1-dirty'
>>> node.is_updatable(fwpkg)
True
Returns:Whether the node is updatable or not.
Return type:boolean
mc_reset(wait=False)[source]

Sends a Master Control reset command to the node.

>>> node.mc_reset()
Parameters:

wait (boolean) – Wait for the node to come back up.

Raises:
  • Exception – If the BMC command contains errors.
  • IPMIError – If there is an IPMI error communicating with the BMC.
node_id[source]

Returns the numerical ID for this node.

>>> node.node_id
0
Returns:The ID of this node.
Return type:integer
rm_macaddr(iface, macaddr)[source]

Remove mac address from an interface

>>> node.rm_macaddr(iface, macaddr)
Parameters:
  • iface (integer) – Interface to remove from
  • macaddr (string) – MAC address to remove
Raises IpmiError:
 

If errors in the command occur with BMC communication.

set_boot_order(boot_args)[source]

Sets boot-able device order for this node.

>>> node.set_boot_order(boot_args=['pxe', 'disk'])
Parameters:boot_args (list) – Arguments list to pass on to the uboot environment.
set_power(mode)[source]

Send an IPMI power command to this target.

>>> # To turn the power 'off'
>>> node.set_power(mode='off')
>>> # A quick 'get' to see if it took effect ...
>>> node.get_power()
False
>>> # To turn the power 'on'
>>> node.set_power(mode='on')
Parameters:mode (string) – Mode to set the power state to. (‘on’/’off’)
set_power_policy(state)[source]

Set default power state for Linux side.

>>> # Set the state to 'always-on'
>>> node.set_power_policy(state='always-on')
>>> # A quick check to make sure our setting took ...
>>> node.get_power_policy()
'always-on'
Parameters:state (string) – State to set the power policy to.

Set the uplink a MAC will use when transmitting a packet out of the cluster.

>>> #
>>> # Set eth0 to uplink 1 ...
>>> #
>>> fabric.set_uplink(uplink=1,iface=0)
Parameters:
  • uplink (integer) – The uplink to set.
  • iface (integer) – The interface for the uplink.
Raises IpmiError:
 

When any errors are encountered.

tftp_address[source]

Returns the tftp_address (ip:port) that this node is using.

>>> node.tftp_address
'10.20.2.172:35123'
Returns:The tftp address and port that this node is using.
Return type:string
update_firmware(package, partition_arg='INACTIVE', priority=None)[source]

Update firmware on this target.

>>> from cxmanage_api.firmware_package import FirmwarePackage
>>> fwpkg = FirmwarePackage('ECX-1000_update-v1.7.1-dirty.tar.gz')
>>> fwpkg.version
'ECX-1000-v1.7.1-dirty'
>>> node.update_firmware(package=fwpkg)
Parameters:
  • package (FirmwarePackage) – Firmware package to deploy.
  • partition_arg (string) – Partition to upgrade to.
Raises PriorityIncrementError:
 

If the SIMG Header priority cannot be changed.

Previous topic

Cxmanage Python API Documentation

Next topic

Fabric