|
| 1 | +--- |
| 2 | +name: containerlab |
| 3 | +description: Deploy a containerlab network device. Defaults to a topology with Nokia SRL, Juniper vJunos-Evolved, and Cisco N9Kv. Pass a topology file path or image to override. |
| 4 | +argument-hint: [--topology <path>] [--image <image>] [--output <path>] |
| 5 | +allowed-tools: [Bash, Read, Write, AskUserQuestion] |
| 6 | +allowed-bash: ["containerlab *", "docker *", "gnmic *", "curl *"] |
| 7 | +--- |
| 8 | + |
| 9 | +# containerlab |
| 10 | + |
| 11 | +Deploys a containerlab network device topology. |
| 12 | + |
| 13 | +> **Scope limit:** Only `containerlab` (deploy/inspect/destroy) and `gnmic` (`capabilities` and `get`) may be used. Do not SSH into containerlab nodes, run `docker exec`, modify VM networking or Docker configuration, or make any other changes to the device environment — ask the user first. |
| 14 | +
|
| 15 | +## Arguments |
| 16 | + |
| 17 | +Parse `$ARGUMENTS` for: |
| 18 | +- `--topology <path>` → use this topology file instead of the default |
| 19 | +- `--image <image>` → override the device image in the default topology |
| 20 | +- `--output <path>` → write the generated topology file here (default: `/tmp/dev.clab.yml`) |
| 21 | + |
| 22 | +If no topology is provided, use the default topology defined below. |
| 23 | + |
| 24 | +## Deploy network device |
| 25 | + |
| 26 | +If the user provided `--topology <path>`, deploy that file directly: |
| 27 | + |
| 28 | +```bash |
| 29 | +containerlab deploy -d -t <path> |
| 30 | +``` |
| 31 | + |
| 32 | +Otherwise, write the default topology to `--output` (default: `/tmp/dev.clab.yml`), substituting `--image` if provided (default: `ghcr.io/nokia/srlinux:26.7.1`): |
| 33 | + |
| 34 | +```yaml |
| 35 | +name: dev-topology |
| 36 | + |
| 37 | +topology: |
| 38 | + nodes: |
| 39 | + vjunos: |
| 40 | + kind: juniper_vjunosevolved |
| 41 | + image: vrnetlab/juniper_vjunosevolved:26.2R1.7-EVO |
| 42 | + ports: |
| 43 | + - 8001:22 |
| 44 | + - 57401:57400 |
| 45 | + |
| 46 | + nokia_srl: |
| 47 | + kind: nokia_srlinux |
| 48 | + image: ghcr.io/nokia/srlinux:26.7.1 |
| 49 | + startup-config: |- |
| 50 | + system name host-name nokia |
| 51 | + system grpc-server mgmt yang-models openconfig |
| 52 | + ports: |
| 53 | + - 8002:22 |
| 54 | + - 57402:57400 |
| 55 | + |
| 56 | + cisco_nxos: |
| 57 | + kind: cisco_n9kv |
| 58 | + image: vrnetlab/cisco_n9kv:9300-10.6.3-lite |
| 59 | + env: |
| 60 | + QEMU_MEMORY: 6144 |
| 61 | + QEMU_SMP: 2 |
| 62 | + startup-config: | |
| 63 | + hostname cisco_nxos |
| 64 | + feature ospf |
| 65 | + feature openconfig |
| 66 | + feature grpc |
| 67 | + grpc use-vrf management |
| 68 | + no ip domain-lookup |
| 69 | + ports: |
| 70 | + - 8003:22 |
| 71 | + - 57403:50051 |
| 72 | + |
| 73 | + links: [] |
| 74 | +``` |
| 75 | +
|
| 76 | +Write it to `$OUTPUT_PATH`, then deploy: |
| 77 | + |
| 78 | +```bash |
| 79 | +containerlab deploy -d -t $OUTPUT_PATH |
| 80 | +``` |
| 81 | + |
| 82 | +If the container already exists: |
| 83 | + |
| 84 | +```bash |
| 85 | +containerlab deploy -d --reconfigure -t <topology-file> |
| 86 | +``` |
| 87 | + |
| 88 | +Wait for all nodes to be healthy (poll every 15s, up to 10 minutes) using `docker inspect` — more reliable than parsing `containerlab inspect` table output: |
| 89 | + |
| 90 | +```bash |
| 91 | +docker inspect --format '{{.Name}}: {{.State.Health.Status}}' <node1> <node2> ... |
| 92 | +``` |
| 93 | + |
| 94 | +Repeat until all vrnetlab nodes show `healthy`. Nokia SRL has no health check — it's ready when running. For vrnetlab-based nodes (Juniper, Cisco) this can take 8–15 minutes. |
| 95 | + |
| 96 | +Once healthy, write a gnmic config file at `$OUTPUT_DIR/gnmic-config.yaml` (where `$OUTPUT_DIR` is the directory of `$OUTPUT_PATH`) with all nodes from the topology. Use `127.0.0.1` with the forwarded port for each node. For Nokia SRL use `skip-verify: true`; for vrnetlab nodes omit it (plain gRPC). |
| 97 | + |
| 98 | +Default credentials, ports and TLS settings per node kind: |
| 99 | +- Nokia SRL: `admin / NokiaSrl1!`, forwarded port, `skip-verify: true` |
| 100 | +- Juniper vJunosEvolved: `admin / admin@123`, forwarded port, `insecure: true` (if the image has TLS configured, use `skip-verify: true` instead) |
| 101 | +- Cisco N9Kv: `admin / admin`, forwarded port, `skip-verify: true` |
| 102 | + |
| 103 | +Example for a topology with all three: |
| 104 | + |
| 105 | +```yaml |
| 106 | +timeout: 10s |
| 107 | +
|
| 108 | +targets: |
| 109 | + juniper: |
| 110 | + address: 127.0.0.1:57401 |
| 111 | + username: admin |
| 112 | + password: admin@123 |
| 113 | + insecure: true |
| 114 | +
|
| 115 | + srl: |
| 116 | + address: 127.0.0.1:57402 |
| 117 | + username: admin |
| 118 | + password: NokiaSrl1! |
| 119 | + skip-verify: true |
| 120 | +
|
| 121 | + nxos: |
| 122 | + address: 127.0.0.1:57403 |
| 123 | + username: admin |
| 124 | + password: admin |
| 125 | + skip-verify: true |
| 126 | +``` |
| 127 | + |
| 128 | +Then validate all nodes at once: |
| 129 | + |
| 130 | +```bash |
| 131 | +gnmic --config $OUTPUT_DIR/gnmic-config.yaml capabilities |
| 132 | +``` |
| 133 | + |
| 134 | +Show the supported encodings and YANG model count per node. If a node fails, show the error and note it may still be booting. |
| 135 | + |
| 136 | +## Summary |
| 137 | + |
| 138 | +Once all nodes are healthy, show the full topology state: |
| 139 | + |
| 140 | +```bash |
| 141 | +containerlab inspect -a |
| 142 | +``` |
| 143 | + |
| 144 | +Print a final summary: |
| 145 | +- Containerlab version |
| 146 | +- For each node: name, kind, management IP, gNMI endpoint, health state, gnmic capabilities result (encodings supported, YANG model count) |
| 147 | +- Next step: run `/netop` to test device |
| 148 | + |
| 149 | +## References |
| 150 | + |
| 151 | +- **containerlab**: https://containerlab.dev/cmd/ |
| 152 | +- **Nokia SRL containerlab kind**: https://containerlab.dev/manual/kinds/nokia_srlinux/ |
| 153 | +- **Juniper vJunos-Evolved containerlab kind**: https://containerlab.dev/manual/kinds/vjunos-evolved/ |
| 154 | +- **Cisco NX-OS containerlab kind**: https://containerlab.dev/manual/kinds/cisco_nxos/ |
0 commit comments