-
-
Notifications
You must be signed in to change notification settings - Fork 76
Kathara.model.Machine
A Kathara device.
Contains information about the device and the API object to interact with the Manager.
Attributes:
-
lab(Kathara.model.Lab): The Kathara network Scenario of the device. -
name(str): The name of the device. -
interfaces(List[Kathara.model.Link]): A list of the collision domains of the device. -
meta(Dict[str, Any]): Keys are meta properties name, values are meta properties values. -
startup_commands(List[str]): A list of commands to execute at the device startup. -
api_object(Any): To interact with the current Kathara Manager. -
capabilities(List[str]): The selected capabilities for the device. -
startup_path(str): The path of the device startup file, if exists. -
shutdown_path(str): The path of the device shutdown file, if exists. -
folder(str): The path of the device folder, if exists.
__init__(lab: 'LabPackage.Lab', name: str, **kwargs) → NoneCreate a new instance of a Kathara device.
Args:
-
lab(Kathara.model.Lab): The Kathara network scenario of the new device. -
name(str): The name of the device. -
**kwargs (Dict[str, Any]): Specifies the optional parameters of the device.
Returns: None
add_interface(link: 'LinkPackage.Link', number: int = None) → NoneAdd an interface to the device attached to the specified collision domain.
Args:
-
link(Kathara.model.Link): The Kathara collision domain to attach. -
number(int): The number of the new interface. If it is None, the first free number is selected.
Returns: None
Raises:
-
Exception: The interface number specified is already used on the device.
add_meta(name: str, value: Any) → NoneAdd a meta property to the device.
Args:
-
name(str): The name of the property. -
value(Any): The value of the property.
Returns: None
Raises:
-
MachineOptionError: The specified value is not valid for the specified property.
check() → NoneSorts interfaces check if there are missing positions.
Returns: None
Raises:
-
NonSequentialMachineInterfaceError: If there is a missing interface number.
connect(terminal_name: str) → NoneConnect to the device with the specified terminal.
Args:
-
terminal_name(str): The name of the terminal to use for the connection. The application must be correctly installed in the host system. This option is only visible on Linux and macOS. On Linux, options are /usr/bin/xterm, TMUX or an user-defined path. On macOS, options are Terminal (default system terminal), iTerm or TMUX.
Returns: None
get_cpu(multiplier: int = 1) → Optional[int]Get the CPU limit, multiplied by a specific multiplier.
User should pass a float value ranging from 0 to max user CPUs. Try to took it from options, or machine meta. Otherwise, return None.
Args: multiplier (int):
Returns:
-
Optional[int]: The CPU limit of the device.
get_image() → strGet the image of the device, if defined in options or machine meta. If not, use default one.
Returns:
-
str: The name of the device image.
get_mem() → strGet memory limit, if defined in options. If not, use the value from device meta. Otherwise, return None.
Returns:
-
str: The memory limit of the device.
get_num_terms() → intGet the number of terminal to be opened for the device.
Returns:
-
int: The number of terminal to be opened.
get_ports() → Optional[Dict[Tuple[int, str], int]]Get the port mapping of the device.
Returns:
-
Dict[(int, str), int]: Keys are pairs (host_port, protocol), values specifies the guest_port.
is_ipv6_enabled() → boolCheck if IPv6 is enabled on the device.
Returns:
-
bool: True if it is enabled, else False.
pack_data() → Optional[bytes]Pack machine data into a .tar.gz file and returns the tar content as a byte array.
While packing files, it also applies the win2linux patch in order to remove UTF-8 BOM.
Returns:
-
bytes: the tar content.
update_meta(args: Dict[str, Any]) → NoneUpdate the device metas from a dict.
Args:
-
args(Dict[str, Any]): Keys are the meta properties names, values are the updated meta properties values.
Returns: None
This file was automatically generated via lazydocs.
Website: kathara.org
Contact us: contact@kathara.org