Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: srl-labs/containerlab
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.9.2
Choose a base ref
...
head repository: srl-labs/containerlab
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing 791 changed files with 98,613 additions and 10,585 deletions.
10 changes: 10 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version = 1

test_patterns = ["*/*_test.go"]

[[analyzers]]
name = "go"
enabled = true

[analyzers.meta]
import_root = "github.com/srl-labs/containerlab"
69 changes: 69 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
FROM mcr.microsoft.com/devcontainers/python:3.11-bookworm

ARG CLAB_VERSION

# Add the netdevops repository
RUN echo "deb [trusted=yes] https://netdevops.fury.site/apt/ /" | \
tee -a /etc/apt/sources.list.d/netdevops.list

# Install necessary packages, including curl
RUN apt-get update && apt-get install -y --no-install-recommends \
direnv \
btop \
iputils-ping \
tcpdump \
iproute2 \
qemu-kvm \
dnsutils \
telnet \
curl

# Install Containerlab
RUN bash -c "$(curl -sL https://get.containerlab.dev)" -- -v ${CLAB_VERSION}

# Install GitHub CLI directly from the latest release
RUN bash -c 'ARCH=$(uname -m | sed "s/x86_64/amd64/" | sed "s/aarch64/arm64/") && \
VERSION=$(curl -s https://api.github.com/repos/cli/cli/releases/latest | \
grep -oP "\"tag_name\": \"\K[^\"]+") && \
CLEAN_VERSION=${VERSION#v} && \
DOWNLOAD_URL="https://github.com/cli/cli/releases/download/${VERSION}/gh_${CLEAN_VERSION}_linux_${ARCH}.tar.gz" && \
curl -L "$DOWNLOAD_URL" | tar xz -C /tmp && \
mv /tmp/gh_${CLEAN_VERSION}_linux_${ARCH}/bin/gh /usr/local/bin/ && \
chmod +x /usr/local/bin/gh && \
rm -rf /tmp/gh_${CLEAN_VERSION}_linux_${ARCH}'

# Install gNMIc and gNOIc
RUN bash -c "$(curl -sL https://get-gnmic.openconfig.net)" && \
bash -c "$(curl -sL https://get-gnoic.kmrd.dev)"

# Add empty docker config files to avoid clab warnings for root user
RUN mkdir -p /root/.docker && echo "{}" > /root/.docker/config.json

# Maintain SSH_AUTH_SOCK env var when using sudo
RUN mkdir -p /etc/sudoers.d && echo 'Defaults env_keep += "SSH_AUTH_SOCK"' > /etc/sudoers.d/ssh_auth_sock

# Add vscode user to clab_admins group so that it can run sudo-less clab commands
# the group is created when clab is installed via the installation script
RUN usermod -aG clab_admins vscode

# Switch to the vscode user provided by the base image
USER vscode

# Copy dclab script used to run the local containerlab build after `make build`
COPY ./.devcontainer/dclab /usr/local/bin/dclab

# Create SSH key for vscode user to enable passwordless SSH to devices
RUN ssh-keygen -t ecdsa -b 256 -N "" -f ~/.ssh/id_ecdsa

# Install uv
COPY --from=ghcr.io/astral-sh/uv:0.6.2 /uv /uvx /bin/

# Add empty docker config files to avoid clab warnings for vscode user
RUN mkdir -p /home/vscode/.docker && echo "{}" > /home/vscode/.docker/config.json

# Setup Zsh and plugins
COPY ./.devcontainer/zsh/.zshrc /home/vscode/.zshrc
COPY ./.devcontainer/zsh/.p10k.zsh /home/vscode/.p10k.zsh
COPY ./.devcontainer/zsh/install-zsh-plugins.sh /tmp/install-zsh-plugins.sh
COPY ./.devcontainer/zsh/install-tools-completions.sh /tmp/install-tools-completions.sh
RUN bash -c "/tmp/install-zsh-plugins.sh && /tmp/install-tools-completions.sh"
2 changes: 2 additions & 0 deletions .devcontainer/dclab
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
/clab/bin/containerlab "$@"
63 changes: 63 additions & 0 deletions .devcontainer/docker-in-docker/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// For format details, see https://aka.ms/devcontainer.json.
{
"build": {
"dockerfile": "../Dockerfile",
"context": "../..",
"args": {
"CLAB_VERSION": "${localEnv:CLAB_VERSION}"
}
},
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
// docker/moby version is that old because newer ones failed to install under emulation
// see https://github.com/moby/moby/issues/48987#issuecomment-2507267417
// and https://github.com/moby/moby/issues/47895#issuecomment-2507528678
"version": "26.1.5",
"dockerDashComposeVersion": "none",
"installDockerComposeSwitch": "false"
},
// Add sshd to support gh cli codespace cp.
"ghcr.io/devcontainers/features/sshd:1": {
"version": "latest"
},
"ghcr.io/devcontainers/features/go:1": {
"version": "1.22"
}
},
"remoteUser": "vscode",
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/bin/zsh"
}
},
"terminal.integrated.fontFamily": "FiraCode Nerd Font, Menlo, Monaco, Cascadia Code, Consolas, Courier New, monospace"
},
"extensions": [
// go
"golang.go",
"mhutchie.git-graph",
"ms-azuretools.vscode-docker",
// Python.
"ms-python.python",
"ms-python.vscode-pylance",
// Errors and highlighters.
"mechatroner.rainbow-csv",
"redhat.vscode-yaml",
"jinliming2.vscode-go-template",
// markdown
"yzhang.markdown-all-in-one",
"davidanson.vscode-markdownlint",
// proto
"zxh404.vscode-proto3",
// containerlab
"srl-labs.vscode-containerlab"
]
}
},
"workspaceMount": "source=${localWorkspaceFolder},target=/${containerWorkspaceFolder},type=bind,consistency=cached",
"workspaceFolder": "/clab"
}
50 changes: 50 additions & 0 deletions .devcontainer/docker-in-docker_slim/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// For format details, see https://aka.ms/devcontainer.json.
{
"build": {
"dockerfile": "../slim.Dockerfile",
"context": "../..",
"args": {
"CLAB_VERSION": "${localEnv:CLAB_VERSION}"
}
},
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "26.1.5",
"dockerDashComposeVersion": "none",
"installDockerComposeSwitch": "false"
},
// Add sshd to support gh cli codespace cp.
"ghcr.io/devcontainers/features/sshd:1": {
"version": "latest"
}
},
"remoteUser": "vscode",
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/bin/zsh"
}
},
"terminal.integrated.fontFamily": "FiraCode Nerd Font, Menlo, Monaco, Cascadia Code, Consolas, Courier New, monospace"
},
"extensions": [
"ms-azuretools.vscode-docker",
// Python.
"ms-python.python",
// Errors and highlighters.
"mechatroner.rainbow-csv",
"redhat.vscode-yaml",
// markdown
"yzhang.markdown-all-in-one",
"davidanson.vscode-markdownlint",
// containerlab
"srl-labs.vscode-containerlab"
]
}
},
"workspaceMount": "source=${localWorkspaceFolder},target=/${containerWorkspaceFolder},type=bind,consistency=cached",
"workspaceFolder": "/clab"
}
69 changes: 69 additions & 0 deletions .devcontainer/docker-outside-of-docker/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// For format details, see https://aka.ms/devcontainer.json.
{
"build": {
"dockerfile": "../Dockerfile",
"context": "../..",
"args": {
"CLAB_VERSION": "${localEnv:CLAB_VERSION}"
}
},
"runArgs": [
"--network=host",
"--pid=host",
"--privileged"
],
"mounts": [
"type=bind,src=/var/lib/docker,dst=/var/lib/docker",
"type=bind,src=/lib/modules,dst=/lib/modules"
],
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
"version": "26.1.5",
"dockerDashComposeVersion": "none",
"installDockerComposeSwitch": "false"
},
// Add sshd to support gh cli codespaces cp.
"ghcr.io/devcontainers/features/sshd:1": {
"version": "latest"
},
"ghcr.io/devcontainers/features/go:1": {
"version": "1.22"
}
},
"remoteUser": "vscode",
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/bin/zsh"
}
},
"terminal.integrated.fontFamily": "FiraCode Nerd Font, Menlo, Monaco, Cascadia Code, Consolas, Courier New, monospace"
},
"extensions": [
// go
"golang.go",
"mhutchie.git-graph",
"ms-azuretools.vscode-docker",
// Python.
"ms-python.python",
"ms-python.vscode-pylance",
// Errors and highlighters.
"mechatroner.rainbow-csv",
"redhat.vscode-yaml",
"jinliming2.vscode-go-template",
// markdown
"yzhang.markdown-all-in-one",
"davidanson.vscode-markdownlint",
// proto
"zxh404.vscode-proto3",
// containerlab
"srl-labs.vscode-containerlab"
]
}
},
"workspaceFolder": "${localWorkspaceFolder}",
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind,consistency=cached"
}
59 changes: 59 additions & 0 deletions .devcontainer/docker-outside-of-docker_slim/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// For format details, see https://aka.ms/devcontainer.json.
{
"build": {
"dockerfile": "../slim.Dockerfile",
"context": "../..",
"args": {
"CLAB_VERSION": "${localEnv:CLAB_VERSION}"
}
},
"runArgs": [
"--network=host",
"--pid=host",
"--privileged"
],
"mounts": [
"type=bind,src=/var/lib/docker,dst=/var/lib/docker",
"type=bind,src=/lib/modules,dst=/lib/modules"
],
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
"version": "26.1.5",
"dockerDashComposeVersion": "none",
"installDockerComposeSwitch": "false"
},
// Add sshd to support gh cli codespaces cp.
"ghcr.io/devcontainers/features/sshd:1": {
"version": "latest"
}
},
"remoteUser": "vscode",
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/bin/zsh"
}
},
"terminal.integrated.fontFamily": "FiraCode Nerd Font, Menlo, Monaco, Cascadia Code, Consolas, Courier New, monospace"
},
"extensions": [
"ms-azuretools.vscode-docker",
// Python.
"ms-python.python",
// Errors and highlighters.
"mechatroner.rainbow-csv",
"redhat.vscode-yaml",
// markdown
"yzhang.markdown-all-in-one",
"davidanson.vscode-markdownlint",
// containerlab
"srl-labs.vscode-containerlab"
]
}
},
"workspaceFolder": "${localWorkspaceFolder}",
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind,consistency=cached"
}
61 changes: 61 additions & 0 deletions .devcontainer/slim.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
FROM mcr.microsoft.com/devcontainers/python:3.11-bookworm

ARG CLAB_VERSION

# Add the netdevops repository
RUN echo "deb [trusted=yes] https://netdevops.fury.site/apt/ /" | \
tee -a /etc/apt/sources.list.d/netdevops.list

# Install necessary packages, including curl
RUN apt-get update && apt-get install -y --no-install-recommends \
direnv \
btop \
iputils-ping \
tcpdump \
iproute2 \
qemu-kvm \
dnsutils \
telnet \
curl

# Install Containerlab
RUN bash -c "$(curl -sL https://get.containerlab.dev)" -- -v ${CLAB_VERSION}

# Install GitHub CLI directly from the latest release
RUN bash -c 'ARCH=$(uname -m | sed "s/x86_64/amd64/" | sed "s/aarch64/arm64/") && \
VERSION=$(curl -s https://api.github.com/repos/cli/cli/releases/latest | \
grep -oP "\"tag_name\": \"\K[^\"]+") && \
CLEAN_VERSION=${VERSION#v} && \
DOWNLOAD_URL="https://github.com/cli/cli/releases/download/${VERSION}/gh_${CLEAN_VERSION}_linux_${ARCH}.tar.gz" && \
curl -L "$DOWNLOAD_URL" | tar xz -C /tmp && \
mv /tmp/gh_${CLEAN_VERSION}_linux_${ARCH}/bin/gh /usr/local/bin/ && \
chmod +x /usr/local/bin/gh && \
rm -rf /tmp/gh_${CLEAN_VERSION}_linux_${ARCH}'

# Add empty docker config files to avoid clab warnings for root user
RUN mkdir -p /root/.docker && echo "{}" > /root/.docker/config.json

# Maintain SSH_AUTH_SOCK env var when using sudo
RUN mkdir -p /etc/sudoers.d && echo 'Defaults env_keep += "SSH_AUTH_SOCK"' > /etc/sudoers.d/ssh_auth_sock

# Add vscode user to clab_admins group so that it can run sudo-less clab commands
# the group is created when clab is installed via the installation script
RUN usermod -aG clab_admins vscode

# Switch to the vscode user provided by the base image
USER vscode

# Copy dclab script used to run the local containerlab build after `make build`
COPY ./.devcontainer/dclab /usr/local/bin/dclab

# Create SSH key for vscode user to enable passwordless SSH to devices
RUN ssh-keygen -t ecdsa -b 256 -N "" -f ~/.ssh/id_ecdsa

# Add empty docker config files to avoid clab warnings for vscode user
RUN mkdir -p /home/vscode/.docker && echo "{}" > /home/vscode/.docker/config.json

# Setup Zsh and plugins
COPY ./.devcontainer/zsh/.zshrc-slim /home/vscode/.zshrc
COPY ./.devcontainer/zsh/.p10k.zsh /home/vscode/.p10k.zsh
COPY ./.devcontainer/zsh/install-zsh-plugins.sh /tmp/install-zsh-plugins.sh
RUN bash -c "/tmp/install-zsh-plugins.sh"
Loading