fabrictestbed_extensions/fablib stuff.

FablibManager#

Slice#

Node#

Component#

class component.Component(node: Node = None, fim_component: FimComponent = None)#
__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

toJson()#

Returns the component attributes as a json string

Returns

slice attributes as json string

Return type

str

toDict(skip=[])#

Returns the component attributes as a dictionary

Returns

slice attributes as dictionary

Return type

dict

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

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

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_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_slice() Slice#

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

Returns

the slice this component is on

Return type

Slice

get_node() Node#

Gets the fablib node this component is associated with.

Returns

the node this component is on

Return type

Node

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_name() str#

Gets the name of this component from the FABRIC component.

Returns

the name of this component

Return type

str

get_disk() int#

Gets the amount of disk space on this component.

Returns

this component’s disk space

Return type

int

get_unit() int#

Get unit count for this component.

Returns

unit

Return type

int

get_pci_addr() str#

Get the PIC device ID for this component.

Returns

PCI device ID

Return type

String

get_model() str#

Get FABlib model name for this component.

Returns

FABlib model name

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_error_message() str#

Get error message for this component.

Returns

reservation state

Return type

String

configure_nvme(mount_point='/mnt/nvme_mount')#

Configure the NVMe drive.

Note this works but may be reorganized.

Parameters

mount_point (String) – The mount point in the filesystem. Default = /mnt/nvme_mount

Interface#

class interface.Interface(component: Component = None, fim_interface: FimInterface = None)#
__str__()#

Creates a tabulated string describing the properties of the interface.

Intended for printing interface information.

Returns

Tabulated string of interface information

Return type

String

toJson()#

Returns the interface attributes as a json string

Returns

slice attributes as json string

Return type

str

toDict(skip=[])#

Returns the interface attributes as a dictionary

Returns

slice attributes as dictionary

Return type

dict

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

Show a table containing the current interface 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’,’MAC’]

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

get_mac() str#

Gets the MAC address of the interface.

Returns

MAC address

Return type

String

get_device_name() str#

Gets a name of the device name on the node

If the interface requires a FABRIC VLAN tag, the interface name returned will be the VLAN tagged interface name.

Returns

OS interface name

Return type

String

get_os_interface() str#

Deprecated: see interface.get_device_name()

Gets a name of the interface the operating system uses for this FABLib interface.

If the interface requires a FABRIC VLAN tag, the interface name retruned will be the VLAN tagged.

Returns

OS interface name

Return type

String

get_physical_os_interface()#

Not intended for API use

ip_addr_add(addr, subnet)#

Add an IP address to the interface in the node.

Parameters
  • addr (IPv4Address or IPv6Address) – IP address

  • subnet (IPv4Network or IPv4Network) – subnet

ip_addr_del(addr, subnet)#

Delete an IP address to the interface in the node.

Parameters
  • addr (IPv4Address or IPv6Address) – IP address

  • subnet (IPv4Network or IPv4Network) – subnet

Bring up the link on the interface.

Bring down the link on the interface.

set_vlan(vlan: Optional[Any] = None)#

Set the VLAN on the FABRIC request.

Parameters

addr (String or int) – vlan

get_bandwidth() str#

Gets the bandwidth of an interface. Basic NICs claim 0 bandwidth but are 100 Gbps shared by all Basic NICs on the host.

Returns

bandwith

Return type

String

get_vlan() str#

Gets the FABRIC VLAN of an interface.

Returns

VLAN

Return type

String

get_reservation_state() str#

Gets the reservation state

Returns

VLAN

Return type

String

get_name() str#

Gets the name of this interface.

Returns

the name of this interface

Return type

String

get_component() Component#

Gets the component attached to this interface.

Returns

the component on this interface

Return type

Component

get_model() str#

Gets the component model type on this interface’s component.

Returns

the model of this interface’s component

Return type

str

get_site() str#

Gets the site this interface’s component is on.

Returns

the site this interface is on

Return type

str

get_slice() Slice#

Gets the FABLIB slice this interface’s node is attached to.

Returns

the slice this interface is attached to

Return type

Slice

get_node() Node#

Gets the node this interface’s component is on.

Returns

the node this interface is attached to

Return type

Node

get_network() NetworkService#

Gets the network this interface is on.

Returns

the network service this interface is on

Return type

NetworkService

Gets the ip link info for this interface.

:return ip link info :rtype: str

get_ip_addr()#

Gets the ip addr info for this interface.

:return ip addr info :rtype: str

get_ips(family=None)#

Gets a list of ips assigned to this interface.

:return list of ips :rtype: list[str]

NetworkService#

class network_service.NetworkService(slice: Slice = None, fim_network_service: FimNetworkService = None)#
__str__()#

Creates a tabulated string describing the properties of the network service.

Intended for printing network service information.

Returns

Tabulated string of network service information

Return type

String

toJson()#

Returns the network attributes as a json string

Returns

network attributes as json string

Return type

str

toDict(skip=[])#

Returns the network attributes as a dictionary

Returns

network attributes as dictionary

Return type

dict

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

Show a table containing the current network 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’,’State’]

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

get_fim_network_service() NetworkService#

Not recommended for most users.

Gets the FABRIC network service this instance represents.

Returns

the FIM network service

Return type

FIMNetworkService

get_slice() Slice#

Gets the fablib slice this network service is built on.

Returns

the slice this network is on

Return type

Slice

get_name() str#

Gets the name of this network service.

Returns

the name of this network service

Return type

String

get_interfaces() List[Interface]#

Gets the interfaces on this network service.

Returns

the interfaces on this network service

Return type

List[Interfaces]

get_interface(name: str = None) Interface or None#

Gets a particular interface on this network service.

Parameters

name (str) – the name of the interface to search for

Returns

the particular interface

Return type

Interface

has_interface(interface: Interface) bool#

Determines whether this network service has a particular interface.

Parameters

interface (Interface) – the fablib interface to search for

Returns

whether this network service has interface

Return type

bool

get_layer() str#

Gets the layer of the network services (L2 or L3)

Returns

L2 or L3

Return type

String

get_type()#

Gets the type of the network services

Returns

network service types

Return type

String

get_error_message() str#

Gets the error messages

Returns

network service types

Return type

String

get_gateway() IPv4Address#

Gets the assigend gateway for a FABnetv L3 IPv6 or IPv4 network

Returns

gateway IP

Return type

IPv4Address or IPv6Network

get_available_ips(count: int = 256) List[IPv4Address]#

Gets the IPs available for a FABnet L3 network.

Note: large IPv6 address spaces take considerable time to build this list. By default this will return the first 256 addresses. If you needed more addresses, set the count parameter.

Parameters

count – number of addresse to include

Returns

gateway IP

Return type

List[IPv4Address]

get_subnet() IPv4Network#

Gets the assigend subnet for a FABnetv L3 IPv6 or IPv4 network

Returns

gateway IP

Return type

IPv4Network or IPv6Network

get_reservation_id() str#

Gets the reservation id of the network

Returns

reservation ID

Return type

String

get_reservation_state() str#

Gets the reservation state of the network

Returns

reservation state

Return type

String

Resources#

class resources.Resources(fablib_manager)#
__str__() str#

Creates a tabulated string of all the available resources.

Intended for printing available resources.

Returns

Tabulated string of available resources

Return type

String

show_site(site_name: str, output: Optional[str] = None, fields: Optional[list[str]] = None, quiet: bool = False, pretty_names=True) str#

Creates a tabulated string of all the available resources at a specific site.

Intended for printing available resources at a site.

Parameters

site_name (String) – site name

Returns

Tabulated string of available resources

Return type

String

get_site_names() List[str]#

Gets a list of all currently available site names

Returns

list of site names

Return type

List[String]

get_component_capacity(site_name: str, component_model_name: str) int#

Gets gets the total site capacity of a component by model name.

Parameters
  • site_name (String) – site name

  • component_model_name (String) – component model name

Returns

total component capacity

Return type

int

get_component_allocated(site_name: str, component_model_name: str) int#

Gets gets number of currently allocated components on a the site by the component by model name.

Parameters
  • site_name (String) – site name

  • component_model_name (String) – component model name

Returns

currently allocated component of this model

Return type

int

get_component_available(site_name: str, component_model_name: str) int#

Gets gets number of currently available components on the site by the component by model name.

Parameters
  • site_name (String) – site name

  • component_model_name (String) – component model name

Returns

currently available component of this model

Return type

int

get_location_lat_long(site_name: str) Tuple[float, float]#

Gets gets location of a site in latitude and longitude

Parameters

site_name (String) – site name

Returns

latitude and longitude of the site

Return type

Tuple(float,float)

get_location_postal(site_name: str) str#

Gets the location of a site by postal address

Parameters

site_name (String) – site name

Returns

postal address of the site

Return type

String

get_host_capacity(site_name: str) int#

Gets the number of worker hosts at the site

Parameters

site_name (String) – site name

Returns

host count

Return type

int

get_cpu_capacity(site_name: str) int#

Gets the total number of cpus at the site

Parameters

site_name (String) – site name

Returns

cpu count

Return type

int

get_core_capacity(site_name: str) int#

Gets the total number of cores at the site

Parameters

site_name (String) – site name

Returns

core count

Return type

int

get_core_allocated(site_name: str) int#

Gets the number of currently allocated cores at the site

Parameters

site_name (String) – site name

Returns

core count

Return type

int

get_core_available(site_name: str) int#

Gets the number of currently available cores at the site

Parameters

site_name (String) – site name

Returns

core count

Return type

int

get_ram_capacity(site_name: str) int#

Gets the total amount of memory at the site in GB

Parameters

site_name (String) – site name

Returns

ram in GB

Return type

int

get_ram_allocated(site_name: str) int#

Gets the amount of memory currently allocated the site in GB

Parameters

site_name (String) – site name

Returns

ram in GB

Return type

int

get_ram_available(site_name: str) int#

Gets the amount of memory currently available the site in GB

Parameters

site_name (String) – site name

Returns

ram in GB

Return type

int

get_disk_capacity(site_name: str) int#

Gets the total amount of disk available the site in GB

Parameters

site_name (String) – site name

Returns

disk in GB

Return type

int

get_disk_allocated(site_name: str) int#

Gets the amount of disk allocated the site in GB

Parameters

site_name (String) – site name

Returns

disk in GB

Return type

int

get_disk_available(site_name: str) int#

Gets the amount of disk available the site in GB

Parameters

site_name (String) – site name

Returns

disk in GB

Return type

int

update()#

Update the available resources by querying the FABRIC services

get_site_list(update: bool = False) List[str]#

Gets a list of all sites by name

Parameters

update (bool) – (optional) set to True update available resources

Returns

list of site names

Return type

List[String]

Gets a list of all links by name

Parameters

update (bool) – (optional) set to True update available resources

Returns

list of link names

Return type

List[String]