Skip to content

Commit fbf8019

Browse files
committed
refer `AGENTS.md, drop VM from skill, drop deploy-dev
Signed-off-by: Robert Gildein <rgildein@users.noreply.github.com>
1 parent 3a3c6a2 commit fbf8019

5 files changed

Lines changed: 42 additions & 179 deletions

File tree

‎.claude/skills/containerlab/SKILL.md‎

Lines changed: 13 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,35 @@
11
---
22
name: containerlab
3-
description: Provision a colima VM (if needed) and deploy a containerlab network device. Defaults to Nokia SRL. Pass a topology file path or image to override. Say "no vm" or "skip vm" to skip VM provisioning.
4-
argument-hint: [no-vm | skip-vm] [--topology <path>] [--image <image>]
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>]
55
allowed-tools: [Bash, Read, Write, AskUserQuestion]
6-
allowed-bash: ["colima *", "containerlab *", "docker *", "gnmic *", "curl *"]
6+
allowed-bash: ["containerlab *", "docker *", "gnmic *", "curl *"]
77
---
88

99
# containerlab
1010

11-
Provisions a colima VM and deploys a containerlab network device.
11+
Deploys a containerlab network device topology.
1212

13-
Steps:
14-
1. Setup VM (colima profile: `containerlab`)
15-
2. Install tools (containerlab, gnmic)
16-
3. Deploy network device
17-
18-
> **No-VM shortcut:** pass `no-vm`, `skip vm`, or `without vm` to skip Steps 1 and 2 and use an already-running VM.
19-
20-
> **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 VM or device environment — ask the user first.
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.
2114
2215
## Arguments
2316

2417
Parse `$ARGUMENTS` for:
25-
- `no-vm` / `skip vm` / `without vm` → skip Steps 1 and 2
2618
- `--topology <path>` → use this topology file instead of the default
2719
- `--image <image>` → override the device image in the default topology
20+
- `--output <path>` → write the generated topology file here (default: `/tmp/dev.clab.yml`)
2821

29-
If no topology is provided, use the default Nokia SRL topology defined in Step 3.
30-
31-
## VM command wrapper
32-
33-
Commands in Steps 2 and 3 run inside the VM. Wrap them as:
34-
```
35-
VM_EXEC="colima exec -p containerlab --"
36-
$VM_EXEC bash -c "<command>"
37-
```
38-
39-
Commands in Step 1 run on the **host** directly (no wrapper).
40-
41-
The host home directory is mounted at the same path inside the VM — no `cd` needed.
42-
43-
In no-VM mode, Steps 2 and 3 commands run on the host directly too.
44-
45-
## Step 1: Setup VM
46-
47-
> Skip if user passed `no-vm` or similar.
48-
49-
Check the state of the `containerlab` colima profile:
50-
51-
```bash
52-
colima list
53-
```
54-
55-
- **Running** → check specs match defaults (4 CPU, 8 GB, 60 GB disk). If they differ, warn and ask whether to recreate:
56-
```bash
57-
colima delete -p containerlab
58-
# then create as below
59-
```
60-
- **Stopped** → start it:
61-
```bash
62-
colima start --profile containerlab --activate=false
63-
```
64-
- **Not listed** → create it:
65-
```bash
66-
colima start --cpu 4 --memory 8 --disk 60 --network-address --profile containerlab --activate=false
67-
```
68-
69-
Verify after start:
70-
```bash
71-
colima list
72-
```
73-
74-
## Step 2: Install tools
75-
76-
Install containerlab if not already present:
77-
78-
```bash
79-
containerlab version 2>/dev/null || bash -c "$(curl -sL https://get.containerlab.dev)"
80-
```
81-
82-
Install gnmic if not already present:
83-
84-
```bash
85-
gnmic version 2>/dev/null || bash -c "$(curl -sL https://get-gnmic.openconfig.net)"
86-
```
22+
If no topology is provided, use the default topology defined below.
8723

88-
## Step 3: Deploy network device
24+
## Deploy network device
8925

9026
If the user provided `--topology <path>`, deploy that file directly:
9127

9228
```bash
9329
containerlab deploy -d -t <path>
9430
```
9531

96-
Otherwise, write the default Nokia SRL topology to `/tmp/dev.clab.yml`, substituting `--image` if provided (default: `ghcr.io/nokia/srlinux:26.7.1`):
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`):
9733

9834
```yaml
9935
name: dev-topology
@@ -137,10 +73,10 @@ topology:
13773
links: []
13874
```
13975
140-
Write it to `/tmp/dev.clab.yml`, then deploy:
76+
Write it to `$OUTPUT_PATH`, then deploy:
14177

14278
```bash
143-
containerlab deploy -d -t /tmp/dev.clab.yml
79+
containerlab deploy -d -t $OUTPUT_PATH
14480
```
14581

14682
If the container already exists:
@@ -157,7 +93,7 @@ docker inspect --format '{{.Name}}: {{.State.Health.Status}}' <node1> <node2> ..
15793

15894
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.
15995

160-
Once healthy, write a gnmic config file at `/tmp/gnmic-config.yaml` 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).
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).
16197

16298
Default credentials, ports and TLS settings per node kind:
16399
- Nokia SRL: `admin / NokiaSrl1!`, forwarded port, `skip-verify: true`
@@ -192,7 +128,7 @@ targets:
192128
Then validate all nodes at once:
193129

194130
```bash
195-
gnmic --config /tmp/gnmic-config.yaml capabilities
131+
gnmic --config $OUTPUT_DIR/gnmic-config.yaml capabilities
196132
```
197133

198134
Show the supported encodings and YANG model count per node. If a node fails, show the error and note it may still be booting.
@@ -206,14 +142,12 @@ containerlab inspect -a
206142
```
207143

208144
Print a final summary:
209-
- Colima profile (if used): `containerlab` — running, specs (CPU/memory/disk)
210145
- Containerlab version
211146
- For each node: name, kind, management IP, gNMI endpoint, health state, gnmic capabilities result (encodings supported, YANG model count)
212147
- Next step: run `/netop` to test device
213148

214149
## References
215150

216-
- **colima**: https://github.com/abiosoft/colima
217151
- **containerlab**: https://containerlab.dev/cmd/
218152
- **Nokia SRL containerlab kind**: https://containerlab.dev/manual/kinds/nokia_srlinux/
219153
- **Juniper vJunos-Evolved containerlab kind**: https://containerlab.dev/manual/kinds/vjunos-evolved/

‎.claude/skills/netop/SKILL.md‎

Lines changed: 8 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ All commands listed in `allowed-bash` run freely — no prompt needed.
3434
**Requires explicit user approval before executing:**
3535
- Any change to network-operator source code (Go files, types, controllers, webhooks, config)
3636
- Any action that directly modifies device state outside of normal operator reconciliation (e.g. manual gnmic Set, out-of-band config fixes)
37-
- Destructive teardown: `make kind-delete`, `make undeploy-dev`, `kubectl delete`
37+
- Destructive teardown: `make kind-delete`, `make undeploy`, `kubectl delete`
3838

3939
**Runs freely in Phase 2 (no approval needed):**
4040
- Creating a kind cluster or deploying the operator (if not present)
@@ -47,68 +47,7 @@ When one of these is needed, describe exactly what will run and why, then wait f
4747

4848
## Phase 1: Check
4949

50-
Runs in order. Each step can be skipped if the user asks for a specific one.
51-
52-
### Step 1.1: Vet
53-
54-
```bash
55-
make vet
56-
```
57-
58-
Fast static analysis — catches real bugs (bad format strings, unreachable code, suspicious struct tags).
59-
Stop if vet fails — these are likely bugs that need manual fixes.
60-
61-
### Step 1.2: Lint
62-
63-
```bash
64-
make lint
65-
```
66-
67-
If lint fails, report the issues. Do NOT run `make lint-fix` automatically — ask the user first:
68-
> "Lint found N issues. Run `make lint-fix` to auto-fix some of them — proceed?"
69-
70-
### Step 1.3: Fmt check (only if vet or lint failed)
71-
72-
Run `make fmt` only when vet or lint reported failures — formatting drift is only worth surfacing when there are already problems to fix:
73-
74-
```bash
75-
make fmt
76-
git diff --name-only
77-
```
78-
79-
`make fmt` is idempotent — it only reformats files. If `git diff` shows changed files, report them as formatting drift. Do NOT stage or commit the changes — just report.
80-
81-
Skip this step entirely when both vet and lint passed.
82-
83-
### Step 1.4: Unit tests
84-
85-
```bash
86-
make test
87-
```
88-
89-
Runs all tests excluding `/e2e` and `/lab`, produces `cover.out`.
90-
91-
### Step 1.4: gNMI integration tests
92-
93-
```bash
94-
make test-gnmi
95-
```
96-
97-
Builds a fake gNMI server from `test/gnmi/` and runs integration tests against it. Fully standalone — no cluster or VM needed.
98-
99-
### Phase 1 summary
100-
101-
```
102-
Local Check Report
103-
─────────────────────────────────────────────────────
104-
Vet: ✓ passed (or ✗ N issues)
105-
Lint: ✓ passed (or ✗ N issues)
106-
Fmt: ✓ no drift (or ✗ N files need formatting) ← only shown when vet or lint failed
107-
Unit tests: ✓ N passed, 0 failed (or ✗ list failing tests)
108-
gNMI tests: ✓ N passed, 0 failed (or ✗ list failing testdata files + diff)
109-
─────────────────────────────────────────────────────
110-
Overall: ✓ all checks passed (or ✗ see above)
111-
```
50+
Follow **After Making Changes** in AGENTS.md — commands, rules, and output format are all defined there. Each step can be skipped if the user asks for a specific one.
11251

11352
---
11453

@@ -167,23 +106,17 @@ kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/
167106
kubectl wait --for=condition=Available deployment --all -n cert-manager --timeout=120s
168107
```
169108

170-
### Step 2.1b: Build and load the controller image (if cluster was just created or operator not deployed)
109+
### Step 2.1b: Build, load and deploy (if cluster was just created or operator not deployed)
171110

172-
Use a fixed local image tag `network-operator-dev:latest` to avoid colliding with the upstream
173-
`ghcr.io/ironcore-dev/network-operator:latest` image that `config/manager/kustomization.yaml`
174-
maps the `controller` name to by default.
111+
Follow the **Development Workflow** in AGENTS.md. Use a fixed local image tag `network-operator-dev:latest` to avoid colliding with the upstream image. The kind cluster name is `network-operator` and the kubectl context is `kind-network-operator`.
175112

176-
Build the image:
113+
Then wait for it to be ready:
177114

178115
```bash
179-
make docker-build IMG=network-operator-dev:latest
116+
kubectl --context kind-network-operator wait --for=condition=Available deployment/network-operator-controller-manager -n network-operator-system --timeout=120s
180117
```
181118

182-
Load it into kind:
183-
184-
```bash
185-
bin/kind load docker-image network-operator-dev:latest --name network-operator
186-
```
119+
If the operator crashes, check logs before asking the user — do not restart or redeploy without understanding the error.
187120

188121
### Step 2.2: Observe operator
189122

@@ -194,20 +127,6 @@ kubectl get deployment -n network-operator-system network-operator-controller-ma
194127
kubectl logs -n network-operator-system -l control-plane=controller-manager --tail=50
195128
```
196129

197-
If the operator is not deployed, deploy it:
198-
199-
```bash
200-
make deploy-dev IMG=network-operator-dev:latest PROVIDER=openconfig KUBECTL="kubectl --context kind-network-operator"
201-
```
202-
203-
Then wait for it to be ready:
204-
205-
```bash
206-
kubectl --context kind-network-operator wait --for=condition=Available deployment/network-operator-controller-manager -n network-operator-system --timeout=120s
207-
```
208-
209-
If the operator crashes, check logs before asking the user — do not restart or redeploy without understanding the error.
210-
211130
### Step 2.3: Observe Device resources
212131

213132
Read existing Device CRs:
@@ -302,7 +221,7 @@ Only perform cleanup steps when the user explicitly asks. Always ask for confirm
302221
Undeploy the operator:
303222

304223
```bash
305-
make undeploy-dev PROVIDER=<provider>
224+
make undeploy
306225
```
307226

308227
Delete the kind cluster:

‎AGENTS.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ make charts # Regenerate Helm chart manifests
3838

3939
```bash
4040
make fmt # Format code
41+
make vet # Static analysis
4142
make lint # Lint code style
4243
make test # Run unit tests (uses envtest: real K8s API + etcd)
44+
make test-gnmi # gNMI integration tests (fake server, no cluster needed)
4345
```
4446

4547
Tests use **Ginkgo + Gomega** (BDD style) for controller and webhook tests — check `suite_test.go` in each package for setup.
@@ -50,6 +52,25 @@ All other packages use the **standard library `testing` package** with table-dri
5052

5153
**All of `make fmt lint test` must pass before work is considered complete.**
5254

55+
**Check rules:**
56+
- Stop if `make vet` fails — these are likely bugs that need manual fixes
57+
- If `make lint` fails, do NOT run `make lint-fix` automatically — ask the user first
58+
- Run `make fmt` + `git diff --name-only` only when vet or lint failed; report drift but do NOT stage or commit
59+
60+
**Check output format** (report after running all steps):
61+
62+
```
63+
Local Check Report
64+
─────────────────────────────────────────────────────
65+
Vet: ✓ passed (or ✗ N issues)
66+
Lint: ✓ passed (or ✗ N issues)
67+
Fmt: ✓ no drift (or ✗ N files need formatting) ← only shown when vet or lint failed
68+
Unit tests: ✓ N passed, 0 failed (or ✗ list failing tests)
69+
gNMI tests: ✓ N passed, 0 failed (or ✗ list failing testdata files + diff)
70+
─────────────────────────────────────────────────────
71+
Overall: ✓ all checks passed (or ✗ see above)
72+
```
73+
5374
## Commits
5475

5576
- Run `git log` first and match the existing commit style

‎Makefile‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -239,18 +239,10 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster.
239239
fi
240240
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -
241241

242-
.PHONY: deploy-dev
243-
deploy-dev: manifests kustomize ## Deploy controller using config/develop overlay. Use PROVIDER to set the provider (default: openconfig).
244-
IMG=$(IMG) PROVIDER=$(PROVIDER) $(KUSTOMIZE) build config/develop | envsubst | $(KUBECTL) apply -f -
245-
246242
.PHONY: undeploy
247243
undeploy: kustomize ## Undeploy controller from the K8s cluster. Call with ignore-not-found=true to ignore resource not found errors during deletion.
248244
$(KUSTOMIZE) build config/default | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
249245

250-
.PHONY: undeploy-dev
251-
undeploy-dev: kustomize ## Undeploy controller using config/develop overlay.
252-
PROVIDER=$(PROVIDER) $(KUSTOMIZE) build config/develop | envsubst | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
253-
254246
##@ Dependencies
255247

256248
## Location to install dependencies to

‎config/develop/manager_patch.yaml‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
- op: replace
2-
path: /spec/template/spec/containers/0/image
3-
value: ${IMG}
41
- op: replace
52
path: /spec/template/spec/containers/0/args
63
value:

0 commit comments

Comments
 (0)