Documentation Index
Fetch the complete documentation index at: https://mintlify.com/markitobonito/cloud_repositorio/llms.txt
Use this file to discover all available pages before exploring further.
VLANManager operates exclusively on the network node (default 10.0.10.3) to configure Open vSwitch VLAN gateway ports, Linux network namespaces for DHCP, and iptables rules for internet access. All commands are executed via RemoteExecutor.execute_direct() over SSH.
Constructor
__init__(remote_executor, network_node_ip="10.0.10.3")
Used to run all commands on the network node.
IP address of the network node where OVS and iptables are managed.
Methods
create_vlan_with_gateway(vlan_id, cidr, gateway_ip, dhcp_enabled=True) → bool
Creates an OVS internal port tagged with vlan_id on br-int, assigns the gateway IP, and optionally configures a DHCP namespace.
VLAN tag to configure on the OVS port.
Network CIDR used to derive the subnet mask, e.g.
"192.168.101.0/24".IP address assigned to the gateway port, e.g.
"192.168.101.1".When
True, calls _setup_dhcp() after the gateway port is created.True when the gateway port is up and (if requested) DHCP is confirmed running. Returns False on any SSH or OVS error.
_setup_dhcp(vlan_id, cidr, gateway_ip) → bool
Internal method that creates a dnsmasq DHCP server inside a dedicated Linux network namespace. Documented here for operators who need to understand or debug the DHCP setup.
VLAN to configure DHCP for.
Network CIDR, e.g.
"192.168.101.0/24". Used to derive the DHCP server IP ({base}.2) and lease range ({base}.10–{base}.250).Passed to dnsmasq as DHCP option 3 (router).
Create namespace
sudo ip netns add ns-dhcp-vlan{vlan_id} — errors are suppressed if the namespace already exists.Create OVS DHCP port
sudo ovs-vsctl --may-exist add-port br-int dhcp_v{vlan_id} tag={vlan_id} -- set interface dhcp_v{vlan_id} type=internalAssign IP inside namespace
Assigns
{base}.2/{mask} to dhcp_v{vlan_id} and brings up both the port and loopback inside the namespace.True when dnsmasq is confirmed running, False otherwise.
enable_internet_for_vlan(vlan_id, cidr, outgoing_iface="ens3") → bool
Enables IP forwarding and adds iptables MASQUERADE rules so VMs on the given VLAN can reach the internet through the network node.
VLAN whose traffic should be NATed.
Source CIDR for the MASQUERADE rule, e.g.
"10.60.7.0/24".Outgoing interface on the network node that connects to the upstream network.
True on success, False on SSH error or exception.
delete_vlan(vlan_id) → bool
Tears down all resources associated with a VLAN: kills dnsmasq, deletes the namespace, and removes both OVS ports.
VLAN to remove.
True on success, False on SSH error or exception.