Skip to content

Commit 4cbb252

Browse files
michelredondovista-Arthur-K-99kaelemchellt
committed
nokia_sros: Add pass-through management interface support (#272)
* vrnetlab: Add pass-through management interfaces * vjunos: Add pass-through management interface support * vrnetlab: Use JSON output of iproute2 * vrnetlab: Add exception for serial console ports 5000-5007 for transparent mode mgmt interface * vrnetlab: Remove non-working port 5000 tc mirred exception, redirect to correct interface * vrnetlab: Use tc clsact qdisc and flower matching as best practice * vrnetlab: Re-add workaround for serial ports in transparent mgmt mode * vrnetlab: Add IPv6 support to management address/gw functions * vjunos: Add IPv6 management addresses, fix v4 address templating * vrnetlab: Set dummy IPv6 address/gw for hostfwd management * Fix CSR1000v and c8000v (#269) * Remove whitespaces from IMG_NAME and IMG_VENDOR * Fix Cisco CSR1000v * Fix Cisco c8000v * Use env var passed from containerlab for IOL launch PID (#270) * nokia_sros: Add pass-through management interface support * fix comment * change mgmt address parsing * added self.mgmt_nic_passthrough to VR and VM classes * remove copy of a healthcheck * formatting * added mgmt passthrough to the VR class and aligned SR OS * added v6 address to bof --------- Co-authored-by: vista <[email protected]> Co-authored-by: Athanasios Kompouras <[email protected]> Co-authored-by: Kaelem <[email protected]> Co-authored-by: Roman Dodin <[email protected]>
1 parent 3647df6 commit 4cbb252

File tree

3 files changed

+349
-134
lines changed

3 files changed

+349
-134
lines changed

common/vrnetlab.py

+21-8
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def __init__(
9999
self._cpu = cpu
100100
self._smp = smp
101101

102-
# various settings
102+
# various settings
103103
self.uuid = None
104104
self.fake_start_date = None
105105
self.nic_type = "e1000"
@@ -110,14 +110,18 @@ def __init__(
110110
# to have them allocated sequential from eth1
111111
self.highest_provisioned_nic_num = 0
112112

113-
# Whether the management interface is pass-through or host-forwarded
114-
self.mgmt_nic_passthrough = mgmt_passthrough
113+
# Whether the management interface is pass-through or host-forwarded.
114+
# Host-forwarded is the original vrnetlab mode where a VM gets a static IP for its management address,
115+
# which **does not** match the eth0 interface of a container.
116+
# In pass-through mode the VM container uses the same IP as the container's eth0 interface and transparently forwards traffic between the two interfaces.
117+
# See https://github.com/hellt/vrnetlab/issues/286
118+
self.mgmt_passthrough = mgmt_passthrough
115119
mgmt_passthrough_override = os.environ.get("CLAB_MGMT_PASSTHROUGH", "")
116120
if mgmt_passthrough_override:
117-
self.mgmt_nic_passthrough = mgmt_passthrough_override.lower() == "true"
121+
self.mgmt_passthrough = mgmt_passthrough_override.lower() == "true"
118122

119123
# Populate management IP and gateway
120-
if self.mgmt_nic_passthrough:
124+
if self.mgmt_passthrough:
121125
self.mgmt_address_ipv4, self.mgmt_address_ipv6 = self.get_mgmt_address()
122126
self.mgmt_gw_ipv4, self.mgmt_gw_ipv6 = self.get_mgmt_gw()
123127
else:
@@ -394,7 +398,7 @@ def gen_mgmt(self):
394398
res.append(self.nic_type + f",netdev=p00,mac={self.mgmt_mac}")
395399
res.append("-netdev")
396400

397-
if self.mgmt_nic_passthrough:
401+
if self.mgmt_passthrough:
398402
# mgmt interface is passthrough - we just create a normal mirred tap interface
399403
res.append(
400404
"tap,id=p00,ifname=tap0,script=/etc/tc-tap-mgmt-ifup,downscript=no"
@@ -425,7 +429,6 @@ def get_mgmt_address(self):
425429
stdout, _ = run_command(["ip", "--json", "address", "show", "dev", "eth0"])
426430
command_json = json.loads(stdout.decode("utf-8"))
427431
intf_addrinfos = command_json[0]["addr_info"]
428-
429432
mgmt_cidr_v4 = None
430433
mgmt_cidr_v6 = None
431434
for addrinfo in intf_addrinfos:
@@ -777,9 +780,19 @@ def qemu_additional_args(self):
777780

778781

779782
class VR:
780-
def __init__(self, username, password):
783+
def __init__(self, username, password, mgmt_passthrough: bool = False):
781784
self.logger = logging.getLogger()
782785

786+
# Whether the management interface is pass-through or host-forwarded.
787+
# Host-forwarded is the original vrnetlab mode where a VM gets a static IP for its management address,
788+
# which **does not** match the eth0 interface of a container.
789+
# In pass-through mode the VM container uses the same IP as the container's eth0 interface and transparently forwards traffic between the two interfaces.
790+
# See https://github.com/hellt/vrnetlab/issues/286
791+
self.mgmt_passthrough = mgmt_passthrough
792+
mgmt_passthrough_override = os.environ.get("CLAB_MGMT_PASSTHROUGH", "")
793+
if mgmt_passthrough_override:
794+
self.mgmt_passthrough = mgmt_passthrough_override.lower() == "true"
795+
783796
try:
784797
os.mkdir("/tftpboot")
785798
except:

sros/docker/healthcheck.py

-18
This file was deleted.

0 commit comments

Comments
 (0)