facility_port

This module contains methods to work with FABRIC facility ports.

class fabrictestbed_extensions.fablib.facility_port.FacilityPort(slice, fim_object)[source]
Parameters:
  • slice (Slice) – the fablib slice to have this node on

  • fim_object (FimNode)

delete()[source]

Remove the facility from the slice. All interfaces associated with the Facility Port are removed from the Slice.

static get_facility_port(slice=None, facility_port=None)[source]

Create a FacilityPort object from an existing FIM facility port.

Factory method that wraps a FIM (FABRIC Information Model) facility port object in a FABlib FacilityPort wrapper.

Parameters:
  • slice (Slice) – The slice containing the facility port.

  • facility_port (FimNode) – FIM facility port object to wrap.

Returns:

FacilityPort object wrapping the FIM facility port.

Return type:

FacilityPort

get_fim()[source]

Gets the Facility Ports’s FABRIC Information Model (fim) object.

This method is used to access data at a lower level than FABlib.

get_interface(name=None, refresh=False, raise_exception=None)[source]

Gets a specific interface by name.

Parameters:
  • name (str) – the interface name

  • refresh (bool) – force refresh from FIM

  • raise_exception (bool) – if True, raise ResourceNotFoundError when the interface is not found; if False, return None. When None (default), falls back to the global FablibManager.raise_on_not_found setting.

Returns:

the interface or None

Return type:

Optional[Interface]

Raises:

ResourceNotFoundError – if the interface is not found and raising is enabled

get_interfaces(refresh=False, output='list')[source]

Gets interfaces associated with this facility port.

Results are cached. Use refresh=True to force reload.

Parameters:
  • refresh (bool) – force refresh from FIM

  • output (str) – return type - ‘list’ or ‘dict’

Returns:

interfaces

Return type:

Union[Dict[str, Interface], List[Interface]]

get_model()[source]

Get fablib model name for the facility port.

Return type:

str

static get_pretty_name_dict()[source]

Return a mapping used when rendering table headers.

get_site()[source]

Gets the site where the facility port is located.

Results are cached for performance.

Returns:

the site name

Return type:

str

get_slice()[source]

Gets the fablib slice associated with this node.

Returns:

the fablib slice on this node

Return type:

Slice

static new_facility_port(slice=None, name=None, site=None, vlan=None, bandwidth=None, mtu=None, labels=None, peer_labels=None)[source]

Create a new facility port in the given slice.

You might want to Slice.add_facility_port(), in most cases.

Parameters:
  • slice (Slice) – The slice in which the facility port will be created.

  • name (str) – The name of the facility port.

  • site (str) – The site where the facility port will be located.

  • vlan (Union[List, str]) – A list or single string representing the VLANs for the facility port.

  • bandwidth (int) – The bandwidth capacity for the facility port, default is 10.

  • mtu (int) – MTU size

  • labels (Labels) – Labels associated with the facility port.

  • peer_labels (Labels) – Peer labels associated with the facility port.

Return type:

FacilityPort

Returns:

A FacilityPort object representing the created facility port.

toDict(skip=None)[source]

Return a Python dict representation of the facility port.

Results are cached. Cache is invalidated when _invalidate_cache() is called.

Parameters:

skip (list) – list of keys to exclude

update(fim_node=None)[source]

Update the facility port with new FIM data.

Parameters:

fim_node (FimNode) – The new FIM node data

class fabrictestbed_extensions.fablib.facility_port.FacilityPort(slice, fim_object)[source]
Parameters:
  • slice (Slice) – the fablib slice to have this node on

  • fim_object (FimNode)

__str__()[source]

Creates a tabulated string describing the properties of the node. Intended for printing node information.

Returns:

Tabulated string of node information

Return type:

String

delete()[source]

Remove the facility from the slice. All interfaces associated with the Facility Port are removed from the Slice.

static get_facility_port(slice=None, facility_port=None)[source]

Create a FacilityPort object from an existing FIM facility port.

Factory method that wraps a FIM (FABRIC Information Model) facility port object in a FABlib FacilityPort wrapper.

Parameters:
  • slice (Slice) – The slice containing the facility port.

  • facility_port (FimNode) – FIM facility port object to wrap.

Returns:

FacilityPort object wrapping the FIM facility port.

Return type:

FacilityPort

get_fim()[source]

Gets the Facility Ports’s FABRIC Information Model (fim) object.

This method is used to access data at a lower level than FABlib.

get_interface(name=None, refresh=False, raise_exception=None)[source]

Gets a specific interface by name.

Parameters:
  • name (str) – the interface name

  • refresh (bool) – force refresh from FIM

  • raise_exception (bool) – if True, raise ResourceNotFoundError when the interface is not found; if False, return None. When None (default), falls back to the global FablibManager.raise_on_not_found setting.

Returns:

the interface or None

Return type:

Optional[Interface]

Raises:

ResourceNotFoundError – if the interface is not found and raising is enabled

get_interfaces(refresh=False, output='list')[source]

Gets interfaces associated with this facility port.

Results are cached. Use refresh=True to force reload.

Parameters:
  • refresh (bool) – force refresh from FIM

  • output (str) – return type - ‘list’ or ‘dict’

Returns:

interfaces

Return type:

Union[Dict[str, Interface], List[Interface]]

get_model()[source]

Get fablib model name for the facility port.

Return type:

str

static get_pretty_name_dict()[source]

Return a mapping used when rendering table headers.

get_site()[source]

Gets the site where the facility port is located.

Results are cached for performance.

Returns:

the site name

Return type:

str

get_slice()[source]

Gets the fablib slice associated with this node.

Returns:

the fablib slice on this node

Return type:

Slice

static new_facility_port(slice=None, name=None, site=None, vlan=None, bandwidth=None, mtu=None, labels=None, peer_labels=None)[source]

Create a new facility port in the given slice.

You might want to Slice.add_facility_port(), in most cases.

Parameters:
  • slice (Slice) – The slice in which the facility port will be created.

  • name (str) – The name of the facility port.

  • site (str) – The site where the facility port will be located.

  • vlan (Union[List, str]) – A list or single string representing the VLANs for the facility port.

  • bandwidth (int) – The bandwidth capacity for the facility port, default is 10.

  • mtu (int) – MTU size

  • labels (Labels) – Labels associated with the facility port.

  • peer_labels (Labels) – Peer labels associated with the facility port.

Return type:

FacilityPort

Returns:

A FacilityPort object representing the created facility port.

toDict(skip=None)[source]

Return a Python dict representation of the facility port.

Results are cached. Cache is invalidated when _invalidate_cache() is called.

Parameters:

skip (list) – list of keys to exclude

update(fim_node=None)[source]

Update the facility port with new FIM data.

Parameters:

fim_node (FimNode) – The new FIM node data