interface¶
Methods to work with FABRIC network interfaces.
- class fabrictestbed_extensions.fablib.interface.Interface(component: Component = None, fim_interface: FimInterface = None, node: FacilityPort = None)¶
Note
Objects of this class are not created directly.
- Parameters:
component (Component) – the component to set on this interface
fim_interface (FimInterface) – the FABRIC information model interface to set on this fablib interface
node (FacilityPort) – the facility Port to which interface is assoicated with
- __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
- config_vlan_iface()¶
Not intended for API use
- get_bandwidth() int ¶
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_component() Component ¶
Gets the component attached to this interface.
- Returns:
the component on this interface
- Return type:
- 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_error_message() str ¶
Gets the error messages
- Returns:
error
- Return type:
String
- get_fim_interface() Interface ¶
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:
fim interface
- get_ip_addr_ssh(dev=None)¶
Gets the ip addr info for this interface.
:return ip addr info :rtype: str
- get_ip_link()¶
Gets the ip link info for this interface.
:return ip link info :rtype: str
- get_ips(family=None)¶
Gets a list of ips assigned to this interface.
:return list of ips :rtype: list[str]
- get_mac() str ¶
Gets the MAC address of the interface.
- Returns:
MAC address
- Return type:
String
- 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_name() str ¶
Gets the name of this interface.
- Returns:
the name of this interface
- Return type:
String
- get_network() NetworkService ¶
Gets the network this interface is on.
- Returns:
the network service this interface is on
- Return type:
- get_node() Node | FacilityPort ¶
Gets the node this interface’s component is on.
- Returns:
the node this interface is attached to
- Return type:
- get_os_dev()¶
Gets json output of ‘ip addr list’ for the interface.
- Returns:
device description
- Return type:
Dict
- 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_peer_port_name() str ¶
If available provide the name of the attached port on the dataplane switch. Only possible once the slice has been instantiated.
- get_physical_os_interface()¶
Not intended for API use
- get_physical_os_interface_name() str ¶
Gets a name of the physical interface the operating system uses for this FABLib interface.
If the interface requires a FABRIC VLAN tag, the base interface name will be returned (i.e. not the VLAN tagged interface)
- Returns:
physical OS interface name
- Return type:
String
- get_reservation_state() str ¶
Gets the reservation state
- Returns:
VLAN
- Return type:
String
- 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:
- get_vlan() str ¶
Gets the FABRIC VLAN of an interface.
- Returns:
VLAN
- Return type:
String
- 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
- ip_link_down()¶
Bring down the link on the interface.
- ip_link_toggle()¶
Toggle the dev down then up.
- ip_link_up()¶
Bring up the link on the interface.
- set_ip(ip=None, cidr=None, mtu=None)¶
Depricated
- set_vlan(vlan: Any | None = None)¶
Set the VLAN on the FABRIC request.
- Parameters:
addr (String or int) – vlan
- 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
- toDict(skip=[])¶
Returns the interface attributes as a dictionary
- Returns:
slice attributes as dictionary
- Return type:
dict
- toJson()¶
Returns the interface attributes as a json string
- Returns:
slice attributes as json string
- Return type:
str
- un_manage_interface()¶
Mark an interface unmanaged by Network Manager; This is needed to be run on rocky* images to avoid the network configuration from being overwritten by NetworkManager