Skip to content

Commit

Permalink
Add support for vJunosEvolved 24.2 and up (#322)
Browse files Browse the repository at this point in the history
* vjunosevolved: Add support for versions 24.1 and up, add OVMF to vrnetlab base image

* vjunosevolved: Minor semantic fixes
  • Loading branch information
vista- authored Feb 5, 2025
1 parent ff08aa6 commit f2ee1ab
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
2 changes: 2 additions & 0 deletions vjunosevolved/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This is the vrnetlab docker image for Juniper's vJunosEvolved.

> Available with [containerlab](https://containerlab.dev) as juniper_vjunosevolved.
There are two variants of vJunosEvolved: the default variant, modelling a Juniper BT chipset, and starting with JunosEvo 24.2, a BX variant, modelling a chassis with two Juniper BX chipsets in it.

## Building the docker image

Download the vJunosEvolved .qcow2 image from <https://www.juniper.net/us/en/dm/vjunos-labs.html>
Expand Down
22 changes: 1 addition & 21 deletions vjunosevolved/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
FROM public.ecr.aws/docker/library/debian:bookworm-slim
FROM ghcr.io/srl-labs/vrnetlab-base:0.2.1
LABEL org.opencontainers.image.authors="roman@dodin.dev,vista@birb.network"

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -qy \
&& apt-get install --no-install-recommends -y \
dosfstools \
bridge-utils \
iproute2 \
python3 \
python3-passlib \
socat \
ssh \
qemu-kvm \
qemu-utils \
inetutils-ping \
dnsutils \
telnet \
&& rm -rf /var/lib/apt/lists/*

ARG IMAGE
COPY $IMAGE* /

Expand All @@ -30,5 +12,3 @@ COPY make-config.sh /
COPY *.py /

EXPOSE 22 161/udp 830 5000 10000-10099 57400
HEALTHCHECK CMD ["/healthcheck.py"]
ENTRYPOINT ["/launch.py"]
23 changes: 20 additions & 3 deletions vjunosevolved/docker/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,25 @@ def __init__(self, hostname, username, password, conn_mode):
self.smbios = [
"type=0,vendor=Bochs,version=Bochs",
"type=3,manufacturer=Bochs",
"type=1,manufacturer=Bochs,product=Bochs,serial=chassis_no=0:slot=0:type=1:assembly_id=0x0D20:platform=251:master=0:channelized=no",
]

# BT chipset
evo_model_smbios = "type=1,manufacturer=Bochs,product=Bochs,serial=chassis_no=0:slot=0:type=1:assembly_id=0x0D20:platform=251:master=0:channelized=no"
if "BX" in disk_image:
# BX chipset
evo_model_smbios = "type=1,manufacturer=Bochs,product=Bochs,serial=chassis_no=0:slot=0:type=1:assembly_id=0x0DA9:platform=272:master=0:channelized=no"
self.smbios.append(evo_model_smbios)

junos_version = str(re.search(r"(\d{2}\.\d{1})R\d{1}", disk_image).group(1))
try:
parsed_junos_version = float(junos_version)
except ValueError as e:
self.logger.error(f"Could not parse Junos version from filename {disk_image}! Expecting '12.3R4' style versioning to be present: {e}")

if parsed_junos_version is not None and parsed_junos_version >= 24.2:
# vJunosEvolved 24.2R1 and up require UEFI
self.qemu_args.extend(["-bios", "/usr/share/qemu/OVMF.fd"])

self.conn_mode = conn_mode

def startup_config(self):
Expand Down Expand Up @@ -150,7 +167,7 @@ def bootstrap_spin(self):

# Login
self.wait_write("\r", None)
self.wait_write("admin", wait="login:")
self.wait_write("admin", wait=f"{self.hostname} login:")
self.wait_write(self.password, wait="Password:")
self.wait_write("\r", None)
self.logger.info("Login completed")
Expand All @@ -167,7 +184,7 @@ def bootstrap_spin(self):
# no match, if we saw some output from the router it's probably
# booting, so let's give it some more time
if res != b"":
self.logger.trace("OUTPUT: %s" % res.decode())
self.logger.trace("OUTPUT: %s" % res.decode('utf-8', errors="ignore"))
# reset spins if we saw some output
self.spins = 0

Expand Down
1 change: 1 addition & 0 deletions vrnetlab-base.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ RUN apt-get update -qy \
git \
dosfstools \
genisoimage \
ovmf \
&& rm -rf /var/lib/apt/lists/*

# copying the uv project
Expand Down

0 comments on commit f2ee1ab

Please sign in to comment.