component

Methods to work with FABRIC components.

You normally would not create Component objects directly with a constructor call; they are created when you invoke fabrictestbed_extensions.fablib.node.Node.add_component(), like so:

node.add_component(model='NVME_P4510', name="nvme1")
node.add_component(model='NIC_Basic', name="nic1")
class fabrictestbed_extensions.fablib.component.Component(node: Node = None, fim_component: FimComponent = None)

Typically invoked when you add a component to a Node.

Note

Component constructer is not meant to be directly used.

Parameters:
  • node (Node) – the fablib node to build the component on

  • fim_component (FIMComponent) – the FIM component this object represents

__str__()

Creates a tabulated string describing the properties of the component.

Intended for printing component information.

Returns:

Tabulated string of component information

Return type:

String

static calculate_name(node: Node = None, name: str = None) str

Not intended for API use

configure_nvme(mount_point='')

Configure the NVMe drive.

Note this works but may be reorganized.

Parameters:

mount_point (String) – The mount point in the filesystem. Default = “” later reassigned to /mnt/{linux device name}

get_details() str

Not intended for API use

get_device_name() str

Not for API use

get_disk() int

Gets the amount of disk space on this component.

Returns:

this component’s disk space

Return type:

int

get_error_message() str

Get error message for this component.

Returns:

reservation state

Return type:

String

get_fim_component() Component

Not recommended for most users.

GGets the FABRIC component this fablib component represents. This method is used to access data at a lower level than FABlib.

Returns:

the FABRIC component on this component

Return type:

FIMComponent

get_fim_model() str

Not for API use

get_interfaces() List[Interface]

Gets the interfaces attached to this fablib component’s FABRIC component.

Returns:

a list of the interfaces on this component.

Return type:

List[Interface]

get_model() str

Get FABlib model name for this component.

Returns:

FABlib model name

Return type:

String

get_name() str

Gets the name of this component from the FABRIC component.

Returns:

the name of this component

Return type:

str

get_node() Node

Gets the fablib node this component is associated with.

Returns:

the node this component is on

Return type:

Node

get_numa_node() str

Get the Numa Node assigned to the device

get_pci_addr() str

Get the PIC device ID for this component.

Returns:

PCI device ID

Return type:

String

get_reservation_id() str

Get reservation ID for this component.

Returns:

reservation ID

Return type:

String

get_reservation_state() str

Get reservation state for this component.

Returns:

reservation state

Return type:

String

get_site() str

Gets the name of the site this component’s node is on.

Returns:

the site name this node is on

Return type:

String

get_slice() Slice

Gets the fablib slice associated with this component’s node.

Returns:

the slice this component is on

Return type:

Slice

get_type() str

Not for API use

Gets the type of this component.

Returns:

the type of component

Return type:

str

get_unit() int

Get unit count for this component.

Returns:

unit

Return type:

int

list_interfaces(fields=None, output=None, quiet=False, filter_function=None)

Lists all the interfaces in the component with their attributes.

There are several output options: “text”, “pandas”, and “json” that determine the format of the output that is returned and (optionally) displayed/printed.

output: ‘text’: string formatted with tabular

‘pandas’: pandas dataframe ‘json’: string in json format

fields: json output will include all available fields/columns.

Example: fields=[‘Name’,’MAC’]

filter_function: A lambda function to filter data by field values.

Example: filter_function=lambda s: s[‘Node’] == ‘Node1’

Parameters:
  • output (str) – output format

  • fields (List[str]) – list of fields (table columns) to show

  • quiet (bool) – True to specify printing/display

  • filter_function (lambda) – lambda function

Returns:

table in format specified by output parameter

Return type:

Object

static new_component(node: Node = None, model: str = None, name: str = None, user_data: dict = {})

Not intended for API use

Creates a new FIM component on the fablib node inputted.

Parameters:
  • node (Node) – the fablib node to build the component on

  • model (str) – the name of the component type to build

  • name (str) – the name of the new component

Returns:

the new fablib compoent

Return type:

Component

static new_storage(node: Node, name: str, auto_mount: bool = False)

Not intended for API use

Creates a new FIM component on the fablib node inputted.

Parameters:
  • node – the fablib node to build the component on

  • name – the name of the new component

  • auto_mount – True - mount the storage; False - do not mount

Returns:

the new fablib compoent

Return type:

Component

show(fields=None, output=None, quiet=False, colors=False, pretty_names=True)

Show a table containing the current component attributes.

There are several output options: “text”, “pandas”, and “json” that determine the format of the output that is returned and (optionally) displayed/printed.

output: ‘text’: string formatted with tabular

‘pandas’: pandas dataframe ‘json’: string in json format

fields: json output will include all available fields.

Example: fields=[‘Name’,’PCI Address’]

Parameters:
  • output (str) – output format

  • fields (List[str]) – list of fields to show

  • quiet (bool) – True to specify printing/display

  • colors (bool) – True to specify state colors for pandas output

Returns:

table in format specified by output parameter

Return type:

Object

toDict(skip=[])

Returns the component attributes as a dictionary

Returns:

slice attributes as dictionary

Return type:

dict

toJson()

Returns the component attributes as a json string

Returns:

slice attributes as json string

Return type:

str