site

FABRIC site and resource information management.

This module provides classes for querying and managing information about FABRIC testbed sites and their available resources. The Site and Resources classes allow users to discover available compute, storage, and network resources across the FABRIC infrastructure.

class fabrictestbed_extensions.fablib.site.Host(host, state, ptp, fablib_manager)[source]

Initialize a Host object.

Parameters:
  • host (node.Node) – The node representing the host.

  • state (str) – The state of the host.

  • ptp (bool) – Boolean indicating if the host is PTP capable.

  • fablib_manager (Any) – The manager for the Fabric library.

Returns:

None

get_component(comp_model_type)[source]

Get a specific component associated with the host.

Parameters:

comp_model_type (str) – The type of component to retrieve.

Returns:

The specified component.

Return type:

Component

get_component_allocated(component_model_name)[source]

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

Parameters:

component_model_name (String) – component model name

Returns:

currently allocated component of this model

Return type:

int

get_component_available(component_model_name)[source]

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

Parameters:

component_model_name (String) – component model name

Returns:

currently available component of this model

Return type:

int

get_component_capacity(component_model_name)[source]

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

Parameters:

component_model_name (String) – component model name

Returns:

total component capacity

Return type:

int

get_components()[source]

Get the components associated with the host.

Returns:

Dictionary-like view of the components associated with the host.

Return type:

ViewOnlyDict

get_core_allocated()[source]

Gets the number of currently allocated cores at the site

Returns:

core count

Return type:

int

get_core_available()[source]

Gets the number of currently available cores at the site

Returns:

core count

Return type:

int

get_core_capacity()[source]

Gets the total number of cores at the site

Returns:

core count

Return type:

int

get_disk_allocated()[source]

Gets the amount of disk allocated the site in GB

Returns:

disk in GB

Return type:

int

get_disk_available()[source]

Gets the amount of disk available the site in GB

Parameters:

site (String or Node or NodeSliver) – site name or object

Returns:

disk in GB

Return type:

int

get_disk_capacity()[source]

Gets the total amount of disk available the site in GB

Returns:

disk in GB

Return type:

int

get_fablib_manager()[source]

Get the Fabric library manager associated with the host.

Returns:

The Fabric library manager.

Return type:

Any

get_fim()[source]

Get the FIM object of the host.

Returns:

The FIM of the host.

Return type:

node.Node

get_location_lat_long()[source]

Gets gets location of a site in latitude and longitude

Returns:

latitude and longitude of the site

Return type:

Tuple(float,float)

get_location_postal()[source]

Gets the location of a site by postal address

Parameters:

site (String or Node or NodeSliver) – site name or site object

Returns:

postal address of the site

Return type:

String

get_name()[source]

Gets the host name

Returns:

str

get_ptp_capable()[source]

Gets the PTP flag of the site - if it has a native PTP capability :param site: site name or object :type site: String or Node or NodeSliver :return: boolean flag :rtype: bool

get_ram_allocated()[source]

Gets the amount of memory currently allocated the site in GB

Parameters:

site (String or Node or NodeSliver) – site name or object

Returns:

ram in GB

Return type:

int

get_ram_available()[source]

Gets the amount of memory currently available the site in GB

Parameters:

site (String or Node or NodeSliver) – site name or object

Returns:

ram in GB

Return type:

int

get_ram_capacity()[source]

Gets the total amount of memory at the site in GB

Returns:

ram in GB

Return type:

int

get_state()[source]

Get the state of the host.

Returns:

The state of the host.

Return type:

str

show(output=None, fields=None, quiet=False, pretty_names=True)[source]

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

Intended for printing available resources at a host.

Parameters:
  • output (str) – Output type

  • fields (List) – List of fields to include

  • quiet (bool) – flag indicating verbose or quiet display

  • pretty_names (bool) – flag indicating if pretty names for the fields to be used or not

Returns:

Tabulated string of available resources

Return type:

String

to_dict()[source]

Convert the Host object to a dictionary.

Returns:

Dictionary representation of the Host object.

Return type:

dict

to_json()[source]

Convert the Host object to a JSON string.

Returns:

JSON string representation of the Host object.

Return type:

str

class fabrictestbed_extensions.fablib.site.ResourceConstants[source]

Constants and mappings for FABRIC resource attributes and display names.

class fabrictestbed_extensions.fablib.site.Site(site, fablib_manager)[source]

Initialize a Site object.

Parameters:
  • site (node.Node) – The node representing the site.

  • fablib_manager (Any) – The manager for the Fabric library.

Returns:

None

get_component_allocated(component_model_name)[source]

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

Parameters:

component_model_name (String) – component model name

Returns:

currently allocated component of this model

Return type:

int

get_component_available(component_model_name)[source]

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

Parameters:

component_model_name (String) – component model name

Returns:

currently available component of this model

Return type:

int

get_component_capacity(component_model_name)[source]

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

Parameters:

component_model_name (String) – component model name

Returns:

total component capacity

Return type:

int

get_core_allocated()[source]

Gets the number of currently allocated cores at the site

Returns:

core count

Return type:

int

get_core_available()[source]

Gets the number of currently available cores at the site

Returns:

core count

Return type:

int

get_core_capacity()[source]

Gets the total number of cores at the site

Returns:

core count

Return type:

int

get_cpu_capacity()[source]

Gets the total number of cpus at the site

Parameters:

site (String or node.Node or NodeSliver) – site name or site object

Returns:

cpu count

Return type:

int

get_disk_allocated()[source]

Gets the amount of disk allocated the site in GB

Returns:

disk in GB

Return type:

int

get_disk_available()[source]

Gets the amount of disk available the site in GB

Parameters:

site (String or Node or NodeSliver) – site name or object

Returns:

disk in GB

Return type:

int

get_disk_capacity()[source]

Gets the total amount of disk available the site in GB

Returns:

disk in GB

Return type:

int

get_fablib_manager()[source]

Get the Fabric library manager associated with the site.

Returns:

The Fabric library manager.

Return type:

Any

get_fim()[source]

Get the FIM object of the site.

Returns:

The FIM of the site.

Return type:

node.Node

get_host(name)[source]

Get a specific host associated with the site.

Parameters:

name (str) – The name of the host to retrieve.

Returns:

The specified host.

Return type:

Host

get_host_capacity()[source]

Gets the number of hosts at the site

Parameters:

site (String or Node or NodeSliver) – site name or site object

Returns:

host count

Return type:

int

get_host_names()[source]

Gets a list of all currently available hosts

Returns:

list of host names

Return type:

List[String]

get_hosts()[source]

Get the hosts associated with the site.

Returns:

Dictionary of hosts associated with the site.

Return type:

Dict[str, Host]

get_location_lat_long()[source]

Gets gets location of a site in latitude and longitude

Returns:

latitude and longitude of the site

Return type:

Tuple(float,float)

get_location_postal()[source]

Gets the location of a site by postal address

Parameters:

site (String or Node or NodeSliver) – site name or site object

Returns:

postal address of the site

Return type:

String

get_name()[source]

Gets the site name

Return type:

str

Returns:

str(MaintenanceState)

get_ptp_capable()[source]

Gets the PTP flag of the site - if it has a native PTP capability

Parameters:

site (String or Node or NodeSliver) – site name or object

Returns:

boolean flag

Return type:

bool

get_ram_allocated()[source]

Gets the amount of memory currently allocated the site in GB

Parameters:

site (String or Node or NodeSliver) – site name or object

Returns:

ram in GB

Return type:

int

get_ram_available()[source]

Gets the amount of memory currently available the site in GB

Parameters:

site (String or Node or NodeSliver) – site name or object

Returns:

ram in GB

Return type:

int

get_ram_capacity()[source]

Gets the total amount of memory at the site in GB

Returns:

ram in GB

Return type:

int

get_state(host=None)[source]

Gets the maintenance state of the node

Returns:

str(MaintenanceState)

show(output=None, fields=None, quiet=False, pretty_names=True)[source]

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

Intended for printing available resources at a site.

Parameters:
  • output (str) – Output type

  • fields (List) – List of fields to include

  • quiet (bool) – flag indicating verbose or quiet display

  • pretty_names (bool) – flag indicating if pretty names for the fields to be used or not

Returns:

Tabulated string of available resources

Return type:

String

to_dict()[source]

Convert site information into a dictionary

Return type:

dict

to_json()[source]

Convert the Site object to a JSON string.

Returns:

JSON string representation of the Site object.

Return type:

str

to_row()[source]

Convert the Site object to a row for tabular display.

Returns:

Tuple containing headers and row for tabular display.

Return type:

Tuple[list, list]

class fabrictestbed_extensions.fablib.site.Switch(switch, fablib_manager)[source]

Initialize a Switch object.

Parameters:
  • switch (node.Node) – The node representing the switch.

  • fablib_manager (Any) – The manager for the Fabric library.

get_allocated()[source]

Get the allocated capacity of the switch.

Returns:

The allocated capacity of the switch.

Return type:

int

get_available()[source]

Get the available capacity of the switch.

Returns:

The available capacity of the switch.

Return type:

int

get_capacity()[source]

Get the capacity of the switch.

Returns:

The capacity of the switch.

Return type:

int

get_fim()[source]

Get the FIM object of the Switch.

Returns:

The FIM of the Switch.

Return type:

node.Node

class fabrictestbed_extensions.fablib.site.Site(site, fablib_manager)[source]

Initialize a Site object.

Parameters:
  • site (node.Node) – The node representing the site.

  • fablib_manager (Any) – The manager for the Fabric library.

Returns:

None

__str__()[source]

Convert the Site object to a string representation in JSON format.

Returns:

JSON string representation of the Site object.

Return type:

str

get_component_allocated(component_model_name)[source]

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

Parameters:

component_model_name (String) – component model name

Returns:

currently allocated component of this model

Return type:

int

get_component_available(component_model_name)[source]

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

Parameters:

component_model_name (String) – component model name

Returns:

currently available component of this model

Return type:

int

get_component_capacity(component_model_name)[source]

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

Parameters:

component_model_name (String) – component model name

Returns:

total component capacity

Return type:

int

get_core_allocated()[source]

Gets the number of currently allocated cores at the site

Returns:

core count

Return type:

int

get_core_available()[source]

Gets the number of currently available cores at the site

Returns:

core count

Return type:

int

get_core_capacity()[source]

Gets the total number of cores at the site

Returns:

core count

Return type:

int

get_cpu_capacity()[source]

Gets the total number of cpus at the site

Parameters:

site (String or node.Node or NodeSliver) – site name or site object

Returns:

cpu count

Return type:

int

get_disk_allocated()[source]

Gets the amount of disk allocated the site in GB

Returns:

disk in GB

Return type:

int

get_disk_available()[source]

Gets the amount of disk available the site in GB

Parameters:

site (String or Node or NodeSliver) – site name or object

Returns:

disk in GB

Return type:

int

get_disk_capacity()[source]

Gets the total amount of disk available the site in GB

Returns:

disk in GB

Return type:

int

get_fablib_manager()[source]

Get the Fabric library manager associated with the site.

Returns:

The Fabric library manager.

Return type:

Any

get_fim()[source]

Get the FIM object of the site.

Returns:

The FIM of the site.

Return type:

node.Node

get_host(name)[source]

Get a specific host associated with the site.

Parameters:

name (str) – The name of the host to retrieve.

Returns:

The specified host.

Return type:

Host

get_host_capacity()[source]

Gets the number of hosts at the site

Parameters:

site (String or Node or NodeSliver) – site name or site object

Returns:

host count

Return type:

int

get_host_names()[source]

Gets a list of all currently available hosts

Returns:

list of host names

Return type:

List[String]

get_hosts()[source]

Get the hosts associated with the site.

Returns:

Dictionary of hosts associated with the site.

Return type:

Dict[str, Host]

get_location_lat_long()[source]

Gets gets location of a site in latitude and longitude

Returns:

latitude and longitude of the site

Return type:

Tuple(float,float)

get_location_postal()[source]

Gets the location of a site by postal address

Parameters:

site (String or Node or NodeSliver) – site name or site object

Returns:

postal address of the site

Return type:

String

get_name()[source]

Gets the site name

Return type:

str

Returns:

str(MaintenanceState)

get_ptp_capable()[source]

Gets the PTP flag of the site - if it has a native PTP capability

Parameters:

site (String or Node or NodeSliver) – site name or object

Returns:

boolean flag

Return type:

bool

get_ram_allocated()[source]

Gets the amount of memory currently allocated the site in GB

Parameters:

site (String or Node or NodeSliver) – site name or object

Returns:

ram in GB

Return type:

int

get_ram_available()[source]

Gets the amount of memory currently available the site in GB

Parameters:

site (String or Node or NodeSliver) – site name or object

Returns:

ram in GB

Return type:

int

get_ram_capacity()[source]

Gets the total amount of memory at the site in GB

Returns:

ram in GB

Return type:

int

get_state(host=None)[source]

Gets the maintenance state of the node

Returns:

str(MaintenanceState)

show(output=None, fields=None, quiet=False, pretty_names=True)[source]

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

Intended for printing available resources at a site.

Parameters:
  • output (str) – Output type

  • fields (List) – List of fields to include

  • quiet (bool) – flag indicating verbose or quiet display

  • pretty_names (bool) – flag indicating if pretty names for the fields to be used or not

Returns:

Tabulated string of available resources

Return type:

String

to_dict()[source]

Convert site information into a dictionary

Return type:

dict

to_json()[source]

Convert the Site object to a JSON string.

Returns:

JSON string representation of the Site object.

Return type:

str

to_row()[source]

Convert the Site object to a row for tabular display.

Returns:

Tuple containing headers and row for tabular display.

Return type:

Tuple[list, list]

class fabrictestbed_extensions.fablib.site.Switch(switch, fablib_manager)[source]

Initialize a Switch object.

Parameters:
  • switch (node.Node) – The node representing the switch.

  • fablib_manager (Any) – The manager for the Fabric library.

get_allocated()[source]

Get the allocated capacity of the switch.

Returns:

The allocated capacity of the switch.

Return type:

int

get_available()[source]

Get the available capacity of the switch.

Returns:

The available capacity of the switch.

Return type:

int

get_capacity()[source]

Get the capacity of the switch.

Returns:

The capacity of the switch.

Return type:

int

get_fim()[source]

Get the FIM object of the Switch.

Returns:

The FIM of the Switch.

Return type:

node.Node

class fabrictestbed_extensions.fablib.site.Host(host, state, ptp, fablib_manager)[source]

Initialize a Host object.

Parameters:
  • host (node.Node) – The node representing the host.

  • state (str) – The state of the host.

  • ptp (bool) – Boolean indicating if the host is PTP capable.

  • fablib_manager (Any) – The manager for the Fabric library.

Returns:

None

__str__()[source]

Convert the Host object to a string representation in JSON format.

Returns:

JSON string representation of the Host object.

Return type:

str

get_component(comp_model_type)[source]

Get a specific component associated with the host.

Parameters:

comp_model_type (str) – The type of component to retrieve.

Returns:

The specified component.

Return type:

Component

get_component_allocated(component_model_name)[source]

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

Parameters:

component_model_name (String) – component model name

Returns:

currently allocated component of this model

Return type:

int

get_component_available(component_model_name)[source]

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

Parameters:

component_model_name (String) – component model name

Returns:

currently available component of this model

Return type:

int

get_component_capacity(component_model_name)[source]

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

Parameters:

component_model_name (String) – component model name

Returns:

total component capacity

Return type:

int

get_components()[source]

Get the components associated with the host.

Returns:

Dictionary-like view of the components associated with the host.

Return type:

ViewOnlyDict

get_core_allocated()[source]

Gets the number of currently allocated cores at the site

Returns:

core count

Return type:

int

get_core_available()[source]

Gets the number of currently available cores at the site

Returns:

core count

Return type:

int

get_core_capacity()[source]

Gets the total number of cores at the site

Returns:

core count

Return type:

int

get_disk_allocated()[source]

Gets the amount of disk allocated the site in GB

Returns:

disk in GB

Return type:

int

get_disk_available()[source]

Gets the amount of disk available the site in GB

Parameters:

site (String or Node or NodeSliver) – site name or object

Returns:

disk in GB

Return type:

int

get_disk_capacity()[source]

Gets the total amount of disk available the site in GB

Returns:

disk in GB

Return type:

int

get_fablib_manager()[source]

Get the Fabric library manager associated with the host.

Returns:

The Fabric library manager.

Return type:

Any

get_fim()[source]

Get the FIM object of the host.

Returns:

The FIM of the host.

Return type:

node.Node

get_location_lat_long()[source]

Gets gets location of a site in latitude and longitude

Returns:

latitude and longitude of the site

Return type:

Tuple(float,float)

get_location_postal()[source]

Gets the location of a site by postal address

Parameters:

site (String or Node or NodeSliver) – site name or site object

Returns:

postal address of the site

Return type:

String

get_name()[source]

Gets the host name

Returns:

str

get_ptp_capable()[source]

Gets the PTP flag of the site - if it has a native PTP capability :param site: site name or object :type site: String or Node or NodeSliver :return: boolean flag :rtype: bool

get_ram_allocated()[source]

Gets the amount of memory currently allocated the site in GB

Parameters:

site (String or Node or NodeSliver) – site name or object

Returns:

ram in GB

Return type:

int

get_ram_available()[source]

Gets the amount of memory currently available the site in GB

Parameters:

site (String or Node or NodeSliver) – site name or object

Returns:

ram in GB

Return type:

int

get_ram_capacity()[source]

Gets the total amount of memory at the site in GB

Returns:

ram in GB

Return type:

int

get_state()[source]

Get the state of the host.

Returns:

The state of the host.

Return type:

str

show(output=None, fields=None, quiet=False, pretty_names=True)[source]

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

Intended for printing available resources at a host.

Parameters:
  • output (str) – Output type

  • fields (List) – List of fields to include

  • quiet (bool) – flag indicating verbose or quiet display

  • pretty_names (bool) – flag indicating if pretty names for the fields to be used or not

Returns:

Tabulated string of available resources

Return type:

String

to_dict()[source]

Convert the Host object to a dictionary.

Returns:

Dictionary representation of the Host object.

Return type:

dict

to_json()[source]

Convert the Host object to a JSON string.

Returns:

JSON string representation of the Host object.

Return type:

str