fabrictestbed_extensions/fablib stuff.

FablibManager#

Slice#

class slice.Slice(fablib_manager: FablibManager, name: str = None)#
__str__()#

Creates a tabulated string describing the properties of the slice.

Intended for printing slice information.

Returns:

Tabulated string of slice information

Return type:

String

save(filename)#

Saves the slice topology to a file. The file can be loaded to create a new slice with the same topology.

The slice topology can be saved before the original request has been submitted or after. If the slice is saved after it is instantiated, only the topology is saved. Any configuration of nodes is not included.

Parameters:

filename (String) – path to the file to save the slice.

load(filename)#

Loads a slice request topology from file. The file can be loaded to create a new slice with the same topology as a previously saved slice.

Parameters:

filename (String) – path to the file to save the slice.

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

Show a table containing the current slice 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

list_nodes(output=None, fields=None, colors=False, quiet=False, filter_function=None)#

Lists all the nodes in the slice.

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’,’State’]

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

Example: filter_function=lambda s: s[‘State’] == ‘Active’

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

  • colors (bool) – True to add colors to the table when possible

Returns:

table in format specified by output parameter

Return type:

Object

list_interfaces(output: Optional[str] = None, fields: Optional[List[str]] = None, quiet: bool = False, filter_function=None)#

Lists all the interfaces in the slice 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’,’Type’, ‘State’]

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

Example: filter_function=lambda s: s[‘Type’] == ‘FABNetv4’

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

list_components(output: Optional[str] = None, fields: Optional[List[str]] = None, quiet: bool = False, filter_function=None)#

Lists all the components in the slice 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’,’Model’]

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

Example: filter_function=lambda s: s[‘Model’] == ‘NIC_Basic’

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_slice(fablib_manager: FablibManager, name: str = None)#

Create a new slice :param fablib_manager: :param name: :return: Slice

toJson()#

Returns the slice attributes as a json string

Returns:

slice attributes as json string

Return type:

str

toDict()#

Returns the slice attributes as a dictionary

Returns:

slice attributes as dictionary

Return type:

dict

get_fim_topology() ExperimentTopology#

Not recommended for most users.

Gets the slice’s FABRIC Information Model (fim) topology. This method is used to access data at a lower level than FABlib.

Returns:

FABRIC experiment topology

Return type:

ExperimentTopology

update()#

(re)Query the FABRIC services for updated information about this slice.

Raises:

Exception – if updating topology fails

get_slice_public_key() str#

Gets the slice public key.

Important! Slice key management is underdevelopment and this functionality will likely change going forward.

Returns:

the public key

Return type:

String

get_private_key_passphrase() str#

Gets the slice private key passphrase.

Important! Slice key management is underdevelopment and this functionality will likely change going forward.

Returns:

the private key passphrase

Return type:

String

get_slice_public_key_file() str#

Gets the path to the slice public key file.

Important! Slice key management is underdevelopment and this functionality will likely change going forward.

Returns:

path to public key file

Return type:

String

get_slice_private_key_file() str#

Gets the path to the slice private key file.

Important! Slice key management is underdevelopment and this functionality will likely change going forward.

Returns:

path to private key file

Return type:

String

isStable() bool#

Tests is the slice is stable. Stable means all requests for to add/remove/modify slice resources have completed. Both successful and failed slice requests are considered to be completed.

Returns:

True if slice is stable, False otherwise

Return type:

Bool

get_state() str#

Gets the slice state.

Returns:

the slice state

Return type:

str

get_name() str#

Gets the slice’s name.

Returns:

the slice name

Return type:

String

get_slice_id() str#

Gets the slice’s ID.

Returns:

the slice ID

Return type:

String

get_lease_end() str#

Gets the timestamp at which the slice lease ends.

Returns:

timestamp when lease ends

Return type:

String

get_lease_start() str#

Gets the timestamp at which the slice lease starts.

Returns:

timestamp when lease starts

Return type:

String

get_project_id() str#

Gets the project id of the slice.

Returns:

project id

Return type:

String

add_l2network(name: Optional[str] = None, interfaces: List[Interface] = [], type: Optional[str] = None) NetworkService#

Adds a new L2 network service to this slice.

L2 networks types include:

  • L2Bridge: a local Ethernet on a single site with unlimited interfaces.

  • L2STS: a wide-area Ethernet on exactly two sites with unlimited interfaces.

    Includes best effort performance and cannot, yet, support Basic NICs residing on a single physical.

  • L2PTP: a wide-area Ethernet on exactly two sites with exactly two interfaces.

    QoS performance guarantees (coming soon!). Does not support Basic NICs. Traffic arrives with VLAN tag and requires the node OS to configure a VLAN interface.

If the type argument is not set, FABlib will automatically choose the L2 network type for you. In most cases the automatic network type is the one you want. You can force a specific network type by setting the type parameter to “L2Bridge”, “L2STS”, or “L2PTP”.

An exception will be raised if the set interfaces is not compatible with the specified network type or if there is not compatible network type for the given interface list.

Parameters:
  • name (String) – the name of the network service

  • interfaces (List[Interface]) – a list of interfaces to build the network with

  • type (String) – optional L2 network type “L2Bridge”, “L2STS”, or “L2PTP”

Returns:

a new L2 network service

Return type:

NetworkService

add_l3network(name: Optional[str] = None, interfaces: List[Interface] = [], type: str = 'IPv4') NetworkService#

Adds a new L3 network service to this slice.

L3 networks types include:

  • IPv4: An IPv4 network on the FABNetv4 internet

  • IPv6: An IPv6 network on the FABNetv6 internet

The FABNet networks are internal IP internets that span the FABRIC testbed. Adding a new L3 network to your FABRIC slice creates an isolated network at a single site. FABRIC issues each isolated L3 network with an IP subnet (either IPv4 or IPv6) and a gateway used to route traffic to the FABNet internet.

Like the public Internet, all FABNet networks can send traffic to all other FABnet networks of the same type. In other words, FABNet networks can be used to communicate between your slices and slices owned by other users.

An exception will be raised if the set interfaces is not from a single FABRIC site. If you want to use L3 networks to connect slices that are distributed across many site, you need to create a separate L3 network for each site.

It is important to note that by all nodes come with a default gateway on a management network that use used to access your nodes (i.e. to accept ssh connections). To use an L3 dataplane network, you will need to add routes to your nodes that selectively route traffic across the new dataplane network. You must be careful to maintain the default gateway settings if you want to be able to access the node using the management network.

Parameters:
  • name (String) – the name of the network service

  • interfaces (List[Interface]) – a list of interfaces to build the network with

  • type (String) – L3 network type “IPv4” or “IPv6”

Returns:

a new L3 network service

Return type:

NetworkService

add_facility_port(name: Optional[str] = None, site: Optional[str] = None, vlan: Optional[str] = None) NetworkService#

Adds a new L2 facility port to this slice

Parameters:
  • name (String) – name of the facility port

  • site (String) – site

  • vlan (String) – vlan

Returns:

a new L2 facility port

Return type:

NetworkService

add_node(name: str, site: Optional[str] = None, cores: int = 2, ram: int = 8, disk: int = 10, image: Optional[str] = None, instance_type: Optional[str] = None, docker_image: Optional[str] = None, host: Optional[str] = None, avoid: List[str] = []) Node#

Creates a new node on this fablib slice.

Parameters:
  • name (String) – Name of the new node

  • site (String) – (Optional) Name of the site to deploy the node on. Default to a random site.

  • cores (int) – (Optional) Number of cores in the node. Default: 2 cores

  • ram (int) – (Optional) Amount of ram in the node. Default: 8 GB

  • disk (int) – (Optional) Amount of disk space n the node. Default: 10 GB

  • image (String) – (Optional) The image to uese for the node. Default: default_rocky_8

:param instance_type :param docker_image :param host: (Optional) The physical host to deploy the node. Each site

has worker nodes numbered 1, 2, 3, etc. Host names follow the pattern in this example of STAR worker number 1: “star-w1.fabric-testbed.net”. Default: unset

Parameters:

avoid (List[String]) – (Optional) A list of sites to avoid is allowing random site.

Returns:

a new node

Return type:

Node

get_object_by_reservation(reservation_id: str) Optional[Union[Node, NetworkService, Interface]]#

Gets an object associated with this slice by its reservation ID.

Parameters:

reservation_id – the ID to search for

Returns:

Object

get_error_messages() List[dict]#

Gets the error messages found in the sliver notices.

Returns:

a list of error messages

Return type:

List[Dict[String, String]]

get_notices() Dict[str, str]#

Gets a dictionary all sliver notices keyed by reservation id.

Returns:

dictionary of node IDs to error messages

Return type:

dict[str, str]

get_components() List[Component]#

Gets all components in this slice.

Returns:

List of all components in this slice

Return type:

List[Component]

get_nodes() List[Node]#

Gets a list of all nodes in this slice.

Returns:

a list of fablib nodes

Return type:

List[Node]

get_node(name: str) Node#

Gets a node from the slice by name.

Parameters:

name (String) – Name of the node

Returns:

a fablib node

Return type:

Node

get_interfaces() List[Interface]#

Gets all interfaces in this slice.

Returns:

a list of interfaces on this slice

Return type:

List[Interface]

get_interface(name: Optional[str] = None) Interface#

Gets a particular interface from this slice.

Parameters:

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

Raises:

Exception – if no interfaces with name are found

Returns:

an interface on this slice

Return type:

Interface

get_networks() List[NetworkService]#

Gets all network services (L2 and L3) in this slice

Returns:

List of all network services in this slice

Return type:

List[NetworkService]

get_network(name: Optional[str] = None) NetworkService#

Gest a particular network service from this slice.

Parameters:

name (str) – the name of the network service to search for

Returns:

a particular network service

Return type:

NetworkService

get_l2networks() List[NetworkService]#

Gets a list of the L2 network services on this slice.

Returns:

network services on this slice

Return type:

list[NetworkService]

get_l2network(name: Optional[str] = None) NetworkService#

Gets a particular L2 network service from this slice.

Parameters:

name (str) – the name of the network service to search for

Returns:

a particular network service

Return type:

NetworkService

get_l3networks() List[NetworkService]#

Gets all L3 networks services in this slice

Returns:

List of all network services in this slice

Return type:

List[NetworkService]

get_l3network(name: Optional[str] = None) NetworkService#

Gets a particular L3 network service from this slice.

Parameters:

name (String) – Name network

Returns:

network services on this slice

Return type:

list[NetworkService]

delete()#

Deletes this slice off of the slice manager and removes its topology.

Raises:

Exception – if deleting the slice fails

renew(end_date: str)#

Renews the FABRIC slice’s lease to the new end date.

Date is in UTC and of the form: “%Y-%m-%d %H:%M:%S %z”

Example of formating a date for 1 day from now:

end_date = (datetime.datetime.now() + datetime.timedelta(days=1)).strftime(“%Y-%m-%d %H:%M:%S %z”)

Parameters:

end_date – String

Raises:

Exception – if renewal fails

wait(timeout: int = 360, interval: int = 10, progress: bool = False)#

Waits for the slice on the slice manager to be in a stable, running state.

Parameters:
  • timeout (int) – how many seconds to wait on the slice

  • interval (int) – how often in seconds to check on slice state

  • progress (bool) – indicator for whether to print wait progress

Raises:

Exception – if the slice state is undesirable, or waiting times out

Returns:

the stable slice on the slice manager

Return type:

SMSlice

wait_ssh(timeout: int = 1800, interval: int = 20, progress: bool = False)#

Waits for all nodes to be accesible via ssh.

Parameters:
  • timeout (int) – how long to wait on slice ssh

  • interval (int) – how often to check on slice ssh

  • progress (bool) – indicator for verbose output

Raises:

Exception – if timeout threshold reached

Returns:

true when slice ssh successful

Return type:

bool

test_ssh() bool#

Tests all nodes in the slices are accessible via ssh.

Returns:

result of testing if all VMs in the slice are accessible via ssh

Return type:

bool

post_boot_config()#

Run post boot configuration. Typically, this is run automatically during a blocking call to submit.

Only use this method after a non-blocking submit call and only call it once.

wait_jupyter(timeout: int = 1800, interval: int = 10)#

Waits for the slice to be in a stable and displays jupyter compliant tables of the slice progress.

Parameters:
  • timeout (int) – how many seconds to wait on the slice

  • interval (int) – how often in seconds to check on slice state

Raises:

Exception – if the slice state is undesirable, or waiting times out

Returns:

the stable slice on the slice manager

Return type:

SMSlice

submit(wait: bool = True, wait_timeout: int = 1800, wait_interval: int = 20, progress: bool = True, wait_jupyter: str = 'text') str#

Submits a slice request to FABRIC.

Can be blocking or non-blocking.

Blocking calls can, optionally,configure timeouts and intervals.

Blocking calls can, optionally, print progress info.

Parameters:
  • wait – indicator for whether to wait for the slice’s resources to be active

  • wait_timeout – how many seconds to wait on the slice resources

  • wait_interval – how often to check on the slice resources

  • progress – indicator for whether to show progress while waiting

  • wait_jupyter – Special wait for jupyter notebooks.

Returns:

slice_id

list_networks(output=None, fields=None, colors=False, quiet=False, filter_function=None)#

Lists all the networks in the slice.

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’,’State’]

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

Example: filter_function=lambda s: s[‘State’] == ‘Active’

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

  • colors (bool) – True to add colors to the table when possible

Returns:

table in format specified by output parameter

Return type:

Object

list_nodes(output=None, fields=None, colors=False, quiet=False, filter_function=None)#

Lists all the nodes in the slice.

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’,’State’]

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

Example: filter_function=lambda s: s[‘State’] == ‘Active’

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

  • colors (bool) – True to add colors to the table when possible

Returns:

table in format specified by output parameter

Return type:

Object

Node#

class node.Node(slice: Slice, node: FimNode)#
__str__()#

Creates a tabulated string describing the properties of the node. Intended for printing node information. :return: Tabulated string of node information :rtype: String

toJson()#

Returns the node attributes as a json string

Returns:

slice attributes as json string

Return type:

str

toDict()#

Returns the node attributes as a dictionary

Returns:

slice attributes as dictionary

Return type:

dict

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

Show a table containing the current node 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

list_components(fields=None, output=None, quiet=False, filter_function=None)#

Lists all the components in the node 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’,’Model’]

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

Example: filter_function=lambda s: s[‘Model’] == ‘NIC_Basic’

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

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

Lists all the interfaces in the node 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

list_networks(fields=None, output=None, quiet=False, filter_function=None)#

Lists all the networks attached to the nodes 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’,’Type’]

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

Example: filter_function=lambda s: s[‘Type’] == ‘FABNetv4’

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_node() Node#

Not recommended for most users.

Gets the node’s FABRIC Information Model (fim) object. This method is used to access data at a lower level than FABlib.

Returns:

the FABRIC model node

Return type:

FIMNode

set_capacities(cores: int = 2, ram: int = 2, disk: int = 10)#

Sets the capacities of the FABRIC node. :param cores: the number of cores to set on this node :type cores: int :param ram: the amount of RAM to set on this node :type ram: int :param disk: the amount of disk space to set on this node :type disk: int

set_instance_type(instance_type: str)#

Sets the instance type of this fablib node on the FABRIC node. :param instance_type: the name of the instance type to set :type instance_type: String

set_image(image: str, username: Optional[str] = None, image_type: str = 'qcow2')#

Sets the image information of this fablib node on the FABRIC node. :param image: the image reference to set :type image: String :param username: the username of this fablib node. Currently unused. :type username: String :param image_type: the image type to set :type image_type: String

set_host(host_name: Optional[str] = None)#

Sets the hostname of this fablib node on the FABRIC node. :param host_name: the hostname. example: host_name=’renc-w2.fabric-testbed.net’ :type host_name: String

set_site(site)#

Sets the hostname of this fablib node on the FABRIC node. :param host_name: the hostname. example: host_name=’renc-w2.fabric-testbed.net’ :type host_name: String

get_slice() Slice#

Gets the fablib slice associated with this node. :return: the fablib slice on this node :rtype: Slice

get_name() str#

Gets the name of the FABRIC node. :return: the name of the node :rtype: String

get_cores() int#

Gets the number of cores on the FABRIC node. :return: the number of cores on the node :rtype: int

get_ram() int#

Gets the amount of RAM on the FABRIC node. :return: the amount of RAM on the node :rtype: int

get_disk() int#

Gets the amount of disk space on the FABRIC node. :return: the amount of disk space on the node :rtype: int

get_image() str#

Gets the image reference on the FABRIC node. :return: the image reference on the node :rtype: String

get_image_type() str#

Gets the image type on the FABRIC node. :return: the image type on the node :rtype: String

get_host() str#

Gets the hostname on the FABRIC node. :return: the hostname on the node :rtype: String

get_site() str#

Gets the sitename on the FABRIC node. :return: the sitename on the node :rtype: String

get_management_ip() str#

Gets the management IP on the FABRIC node. :return: management IP :rtype: String

get_reservation_id() str#

Gets the reservation ID on the FABRIC node. :return: reservation ID on the node :rtype: String

get_reservation_state() str#

Gets the reservation state on the FABRIC node. :return: the reservation state on the node :rtype: String

get_error_message() str#

Gets the error message on the FABRIC node. :return: the error message on the node :rtype: String

get_interfaces() List[Interface]#

Gets a list of the interfaces associated with the FABRIC node. :return: a list of interfaces on the node :rtype: List[Interface]

get_interface(name: Optional[str] = None, network_name: Optional[str] = None) Interface#

Gets a particular interface associated with a FABRIC node. Accepts either the interface name or a network_name. If a network name is used this method will return the interface on the node that is connected to the network specified. If a name and network_name are both used, the interface name will take precedence. :param name: interface name to search for :type name: str :param network_name: network name to search for :type name: str :raise Exception: if interface is not found :return: an interface on the node :rtype: Interface

get_username() str#

Gets the username on this fablib node. :return: the username on this node :rtype: String

get_public_key() str#

Gets the public key on fablib node. Important! Slice key management is underdevelopment and this functionality will likely change going forward. :return: the public key on the node :rtype: String

get_public_key_file() str#

Gets the public key file path on the fablib node. Important! Slice key management is underdevelopment and this functionality will likely change going forward. :return: the public key path :rtype: String

get_private_key() str#

Gets the private key on the fablib node. Important! Slice key management is underdevelopment and this functionality will likely change going forward. :return: the private key on the node :rtype: String

get_private_key_file() str#

Gets the private key file path on the fablib slice. Important! Slice key management is underdevelopment and this functionality will likely change going forward. :return: the private key path :rtype: String

get_private_key_passphrase() str#

Gets the private key passphrase on the FABLIB slice. Important! Slice key management is underdevelopment and this functionality will likely change going forward. :return: the private key passphrase :rtype: String

add_component(model: Optional[str] = None, name: Optional[str] = None) Component#

Creates a new FABRIC component using this fablib node. Example model include: - NIC_Basic: A single port 100 Gbps SR-IOV Virtual Function on a Mellanox ConnectX-6 - NIC_ConnectX_5: A dual port 25 Gbps Mellanox ConnectX-5 - NIC_ConnectX_6: A dual port 100 Gbps Mellanox ConnectX-6 - NVME_P4510: NVMe Storage Device - GPU_TeslaT4: Tesla T4 GPU - GPU_RTX6000: RTX6000 GPU :param model: the name of the component model to add :type model: String :param name: the name of the new component :type name: String :return: the new component :rtype: Component

get_components() List[Component]#

Gets a list of components associated with this node. :return: a list of components on this node :rtype: List[Component]

get_component(name: str) Component#

Gets a particular component associated with this node. :param name: the name of the component to search for :type name: String :raise Exception: if component not found by name :return: the component on the FABRIC node :rtype: Component

get_ssh_command() str#

Gets a SSH command used to access this node node from a terminal. :return: the SSH command to access this node :rtype: str

execute(command, retry=3, retry_interval=10, username=None, private_key_file=None, private_key_passphrase=None, quiet=False, read_timeout=10, timeout=None, output_file=None)#

Runs a command on the FABRIC node.

The function uses paramiko to ssh to the FABRIC node and execute an arbitrary shell command.

Parameters:
  • command (str) – the command to run

  • retry (int) – the number of times to retry SSH upon failure

  • retry_interval (int) – the number of seconds to wait before retrying SSH upon failure

  • username (str) – username

  • private_key_file (str) – path to private key file

  • private_key_passphrase (str) – pass phrase

  • output_file (List[str]) – path to a file where the stdout/stderr will be written. None for no file output

  • output (bool) – print stdout and stderr to the screen

  • read_timeout – the number of seconds to wait before retrying to

read from stdout and stderr :type read_timeout: int :param timeout: the number of seconds to wait before terminating the command using the linux timeout command. Specifying a timeout encapsulates the command with the timeout command for you :type timeout: int :return: a tuple of (stdout[Sting],stderr[String]) :rtype: Tuple :raise Exception: if management IP is invalid

execute_thread(command: str, retry: int = 3, retry_interval: int = 10, username: Optional[str] = None, private_key_file: Optional[str] = None, private_key_passphrase: Optional[str] = None, output_file: Optional[str] = None) Thread#

Creates a thread that calls node.execute(). Results (i.e. stdout, stderr) from the thread can be retrieved with by calling thread.result()

Parameters:
  • command (str) – the command to run

  • retry (int) – the number of times to retry SSH upon failure

  • retry_interval (int) – the number of seconds to wait before retrying SSH upon failure

  • username (str) – username

  • private_key_file (str) – path to private key file

  • private_key_passphrase (str) – pass phrase

  • output_file (List[str]) – path to a file where the stdout/stderr will be written. None for no file output

Returns:

a thread that called node.execute()

Raises:

Exception – if management IP is invalid

upload_file(local_file_path: str, remote_file_path: str, retry: int = 3, retry_interval: int = 10)#

Upload a local file to a remote location on the node. :param local_file_path: the path to the file to upload :type local_file_path: str :param remote_file_path: the destination path of the file on the node :type remote_file_path: str :param retry: how many times to retry SCP upon failure :type retry: int :param retry_interval: how often to retry SCP on failure :type retry_interval: int :raise Exception: if management IP is invalid

upload_file_thread(local_file_path: str, remote_file_path: str, retry: int = 3, retry_interval: int = 10)#

Creates a thread that calls node.upload_file(). Results from the thread can be retrieved with by calling thread.result() :param local_file_path: the path to the file to upload :type local_file_path: str :param remote_file_path: the destination path of the file on the node :type remote_file_path: str :param retry: how many times to retry SCP upon failure :type retry: int :param retry_interval: how often to retry SCP on failure :type retry_interval: int :return: a thread that called node.execute() :rtype: Thread :raise Exception: if management IP is invalid

upload_directory(local_directory_path: str, remote_directory_path: str, retry: int = 3, retry_interval: int = 10)#

Upload a directory to remote location on the node. Makes a gzipped tarball of a directory and uploades it to a node. Then unzips and tars the directory at the remote_directory_path :param local_directory_path: the path to the directory to upload :type local_directory_path: str :param remote_directory_path: the destination path of the directory on the node :type remote_directory_path: str :param retry: how many times to retry SCP upon failure :type retry: int :param retry_interval: how often to retry SCP on failure :type retry_interval: int :raise Exception: if management IP is invalid

upload_directory_thread(local_directory_path: str, remote_directory_path: str, retry: int = 3, retry_interval: int = 10)#

” Creates a thread that calls node.upload_directory. Results from the thread can be retrieved with by calling thread.result() :param local_directory_path: the path to the directory to upload :type local_directory_path: str :param remote_directory_path: the destination path of the directory on the node :type remote_directory_path: str :param retry: how many times to retry SCP upon failure :type retry: int :param retry_interval: how often to retry SCP on failure :type retry_interval: int :return: a thread that called node.download_file() :rtype: Thread :raise Exception: if management IP is invalid

download_file(local_file_path: str, remote_file_path: str, retry: int = 3, retry_interval: int = 10)#

Download a remote file from the node to a local destination. :param local_file_path: the destination path for the remote file :type local_file_path: str :param remote_file_path: the path to the remote file to download :type remote_file_path: str :param retry: how many times to retry SCP upon failure :type retry: int :param retry_interval: how often to retry SCP upon failure :type retry_interval: int

download_file_thread(local_file_path: str, remote_file_path: str, retry: int = 3, retry_interval: int = 10)#

” Creates a thread that calls node.download_file(). Results from the thread can be retrieved with by calling thread.result() :param local_file_path: the destination path for the remote file :type local_file_path: str :param remote_file_path: the path to the remote file to download :type remote_file_path: str :param retry: how many times to retry SCP upon failure :type retry: int :param retry_interval: how often to retry SCP upon failure :type retry_interval: int :return: a thread that called node.download_file() :rtype: Thread :raise Exception: if management IP is invalid

download_directory(local_directory_path: str, remote_directory_path: str, retry: int = 3, retry_interval: int = 10)#

Downloads a directory from remote location on the node. Makes a gzipped tarball of a directory and downloads it from a node. Then unzips and tars the directory at the local_directory_path :param local_directory_path: the path to the directory to upload :type local_directory_path: str :param remote_directory_path: the destination path of the directory on the node :type remote_directory_path: str :param retry: how many times to retry SCP upon failure :type retry: int :param retry_interval: how often to retry SCP on failure :type retry_interval: int :raise Exception: if management IP is invalid

download_directory_thread(local_directory_path: str, remote_directory_path: str, retry: int = 3, retry_interval: int = 10)#

” Creates a thread that calls node.download_directory. Results from the thread can be retrieved with by calling thread.result() :param local_directory_path: the path to the directory to upload :type local_directory_path: str :param remote_directory_path: the destination path of the directory on the node :type remote_directory_path: str :param retry: how many times to retry SCP upon failure :type retry: int :param retry_interval: how often to retry SCP on failure :type retry_interval: int :raise Exception: if management IP is invalid

test_ssh() bool#

Test whether SSH is functional on the node. :return: true if SSH is working, false otherwise :rtype: bool

get_management_os_interface() str#

Gets the name of the management interface used by the node’s operating system. :return: interface name :rtype: String

get_dataplane_os_interfaces() List[dict]#

Gets a list of all the dataplane interface names used by the node’s operating system. :return: interface names :rtype: List[String]

flush_all_os_interfaces()#

Flushes the configuration of all dataplane interfaces in the node.

flush_os_interface(os_iface: str)#

Flush the configuration of an interface in the node :param os_iface: the name of the interface to flush :type os_iface: String

ip_route_add(subnet: Union[IPv4Network, IPv6Network], gateway: Union[IPv4Address, IPv6Address])#

Add a route on the node. :param subnet: The destination subnet :type subnet: IPv4Network or IPv6Network :param gateway: The next hop gateway. :type gateway: IPv4Address or IPv6Address

ip_route_del(subnet: Union[IPv4Network, IPv6Network], gateway: Union[IPv4Address, IPv6Address])#

Delete a route on the node. :param subnet: The destination subnet :type subnet: IPv4Network or IPv6Network :param gateway: The next hop gateway. :type gateway: IPv4Address or IPv6Address

ip_addr_add(addr: Union[IPv4Address, IPv6Address], subnet: Union[IPv4Network, IPv6Network], interface: Interface)#

Add an IP to an interface on the node. :param addr: IP address :type addr: IPv4Address or IPv6Address :param subnet: subnet. :type subnet: IPv4Network or IPv6Network :param interface: the FABlib interface. :type interface: Interface

ip_addr_del(addr: Union[IPv4Address, IPv6Address], subnet: Union[IPv4Network, IPv6Network], interface: Interface)#

Delete an IP to an interface on the node. :param addr: IP address :type addr: IPv4Address or IPv6Address :param subnet: subnet. :type subnet: IPv4Network or IPv6Network :param interface: the FABlib interface. :type interface: Interface

Bring up a link on an interface on the node. :param subnet: subnet. :type subnet: IPv4Network or IPv6Network :param interface: the FABlib interface. :type interface: Interface

Bring down a link on an interface on the node. :param subnet: subnet. :type subnet: IPv4Network or IPv6Network :param interface: the FABlib interface. :type interface: Interface

network_manager_stop()#

Stop network manager on the node.

network_manager_start()#

(re)Start network manager on the node.

get_ip_routes()#

Get a list of routes from the node.

get_ip_addrs()#

Get a list of ip address info from the node.

clear_all_ifaces()#

Flush all interfaces and delete VLAN os interfaces

remove_all_vlan_os_interfaces()#

Delete all VLAN os interfaces

remove_vlan_os_interface(os_iface: Optional[str] = None)#

Remove one VLAN OS interface

add_vlan_os_interface(os_iface: Optional[str] = None, vlan: Optional[str] = None, ip: Optional[str] = None, cidr: Optional[str] = None, mtu: Optional[str] = None, interface: Optional[str] = None)#

Depricated

ping_test(dst_ip: str) bool#

Test a ping from the node to a destination IP :param dst_ip: destination IP String. :type dst_ip: String

get_storage(name: str) Component#

Gets a particular storage associated with this node. :param name: the name of the storage :type name: String :raise Exception: if storage not found by name :return: the storage on the FABRIC node :rtype: Component

add_storage(name: str, auto_mount: bool = False) Component#

Creates a new FABRIC Storage component and attaches it to the Node :param name: Name of the Storage volume created for the project outside the scope of the Slice :param auto_mount: Mount the storage volume :rtype: Component

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

Returns the component attributes as a dictionary

Returns:

slice attributes as dictionary

Return type:

dict

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

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

Returns the interface attributes as a dictionary

Returns:

slice attributes as dictionary

Return type:

dict

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

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

Returns the network attributes as a dictionary

Returns:

network attributes as dictionary

Return type:

dict

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

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) 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 currrently allocated comoponents 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 currrently available comoponents 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 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]