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=None, fim_component=None)[source]¶
Typically invoked when you add a component to a
Node.Note
Componentconstructer 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
- configure(commands=[])[source]¶
Configure a component by executing a set of commands provided by the user or run any default commands.
- Raises:
SliceStateError – if the node is not in Active state
- configure_nvme(mount_point='')[source]¶
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}
- Raises:
SliceStateError – if the node is not in Active state
- generate_template_context(skip=None)[source]¶
Generate the base template context for this component.
Creates a dictionary context suitable for Jinja2 template rendering, including component attributes and an empty interfaces list.
- get_disk()[source]¶
Gets the amount of disk space on this component.
- Returns:
this component’s disk space
- Return type:
- get_error_message()[source]¶
Get error message for this component.
- Returns:
reservation state
- Return type:
String
- get_fim()[source]¶
Gets the component’s FABRIC Information Model (fim) object.
This method is used to access data at a lower level than FABlib.
- get_fim_component()[source]¶
Not recommended for most users.
Gets 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_interface(name=None, network_name=None, refresh=False)[source]¶
Gets a particular interface attached to this component.
Accepts either the interface name or a network_name. If a network name is used, returns the interface connected to that network. If both name and network_name are provided, name takes precedence.
- get_interfaces(include_subs=True, refresh=False, output='list')[source]¶
Gets the interfaces attached to this fablib component’s FABRIC component.
Results are cached. Use refresh=True to force reload from FIM.
- Parameters:
- Returns:
a list or dict of the interfaces on this component.
- Return type:
- get_model()[source]¶
Get FABlib model name for this component.
- Returns:
FABlib model name
- Return type:
String
- get_node()[source]¶
Gets the fablib node this component is associated with.
- Returns:
the node this component is on
- Return type:
- get_pci_addr()[source]¶
Get the PIC device ID for this component.
- Returns:
PCI device ID
- Return type:
String
- get_reservation_id()[source]¶
Get reservation ID for this component.
- Returns:
reservation ID
- Return type:
String
- get_reservation_state()[source]¶
Get reservation state for this component.
- Returns:
reservation state
- Return type:
String
- get_site()[source]¶
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()[source]¶
Gets the fablib slice associated with this component’s node.
- Returns:
the slice this component is on
- Return type:
- get_type()[source]¶
Not for API use
Gets the type of this component.
- Returns:
the type of component
- Return type:
- list_interfaces(fields=None, output=None, quiet=False, filter_function=None, refresh=False)[source]¶
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:
- Returns:
table in format specified by output parameter
- Return type:
Object
- static new_component(node=None, model=None, name=None, user_data={})[source]¶
Not intended for API use
Creates a new FIM component on the fablib node inputted.
- static new_storage(node, name, auto_mount=False)[source]¶
Not intended for API use
Creates a new FIM component on the fablib node inputted.
- class fabrictestbed_extensions.fablib.component.Component(node=None, fim_component=None)[source]
Typically invoked when you add a component to a
Node.Note
Componentconstructer 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__()[source]
Creates a tabulated string describing the properties of the component.
Intended for printing component information.
- Returns:
Tabulated string of component information
- Return type:
String
- configure(commands=[])[source]
Configure a component by executing a set of commands provided by the user or run any default commands.
- Raises:
SliceStateError – if the node is not in Active state
- configure_nvme(mount_point='')[source]
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}
- Raises:
SliceStateError – if the node is not in Active state
- delete()[source]
Remove the component from the slice/node.
- generate_template_context(skip=None)[source]
Generate the base template context for this component.
Creates a dictionary context suitable for Jinja2 template rendering, including component attributes and an empty interfaces list.
- get_disk()[source]
Gets the amount of disk space on this component.
- Returns:
this component’s disk space
- Return type:
- get_error_message()[source]
Get error message for this component.
- Returns:
reservation state
- Return type:
String
- get_fim()[source]
Gets the component’s FABRIC Information Model (fim) object.
This method is used to access data at a lower level than FABlib.
- get_fim_component()[source]
Not recommended for most users.
Gets 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_interface(name=None, network_name=None, refresh=False)[source]
Gets a particular interface attached to this component.
Accepts either the interface name or a network_name. If a network name is used, returns the interface connected to that network. If both name and network_name are provided, name takes precedence.
- get_interfaces(include_subs=True, refresh=False, output='list')[source]
Gets the interfaces attached to this fablib component’s FABRIC component.
Results are cached. Use refresh=True to force reload from FIM.
- Parameters:
- Returns:
a list or dict of the interfaces on this component.
- Return type:
- get_model()[source]
Get FABlib model name for this component.
- Returns:
FABlib model name
- Return type:
String
- get_node()[source]
Gets the fablib node this component is associated with.
- Returns:
the node this component is on
- Return type:
- get_pci_addr()[source]
Get the PIC device ID for this component.
- Returns:
PCI device ID
- Return type:
String
- static get_pretty_name_dict()[source]
Returns the mapping used when rendering table headers.
- get_reservation_id()[source]
Get reservation ID for this component.
- Returns:
reservation ID
- Return type:
String
- get_reservation_state()[source]
Get reservation state for this component.
- Returns:
reservation state
- Return type:
String
- get_short_name()[source]
Gets the short name of the component.
- get_site()[source]
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()[source]
Gets the fablib slice associated with this component’s node.
- Returns:
the slice this component is on
- Return type:
- get_type()[source]
Not for API use
Gets the type of this component.
- Returns:
the type of component
- Return type:
- list_interfaces(fields=None, output=None, quiet=False, filter_function=None, refresh=False)[source]
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:
- Returns:
table in format specified by output parameter
- Return type:
Object
- static new_component(node=None, model=None, name=None, user_data={})[source]
Not intended for API use
Creates a new FIM component on the fablib node inputted.
- static new_storage(node, name, auto_mount=False)[source]
Not intended for API use
Creates a new FIM component on the fablib node inputted.
- toDict(skip=None)[source]
Returns the component attributes as a dictionary.
Results are cached. Cache is invalidated when
_invalidate_cache()is called.
- update(fim_component=None)[source]
Update the component with new FIM data.
- Parameters:
fim_component (FimComponent) – The new FIM component data