Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/lab/topology.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ topology:
nodes:
- name: dc1-spine1
type: ceos
image: localhost:5001/netclab/ceos:4.36.1F
image: ceos:4.36.1F
memory: 2Gi
cpu: 1000m
interfaces:
- name: eth1
network: b1
- name: dc1-leaf1a
type: ceos
image: localhost:5001/netclab/ceos:4.36.1F
image: ceos:4.36.1F
memory: 2Gi
cpu: 1000m
interfaces:
Expand Down
12 changes: 11 additions & 1 deletion function/netclab_topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,17 @@
# the readable link written alongside as a comment.
MAX_IFNAME = 15

CEOS_IMAGE = "localhost:5001/netclab/ceos:4.36.1F"
# No registry, deliberately. The generated topology is committed and fetched at
# a tag by other repositories, so it is read far more often than it is run here
# -- and a machine-local registry address in a published artifact is wrong for
# everyone but the machine that has it. `docker import` + `kind load` names the
# image exactly this way, which is what a reader following netclab-xp's
# documentation ends up with.
#
# Bring-up scripts that do serve cEOS from a registry rewrite this: it is one
# line against a temp copy, and local specifics belong in a script rather than
# in something published. See `scripts/kind-up.sh`.
CEOS_IMAGE = "ceos:4.36.1F"
CEOS_MEMORY = "2Gi"
CEOS_CPU = "1000m"

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "function-avd"
version = "0.1.5"
version = "0.1.6"
description = "Living AVD model driven by Crossplane XRs (Fabric -> Device composite function)"
readme = "README.md"
authors = [
Expand Down
23 changes: 18 additions & 5 deletions scripts/kind-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,21 @@ EOF
else
echo ">> lab topology regenerated for ${LAB_HOSTS}"
TOPO="$(mktemp -t netclab-topology.XXXXXX.yaml)"
trap 'rm -f "$TOPO"' EXIT
TOPO_REGENERATED="$TOPO"
uv run avd-topology "$LAB_FABRIC" --hosts "$LAB_HOSTS" > "$TOPO"
fi

# The topology names the image without a registry -- the name `docker import`
# plus `kind load` leaves, and the one a reader of netclab-xp's documentation
# ends up with. This lab serves cEOS from the local registry instead, because
# that survives teardown. The EOS version still comes from the topology: it is
# generated from the AVD model, so the model decides which image the lab runs.
CEOS_TAG="$(awk '/image:/ {print $2; exit}' "$TOPO")"; CEOS_TAG="${CEOS_TAG##*:}"
CEOS_REPO=${CEOS_REPO:-netclab/ceos}
CEOS_IMG="localhost:${REG_PORT}/${CEOS_REPO}:${CEOS_TAG}"

# cEOS cannot be pulled: it is licensed and needs an Arista login. Fail here
# with the tag the topology asks for, rather than as an ImagePullBackOff later.
CEOS_IMG="$(awk '/image:/ {print $2; exit}' "$TOPO")"
CEOS_REPO="${CEOS_IMG#*/}"; CEOS_REPO="${CEOS_REPO%:*}"
CEOS_TAG="${CEOS_IMG##*:}"
if ! curl -sf "http://localhost:${REG_PORT}/v2/${CEOS_REPO}/tags/list" \
| grep -q "\"${CEOS_TAG}\""; then
echo "!! ${CEOS_IMG} is not in the local registry."
Expand All @@ -208,9 +214,16 @@ EOF
exit 1
fi

# Rewrite a copy, never the committed file: it is an artifact other
# repositories fetch at a tag, and `test_topology_golden` compares it to what
# the generator produces.
TOPO_LOCAL="$(mktemp -t netclab-topology-local.XXXXXX.yaml)"
trap 'rm -f "$TOPO_LOCAL" "${TOPO_REGENERATED:-}"' EXIT
sed "s|^\( *image: \).*|\1${CEOS_IMG}|" "$TOPO" > "$TOPO_LOCAL"

echo ">> netclab-chart ${NETCLAB_CHART}"
helm upgrade --install avd netclab/netclab --version "${NETCLAB_CHART}" \
--kube-context "$CTX" -n default -f "$TOPO" >/dev/null
--kube-context "$CTX" -n default -f "$TOPO_LOCAL" >/dev/null
fi

echo
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.