Skip to content

Commit

Permalink
added dell sonic transparent mgmt (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt authored Dec 8, 2024
1 parent 7ff8969 commit 75a64be
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
6 changes: 3 additions & 3 deletions c8000v/docker/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def bootstrap_spin(self):
def bootstrap_config(self):
"""Do the actual bootstrap config"""
self.logger.info("applying bootstrap configuration")

v4_mgmt_address = vrnetlab.cidr_to_ddn(self.mgmt_address_ipv4)

self.wait_write("", None)
Expand All @@ -166,9 +166,9 @@ def bootstrap_config(self):
else:
self.wait_write("ip domain-name example.com")
self.wait_write("crypto key generate rsa modulus 2048")

self.wait_write("ipv6 unicast-routing")

self.wait_write("vrf definition clab-mgmt")
self.wait_write("description Containerlab management VRF (DO NOT DELETE)")
self.wait_write("address-family ipv4")
Expand Down
15 changes: 8 additions & 7 deletions common/vrnetlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,16 +838,17 @@ def get_digits(input_str: str) -> int:
non_string_chars = re.findall(r"\d", input_str)
return int("".join(non_string_chars))


def cidr_to_ddn(prefix: str) -> list[str]:
"""
Convert a IPv4 CIDR notation prefix to address + mask in DDN notation
Returns a list of IP address (str) and mask (str) in dotted decimal
Example:
get_ddn_mask('192.168.0.1/24')
Returns a list of IP address (str) and mask (str) in dotted decimal
Example:
get_ddn_mask('192.168.0.1/24')
returns ['192.168.0.1' ,'255.255.255.0']
"""

network = ipaddress.IPv4Interface(prefix)
return [str(network.ip), str(network.netmask)]
return [str(network.ip), str(network.netmask)]
9 changes: 5 additions & 4 deletions dell_sonic/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
VENDOR=Sonic
NAME=dell_sonic
VENDOR=Dell
NAME=sonic
IMAGE_FORMAT=qcow
IMAGE_GLOB=*.qcow2

# match versions like:
# 4.2.1
# rename the disk image file as dell-sonic-<version>.qcow2
# examples:
# for a file named "dell-sonic-4.2.1.qcow2" the image will be named "vrnetlab/dell_sonic:4.2.1"
VERSION=$(shell echo $(IMAGE) | sed -e 's/dell-sonic-//' | sed -e 's/.qcow2//')

-include ../makefile-sanity.include
Expand Down
9 changes: 8 additions & 1 deletion dell_sonic/docker/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,14 @@ def bootstrap_config(self):
"""Do the actual bootstrap config"""
self.logger.info("applying bootstrap configuration")
self.wait_write("sudo -i", "$")
self.wait_write("/usr/sbin/ip address add 10.0.0.15/24 dev eth0", "#")
# set ipv4/6 address to the management interface
self.wait_write(
f"sudo /usr/sbin/ip address add {self.mgmt_address_ipv4} dev eth0", "#"
)
# note, v6 address is not being applied for whatever reason
self.wait_write(
f"sudo /usr/sbin/ip -6 address add {self.mgmt_address_ipv6} dev eth0", "#"
)
self.wait_write("passwd -q %s" % (self.username))
self.wait_write(self.password, "New password:")
self.wait_write(self.password, "password:")
Expand Down

0 comments on commit 75a64be

Please sign in to comment.