Skip to content

Developer Interface

This part of the documentation covers all the interfaces of WEmulate.

Database and TC Interface

wemulate.ext.utils.add_connection(connection_name, first_logical_interface, second_logical_interface)

Creates a new connection in the database and adds a linux bridge on the host system.

Parameters:

Name Type Description Default
connection_name str

Name of the connection which should be created.

required
first_logical_interface str

Name of the first logical interface.

required
second_logical_interface str

Name of the second logical interface.

required

Returns:

Type Description
None

None

Source code in wemulate/ext/utils/add.py
def add_connection(
    connection_name: str, first_logical_interface: str, second_logical_interface: str
) -> None:
    """
    Creates a new connection in the database and adds a linux bridge on the host system.

    Args:
        connection_name: Name of the connection which should be created.
        first_logical_interface: Name of the first logical interface.
        second_logical_interface: Name of the second logical interface.

    Returns:
        None
    """
    (
        physical_interface1_name,
        physical_interface2_name,
    ) = retrieve.get_physical_interface_names(
        first_logical_interface, second_logical_interface
    )
    dbutils.create_connection(
        connection_name,
        dbutils.get_logical_interface_by_name(first_logical_interface),
        dbutils.get_logical_interface_by_name(second_logical_interface),
        dbutils.get_active_profile(dbutils.get_device()),
    )
    tcutils.add_connection(
        connection_name,
        physical_interface1_name,
        physical_interface2_name,
    )

wemulate.ext.utils.add_parameter(connection_name, parameters, direction)

Add parameters to the already configured parameters on the given connection. If a direction is provided, the parameter will be applied only on the given direction. If not, the parameter will be applied in both directions (bidirectional, in-/outgoing).

Parameters:

Name Type Description Default
connection_name str

Name of the connection on which the parameters should be configured.

required
parameters Dict[str, float]

Parameters which should be configured.

required
direction Optional[str]

Direction on which the parameter should be applied (bidirectional if None)

required

Returns:

Type Description
None

None

Source code in wemulate/ext/utils/add.py
def add_parameter(
    connection_name: str, parameters: Dict[str, float], direction: Optional[str]
) -> None:
    """
    Add parameters to the already configured parameters on the given connection.
    If a direction is provided, the parameter will be applied only on the given direction.
    If not, the parameter will be applied in both directions (bidirectional, in-/outgoing).

    Args:
        connection_name: Name of the connection on which the parameters should be configured.
        parameters: Parameters which should be configured.
        direction: Direction on which the parameter should be applied (bidirectional if None)

    Returns:
        None
    """
    connection, current_parameters = common.get_current_applied_parameters(
        connection_name
    )
    common.set_parameters_with_tc(
        connection,
        common.create_or_update_parameters_in_db(
            connection, parameters, direction, current_parameters
        ),
        direction,
    )

wemulate.ext.utils.set_parameter(connection_name, parameters, direction)

Set parameters on the given connection. Replaces all parameters which are configured. If a direction is provided, the parameter will be applied only on the given direction. If not, the parameter will be applied in both directions (bidirectional, in-/outgoing).

Parameters:

Name Type Description Default
connection_name str

Name of the connection on which the parameters should be configured.

required
parameters Dict[str, float]

Parameters which should be configured.

required
direction Optional[str]

Direction on which the parameter should be applied (bidirectional if None)

required

Returns:

Type Description
None

None

Source code in wemulate/ext/utils/set.py
def set_parameter(
    connection_name: str, parameters: Dict[str, float], direction: Optional[str]
) -> None:
    """
    Set parameters on the given connection. Replaces all parameters which are configured.
    If a direction is provided, the parameter will be applied only on the given direction.
    If not, the parameter will be applied in both directions (bidirectional, in-/outgoing).

    Args:
        connection_name: Name of the connection on which the parameters should be configured.
        parameters: Parameters which should be configured.
        direction: Direction on which the parameter should be applied (bidirectional if None)

    Returns:
        None
    """
    connection: ConnectionModel = dbutils.get_connection_by_name(connection_name)
    dbutils.delete_all_parameter_on_connection(connection.connection_id, direction)
    connection, current_parameters = common.get_current_applied_parameters(
        connection_name
    )

    common.set_parameters_with_tc(
        connection,
        common.create_or_update_parameters_in_db(
            connection, parameters, direction, current_parameters
        ),
        direction,
    )

wemulate.ext.utils.create_or_update_parameters_in_db(connection, parameters, direction, current_parameters=Dict[str, Dict[str, int]])

Creates and updates parameters in the database.

Args: connection: Connection object on which the updates should be made. parameters: Parameters which should be updated. direction: Direction on which the parameter should be applied (bidirectional if None) current_parameters: Current parameters which should be updated.

Returns: Returns the current_parameters which are set in the database.

Source code in wemulate/ext/utils/common.py
def create_or_update_parameters_in_db(
    connection: ConnectionModel,
    parameters: Dict[str, int],
    direction: Optional[str],
    current_parameters=Dict[str, Dict[str, int]],
) -> Dict[str, Dict[str, int]]:
    """
    Creates and updates parameters in the database.

    Args:
        connection: Connection object on which the updates should be made.
        parameters: Parameters which should be updated.
        direction: Direction on which the parameter should be applied (bidirectional if None)
        current_parameters: Current parameters which should be updated.

    Returns:
        Returns the current_parameters which are set in the database.
    """
    for direction in [INCOMING, OUTGOING] if direction is None else [direction]:
        for parameter_name in PARAMETERS:
            if parameter_name in parameters:
                _set_specific_parameter(
                    connection,
                    parameter_name,
                    parameters,
                    current_parameters,
                    direction,
                )
    return current_parameters

wemulate.ext.utils.set_parameters_with_tc(connection, parameters, direction)

Set parameters on the host system on the given connection.

Args: connection: Connection object on which the updates should be made. parameters: Parameters which should be configured. direction: Direction on which the parameter should be applied (bidirectional if None)

Returns: None

Source code in wemulate/ext/utils/common.py
def set_parameters_with_tc(
    connection: ConnectionModel,
    parameters: Dict[str, Dict[str, int]],
    direction: Optional[str],
):
    """
    Set parameters on the host system on the given connection.

    Args:
        connection: Connection object on which the updates should be made.
        parameters: Parameters which should be configured.
        direction: Direction on which the parameter should be applied (bidirectional if None)

    Returns:
        None
    """
    tcutils.set_parameters(
        connection.connection_name,
        dbutils.get_physical_interface_by_logical_interface_id(
            connection.first_logical_interface_id
        ).physical_name,
        parameters,
        direction,
    )

wemulate.ext.utils.delete_parameters_in_db(parameters, current_parameters, connection, direction)

Delete specific parameters in db.

Parameters:

Name Type Description Default
parameters Dict[str, int]

Parameters which should be deleted.

required
current_parameters Dict[str, Dict[str, int]]

The current parameters of the connection.

required
connection ConnectionModel

Connection object on which the updates should be made.

required
direction Optional[str]

Direction on which the parameter should be applied (bidirectional if None)

required

Returns:

Type Description
Dict[str, Dict[str, int]]

Returns the current parameters in the database.

Source code in wemulate/ext/utils/common.py
def delete_parameters_in_db(
    parameters: Dict[str, int],
    current_parameters: Dict[str, Dict[str, int]],
    connection: ConnectionModel,
    direction: Optional[str],
) -> Dict[str, Dict[str, int]]:
    """
    Delete specific parameters in db.

    Args:
        parameters: Parameters which should be deleted.
        current_parameters: The current parameters of the connection.
        connection: Connection object on which the updates should be made.
        direction: Direction on which the parameter should be applied (bidirectional if None)

    Returns:
        Returns the current parameters in the database.
    """

    for direction in [INCOMING, OUTGOING] if direction is None else [direction]:
        for parameter_name in PARAMETERS:
            if (
                parameter_name in parameters
                and parameter_name in current_parameters[direction]
            ):
                _delete_specific_parameter(connection, parameter_name, direction)
                current_parameters[direction].pop(parameter_name)
    return current_parameters

wemulate.ext.utils.get_current_applied_parameters(connection_name)

Retrieve the connection object and its current applied parameters.

Args: connection_name: The name of the connection

Returns: Returns the connection object (ConnectionModel) and the current_parameters which are currently set.

Source code in wemulate/ext/utils/common.py
def get_current_applied_parameters(connection_name: str):
    """
    Retrieve the connection object and its current applied parameters.

    Args:
        connection_name: The name of the connection

    Returns:
        Returns the connection object (ConnectionModel) and the current_parameters which are currently set.
    """
    connection: ConnectionModel = dbutils.get_connection_by_name(connection_name)
    current_parameters: Dict[str, Dict[str, int]] = {OUTGOING: {}, INCOMING: {}}
    for parameter in connection.parameters:
        current_parameters[parameter.direction][
            parameter.parameter_name
        ] = parameter.value
    return connection, current_parameters

wemulate.ext.utils.delete_connection(connection_name)

Delete connection with the given name.

Parameters:

Name Type Description Default
connection_name str

Name of the connection which should be deleted.

required

Returns:

Type Description
None

None

Source code in wemulate/ext/utils/delete.py
def delete_connection(connection_name: str) -> None:
    """
    Delete connection with the given name.

    Args:
        connection_name: Name of the connection which should be deleted.

    Returns:
        None
    """
    connection: ConnectionModel = dbutils.get_connection_by_name(connection_name)
    physical_interface_name = dbutils.get_physical_interface_by_logical_interface_id(
        connection.first_logical_interface_id
    ).physical_name
    tcutils.remove_parameters(connection_name, physical_interface_name)
    tcutils.remove_connection(connection_name)
    dbutils.delete_connection_by_name(connection_name)

wemulate.ext.utils.delete_parameter(connection_name, parameters, direction)

Delete specific parameters on the given connection. If a direction is provided, the parameter will be removed only on the given direction. If not, the parameter will be removed in both directions (bidirectional, in-/outgoing).

Parameters:

Name Type Description Default
connection_name str

Name of the connection on which the parameters should be deleted.

required
parameters Dict[str, int]

Parameters which should be deleted.

required
direction Optional[str]

The direction on which the parameter should be removed (bidirectional if None)

required

Returns:

Type Description
None

None

Source code in wemulate/ext/utils/delete.py
def delete_parameter(
    connection_name: str, parameters: Dict[str, int], direction: Optional[str]
) -> None:
    """
    Delete specific parameters on the given connection.
    If a direction is provided, the parameter will be removed only on the given direction.
    If not, the parameter will be removed in both directions (bidirectional, in-/outgoing).

    Args:
        connection_name: Name of the connection on which the parameters should be deleted.
        parameters: Parameters which should be deleted.
        direction: The direction on which the parameter should be removed (bidirectional if None)

    Returns:
        None
    """
    connection, current_parameters = common.get_current_applied_parameters(
        connection_name
    )
    physical_interface_name = dbutils.get_physical_interface_by_logical_interface_id(
        connection.first_logical_interface_id
    ).physical_name
    tcutils.remove_parameters(connection_name, physical_interface_name)
    common.set_parameters_with_tc(
        connection,
        common.delete_parameters_in_db(
            parameters, current_parameters, connection, direction
        ),
        direction,
    )

wemulate.ext.utils.reset_connection(connection_name)

Deletes all parameter on a specific connection

Parameters:

Name Type Description Default
connection_name str

Name of the connection which should be reset

required

Returns:

Type Description
None

None

Source code in wemulate/ext/utils/reset.py
def reset_connection(connection_name: str) -> None:
    """
    Deletes all parameter on a specific connection

    Args:
        connection_name: Name of the connection which should be reset

    Returns:
        None
    """
    connection: ConnectionModel = dbutils.get_connection_by_name(connection_name)
    dbutils.delete_all_parameter_on_connection(connection.connection_id)
    physical_interface_name = dbutils.get_physical_interface_by_logical_interface_id(
        connection.first_logical_interface_id
    ).physical_name
    tcutils.remove_parameters(connection.connection_name, physical_interface_name)

wemulate.ext.utils.reset_device()

Deletes all parameters and connection in the database and on the host system.

Returns:

Type Description
None

None

Source code in wemulate/ext/utils/reset.py
def reset_device() -> None:
    """
    Deletes all parameters and connection in the database and on the host system.

    Returns:
        None
    """
    for connection in dbutils.get_connection_list():
        physical_interface_name = (
            dbutils.get_physical_interface_by_logical_interface_id(
                connection.first_logical_interface_id
            ).physical_name
        )
        tcutils.remove_parameters(connection.connection_name, physical_interface_name)
        tcutils.remove_connection(connection.connection_name)
    dbutils.reset_all_connections()

wemulate.ext.utils.get_physical_interface_names(first_logical_interface, second_logical_interface)

Get the physical interface names for the logical interface names.

Parameters:

Name Type Description Default
first_logical_interface str

First logical interface name.

required
second_logical_interface str

Second logical interface name.

required

Returns:

Type Description
Tuple[str, str]

Tuple of strings.

Source code in wemulate/ext/utils/retrieve.py
def get_physical_interface_names(
    first_logical_interface: str, second_logical_interface: str
) -> Tuple[str, str]:
    """
    Get the physical interface names for the logical interface names.

    Args:
        first_logical_interface: First logical interface name.
        second_logical_interface: Second logical interface name.

    Returns:
        Tuple of strings.
    """
    physical_interface1_name: str = dbutils.get_physical_interface_by_logical_name(
        first_logical_interface
    ).physical_name
    physical_interface2_name: str = dbutils.get_physical_interface_by_logical_name(
        second_logical_interface
    ).physical_name
    return physical_interface1_name, physical_interface2_name

wemulate.ext.utils.get_logical_interface_by_name(logical_interface_name)

Return the logical interface object for a given name

Parameters:

Name Type Description Default
logical_interface_name str

Logical interface name.

required

Returns:

Type Description
Optional[LogicalInterfaceModel]

Returns a logical interface object.

Source code in wemulate/ext/utils/retrieve.py
def get_logical_interface_by_name(
    logical_interface_name: str,
) -> Optional[LogicalInterfaceModel]:
    """
    Return the logical interface object for a given name

    Args:
        logical_interface_name: Logical interface name.

    Returns:
        Returns a logical interface object.
    """
    return dbutils.get_logical_interface_by_name(logical_interface_name)

wemulate.ext.utils.connection_exists_in_db(connection_name)

Returns a true if a connection exists in the database

Parameters:

Name Type Description Default
connection_name str

Connection name.

required

Returns:

Type Description
bool

Returns a boolean.

Source code in wemulate/ext/utils/retrieve.py
def connection_exists_in_db(connection_name: str) -> bool:
    """
    Returns a true if a connection exists in the database

    Args:
        connection_name: Connection name.

    Returns:
        Returns a boolean.
    """
    return dbutils.connection_exists(connection_name)

wemulate.ext.utils.get_connection_by_name(connection_name)

Returns a a connection object for a connection name.

Parameters:

Name Type Description Default
connection_name str

Connection name.

required

Returns:

Type Description
ConnectionModel

Returns a connection object.

Source code in wemulate/ext/utils/retrieve.py
def get_connection_by_name(connection_name: str) -> ConnectionModel:
    """
    Returns a a connection object for a connection name.

    Args:
        connection_name: Connection name.

    Returns:
        Returns a connection object.
    """
    return dbutils.get_connection_by_name(connection_name)

wemulate.ext.utils.get_connection_by_id(connection_id)

Returns a a connection object by its unique id.

Parameters:

Name Type Description Default
connection_id int

Connection id.

required

Returns:

Type Description
ConnectionModel

Returns a connection object.

Source code in wemulate/ext/utils/retrieve.py
def get_connection_by_id(connection_id: int) -> ConnectionModel:
    """
    Returns a a connection object by its unique id.

    Args:
        connection_id: Connection id.

    Returns:
        Returns a connection object.
    """
    return dbutils.get_connection_by_id(connection_id)

wemulate.ext.utils.get_logical_interface_by_physical_name(physical_interface_name)

Returns the logical interface object for a physical interface name.

Parameters:

Name Type Description Default
physical_interface_name str

Name of the physical interface.

required

Returns:

Type Description
LogicalInterfaceModel

Returns a logical interface object.

Source code in wemulate/ext/utils/retrieve.py
def get_logical_interface_by_physical_name(
    physical_interface_name: str,
) -> LogicalInterfaceModel:
    """
    Returns the logical interface object for a physical interface name.

    Args:
        physical_interface_name: Name of the physical interface.

    Returns:
        Returns a logical interface object.
    """
    return dbutils.get_logical_interface_by_physical_name(physical_interface_name)

wemulate.ext.utils.get_logical_interface_by_id(logical_interface_id)

Returns the logical interface object for the logical interface id.

Parameters:

Name Type Description Default
logical_interface_id int

The unique identifier for the specific logical interface.

required

Returns:

Type Description
LogicalInterfaceModel

Returns a logical interface object.

Source code in wemulate/ext/utils/retrieve.py
def get_logical_interface_by_id(
    logical_interface_id: int,
) -> LogicalInterfaceModel:
    """
    Returns the logical interface object for the logical interface id.

    Args:
        logical_interface_id: The unique identifier for the specific logical interface.

    Returns:
        Returns a logical interface object.
    """
    return dbutils.get_logical_interface_by_id(logical_interface_id)

wemulate.ext.utils.get_connection_list()

Returns all existing connection objects as a list.

Returns:

Type Description
List[ConnectionModel]

Returns a list of connection objects.

Source code in wemulate/ext/utils/retrieve.py
def get_connection_list() -> List[ConnectionModel]:
    """
    Returns all existing connection objects as a list.

    Returns:
        Returns a list of connection objects.
    """
    return dbutils.get_connection_list()

wemulate.ext.utils.reset_connection(connection_name)

Deletes all parameter on a specific connection

Parameters:

Name Type Description Default
connection_name str

Name of the connection which should be reset

required

Returns:

Type Description
None

None

Source code in wemulate/ext/utils/reset.py
def reset_connection(connection_name: str) -> None:
    """
    Deletes all parameter on a specific connection

    Args:
        connection_name: Name of the connection which should be reset

    Returns:
        None
    """
    connection: ConnectionModel = dbutils.get_connection_by_name(connection_name)
    dbutils.delete_all_parameter_on_connection(connection.connection_id)
    physical_interface_name = dbutils.get_physical_interface_by_logical_interface_id(
        connection.first_logical_interface_id
    ).physical_name
    tcutils.remove_parameters(connection.connection_name, physical_interface_name)

wemulate.ext.utils.reset_device()

Deletes all parameters and connection in the database and on the host system.

Returns:

Type Description
None

None

Source code in wemulate/ext/utils/reset.py
def reset_device() -> None:
    """
    Deletes all parameters and connection in the database and on the host system.

    Returns:
        None
    """
    for connection in dbutils.get_connection_list():
        physical_interface_name = (
            dbutils.get_physical_interface_by_logical_interface_id(
                connection.first_logical_interface_id
            ).physical_name
        )
        tcutils.remove_parameters(connection.connection_name, physical_interface_name)
        tcutils.remove_connection(connection.connection_name)
    dbutils.reset_all_connections()

Setting and Configuration Interface

wemulate.ext.settings.get_interface_ip(interface)

Returns the ip address of an interface.

Parameters:

Name Type Description Default
interface str

Name of the interface.

required

Returns:

Type Description
Optional[str]

Returns the ip address as string.

Source code in wemulate/ext/settings/device.py
def get_interface_ip(interface: str) -> Optional[str]:
    """
    Returns the ip address of an interface.

    Args:
        interface: Name of the interface.

    Returns:
        Returns the ip address as string.
    """
    if netifaces.AF_INET in netifaces.ifaddresses(interface):
        return netifaces.ifaddresses(interface)[netifaces.AF_INET][0]["addr"]
    else:
        "N/A"

wemulate.ext.settings.get_interface_mac_address(interface)

Returns the mac address of an interface.

Parameters:

Name Type Description Default
interface str

Name of the interface.

required

Returns:

Type Description
str

Returns the mac address as string.

Source code in wemulate/ext/settings/device.py
def get_interface_mac_address(interface: str) -> str:
    """
    Returns the mac address of an interface.

    Args:
        interface: Name of the interface.

    Returns:
        Returns the mac address as string.
    """
    return netifaces.ifaddresses(interface)[netifaces.AF_LINK][0]["addr"]

wemulate.ext.settings.get_mgmt_interfaces()

Returns all management interfaces saved in the database.

Returns:

Type Description
List[str]

Returns the management interfaces as list of strings.

Source code in wemulate/ext/settings/device.py
def get_mgmt_interfaces() -> List[str]:
    """
    Returns all management interfaces saved in the database.

    Returns:
        Returns the management interfaces as list of strings.
    """
    return [
        mgmt_interface.interface_name
        for mgmt_interface in dbutils.get_mgmt_interfaces()
    ]

wemulate.ext.settings.get_all_interfaces_on_device()

Returns all interfaces on the device.

Returns:

Type Description
List[str]

Returns a list of interfaces.

Source code in wemulate/ext/settings/device.py
def get_all_interfaces_on_device() -> List[str]:
    """
    Returns all interfaces on the device.

    Returns:
        Returns a list of interfaces.
    """
    return [name for name in netifaces.interfaces() if name.startswith(("eth", "en"))]

wemulate.ext.settings.add_mgmt_interface(interface_name)

Adds an interface as management interfaces.

Parameters:

Name Type Description Default
interface_name str

Name of the interface

required

Returns:

Type Description
None

None

Source code in wemulate/ext/settings/device.py
def add_mgmt_interface(interface_name: str) -> None:
    """
    Adds an interface as management interfaces.

    Args:
        interface_name: Name of the interface

    Returns:
        None
    """
    if check_if_interface_present_on_device(interface_name):
        dbutils.create_mgmt_interface(interface_name)
    else:
        raise WemulateMgmtInterfaceError(interface_name)

wemulate.ext.settings.get_non_mgmt_interfaces()

Returns all interfaces which usable to connect different devices (all non-mgmt interfaces).

Returns:

Type Description
List[str]

Returns the interfaces as list of strings.

Source code in wemulate/ext/settings/device.py
def get_non_mgmt_interfaces() -> List[str]:
    """
    Returns all interfaces which usable to connect different devices (all non-mgmt interfaces).

    Returns:
        Returns the interfaces as list of strings.
    """
    return [
        interface_name
        for interface_name in get_all_interfaces_on_device()
        if interface_name not in get_mgmt_interfaces()
    ]

wemulate.ext.settings.check_if_mgmt_interface_set()

Source code in wemulate/ext/settings/device.py
def check_if_mgmt_interface_set() -> bool:
    if get_mgmt_interfaces():
        return True
    raise WEmulateExecutionError(
        "There is no management interface set in the config/database!"
    )

wemulate.ext.settings.get_db_location()

Returns the database path.

Returns:

Type Description
str

Returns the path to the database as string.

Source code in wemulate/ext/settings/config.py
def get_db_location() -> str:
    """
    Returns the database path.

    Returns:
        Returns the path to the database as string.
    """
    return WEMULATE_DATABASE_PATH

wemulate.ext.settings.check_if_interface_present_on_device(interface_name)

Source code in wemulate/ext/settings/device.py
def check_if_interface_present_on_device(interface_name: str) -> bool:
    return interface_name in get_all_interfaces_on_device()

Exceptions

wemulate.core.exc.WEmulateError

Bases: Exception

Generic errors.

Source code in wemulate/core/exc.py
1
2
3
4
class WEmulateError(Exception):
    """Generic errors."""

    pass

wemulate.core.exc.WEmulateValidationError

Bases: WEmulateError

Validation errors

Source code in wemulate/core/exc.py
class WEmulateValidationError(WEmulateError):
    """Validation errors"""

    def __init__(self, message="A validation error occured"):
        self.message = message
        super().__init__(self.message)

wemulate.core.exc.WEmulateExecutionError

Bases: WEmulateError

Execution errors

Source code in wemulate/core/exc.py
class WEmulateExecutionError(WEmulateError):
    """Execution errors"""

    def __init__(self, message="An unknown execution error occured"):
        self.message = message
        super().__init__(self.message)

wemulate.core.exc.WEmulateConfigNotFoundError

Bases: WEmulateError

Config file not found error

Source code in wemulate/core/exc.py
class WEmulateConfigNotFoundError(WEmulateError):
    """Config file not found error"""

    def __init__(self, message="No configuration file was found"):
        self.message = message
        super().__init__(self.message)

wemulate.core.exc.WEmulateFileError

Bases: WEmulateError

Error during writing/reading files

Source code in wemulate/core/exc.py
class WEmulateFileError(WEmulateError):
    """Error during writing/reading files"""

    def __init__(self, message: str):
        self.message = message
        super().__init__(self.message)

wemulate.core.exc.WEmulateDatabaseError

Bases: WEmulateError

Error during database operation

Source code in wemulate/core/exc.py
class WEmulateDatabaseError(WEmulateError):
    """Error during database operation"""

    def __init__(self, message: str):
        self.message = message
        super().__init__(self.message)

wemulate.core.exc.WemulateMgmtInterfaceError

Bases: WEmulateError

Management Interface not found error

Source code in wemulate/core/exc.py
class WemulateMgmtInterfaceError(WEmulateError):
    """Management Interface not found error"""

    def __init__(self, interface_name: str = "", message=""):
        if not message:
            if interface_name:
                self.message = f"The interface {interface_name} is not present on this device. Please provide a valid interface name"
            else:
                self.message = "There is no management interface configured. Please configure at least one with the wemulate config command before using other commands"
        super().__init__(self.message)