avocado_i2n.vmnet.tunnel module¶
Tunnel object for the vmnet utility.
SUMMARY¶
Copyright: Intra2net AG
CONTENTS¶
This class wraps up the utilities for managing tunnels.
The parameters parsed at each vm are used as overwrite dictionary and and missing ones are generated for the full configuration of the tunnel.
INTERFACE¶
- class avocado_i2n.vmnet.tunnel.VMTunnel(name: str, node1: VMNode, node2: VMNode, local1: dict[str, str] = None, remote1: dict[str, str] = None, peer1: dict[str, str] = None, auth: dict[str, str] = None)[source]¶
Bases:
objectGet the tunnel class.
- property left_iface: VMInterface | None¶
Get a reference to the left interface of the tunnel.
- property right_iface: VMInterface | None¶
Get a reference to the right interface of the tunnel.
- property left_net: VMNetconfig | None¶
Get a reference to the left netconfig of the tunnel.
- property right_net: VMNetconfig | None¶
Get a reference to the right netconfig of the tunnel.
- property left_params: Params¶
Tunnel generated left side parameters.
- property right_params: Params¶
Tunnel generated right side parameters.
- property params: Params¶
Tunnel generated test parameters.
- property name: str | None¶
Name for the connection.
- connects_nodes(node1: VMNode, node2: VMNode) bool[source]¶
Check whether a tunnel connects two vm nodes.
The vm nodes can be connected directly as tunnel peers or indirectly in tunnel connected LANs (netconfigs).
- Parameters:
node1 – one side vm of the tunnel
node2 – another side vm of the tunnel
- Returns:
whether the tunnel connects the two nodes
- configure_between_endpoints(apply_extra_options: dict[str, Any] = None) None[source]¶
Build a tunnel between two endpoint vms.
- Parameters:
apply_extra_options – extra switches to apply as key exchange, firewall ruleset, etc.
- configure_on_endpoint(node: VMNode, apply_extra_options: dict[str, Any] = None) None[source]¶
Configure a tunnel on an end point virtual machine.
- Parameters:
node – node end point where the tunnel will be configured
apply_extra_options – extra switches to apply as key exchange, firewall ruleset, etc.
- Raises:
ValueErrorif some of the supplied configuration is not valid
The provided virtual machine parameters will be used for configuration of the tunnel.
The tunnel name can be used to also reconfigure an existing tunnel.
- import_key_params(from_node: VMNode, to_node: VMNode) None[source]¶
Generate own key configuration at the source vm and foreign key configuration at the destination vm.
- Parameters:
from_node – source node to get the key from (and generate own key configuration on it containing all relevant key information)
to_node – destination node to import the key to (and generate foreign key configuration on it containing all relevant key information)