FcoeadmI - command fcoeadm -i

Module for parsing the output of command fcoeadm -i. The bulk of the content is split on the colon and keys are kept as is. Lines beginning with ‘Description’, ‘Revision’, ‘Manufacturer’, ‘Serial Number’, ‘Driver’ ,’Number of Ports’ are kept in a dictionary keyed under each of these names. Lines beginning with ‘Symbolic Name’, ‘OS Device Name’, ‘Node Name’, ‘Port Name’, ‘FabricName’, ‘Speed’, ‘Supported Speed’, ‘MaxFrameSize’, ‘FC-ID (Port ID)’, ‘State’ are kept in a sub-dictionary keyed under each these names. All the sub-dictionaries are kept in a list keyed in ‘Interfaces’.

class insights.parsers.fcoeadm_i.FcoeadmI(context, extra_bad_lines=None)[source]

Bases: CommandParser, dict

Class for parsing fcoeadm -i command output.

Typical output of command fcoeadm -i looks like:

Description:      NetXtreme II BCM57810 10 Gigabit Ethernet
Revision:         10
Manufacturer:     Broadcom Corporation
Serial Number:    2C44FD8F4418
Driver:           bnx2x 1.712.30-0
Number of Ports:  1

    Symbolic Name:     bnx2fc (QLogic BCM57810) v2.9.6 over eth8.0-fcoe
    OS Device Name:    host6
    Node Name:         0x50060B0000C26237
    Port Name:         0x50060B0000C26236
    FabricName:        0x0000000000000000
    Speed:             Unknown
    Supported Speed:   1 Gbit, 10 Gbit
    MaxFrameSize:      2048
    FC-ID (Port ID):   0xFFFFFFFF
    State:             Online

    Symbolic Name:     bnx2fc (QLogic BCM57810) v2.9.6 over eth6.0-fcoe
    OS Device Name:    host7
    Node Name:         0x50060B0000C26235
    Port Name:         0x50060B0000C26234
    FabricName:        0x0000000000000000
    Speed:             Unknown
    Supported Speed:   1 Gbit, 10 Gbit
    MaxFrameSize:      2048
    FC-ID (Port ID):   0xFFFFFFFF
    State:             Offline

Examples

>>> type(fi)
<class 'insights.parsers.fcoeadm_i.FcoeadmI'>
>>> fi.fcoe["Description"]
'NetXtreme II BCM57810 10 Gigabit Ethernet'
>>> fi["Description"]
'NetXtreme II BCM57810 10 Gigabit Ethernet'
>>> fi.fcoe["Driver"]
'bnx2x 1.712.30-0'
>>> fi["Driver"]
'bnx2x 1.712.30-0'
>>> fi.fcoe['Serial Number']
'2C44FD8F4418'
>>> fi['Serial Number']
'2C44FD8F4418'
>>> fi.iface_list
['eth8.0-fcoe', 'eth6.0-fcoe']
>>> fi.nic_list
['eth8', 'eth6']
>>> fi.stat_list
['Online', 'Offline']
>>> fi.get_stat_from_nic('eth6')
'Offline'
>>> fi.get_host_from_nic('eth6')
'host7'
driver_name

Driver name

Type:

str

driver_version

Driver version

Type:

str

iface_list

FCoE interface names

Type:

list

nic_list

Ethernet ports running FCoE interfaces

Type:

list

stat_list

FCoE interface(s) status

Type:

list

Raises:
property fcoe

The result parsed of ‘/usr/sbin/fcoeadm -i’

Type:

(dict)

get_host_from_nic(nic)[source]

Get ‘OS Device Name’ for the specified ethernet port.

Parameter:

nic (str): Ethernet port which provided by FCoE adapter

Returns:

Return fcoe host, which as ‘OS Device Name’ to display,

when nic is not valid fcoe port, raise ValueError

Return type:

str

Raises:

ValueError -- When nic is not valid fcoe port

get_stat_from_nic(nic)[source]

Get ‘State’ of fcoe interface created on specified ethernet port.

Parameter:

nic (str): Ethernet port which provided by FCoE adapter.

Returns:

Return fcoe status. When nic is not valid fcoe port,

raise ValueError.

Return type:

str

Raises:

ValueError -- When nic is not valid fcoe port

parse_content(content)[source]

This method must be implemented by classes based on this class.