ToFaRev sessions

ToFaRev review

srl-labs/containerlab · d44c69f72ab1

completed · 54 messages · 68 tool calls

Last snapshot:

Download session JSON · Full transcript

Final review

# ToFaRev review

Review complete within the supplied scope.

Source inspection only; PR code, tests, and benchmarks were not executed.

| Finding | Location |
| --- | --- |
| **P4 - CI `components` shard schedules [`14-srsim-new-chassis.robot`](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/tests/13-srsim/14-srsim-new-chassis.robot#L1-L1), which always skips because no runner sets `26_10_TESTS`** | [.github/workflows/srsim-tests.yml:51-52](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/.github/workflows/srsim-tests.yml#L51-L52) |
| **P4 - Inline `SFM` override warning in `Init` duplicates `warnUserEnvOverrides` for the `NOKIA_SROS_SFM` key** | [nodes/sros/sros.go:277-297](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/nodes/sros/sros.go#L277-L297) |

## P4 - CI `components` shard schedules [`14-srsim-new-chassis.robot`](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/tests/13-srsim/14-srsim-new-chassis.robot#L1-L1), which always skips because no runner sets `26_10_TESTS`

**Location:** [.github/workflows/srsim-tests.yml:51-52](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/.github/workflows/srsim-tests.yml#L51-L52)

**Problem:** The new chassis suite gates itself with `Skip If '${26_10_TESTS}'.lower() != 'true'` and defaults the variable to `false` in [`tests/13-srsim/14-srsim-new-chassis.robot`](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/tests/13-srsim/14-srsim-new-chassis.robot#L1-L1). Nothing in the repository sets it: [`srsim-tests.yml`](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/.github/workflows/srsim-tests.yml#L1-L1) invokes `./tests/rf-run.sh ${{ inputs.runtime }} ./tests/13-srsim/${test_suite}` with no `--variable` flag and no input that could carry one, yet the `components` shard lists [`14-srsim-new-chassis.robot`](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/tests/13-srsim/14-srsim-new-chassis.robot#L1-L1).

**Trigger:** Every CI run of the `components` shard.

**Impact:** The new-chassis code paths (`ixr-e2sc`, `ixr-e3`, `sar-10x` classification, integrated/distributed routing, component warnings) receive no automated CI coverage, and the shard listing overstates actual coverage. Regressions would only surface through manual runs with `--variable 26_10_TESTS:true`.

**Suggested correction:** Either add a workflow input (or a dedicated shard) that passes `--variable 26_10_TESTS:true` once the 26.10 image is generally available, or remove the suite from the `components` shard until then. If the skip is intentionally permanent until the image ships, a comment in the workflow would make that explicit.


## P4 - Inline `SFM` override warning in `Init` duplicates `warnUserEnvOverrides` for the `NOKIA_SROS_SFM` key

**Location:** [nodes/sros/sros.go:277-297](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/nodes/sros/sros.go#L277-L297)

**Problem:** The inline block in `Init` reproduces exactly the semantics of `warnUserEnvOverrides` ([`component.go:184-202`](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/nodes/sros/component.go#L184-L202)) — warn when the user env value exists and differs — for the single `NOKIA_SROS_SFM` key, including the identical message format and log fields.

**Trigger:** Any node whose kind config sets `SFM` while the user also sets the `NOKIA_SROS_SFM` environment variable to a different value.

**Impact:** Two copies of the same warning text and log-field contract must be kept in sync; a future message change must be applied in both places, which is easy to miss during maintenance.

**Suggested correction:** Replace the inline warn with `warnUserEnvOverrides(n.Cfg.ShortName, map[string]string{envNokiaSrosSFM: sfm}, n.userEnv)` and keep the `n.Cfg.Env[envNokiaSrosSFM] = sfm` assignment gated on the key being absent (the helper already computes `userSet`). This is a small local simplification, not a structural change.


## Coverage

- Static review only; tests were not executed. All 31 changed paths were read from `diff.txt` in full, and head files were cross-checked where the diff was ambiguous (including the complete [`utils/sros_schema_gen.sh`](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/utils/sros_schema_gen.sh#L1-L1), [`chassis_info.go`](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/nodes/sros/chassis_info.go#L1-L1), [`component_config.go`](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/nodes/sros/component_config.go#L1-L1), and [`component.go`](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/nodes/sros/component.go#L1-L1)).
- Verified: classification routing (standalone/integrated/redundant/distributed), `userEnv` snapshot ordering relative to `setupComponentNodes` (called from `Init` at [`sros.go`](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/nodes/sros/sros.go#L1-L1):343, after the snapshot), single-warning behavior across CPM A/B and line cards via the `PreDeploy` gating, per-component env preservation in `componentDerivedEnv`, and schema enum coverage for the new chassis types and integrated-default MDA types.
- Runtime-dependent behaviors (container creation, netns join, image inspection returning `chassis_info.json`, gnmic queries against distributed-base container names) are inferred from code and robot test expectations, not verified in a live environment.
- The base `checkComponentSlotsConfig` insertion bug (raw-slot insert vs uppercased check) was fixed as part of the move; no finding was raised for it.
- The package-level `srosEnv` map mutation ([`sros.go`](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/nodes/sros/sros.go#L1-L1):309,312) and SFM-per-line-card config emission are pre-existing patterns carried over unchanged and were not flagged.

---
Powered by <a href="https://tokenfactory.nebius.com/"><picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/hellt/tofarev/11341daf301af9b89b711528df08d0a9e9139bca/assets/nebius-token-factory-dark.svg"><img src="https://raw.githubusercontent.com/hellt/tofarev/11341daf301af9b89b711528df08d0a9e9139bca/assets/nebius-token-factory-light.svg" alt="Nebius Token Factory" height="22" align="absmiddle"></picture></a>

```json
{
  "version": 1,
  "findings": [
    {
      "priority": "P4",
      "title": "CI `components` shard schedules `14-srsim-new-chassis.robot`, which always skips because no runner sets `26_10_TESTS`",
      "location": {
        "revision": "head",
        "path": ".github/workflows/srsim-tests.yml",
        "start": 51,
        "end": 52
      },
      "problem": "The new chassis suite gates itself with `Skip If '${26_10_TESTS}'.lower() != 'true'` and defaults the variable to `false` in `tests/13-srsim/14-srsim-new-chassis.robot`. Nothing in the repository sets it: `srsim-tests.yml` invokes `./tests/rf-run.sh ${{ inputs.runtime }} ./tests/13-srsim/${test_suite}` with no `--variable` flag and no input that could carry one, yet the `components` shard lists `14-srsim-new-chassis.robot`.",
      "trigger": "Every CI run of the `components` shard.",
      "impact": "The new-chassis code paths (`ixr-e2sc`, `ixr-e3`, `sar-10x` classification, integrated/distributed routing, component warnings) receive no automated CI coverage, and the shard listing overstates actual coverage. Regressions would only surface through manual runs with `--variable 26_10_TESTS:true`.",
      "suggestion": "Either add a workflow input (or a dedicated shard) that passes `--variable 26_10_TESTS:true` once the 26.10 image is generally available, or remove the suite from the `components` shard until then. If the skip is intentionally permanent until the image ships, a comment in the workflow would make that explicit."
    },
    {
      "priority": "P4",
      "title": "Inline `SFM` override warning in `Init` duplicates `warnUserEnvOverrides` for the `NOKIA_SROS_SFM` key",
      "location": {
        "revision": "head",
        "path": "nodes/sros/sros.go",
        "start": 277,
        "end": 297
      },
      "problem": "The inline block in `Init` reproduces exactly the semantics of `warnUserEnvOverrides` (`component.go:184-202`) — warn when the user env value exists and differs — for the single `NOKIA_SROS_SFM` key, including the identical message format and log fields.",
      "trigger": "Any node whose kind config sets `SFM` while the user also sets the `NOKIA_SROS_SFM` environment variable to a different value.",
      "impact": "Two copies of the same warning text and log-field contract must be kept in sync; a future message change must be applied in both places, which is easy to miss during maintenance.",
      "suggestion": "Replace the inline warn with `warnUserEnvOverrides(n.Cfg.ShortName, map[string]string{envNokiaSrosSFM: sfm}, n.userEnv)` and keep the `n.Cfg.Env[envNokiaSrosSFM] = sfm` assignment gated on the key being absent (the helper already computes `userSet`). This is a small local simplification, not a structural change."
    }
  ],
  "coverage": {
    "complete": true,
    "notes": [
      "Static review only; tests were not executed. All 31 changed paths were read from `diff.txt` in full, and head files were cross-checked where the diff was ambiguous (including the complete `utils/sros_schema_gen.sh`, `chassis_info.go`, `component_config.go`, and `component.go`).",
      "Verified: classification routing (standalone/integrated/redundant/distributed), `userEnv` snapshot ordering relative to `setupComponentNodes` (called from `Init` at `sros.go`:343, after the snapshot), single-warning behavior across CPM A/B and line cards via the `PreDeploy` gating, per-component env preservation in `componentDerivedEnv`, and schema enum coverage for the new chassis types and integrated-default MDA types.",
      "Runtime-dependent behaviors (container creation, netns join, image inspection returning `chassis_info.json`, gnmic queries against distributed-base container names) are inferred from code and robot test expectations, not verified in a live environment.",
      "The base `checkComponentSlotsConfig` insertion bug (raw-slot insert vs uppercased check) was fixed as part of the move; no finding was raised for it.",
      "The package-level `srosEnv` map mutation (`sros.go`:309,312) and SFM-per-line-card config emission are pre-existing patterns carried over unchanged and were not flagged."
    ]
  }
}
```
User · 1
Review the read-only PR snapshot at /source.
Read standards.json and its referenced rules, then diff.txt and relevant head/ and base/ files. Track all 31 changed paths from the diff. Complete checks for each changed path and relevant callers, tests, docs, and schema before finalizing. Source-only review can be complete without executing tests; disclose that limitation. Use read offsets for truncated output and group independent tool calls. Use glob/grep for surrounding code. Return the trusted result schema.
Head: d44c69f72ab156474197f12b6fc1407b3f8a65c4. Comparison base: 84cf630e6eedd662d9742fbcd6158a91372e3a56. Target base: 84cf630e6eedd662d9742fbcd6158a91372e3a56.
GitHub permalink roots: head=https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/; base=https://github.com/srl-labs/containerlab/blob/84cf630e6eedd662d9742fbcd6158a91372e3a56/.
Snapshot incomplete: false. The full inventory and omission details are in manifest.json; consult it when needed. 
Message metadata
{
  "role": "user",
  "id": "msg_1502d8a66001F2b7xDf6faLOHN",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346524262
  },
  "summary": {
    "diffs": []
  },
  "agent": "tofarev",
  "model": {
    "providerID": "tofarev",
    "modelID": "zai-org/GLM-5.3-Flash"
  }
}
Assistant · 2
step-start
{
  "type": "step-start",
  "id": "prt_1502d9930001isDXuBckgK4Oru",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502d8d39001ueMeRrKSWMmkMd"
}
Reasoning
Let me start by exploring the snapshot structure and reading the standards.
read · error

Input

{
  "filePath": "/source"
}

Output

The user has specified a rule which prevents you from using this specific tool call. Here are some of the relevant rules [{"permission":"*","action":"allow","pattern":"*"},{"permission":"read","pattern":"*","action":"allow"},{"permission":"read","pattern":"*.env","action":"ask"},{"permission":"read","pattern":"*.env.*","action":"ask"},{"permission":"read","pattern":"*.env.example","action":"allow"},{"permission":"*","action":"deny","pattern":"*"},{"permission":"read","pattern":"*","action":"deny"},{"permission":"read","pattern":"source/*","action":"allow"},{"permission":"*","action":"deny","pattern":"*"},{"permission":"read","pattern":"*","action":"deny"},{"permission":"read","pattern":"source/*","action":"allow"}]
Tool metadata
{
  "type": "tool",
  "id": "prt_1502d99e8001Hmfy2N8kl7Ptry",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502d8d39001ueMeRrKSWMmkMd",
  "callID": "call_82d5253209e342f0beacada2",
  "tool": "read",
  "state": {
    "status": "error",
    "input": {
      "filePath": "/source"
    },
    "error": "The user has specified a rule which prevents you from using this specific tool call. Here are some of the relevant rules [{\"permission\":\"*\",\"action\":\"allow\",\"pattern\":\"*\"},{\"permission\":\"read\",\"pattern\":\"*\",\"action\":\"allow\"},{\"permission\":\"read\",\"pattern\":\"*.env\",\"action\":\"ask\"},{\"permission\":\"read\",\"pattern\":\"*.env.*\",\"action\":\"ask\"},{\"permission\":\"read\",\"pattern\":\"*.env.example\",\"action\":\"allow\"},{\"permission\":\"*\",\"action\":\"deny\",\"pattern\":\"*\"},{\"permission\":\"read\",\"pattern\":\"*\",\"action\":\"deny\"},{\"permission\":\"read\",\"pattern\":\"source/*\",\"action\":\"allow\"},{\"permission\":\"*\",\"action\":\"deny\",\"pattern\":\"*\"},{\"permission\":\"read\",\"pattern\":\"*\",\"action\":\"deny\"},{\"permission\":\"read\",\"pattern\":\"source/*\",\"action\":\"allow\"}]",
    "time": {
      "start": 1792346528244,
      "end": 1792346528264
    }
  }
}
read · completed

Input

{
  "filePath": "/source/standards.json"
}

Output

<path>/source/standards.json</path>
<type>file</type>
<content>
1: [
2:   {
3:     "path": ".cursor/rules/karpathy-guidelines.mdc",
4:     "revision": "84cf630e6eedd662d9742fbcd6158a91372e3a56",
5:     "file": "standards/karpathy-guidelines.mdc"
6:   },
7:   {
8:     "path": ".cursor/rules/ponytail.mdc",
9:     "revision": "84cf630e6eedd662d9742fbcd6158a91372e3a56",
10:     "file": "standards/ponytail.mdc"
11:   }
12: ]

(End of file - total 12 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502d99fa001coN5242tl4BUm8",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502d8d39001ueMeRrKSWMmkMd",
  "callID": "call_5951755653b94ad3b9b1157b",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/standards.json"
    },
    "output": "<path>/source/standards.json</path>\n<type>file</type>\n<content>\n1: [\n2:   {\n3:     \"path\": \".cursor/rules/karpathy-guidelines.mdc\",\n4:     \"revision\": \"84cf630e6eedd662d9742fbcd6158a91372e3a56\",\n5:     \"file\": \"standards/karpathy-guidelines.mdc\"\n6:   },\n7:   {\n8:     \"path\": \".cursor/rules/ponytail.mdc\",\n9:     \"revision\": \"84cf630e6eedd662d9742fbcd6158a91372e3a56\",\n10:     \"file\": \"standards/ponytail.mdc\"\n11:   }\n12: ]\n\n(End of file - total 12 lines)\n</content>",
    "title": "source/standards.json",
    "metadata": {
      "preview": "[\n  {\n    \"path\": \".cursor/rules/karpathy-guidelines.mdc\",\n    \"revision\": \"84cf630e6eedd662d9742fbcd6158a91372e3a56\",\n    \"file\": \"standards/karpathy-guidelines.mdc\"\n  },\n  {\n    \"path\": \".cursor/rules/ponytail.mdc\",\n    \"revision\": \"84cf630e6eedd662d9742fbcd6158a91372e3a56\",\n    \"file\": \"standards/ponytail.mdc\"\n  }\n]",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/standards.json",
        "text": "[\n  {\n    \"path\": \".cursor/rules/karpathy-guidelines.mdc\",\n    \"revision\": \"84cf630e6eedd662d9742fbcd6158a91372e3a56\",\n    \"file\": \"standards/karpathy-guidelines.mdc\"\n  },\n  {\n    \"path\": \".cursor/rules/ponytail.mdc\",\n    \"revision\": \"84cf630e6eedd662d9742fbcd6158a91372e3a56\",\n    \"file\": \"standards/ponytail.mdc\"\n  }\n]",
        "lineStart": 1,
        "lineEnd": 12,
        "totalLines": 12,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346528255,
      "end": 1792346528288
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502d9a27001ZhXemvn0q0ODdh",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502d8d39001ueMeRrKSWMmkMd",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 3305,
    "input": 3268,
    "output": 23,
    "reasoning": 14,
    "cache": {
      "read": 0,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502d8d39001ueMeRrKSWMmkMd",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346524985,
    "completed": 1792346528302
  },
  "parentID": "msg_1502d8a66001F2b7xDf6faLOHN",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 3305,
    "input": 3268,
    "output": 23,
    "reasoning": 14,
    "cache": {
      "read": 0,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 3
step-start
{
  "type": "step-start",
  "id": "prt_1502d9d4d0014lAErKscuE6mcU",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502d9a31001syzcYf80k0jjc3"
}
read · completed

Input

{
  "filePath": "/source/standards/karpathy-guidelines.mdc"
}

Output

<path>/source/standards/karpathy-guidelines.mdc</path>
<type>file</type>
<content>
1: ---
2: description: Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes, surface assumptions, and define verifiable success criteria.
3: alwaysApply: true
4: ---
5: 
6: # Karpathy behavioral guidelines
7: 
8: Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed.
9: 
10: **Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.
11: 
12: ## 1. Think Before Coding
13: 
14: **Don't assume. Don't hide confusion. Surface tradeoffs.**
15: 
16: Before implementing:
17: 
18: - State your assumptions explicitly. If uncertain, ask.
19: - If multiple interpretations exist, present them - don't pick silently.
20: - If a simpler approach exists, say so. Push back when warranted.
21: - If something is unclear, stop. Name what's confusing. Ask.
22: 
23: ## 2. Simplicity First
24: 
25: **Minimum code that solves the problem. Nothing speculative.**
26: 
27: - No features beyond what was asked.
28: - No abstractions for single-use code.
29: - No "flexibility" or "configurability" that wasn't requested.
30: - No error handling for impossible scenarios.
31: - If you write 200 lines and it could be 50, rewrite it.
32: 
33: Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
34: 
35: ## 3. Surgical Changes
36: 
37: **Touch only what you must. Clean up only your own mess.**
38: 
39: When editing existing code:
40: 
41: - Don't "improve" adjacent code, comments, or formatting.
42: - Don't refactor things that aren't broken.
43: - Match existing style, even if you'd do it differently.
44: - If you notice unrelated dead code, mention it - don't delete it.
45: 
46: When your changes create orphans:
47: 
48: - Remove imports/variables/functions that YOUR changes made unused.
49: - Don't remove pre-existing dead code unless asked.
50: 
51: The test: Every changed line should trace directly to the user's request.
52: 
53: ## 4. Goal-Driven Execution
54: 
55: **Define success criteria. Loop until verified.**
56: 
57: Transform tasks into verifiable goals:
58: 
59: - "Add validation" → "Write tests for invalid inputs, then make them pass"
60: - "Fix the bug" → "Write a test that reproduces it, then make it pass"
61: - "Refactor X" → "Ensure tests pass before and after"
62: 
63: For multi-step tasks, state a brief plan:
64: 
65: ```
66: 1. [Step] → verify: [check]
67: 2. [Step] → verify: [check]
68: 3. [Step] → verify: [check]
69: ```
70: 
71: Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
72: 
73: ---
74: 
75: **These guidelines are working if:** fewer unnecessary changes in diffs, fewer rewrites due to overcomplication, and clarifying questions come before implementation rather than after mistakes.

(End of file - total 75 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502d9d890013SMK0ey2Tl2Sv6",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502d9a31001syzcYf80k0jjc3",
  "callID": "call_1c85c1741a2844998d02f589",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/standards/karpathy-guidelines.mdc"
    },
    "output": "<path>/source/standards/karpathy-guidelines.mdc</path>\n<type>file</type>\n<content>\n1: ---\n2: description: Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes, surface assumptions, and define verifiable success criteria.\n3: alwaysApply: true\n4: ---\n5: \n6: # Karpathy behavioral guidelines\n7: \n8: Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed.\n9: \n10: **Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.\n11: \n12: ## 1. Think Before Coding\n13: \n14: **Don't assume. Don't hide confusion. Surface tradeoffs.**\n15: \n16: Before implementing:\n17: \n18: - State your assumptions explicitly. If uncertain, ask.\n19: - If multiple interpretations exist, present them - don't pick silently.\n20: - If a simpler approach exists, say so. Push back when warranted.\n21: - If something is unclear, stop. Name what's confusing. Ask.\n22: \n23: ## 2. Simplicity First\n24: \n25: **Minimum code that solves the problem. Nothing speculative.**\n26: \n27: - No features beyond what was asked.\n28: - No abstractions for single-use code.\n29: - No \"flexibility\" or \"configurability\" that wasn't requested.\n30: - No error handling for impossible scenarios.\n31: - If you write 200 lines and it could be 50, rewrite it.\n32: \n33: Ask yourself: \"Would a senior engineer say this is overcomplicated?\" If yes, simplify.\n34: \n35: ## 3. Surgical Changes\n36: \n37: **Touch only what you must. Clean up only your own mess.**\n38: \n39: When editing existing code:\n40: \n41: - Don't \"improve\" adjacent code, comments, or formatting.\n42: - Don't refactor things that aren't broken.\n43: - Match existing style, even if you'd do it differently.\n44: - If you notice unrelated dead code, mention it - don't delete it.\n45: \n46: When your changes create orphans:\n47: \n48: - Remove imports/variables/functions that YOUR changes made unused.\n49: - Don't remove pre-existing dead code unless asked.\n50: \n51: The test: Every changed line should trace directly to the user's request.\n52: \n53: ## 4. Goal-Driven Execution\n54: \n55: **Define success criteria. Loop until verified.**\n56: \n57: Transform tasks into verifiable goals:\n58: \n59: - \"Add validation\" → \"Write tests for invalid inputs, then make them pass\"\n60: - \"Fix the bug\" → \"Write a test that reproduces it, then make it pass\"\n61: - \"Refactor X\" → \"Ensure tests pass before and after\"\n62: \n63: For multi-step tasks, state a brief plan:\n64: \n65: ```\n66: 1. [Step] → verify: [check]\n67: 2. [Step] → verify: [check]\n68: 3. [Step] → verify: [check]\n69: ```\n70: \n71: Strong success criteria let you loop independently. Weak criteria (\"make it work\") require constant clarification.\n72: \n73: ---\n74: \n75: **These guidelines are working if:** fewer unnecessary changes in diffs, fewer rewrites due to overcomplication, and clarifying questions come before implementation rather than after mistakes.\n\n(End of file - total 75 lines)\n</content>",
    "title": "source/standards/karpathy-guidelines.mdc",
    "metadata": {
      "preview": "---\ndescription: Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes, surface assumptions, and define verifiable success criteria.\nalwaysApply: true\n---\n\n# Karpathy behavioral guidelines\n\nBehavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed.\n\n**Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.\n\n## 1. Think Before Coding\n\n**Don't assume. Don't hide confusion. Surface tradeoffs.**\n\nBefore implementing:\n\n- State your assumptions explicitly. If uncertain, ask.\n- If multiple interpretations exist, present them - don't pick silently.\n- If a simpler approach exists, say so. Push back when warranted.",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/standards/karpathy-guidelines.mdc",
        "text": "---\ndescription: Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes, surface assumptions, and define verifiable success criteria.\nalwaysApply: true\n---\n\n# Karpathy behavioral guidelines\n\nBehavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed.\n\n**Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.\n\n## 1. Think Before Coding\n\n**Don't assume. Don't hide confusion. Surface tradeoffs.**\n\nBefore implementing:\n\n- State your assumptions explicitly. If uncertain, ask.\n- If multiple interpretations exist, present them - don't pick silently.\n- If a simpler approach exists, say so. Push back when warranted.\n- If something is unclear, stop. Name what's confusing. Ask.\n\n## 2. Simplicity First\n\n**Minimum code that solves the problem. Nothing speculative.**\n\n- No features beyond what was asked.\n- No abstractions for single-use code.\n- No \"flexibility\" or \"configurability\" that wasn't requested.\n- No error handling for impossible scenarios.\n- If you write 200 lines and it could be 50, rewrite it.\n\nAsk yourself: \"Would a senior engineer say this is overcomplicated?\" If yes, simplify.\n\n## 3. Surgical Changes\n\n**Touch only what you must. Clean up only your own mess.**\n\nWhen editing existing code:\n\n- Don't \"improve\" adjacent code, comments, or formatting.\n- Don't refactor things that aren't broken.\n- Match existing style, even if you'd do it differently.\n- If you notice unrelated dead code, mention it - don't delete it.\n\nWhen your changes create orphans:\n\n- Remove imports/variables/functions that YOUR changes made unused.\n- Don't remove pre-existing dead code unless asked.\n\nThe test: Every changed line should trace directly to the user's request.\n\n## 4. Goal-Driven Execution\n\n**Define success criteria. Loop until verified.**\n\nTransform tasks into verifiable goals:\n\n- \"Add validation\" → \"Write tests for invalid inputs, then make them pass\"\n- \"Fix the bug\" → \"Write a test that reproduces it, then make it pass\"\n- \"Refactor X\" → \"Ensure tests pass before and after\"\n\nFor multi-step tasks, state a brief plan:\n\n```\n1. [Step] → verify: [check]\n2. [Step] → verify: [check]\n3. [Step] → verify: [check]\n```\n\nStrong success criteria let you loop independently. Weak criteria (\"make it work\") require constant clarification.\n\n---\n\n**These guidelines are working if:** fewer unnecessary changes in diffs, fewer rewrites due to overcomplication, and clarifying questions come before implementation rather than after mistakes.",
        "lineStart": 1,
        "lineEnd": 75,
        "totalLines": 75,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346529167,
      "end": 1792346529187
    }
  }
}
read · completed

Input

{
  "filePath": "/source/standards/ponytail.mdc"
}

Output

<path>/source/standards/ponytail.mdc</path>
<type>file</type>
<content>
1: ---
2: description: Ponytail, lazy senior dev mode. Always pick the simplest solution that works.
3: globs:
4: alwaysApply: true
5: ---
6: 
7: # Ponytail, lazy senior dev mode
8: 
9: You are a lazy senior developer. Lazy means efficient, not careless. The best code is the code never written.
10: 
11: Before writing any code, stop at the first rung that holds:
12: 
13: 1. Does this need to be built at all? (YAGNI)
14: 2. Does it already exist in this codebase? Reuse the helper, util, or pattern that's already here, don't re-write it.
15: 3. Does the standard library already do this? Use it.
16: 4. Does a native platform feature cover it? Use it.
17: 5. Does an already-installed dependency solve it? Use it.
18: 6. Can this be one line? Make it one line.
19: 7. Only then: write the minimum code that works.
20: 
21: The ladder runs after you understand the problem, not instead of it: read the task and the code it touches, trace the real flow end to end, then climb.
22: 
23: Bug fix = root cause, not symptom: a report names a symptom. Grep every caller of the function you touch and fix the shared function once — one guard there is a smaller diff than one per caller, and patching only the path the ticket names leaves a sibling caller still broken.
24: 
25: Rules:
26: 
27: - No abstractions that weren't explicitly requested.
28: - No new dependency if it can be avoided.
29: - No boilerplate nobody asked for.
30: - Deletion over addition. Boring over clever. Fewest files possible.
31: - Shortest working diff wins, but only once you understand the problem. The smallest change in the wrong place isn't lazy, it's a second bug.
32: - Question complex requests: "Do you actually need X, or does Y cover it?"
33: - Pick the edge-case-correct option when two stdlib approaches are the same size, lazy means less code, not the flimsier algorithm.
34: - Mark deliberate simplifications that cut a real corner with a known ceiling (global lock, O(n²) scan, naive heuristic) with a `ponytail:` comment naming the ceiling and upgrade path.
35: 
36: Not lazy about: understanding the problem (read it fully and trace the real flow before picking a rung, a small diff you don't understand is just laziness dressed up as efficiency), input validation at trust boundaries, error handling that prevents data loss, security, accessibility, the calibration real hardware needs (the platform is never the spec ideal, a clock drifts, a sensor reads off), anything explicitly requested. Lazy code without its check is unfinished: non-trivial logic leaves ONE runnable check behind, the smallest thing that fails if the logic breaks (an assert-based demo/self-check or one small test file; no frameworks, no fixtures). Trivial one-liners need no test.

(End of file - total 36 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502d9dd5001cfrUL5zES809Gh",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502d9a31001syzcYf80k0jjc3",
  "callID": "call_a4268bb4398a4e90a4d9d78d",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/standards/ponytail.mdc"
    },
    "output": "<path>/source/standards/ponytail.mdc</path>\n<type>file</type>\n<content>\n1: ---\n2: description: Ponytail, lazy senior dev mode. Always pick the simplest solution that works.\n3: globs:\n4: alwaysApply: true\n5: ---\n6: \n7: # Ponytail, lazy senior dev mode\n8: \n9: You are a lazy senior developer. Lazy means efficient, not careless. The best code is the code never written.\n10: \n11: Before writing any code, stop at the first rung that holds:\n12: \n13: 1. Does this need to be built at all? (YAGNI)\n14: 2. Does it already exist in this codebase? Reuse the helper, util, or pattern that's already here, don't re-write it.\n15: 3. Does the standard library already do this? Use it.\n16: 4. Does a native platform feature cover it? Use it.\n17: 5. Does an already-installed dependency solve it? Use it.\n18: 6. Can this be one line? Make it one line.\n19: 7. Only then: write the minimum code that works.\n20: \n21: The ladder runs after you understand the problem, not instead of it: read the task and the code it touches, trace the real flow end to end, then climb.\n22: \n23: Bug fix = root cause, not symptom: a report names a symptom. Grep every caller of the function you touch and fix the shared function once — one guard there is a smaller diff than one per caller, and patching only the path the ticket names leaves a sibling caller still broken.\n24: \n25: Rules:\n26: \n27: - No abstractions that weren't explicitly requested.\n28: - No new dependency if it can be avoided.\n29: - No boilerplate nobody asked for.\n30: - Deletion over addition. Boring over clever. Fewest files possible.\n31: - Shortest working diff wins, but only once you understand the problem. The smallest change in the wrong place isn't lazy, it's a second bug.\n32: - Question complex requests: \"Do you actually need X, or does Y cover it?\"\n33: - Pick the edge-case-correct option when two stdlib approaches are the same size, lazy means less code, not the flimsier algorithm.\n34: - Mark deliberate simplifications that cut a real corner with a known ceiling (global lock, O(n²) scan, naive heuristic) with a `ponytail:` comment naming the ceiling and upgrade path.\n35: \n36: Not lazy about: understanding the problem (read it fully and trace the real flow before picking a rung, a small diff you don't understand is just laziness dressed up as efficiency), input validation at trust boundaries, error handling that prevents data loss, security, accessibility, the calibration real hardware needs (the platform is never the spec ideal, a clock drifts, a sensor reads off), anything explicitly requested. Lazy code without its check is unfinished: non-trivial logic leaves ONE runnable check behind, the smallest thing that fails if the logic breaks (an assert-based demo/self-check or one small test file; no frameworks, no fixtures). Trivial one-liners need no test.\n\n(End of file - total 36 lines)\n</content>",
    "title": "source/standards/ponytail.mdc",
    "metadata": {
      "preview": "---\ndescription: Ponytail, lazy senior dev mode. Always pick the simplest solution that works.\nglobs:\nalwaysApply: true\n---\n\n# Ponytail, lazy senior dev mode\n\nYou are a lazy senior developer. Lazy means efficient, not careless. The best code is the code never written.\n\nBefore writing any code, stop at the first rung that holds:\n\n1. Does this need to be built at all? (YAGNI)\n2. Does it already exist in this codebase? Reuse the helper, util, or pattern that's already here, don't re-write it.\n3. Does the standard library already do this? Use it.\n4. Does a native platform feature cover it? Use it.\n5. Does an already-installed dependency solve it? Use it.\n6. Can this be one line? Make it one line.\n7. Only then: write the minimum code that works.\n",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/standards/ponytail.mdc",
        "text": "---\ndescription: Ponytail, lazy senior dev mode. Always pick the simplest solution that works.\nglobs:\nalwaysApply: true\n---\n\n# Ponytail, lazy senior dev mode\n\nYou are a lazy senior developer. Lazy means efficient, not careless. The best code is the code never written.\n\nBefore writing any code, stop at the first rung that holds:\n\n1. Does this need to be built at all? (YAGNI)\n2. Does it already exist in this codebase? Reuse the helper, util, or pattern that's already here, don't re-write it.\n3. Does the standard library already do this? Use it.\n4. Does a native platform feature cover it? Use it.\n5. Does an already-installed dependency solve it? Use it.\n6. Can this be one line? Make it one line.\n7. Only then: write the minimum code that works.\n\nThe ladder runs after you understand the problem, not instead of it: read the task and the code it touches, trace the real flow end to end, then climb.\n\nBug fix = root cause, not symptom: a report names a symptom. Grep every caller of the function you touch and fix the shared function once — one guard there is a smaller diff than one per caller, and patching only the path the ticket names leaves a sibling caller still broken.\n\nRules:\n\n- No abstractions that weren't explicitly requested.\n- No new dependency if it can be avoided.\n- No boilerplate nobody asked for.\n- Deletion over addition. Boring over clever. Fewest files possible.\n- Shortest working diff wins, but only once you understand the problem. The smallest change in the wrong place isn't lazy, it's a second bug.\n- Question complex requests: \"Do you actually need X, or does Y cover it?\"\n- Pick the edge-case-correct option when two stdlib approaches are the same size, lazy means less code, not the flimsier algorithm.\n- Mark deliberate simplifications that cut a real corner with a known ceiling (global lock, O(n²) scan, naive heuristic) with a `ponytail:` comment naming the ceiling and upgrade path.\n\nNot lazy about: understanding the problem (read it fully and trace the real flow before picking a rung, a small diff you don't understand is just laziness dressed up as efficiency), input validation at trust boundaries, error handling that prevents data loss, security, accessibility, the calibration real hardware needs (the platform is never the spec ideal, a clock drifts, a sensor reads off), anything explicitly requested. Lazy code without its check is unfinished: non-trivial logic leaves ONE runnable check behind, the smallest thing that fails if the logic breaks (an assert-based demo/self-check or one small test file; no frameworks, no fixtures). Trivial one-liners need no test.",
        "lineStart": 1,
        "lineEnd": 36,
        "totalLines": 36,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346529242,
      "end": 1792346529256
    }
  }
}
read · completed

Input

{
  "filePath": "/source/manifest.json"
}

Output

<path>/source/manifest.json</path>
<type>file</type>
<content>
1: {
2:   "version": 1,
3:   "head": "d44c69f72ab156474197f12b6fc1407b3f8a65c4",
4:   "base": "84cf630e6eedd662d9742fbcd6158a91372e3a56",
5:   "mergeBase": "84cf630e6eedd662d9742fbcd6158a91372e3a56",
6:   "changed": [
7:     {
8:       "status": "M",
9:       "path": ".github/workflows/srsim-tests.yml"
10:     },
11:     {
12:       "status": "M",
13:       "path": "docs/manual/kinds/sros.md"
14:     },
15:     {
16:       "status": "M",
17:       "path": "nodes/sros/README.md"
18:     },
19:     {
20:       "status": "M",
21:       "path": "nodes/sros/chassis_info.go"
22:     },
23:     {
24:       "status": "A",
25:       "path": "nodes/sros/chassis_info_test.go"
26:     },
27:     {
28:       "status": "M",
29:       "path": "nodes/sros/component.go"
30:     },
31:     {
32:       "status": "M",
33:       "path": "nodes/sros/component_config.go"
34:     },
35:     {
36:       "status": "M",
37:       "path": "nodes/sros/config.go"
38:     },
39:     {
40:       "status": "M",
41:       "path": "nodes/sros/netns.go"
42:     },
43:     {
44:       "status": "M",
45:       "path": "nodes/sros/power.go"
46:     },
47:     {
48:       "status": "M",
49:       "path": "nodes/sros/sros.go"
50:     },
51:     {
52:       "status": "M",
53:       "path": "nodes/sros/sros_test.go"
54:     },
55:     {
56:       "status": "M",
57:       "path": "nodes/sros/template.go"
58:     },
59:     {
60:       "status": "M",
61:       "path": "nodes/sros/variant.go"
62:     },
63:     {
64:       "status": "M",
65:       "path": "schemas/clab.schema.json"
66:     },
67:     {
68:       "status": "M",
69:       "path": "tests/13-srsim/01-sros-to-linux.robot"
70:     },
71:     {
72:       "status": "M",
73:       "path": "tests/13-srsim/03-sros-dist-to-linux.robot"
74:     },
75:     {
76:       "status": "M",
77:       "path": "tests/13-srsim/04-sros-classic.robot"
78:     },
79:     {
80:       "status": "M",
81:       "path": "tests/13-srsim/05-sros-comp-to-linux.robot"
82:     },
83:     {
84:       "status": "M",
85:       "path": "tests/13-srsim/06-srsim-sar.robot"
86:     },
87:     {
88:       "status": "M",
89:       "path": "tests/13-srsim/07-srsim-with-mgmt-network.robot"
90:     },
91:     {
92:       "status": "M",
93:       "path": "tests/13-srsim/08-srsim-comp-cfg-test.robot"
94:     },
95:     {
96:       "status": "M",
97:       "path": "tests/13-srsim/09-srsim-pause-container.robot"
98:     },
99:     {
100:       "status": "M",
101:       "path": "tests/13-srsim/10-srsim-lifecycle.robot"
102:     },
103:     {
104:       "status": "M",
105:       "path": "tests/13-srsim/12-srsim-veth-stitch.robot"
106:     },
107:     {
108:       "status": "A",
109:       "path": "tests/13-srsim/13-srsim-integrated.clab.yml"
110:     },
111:     {
112:       "status": "A",
113:       "path": "tests/13-srsim/13-srsim-integrated.robot"
114:     },
115:     {
116:       "status": "A",
117:       "path": "tests/13-srsim/14-srsim-new-chassis.clab.yml"
118:     },
119:     {
120:       "status": "A",
121:       "path": "tests/13-srsim/14-srsim-new-chassis.robot"
122:     },
123:     {
124:       "status": "A",
125:       "path": "tests/srsim.robot"
126:     },
127:     {
128:       "status": "M",
129:       "path": "utils/sros_schema_gen.sh"
130:     }
131:   ],
132:   "files": [
133:     {
134:       "revision": "head",
135:       "path": ".github/workflows/srsim-tests.yml",
136:       "bytes": 4465,
137:       "lines": 141
138:     },
139:     {
140:       "revision": "head",
141:       "path": "docs/manual/kinds/sros.md",
142:       "bytes": 36892,
143:       "lines": 906
144:     },
145:     {
146:       "revision": "head",
147:       "path": "nodes/sros/chassis_info_test.go",
148:       "bytes": 2578,
149:       "lines": 99
150:     },
151:     {
152:       "revision": "head",
153:       "path": "nodes/sros/chassis_info.go",
154:       "bytes": 5820,
155:       "lines": 222
156:     },
157:     {
158:       "revision": "head",
159:       "path": "nodes/sros/component_config.go",
160:       "bytes": 10029,
161:       "lines": 393
162:     },
163:     {
164:       "revision": "head",
165:       "path": "nodes/sros/component.go",
166:       "bytes": 7301,
167:       "lines": 309
168:     },
169:     {
170:       "revision": "head",
171:       "path": "nodes/sros/config.go",
172:       "bytes": 10055,
173:       "lines": 345
174:     },
175:     {
176:       "revision": "head",
177:       "path": "nodes/sros/netns.go",
178:       "bytes": 5099,
179:       "lines": 157
180:     },
181:     {
182:       "revision": "head",
183:       "path": "nodes/sros/power.go",
184:       "bytes": 1613,
185:       "lines": 95
186:     },
187:     {
188:       "revision": "head",
189:       "path": "nodes/sros/README.md",
190:       "bytes": 45346,
191:       "lines": 1582
192:     },
193:     {
194:       "revision": "head",
195:       "path": "nodes/sros/sros_test.go",
196:       "bytes": 42251,
197:       "lines": 1351
198:     },
199:     {
200:       "revision": "head",
201:       "path": "nodes/sros/sros.go",
202:       "bytes": 57207,
203:       "lines": 1910
204:     },
205:     {
206:       "revision": "head",
207:       "path": "nodes/sros/template.go",
208:       "bytes": 2661,
209:       "lines": 99
210:     },
211:     {
212:       "revision": "head",
213:       "path": "nodes/sros/variant.go",
214:       "bytes": 4674,
215:       "lines": 170
216:     },
217:     {
218:       "revision": "head",
219:       "path": "schemas/clab.schema.json",
220:       "bytes": 167017,
221:       "lines": 3969
222:     },
223:     {
224:       "revision": "head",
225:       "path": "tests/13-srsim/01-sros-to-linux.robot",
226:       "bytes": 4315,
227:       "lines": 105
228:     },
229:     {
230:       "revision": "head",
231:       "path": "tests/13-srsim/03-sros-dist-to-linux.robot",
232:       "bytes": 1876,
233:       "lines": 47
234:     },
235:     {
236:       "revision": "head",
237:       "path": "tests/13-srsim/04-sros-classic.robot",
238:       "bytes": 2147,
239:       "lines": 61
240:     },
241:     {
242:       "revision": "head",
243:       "path": "tests/13-srsim/05-sros-comp-to-linux.robot",
244:       "bytes": 6761,
245:       "lines": 139
246:     },
247:     {
248:       "revision": "head",
249:       "path": "tests/13-srsim/06-srsim-sar.robot",
250:       "bytes": 1499,
251:       "lines": 41
252:     },
253:     {
254:       "revision": "head",
255:       "path": "tests/13-srsim/07-srsim-with-mgmt-network.robot",
256:       "bytes": 2497,
257:       "lines": 60
258:     },
259:     {
260:       "revision": "head",
261:       "path": "tests/13-srsim/08-srsim-comp-cfg-test.robot",
262:       "bytes": 7029,
263:       "lines": 135
264:     },
265:     {
266:       "revision": "head",
267:       "path": "tests/13-srsim/09-srsim-pause-container.robot",
268:       "bytes": 7632,
269:       "lines": 166
270:     },
271:     {
272:       "revision": "head",
273:       "path": "tests/13-srsim/10-srsim-lifecycle.robot",
274:       "bytes": 4003,
275:       "lines": 86
276:     },
277:     {
278:       "revision": "head",
279:       "path": "tests/13-srsim/12-srsim-veth-stitch.robot",
280:       "bytes": 4048,
281:       "lines": 106
282:     },
283:     {
284:       "revision": "head",
285:       "path": "tests/13-srsim/13-srsim-integrated.clab.yml",
286:       "bytes": 702,
287:       "lines": 33
288:     },
289:     {
290:       "revision": "head",
291:       "path": "tests/13-srsim/13-srsim-integrated.robot",
292:       "bytes": 4891,
293:       "lines": 105
294:     },
295:     {
296:       "revision": "head",
297:       "path": "tests/13-srsim/14-srsim-new-chassis.clab.yml",
298:       "bytes": 1729,
299:       "lines": 53
300:     },
301:     {
302:       "revision": "head",
303:       "path": "tests/13-srsim/14-srsim-new-chassis.robot",
304:       "bytes": 3552,
305:       "lines": 83
306:     },
307:     {
308:       "revision": "head",
309:       "path": "tests/srsim.robot",
310:       "bytes": 631,
311:       "lines": 20
312:     },
313:     {
314:       "revision": "head",
315:       "path": "utils/sros_schema_gen.sh",
316:       "bytes": 1178,
317:       "lines": 26
318:     },
319:     {
320:       "revision": "head",
321:       "path": "docs/cmd/completion.md",
322:       "bytes": 2336,
323:       "lines": 95
324:     },
325:     {
326:       "revision": "head",
327:       "path": "docs/cmd/deploy.md",
328:       "bytes": 31381,
329:       "lines": 565
330:     },
331:     {
332:       "revision": "head",
333:       "path": "docs/cmd/destroy.md",
334:       "bytes": 3397,
335:       "lines": 98
336:     },
337:     {
338:       "revision": "head",
339:       "path": "docs/cmd/events.md",
340:       "bytes": 5990,
341:       "lines": 89
342:     },
343:     {
344:       "revision": "head",
345:       "path": "docs/cmd/exec.md",
346:       "bytes": 7316,
347:       "lines": 177
348:     },
349:     {
350:       "revision": "head",
351:       "path": "docs/cmd/generate.md",
352:       "bytes": 6005,
353:       "lines": 138
354:     },
355:     {
356:       "revision": "head",
357:       "path": "docs/cmd/graph.md",
358:       "bytes": 7858,
359:       "lines": 188
360:     },
361:     {
362:       "revision": "head",
363:       "path": "docs/cmd/inspect/index.md",
364:       "bytes": 10896,
365:       "lines": 179
366:     },
367:     {
368:       "revision": "head",
369:       "path": "docs/cmd/inspect/interfaces.md",
370:       "bytes": 11201,
371:       "lines": 197
372:     },
373:     {
374:       "revision": "head",
375:       "path": "docs/cmd/redeploy.md",
376:       "bytes": 6085,
377:       "lines": 150
378:     },
379:     {
380:       "revision": "head",
381:       "path": "docs/cmd/restart.md",
382:       "bytes": 1432,
383:       "lines": 64
384:     },
385:     {
386:       "revision": "head",
387:       "path": "docs/cmd/save.md",
388:       "bytes": 6445,
389:       "lines": 133
390:     },
391:     {
392:       "revision": "head",
393:       "path": "docs/cmd/start.md",
394:       "bytes": 2251,
395:       "lines": 76
396:     },
397:     {
398:       "revision": "head",
399:       "path": "docs/cmd/stop.md",
400:       "bytes": 1313,
401:       "lines": 62
402:     },
403:     {
404:       "revision": "head",
405:       "path": "docs/cmd/tools/api-server/start.md",
406:       "bytes": 5581,
407:       "lines": 165
408:     },
409:     {
410:       "revision": "head",
411:       "path": "docs/cmd/tools/api-server/status.md",
412:       "bytes": 4223,
413:       "lines": 105
414:     },
415:     {
416:       "revision": "head",
417:       "path": "docs/cmd/tools/api-server/stop.md",
418:       "bytes": 1836,
419:       "lines": 56
420:     },
421:     {
422:       "revision": "head",
423:       "path": "docs/cmd/tools/cert/ca/create.md",
424:       "bytes": 2206,
425:       "lines": 77
426:     },
427:     {
428:       "revision": "head",
429:       "path": "docs/cmd/tools/cert/sign.md",
430:       "bytes": 2428,
431:       "lines": 79
432:     },
433:     {
434:       "revision": "head",
435:       "path": "docs/cmd/tools/disable-tx-offload.md",
436:       "bytes": 982,
437:       "lines": 25
438:     },
439:     {
440:       "revision": "head",
441:       "path": "docs/cmd/tools/gotty/attach.md",
442:       "bytes": 1904,
443:       "lines": 67
444:     },
445:     {
446:       "revision": "head",
447:       "path": "docs/cmd/tools/gotty/detach.md",
448:       "bytes": 627,
449:       "lines": 29
450:     },
451:     {
452:       "revision": "head",
453:       "path": "docs/cmd/tools/gotty/list.md",
454:       "bytes": 1070,
455:       "lines": 46
456:     },
457:     {
458:       "revision": "head",
459:       "path": "docs/cmd/tools/gotty/reattach.md",
460:       "bytes": 955,
461:       "lines": 26
462:     },
463:     {
464:       "revision": "head",
465:       "path": "docs/cmd/tools/netem/reset.md",
466:       "bytes": 1635,
467:       "lines": 63
468:     },
469:     {
470:       "revision": "head",
471:       "path": "docs/cmd/tools/netem/set.md",
472:       "bytes": 3979,
473:       "lines": 114
474:     },
475:     {
476:       "revision": "head",
477:       "path": "docs/cmd/tools/netem/show.md",
478:       "bytes": 3651,
479:       "lines": 150
480:     },
481:     {
482:       "revision": "head",
483:       "path": "docs/cmd/tools/snapshot/save.md",
484:       "bytes": 1647,
485:       "lines": 75
486:     },
487:     {
488:       "revision": "head",
489:       "path": "docs/cmd/tools/sshx/attach.md",
490:       "bytes": 5194,
491:       "lines": 128
492:     },
493:     {
494:       "revision": "head",
495:       "path": "docs/cmd/tools/sshx/detach.md",
496:       "bytes": 1837,
497:       "lines": 46
498:     },
499:     {
500:       "revision": "head",
501:       "path": "docs/cmd/tools/sshx/list.md",
502:       "bytes": 3662,
503:       "lines": 77
504:     },
505:     {
506:       "revision": "head",
507:       "path": "docs/cmd/tools/sshx/reattach.md",
508:       "bytes": 4593,
509:       "lines": 101
510:     },
511:     {
512:       "revision": "head",
513:       "path": "docs/cmd/tools/veth/create.md",
514:       "bytes": 1890,
515:       "lines": 51
516:     },
517:     {
518:       "revision": "head",
519:       "path": "docs/cmd/tools/vxlan/create.md",
520:       "bytes": 3355,
521:       "lines": 73
522:     },
523:     {
524:       "revision": "head",
525:       "path": "docs/cmd/tools/vxlan/delete.md",
526:       "bytes": 1230,
527:       "lines": 31
528:     },
529:     {
530:       "revision": "head",
531:       "path": "docs/cmd/validate.md",
532:       "bytes": 1785,
533:       "lines": 51
534:     },
535:     {
536:       "revision": "head",
537:       "path": "docs/cmd/version/check.md",
538:       "bytes": 537,
539:       "lines": 21
540:     },
541:     {
542:       "revision": "head",
543:       "path": "docs/cmd/version/index.md",
544:       "bytes": 1011,
545:       "lines": 37
546:     },
547:     {
548:       "revision": "head",
549:       "path": "docs/CNAME",
550:       "bytes": 16,
551:       "lines": 1
552:     },
553:     {
554:       "revision": "head",
555:       "path": "docs/community.md",
556:       "bytes": 26611,
557:       "lines": 360
558:     },
559:     {
560:       "revision": "head",
561:       "path": "docs/htmltest-pr.yml",
562:       "bytes": 678,
563:       "lines": 14
564:     },
565:     {
566:       "revision": "head",
567:       "path": "docs/htmltest-w-github.yml",
568:       "bytes": 1679,
569:       "lines": 31
570:     },
571:     {
572:       "revision": "head",
573:       "path": "docs/htmltest.yml",
574:       "bytes": 2429,
575:       "lines": 49
576:     },
577:     {
578:       "revision": "head",
579:       "path": "docs/images/clabnew.svg",
580:       "bytes": 16299,
581:       "lines": 13
582:     },
583:     {
584:       "revision": "head",
585:       "path": "docs/images/coloured_wordmark.svg",
586:       "bytes": 8031,
587:       "lines": 91
588:     },
589:     {
590:       "revision": "head",
591:       "path": "docs/images/containerlab_dark_no_text.svg",
592:       "bytes": 3589,
593:       "lines": 8
594:     },
595:     {
596:       "revision": "head",
597:       "path": "docs/images/containerlab_export.svg",
598:       "bytes": 8893,
599:       "lines": 33
600:     },
601:     {
602:       "revision": "head",
603:       "path": "docs/images/containerlab_full_white_no_text.svg",
604:       "bytes": 3801,
605:       "lines": 8
606:     },
607:     {
608:       "revision": "head",
609:       "path": "docs/images/containerlab_white_no_text.svg",
610:       "bytes": 3293,
611:       "lines": 8
612:     },
613:     {
614:       "revision": "head",
615:       "path": "docs/images/containerlab-animated-wordmark.svg",
616:       "bytes": 70018,
617:       "lines": 52
618:     },
619:     {
620:       "revision": "head",
621:       "path": "docs/images/favicon.svg",
622:       "bytes": 16378,
623:       "lines": 20
624:     },
625:     {
626:       "revision": "head",
627:       "path": "docs/images/flask.svg",
628:       "bytes": 378,
629:       "lines": 1
630:     },
631:     {
632:       "revision": "head",
633:       "path": "docs/images/gui/browser-sandbox-placeholder.svg",
634:       "bytes": 2220,
635:       "lines": 25
636:     },
637:     {
638:       "revision": "head",
639:       "path": "docs/images/topoviewer-icons/client.svg",
640:       "bytes": 633,
641:       "lines": 1
642:     },
643:     {
644:       "revision": "head",
645:       "path": "docs/images/topoviewer-icons/controller.svg",
646:       "bytes": 768,
647:       "lines": 1
648:     },
649:     {
650:       "revision": "head",
651:       "path": "docs/images/topoviewer-icons/dcgw.svg",
652:       "bytes": 1015,
653:       "lines": 1
654:     },
655:     {
656:       "revision": "head",
657:       "path": "docs/images/topoviewer-icons/pon.svg",
658:       "bytes": 553,
659:       "lines": 1
660:     },
661:     {
662:       "revision": "head",
663:       "path": "docs/images/topoviewer-icons/rgw.svg",
664:       "bytes": 983,
665:       "lines": 1
666:     },
667:     {
668:       "revision": "head",
669:       "path": "docs/images/topoviewer-icons/router.svg",
670:       "bytes": 864,
671:       "lines": 1
672:     },
673:     {
674:       "revision": "head",
675:       "path": "docs/images/topoviewer-icons/server.svg",
676:       "bytes": 744,
677:       "lines": 1
678:     },
679:     {
680:       "revision": "head",
681:       "path": "docs/images/topoviewer-icons/spine.svg",
682:       "bytes": 940,
683:       "lines": 1
684:     },
685:     {
686:       "revision": "head",
687:       "path": "docs/images/topoviewer-icons/switch.svg",
688:       "bytes": 803,
689:       "lines": 1
690:     },
691:     {
692:       "revision": "head",
693:       "path": "docs/index.md",
694:       "bytes": 6778,
695:       "lines": 189
696:     },
697:     {
698:       "revision": "head",
699:       "path": "docs/install.md",
700:       "bytes": 17575,
701:       "lines": 505
702:     },
703:     {
704:       "revision": "head",
705:       "path": "docs/javascripts/instant-reinit.js",
706:       "bytes": 2040,
707:       "lines": 45
708:     },
709:     {
710:       "revision": "head",
711:       "path": "docs/lab-examples/asav01.md",
712:       "bytes": 4137,
713:       "lines": 90
714:     },
715:     {
716:       "revision": "head",
717:       "path": "docs/lab-examples/bgp-vpls-nok-jun.md",
718:       "bytes": 3374,
719:       "lines": 34
720:     },
721:     {
722:       "revision": "head",
723:       "path": "docs/lab-examples/cisco_iol.md",
724:       "bytes": 4368,
725:       "lines": 100
726:     },
727:     {
728:       "revision": "head",
729:       "path": "docs/lab-examples/cvx01.md",
730:       "bytes": 2989,
731:       "lines": 48
732:     },
733:     {
734:       "revision": "head",
735:       "path": "docs/lab-examples/cvx02.md",
736:       "bytes": 2990,
737:       "lines": 49
738:     },
739:     {
740:       "revision": "head",
741:       "path": "docs/lab-examples/ext-bridge.md",
742:       "bytes": 2042,
743:       "lines": 31
744:     },
745:     {
746:       "revision": "head",
747:       "path": "docs/lab-examples/f5bigipve01.md",
748:       "bytes": 4956,
749:       "lines": 118
750:     },
751:     {
752:       "revision": "head",
753:       "path": "docs/lab-examples/freebsd01.md",
754:       "bytes": 3571,
755:       "lines": 76
756:     },
757:     {
758:       "revision": "head",
759:       "path": "docs/lab-examples/frr01.md",
760:       "bytes": 2987,
761:       "lines": 64
762:     },
763:     {
764:       "revision": "head",
765:       "path": "docs/lab-examples/ftdv01.md",
766:       "bytes": 4108,
767:       "lines": 75
768:     },
769:     {
770:       "revision": "head",
771:       "path": "docs/lab-examples/generic_vm01.md",
772:       "bytes": 3201,
773:       "lines": 66
774:     },
775:     {
776:       "revision": "head",
777:       "path": "docs/lab-examples/ixiacone-srl.md",
778:       "bytes": 6827,
779:       "lines": 135
780:     },
781:     {
782:       "revision": "head",
783:       "path": "docs/lab-examples/lab-examples.md",
784:       "bytes": 4334,
785:       "lines": 80
786:     },
787:     {
788:       "revision": "head",
789:       "path": "docs/lab-examples/min-5clos.md",
790:       "bytes": 9340,
791:       "lines": 127
792:     },
793:     {
794:       "revision": "head",
795:       "path": "docs/lab-examples/min-clos.md",
796:       "bytes": 1970,
797:       "lines": 26
798:     },
799:     {
800:       "revision": "head",
801:       "path": "docs/lab-examples/multinode.md",
802:       "bytes": 14610,
803:       "lines": 264
804:     },
805:     {
806:       "revision": "head",
807:       "path": "docs/lab-examples/openbsd01.md",
808:       "bytes": 3615,
809:       "lines": 76
810:     },
811:     {
812:       "revision": "head",
813:       "path": "docs/lab-examples/ost-srl.md",
814:       "bytes": 6005,
815:       "lines": 114
816:     },
817:     {
818:       "revision": "head",
819:       "path": "docs/lab-examples/osvbng01.md",
820:       "bytes": 3109,
821:       "lines": 71
822:     },
823:     {
824:       "revision": "head",
825:       "path": "docs/lab-examples/peering-lab.md",
826:       "bytes": 23285,
827:       "lines": 391
828:     },
829:     {
830:       "revision": "head",
831:       "path": "docs/lab-examples/rare-freertr.md",
832:       "bytes": 1848,
833:       "lines": 31
834:     },
835:     {
836:       "revision": "head",
837:       "path": "docs/lab-examples/single-srl.md",
838:       "bytes": 2261,
839:       "lines": 32
840:     },
841:     {
842:       "revision": "head",
843:       "path": "docs/lab-examples/sr-sim.md",
844:       "bytes": 3766,
845:       "lines": 64
846:     },
847:     {
848:       "revision": "head",
849:       "path": "docs/lab-examples/srl-arcos.md",
850:       "bytes": 2871,
851:       "lines": 52
852:     },
853:     {
854:       "revision": "head",
855:       "path": "docs/lab-examples/srl-ceos.md",
856:       "bytes": 8462,
857:       "lines": 211
858:     },
859:     {
860:       "revision": "head",
861:       "path": "docs/lab-examples/srl-cjunosevolved.md",
862:       "bytes": 2674,
863:       "lines": 43
864:     },
865:     {
866:       "revision": "head",
867:       "path": "docs/lab-examples/srl-crpd.md",
868:       "bytes": 9443,
869:       "lines": 181
870:     },
871:     {
872:       "revision": "head",
873:       "path": "docs/lab-examples/srl-frr.md",
874:       "bytes": 3163,
875:       "lines": 33
876:     },
877:     {
878:       "revision": "head",
879:       "path": "docs/lab-examples/srl-sonic.md",
880:       "bytes": 9521,
881:       "lines": 193
882:     },
883:     {
884:       "revision": "head",
885:       "path": "docs/lab-examples/srl-vjunos-switch.md",
886:       "bytes": 1886,
887:       "lines": 24
888:     },
889:     {
890:       "revision": "head",
891:       "path": "docs/lab-examples/srl-vjunosevolved.md",
892:       "bytes": 1891,
893:       "lines": 24
894:     },
895:     {
896:       "revision": "head",
897:       "path": "docs/lab-examples/srl-xrd.md",
898:       "bytes": 2877,
899:       "lines": 49
900:     },
901:     {
902:       "revision": "head",
903:       "path": "docs/lab-examples/templated01.md",
904:       "bytes": 2516,
905:       "lines": 56
906:     },
907:     {
908:       "revision": "head",
909:       "path": "docs/lab-examples/templated02.md",
910:       "bytes": 2792,
911:       "lines": 68
912:     },
913:     {
914:       "revision": "head",
915:       "path": "docs/lab-examples/two-srls.md",
916:       "bytes": 3098,
917:       "lines": 47
918:     },
919:     {
920:       "revision": "head",
921:       "path": "docs/lab-examples/vr-sros.md",
922:       "bytes": 2506,
923:       "lines": 28
924:     },
925:     {
926:       "revision": "head",
927:       "path": "docs/lab-examples/vr-vmx.md",
928:       "bytes": 2523,
929:       "lines": 30
930:     },
931:     {
932:       "revision": "head",
933:       "path": "docs/lab-examples/vr-xrv.md",
934:       "bytes": 2419,
935:       "lines": 27
936:     },
937:     {
938:       "revision": "head",
939:       "path": "docs/lab-examples/vr-xrv9k.md",
940:       "bytes": 2441,
941:       "lines": 27
942:     },
943:     {
944:       "revision": "head",
945:       "path": "docs/lab-examples/vsrx01.md",
946:       "bytes": 4497,
947:       "lines": 90
948:     },
949:     {
950:       "revision": "head",
951:       "path": "docs/lab-examples/wan.md",
952:       "bytes": 1820,
953:       "lines": 24
954:     },
955:     {
956:       "revision": "head",
957:       "path": "docs/macos.md",
958:       "bytes": 17237,
959:       "lines": 251
960:     },
961:     {
962:       "revision": "head",
963:       "path": "docs/manual/api-server.md",
964:       "bytes": 7871,
965:       "lines": 223
966:     },
967:     {
968:       "revision": "head",
969:       "path": "docs/manual/cert.md",
970:       "bytes": 3472,
971:       "lines": 59
972:     },
973:     {
974:       "revision": "head",
975:       "path": "docs/manual/clabernetes/index.md",
976:       "bytes": 990,
977:       "lines": 18
978:     },
979:     {
980:       "revision": "head",
981:       "path": "docs/manual/clabernetes/runtime.md",
982:       "bytes": 34317,
983:       "lines": 888
984:     },
985:     {
986:       "revision": "head",
987:       "path": "docs/manual/codespaces.md",
988:       "bytes": 20644,
989:       "lines": 318
990:     },
991:     {
992:       "revision": "head",
993:       "path": "docs/manual/conf-artifacts.md",
994:       "bytes": 3196,
995:       "lines": 54
996:     },
997:     {
998:       "revision": "head",
999:       "path": "docs/manual/config-mgmt.md",
1000:       "bytes": 12920,
1001:       "lines": 311
1002:     },
1003:     {
1004:       "revision": "head",
1005:       "path": "docs/manual/dev/debug.md",
1006:       "bytes": 5255,
1007:       "lines": 133
1008:     },
1009:     {
1010:       "revision": "head",
1011:       "path": "docs/manual/dev/doc.md",
1012:       "bytes": 4366,
1013:       "lines": 55
1014:     },
1015:     {
1016:       "revision": "head",
1017:       "path": "docs/manual/dev/index.md",
1018:       "bytes": 1170,
1019:       "lines": 21
1020:     },
1021:     {
1022:       "revision": "head",
1023:       "path": "docs/manual/dev/test.md",
1024:       "bytes": 4069,
1025:       "lines": 100
1026:     },
1027:     {
1028:       "revision": "head",
1029:       "path": "docs/manual/gui/desktop.md",
1030:       "bytes": 5381,
1031:       "lines": 130
1032:     },
1033:     {
1034:       "revision": "head",
1035:       "path": "docs/manual/gui/index.md",
1036:       "bytes": 16398,
1037:       "lines": 314
1038:     },
1039:     {
1040:       "revision": "head",
1041:       "path": "docs/manual/gui/vsc-extension.md",
1042:       "bytes": 9060,
1043:       "lines": 202
1044:     },
1045:     {
1046:       "revision": "head",
1047:       "path": "docs/manual/gui/web.md",
1048:       "bytes": 6617,
1049:       "lines": 178
1050:     },
1051:     {
1052:       "revision": "head",
1053:       "path": "docs/manual/images.md",
1054:       "bytes": 5119,
1055:       "lines": 108
1056:     },
1057:     {
1058:       "revision": "head",
1059:       "path": "docs/manual/impairments.md",
1060:       "bytes": 881,
1061:       "lines": 20
1062:     },
1063:     {
1064:       "revision": "head",
1065:       "path": "docs/manual/inventory.md",
1066:       "bytes": 11726,
1067:       "lines": 398
1068:     },
1069:     {
1070:       "revision": "head",
1071:       "path": "docs/manual/kinds/6wind_vsr.md",
1072:       "bytes": 9464,
1073:       "lines": 208
1074:     },
1075:     {
1076:       "revision": "head",
1077:       "path": "docs/manual/kinds/arrcus_arcos.md",
1078:       "bytes": 4185,
1079:       "lines": 134
1080:     },
1081:     {
1082:       "revision": "head",
1083:       "path": "docs/manual/kinds/bridge.md",
1084:       "bytes": 5527,
1085:       "lines": 123
1086:     },
1087:     {
1088:       "revision": "head",
1089:       "path": "docs/manual/kinds/c8000.md",
1090:       "bytes": 5477,
1091:       "lines": 151
1092:     },
1093:     {
1094:       "revision": "head",
1095:       "path": "docs/manual/kinds/ceos.md",
1096:       "bytes": 22395,
1097:       "lines": 548
1098:     },
1099:     {
1100:       "revision": "head",
1101:       "path": "docs/manual/kinds/checkpoint_cloudguard.md",
1102:       "bytes": 2694,
1103:       "lines": 60
1104:     },
1105:     {
1106:       "revision": "head",
1107:       "path": "docs/manual/kinds/ciena_saos.md",
1108:       "bytes": 8268,
1109:       "lines": 244
1110:     },
1111:     {
1112:       "revision": "head",
1113:       "path": "docs/manual/kinds/cisco_asav.md",
1114:       "bytes": 4142,
1115:       "lines": 95
1116:     },
1117:     {
1118:       "revision": "head",
1119:       "path": "docs/manual/kinds/cisco_iol.md",
1120:       "bytes": 11889,
1121:       "lines": 269
1122:     },
1123:     {
1124:       "revision": "head",
1125:       "path": "docs/manual/kinds/cisco_sdwan.md",
1126:       "bytes": 6415,
1127:       "lines": 280
1128:     },
1129:     {
1130:       "revision": "head",
1131:       "path": "docs/manual/kinds/cisco_vios.md",
1132:       "bytes": 3734,
1133:       "lines": 95
1134:     },
1135:     {
1136:       "revision": "head",
1137:       "path": "docs/manual/kinds/cisco_xrd_vrouter.md",
1138:       "bytes": 5916,
1139:       "lines": 139
1140:     },
1141:     {
1142:       "revision": "head",
1143:       "path": "docs/manual/kinds/cjunosevolved.md",
1144:       "bytes": 7017,
1145:       "lines": 150
1146:     },
1147:     {
1148:       "revision": "head",
1149:       "path": "docs/manual/kinds/crpd.md",
1150:       "bytes": 8048,
1151:       "lines": 191
1152:     },
1153:     {
1154:       "revision": "head",
1155:       "path": "docs/manual/kinds/csrx.md",
1156:       "bytes": 6460,
1157:       "lines": 176
1158:     },
1159:     {
1160:       "revision": "head",
1161:       "path": "docs/manual/kinds/dell_sonic.md",
1162:       "bytes": 3154,
1163:       "lines": 95
1164:     },
1165:     {
1166:       "revision": "head",
1167:       "path": "docs/manual/kinds/ext-container.md",
1168:       "bytes": 2729,
1169:       "lines": 64
1170:     },
1171:     {
1172:       "revision": "head",
1173:       "path": "docs/manual/kinds/f5_bigipve.md",
1174:       "bytes": 8997,
1175:       "lines": 220
1176:     },
1177:     {
1178:       "revision": "head",
1179:       "path": "docs/manual/kinds/fdio_vpp.md",
1180:       "bytes": 10759,
1181:       "lines": 225
1182:     },
1183:     {
1184:       "revision": "head",
1185:       "path": "docs/manual/kinds/fortinet_fortigate.md",
1186:       "bytes": 3737,
1187:       "lines": 81
1188:     },
1189:     {
1190:       "revision": "head",
1191:       "path": "docs/manual/kinds/freebsd.md",
1192:       "bytes": 4052,
1193:       "lines": 95
1194:     },
1195:     {
1196:       "revision": "head",
1197:       "path": "docs/manual/kinds/frr.md",
1198:       "bytes": 7504,
1199:       "lines": 151
1200:     },
1201:     {
1202:       "revision": "head",
1203:       "path": "docs/manual/kinds/generic_vm.md",
1204:       "bytes": 3133,
1205:       "lines": 87
1206:     },
1207:     {
1208:       "revision": "head",
1209:       "path": "docs/manual/kinds/host.md",
1210:       "bytes": 1105,
1211:       "lines": 24
1212:     },
1213:     {
1214:       "revision": "head",
1215:       "path": "docs/manual/kinds/huawei_vrp.md",
1216:       "bytes": 4188,
1217:       "lines": 88
1218:     },
1219:     {
1220:       "revision": "head",
1221:       "path": "docs/manual/kinds/index.md",
1222:       "bytes": 8558,
1223:       "lines": 104
1224:     },
1225:     {
1226:       "revision": "head",
1227:       "path": "docs/manual/kinds/ipinfusion-ocnos.md",
1228:       "bytes": 2248,
1229:       "lines": 54
1230:     },
1231:     {
1232:       "revision": "head",
1233:       "path": "docs/manual/kinds/k8s-kind.md",
1234:       "bytes": 6322,
1235:       "lines": 141
1236:     },
1237:     {
1238:       "revision": "head",
1239:       "path": "docs/manual/kinds/keysight_ixia-c-one.md",
1240:       "bytes": 3228,
1241:       "lines": 68
1242:     },
1243:     {
1244:       "revision": "head",
1245:       "path": "docs/manual/kinds/linux.md",
1246:       "bytes": 2960,
1247:       "lines": 55
1248:     },
1249:     {
1250:       "revision": "head",
1251:       "path": "docs/manual/kinds/nvidia_cumulusvx.md",
1252:       "bytes": 4019,
1253:       "lines": 106
1254:     },
1255:     {
1256:       "revision": "head",
1257:       "path": "docs/manual/kinds/openbsd.md",
1258:       "bytes": 4034,
1259:       "lines": 95
1260:     },
1261:     {
1262:       "revision": "head",
1263:       "path": "docs/manual/kinds/openwrt.md",
1264:       "bytes": 1725,
1265:       "lines": 37
1266:     },
1267:     {
1268:       "revision": "head",
1269:       "path": "docs/manual/kinds/ostinato.md",
1270:       "bytes": 3594,
1271:       "lines": 95
1272:     },
1273:     {
1274:       "revision": "head",
1275:       "path": "docs/manual/kinds/ovs-bridge.md",
1276:       "bytes": 1997,
1277:       "lines": 53
1278:     },
1279:     {
1280:       "revision": "head",
1281:       "path": "docs/manual/kinds/plvision_sonic.md",
1282:       "bytes": 3542,
1283:       "lines": 84
1284:     },
1285:     {
1286:       "revision": "head",
1287:       "path": "docs/manual/kinds/rare-freertr.md",
1288:       "bytes": 6044,
1289:       "lines": 170
1290:     },
1291:     {
1292:       "revision": "head",
1293:       "path": "docs/manual/kinds/sonic-vm.md",
1294:       "bytes": 5902,
1295:       "lines": 145
1296:     },
1297:     {
1298:       "revision": "head",
1299:       "path": "docs/manual/kinds/sonic-vs.md",
1300:       "bytes": 3737,
1301:       "lines": 78
1302:     },
1303:     {
1304:       "revision": "head",
1305:       "path": "docs/manual/kinds/spirent_stc.md",
1306:       "bytes": 3762,
1307:       "lines": 116
1308:     },
1309:     {
1310:       "revision": "head",
1311:       "path": "docs/manual/kinds/srl.md",
1312:       "bytes": 25640,
1313:       "lines": 577
1314:     },
1315:     {
1316:       "revision": "head",
1317:       "path": "docs/manual/kinds/veesix_osvbng.md",
1318:       "bytes": 3889,
1319:       "lines": 124
1320:     },
1321:     {
1322:       "revision": "head",
1323:       "path": "docs/manual/kinds/vr-aoscx.md",
1324:       "bytes": 3329,
1325:       "lines": 73
1326:     },
1327:     {
1328:       "revision": "head",
1329:       "path": "docs/manual/kinds/vr-c8000v.md",
1330:       "bytes": 6882,
1331:       "lines": 188
1332:     },
1333:     {
1334:       "revision": "head",
1335:       "path": "docs/manual/kinds/vr-cat9kv.md",
1336:       "bytes": 6835,
1337:       "lines": 170
1338:     },
1339:     {
1340:       "revision": "head",
1341:       "path": "docs/manual/kinds/vr-csr.md",
1342:       "bytes": 4119,
1343:       "lines": 86
1344:     },
1345:     {
1346:       "revision": "head",
1347:       "path": "docs/manual/kinds/vr-ftdv.md",
1348:       "bytes": 3343,
1349:       "lines": 79
1350:     },
1351:     {
1352:       "revision": "head",
1353:       "path": "docs/manual/kinds/vr-ftosv.md",
1354:       "bytes": 3557,
1355:       "lines": 79
1356:     },
1357:     {
1358:       "revision": "head",
1359:       "path": "docs/manual/kinds/vr-n9kv.md",
1360:       "bytes": 4790,
1361:       "lines": 123
1362:     },
1363:     {
1364:       "revision": "head",
1365:       "path": "docs/manual/kinds/vr-pan.md",
1366:       "bytes": 3372,
1367:       "lines": 86
1368:     },
1369:     {
1370:       "revision": "head",
1371:       "path": "docs/manual/kinds/vr-ros.md",
1372:       "bytes": 3912,
1373:       "lines": 83
1374:     },
1375:     {
1376:       "revision": "head",
1377:       "path": "docs/manual/kinds/vr-sros.md",
1378:       "bytes": 22067,
1379:       "lines": 505
1380:     },
1381:     {
1382:       "revision": "head",
1383:       "path": "docs/manual/kinds/vr-veos.md",
1384:       "bytes": 4126,
1385:       "lines": 94
1386:     },
1387:     {
1388:       "revision": "head",
1389:       "path": "docs/manual/kinds/vr-vjunosevolved.md",
1390:       "bytes": 5141,
1391:       "lines": 107
1392:     },
1393:     {
1394:       "revision": "head",
1395:       "path": "docs/manual/kinds/vr-vjunosrouter.md",
1396:       "bytes": 5140,
1397:       "lines": 103
1398:     },
1399:     {
1400:       "revision": "head",
1401:       "path": "docs/manual/kinds/vr-vjunosswitch.md",
1402:       "bytes": 5110,
1403:       "lines": 108
1404:     },
1405:     {
1406:       "revision": "head",
1407:       "path": "docs/manual/kinds/vr-vmx.md",
1408:       "bytes": 5371,
1409:       "lines": 121
1410:     },
1411:     {
1412:       "revision": "head",
1413:       "path": "docs/manual/kinds/vr-vqfx.md",
1414:       "bytes": 4053,
1415:       "lines": 90
1416:     },
1417:     {
1418:       "revision": "head",
1419:       "path": "docs/manual/kinds/vr-vsrx.md",
1420:       "bytes": 4053,
1421:       "lines": 89
1422:     },
1423:     {
1424:       "revision": "head",
1425:       "path": "docs/manual/kinds/vr-xrv.md",
1426:       "bytes": 4029,
1427:       "lines": 100
1428:     },
1429:     {
1430:       "revision": "head",
1431:       "path": "docs/manual/kinds/vr-xrv9k.md",
1432:       "bytes": 5157,
1433:       "lines": 120
1434:     },
1435:     {
1436:       "revision": "head",
1437:       "path": "docs/manual/kinds/vyosnetworks_vyos.md",
1438:       "bytes": 6643,
1439:       "lines": 187
1440:     },
1441:     {
1442:       "revision": "head",
1443:       "path": "docs/manual/kinds/xrd.md",
1444:       "bytes": 7951,
1445:       "lines": 177
1446:     },
1447:     {
1448:       "revision": "head",
1449:       "path": "docs/manual/multi-node.md",
1450:       "bytes": 6089,
1451:       "lines": 72
1452:     },
1453:     {
1454:       "revision": "head",
1455:       "path": "docs/manual/network.md",
1456:       "bytes": 40210,
1457:       "lines": 835
1458:     },
1459:     {
1460:       "revision": "head",
1461:       "path": "docs/manual/node-filtering.md",
1462:       "bytes": 3517,
1463:       "lines": 66
1464:     },
1465:     {
1466:       "revision": "head",
1467:       "path": "docs/manual/nodes.md",
1468:       "bytes": 44445,
1469:       "lines": 1205
1470:     },
1471:     {
1472:       "revision": "head",
1473:       "path": "docs/manual/s3-usage-example.md",
1474:       "bytes": 1446,
1475:       "lines": 61
1476:     },
1477:     {
1478:       "revision": "head",
1479:       "path": "docs/manual/share-access.md",
1480:       "bytes": 8219,
1481:       "lines": 150
1482:     },
1483:     {
1484:       "revision": "head",
1485:       "path": "docs/manual/topo-def-file.md",
1486:       "bytes": 37253,
1487:       "lines": 903
1488:     },
1489:     {
1490:       "revision": "head",
1491:       "path": "docs/manual/vrnetlab.md",
1492:       "bytes": 30525,
1493:       "lines": 270
1494:     },
1495:     {
1496:       "revision": "head",
1497:       "path": "docs/manual/wireshark.md",
1498:       "bytes": 16256,
1499:       "lines": 326
1500:     },
1501:     {
1502:       "revision": "head",
1503:       "path": "docs/quickstart.md",
1504:       "bytes": 10387,
1505:       "lines": 207
1506:     },
1507:     {
1508:       "revision": "head",
1509:       "path": "docs/rn/0.11.0.md",
1510:       "bytes": 5330,
1511:       "lines": 71
1512:     },
1513:     {
1514:       "revision": "head",
1515:       "path": "docs/rn/0.12.0.md",
1516:       "bytes": 4928,
1517:       "lines": 75
1518:     },
1519:     {
1520:       "revision": "head",
1521:       "path": "docs/rn/0.13.0.md",
1522:       "bytes": 1772,
1523:       "lines": 30
1524:     },
1525:     {
1526:       "revision": "head",
1527:       "path": "docs/rn/0.14.0.md",
1528:       "bytes": 2612,
1529:       "lines": 35
1530:     },
1531:     {
1532:       "revision": "head",
1533:       "path": "docs/rn/0.14.1.md",
1534:       "bytes": 177,
1535:       "lines": 5
1536:     },
1537:     {
1538:       "revision": "head",
1539:       "path": "docs/rn/0.14.2.md",
1540:       "bytes": 301,
1541:       "lines": 5
1542:     },
1543:     {
1544:       "revision": "head",
1545:       "path": "docs/rn/0.14.3.md",
1546:       "bytes": 317,
1547:       "lines": 9
1548:     },
1549:     {
1550:       "revision": "head",
1551:       "path": "docs/rn/0.14.4.md",
1552:       "bytes": 286,
1553:       "lines": 9
1554:     },
1555:     {
1556:       "revision": "head",
1557:       "path": "docs/rn/0.15.md",
1558:       "bytes": 3827,
1559:       "lines": 69
1560:     },
1561:     {
1562:       "revision": "head",
1563:       "path": "docs/rn/0.16.md",
1564:       "bytes": 3480,
1565:       "lines": 65
1566:     },
1567:     {
1568:       "revision": "head",
1569:       "path": "docs/rn/0.17.md",
1570:       "bytes": 3356,
1571:       "lines": 41
1572:     },
1573:     {
1574:       "revision": "head",
1575:       "path": "docs/rn/0.18.md",
1576:       "bytes": 1527,
1577:       "lines": 34
1578:     },
1579:     {
1580:       "revision": "head",
1581:       "path": "docs/rn/0.19.md",
1582:       "bytes": 2470,
1583:       "lines": 48
1584:     },
1585:     {
1586:       "revision": "head",
1587:       "path": "docs/rn/0.20.md",
1588:       "bytes": 2146,
1589:       "lines": 33
1590:     },
1591:     {
1592:       "revision": "head",
1593:       "path": "docs/rn/0.21.md",
1594:       "bytes": 2459,
1595:       "lines": 48
1596:     },
1597:     {
1598:       "revision": "head",
1599:       "path": "docs/rn/0.22.md",
1600:       "bytes": 1806,
1601:       "lines": 27
1602:     },
1603:     {
1604:       "revision": "head",
1605:       "path": "docs/rn/0.23.md",
1606:       "bytes": 1835,
1607:       "lines": 35
1608:     },
1609:     {
1610:       "revision": "head",
1611:       "path": "docs/rn/0.24.md",
1612:       "bytes": 3490,
1613:       "lines": 51
1614:     },
1615:     {
1616:       "revision": "head",
1617:       "path": "docs/rn/0.25.md",
1618:       "bytes": 2105,
1619:       "lines": 37
1620:     },
1621:     {
1622:       "revision": "head",
1623:       "path": "docs/rn/0.26.md",
1624:       "bytes": 5078,
1625:       "lines": 88
1626:     },
1627:     {
1628:       "revision": "head",
1629:       "path": "docs/rn/0.27.md",
1630:       "bytes": 947,
1631:       "lines": 21
1632:     },
1633:     {
1634:       "revision": "head",
1635:       "path": "docs/rn/0.28.md",
1636:       "bytes": 1382,
1637:       "lines": 32
1638:     },
1639:     {
1640:       "revision": "head",
1641:       "path": "docs/rn/0.29.md",
1642:       "bytes": 750,
1643:       "lines": 13
1644:     },
1645:     {
1646:       "revision": "head",
1647:       "path": "docs/rn/0.30.md",
1648:       "bytes": 566,
1649:       "lines": 14
1650:     },
1651:     {
1652:       "revision": "head",
1653:       "path": "docs/rn/0.31.md",
1654:       "bytes": 1710,
1655:       "lines": 30
1656:     },
1657:     {
1658:       "revision": "head",
1659:       "path": "docs/rn/0.32.md",
1660:       "bytes": 2075,
1661:       "lines": 45
1662:     },
1663:     {
1664:       "revision": "head",
1665:       "path": "docs/rn/0.33.md",
1666:       "bytes": 893,
1667:       "lines": 22
1668:     },
1669:     {
1670:       "revision": "head",
1671:       "path": "docs/rn/0.34.md",
1672:       "bytes": 1019,
1673:       "lines": 23
1674:     },
1675:     {
1676:       "revision": "head",
1677:       "path": "docs/rn/0.35.md",
1678:       "bytes": 876,
1679:       "lines": 29
1680:     },
1681:     {
1682:       "revision": "head",
1683:       "path": "docs/rn/0.36.md",
1684:       "bytes": 868,
1685:       "lines": 23
1686:     },
1687:     {
1688:       "revision": "head",
1689:       "path": "docs/rn/0.37.md",
1690:       "bytes": 1990,
1691:       "lines": 38
1692:     },
1693:     {
1694:       "revision": "head",
1695:       "path": "docs/rn/0.38.md",
1696:       "bytes": 881,
1697:       "lines": 18
1698:     },
1699:     {
1700:       "revision": "head",
1701:       "path": "docs/rn/0.39.md",
1702:       "bytes": 3693,
1703:       "lines": 101
1704:     },
1705:     {
1706:       "revision": "head",
1707:       "path": "docs/rn/0.40.md",
1708:       "bytes": 732,
1709:       "lines": 15
1710:     },
1711:     {
1712:       "revision": "head",
1713:       "path": "docs/rn/0.41.md",
1714:       "bytes": 4520,
1715:       "lines": 88
1716:     },
1717:     {
1718:       "revision": "head",
1719:       "path": "docs/rn/0.42.md",
1720:       "bytes": 955,
1721:       "lines": 15
1722:     },
1723:     {
1724:       "revision": "head",
1725:       "path": "docs/rn/0.43.md",
1726:       "bytes": 3478,
1727:       "lines": 90
1728:     },
1729:     {
1730:       "revision": "head",
1731:       "path": "docs/rn/0.44.md",
1732:       "bytes": 2213,
1733:       "lines": 54
1734:     },
1735:     {
1736:       "revision": "head",
1737:       "path": "docs/rn/0.45.md",
1738:       "bytes": 1807,
1739:       "lines": 32
1740:     },
1741:     {
1742:       "revision": "head",
1743:       "path": "docs/rn/0.46.md",
1744:       "bytes": 3260,
1745:       "lines": 98
1746:     },
1747:     {
1748:       "revision": "head",
1749:       "path": "docs/rn/0.47.md",
1750:       "bytes": 2333,
1751:       "lines": 46
1752:     },
1753:     {
1754:       "revision": "head",
1755:       "path": "docs/rn/0.48.md",
1756:       "bytes": 4072,
1757:       "lines": 75
1758:     },
1759:     {
1760:       "revision": "head",
1761:       "path": "docs/rn/0.49.md",
1762:       "bytes": 1541,
1763:       "lines": 30
1764:     },
1765:     {
1766:       "revision": "head",
1767:       "path": "docs/rn/0.50.md",
1768:       "bytes": 3606,
1769:       "lines": 54
1770:     },
1771:     {
1772:       "revision": "head",
1773:       "path": "docs/rn/0.51.md",
1774:       "bytes": 2871,
1775:       "lines": 68
1776:     },
1777:     {
1778:       "revision": "head",
1779:       "path": "docs/rn/0.52.md",
1780:       "bytes": 3179,
1781:       "lines": 65
1782:     },
1783:     {
1784:       "revision": "head",
1785:       "path": "docs/rn/0.53.md",
1786:       "bytes": 1282,
1787:       "lines": 27
1788:     },
1789:     {
1790:       "revision": "head",
1791:       "path": "docs/rn/0.54.md",
1792:       "bytes": 942,
1793:       "lines": 26
1794:     },
1795:     {
1796:       "revision": "head",
1797:       "path": "docs/rn/0.55.md",
1798:       "bytes": 3026,
1799:       "lines": 77
1800:     },
1801:     {
1802:       "revision": "head",
1803:       "path": "docs/rn/0.56.md",
1804:       "bytes": 2575,
1805:       "lines": 46
1806:     },
1807:     {
1808:       "revision": "head",
1809:       "path": "docs/rn/0.57.md",
1810:       "bytes": 2466,
1811:       "lines": 56
1812:     },
1813:     {
1814:       "revision": "head",
1815:       "path": "docs/rn/0.58.md",
1816:       "bytes": 1868,
1817:       "lines": 30
1818:     },
1819:     {
1820:       "revision": "head",
1821:       "path": "docs/rn/0.59.md",
1822:       "bytes": 1494,
1823:       "lines": 34
1824:     },
1825:     {
1826:       "revision": "head",
1827:       "path": "docs/rn/0.60.md",
1828:       "bytes": 10022,
1829:       "lines": 135
1830:     },
1831:     {
1832:       "revision": "head",
1833:       "path": "docs/rn/0.61.md",
1834:       "bytes": 2588,
1835:       "lines": 45
1836:     },
1837:     {
1838:       "revision": "head",
1839:       "path": "docs/rn/0.62.md",
1840:       "bytes": 2915,
1841:       "lines": 54
1842:     },
1843:     {
1844:       "revision": "head",
1845:       "path": "docs/rn/0.63.md",
1846:       "bytes": 2182,
1847:       "lines": 46
1848:     },
1849:     {
1850:       "revision": "head",
1851:       "path": "docs/rn/0.64.md",
1852:       "bytes": 5000,
1853:       "lines": 45
1854:     },
1855:     {
1856:       "revision": "head",
1857:       "path": "docs/rn/0.65.md",
1858:       "bytes": 1622,
1859:       "lines": 41
1860:     },
1861:     {
1862:       "revision": "head",
1863:       "path": "docs/rn/0.66.md",
1864:       "bytes": 897,
1865:       "lines": 21
1866:     },
1867:     {
1868:       "revision": "head",
1869:       "path": "docs/rn/0.67.md",
1870:       "bytes": 1394,
1871:       "lines": 23
1872:     },
1873:     {
1874:       "revision": "head",
1875:       "path": "docs/rn/0.68.md",
1876:       "bytes": 2604,
1877:       "lines": 40
1878:     },
1879:     {
1880:       "revision": "head",
1881:       "path": "docs/rn/0.69.md",
1882:       "bytes": 5732,
1883:       "lines": 117
1884:     },
1885:     {
1886:       "revision": "head",
1887:       "path": "docs/rn/0.70.md",
1888:       "bytes": 3389,
1889:       "lines": 64
1890:     },
1891:     {
1892:       "revision": "head",
1893:       "path": "docs/rn/0.71.md",
1894:       "bytes": 5144,
1895:       "lines": 120
1896:     },
1897:     {
1898:       "revision": "head",
1899:       "path": "docs/rn/0.72.md",
1900:       "bytes": 3663,
1901:       "lines": 62
1902:     },
1903:     {
1904:       "revision": "head",
1905:       "path": "docs/rn/0.73.md",
1906:       "bytes": 6239,
1907:       "lines": 96
1908:     },
1909:     {
1910:       "revision": "head",
1911:       "path": "docs/rn/0.74.md",
1912:       "bytes": 6031,
1913:       "lines": 94
1914:     },
1915:     {
1916:       "revision": "head",
1917:       "path": "docs/rn/0.75.md",
1918:       "bytes": 5768,
1919:       "lines": 78
1920:     },
1921:     {
1922:       "revision": "head",
1923:       "path": "docs/rn/0.76.md",
1924:       "bytes": 4557,
1925:       "lines": 69
1926:     },
1927:     {
1928:       "revision": "head",
1929:       "path": "docs/rn/0.77.md",
1930:       "bytes": 3761,
1931:       "lines": 71
1932:     },
1933:     {
1934:       "revision": "head",
1935:       "path": "docs/rn/0.78.md",
1936:       "bytes": 5580,
1937:       "lines": 118
1938:     },
1939:     {
1940:       "revision": "head",
1941:       "path": "docs/rn/0.79.md",
1942:       "bytes": 3853,
1943:       "lines": 96
1944:     },
1945:     {
1946:       "revision": "head",
1947:       "path": "docs/rn/0.80.md",
1948:       "bytes": 15226,
1949:       "lines": 280
1950:     },
1951:     {
1952:       "revision": "head",
1953:       "path": "docs/rn/0.81.md",
1954:       "bytes": 5387,
1955:       "lines": 98
1956:     },
1957:     {
1958:       "revision": "head",
1959:       "path": "docs/stylesheets/extra.css",
1960:       "bytes": 19354,
1961:       "lines": 750
1962:     },
1963:     {
1964:       "revision": "head",
1965:       "path": "docs/windows.md",
1966:       "bytes": 10218,
1967:       "lines": 225
1968:     },
1969:     {
1970:       "revision": "head",
1971:       "path": ".cursor/rules/git-mutations.mdc",
1972:       "bytes": 403,
1973:       "lines": 10
1974:     },
1975:     {
1976:       "revision": "head",
1977:       "path": ".cursor/rules/karpathy-guidelines.mdc",
1978:       "bytes": 2643,
1979:       "lines": 75
1980:     },
1981:     {
1982:       "revision": "head",
1983:       "path": ".cursor/rules/ponytail.mdc",
1984:       "bytes": 2620,
1985:       "lines": 36
1986:     },
1987:     {
1988:       "revision": "head",
1989:       "path": ".cursor/rules/release-note-review.mdc",
1990:       "bytes": 472,
1991:       "lines": 12
1992:     },
1993:     {
1994:       "revision": "head",
1995:       "path": ".cursor/skills/refresh-nix-vendor-hash/SKILL.md",
1996:       "bytes": 2916,
1997:       "lines": 89
1998:     },
1999:     {
2000:       "revision": "head",

(Showing lines 1-2000 of 15645. Use offset=2001 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502d9e0e001UG0cuBrlTiGui2",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502d9a31001syzcYf80k0jjc3",
  "callID": "call_d503585ce0bd463c945fff06",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/manifest.json"
    },
    "output": "<path>/source/manifest.json</path>\n<type>file</type>\n<content>\n1: {\n2:   \"version\": 1,\n3:   \"head\": \"d44c69f72ab156474197f12b6fc1407b3f8a65c4\",\n4:   \"base\": \"84cf630e6eedd662d9742fbcd6158a91372e3a56\",\n5:   \"mergeBase\": \"84cf630e6eedd662d9742fbcd6158a91372e3a56\",\n6:   \"changed\": [\n7:     {\n8:       \"status\": \"M\",\n9:       \"path\": \".github/workflows/srsim-tests.yml\"\n10:     },\n11:     {\n12:       \"status\": \"M\",\n13:       \"path\": \"docs/manual/kinds/sros.md\"\n14:     },\n15:     {\n16:       \"status\": \"M\",\n17:       \"path\": \"nodes/sros/README.md\"\n18:     },\n19:     {\n20:       \"status\": \"M\",\n21:       \"path\": \"nodes/sros/chassis_info.go\"\n22:     },\n23:     {\n24:       \"status\": \"A\",\n25:       \"path\": \"nodes/sros/chassis_info_test.go\"\n26:     },\n27:     {\n28:       \"status\": \"M\",\n29:       \"path\": \"nodes/sros/component.go\"\n30:     },\n31:     {\n32:       \"status\": \"M\",\n33:       \"path\": \"nodes/sros/component_config.go\"\n34:     },\n35:     {\n36:       \"status\": \"M\",\n37:       \"path\": \"nodes/sros/config.go\"\n38:     },\n39:     {\n40:       \"status\": \"M\",\n41:       \"path\": \"nodes/sros/netns.go\"\n42:     },\n43:     {\n44:       \"status\": \"M\",\n45:       \"path\": \"nodes/sros/power.go\"\n46:     },\n47:     {\n48:       \"status\": \"M\",\n49:       \"path\": \"nodes/sros/sros.go\"\n50:     },\n51:     {\n52:       \"status\": \"M\",\n53:       \"path\": \"nodes/sros/sros_test.go\"\n54:     },\n55:     {\n56:       \"status\": \"M\",\n57:       \"path\": \"nodes/sros/template.go\"\n58:     },\n59:     {\n60:       \"status\": \"M\",\n61:       \"path\": \"nodes/sros/variant.go\"\n62:     },\n63:     {\n64:       \"status\": \"M\",\n65:       \"path\": \"schemas/clab.schema.json\"\n66:     },\n67:     {\n68:       \"status\": \"M\",\n69:       \"path\": \"tests/13-srsim/01-sros-to-linux.robot\"\n70:     },\n71:     {\n72:       \"status\": \"M\",\n73:       \"path\": \"tests/13-srsim/03-sros-dist-to-linux.robot\"\n74:     },\n75:     {\n76:       \"status\": \"M\",\n77:       \"path\": \"tests/13-srsim/04-sros-classic.robot\"\n78:     },\n79:     {\n80:       \"status\": \"M\",\n81:       \"path\": \"tests/13-srsim/05-sros-comp-to-linux.robot\"\n82:     },\n83:     {\n84:       \"status\": \"M\",\n85:       \"path\": \"tests/13-srsim/06-srsim-sar.robot\"\n86:     },\n87:     {\n88:       \"status\": \"M\",\n89:       \"path\": \"tests/13-srsim/07-srsim-with-mgmt-network.robot\"\n90:     },\n91:     {\n92:       \"status\": \"M\",\n93:       \"path\": \"tests/13-srsim/08-srsim-comp-cfg-test.robot\"\n94:     },\n95:     {\n96:       \"status\": \"M\",\n97:       \"path\": \"tests/13-srsim/09-srsim-pause-container.robot\"\n98:     },\n99:     {\n100:       \"status\": \"M\",\n101:       \"path\": \"tests/13-srsim/10-srsim-lifecycle.robot\"\n102:     },\n103:     {\n104:       \"status\": \"M\",\n105:       \"path\": \"tests/13-srsim/12-srsim-veth-stitch.robot\"\n106:     },\n107:     {\n108:       \"status\": \"A\",\n109:       \"path\": \"tests/13-srsim/13-srsim-integrated.clab.yml\"\n110:     },\n111:     {\n112:       \"status\": \"A\",\n113:       \"path\": \"tests/13-srsim/13-srsim-integrated.robot\"\n114:     },\n115:     {\n116:       \"status\": \"A\",\n117:       \"path\": \"tests/13-srsim/14-srsim-new-chassis.clab.yml\"\n118:     },\n119:     {\n120:       \"status\": \"A\",\n121:       \"path\": \"tests/13-srsim/14-srsim-new-chassis.robot\"\n122:     },\n123:     {\n124:       \"status\": \"A\",\n125:       \"path\": \"tests/srsim.robot\"\n126:     },\n127:     {\n128:       \"status\": \"M\",\n129:       \"path\": \"utils/sros_schema_gen.sh\"\n130:     }\n131:   ],\n132:   \"files\": [\n133:     {\n134:       \"revision\": \"head\",\n135:       \"path\": \".github/workflows/srsim-tests.yml\",\n136:       \"bytes\": 4465,\n137:       \"lines\": 141\n138:     },\n139:     {\n140:       \"revision\": \"head\",\n141:       \"path\": \"docs/manual/kinds/sros.md\",\n142:       \"bytes\": 36892,\n143:       \"lines\": 906\n144:     },\n145:     {\n146:       \"revision\": \"head\",\n147:       \"path\": \"nodes/sros/chassis_info_test.go\",\n148:       \"bytes\": 2578,\n149:       \"lines\": 99\n150:     },\n151:     {\n152:       \"revision\": \"head\",\n153:       \"path\": \"nodes/sros/chassis_info.go\",\n154:       \"bytes\": 5820,\n155:       \"lines\": 222\n156:     },\n157:     {\n158:       \"revision\": \"head\",\n159:       \"path\": \"nodes/sros/component_config.go\",\n160:       \"bytes\": 10029,\n161:       \"lines\": 393\n162:     },\n163:     {\n164:       \"revision\": \"head\",\n165:       \"path\": \"nodes/sros/component.go\",\n166:       \"bytes\": 7301,\n167:       \"lines\": 309\n168:     },\n169:     {\n170:       \"revision\": \"head\",\n171:       \"path\": \"nodes/sros/config.go\",\n172:       \"bytes\": 10055,\n173:       \"lines\": 345\n174:     },\n175:     {\n176:       \"revision\": \"head\",\n177:       \"path\": \"nodes/sros/netns.go\",\n178:       \"bytes\": 5099,\n179:       \"lines\": 157\n180:     },\n181:     {\n182:       \"revision\": \"head\",\n183:       \"path\": \"nodes/sros/power.go\",\n184:       \"bytes\": 1613,\n185:       \"lines\": 95\n186:     },\n187:     {\n188:       \"revision\": \"head\",\n189:       \"path\": \"nodes/sros/README.md\",\n190:       \"bytes\": 45346,\n191:       \"lines\": 1582\n192:     },\n193:     {\n194:       \"revision\": \"head\",\n195:       \"path\": \"nodes/sros/sros_test.go\",\n196:       \"bytes\": 42251,\n197:       \"lines\": 1351\n198:     },\n199:     {\n200:       \"revision\": \"head\",\n201:       \"path\": \"nodes/sros/sros.go\",\n202:       \"bytes\": 57207,\n203:       \"lines\": 1910\n204:     },\n205:     {\n206:       \"revision\": \"head\",\n207:       \"path\": \"nodes/sros/template.go\",\n208:       \"bytes\": 2661,\n209:       \"lines\": 99\n210:     },\n211:     {\n212:       \"revision\": \"head\",\n213:       \"path\": \"nodes/sros/variant.go\",\n214:       \"bytes\": 4674,\n215:       \"lines\": 170\n216:     },\n217:     {\n218:       \"revision\": \"head\",\n219:       \"path\": \"schemas/clab.schema.json\",\n220:       \"bytes\": 167017,\n221:       \"lines\": 3969\n222:     },\n223:     {\n224:       \"revision\": \"head\",\n225:       \"path\": \"tests/13-srsim/01-sros-to-linux.robot\",\n226:       \"bytes\": 4315,\n227:       \"lines\": 105\n228:     },\n229:     {\n230:       \"revision\": \"head\",\n231:       \"path\": \"tests/13-srsim/03-sros-dist-to-linux.robot\",\n232:       \"bytes\": 1876,\n233:       \"lines\": 47\n234:     },\n235:     {\n236:       \"revision\": \"head\",\n237:       \"path\": \"tests/13-srsim/04-sros-classic.robot\",\n238:       \"bytes\": 2147,\n239:       \"lines\": 61\n240:     },\n241:     {\n242:       \"revision\": \"head\",\n243:       \"path\": \"tests/13-srsim/05-sros-comp-to-linux.robot\",\n244:       \"bytes\": 6761,\n245:       \"lines\": 139\n246:     },\n247:     {\n248:       \"revision\": \"head\",\n249:       \"path\": \"tests/13-srsim/06-srsim-sar.robot\",\n250:       \"bytes\": 1499,\n251:       \"lines\": 41\n252:     },\n253:     {\n254:       \"revision\": \"head\",\n255:       \"path\": \"tests/13-srsim/07-srsim-with-mgmt-network.robot\",\n256:       \"bytes\": 2497,\n257:       \"lines\": 60\n258:     },\n259:     {\n260:       \"revision\": \"head\",\n261:       \"path\": \"tests/13-srsim/08-srsim-comp-cfg-test.robot\",\n262:       \"bytes\": 7029,\n263:       \"lines\": 135\n264:     },\n265:     {\n266:       \"revision\": \"head\",\n267:       \"path\": \"tests/13-srsim/09-srsim-pause-container.robot\",\n268:       \"bytes\": 7632,\n269:       \"lines\": 166\n270:     },\n271:     {\n272:       \"revision\": \"head\",\n273:       \"path\": \"tests/13-srsim/10-srsim-lifecycle.robot\",\n274:       \"bytes\": 4003,\n275:       \"lines\": 86\n276:     },\n277:     {\n278:       \"revision\": \"head\",\n279:       \"path\": \"tests/13-srsim/12-srsim-veth-stitch.robot\",\n280:       \"bytes\": 4048,\n281:       \"lines\": 106\n282:     },\n283:     {\n284:       \"revision\": \"head\",\n285:       \"path\": \"tests/13-srsim/13-srsim-integrated.clab.yml\",\n286:       \"bytes\": 702,\n287:       \"lines\": 33\n288:     },\n289:     {\n290:       \"revision\": \"head\",\n291:       \"path\": \"tests/13-srsim/13-srsim-integrated.robot\",\n292:       \"bytes\": 4891,\n293:       \"lines\": 105\n294:     },\n295:     {\n296:       \"revision\": \"head\",\n297:       \"path\": \"tests/13-srsim/14-srsim-new-chassis.clab.yml\",\n298:       \"bytes\": 1729,\n299:       \"lines\": 53\n300:     },\n301:     {\n302:       \"revision\": \"head\",\n303:       \"path\": \"tests/13-srsim/14-srsim-new-chassis.robot\",\n304:       \"bytes\": 3552,\n305:       \"lines\": 83\n306:     },\n307:     {\n308:       \"revision\": \"head\",\n309:       \"path\": \"tests/srsim.robot\",\n310:       \"bytes\": 631,\n311:       \"lines\": 20\n312:     },\n313:     {\n314:       \"revision\": \"head\",\n315:       \"path\": \"utils/sros_schema_gen.sh\",\n316:       \"bytes\": 1178,\n317:       \"lines\": 26\n318:     },\n319:     {\n320:       \"revision\": \"head\",\n321:       \"path\": \"docs/cmd/completion.md\",\n322:       \"bytes\": 2336,\n323:       \"lines\": 95\n324:     },\n325:     {\n326:       \"revision\": \"head\",\n327:       \"path\": \"docs/cmd/deploy.md\",\n328:       \"bytes\": 31381,\n329:       \"lines\": 565\n330:     },\n331:     {\n332:       \"revision\": \"head\",\n333:       \"path\": \"docs/cmd/destroy.md\",\n334:       \"bytes\": 3397,\n335:       \"lines\": 98\n336:     },\n337:     {\n338:       \"revision\": \"head\",\n339:       \"path\": \"docs/cmd/events.md\",\n340:       \"bytes\": 5990,\n341:       \"lines\": 89\n342:     },\n343:     {\n344:       \"revision\": \"head\",\n345:       \"path\": \"docs/cmd/exec.md\",\n346:       \"bytes\": 7316,\n347:       \"lines\": 177\n348:     },\n349:     {\n350:       \"revision\": \"head\",\n351:       \"path\": \"docs/cmd/generate.md\",\n352:       \"bytes\": 6005,\n353:       \"lines\": 138\n354:     },\n355:     {\n356:       \"revision\": \"head\",\n357:       \"path\": \"docs/cmd/graph.md\",\n358:       \"bytes\": 7858,\n359:       \"lines\": 188\n360:     },\n361:     {\n362:       \"revision\": \"head\",\n363:       \"path\": \"docs/cmd/inspect/index.md\",\n364:       \"bytes\": 10896,\n365:       \"lines\": 179\n366:     },\n367:     {\n368:       \"revision\": \"head\",\n369:       \"path\": \"docs/cmd/inspect/interfaces.md\",\n370:       \"bytes\": 11201,\n371:       \"lines\": 197\n372:     },\n373:     {\n374:       \"revision\": \"head\",\n375:       \"path\": \"docs/cmd/redeploy.md\",\n376:       \"bytes\": 6085,\n377:       \"lines\": 150\n378:     },\n379:     {\n380:       \"revision\": \"head\",\n381:       \"path\": \"docs/cmd/restart.md\",\n382:       \"bytes\": 1432,\n383:       \"lines\": 64\n384:     },\n385:     {\n386:       \"revision\": \"head\",\n387:       \"path\": \"docs/cmd/save.md\",\n388:       \"bytes\": 6445,\n389:       \"lines\": 133\n390:     },\n391:     {\n392:       \"revision\": \"head\",\n393:       \"path\": \"docs/cmd/start.md\",\n394:       \"bytes\": 2251,\n395:       \"lines\": 76\n396:     },\n397:     {\n398:       \"revision\": \"head\",\n399:       \"path\": \"docs/cmd/stop.md\",\n400:       \"bytes\": 1313,\n401:       \"lines\": 62\n402:     },\n403:     {\n404:       \"revision\": \"head\",\n405:       \"path\": \"docs/cmd/tools/api-server/start.md\",\n406:       \"bytes\": 5581,\n407:       \"lines\": 165\n408:     },\n409:     {\n410:       \"revision\": \"head\",\n411:       \"path\": \"docs/cmd/tools/api-server/status.md\",\n412:       \"bytes\": 4223,\n413:       \"lines\": 105\n414:     },\n415:     {\n416:       \"revision\": \"head\",\n417:       \"path\": \"docs/cmd/tools/api-server/stop.md\",\n418:       \"bytes\": 1836,\n419:       \"lines\": 56\n420:     },\n421:     {\n422:       \"revision\": \"head\",\n423:       \"path\": \"docs/cmd/tools/cert/ca/create.md\",\n424:       \"bytes\": 2206,\n425:       \"lines\": 77\n426:     },\n427:     {\n428:       \"revision\": \"head\",\n429:       \"path\": \"docs/cmd/tools/cert/sign.md\",\n430:       \"bytes\": 2428,\n431:       \"lines\": 79\n432:     },\n433:     {\n434:       \"revision\": \"head\",\n435:       \"path\": \"docs/cmd/tools/disable-tx-offload.md\",\n436:       \"bytes\": 982,\n437:       \"lines\": 25\n438:     },\n439:     {\n440:       \"revision\": \"head\",\n441:       \"path\": \"docs/cmd/tools/gotty/attach.md\",\n442:       \"bytes\": 1904,\n443:       \"lines\": 67\n444:     },\n445:     {\n446:       \"revision\": \"head\",\n447:       \"path\": \"docs/cmd/tools/gotty/detach.md\",\n448:       \"bytes\": 627,\n449:       \"lines\": 29\n450:     },\n451:     {\n452:       \"revision\": \"head\",\n453:       \"path\": \"docs/cmd/tools/gotty/list.md\",\n454:       \"bytes\": 1070,\n455:       \"lines\": 46\n456:     },\n457:     {\n458:       \"revision\": \"head\",\n459:       \"path\": \"docs/cmd/tools/gotty/reattach.md\",\n460:       \"bytes\": 955,\n461:       \"lines\": 26\n462:     },\n463:     {\n464:       \"revision\": \"head\",\n465:       \"path\": \"docs/cmd/tools/netem/reset.md\",\n466:       \"bytes\": 1635,\n467:       \"lines\": 63\n468:     },\n469:     {\n470:       \"revision\": \"head\",\n471:       \"path\": \"docs/cmd/tools/netem/set.md\",\n472:       \"bytes\": 3979,\n473:       \"lines\": 114\n474:     },\n475:     {\n476:       \"revision\": \"head\",\n477:       \"path\": \"docs/cmd/tools/netem/show.md\",\n478:       \"bytes\": 3651,\n479:       \"lines\": 150\n480:     },\n481:     {\n482:       \"revision\": \"head\",\n483:       \"path\": \"docs/cmd/tools/snapshot/save.md\",\n484:       \"bytes\": 1647,\n485:       \"lines\": 75\n486:     },\n487:     {\n488:       \"revision\": \"head\",\n489:       \"path\": \"docs/cmd/tools/sshx/attach.md\",\n490:       \"bytes\": 5194,\n491:       \"lines\": 128\n492:     },\n493:     {\n494:       \"revision\": \"head\",\n495:       \"path\": \"docs/cmd/tools/sshx/detach.md\",\n496:       \"bytes\": 1837,\n497:       \"lines\": 46\n498:     },\n499:     {\n500:       \"revision\": \"head\",\n501:       \"path\": \"docs/cmd/tools/sshx/list.md\",\n502:       \"bytes\": 3662,\n503:       \"lines\": 77\n504:     },\n505:     {\n506:       \"revision\": \"head\",\n507:       \"path\": \"docs/cmd/tools/sshx/reattach.md\",\n508:       \"bytes\": 4593,\n509:       \"lines\": 101\n510:     },\n511:     {\n512:       \"revision\": \"head\",\n513:       \"path\": \"docs/cmd/tools/veth/create.md\",\n514:       \"bytes\": 1890,\n515:       \"lines\": 51\n516:     },\n517:     {\n518:       \"revision\": \"head\",\n519:       \"path\": \"docs/cmd/tools/vxlan/create.md\",\n520:       \"bytes\": 3355,\n521:       \"lines\": 73\n522:     },\n523:     {\n524:       \"revision\": \"head\",\n525:       \"path\": \"docs/cmd/tools/vxlan/delete.md\",\n526:       \"bytes\": 1230,\n527:       \"lines\": 31\n528:     },\n529:     {\n530:       \"revision\": \"head\",\n531:       \"path\": \"docs/cmd/validate.md\",\n532:       \"bytes\": 1785,\n533:       \"lines\": 51\n534:     },\n535:     {\n536:       \"revision\": \"head\",\n537:       \"path\": \"docs/cmd/version/check.md\",\n538:       \"bytes\": 537,\n539:       \"lines\": 21\n540:     },\n541:     {\n542:       \"revision\": \"head\",\n543:       \"path\": \"docs/cmd/version/index.md\",\n544:       \"bytes\": 1011,\n545:       \"lines\": 37\n546:     },\n547:     {\n548:       \"revision\": \"head\",\n549:       \"path\": \"docs/CNAME\",\n550:       \"bytes\": 16,\n551:       \"lines\": 1\n552:     },\n553:     {\n554:       \"revision\": \"head\",\n555:       \"path\": \"docs/community.md\",\n556:       \"bytes\": 26611,\n557:       \"lines\": 360\n558:     },\n559:     {\n560:       \"revision\": \"head\",\n561:       \"path\": \"docs/htmltest-pr.yml\",\n562:       \"bytes\": 678,\n563:       \"lines\": 14\n564:     },\n565:     {\n566:       \"revision\": \"head\",\n567:       \"path\": \"docs/htmltest-w-github.yml\",\n568:       \"bytes\": 1679,\n569:       \"lines\": 31\n570:     },\n571:     {\n572:       \"revision\": \"head\",\n573:       \"path\": \"docs/htmltest.yml\",\n574:       \"bytes\": 2429,\n575:       \"lines\": 49\n576:     },\n577:     {\n578:       \"revision\": \"head\",\n579:       \"path\": \"docs/images/clabnew.svg\",\n580:       \"bytes\": 16299,\n581:       \"lines\": 13\n582:     },\n583:     {\n584:       \"revision\": \"head\",\n585:       \"path\": \"docs/images/coloured_wordmark.svg\",\n586:       \"bytes\": 8031,\n587:       \"lines\": 91\n588:     },\n589:     {\n590:       \"revision\": \"head\",\n591:       \"path\": \"docs/images/containerlab_dark_no_text.svg\",\n592:       \"bytes\": 3589,\n593:       \"lines\": 8\n594:     },\n595:     {\n596:       \"revision\": \"head\",\n597:       \"path\": \"docs/images/containerlab_export.svg\",\n598:       \"bytes\": 8893,\n599:       \"lines\": 33\n600:     },\n601:     {\n602:       \"revision\": \"head\",\n603:       \"path\": \"docs/images/containerlab_full_white_no_text.svg\",\n604:       \"bytes\": 3801,\n605:       \"lines\": 8\n606:     },\n607:     {\n608:       \"revision\": \"head\",\n609:       \"path\": \"docs/images/containerlab_white_no_text.svg\",\n610:       \"bytes\": 3293,\n611:       \"lines\": 8\n612:     },\n613:     {\n614:       \"revision\": \"head\",\n615:       \"path\": \"docs/images/containerlab-animated-wordmark.svg\",\n616:       \"bytes\": 70018,\n617:       \"lines\": 52\n618:     },\n619:     {\n620:       \"revision\": \"head\",\n621:       \"path\": \"docs/images/favicon.svg\",\n622:       \"bytes\": 16378,\n623:       \"lines\": 20\n624:     },\n625:     {\n626:       \"revision\": \"head\",\n627:       \"path\": \"docs/images/flask.svg\",\n628:       \"bytes\": 378,\n629:       \"lines\": 1\n630:     },\n631:     {\n632:       \"revision\": \"head\",\n633:       \"path\": \"docs/images/gui/browser-sandbox-placeholder.svg\",\n634:       \"bytes\": 2220,\n635:       \"lines\": 25\n636:     },\n637:     {\n638:       \"revision\": \"head\",\n639:       \"path\": \"docs/images/topoviewer-icons/client.svg\",\n640:       \"bytes\": 633,\n641:       \"lines\": 1\n642:     },\n643:     {\n644:       \"revision\": \"head\",\n645:       \"path\": \"docs/images/topoviewer-icons/controller.svg\",\n646:       \"bytes\": 768,\n647:       \"lines\": 1\n648:     },\n649:     {\n650:       \"revision\": \"head\",\n651:       \"path\": \"docs/images/topoviewer-icons/dcgw.svg\",\n652:       \"bytes\": 1015,\n653:       \"lines\": 1\n654:     },\n655:     {\n656:       \"revision\": \"head\",\n657:       \"path\": \"docs/images/topoviewer-icons/pon.svg\",\n658:       \"bytes\": 553,\n659:       \"lines\": 1\n660:     },\n661:     {\n662:       \"revision\": \"head\",\n663:       \"path\": \"docs/images/topoviewer-icons/rgw.svg\",\n664:       \"bytes\": 983,\n665:       \"lines\": 1\n666:     },\n667:     {\n668:       \"revision\": \"head\",\n669:       \"path\": \"docs/images/topoviewer-icons/router.svg\",\n670:       \"bytes\": 864,\n671:       \"lines\": 1\n672:     },\n673:     {\n674:       \"revision\": \"head\",\n675:       \"path\": \"docs/images/topoviewer-icons/server.svg\",\n676:       \"bytes\": 744,\n677:       \"lines\": 1\n678:     },\n679:     {\n680:       \"revision\": \"head\",\n681:       \"path\": \"docs/images/topoviewer-icons/spine.svg\",\n682:       \"bytes\": 940,\n683:       \"lines\": 1\n684:     },\n685:     {\n686:       \"revision\": \"head\",\n687:       \"path\": \"docs/images/topoviewer-icons/switch.svg\",\n688:       \"bytes\": 803,\n689:       \"lines\": 1\n690:     },\n691:     {\n692:       \"revision\": \"head\",\n693:       \"path\": \"docs/index.md\",\n694:       \"bytes\": 6778,\n695:       \"lines\": 189\n696:     },\n697:     {\n698:       \"revision\": \"head\",\n699:       \"path\": \"docs/install.md\",\n700:       \"bytes\": 17575,\n701:       \"lines\": 505\n702:     },\n703:     {\n704:       \"revision\": \"head\",\n705:       \"path\": \"docs/javascripts/instant-reinit.js\",\n706:       \"bytes\": 2040,\n707:       \"lines\": 45\n708:     },\n709:     {\n710:       \"revision\": \"head\",\n711:       \"path\": \"docs/lab-examples/asav01.md\",\n712:       \"bytes\": 4137,\n713:       \"lines\": 90\n714:     },\n715:     {\n716:       \"revision\": \"head\",\n717:       \"path\": \"docs/lab-examples/bgp-vpls-nok-jun.md\",\n718:       \"bytes\": 3374,\n719:       \"lines\": 34\n720:     },\n721:     {\n722:       \"revision\": \"head\",\n723:       \"path\": \"docs/lab-examples/cisco_iol.md\",\n724:       \"bytes\": 4368,\n725:       \"lines\": 100\n726:     },\n727:     {\n728:       \"revision\": \"head\",\n729:       \"path\": \"docs/lab-examples/cvx01.md\",\n730:       \"bytes\": 2989,\n731:       \"lines\": 48\n732:     },\n733:     {\n734:       \"revision\": \"head\",\n735:       \"path\": \"docs/lab-examples/cvx02.md\",\n736:       \"bytes\": 2990,\n737:       \"lines\": 49\n738:     },\n739:     {\n740:       \"revision\": \"head\",\n741:       \"path\": \"docs/lab-examples/ext-bridge.md\",\n742:       \"bytes\": 2042,\n743:       \"lines\": 31\n744:     },\n745:     {\n746:       \"revision\": \"head\",\n747:       \"path\": \"docs/lab-examples/f5bigipve01.md\",\n748:       \"bytes\": 4956,\n749:       \"lines\": 118\n750:     },\n751:     {\n752:       \"revision\": \"head\",\n753:       \"path\": \"docs/lab-examples/freebsd01.md\",\n754:       \"bytes\": 3571,\n755:       \"lines\": 76\n756:     },\n757:     {\n758:       \"revision\": \"head\",\n759:       \"path\": \"docs/lab-examples/frr01.md\",\n760:       \"bytes\": 2987,\n761:       \"lines\": 64\n762:     },\n763:     {\n764:       \"revision\": \"head\",\n765:       \"path\": \"docs/lab-examples/ftdv01.md\",\n766:       \"bytes\": 4108,\n767:       \"lines\": 75\n768:     },\n769:     {\n770:       \"revision\": \"head\",\n771:       \"path\": \"docs/lab-examples/generic_vm01.md\",\n772:       \"bytes\": 3201,\n773:       \"lines\": 66\n774:     },\n775:     {\n776:       \"revision\": \"head\",\n777:       \"path\": \"docs/lab-examples/ixiacone-srl.md\",\n778:       \"bytes\": 6827,\n779:       \"lines\": 135\n780:     },\n781:     {\n782:       \"revision\": \"head\",\n783:       \"path\": \"docs/lab-examples/lab-examples.md\",\n784:       \"bytes\": 4334,\n785:       \"lines\": 80\n786:     },\n787:     {\n788:       \"revision\": \"head\",\n789:       \"path\": \"docs/lab-examples/min-5clos.md\",\n790:       \"bytes\": 9340,\n791:       \"lines\": 127\n792:     },\n793:     {\n794:       \"revision\": \"head\",\n795:       \"path\": \"docs/lab-examples/min-clos.md\",\n796:       \"bytes\": 1970,\n797:       \"lines\": 26\n798:     },\n799:     {\n800:       \"revision\": \"head\",\n801:       \"path\": \"docs/lab-examples/multinode.md\",\n802:       \"bytes\": 14610,\n803:       \"lines\": 264\n804:     },\n805:     {\n806:       \"revision\": \"head\",\n807:       \"path\": \"docs/lab-examples/openbsd01.md\",\n808:       \"bytes\": 3615,\n809:       \"lines\": 76\n810:     },\n811:     {\n812:       \"revision\": \"head\",\n813:       \"path\": \"docs/lab-examples/ost-srl.md\",\n814:       \"bytes\": 6005,\n815:       \"lines\": 114\n816:     },\n817:     {\n818:       \"revision\": \"head\",\n819:       \"path\": \"docs/lab-examples/osvbng01.md\",\n820:       \"bytes\": 3109,\n821:       \"lines\": 71\n822:     },\n823:     {\n824:       \"revision\": \"head\",\n825:       \"path\": \"docs/lab-examples/peering-lab.md\",\n826:       \"bytes\": 23285,\n827:       \"lines\": 391\n828:     },\n829:     {\n830:       \"revision\": \"head\",\n831:       \"path\": \"docs/lab-examples/rare-freertr.md\",\n832:       \"bytes\": 1848,\n833:       \"lines\": 31\n834:     },\n835:     {\n836:       \"revision\": \"head\",\n837:       \"path\": \"docs/lab-examples/single-srl.md\",\n838:       \"bytes\": 2261,\n839:       \"lines\": 32\n840:     },\n841:     {\n842:       \"revision\": \"head\",\n843:       \"path\": \"docs/lab-examples/sr-sim.md\",\n844:       \"bytes\": 3766,\n845:       \"lines\": 64\n846:     },\n847:     {\n848:       \"revision\": \"head\",\n849:       \"path\": \"docs/lab-examples/srl-arcos.md\",\n850:       \"bytes\": 2871,\n851:       \"lines\": 52\n852:     },\n853:     {\n854:       \"revision\": \"head\",\n855:       \"path\": \"docs/lab-examples/srl-ceos.md\",\n856:       \"bytes\": 8462,\n857:       \"lines\": 211\n858:     },\n859:     {\n860:       \"revision\": \"head\",\n861:       \"path\": \"docs/lab-examples/srl-cjunosevolved.md\",\n862:       \"bytes\": 2674,\n863:       \"lines\": 43\n864:     },\n865:     {\n866:       \"revision\": \"head\",\n867:       \"path\": \"docs/lab-examples/srl-crpd.md\",\n868:       \"bytes\": 9443,\n869:       \"lines\": 181\n870:     },\n871:     {\n872:       \"revision\": \"head\",\n873:       \"path\": \"docs/lab-examples/srl-frr.md\",\n874:       \"bytes\": 3163,\n875:       \"lines\": 33\n876:     },\n877:     {\n878:       \"revision\": \"head\",\n879:       \"path\": \"docs/lab-examples/srl-sonic.md\",\n880:       \"bytes\": 9521,\n881:       \"lines\": 193\n882:     },\n883:     {\n884:       \"revision\": \"head\",\n885:       \"path\": \"docs/lab-examples/srl-vjunos-switch.md\",\n886:       \"bytes\": 1886,\n887:       \"lines\": 24\n888:     },\n889:     {\n890:       \"revision\": \"head\",\n891:       \"path\": \"docs/lab-examples/srl-vjunosevolved.md\",\n892:       \"bytes\": 1891,\n893:       \"lines\": 24\n894:     },\n895:     {\n896:       \"revision\": \"head\",\n897:       \"path\": \"docs/lab-examples/srl-xrd.md\",\n898:       \"bytes\": 2877,\n899:       \"lines\": 49\n900:     },\n901:     {\n902:       \"revision\": \"head\",\n903:       \"path\": \"docs/lab-examples/templated01.md\",\n904:       \"bytes\": 2516,\n905:       \"lines\": 56\n906:     },\n907:     {\n908:       \"revision\": \"head\",\n909:       \"path\": \"docs/lab-examples/templated02.md\",\n910:       \"bytes\": 2792,\n911:       \"lines\": 68\n912:     },\n913:     {\n914:       \"revision\": \"head\",\n915:       \"path\": \"docs/lab-examples/two-srls.md\",\n916:       \"bytes\": 3098,\n917:       \"lines\": 47\n918:     },\n919:     {\n920:       \"revision\": \"head\",\n921:       \"path\": \"docs/lab-examples/vr-sros.md\",\n922:       \"bytes\": 2506,\n923:       \"lines\": 28\n924:     },\n925:     {\n926:       \"revision\": \"head\",\n927:       \"path\": \"docs/lab-examples/vr-vmx.md\",\n928:       \"bytes\": 2523,\n929:       \"lines\": 30\n930:     },\n931:     {\n932:       \"revision\": \"head\",\n933:       \"path\": \"docs/lab-examples/vr-xrv.md\",\n934:       \"bytes\": 2419,\n935:       \"lines\": 27\n936:     },\n937:     {\n938:       \"revision\": \"head\",\n939:       \"path\": \"docs/lab-examples/vr-xrv9k.md\",\n940:       \"bytes\": 2441,\n941:       \"lines\": 27\n942:     },\n943:     {\n944:       \"revision\": \"head\",\n945:       \"path\": \"docs/lab-examples/vsrx01.md\",\n946:       \"bytes\": 4497,\n947:       \"lines\": 90\n948:     },\n949:     {\n950:       \"revision\": \"head\",\n951:       \"path\": \"docs/lab-examples/wan.md\",\n952:       \"bytes\": 1820,\n953:       \"lines\": 24\n954:     },\n955:     {\n956:       \"revision\": \"head\",\n957:       \"path\": \"docs/macos.md\",\n958:       \"bytes\": 17237,\n959:       \"lines\": 251\n960:     },\n961:     {\n962:       \"revision\": \"head\",\n963:       \"path\": \"docs/manual/api-server.md\",\n964:       \"bytes\": 7871,\n965:       \"lines\": 223\n966:     },\n967:     {\n968:       \"revision\": \"head\",\n969:       \"path\": \"docs/manual/cert.md\",\n970:       \"bytes\": 3472,\n971:       \"lines\": 59\n972:     },\n973:     {\n974:       \"revision\": \"head\",\n975:       \"path\": \"docs/manual/clabernetes/index.md\",\n976:       \"bytes\": 990,\n977:       \"lines\": 18\n978:     },\n979:     {\n980:       \"revision\": \"head\",\n981:       \"path\": \"docs/manual/clabernetes/runtime.md\",\n982:       \"bytes\": 34317,\n983:       \"lines\": 888\n984:     },\n985:     {\n986:       \"revision\": \"head\",\n987:       \"path\": \"docs/manual/codespaces.md\",\n988:       \"bytes\": 20644,\n989:       \"lines\": 318\n990:     },\n991:     {\n992:       \"revision\": \"head\",\n993:       \"path\": \"docs/manual/conf-artifacts.md\",\n994:       \"bytes\": 3196,\n995:       \"lines\": 54\n996:     },\n997:     {\n998:       \"revision\": \"head\",\n999:       \"path\": \"docs/manual/config-mgmt.md\",\n1000:       \"bytes\": 12920,\n1001:       \"lines\": 311\n1002:     },\n1003:     {\n1004:       \"revision\": \"head\",\n1005:       \"path\": \"docs/manual/dev/debug.md\",\n1006:       \"bytes\": 5255,\n1007:       \"lines\": 133\n1008:     },\n1009:     {\n1010:       \"revision\": \"head\",\n1011:       \"path\": \"docs/manual/dev/doc.md\",\n1012:       \"bytes\": 4366,\n1013:       \"lines\": 55\n1014:     },\n1015:     {\n1016:       \"revision\": \"head\",\n1017:       \"path\": \"docs/manual/dev/index.md\",\n1018:       \"bytes\": 1170,\n1019:       \"lines\": 21\n1020:     },\n1021:     {\n1022:       \"revision\": \"head\",\n1023:       \"path\": \"docs/manual/dev/test.md\",\n1024:       \"bytes\": 4069,\n1025:       \"lines\": 100\n1026:     },\n1027:     {\n1028:       \"revision\": \"head\",\n1029:       \"path\": \"docs/manual/gui/desktop.md\",\n1030:       \"bytes\": 5381,\n1031:       \"lines\": 130\n1032:     },\n1033:     {\n1034:       \"revision\": \"head\",\n1035:       \"path\": \"docs/manual/gui/index.md\",\n1036:       \"bytes\": 16398,\n1037:       \"lines\": 314\n1038:     },\n1039:     {\n1040:       \"revision\": \"head\",\n1041:       \"path\": \"docs/manual/gui/vsc-extension.md\",\n1042:       \"bytes\": 9060,\n1043:       \"lines\": 202\n1044:     },\n1045:     {\n1046:       \"revision\": \"head\",\n1047:       \"path\": \"docs/manual/gui/web.md\",\n1048:       \"bytes\": 6617,\n1049:       \"lines\": 178\n1050:     },\n1051:     {\n1052:       \"revision\": \"head\",\n1053:       \"path\": \"docs/manual/images.md\",\n1054:       \"bytes\": 5119,\n1055:       \"lines\": 108\n1056:     },\n1057:     {\n1058:       \"revision\": \"head\",\n1059:       \"path\": \"docs/manual/impairments.md\",\n1060:       \"bytes\": 881,\n1061:       \"lines\": 20\n1062:     },\n1063:     {\n1064:       \"revision\": \"head\",\n1065:       \"path\": \"docs/manual/inventory.md\",\n1066:       \"bytes\": 11726,\n1067:       \"lines\": 398\n1068:     },\n1069:     {\n1070:       \"revision\": \"head\",\n1071:       \"path\": \"docs/manual/kinds/6wind_vsr.md\",\n1072:       \"bytes\": 9464,\n1073:       \"lines\": 208\n1074:     },\n1075:     {\n1076:       \"revision\": \"head\",\n1077:       \"path\": \"docs/manual/kinds/arrcus_arcos.md\",\n1078:       \"bytes\": 4185,\n1079:       \"lines\": 134\n1080:     },\n1081:     {\n1082:       \"revision\": \"head\",\n1083:       \"path\": \"docs/manual/kinds/bridge.md\",\n1084:       \"bytes\": 5527,\n1085:       \"lines\": 123\n1086:     },\n1087:     {\n1088:       \"revision\": \"head\",\n1089:       \"path\": \"docs/manual/kinds/c8000.md\",\n1090:       \"bytes\": 5477,\n1091:       \"lines\": 151\n1092:     },\n1093:     {\n1094:       \"revision\": \"head\",\n1095:       \"path\": \"docs/manual/kinds/ceos.md\",\n1096:       \"bytes\": 22395,\n1097:       \"lines\": 548\n1098:     },\n1099:     {\n1100:       \"revision\": \"head\",\n1101:       \"path\": \"docs/manual/kinds/checkpoint_cloudguard.md\",\n1102:       \"bytes\": 2694,\n1103:       \"lines\": 60\n1104:     },\n1105:     {\n1106:       \"revision\": \"head\",\n1107:       \"path\": \"docs/manual/kinds/ciena_saos.md\",\n1108:       \"bytes\": 8268,\n1109:       \"lines\": 244\n1110:     },\n1111:     {\n1112:       \"revision\": \"head\",\n1113:       \"path\": \"docs/manual/kinds/cisco_asav.md\",\n1114:       \"bytes\": 4142,\n1115:       \"lines\": 95\n1116:     },\n1117:     {\n1118:       \"revision\": \"head\",\n1119:       \"path\": \"docs/manual/kinds/cisco_iol.md\",\n1120:       \"bytes\": 11889,\n1121:       \"lines\": 269\n1122:     },\n1123:     {\n1124:       \"revision\": \"head\",\n1125:       \"path\": \"docs/manual/kinds/cisco_sdwan.md\",\n1126:       \"bytes\": 6415,\n1127:       \"lines\": 280\n1128:     },\n1129:     {\n1130:       \"revision\": \"head\",\n1131:       \"path\": \"docs/manual/kinds/cisco_vios.md\",\n1132:       \"bytes\": 3734,\n1133:       \"lines\": 95\n1134:     },\n1135:     {\n1136:       \"revision\": \"head\",\n1137:       \"path\": \"docs/manual/kinds/cisco_xrd_vrouter.md\",\n1138:       \"bytes\": 5916,\n1139:       \"lines\": 139\n1140:     },\n1141:     {\n1142:       \"revision\": \"head\",\n1143:       \"path\": \"docs/manual/kinds/cjunosevolved.md\",\n1144:       \"bytes\": 7017,\n1145:       \"lines\": 150\n1146:     },\n1147:     {\n1148:       \"revision\": \"head\",\n1149:       \"path\": \"docs/manual/kinds/crpd.md\",\n1150:       \"bytes\": 8048,\n1151:       \"lines\": 191\n1152:     },\n1153:     {\n1154:       \"revision\": \"head\",\n1155:       \"path\": \"docs/manual/kinds/csrx.md\",\n1156:       \"bytes\": 6460,\n1157:       \"lines\": 176\n1158:     },\n1159:     {\n1160:       \"revision\": \"head\",\n1161:       \"path\": \"docs/manual/kinds/dell_sonic.md\",\n1162:       \"bytes\": 3154,\n1163:       \"lines\": 95\n1164:     },\n1165:     {\n1166:       \"revision\": \"head\",\n1167:       \"path\": \"docs/manual/kinds/ext-container.md\",\n1168:       \"bytes\": 2729,\n1169:       \"lines\": 64\n1170:     },\n1171:     {\n1172:       \"revision\": \"head\",\n1173:       \"path\": \"docs/manual/kinds/f5_bigipve.md\",\n1174:       \"bytes\": 8997,\n1175:       \"lines\": 220\n1176:     },\n1177:     {\n1178:       \"revision\": \"head\",\n1179:       \"path\": \"docs/manual/kinds/fdio_vpp.md\",\n1180:       \"bytes\": 10759,\n1181:       \"lines\": 225\n1182:     },\n1183:     {\n1184:       \"revision\": \"head\",\n1185:       \"path\": \"docs/manual/kinds/fortinet_fortigate.md\",\n1186:       \"bytes\": 3737,\n1187:       \"lines\": 81\n1188:     },\n1189:     {\n1190:       \"revision\": \"head\",\n1191:       \"path\": \"docs/manual/kinds/freebsd.md\",\n1192:       \"bytes\": 4052,\n1193:       \"lines\": 95\n1194:     },\n1195:     {\n1196:       \"revision\": \"head\",\n1197:       \"path\": \"docs/manual/kinds/frr.md\",\n1198:       \"bytes\": 7504,\n1199:       \"lines\": 151\n1200:     },\n1201:     {\n1202:       \"revision\": \"head\",\n1203:       \"path\": \"docs/manual/kinds/generic_vm.md\",\n1204:       \"bytes\": 3133,\n1205:       \"lines\": 87\n1206:     },\n1207:     {\n1208:       \"revision\": \"head\",\n1209:       \"path\": \"docs/manual/kinds/host.md\",\n1210:       \"bytes\": 1105,\n1211:       \"lines\": 24\n1212:     },\n1213:     {\n1214:       \"revision\": \"head\",\n1215:       \"path\": \"docs/manual/kinds/huawei_vrp.md\",\n1216:       \"bytes\": 4188,\n1217:       \"lines\": 88\n1218:     },\n1219:     {\n1220:       \"revision\": \"head\",\n1221:       \"path\": \"docs/manual/kinds/index.md\",\n1222:       \"bytes\": 8558,\n1223:       \"lines\": 104\n1224:     },\n1225:     {\n1226:       \"revision\": \"head\",\n1227:       \"path\": \"docs/manual/kinds/ipinfusion-ocnos.md\",\n1228:       \"bytes\": 2248,\n1229:       \"lines\": 54\n1230:     },\n1231:     {\n1232:       \"revision\": \"head\",\n1233:       \"path\": \"docs/manual/kinds/k8s-kind.md\",\n1234:       \"bytes\": 6322,\n1235:       \"lines\": 141\n1236:     },\n1237:     {\n1238:       \"revision\": \"head\",\n1239:       \"path\": \"docs/manual/kinds/keysight_ixia-c-one.md\",\n1240:       \"bytes\": 3228,\n1241:       \"lines\": 68\n1242:     },\n1243:     {\n1244:       \"revision\": \"head\",\n1245:       \"path\": \"docs/manual/kinds/linux.md\",\n1246:       \"bytes\": 2960,\n1247:       \"lines\": 55\n1248:     },\n1249:     {\n1250:       \"revision\": \"head\",\n1251:       \"path\": \"docs/manual/kinds/nvidia_cumulusvx.md\",\n1252:       \"bytes\": 4019,\n1253:       \"lines\": 106\n1254:     },\n1255:     {\n1256:       \"revision\": \"head\",\n1257:       \"path\": \"docs/manual/kinds/openbsd.md\",\n1258:       \"bytes\": 4034,\n1259:       \"lines\": 95\n1260:     },\n1261:     {\n1262:       \"revision\": \"head\",\n1263:       \"path\": \"docs/manual/kinds/openwrt.md\",\n1264:       \"bytes\": 1725,\n1265:       \"lines\": 37\n1266:     },\n1267:     {\n1268:       \"revision\": \"head\",\n1269:       \"path\": \"docs/manual/kinds/ostinato.md\",\n1270:       \"bytes\": 3594,\n1271:       \"lines\": 95\n1272:     },\n1273:     {\n1274:       \"revision\": \"head\",\n1275:       \"path\": \"docs/manual/kinds/ovs-bridge.md\",\n1276:       \"bytes\": 1997,\n1277:       \"lines\": 53\n1278:     },\n1279:     {\n1280:       \"revision\": \"head\",\n1281:       \"path\": \"docs/manual/kinds/plvision_sonic.md\",\n1282:       \"bytes\": 3542,\n1283:       \"lines\": 84\n1284:     },\n1285:     {\n1286:       \"revision\": \"head\",\n1287:       \"path\": \"docs/manual/kinds/rare-freertr.md\",\n1288:       \"bytes\": 6044,\n1289:       \"lines\": 170\n1290:     },\n1291:     {\n1292:       \"revision\": \"head\",\n1293:       \"path\": \"docs/manual/kinds/sonic-vm.md\",\n1294:       \"bytes\": 5902,\n1295:       \"lines\": 145\n1296:     },\n1297:     {\n1298:       \"revision\": \"head\",\n1299:       \"path\": \"docs/manual/kinds/sonic-vs.md\",\n1300:       \"bytes\": 3737,\n1301:       \"lines\": 78\n1302:     },\n1303:     {\n1304:       \"revision\": \"head\",\n1305:       \"path\": \"docs/manual/kinds/spirent_stc.md\",\n1306:       \"bytes\": 3762,\n1307:       \"lines\": 116\n1308:     },\n1309:     {\n1310:       \"revision\": \"head\",\n1311:       \"path\": \"docs/manual/kinds/srl.md\",\n1312:       \"bytes\": 25640,\n1313:       \"lines\": 577\n1314:     },\n1315:     {\n1316:       \"revision\": \"head\",\n1317:       \"path\": \"docs/manual/kinds/veesix_osvbng.md\",\n1318:       \"bytes\": 3889,\n1319:       \"lines\": 124\n1320:     },\n1321:     {\n1322:       \"revision\": \"head\",\n1323:       \"path\": \"docs/manual/kinds/vr-aoscx.md\",\n1324:       \"bytes\": 3329,\n1325:       \"lines\": 73\n1326:     },\n1327:     {\n1328:       \"revision\": \"head\",\n1329:       \"path\": \"docs/manual/kinds/vr-c8000v.md\",\n1330:       \"bytes\": 6882,\n1331:       \"lines\": 188\n1332:     },\n1333:     {\n1334:       \"revision\": \"head\",\n1335:       \"path\": \"docs/manual/kinds/vr-cat9kv.md\",\n1336:       \"bytes\": 6835,\n1337:       \"lines\": 170\n1338:     },\n1339:     {\n1340:       \"revision\": \"head\",\n1341:       \"path\": \"docs/manual/kinds/vr-csr.md\",\n1342:       \"bytes\": 4119,\n1343:       \"lines\": 86\n1344:     },\n1345:     {\n1346:       \"revision\": \"head\",\n1347:       \"path\": \"docs/manual/kinds/vr-ftdv.md\",\n1348:       \"bytes\": 3343,\n1349:       \"lines\": 79\n1350:     },\n1351:     {\n1352:       \"revision\": \"head\",\n1353:       \"path\": \"docs/manual/kinds/vr-ftosv.md\",\n1354:       \"bytes\": 3557,\n1355:       \"lines\": 79\n1356:     },\n1357:     {\n1358:       \"revision\": \"head\",\n1359:       \"path\": \"docs/manual/kinds/vr-n9kv.md\",\n1360:       \"bytes\": 4790,\n1361:       \"lines\": 123\n1362:     },\n1363:     {\n1364:       \"revision\": \"head\",\n1365:       \"path\": \"docs/manual/kinds/vr-pan.md\",\n1366:       \"bytes\": 3372,\n1367:       \"lines\": 86\n1368:     },\n1369:     {\n1370:       \"revision\": \"head\",\n1371:       \"path\": \"docs/manual/kinds/vr-ros.md\",\n1372:       \"bytes\": 3912,\n1373:       \"lines\": 83\n1374:     },\n1375:     {\n1376:       \"revision\": \"head\",\n1377:       \"path\": \"docs/manual/kinds/vr-sros.md\",\n1378:       \"bytes\": 22067,\n1379:       \"lines\": 505\n1380:     },\n1381:     {\n1382:       \"revision\": \"head\",\n1383:       \"path\": \"docs/manual/kinds/vr-veos.md\",\n1384:       \"bytes\": 4126,\n1385:       \"lines\": 94\n1386:     },\n1387:     {\n1388:       \"revision\": \"head\",\n1389:       \"path\": \"docs/manual/kinds/vr-vjunosevolved.md\",\n1390:       \"bytes\": 5141,\n1391:       \"lines\": 107\n1392:     },\n1393:     {\n1394:       \"revision\": \"head\",\n1395:       \"path\": \"docs/manual/kinds/vr-vjunosrouter.md\",\n1396:       \"bytes\": 5140,\n1397:       \"lines\": 103\n1398:     },\n1399:     {\n1400:       \"revision\": \"head\",\n1401:       \"path\": \"docs/manual/kinds/vr-vjunosswitch.md\",\n1402:       \"bytes\": 5110,\n1403:       \"lines\": 108\n1404:     },\n1405:     {\n1406:       \"revision\": \"head\",\n1407:       \"path\": \"docs/manual/kinds/vr-vmx.md\",\n1408:       \"bytes\": 5371,\n1409:       \"lines\": 121\n1410:     },\n1411:     {\n1412:       \"revision\": \"head\",\n1413:       \"path\": \"docs/manual/kinds/vr-vqfx.md\",\n1414:       \"bytes\": 4053,\n1415:       \"lines\": 90\n1416:     },\n1417:     {\n1418:       \"revision\": \"head\",\n1419:       \"path\": \"docs/manual/kinds/vr-vsrx.md\",\n1420:       \"bytes\": 4053,\n1421:       \"lines\": 89\n1422:     },\n1423:     {\n1424:       \"revision\": \"head\",\n1425:       \"path\": \"docs/manual/kinds/vr-xrv.md\",\n1426:       \"bytes\": 4029,\n1427:       \"lines\": 100\n1428:     },\n1429:     {\n1430:       \"revision\": \"head\",\n1431:       \"path\": \"docs/manual/kinds/vr-xrv9k.md\",\n1432:       \"bytes\": 5157,\n1433:       \"lines\": 120\n1434:     },\n1435:     {\n1436:       \"revision\": \"head\",\n1437:       \"path\": \"docs/manual/kinds/vyosnetworks_vyos.md\",\n1438:       \"bytes\": 6643,\n1439:       \"lines\": 187\n1440:     },\n1441:     {\n1442:       \"revision\": \"head\",\n1443:       \"path\": \"docs/manual/kinds/xrd.md\",\n1444:       \"bytes\": 7951,\n1445:       \"lines\": 177\n1446:     },\n1447:     {\n1448:       \"revision\": \"head\",\n1449:       \"path\": \"docs/manual/multi-node.md\",\n1450:       \"bytes\": 6089,\n1451:       \"lines\": 72\n1452:     },\n1453:     {\n1454:       \"revision\": \"head\",\n1455:       \"path\": \"docs/manual/network.md\",\n1456:       \"bytes\": 40210,\n1457:       \"lines\": 835\n1458:     },\n1459:     {\n1460:       \"revision\": \"head\",\n1461:       \"path\": \"docs/manual/node-filtering.md\",\n1462:       \"bytes\": 3517,\n1463:       \"lines\": 66\n1464:     },\n1465:     {\n1466:       \"revision\": \"head\",\n1467:       \"path\": \"docs/manual/nodes.md\",\n1468:       \"bytes\": 44445,\n1469:       \"lines\": 1205\n1470:     },\n1471:     {\n1472:       \"revision\": \"head\",\n1473:       \"path\": \"docs/manual/s3-usage-example.md\",\n1474:       \"bytes\": 1446,\n1475:       \"lines\": 61\n1476:     },\n1477:     {\n1478:       \"revision\": \"head\",\n1479:       \"path\": \"docs/manual/share-access.md\",\n1480:       \"bytes\": 8219,\n1481:       \"lines\": 150\n1482:     },\n1483:     {\n1484:       \"revision\": \"head\",\n1485:       \"path\": \"docs/manual/topo-def-file.md\",\n1486:       \"bytes\": 37253,\n1487:       \"lines\": 903\n1488:     },\n1489:     {\n1490:       \"revision\": \"head\",\n1491:       \"path\": \"docs/manual/vrnetlab.md\",\n1492:       \"bytes\": 30525,\n1493:       \"lines\": 270\n1494:     },\n1495:     {\n1496:       \"revision\": \"head\",\n1497:       \"path\": \"docs/manual/wireshark.md\",\n1498:       \"bytes\": 16256,\n1499:       \"lines\": 326\n1500:     },\n1501:     {\n1502:       \"revision\": \"head\",\n1503:       \"path\": \"docs/quickstart.md\",\n1504:       \"bytes\": 10387,\n1505:       \"lines\": 207\n1506:     },\n1507:     {\n1508:       \"revision\": \"head\",\n1509:       \"path\": \"docs/rn/0.11.0.md\",\n1510:       \"bytes\": 5330,\n1511:       \"lines\": 71\n1512:     },\n1513:     {\n1514:       \"revision\": \"head\",\n1515:       \"path\": \"docs/rn/0.12.0.md\",\n1516:       \"bytes\": 4928,\n1517:       \"lines\": 75\n1518:     },\n1519:     {\n1520:       \"revision\": \"head\",\n1521:       \"path\": \"docs/rn/0.13.0.md\",\n1522:       \"bytes\": 1772,\n1523:       \"lines\": 30\n1524:     },\n1525:     {\n1526:       \"revision\": \"head\",\n1527:       \"path\": \"docs/rn/0.14.0.md\",\n1528:       \"bytes\": 2612,\n1529:       \"lines\": 35\n1530:     },\n1531:     {\n1532:       \"revision\": \"head\",\n1533:       \"path\": \"docs/rn/0.14.1.md\",\n1534:       \"bytes\": 177,\n1535:       \"lines\": 5\n1536:     },\n1537:     {\n1538:       \"revision\": \"head\",\n1539:       \"path\": \"docs/rn/0.14.2.md\",\n1540:       \"bytes\": 301,\n1541:       \"lines\": 5\n1542:     },\n1543:     {\n1544:       \"revision\": \"head\",\n1545:       \"path\": \"docs/rn/0.14.3.md\",\n1546:       \"bytes\": 317,\n1547:       \"lines\": 9\n1548:     },\n1549:     {\n1550:       \"revision\": \"head\",\n1551:       \"path\": \"docs/rn/0.14.4.md\",\n1552:       \"bytes\": 286,\n1553:       \"lines\": 9\n1554:     },\n1555:     {\n1556:       \"revision\": \"head\",\n1557:       \"path\": \"docs/rn/0.15.md\",\n1558:       \"bytes\": 3827,\n1559:       \"lines\": 69\n1560:     },\n1561:     {\n1562:       \"revision\": \"head\",\n1563:       \"path\": \"docs/rn/0.16.md\",\n1564:       \"bytes\": 3480,\n1565:       \"lines\": 65\n1566:     },\n1567:     {\n1568:       \"revision\": \"head\",\n1569:       \"path\": \"docs/rn/0.17.md\",\n1570:       \"bytes\": 3356,\n1571:       \"lines\": 41\n1572:     },\n1573:     {\n1574:       \"revision\": \"head\",\n1575:       \"path\": \"docs/rn/0.18.md\",\n1576:       \"bytes\": 1527,\n1577:       \"lines\": 34\n1578:     },\n1579:     {\n1580:       \"revision\": \"head\",\n1581:       \"path\": \"docs/rn/0.19.md\",\n1582:       \"bytes\": 2470,\n1583:       \"lines\": 48\n1584:     },\n1585:     {\n1586:       \"revision\": \"head\",\n1587:       \"path\": \"docs/rn/0.20.md\",\n1588:       \"bytes\": 2146,\n1589:       \"lines\": 33\n1590:     },\n1591:     {\n1592:       \"revision\": \"head\",\n1593:       \"path\": \"docs/rn/0.21.md\",\n1594:       \"bytes\": 2459,\n1595:       \"lines\": 48\n1596:     },\n1597:     {\n1598:       \"revision\": \"head\",\n1599:       \"path\": \"docs/rn/0.22.md\",\n1600:       \"bytes\": 1806,\n1601:       \"lines\": 27\n1602:     },\n1603:     {\n1604:       \"revision\": \"head\",\n1605:       \"path\": \"docs/rn/0.23.md\",\n1606:       \"bytes\": 1835,\n1607:       \"lines\": 35\n1608:     },\n1609:     {\n1610:       \"revision\": \"head\",\n1611:       \"path\": \"docs/rn/0.24.md\",\n1612:       \"bytes\": 3490,\n1613:       \"lines\": 51\n1614:     },\n1615:     {\n1616:       \"revision\": \"head\",\n1617:       \"path\": \"docs/rn/0.25.md\",\n1618:       \"bytes\": 2105,\n1619:       \"lines\": 37\n1620:     },\n1621:     {\n1622:       \"revision\": \"head\",\n1623:       \"path\": \"docs/rn/0.26.md\",\n1624:       \"bytes\": 5078,\n1625:       \"lines\": 88\n1626:     },\n1627:     {\n1628:       \"revision\": \"head\",\n1629:       \"path\": \"docs/rn/0.27.md\",\n1630:       \"bytes\": 947,\n1631:       \"lines\": 21\n1632:     },\n1633:     {\n1634:       \"revision\": \"head\",\n1635:       \"path\": \"docs/rn/0.28.md\",\n1636:       \"bytes\": 1382,\n1637:       \"lines\": 32\n1638:     },\n1639:     {\n1640:       \"revision\": \"head\",\n1641:       \"path\": \"docs/rn/0.29.md\",\n1642:       \"bytes\": 750,\n1643:       \"lines\": 13\n1644:     },\n1645:     {\n1646:       \"revision\": \"head\",\n1647:       \"path\": \"docs/rn/0.30.md\",\n1648:       \"bytes\": 566,\n1649:       \"lines\": 14\n1650:     },\n1651:     {\n1652:       \"revision\": \"head\",\n1653:       \"path\": \"docs/rn/0.31.md\",\n1654:       \"bytes\": 1710,\n1655:       \"lines\": 30\n1656:     },\n1657:     {\n1658:       \"revision\": \"head\",\n1659:       \"path\": \"docs/rn/0.32.md\",\n1660:       \"bytes\": 2075,\n1661:       \"lines\": 45\n1662:     },\n1663:     {\n1664:       \"revision\": \"head\",\n1665:       \"path\": \"docs/rn/0.33.md\",\n1666:       \"bytes\": 893,\n1667:       \"lines\": 22\n1668:     },\n1669:     {\n1670:       \"revision\": \"head\",\n1671:       \"path\": \"docs/rn/0.34.md\",\n1672:       \"bytes\": 1019,\n1673:       \"lines\": 23\n1674:     },\n1675:     {\n1676:       \"revision\": \"head\",\n1677:       \"path\": \"docs/rn/0.35.md\",\n1678:       \"bytes\": 876,\n1679:       \"lines\": 29\n1680:     },\n1681:     {\n1682:       \"revision\": \"head\",\n1683:       \"path\": \"docs/rn/0.36.md\",\n1684:       \"bytes\": 868,\n1685:       \"lines\": 23\n1686:     },\n1687:     {\n1688:       \"revision\": \"head\",\n1689:       \"path\": \"docs/rn/0.37.md\",\n1690:       \"bytes\": 1990,\n1691:       \"lines\": 38\n1692:     },\n1693:     {\n1694:       \"revision\": \"head\",\n1695:       \"path\": \"docs/rn/0.38.md\",\n1696:       \"bytes\": 881,\n1697:       \"lines\": 18\n1698:     },\n1699:     {\n1700:       \"revision\": \"head\",\n1701:       \"path\": \"docs/rn/0.39.md\",\n1702:       \"bytes\": 3693,\n1703:       \"lines\": 101\n1704:     },\n1705:     {\n1706:       \"revision\": \"head\",\n1707:       \"path\": \"docs/rn/0.40.md\",\n1708:       \"bytes\": 732,\n1709:       \"lines\": 15\n1710:     },\n1711:     {\n1712:       \"revision\": \"head\",\n1713:       \"path\": \"docs/rn/0.41.md\",\n1714:       \"bytes\": 4520,\n1715:       \"lines\": 88\n1716:     },\n1717:     {\n1718:       \"revision\": \"head\",\n1719:       \"path\": \"docs/rn/0.42.md\",\n1720:       \"bytes\": 955,\n1721:       \"lines\": 15\n1722:     },\n1723:     {\n1724:       \"revision\": \"head\",\n1725:       \"path\": \"docs/rn/0.43.md\",\n1726:       \"bytes\": 3478,\n1727:       \"lines\": 90\n1728:     },\n1729:     {\n1730:       \"revision\": \"head\",\n1731:       \"path\": \"docs/rn/0.44.md\",\n1732:       \"bytes\": 2213,\n1733:       \"lines\": 54\n1734:     },\n1735:     {\n1736:       \"revision\": \"head\",\n1737:       \"path\": \"docs/rn/0.45.md\",\n1738:       \"bytes\": 1807,\n1739:       \"lines\": 32\n1740:     },\n1741:     {\n1742:       \"revision\": \"head\",\n1743:       \"path\": \"docs/rn/0.46.md\",\n1744:       \"bytes\": 3260,\n1745:       \"lines\": 98\n1746:     },\n1747:     {\n1748:       \"revision\": \"head\",\n1749:       \"path\": \"docs/rn/0.47.md\",\n1750:       \"bytes\": 2333,\n1751:       \"lines\": 46\n1752:     },\n1753:     {\n1754:       \"revision\": \"head\",\n1755:       \"path\": \"docs/rn/0.48.md\",\n1756:       \"bytes\": 4072,\n1757:       \"lines\": 75\n1758:     },\n1759:     {\n1760:       \"revision\": \"head\",\n1761:       \"path\": \"docs/rn/0.49.md\",\n1762:       \"bytes\": 1541,\n1763:       \"lines\": 30\n1764:     },\n1765:     {\n1766:       \"revision\": \"head\",\n1767:       \"path\": \"docs/rn/0.50.md\",\n1768:       \"bytes\": 3606,\n1769:       \"lines\": 54\n1770:     },\n1771:     {\n1772:       \"revision\": \"head\",\n1773:       \"path\": \"docs/rn/0.51.md\",\n1774:       \"bytes\": 2871,\n1775:       \"lines\": 68\n1776:     },\n1777:     {\n1778:       \"revision\": \"head\",\n1779:       \"path\": \"docs/rn/0.52.md\",\n1780:       \"bytes\": 3179,\n1781:       \"lines\": 65\n1782:     },\n1783:     {\n1784:       \"revision\": \"head\",\n1785:       \"path\": \"docs/rn/0.53.md\",\n1786:       \"bytes\": 1282,\n1787:       \"lines\": 27\n1788:     },\n1789:     {\n1790:       \"revision\": \"head\",\n1791:       \"path\": \"docs/rn/0.54.md\",\n1792:       \"bytes\": 942,\n1793:       \"lines\": 26\n1794:     },\n1795:     {\n1796:       \"revision\": \"head\",\n1797:       \"path\": \"docs/rn/0.55.md\",\n1798:       \"bytes\": 3026,\n1799:       \"lines\": 77\n1800:     },\n1801:     {\n1802:       \"revision\": \"head\",\n1803:       \"path\": \"docs/rn/0.56.md\",\n1804:       \"bytes\": 2575,\n1805:       \"lines\": 46\n1806:     },\n1807:     {\n1808:       \"revision\": \"head\",\n1809:       \"path\": \"docs/rn/0.57.md\",\n1810:       \"bytes\": 2466,\n1811:       \"lines\": 56\n1812:     },\n1813:     {\n1814:       \"revision\": \"head\",\n1815:       \"path\": \"docs/rn/0.58.md\",\n1816:       \"bytes\": 1868,\n1817:       \"lines\": 30\n1818:     },\n1819:     {\n1820:       \"revision\": \"head\",\n1821:       \"path\": \"docs/rn/0.59.md\",\n1822:       \"bytes\": 1494,\n1823:       \"lines\": 34\n1824:     },\n1825:     {\n1826:       \"revision\": \"head\",\n1827:       \"path\": \"docs/rn/0.60.md\",\n1828:       \"bytes\": 10022,\n1829:       \"lines\": 135\n1830:     },\n1831:     {\n1832:       \"revision\": \"head\",\n1833:       \"path\": \"docs/rn/0.61.md\",\n1834:       \"bytes\": 2588,\n1835:       \"lines\": 45\n1836:     },\n1837:     {\n1838:       \"revision\": \"head\",\n1839:       \"path\": \"docs/rn/0.62.md\",\n1840:       \"bytes\": 2915,\n1841:       \"lines\": 54\n1842:     },\n1843:     {\n1844:       \"revision\": \"head\",\n1845:       \"path\": \"docs/rn/0.63.md\",\n1846:       \"bytes\": 2182,\n1847:       \"lines\": 46\n1848:     },\n1849:     {\n1850:       \"revision\": \"head\",\n1851:       \"path\": \"docs/rn/0.64.md\",\n1852:       \"bytes\": 5000,\n1853:       \"lines\": 45\n1854:     },\n1855:     {\n1856:       \"revision\": \"head\",\n1857:       \"path\": \"docs/rn/0.65.md\",\n1858:       \"bytes\": 1622,\n1859:       \"lines\": 41\n1860:     },\n1861:     {\n1862:       \"revision\": \"head\",\n1863:       \"path\": \"docs/rn/0.66.md\",\n1864:       \"bytes\": 897,\n1865:       \"lines\": 21\n1866:     },\n1867:     {\n1868:       \"revision\": \"head\",\n1869:       \"path\": \"docs/rn/0.67.md\",\n1870:       \"bytes\": 1394,\n1871:       \"lines\": 23\n1872:     },\n1873:     {\n1874:       \"revision\": \"head\",\n1875:       \"path\": \"docs/rn/0.68.md\",\n1876:       \"bytes\": 2604,\n1877:       \"lines\": 40\n1878:     },\n1879:     {\n1880:       \"revision\": \"head\",\n1881:       \"path\": \"docs/rn/0.69.md\",\n1882:       \"bytes\": 5732,\n1883:       \"lines\": 117\n1884:     },\n1885:     {\n1886:       \"revision\": \"head\",\n1887:       \"path\": \"docs/rn/0.70.md\",\n1888:       \"bytes\": 3389,\n1889:       \"lines\": 64\n1890:     },\n1891:     {\n1892:       \"revision\": \"head\",\n1893:       \"path\": \"docs/rn/0.71.md\",\n1894:       \"bytes\": 5144,\n1895:       \"lines\": 120\n1896:     },\n1897:     {\n1898:       \"revision\": \"head\",\n1899:       \"path\": \"docs/rn/0.72.md\",\n1900:       \"bytes\": 3663,\n1901:       \"lines\": 62\n1902:     },\n1903:     {\n1904:       \"revision\": \"head\",\n1905:       \"path\": \"docs/rn/0.73.md\",\n1906:       \"bytes\": 6239,\n1907:       \"lines\": 96\n1908:     },\n1909:     {\n1910:       \"revision\": \"head\",\n1911:       \"path\": \"docs/rn/0.74.md\",\n1912:       \"bytes\": 6031,\n1913:       \"lines\": 94\n1914:     },\n1915:     {\n1916:       \"revision\": \"head\",\n1917:       \"path\": \"docs/rn/0.75.md\",\n1918:       \"bytes\": 5768,\n1919:       \"lines\": 78\n1920:     },\n1921:     {\n1922:       \"revision\": \"head\",\n1923:       \"path\": \"docs/rn/0.76.md\",\n1924:       \"bytes\": 4557,\n1925:       \"lines\": 69\n1926:     },\n1927:     {\n1928:       \"revision\": \"head\",\n1929:       \"path\": \"docs/rn/0.77.md\",\n1930:       \"bytes\": 3761,\n1931:       \"lines\": 71\n1932:     },\n1933:     {\n1934:       \"revision\": \"head\",\n1935:       \"path\": \"docs/rn/0.78.md\",\n1936:       \"bytes\": 5580,\n1937:       \"lines\": 118\n1938:     },\n1939:     {\n1940:       \"revision\": \"head\",\n1941:       \"path\": \"docs/rn/0.79.md\",\n1942:       \"bytes\": 3853,\n1943:       \"lines\": 96\n1944:     },\n1945:     {\n1946:       \"revision\": \"head\",\n1947:       \"path\": \"docs/rn/0.80.md\",\n1948:       \"bytes\": 15226,\n1949:       \"lines\": 280\n1950:     },\n1951:     {\n1952:       \"revision\": \"head\",\n1953:       \"path\": \"docs/rn/0.81.md\",\n1954:       \"bytes\": 5387,\n1955:       \"lines\": 98\n1956:     },\n1957:     {\n1958:       \"revision\": \"head\",\n1959:       \"path\": \"docs/stylesheets/extra.css\",\n1960:       \"bytes\": 19354,\n1961:       \"lines\": 750\n1962:     },\n1963:     {\n1964:       \"revision\": \"head\",\n1965:       \"path\": \"docs/windows.md\",\n1966:       \"bytes\": 10218,\n1967:       \"lines\": 225\n1968:     },\n1969:     {\n1970:       \"revision\": \"head\",\n1971:       \"path\": \".cursor/rules/git-mutations.mdc\",\n1972:       \"bytes\": 403,\n1973:       \"lines\": 10\n1974:     },\n1975:     {\n1976:       \"revision\": \"head\",\n1977:       \"path\": \".cursor/rules/karpathy-guidelines.mdc\",\n1978:       \"bytes\": 2643,\n1979:       \"lines\": 75\n1980:     },\n1981:     {\n1982:       \"revision\": \"head\",\n1983:       \"path\": \".cursor/rules/ponytail.mdc\",\n1984:       \"bytes\": 2620,\n1985:       \"lines\": 36\n1986:     },\n1987:     {\n1988:       \"revision\": \"head\",\n1989:       \"path\": \".cursor/rules/release-note-review.mdc\",\n1990:       \"bytes\": 472,\n1991:       \"lines\": 12\n1992:     },\n1993:     {\n1994:       \"revision\": \"head\",\n1995:       \"path\": \".cursor/skills/refresh-nix-vendor-hash/SKILL.md\",\n1996:       \"bytes\": 2916,\n1997:       \"lines\": 89\n1998:     },\n1999:     {\n2000:       \"revision\": \"head\",\n\n(Showing lines 1-2000 of 15645. Use offset=2001 to continue.)\n</content>",
    "title": "source/manifest.json",
    "metadata": {
      "preview": "{\n  \"version\": 1,\n  \"head\": \"d44c69f72ab156474197f12b6fc1407b3f8a65c4\",\n  \"base\": \"84cf630e6eedd662d9742fbcd6158a91372e3a56\",\n  \"mergeBase\": \"84cf630e6eedd662d9742fbcd6158a91372e3a56\",\n  \"changed\": [\n    {\n      \"status\": \"M\",\n      \"path\": \".github/workflows/srsim-tests.yml\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"docs/manual/kinds/sros.md\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/README.md\"\n    },\n    {\n      \"status\": \"M\",",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/manifest.json",
        "text": "{\n  \"version\": 1,\n  \"head\": \"d44c69f72ab156474197f12b6fc1407b3f8a65c4\",\n  \"base\": \"84cf630e6eedd662d9742fbcd6158a91372e3a56\",\n  \"mergeBase\": \"84cf630e6eedd662d9742fbcd6158a91372e3a56\",\n  \"changed\": [\n    {\n      \"status\": \"M\",\n      \"path\": \".github/workflows/srsim-tests.yml\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"docs/manual/kinds/sros.md\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/README.md\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/chassis_info.go\"\n    },\n    {\n      \"status\": \"A\",\n      \"path\": \"nodes/sros/chassis_info_test.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/component.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/component_config.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/config.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/netns.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/power.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/sros.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/sros_test.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/template.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/variant.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"schemas/clab.schema.json\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/01-sros-to-linux.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/03-sros-dist-to-linux.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/04-sros-classic.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/05-sros-comp-to-linux.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/06-srsim-sar.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/07-srsim-with-mgmt-network.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/08-srsim-comp-cfg-test.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/09-srsim-pause-container.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/10-srsim-lifecycle.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/12-srsim-veth-stitch.robot\"\n    },\n    {\n      \"status\": \"A\",\n      \"path\": \"tests/13-srsim/13-srsim-integrated.clab.yml\"\n    },\n    {\n      \"status\": \"A\",\n      \"path\": \"tests/13-srsim/13-srsim-integrated.robot\"\n    },\n    {\n      \"status\": \"A\",\n      \"path\": \"tests/13-srsim/14-srsim-new-chassis.clab.yml\"\n    },\n    {\n      \"status\": \"A\",\n      \"path\": \"tests/13-srsim/14-srsim-new-chassis.robot\"\n    },\n    {\n      \"status\": \"A\",\n      \"path\": \"tests/srsim.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"utils/sros_schema_gen.sh\"\n    }\n  ],\n  \"files\": [\n    {\n      \"revision\": \"head\",\n      \"path\": \".github/workflows/srsim-tests.yml\",\n      \"bytes\": 4465,\n      \"lines\": 141\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/sros.md\",\n      \"bytes\": 36892,\n      \"lines\": 906\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/chassis_info_test.go\",\n      \"bytes\": 2578,\n      \"lines\": 99\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/chassis_info.go\",\n      \"bytes\": 5820,\n      \"lines\": 222\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/component_config.go\",\n      \"bytes\": 10029,\n      \"lines\": 393\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/component.go\",\n      \"bytes\": 7301,\n      \"lines\": 309\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/config.go\",\n      \"bytes\": 10055,\n      \"lines\": 345\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/netns.go\",\n      \"bytes\": 5099,\n      \"lines\": 157\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/power.go\",\n      \"bytes\": 1613,\n      \"lines\": 95\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/README.md\",\n      \"bytes\": 45346,\n      \"lines\": 1582\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/sros_test.go\",\n      \"bytes\": 42251,\n      \"lines\": 1351\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/sros.go\",\n      \"bytes\": 57207,\n      \"lines\": 1910\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/template.go\",\n      \"bytes\": 2661,\n      \"lines\": 99\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/variant.go\",\n      \"bytes\": 4674,\n      \"lines\": 170\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"schemas/clab.schema.json\",\n      \"bytes\": 167017,\n      \"lines\": 3969\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/01-sros-to-linux.robot\",\n      \"bytes\": 4315,\n      \"lines\": 105\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/03-sros-dist-to-linux.robot\",\n      \"bytes\": 1876,\n      \"lines\": 47\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/04-sros-classic.robot\",\n      \"bytes\": 2147,\n      \"lines\": 61\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/05-sros-comp-to-linux.robot\",\n      \"bytes\": 6761,\n      \"lines\": 139\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/06-srsim-sar.robot\",\n      \"bytes\": 1499,\n      \"lines\": 41\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/07-srsim-with-mgmt-network.robot\",\n      \"bytes\": 2497,\n      \"lines\": 60\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/08-srsim-comp-cfg-test.robot\",\n      \"bytes\": 7029,\n      \"lines\": 135\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/09-srsim-pause-container.robot\",\n      \"bytes\": 7632,\n      \"lines\": 166\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/10-srsim-lifecycle.robot\",\n      \"bytes\": 4003,\n      \"lines\": 86\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/12-srsim-veth-stitch.robot\",\n      \"bytes\": 4048,\n      \"lines\": 106\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/13-srsim-integrated.clab.yml\",\n      \"bytes\": 702,\n      \"lines\": 33\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/13-srsim-integrated.robot\",\n      \"bytes\": 4891,\n      \"lines\": 105\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/14-srsim-new-chassis.clab.yml\",\n      \"bytes\": 1729,\n      \"lines\": 53\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/14-srsim-new-chassis.robot\",\n      \"bytes\": 3552,\n      \"lines\": 83\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/srsim.robot\",\n      \"bytes\": 631,\n      \"lines\": 20\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"utils/sros_schema_gen.sh\",\n      \"bytes\": 1178,\n      \"lines\": 26\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/completion.md\",\n      \"bytes\": 2336,\n      \"lines\": 95\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/deploy.md\",\n      \"bytes\": 31381,\n      \"lines\": 565\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/destroy.md\",\n      \"bytes\": 3397,\n      \"lines\": 98\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/events.md\",\n      \"bytes\": 5990,\n      \"lines\": 89\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/exec.md\",\n      \"bytes\": 7316,\n      \"lines\": 177\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/generate.md\",\n      \"bytes\": 6005,\n      \"lines\": 138\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/graph.md\",\n      \"bytes\": 7858,\n      \"lines\": 188\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/inspect/index.md\",\n      \"bytes\": 10896,\n      \"lines\": 179\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/inspect/interfaces.md\",\n      \"bytes\": 11201,\n      \"lines\": 197\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/redeploy.md\",\n      \"bytes\": 6085,\n      \"lines\": 150\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/restart.md\",\n      \"bytes\": 1432,\n      \"lines\": 64\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/save.md\",\n      \"bytes\": 6445,\n      \"lines\": 133\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/start.md\",\n      \"bytes\": 2251,\n      \"lines\": 76\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/stop.md\",\n      \"bytes\": 1313,\n      \"lines\": 62\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/api-server/start.md\",\n      \"bytes\": 5581,\n      \"lines\": 165\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/api-server/status.md\",\n      \"bytes\": 4223,\n      \"lines\": 105\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/api-server/stop.md\",\n      \"bytes\": 1836,\n      \"lines\": 56\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/cert/ca/create.md\",\n      \"bytes\": 2206,\n      \"lines\": 77\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/cert/sign.md\",\n      \"bytes\": 2428,\n      \"lines\": 79\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/disable-tx-offload.md\",\n      \"bytes\": 982,\n      \"lines\": 25\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/gotty/attach.md\",\n      \"bytes\": 1904,\n      \"lines\": 67\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/gotty/detach.md\",\n      \"bytes\": 627,\n      \"lines\": 29\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/gotty/list.md\",\n      \"bytes\": 1070,\n      \"lines\": 46\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/gotty/reattach.md\",\n      \"bytes\": 955,\n      \"lines\": 26\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/netem/reset.md\",\n      \"bytes\": 1635,\n      \"lines\": 63\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/netem/set.md\",\n      \"bytes\": 3979,\n      \"lines\": 114\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/netem/show.md\",\n      \"bytes\": 3651,\n      \"lines\": 150\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/snapshot/save.md\",\n      \"bytes\": 1647,\n      \"lines\": 75\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/sshx/attach.md\",\n      \"bytes\": 5194,\n      \"lines\": 128\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/sshx/detach.md\",\n      \"bytes\": 1837,\n      \"lines\": 46\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/sshx/list.md\",\n      \"bytes\": 3662,\n      \"lines\": 77\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/sshx/reattach.md\",\n      \"bytes\": 4593,\n      \"lines\": 101\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/veth/create.md\",\n      \"bytes\": 1890,\n      \"lines\": 51\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/vxlan/create.md\",\n      \"bytes\": 3355,\n      \"lines\": 73\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/vxlan/delete.md\",\n      \"bytes\": 1230,\n      \"lines\": 31\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/validate.md\",\n      \"bytes\": 1785,\n      \"lines\": 51\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/version/check.md\",\n      \"bytes\": 537,\n      \"lines\": 21\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/version/index.md\",\n      \"bytes\": 1011,\n      \"lines\": 37\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/CNAME\",\n      \"bytes\": 16,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/community.md\",\n      \"bytes\": 26611,\n      \"lines\": 360\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/htmltest-pr.yml\",\n      \"bytes\": 678,\n      \"lines\": 14\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/htmltest-w-github.yml\",\n      \"bytes\": 1679,\n      \"lines\": 31\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/htmltest.yml\",\n      \"bytes\": 2429,\n      \"lines\": 49\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/clabnew.svg\",\n      \"bytes\": 16299,\n      \"lines\": 13\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/coloured_wordmark.svg\",\n      \"bytes\": 8031,\n      \"lines\": 91\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/containerlab_dark_no_text.svg\",\n      \"bytes\": 3589,\n      \"lines\": 8\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/containerlab_export.svg\",\n      \"bytes\": 8893,\n      \"lines\": 33\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/containerlab_full_white_no_text.svg\",\n      \"bytes\": 3801,\n      \"lines\": 8\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/containerlab_white_no_text.svg\",\n      \"bytes\": 3293,\n      \"lines\": 8\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/containerlab-animated-wordmark.svg\",\n      \"bytes\": 70018,\n      \"lines\": 52\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/favicon.svg\",\n      \"bytes\": 16378,\n      \"lines\": 20\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/flask.svg\",\n      \"bytes\": 378,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/gui/browser-sandbox-placeholder.svg\",\n      \"bytes\": 2220,\n      \"lines\": 25\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/topoviewer-icons/client.svg\",\n      \"bytes\": 633,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/topoviewer-icons/controller.svg\",\n      \"bytes\": 768,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/topoviewer-icons/dcgw.svg\",\n      \"bytes\": 1015,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/topoviewer-icons/pon.svg\",\n      \"bytes\": 553,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/topoviewer-icons/rgw.svg\",\n      \"bytes\": 983,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/topoviewer-icons/router.svg\",\n      \"bytes\": 864,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/topoviewer-icons/server.svg\",\n      \"bytes\": 744,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/topoviewer-icons/spine.svg\",\n      \"bytes\": 940,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/topoviewer-icons/switch.svg\",\n      \"bytes\": 803,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/index.md\",\n      \"bytes\": 6778,\n      \"lines\": 189\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/install.md\",\n      \"bytes\": 17575,\n      \"lines\": 505\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/javascripts/instant-reinit.js\",\n      \"bytes\": 2040,\n      \"lines\": 45\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/asav01.md\",\n      \"bytes\": 4137,\n      \"lines\": 90\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/bgp-vpls-nok-jun.md\",\n      \"bytes\": 3374,\n      \"lines\": 34\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/cisco_iol.md\",\n      \"bytes\": 4368,\n      \"lines\": 100\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/cvx01.md\",\n      \"bytes\": 2989,\n      \"lines\": 48\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/cvx02.md\",\n      \"bytes\": 2990,\n      \"lines\": 49\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/ext-bridge.md\",\n      \"bytes\": 2042,\n      \"lines\": 31\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/f5bigipve01.md\",\n      \"bytes\": 4956,\n      \"lines\": 118\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/freebsd01.md\",\n      \"bytes\": 3571,\n      \"lines\": 76\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/frr01.md\",\n      \"bytes\": 2987,\n      \"lines\": 64\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/ftdv01.md\",\n      \"bytes\": 4108,\n      \"lines\": 75\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/generic_vm01.md\",\n      \"bytes\": 3201,\n      \"lines\": 66\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/ixiacone-srl.md\",\n      \"bytes\": 6827,\n      \"lines\": 135\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/lab-examples.md\",\n      \"bytes\": 4334,\n      \"lines\": 80\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/min-5clos.md\",\n      \"bytes\": 9340,\n      \"lines\": 127\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/min-clos.md\",\n      \"bytes\": 1970,\n      \"lines\": 26\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/multinode.md\",\n      \"bytes\": 14610,\n      \"lines\": 264\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/openbsd01.md\",\n      \"bytes\": 3615,\n      \"lines\": 76\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/ost-srl.md\",\n      \"bytes\": 6005,\n      \"lines\": 114\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/osvbng01.md\",\n      \"bytes\": 3109,\n      \"lines\": 71\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/peering-lab.md\",\n      \"bytes\": 23285,\n      \"lines\": 391\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/rare-freertr.md\",\n      \"bytes\": 1848,\n      \"lines\": 31\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/single-srl.md\",\n      \"bytes\": 2261,\n      \"lines\": 32\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/sr-sim.md\",\n      \"bytes\": 3766,\n      \"lines\": 64\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/srl-arcos.md\",\n      \"bytes\": 2871,\n      \"lines\": 52\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/srl-ceos.md\",\n      \"bytes\": 8462,\n      \"lines\": 211\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/srl-cjunosevolved.md\",\n      \"bytes\": 2674,\n      \"lines\": 43\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/srl-crpd.md\",\n      \"bytes\": 9443,\n      \"lines\": 181\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/srl-frr.md\",\n      \"bytes\": 3163,\n      \"lines\": 33\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/srl-sonic.md\",\n      \"bytes\": 9521,\n      \"lines\": 193\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/srl-vjunos-switch.md\",\n      \"bytes\": 1886,\n      \"lines\": 24\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/srl-vjunosevolved.md\",\n      \"bytes\": 1891,\n      \"lines\": 24\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/srl-xrd.md\",\n      \"bytes\": 2877,\n      \"lines\": 49\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/templated01.md\",\n      \"bytes\": 2516,\n      \"lines\": 56\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/templated02.md\",\n      \"bytes\": 2792,\n      \"lines\": 68\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/two-srls.md\",\n      \"bytes\": 3098,\n      \"lines\": 47\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/vr-sros.md\",\n      \"bytes\": 2506,\n      \"lines\": 28\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/vr-vmx.md\",\n      \"bytes\": 2523,\n      \"lines\": 30\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/vr-xrv.md\",\n      \"bytes\": 2419,\n      \"lines\": 27\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/vr-xrv9k.md\",\n      \"bytes\": 2441,\n      \"lines\": 27\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/vsrx01.md\",\n      \"bytes\": 4497,\n      \"lines\": 90\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/wan.md\",\n      \"bytes\": 1820,\n      \"lines\": 24\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/macos.md\",\n      \"bytes\": 17237,\n      \"lines\": 251\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/api-server.md\",\n      \"bytes\": 7871,\n      \"lines\": 223\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/cert.md\",\n      \"bytes\": 3472,\n      \"lines\": 59\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/clabernetes/index.md\",\n      \"bytes\": 990,\n      \"lines\": 18\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/clabernetes/runtime.md\",\n      \"bytes\": 34317,\n      \"lines\": 888\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/codespaces.md\",\n      \"bytes\": 20644,\n      \"lines\": 318\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/conf-artifacts.md\",\n      \"bytes\": 3196,\n      \"lines\": 54\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/config-mgmt.md\",\n      \"bytes\": 12920,\n      \"lines\": 311\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/dev/debug.md\",\n      \"bytes\": 5255,\n      \"lines\": 133\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/dev/doc.md\",\n      \"bytes\": 4366,\n      \"lines\": 55\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/dev/index.md\",\n      \"bytes\": 1170,\n      \"lines\": 21\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/dev/test.md\",\n      \"bytes\": 4069,\n      \"lines\": 100\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/gui/desktop.md\",\n      \"bytes\": 5381,\n      \"lines\": 130\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/gui/index.md\",\n      \"bytes\": 16398,\n      \"lines\": 314\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/gui/vsc-extension.md\",\n      \"bytes\": 9060,\n      \"lines\": 202\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/gui/web.md\",\n      \"bytes\": 6617,\n      \"lines\": 178\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/images.md\",\n      \"bytes\": 5119,\n      \"lines\": 108\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/impairments.md\",\n      \"bytes\": 881,\n      \"lines\": 20\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/inventory.md\",\n      \"bytes\": 11726,\n      \"lines\": 398\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/6wind_vsr.md\",\n      \"bytes\": 9464,\n      \"lines\": 208\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/arrcus_arcos.md\",\n      \"bytes\": 4185,\n      \"lines\": 134\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/bridge.md\",\n      \"bytes\": 5527,\n      \"lines\": 123\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/c8000.md\",\n      \"bytes\": 5477,\n      \"lines\": 151\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/ceos.md\",\n      \"bytes\": 22395,\n      \"lines\": 548\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/checkpoint_cloudguard.md\",\n      \"bytes\": 2694,\n      \"lines\": 60\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/ciena_saos.md\",\n      \"bytes\": 8268,\n      \"lines\": 244\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/cisco_asav.md\",\n      \"bytes\": 4142,\n      \"lines\": 95\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/cisco_iol.md\",\n      \"bytes\": 11889,\n      \"lines\": 269\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/cisco_sdwan.md\",\n      \"bytes\": 6415,\n      \"lines\": 280\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/cisco_vios.md\",\n      \"bytes\": 3734,\n      \"lines\": 95\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/cisco_xrd_vrouter.md\",\n      \"bytes\": 5916,\n      \"lines\": 139\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/cjunosevolved.md\",\n      \"bytes\": 7017,\n      \"lines\": 150\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/crpd.md\",\n      \"bytes\": 8048,\n      \"lines\": 191\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/csrx.md\",\n      \"bytes\": 6460,\n      \"lines\": 176\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/dell_sonic.md\",\n      \"bytes\": 3154,\n      \"lines\": 95\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/ext-container.md\",\n      \"bytes\": 2729,\n      \"lines\": 64\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/f5_bigipve.md\",\n      \"bytes\": 8997,\n      \"lines\": 220\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/fdio_vpp.md\",\n      \"bytes\": 10759,\n      \"lines\": 225\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/fortinet_fortigate.md\",\n      \"bytes\": 3737,\n      \"lines\": 81\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/freebsd.md\",\n      \"bytes\": 4052,\n      \"lines\": 95\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/frr.md\",\n      \"bytes\": 7504,\n      \"lines\": 151\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/generic_vm.md\",\n      \"bytes\": 3133,\n      \"lines\": 87\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/host.md\",\n      \"bytes\": 1105,\n      \"lines\": 24\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/huawei_vrp.md\",\n      \"bytes\": 4188,\n      \"lines\": 88\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/index.md\",\n      \"bytes\": 8558,\n      \"lines\": 104\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/ipinfusion-ocnos.md\",\n      \"bytes\": 2248,\n      \"lines\": 54\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/k8s-kind.md\",\n      \"bytes\": 6322,\n      \"lines\": 141\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/keysight_ixia-c-one.md\",\n      \"bytes\": 3228,\n      \"lines\": 68\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/linux.md\",\n      \"bytes\": 2960,\n      \"lines\": 55\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/nvidia_cumulusvx.md\",\n      \"bytes\": 4019,\n      \"lines\": 106\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/openbsd.md\",\n      \"bytes\": 4034,\n      \"lines\": 95\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/openwrt.md\",\n      \"bytes\": 1725,\n      \"lines\": 37\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/ostinato.md\",\n      \"bytes\": 3594,\n      \"lines\": 95\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/ovs-bridge.md\",\n      \"bytes\": 1997,\n      \"lines\": 53\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/plvision_sonic.md\",\n      \"bytes\": 3542,\n      \"lines\": 84\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/rare-freertr.md\",\n      \"bytes\": 6044,\n      \"lines\": 170\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/sonic-vm.md\",\n      \"bytes\": 5902,\n      \"lines\": 145\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/sonic-vs.md\",\n      \"bytes\": 3737,\n      \"lines\": 78\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/spirent_stc.md\",\n      \"bytes\": 3762,\n      \"lines\": 116\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/srl.md\",\n      \"bytes\": 25640,\n      \"lines\": 577\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/veesix_osvbng.md\",\n      \"bytes\": 3889,\n      \"lines\": 124\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-aoscx.md\",\n      \"bytes\": 3329,\n      \"lines\": 73\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-c8000v.md\",\n      \"bytes\": 6882,\n      \"lines\": 188\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-cat9kv.md\",\n      \"bytes\": 6835,\n      \"lines\": 170\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-csr.md\",\n      \"bytes\": 4119,\n      \"lines\": 86\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-ftdv.md\",\n      \"bytes\": 3343,\n      \"lines\": 79\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-ftosv.md\",\n      \"bytes\": 3557,\n      \"lines\": 79\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-n9kv.md\",\n      \"bytes\": 4790,\n      \"lines\": 123\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-pan.md\",\n      \"bytes\": 3372,\n      \"lines\": 86\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-ros.md\",\n      \"bytes\": 3912,\n      \"lines\": 83\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-sros.md\",\n      \"bytes\": 22067,\n      \"lines\": 505\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-veos.md\",\n      \"bytes\": 4126,\n      \"lines\": 94\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-vjunosevolved.md\",\n      \"bytes\": 5141,\n      \"lines\": 107\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-vjunosrouter.md\",\n      \"bytes\": 5140,\n      \"lines\": 103\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-vjunosswitch.md\",\n      \"bytes\": 5110,\n      \"lines\": 108\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-vmx.md\",\n      \"bytes\": 5371,\n      \"lines\": 121\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-vqfx.md\",\n      \"bytes\": 4053,\n      \"lines\": 90\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-vsrx.md\",\n      \"bytes\": 4053,\n      \"lines\": 89\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-xrv.md\",\n      \"bytes\": 4029,\n      \"lines\": 100\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-xrv9k.md\",\n      \"bytes\": 5157,\n      \"lines\": 120\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vyosnetworks_vyos.md\",\n      \"bytes\": 6643,\n      \"lines\": 187\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/xrd.md\",\n      \"bytes\": 7951,\n      \"lines\": 177\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/multi-node.md\",\n      \"bytes\": 6089,\n      \"lines\": 72\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/network.md\",\n      \"bytes\": 40210,\n      \"lines\": 835\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/node-filtering.md\",\n      \"bytes\": 3517,\n      \"lines\": 66\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/nodes.md\",\n      \"bytes\": 44445,\n      \"lines\": 1205\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/s3-usage-example.md\",\n      \"bytes\": 1446,\n      \"lines\": 61\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/share-access.md\",\n      \"bytes\": 8219,\n      \"lines\": 150\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/topo-def-file.md\",\n      \"bytes\": 37253,\n      \"lines\": 903\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/vrnetlab.md\",\n      \"bytes\": 30525,\n      \"lines\": 270\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/wireshark.md\",\n      \"bytes\": 16256,\n      \"lines\": 326\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/quickstart.md\",\n      \"bytes\": 10387,\n      \"lines\": 207\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.11.0.md\",\n      \"bytes\": 5330,\n      \"lines\": 71\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.12.0.md\",\n      \"bytes\": 4928,\n      \"lines\": 75\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.13.0.md\",\n      \"bytes\": 1772,\n      \"lines\": 30\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.14.0.md\",\n      \"bytes\": 2612,\n      \"lines\": 35\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.14.1.md\",\n      \"bytes\": 177,\n      \"lines\": 5\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.14.2.md\",\n      \"bytes\": 301,\n      \"lines\": 5\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.14.3.md\",\n      \"bytes\": 317,\n      \"lines\": 9\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.14.4.md\",\n      \"bytes\": 286,\n      \"lines\": 9\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.15.md\",\n      \"bytes\": 3827,\n      \"lines\": 69\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.16.md\",\n      \"bytes\": 3480,\n      \"lines\": 65\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.17.md\",\n      \"bytes\": 3356,\n      \"lines\": 41\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.18.md\",\n      \"bytes\": 1527,\n      \"lines\": 34\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.19.md\",\n      \"bytes\": 2470,\n      \"lines\": 48\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.20.md\",\n      \"bytes\": 2146,\n      \"lines\": 33\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.21.md\",\n      \"bytes\": 2459,\n      \"lines\": 48\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.22.md\",\n      \"bytes\": 1806,\n      \"lines\": 27\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.23.md\",\n      \"bytes\": 1835,\n      \"lines\": 35\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.24.md\",\n      \"bytes\": 3490,\n      \"lines\": 51\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.25.md\",\n      \"bytes\": 2105,\n      \"lines\": 37\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.26.md\",\n      \"bytes\": 5078,\n      \"lines\": 88\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.27.md\",\n      \"bytes\": 947,\n      \"lines\": 21\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.28.md\",\n      \"bytes\": 1382,\n      \"lines\": 32\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.29.md\",\n      \"bytes\": 750,\n      \"lines\": 13\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.30.md\",\n      \"bytes\": 566,\n      \"lines\": 14\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.31.md\",\n      \"bytes\": 1710,\n      \"lines\": 30\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.32.md\",\n      \"bytes\": 2075,\n      \"lines\": 45\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.33.md\",\n      \"bytes\": 893,\n      \"lines\": 22\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.34.md\",\n      \"bytes\": 1019,\n      \"lines\": 23\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.35.md\",\n      \"bytes\": 876,\n      \"lines\": 29\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.36.md\",\n      \"bytes\": 868,\n      \"lines\": 23\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.37.md\",\n      \"bytes\": 1990,\n      \"lines\": 38\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.38.md\",\n      \"bytes\": 881,\n      \"lines\": 18\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.39.md\",\n      \"bytes\": 3693,\n      \"lines\": 101\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.40.md\",\n      \"bytes\": 732,\n      \"lines\": 15\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.41.md\",\n      \"bytes\": 4520,\n      \"lines\": 88\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.42.md\",\n      \"bytes\": 955,\n      \"lines\": 15\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.43.md\",\n      \"bytes\": 3478,\n      \"lines\": 90\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.44.md\",\n      \"bytes\": 2213,\n      \"lines\": 54\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.45.md\",\n      \"bytes\": 1807,\n      \"lines\": 32\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.46.md\",\n      \"bytes\": 3260,\n      \"lines\": 98\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.47.md\",\n      \"bytes\": 2333,\n      \"lines\": 46\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.48.md\",\n      \"bytes\": 4072,\n      \"lines\": 75\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.49.md\",\n      \"bytes\": 1541,\n      \"lines\": 30\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.50.md\",\n      \"bytes\": 3606,\n      \"lines\": 54\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.51.md\",\n      \"bytes\": 2871,\n      \"lines\": 68\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.52.md\",\n      \"bytes\": 3179,\n      \"lines\": 65\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.53.md\",\n      \"bytes\": 1282,\n      \"lines\": 27\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.54.md\",\n      \"bytes\": 942,\n      \"lines\": 26\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.55.md\",\n      \"bytes\": 3026,\n      \"lines\": 77\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.56.md\",\n      \"bytes\": 2575,\n      \"lines\": 46\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.57.md\",\n      \"bytes\": 2466,\n      \"lines\": 56\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.58.md\",\n      \"bytes\": 1868,\n      \"lines\": 30\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.59.md\",\n      \"bytes\": 1494,\n      \"lines\": 34\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.60.md\",\n      \"bytes\": 10022,\n      \"lines\": 135\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.61.md\",\n      \"bytes\": 2588,\n      \"lines\": 45\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.62.md\",\n      \"bytes\": 2915,\n      \"lines\": 54\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.63.md\",\n      \"bytes\": 2182,\n      \"lines\": 46\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.64.md\",\n      \"bytes\": 5000,\n      \"lines\": 45\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.65.md\",\n      \"bytes\": 1622,\n      \"lines\": 41\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.66.md\",\n      \"bytes\": 897,\n      \"lines\": 21\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.67.md\",\n      \"bytes\": 1394,\n      \"lines\": 23\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.68.md\",\n      \"bytes\": 2604,\n      \"lines\": 40\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.69.md\",\n      \"bytes\": 5732,\n      \"lines\": 117\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.70.md\",\n      \"bytes\": 3389,\n      \"lines\": 64\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.71.md\",\n      \"bytes\": 5144,\n      \"lines\": 120\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.72.md\",\n      \"bytes\": 3663,\n      \"lines\": 62\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.73.md\",\n      \"bytes\": 6239,\n      \"lines\": 96\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.74.md\",\n      \"bytes\": 6031,\n      \"lines\": 94\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.75.md\",\n      \"bytes\": 5768,\n      \"lines\": 78\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.76.md\",\n      \"bytes\": 4557,\n      \"lines\": 69\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.77.md\",\n      \"bytes\": 3761,\n      \"lines\": 71\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.78.md\",\n      \"bytes\": 5580,\n      \"lines\": 118\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.79.md\",\n      \"bytes\": 3853,\n      \"lines\": 96\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.80.md\",\n      \"bytes\": 15226,\n      \"lines\": 280\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.81.md\",\n      \"bytes\": 5387,\n      \"lines\": 98\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/stylesheets/extra.css\",\n      \"bytes\": 19354,\n      \"lines\": 750\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/windows.md\",\n      \"bytes\": 10218,\n      \"lines\": 225\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \".cursor/rules/git-mutations.mdc\",\n      \"bytes\": 403,\n      \"lines\": 10\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \".cursor/rules/karpathy-guidelines.mdc\",\n      \"bytes\": 2643,\n      \"lines\": 75\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \".cursor/rules/ponytail.mdc\",\n      \"bytes\": 2620,\n      \"lines\": 36\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \".cursor/rules/release-note-review.mdc\",\n      \"bytes\": 472,\n      \"lines\": 12\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \".cursor/skills/refresh-nix-vendor-hash/SKILL.md\",\n      \"bytes\": 2916,\n      \"lines\": 89\n    },\n    {\n      \"revision\": \"head\",",
        "lineStart": 1,
        "lineEnd": 2000,
        "totalLines": 15645,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346529300,
      "end": 1792346529374
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502d9e630013EvoP8zsoOXyTj",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502d9a31001syzcYf80k0jjc3",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 3720,
    "input": 596,
    "output": 51,
    "reasoning": 1,
    "cache": {
      "read": 3072,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502d9a31001syzcYf80k0jjc3",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346528305,
    "completed": 1792346529383
  },
  "parentID": "msg_1502d8a66001F2b7xDf6faLOHN",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 3720,
    "input": 596,
    "output": 51,
    "reasoning": 1,
    "cache": {
      "read": 3072,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 4
step-start
{
  "type": "step-start",
  "id": "prt_1502da6e4001RUOsnrLkp4uMeN",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502d9e6b001O6WVSMYXb5D2sX"
}
Reasoning
The manifest is long. I have the changed paths list (31). Now let me read the diff.
read · completed

Input

{
  "filePath": "/source/diff.txt"
}

Output

<path>/source/diff.txt</path>
<type>file</type>
<content>
1: diff --git a/.github/workflows/srsim-tests.yml b/.github/workflows/srsim-tests.yml
2: index e9896cd..4aa8f48 100644
3: --- a/.github/workflows/srsim-tests.yml
4: +++ b/.github/workflows/srsim-tests.yml
5: @@ -41,22 +41,21 @@ jobs:
6:      if: needs.check-license.outputs.available == 'true'
7:      env:
8:        SRSIM_IMAGE_TAG: 26.7.R1
9:      strategy:
10:        matrix:
11: -        test-suite:
12: -          - "01*.robot"
13: -          - "03*.robot"
14: -          - "04*.robot"
15: -          - "05*.robot"
16: -          - "06*.robot"
17: -          - "07*.robot"
18: -          - "08*.robot"
19: -          - "09*.robot"
20: -          - "10*.robot"
21: -          - "11*.robot"
22: -          - "12*.robot"
23: +        include:
24: +          - shard: basic
25: +            test_suites: "01-sros-to-linux.robot 07-srsim-with-mgmt-network.robot 12-srsim-veth-stitch.robot"
26: +          - shard: lifecycle
27: +            test_suites: "04-sros-classic.robot 06-srsim-sar.robot 10-srsim-lifecycle.robot"
28: +          - shard: components
29: +            test_suites: "05-sros-comp-to-linux.robot 09-srsim-pause-container.robot 14-srsim-new-chassis.robot"
30: +          - shard: provisioning
31: +            test_suites: "03-sros-dist-to-linux.robot 08-srsim-comp-cfg-test.robot 13-srsim-integrated.robot"
32: +          - shard: apply
33: +            test_suites: "11-srsim-apply.robot"
34:      steps:
35:        - name: Checkout
36:          uses: actions/checkout@v7
37:          with:
38:            fetch-depth: 0
39: @@ -92,34 +91,39 @@ jobs:
40:          run: uv sync --all-extras --dev
41:  
42:        - name: Activate virtualenv
43:          run: |
44:            . .venv/bin/activate
45: -          echo PATH=$PATH >> $GITHUB_ENV
46: +          echo "PATH=$PATH" >> "$GITHUB_ENV"
47:  
48: -      - name: Sanitize test-suite name
49: -        run: echo "TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')" >> $GITHUB_ENV
50: +      - name: Set shard name
51: +        run: echo "TEST_SUITE=${{ matrix.shard }}" >> "$GITHUB_ENV"
52:  
53:        - name: Login to GitHub Container Registry
54:          uses: docker/login-action@v4
55:          with:
56:            registry: ghcr.io
57:            username: ${{ github.actor }}
58:            password: ${{ github.token }}
59:  
60:        - name: Pull and re-tag srsim image
61: -        run: docker pull ghcr.io/srl-labs/containerlab/nokia_srsim:${SRSIM_IMAGE_TAG} && docker tag ghcr.io/srl-labs/containerlab/nokia_srsim:${SRSIM_IMAGE_TAG} registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}
62: +        run: |
63: +          image="ghcr.io/srl-labs/containerlab/nokia_srsim:${SRSIM_IMAGE_TAG}"
64: +          docker pull "$image"
65: +          docker tag "$image" "registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}"
66:  
67:        - name: Logout from GitHub Container Registry
68:          run: docker logout ghcr.io
69:  
70:        # - name: setup tmate session
71:        #   uses: mxschmitt/action-tmate@v3
72:  
73:        - name: Run sros-srsim tests
74:          run: |
75: -          ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/13-srsim/${{ matrix.test-suite }}
76: +          for test_suite in ${{ matrix.test_suites }}; do
77: +            ./tests/rf-run.sh ${{ inputs.runtime }} "./tests/13-srsim/${test_suite}"
78: +          done
79:        # upload test reports as a zip file
80:        - name: Upload test logs
81:          uses: actions/upload-artifact@v7
82:          if: always()
83:          with:
84: diff --git a/docs/manual/kinds/sros.md b/docs/manual/kinds/sros.md
85: index 633972e..7c0f2e1 100644
86: --- a/docs/manual/kinds/sros.md
87: +++ b/docs/manual/kinds/sros.md
88: @@ -239,13 +239,19 @@ topology:
89:          NOKIA_SROS_MDA_1: me12-100gb-qsfp28 # override default MDA type in slot 1
90:  ```
91:  
92:  ///
93:  
94: -For known SR/IXR integrated nodes, containerlab's default model-driven configuration also provisions the default card and MDA configuration. The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`. If the hardware is overridden with `components` or SR-SIM environment variables, the generated SR OS card/MDA configuration follows those overrides.
95: +For known SR and IXR integrated types, containerlab generates model-driven configuration for the default card and MDA(s).
96:  
97: -Integrated nodes accept at most one `components` entry because they still run as a single container. The component slot can be omitted or set to `A`; `ixr-r6` also accepts a single `B` slot override.
98: +The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e2sc`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`.
99: +
100: +An integrated node other than `ixr-r6` runs as one container and accepts one `components` entry. The slot can be omitted or set to `A`. `ixr-r6` accepts slots `A` and `B`. Two `ixr-r6` entries, one for `A` and one for `B`, run as a dual-CPIOM node with one container per CPM. Integrated nodes do not accept numeric line-card slots.
101: +
102: +A `components` entry with `type` sets `NOKIA_SROS_CARD`. Containerlab then skips generated card and MDA configuration, because those defaults belong to the built-in card. Set `type` when the integrated card itself must change, for example `cpm-ixr-e2n/imm4-sfp+4-sfp+`.
103: +
104: +Node `env` overrides `components`: `type`, `xiom`, `mda`, per-component `env`, and the `sfm` key. When both set the same variable to different values, the environment variable wins and containerlab logs a warning naming that variable. `NOKIA_SROS_MDA_*` and `NOKIA_SROS_XIOM_*` are written into the generated configuration. `NOKIA_SROS_CARD` skips that generation, the same as a component `type`. On a distributed node, `NOKIA_SROS_SLOT` does not replace each component's slot.
105:  
106:  ### Distributed
107:  
108:  When the emulated platform is chassis-based, like SR-7, SR-14s, etc., the SR-SIM node must be defined in a distributed mode in the topology file.
109:  
110: @@ -385,16 +391,18 @@ topology:
111:  When a distributed SR-SIM node is defined using `components`, we need to take into account the following:
112:  
113:  1. Component containers are attached to an internal namespace pause container.
114:  2. When changing a MDA or card type from its default value, the configuration for card, SFM and MDA must be also defined.
115:  3. Links can be added referring to the node name. The same [interface naming](#interface-naming) convention holds for all SR-SIM nodes.
116: -4. Environment variable based configuration on per-component, or node-level will override the configuration set in `type`, `xiom` and `mda` fields.
117: +4. Environment variable based configuration on per-component, or node-level will override the configuration set in `type`, `xiom` and `mda` fields. Node-level `env` wins over both. When the values differ, containerlab logs a warning naming the environment variable that was kept.
118:  
119:  ##### Configuration for components
120:  
121:  When using the `components` structure in the node definition for a distributed node, containerlab will also generate the SR OS configuration for the installed components in the chassis, as well as relevant power supply configuration[^6] to ensure the installed components come up without requiring a user to manually provide the configuration. The same generated configuration mechanism is used for the built-in SR/IXR integrated defaults.
122:  
123: +At deploy time, containerlab reads `chassis_info.json` from the selected SR-SIM image and compares the effective `components` configuration with the hardware types listed for that chassis. Unsupported card slots and card, SFM, XIOM, or MDA types produce warnings but do not stop deployment. This is a best-effort check: compatibility that is not represented in `chassis_info.json`, such as the MDA types supported by a specific XIOM, is not validated.
124: +
125:  /// details | Disabling generated SR OS configuration for `components`
126:      type: tip
127:  You can disable this config generation behavior by setting the `gen-component-config: false` [kind-specific config key](../nodes.md#kind-specific-config) on the node, or on the base node for a distributed chassis.
128:  
129:  ```yaml hl_lines="6"
130: diff --git a/nodes/sros/README.md b/nodes/sros/README.md
131: index 3fbdee2..435bf6d 100644
132: --- a/nodes/sros/README.md
133: +++ b/nodes/sros/README.md
134: @@ -37,11 +37,23 @@ The SR OS node kind supports deploying Nokia's SR OS network operating system in
135:  - **`sros_test.go`**: Unit tests
136:    - Node type helper method tests
137:    - Edge case validation
138:    - Version parsing tests
139:  
140: -- During PreDeploy, `chassis_info.json` is read from the node image (`/opt/nokia/chassis_info.json`) and written under the node's lab directory (`n.Cfg.LabDir`) with the same filename.
141: +- **`component.go`**: Component model, slot checks, and environment precedence
142: +- **`component_config.go`**: Generated card, SFM, XIOM, and MDA configuration, including integrated defaults
143: +- **`chassis_info.go`**: Parses `chassis_info.json` and returns advisory compatibility warnings
144: +
145: +### Chassis info and component checks
146: +
147: +During PreDeploy, `createSROSFiles` reads `/opt/nokia/chassis_info.json` from the node image and writes it to `n.Cfg.LabDir/chassis_info.json`, prefixed with the license header. Failure to read the file is logged and does not stop deployment.
148: +
149: +The same file is then compared with the effective component configuration. Aliases such as `SAR-Mx` to `SAR-Hx` are followed. Unsupported slots, CPM/IOM types, SFM, XIOM, direct MDAs, and fixed-hardware mismatches produce warnings only. MDAs nested under an XIOM are not checked, because the file does not say which MDA types a given XIOM accepts.
150: +
151: +### Environment precedence
152: +
153: +Node `env` overrides per-component `env`, which overrides `type`, `xiom`, `mda`, and `sfm`. When a node environment variable replaces a different component value, containerlab logs that the component value will not be used and names the variable. `NOKIA_SROS_SLOT` still comes from each component in a distributed node, because one node-level slot cannot identify every card.
154:  
155:  ## Architecture
156:  
157:  ### Node Type Detection
158:  
159: @@ -346,29 +358,16 @@ componentConfig := ""
160:  if !isFullConfigFile(n.Cfg.StartupConfig) {
161:      componentConfig = n.generateComponentConfig()
162:  }
163:  ```
164:  
165: -For distributed SR OS deployments with multiple CPMs and linecards, this generates:
166: -- Slot-specific configuration
167: -- Card type definitions
168: -- MDA (Media Dependent Adapter) configurations
169: -- Fabric connectivity
170: +For integrated nodes and distributed line cards, this appends flat MD-CLI lines. CPM slots `A` and `B` are not provisioned as cards. `NOKIA_SROS_CARD`, or a component `type` on an integrated node, skips this generation because the built-in MDA defaults belong to the default card.
171:  
172: -Example generated component config:
173:  ```
174: -/configure {
175: -    card 1 {
176: -        card-type iom-e
177: -        mda 1 {
178: -            mda-type me12-100gb-qsfp28
179: -        }
180: -    }
181: -    card A {
182: -        card-type cpm-ixr
183: -    }
184: -}
185: +/configure card 1 card-type iom-1 admin-state enable
186: +/configure card 1 mda 1 mda-type me6-100gb-qsfp28 admin-state enable
187: +/configure sfm 1 sfm-type sfm-2s admin-state enable
188:  ```
189:  
190:  #### Phase 3: Node-Type Specific Configuration (`applyNodeTypeSpecificConfig`)
191:  
192:  This phase customizes the template data based on the node's platform type and security settings.
193: @@ -1047,83 +1046,22 @@ Each platform type has tailored configurations embedded in the `configs/` direct
194:  **SAR Classic Mode:**
195:  - **No gRPC configuration embedded**
196:  - SAR in classic mode doesn't support gRPC
197:  - Uses only CLI/NETCONF for management
198:  
199: -### Distributed SR OS Configuration
200: -
201: -For distributed deployments with multiple components (CPMs and line cards), additional configuration is generated.
202: -
203: -#### Component Configuration Generation
204: -
205: -```go
206: -func (n *sros) generateComponentConfig() string
207: -```
208: -
209: -**Generated Configuration Structure:**
210: -
211: -```
212: -/configure {
213: -    {{- range .Components }}
214: -    card {{ .Slot }} {
215: -        card-type {{ .Type }}
216: -        {{- if .MDAs }}
217: -        {{- range .MDAs }}
218: -        mda {{ .Slot }} {
219: -            mda-type {{ .Type }}
220: -        }
221: -        {{- end }}
222: -        {{- end }}
223: -    }
224: -    {{- end }}
225: -    
226: -    {{- if .FabricConfig }}
227: -    fabric {
228: -        {{ .FabricConfig }}
229: -    }
230: -    {{- end }}
231: -}
232: -```
233: +### Component configuration
234:  
235: -**Example Distributed Topology:**
236: +`generateComponentConfig` runs for integrated nodes and for the CPM of a distributed node, unless the user supplied a full startup config, selected classic mode, or set `gen-component-config: false`.
237:  
238: -```yaml
239: -nodes:
240: -  chassis1:
241: -    kind: nokia_srsim
242: -    components:
243: -      - slot: A
244: -        type: cpm-ixr
245: -      - slot: B
246: -        type: cpm-ixr
247: -      - slot: 1
248: -        type: iom-ixr
249: -        mda:
250: -          - slot: 1
251: -            type: m20-1gb-sfp-b
252: -```
253: +Known integrated types (`sr-1`, `sr-1s`, `ixr-r6`, and the `ixr-e*` pizza boxes) get built-in card and MDA lines. One `components` entry is accepted, with the slot omitted or set to `A`. `ixr-r6` also accepts `B`, and two entries (`A` and `B`) deploy a dual-CPIOM node. A component `type` sets `NOKIA_SROS_CARD` and skips generated card and MDA lines.
254:  
255: -**Generated Component Config:**
256: +Distributed line cards produce one line per card, SFM, XIOM, and direct MDA. The values are the effective ones after environment precedence, so `NOKIA_SROS_MDA_*` and `NOKIA_SROS_XIOM_*` change the generated lines.
257:  
258:  ```
259: -/configure {
260: -    card A {
261: -        card-type cpm-ixr
262: -    }
263: -    card B {
264: -        card-type cpm-ixr
265: -    }
266: -    card 1 {
267: -        card-type iom-ixr
268: -        mda 1 {
269: -            mda-type m20-1gb-sfp-b
270: -        }
271: -    }
272: -    fabric {
273: -        multiplane-mode enabled
274: -    }
275: -}
276: +/configure card 1 card-type xcm-2s admin-state enable
277: +/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable
278: +/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable
279:  ```
280:  
281:  ### Security and Certificate Management
282:  
283:  When `certificate.issue: true` is set, the system generates and injects TLS certificates.
284: @@ -1538,14 +1476,14 @@ docker ps | grep chassis1
285:  # Verify slot assignments
286:  ssh admin@clab-mylab-chassis1-cpm-a "show card state"
287:  ```
288:  
289:  **Common Causes:**
290: -- Component slots not properly defined
291: -- CPM slot names must be "A" or "B" (uppercase)
292: +- Component slots are duplicated, including slots that differ only by case
293:  - Line card slots must be numeric
294: -- Environment variables not set on components
295: +- The component type or MDA is not listed for that chassis in the image's `chassis_info.json` (this is logged as a warning and does not stop deployment)
296: +- A node-level environment variable overrides the component value; the log names the variable that was kept
297:  
298:  ## Performance Considerations
299:  
300:  ### Template Execution Performance
301:  
302: @@ -1638,7 +1576,7 @@ BSD 3-Clause License - See LICENSE file for details
303:  
304:  **Maintainers:**
305:  - Nokia Containerlab Team
306:  - Community Contributors
307:  
308: -**Last Updated:** 2025-11-15
309: -**SR OS Versions Supported:**  25.7+, 26.x (planned)
310: +**Last Updated:** 2026-10-14
311: +**SR OS Versions Supported:**  25.7+, 26.x
312: diff --git a/nodes/sros/chassis_info.go b/nodes/sros/chassis_info.go
313: index ace213b..fe5b7f8 100644
314: --- a/nodes/sros/chassis_info.go
315: +++ b/nodes/sros/chassis_info.go
316: @@ -2,10 +2,221 @@
317:  // Licensed under the BSD 3-Clause License.
318:  // SPDX-License-Identifier: BSD-3-Clause
319:  
320:  package sros
321:  
322: +import (
323: +	"encoding/json"
324: +	"fmt"
325: +	"slices"
326: +	"strconv"
327: +	"strings"
328: +)
329: +
330:  // DefaultChassisInfoPath is the path to chassis_info.json inside SROS/SR SIM container images.
331:  const DefaultChassisInfoPath = "/opt/nokia/chassis_info.json"
332:  
333:  // chassisInfoFileLicense is prepended to the chassis_info.json file written to LabDir.
334:  const chassisInfoFileLicense = "// Copyright 2026 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\n"
335: +
336: +type chassisInfoEntry struct {
337: +	Alias      string            `json:"alias"`
338: +	CPM        []string          `json:"cpm"`
339: +	IOM        []string          `json:"iom"`
340: +	IOMSlots   int               `json:"iom_slots"`
341: +	MDA        []*string         `json:"mda"`
342: +	FixedMDAs  map[string]string `json:"fixed_mdas"`
343: +	SFM        []string          `json:"sfm"`
344: +	XIOM       []string          `json:"xiom"`
345: +	FixedHWCfg string            `json:"fixed_hw_cfg"`
346: +	Integrated bool              `json:"integrated"`
347: +	Redundant  bool              `json:"redundant"`
348: +}
349: +
350: +type chassisInfo map[string]chassisInfoEntry
351: +
352: +func parseChassisInfo(content []byte) (chassisInfo, error) {
353: +	var info chassisInfo
354: +	if err := json.Unmarshal(content, &info); err != nil {
355: +		return nil, fmt.Errorf("parse chassis_info.json: %w", err)
356: +	}
357: +	return info, nil
358: +}
359: +
360: +func (i chassisInfo) entry(nodeType string) (chassisInfoEntry, bool) {
361: +	key := ""
362: +	for candidate := range i {
363: +		if strings.EqualFold(candidate, strings.TrimSpace(nodeType)) {
364: +			key = candidate
365: +			break
366: +		}
367: +	}
368: +	if key == "" {
369: +		return chassisInfoEntry{}, false
370: +	}
371: +
372: +	seen := map[string]struct{}{}
373: +	for {
374: +		if _, ok := seen[key]; ok {
375: +			return chassisInfoEntry{}, false
376: +		}
377: +		seen[key] = struct{}{}
378: +
379: +		entry := i[key]
380: +		if entry.Alias == "" {
381: +			return entry, true
382: +		}
383: +
384: +		key = ""
385: +		for candidate := range i {
386: +			if strings.EqualFold(candidate, entry.Alias) {
387: +				key = candidate
388: +				break
389: +			}
390: +		}
391: +		if key == "" {
392: +			return chassisInfoEntry{}, false
393: +		}
394: +	}
395: +}
396: +
397: +// componentWarnings returns best-effort validation warnings. It deliberately skips checks
398: +// that chassis_info.json cannot express, such as which MDA types belong under a specific XIOM.
399: +func (i chassisInfo) componentWarnings(nodeType, sfm string, components []*Component) []string {
400: +	entry, ok := i.entry(nodeType)
401: +	if !ok {
402: +		return []string{
403: +			fmt.Sprintf(
404: +				"chassis type %q is not present in chassis_info.json; component compatibility was not checked",
405: +				nodeType,
406: +			),
407: +		}
408: +	}
409: +
410: +	var warnings []string
411: +	if sfm != "" && len(entry.SFM) > 0 && !slices.Contains(entry.SFM, sfm) {
412: +		warnings = append(warnings, fmt.Sprintf(
413: +			"SFM type %q is not listed for chassis type %q",
414: +			sfm,
415: +			nodeType,
416: +		))
417: +	}
418: +
419: +	for _, component := range components {
420: +		if component == nil {
421: +			continue
422: +		}
423: +		slot := strings.ToUpper(strings.TrimSpace(component.Slot))
424: +		if slot == "" {
425: +			slot = slotAName
426: +		}
427: +
428: +		switch {
429: +		case slot == slotAName || slot == slotBName:
430: +			if slot == slotBName && !entry.Redundant {
431: +				warnings = append(warnings, fmt.Sprintf(
432: +					"component slot %s is not listed as supported for chassis type %q",
433: +					slot,
434: +					nodeType,
435: +				))
436: +			}
437: +			if component.Type != "" &&
438: +				entry.FixedHWCfg != "" &&
439: +				component.Type != entry.FixedHWCfg {
440: +				warnings = append(warnings, fmt.Sprintf(
441: +					"component type %q in slot %s does not match fixed hardware %q for chassis type %q",
442: +					component.Type,
443: +					slot,
444: +					entry.FixedHWCfg,
445: +					nodeType,
446: +				))
447: +			} else if component.Type != "" &&
448: +				entry.FixedHWCfg == "" &&
449: +				len(entry.CPM) > 0 &&
450: +				!slices.Contains(entry.CPM, component.Type) {
451: +				warnings = append(warnings, fmt.Sprintf(
452: +					"component type %q in slot %s is not listed for chassis type %q",
453: +					component.Type,
454: +					slot,
455: +					nodeType,
456: +				))
457: +			}
458: +		default:
459: +			numericSlot, err := strconv.Atoi(slot)
460: +			if err == nil {
461: +				if entry.IOMSlots > 0 && numericSlot > entry.IOMSlots {
462: +					warnings = append(warnings, fmt.Sprintf(
463: +						"component slot %s exceeds the %d IOM slots listed for chassis type %q",
464: +						slot,
465: +						entry.IOMSlots,
466: +						nodeType,
467: +					))
468: +				}
469: +				if component.Type != "" &&
470: +					len(entry.IOM) > 0 &&
471: +					!slices.Contains(entry.IOM, component.Type) {
472: +					warnings = append(warnings, fmt.Sprintf(
473: +						"component type %q in slot %s is not listed for chassis type %q",
474: +						component.Type,
475: +						slot,
476: +						nodeType,
477: +					))
478: +				}
479: +			}
480: +		}
481: +
482: +		for _, xiom := range component.XIOM {
483: +			if xiom.Type != "" &&
484: +				len(entry.XIOM) > 0 &&
485: +				!slices.Contains(entry.XIOM, xiom.Type) {
486: +				warnings = append(warnings, fmt.Sprintf(
487: +					"XIOM type %q in component slot %s is not listed for chassis type %q",
488: +					xiom.Type,
489: +					slot,
490: +					nodeType,
491: +				))
492: +			}
493: +		}
494: +
495: +		if entry.Integrated || (slot != slotAName && slot != slotBName) {
496: +			warnings = append(warnings, validateMDAs(nodeType, entry, component.MDA)...)
497: +		}
498: +	}
499: +
500: +	return warnings
501: +}
502: +
503: +func validateMDAs(nodeType string, entry chassisInfoEntry, mdas MDAS) []string {
504: +	var warnings []string
505: +	for _, mda := range mdas {
506: +		if fixed, exists := entry.FixedMDAs[strconv.Itoa(mda.Slot)]; exists {
507: +			if mda.Type != fixed {
508: +				warnings = append(warnings, fmt.Sprintf(
509: +					"MDA type %q in slot %d does not match fixed MDA %q for chassis type %q",
510: +					mda.Type,
511: +					mda.Slot,
512: +					fixed,
513: +					nodeType,
514: +				))
515: +			}
516: +			continue
517: +		}
518: +		if mda.Type != "" && !containsChassisType(entry.MDA, mda.Type) {
519: +			warnings = append(warnings, fmt.Sprintf(
520: +				"MDA type %q in slot %d is not listed for chassis type %q",
521: +				mda.Type,
522: +				mda.Slot,
523: +				nodeType,
524: +			))
525: +		}
526: +	}
527: +	return warnings
528: +}
529: +
530: +func containsChassisType(types []*string, value string) bool {
531: +	for _, typ := range types {
532: +		if typ != nil && *typ == value {
533: +			return true
534: +		}
535: +	}
536: +	return false
537: +}
538: diff --git a/nodes/sros/chassis_info_test.go b/nodes/sros/chassis_info_test.go
539: new file mode 100644
540: index 0000000..befd2b4
541: --- /dev/null
542: +++ b/nodes/sros/chassis_info_test.go
543: @@ -0,0 +1,99 @@
544: +// Copyright 2026 Nokia
545: +// Licensed under the BSD 3-Clause License.
546: +// SPDX-License-Identifier: BSD-3-Clause
547: +
548: +package sros
549: +
550: +import (
551: +	"testing"
552: +
553: +	"github.com/stretchr/testify/assert"
554: +	"github.com/stretchr/testify/require"
555: +)
556: +
557: +func TestChassisInfoComponentWarnings(t *testing.T) {
558: +	info, err := parseChassisInfo([]byte(`{
559: +		"IXR-x": {
560: +			"cpm": ["cpm-ixr-x"],
561: +			"iom": ["imm6-qsfpdd+48-sfp56"],
562: +			"iom_slots": 1,
563: +			"mda": [null],
564: +			"sfm": ["sfm-ixr-x"]
565: +		},
566: +		"SAR-Hx": {
567: +			"cpm": ["iom-sar-1x"],
568: +			"fixed_mdas": {"2": "fixed-mda"},
569: +			"integrated": true,
570: +			"mda": ["supported-mda"],
571: +			"xiom": ["supported-xiom"]
572: +		},
573: +		"SAR-Mx": {"alias": "SAR-Hx"}
574: +	}`))
575: +	require.NoError(t, err)
576: +
577: +	t.Run("supported configuration", func(t *testing.T) {
578: +		warnings := info.componentWarnings("sar-mx", "", []*Component{{
579: +			Slot: slotAName,
580: +			Type: "iom-sar-1x",
581: +			MDA: MDAS{
582: +				{Slot: 1, Type: "supported-mda"},
583: +				{Slot: 2, Type: "fixed-mda"},
584: +			},
585: +			XIOM: XIOMS{{Slot: 1, Type: "supported-xiom"}},
586: +		}})
587: +
588: +		assert.Empty(t, warnings)
589: +	})
590: +
591: +	t.Run("unsupported values warn", func(t *testing.T) {
592: +		warnings := info.componentWarnings("IXR-x", "wrong-sfm", []*Component{
593: +			{Slot: slotAName, Type: "wrong-cpm"},
594: +			{Slot: "2", Type: "wrong-iom", MDA: MDAS{{Slot: 1, Type: "wrong-mda"}}},
595: +		})
596: +
597: +		assert.Len(t, warnings, 5)
598: +		assert.Contains(t, warnings[0], "SFM type")
599: +		assert.Contains(t, warnings[1], "component type")
600: +		assert.Contains(t, warnings[2], "exceeds")
601: +		assert.Contains(t, warnings[3], "component type")
602: +		assert.Contains(t, warnings[4], "MDA type")
603: +	})
604: +
605: +	t.Run("fixed MDA mismatch warns", func(t *testing.T) {
606: +		warnings := info.componentWarnings("SAR-Hx", "", []*Component{{
607: +			Slot: slotAName,
608: +			MDA:  MDAS{{Slot: 2, Type: "wrong-mda"}},
609: +		}})
610: +
611: +		require.Len(t, warnings, 1)
612: +		assert.Contains(t, warnings[0], "does not match fixed MDA")
613: +	})
614: +
615: +	t.Run("distributed CPM slot does not validate direct MDAs", func(t *testing.T) {
616: +		warnings := info.componentWarnings("IXR-x", "", []*Component{{
617: +			Slot: slotAName,
618: +			Type: "cpm-ixr-x",
619: +			MDA:  MDAS{{Slot: 1, Type: "not-a-cpm-mda"}},
620: +		}})
621: +
622: +		assert.Empty(t, warnings)
623: +	})
624: +
625: +	t.Run("nested XIOM MDA is not guessed", func(t *testing.T) {
626: +		warnings := info.componentWarnings("SAR-Hx", "", []*Component{{
627: +			Slot: slotAName,
628: +			XIOM: XIOMS{{
629: +				Slot: 1,
630: +				Type: "supported-xiom",
631: +				MDA:  MDAS{{Slot: 1, Type: "not-in-chassis-mda-list"}},
632: +			}},
633: +		}})
634: +
635: +		assert.Empty(t, warnings)
636: +	})
637: +}
638: +
639: +func TestParseChassisInfoRejectsInvalidJSON(t *testing.T) {
640: +	_, err := parseChassisInfo([]byte(`{"SR-1":`))
641: +	require.Error(t, err)
642: +}
643: diff --git a/nodes/sros/component.go b/nodes/sros/component.go
644: index bdac689..b62efb3 100644
645: --- a/nodes/sros/component.go
646: +++ b/nodes/sros/component.go
647: @@ -1,10 +1,15 @@
648:  package sros
649:  
650:  import (
651:  	"fmt"
652: +	"maps"
653: +	"slices"
654: +	"strconv"
655:  	"strings"
656: +
657: +	"github.com/charmbracelet/log"
658:  )
659:  
660:  // Component is an SR-SIM card: a CPM (slot A or B) or a line card.
661:  type Component struct {
662:  	Slot string            `yaml:"slot,omitempty" json:"slot,omitempty"`
663: @@ -117,5 +122,188 @@ func (l *XIOMS) UnmarshalYAML(unmarshal func(any) error) error {
664:  
665:  	*l = XIOMS(entries)
666:  
667:  	return nil
668:  }
669: +
670: +func setComponentEnvVars(env map[string]string, c *Component) {
671: +	if c.Type != "" {
672: +		env[envNokiaSrosCard] = c.Type
673: +	}
674: +
675: +	for _, x := range c.XIOM {
676: +		key := fmt.Sprintf("%s_X%d", envNokiaSrosXIOM, x.Slot)
677: +		env[key] = x.Type
678: +		// add the nested MDA
679: +		for _, m := range x.MDA {
680: +			key := fmt.Sprintf("%s_X%d_%d", envNokiaSrosMDA, x.Slot, m.Slot)
681: +			env[key] = m.Type
682: +		}
683: +	}
684: +
685: +	for _, m := range c.MDA {
686: +		key := fmt.Sprintf("%s_%d", envNokiaSrosMDA, m.Slot)
687: +		env[key] = m.Type
688: +	}
689: +}
690: +
691: +func (n *sros) checkComponentSlotsConfig() error {
692: +	// check Slots are unique
693: +	componentNames := map[string]struct{}{}
694: +	for _, component := range n.kindSpecificCfg().Components {
695: +		// convert slot to upper
696: +		slot := strings.ToUpper(component.Slot)
697: +		// check if slot exists
698: +		_, exists := componentNames[slot]
699: +		if exists {
700: +			return fmt.Errorf(
701: +				"node %s slot %s duplicate definition",
702: +				n.GetShortName(),
703: +				component.Slot,
704: +			)
705: +		}
706: +		// add to component names map
707: +		componentNames[slot] = struct{}{}
708: +
709: +	}
710: +	return nil
711: +}
712: +
713: +// componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,
714: +// and per-component env. Per-component env overrides the typed fields.
715: +func componentDerivedEnv(c *Component) map[string]string {
716: +	derived := map[string]string{}
717: +	if c == nil {
718: +		return derived
719: +	}
720: +	setComponentEnvVars(derived, c)
721: +	maps.Copy(derived, c.Env)
722: +	return derived
723: +}
724: +
725: +// warnUserEnvOverrides logs when a node env var replaces a component-derived value.
726: +func warnUserEnvOverrides(node string, derived, userEnv map[string]string) {
727: +	for key, componentValue := range derived {
728: +		envValue, userSet := userEnv[key]
729: +		if !userSet || componentValue == envValue {
730: +			continue
731: +		}
732: +		log.Warn(
733: +			fmt.Sprintf(
734: +				"component value %q will not be used because environment variable %s is set",
735: +				componentValue,
736: +				key,
737: +			),
738: +			"node", node,
739: +			"env", key,
740: +			"component-value", componentValue,
741: +			"env-value", envValue,
742: +		)
743: +	}
744: +}
745: +
746: +// keepUserEnv copies component-derived keys into dst unless the user already set that key.
747: +// A user value wins, and a differing component value is logged.
748: +func keepUserEnv(node string, dst, derived, userEnv map[string]string) {
749: +	warnUserEnvOverrides(node, derived, userEnv)
750: +	for key, componentValue := range derived {
751: +		if envValue, userSet := userEnv[key]; userSet {
752: +			dst[key] = envValue
753: +			continue
754: +		}
755: +		dst[key] = componentValue
756: +	}
757: +}
758: +
759: +// cloneComponent returns a deep copy of c suitable for env overrides during config generation.
760: +func cloneComponent(c *Component) *Component {
761: +	if c == nil {
762: +		return &Component{}
763: +	}
764: +	out := *c
765: +	out.Env = maps.Clone(c.Env)
766: +	out.MDA = slices.Clone(c.MDA)
767: +	if len(c.XIOM) > 0 {
768: +		out.XIOM = make(XIOMS, len(c.XIOM))
769: +		for i, xiom := range c.XIOM {
770: +			xiom.MDA = slices.Clone(xiom.MDA)
771: +			out.XIOM[i] = xiom
772: +		}
773: +	}
774: +	return &out
775: +}
776: +
777: +// applyHardwareEnv overlays SR-SIM card, XIOM, and MDA environment variables onto c.
778: +// NOKIA_SROS_SLOT is left unchanged; it identifies the container rather than provisioned hardware.
779: +func applyHardwareEnv(c *Component, env map[string]string) {
780: +	if c == nil || len(env) == 0 {
781: +		return
782: +	}
783: +	if card := env[envNokiaSrosCard]; card != "" {
784: +		c.Type = card
785: +	}
786: +	for key, val := range env {
787: +		if val == "" {
788: +			continue
789: +		}
790: +		switch {
791: +		case strings.HasPrefix(key, envNokiaSrosMDA+"_X"):
792: +			rest := strings.TrimPrefix(key, envNokiaSrosMDA+"_X")
793: +			xiomStr, mdaStr, ok := strings.Cut(rest, "_")
794: +			if !ok {
795: +				continue
796: +			}
797: +			xiomSlot, errX := strconv.Atoi(xiomStr)
798: +			mdaSlot, errM := strconv.Atoi(mdaStr)
799: +			if errX != nil || errM != nil || xiomSlot <= 0 || mdaSlot <= 0 {
800: +				continue
801: +			}
802: +			upsertXiomMDA(c, xiomSlot, mdaSlot, val)
803: +		case strings.HasPrefix(key, envNokiaSrosMDA+"_"):
804: +			slot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosMDA+"_"))
805: +			if err != nil || slot <= 0 {
806: +				continue
807: +			}
808: +			c.MDA = upsertMDA(c.MDA, slot, val)
809: +		case strings.HasPrefix(key, envNokiaSrosXIOM+"_X"):
810: +			slot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosXIOM+"_X"))
811: +			if err != nil || slot <= 0 {
812: +				continue
813: +			}
814: +			upsertXiomType(c, slot, val)
815: +		}
816: +	}
817: +}
818: +
819: +func upsertMDA(mdas MDAS, slot int, typ string) MDAS {
820: +	for i := range mdas {
821: +		if mdas[i].Slot == slot {
822: +			mdas[i].Type = typ
823: +			return mdas
824: +		}
825: +	}
826: +	return append(mdas, MDA{Slot: slot, Type: typ})
827: +}
828: +
829: +func upsertXiomType(c *Component, slot int, typ string) {
830: +	for i := range c.XIOM {
831: +		if c.XIOM[i].Slot == slot {
832: +			c.XIOM[i].Type = typ
833: +			return
834: +		}
835: +	}
836: +	c.XIOM = append(c.XIOM, XIOM{Slot: slot, Type: typ})
837: +}
838: +
839: +func upsertXiomMDA(c *Component, xiomSlot, mdaSlot int, typ string) {
840: +	for i := range c.XIOM {
841: +		if c.XIOM[i].Slot != xiomSlot {
842: +			continue
843: +		}
844: +		c.XIOM[i].MDA = upsertMDA(c.XIOM[i].MDA, mdaSlot, typ)
845: +		return
846: +	}
847: +	c.XIOM = append(c.XIOM, XIOM{
848: +		Slot: xiomSlot,
849: +		MDA:  MDAS{{Slot: mdaSlot, Type: typ}},
850: +	})
851: +}
852: diff --git a/nodes/sros/component_config.go b/nodes/sros/component_config.go
853: index 914f3de..3985e12 100644
854: --- a/nodes/sros/component_config.go
855: +++ b/nodes/sros/component_config.go
856: @@ -4,13 +4,15 @@
857:  
858:  package sros
859:  
860:  import (
861:  	"fmt"
862: +	"maps"
863:  	"slices"
864: -	"strconv"
865:  	"strings"
866: +
867: +	"github.com/charmbracelet/log"
868:  )
869:  
870:  const integratedSrosCardSlot = "1"
871:  
872:  type integratedSrosDefaultComponent struct {
873: @@ -82,10 +84,17 @@ var integratedSrosDefaultComponents = map[string]integratedSrosDefaultComponent{
874:  		allowedSlots: []string{slotAName},
875:  		mdas: MDAS{
876:  			{Slot: 1, Type: "m16-sfp112+15-sfp56+6-qsfpdd"},
877:  		},
878:  	},
879: +	"ixr-e2sc": {
880: +		cardType:     "imm16-sfp++4-sfp28",
881: +		allowedSlots: []string{slotAName},
882: +		mdas: MDAS{
883: +			{Slot: 1, Type: "m16-sfp++4-sfp28"},
884: +		},
885: +	},
886:  	"ixr-ec": {
887:  		cardType:     "imm4-1g-tx+20-1g-sfp+6-10g-sfp+",
888:  		allowedSlots: []string{slotAName},
889:  		mdas: MDAS{
890:  			{Slot: 1, Type: "m4-1g-tx+20-1g-sfp+6-10g-sfp+"},
891: @@ -172,66 +181,44 @@ func buildComponentCfgLines(components []*Component, sfm string) []componentCfgL
892:  		}
893:  	}
894:  	return lines
895:  }
896:  
897: -func buildIntegratedComponentCfgLines(
898: -	nodeType string,
899: -	env map[string]string,
900: -) []componentCfgLine {
901: +func buildIntegratedComponentCfgLines(nodeType string, override *Component) []componentCfgLine {
902:  	component, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]
903:  	if !ok {
904:  		return nil
905:  	}
906: -
907: -	cardType := component.cardType
908: -	if envCardType := strings.TrimSpace(env[envNokiaSrosCard]); envCardType != "" {
909: -		cardType = envCardType
910: +	if override == nil {
911: +		override = &Component{}
912:  	}
913:  
914: -	lines := []componentCfgLine{
915: -		{Kind: "card", Slot: integratedSrosCardSlot, Type: cardType},
916: +	defaultMdas := component.mdas
917: +
918: +	if len(override.XIOM) > 0 {
919: +		defaultMdas = nil
920:  	}
921:  
922: -	for _, mda := range mergeIntegratedMdas(component.mdas, env) {
923: -		lines = append(lines, componentCfgLine{
924: -			Kind: "mda", Slot: integratedSrosCardSlot, MdaSlot: mda.Slot, Type: mda.Type,
925: -		})
926: +	card := &Component{
927: +		Slot: integratedSrosCardSlot,
928: +		Type: component.cardType,
929: +		XIOM: override.XIOM,
930: +		MDA:  mergeIntegratedMdas(defaultMdas, override.MDA),
931:  	}
932:  
933: -	return lines
934: +	return buildComponentCfgLines([]*Component{card}, "")
935:  }
936:  
937: -func mergeIntegratedMdas(defaults MDAS, env map[string]string) MDAS {
938: +func mergeIntegratedMdas(defaults, overrides MDAS) MDAS {
939:  	bySlot := map[int]string{}
940: -	for _, mda := range defaults {
941: +	for _, mda := range slices.Concat(defaults, overrides) {
942:  		if mda.Slot > 0 && mda.Type != "" {
943:  			bySlot[mda.Slot] = mda.Type
944:  		}
945:  	}
946:  
947: -	const prefix = envNokiaSrosMDA + "_"
948: -	for key, value := range env {
949: -		slotText, ok := strings.CutPrefix(key, prefix)
950: -		if !ok {
951: -			continue
952: -		}
953: -		slot, err := strconv.Atoi(slotText)
954: -		if err != nil || slot <= 0 {
955: -			continue
956: -		}
957: -		if value = strings.TrimSpace(value); value != "" {
958: -			bySlot[slot] = value
959: -		}
960: -	}
961: -
962: -	slots := make([]int, 0, len(bySlot))
963: -	for slot := range bySlot {
964: -		slots = append(slots, slot)
965: -	}
966: -	slices.Sort(slots)
967: -
968: +	slots := slices.Sorted(maps.Keys(bySlot))
969:  	mdas := make(MDAS, 0, len(slots))
970:  	for _, slot := range slots {
971:  		mdas = append(mdas, MDA{Slot: slot, Type: bySlot[slot]})
972:  	}
973:  	return mdas
974: @@ -257,19 +244,150 @@ func integratedSrosAllowedSlots(nodeType string) []string {
975:  		return []string{slotAName}
976:  	}
977:  	return component.allowedSlots
978:  }
979:  
980: -func isSingleSlotIntegratedSrosNodeType(nodeType string) bool {
981: -	if !isIntegratedSrosNodeType(nodeType) {
982: +func isRedundantIntegratedSrosComponents(nodeType string, components []*Component) bool {
983: +	if !isIntegratedSrosNodeType(nodeType) || len(components) < 2 {
984:  		return false
985:  	}
986: -	return len(integratedSrosAllowedSlots(nodeType)) == 1
987: +	for _, c := range components {
988: +		if strings.TrimSpace(c.Slot) == "" || !integratedSrosSlotAllowed(nodeType, c.Slot) {
989: +			return false
990: +		}
991: +	}
992: +	return true
993:  }
994:  
995:  func integratedSrosSlotAllowed(nodeType, slot string) bool {
996:  	slot = strings.ToUpper(strings.TrimSpace(slot))
997:  	if slot == "" {
998:  		slot = standaloneSlotName
999:  	}
1000:  	return slices.Contains(integratedSrosAllowedSlots(nodeType), slot)
1001:  }
1002: +
1003: +func (n *sros) generateComponentConfig() string {
1004: +	if !n.kindSpecificCfg().GenComponentConfig {
1005: +		return ""
1006: +	}
1007: +	if n.isConfigClassic() {
1008: +		return ""
1009: +	}
1010: +
1011: +	if isIntegratedSrosNodeType(n.Cfg.NodeType) {
1012: +		return n.generateIntegratedComponentConfig()
1013: +	}
1014: +
1015: +	components := n.rootComponents
1016: +	if len(components) == 0 {
1017: +		return ""
1018: +	}
1019: +
1020: +	for _, c := range components {
1021: +		slot := strings.ToUpper(strings.TrimSpace(c.Slot))
1022: +		if slot == slotAName || slot == slotBName {
1023: +			continue
1024: +		}
1025: +		if c.Type == "" {
1026: +			log.Warn(
1027: +				"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.",
1028: +				"node",
1029: +				n.Cfg.ShortName,
1030: +				"slot",
1031: +				slot,
1032: +			)
1033: +		}
1034: +	}
1035: +
1036: +	lines := buildComponentCfgLines(n.componentsForConfig(components), n.componentSFM())
1037: +	return n.componentConfigFromLines(lines)
1038: +}
1039: +
1040: +// hardwareEnv is the topology env, which overrides component type, XIOM, and MDA.
1041: +// Nodes that have not been through Init expose that env on Cfg.Env.
1042: +func (n *sros) hardwareEnv() map[string]string {
1043: +	if n.userEnv != nil {
1044: +		return n.userEnv
1045: +	}
1046: +	return n.Cfg.Env
1047: +}
1048: +
1049: +// componentSFM is the SFM used in generated config. NOKIA_SROS_SFM overrides the sfm key.
1050: +func (n *sros) componentSFM() string {
1051: +	if sfm := n.hardwareEnv()[envNokiaSrosSFM]; sfm != "" {
1052: +		return sfm
1053: +	}
1054: +	return n.kindSpecificCfg().SFM
1055: +}
1056: +
1057: +// componentForConfig clones c and applies per-component env, then node env.
1058: +func (n *sros) componentForConfig(c *Component) *Component {
1059: +	out := cloneComponent(c)
1060: +	applyHardwareEnv(out, out.Env)
1061: +	applyHardwareEnv(out, n.hardwareEnv())
1062: +	return out
1063: +}
1064: +
1065: +func (n *sros) componentsForConfig(components []*Component) []*Component {
1066: +	out := make([]*Component, len(components))
1067: +	for i, c := range components {
1068: +		out[i] = n.componentForConfig(c)
1069: +	}
1070: +	return out
1071: +}
1072: +
1073: +func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {
1074: +	powerConfig := n.generatePowerConfig()
1075: +	if len(lines) == 0 && powerConfig == "" {
1076: +		return ""
1077: +	}
1078: +
1079: +	var config strings.Builder
1080: +	for _, l := range lines {
1081: +		config.WriteString(l.String())
1082: +	}
1083: +	config.WriteString(powerConfig)
1084: +	return config.String()
1085: +}
1086: +
1087: +func (n *sros) generateIntegratedComponentConfig() string {
1088: +	card := strings.TrimSpace(n.Cfg.Env[envNokiaSrosCard])
1089: +	if card != "" {
1090: +		log.Info(
1091: +			"Card type override set on integrated chassis type, skipping component SR OS config generation",
1092: +			"node",
1093: +			n.Cfg.ShortName,
1094: +			"type",
1095: +			n.Cfg.NodeType,
1096: +			"card",
1097: +			card,
1098: +		)
1099: +		return ""
1100: +	}
1101: +
1102: +	lines := buildIntegratedComponentCfgLines(
1103: +		n.Cfg.NodeType,
1104: +		n.componentForConfig(n.integratedComponentOverride()),
1105: +	)
1106: +	return n.componentConfigFromLines(lines)
1107: +}
1108: +
1109: +// integratedComponentOverride returns the component that overrides the integrated defaults:
1110: +// the single component of a standalone node, or the component matching the slot of a
1111: +// redundant CPM node.
1112: +func (n *sros) integratedComponentOverride() *Component {
1113: +	if n.rootCtrName == "" {
1114: +		if len(n.kindSpecificCfg().Components) == 1 {
1115: +			return n.kindSpecificCfg().Components[0]
1116: +		}
1117: +		return nil
1118: +	}
1119: +
1120: +	slot := n.Cfg.Env[envNokiaSrosSlot]
1121: +	for _, c := range n.rootComponents {
1122: +		if strings.EqualFold(strings.TrimSpace(c.Slot), slot) {
1123: +			return c
1124: +		}
1125: +	}
1126: +	return nil
1127: +}
1128: diff --git a/nodes/sros/config.go b/nodes/sros/config.go
1129: index b46ae42..8ddbb21 100644
1130: --- a/nodes/sros/config.go
1131: +++ b/nodes/sros/config.go
1132: @@ -1,8 +1,22 @@
1133:  package sros
1134:  
1135: -import "golang.org/x/mod/semver"
1136: +import (
1137: +	"bytes"
1138: +	"context"
1139: +	"fmt"
1140: +	"io"
1141: +	"os"
1142: +	"path/filepath"
1143: +	"strings"
1144: +
1145: +	clabutils "github.com/srl-labs/containerlab/utils"
1146: +
1147: +	"github.com/beevik/etree"
1148: +	"github.com/charmbracelet/log"
1149: +	"golang.org/x/mod/semver"
1150: +)
1151:  
1152:  const (
1153:  	grpcMDCLIConfig    = `/configure system grpc md-cli admin-state enable`
1154:  	profileMDCLIConfig = `/configure system security aaa local-profiles profile "administrative" grpc rpc-authorization md-cli-session permit`
1155:  	tls13CipherCCM8    = `/configure system security tls server-cipher-list "clab-all" tls13-cipher 5 name tls-aes128-ccm8-sha256`
1156: @@ -18,5 +32,314 @@ func (n *sros) setVersionSpecificParams(tplData *srosTemplateData) {
1157:  		if tplData.IsSecureGrpc {
1158:  			tplData.GRPCConfig += "\n" + tls13CipherCCM8
1159:  		}
1160:  	}
1161:  }
1162: +
1163: +// buildPKIImportXML builds the NETCONF action XML that imports a PEM file into the PKI store.
1164: +func buildPKIImportXML(inputURL, outputFile, importType string) string {
1165: +	action := etree.NewElement("action")
1166: +	action.CreateAttr("xmlns", "urn:ietf:params:xml:ns:yang:1")
1167: +
1168: +	admin := action.CreateElement("admin")
1169: +	admin.CreateAttr("xmlns", "urn:nokia.com:sros:ns:yang:sr:oper-admin")
1170: +
1171: +	importElem := admin.CreateElement("system").
1172: +		CreateElement("security").
1173: +		CreateElement("pki").
1174: +		CreateElement("import")
1175: +
1176: +	// Add import parameters
1177: +	importElem.CreateElement("input-url").SetText(inputURL)
1178: +	importElem.CreateElement("output-file").SetText(outputFile)
1179: +	importElem.CreateElement("type").SetText(importType)
1180: +	importElem.CreateElement("format").SetText("pem")
1181: +	var buf bytes.Buffer
1182: +	action.WriteTo(&buf, &etree.WriteSettings{
1183: +		CanonicalText:    false,
1184: +		CanonicalAttrVal: false,
1185: +	})
1186: +	return buf.String()
1187: +}
1188: +
1189: +// buildTLSProfileXML builds the TLS profile configuration XML.
1190: +func buildTLSProfileXML() string {
1191: +	config := etree.NewElement("config")
1192: +	configure := config.CreateElement("configure")
1193: +	configure.CreateAttr("xmlns", "urn:nokia.com:sros:ns:yang:sr:conf")
1194: +	configure.CreateAttr("xmlns:nc", "urn:ietf:params:xml:ns:netconf:base:1.0")
1195: +
1196: +	certProfile := configure.CreateElement("system").
1197: +		CreateElement("security").
1198: +		CreateElement("tls").
1199: +		CreateElement("cert-profile")
1200: +
1201: +	// Set operation attribute
1202: +	certProfile.CreateAttr("nc:operation", "merge")
1203: +
1204: +	// Add profile configuration
1205: +	certProfile.CreateElement("cert-profile-name").SetText(tlsCertProfileName)
1206: +	certProfile.CreateElement("admin-state").SetText("enable")
1207: +
1208: +	var buf bytes.Buffer
1209: +	config.WriteTo(&buf, &etree.WriteSettings{
1210: +		CanonicalText:    false,
1211: +		CanonicalAttrVal: false,
1212: +	})
1213: +	return buf.String()
1214: +}
1215: +
1216: +// createSROSConfigFiles handles config generation for the SR-SIM kind.
1217: +// Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).
1218: +func (n *sros) createSROSConfigFiles() error {
1219: +	// Get version from image before generating config
1220: +	if n.swVersion == nil {
1221: +		ctx := context.Background()
1222: +		version, err := n.srosVersionFromImage(ctx)
1223: +		if err != nil {
1224: +			n.swVersion = n.parseVersionString(srosDefaultVersion)
1225: +			log.Warn("Failed to get SR OS version from image",
1226: +				"node", n.Cfg.ShortName, "version", n.swVersion, "error", err)
1227: +		} else {
1228: +			n.swVersion = version
1229: +			log.Info("Retrieved SR OS version from image",
1230: +				"node", n.Cfg.ShortName,
1231: +				"version", fmt.Sprintf("%s.%s.%s", version.Major, version.Minor, version.Build))
1232: +		}
1233: +	}
1234: +
1235: +	// Path pointing to the target config file under configCf3 dir
1236: +	cf3CfgFile := filepath.Join(
1237: +		n.Cfg.LabDir,
1238: +		n.Cfg.Env[envNokiaSrosSlot],
1239: +		configCf3,
1240: +		startupCfgName,
1241: +	)
1242: +	isPartial := clabutils.IsPartialConfigFile(n.Cfg.StartupConfig)
1243: +
1244: +	// generate config and use that to boot node
1245: +	log.Debug("Reading startup-config", "node", n.Cfg.ShortName, "startup-config",
1246: +		n.Cfg.StartupConfig, "isPartial", isPartial)
1247: +
1248: +	startupConfig, err := n.buildStartupConfig(isPartial)
1249: +	if err != nil {
1250: +		return err
1251: +	}
1252: +
1253: +	if startupConfig == "" {
1254: +		log.Debug(
1255: +			"startup config is empty, skipping startup config file generation",
1256: +			"node",
1257: +			n.Cfg.ShortName,
1258: +		)
1259: +		return nil
1260: +	}
1261: +
1262: +	return n.GenerateConfig(cf3CfgFile, startupConfig)
1263: +}
1264: +
1265: +// buildStartupConfig returns the full startup config string: either from user file (full config)
1266: +// or from default + partial config generation. It does not return a template; the name is
1267: +// historical.
1268: +func (n *sros) buildStartupConfig(isPartial bool) (string, error) {
1269: +	// User provides full startup config
1270: +	if n.Cfg.StartupConfig != "" && !isPartial {
1271: +		c, err := os.ReadFile(n.Cfg.StartupConfig)
1272: +		if err != nil {
1273: +			return "", err
1274: +		}
1275: +
1276: +		cBuf, err := clabutils.SubstituteEnvsAndTemplate(bytes.NewReader(c), n.Cfg)
1277: +		if err != nil {
1278: +			return "", err
1279: +		}
1280: +		return cBuf.String(), nil
1281: +	}
1282: +
1283: +	// Generate default config and optionally add partial config
1284: +	if err := n.addDefaultConfig(); err != nil {
1285: +		return "", err
1286: +	}
1287: +	if err := n.addPartialConfig(); err != nil {
1288: +		return "", err
1289: +	}
1290: +
1291: +	return string(n.startupCliCfg), nil
1292: +}
1293: +
1294: +// prepareConfigTemplateData prepares all data needed for template selection and execution.
1295: +// Service configs are filled from a single table-driven result: variant → getFullSnippetSet(v).
1296: +func (n *sros) prepareConfigTemplateData() (*srosTemplateData, error) {
1297: +	b, err := n.banner()
1298: +	if err != nil {
1299: +		return nil, err
1300: +	}
1301: +
1302: +	componentConfig := ""
1303: +	if !isFullConfigFile(n.Cfg.StartupConfig) {
1304: +		componentConfig = n.generateComponentConfig()
1305: +	} else {
1306: +		log.Debugf(
1307: +			"SR-SIM node %q has non-partial startup-config defined, skipping component config gen",
1308: +			n.Cfg.LongName,
1309: +		)
1310: +	}
1311: +
1312: +	v := n.resolveConfigVariant()
1313: +	snippets := getFullSnippetSet(v)
1314: +	configMode := string(v.Mode)
1315: +	if v.ForceClassic {
1316: +		log.Warn(
1317: +			"SAR-Hm nodes only support classic configuration mode. Overriding configuration mode to 'classic'",
1318: +			"node",
1319: +			n.Cfg.LongName,
1320: +			"node-type",
1321: +			strings.ToLower(n.Cfg.NodeType),
1322: +		)
1323: +		configMode = string(ConfigModeClassic)
1324: +		n.kindSpecificCfg().ConfigMode = ConfigModeClassic
1325: +	}
1326: +
1327: +	tplData := &srosTemplateData{
1328: +		// Selection criteria
1329: +		NodeType:          strings.ToLower(n.Cfg.NodeType),
1330: +		ConfigurationMode: configMode,
1331: +		SwVersion:         n.swVersion,
1332: +		IsSecureGrpc:      *n.Cfg.Certificate.Issue,
1333: +
1334: +		// Node data
1335: +		Name:            n.Cfg.ShortName,
1336: +		TLSKey:          n.Cfg.TLSKey,
1337: +		TLSCert:         n.Cfg.TLSCert,
1338: +		TLSAnchor:       n.Cfg.TLSAnchor,
1339: +		Banner:          b,
1340: +		IFaces:          map[string]tplIFace{},
1341: +		MgmtMTU:         0,
1342: +		MgmtIPMTU:       n.Runtime.Mgmt().MTU,
1343: +		ComponentConfig: componentConfig,
1344: +
1345: +		// Service configs from variant (single source of truth)
1346: +		SystemConfig:  snippets.SystemConfig,
1347: +		GRPCConfig:    snippets.GRPCConfig,
1348: +		SNMPConfig:    snippets.SNMPConfig,
1349: +		NetconfConfig: snippets.NetconfConfig,
1350: +		LoggingConfig: snippets.LoggingConfig,
1351: +		SSHConfig:     snippets.SSHConfig,
1352: +	}
1353: +
1354: +	if n.Config().DNS != nil {
1355: +		tplData.DNSServers = append(tplData.DNSServers, n.Config().DNS.Servers...)
1356: +	}
1357: +
1358: +	n.prepareSSHPubKeys(tplData)
1359: +
1360: +	n.setVersionSpecificParams(tplData)
1361: +
1362: +	return tplData, nil
1363: +}
1364: +
1365: +// addDefaultConfig adds sros default configuration such as tls certs, gnmi/json-rpc, login-banner,
1366: +// ssh keys.
1367: +func (n *sros) addDefaultConfig() error {
1368: +	// Prepare all template data
1369: +	tplData, err := n.prepareConfigTemplateData()
1370: +	if err != nil {
1371: +		return err
1372: +	}
1373: +
1374: +	// Select appropriate template
1375: +	srosCfgTpl, err := n.selectConfigTemplate(tplData)
1376: +	if err != nil {
1377: +		return fmt.Errorf("failed to select config template: %w", err)
1378: +	}
1379: +	log.Debug("Prepare SR OS config template", "template", srosCfgTpl.Name(),
1380: +		"node", n.Cfg.LongName,
1381: +		"configuration-mode", tplData.ConfigurationMode,
1382: +		"node-type", tplData.NodeType,
1383: +		"secure-grpc", tplData.IsSecureGrpc,
1384: +		"sw-version", tplData.SwVersion)
1385: +
1386: +	// Execute template
1387: +	buf := new(bytes.Buffer)
1388: +	err = srosCfgTpl.Execute(buf, tplData)
1389: +	if err != nil {
1390: +		return err
1391: +	}
1392: +
1393: +	if buf.Len() == 0 {
1394: +		log.Warn(
1395: +			"Buffer empty, template parsing error",
1396: +			"node", n.Cfg.ShortName,
1397: +			"template", srosCfgTpl.Name(),
1398: +		)
1399: +	} else {
1400: +		log.Debug("Additional default config parsed",
1401: +			"node", n.Cfg.ShortName,
1402: +			"template", srosCfgTpl.Name())
1403: +		n.startupCliCfg = append(n.startupCliCfg, buf.String()...)
1404: +	}
1405: +
1406: +	return nil
1407: +}
1408: +
1409: +// applyPartialConfig applies partial configuration to the SR OS.
1410: +func (n *sros) addPartialConfig() error {
1411: +	if n.Cfg.StartupConfig != "" {
1412: +		// b holds the configuration to be applied to the node
1413: +		b := &bytes.Buffer{}
1414: +		// apply partial configs if partial config is used
1415: +		if clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM("") {
1416: +			log.Info("Adding configuration",
1417: +				"node", n.Cfg.LongName,
1418: +				"type", "partial",
1419: +				"source", n.Cfg.StartupConfig)
1420: +
1421: +			r, err := os.Open(n.Cfg.StartupConfig)
1422: +			if err != nil {
1423: +				return err
1424: +			}
1425: +
1426: +			defer r.Close() // skipcq: GO-S2307
1427: +
1428: +			_, err = io.Copy(b, r)
1429: +			if err != nil {
1430: +				return err
1431: +			}
1432: +
1433: +			configContent, err := clabutils.SubstituteEnvsAndTemplate(b, n.Cfg)
1434: +			if err != nil {
1435: +				return err
1436: +			}
1437: +			if configContent.Len() == 0 {
1438: +				log.Warn(
1439: +					"Buffer empty, PARTIAL config template parsing error",
1440: +					"node",
1441: +					n.Cfg.ShortName,
1442: +				)
1443: +			} else {
1444: +				log.Debug("Additional PARTIAL config parsed", "node",
1445: +					n.Cfg.ShortName, "partial-config", configContent.String())
1446: +				n.startupCliCfg = append(n.startupCliCfg, configContent.String()...)
1447: +			}
1448: +		} else {
1449: +			log.Warn(
1450: +				"Passed startup-config option, but it will not have any effect",
1451: +				"node",
1452: +				n.Cfg.ShortName,
1453: +			)
1454: +		}
1455: +	}
1456: +	return nil
1457: +}
1458: +
1459: +// isConfigClassic reports whether the node is in classic or mixed configuration mode.
1460: +func (n *sros) isConfigClassic() bool {
1461: +	mode := n.kindSpecificCfg().ConfigMode
1462: +	return mode == ConfigModeClassic || mode == ConfigModeMixed
1463: +}
1464: +
1465: +// isFullConfigFile returns true if the config file doesn't contain .partial substring
1466: +// and the config file is NOT nil (ie. startup config IS defined).
1467: +// it is intended that the 'c' arg is n.Cfg.StartupConfig.
1468: +func isFullConfigFile(c string) bool {
1469: +	return c != "" && !clabutils.IsPartialConfigFile(c)
1470: +}
1471: diff --git a/nodes/sros/netns.go b/nodes/sros/netns.go
1472: index dbd9af7..e7ec511 100644
1473: --- a/nodes/sros/netns.go
1474: +++ b/nodes/sros/netns.go
1475: @@ -1,14 +1,20 @@
1476:  package sros
1477:  
1478:  import (
1479: +	"context"
1480: +	"errors"
1481:  	"fmt"
1482:  	"maps"
1483:  
1484: +	clabutils "github.com/srl-labs/containerlab/utils"
1485: +
1486:  	clabconstants "github.com/srl-labs/containerlab/constants"
1487:  	clabnodes "github.com/srl-labs/containerlab/nodes"
1488: +	clabruntime "github.com/srl-labs/containerlab/runtime"
1489:  	clabtypes "github.com/srl-labs/containerlab/types"
1490: +	"github.com/vishvananda/netns"
1491:  )
1492:  
1493:  // namespaceNode owns the shared network namespace of a components-based SR-SIM node.
1494:  type namespaceNode struct {
1495:  	clabnodes.DefaultNode
1496: @@ -81,5 +87,71 @@ func (n *sros) newNetnsConfig() *clabtypes.NodeConfig {
1497:  		Labels:                labels,
1498:  		Runtime:               n.Cfg.Runtime,
1499:  		ResultingPortBindings: n.Cfg.ResultingPortBindings,
1500:  	}
1501:  }
1502: +
1503: +func (n *sros) ensureNetnsRunning(ctx context.Context) error {
1504: +	switch status := n.netnsNode.GetContainerStatus(ctx); status {
1505: +	case clabruntime.Running:
1506: +		// The namespace holder intentionally survives regular node lifecycle operations.
1507: +	case clabruntime.Created, clabruntime.Stopped:
1508: +		if err := n.netnsNode.Start(ctx); err != nil {
1509: +			return fmt.Errorf("node %q network namespace container start error: %w",
1510: +				n.Cfg.ShortName, err)
1511: +		}
1512: +	case clabruntime.Paused:
1513: +		if err := n.Runtime.UnpauseContainer(ctx, n.netnsNode.Config().LongName); err != nil {
1514: +			return fmt.Errorf("node %q network namespace container unpause error: %w",
1515: +				n.Cfg.ShortName, err)
1516: +		}
1517: +	case clabruntime.NotFound:
1518: +		return fmt.Errorf(
1519: +			"node %q network namespace container %q not found; recreate the node",
1520: +			n.Cfg.ShortName, n.netnsNode.Config().LongName,
1521: +		)
1522: +	default:
1523: +		return fmt.Errorf("node %q network namespace container %q is %s",
1524: +			n.Cfg.ShortName, n.netnsNode.Config().LongName, status)
1525: +	}
1526: +
1527: +	return nil
1528: +}
1529: +
1530: +func (n *sros) cleanupParkingNetNS() error {
1531: +	name := clabutils.ParkingNetnsName(n.Cfg.LongName)
1532: +	if _, err := clabutils.GetNamedNetNS(name); err != nil {
1533: +		return nil
1534: +	}
1535: +
1536: +	return netns.DeleteNamed(name)
1537: +}
1538: +
1539: +// GetNSPath retrieves the Namespace Path.
1540: +func (n *sros) GetNSPath(ctx context.Context) (string, error) {
1541: +	if n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == "") {
1542: +		return n.DefaultNode.GetNSPath(ctx)
1543: +	} else if n.isDistributedCardNode() {
1544: +		return n.Runtime.GetNSPath(ctx, n.rootCtrName)
1545: +	}
1546: +	return n.netnsNode.GetNSPath(ctx)
1547: +}
1548: +
1549: +// DeleteNetnsSymlink deletes the symlink file created for the container netns.
1550: +func (n *sros) DeleteNetnsSymlink() error {
1551: +	var errs []error
1552: +
1553: +	// if it is the base node, then we need to delete the symlink for all the components.
1554: +	if n.isDistributedBaseNode() {
1555: +		for _, componentNode := range n.componentNodes {
1556: +			errs = append(errs, componentNode.DeleteNetnsSymlink())
1557: +		}
1558: +		if n.netnsNode != nil {
1559: +			errs = append(errs, n.netnsNode.DeleteNetnsSymlink())
1560: +		}
1561: +		errs = append(errs, clabutils.DeleteNetnsSymlink(n.Cfg.LongName))
1562: +	}
1563: +
1564: +	errs = append(errs, n.DefaultNode.DeleteNetnsSymlink(), n.cleanupParkingNetNS())
1565: +
1566: +	return errors.Join(errs...)
1567: +}
1568: diff --git a/nodes/sros/power.go b/nodes/sros/power.go
1569: index 7ab11bd..07509f3 100644
1570: --- a/nodes/sros/power.go
1571: +++ b/nodes/sros/power.go
1572: @@ -3,10 +3,15 @@ package sros
1573:  import (
1574:  	"fmt"
1575:  	"strings"
1576:  )
1577:  
1578: +const (
1579: +	defaultSrosPowerType       = "dc"
1580: +	defaultSrosPowerModuleType = "ps-a-dc-6000"
1581: +)
1582: +
1583:  // SrosPower defines power supply configuration for a given node type.
1584:  type SrosPower struct {
1585:  	Modules any
1586:  	Shelves int
1587:  }
1588: diff --git a/nodes/sros/sros.go b/nodes/sros/sros.go
1589: index 1eac470..20ae973 100644
1590: --- a/nodes/sros/sros.go
1591: +++ b/nodes/sros/sros.go
1592: @@ -6,11 +6,10 @@ package sros
1593:  
1594:  import (
1595:  	"bufio"
1596:  	"bytes"
1597:  	"context"
1598: -	_ "embed"
1599:  	"errors"
1600:  	"fmt"
1601:  	"io"
1602:  	"maps"
1603:  	"net"
1604: @@ -20,19 +19,16 @@ import (
1605:  	"reflect"
1606:  	"regexp"
1607:  	"slices"
1608:  	"strconv"
1609:  	"strings"
1610: -	"text/template"
1611:  	"time"
1612:  
1613: -	"github.com/beevik/etree"

(Output capped at 50 KB. Showing lines 1-1613. Use offset=1614 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502da77e001c5CTuaPA6qQQ5l",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502d9e6b001O6WVSMYXb5D2sX",
  "callID": "call_c2c8ae9f00814451945c4fa3",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/diff.txt"
    },
    "output": "<path>/source/diff.txt</path>\n<type>file</type>\n<content>\n1: diff --git a/.github/workflows/srsim-tests.yml b/.github/workflows/srsim-tests.yml\n2: index e9896cd..4aa8f48 100644\n3: --- a/.github/workflows/srsim-tests.yml\n4: +++ b/.github/workflows/srsim-tests.yml\n5: @@ -41,22 +41,21 @@ jobs:\n6:      if: needs.check-license.outputs.available == 'true'\n7:      env:\n8:        SRSIM_IMAGE_TAG: 26.7.R1\n9:      strategy:\n10:        matrix:\n11: -        test-suite:\n12: -          - \"01*.robot\"\n13: -          - \"03*.robot\"\n14: -          - \"04*.robot\"\n15: -          - \"05*.robot\"\n16: -          - \"06*.robot\"\n17: -          - \"07*.robot\"\n18: -          - \"08*.robot\"\n19: -          - \"09*.robot\"\n20: -          - \"10*.robot\"\n21: -          - \"11*.robot\"\n22: -          - \"12*.robot\"\n23: +        include:\n24: +          - shard: basic\n25: +            test_suites: \"01-sros-to-linux.robot 07-srsim-with-mgmt-network.robot 12-srsim-veth-stitch.robot\"\n26: +          - shard: lifecycle\n27: +            test_suites: \"04-sros-classic.robot 06-srsim-sar.robot 10-srsim-lifecycle.robot\"\n28: +          - shard: components\n29: +            test_suites: \"05-sros-comp-to-linux.robot 09-srsim-pause-container.robot 14-srsim-new-chassis.robot\"\n30: +          - shard: provisioning\n31: +            test_suites: \"03-sros-dist-to-linux.robot 08-srsim-comp-cfg-test.robot 13-srsim-integrated.robot\"\n32: +          - shard: apply\n33: +            test_suites: \"11-srsim-apply.robot\"\n34:      steps:\n35:        - name: Checkout\n36:          uses: actions/checkout@v7\n37:          with:\n38:            fetch-depth: 0\n39: @@ -92,34 +91,39 @@ jobs:\n40:          run: uv sync --all-extras --dev\n41:  \n42:        - name: Activate virtualenv\n43:          run: |\n44:            . .venv/bin/activate\n45: -          echo PATH=$PATH >> $GITHUB_ENV\n46: +          echo \"PATH=$PATH\" >> \"$GITHUB_ENV\"\n47:  \n48: -      - name: Sanitize test-suite name\n49: -        run: echo \"TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')\" >> $GITHUB_ENV\n50: +      - name: Set shard name\n51: +        run: echo \"TEST_SUITE=${{ matrix.shard }}\" >> \"$GITHUB_ENV\"\n52:  \n53:        - name: Login to GitHub Container Registry\n54:          uses: docker/login-action@v4\n55:          with:\n56:            registry: ghcr.io\n57:            username: ${{ github.actor }}\n58:            password: ${{ github.token }}\n59:  \n60:        - name: Pull and re-tag srsim image\n61: -        run: docker pull ghcr.io/srl-labs/containerlab/nokia_srsim:${SRSIM_IMAGE_TAG} && docker tag ghcr.io/srl-labs/containerlab/nokia_srsim:${SRSIM_IMAGE_TAG} registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\n62: +        run: |\n63: +          image=\"ghcr.io/srl-labs/containerlab/nokia_srsim:${SRSIM_IMAGE_TAG}\"\n64: +          docker pull \"$image\"\n65: +          docker tag \"$image\" \"registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\"\n66:  \n67:        - name: Logout from GitHub Container Registry\n68:          run: docker logout ghcr.io\n69:  \n70:        # - name: setup tmate session\n71:        #   uses: mxschmitt/action-tmate@v3\n72:  \n73:        - name: Run sros-srsim tests\n74:          run: |\n75: -          ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/13-srsim/${{ matrix.test-suite }}\n76: +          for test_suite in ${{ matrix.test_suites }}; do\n77: +            ./tests/rf-run.sh ${{ inputs.runtime }} \"./tests/13-srsim/${test_suite}\"\n78: +          done\n79:        # upload test reports as a zip file\n80:        - name: Upload test logs\n81:          uses: actions/upload-artifact@v7\n82:          if: always()\n83:          with:\n84: diff --git a/docs/manual/kinds/sros.md b/docs/manual/kinds/sros.md\n85: index 633972e..7c0f2e1 100644\n86: --- a/docs/manual/kinds/sros.md\n87: +++ b/docs/manual/kinds/sros.md\n88: @@ -239,13 +239,19 @@ topology:\n89:          NOKIA_SROS_MDA_1: me12-100gb-qsfp28 # override default MDA type in slot 1\n90:  ```\n91:  \n92:  ///\n93:  \n94: -For known SR/IXR integrated nodes, containerlab's default model-driven configuration also provisions the default card and MDA configuration. The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`. If the hardware is overridden with `components` or SR-SIM environment variables, the generated SR OS card/MDA configuration follows those overrides.\n95: +For known SR and IXR integrated types, containerlab generates model-driven configuration for the default card and MDA(s).\n96:  \n97: -Integrated nodes accept at most one `components` entry because they still run as a single container. The component slot can be omitted or set to `A`; `ixr-r6` also accepts a single `B` slot override.\n98: +The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e2sc`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`.\n99: +\n100: +An integrated node other than `ixr-r6` runs as one container and accepts one `components` entry. The slot can be omitted or set to `A`. `ixr-r6` accepts slots `A` and `B`. Two `ixr-r6` entries, one for `A` and one for `B`, run as a dual-CPIOM node with one container per CPM. Integrated nodes do not accept numeric line-card slots.\n101: +\n102: +A `components` entry with `type` sets `NOKIA_SROS_CARD`. Containerlab then skips generated card and MDA configuration, because those defaults belong to the built-in card. Set `type` when the integrated card itself must change, for example `cpm-ixr-e2n/imm4-sfp+4-sfp+`.\n103: +\n104: +Node `env` overrides `components`: `type`, `xiom`, `mda`, per-component `env`, and the `sfm` key. When both set the same variable to different values, the environment variable wins and containerlab logs a warning naming that variable. `NOKIA_SROS_MDA_*` and `NOKIA_SROS_XIOM_*` are written into the generated configuration. `NOKIA_SROS_CARD` skips that generation, the same as a component `type`. On a distributed node, `NOKIA_SROS_SLOT` does not replace each component's slot.\n105:  \n106:  ### Distributed\n107:  \n108:  When the emulated platform is chassis-based, like SR-7, SR-14s, etc., the SR-SIM node must be defined in a distributed mode in the topology file.\n109:  \n110: @@ -385,16 +391,18 @@ topology:\n111:  When a distributed SR-SIM node is defined using `components`, we need to take into account the following:\n112:  \n113:  1. Component containers are attached to an internal namespace pause container.\n114:  2. When changing a MDA or card type from its default value, the configuration for card, SFM and MDA must be also defined.\n115:  3. Links can be added referring to the node name. The same [interface naming](#interface-naming) convention holds for all SR-SIM nodes.\n116: -4. Environment variable based configuration on per-component, or node-level will override the configuration set in `type`, `xiom` and `mda` fields.\n117: +4. Environment variable based configuration on per-component, or node-level will override the configuration set in `type`, `xiom` and `mda` fields. Node-level `env` wins over both. When the values differ, containerlab logs a warning naming the environment variable that was kept.\n118:  \n119:  ##### Configuration for components\n120:  \n121:  When using the `components` structure in the node definition for a distributed node, containerlab will also generate the SR OS configuration for the installed components in the chassis, as well as relevant power supply configuration[^6] to ensure the installed components come up without requiring a user to manually provide the configuration. The same generated configuration mechanism is used for the built-in SR/IXR integrated defaults.\n122:  \n123: +At deploy time, containerlab reads `chassis_info.json` from the selected SR-SIM image and compares the effective `components` configuration with the hardware types listed for that chassis. Unsupported card slots and card, SFM, XIOM, or MDA types produce warnings but do not stop deployment. This is a best-effort check: compatibility that is not represented in `chassis_info.json`, such as the MDA types supported by a specific XIOM, is not validated.\n124: +\n125:  /// details | Disabling generated SR OS configuration for `components`\n126:      type: tip\n127:  You can disable this config generation behavior by setting the `gen-component-config: false` [kind-specific config key](../nodes.md#kind-specific-config) on the node, or on the base node for a distributed chassis.\n128:  \n129:  ```yaml hl_lines=\"6\"\n130: diff --git a/nodes/sros/README.md b/nodes/sros/README.md\n131: index 3fbdee2..435bf6d 100644\n132: --- a/nodes/sros/README.md\n133: +++ b/nodes/sros/README.md\n134: @@ -37,11 +37,23 @@ The SR OS node kind supports deploying Nokia's SR OS network operating system in\n135:  - **`sros_test.go`**: Unit tests\n136:    - Node type helper method tests\n137:    - Edge case validation\n138:    - Version parsing tests\n139:  \n140: -- During PreDeploy, `chassis_info.json` is read from the node image (`/opt/nokia/chassis_info.json`) and written under the node's lab directory (`n.Cfg.LabDir`) with the same filename.\n141: +- **`component.go`**: Component model, slot checks, and environment precedence\n142: +- **`component_config.go`**: Generated card, SFM, XIOM, and MDA configuration, including integrated defaults\n143: +- **`chassis_info.go`**: Parses `chassis_info.json` and returns advisory compatibility warnings\n144: +\n145: +### Chassis info and component checks\n146: +\n147: +During PreDeploy, `createSROSFiles` reads `/opt/nokia/chassis_info.json` from the node image and writes it to `n.Cfg.LabDir/chassis_info.json`, prefixed with the license header. Failure to read the file is logged and does not stop deployment.\n148: +\n149: +The same file is then compared with the effective component configuration. Aliases such as `SAR-Mx` to `SAR-Hx` are followed. Unsupported slots, CPM/IOM types, SFM, XIOM, direct MDAs, and fixed-hardware mismatches produce warnings only. MDAs nested under an XIOM are not checked, because the file does not say which MDA types a given XIOM accepts.\n150: +\n151: +### Environment precedence\n152: +\n153: +Node `env` overrides per-component `env`, which overrides `type`, `xiom`, `mda`, and `sfm`. When a node environment variable replaces a different component value, containerlab logs that the component value will not be used and names the variable. `NOKIA_SROS_SLOT` still comes from each component in a distributed node, because one node-level slot cannot identify every card.\n154:  \n155:  ## Architecture\n156:  \n157:  ### Node Type Detection\n158:  \n159: @@ -346,29 +358,16 @@ componentConfig := \"\"\n160:  if !isFullConfigFile(n.Cfg.StartupConfig) {\n161:      componentConfig = n.generateComponentConfig()\n162:  }\n163:  ```\n164:  \n165: -For distributed SR OS deployments with multiple CPMs and linecards, this generates:\n166: -- Slot-specific configuration\n167: -- Card type definitions\n168: -- MDA (Media Dependent Adapter) configurations\n169: -- Fabric connectivity\n170: +For integrated nodes and distributed line cards, this appends flat MD-CLI lines. CPM slots `A` and `B` are not provisioned as cards. `NOKIA_SROS_CARD`, or a component `type` on an integrated node, skips this generation because the built-in MDA defaults belong to the default card.\n171:  \n172: -Example generated component config:\n173:  ```\n174: -/configure {\n175: -    card 1 {\n176: -        card-type iom-e\n177: -        mda 1 {\n178: -            mda-type me12-100gb-qsfp28\n179: -        }\n180: -    }\n181: -    card A {\n182: -        card-type cpm-ixr\n183: -    }\n184: -}\n185: +/configure card 1 card-type iom-1 admin-state enable\n186: +/configure card 1 mda 1 mda-type me6-100gb-qsfp28 admin-state enable\n187: +/configure sfm 1 sfm-type sfm-2s admin-state enable\n188:  ```\n189:  \n190:  #### Phase 3: Node-Type Specific Configuration (`applyNodeTypeSpecificConfig`)\n191:  \n192:  This phase customizes the template data based on the node's platform type and security settings.\n193: @@ -1047,83 +1046,22 @@ Each platform type has tailored configurations embedded in the `configs/` direct\n194:  **SAR Classic Mode:**\n195:  - **No gRPC configuration embedded**\n196:  - SAR in classic mode doesn't support gRPC\n197:  - Uses only CLI/NETCONF for management\n198:  \n199: -### Distributed SR OS Configuration\n200: -\n201: -For distributed deployments with multiple components (CPMs and line cards), additional configuration is generated.\n202: -\n203: -#### Component Configuration Generation\n204: -\n205: -```go\n206: -func (n *sros) generateComponentConfig() string\n207: -```\n208: -\n209: -**Generated Configuration Structure:**\n210: -\n211: -```\n212: -/configure {\n213: -    {{- range .Components }}\n214: -    card {{ .Slot }} {\n215: -        card-type {{ .Type }}\n216: -        {{- if .MDAs }}\n217: -        {{- range .MDAs }}\n218: -        mda {{ .Slot }} {\n219: -            mda-type {{ .Type }}\n220: -        }\n221: -        {{- end }}\n222: -        {{- end }}\n223: -    }\n224: -    {{- end }}\n225: -    \n226: -    {{- if .FabricConfig }}\n227: -    fabric {\n228: -        {{ .FabricConfig }}\n229: -    }\n230: -    {{- end }}\n231: -}\n232: -```\n233: +### Component configuration\n234:  \n235: -**Example Distributed Topology:**\n236: +`generateComponentConfig` runs for integrated nodes and for the CPM of a distributed node, unless the user supplied a full startup config, selected classic mode, or set `gen-component-config: false`.\n237:  \n238: -```yaml\n239: -nodes:\n240: -  chassis1:\n241: -    kind: nokia_srsim\n242: -    components:\n243: -      - slot: A\n244: -        type: cpm-ixr\n245: -      - slot: B\n246: -        type: cpm-ixr\n247: -      - slot: 1\n248: -        type: iom-ixr\n249: -        mda:\n250: -          - slot: 1\n251: -            type: m20-1gb-sfp-b\n252: -```\n253: +Known integrated types (`sr-1`, `sr-1s`, `ixr-r6`, and the `ixr-e*` pizza boxes) get built-in card and MDA lines. One `components` entry is accepted, with the slot omitted or set to `A`. `ixr-r6` also accepts `B`, and two entries (`A` and `B`) deploy a dual-CPIOM node. A component `type` sets `NOKIA_SROS_CARD` and skips generated card and MDA lines.\n254:  \n255: -**Generated Component Config:**\n256: +Distributed line cards produce one line per card, SFM, XIOM, and direct MDA. The values are the effective ones after environment precedence, so `NOKIA_SROS_MDA_*` and `NOKIA_SROS_XIOM_*` change the generated lines.\n257:  \n258:  ```\n259: -/configure {\n260: -    card A {\n261: -        card-type cpm-ixr\n262: -    }\n263: -    card B {\n264: -        card-type cpm-ixr\n265: -    }\n266: -    card 1 {\n267: -        card-type iom-ixr\n268: -        mda 1 {\n269: -            mda-type m20-1gb-sfp-b\n270: -        }\n271: -    }\n272: -    fabric {\n273: -        multiplane-mode enabled\n274: -    }\n275: -}\n276: +/configure card 1 card-type xcm-2s admin-state enable\n277: +/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\n278: +/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\n279:  ```\n280:  \n281:  ### Security and Certificate Management\n282:  \n283:  When `certificate.issue: true` is set, the system generates and injects TLS certificates.\n284: @@ -1538,14 +1476,14 @@ docker ps | grep chassis1\n285:  # Verify slot assignments\n286:  ssh admin@clab-mylab-chassis1-cpm-a \"show card state\"\n287:  ```\n288:  \n289:  **Common Causes:**\n290: -- Component slots not properly defined\n291: -- CPM slot names must be \"A\" or \"B\" (uppercase)\n292: +- Component slots are duplicated, including slots that differ only by case\n293:  - Line card slots must be numeric\n294: -- Environment variables not set on components\n295: +- The component type or MDA is not listed for that chassis in the image's `chassis_info.json` (this is logged as a warning and does not stop deployment)\n296: +- A node-level environment variable overrides the component value; the log names the variable that was kept\n297:  \n298:  ## Performance Considerations\n299:  \n300:  ### Template Execution Performance\n301:  \n302: @@ -1638,7 +1576,7 @@ BSD 3-Clause License - See LICENSE file for details\n303:  \n304:  **Maintainers:**\n305:  - Nokia Containerlab Team\n306:  - Community Contributors\n307:  \n308: -**Last Updated:** 2025-11-15\n309: -**SR OS Versions Supported:**  25.7+, 26.x (planned)\n310: +**Last Updated:** 2026-10-14\n311: +**SR OS Versions Supported:**  25.7+, 26.x\n312: diff --git a/nodes/sros/chassis_info.go b/nodes/sros/chassis_info.go\n313: index ace213b..fe5b7f8 100644\n314: --- a/nodes/sros/chassis_info.go\n315: +++ b/nodes/sros/chassis_info.go\n316: @@ -2,10 +2,221 @@\n317:  // Licensed under the BSD 3-Clause License.\n318:  // SPDX-License-Identifier: BSD-3-Clause\n319:  \n320:  package sros\n321:  \n322: +import (\n323: +\t\"encoding/json\"\n324: +\t\"fmt\"\n325: +\t\"slices\"\n326: +\t\"strconv\"\n327: +\t\"strings\"\n328: +)\n329: +\n330:  // DefaultChassisInfoPath is the path to chassis_info.json inside SROS/SR SIM container images.\n331:  const DefaultChassisInfoPath = \"/opt/nokia/chassis_info.json\"\n332:  \n333:  // chassisInfoFileLicense is prepended to the chassis_info.json file written to LabDir.\n334:  const chassisInfoFileLicense = \"// Copyright 2026 Nokia\\n// Licensed under the BSD 3-Clause License.\\n// SPDX-License-Identifier: BSD-3-Clause\\n\\n\"\n335: +\n336: +type chassisInfoEntry struct {\n337: +\tAlias      string            `json:\"alias\"`\n338: +\tCPM        []string          `json:\"cpm\"`\n339: +\tIOM        []string          `json:\"iom\"`\n340: +\tIOMSlots   int               `json:\"iom_slots\"`\n341: +\tMDA        []*string         `json:\"mda\"`\n342: +\tFixedMDAs  map[string]string `json:\"fixed_mdas\"`\n343: +\tSFM        []string          `json:\"sfm\"`\n344: +\tXIOM       []string          `json:\"xiom\"`\n345: +\tFixedHWCfg string            `json:\"fixed_hw_cfg\"`\n346: +\tIntegrated bool              `json:\"integrated\"`\n347: +\tRedundant  bool              `json:\"redundant\"`\n348: +}\n349: +\n350: +type chassisInfo map[string]chassisInfoEntry\n351: +\n352: +func parseChassisInfo(content []byte) (chassisInfo, error) {\n353: +\tvar info chassisInfo\n354: +\tif err := json.Unmarshal(content, &info); err != nil {\n355: +\t\treturn nil, fmt.Errorf(\"parse chassis_info.json: %w\", err)\n356: +\t}\n357: +\treturn info, nil\n358: +}\n359: +\n360: +func (i chassisInfo) entry(nodeType string) (chassisInfoEntry, bool) {\n361: +\tkey := \"\"\n362: +\tfor candidate := range i {\n363: +\t\tif strings.EqualFold(candidate, strings.TrimSpace(nodeType)) {\n364: +\t\t\tkey = candidate\n365: +\t\t\tbreak\n366: +\t\t}\n367: +\t}\n368: +\tif key == \"\" {\n369: +\t\treturn chassisInfoEntry{}, false\n370: +\t}\n371: +\n372: +\tseen := map[string]struct{}{}\n373: +\tfor {\n374: +\t\tif _, ok := seen[key]; ok {\n375: +\t\t\treturn chassisInfoEntry{}, false\n376: +\t\t}\n377: +\t\tseen[key] = struct{}{}\n378: +\n379: +\t\tentry := i[key]\n380: +\t\tif entry.Alias == \"\" {\n381: +\t\t\treturn entry, true\n382: +\t\t}\n383: +\n384: +\t\tkey = \"\"\n385: +\t\tfor candidate := range i {\n386: +\t\t\tif strings.EqualFold(candidate, entry.Alias) {\n387: +\t\t\t\tkey = candidate\n388: +\t\t\t\tbreak\n389: +\t\t\t}\n390: +\t\t}\n391: +\t\tif key == \"\" {\n392: +\t\t\treturn chassisInfoEntry{}, false\n393: +\t\t}\n394: +\t}\n395: +}\n396: +\n397: +// componentWarnings returns best-effort validation warnings. It deliberately skips checks\n398: +// that chassis_info.json cannot express, such as which MDA types belong under a specific XIOM.\n399: +func (i chassisInfo) componentWarnings(nodeType, sfm string, components []*Component) []string {\n400: +\tentry, ok := i.entry(nodeType)\n401: +\tif !ok {\n402: +\t\treturn []string{\n403: +\t\t\tfmt.Sprintf(\n404: +\t\t\t\t\"chassis type %q is not present in chassis_info.json; component compatibility was not checked\",\n405: +\t\t\t\tnodeType,\n406: +\t\t\t),\n407: +\t\t}\n408: +\t}\n409: +\n410: +\tvar warnings []string\n411: +\tif sfm != \"\" && len(entry.SFM) > 0 && !slices.Contains(entry.SFM, sfm) {\n412: +\t\twarnings = append(warnings, fmt.Sprintf(\n413: +\t\t\t\"SFM type %q is not listed for chassis type %q\",\n414: +\t\t\tsfm,\n415: +\t\t\tnodeType,\n416: +\t\t))\n417: +\t}\n418: +\n419: +\tfor _, component := range components {\n420: +\t\tif component == nil {\n421: +\t\t\tcontinue\n422: +\t\t}\n423: +\t\tslot := strings.ToUpper(strings.TrimSpace(component.Slot))\n424: +\t\tif slot == \"\" {\n425: +\t\t\tslot = slotAName\n426: +\t\t}\n427: +\n428: +\t\tswitch {\n429: +\t\tcase slot == slotAName || slot == slotBName:\n430: +\t\t\tif slot == slotBName && !entry.Redundant {\n431: +\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n432: +\t\t\t\t\t\"component slot %s is not listed as supported for chassis type %q\",\n433: +\t\t\t\t\tslot,\n434: +\t\t\t\t\tnodeType,\n435: +\t\t\t\t))\n436: +\t\t\t}\n437: +\t\t\tif component.Type != \"\" &&\n438: +\t\t\t\tentry.FixedHWCfg != \"\" &&\n439: +\t\t\t\tcomponent.Type != entry.FixedHWCfg {\n440: +\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n441: +\t\t\t\t\t\"component type %q in slot %s does not match fixed hardware %q for chassis type %q\",\n442: +\t\t\t\t\tcomponent.Type,\n443: +\t\t\t\t\tslot,\n444: +\t\t\t\t\tentry.FixedHWCfg,\n445: +\t\t\t\t\tnodeType,\n446: +\t\t\t\t))\n447: +\t\t\t} else if component.Type != \"\" &&\n448: +\t\t\t\tentry.FixedHWCfg == \"\" &&\n449: +\t\t\t\tlen(entry.CPM) > 0 &&\n450: +\t\t\t\t!slices.Contains(entry.CPM, component.Type) {\n451: +\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n452: +\t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n453: +\t\t\t\t\tcomponent.Type,\n454: +\t\t\t\t\tslot,\n455: +\t\t\t\t\tnodeType,\n456: +\t\t\t\t))\n457: +\t\t\t}\n458: +\t\tdefault:\n459: +\t\t\tnumericSlot, err := strconv.Atoi(slot)\n460: +\t\t\tif err == nil {\n461: +\t\t\t\tif entry.IOMSlots > 0 && numericSlot > entry.IOMSlots {\n462: +\t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n463: +\t\t\t\t\t\t\"component slot %s exceeds the %d IOM slots listed for chassis type %q\",\n464: +\t\t\t\t\t\tslot,\n465: +\t\t\t\t\t\tentry.IOMSlots,\n466: +\t\t\t\t\t\tnodeType,\n467: +\t\t\t\t\t))\n468: +\t\t\t\t}\n469: +\t\t\t\tif component.Type != \"\" &&\n470: +\t\t\t\t\tlen(entry.IOM) > 0 &&\n471: +\t\t\t\t\t!slices.Contains(entry.IOM, component.Type) {\n472: +\t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n473: +\t\t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n474: +\t\t\t\t\t\tcomponent.Type,\n475: +\t\t\t\t\t\tslot,\n476: +\t\t\t\t\t\tnodeType,\n477: +\t\t\t\t\t))\n478: +\t\t\t\t}\n479: +\t\t\t}\n480: +\t\t}\n481: +\n482: +\t\tfor _, xiom := range component.XIOM {\n483: +\t\t\tif xiom.Type != \"\" &&\n484: +\t\t\t\tlen(entry.XIOM) > 0 &&\n485: +\t\t\t\t!slices.Contains(entry.XIOM, xiom.Type) {\n486: +\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n487: +\t\t\t\t\t\"XIOM type %q in component slot %s is not listed for chassis type %q\",\n488: +\t\t\t\t\txiom.Type,\n489: +\t\t\t\t\tslot,\n490: +\t\t\t\t\tnodeType,\n491: +\t\t\t\t))\n492: +\t\t\t}\n493: +\t\t}\n494: +\n495: +\t\tif entry.Integrated || (slot != slotAName && slot != slotBName) {\n496: +\t\t\twarnings = append(warnings, validateMDAs(nodeType, entry, component.MDA)...)\n497: +\t\t}\n498: +\t}\n499: +\n500: +\treturn warnings\n501: +}\n502: +\n503: +func validateMDAs(nodeType string, entry chassisInfoEntry, mdas MDAS) []string {\n504: +\tvar warnings []string\n505: +\tfor _, mda := range mdas {\n506: +\t\tif fixed, exists := entry.FixedMDAs[strconv.Itoa(mda.Slot)]; exists {\n507: +\t\t\tif mda.Type != fixed {\n508: +\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n509: +\t\t\t\t\t\"MDA type %q in slot %d does not match fixed MDA %q for chassis type %q\",\n510: +\t\t\t\t\tmda.Type,\n511: +\t\t\t\t\tmda.Slot,\n512: +\t\t\t\t\tfixed,\n513: +\t\t\t\t\tnodeType,\n514: +\t\t\t\t))\n515: +\t\t\t}\n516: +\t\t\tcontinue\n517: +\t\t}\n518: +\t\tif mda.Type != \"\" && !containsChassisType(entry.MDA, mda.Type) {\n519: +\t\t\twarnings = append(warnings, fmt.Sprintf(\n520: +\t\t\t\t\"MDA type %q in slot %d is not listed for chassis type %q\",\n521: +\t\t\t\tmda.Type,\n522: +\t\t\t\tmda.Slot,\n523: +\t\t\t\tnodeType,\n524: +\t\t\t))\n525: +\t\t}\n526: +\t}\n527: +\treturn warnings\n528: +}\n529: +\n530: +func containsChassisType(types []*string, value string) bool {\n531: +\tfor _, typ := range types {\n532: +\t\tif typ != nil && *typ == value {\n533: +\t\t\treturn true\n534: +\t\t}\n535: +\t}\n536: +\treturn false\n537: +}\n538: diff --git a/nodes/sros/chassis_info_test.go b/nodes/sros/chassis_info_test.go\n539: new file mode 100644\n540: index 0000000..befd2b4\n541: --- /dev/null\n542: +++ b/nodes/sros/chassis_info_test.go\n543: @@ -0,0 +1,99 @@\n544: +// Copyright 2026 Nokia\n545: +// Licensed under the BSD 3-Clause License.\n546: +// SPDX-License-Identifier: BSD-3-Clause\n547: +\n548: +package sros\n549: +\n550: +import (\n551: +\t\"testing\"\n552: +\n553: +\t\"github.com/stretchr/testify/assert\"\n554: +\t\"github.com/stretchr/testify/require\"\n555: +)\n556: +\n557: +func TestChassisInfoComponentWarnings(t *testing.T) {\n558: +\tinfo, err := parseChassisInfo([]byte(`{\n559: +\t\t\"IXR-x\": {\n560: +\t\t\t\"cpm\": [\"cpm-ixr-x\"],\n561: +\t\t\t\"iom\": [\"imm6-qsfpdd+48-sfp56\"],\n562: +\t\t\t\"iom_slots\": 1,\n563: +\t\t\t\"mda\": [null],\n564: +\t\t\t\"sfm\": [\"sfm-ixr-x\"]\n565: +\t\t},\n566: +\t\t\"SAR-Hx\": {\n567: +\t\t\t\"cpm\": [\"iom-sar-1x\"],\n568: +\t\t\t\"fixed_mdas\": {\"2\": \"fixed-mda\"},\n569: +\t\t\t\"integrated\": true,\n570: +\t\t\t\"mda\": [\"supported-mda\"],\n571: +\t\t\t\"xiom\": [\"supported-xiom\"]\n572: +\t\t},\n573: +\t\t\"SAR-Mx\": {\"alias\": \"SAR-Hx\"}\n574: +\t}`))\n575: +\trequire.NoError(t, err)\n576: +\n577: +\tt.Run(\"supported configuration\", func(t *testing.T) {\n578: +\t\twarnings := info.componentWarnings(\"sar-mx\", \"\", []*Component{{\n579: +\t\t\tSlot: slotAName,\n580: +\t\t\tType: \"iom-sar-1x\",\n581: +\t\t\tMDA: MDAS{\n582: +\t\t\t\t{Slot: 1, Type: \"supported-mda\"},\n583: +\t\t\t\t{Slot: 2, Type: \"fixed-mda\"},\n584: +\t\t\t},\n585: +\t\t\tXIOM: XIOMS{{Slot: 1, Type: \"supported-xiom\"}},\n586: +\t\t}})\n587: +\n588: +\t\tassert.Empty(t, warnings)\n589: +\t})\n590: +\n591: +\tt.Run(\"unsupported values warn\", func(t *testing.T) {\n592: +\t\twarnings := info.componentWarnings(\"IXR-x\", \"wrong-sfm\", []*Component{\n593: +\t\t\t{Slot: slotAName, Type: \"wrong-cpm\"},\n594: +\t\t\t{Slot: \"2\", Type: \"wrong-iom\", MDA: MDAS{{Slot: 1, Type: \"wrong-mda\"}}},\n595: +\t\t})\n596: +\n597: +\t\tassert.Len(t, warnings, 5)\n598: +\t\tassert.Contains(t, warnings[0], \"SFM type\")\n599: +\t\tassert.Contains(t, warnings[1], \"component type\")\n600: +\t\tassert.Contains(t, warnings[2], \"exceeds\")\n601: +\t\tassert.Contains(t, warnings[3], \"component type\")\n602: +\t\tassert.Contains(t, warnings[4], \"MDA type\")\n603: +\t})\n604: +\n605: +\tt.Run(\"fixed MDA mismatch warns\", func(t *testing.T) {\n606: +\t\twarnings := info.componentWarnings(\"SAR-Hx\", \"\", []*Component{{\n607: +\t\t\tSlot: slotAName,\n608: +\t\t\tMDA:  MDAS{{Slot: 2, Type: \"wrong-mda\"}},\n609: +\t\t}})\n610: +\n611: +\t\trequire.Len(t, warnings, 1)\n612: +\t\tassert.Contains(t, warnings[0], \"does not match fixed MDA\")\n613: +\t})\n614: +\n615: +\tt.Run(\"distributed CPM slot does not validate direct MDAs\", func(t *testing.T) {\n616: +\t\twarnings := info.componentWarnings(\"IXR-x\", \"\", []*Component{{\n617: +\t\t\tSlot: slotAName,\n618: +\t\t\tType: \"cpm-ixr-x\",\n619: +\t\t\tMDA:  MDAS{{Slot: 1, Type: \"not-a-cpm-mda\"}},\n620: +\t\t}})\n621: +\n622: +\t\tassert.Empty(t, warnings)\n623: +\t})\n624: +\n625: +\tt.Run(\"nested XIOM MDA is not guessed\", func(t *testing.T) {\n626: +\t\twarnings := info.componentWarnings(\"SAR-Hx\", \"\", []*Component{{\n627: +\t\t\tSlot: slotAName,\n628: +\t\t\tXIOM: XIOMS{{\n629: +\t\t\t\tSlot: 1,\n630: +\t\t\t\tType: \"supported-xiom\",\n631: +\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"not-in-chassis-mda-list\"}},\n632: +\t\t\t}},\n633: +\t\t}})\n634: +\n635: +\t\tassert.Empty(t, warnings)\n636: +\t})\n637: +}\n638: +\n639: +func TestParseChassisInfoRejectsInvalidJSON(t *testing.T) {\n640: +\t_, err := parseChassisInfo([]byte(`{\"SR-1\":`))\n641: +\trequire.Error(t, err)\n642: +}\n643: diff --git a/nodes/sros/component.go b/nodes/sros/component.go\n644: index bdac689..b62efb3 100644\n645: --- a/nodes/sros/component.go\n646: +++ b/nodes/sros/component.go\n647: @@ -1,10 +1,15 @@\n648:  package sros\n649:  \n650:  import (\n651:  \t\"fmt\"\n652: +\t\"maps\"\n653: +\t\"slices\"\n654: +\t\"strconv\"\n655:  \t\"strings\"\n656: +\n657: +\t\"github.com/charmbracelet/log\"\n658:  )\n659:  \n660:  // Component is an SR-SIM card: a CPM (slot A or B) or a line card.\n661:  type Component struct {\n662:  \tSlot string            `yaml:\"slot,omitempty\" json:\"slot,omitempty\"`\n663: @@ -117,5 +122,188 @@ func (l *XIOMS) UnmarshalYAML(unmarshal func(any) error) error {\n664:  \n665:  \t*l = XIOMS(entries)\n666:  \n667:  \treturn nil\n668:  }\n669: +\n670: +func setComponentEnvVars(env map[string]string, c *Component) {\n671: +\tif c.Type != \"\" {\n672: +\t\tenv[envNokiaSrosCard] = c.Type\n673: +\t}\n674: +\n675: +\tfor _, x := range c.XIOM {\n676: +\t\tkey := fmt.Sprintf(\"%s_X%d\", envNokiaSrosXIOM, x.Slot)\n677: +\t\tenv[key] = x.Type\n678: +\t\t// add the nested MDA\n679: +\t\tfor _, m := range x.MDA {\n680: +\t\t\tkey := fmt.Sprintf(\"%s_X%d_%d\", envNokiaSrosMDA, x.Slot, m.Slot)\n681: +\t\t\tenv[key] = m.Type\n682: +\t\t}\n683: +\t}\n684: +\n685: +\tfor _, m := range c.MDA {\n686: +\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n687: +\t\tenv[key] = m.Type\n688: +\t}\n689: +}\n690: +\n691: +func (n *sros) checkComponentSlotsConfig() error {\n692: +\t// check Slots are unique\n693: +\tcomponentNames := map[string]struct{}{}\n694: +\tfor _, component := range n.kindSpecificCfg().Components {\n695: +\t\t// convert slot to upper\n696: +\t\tslot := strings.ToUpper(component.Slot)\n697: +\t\t// check if slot exists\n698: +\t\t_, exists := componentNames[slot]\n699: +\t\tif exists {\n700: +\t\t\treturn fmt.Errorf(\n701: +\t\t\t\t\"node %s slot %s duplicate definition\",\n702: +\t\t\t\tn.GetShortName(),\n703: +\t\t\t\tcomponent.Slot,\n704: +\t\t\t)\n705: +\t\t}\n706: +\t\t// add to component names map\n707: +\t\tcomponentNames[slot] = struct{}{}\n708: +\n709: +\t}\n710: +\treturn nil\n711: +}\n712: +\n713: +// componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,\n714: +// and per-component env. Per-component env overrides the typed fields.\n715: +func componentDerivedEnv(c *Component) map[string]string {\n716: +\tderived := map[string]string{}\n717: +\tif c == nil {\n718: +\t\treturn derived\n719: +\t}\n720: +\tsetComponentEnvVars(derived, c)\n721: +\tmaps.Copy(derived, c.Env)\n722: +\treturn derived\n723: +}\n724: +\n725: +// warnUserEnvOverrides logs when a node env var replaces a component-derived value.\n726: +func warnUserEnvOverrides(node string, derived, userEnv map[string]string) {\n727: +\tfor key, componentValue := range derived {\n728: +\t\tenvValue, userSet := userEnv[key]\n729: +\t\tif !userSet || componentValue == envValue {\n730: +\t\t\tcontinue\n731: +\t\t}\n732: +\t\tlog.Warn(\n733: +\t\t\tfmt.Sprintf(\n734: +\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n735: +\t\t\t\tcomponentValue,\n736: +\t\t\t\tkey,\n737: +\t\t\t),\n738: +\t\t\t\"node\", node,\n739: +\t\t\t\"env\", key,\n740: +\t\t\t\"component-value\", componentValue,\n741: +\t\t\t\"env-value\", envValue,\n742: +\t\t)\n743: +\t}\n744: +}\n745: +\n746: +// keepUserEnv copies component-derived keys into dst unless the user already set that key.\n747: +// A user value wins, and a differing component value is logged.\n748: +func keepUserEnv(node string, dst, derived, userEnv map[string]string) {\n749: +\twarnUserEnvOverrides(node, derived, userEnv)\n750: +\tfor key, componentValue := range derived {\n751: +\t\tif envValue, userSet := userEnv[key]; userSet {\n752: +\t\t\tdst[key] = envValue\n753: +\t\t\tcontinue\n754: +\t\t}\n755: +\t\tdst[key] = componentValue\n756: +\t}\n757: +}\n758: +\n759: +// cloneComponent returns a deep copy of c suitable for env overrides during config generation.\n760: +func cloneComponent(c *Component) *Component {\n761: +\tif c == nil {\n762: +\t\treturn &Component{}\n763: +\t}\n764: +\tout := *c\n765: +\tout.Env = maps.Clone(c.Env)\n766: +\tout.MDA = slices.Clone(c.MDA)\n767: +\tif len(c.XIOM) > 0 {\n768: +\t\tout.XIOM = make(XIOMS, len(c.XIOM))\n769: +\t\tfor i, xiom := range c.XIOM {\n770: +\t\t\txiom.MDA = slices.Clone(xiom.MDA)\n771: +\t\t\tout.XIOM[i] = xiom\n772: +\t\t}\n773: +\t}\n774: +\treturn &out\n775: +}\n776: +\n777: +// applyHardwareEnv overlays SR-SIM card, XIOM, and MDA environment variables onto c.\n778: +// NOKIA_SROS_SLOT is left unchanged; it identifies the container rather than provisioned hardware.\n779: +func applyHardwareEnv(c *Component, env map[string]string) {\n780: +\tif c == nil || len(env) == 0 {\n781: +\t\treturn\n782: +\t}\n783: +\tif card := env[envNokiaSrosCard]; card != \"\" {\n784: +\t\tc.Type = card\n785: +\t}\n786: +\tfor key, val := range env {\n787: +\t\tif val == \"\" {\n788: +\t\t\tcontinue\n789: +\t\t}\n790: +\t\tswitch {\n791: +\t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_X\"):\n792: +\t\t\trest := strings.TrimPrefix(key, envNokiaSrosMDA+\"_X\")\n793: +\t\t\txiomStr, mdaStr, ok := strings.Cut(rest, \"_\")\n794: +\t\t\tif !ok {\n795: +\t\t\t\tcontinue\n796: +\t\t\t}\n797: +\t\t\txiomSlot, errX := strconv.Atoi(xiomStr)\n798: +\t\t\tmdaSlot, errM := strconv.Atoi(mdaStr)\n799: +\t\t\tif errX != nil || errM != nil || xiomSlot <= 0 || mdaSlot <= 0 {\n800: +\t\t\t\tcontinue\n801: +\t\t\t}\n802: +\t\t\tupsertXiomMDA(c, xiomSlot, mdaSlot, val)\n803: +\t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_\"):\n804: +\t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosMDA+\"_\"))\n805: +\t\t\tif err != nil || slot <= 0 {\n806: +\t\t\t\tcontinue\n807: +\t\t\t}\n808: +\t\t\tc.MDA = upsertMDA(c.MDA, slot, val)\n809: +\t\tcase strings.HasPrefix(key, envNokiaSrosXIOM+\"_X\"):\n810: +\t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosXIOM+\"_X\"))\n811: +\t\t\tif err != nil || slot <= 0 {\n812: +\t\t\t\tcontinue\n813: +\t\t\t}\n814: +\t\t\tupsertXiomType(c, slot, val)\n815: +\t\t}\n816: +\t}\n817: +}\n818: +\n819: +func upsertMDA(mdas MDAS, slot int, typ string) MDAS {\n820: +\tfor i := range mdas {\n821: +\t\tif mdas[i].Slot == slot {\n822: +\t\t\tmdas[i].Type = typ\n823: +\t\t\treturn mdas\n824: +\t\t}\n825: +\t}\n826: +\treturn append(mdas, MDA{Slot: slot, Type: typ})\n827: +}\n828: +\n829: +func upsertXiomType(c *Component, slot int, typ string) {\n830: +\tfor i := range c.XIOM {\n831: +\t\tif c.XIOM[i].Slot == slot {\n832: +\t\t\tc.XIOM[i].Type = typ\n833: +\t\t\treturn\n834: +\t\t}\n835: +\t}\n836: +\tc.XIOM = append(c.XIOM, XIOM{Slot: slot, Type: typ})\n837: +}\n838: +\n839: +func upsertXiomMDA(c *Component, xiomSlot, mdaSlot int, typ string) {\n840: +\tfor i := range c.XIOM {\n841: +\t\tif c.XIOM[i].Slot != xiomSlot {\n842: +\t\t\tcontinue\n843: +\t\t}\n844: +\t\tc.XIOM[i].MDA = upsertMDA(c.XIOM[i].MDA, mdaSlot, typ)\n845: +\t\treturn\n846: +\t}\n847: +\tc.XIOM = append(c.XIOM, XIOM{\n848: +\t\tSlot: xiomSlot,\n849: +\t\tMDA:  MDAS{{Slot: mdaSlot, Type: typ}},\n850: +\t})\n851: +}\n852: diff --git a/nodes/sros/component_config.go b/nodes/sros/component_config.go\n853: index 914f3de..3985e12 100644\n854: --- a/nodes/sros/component_config.go\n855: +++ b/nodes/sros/component_config.go\n856: @@ -4,13 +4,15 @@\n857:  \n858:  package sros\n859:  \n860:  import (\n861:  \t\"fmt\"\n862: +\t\"maps\"\n863:  \t\"slices\"\n864: -\t\"strconv\"\n865:  \t\"strings\"\n866: +\n867: +\t\"github.com/charmbracelet/log\"\n868:  )\n869:  \n870:  const integratedSrosCardSlot = \"1\"\n871:  \n872:  type integratedSrosDefaultComponent struct {\n873: @@ -82,10 +84,17 @@ var integratedSrosDefaultComponents = map[string]integratedSrosDefaultComponent{\n874:  \t\tallowedSlots: []string{slotAName},\n875:  \t\tmdas: MDAS{\n876:  \t\t\t{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"},\n877:  \t\t},\n878:  \t},\n879: +\t\"ixr-e2sc\": {\n880: +\t\tcardType:     \"imm16-sfp++4-sfp28\",\n881: +\t\tallowedSlots: []string{slotAName},\n882: +\t\tmdas: MDAS{\n883: +\t\t\t{Slot: 1, Type: \"m16-sfp++4-sfp28\"},\n884: +\t\t},\n885: +\t},\n886:  \t\"ixr-ec\": {\n887:  \t\tcardType:     \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n888:  \t\tallowedSlots: []string{slotAName},\n889:  \t\tmdas: MDAS{\n890:  \t\t\t{Slot: 1, Type: \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\"},\n891: @@ -172,66 +181,44 @@ func buildComponentCfgLines(components []*Component, sfm string) []componentCfgL\n892:  \t\t}\n893:  \t}\n894:  \treturn lines\n895:  }\n896:  \n897: -func buildIntegratedComponentCfgLines(\n898: -\tnodeType string,\n899: -\tenv map[string]string,\n900: -) []componentCfgLine {\n901: +func buildIntegratedComponentCfgLines(nodeType string, override *Component) []componentCfgLine {\n902:  \tcomponent, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]\n903:  \tif !ok {\n904:  \t\treturn nil\n905:  \t}\n906: -\n907: -\tcardType := component.cardType\n908: -\tif envCardType := strings.TrimSpace(env[envNokiaSrosCard]); envCardType != \"\" {\n909: -\t\tcardType = envCardType\n910: +\tif override == nil {\n911: +\t\toverride = &Component{}\n912:  \t}\n913:  \n914: -\tlines := []componentCfgLine{\n915: -\t\t{Kind: \"card\", Slot: integratedSrosCardSlot, Type: cardType},\n916: +\tdefaultMdas := component.mdas\n917: +\n918: +\tif len(override.XIOM) > 0 {\n919: +\t\tdefaultMdas = nil\n920:  \t}\n921:  \n922: -\tfor _, mda := range mergeIntegratedMdas(component.mdas, env) {\n923: -\t\tlines = append(lines, componentCfgLine{\n924: -\t\t\tKind: \"mda\", Slot: integratedSrosCardSlot, MdaSlot: mda.Slot, Type: mda.Type,\n925: -\t\t})\n926: +\tcard := &Component{\n927: +\t\tSlot: integratedSrosCardSlot,\n928: +\t\tType: component.cardType,\n929: +\t\tXIOM: override.XIOM,\n930: +\t\tMDA:  mergeIntegratedMdas(defaultMdas, override.MDA),\n931:  \t}\n932:  \n933: -\treturn lines\n934: +\treturn buildComponentCfgLines([]*Component{card}, \"\")\n935:  }\n936:  \n937: -func mergeIntegratedMdas(defaults MDAS, env map[string]string) MDAS {\n938: +func mergeIntegratedMdas(defaults, overrides MDAS) MDAS {\n939:  \tbySlot := map[int]string{}\n940: -\tfor _, mda := range defaults {\n941: +\tfor _, mda := range slices.Concat(defaults, overrides) {\n942:  \t\tif mda.Slot > 0 && mda.Type != \"\" {\n943:  \t\t\tbySlot[mda.Slot] = mda.Type\n944:  \t\t}\n945:  \t}\n946:  \n947: -\tconst prefix = envNokiaSrosMDA + \"_\"\n948: -\tfor key, value := range env {\n949: -\t\tslotText, ok := strings.CutPrefix(key, prefix)\n950: -\t\tif !ok {\n951: -\t\t\tcontinue\n952: -\t\t}\n953: -\t\tslot, err := strconv.Atoi(slotText)\n954: -\t\tif err != nil || slot <= 0 {\n955: -\t\t\tcontinue\n956: -\t\t}\n957: -\t\tif value = strings.TrimSpace(value); value != \"\" {\n958: -\t\t\tbySlot[slot] = value\n959: -\t\t}\n960: -\t}\n961: -\n962: -\tslots := make([]int, 0, len(bySlot))\n963: -\tfor slot := range bySlot {\n964: -\t\tslots = append(slots, slot)\n965: -\t}\n966: -\tslices.Sort(slots)\n967: -\n968: +\tslots := slices.Sorted(maps.Keys(bySlot))\n969:  \tmdas := make(MDAS, 0, len(slots))\n970:  \tfor _, slot := range slots {\n971:  \t\tmdas = append(mdas, MDA{Slot: slot, Type: bySlot[slot]})\n972:  \t}\n973:  \treturn mdas\n974: @@ -257,19 +244,150 @@ func integratedSrosAllowedSlots(nodeType string) []string {\n975:  \t\treturn []string{slotAName}\n976:  \t}\n977:  \treturn component.allowedSlots\n978:  }\n979:  \n980: -func isSingleSlotIntegratedSrosNodeType(nodeType string) bool {\n981: -\tif !isIntegratedSrosNodeType(nodeType) {\n982: +func isRedundantIntegratedSrosComponents(nodeType string, components []*Component) bool {\n983: +\tif !isIntegratedSrosNodeType(nodeType) || len(components) < 2 {\n984:  \t\treturn false\n985:  \t}\n986: -\treturn len(integratedSrosAllowedSlots(nodeType)) == 1\n987: +\tfor _, c := range components {\n988: +\t\tif strings.TrimSpace(c.Slot) == \"\" || !integratedSrosSlotAllowed(nodeType, c.Slot) {\n989: +\t\t\treturn false\n990: +\t\t}\n991: +\t}\n992: +\treturn true\n993:  }\n994:  \n995:  func integratedSrosSlotAllowed(nodeType, slot string) bool {\n996:  \tslot = strings.ToUpper(strings.TrimSpace(slot))\n997:  \tif slot == \"\" {\n998:  \t\tslot = standaloneSlotName\n999:  \t}\n1000:  \treturn slices.Contains(integratedSrosAllowedSlots(nodeType), slot)\n1001:  }\n1002: +\n1003: +func (n *sros) generateComponentConfig() string {\n1004: +\tif !n.kindSpecificCfg().GenComponentConfig {\n1005: +\t\treturn \"\"\n1006: +\t}\n1007: +\tif n.isConfigClassic() {\n1008: +\t\treturn \"\"\n1009: +\t}\n1010: +\n1011: +\tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n1012: +\t\treturn n.generateIntegratedComponentConfig()\n1013: +\t}\n1014: +\n1015: +\tcomponents := n.rootComponents\n1016: +\tif len(components) == 0 {\n1017: +\t\treturn \"\"\n1018: +\t}\n1019: +\n1020: +\tfor _, c := range components {\n1021: +\t\tslot := strings.ToUpper(strings.TrimSpace(c.Slot))\n1022: +\t\tif slot == slotAName || slot == slotBName {\n1023: +\t\t\tcontinue\n1024: +\t\t}\n1025: +\t\tif c.Type == \"\" {\n1026: +\t\t\tlog.Warn(\n1027: +\t\t\t\t\"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.\",\n1028: +\t\t\t\t\"node\",\n1029: +\t\t\t\tn.Cfg.ShortName,\n1030: +\t\t\t\t\"slot\",\n1031: +\t\t\t\tslot,\n1032: +\t\t\t)\n1033: +\t\t}\n1034: +\t}\n1035: +\n1036: +\tlines := buildComponentCfgLines(n.componentsForConfig(components), n.componentSFM())\n1037: +\treturn n.componentConfigFromLines(lines)\n1038: +}\n1039: +\n1040: +// hardwareEnv is the topology env, which overrides component type, XIOM, and MDA.\n1041: +// Nodes that have not been through Init expose that env on Cfg.Env.\n1042: +func (n *sros) hardwareEnv() map[string]string {\n1043: +\tif n.userEnv != nil {\n1044: +\t\treturn n.userEnv\n1045: +\t}\n1046: +\treturn n.Cfg.Env\n1047: +}\n1048: +\n1049: +// componentSFM is the SFM used in generated config. NOKIA_SROS_SFM overrides the sfm key.\n1050: +func (n *sros) componentSFM() string {\n1051: +\tif sfm := n.hardwareEnv()[envNokiaSrosSFM]; sfm != \"\" {\n1052: +\t\treturn sfm\n1053: +\t}\n1054: +\treturn n.kindSpecificCfg().SFM\n1055: +}\n1056: +\n1057: +// componentForConfig clones c and applies per-component env, then node env.\n1058: +func (n *sros) componentForConfig(c *Component) *Component {\n1059: +\tout := cloneComponent(c)\n1060: +\tapplyHardwareEnv(out, out.Env)\n1061: +\tapplyHardwareEnv(out, n.hardwareEnv())\n1062: +\treturn out\n1063: +}\n1064: +\n1065: +func (n *sros) componentsForConfig(components []*Component) []*Component {\n1066: +\tout := make([]*Component, len(components))\n1067: +\tfor i, c := range components {\n1068: +\t\tout[i] = n.componentForConfig(c)\n1069: +\t}\n1070: +\treturn out\n1071: +}\n1072: +\n1073: +func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {\n1074: +\tpowerConfig := n.generatePowerConfig()\n1075: +\tif len(lines) == 0 && powerConfig == \"\" {\n1076: +\t\treturn \"\"\n1077: +\t}\n1078: +\n1079: +\tvar config strings.Builder\n1080: +\tfor _, l := range lines {\n1081: +\t\tconfig.WriteString(l.String())\n1082: +\t}\n1083: +\tconfig.WriteString(powerConfig)\n1084: +\treturn config.String()\n1085: +}\n1086: +\n1087: +func (n *sros) generateIntegratedComponentConfig() string {\n1088: +\tcard := strings.TrimSpace(n.Cfg.Env[envNokiaSrosCard])\n1089: +\tif card != \"\" {\n1090: +\t\tlog.Info(\n1091: +\t\t\t\"Card type override set on integrated chassis type, skipping component SR OS config generation\",\n1092: +\t\t\t\"node\",\n1093: +\t\t\tn.Cfg.ShortName,\n1094: +\t\t\t\"type\",\n1095: +\t\t\tn.Cfg.NodeType,\n1096: +\t\t\t\"card\",\n1097: +\t\t\tcard,\n1098: +\t\t)\n1099: +\t\treturn \"\"\n1100: +\t}\n1101: +\n1102: +\tlines := buildIntegratedComponentCfgLines(\n1103: +\t\tn.Cfg.NodeType,\n1104: +\t\tn.componentForConfig(n.integratedComponentOverride()),\n1105: +\t)\n1106: +\treturn n.componentConfigFromLines(lines)\n1107: +}\n1108: +\n1109: +// integratedComponentOverride returns the component that overrides the integrated defaults:\n1110: +// the single component of a standalone node, or the component matching the slot of a\n1111: +// redundant CPM node.\n1112: +func (n *sros) integratedComponentOverride() *Component {\n1113: +\tif n.rootCtrName == \"\" {\n1114: +\t\tif len(n.kindSpecificCfg().Components) == 1 {\n1115: +\t\t\treturn n.kindSpecificCfg().Components[0]\n1116: +\t\t}\n1117: +\t\treturn nil\n1118: +\t}\n1119: +\n1120: +\tslot := n.Cfg.Env[envNokiaSrosSlot]\n1121: +\tfor _, c := range n.rootComponents {\n1122: +\t\tif strings.EqualFold(strings.TrimSpace(c.Slot), slot) {\n1123: +\t\t\treturn c\n1124: +\t\t}\n1125: +\t}\n1126: +\treturn nil\n1127: +}\n1128: diff --git a/nodes/sros/config.go b/nodes/sros/config.go\n1129: index b46ae42..8ddbb21 100644\n1130: --- a/nodes/sros/config.go\n1131: +++ b/nodes/sros/config.go\n1132: @@ -1,8 +1,22 @@\n1133:  package sros\n1134:  \n1135: -import \"golang.org/x/mod/semver\"\n1136: +import (\n1137: +\t\"bytes\"\n1138: +\t\"context\"\n1139: +\t\"fmt\"\n1140: +\t\"io\"\n1141: +\t\"os\"\n1142: +\t\"path/filepath\"\n1143: +\t\"strings\"\n1144: +\n1145: +\tclabutils \"github.com/srl-labs/containerlab/utils\"\n1146: +\n1147: +\t\"github.com/beevik/etree\"\n1148: +\t\"github.com/charmbracelet/log\"\n1149: +\t\"golang.org/x/mod/semver\"\n1150: +)\n1151:  \n1152:  const (\n1153:  \tgrpcMDCLIConfig    = `/configure system grpc md-cli admin-state enable`\n1154:  \tprofileMDCLIConfig = `/configure system security aaa local-profiles profile \"administrative\" grpc rpc-authorization md-cli-session permit`\n1155:  \ttls13CipherCCM8    = `/configure system security tls server-cipher-list \"clab-all\" tls13-cipher 5 name tls-aes128-ccm8-sha256`\n1156: @@ -18,5 +32,314 @@ func (n *sros) setVersionSpecificParams(tplData *srosTemplateData) {\n1157:  \t\tif tplData.IsSecureGrpc {\n1158:  \t\t\ttplData.GRPCConfig += \"\\n\" + tls13CipherCCM8\n1159:  \t\t}\n1160:  \t}\n1161:  }\n1162: +\n1163: +// buildPKIImportXML builds the NETCONF action XML that imports a PEM file into the PKI store.\n1164: +func buildPKIImportXML(inputURL, outputFile, importType string) string {\n1165: +\taction := etree.NewElement(\"action\")\n1166: +\taction.CreateAttr(\"xmlns\", \"urn:ietf:params:xml:ns:yang:1\")\n1167: +\n1168: +\tadmin := action.CreateElement(\"admin\")\n1169: +\tadmin.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:oper-admin\")\n1170: +\n1171: +\timportElem := admin.CreateElement(\"system\").\n1172: +\t\tCreateElement(\"security\").\n1173: +\t\tCreateElement(\"pki\").\n1174: +\t\tCreateElement(\"import\")\n1175: +\n1176: +\t// Add import parameters\n1177: +\timportElem.CreateElement(\"input-url\").SetText(inputURL)\n1178: +\timportElem.CreateElement(\"output-file\").SetText(outputFile)\n1179: +\timportElem.CreateElement(\"type\").SetText(importType)\n1180: +\timportElem.CreateElement(\"format\").SetText(\"pem\")\n1181: +\tvar buf bytes.Buffer\n1182: +\taction.WriteTo(&buf, &etree.WriteSettings{\n1183: +\t\tCanonicalText:    false,\n1184: +\t\tCanonicalAttrVal: false,\n1185: +\t})\n1186: +\treturn buf.String()\n1187: +}\n1188: +\n1189: +// buildTLSProfileXML builds the TLS profile configuration XML.\n1190: +func buildTLSProfileXML() string {\n1191: +\tconfig := etree.NewElement(\"config\")\n1192: +\tconfigure := config.CreateElement(\"configure\")\n1193: +\tconfigure.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:conf\")\n1194: +\tconfigure.CreateAttr(\"xmlns:nc\", \"urn:ietf:params:xml:ns:netconf:base:1.0\")\n1195: +\n1196: +\tcertProfile := configure.CreateElement(\"system\").\n1197: +\t\tCreateElement(\"security\").\n1198: +\t\tCreateElement(\"tls\").\n1199: +\t\tCreateElement(\"cert-profile\")\n1200: +\n1201: +\t// Set operation attribute\n1202: +\tcertProfile.CreateAttr(\"nc:operation\", \"merge\")\n1203: +\n1204: +\t// Add profile configuration\n1205: +\tcertProfile.CreateElement(\"cert-profile-name\").SetText(tlsCertProfileName)\n1206: +\tcertProfile.CreateElement(\"admin-state\").SetText(\"enable\")\n1207: +\n1208: +\tvar buf bytes.Buffer\n1209: +\tconfig.WriteTo(&buf, &etree.WriteSettings{\n1210: +\t\tCanonicalText:    false,\n1211: +\t\tCanonicalAttrVal: false,\n1212: +\t})\n1213: +\treturn buf.String()\n1214: +}\n1215: +\n1216: +// createSROSConfigFiles handles config generation for the SR-SIM kind.\n1217: +// Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).\n1218: +func (n *sros) createSROSConfigFiles() error {\n1219: +\t// Get version from image before generating config\n1220: +\tif n.swVersion == nil {\n1221: +\t\tctx := context.Background()\n1222: +\t\tversion, err := n.srosVersionFromImage(ctx)\n1223: +\t\tif err != nil {\n1224: +\t\t\tn.swVersion = n.parseVersionString(srosDefaultVersion)\n1225: +\t\t\tlog.Warn(\"Failed to get SR OS version from image\",\n1226: +\t\t\t\t\"node\", n.Cfg.ShortName, \"version\", n.swVersion, \"error\", err)\n1227: +\t\t} else {\n1228: +\t\t\tn.swVersion = version\n1229: +\t\t\tlog.Info(\"Retrieved SR OS version from image\",\n1230: +\t\t\t\t\"node\", n.Cfg.ShortName,\n1231: +\t\t\t\t\"version\", fmt.Sprintf(\"%s.%s.%s\", version.Major, version.Minor, version.Build))\n1232: +\t\t}\n1233: +\t}\n1234: +\n1235: +\t// Path pointing to the target config file under configCf3 dir\n1236: +\tcf3CfgFile := filepath.Join(\n1237: +\t\tn.Cfg.LabDir,\n1238: +\t\tn.Cfg.Env[envNokiaSrosSlot],\n1239: +\t\tconfigCf3,\n1240: +\t\tstartupCfgName,\n1241: +\t)\n1242: +\tisPartial := clabutils.IsPartialConfigFile(n.Cfg.StartupConfig)\n1243: +\n1244: +\t// generate config and use that to boot node\n1245: +\tlog.Debug(\"Reading startup-config\", \"node\", n.Cfg.ShortName, \"startup-config\",\n1246: +\t\tn.Cfg.StartupConfig, \"isPartial\", isPartial)\n1247: +\n1248: +\tstartupConfig, err := n.buildStartupConfig(isPartial)\n1249: +\tif err != nil {\n1250: +\t\treturn err\n1251: +\t}\n1252: +\n1253: +\tif startupConfig == \"\" {\n1254: +\t\tlog.Debug(\n1255: +\t\t\t\"startup config is empty, skipping startup config file generation\",\n1256: +\t\t\t\"node\",\n1257: +\t\t\tn.Cfg.ShortName,\n1258: +\t\t)\n1259: +\t\treturn nil\n1260: +\t}\n1261: +\n1262: +\treturn n.GenerateConfig(cf3CfgFile, startupConfig)\n1263: +}\n1264: +\n1265: +// buildStartupConfig returns the full startup config string: either from user file (full config)\n1266: +// or from default + partial config generation. It does not return a template; the name is\n1267: +// historical.\n1268: +func (n *sros) buildStartupConfig(isPartial bool) (string, error) {\n1269: +\t// User provides full startup config\n1270: +\tif n.Cfg.StartupConfig != \"\" && !isPartial {\n1271: +\t\tc, err := os.ReadFile(n.Cfg.StartupConfig)\n1272: +\t\tif err != nil {\n1273: +\t\t\treturn \"\", err\n1274: +\t\t}\n1275: +\n1276: +\t\tcBuf, err := clabutils.SubstituteEnvsAndTemplate(bytes.NewReader(c), n.Cfg)\n1277: +\t\tif err != nil {\n1278: +\t\t\treturn \"\", err\n1279: +\t\t}\n1280: +\t\treturn cBuf.String(), nil\n1281: +\t}\n1282: +\n1283: +\t// Generate default config and optionally add partial config\n1284: +\tif err := n.addDefaultConfig(); err != nil {\n1285: +\t\treturn \"\", err\n1286: +\t}\n1287: +\tif err := n.addPartialConfig(); err != nil {\n1288: +\t\treturn \"\", err\n1289: +\t}\n1290: +\n1291: +\treturn string(n.startupCliCfg), nil\n1292: +}\n1293: +\n1294: +// prepareConfigTemplateData prepares all data needed for template selection and execution.\n1295: +// Service configs are filled from a single table-driven result: variant → getFullSnippetSet(v).\n1296: +func (n *sros) prepareConfigTemplateData() (*srosTemplateData, error) {\n1297: +\tb, err := n.banner()\n1298: +\tif err != nil {\n1299: +\t\treturn nil, err\n1300: +\t}\n1301: +\n1302: +\tcomponentConfig := \"\"\n1303: +\tif !isFullConfigFile(n.Cfg.StartupConfig) {\n1304: +\t\tcomponentConfig = n.generateComponentConfig()\n1305: +\t} else {\n1306: +\t\tlog.Debugf(\n1307: +\t\t\t\"SR-SIM node %q has non-partial startup-config defined, skipping component config gen\",\n1308: +\t\t\tn.Cfg.LongName,\n1309: +\t\t)\n1310: +\t}\n1311: +\n1312: +\tv := n.resolveConfigVariant()\n1313: +\tsnippets := getFullSnippetSet(v)\n1314: +\tconfigMode := string(v.Mode)\n1315: +\tif v.ForceClassic {\n1316: +\t\tlog.Warn(\n1317: +\t\t\t\"SAR-Hm nodes only support classic configuration mode. Overriding configuration mode to 'classic'\",\n1318: +\t\t\t\"node\",\n1319: +\t\t\tn.Cfg.LongName,\n1320: +\t\t\t\"node-type\",\n1321: +\t\t\tstrings.ToLower(n.Cfg.NodeType),\n1322: +\t\t)\n1323: +\t\tconfigMode = string(ConfigModeClassic)\n1324: +\t\tn.kindSpecificCfg().ConfigMode = ConfigModeClassic\n1325: +\t}\n1326: +\n1327: +\ttplData := &srosTemplateData{\n1328: +\t\t// Selection criteria\n1329: +\t\tNodeType:          strings.ToLower(n.Cfg.NodeType),\n1330: +\t\tConfigurationMode: configMode,\n1331: +\t\tSwVersion:         n.swVersion,\n1332: +\t\tIsSecureGrpc:      *n.Cfg.Certificate.Issue,\n1333: +\n1334: +\t\t// Node data\n1335: +\t\tName:            n.Cfg.ShortName,\n1336: +\t\tTLSKey:          n.Cfg.TLSKey,\n1337: +\t\tTLSCert:         n.Cfg.TLSCert,\n1338: +\t\tTLSAnchor:       n.Cfg.TLSAnchor,\n1339: +\t\tBanner:          b,\n1340: +\t\tIFaces:          map[string]tplIFace{},\n1341: +\t\tMgmtMTU:         0,\n1342: +\t\tMgmtIPMTU:       n.Runtime.Mgmt().MTU,\n1343: +\t\tComponentConfig: componentConfig,\n1344: +\n1345: +\t\t// Service configs from variant (single source of truth)\n1346: +\t\tSystemConfig:  snippets.SystemConfig,\n1347: +\t\tGRPCConfig:    snippets.GRPCConfig,\n1348: +\t\tSNMPConfig:    snippets.SNMPConfig,\n1349: +\t\tNetconfConfig: snippets.NetconfConfig,\n1350: +\t\tLoggingConfig: snippets.LoggingConfig,\n1351: +\t\tSSHConfig:     snippets.SSHConfig,\n1352: +\t}\n1353: +\n1354: +\tif n.Config().DNS != nil {\n1355: +\t\ttplData.DNSServers = append(tplData.DNSServers, n.Config().DNS.Servers...)\n1356: +\t}\n1357: +\n1358: +\tn.prepareSSHPubKeys(tplData)\n1359: +\n1360: +\tn.setVersionSpecificParams(tplData)\n1361: +\n1362: +\treturn tplData, nil\n1363: +}\n1364: +\n1365: +// addDefaultConfig adds sros default configuration such as tls certs, gnmi/json-rpc, login-banner,\n1366: +// ssh keys.\n1367: +func (n *sros) addDefaultConfig() error {\n1368: +\t// Prepare all template data\n1369: +\ttplData, err := n.prepareConfigTemplateData()\n1370: +\tif err != nil {\n1371: +\t\treturn err\n1372: +\t}\n1373: +\n1374: +\t// Select appropriate template\n1375: +\tsrosCfgTpl, err := n.selectConfigTemplate(tplData)\n1376: +\tif err != nil {\n1377: +\t\treturn fmt.Errorf(\"failed to select config template: %w\", err)\n1378: +\t}\n1379: +\tlog.Debug(\"Prepare SR OS config template\", \"template\", srosCfgTpl.Name(),\n1380: +\t\t\"node\", n.Cfg.LongName,\n1381: +\t\t\"configuration-mode\", tplData.ConfigurationMode,\n1382: +\t\t\"node-type\", tplData.NodeType,\n1383: +\t\t\"secure-grpc\", tplData.IsSecureGrpc,\n1384: +\t\t\"sw-version\", tplData.SwVersion)\n1385: +\n1386: +\t// Execute template\n1387: +\tbuf := new(bytes.Buffer)\n1388: +\terr = srosCfgTpl.Execute(buf, tplData)\n1389: +\tif err != nil {\n1390: +\t\treturn err\n1391: +\t}\n1392: +\n1393: +\tif buf.Len() == 0 {\n1394: +\t\tlog.Warn(\n1395: +\t\t\t\"Buffer empty, template parsing error\",\n1396: +\t\t\t\"node\", n.Cfg.ShortName,\n1397: +\t\t\t\"template\", srosCfgTpl.Name(),\n1398: +\t\t)\n1399: +\t} else {\n1400: +\t\tlog.Debug(\"Additional default config parsed\",\n1401: +\t\t\t\"node\", n.Cfg.ShortName,\n1402: +\t\t\t\"template\", srosCfgTpl.Name())\n1403: +\t\tn.startupCliCfg = append(n.startupCliCfg, buf.String()...)\n1404: +\t}\n1405: +\n1406: +\treturn nil\n1407: +}\n1408: +\n1409: +// applyPartialConfig applies partial configuration to the SR OS.\n1410: +func (n *sros) addPartialConfig() error {\n1411: +\tif n.Cfg.StartupConfig != \"\" {\n1412: +\t\t// b holds the configuration to be applied to the node\n1413: +\t\tb := &bytes.Buffer{}\n1414: +\t\t// apply partial configs if partial config is used\n1415: +\t\tif clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM(\"\") {\n1416: +\t\t\tlog.Info(\"Adding configuration\",\n1417: +\t\t\t\t\"node\", n.Cfg.LongName,\n1418: +\t\t\t\t\"type\", \"partial\",\n1419: +\t\t\t\t\"source\", n.Cfg.StartupConfig)\n1420: +\n1421: +\t\t\tr, err := os.Open(n.Cfg.StartupConfig)\n1422: +\t\t\tif err != nil {\n1423: +\t\t\t\treturn err\n1424: +\t\t\t}\n1425: +\n1426: +\t\t\tdefer r.Close() // skipcq: GO-S2307\n1427: +\n1428: +\t\t\t_, err = io.Copy(b, r)\n1429: +\t\t\tif err != nil {\n1430: +\t\t\t\treturn err\n1431: +\t\t\t}\n1432: +\n1433: +\t\t\tconfigContent, err := clabutils.SubstituteEnvsAndTemplate(b, n.Cfg)\n1434: +\t\t\tif err != nil {\n1435: +\t\t\t\treturn err\n1436: +\t\t\t}\n1437: +\t\t\tif configContent.Len() == 0 {\n1438: +\t\t\t\tlog.Warn(\n1439: +\t\t\t\t\t\"Buffer empty, PARTIAL config template parsing error\",\n1440: +\t\t\t\t\t\"node\",\n1441: +\t\t\t\t\tn.Cfg.ShortName,\n1442: +\t\t\t\t)\n1443: +\t\t\t} else {\n1444: +\t\t\t\tlog.Debug(\"Additional PARTIAL config parsed\", \"node\",\n1445: +\t\t\t\t\tn.Cfg.ShortName, \"partial-config\", configContent.String())\n1446: +\t\t\t\tn.startupCliCfg = append(n.startupCliCfg, configContent.String()...)\n1447: +\t\t\t}\n1448: +\t\t} else {\n1449: +\t\t\tlog.Warn(\n1450: +\t\t\t\t\"Passed startup-config option, but it will not have any effect\",\n1451: +\t\t\t\t\"node\",\n1452: +\t\t\t\tn.Cfg.ShortName,\n1453: +\t\t\t)\n1454: +\t\t}\n1455: +\t}\n1456: +\treturn nil\n1457: +}\n1458: +\n1459: +// isConfigClassic reports whether the node is in classic or mixed configuration mode.\n1460: +func (n *sros) isConfigClassic() bool {\n1461: +\tmode := n.kindSpecificCfg().ConfigMode\n1462: +\treturn mode == ConfigModeClassic || mode == ConfigModeMixed\n1463: +}\n1464: +\n1465: +// isFullConfigFile returns true if the config file doesn't contain .partial substring\n1466: +// and the config file is NOT nil (ie. startup config IS defined).\n1467: +// it is intended that the 'c' arg is n.Cfg.StartupConfig.\n1468: +func isFullConfigFile(c string) bool {\n1469: +\treturn c != \"\" && !clabutils.IsPartialConfigFile(c)\n1470: +}\n1471: diff --git a/nodes/sros/netns.go b/nodes/sros/netns.go\n1472: index dbd9af7..e7ec511 100644\n1473: --- a/nodes/sros/netns.go\n1474: +++ b/nodes/sros/netns.go\n1475: @@ -1,14 +1,20 @@\n1476:  package sros\n1477:  \n1478:  import (\n1479: +\t\"context\"\n1480: +\t\"errors\"\n1481:  \t\"fmt\"\n1482:  \t\"maps\"\n1483:  \n1484: +\tclabutils \"github.com/srl-labs/containerlab/utils\"\n1485: +\n1486:  \tclabconstants \"github.com/srl-labs/containerlab/constants\"\n1487:  \tclabnodes \"github.com/srl-labs/containerlab/nodes\"\n1488: +\tclabruntime \"github.com/srl-labs/containerlab/runtime\"\n1489:  \tclabtypes \"github.com/srl-labs/containerlab/types\"\n1490: +\t\"github.com/vishvananda/netns\"\n1491:  )\n1492:  \n1493:  // namespaceNode owns the shared network namespace of a components-based SR-SIM node.\n1494:  type namespaceNode struct {\n1495:  \tclabnodes.DefaultNode\n1496: @@ -81,5 +87,71 @@ func (n *sros) newNetnsConfig() *clabtypes.NodeConfig {\n1497:  \t\tLabels:                labels,\n1498:  \t\tRuntime:               n.Cfg.Runtime,\n1499:  \t\tResultingPortBindings: n.Cfg.ResultingPortBindings,\n1500:  \t}\n1501:  }\n1502: +\n1503: +func (n *sros) ensureNetnsRunning(ctx context.Context) error {\n1504: +\tswitch status := n.netnsNode.GetContainerStatus(ctx); status {\n1505: +\tcase clabruntime.Running:\n1506: +\t\t// The namespace holder intentionally survives regular node lifecycle operations.\n1507: +\tcase clabruntime.Created, clabruntime.Stopped:\n1508: +\t\tif err := n.netnsNode.Start(ctx); err != nil {\n1509: +\t\t\treturn fmt.Errorf(\"node %q network namespace container start error: %w\",\n1510: +\t\t\t\tn.Cfg.ShortName, err)\n1511: +\t\t}\n1512: +\tcase clabruntime.Paused:\n1513: +\t\tif err := n.Runtime.UnpauseContainer(ctx, n.netnsNode.Config().LongName); err != nil {\n1514: +\t\t\treturn fmt.Errorf(\"node %q network namespace container unpause error: %w\",\n1515: +\t\t\t\tn.Cfg.ShortName, err)\n1516: +\t\t}\n1517: +\tcase clabruntime.NotFound:\n1518: +\t\treturn fmt.Errorf(\n1519: +\t\t\t\"node %q network namespace container %q not found; recreate the node\",\n1520: +\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName,\n1521: +\t\t)\n1522: +\tdefault:\n1523: +\t\treturn fmt.Errorf(\"node %q network namespace container %q is %s\",\n1524: +\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName, status)\n1525: +\t}\n1526: +\n1527: +\treturn nil\n1528: +}\n1529: +\n1530: +func (n *sros) cleanupParkingNetNS() error {\n1531: +\tname := clabutils.ParkingNetnsName(n.Cfg.LongName)\n1532: +\tif _, err := clabutils.GetNamedNetNS(name); err != nil {\n1533: +\t\treturn nil\n1534: +\t}\n1535: +\n1536: +\treturn netns.DeleteNamed(name)\n1537: +}\n1538: +\n1539: +// GetNSPath retrieves the Namespace Path.\n1540: +func (n *sros) GetNSPath(ctx context.Context) (string, error) {\n1541: +\tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == \"\") {\n1542: +\t\treturn n.DefaultNode.GetNSPath(ctx)\n1543: +\t} else if n.isDistributedCardNode() {\n1544: +\t\treturn n.Runtime.GetNSPath(ctx, n.rootCtrName)\n1545: +\t}\n1546: +\treturn n.netnsNode.GetNSPath(ctx)\n1547: +}\n1548: +\n1549: +// DeleteNetnsSymlink deletes the symlink file created for the container netns.\n1550: +func (n *sros) DeleteNetnsSymlink() error {\n1551: +\tvar errs []error\n1552: +\n1553: +\t// if it is the base node, then we need to delete the symlink for all the components.\n1554: +\tif n.isDistributedBaseNode() {\n1555: +\t\tfor _, componentNode := range n.componentNodes {\n1556: +\t\t\terrs = append(errs, componentNode.DeleteNetnsSymlink())\n1557: +\t\t}\n1558: +\t\tif n.netnsNode != nil {\n1559: +\t\t\terrs = append(errs, n.netnsNode.DeleteNetnsSymlink())\n1560: +\t\t}\n1561: +\t\terrs = append(errs, clabutils.DeleteNetnsSymlink(n.Cfg.LongName))\n1562: +\t}\n1563: +\n1564: +\terrs = append(errs, n.DefaultNode.DeleteNetnsSymlink(), n.cleanupParkingNetNS())\n1565: +\n1566: +\treturn errors.Join(errs...)\n1567: +}\n1568: diff --git a/nodes/sros/power.go b/nodes/sros/power.go\n1569: index 7ab11bd..07509f3 100644\n1570: --- a/nodes/sros/power.go\n1571: +++ b/nodes/sros/power.go\n1572: @@ -3,10 +3,15 @@ package sros\n1573:  import (\n1574:  \t\"fmt\"\n1575:  \t\"strings\"\n1576:  )\n1577:  \n1578: +const (\n1579: +\tdefaultSrosPowerType       = \"dc\"\n1580: +\tdefaultSrosPowerModuleType = \"ps-a-dc-6000\"\n1581: +)\n1582: +\n1583:  // SrosPower defines power supply configuration for a given node type.\n1584:  type SrosPower struct {\n1585:  \tModules any\n1586:  \tShelves int\n1587:  }\n1588: diff --git a/nodes/sros/sros.go b/nodes/sros/sros.go\n1589: index 1eac470..20ae973 100644\n1590: --- a/nodes/sros/sros.go\n1591: +++ b/nodes/sros/sros.go\n1592: @@ -6,11 +6,10 @@ package sros\n1593:  \n1594:  import (\n1595:  \t\"bufio\"\n1596:  \t\"bytes\"\n1597:  \t\"context\"\n1598: -\t_ \"embed\"\n1599:  \t\"errors\"\n1600:  \t\"fmt\"\n1601:  \t\"io\"\n1602:  \t\"maps\"\n1603:  \t\"net\"\n1604: @@ -20,19 +19,16 @@ import (\n1605:  \t\"reflect\"\n1606:  \t\"regexp\"\n1607:  \t\"slices\"\n1608:  \t\"strconv\"\n1609:  \t\"strings\"\n1610: -\t\"text/template\"\n1611:  \t\"time\"\n1612:  \n1613: -\t\"github.com/beevik/etree\"\n\n(Output capped at 50 KB. Showing lines 1-1613. Use offset=1614 to continue.)\n</content>",
    "title": "source/diff.txt",
    "metadata": {
      "preview": "diff --git a/.github/workflows/srsim-tests.yml b/.github/workflows/srsim-tests.yml\nindex e9896cd..4aa8f48 100644\n--- a/.github/workflows/srsim-tests.yml\n+++ b/.github/workflows/srsim-tests.yml\n@@ -41,22 +41,21 @@ jobs:\n     if: needs.check-license.outputs.available == 'true'\n     env:\n       SRSIM_IMAGE_TAG: 26.7.R1\n     strategy:\n       matrix:\n-        test-suite:\n-          - \"01*.robot\"\n-          - \"03*.robot\"\n-          - \"04*.robot\"\n-          - \"05*.robot\"\n-          - \"06*.robot\"\n-          - \"07*.robot\"\n-          - \"08*.robot\"\n-          - \"09*.robot\"\n-          - \"10*.robot\"",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/diff.txt",
        "text": "diff --git a/.github/workflows/srsim-tests.yml b/.github/workflows/srsim-tests.yml\nindex e9896cd..4aa8f48 100644\n--- a/.github/workflows/srsim-tests.yml\n+++ b/.github/workflows/srsim-tests.yml\n@@ -41,22 +41,21 @@ jobs:\n     if: needs.check-license.outputs.available == 'true'\n     env:\n       SRSIM_IMAGE_TAG: 26.7.R1\n     strategy:\n       matrix:\n-        test-suite:\n-          - \"01*.robot\"\n-          - \"03*.robot\"\n-          - \"04*.robot\"\n-          - \"05*.robot\"\n-          - \"06*.robot\"\n-          - \"07*.robot\"\n-          - \"08*.robot\"\n-          - \"09*.robot\"\n-          - \"10*.robot\"\n-          - \"11*.robot\"\n-          - \"12*.robot\"\n+        include:\n+          - shard: basic\n+            test_suites: \"01-sros-to-linux.robot 07-srsim-with-mgmt-network.robot 12-srsim-veth-stitch.robot\"\n+          - shard: lifecycle\n+            test_suites: \"04-sros-classic.robot 06-srsim-sar.robot 10-srsim-lifecycle.robot\"\n+          - shard: components\n+            test_suites: \"05-sros-comp-to-linux.robot 09-srsim-pause-container.robot 14-srsim-new-chassis.robot\"\n+          - shard: provisioning\n+            test_suites: \"03-sros-dist-to-linux.robot 08-srsim-comp-cfg-test.robot 13-srsim-integrated.robot\"\n+          - shard: apply\n+            test_suites: \"11-srsim-apply.robot\"\n     steps:\n       - name: Checkout\n         uses: actions/checkout@v7\n         with:\n           fetch-depth: 0\n@@ -92,34 +91,39 @@ jobs:\n         run: uv sync --all-extras --dev\n \n       - name: Activate virtualenv\n         run: |\n           . .venv/bin/activate\n-          echo PATH=$PATH >> $GITHUB_ENV\n+          echo \"PATH=$PATH\" >> \"$GITHUB_ENV\"\n \n-      - name: Sanitize test-suite name\n-        run: echo \"TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')\" >> $GITHUB_ENV\n+      - name: Set shard name\n+        run: echo \"TEST_SUITE=${{ matrix.shard }}\" >> \"$GITHUB_ENV\"\n \n       - name: Login to GitHub Container Registry\n         uses: docker/login-action@v4\n         with:\n           registry: ghcr.io\n           username: ${{ github.actor }}\n           password: ${{ github.token }}\n \n       - name: Pull and re-tag srsim image\n-        run: docker pull ghcr.io/srl-labs/containerlab/nokia_srsim:${SRSIM_IMAGE_TAG} && docker tag ghcr.io/srl-labs/containerlab/nokia_srsim:${SRSIM_IMAGE_TAG} registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\n+        run: |\n+          image=\"ghcr.io/srl-labs/containerlab/nokia_srsim:${SRSIM_IMAGE_TAG}\"\n+          docker pull \"$image\"\n+          docker tag \"$image\" \"registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\"\n \n       - name: Logout from GitHub Container Registry\n         run: docker logout ghcr.io\n \n       # - name: setup tmate session\n       #   uses: mxschmitt/action-tmate@v3\n \n       - name: Run sros-srsim tests\n         run: |\n-          ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/13-srsim/${{ matrix.test-suite }}\n+          for test_suite in ${{ matrix.test_suites }}; do\n+            ./tests/rf-run.sh ${{ inputs.runtime }} \"./tests/13-srsim/${test_suite}\"\n+          done\n       # upload test reports as a zip file\n       - name: Upload test logs\n         uses: actions/upload-artifact@v7\n         if: always()\n         with:\ndiff --git a/docs/manual/kinds/sros.md b/docs/manual/kinds/sros.md\nindex 633972e..7c0f2e1 100644\n--- a/docs/manual/kinds/sros.md\n+++ b/docs/manual/kinds/sros.md\n@@ -239,13 +239,19 @@ topology:\n         NOKIA_SROS_MDA_1: me12-100gb-qsfp28 # override default MDA type in slot 1\n ```\n \n ///\n \n-For known SR/IXR integrated nodes, containerlab's default model-driven configuration also provisions the default card and MDA configuration. The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`. If the hardware is overridden with `components` or SR-SIM environment variables, the generated SR OS card/MDA configuration follows those overrides.\n+For known SR and IXR integrated types, containerlab generates model-driven configuration for the default card and MDA(s).\n \n-Integrated nodes accept at most one `components` entry because they still run as a single container. The component slot can be omitted or set to `A`; `ixr-r6` also accepts a single `B` slot override.\n+The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e2sc`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`.\n+\n+An integrated node other than `ixr-r6` runs as one container and accepts one `components` entry. The slot can be omitted or set to `A`. `ixr-r6` accepts slots `A` and `B`. Two `ixr-r6` entries, one for `A` and one for `B`, run as a dual-CPIOM node with one container per CPM. Integrated nodes do not accept numeric line-card slots.\n+\n+A `components` entry with `type` sets `NOKIA_SROS_CARD`. Containerlab then skips generated card and MDA configuration, because those defaults belong to the built-in card. Set `type` when the integrated card itself must change, for example `cpm-ixr-e2n/imm4-sfp+4-sfp+`.\n+\n+Node `env` overrides `components`: `type`, `xiom`, `mda`, per-component `env`, and the `sfm` key. When both set the same variable to different values, the environment variable wins and containerlab logs a warning naming that variable. `NOKIA_SROS_MDA_*` and `NOKIA_SROS_XIOM_*` are written into the generated configuration. `NOKIA_SROS_CARD` skips that generation, the same as a component `type`. On a distributed node, `NOKIA_SROS_SLOT` does not replace each component's slot.\n \n ### Distributed\n \n When the emulated platform is chassis-based, like SR-7, SR-14s, etc., the SR-SIM node must be defined in a distributed mode in the topology file.\n \n@@ -385,16 +391,18 @@ topology:\n When a distributed SR-SIM node is defined using `components`, we need to take into account the following:\n \n 1. Component containers are attached to an internal namespace pause container.\n 2. When changing a MDA or card type from its default value, the configuration for card, SFM and MDA must be also defined.\n 3. Links can be added referring to the node name. The same [interface naming](#interface-naming) convention holds for all SR-SIM nodes.\n-4. Environment variable based configuration on per-component, or node-level will override the configuration set in `type`, `xiom` and `mda` fields.\n+4. Environment variable based configuration on per-component, or node-level will override the configuration set in `type`, `xiom` and `mda` fields. Node-level `env` wins over both. When the values differ, containerlab logs a warning naming the environment variable that was kept.\n \n ##### Configuration for components\n \n When using the `components` structure in the node definition for a distributed node, containerlab will also generate the SR OS configuration for the installed components in the chassis, as well as relevant power supply configuration[^6] to ensure the installed components come up without requiring a user to manually provide the configuration. The same generated configuration mechanism is used for the built-in SR/IXR integrated defaults.\n \n+At deploy time, containerlab reads `chassis_info.json` from the selected SR-SIM image and compares the effective `components` configuration with the hardware types listed for that chassis. Unsupported card slots and card, SFM, XIOM, or MDA types produce warnings but do not stop deployment. This is a best-effort check: compatibility that is not represented in `chassis_info.json`, such as the MDA types supported by a specific XIOM, is not validated.\n+\n /// details | Disabling generated SR OS configuration for `components`\n     type: tip\n You can disable this config generation behavior by setting the `gen-component-config: false` [kind-specific config key](../nodes.md#kind-specific-config) on the node, or on the base node for a distributed chassis.\n \n ```yaml hl_lines=\"6\"\ndiff --git a/nodes/sros/README.md b/nodes/sros/README.md\nindex 3fbdee2..435bf6d 100644\n--- a/nodes/sros/README.md\n+++ b/nodes/sros/README.md\n@@ -37,11 +37,23 @@ The SR OS node kind supports deploying Nokia's SR OS network operating system in\n - **`sros_test.go`**: Unit tests\n   - Node type helper method tests\n   - Edge case validation\n   - Version parsing tests\n \n-- During PreDeploy, `chassis_info.json` is read from the node image (`/opt/nokia/chassis_info.json`) and written under the node's lab directory (`n.Cfg.LabDir`) with the same filename.\n+- **`component.go`**: Component model, slot checks, and environment precedence\n+- **`component_config.go`**: Generated card, SFM, XIOM, and MDA configuration, including integrated defaults\n+- **`chassis_info.go`**: Parses `chassis_info.json` and returns advisory compatibility warnings\n+\n+### Chassis info and component checks\n+\n+During PreDeploy, `createSROSFiles` reads `/opt/nokia/chassis_info.json` from the node image and writes it to `n.Cfg.LabDir/chassis_info.json`, prefixed with the license header. Failure to read the file is logged and does not stop deployment.\n+\n+The same file is then compared with the effective component configuration. Aliases such as `SAR-Mx` to `SAR-Hx` are followed. Unsupported slots, CPM/IOM types, SFM, XIOM, direct MDAs, and fixed-hardware mismatches produce warnings only. MDAs nested under an XIOM are not checked, because the file does not say which MDA types a given XIOM accepts.\n+\n+### Environment precedence\n+\n+Node `env` overrides per-component `env`, which overrides `type`, `xiom`, `mda`, and `sfm`. When a node environment variable replaces a different component value, containerlab logs that the component value will not be used and names the variable. `NOKIA_SROS_SLOT` still comes from each component in a distributed node, because one node-level slot cannot identify every card.\n \n ## Architecture\n \n ### Node Type Detection\n \n@@ -346,29 +358,16 @@ componentConfig := \"\"\n if !isFullConfigFile(n.Cfg.StartupConfig) {\n     componentConfig = n.generateComponentConfig()\n }\n ```\n \n-For distributed SR OS deployments with multiple CPMs and linecards, this generates:\n-- Slot-specific configuration\n-- Card type definitions\n-- MDA (Media Dependent Adapter) configurations\n-- Fabric connectivity\n+For integrated nodes and distributed line cards, this appends flat MD-CLI lines. CPM slots `A` and `B` are not provisioned as cards. `NOKIA_SROS_CARD`, or a component `type` on an integrated node, skips this generation because the built-in MDA defaults belong to the default card.\n \n-Example generated component config:\n ```\n-/configure {\n-    card 1 {\n-        card-type iom-e\n-        mda 1 {\n-            mda-type me12-100gb-qsfp28\n-        }\n-    }\n-    card A {\n-        card-type cpm-ixr\n-    }\n-}\n+/configure card 1 card-type iom-1 admin-state enable\n+/configure card 1 mda 1 mda-type me6-100gb-qsfp28 admin-state enable\n+/configure sfm 1 sfm-type sfm-2s admin-state enable\n ```\n \n #### Phase 3: Node-Type Specific Configuration (`applyNodeTypeSpecificConfig`)\n \n This phase customizes the template data based on the node's platform type and security settings.\n@@ -1047,83 +1046,22 @@ Each platform type has tailored configurations embedded in the `configs/` direct\n **SAR Classic Mode:**\n - **No gRPC configuration embedded**\n - SAR in classic mode doesn't support gRPC\n - Uses only CLI/NETCONF for management\n \n-### Distributed SR OS Configuration\n-\n-For distributed deployments with multiple components (CPMs and line cards), additional configuration is generated.\n-\n-#### Component Configuration Generation\n-\n-```go\n-func (n *sros) generateComponentConfig() string\n-```\n-\n-**Generated Configuration Structure:**\n-\n-```\n-/configure {\n-    {{- range .Components }}\n-    card {{ .Slot }} {\n-        card-type {{ .Type }}\n-        {{- if .MDAs }}\n-        {{- range .MDAs }}\n-        mda {{ .Slot }} {\n-            mda-type {{ .Type }}\n-        }\n-        {{- end }}\n-        {{- end }}\n-    }\n-    {{- end }}\n-    \n-    {{- if .FabricConfig }}\n-    fabric {\n-        {{ .FabricConfig }}\n-    }\n-    {{- end }}\n-}\n-```\n+### Component configuration\n \n-**Example Distributed Topology:**\n+`generateComponentConfig` runs for integrated nodes and for the CPM of a distributed node, unless the user supplied a full startup config, selected classic mode, or set `gen-component-config: false`.\n \n-```yaml\n-nodes:\n-  chassis1:\n-    kind: nokia_srsim\n-    components:\n-      - slot: A\n-        type: cpm-ixr\n-      - slot: B\n-        type: cpm-ixr\n-      - slot: 1\n-        type: iom-ixr\n-        mda:\n-          - slot: 1\n-            type: m20-1gb-sfp-b\n-```\n+Known integrated types (`sr-1`, `sr-1s`, `ixr-r6`, and the `ixr-e*` pizza boxes) get built-in card and MDA lines. One `components` entry is accepted, with the slot omitted or set to `A`. `ixr-r6` also accepts `B`, and two entries (`A` and `B`) deploy a dual-CPIOM node. A component `type` sets `NOKIA_SROS_CARD` and skips generated card and MDA lines.\n \n-**Generated Component Config:**\n+Distributed line cards produce one line per card, SFM, XIOM, and direct MDA. The values are the effective ones after environment precedence, so `NOKIA_SROS_MDA_*` and `NOKIA_SROS_XIOM_*` change the generated lines.\n \n ```\n-/configure {\n-    card A {\n-        card-type cpm-ixr\n-    }\n-    card B {\n-        card-type cpm-ixr\n-    }\n-    card 1 {\n-        card-type iom-ixr\n-        mda 1 {\n-            mda-type m20-1gb-sfp-b\n-        }\n-    }\n-    fabric {\n-        multiplane-mode enabled\n-    }\n-}\n+/configure card 1 card-type xcm-2s admin-state enable\n+/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\n+/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\n ```\n \n ### Security and Certificate Management\n \n When `certificate.issue: true` is set, the system generates and injects TLS certificates.\n@@ -1538,14 +1476,14 @@ docker ps | grep chassis1\n # Verify slot assignments\n ssh admin@clab-mylab-chassis1-cpm-a \"show card state\"\n ```\n \n **Common Causes:**\n-- Component slots not properly defined\n-- CPM slot names must be \"A\" or \"B\" (uppercase)\n+- Component slots are duplicated, including slots that differ only by case\n - Line card slots must be numeric\n-- Environment variables not set on components\n+- The component type or MDA is not listed for that chassis in the image's `chassis_info.json` (this is logged as a warning and does not stop deployment)\n+- A node-level environment variable overrides the component value; the log names the variable that was kept\n \n ## Performance Considerations\n \n ### Template Execution Performance\n \n@@ -1638,7 +1576,7 @@ BSD 3-Clause License - See LICENSE file for details\n \n **Maintainers:**\n - Nokia Containerlab Team\n - Community Contributors\n \n-**Last Updated:** 2025-11-15\n-**SR OS Versions Supported:**  25.7+, 26.x (planned)\n+**Last Updated:** 2026-10-14\n+**SR OS Versions Supported:**  25.7+, 26.x\ndiff --git a/nodes/sros/chassis_info.go b/nodes/sros/chassis_info.go\nindex ace213b..fe5b7f8 100644\n--- a/nodes/sros/chassis_info.go\n+++ b/nodes/sros/chassis_info.go\n@@ -2,10 +2,221 @@\n // Licensed under the BSD 3-Clause License.\n // SPDX-License-Identifier: BSD-3-Clause\n \n package sros\n \n+import (\n+\t\"encoding/json\"\n+\t\"fmt\"\n+\t\"slices\"\n+\t\"strconv\"\n+\t\"strings\"\n+)\n+\n // DefaultChassisInfoPath is the path to chassis_info.json inside SROS/SR SIM container images.\n const DefaultChassisInfoPath = \"/opt/nokia/chassis_info.json\"\n \n // chassisInfoFileLicense is prepended to the chassis_info.json file written to LabDir.\n const chassisInfoFileLicense = \"// Copyright 2026 Nokia\\n// Licensed under the BSD 3-Clause License.\\n// SPDX-License-Identifier: BSD-3-Clause\\n\\n\"\n+\n+type chassisInfoEntry struct {\n+\tAlias      string            `json:\"alias\"`\n+\tCPM        []string          `json:\"cpm\"`\n+\tIOM        []string          `json:\"iom\"`\n+\tIOMSlots   int               `json:\"iom_slots\"`\n+\tMDA        []*string         `json:\"mda\"`\n+\tFixedMDAs  map[string]string `json:\"fixed_mdas\"`\n+\tSFM        []string          `json:\"sfm\"`\n+\tXIOM       []string          `json:\"xiom\"`\n+\tFixedHWCfg string            `json:\"fixed_hw_cfg\"`\n+\tIntegrated bool              `json:\"integrated\"`\n+\tRedundant  bool              `json:\"redundant\"`\n+}\n+\n+type chassisInfo map[string]chassisInfoEntry\n+\n+func parseChassisInfo(content []byte) (chassisInfo, error) {\n+\tvar info chassisInfo\n+\tif err := json.Unmarshal(content, &info); err != nil {\n+\t\treturn nil, fmt.Errorf(\"parse chassis_info.json: %w\", err)\n+\t}\n+\treturn info, nil\n+}\n+\n+func (i chassisInfo) entry(nodeType string) (chassisInfoEntry, bool) {\n+\tkey := \"\"\n+\tfor candidate := range i {\n+\t\tif strings.EqualFold(candidate, strings.TrimSpace(nodeType)) {\n+\t\t\tkey = candidate\n+\t\t\tbreak\n+\t\t}\n+\t}\n+\tif key == \"\" {\n+\t\treturn chassisInfoEntry{}, false\n+\t}\n+\n+\tseen := map[string]struct{}{}\n+\tfor {\n+\t\tif _, ok := seen[key]; ok {\n+\t\t\treturn chassisInfoEntry{}, false\n+\t\t}\n+\t\tseen[key] = struct{}{}\n+\n+\t\tentry := i[key]\n+\t\tif entry.Alias == \"\" {\n+\t\t\treturn entry, true\n+\t\t}\n+\n+\t\tkey = \"\"\n+\t\tfor candidate := range i {\n+\t\t\tif strings.EqualFold(candidate, entry.Alias) {\n+\t\t\t\tkey = candidate\n+\t\t\t\tbreak\n+\t\t\t}\n+\t\t}\n+\t\tif key == \"\" {\n+\t\t\treturn chassisInfoEntry{}, false\n+\t\t}\n+\t}\n+}\n+\n+// componentWarnings returns best-effort validation warnings. It deliberately skips checks\n+// that chassis_info.json cannot express, such as which MDA types belong under a specific XIOM.\n+func (i chassisInfo) componentWarnings(nodeType, sfm string, components []*Component) []string {\n+\tentry, ok := i.entry(nodeType)\n+\tif !ok {\n+\t\treturn []string{\n+\t\t\tfmt.Sprintf(\n+\t\t\t\t\"chassis type %q is not present in chassis_info.json; component compatibility was not checked\",\n+\t\t\t\tnodeType,\n+\t\t\t),\n+\t\t}\n+\t}\n+\n+\tvar warnings []string\n+\tif sfm != \"\" && len(entry.SFM) > 0 && !slices.Contains(entry.SFM, sfm) {\n+\t\twarnings = append(warnings, fmt.Sprintf(\n+\t\t\t\"SFM type %q is not listed for chassis type %q\",\n+\t\t\tsfm,\n+\t\t\tnodeType,\n+\t\t))\n+\t}\n+\n+\tfor _, component := range components {\n+\t\tif component == nil {\n+\t\t\tcontinue\n+\t\t}\n+\t\tslot := strings.ToUpper(strings.TrimSpace(component.Slot))\n+\t\tif slot == \"\" {\n+\t\t\tslot = slotAName\n+\t\t}\n+\n+\t\tswitch {\n+\t\tcase slot == slotAName || slot == slotBName:\n+\t\t\tif slot == slotBName && !entry.Redundant {\n+\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n+\t\t\t\t\t\"component slot %s is not listed as supported for chassis type %q\",\n+\t\t\t\t\tslot,\n+\t\t\t\t\tnodeType,\n+\t\t\t\t))\n+\t\t\t}\n+\t\t\tif component.Type != \"\" &&\n+\t\t\t\tentry.FixedHWCfg != \"\" &&\n+\t\t\t\tcomponent.Type != entry.FixedHWCfg {\n+\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n+\t\t\t\t\t\"component type %q in slot %s does not match fixed hardware %q for chassis type %q\",\n+\t\t\t\t\tcomponent.Type,\n+\t\t\t\t\tslot,\n+\t\t\t\t\tentry.FixedHWCfg,\n+\t\t\t\t\tnodeType,\n+\t\t\t\t))\n+\t\t\t} else if component.Type != \"\" &&\n+\t\t\t\tentry.FixedHWCfg == \"\" &&\n+\t\t\t\tlen(entry.CPM) > 0 &&\n+\t\t\t\t!slices.Contains(entry.CPM, component.Type) {\n+\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n+\t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n+\t\t\t\t\tcomponent.Type,\n+\t\t\t\t\tslot,\n+\t\t\t\t\tnodeType,\n+\t\t\t\t))\n+\t\t\t}\n+\t\tdefault:\n+\t\t\tnumericSlot, err := strconv.Atoi(slot)\n+\t\t\tif err == nil {\n+\t\t\t\tif entry.IOMSlots > 0 && numericSlot > entry.IOMSlots {\n+\t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n+\t\t\t\t\t\t\"component slot %s exceeds the %d IOM slots listed for chassis type %q\",\n+\t\t\t\t\t\tslot,\n+\t\t\t\t\t\tentry.IOMSlots,\n+\t\t\t\t\t\tnodeType,\n+\t\t\t\t\t))\n+\t\t\t\t}\n+\t\t\t\tif component.Type != \"\" &&\n+\t\t\t\t\tlen(entry.IOM) > 0 &&\n+\t\t\t\t\t!slices.Contains(entry.IOM, component.Type) {\n+\t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n+\t\t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n+\t\t\t\t\t\tcomponent.Type,\n+\t\t\t\t\t\tslot,\n+\t\t\t\t\t\tnodeType,\n+\t\t\t\t\t))\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\n+\n+\t\tfor _, xiom := range component.XIOM {\n+\t\t\tif xiom.Type != \"\" &&\n+\t\t\t\tlen(entry.XIOM) > 0 &&\n+\t\t\t\t!slices.Contains(entry.XIOM, xiom.Type) {\n+\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n+\t\t\t\t\t\"XIOM type %q in component slot %s is not listed for chassis type %q\",\n+\t\t\t\t\txiom.Type,\n+\t\t\t\t\tslot,\n+\t\t\t\t\tnodeType,\n+\t\t\t\t))\n+\t\t\t}\n+\t\t}\n+\n+\t\tif entry.Integrated || (slot != slotAName && slot != slotBName) {\n+\t\t\twarnings = append(warnings, validateMDAs(nodeType, entry, component.MDA)...)\n+\t\t}\n+\t}\n+\n+\treturn warnings\n+}\n+\n+func validateMDAs(nodeType string, entry chassisInfoEntry, mdas MDAS) []string {\n+\tvar warnings []string\n+\tfor _, mda := range mdas {\n+\t\tif fixed, exists := entry.FixedMDAs[strconv.Itoa(mda.Slot)]; exists {\n+\t\t\tif mda.Type != fixed {\n+\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n+\t\t\t\t\t\"MDA type %q in slot %d does not match fixed MDA %q for chassis type %q\",\n+\t\t\t\t\tmda.Type,\n+\t\t\t\t\tmda.Slot,\n+\t\t\t\t\tfixed,\n+\t\t\t\t\tnodeType,\n+\t\t\t\t))\n+\t\t\t}\n+\t\t\tcontinue\n+\t\t}\n+\t\tif mda.Type != \"\" && !containsChassisType(entry.MDA, mda.Type) {\n+\t\t\twarnings = append(warnings, fmt.Sprintf(\n+\t\t\t\t\"MDA type %q in slot %d is not listed for chassis type %q\",\n+\t\t\t\tmda.Type,\n+\t\t\t\tmda.Slot,\n+\t\t\t\tnodeType,\n+\t\t\t))\n+\t\t}\n+\t}\n+\treturn warnings\n+}\n+\n+func containsChassisType(types []*string, value string) bool {\n+\tfor _, typ := range types {\n+\t\tif typ != nil && *typ == value {\n+\t\t\treturn true\n+\t\t}\n+\t}\n+\treturn false\n+}\ndiff --git a/nodes/sros/chassis_info_test.go b/nodes/sros/chassis_info_test.go\nnew file mode 100644\nindex 0000000..befd2b4\n--- /dev/null\n+++ b/nodes/sros/chassis_info_test.go\n@@ -0,0 +1,99 @@\n+// Copyright 2026 Nokia\n+// Licensed under the BSD 3-Clause License.\n+// SPDX-License-Identifier: BSD-3-Clause\n+\n+package sros\n+\n+import (\n+\t\"testing\"\n+\n+\t\"github.com/stretchr/testify/assert\"\n+\t\"github.com/stretchr/testify/require\"\n+)\n+\n+func TestChassisInfoComponentWarnings(t *testing.T) {\n+\tinfo, err := parseChassisInfo([]byte(`{\n+\t\t\"IXR-x\": {\n+\t\t\t\"cpm\": [\"cpm-ixr-x\"],\n+\t\t\t\"iom\": [\"imm6-qsfpdd+48-sfp56\"],\n+\t\t\t\"iom_slots\": 1,\n+\t\t\t\"mda\": [null],\n+\t\t\t\"sfm\": [\"sfm-ixr-x\"]\n+\t\t},\n+\t\t\"SAR-Hx\": {\n+\t\t\t\"cpm\": [\"iom-sar-1x\"],\n+\t\t\t\"fixed_mdas\": {\"2\": \"fixed-mda\"},\n+\t\t\t\"integrated\": true,\n+\t\t\t\"mda\": [\"supported-mda\"],\n+\t\t\t\"xiom\": [\"supported-xiom\"]\n+\t\t},\n+\t\t\"SAR-Mx\": {\"alias\": \"SAR-Hx\"}\n+\t}`))\n+\trequire.NoError(t, err)\n+\n+\tt.Run(\"supported configuration\", func(t *testing.T) {\n+\t\twarnings := info.componentWarnings(\"sar-mx\", \"\", []*Component{{\n+\t\t\tSlot: slotAName,\n+\t\t\tType: \"iom-sar-1x\",\n+\t\t\tMDA: MDAS{\n+\t\t\t\t{Slot: 1, Type: \"supported-mda\"},\n+\t\t\t\t{Slot: 2, Type: \"fixed-mda\"},\n+\t\t\t},\n+\t\t\tXIOM: XIOMS{{Slot: 1, Type: \"supported-xiom\"}},\n+\t\t}})\n+\n+\t\tassert.Empty(t, warnings)\n+\t})\n+\n+\tt.Run(\"unsupported values warn\", func(t *testing.T) {\n+\t\twarnings := info.componentWarnings(\"IXR-x\", \"wrong-sfm\", []*Component{\n+\t\t\t{Slot: slotAName, Type: \"wrong-cpm\"},\n+\t\t\t{Slot: \"2\", Type: \"wrong-iom\", MDA: MDAS{{Slot: 1, Type: \"wrong-mda\"}}},\n+\t\t})\n+\n+\t\tassert.Len(t, warnings, 5)\n+\t\tassert.Contains(t, warnings[0], \"SFM type\")\n+\t\tassert.Contains(t, warnings[1], \"component type\")\n+\t\tassert.Contains(t, warnings[2], \"exceeds\")\n+\t\tassert.Contains(t, warnings[3], \"component type\")\n+\t\tassert.Contains(t, warnings[4], \"MDA type\")\n+\t})\n+\n+\tt.Run(\"fixed MDA mismatch warns\", func(t *testing.T) {\n+\t\twarnings := info.componentWarnings(\"SAR-Hx\", \"\", []*Component{{\n+\t\t\tSlot: slotAName,\n+\t\t\tMDA:  MDAS{{Slot: 2, Type: \"wrong-mda\"}},\n+\t\t}})\n+\n+\t\trequire.Len(t, warnings, 1)\n+\t\tassert.Contains(t, warnings[0], \"does not match fixed MDA\")\n+\t})\n+\n+\tt.Run(\"distributed CPM slot does not validate direct MDAs\", func(t *testing.T) {\n+\t\twarnings := info.componentWarnings(\"IXR-x\", \"\", []*Component{{\n+\t\t\tSlot: slotAName,\n+\t\t\tType: \"cpm-ixr-x\",\n+\t\t\tMDA:  MDAS{{Slot: 1, Type: \"not-a-cpm-mda\"}},\n+\t\t}})\n+\n+\t\tassert.Empty(t, warnings)\n+\t})\n+\n+\tt.Run(\"nested XIOM MDA is not guessed\", func(t *testing.T) {\n+\t\twarnings := info.componentWarnings(\"SAR-Hx\", \"\", []*Component{{\n+\t\t\tSlot: slotAName,\n+\t\t\tXIOM: XIOMS{{\n+\t\t\t\tSlot: 1,\n+\t\t\t\tType: \"supported-xiom\",\n+\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"not-in-chassis-mda-list\"}},\n+\t\t\t}},\n+\t\t}})\n+\n+\t\tassert.Empty(t, warnings)\n+\t})\n+}\n+\n+func TestParseChassisInfoRejectsInvalidJSON(t *testing.T) {\n+\t_, err := parseChassisInfo([]byte(`{\"SR-1\":`))\n+\trequire.Error(t, err)\n+}\ndiff --git a/nodes/sros/component.go b/nodes/sros/component.go\nindex bdac689..b62efb3 100644\n--- a/nodes/sros/component.go\n+++ b/nodes/sros/component.go\n@@ -1,10 +1,15 @@\n package sros\n \n import (\n \t\"fmt\"\n+\t\"maps\"\n+\t\"slices\"\n+\t\"strconv\"\n \t\"strings\"\n+\n+\t\"github.com/charmbracelet/log\"\n )\n \n // Component is an SR-SIM card: a CPM (slot A or B) or a line card.\n type Component struct {\n \tSlot string            `yaml:\"slot,omitempty\" json:\"slot,omitempty\"`\n@@ -117,5 +122,188 @@ func (l *XIOMS) UnmarshalYAML(unmarshal func(any) error) error {\n \n \t*l = XIOMS(entries)\n \n \treturn nil\n }\n+\n+func setComponentEnvVars(env map[string]string, c *Component) {\n+\tif c.Type != \"\" {\n+\t\tenv[envNokiaSrosCard] = c.Type\n+\t}\n+\n+\tfor _, x := range c.XIOM {\n+\t\tkey := fmt.Sprintf(\"%s_X%d\", envNokiaSrosXIOM, x.Slot)\n+\t\tenv[key] = x.Type\n+\t\t// add the nested MDA\n+\t\tfor _, m := range x.MDA {\n+\t\t\tkey := fmt.Sprintf(\"%s_X%d_%d\", envNokiaSrosMDA, x.Slot, m.Slot)\n+\t\t\tenv[key] = m.Type\n+\t\t}\n+\t}\n+\n+\tfor _, m := range c.MDA {\n+\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n+\t\tenv[key] = m.Type\n+\t}\n+}\n+\n+func (n *sros) checkComponentSlotsConfig() error {\n+\t// check Slots are unique\n+\tcomponentNames := map[string]struct{}{}\n+\tfor _, component := range n.kindSpecificCfg().Components {\n+\t\t// convert slot to upper\n+\t\tslot := strings.ToUpper(component.Slot)\n+\t\t// check if slot exists\n+\t\t_, exists := componentNames[slot]\n+\t\tif exists {\n+\t\t\treturn fmt.Errorf(\n+\t\t\t\t\"node %s slot %s duplicate definition\",\n+\t\t\t\tn.GetShortName(),\n+\t\t\t\tcomponent.Slot,\n+\t\t\t)\n+\t\t}\n+\t\t// add to component names map\n+\t\tcomponentNames[slot] = struct{}{}\n+\n+\t}\n+\treturn nil\n+}\n+\n+// componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,\n+// and per-component env. Per-component env overrides the typed fields.\n+func componentDerivedEnv(c *Component) map[string]string {\n+\tderived := map[string]string{}\n+\tif c == nil {\n+\t\treturn derived\n+\t}\n+\tsetComponentEnvVars(derived, c)\n+\tmaps.Copy(derived, c.Env)\n+\treturn derived\n+}\n+\n+// warnUserEnvOverrides logs when a node env var replaces a component-derived value.\n+func warnUserEnvOverrides(node string, derived, userEnv map[string]string) {\n+\tfor key, componentValue := range derived {\n+\t\tenvValue, userSet := userEnv[key]\n+\t\tif !userSet || componentValue == envValue {\n+\t\t\tcontinue\n+\t\t}\n+\t\tlog.Warn(\n+\t\t\tfmt.Sprintf(\n+\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n+\t\t\t\tcomponentValue,\n+\t\t\t\tkey,\n+\t\t\t),\n+\t\t\t\"node\", node,\n+\t\t\t\"env\", key,\n+\t\t\t\"component-value\", componentValue,\n+\t\t\t\"env-value\", envValue,\n+\t\t)\n+\t}\n+}\n+\n+// keepUserEnv copies component-derived keys into dst unless the user already set that key.\n+// A user value wins, and a differing component value is logged.\n+func keepUserEnv(node string, dst, derived, userEnv map[string]string) {\n+\twarnUserEnvOverrides(node, derived, userEnv)\n+\tfor key, componentValue := range derived {\n+\t\tif envValue, userSet := userEnv[key]; userSet {\n+\t\t\tdst[key] = envValue\n+\t\t\tcontinue\n+\t\t}\n+\t\tdst[key] = componentValue\n+\t}\n+}\n+\n+// cloneComponent returns a deep copy of c suitable for env overrides during config generation.\n+func cloneComponent(c *Component) *Component {\n+\tif c == nil {\n+\t\treturn &Component{}\n+\t}\n+\tout := *c\n+\tout.Env = maps.Clone(c.Env)\n+\tout.MDA = slices.Clone(c.MDA)\n+\tif len(c.XIOM) > 0 {\n+\t\tout.XIOM = make(XIOMS, len(c.XIOM))\n+\t\tfor i, xiom := range c.XIOM {\n+\t\t\txiom.MDA = slices.Clone(xiom.MDA)\n+\t\t\tout.XIOM[i] = xiom\n+\t\t}\n+\t}\n+\treturn &out\n+}\n+\n+// applyHardwareEnv overlays SR-SIM card, XIOM, and MDA environment variables onto c.\n+// NOKIA_SROS_SLOT is left unchanged; it identifies the container rather than provisioned hardware.\n+func applyHardwareEnv(c *Component, env map[string]string) {\n+\tif c == nil || len(env) == 0 {\n+\t\treturn\n+\t}\n+\tif card := env[envNokiaSrosCard]; card != \"\" {\n+\t\tc.Type = card\n+\t}\n+\tfor key, val := range env {\n+\t\tif val == \"\" {\n+\t\t\tcontinue\n+\t\t}\n+\t\tswitch {\n+\t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_X\"):\n+\t\t\trest := strings.TrimPrefix(key, envNokiaSrosMDA+\"_X\")\n+\t\t\txiomStr, mdaStr, ok := strings.Cut(rest, \"_\")\n+\t\t\tif !ok {\n+\t\t\t\tcontinue\n+\t\t\t}\n+\t\t\txiomSlot, errX := strconv.Atoi(xiomStr)\n+\t\t\tmdaSlot, errM := strconv.Atoi(mdaStr)\n+\t\t\tif errX != nil || errM != nil || xiomSlot <= 0 || mdaSlot <= 0 {\n+\t\t\t\tcontinue\n+\t\t\t}\n+\t\t\tupsertXiomMDA(c, xiomSlot, mdaSlot, val)\n+\t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_\"):\n+\t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosMDA+\"_\"))\n+\t\t\tif err != nil || slot <= 0 {\n+\t\t\t\tcontinue\n+\t\t\t}\n+\t\t\tc.MDA = upsertMDA(c.MDA, slot, val)\n+\t\tcase strings.HasPrefix(key, envNokiaSrosXIOM+\"_X\"):\n+\t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosXIOM+\"_X\"))\n+\t\t\tif err != nil || slot <= 0 {\n+\t\t\t\tcontinue\n+\t\t\t}\n+\t\t\tupsertXiomType(c, slot, val)\n+\t\t}\n+\t}\n+}\n+\n+func upsertMDA(mdas MDAS, slot int, typ string) MDAS {\n+\tfor i := range mdas {\n+\t\tif mdas[i].Slot == slot {\n+\t\t\tmdas[i].Type = typ\n+\t\t\treturn mdas\n+\t\t}\n+\t}\n+\treturn append(mdas, MDA{Slot: slot, Type: typ})\n+}\n+\n+func upsertXiomType(c *Component, slot int, typ string) {\n+\tfor i := range c.XIOM {\n+\t\tif c.XIOM[i].Slot == slot {\n+\t\t\tc.XIOM[i].Type = typ\n+\t\t\treturn\n+\t\t}\n+\t}\n+\tc.XIOM = append(c.XIOM, XIOM{Slot: slot, Type: typ})\n+}\n+\n+func upsertXiomMDA(c *Component, xiomSlot, mdaSlot int, typ string) {\n+\tfor i := range c.XIOM {\n+\t\tif c.XIOM[i].Slot != xiomSlot {\n+\t\t\tcontinue\n+\t\t}\n+\t\tc.XIOM[i].MDA = upsertMDA(c.XIOM[i].MDA, mdaSlot, typ)\n+\t\treturn\n+\t}\n+\tc.XIOM = append(c.XIOM, XIOM{\n+\t\tSlot: xiomSlot,\n+\t\tMDA:  MDAS{{Slot: mdaSlot, Type: typ}},\n+\t})\n+}\ndiff --git a/nodes/sros/component_config.go b/nodes/sros/component_config.go\nindex 914f3de..3985e12 100644\n--- a/nodes/sros/component_config.go\n+++ b/nodes/sros/component_config.go\n@@ -4,13 +4,15 @@\n \n package sros\n \n import (\n \t\"fmt\"\n+\t\"maps\"\n \t\"slices\"\n-\t\"strconv\"\n \t\"strings\"\n+\n+\t\"github.com/charmbracelet/log\"\n )\n \n const integratedSrosCardSlot = \"1\"\n \n type integratedSrosDefaultComponent struct {\n@@ -82,10 +84,17 @@ var integratedSrosDefaultComponents = map[string]integratedSrosDefaultComponent{\n \t\tallowedSlots: []string{slotAName},\n \t\tmdas: MDAS{\n \t\t\t{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"},\n \t\t},\n \t},\n+\t\"ixr-e2sc\": {\n+\t\tcardType:     \"imm16-sfp++4-sfp28\",\n+\t\tallowedSlots: []string{slotAName},\n+\t\tmdas: MDAS{\n+\t\t\t{Slot: 1, Type: \"m16-sfp++4-sfp28\"},\n+\t\t},\n+\t},\n \t\"ixr-ec\": {\n \t\tcardType:     \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n \t\tallowedSlots: []string{slotAName},\n \t\tmdas: MDAS{\n \t\t\t{Slot: 1, Type: \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\"},\n@@ -172,66 +181,44 @@ func buildComponentCfgLines(components []*Component, sfm string) []componentCfgL\n \t\t}\n \t}\n \treturn lines\n }\n \n-func buildIntegratedComponentCfgLines(\n-\tnodeType string,\n-\tenv map[string]string,\n-) []componentCfgLine {\n+func buildIntegratedComponentCfgLines(nodeType string, override *Component) []componentCfgLine {\n \tcomponent, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]\n \tif !ok {\n \t\treturn nil\n \t}\n-\n-\tcardType := component.cardType\n-\tif envCardType := strings.TrimSpace(env[envNokiaSrosCard]); envCardType != \"\" {\n-\t\tcardType = envCardType\n+\tif override == nil {\n+\t\toverride = &Component{}\n \t}\n \n-\tlines := []componentCfgLine{\n-\t\t{Kind: \"card\", Slot: integratedSrosCardSlot, Type: cardType},\n+\tdefaultMdas := component.mdas\n+\n+\tif len(override.XIOM) > 0 {\n+\t\tdefaultMdas = nil\n \t}\n \n-\tfor _, mda := range mergeIntegratedMdas(component.mdas, env) {\n-\t\tlines = append(lines, componentCfgLine{\n-\t\t\tKind: \"mda\", Slot: integratedSrosCardSlot, MdaSlot: mda.Slot, Type: mda.Type,\n-\t\t})\n+\tcard := &Component{\n+\t\tSlot: integratedSrosCardSlot,\n+\t\tType: component.cardType,\n+\t\tXIOM: override.XIOM,\n+\t\tMDA:  mergeIntegratedMdas(defaultMdas, override.MDA),\n \t}\n \n-\treturn lines\n+\treturn buildComponentCfgLines([]*Component{card}, \"\")\n }\n \n-func mergeIntegratedMdas(defaults MDAS, env map[string]string) MDAS {\n+func mergeIntegratedMdas(defaults, overrides MDAS) MDAS {\n \tbySlot := map[int]string{}\n-\tfor _, mda := range defaults {\n+\tfor _, mda := range slices.Concat(defaults, overrides) {\n \t\tif mda.Slot > 0 && mda.Type != \"\" {\n \t\t\tbySlot[mda.Slot] = mda.Type\n \t\t}\n \t}\n \n-\tconst prefix = envNokiaSrosMDA + \"_\"\n-\tfor key, value := range env {\n-\t\tslotText, ok := strings.CutPrefix(key, prefix)\n-\t\tif !ok {\n-\t\t\tcontinue\n-\t\t}\n-\t\tslot, err := strconv.Atoi(slotText)\n-\t\tif err != nil || slot <= 0 {\n-\t\t\tcontinue\n-\t\t}\n-\t\tif value = strings.TrimSpace(value); value != \"\" {\n-\t\t\tbySlot[slot] = value\n-\t\t}\n-\t}\n-\n-\tslots := make([]int, 0, len(bySlot))\n-\tfor slot := range bySlot {\n-\t\tslots = append(slots, slot)\n-\t}\n-\tslices.Sort(slots)\n-\n+\tslots := slices.Sorted(maps.Keys(bySlot))\n \tmdas := make(MDAS, 0, len(slots))\n \tfor _, slot := range slots {\n \t\tmdas = append(mdas, MDA{Slot: slot, Type: bySlot[slot]})\n \t}\n \treturn mdas\n@@ -257,19 +244,150 @@ func integratedSrosAllowedSlots(nodeType string) []string {\n \t\treturn []string{slotAName}\n \t}\n \treturn component.allowedSlots\n }\n \n-func isSingleSlotIntegratedSrosNodeType(nodeType string) bool {\n-\tif !isIntegratedSrosNodeType(nodeType) {\n+func isRedundantIntegratedSrosComponents(nodeType string, components []*Component) bool {\n+\tif !isIntegratedSrosNodeType(nodeType) || len(components) < 2 {\n \t\treturn false\n \t}\n-\treturn len(integratedSrosAllowedSlots(nodeType)) == 1\n+\tfor _, c := range components {\n+\t\tif strings.TrimSpace(c.Slot) == \"\" || !integratedSrosSlotAllowed(nodeType, c.Slot) {\n+\t\t\treturn false\n+\t\t}\n+\t}\n+\treturn true\n }\n \n func integratedSrosSlotAllowed(nodeType, slot string) bool {\n \tslot = strings.ToUpper(strings.TrimSpace(slot))\n \tif slot == \"\" {\n \t\tslot = standaloneSlotName\n \t}\n \treturn slices.Contains(integratedSrosAllowedSlots(nodeType), slot)\n }\n+\n+func (n *sros) generateComponentConfig() string {\n+\tif !n.kindSpecificCfg().GenComponentConfig {\n+\t\treturn \"\"\n+\t}\n+\tif n.isConfigClassic() {\n+\t\treturn \"\"\n+\t}\n+\n+\tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n+\t\treturn n.generateIntegratedComponentConfig()\n+\t}\n+\n+\tcomponents := n.rootComponents\n+\tif len(components) == 0 {\n+\t\treturn \"\"\n+\t}\n+\n+\tfor _, c := range components {\n+\t\tslot := strings.ToUpper(strings.TrimSpace(c.Slot))\n+\t\tif slot == slotAName || slot == slotBName {\n+\t\t\tcontinue\n+\t\t}\n+\t\tif c.Type == \"\" {\n+\t\t\tlog.Warn(\n+\t\t\t\t\"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.\",\n+\t\t\t\t\"node\",\n+\t\t\t\tn.Cfg.ShortName,\n+\t\t\t\t\"slot\",\n+\t\t\t\tslot,\n+\t\t\t)\n+\t\t}\n+\t}\n+\n+\tlines := buildComponentCfgLines(n.componentsForConfig(components), n.componentSFM())\n+\treturn n.componentConfigFromLines(lines)\n+}\n+\n+// hardwareEnv is the topology env, which overrides component type, XIOM, and MDA.\n+// Nodes that have not been through Init expose that env on Cfg.Env.\n+func (n *sros) hardwareEnv() map[string]string {\n+\tif n.userEnv != nil {\n+\t\treturn n.userEnv\n+\t}\n+\treturn n.Cfg.Env\n+}\n+\n+// componentSFM is the SFM used in generated config. NOKIA_SROS_SFM overrides the sfm key.\n+func (n *sros) componentSFM() string {\n+\tif sfm := n.hardwareEnv()[envNokiaSrosSFM]; sfm != \"\" {\n+\t\treturn sfm\n+\t}\n+\treturn n.kindSpecificCfg().SFM\n+}\n+\n+// componentForConfig clones c and applies per-component env, then node env.\n+func (n *sros) componentForConfig(c *Component) *Component {\n+\tout := cloneComponent(c)\n+\tapplyHardwareEnv(out, out.Env)\n+\tapplyHardwareEnv(out, n.hardwareEnv())\n+\treturn out\n+}\n+\n+func (n *sros) componentsForConfig(components []*Component) []*Component {\n+\tout := make([]*Component, len(components))\n+\tfor i, c := range components {\n+\t\tout[i] = n.componentForConfig(c)\n+\t}\n+\treturn out\n+}\n+\n+func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {\n+\tpowerConfig := n.generatePowerConfig()\n+\tif len(lines) == 0 && powerConfig == \"\" {\n+\t\treturn \"\"\n+\t}\n+\n+\tvar config strings.Builder\n+\tfor _, l := range lines {\n+\t\tconfig.WriteString(l.String())\n+\t}\n+\tconfig.WriteString(powerConfig)\n+\treturn config.String()\n+}\n+\n+func (n *sros) generateIntegratedComponentConfig() string {\n+\tcard := strings.TrimSpace(n.Cfg.Env[envNokiaSrosCard])\n+\tif card != \"\" {\n+\t\tlog.Info(\n+\t\t\t\"Card type override set on integrated chassis type, skipping component SR OS config generation\",\n+\t\t\t\"node\",\n+\t\t\tn.Cfg.ShortName,\n+\t\t\t\"type\",\n+\t\t\tn.Cfg.NodeType,\n+\t\t\t\"card\",\n+\t\t\tcard,\n+\t\t)\n+\t\treturn \"\"\n+\t}\n+\n+\tlines := buildIntegratedComponentCfgLines(\n+\t\tn.Cfg.NodeType,\n+\t\tn.componentForConfig(n.integratedComponentOverride()),\n+\t)\n+\treturn n.componentConfigFromLines(lines)\n+}\n+\n+// integratedComponentOverride returns the component that overrides the integrated defaults:\n+// the single component of a standalone node, or the component matching the slot of a\n+// redundant CPM node.\n+func (n *sros) integratedComponentOverride() *Component {\n+\tif n.rootCtrName == \"\" {\n+\t\tif len(n.kindSpecificCfg().Components) == 1 {\n+\t\t\treturn n.kindSpecificCfg().Components[0]\n+\t\t}\n+\t\treturn nil\n+\t}\n+\n+\tslot := n.Cfg.Env[envNokiaSrosSlot]\n+\tfor _, c := range n.rootComponents {\n+\t\tif strings.EqualFold(strings.TrimSpace(c.Slot), slot) {\n+\t\t\treturn c\n+\t\t}\n+\t}\n+\treturn nil\n+}\ndiff --git a/nodes/sros/config.go b/nodes/sros/config.go\nindex b46ae42..8ddbb21 100644\n--- a/nodes/sros/config.go\n+++ b/nodes/sros/config.go\n@@ -1,8 +1,22 @@\n package sros\n \n-import \"golang.org/x/mod/semver\"\n+import (\n+\t\"bytes\"\n+\t\"context\"\n+\t\"fmt\"\n+\t\"io\"\n+\t\"os\"\n+\t\"path/filepath\"\n+\t\"strings\"\n+\n+\tclabutils \"github.com/srl-labs/containerlab/utils\"\n+\n+\t\"github.com/beevik/etree\"\n+\t\"github.com/charmbracelet/log\"\n+\t\"golang.org/x/mod/semver\"\n+)\n \n const (\n \tgrpcMDCLIConfig    = `/configure system grpc md-cli admin-state enable`\n \tprofileMDCLIConfig = `/configure system security aaa local-profiles profile \"administrative\" grpc rpc-authorization md-cli-session permit`\n \ttls13CipherCCM8    = `/configure system security tls server-cipher-list \"clab-all\" tls13-cipher 5 name tls-aes128-ccm8-sha256`\n@@ -18,5 +32,314 @@ func (n *sros) setVersionSpecificParams(tplData *srosTemplateData) {\n \t\tif tplData.IsSecureGrpc {\n \t\t\ttplData.GRPCConfig += \"\\n\" + tls13CipherCCM8\n \t\t}\n \t}\n }\n+\n+// buildPKIImportXML builds the NETCONF action XML that imports a PEM file into the PKI store.\n+func buildPKIImportXML(inputURL, outputFile, importType string) string {\n+\taction := etree.NewElement(\"action\")\n+\taction.CreateAttr(\"xmlns\", \"urn:ietf:params:xml:ns:yang:1\")\n+\n+\tadmin := action.CreateElement(\"admin\")\n+\tadmin.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:oper-admin\")\n+\n+\timportElem := admin.CreateElement(\"system\").\n+\t\tCreateElement(\"security\").\n+\t\tCreateElement(\"pki\").\n+\t\tCreateElement(\"import\")\n+\n+\t// Add import parameters\n+\timportElem.CreateElement(\"input-url\").SetText(inputURL)\n+\timportElem.CreateElement(\"output-file\").SetText(outputFile)\n+\timportElem.CreateElement(\"type\").SetText(importType)\n+\timportElem.CreateElement(\"format\").SetText(\"pem\")\n+\tvar buf bytes.Buffer\n+\taction.WriteTo(&buf, &etree.WriteSettings{\n+\t\tCanonicalText:    false,\n+\t\tCanonicalAttrVal: false,\n+\t})\n+\treturn buf.String()\n+}\n+\n+// buildTLSProfileXML builds the TLS profile configuration XML.\n+func buildTLSProfileXML() string {\n+\tconfig := etree.NewElement(\"config\")\n+\tconfigure := config.CreateElement(\"configure\")\n+\tconfigure.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:conf\")\n+\tconfigure.CreateAttr(\"xmlns:nc\", \"urn:ietf:params:xml:ns:netconf:base:1.0\")\n+\n+\tcertProfile := configure.CreateElement(\"system\").\n+\t\tCreateElement(\"security\").\n+\t\tCreateElement(\"tls\").\n+\t\tCreateElement(\"cert-profile\")\n+\n+\t// Set operation attribute\n+\tcertProfile.CreateAttr(\"nc:operation\", \"merge\")\n+\n+\t// Add profile configuration\n+\tcertProfile.CreateElement(\"cert-profile-name\").SetText(tlsCertProfileName)\n+\tcertProfile.CreateElement(\"admin-state\").SetText(\"enable\")\n+\n+\tvar buf bytes.Buffer\n+\tconfig.WriteTo(&buf, &etree.WriteSettings{\n+\t\tCanonicalText:    false,\n+\t\tCanonicalAttrVal: false,\n+\t})\n+\treturn buf.String()\n+}\n+\n+// createSROSConfigFiles handles config generation for the SR-SIM kind.\n+// Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).\n+func (n *sros) createSROSConfigFiles() error {\n+\t// Get version from image before generating config\n+\tif n.swVersion == nil {\n+\t\tctx := context.Background()\n+\t\tversion, err := n.srosVersionFromImage(ctx)\n+\t\tif err != nil {\n+\t\t\tn.swVersion = n.parseVersionString(srosDefaultVersion)\n+\t\t\tlog.Warn(\"Failed to get SR OS version from image\",\n+\t\t\t\t\"node\", n.Cfg.ShortName, \"version\", n.swVersion, \"error\", err)\n+\t\t} else {\n+\t\t\tn.swVersion = version\n+\t\t\tlog.Info(\"Retrieved SR OS version from image\",\n+\t\t\t\t\"node\", n.Cfg.ShortName,\n+\t\t\t\t\"version\", fmt.Sprintf(\"%s.%s.%s\", version.Major, version.Minor, version.Build))\n+\t\t}\n+\t}\n+\n+\t// Path pointing to the target config file under configCf3 dir\n+\tcf3CfgFile := filepath.Join(\n+\t\tn.Cfg.LabDir,\n+\t\tn.Cfg.Env[envNokiaSrosSlot],\n+\t\tconfigCf3,\n+\t\tstartupCfgName,\n+\t)\n+\tisPartial := clabutils.IsPartialConfigFile(n.Cfg.StartupConfig)\n+\n+\t// generate config and use that to boot node\n+\tlog.Debug(\"Reading startup-config\", \"node\", n.Cfg.ShortName, \"startup-config\",\n+\t\tn.Cfg.StartupConfig, \"isPartial\", isPartial)\n+\n+\tstartupConfig, err := n.buildStartupConfig(isPartial)\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\tif startupConfig == \"\" {\n+\t\tlog.Debug(\n+\t\t\t\"startup config is empty, skipping startup config file generation\",\n+\t\t\t\"node\",\n+\t\t\tn.Cfg.ShortName,\n+\t\t)\n+\t\treturn nil\n+\t}\n+\n+\treturn n.GenerateConfig(cf3CfgFile, startupConfig)\n+}\n+\n+// buildStartupConfig returns the full startup config string: either from user file (full config)\n+// or from default + partial config generation. It does not return a template; the name is\n+// historical.\n+func (n *sros) buildStartupConfig(isPartial bool) (string, error) {\n+\t// User provides full startup config\n+\tif n.Cfg.StartupConfig != \"\" && !isPartial {\n+\t\tc, err := os.ReadFile(n.Cfg.StartupConfig)\n+\t\tif err != nil {\n+\t\t\treturn \"\", err\n+\t\t}\n+\n+\t\tcBuf, err := clabutils.SubstituteEnvsAndTemplate(bytes.NewReader(c), n.Cfg)\n+\t\tif err != nil {\n+\t\t\treturn \"\", err\n+\t\t}\n+\t\treturn cBuf.String(), nil\n+\t}\n+\n+\t// Generate default config and optionally add partial config\n+\tif err := n.addDefaultConfig(); err != nil {\n+\t\treturn \"\", err\n+\t}\n+\tif err := n.addPartialConfig(); err != nil {\n+\t\treturn \"\", err\n+\t}\n+\n+\treturn string(n.startupCliCfg), nil\n+}\n+\n+// prepareConfigTemplateData prepares all data needed for template selection and execution.\n+// Service configs are filled from a single table-driven result: variant → getFullSnippetSet(v).\n+func (n *sros) prepareConfigTemplateData() (*srosTemplateData, error) {\n+\tb, err := n.banner()\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\tcomponentConfig := \"\"\n+\tif !isFullConfigFile(n.Cfg.StartupConfig) {\n+\t\tcomponentConfig = n.generateComponentConfig()\n+\t} else {\n+\t\tlog.Debugf(\n+\t\t\t\"SR-SIM node %q has non-partial startup-config defined, skipping component config gen\",\n+\t\t\tn.Cfg.LongName,\n+\t\t)\n+\t}\n+\n+\tv := n.resolveConfigVariant()\n+\tsnippets := getFullSnippetSet(v)\n+\tconfigMode := string(v.Mode)\n+\tif v.ForceClassic {\n+\t\tlog.Warn(\n+\t\t\t\"SAR-Hm nodes only support classic configuration mode. Overriding configuration mode to 'classic'\",\n+\t\t\t\"node\",\n+\t\t\tn.Cfg.LongName,\n+\t\t\t\"node-type\",\n+\t\t\tstrings.ToLower(n.Cfg.NodeType),\n+\t\t)\n+\t\tconfigMode = string(ConfigModeClassic)\n+\t\tn.kindSpecificCfg().ConfigMode = ConfigModeClassic\n+\t}\n+\n+\ttplData := &srosTemplateData{\n+\t\t// Selection criteria\n+\t\tNodeType:          strings.ToLower(n.Cfg.NodeType),\n+\t\tConfigurationMode: configMode,\n+\t\tSwVersion:         n.swVersion,\n+\t\tIsSecureGrpc:      *n.Cfg.Certificate.Issue,\n+\n+\t\t// Node data\n+\t\tName:            n.Cfg.ShortName,\n+\t\tTLSKey:          n.Cfg.TLSKey,\n+\t\tTLSCert:         n.Cfg.TLSCert,\n+\t\tTLSAnchor:       n.Cfg.TLSAnchor,\n+\t\tBanner:          b,\n+\t\tIFaces:          map[string]tplIFace{},\n+\t\tMgmtMTU:         0,\n+\t\tMgmtIPMTU:       n.Runtime.Mgmt().MTU,\n+\t\tComponentConfig: componentConfig,\n+\n+\t\t// Service configs from variant (single source of truth)\n+\t\tSystemConfig:  snippets.SystemConfig,\n+\t\tGRPCConfig:    snippets.GRPCConfig,\n+\t\tSNMPConfig:    snippets.SNMPConfig,\n+\t\tNetconfConfig: snippets.NetconfConfig,\n+\t\tLoggingConfig: snippets.LoggingConfig,\n+\t\tSSHConfig:     snippets.SSHConfig,\n+\t}\n+\n+\tif n.Config().DNS != nil {\n+\t\ttplData.DNSServers = append(tplData.DNSServers, n.Config().DNS.Servers...)\n+\t}\n+\n+\tn.prepareSSHPubKeys(tplData)\n+\n+\tn.setVersionSpecificParams(tplData)\n+\n+\treturn tplData, nil\n+}\n+\n+// addDefaultConfig adds sros default configuration such as tls certs, gnmi/json-rpc, login-banner,\n+// ssh keys.\n+func (n *sros) addDefaultConfig() error {\n+\t// Prepare all template data\n+\ttplData, err := n.prepareConfigTemplateData()\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\t// Select appropriate template\n+\tsrosCfgTpl, err := n.selectConfigTemplate(tplData)\n+\tif err != nil {\n+\t\treturn fmt.Errorf(\"failed to select config template: %w\", err)\n+\t}\n+\tlog.Debug(\"Prepare SR OS config template\", \"template\", srosCfgTpl.Name(),\n+\t\t\"node\", n.Cfg.LongName,\n+\t\t\"configuration-mode\", tplData.ConfigurationMode,\n+\t\t\"node-type\", tplData.NodeType,\n+\t\t\"secure-grpc\", tplData.IsSecureGrpc,\n+\t\t\"sw-version\", tplData.SwVersion)\n+\n+\t// Execute template\n+\tbuf := new(bytes.Buffer)\n+\terr = srosCfgTpl.Execute(buf, tplData)\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\tif buf.Len() == 0 {\n+\t\tlog.Warn(\n+\t\t\t\"Buffer empty, template parsing error\",\n+\t\t\t\"node\", n.Cfg.ShortName,\n+\t\t\t\"template\", srosCfgTpl.Name(),\n+\t\t)\n+\t} else {\n+\t\tlog.Debug(\"Additional default config parsed\",\n+\t\t\t\"node\", n.Cfg.ShortName,\n+\t\t\t\"template\", srosCfgTpl.Name())\n+\t\tn.startupCliCfg = append(n.startupCliCfg, buf.String()...)\n+\t}\n+\n+\treturn nil\n+}\n+\n+// applyPartialConfig applies partial configuration to the SR OS.\n+func (n *sros) addPartialConfig() error {\n+\tif n.Cfg.StartupConfig != \"\" {\n+\t\t// b holds the configuration to be applied to the node\n+\t\tb := &bytes.Buffer{}\n+\t\t// apply partial configs if partial config is used\n+\t\tif clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM(\"\") {\n+\t\t\tlog.Info(\"Adding configuration\",\n+\t\t\t\t\"node\", n.Cfg.LongName,\n+\t\t\t\t\"type\", \"partial\",\n+\t\t\t\t\"source\", n.Cfg.StartupConfig)\n+\n+\t\t\tr, err := os.Open(n.Cfg.StartupConfig)\n+\t\t\tif err != nil {\n+\t\t\t\treturn err\n+\t\t\t}\n+\n+\t\t\tdefer r.Close() // skipcq: GO-S2307\n+\n+\t\t\t_, err = io.Copy(b, r)\n+\t\t\tif err != nil {\n+\t\t\t\treturn err\n+\t\t\t}\n+\n+\t\t\tconfigContent, err := clabutils.SubstituteEnvsAndTemplate(b, n.Cfg)\n+\t\t\tif err != nil {\n+\t\t\t\treturn err\n+\t\t\t}\n+\t\t\tif configContent.Len() == 0 {\n+\t\t\t\tlog.Warn(\n+\t\t\t\t\t\"Buffer empty, PARTIAL config template parsing error\",\n+\t\t\t\t\t\"node\",\n+\t\t\t\t\tn.Cfg.ShortName,\n+\t\t\t\t)\n+\t\t\t} else {\n+\t\t\t\tlog.Debug(\"Additional PARTIAL config parsed\", \"node\",\n+\t\t\t\t\tn.Cfg.ShortName, \"partial-config\", configContent.String())\n+\t\t\t\tn.startupCliCfg = append(n.startupCliCfg, configContent.String()...)\n+\t\t\t}\n+\t\t} else {\n+\t\t\tlog.Warn(\n+\t\t\t\t\"Passed startup-config option, but it will not have any effect\",\n+\t\t\t\t\"node\",\n+\t\t\t\tn.Cfg.ShortName,\n+\t\t\t)\n+\t\t}\n+\t}\n+\treturn nil\n+}\n+\n+// isConfigClassic reports whether the node is in classic or mixed configuration mode.\n+func (n *sros) isConfigClassic() bool {\n+\tmode := n.kindSpecificCfg().ConfigMode\n+\treturn mode == ConfigModeClassic || mode == ConfigModeMixed\n+}\n+\n+// isFullConfigFile returns true if the config file doesn't contain .partial substring\n+// and the config file is NOT nil (ie. startup config IS defined).\n+// it is intended that the 'c' arg is n.Cfg.StartupConfig.\n+func isFullConfigFile(c string) bool {\n+\treturn c != \"\" && !clabutils.IsPartialConfigFile(c)\n+}\ndiff --git a/nodes/sros/netns.go b/nodes/sros/netns.go\nindex dbd9af7..e7ec511 100644\n--- a/nodes/sros/netns.go\n+++ b/nodes/sros/netns.go\n@@ -1,14 +1,20 @@\n package sros\n \n import (\n+\t\"context\"\n+\t\"errors\"\n \t\"fmt\"\n \t\"maps\"\n \n+\tclabutils \"github.com/srl-labs/containerlab/utils\"\n+\n \tclabconstants \"github.com/srl-labs/containerlab/constants\"\n \tclabnodes \"github.com/srl-labs/containerlab/nodes\"\n+\tclabruntime \"github.com/srl-labs/containerlab/runtime\"\n \tclabtypes \"github.com/srl-labs/containerlab/types\"\n+\t\"github.com/vishvananda/netns\"\n )\n \n // namespaceNode owns the shared network namespace of a components-based SR-SIM node.\n type namespaceNode struct {\n \tclabnodes.DefaultNode\n@@ -81,5 +87,71 @@ func (n *sros) newNetnsConfig() *clabtypes.NodeConfig {\n \t\tLabels:                labels,\n \t\tRuntime:               n.Cfg.Runtime,\n \t\tResultingPortBindings: n.Cfg.ResultingPortBindings,\n \t}\n }\n+\n+func (n *sros) ensureNetnsRunning(ctx context.Context) error {\n+\tswitch status := n.netnsNode.GetContainerStatus(ctx); status {\n+\tcase clabruntime.Running:\n+\t\t// The namespace holder intentionally survives regular node lifecycle operations.\n+\tcase clabruntime.Created, clabruntime.Stopped:\n+\t\tif err := n.netnsNode.Start(ctx); err != nil {\n+\t\t\treturn fmt.Errorf(\"node %q network namespace container start error: %w\",\n+\t\t\t\tn.Cfg.ShortName, err)\n+\t\t}\n+\tcase clabruntime.Paused:\n+\t\tif err := n.Runtime.UnpauseContainer(ctx, n.netnsNode.Config().LongName); err != nil {\n+\t\t\treturn fmt.Errorf(\"node %q network namespace container unpause error: %w\",\n+\t\t\t\tn.Cfg.ShortName, err)\n+\t\t}\n+\tcase clabruntime.NotFound:\n+\t\treturn fmt.Errorf(\n+\t\t\t\"node %q network namespace container %q not found; recreate the node\",\n+\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName,\n+\t\t)\n+\tdefault:\n+\t\treturn fmt.Errorf(\"node %q network namespace container %q is %s\",\n+\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName, status)\n+\t}\n+\n+\treturn nil\n+}\n+\n+func (n *sros) cleanupParkingNetNS() error {\n+\tname := clabutils.ParkingNetnsName(n.Cfg.LongName)\n+\tif _, err := clabutils.GetNamedNetNS(name); err != nil {\n+\t\treturn nil\n+\t}\n+\n+\treturn netns.DeleteNamed(name)\n+}\n+\n+// GetNSPath retrieves the Namespace Path.\n+func (n *sros) GetNSPath(ctx context.Context) (string, error) {\n+\tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == \"\") {\n+\t\treturn n.DefaultNode.GetNSPath(ctx)\n+\t} else if n.isDistributedCardNode() {\n+\t\treturn n.Runtime.GetNSPath(ctx, n.rootCtrName)\n+\t}\n+\treturn n.netnsNode.GetNSPath(ctx)\n+}\n+\n+// DeleteNetnsSymlink deletes the symlink file created for the container netns.\n+func (n *sros) DeleteNetnsSymlink() error {\n+\tvar errs []error\n+\n+\t// if it is the base node, then we need to delete the symlink for all the components.\n+\tif n.isDistributedBaseNode() {\n+\t\tfor _, componentNode := range n.componentNodes {\n+\t\t\terrs = append(errs, componentNode.DeleteNetnsSymlink())\n+\t\t}\n+\t\tif n.netnsNode != nil {\n+\t\t\terrs = append(errs, n.netnsNode.DeleteNetnsSymlink())\n+\t\t}\n+\t\terrs = append(errs, clabutils.DeleteNetnsSymlink(n.Cfg.LongName))\n+\t}\n+\n+\terrs = append(errs, n.DefaultNode.DeleteNetnsSymlink(), n.cleanupParkingNetNS())\n+\n+\treturn errors.Join(errs...)\n+}\ndiff --git a/nodes/sros/power.go b/nodes/sros/power.go\nindex 7ab11bd..07509f3 100644\n--- a/nodes/sros/power.go\n+++ b/nodes/sros/power.go\n@@ -3,10 +3,15 @@ package sros\n import (\n \t\"fmt\"\n \t\"strings\"\n )\n \n+const (\n+\tdefaultSrosPowerType       = \"dc\"\n+\tdefaultSrosPowerModuleType = \"ps-a-dc-6000\"\n+)\n+\n // SrosPower defines power supply configuration for a given node type.\n type SrosPower struct {\n \tModules any\n \tShelves int\n }\ndiff --git a/nodes/sros/sros.go b/nodes/sros/sros.go\nindex 1eac470..20ae973 100644\n--- a/nodes/sros/sros.go\n+++ b/nodes/sros/sros.go\n@@ -6,11 +6,10 @@ package sros\n \n import (\n \t\"bufio\"\n \t\"bytes\"\n \t\"context\"\n-\t_ \"embed\"\n \t\"errors\"\n \t\"fmt\"\n \t\"io\"\n \t\"maps\"\n \t\"net\"\n@@ -20,19 +19,16 @@ import (\n \t\"reflect\"\n \t\"regexp\"\n \t\"slices\"\n \t\"strconv\"\n \t\"strings\"\n-\t\"text/template\"\n \t\"time\"\n \n-\t\"github.com/beevik/etree\"",
        "lineStart": 1,
        "lineEnd": 1613,
        "totalLines": 1614,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346531716,
      "end": 1792346531735
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502da79e001a1UpMZKgOychs8",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502d9e6b001O6WVSMYXb5D2sX",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 24762,
    "input": 24727,
    "output": 13,
    "reasoning": 22,
    "cache": {
      "read": 0,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502d9e6b001O6WVSMYXb5D2sX",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346529387,
    "completed": 1792346531748
  },
  "parentID": "msg_1502d8a66001F2b7xDf6faLOHN",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 24762,
    "input": 24727,
    "output": 13,
    "reasoning": 22,
    "cache": {
      "read": 0,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 5
step-start
{
  "type": "step-start",
  "id": "prt_1502db242001i8SaIwZ2tYjtNn",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502da7a9001g13xnqsXX4pQRr"
}
Reasoning
The diff is large. Let me continue reading from line 1614.
read · completed

Input

{
  "filePath": "/source/diff.txt",
  "offset": 1614
}

Output

<path>/source/diff.txt</path>
<type>file</type>
<content>
1614:  	"github.com/brunoga/deep"
1615:  	"github.com/charmbracelet/log"
1616:  	"github.com/scrapli/scrapligo/driver/netconf"
1617:  	"github.com/scrapli/scrapligo/driver/opoptions"
1618: -	"github.com/vishvananda/netns"
1619:  
1620:  	"github.com/scrapli/scrapligo/response"
1621:  
1622:  	clabconstants "github.com/srl-labs/containerlab/constants"
1623:  	clabexec "github.com/srl-labs/containerlab/exec"
1624: @@ -82,32 +78,16 @@ const (
1625:  	envNokiaSrosMDA           = "NOKIA_SROS_MDA"
1626:  	envSrosIPv4Active         = "NOKIA_SROS_ADDRESS_IPV4_ACTIVE"
1627:  	envSrosIPv6Active         = "NOKIA_SROS_ADDRESS_IPV6_ACTIVE"
1628:  	envSrosStaticRoutePrefix  = "NOKIA_SROS_STATIC_ROUTE_"
1629:  
1630: -	defaultSrosPowerType       = "dc"
1631: -	defaultSrosPowerModuleType = "ps-a-dc-6000"
1632: -
1633:  	srosMinorError     = "MINOR:"
1634:  	srosCriticalError  = "CRITICAL:"
1635:  	srosRejectedCfgMsg = "Configuration load failed - using default configuration"
1636:  )
1637:  
1638:  var (
1639: -
1640: -	//go:embed configs/sros_config_sros25.go.tpl
1641: -	cfgTplSROS25 string
1642: -
1643: -	//go:embed configs/sros_config_classic.go.tpl
1644: -	cfgTplClassic string
1645: -
1646: -	//go:embed configs/ixr/ixr_config_classic.go.tpl
1647: -	cfgTplClassicIxr string
1648: -
1649: -	//go:embed configs/sar/sar_config_classic.go.tpl
1650: -	cfgTplClassicSar string
1651: -
1652:  	kindNames  = []string{"nokia_srsim"}
1653:  	srosSysctl = map[string]string{
1654:  		"net.ipv4.ip_forward":                "0",
1655:  		"net.ipv6.conf.all.disable_ipv6":     "0",
1656:  		"net.ipv6.conf.default.disable_ipv6": "0",
1657: @@ -160,15 +140,10 @@ var (
1658:        e1-2-3       -> card 1, mda 2, port 3
1659:        e1-2-c3-4    -> card 1, mda 2, connector 3, port 4
1660:        e1-x2-3-4    -> card 1, xiom 2, mda 3, port 4
1661:        e1-x2-3-c4-5 -> card 1, xiom 2, mda 3, connector 4, port 5
1662:  	  eth[0-9], for management interfaces of CPM-A/CPM-B or for fabric interfaces`
1663: -	// Auxiliary regexps for IXR/SAR detection.
1664: -	sarRegexp   = regexp.MustCompile(`(?i)\bsar-`)
1665: -	sarHmRegexp = regexp.MustCompile(`(?i)\b(sar-hm|sar-hmc)\b`)
1666: -
1667: -	ixrRegexp = regexp.MustCompile(`(?i)\bixr-`)
1668:  )
1669:  
1670:  // Register registers the node in the NodeRegistry.
1671:  func Register(r *clabnodes.NodeRegistry) {
1672:  	generateNodeAttributes := clabnodes.NewGenerateNodeAttributes(generateable, generateIfFormat)
1673: @@ -241,10 +216,14 @@ type sros struct {
1674:  	// rootCtrName is the container that owns the netns.
1675:  	//  - for components based: the internal netns container.
1676:  	//  - for network mode based: parsed from network-mode.
1677:  	rootCtrName string
1678:  
1679: +	// userEnv is the env map from the topology, before component fields are merged in.
1680: +	// Node env overrides component type, XIOM, MDA, SFM, and per-component env.
1681: +	userEnv map[string]string
1682: +
1683:  	preDeployParams *clabnodes.PreDeployParams
1684:  
1685:  	netnsNode clabnodes.Node
1686:  }
1687:  
1688: @@ -279,16 +258,44 @@ func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) err
1689:  	// if user was not initialized to a value, use root
1690:  	if n.Cfg.User == "" {
1691:  		n.Cfg.User = "0:0"
1692:  	}
1693:  
1694: -	if sfm := n.kindSpecificCfg().SFM; sfm != "" {
1695: +	// Snapshot topology env before component and SFM flags are applied.
1696: +	// Component nodes set userEnv from the base node before Init.
1697: +	envAlreadyResolved := n.userEnv != nil
1698: +	if !envAlreadyResolved {
1699:  		if n.Cfg.Env == nil {
1700: -			n.Cfg.Env = map[string]string{}
1701: +			n.userEnv = map[string]string{}
1702: +		} else {
1703: +			n.userEnv = maps.Clone(n.Cfg.Env)
1704:  		}
1705: +	}
1706: +	if n.Cfg.Env == nil {
1707: +		n.Cfg.Env = map[string]string{}
1708: +	}
1709:  
1710: -		n.Cfg.Env[envNokiaSrosSFM] = sfm
1711: +	// Distributed cards inherit SFM from the base node env. Applying it again
1712: +	// would warn once per card when the user also set NOKIA_SROS_SFM.
1713: +	if sfm := n.kindSpecificCfg().SFM; sfm != "" && !envAlreadyResolved {
1714: +		if envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {
1715: +			if envSFM != sfm {
1716: +				log.Warn(
1717: +					fmt.Sprintf(
1718: +						"component value %q will not be used because environment variable %s is set",
1719: +						sfm,
1720: +						envNokiaSrosSFM,
1721: +					),
1722: +					"node", n.Cfg.ShortName,
1723: +					"env", envNokiaSrosSFM,
1724: +					"component-value", sfm,
1725: +					"env-value", envSFM,
1726: +				)
1727: +			}
1728: +		} else {
1729: +			n.Cfg.Env[envNokiaSrosSFM] = sfm
1730: +		}
1731:  	}
1732:  
1733:  	maps.Copy(n.Cfg.Sysctls, srosSysctl)
1734:  
1735:  	// make sure we always have uppercase slot definition
1736: @@ -316,10 +323,11 @@ func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) err
1737:  
1738:  		vars, err := n.setupStandaloneComponents()
1739:  		if err != nil {
1740:  			return err
1741:  		}
1742: +		warnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)
1743:  
1744:  		// n.Cfg.Env overrides component vars, overrides default srosEnv
1745:  		n.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)
1746:  		log.Debug("Merged env file", "env", fmt.Sprintf("%+v", n.Cfg.Env), "node", n.Cfg.ShortName)
1747:  	} else {
1748: @@ -348,12 +356,15 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {
1749:  	if len(n.kindSpecificCfg().Components) == 0 {
1750:  		return nil, nil
1751:  	}
1752:  	if len(n.kindSpecificCfg().Components) > 1 {
1753:  		return nil, fmt.Errorf(
1754: -			"expected at most one component override for standalone SR-SIM node %q",
1755: +			"expected at most one component override for standalone SR-SIM node %q, "+
1756: +				"or one component per slot %s for redundant type %q",
1757:  			n.Cfg.ShortName,
1758: +			strings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), "/"),
1759: +			n.Cfg.NodeType,
1760:  		)
1761:  	}
1762:  
1763:  	slotA := n.kindSpecificCfg().Components[0]
1764:  
1765: @@ -370,27 +381,11 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {
1766:  			n.Cfg.ShortName,
1767:  		)
1768:  	}
1769:  	vars[envNokiaSrosSlot] = slotName
1770:  
1771: -	if slotA.Type != "" {
1772: -		if isSingleSlotIntegratedSrosNodeType(n.Cfg.NodeType) {
1773: -			return nil, fmt.Errorf(
1774: -				"node %q type %q is integrated and does not support component card-type override",
1775: -				n.Cfg.ShortName,
1776: -				n.Cfg.NodeType,
1777: -			)
1778: -		}
1779: -		vars[envNokiaSrosCard] = slotA.Type
1780: -	}
1781: -
1782: -	if len(slotA.MDA) > 0 {
1783: -		for _, m := range slotA.MDA {
1784: -			key := fmt.Sprintf("%s_%d", envNokiaSrosMDA, m.Slot)
1785: -			vars[key] = m.Type
1786: -		}
1787: -	}
1788: +	setComponentEnvVars(vars, slotA)
1789:  
1790:  	maps.Copy(vars, slotA.Env)
1791:  
1792:  	return vars, nil
1793:  }
1794: @@ -625,39 +620,10 @@ func (n *sros) Delete(ctx context.Context) error {
1795:  	errs = append(errs, n.DefaultNode.Delete(ctx), n.netnsNode.Delete(ctx))
1796:  
1797:  	return errors.Join(errs...)
1798:  }
1799:  
1800: -// DeleteNetnsSymlink deletes the symlink file created for the container netns.
1801: -func (n *sros) DeleteNetnsSymlink() error {
1802: -	var errs []error
1803: -
1804: -	// if it is the base node, then we need to delete the symlink for all the components.
1805: -	if n.isDistributedBaseNode() {
1806: -		for _, componentNode := range n.componentNodes {
1807: -			errs = append(errs, componentNode.DeleteNetnsSymlink())
1808: -		}
1809: -		if n.netnsNode != nil {
1810: -			errs = append(errs, n.netnsNode.DeleteNetnsSymlink())
1811: -		}
1812: -		errs = append(errs, clabutils.DeleteNetnsSymlink(n.Cfg.LongName))
1813: -	}
1814: -
1815: -	errs = append(errs, n.DefaultNode.DeleteNetnsSymlink(), n.cleanupParkingNetNS())
1816: -
1817: -	return errors.Join(errs...)
1818: -}
1819: -
1820: -func (n *sros) cleanupParkingNetNS() error {
1821: -	name := clabutils.ParkingNetnsName(n.Cfg.LongName)
1822: -	if _, err := clabutils.GetNamedNetNS(name); err != nil {
1823: -		return nil
1824: -	}
1825: -
1826: -	return netns.DeleteNamed(name)
1827: -}
1828: -
1829:  func (n *sros) setupComponentNodes() error {
1830:  	if !n.isDistributedBaseNode() {
1831:  		return nil
1832:  	}
1833:  
1834: @@ -693,17 +659,16 @@ func (n *sros) setupComponentNodes() error {
1835:  		componentConfig.Fqdn = n.calcComponentFqdn(c.Slot)
1836:  		componentConfig.DNS = nil
1837:  		componentConfig.PortBindings = nil
1838:  		componentConfig.PortSet = nil
1839:  
1840: -		// add the component env to the componentConfig env
1841: -		for k, v := range c.Env {
1842: -			componentConfig.Env[k] = v
1843: +		// Component fields fill env keys the user did not set. Node env wins.
1844: +		if componentConfig.Env == nil {
1845: +			componentConfig.Env = map[string]string{}
1846:  		}
1847: -
1848: -		// set component environment variables
1849: -		n.setComponentEnvVars(componentConfig, c)
1850: +		keepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)
1851: +		// Slot identifies this container. A node-level NOKIA_SROS_SLOT cannot apply to every card.
1852:  		componentConfig.Env[envNokiaSrosSlot] = c.Slot
1853:  
1854:  		// adjust label based env vars
1855:  		componentConfig.Env["CLAB_LABEL_"+clabutils.ToEnvKey(clabconstants.NodeName)] = componentConfig.ShortName
1856:  		componentConfig.Env["CLAB_LABEL_"+clabutils.ToEnvKey(clabconstants.LongName)] = componentConfig.LongName
1857: @@ -716,10 +681,14 @@ func (n *sros) setupComponentNodes() error {
1858:  		componentConfig.Labels[clabconstants.NodeName] = componentConfig.ShortName
1859:  		componentConfig.Labels[clabconstants.LongName] = componentConfig.LongName
1860:  		componentConfig.Labels[clabconstants.RootNodeName] = n.Cfg.ShortName
1861:  		componentConfig.Labels[clabconstants.RootNodeLongName] = n.Cfg.LongName
1862:  
1863: +		// Preserve the topology env. Init must not snapshot the merged component env,
1864: +		// or config generation would treat component flags as user overrides.
1865: +		srosNode.userEnv = maps.Clone(n.userEnv)
1866: +
1867:  		// init the component
1868:  		err = componentNode.Init(componentConfig)
1869:  		if err != nil {
1870:  			return err
1871:  		}
1872: @@ -737,32 +706,10 @@ func (n *sros) setupComponentNodes() error {
1873:  		n.componentNodes = append(n.componentNodes, componentNode)
1874:  	}
1875:  	return nil
1876:  }
1877:  
1878: -// setComponentEnvVars sets environment variables for a component.
1879: -func (n *sros) setComponentEnvVars(componentConfig *clabtypes.NodeConfig, c *Component) {
1880: -	if c.Type != "" {
1881: -		componentConfig.Env[envNokiaSrosCard] = c.Type
1882: -	}
1883: -
1884: -	for _, x := range c.XIOM {
1885: -		key := fmt.Sprintf("%s_X%d", envNokiaSrosXIOM, x.Slot)
1886: -		componentConfig.Env[key] = x.Type
1887: -		// add the nested MDA
1888: -		for _, m := range x.MDA {
1889: -			key := fmt.Sprintf("%s_X%d_%d", envNokiaSrosMDA, x.Slot, m.Slot)
1890: -			componentConfig.Env[key] = m.Type
1891: -		}
1892: -	}
1893: -
1894: -	for _, m := range c.MDA {
1895: -		key := fmt.Sprintf("%s_%d", envNokiaSrosMDA, m.Slot)
1896: -		componentConfig.Env[key] = m.Type
1897: -	}
1898: -}
1899: -
1900:  // deployFabric deploys the distributed SR-SIM when the `components` key is present.
1901:  func (n *sros) deployFabric(ctx context.Context, deployParams *clabnodes.DeployParams) error {
1902:  	netnsConfig := n.netnsNode.Config()
1903:  
1904:  	netnsConfig.MgmtIPv4Address = n.Cfg.MgmtIPv4Address
1905: @@ -870,30 +817,20 @@ func (n *sros) isDistributedCardNode() bool {
1906:  
1907:  // isDistributedBaseNode returns true if this is the base node of a distributed
1908:  // SR-SIM deployment. The base node orchestrates multiple component nodes.
1909:  func (n *sros) isDistributedBaseNode() bool {
1910:  	if isIntegratedSrosNodeType(n.Cfg.NodeType) {
1911: -		return false
1912: +		return isRedundantIntegratedSrosComponents(n.Cfg.NodeType, n.kindSpecificCfg().Components)
1913:  	}
1914:  	return len(n.kindSpecificCfg().Components) > 1
1915:  }
1916:  
1917:  // isStandaloneNode returns true if this is a standalone (non-distributed) SR-SIM node.
1918:  func (n *sros) isStandaloneNode() bool {
1919:  	return !n.isDistributedBaseNode() && !n.isDistributedCardNode()
1920:  }
1921:  
1922: -// GetNSPath retrieves the Namespace Path.
1923: -func (n *sros) GetNSPath(ctx context.Context) (string, error) {
1924: -	if n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == "") {
1925: -		return n.DefaultNode.GetNSPath(ctx)
1926: -	} else if n.isDistributedCardNode() {
1927: -		return n.Runtime.GetNSPath(ctx, n.rootCtrName)
1928: -	}
1929: -	return n.netnsNode.GetNSPath(ctx)
1930: -}
1931: -
1932:  // calcComponentName appends the line card suffix to the given node name.
1933:  func (n *sros) calcComponentName(name, slot string) string {
1934:  	if n.renameDone {
1935:  		return name
1936:  	}
1937: @@ -934,19 +871,18 @@ func (n *sros) cpmNode() (clabnodes.Node, error) {
1938:  }
1939:  
1940:  // cpmSlot returns the Slot of the preferred CPM Node (used when Distributed mode).
1941:  // It prefers slot A if present, otherwise returns slot B.
1942:  func (n *sros) cpmSlot() (string, error) {
1943: -	// Prefer slot A, fall back to slot B
1944: +	// Prefer slot A, fall back to slot B. Slots are accepted in either case.
1945:  	for _, comp := range n.kindSpecificCfg().Components {
1946: -		if comp.Slot == slotAName {
1947: +		if strings.EqualFold(comp.Slot, slotAName) {
1948:  			return slotAName, nil
1949:  		}
1950:  	}
1951: -	// Check for slot B as fallback
1952:  	for _, comp := range n.kindSpecificCfg().Components {
1953: -		if comp.Slot == slotBName {
1954: +		if strings.EqualFold(comp.Slot, slotBName) {
1955:  			return slotBName, nil
1956:  		}
1957:  	}
1958:  	return "", fmt.Errorf("node %s: unable to determine default slot", n.GetShortName())
1959:  }
1960: @@ -1041,33 +977,10 @@ func (*sros) checkKernelVersion() error {
1961:  		)
1962:  	}
1963:  	return nil
1964:  }
1965:  
1966: -// checkComponentSlotsConfig check the sros component slot config for validity.
1967: -func (n *sros) checkComponentSlotsConfig() error {
1968: -	// check Slots are unique
1969: -	componentNames := map[string]struct{}{}
1970: -	for _, component := range n.kindSpecificCfg().Components {
1971: -		// convert slot to upper
1972: -		slot := strings.ToUpper(component.Slot)
1973: -		// check if slot exists
1974: -		_, exists := componentNames[slot]
1975: -		if exists {
1976: -			return fmt.Errorf(
1977: -				"node %s slot %s duplicate definition",
1978: -				n.GetShortName(),
1979: -				component.Slot,
1980: -			)
1981: -		}
1982: -		// add to component names map
1983: -		componentNames[component.Slot] = struct{}{}
1984: -
1985: -	}
1986: -	return nil
1987: -}
1988: -
1989:  func (n *sros) CheckDeploymentConditions(ctx context.Context) error {
1990:  	// perform the sros specific kernel version check
1991:  	err := n.checkKernelVersion()
1992:  	if err != nil {
1993:  		return err
1994: @@ -1148,13 +1061,53 @@ func (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {
1995:  	licensed := append([]byte(chassisInfoFileLicense), content...)
1996:  	if err := os.WriteFile(dstPath, licensed, clabconstants.PermissionsFileDefault); err != nil {
1997:  		return fmt.Errorf("write %s: %w", dstPath, err)
1998:  	}
1999:  	log.Debug("Wrote chassis_info.json to lab dir", "node", n.Cfg.ShortName, "path", dstPath)
2000: +	n.warnUnsupportedComponents(content)
2001:  	return nil
2002:  }
2003:  
2004: +// warnUnsupportedComponents validates the effective component configuration against the
2005: +// chassis_info.json extracted from this exact image. Validation is advisory and never blocks
2006: +// deploy.
2007: +func (n *sros) warnUnsupportedComponents(content []byte) {
2008: +	// A distributed node validates once, from CPM A, to avoid duplicate warnings from CPM B.
2009: +	if !n.isStandaloneNode() && !n.isCPM(slotAName) {
2010: +		return
2011: +	}
2012: +
2013: +	info, err := parseChassisInfo(content)
2014: +	if err != nil {
2015: +		log.Warn("Could not validate SR-SIM components against chassis_info.json",
2016: +			"node", n.Cfg.ShortName, "error", err)
2017: +		return
2018: +	}
2019: +
2020: +	components := n.rootComponents
2021: +	if len(components) == 0 {
2022: +		components = n.kindSpecificCfg().Components
2023: +	}
2024: +
2025: +	effective := n.componentsForConfig(components)
2026: +	if len(effective) == 0 {
2027: +		// Environment variables can configure integrated hardware without a components entry.
2028: +		effective = []*Component{n.componentForConfig(nil)}
2029: +	}
2030: +
2031: +	nodeType := n.Cfg.NodeType
2032: +	if chassis := strings.TrimSpace(n.Cfg.Env[envNokiaSrosChassis]); chassis != "" {
2033: +		nodeType = chassis
2034: +	}
2035: +	for _, warning := range info.componentWarnings(nodeType, n.componentSFM(), effective) {
2036: +		log.Warn("SR-SIM component configuration may not be supported",
2037: +			"node", n.Cfg.ShortName,
2038: +			"chassis", nodeType,
2039: +			"warning", warning)
2040: +	}
2041: +}
2042: +
2043:  // Func that Places the Certificates in the right place and format.
2044:  func (n *sros) createSROSCertificates() error {
2045:  	if *n.Cfg.Certificate.Issue {
2046:  		clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),
2047:  			clabconstants.PermissionsOpen)
2048: @@ -1170,88 +1123,10 @@ func (n *sros) createSROSCertificates() error {
2049:  		}
2050:  	}
2051:  	return nil
2052:  }
2053:  
2054: -// createSROSConfigFiles handles config generation for the SR-SIM kind.
2055: -// Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).
2056: -func (n *sros) createSROSConfigFiles() error {
2057: -	// Get version from image before generating config
2058: -	if n.swVersion == nil {
2059: -		ctx := context.Background()
2060: -		version, err := n.srosVersionFromImage(ctx)
2061: -		if err != nil {
2062: -			n.swVersion = n.parseVersionString(srosDefaultVersion)
2063: -			log.Warn("Failed to get SR OS version from image",
2064: -				"node", n.Cfg.ShortName, "version", n.swVersion, "error", err)
2065: -		} else {
2066: -			n.swVersion = version
2067: -			log.Info("Retrieved SR OS version from image",
2068: -				"node", n.Cfg.ShortName,
2069: -				"version", fmt.Sprintf("%s.%s.%s", version.Major, version.Minor, version.Build))
2070: -		}
2071: -	}
2072: -
2073: -	// Path pointing to the target config file under configCf3 dir
2074: -	cf3CfgFile := filepath.Join(
2075: -		n.Cfg.LabDir,
2076: -		n.Cfg.Env[envNokiaSrosSlot],
2077: -		configCf3,
2078: -		startupCfgName,
2079: -	)
2080: -	isPartial := clabutils.IsPartialConfigFile(n.Cfg.StartupConfig)
2081: -
2082: -	// generate config and use that to boot node
2083: -	log.Debug("Reading startup-config", "node", n.Cfg.ShortName, "startup-config",
2084: -		n.Cfg.StartupConfig, "isPartial", isPartial)
2085: -
2086: -	startupConfig, err := n.buildStartupConfig(isPartial)
2087: -	if err != nil {
2088: -		return err
2089: -	}
2090: -
2091: -	if startupConfig == "" {
2092: -		log.Debug(
2093: -			"startup config is empty, skipping startup config file generation",
2094: -			"node",
2095: -			n.Cfg.ShortName,
2096: -		)
2097: -		return nil
2098: -	}
2099: -
2100: -	return n.GenerateConfig(cf3CfgFile, startupConfig)
2101: -}
2102: -
2103: -// buildStartupConfig returns the full startup config string: either from user file (full config)
2104: -// or from default + partial config generation. It does not return a template; the name is
2105: -// historical.
2106: -func (n *sros) buildStartupConfig(isPartial bool) (string, error) {
2107: -	// User provides full startup config
2108: -	if n.Cfg.StartupConfig != "" && !isPartial {
2109: -		c, err := os.ReadFile(n.Cfg.StartupConfig)
2110: -		if err != nil {
2111: -			return "", err
2112: -		}
2113: -
2114: -		cBuf, err := clabutils.SubstituteEnvsAndTemplate(bytes.NewReader(c), n.Cfg)
2115: -		if err != nil {
2116: -			return "", err
2117: -		}
2118: -		return cBuf.String(), nil
2119: -	}
2120: -
2121: -	// Generate default config and optionally add partial config
2122: -	if err := n.addDefaultConfig(); err != nil {
2123: -		return "", err
2124: -	}
2125: -	if err := n.addPartialConfig(); err != nil {
2126: -		return "", err
2127: -	}
2128: -
2129: -	return string(n.startupCliCfg), nil
2130: -}
2131: -
2132:  // SlotIsInteger checks if the slot string represents a valid integer.
2133:  func SlotIsInteger(s string) bool {
2134:  	_, err := strconv.Atoi(s)
2135:  	return err == nil
2136:  }
2137: @@ -1279,221 +1154,10 @@ func (n *sros) isCPM(cpm string) bool {
2138:  	}
2139:  
2140:  	return true
2141:  }
2142:  
2143: -// prepareConfigTemplateData prepares all data needed for template selection and execution.
2144: -// Service configs are filled from a single table-driven result: variant → getFullSnippetSet(v).
2145: -func (n *sros) prepareConfigTemplateData() (*srosTemplateData, error) {
2146: -	b, err := n.banner()
2147: -	if err != nil {
2148: -		return nil, err
2149: -	}
2150: -
2151: -	componentConfig := ""
2152: -	if !isFullConfigFile(n.Cfg.StartupConfig) {
2153: -		componentConfig = n.generateComponentConfig()
2154: -	} else {
2155: -		log.Debugf(
2156: -			"SR-SIM node %q has non-partial startup-config defined, skipping component config gen",
2157: -			n.Cfg.LongName,
2158: -		)
2159: -	}
2160: -
2161: -	v := n.resolveConfigVariant()
2162: -	snippets := getFullSnippetSet(v)
2163: -	configMode := string(v.Mode)
2164: -	if v.ForceClassic {
2165: -		log.Warn(
2166: -			"SAR-Hm nodes only support classic configuration mode. Overriding configuration mode to 'classic'",
2167: -			"node",
2168: -			n.Cfg.LongName,
2169: -			"node-type",
2170: -			strings.ToLower(n.Cfg.NodeType),
2171: -		)
2172: -		configMode = string(ConfigModeClassic)
2173: -		n.kindSpecificCfg().ConfigMode = ConfigModeClassic
2174: -	}
2175: -
2176: -	tplData := &srosTemplateData{
2177: -		// Selection criteria
2178: -		NodeType:          strings.ToLower(n.Cfg.NodeType),
2179: -		ConfigurationMode: configMode,
2180: -		SwVersion:         n.swVersion,
2181: -		IsSecureGrpc:      *n.Cfg.Certificate.Issue,
2182: -
2183: -		// Node data
2184: -		Name:            n.Cfg.ShortName,
2185: -		TLSKey:          n.Cfg.TLSKey,
2186: -		TLSCert:         n.Cfg.TLSCert,
2187: -		TLSAnchor:       n.Cfg.TLSAnchor,
2188: -		Banner:          b,
2189: -		IFaces:          map[string]tplIFace{},
2190: -		MgmtMTU:         0,
2191: -		MgmtIPMTU:       n.Runtime.Mgmt().MTU,
2192: -		ComponentConfig: componentConfig,
2193: -
2194: -		// Service configs from variant (single source of truth)
2195: -		SystemConfig:  snippets.SystemConfig,
2196: -		GRPCConfig:    snippets.GRPCConfig,
2197: -		SNMPConfig:    snippets.SNMPConfig,
2198: -		NetconfConfig: snippets.NetconfConfig,
2199: -		LoggingConfig: snippets.LoggingConfig,
2200: -		SSHConfig:     snippets.SSHConfig,
2201: -	}
2202: -
2203: -	if n.Config().DNS != nil {
2204: -		tplData.DNSServers = append(tplData.DNSServers, n.Config().DNS.Servers...)
2205: -	}
2206: -
2207: -	n.prepareSSHPubKeys(tplData)
2208: -
2209: -	n.setVersionSpecificParams(tplData)
2210: -
2211: -	return tplData, nil
2212: -}
2213: -
2214: -// isIXRNode returns true if this is an IXR node type (case-insensitive).
2215: -func (n *sros) isIXRNode() bool {
2216: -	return ixrRegexp.MatchString(n.Cfg.NodeType)
2217: -}
2218: -
2219: -// isSARNode returns true if this is a SAR node type (case-insensitive).
2220: -func (n *sros) isSARNode() bool {
2221: -	return sarRegexp.MatchString(n.Cfg.NodeType)
2222: -}
2223: -
2224: -// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).
2225: -func (n *sros) isSARHmNode() bool {
2226: -	return sarHmRegexp.MatchString(n.Cfg.NodeType)
2227: -}
2228: -
2229: -// getTemplateForVariant returns the template string and name for the given config variant.
2230: -// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= "26").
2231: -func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {
2232: -	// Model-driven (or mixed treated as classic below when family is classic)
2233: -	if v.Mode == ConfigModeModelDriven {
2234: -		// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= "26"
2235: -		// { return cfgTplSROS26, "clab-sros-config-sros26" }
2236: -		return cfgTplSROS25, "clab-sros-config-sros25"
2237: -	}
2238: -	// Classic (or mixed)
2239: -	tmpl = cfgTplClassic
2240: -	tplName = "clab-sros-config-classic"
2241: -	switch v.Family {
2242: -	case ConfigFamilyIXR:
2243: -		return cfgTplClassicIxr, "clab-sros-config-classic-ixr"
2244: -	case ConfigFamilySAR:
2245: -		return cfgTplClassicSar, "clab-sros-config-classic-sar"
2246: -	default:
2247: -		return tmpl, tplName
2248: -	}
2249: -}
2250: -
2251: -// selectConfigTemplate chooses the config template from the config variant (mode + family).
2252: -func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {
2253: -	v := n.resolveConfigVariant()
2254: -	tmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)
2255: -	return template.New(tplName).
2256: -		Funcs(clabutils.CreateFuncs()).
2257: -		Parse(tmpl)
2258: -}
2259: -
2260: -// addDefaultConfig adds sros default configuration such as tls certs, gnmi/json-rpc, login-banner,
2261: -// ssh keys.
2262: -func (n *sros) addDefaultConfig() error {
2263: -	// Prepare all template data
2264: -	tplData, err := n.prepareConfigTemplateData()
2265: -	if err != nil {
2266: -		return err
2267: -	}
2268: -
2269: -	// Select appropriate template
2270: -	srosCfgTpl, err := n.selectConfigTemplate(tplData)
2271: -	if err != nil {
2272: -		return fmt.Errorf("failed to select config template: %w", err)
2273: -	}
2274: -	log.Debug("Prepare SR OS config template", "template", srosCfgTpl.Name(),
2275: -		"node", n.Cfg.LongName,
2276: -		"configuration-mode", tplData.ConfigurationMode,
2277: -		"node-type", tplData.NodeType,
2278: -		"secure-grpc", tplData.IsSecureGrpc,
2279: -		"sw-version", tplData.SwVersion)
2280: -
2281: -	// Execute template
2282: -	buf := new(bytes.Buffer)
2283: -	err = srosCfgTpl.Execute(buf, tplData)
2284: -	if err != nil {
2285: -		return err
2286: -	}
2287: -
2288: -	if buf.Len() == 0 {
2289: -		log.Warn(
2290: -			"Buffer empty, template parsing error",
2291: -			"node", n.Cfg.ShortName,
2292: -			"template", srosCfgTpl.Name(),
2293: -		)
2294: -	} else {
2295: -		log.Debug("Additional default config parsed",
2296: -			"node", n.Cfg.ShortName,
2297: -			"template", srosCfgTpl.Name())
2298: -		n.startupCliCfg = append(n.startupCliCfg, buf.String()...)
2299: -	}
2300: -
2301: -	return nil
2302: -}
2303: -
2304: -// applyPartialConfig applies partial configuration to the SR OS.
2305: -func (n *sros) addPartialConfig() error {
2306: -	if n.Cfg.StartupConfig != "" {
2307: -		// b holds the configuration to be applied to the node
2308: -		b := &bytes.Buffer{}
2309: -		// apply partial configs if partial config is used
2310: -		if clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM("") {
2311: -			log.Info("Adding configuration",
2312: -				"node", n.Cfg.LongName,
2313: -				"type", "partial",
2314: -				"source", n.Cfg.StartupConfig)
2315: -
2316: -			r, err := os.Open(n.Cfg.StartupConfig)
2317: -			if err != nil {
2318: -				return err
2319: -			}
2320: -
2321: -			defer r.Close() // skipcq: GO-S2307
2322: -
2323: -			_, err = io.Copy(b, r)
2324: -			if err != nil {
2325: -				return err
2326: -			}
2327: -
2328: -			configContent, err := clabutils.SubstituteEnvsAndTemplate(b, n.Cfg)
2329: -			if err != nil {
2330: -				return err
2331: -			}
2332: -			if configContent.Len() == 0 {
2333: -				log.Warn(
2334: -					"Buffer empty, PARTIAL config template parsing error",
2335: -					"node",
2336: -					n.Cfg.ShortName,
2337: -				)
2338: -			} else {
2339: -				log.Debug("Additional PARTIAL config parsed", "node",
2340: -					n.Cfg.ShortName, "partial-config", configContent.String())
2341: -				n.startupCliCfg = append(n.startupCliCfg, configContent.String()...)
2342: -			}
2343: -		} else {
2344: -			log.Warn(
2345: -				"Passed startup-config option, but it will not have any effect",
2346: -				"node",
2347: -				n.Cfg.ShortName,
2348: -			)
2349: -		}
2350: -	}
2351: -	return nil
2352: -}
2353: -
2354:  func (n *sros) GetContainers(ctx context.Context) ([]clabruntime.GenericContainer, error) {
2355:  	// if not a distributed setup call regular GetContainers
2356:  	if n.isStandaloneNode() || n.isDistributedCardNode() {
2357:  		return n.DefaultNode.GetContainers(ctx)
2358:  	}
2359: @@ -1761,63 +1425,10 @@ func (n *sros) saveConfigWithAddr(ctx context.Context, addr string) error {
2360:  	)
2361:  
2362:  	return nil
2363:  }
2364:  
2365: -// BuildPKIImportXML.
2366: -func buildPKIImportXML(inputURL, outputFile, importType string) string {
2367: -	action := etree.NewElement("action")
2368: -	action.CreateAttr("xmlns", "urn:ietf:params:xml:ns:yang:1")
2369: -
2370: -	admin := action.CreateElement("admin")
2371: -	admin.CreateAttr("xmlns", "urn:nokia.com:sros:ns:yang:sr:oper-admin")
2372: -
2373: -	importElem := admin.CreateElement("system").
2374: -		CreateElement("security").
2375: -		CreateElement("pki").
2376: -		CreateElement("import")
2377: -
2378: -	// Add import parameters
2379: -	importElem.CreateElement("input-url").SetText(inputURL)
2380: -	importElem.CreateElement("output-file").SetText(outputFile)
2381: -	importElem.CreateElement("type").SetText(importType)
2382: -	importElem.CreateElement("format").SetText("pem")
2383: -	var buf bytes.Buffer
2384: -	action.WriteTo(&buf, &etree.WriteSettings{
2385: -		CanonicalText:    false,
2386: -		CanonicalAttrVal: false,
2387: -	})
2388: -	return buf.String()
2389: -}
2390: -
2391: -// BuildTLSProfileXML builds the TLS profile configuration XML.
2392: -func buildTLSProfileXML() string {
2393: -	config := etree.NewElement("config")
2394: -	configure := config.CreateElement("configure")
2395: -	configure.CreateAttr("xmlns", "urn:nokia.com:sros:ns:yang:sr:conf")
2396: -	configure.CreateAttr("xmlns:nc", "urn:ietf:params:xml:ns:netconf:base:1.0")
2397: -
2398: -	certProfile := configure.CreateElement("system").
2399: -		CreateElement("security").
2400: -		CreateElement("tls").
2401: -		CreateElement("cert-profile")
2402: -
2403: -	// Set operation attribute
2404: -	certProfile.CreateAttr("nc:operation", "merge")
2405: -
2406: -	// Add profile configuration
2407: -	certProfile.CreateElement("cert-profile-name").SetText(tlsCertProfileName)
2408: -	certProfile.CreateElement("admin-state").SetText("enable")
2409: -
2410: -	var buf bytes.Buffer
2411: -	config.WriteTo(&buf, &etree.WriteSettings{
2412: -		CanonicalText:    false,
2413: -		CanonicalAttrVal: false,
2414: -	})
2415: -	return buf.String()
2416: -}
2417: -
2418:  // TLS bootstrap via NETCONF to enable secure gRPC.
2419:  func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {
2420:  	// Always import PKI key and cert:
2421:  	// 	 import "cf3:\node.key" in PEM format as "cf3:\system-pki\node.key" (encrypted DER)
2422:  	//   import "cf3:\node.crt" in PEM format as "cf3:\system-pki\node.crt" (encrypted DER)
2423: @@ -1867,23 +1478,10 @@ func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {
2424:  		}
2425:  	}
2426:  	return err
2427:  }
2428:  
2429: -// isConfigClassic reports whether the node is in classic or mixed configuration mode.
2430: -func (n *sros) isConfigClassic() bool {
2431: -	mode := n.kindSpecificCfg().ConfigMode
2432: -	return mode == ConfigModeClassic || mode == ConfigModeMixed
2433: -}
2434: -
2435: -// isFullConfigFile returns true if the config file doesn't contain .partial substring
2436: -// and the config file is NOT nil (ie. startup config IS defined).
2437: -// it is intended that the 'c' arg is n.Cfg.StartupConfig.
2438: -func isFullConfigFile(c string) bool {
2439: -	return c != "" && !clabutils.IsPartialConfigFile(c)
2440: -}
2441: -
2442:  func (n *sros) IsHealthy(_ context.Context) (bool, error) {
2443:  	if !n.isCPM("") {
2444:  		return true, fmt.Errorf("node %q is not a CPM, healthcheck has no effect", n.Cfg.LongName)
2445:  	}
2446:  	// non-partial user startup config might not have any netconf config
2447: @@ -2082,67 +1680,10 @@ func (n *sros) MgmtIPAddr() (string, error) {
2448:  		"no management IP address (IPv4 or IPv6) configured for node %q",
2449:  		n.Cfg.LongName,
2450:  	)
2451:  }
2452:  
2453: -// generateComponentConfig generates SR OS configuration for explicitly defined distributed
2454: -// components or known integrated SR-SIM defaults. Power config is appended when supported.
2455: -func (n *sros) generateComponentConfig() string {
2456: -	if !n.kindSpecificCfg().GenComponentConfig {
2457: -		return ""
2458: -	}
2459: -	if n.isConfigClassic() {
2460: -		return ""
2461: -	}
2462: -
2463: -	components := n.rootComponents
2464: -	if len(components) == 0 {
2465: -		if len(n.kindSpecificCfg().Components) > 1 || n.rootCtrName != "" {
2466: -			return ""
2467: -		}
2468: -
2469: -		lines := buildIntegratedComponentCfgLines(n.Cfg.NodeType, n.Cfg.Env)
2470: -		if len(lines) == 0 {
2471: -			return ""
2472: -		}
2473: -		return n.componentConfigFromLines(lines)
2474: -	}
2475: -
2476: -	for _, c := range components {
2477: -		slot := strings.ToUpper(strings.TrimSpace(c.Slot))
2478: -		if slot == slotAName || slot == slotBName {
2479: -			continue
2480: -		}
2481: -		if c.Type == "" {
2482: -			log.Warn(
2483: -				"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.",
2484: -				"node",
2485: -				n.Cfg.ShortName,
2486: -				"slot",
2487: -				slot,
2488: -			)
2489: -		}
2490: -	}
2491: -
2492: -	lines := buildComponentCfgLines(components, n.kindSpecificCfg().SFM)
2493: -	return n.componentConfigFromLines(lines)
2494: -}
2495: -
2496: -func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {
2497: -	powerConfig := n.generatePowerConfig()
2498: -	if len(lines) == 0 && powerConfig == "" {
2499: -		return ""
2500: -	}
2501: -
2502: -	var config strings.Builder
2503: -	for _, l := range lines {
2504: -		config.WriteString(l.String())
2505: -	}
2506: -	config.WriteString(powerConfig)
2507: -	return config.String()
2508: -}
2509: -
2510:  // override to fetch CPM to avoid renaming the base node to CPM A.
2511:  func (n *sros) GetContainerName() string {
2512:  	if n.isDistributedBaseNode() && n.cpmContainerName != "" {
2513:  		return n.cpmContainerName
2514:  	}
2515: @@ -2365,32 +1906,5 @@ func (n *sros) RestoreEndpoints(ctx context.Context) error {
2516:  	if err != nil {
2517:  		return err
2518:  	}
2519:  	return clabutils.LinkContainerNS(nsPath, n.Cfg.LongName)
2520:  }
2521: -
2522: -func (n *sros) ensureNetnsRunning(ctx context.Context) error {
2523: -	switch status := n.netnsNode.GetContainerStatus(ctx); status {
2524: -	case clabruntime.Running:
2525: -		// The namespace holder intentionally survives regular node lifecycle operations.
2526: -	case clabruntime.Created, clabruntime.Stopped:
2527: -		if err := n.netnsNode.Start(ctx); err != nil {
2528: -			return fmt.Errorf("node %q network namespace container start error: %w",
2529: -				n.Cfg.ShortName, err)
2530: -		}
2531: -	case clabruntime.Paused:
2532: -		if err := n.Runtime.UnpauseContainer(ctx, n.netnsNode.Config().LongName); err != nil {
2533: -			return fmt.Errorf("node %q network namespace container unpause error: %w",
2534: -				n.Cfg.ShortName, err)
2535: -		}
2536: -	case clabruntime.NotFound:
2537: -		return fmt.Errorf(
2538: -			"node %q network namespace container %q not found; recreate the node",
2539: -			n.Cfg.ShortName, n.netnsNode.Config().LongName,
2540: -		)
2541: -	default:
2542: -		return fmt.Errorf("node %q network namespace container %q is %s",
2543: -			n.Cfg.ShortName, n.netnsNode.Config().LongName, status)
2544: -	}
2545: -
2546: -	return nil
2547: -}
2548: diff --git a/nodes/sros/sros_test.go b/nodes/sros/sros_test.go
2549: index 29cace9..dd8aea6 100644
2550: --- a/nodes/sros/sros_test.go
2551: +++ b/nodes/sros/sros_test.go
2552: @@ -272,10 +272,16 @@ func Test_sros_generateComponentConfig(t *testing.T) {
2553:  			name:     "integrated_ixr_e3x_default",
2554:  			nodeType: "ixr-e3x",
2555:  			cardType: "imm16-sfp112+15-sfp56+6-qsfpdd",
2556:  			mdas:     MDAS{{Slot: 1, Type: "m16-sfp112+15-sfp56+6-qsfpdd"}},
2557:  		},
2558: +		{
2559: +			name:     "integrated_ixr_e2sc_default",
2560: +			nodeType: "ixr-e2sc",
2561: +			cardType: "imm16-sfp++4-sfp28",
2562: +			mdas:     MDAS{{Slot: 1, Type: "m16-sfp++4-sfp28"}},
2563: +		},
2564:  		{
2565:  			name:     "integrated_ixr_ec_default",
2566:  			nodeType: "ixr-ec",
2567:  			cardType: "imm4-1g-tx+20-1g-sfp+6-10g-sfp+",
2568:  			mdas:     MDAS{{Slot: 1, Type: "m4-1g-tx+20-1g-sfp+6-10g-sfp+"}},
2569: @@ -311,40 +317,116 @@ func Test_sros_generateComponentConfig(t *testing.T) {
2570:  				assert.Equal(t, 4, strings.Count(cfg, "power-module-type ps-a-dc-6000"))
2571:  			}
2572:  		})
2573:  	}
2574:  
2575: -	t.Run("integrated_env_overrides_preserve_default_mda_slots", func(t *testing.T) {
2576: +	t.Run("integrated_component_mda_override_preserves_default_mda_slots", func(t *testing.T) {
2577: +		n := newSrosComponentConfigTestNode("sr-1", nil, []*Component{
2578: +			{MDA: MDAS{{Slot: 1, Type: "custom-mda"}}},
2579: +		})
2580: +
2581: +		cfg := n.generateComponentConfig()
2582: +
2583: +		assert.Contains(t, cfg, "/configure card 1 card-type iom-1 admin-state enable")
2584: +		assert.Contains(t, cfg, "/configure card 1 mda 1 mda-type custom-mda admin-state enable")
2585: +		assert.Contains(
2586: +			t,
2587: +			cfg,
2588: +			"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable",
2589: +		)
2590: +	})
2591: +
2592: +	t.Run("integrated_xiom_replaces_default_mdas", func(t *testing.T) {
2593: +		n := newSrosComponentConfigTestNode("sr-1s", nil, []*Component{
2594: +			{
2595: +				XIOM: XIOMS{
2596: +					{
2597: +						Slot: 1,
2598: +						Type: "iom-s-3.0t",
2599: +						MDA: MDAS{
2600: +							{Slot: 1, Type: "ms18-100gb-qsfp28"},
2601: +							{Slot: 2, Type: "ms2-400gb-qsfpdd+2-100gb-qsfp28"},
2602: +						},
2603: +					},
2604: +				},
2605: +			},
2606: +		})
2607: +
2608: +		cfg := n.generateComponentConfig()
2609: +
2610: +		assert.Contains(t, cfg, "/configure card 1 card-type xcm-1s admin-state enable")
2611: +		assert.Contains(t, cfg, "/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable")
2612: +		assert.Contains(
2613: +			t,
2614: +			cfg,
2615: +			"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable",
2616: +		)
2617: +		assert.Contains(
2618: +			t,
2619: +			cfg,
2620: +			"/configure card 1 xiom x1 mda 2 mda-type ms2-400gb-qsfpdd+2-100gb-qsfp28 admin-state enable",
2621: +		)
2622: +		assert.NotContains(t, cfg, "s36-100gb-qsfp28")
2623: +	})
2624: +
2625: +	t.Run("integrated_env_mda_overrides_default_component_config", func(t *testing.T) {
2626:  		n := newSrosComponentConfigTestNode(
2627:  			"sr-1",
2628: -			map[string]string{
2629: -				envNokiaSrosCard:       "env-card",
2630: -				envNokiaSrosMDA + "_1": "env-mda",
2631: -			},
2632: +			map[string]string{envNokiaSrosMDA + "_1": "env-mda"},
2633:  			nil,
2634:  		)
2635:  
2636:  		cfg := n.generateComponentConfig()
2637:  
2638: -		assert.Contains(t, cfg, "/configure card 1 card-type env-card admin-state enable")
2639: -		assert.Contains(t, cfg, "/configure card 1 mda 1 mda-type env-mda admin-state enable")
2640: +		assert.Contains(
2641: +			t,
2642: +			cfg,
2643: +			"/configure card 1 mda 1 mda-type env-mda admin-state enable",
2644: +		)
2645:  		assert.Contains(
2646:  			t,
2647:  			cfg,
2648:  			"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable",
2649:  		)
2650: +		assert.NotContains(t, cfg, "me6-100gb-qsfp28")
2651:  	})
2652:  
2653: -	t.Run("integrated_env_override_adds_mda_slot", func(t *testing.T) {
2654: +	t.Run("integrated_env_mda_overrides_component_mda", func(t *testing.T) {
2655:  		n := newSrosComponentConfigTestNode(
2656: -			"ixr-r6",
2657: +			"sr-1",
2658: +			map[string]string{envNokiaSrosMDA + "_1": "from-env"},
2659: +			[]*Component{{MDA: MDAS{{Slot: 1, Type: "from-component"}}}},
2660: +		)
2661: +
2662: +		cfg := n.generateComponentConfig()
2663: +
2664: +		assert.Contains(
2665: +			t,
2666: +			cfg,
2667: +			"/configure card 1 mda 1 mda-type from-env admin-state enable",
2668: +		)
2669: +		assert.NotContains(t, cfg, "from-component")
2670: +	})
2671: +
2672: +	t.Run("integrated_card_override_skips_component_config", func(t *testing.T) {
2673: +		n := newSrosComponentConfigTestNode(
2674: +			"sr-1s",
2675:  			map[string]string{
2676: -				envNokiaSrosMDA + "_3": "m20-1g-csfp",
2677: +				envNokiaSrosCard:       "cpm-1s",
2678: +				envNokiaSrosMDA + "_1": "env-mda",
2679:  			},
2680:  			nil,
2681:  		)
2682:  
2683: +		assert.Empty(t, n.generateComponentConfig())
2684: +	})
2685: +
2686: +	t.Run("integrated_component_override_adds_mda_slot", func(t *testing.T) {
2687: +		n := newSrosComponentConfigTestNode("ixr-r6", nil, []*Component{
2688: +			{MDA: MDAS{{Slot: 3, Type: "m20-1g-csfp"}}},
2689: +		})
2690: +
2691:  		cfg := n.generateComponentConfig()
2692:  
2693:  		assert.Contains(
2694:  			t,
2695:  			cfg,
2696: @@ -415,41 +497,174 @@ func Test_sros_integratedComponentOverrides(t *testing.T) {
2697:  		require.NoError(t, err)
2698:  		assert.True(t, n.isStandaloneNode())
2699:  		assert.Equal(t, slotBName, n.Cfg.Env[envNokiaSrosSlot])
2700:  		assert.Equal(t, "cpiom-ixr-r6", n.Cfg.Env[envNokiaSrosCard])
2701:  		assert.Equal(t, "m20-1g-csfp", n.Cfg.Env[envNokiaSrosMDA+"_3"])
2702: +
2703: +		assert.Empty(t, n.generateComponentConfig())
2704: +	})
2705: +
2706: +	t.Run("integrated_component_xiom_sets_env", func(t *testing.T) {
2707: +		n := newSrosInitTestNode("sr-1s", []*Component{
2708: +			{
2709: +				XIOM: XIOMS{
2710: +					{
2711: +						Slot: 1,
2712: +						Type: "iom-s-3.0t",
2713: +						MDA:  MDAS{{Slot: 1, Type: "ms18-100gb-qsfp28"}},
2714: +					},
2715: +				},
2716: +			},
2717: +		})
2718: +
2719: +		require.NoError(t, n.Init(n.Cfg))
2720: +		assert.Equal(t, "iom-s-3.0t", n.Cfg.Env[envNokiaSrosXIOM+"_X1"])
2721: +		assert.Equal(t, "ms18-100gb-qsfp28", n.Cfg.Env[envNokiaSrosMDA+"_X1_1"])
2722: +
2723: +		cfg := n.generateComponentConfig()
2724: +		assert.Contains(t, cfg, "/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable")
2725: +		assert.Contains(
2726: +			t,
2727: +			cfg,
2728: +			"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable",
2729: +		)
2730:  	})
2731:  
2732:  	t.Run("integrated_rejects_multiple_components", func(t *testing.T) {
2733: +		for _, tc := range []struct {
2734: +			nodeType   string
2735: +			components []*Component
2736: +		}{
2737: +			{"sr-1", []*Component{{Slot: slotAName}, {Slot: slotBName}}},
2738: +			{"ixr-r6", []*Component{{Slot: slotAName}, {Slot: "1"}}},
2739: +			{"ixr-r6", []*Component{{Slot: slotAName}, {}}},
2740: +		} {
2741: +			n := newSrosInitTestNode(tc.nodeType, tc.components)
2742: +
2743: +			err := n.Init(n.Cfg)
2744: +
2745: +			require.Error(t, err, tc.nodeType)
2746: +			assert.Contains(t, err.Error(), "at most one component override")
2747: +		}
2748: +	})
2749: +
2750: +	t.Run("redundant_integrated_components_are_distributed", func(t *testing.T) {
2751:  		n := newSrosInitTestNode("ixr-r6", []*Component{
2752: -			{Slot: slotAName, Type: "cpiom-ixr-r6"},
2753: -			{Slot: slotBName, Type: "cpiom-ixr-r6"},
2754: +			{Slot: slotAName, MDA: MDAS{{Slot: 3, Type: "m20-1g-csfp"}}},
2755: +			{Slot: slotBName},
2756:  		})
2757:  
2758: -		err := n.Init(n.Cfg)
2759: +		require.NoError(t, n.Init(n.Cfg))
2760: +		assert.True(t, n.isDistributedBaseNode())
2761: +		require.Len(t, n.componentNodes, 2)
2762: +
2763: +		cpmA := n.componentNodes[0].(*sros)
2764: +		cpmB := n.componentNodes[1].(*sros)
2765: +		assert.Equal(t, slotAName, cpmA.Config().Env[envNokiaSrosSlot])
2766: +		assert.Equal(t, slotBName, cpmB.Config().Env[envNokiaSrosSlot])
2767: +		assert.Equal(t, "container:n1-netns", cpmA.Config().NetworkMode)
2768: +		assert.Equal(t, "container:n1-netns", cpmB.Config().NetworkMode)
2769: +
2770: +		cfgA := cpmA.generateComponentConfig()
2771: +		assert.Contains(t, cfgA, "/configure card 1 card-type iom-ixr-r6 admin-state enable")
2772: +		assert.Contains(
2773: +			t,
2774: +			cfgA,
2775: +			"/configure card 1 mda 1 mda-type m6-10g-sfp++1-100g-qsfp28 admin-state enable",
2776: +		)
2777: +		assert.Contains(t, cfgA, "/configure card 1 mda 3 mda-type m20-1g-csfp admin-state enable")
2778: +
2779: +		cfgB := cpmB.generateComponentConfig()
2780: +		assert.Contains(t, cfgB, "/configure card 1 card-type iom-ixr-r6 admin-state enable")
2781: +		assert.NotContains(t, cfgB, "m20-1g-csfp")
2782: +	})
2783: +
2784: +	t.Run("lowercase_integrated_slots_resolve_to_cpm_a", func(t *testing.T) {
2785: +		n := newSrosInitTestNode("ixr-r6", []*Component{
2786: +			{Slot: "a"},
2787: +			{Slot: "b"},
2788: +		})
2789: +
2790: +		require.NoError(t, n.Init(n.Cfg))
2791: +		slot, err := n.cpmSlot()
2792: +		require.NoError(t, err)
2793: +		assert.Equal(t, slotAName, slot)
2794: +	})
2795: +
2796: +	t.Run("node_env_overrides_component_mda", func(t *testing.T) {
2797: +		n := newSrosInitTestNode("sr-1", []*Component{
2798: +			{MDA: MDAS{{Slot: 1, Type: "from-component"}}},
2799: +		})
2800: +		n.Cfg.Env = map[string]string{envNokiaSrosMDA + "_1": "from-env"}
2801: +
2802: +		require.NoError(t, n.Init(n.Cfg))
2803: +		assert.Equal(t, "from-env", n.Cfg.Env[envNokiaSrosMDA+"_1"])
2804: +
2805: +		cfg := n.generateComponentConfig()
2806: +		assert.Contains(t, cfg, "/configure card 1 mda 1 mda-type from-env admin-state enable")
2807: +		assert.NotContains(t, cfg, "from-component")
2808: +	})
2809: +
2810: +	t.Run("node_env_overrides_sfm", func(t *testing.T) {
2811: +		n := newSrosInitTestNode("sr-1", nil)
2812: +		kindSpecificConfig.Of(n.Cfg).SFM = "from-sfm"
2813: +		n.Cfg.Env = map[string]string{envNokiaSrosSFM: "from-env"}
2814: +
2815: +		require.NoError(t, n.Init(n.Cfg))
2816: +		assert.Equal(t, "from-env", n.Cfg.Env[envNokiaSrosSFM])
2817: +	})
2818: +
2819: +	t.Run("distributed_node_env_overrides_component_mda", func(t *testing.T) {
2820: +		n := newSrosInitTestNode("sr-2s", []*Component{
2821: +			{Slot: slotAName, Type: "cpm-2s"},
2822: +			{
2823: +				Slot: "1",
2824: +				Type: "xcm-2s",
2825: +				MDA:  MDAS{{Slot: 1, Type: "from-component"}},
2826: +			},
2827: +		})
2828: +		n.Cfg.Env = map[string]string{envNokiaSrosMDA + "_1": "from-env"}
2829: +
2830: +		require.NoError(t, n.Init(n.Cfg))
2831: +		require.Len(t, n.componentNodes, 2)
2832: +
2833: +		linecard := n.componentNodes[1].(*sros)
2834: +		assert.Equal(t, "from-env", linecard.Config().Env[envNokiaSrosMDA+"_1"])
2835: +
2836: +		cfg := n.componentNodes[0].(*sros).generateComponentConfig()
2837: +		assert.Contains(t, cfg, "/configure card 1 mda 1 mda-type from-env admin-state enable")
2838: +		assert.NotContains(t, cfg, "from-component")
2839: +	})
2840: +
2841: +	t.Run("duplicate_component_slots_are_rejected_regardless_of_case", func(t *testing.T) {
2842: +		n := newSrosInitTestNode("sr-2s", []*Component{
2843: +			{Slot: "a"},
2844: +			{Slot: "A"},
2845: +		})
2846: +
2847: +		err := n.checkComponentSlotsConfig()
2848:  
2849:  		require.Error(t, err)
2850: -		assert.Contains(t, err.Error(), "at most one component override")
2851: +		assert.Contains(t, err.Error(), "duplicate")
2852:  	})
2853:  
2854:  	t.Run("sfm_sets_container_env", func(t *testing.T) {
2855:  		n := newSrosInitTestNode("sr-1", nil)
2856:  		kindSpecificConfig.Of(n.Cfg).SFM = "m-sfm6-7/12"
2857:  
2858:  		require.NoError(t, n.Init(n.Cfg))
2859:  		assert.Equal(t, "m-sfm6-7/12", n.Cfg.Env[envNokiaSrosSFM])
2860:  	})
2861:  
2862: -	t.Run("single_slot_integrated_rejects_card_type_override", func(t *testing.T) {
2863: -		n := newSrosInitTestNode("ixr-e2", []*Component{
2864: -			{Slot: slotAName, Type: "imm2-qsfpdd+2-qsfp28+24-sfp28"},
2865: +	t.Run("single_slot_integrated_allows_card_type_override", func(t *testing.T) {
2866: +		n := newSrosInitTestNode("ixr-e2n", []*Component{
2867: +			{Slot: slotAName, Type: "cpm-ixr-e2n/imm4-sfp+4-sfp+"},
2868:  		})
2869:  
2870: -		err := n.Init(n.Cfg)
2871: -
2872: -		require.Error(t, err)
2873: -		assert.Contains(t, err.Error(), "does not support component card-type override")
2874: +		require.NoError(t, n.Init(n.Cfg))
2875: +		assert.Equal(t, "cpm-ixr-e2n/imm4-sfp+4-sfp+", n.Cfg.Env[envNokiaSrosCard])
2876: +		assert.Empty(t, n.generateComponentConfig())
2877:  	})
2878:  
2879:  	t.Run("integrated_rejects_invalid_slot", func(t *testing.T) {
2880:  		n := newSrosInitTestNode("ixr-e2", []*Component{
2881:  			{Slot: slotBName, Type: "cpm-ixr-e2"},
2882: diff --git a/nodes/sros/template.go b/nodes/sros/template.go
2883: index 38f1e4d..b538320 100644
2884: --- a/nodes/sros/template.go
2885: +++ b/nodes/sros/template.go
2886: @@ -1,7 +1,28 @@
2887:  package sros
2888:  
2889: +import (
2890: +	_ "embed"
2891: +	"text/template"
2892: +
2893: +	clabutils "github.com/srl-labs/containerlab/utils"
2894: +)
2895: +
2896: +var (
2897: +	//go:embed configs/sros_config_sros25.go.tpl
2898: +	cfgTplSROS25 string
2899: +
2900: +	//go:embed configs/sros_config_classic.go.tpl
2901: +	cfgTplClassic string
2902: +
2903: +	//go:embed configs/ixr/ixr_config_classic.go.tpl
2904: +	cfgTplClassicIxr string
2905: +
2906: +	//go:embed configs/sar/sar_config_classic.go.tpl
2907: +	cfgTplClassicSar string
2908: +)
2909: +
2910:  // srosTemplateData holds all data needed for template selection and execution.
2911:  type srosTemplateData struct {
2912:  	// Template selection criteria
2913:  	NodeType          string
2914:  	ConfigurationMode string
2915: @@ -43,5 +64,36 @@ type tplIFace struct {
2916:  	Slot       string
2917:  	Port       string
2918:  	BreakoutNo string
2919:  	Mtu        int
2920:  }
2921: +
2922: +// getTemplateForVariant returns the template string and name for the given config variant.
2923: +// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= "26").
2924: +func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {
2925: +	// Model-driven (or mixed treated as classic below when family is classic)
2926: +	if v.Mode == ConfigModeModelDriven {
2927: +		// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= "26"
2928: +		// { return cfgTplSROS26, "clab-sros-config-sros26" }
2929: +		return cfgTplSROS25, "clab-sros-config-sros25"
2930: +	}
2931: +	// Classic (or mixed)
2932: +	tmpl = cfgTplClassic
2933: +	tplName = "clab-sros-config-classic"
2934: +	switch v.Family {
2935: +	case ConfigFamilyIXR:
2936: +		return cfgTplClassicIxr, "clab-sros-config-classic-ixr"
2937: +	case ConfigFamilySAR:
2938: +		return cfgTplClassicSar, "clab-sros-config-classic-sar"
2939: +	default:
2940: +		return tmpl, tplName
2941: +	}
2942: +}
2943: +
2944: +// selectConfigTemplate chooses the config template from the config variant (mode + family).
2945: +func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {
2946: +	v := n.resolveConfigVariant()
2947: +	tmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)
2948: +	return template.New(tplName).
2949: +		Funcs(clabutils.CreateFuncs()).
2950: +		Parse(tmpl)
2951: +}
2952: diff --git a/nodes/sros/variant.go b/nodes/sros/variant.go
2953: index fad585c..85bcac5 100644
2954: --- a/nodes/sros/variant.go
2955: +++ b/nodes/sros/variant.go
2956: @@ -2,11 +2,21 @@
2957:  // Licensed under the BSD 3-Clause License.
2958:  // SPDX-License-Identifier: BSD-3-Clause
2959:  
2960:  package sros
2961:  
2962: -import "fmt"
2963: +import (
2964: +	"fmt"
2965: +	"regexp"
2966: +)
2967: +
2968: +var (
2969: +	sarRegexp   = regexp.MustCompile(`(?i)\bsar-`)
2970: +	sarHmRegexp = regexp.MustCompile(`(?i)\b(sar-hm|sar-hmc)\b`)
2971: +
2972: +	ixrRegexp = regexp.MustCompile(`(?i)\bixr-`)
2973: +)
2974:  
2975:  // ConfigMode is the configuration mode (model-driven or classic).
2976:  type ConfigMode string
2977:  
2978:  const (
2979: @@ -141,5 +151,20 @@ func getSnippetSet(v ConfigVariant) snippetSet {
2980:  			grpc = grpcConfigSARInsecure
2981:  		}
2982:  	}
2983:  	return snippetSet{SystemConfig: sys, GRPCConfig: grpc}
2984:  }
2985: +
2986: +// isIXRNode returns true if this is an IXR node type (case-insensitive).
2987: +func (n *sros) isIXRNode() bool {
2988: +	return ixrRegexp.MatchString(n.Cfg.NodeType)
2989: +}
2990: +
2991: +// isSARNode returns true if this is a SAR node type (case-insensitive).
2992: +func (n *sros) isSARNode() bool {
2993: +	return sarRegexp.MatchString(n.Cfg.NodeType)
2994: +}
2995: +
2996: +// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).
2997: +func (n *sros) isSARHmNode() bool {
2998: +	return sarHmRegexp.MatchString(n.Cfg.NodeType)
2999: +}
3000: diff --git a/schemas/clab.schema.json b/schemas/clab.schema.json
3001: index 66679ac..0157106 100644
3002: --- a/schemas/clab.schema.json
3003: +++ b/schemas/clab.schema.json
3004: @@ -939,10 +939,12 @@
3005:                                              "ixr-6",
3006:                                              "ixr-e2c",
3007:                                              "ixr-e2",
3008:                                              "ixr-e2n",
3009:                                              "ixr-e2n-s",
3010: +                                            "ixr-e2sc",
3011: +                                            "ixr-e3",
3012:                                              "ixr-e3c",
3013:                                              "ixr-e3x",
3014:                                              "ixr-ec",
3015:                                              "ixr-e",
3016:                                              "ixr-r4",
3017: @@ -951,10 +953,11 @@
3018:                                              "ixr-r6",
3019:                                              "ixr-s",
3020:                                              "ixr-x3",
3021:                                              "ixr-x",
3022:                                              "sar-1",
3023: +                                            "sar-10x",
3024:                                              "sar-hm",
3025:                                              "sar-hmc",
3026:                                              "sar-hx",
3027:                                              "sar-mx",
3028:                                              "sr-1-24d",
3029: @@ -2009,11 +2012,14 @@
3030:                  "cpm-ixr-e-gnss/imm24-sfp++8-sfp28+2-qsfp28",
3031:                  "cpm-ixr-e/imm14-10g-sfp++4-1g-tx",
3032:                  "cpm-ixr-e/imm24-sfp++8-sfp28+2-qsfp28",
3033:                  "cpm-ixr-e2",
3034:                  "cpm-ixr-e2c",
3035: +                "cpm-ixr-e2n-s/imm4-sfp+4-sfp+-s",
3036:                  "cpm-ixr-e2n/imm4-sfp+4-sfp+",
3037: +                "cpm-ixr-e2sc/imm16-sfp++4-sfp28",
3038: +                "cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd",
3039:                  "cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56",
3040:                  "cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd",
3041:                  "cpm-ixr-ec",
3042:                  "cpm-ixr-s/imm48-sfp++6-qsfp28",
3043:                  "cpm-ixr-x/imm32-qsfp28+4-qsfpdd",
3044: @@ -2077,10 +2083,11 @@
3045:              "type": "string",
3046:              "description": "CPM card types for SR OS",
3047:              "enum": [
3048:                  "cpiom-ixr-r6",
3049:                  "cpiom-ixr-r6d",
3050: +                "cpiom-sar-x",
3051:                  "cpm-1",
3052:                  "cpm-1s",
3053:                  "cpm-1se",
3054:                  "cpm-1se/imm36-800g-qsfpdd",
3055:                  "cpm-1x",
3056: @@ -2102,11 +2109,14 @@
3057:                  "cpm-ixr-e-gnss/imm24-sfp++8-sfp28+2-qsfp28",
3058:                  "cpm-ixr-e/imm14-10g-sfp++4-1g-tx",
3059:                  "cpm-ixr-e/imm24-sfp++8-sfp28+2-qsfp28",
3060:                  "cpm-ixr-e2",
3061:                  "cpm-ixr-e2c",
3062: +                "cpm-ixr-e2n-s/imm4-sfp+4-sfp+-s",
3063:                  "cpm-ixr-e2n/imm4-sfp+4-sfp+",
3064: +                "cpm-ixr-e2sc/imm16-sfp++4-sfp28",
3065: +                "cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd",
3066:                  "cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56",
3067:                  "cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd",
3068:                  "cpm-ixr-ec",
3069:                  "cpm-ixr-r4",
3070:                  "cpm-ixr-s",
3071: @@ -2122,11 +2132,12 @@
3072:                  "cpm-v/iom-v",
3073:                  "cpm-x20",
3074:                  "cpm2-s",
3075:                  "cpm2-x20",
3076:                  "cpm5",
3077: -                "iom-sar"
3078: +                "iom-sar",
3079: +                "iom-sar-1x"
3080:              ]
3081:          },
3082:          "sros-mda-types": {
3083:              "type": "string",
3084:              "description": "MDA types for SR OS",
3085: @@ -2153,10 +2164,11 @@
3086:                  "m10-sfp++6-sfp",
3087:                  "m12-sfp28+2-qsfp28",
3088:                  "m14-10g-sfp++4-1g-tx",
3089:                  "m18-25g-sfp28",
3090:                  "m2-100g-qsfp28+16-10g-sfp+",
3091: +                "m2-1g-sfp+2-10g-sfp+",
3092:                  "m2-cfp2",
3093:                  "m2-qsfpdd+2-qsfp28+24-sfp28",
3094:                  "m20-10g-sfp+",
3095:                  "m20-1g-csfp",
3096:                  "m20-v",
3097: @@ -2166,11 +2178,13 @@
3098:                  "m32-qsfp28+4-qsfpdd",
3099:                  "m36-100g-qsfp28",
3100:                  "m36-qsfpdd",
3101:                  "m4-100g-cfp4",
3102:                  "m4-10g-sfp++1-100g-cfp2",
3103: +                "m4-1g-rj+6-10g-sfp++2-25g-sfp28",
3104:                  "m4-1g-tx+20-1g-sfp+6-10g-sfp+",
3105: +                "m4-rs232-rj45+4-c3794-sfp",
3106:                  "m40-10g-sfp",
3107:                  "m40-10g-sfp-ptp",
3108:                  "m40-200g-sfpdd+6-800g-qsfpdd-1",
3109:                  "m46-10g-sfp+",
3110:                  "m48-400g-qsfpdd-1",
3111: @@ -2181,10 +2195,11 @@
3112:                  "m5e2-100g-qsfp28+2-800g-qdd",
3113:                  "m5e8-100g-sfp112+2-800g-qdd",
3114:                  "m6-10g-sfp++1-100g-qsfp28",
3115:                  "m6-10g-sfp++4-25g-sfp28",
3116:                  "m6-qsfpdd+48-sfp56",
3117: +                "m8-t1e1-rj48",
3118:                  "m80-1g-csfp",
3119:                  "m80-200g-sfpdd+12-400g-qsfpdd-1",
3120:                  "m80-200g-sfpdd+12-800g-qsfpdd-1x",
3121:                  "ma2-10gb-sfp+12-1gb-sfp",
3122:                  "ma20-1gb-tx",
3123: diff --git a/tests/13-srsim/01-sros-to-linux.robot b/tests/13-srsim/01-sros-to-linux.robot
3124: index c4d9cb2..8226dd7 100644
3125: --- a/tests/13-srsim/01-sros-to-linux.robot
3126: +++ b/tests/13-srsim/01-sros-to-linux.robot
3127: @@ -1,9 +1,10 @@
3128:  *** Settings ***
3129:  Library             OperatingSystem
3130:  Resource            ../ssh.robot
3131:  Resource            ../common.robot
3132: +Resource            ../srsim.robot
3133:  
3134:  Suite Teardown      Run Keyword    Cleanup
3135:  
3136:  
3137:  *** Variables ***
3138: @@ -21,15 +22,11 @@ Set key-path Variable
3139:  Create SSH keypair - RSA
3140:      ${rc}    ${output} =    Run And Return Rc And Output
3141:      ...    ssh-keygen -t rsa -N "" -f ${key-path}-rsa
3142:  
3143:  Deploy ${lab-name} lab
3144: -    Log    ${CURDIR}
3145: -    ${rc}    ${output} =    Run And Return Rc And Output
3146: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3147: -    Log    ${output}
3148: -    Should Be Equal As Integers    ${rc}    0
3149: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3150:  

(Output capped at 50 KB. Showing lines 1614-3150. Use offset=3151 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502db2f4001SyqVt31YGs6TC6",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502da7a9001g13xnqsXX4pQRr",
  "callID": "call_6f1718d49ab548c7abc85c3c",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/diff.txt",
      "offset": 1614
    },
    "output": "<path>/source/diff.txt</path>\n<type>file</type>\n<content>\n1614:  \t\"github.com/brunoga/deep\"\n1615:  \t\"github.com/charmbracelet/log\"\n1616:  \t\"github.com/scrapli/scrapligo/driver/netconf\"\n1617:  \t\"github.com/scrapli/scrapligo/driver/opoptions\"\n1618: -\t\"github.com/vishvananda/netns\"\n1619:  \n1620:  \t\"github.com/scrapli/scrapligo/response\"\n1621:  \n1622:  \tclabconstants \"github.com/srl-labs/containerlab/constants\"\n1623:  \tclabexec \"github.com/srl-labs/containerlab/exec\"\n1624: @@ -82,32 +78,16 @@ const (\n1625:  \tenvNokiaSrosMDA           = \"NOKIA_SROS_MDA\"\n1626:  \tenvSrosIPv4Active         = \"NOKIA_SROS_ADDRESS_IPV4_ACTIVE\"\n1627:  \tenvSrosIPv6Active         = \"NOKIA_SROS_ADDRESS_IPV6_ACTIVE\"\n1628:  \tenvSrosStaticRoutePrefix  = \"NOKIA_SROS_STATIC_ROUTE_\"\n1629:  \n1630: -\tdefaultSrosPowerType       = \"dc\"\n1631: -\tdefaultSrosPowerModuleType = \"ps-a-dc-6000\"\n1632: -\n1633:  \tsrosMinorError     = \"MINOR:\"\n1634:  \tsrosCriticalError  = \"CRITICAL:\"\n1635:  \tsrosRejectedCfgMsg = \"Configuration load failed - using default configuration\"\n1636:  )\n1637:  \n1638:  var (\n1639: -\n1640: -\t//go:embed configs/sros_config_sros25.go.tpl\n1641: -\tcfgTplSROS25 string\n1642: -\n1643: -\t//go:embed configs/sros_config_classic.go.tpl\n1644: -\tcfgTplClassic string\n1645: -\n1646: -\t//go:embed configs/ixr/ixr_config_classic.go.tpl\n1647: -\tcfgTplClassicIxr string\n1648: -\n1649: -\t//go:embed configs/sar/sar_config_classic.go.tpl\n1650: -\tcfgTplClassicSar string\n1651: -\n1652:  \tkindNames  = []string{\"nokia_srsim\"}\n1653:  \tsrosSysctl = map[string]string{\n1654:  \t\t\"net.ipv4.ip_forward\":                \"0\",\n1655:  \t\t\"net.ipv6.conf.all.disable_ipv6\":     \"0\",\n1656:  \t\t\"net.ipv6.conf.default.disable_ipv6\": \"0\",\n1657: @@ -160,15 +140,10 @@ var (\n1658:        e1-2-3       -> card 1, mda 2, port 3\n1659:        e1-2-c3-4    -> card 1, mda 2, connector 3, port 4\n1660:        e1-x2-3-4    -> card 1, xiom 2, mda 3, port 4\n1661:        e1-x2-3-c4-5 -> card 1, xiom 2, mda 3, connector 4, port 5\n1662:  \t  eth[0-9], for management interfaces of CPM-A/CPM-B or for fabric interfaces`\n1663: -\t// Auxiliary regexps for IXR/SAR detection.\n1664: -\tsarRegexp   = regexp.MustCompile(`(?i)\\bsar-`)\n1665: -\tsarHmRegexp = regexp.MustCompile(`(?i)\\b(sar-hm|sar-hmc)\\b`)\n1666: -\n1667: -\tixrRegexp = regexp.MustCompile(`(?i)\\bixr-`)\n1668:  )\n1669:  \n1670:  // Register registers the node in the NodeRegistry.\n1671:  func Register(r *clabnodes.NodeRegistry) {\n1672:  \tgenerateNodeAttributes := clabnodes.NewGenerateNodeAttributes(generateable, generateIfFormat)\n1673: @@ -241,10 +216,14 @@ type sros struct {\n1674:  \t// rootCtrName is the container that owns the netns.\n1675:  \t//  - for components based: the internal netns container.\n1676:  \t//  - for network mode based: parsed from network-mode.\n1677:  \trootCtrName string\n1678:  \n1679: +\t// userEnv is the env map from the topology, before component fields are merged in.\n1680: +\t// Node env overrides component type, XIOM, MDA, SFM, and per-component env.\n1681: +\tuserEnv map[string]string\n1682: +\n1683:  \tpreDeployParams *clabnodes.PreDeployParams\n1684:  \n1685:  \tnetnsNode clabnodes.Node\n1686:  }\n1687:  \n1688: @@ -279,16 +258,44 @@ func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) err\n1689:  \t// if user was not initialized to a value, use root\n1690:  \tif n.Cfg.User == \"\" {\n1691:  \t\tn.Cfg.User = \"0:0\"\n1692:  \t}\n1693:  \n1694: -\tif sfm := n.kindSpecificCfg().SFM; sfm != \"\" {\n1695: +\t// Snapshot topology env before component and SFM flags are applied.\n1696: +\t// Component nodes set userEnv from the base node before Init.\n1697: +\tenvAlreadyResolved := n.userEnv != nil\n1698: +\tif !envAlreadyResolved {\n1699:  \t\tif n.Cfg.Env == nil {\n1700: -\t\t\tn.Cfg.Env = map[string]string{}\n1701: +\t\t\tn.userEnv = map[string]string{}\n1702: +\t\t} else {\n1703: +\t\t\tn.userEnv = maps.Clone(n.Cfg.Env)\n1704:  \t\t}\n1705: +\t}\n1706: +\tif n.Cfg.Env == nil {\n1707: +\t\tn.Cfg.Env = map[string]string{}\n1708: +\t}\n1709:  \n1710: -\t\tn.Cfg.Env[envNokiaSrosSFM] = sfm\n1711: +\t// Distributed cards inherit SFM from the base node env. Applying it again\n1712: +\t// would warn once per card when the user also set NOKIA_SROS_SFM.\n1713: +\tif sfm := n.kindSpecificCfg().SFM; sfm != \"\" && !envAlreadyResolved {\n1714: +\t\tif envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {\n1715: +\t\t\tif envSFM != sfm {\n1716: +\t\t\t\tlog.Warn(\n1717: +\t\t\t\t\tfmt.Sprintf(\n1718: +\t\t\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n1719: +\t\t\t\t\t\tsfm,\n1720: +\t\t\t\t\t\tenvNokiaSrosSFM,\n1721: +\t\t\t\t\t),\n1722: +\t\t\t\t\t\"node\", n.Cfg.ShortName,\n1723: +\t\t\t\t\t\"env\", envNokiaSrosSFM,\n1724: +\t\t\t\t\t\"component-value\", sfm,\n1725: +\t\t\t\t\t\"env-value\", envSFM,\n1726: +\t\t\t\t)\n1727: +\t\t\t}\n1728: +\t\t} else {\n1729: +\t\t\tn.Cfg.Env[envNokiaSrosSFM] = sfm\n1730: +\t\t}\n1731:  \t}\n1732:  \n1733:  \tmaps.Copy(n.Cfg.Sysctls, srosSysctl)\n1734:  \n1735:  \t// make sure we always have uppercase slot definition\n1736: @@ -316,10 +323,11 @@ func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) err\n1737:  \n1738:  \t\tvars, err := n.setupStandaloneComponents()\n1739:  \t\tif err != nil {\n1740:  \t\t\treturn err\n1741:  \t\t}\n1742: +\t\twarnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)\n1743:  \n1744:  \t\t// n.Cfg.Env overrides component vars, overrides default srosEnv\n1745:  \t\tn.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)\n1746:  \t\tlog.Debug(\"Merged env file\", \"env\", fmt.Sprintf(\"%+v\", n.Cfg.Env), \"node\", n.Cfg.ShortName)\n1747:  \t} else {\n1748: @@ -348,12 +356,15 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {\n1749:  \tif len(n.kindSpecificCfg().Components) == 0 {\n1750:  \t\treturn nil, nil\n1751:  \t}\n1752:  \tif len(n.kindSpecificCfg().Components) > 1 {\n1753:  \t\treturn nil, fmt.Errorf(\n1754: -\t\t\t\"expected at most one component override for standalone SR-SIM node %q\",\n1755: +\t\t\t\"expected at most one component override for standalone SR-SIM node %q, \"+\n1756: +\t\t\t\t\"or one component per slot %s for redundant type %q\",\n1757:  \t\t\tn.Cfg.ShortName,\n1758: +\t\t\tstrings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), \"/\"),\n1759: +\t\t\tn.Cfg.NodeType,\n1760:  \t\t)\n1761:  \t}\n1762:  \n1763:  \tslotA := n.kindSpecificCfg().Components[0]\n1764:  \n1765: @@ -370,27 +381,11 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {\n1766:  \t\t\tn.Cfg.ShortName,\n1767:  \t\t)\n1768:  \t}\n1769:  \tvars[envNokiaSrosSlot] = slotName\n1770:  \n1771: -\tif slotA.Type != \"\" {\n1772: -\t\tif isSingleSlotIntegratedSrosNodeType(n.Cfg.NodeType) {\n1773: -\t\t\treturn nil, fmt.Errorf(\n1774: -\t\t\t\t\"node %q type %q is integrated and does not support component card-type override\",\n1775: -\t\t\t\tn.Cfg.ShortName,\n1776: -\t\t\t\tn.Cfg.NodeType,\n1777: -\t\t\t)\n1778: -\t\t}\n1779: -\t\tvars[envNokiaSrosCard] = slotA.Type\n1780: -\t}\n1781: -\n1782: -\tif len(slotA.MDA) > 0 {\n1783: -\t\tfor _, m := range slotA.MDA {\n1784: -\t\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n1785: -\t\t\tvars[key] = m.Type\n1786: -\t\t}\n1787: -\t}\n1788: +\tsetComponentEnvVars(vars, slotA)\n1789:  \n1790:  \tmaps.Copy(vars, slotA.Env)\n1791:  \n1792:  \treturn vars, nil\n1793:  }\n1794: @@ -625,39 +620,10 @@ func (n *sros) Delete(ctx context.Context) error {\n1795:  \terrs = append(errs, n.DefaultNode.Delete(ctx), n.netnsNode.Delete(ctx))\n1796:  \n1797:  \treturn errors.Join(errs...)\n1798:  }\n1799:  \n1800: -// DeleteNetnsSymlink deletes the symlink file created for the container netns.\n1801: -func (n *sros) DeleteNetnsSymlink() error {\n1802: -\tvar errs []error\n1803: -\n1804: -\t// if it is the base node, then we need to delete the symlink for all the components.\n1805: -\tif n.isDistributedBaseNode() {\n1806: -\t\tfor _, componentNode := range n.componentNodes {\n1807: -\t\t\terrs = append(errs, componentNode.DeleteNetnsSymlink())\n1808: -\t\t}\n1809: -\t\tif n.netnsNode != nil {\n1810: -\t\t\terrs = append(errs, n.netnsNode.DeleteNetnsSymlink())\n1811: -\t\t}\n1812: -\t\terrs = append(errs, clabutils.DeleteNetnsSymlink(n.Cfg.LongName))\n1813: -\t}\n1814: -\n1815: -\terrs = append(errs, n.DefaultNode.DeleteNetnsSymlink(), n.cleanupParkingNetNS())\n1816: -\n1817: -\treturn errors.Join(errs...)\n1818: -}\n1819: -\n1820: -func (n *sros) cleanupParkingNetNS() error {\n1821: -\tname := clabutils.ParkingNetnsName(n.Cfg.LongName)\n1822: -\tif _, err := clabutils.GetNamedNetNS(name); err != nil {\n1823: -\t\treturn nil\n1824: -\t}\n1825: -\n1826: -\treturn netns.DeleteNamed(name)\n1827: -}\n1828: -\n1829:  func (n *sros) setupComponentNodes() error {\n1830:  \tif !n.isDistributedBaseNode() {\n1831:  \t\treturn nil\n1832:  \t}\n1833:  \n1834: @@ -693,17 +659,16 @@ func (n *sros) setupComponentNodes() error {\n1835:  \t\tcomponentConfig.Fqdn = n.calcComponentFqdn(c.Slot)\n1836:  \t\tcomponentConfig.DNS = nil\n1837:  \t\tcomponentConfig.PortBindings = nil\n1838:  \t\tcomponentConfig.PortSet = nil\n1839:  \n1840: -\t\t// add the component env to the componentConfig env\n1841: -\t\tfor k, v := range c.Env {\n1842: -\t\t\tcomponentConfig.Env[k] = v\n1843: +\t\t// Component fields fill env keys the user did not set. Node env wins.\n1844: +\t\tif componentConfig.Env == nil {\n1845: +\t\t\tcomponentConfig.Env = map[string]string{}\n1846:  \t\t}\n1847: -\n1848: -\t\t// set component environment variables\n1849: -\t\tn.setComponentEnvVars(componentConfig, c)\n1850: +\t\tkeepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)\n1851: +\t\t// Slot identifies this container. A node-level NOKIA_SROS_SLOT cannot apply to every card.\n1852:  \t\tcomponentConfig.Env[envNokiaSrosSlot] = c.Slot\n1853:  \n1854:  \t\t// adjust label based env vars\n1855:  \t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.NodeName)] = componentConfig.ShortName\n1856:  \t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.LongName)] = componentConfig.LongName\n1857: @@ -716,10 +681,14 @@ func (n *sros) setupComponentNodes() error {\n1858:  \t\tcomponentConfig.Labels[clabconstants.NodeName] = componentConfig.ShortName\n1859:  \t\tcomponentConfig.Labels[clabconstants.LongName] = componentConfig.LongName\n1860:  \t\tcomponentConfig.Labels[clabconstants.RootNodeName] = n.Cfg.ShortName\n1861:  \t\tcomponentConfig.Labels[clabconstants.RootNodeLongName] = n.Cfg.LongName\n1862:  \n1863: +\t\t// Preserve the topology env. Init must not snapshot the merged component env,\n1864: +\t\t// or config generation would treat component flags as user overrides.\n1865: +\t\tsrosNode.userEnv = maps.Clone(n.userEnv)\n1866: +\n1867:  \t\t// init the component\n1868:  \t\terr = componentNode.Init(componentConfig)\n1869:  \t\tif err != nil {\n1870:  \t\t\treturn err\n1871:  \t\t}\n1872: @@ -737,32 +706,10 @@ func (n *sros) setupComponentNodes() error {\n1873:  \t\tn.componentNodes = append(n.componentNodes, componentNode)\n1874:  \t}\n1875:  \treturn nil\n1876:  }\n1877:  \n1878: -// setComponentEnvVars sets environment variables for a component.\n1879: -func (n *sros) setComponentEnvVars(componentConfig *clabtypes.NodeConfig, c *Component) {\n1880: -\tif c.Type != \"\" {\n1881: -\t\tcomponentConfig.Env[envNokiaSrosCard] = c.Type\n1882: -\t}\n1883: -\n1884: -\tfor _, x := range c.XIOM {\n1885: -\t\tkey := fmt.Sprintf(\"%s_X%d\", envNokiaSrosXIOM, x.Slot)\n1886: -\t\tcomponentConfig.Env[key] = x.Type\n1887: -\t\t// add the nested MDA\n1888: -\t\tfor _, m := range x.MDA {\n1889: -\t\t\tkey := fmt.Sprintf(\"%s_X%d_%d\", envNokiaSrosMDA, x.Slot, m.Slot)\n1890: -\t\t\tcomponentConfig.Env[key] = m.Type\n1891: -\t\t}\n1892: -\t}\n1893: -\n1894: -\tfor _, m := range c.MDA {\n1895: -\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n1896: -\t\tcomponentConfig.Env[key] = m.Type\n1897: -\t}\n1898: -}\n1899: -\n1900:  // deployFabric deploys the distributed SR-SIM when the `components` key is present.\n1901:  func (n *sros) deployFabric(ctx context.Context, deployParams *clabnodes.DeployParams) error {\n1902:  \tnetnsConfig := n.netnsNode.Config()\n1903:  \n1904:  \tnetnsConfig.MgmtIPv4Address = n.Cfg.MgmtIPv4Address\n1905: @@ -870,30 +817,20 @@ func (n *sros) isDistributedCardNode() bool {\n1906:  \n1907:  // isDistributedBaseNode returns true if this is the base node of a distributed\n1908:  // SR-SIM deployment. The base node orchestrates multiple component nodes.\n1909:  func (n *sros) isDistributedBaseNode() bool {\n1910:  \tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n1911: -\t\treturn false\n1912: +\t\treturn isRedundantIntegratedSrosComponents(n.Cfg.NodeType, n.kindSpecificCfg().Components)\n1913:  \t}\n1914:  \treturn len(n.kindSpecificCfg().Components) > 1\n1915:  }\n1916:  \n1917:  // isStandaloneNode returns true if this is a standalone (non-distributed) SR-SIM node.\n1918:  func (n *sros) isStandaloneNode() bool {\n1919:  \treturn !n.isDistributedBaseNode() && !n.isDistributedCardNode()\n1920:  }\n1921:  \n1922: -// GetNSPath retrieves the Namespace Path.\n1923: -func (n *sros) GetNSPath(ctx context.Context) (string, error) {\n1924: -\tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == \"\") {\n1925: -\t\treturn n.DefaultNode.GetNSPath(ctx)\n1926: -\t} else if n.isDistributedCardNode() {\n1927: -\t\treturn n.Runtime.GetNSPath(ctx, n.rootCtrName)\n1928: -\t}\n1929: -\treturn n.netnsNode.GetNSPath(ctx)\n1930: -}\n1931: -\n1932:  // calcComponentName appends the line card suffix to the given node name.\n1933:  func (n *sros) calcComponentName(name, slot string) string {\n1934:  \tif n.renameDone {\n1935:  \t\treturn name\n1936:  \t}\n1937: @@ -934,19 +871,18 @@ func (n *sros) cpmNode() (clabnodes.Node, error) {\n1938:  }\n1939:  \n1940:  // cpmSlot returns the Slot of the preferred CPM Node (used when Distributed mode).\n1941:  // It prefers slot A if present, otherwise returns slot B.\n1942:  func (n *sros) cpmSlot() (string, error) {\n1943: -\t// Prefer slot A, fall back to slot B\n1944: +\t// Prefer slot A, fall back to slot B. Slots are accepted in either case.\n1945:  \tfor _, comp := range n.kindSpecificCfg().Components {\n1946: -\t\tif comp.Slot == slotAName {\n1947: +\t\tif strings.EqualFold(comp.Slot, slotAName) {\n1948:  \t\t\treturn slotAName, nil\n1949:  \t\t}\n1950:  \t}\n1951: -\t// Check for slot B as fallback\n1952:  \tfor _, comp := range n.kindSpecificCfg().Components {\n1953: -\t\tif comp.Slot == slotBName {\n1954: +\t\tif strings.EqualFold(comp.Slot, slotBName) {\n1955:  \t\t\treturn slotBName, nil\n1956:  \t\t}\n1957:  \t}\n1958:  \treturn \"\", fmt.Errorf(\"node %s: unable to determine default slot\", n.GetShortName())\n1959:  }\n1960: @@ -1041,33 +977,10 @@ func (*sros) checkKernelVersion() error {\n1961:  \t\t)\n1962:  \t}\n1963:  \treturn nil\n1964:  }\n1965:  \n1966: -// checkComponentSlotsConfig check the sros component slot config for validity.\n1967: -func (n *sros) checkComponentSlotsConfig() error {\n1968: -\t// check Slots are unique\n1969: -\tcomponentNames := map[string]struct{}{}\n1970: -\tfor _, component := range n.kindSpecificCfg().Components {\n1971: -\t\t// convert slot to upper\n1972: -\t\tslot := strings.ToUpper(component.Slot)\n1973: -\t\t// check if slot exists\n1974: -\t\t_, exists := componentNames[slot]\n1975: -\t\tif exists {\n1976: -\t\t\treturn fmt.Errorf(\n1977: -\t\t\t\t\"node %s slot %s duplicate definition\",\n1978: -\t\t\t\tn.GetShortName(),\n1979: -\t\t\t\tcomponent.Slot,\n1980: -\t\t\t)\n1981: -\t\t}\n1982: -\t\t// add to component names map\n1983: -\t\tcomponentNames[component.Slot] = struct{}{}\n1984: -\n1985: -\t}\n1986: -\treturn nil\n1987: -}\n1988: -\n1989:  func (n *sros) CheckDeploymentConditions(ctx context.Context) error {\n1990:  \t// perform the sros specific kernel version check\n1991:  \terr := n.checkKernelVersion()\n1992:  \tif err != nil {\n1993:  \t\treturn err\n1994: @@ -1148,13 +1061,53 @@ func (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {\n1995:  \tlicensed := append([]byte(chassisInfoFileLicense), content...)\n1996:  \tif err := os.WriteFile(dstPath, licensed, clabconstants.PermissionsFileDefault); err != nil {\n1997:  \t\treturn fmt.Errorf(\"write %s: %w\", dstPath, err)\n1998:  \t}\n1999:  \tlog.Debug(\"Wrote chassis_info.json to lab dir\", \"node\", n.Cfg.ShortName, \"path\", dstPath)\n2000: +\tn.warnUnsupportedComponents(content)\n2001:  \treturn nil\n2002:  }\n2003:  \n2004: +// warnUnsupportedComponents validates the effective component configuration against the\n2005: +// chassis_info.json extracted from this exact image. Validation is advisory and never blocks\n2006: +// deploy.\n2007: +func (n *sros) warnUnsupportedComponents(content []byte) {\n2008: +\t// A distributed node validates once, from CPM A, to avoid duplicate warnings from CPM B.\n2009: +\tif !n.isStandaloneNode() && !n.isCPM(slotAName) {\n2010: +\t\treturn\n2011: +\t}\n2012: +\n2013: +\tinfo, err := parseChassisInfo(content)\n2014: +\tif err != nil {\n2015: +\t\tlog.Warn(\"Could not validate SR-SIM components against chassis_info.json\",\n2016: +\t\t\t\"node\", n.Cfg.ShortName, \"error\", err)\n2017: +\t\treturn\n2018: +\t}\n2019: +\n2020: +\tcomponents := n.rootComponents\n2021: +\tif len(components) == 0 {\n2022: +\t\tcomponents = n.kindSpecificCfg().Components\n2023: +\t}\n2024: +\n2025: +\teffective := n.componentsForConfig(components)\n2026: +\tif len(effective) == 0 {\n2027: +\t\t// Environment variables can configure integrated hardware without a components entry.\n2028: +\t\teffective = []*Component{n.componentForConfig(nil)}\n2029: +\t}\n2030: +\n2031: +\tnodeType := n.Cfg.NodeType\n2032: +\tif chassis := strings.TrimSpace(n.Cfg.Env[envNokiaSrosChassis]); chassis != \"\" {\n2033: +\t\tnodeType = chassis\n2034: +\t}\n2035: +\tfor _, warning := range info.componentWarnings(nodeType, n.componentSFM(), effective) {\n2036: +\t\tlog.Warn(\"SR-SIM component configuration may not be supported\",\n2037: +\t\t\t\"node\", n.Cfg.ShortName,\n2038: +\t\t\t\"chassis\", nodeType,\n2039: +\t\t\t\"warning\", warning)\n2040: +\t}\n2041: +}\n2042: +\n2043:  // Func that Places the Certificates in the right place and format.\n2044:  func (n *sros) createSROSCertificates() error {\n2045:  \tif *n.Cfg.Certificate.Issue {\n2046:  \t\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),\n2047:  \t\t\tclabconstants.PermissionsOpen)\n2048: @@ -1170,88 +1123,10 @@ func (n *sros) createSROSCertificates() error {\n2049:  \t\t}\n2050:  \t}\n2051:  \treturn nil\n2052:  }\n2053:  \n2054: -// createSROSConfigFiles handles config generation for the SR-SIM kind.\n2055: -// Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).\n2056: -func (n *sros) createSROSConfigFiles() error {\n2057: -\t// Get version from image before generating config\n2058: -\tif n.swVersion == nil {\n2059: -\t\tctx := context.Background()\n2060: -\t\tversion, err := n.srosVersionFromImage(ctx)\n2061: -\t\tif err != nil {\n2062: -\t\t\tn.swVersion = n.parseVersionString(srosDefaultVersion)\n2063: -\t\t\tlog.Warn(\"Failed to get SR OS version from image\",\n2064: -\t\t\t\t\"node\", n.Cfg.ShortName, \"version\", n.swVersion, \"error\", err)\n2065: -\t\t} else {\n2066: -\t\t\tn.swVersion = version\n2067: -\t\t\tlog.Info(\"Retrieved SR OS version from image\",\n2068: -\t\t\t\t\"node\", n.Cfg.ShortName,\n2069: -\t\t\t\t\"version\", fmt.Sprintf(\"%s.%s.%s\", version.Major, version.Minor, version.Build))\n2070: -\t\t}\n2071: -\t}\n2072: -\n2073: -\t// Path pointing to the target config file under configCf3 dir\n2074: -\tcf3CfgFile := filepath.Join(\n2075: -\t\tn.Cfg.LabDir,\n2076: -\t\tn.Cfg.Env[envNokiaSrosSlot],\n2077: -\t\tconfigCf3,\n2078: -\t\tstartupCfgName,\n2079: -\t)\n2080: -\tisPartial := clabutils.IsPartialConfigFile(n.Cfg.StartupConfig)\n2081: -\n2082: -\t// generate config and use that to boot node\n2083: -\tlog.Debug(\"Reading startup-config\", \"node\", n.Cfg.ShortName, \"startup-config\",\n2084: -\t\tn.Cfg.StartupConfig, \"isPartial\", isPartial)\n2085: -\n2086: -\tstartupConfig, err := n.buildStartupConfig(isPartial)\n2087: -\tif err != nil {\n2088: -\t\treturn err\n2089: -\t}\n2090: -\n2091: -\tif startupConfig == \"\" {\n2092: -\t\tlog.Debug(\n2093: -\t\t\t\"startup config is empty, skipping startup config file generation\",\n2094: -\t\t\t\"node\",\n2095: -\t\t\tn.Cfg.ShortName,\n2096: -\t\t)\n2097: -\t\treturn nil\n2098: -\t}\n2099: -\n2100: -\treturn n.GenerateConfig(cf3CfgFile, startupConfig)\n2101: -}\n2102: -\n2103: -// buildStartupConfig returns the full startup config string: either from user file (full config)\n2104: -// or from default + partial config generation. It does not return a template; the name is\n2105: -// historical.\n2106: -func (n *sros) buildStartupConfig(isPartial bool) (string, error) {\n2107: -\t// User provides full startup config\n2108: -\tif n.Cfg.StartupConfig != \"\" && !isPartial {\n2109: -\t\tc, err := os.ReadFile(n.Cfg.StartupConfig)\n2110: -\t\tif err != nil {\n2111: -\t\t\treturn \"\", err\n2112: -\t\t}\n2113: -\n2114: -\t\tcBuf, err := clabutils.SubstituteEnvsAndTemplate(bytes.NewReader(c), n.Cfg)\n2115: -\t\tif err != nil {\n2116: -\t\t\treturn \"\", err\n2117: -\t\t}\n2118: -\t\treturn cBuf.String(), nil\n2119: -\t}\n2120: -\n2121: -\t// Generate default config and optionally add partial config\n2122: -\tif err := n.addDefaultConfig(); err != nil {\n2123: -\t\treturn \"\", err\n2124: -\t}\n2125: -\tif err := n.addPartialConfig(); err != nil {\n2126: -\t\treturn \"\", err\n2127: -\t}\n2128: -\n2129: -\treturn string(n.startupCliCfg), nil\n2130: -}\n2131: -\n2132:  // SlotIsInteger checks if the slot string represents a valid integer.\n2133:  func SlotIsInteger(s string) bool {\n2134:  \t_, err := strconv.Atoi(s)\n2135:  \treturn err == nil\n2136:  }\n2137: @@ -1279,221 +1154,10 @@ func (n *sros) isCPM(cpm string) bool {\n2138:  \t}\n2139:  \n2140:  \treturn true\n2141:  }\n2142:  \n2143: -// prepareConfigTemplateData prepares all data needed for template selection and execution.\n2144: -// Service configs are filled from a single table-driven result: variant → getFullSnippetSet(v).\n2145: -func (n *sros) prepareConfigTemplateData() (*srosTemplateData, error) {\n2146: -\tb, err := n.banner()\n2147: -\tif err != nil {\n2148: -\t\treturn nil, err\n2149: -\t}\n2150: -\n2151: -\tcomponentConfig := \"\"\n2152: -\tif !isFullConfigFile(n.Cfg.StartupConfig) {\n2153: -\t\tcomponentConfig = n.generateComponentConfig()\n2154: -\t} else {\n2155: -\t\tlog.Debugf(\n2156: -\t\t\t\"SR-SIM node %q has non-partial startup-config defined, skipping component config gen\",\n2157: -\t\t\tn.Cfg.LongName,\n2158: -\t\t)\n2159: -\t}\n2160: -\n2161: -\tv := n.resolveConfigVariant()\n2162: -\tsnippets := getFullSnippetSet(v)\n2163: -\tconfigMode := string(v.Mode)\n2164: -\tif v.ForceClassic {\n2165: -\t\tlog.Warn(\n2166: -\t\t\t\"SAR-Hm nodes only support classic configuration mode. Overriding configuration mode to 'classic'\",\n2167: -\t\t\t\"node\",\n2168: -\t\t\tn.Cfg.LongName,\n2169: -\t\t\t\"node-type\",\n2170: -\t\t\tstrings.ToLower(n.Cfg.NodeType),\n2171: -\t\t)\n2172: -\t\tconfigMode = string(ConfigModeClassic)\n2173: -\t\tn.kindSpecificCfg().ConfigMode = ConfigModeClassic\n2174: -\t}\n2175: -\n2176: -\ttplData := &srosTemplateData{\n2177: -\t\t// Selection criteria\n2178: -\t\tNodeType:          strings.ToLower(n.Cfg.NodeType),\n2179: -\t\tConfigurationMode: configMode,\n2180: -\t\tSwVersion:         n.swVersion,\n2181: -\t\tIsSecureGrpc:      *n.Cfg.Certificate.Issue,\n2182: -\n2183: -\t\t// Node data\n2184: -\t\tName:            n.Cfg.ShortName,\n2185: -\t\tTLSKey:          n.Cfg.TLSKey,\n2186: -\t\tTLSCert:         n.Cfg.TLSCert,\n2187: -\t\tTLSAnchor:       n.Cfg.TLSAnchor,\n2188: -\t\tBanner:          b,\n2189: -\t\tIFaces:          map[string]tplIFace{},\n2190: -\t\tMgmtMTU:         0,\n2191: -\t\tMgmtIPMTU:       n.Runtime.Mgmt().MTU,\n2192: -\t\tComponentConfig: componentConfig,\n2193: -\n2194: -\t\t// Service configs from variant (single source of truth)\n2195: -\t\tSystemConfig:  snippets.SystemConfig,\n2196: -\t\tGRPCConfig:    snippets.GRPCConfig,\n2197: -\t\tSNMPConfig:    snippets.SNMPConfig,\n2198: -\t\tNetconfConfig: snippets.NetconfConfig,\n2199: -\t\tLoggingConfig: snippets.LoggingConfig,\n2200: -\t\tSSHConfig:     snippets.SSHConfig,\n2201: -\t}\n2202: -\n2203: -\tif n.Config().DNS != nil {\n2204: -\t\ttplData.DNSServers = append(tplData.DNSServers, n.Config().DNS.Servers...)\n2205: -\t}\n2206: -\n2207: -\tn.prepareSSHPubKeys(tplData)\n2208: -\n2209: -\tn.setVersionSpecificParams(tplData)\n2210: -\n2211: -\treturn tplData, nil\n2212: -}\n2213: -\n2214: -// isIXRNode returns true if this is an IXR node type (case-insensitive).\n2215: -func (n *sros) isIXRNode() bool {\n2216: -\treturn ixrRegexp.MatchString(n.Cfg.NodeType)\n2217: -}\n2218: -\n2219: -// isSARNode returns true if this is a SAR node type (case-insensitive).\n2220: -func (n *sros) isSARNode() bool {\n2221: -\treturn sarRegexp.MatchString(n.Cfg.NodeType)\n2222: -}\n2223: -\n2224: -// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).\n2225: -func (n *sros) isSARHmNode() bool {\n2226: -\treturn sarHmRegexp.MatchString(n.Cfg.NodeType)\n2227: -}\n2228: -\n2229: -// getTemplateForVariant returns the template string and name for the given config variant.\n2230: -// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= \"26\").\n2231: -func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {\n2232: -\t// Model-driven (or mixed treated as classic below when family is classic)\n2233: -\tif v.Mode == ConfigModeModelDriven {\n2234: -\t\t// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= \"26\"\n2235: -\t\t// { return cfgTplSROS26, \"clab-sros-config-sros26\" }\n2236: -\t\treturn cfgTplSROS25, \"clab-sros-config-sros25\"\n2237: -\t}\n2238: -\t// Classic (or mixed)\n2239: -\ttmpl = cfgTplClassic\n2240: -\ttplName = \"clab-sros-config-classic\"\n2241: -\tswitch v.Family {\n2242: -\tcase ConfigFamilyIXR:\n2243: -\t\treturn cfgTplClassicIxr, \"clab-sros-config-classic-ixr\"\n2244: -\tcase ConfigFamilySAR:\n2245: -\t\treturn cfgTplClassicSar, \"clab-sros-config-classic-sar\"\n2246: -\tdefault:\n2247: -\t\treturn tmpl, tplName\n2248: -\t}\n2249: -}\n2250: -\n2251: -// selectConfigTemplate chooses the config template from the config variant (mode + family).\n2252: -func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {\n2253: -\tv := n.resolveConfigVariant()\n2254: -\ttmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)\n2255: -\treturn template.New(tplName).\n2256: -\t\tFuncs(clabutils.CreateFuncs()).\n2257: -\t\tParse(tmpl)\n2258: -}\n2259: -\n2260: -// addDefaultConfig adds sros default configuration such as tls certs, gnmi/json-rpc, login-banner,\n2261: -// ssh keys.\n2262: -func (n *sros) addDefaultConfig() error {\n2263: -\t// Prepare all template data\n2264: -\ttplData, err := n.prepareConfigTemplateData()\n2265: -\tif err != nil {\n2266: -\t\treturn err\n2267: -\t}\n2268: -\n2269: -\t// Select appropriate template\n2270: -\tsrosCfgTpl, err := n.selectConfigTemplate(tplData)\n2271: -\tif err != nil {\n2272: -\t\treturn fmt.Errorf(\"failed to select config template: %w\", err)\n2273: -\t}\n2274: -\tlog.Debug(\"Prepare SR OS config template\", \"template\", srosCfgTpl.Name(),\n2275: -\t\t\"node\", n.Cfg.LongName,\n2276: -\t\t\"configuration-mode\", tplData.ConfigurationMode,\n2277: -\t\t\"node-type\", tplData.NodeType,\n2278: -\t\t\"secure-grpc\", tplData.IsSecureGrpc,\n2279: -\t\t\"sw-version\", tplData.SwVersion)\n2280: -\n2281: -\t// Execute template\n2282: -\tbuf := new(bytes.Buffer)\n2283: -\terr = srosCfgTpl.Execute(buf, tplData)\n2284: -\tif err != nil {\n2285: -\t\treturn err\n2286: -\t}\n2287: -\n2288: -\tif buf.Len() == 0 {\n2289: -\t\tlog.Warn(\n2290: -\t\t\t\"Buffer empty, template parsing error\",\n2291: -\t\t\t\"node\", n.Cfg.ShortName,\n2292: -\t\t\t\"template\", srosCfgTpl.Name(),\n2293: -\t\t)\n2294: -\t} else {\n2295: -\t\tlog.Debug(\"Additional default config parsed\",\n2296: -\t\t\t\"node\", n.Cfg.ShortName,\n2297: -\t\t\t\"template\", srosCfgTpl.Name())\n2298: -\t\tn.startupCliCfg = append(n.startupCliCfg, buf.String()...)\n2299: -\t}\n2300: -\n2301: -\treturn nil\n2302: -}\n2303: -\n2304: -// applyPartialConfig applies partial configuration to the SR OS.\n2305: -func (n *sros) addPartialConfig() error {\n2306: -\tif n.Cfg.StartupConfig != \"\" {\n2307: -\t\t// b holds the configuration to be applied to the node\n2308: -\t\tb := &bytes.Buffer{}\n2309: -\t\t// apply partial configs if partial config is used\n2310: -\t\tif clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM(\"\") {\n2311: -\t\t\tlog.Info(\"Adding configuration\",\n2312: -\t\t\t\t\"node\", n.Cfg.LongName,\n2313: -\t\t\t\t\"type\", \"partial\",\n2314: -\t\t\t\t\"source\", n.Cfg.StartupConfig)\n2315: -\n2316: -\t\t\tr, err := os.Open(n.Cfg.StartupConfig)\n2317: -\t\t\tif err != nil {\n2318: -\t\t\t\treturn err\n2319: -\t\t\t}\n2320: -\n2321: -\t\t\tdefer r.Close() // skipcq: GO-S2307\n2322: -\n2323: -\t\t\t_, err = io.Copy(b, r)\n2324: -\t\t\tif err != nil {\n2325: -\t\t\t\treturn err\n2326: -\t\t\t}\n2327: -\n2328: -\t\t\tconfigContent, err := clabutils.SubstituteEnvsAndTemplate(b, n.Cfg)\n2329: -\t\t\tif err != nil {\n2330: -\t\t\t\treturn err\n2331: -\t\t\t}\n2332: -\t\t\tif configContent.Len() == 0 {\n2333: -\t\t\t\tlog.Warn(\n2334: -\t\t\t\t\t\"Buffer empty, PARTIAL config template parsing error\",\n2335: -\t\t\t\t\t\"node\",\n2336: -\t\t\t\t\tn.Cfg.ShortName,\n2337: -\t\t\t\t)\n2338: -\t\t\t} else {\n2339: -\t\t\t\tlog.Debug(\"Additional PARTIAL config parsed\", \"node\",\n2340: -\t\t\t\t\tn.Cfg.ShortName, \"partial-config\", configContent.String())\n2341: -\t\t\t\tn.startupCliCfg = append(n.startupCliCfg, configContent.String()...)\n2342: -\t\t\t}\n2343: -\t\t} else {\n2344: -\t\t\tlog.Warn(\n2345: -\t\t\t\t\"Passed startup-config option, but it will not have any effect\",\n2346: -\t\t\t\t\"node\",\n2347: -\t\t\t\tn.Cfg.ShortName,\n2348: -\t\t\t)\n2349: -\t\t}\n2350: -\t}\n2351: -\treturn nil\n2352: -}\n2353: -\n2354:  func (n *sros) GetContainers(ctx context.Context) ([]clabruntime.GenericContainer, error) {\n2355:  \t// if not a distributed setup call regular GetContainers\n2356:  \tif n.isStandaloneNode() || n.isDistributedCardNode() {\n2357:  \t\treturn n.DefaultNode.GetContainers(ctx)\n2358:  \t}\n2359: @@ -1761,63 +1425,10 @@ func (n *sros) saveConfigWithAddr(ctx context.Context, addr string) error {\n2360:  \t)\n2361:  \n2362:  \treturn nil\n2363:  }\n2364:  \n2365: -// BuildPKIImportXML.\n2366: -func buildPKIImportXML(inputURL, outputFile, importType string) string {\n2367: -\taction := etree.NewElement(\"action\")\n2368: -\taction.CreateAttr(\"xmlns\", \"urn:ietf:params:xml:ns:yang:1\")\n2369: -\n2370: -\tadmin := action.CreateElement(\"admin\")\n2371: -\tadmin.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:oper-admin\")\n2372: -\n2373: -\timportElem := admin.CreateElement(\"system\").\n2374: -\t\tCreateElement(\"security\").\n2375: -\t\tCreateElement(\"pki\").\n2376: -\t\tCreateElement(\"import\")\n2377: -\n2378: -\t// Add import parameters\n2379: -\timportElem.CreateElement(\"input-url\").SetText(inputURL)\n2380: -\timportElem.CreateElement(\"output-file\").SetText(outputFile)\n2381: -\timportElem.CreateElement(\"type\").SetText(importType)\n2382: -\timportElem.CreateElement(\"format\").SetText(\"pem\")\n2383: -\tvar buf bytes.Buffer\n2384: -\taction.WriteTo(&buf, &etree.WriteSettings{\n2385: -\t\tCanonicalText:    false,\n2386: -\t\tCanonicalAttrVal: false,\n2387: -\t})\n2388: -\treturn buf.String()\n2389: -}\n2390: -\n2391: -// BuildTLSProfileXML builds the TLS profile configuration XML.\n2392: -func buildTLSProfileXML() string {\n2393: -\tconfig := etree.NewElement(\"config\")\n2394: -\tconfigure := config.CreateElement(\"configure\")\n2395: -\tconfigure.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:conf\")\n2396: -\tconfigure.CreateAttr(\"xmlns:nc\", \"urn:ietf:params:xml:ns:netconf:base:1.0\")\n2397: -\n2398: -\tcertProfile := configure.CreateElement(\"system\").\n2399: -\t\tCreateElement(\"security\").\n2400: -\t\tCreateElement(\"tls\").\n2401: -\t\tCreateElement(\"cert-profile\")\n2402: -\n2403: -\t// Set operation attribute\n2404: -\tcertProfile.CreateAttr(\"nc:operation\", \"merge\")\n2405: -\n2406: -\t// Add profile configuration\n2407: -\tcertProfile.CreateElement(\"cert-profile-name\").SetText(tlsCertProfileName)\n2408: -\tcertProfile.CreateElement(\"admin-state\").SetText(\"enable\")\n2409: -\n2410: -\tvar buf bytes.Buffer\n2411: -\tconfig.WriteTo(&buf, &etree.WriteSettings{\n2412: -\t\tCanonicalText:    false,\n2413: -\t\tCanonicalAttrVal: false,\n2414: -\t})\n2415: -\treturn buf.String()\n2416: -}\n2417: -\n2418:  // TLS bootstrap via NETCONF to enable secure gRPC.\n2419:  func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {\n2420:  \t// Always import PKI key and cert:\n2421:  \t// \t import \"cf3:\\node.key\" in PEM format as \"cf3:\\system-pki\\node.key\" (encrypted DER)\n2422:  \t//   import \"cf3:\\node.crt\" in PEM format as \"cf3:\\system-pki\\node.crt\" (encrypted DER)\n2423: @@ -1867,23 +1478,10 @@ func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {\n2424:  \t\t}\n2425:  \t}\n2426:  \treturn err\n2427:  }\n2428:  \n2429: -// isConfigClassic reports whether the node is in classic or mixed configuration mode.\n2430: -func (n *sros) isConfigClassic() bool {\n2431: -\tmode := n.kindSpecificCfg().ConfigMode\n2432: -\treturn mode == ConfigModeClassic || mode == ConfigModeMixed\n2433: -}\n2434: -\n2435: -// isFullConfigFile returns true if the config file doesn't contain .partial substring\n2436: -// and the config file is NOT nil (ie. startup config IS defined).\n2437: -// it is intended that the 'c' arg is n.Cfg.StartupConfig.\n2438: -func isFullConfigFile(c string) bool {\n2439: -\treturn c != \"\" && !clabutils.IsPartialConfigFile(c)\n2440: -}\n2441: -\n2442:  func (n *sros) IsHealthy(_ context.Context) (bool, error) {\n2443:  \tif !n.isCPM(\"\") {\n2444:  \t\treturn true, fmt.Errorf(\"node %q is not a CPM, healthcheck has no effect\", n.Cfg.LongName)\n2445:  \t}\n2446:  \t// non-partial user startup config might not have any netconf config\n2447: @@ -2082,67 +1680,10 @@ func (n *sros) MgmtIPAddr() (string, error) {\n2448:  \t\t\"no management IP address (IPv4 or IPv6) configured for node %q\",\n2449:  \t\tn.Cfg.LongName,\n2450:  \t)\n2451:  }\n2452:  \n2453: -// generateComponentConfig generates SR OS configuration for explicitly defined distributed\n2454: -// components or known integrated SR-SIM defaults. Power config is appended when supported.\n2455: -func (n *sros) generateComponentConfig() string {\n2456: -\tif !n.kindSpecificCfg().GenComponentConfig {\n2457: -\t\treturn \"\"\n2458: -\t}\n2459: -\tif n.isConfigClassic() {\n2460: -\t\treturn \"\"\n2461: -\t}\n2462: -\n2463: -\tcomponents := n.rootComponents\n2464: -\tif len(components) == 0 {\n2465: -\t\tif len(n.kindSpecificCfg().Components) > 1 || n.rootCtrName != \"\" {\n2466: -\t\t\treturn \"\"\n2467: -\t\t}\n2468: -\n2469: -\t\tlines := buildIntegratedComponentCfgLines(n.Cfg.NodeType, n.Cfg.Env)\n2470: -\t\tif len(lines) == 0 {\n2471: -\t\t\treturn \"\"\n2472: -\t\t}\n2473: -\t\treturn n.componentConfigFromLines(lines)\n2474: -\t}\n2475: -\n2476: -\tfor _, c := range components {\n2477: -\t\tslot := strings.ToUpper(strings.TrimSpace(c.Slot))\n2478: -\t\tif slot == slotAName || slot == slotBName {\n2479: -\t\t\tcontinue\n2480: -\t\t}\n2481: -\t\tif c.Type == \"\" {\n2482: -\t\t\tlog.Warn(\n2483: -\t\t\t\t\"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.\",\n2484: -\t\t\t\t\"node\",\n2485: -\t\t\t\tn.Cfg.ShortName,\n2486: -\t\t\t\t\"slot\",\n2487: -\t\t\t\tslot,\n2488: -\t\t\t)\n2489: -\t\t}\n2490: -\t}\n2491: -\n2492: -\tlines := buildComponentCfgLines(components, n.kindSpecificCfg().SFM)\n2493: -\treturn n.componentConfigFromLines(lines)\n2494: -}\n2495: -\n2496: -func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {\n2497: -\tpowerConfig := n.generatePowerConfig()\n2498: -\tif len(lines) == 0 && powerConfig == \"\" {\n2499: -\t\treturn \"\"\n2500: -\t}\n2501: -\n2502: -\tvar config strings.Builder\n2503: -\tfor _, l := range lines {\n2504: -\t\tconfig.WriteString(l.String())\n2505: -\t}\n2506: -\tconfig.WriteString(powerConfig)\n2507: -\treturn config.String()\n2508: -}\n2509: -\n2510:  // override to fetch CPM to avoid renaming the base node to CPM A.\n2511:  func (n *sros) GetContainerName() string {\n2512:  \tif n.isDistributedBaseNode() && n.cpmContainerName != \"\" {\n2513:  \t\treturn n.cpmContainerName\n2514:  \t}\n2515: @@ -2365,32 +1906,5 @@ func (n *sros) RestoreEndpoints(ctx context.Context) error {\n2516:  \tif err != nil {\n2517:  \t\treturn err\n2518:  \t}\n2519:  \treturn clabutils.LinkContainerNS(nsPath, n.Cfg.LongName)\n2520:  }\n2521: -\n2522: -func (n *sros) ensureNetnsRunning(ctx context.Context) error {\n2523: -\tswitch status := n.netnsNode.GetContainerStatus(ctx); status {\n2524: -\tcase clabruntime.Running:\n2525: -\t\t// The namespace holder intentionally survives regular node lifecycle operations.\n2526: -\tcase clabruntime.Created, clabruntime.Stopped:\n2527: -\t\tif err := n.netnsNode.Start(ctx); err != nil {\n2528: -\t\t\treturn fmt.Errorf(\"node %q network namespace container start error: %w\",\n2529: -\t\t\t\tn.Cfg.ShortName, err)\n2530: -\t\t}\n2531: -\tcase clabruntime.Paused:\n2532: -\t\tif err := n.Runtime.UnpauseContainer(ctx, n.netnsNode.Config().LongName); err != nil {\n2533: -\t\t\treturn fmt.Errorf(\"node %q network namespace container unpause error: %w\",\n2534: -\t\t\t\tn.Cfg.ShortName, err)\n2535: -\t\t}\n2536: -\tcase clabruntime.NotFound:\n2537: -\t\treturn fmt.Errorf(\n2538: -\t\t\t\"node %q network namespace container %q not found; recreate the node\",\n2539: -\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName,\n2540: -\t\t)\n2541: -\tdefault:\n2542: -\t\treturn fmt.Errorf(\"node %q network namespace container %q is %s\",\n2543: -\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName, status)\n2544: -\t}\n2545: -\n2546: -\treturn nil\n2547: -}\n2548: diff --git a/nodes/sros/sros_test.go b/nodes/sros/sros_test.go\n2549: index 29cace9..dd8aea6 100644\n2550: --- a/nodes/sros/sros_test.go\n2551: +++ b/nodes/sros/sros_test.go\n2552: @@ -272,10 +272,16 @@ func Test_sros_generateComponentConfig(t *testing.T) {\n2553:  \t\t\tname:     \"integrated_ixr_e3x_default\",\n2554:  \t\t\tnodeType: \"ixr-e3x\",\n2555:  \t\t\tcardType: \"imm16-sfp112+15-sfp56+6-qsfpdd\",\n2556:  \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"}},\n2557:  \t\t},\n2558: +\t\t{\n2559: +\t\t\tname:     \"integrated_ixr_e2sc_default\",\n2560: +\t\t\tnodeType: \"ixr-e2sc\",\n2561: +\t\t\tcardType: \"imm16-sfp++4-sfp28\",\n2562: +\t\t\tmdas:     MDAS{{Slot: 1, Type: \"m16-sfp++4-sfp28\"}},\n2563: +\t\t},\n2564:  \t\t{\n2565:  \t\t\tname:     \"integrated_ixr_ec_default\",\n2566:  \t\t\tnodeType: \"ixr-ec\",\n2567:  \t\t\tcardType: \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n2568:  \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\"}},\n2569: @@ -311,40 +317,116 @@ func Test_sros_generateComponentConfig(t *testing.T) {\n2570:  \t\t\t\tassert.Equal(t, 4, strings.Count(cfg, \"power-module-type ps-a-dc-6000\"))\n2571:  \t\t\t}\n2572:  \t\t})\n2573:  \t}\n2574:  \n2575: -\tt.Run(\"integrated_env_overrides_preserve_default_mda_slots\", func(t *testing.T) {\n2576: +\tt.Run(\"integrated_component_mda_override_preserves_default_mda_slots\", func(t *testing.T) {\n2577: +\t\tn := newSrosComponentConfigTestNode(\"sr-1\", nil, []*Component{\n2578: +\t\t\t{MDA: MDAS{{Slot: 1, Type: \"custom-mda\"}}},\n2579: +\t\t})\n2580: +\n2581: +\t\tcfg := n.generateComponentConfig()\n2582: +\n2583: +\t\tassert.Contains(t, cfg, \"/configure card 1 card-type iom-1 admin-state enable\")\n2584: +\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type custom-mda admin-state enable\")\n2585: +\t\tassert.Contains(\n2586: +\t\t\tt,\n2587: +\t\t\tcfg,\n2588: +\t\t\t\"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable\",\n2589: +\t\t)\n2590: +\t})\n2591: +\n2592: +\tt.Run(\"integrated_xiom_replaces_default_mdas\", func(t *testing.T) {\n2593: +\t\tn := newSrosComponentConfigTestNode(\"sr-1s\", nil, []*Component{\n2594: +\t\t\t{\n2595: +\t\t\t\tXIOM: XIOMS{\n2596: +\t\t\t\t\t{\n2597: +\t\t\t\t\t\tSlot: 1,\n2598: +\t\t\t\t\t\tType: \"iom-s-3.0t\",\n2599: +\t\t\t\t\t\tMDA: MDAS{\n2600: +\t\t\t\t\t\t\t{Slot: 1, Type: \"ms18-100gb-qsfp28\"},\n2601: +\t\t\t\t\t\t\t{Slot: 2, Type: \"ms2-400gb-qsfpdd+2-100gb-qsfp28\"},\n2602: +\t\t\t\t\t\t},\n2603: +\t\t\t\t\t},\n2604: +\t\t\t\t},\n2605: +\t\t\t},\n2606: +\t\t})\n2607: +\n2608: +\t\tcfg := n.generateComponentConfig()\n2609: +\n2610: +\t\tassert.Contains(t, cfg, \"/configure card 1 card-type xcm-1s admin-state enable\")\n2611: +\t\tassert.Contains(t, cfg, \"/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\")\n2612: +\t\tassert.Contains(\n2613: +\t\t\tt,\n2614: +\t\t\tcfg,\n2615: +\t\t\t\"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\",\n2616: +\t\t)\n2617: +\t\tassert.Contains(\n2618: +\t\t\tt,\n2619: +\t\t\tcfg,\n2620: +\t\t\t\"/configure card 1 xiom x1 mda 2 mda-type ms2-400gb-qsfpdd+2-100gb-qsfp28 admin-state enable\",\n2621: +\t\t)\n2622: +\t\tassert.NotContains(t, cfg, \"s36-100gb-qsfp28\")\n2623: +\t})\n2624: +\n2625: +\tt.Run(\"integrated_env_mda_overrides_default_component_config\", func(t *testing.T) {\n2626:  \t\tn := newSrosComponentConfigTestNode(\n2627:  \t\t\t\"sr-1\",\n2628: -\t\t\tmap[string]string{\n2629: -\t\t\t\tenvNokiaSrosCard:       \"env-card\",\n2630: -\t\t\t\tenvNokiaSrosMDA + \"_1\": \"env-mda\",\n2631: -\t\t\t},\n2632: +\t\t\tmap[string]string{envNokiaSrosMDA + \"_1\": \"env-mda\"},\n2633:  \t\t\tnil,\n2634:  \t\t)\n2635:  \n2636:  \t\tcfg := n.generateComponentConfig()\n2637:  \n2638: -\t\tassert.Contains(t, cfg, \"/configure card 1 card-type env-card admin-state enable\")\n2639: -\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type env-mda admin-state enable\")\n2640: +\t\tassert.Contains(\n2641: +\t\t\tt,\n2642: +\t\t\tcfg,\n2643: +\t\t\t\"/configure card 1 mda 1 mda-type env-mda admin-state enable\",\n2644: +\t\t)\n2645:  \t\tassert.Contains(\n2646:  \t\t\tt,\n2647:  \t\t\tcfg,\n2648:  \t\t\t\"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable\",\n2649:  \t\t)\n2650: +\t\tassert.NotContains(t, cfg, \"me6-100gb-qsfp28\")\n2651:  \t})\n2652:  \n2653: -\tt.Run(\"integrated_env_override_adds_mda_slot\", func(t *testing.T) {\n2654: +\tt.Run(\"integrated_env_mda_overrides_component_mda\", func(t *testing.T) {\n2655:  \t\tn := newSrosComponentConfigTestNode(\n2656: -\t\t\t\"ixr-r6\",\n2657: +\t\t\t\"sr-1\",\n2658: +\t\t\tmap[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"},\n2659: +\t\t\t[]*Component{{MDA: MDAS{{Slot: 1, Type: \"from-component\"}}}},\n2660: +\t\t)\n2661: +\n2662: +\t\tcfg := n.generateComponentConfig()\n2663: +\n2664: +\t\tassert.Contains(\n2665: +\t\t\tt,\n2666: +\t\t\tcfg,\n2667: +\t\t\t\"/configure card 1 mda 1 mda-type from-env admin-state enable\",\n2668: +\t\t)\n2669: +\t\tassert.NotContains(t, cfg, \"from-component\")\n2670: +\t})\n2671: +\n2672: +\tt.Run(\"integrated_card_override_skips_component_config\", func(t *testing.T) {\n2673: +\t\tn := newSrosComponentConfigTestNode(\n2674: +\t\t\t\"sr-1s\",\n2675:  \t\t\tmap[string]string{\n2676: -\t\t\t\tenvNokiaSrosMDA + \"_3\": \"m20-1g-csfp\",\n2677: +\t\t\t\tenvNokiaSrosCard:       \"cpm-1s\",\n2678: +\t\t\t\tenvNokiaSrosMDA + \"_1\": \"env-mda\",\n2679:  \t\t\t},\n2680:  \t\t\tnil,\n2681:  \t\t)\n2682:  \n2683: +\t\tassert.Empty(t, n.generateComponentConfig())\n2684: +\t})\n2685: +\n2686: +\tt.Run(\"integrated_component_override_adds_mda_slot\", func(t *testing.T) {\n2687: +\t\tn := newSrosComponentConfigTestNode(\"ixr-r6\", nil, []*Component{\n2688: +\t\t\t{MDA: MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}}},\n2689: +\t\t})\n2690: +\n2691:  \t\tcfg := n.generateComponentConfig()\n2692:  \n2693:  \t\tassert.Contains(\n2694:  \t\t\tt,\n2695:  \t\t\tcfg,\n2696: @@ -415,41 +497,174 @@ func Test_sros_integratedComponentOverrides(t *testing.T) {\n2697:  \t\trequire.NoError(t, err)\n2698:  \t\tassert.True(t, n.isStandaloneNode())\n2699:  \t\tassert.Equal(t, slotBName, n.Cfg.Env[envNokiaSrosSlot])\n2700:  \t\tassert.Equal(t, \"cpiom-ixr-r6\", n.Cfg.Env[envNokiaSrosCard])\n2701:  \t\tassert.Equal(t, \"m20-1g-csfp\", n.Cfg.Env[envNokiaSrosMDA+\"_3\"])\n2702: +\n2703: +\t\tassert.Empty(t, n.generateComponentConfig())\n2704: +\t})\n2705: +\n2706: +\tt.Run(\"integrated_component_xiom_sets_env\", func(t *testing.T) {\n2707: +\t\tn := newSrosInitTestNode(\"sr-1s\", []*Component{\n2708: +\t\t\t{\n2709: +\t\t\t\tXIOM: XIOMS{\n2710: +\t\t\t\t\t{\n2711: +\t\t\t\t\t\tSlot: 1,\n2712: +\t\t\t\t\t\tType: \"iom-s-3.0t\",\n2713: +\t\t\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"ms18-100gb-qsfp28\"}},\n2714: +\t\t\t\t\t},\n2715: +\t\t\t\t},\n2716: +\t\t\t},\n2717: +\t\t})\n2718: +\n2719: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2720: +\t\tassert.Equal(t, \"iom-s-3.0t\", n.Cfg.Env[envNokiaSrosXIOM+\"_X1\"])\n2721: +\t\tassert.Equal(t, \"ms18-100gb-qsfp28\", n.Cfg.Env[envNokiaSrosMDA+\"_X1_1\"])\n2722: +\n2723: +\t\tcfg := n.generateComponentConfig()\n2724: +\t\tassert.Contains(t, cfg, \"/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\")\n2725: +\t\tassert.Contains(\n2726: +\t\t\tt,\n2727: +\t\t\tcfg,\n2728: +\t\t\t\"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\",\n2729: +\t\t)\n2730:  \t})\n2731:  \n2732:  \tt.Run(\"integrated_rejects_multiple_components\", func(t *testing.T) {\n2733: +\t\tfor _, tc := range []struct {\n2734: +\t\t\tnodeType   string\n2735: +\t\t\tcomponents []*Component\n2736: +\t\t}{\n2737: +\t\t\t{\"sr-1\", []*Component{{Slot: slotAName}, {Slot: slotBName}}},\n2738: +\t\t\t{\"ixr-r6\", []*Component{{Slot: slotAName}, {Slot: \"1\"}}},\n2739: +\t\t\t{\"ixr-r6\", []*Component{{Slot: slotAName}, {}}},\n2740: +\t\t} {\n2741: +\t\t\tn := newSrosInitTestNode(tc.nodeType, tc.components)\n2742: +\n2743: +\t\t\terr := n.Init(n.Cfg)\n2744: +\n2745: +\t\t\trequire.Error(t, err, tc.nodeType)\n2746: +\t\t\tassert.Contains(t, err.Error(), \"at most one component override\")\n2747: +\t\t}\n2748: +\t})\n2749: +\n2750: +\tt.Run(\"redundant_integrated_components_are_distributed\", func(t *testing.T) {\n2751:  \t\tn := newSrosInitTestNode(\"ixr-r6\", []*Component{\n2752: -\t\t\t{Slot: slotAName, Type: \"cpiom-ixr-r6\"},\n2753: -\t\t\t{Slot: slotBName, Type: \"cpiom-ixr-r6\"},\n2754: +\t\t\t{Slot: slotAName, MDA: MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}}},\n2755: +\t\t\t{Slot: slotBName},\n2756:  \t\t})\n2757:  \n2758: -\t\terr := n.Init(n.Cfg)\n2759: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2760: +\t\tassert.True(t, n.isDistributedBaseNode())\n2761: +\t\trequire.Len(t, n.componentNodes, 2)\n2762: +\n2763: +\t\tcpmA := n.componentNodes[0].(*sros)\n2764: +\t\tcpmB := n.componentNodes[1].(*sros)\n2765: +\t\tassert.Equal(t, slotAName, cpmA.Config().Env[envNokiaSrosSlot])\n2766: +\t\tassert.Equal(t, slotBName, cpmB.Config().Env[envNokiaSrosSlot])\n2767: +\t\tassert.Equal(t, \"container:n1-netns\", cpmA.Config().NetworkMode)\n2768: +\t\tassert.Equal(t, \"container:n1-netns\", cpmB.Config().NetworkMode)\n2769: +\n2770: +\t\tcfgA := cpmA.generateComponentConfig()\n2771: +\t\tassert.Contains(t, cfgA, \"/configure card 1 card-type iom-ixr-r6 admin-state enable\")\n2772: +\t\tassert.Contains(\n2773: +\t\t\tt,\n2774: +\t\t\tcfgA,\n2775: +\t\t\t\"/configure card 1 mda 1 mda-type m6-10g-sfp++1-100g-qsfp28 admin-state enable\",\n2776: +\t\t)\n2777: +\t\tassert.Contains(t, cfgA, \"/configure card 1 mda 3 mda-type m20-1g-csfp admin-state enable\")\n2778: +\n2779: +\t\tcfgB := cpmB.generateComponentConfig()\n2780: +\t\tassert.Contains(t, cfgB, \"/configure card 1 card-type iom-ixr-r6 admin-state enable\")\n2781: +\t\tassert.NotContains(t, cfgB, \"m20-1g-csfp\")\n2782: +\t})\n2783: +\n2784: +\tt.Run(\"lowercase_integrated_slots_resolve_to_cpm_a\", func(t *testing.T) {\n2785: +\t\tn := newSrosInitTestNode(\"ixr-r6\", []*Component{\n2786: +\t\t\t{Slot: \"a\"},\n2787: +\t\t\t{Slot: \"b\"},\n2788: +\t\t})\n2789: +\n2790: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2791: +\t\tslot, err := n.cpmSlot()\n2792: +\t\trequire.NoError(t, err)\n2793: +\t\tassert.Equal(t, slotAName, slot)\n2794: +\t})\n2795: +\n2796: +\tt.Run(\"node_env_overrides_component_mda\", func(t *testing.T) {\n2797: +\t\tn := newSrosInitTestNode(\"sr-1\", []*Component{\n2798: +\t\t\t{MDA: MDAS{{Slot: 1, Type: \"from-component\"}}},\n2799: +\t\t})\n2800: +\t\tn.Cfg.Env = map[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"}\n2801: +\n2802: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2803: +\t\tassert.Equal(t, \"from-env\", n.Cfg.Env[envNokiaSrosMDA+\"_1\"])\n2804: +\n2805: +\t\tcfg := n.generateComponentConfig()\n2806: +\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type from-env admin-state enable\")\n2807: +\t\tassert.NotContains(t, cfg, \"from-component\")\n2808: +\t})\n2809: +\n2810: +\tt.Run(\"node_env_overrides_sfm\", func(t *testing.T) {\n2811: +\t\tn := newSrosInitTestNode(\"sr-1\", nil)\n2812: +\t\tkindSpecificConfig.Of(n.Cfg).SFM = \"from-sfm\"\n2813: +\t\tn.Cfg.Env = map[string]string{envNokiaSrosSFM: \"from-env\"}\n2814: +\n2815: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2816: +\t\tassert.Equal(t, \"from-env\", n.Cfg.Env[envNokiaSrosSFM])\n2817: +\t})\n2818: +\n2819: +\tt.Run(\"distributed_node_env_overrides_component_mda\", func(t *testing.T) {\n2820: +\t\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n2821: +\t\t\t{Slot: slotAName, Type: \"cpm-2s\"},\n2822: +\t\t\t{\n2823: +\t\t\t\tSlot: \"1\",\n2824: +\t\t\t\tType: \"xcm-2s\",\n2825: +\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"from-component\"}},\n2826: +\t\t\t},\n2827: +\t\t})\n2828: +\t\tn.Cfg.Env = map[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"}\n2829: +\n2830: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2831: +\t\trequire.Len(t, n.componentNodes, 2)\n2832: +\n2833: +\t\tlinecard := n.componentNodes[1].(*sros)\n2834: +\t\tassert.Equal(t, \"from-env\", linecard.Config().Env[envNokiaSrosMDA+\"_1\"])\n2835: +\n2836: +\t\tcfg := n.componentNodes[0].(*sros).generateComponentConfig()\n2837: +\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type from-env admin-state enable\")\n2838: +\t\tassert.NotContains(t, cfg, \"from-component\")\n2839: +\t})\n2840: +\n2841: +\tt.Run(\"duplicate_component_slots_are_rejected_regardless_of_case\", func(t *testing.T) {\n2842: +\t\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n2843: +\t\t\t{Slot: \"a\"},\n2844: +\t\t\t{Slot: \"A\"},\n2845: +\t\t})\n2846: +\n2847: +\t\terr := n.checkComponentSlotsConfig()\n2848:  \n2849:  \t\trequire.Error(t, err)\n2850: -\t\tassert.Contains(t, err.Error(), \"at most one component override\")\n2851: +\t\tassert.Contains(t, err.Error(), \"duplicate\")\n2852:  \t})\n2853:  \n2854:  \tt.Run(\"sfm_sets_container_env\", func(t *testing.T) {\n2855:  \t\tn := newSrosInitTestNode(\"sr-1\", nil)\n2856:  \t\tkindSpecificConfig.Of(n.Cfg).SFM = \"m-sfm6-7/12\"\n2857:  \n2858:  \t\trequire.NoError(t, n.Init(n.Cfg))\n2859:  \t\tassert.Equal(t, \"m-sfm6-7/12\", n.Cfg.Env[envNokiaSrosSFM])\n2860:  \t})\n2861:  \n2862: -\tt.Run(\"single_slot_integrated_rejects_card_type_override\", func(t *testing.T) {\n2863: -\t\tn := newSrosInitTestNode(\"ixr-e2\", []*Component{\n2864: -\t\t\t{Slot: slotAName, Type: \"imm2-qsfpdd+2-qsfp28+24-sfp28\"},\n2865: +\tt.Run(\"single_slot_integrated_allows_card_type_override\", func(t *testing.T) {\n2866: +\t\tn := newSrosInitTestNode(\"ixr-e2n\", []*Component{\n2867: +\t\t\t{Slot: slotAName, Type: \"cpm-ixr-e2n/imm4-sfp+4-sfp+\"},\n2868:  \t\t})\n2869:  \n2870: -\t\terr := n.Init(n.Cfg)\n2871: -\n2872: -\t\trequire.Error(t, err)\n2873: -\t\tassert.Contains(t, err.Error(), \"does not support component card-type override\")\n2874: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2875: +\t\tassert.Equal(t, \"cpm-ixr-e2n/imm4-sfp+4-sfp+\", n.Cfg.Env[envNokiaSrosCard])\n2876: +\t\tassert.Empty(t, n.generateComponentConfig())\n2877:  \t})\n2878:  \n2879:  \tt.Run(\"integrated_rejects_invalid_slot\", func(t *testing.T) {\n2880:  \t\tn := newSrosInitTestNode(\"ixr-e2\", []*Component{\n2881:  \t\t\t{Slot: slotBName, Type: \"cpm-ixr-e2\"},\n2882: diff --git a/nodes/sros/template.go b/nodes/sros/template.go\n2883: index 38f1e4d..b538320 100644\n2884: --- a/nodes/sros/template.go\n2885: +++ b/nodes/sros/template.go\n2886: @@ -1,7 +1,28 @@\n2887:  package sros\n2888:  \n2889: +import (\n2890: +\t_ \"embed\"\n2891: +\t\"text/template\"\n2892: +\n2893: +\tclabutils \"github.com/srl-labs/containerlab/utils\"\n2894: +)\n2895: +\n2896: +var (\n2897: +\t//go:embed configs/sros_config_sros25.go.tpl\n2898: +\tcfgTplSROS25 string\n2899: +\n2900: +\t//go:embed configs/sros_config_classic.go.tpl\n2901: +\tcfgTplClassic string\n2902: +\n2903: +\t//go:embed configs/ixr/ixr_config_classic.go.tpl\n2904: +\tcfgTplClassicIxr string\n2905: +\n2906: +\t//go:embed configs/sar/sar_config_classic.go.tpl\n2907: +\tcfgTplClassicSar string\n2908: +)\n2909: +\n2910:  // srosTemplateData holds all data needed for template selection and execution.\n2911:  type srosTemplateData struct {\n2912:  \t// Template selection criteria\n2913:  \tNodeType          string\n2914:  \tConfigurationMode string\n2915: @@ -43,5 +64,36 @@ type tplIFace struct {\n2916:  \tSlot       string\n2917:  \tPort       string\n2918:  \tBreakoutNo string\n2919:  \tMtu        int\n2920:  }\n2921: +\n2922: +// getTemplateForVariant returns the template string and name for the given config variant.\n2923: +// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= \"26\").\n2924: +func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {\n2925: +\t// Model-driven (or mixed treated as classic below when family is classic)\n2926: +\tif v.Mode == ConfigModeModelDriven {\n2927: +\t\t// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= \"26\"\n2928: +\t\t// { return cfgTplSROS26, \"clab-sros-config-sros26\" }\n2929: +\t\treturn cfgTplSROS25, \"clab-sros-config-sros25\"\n2930: +\t}\n2931: +\t// Classic (or mixed)\n2932: +\ttmpl = cfgTplClassic\n2933: +\ttplName = \"clab-sros-config-classic\"\n2934: +\tswitch v.Family {\n2935: +\tcase ConfigFamilyIXR:\n2936: +\t\treturn cfgTplClassicIxr, \"clab-sros-config-classic-ixr\"\n2937: +\tcase ConfigFamilySAR:\n2938: +\t\treturn cfgTplClassicSar, \"clab-sros-config-classic-sar\"\n2939: +\tdefault:\n2940: +\t\treturn tmpl, tplName\n2941: +\t}\n2942: +}\n2943: +\n2944: +// selectConfigTemplate chooses the config template from the config variant (mode + family).\n2945: +func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {\n2946: +\tv := n.resolveConfigVariant()\n2947: +\ttmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)\n2948: +\treturn template.New(tplName).\n2949: +\t\tFuncs(clabutils.CreateFuncs()).\n2950: +\t\tParse(tmpl)\n2951: +}\n2952: diff --git a/nodes/sros/variant.go b/nodes/sros/variant.go\n2953: index fad585c..85bcac5 100644\n2954: --- a/nodes/sros/variant.go\n2955: +++ b/nodes/sros/variant.go\n2956: @@ -2,11 +2,21 @@\n2957:  // Licensed under the BSD 3-Clause License.\n2958:  // SPDX-License-Identifier: BSD-3-Clause\n2959:  \n2960:  package sros\n2961:  \n2962: -import \"fmt\"\n2963: +import (\n2964: +\t\"fmt\"\n2965: +\t\"regexp\"\n2966: +)\n2967: +\n2968: +var (\n2969: +\tsarRegexp   = regexp.MustCompile(`(?i)\\bsar-`)\n2970: +\tsarHmRegexp = regexp.MustCompile(`(?i)\\b(sar-hm|sar-hmc)\\b`)\n2971: +\n2972: +\tixrRegexp = regexp.MustCompile(`(?i)\\bixr-`)\n2973: +)\n2974:  \n2975:  // ConfigMode is the configuration mode (model-driven or classic).\n2976:  type ConfigMode string\n2977:  \n2978:  const (\n2979: @@ -141,5 +151,20 @@ func getSnippetSet(v ConfigVariant) snippetSet {\n2980:  \t\t\tgrpc = grpcConfigSARInsecure\n2981:  \t\t}\n2982:  \t}\n2983:  \treturn snippetSet{SystemConfig: sys, GRPCConfig: grpc}\n2984:  }\n2985: +\n2986: +// isIXRNode returns true if this is an IXR node type (case-insensitive).\n2987: +func (n *sros) isIXRNode() bool {\n2988: +\treturn ixrRegexp.MatchString(n.Cfg.NodeType)\n2989: +}\n2990: +\n2991: +// isSARNode returns true if this is a SAR node type (case-insensitive).\n2992: +func (n *sros) isSARNode() bool {\n2993: +\treturn sarRegexp.MatchString(n.Cfg.NodeType)\n2994: +}\n2995: +\n2996: +// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).\n2997: +func (n *sros) isSARHmNode() bool {\n2998: +\treturn sarHmRegexp.MatchString(n.Cfg.NodeType)\n2999: +}\n3000: diff --git a/schemas/clab.schema.json b/schemas/clab.schema.json\n3001: index 66679ac..0157106 100644\n3002: --- a/schemas/clab.schema.json\n3003: +++ b/schemas/clab.schema.json\n3004: @@ -939,10 +939,12 @@\n3005:                                              \"ixr-6\",\n3006:                                              \"ixr-e2c\",\n3007:                                              \"ixr-e2\",\n3008:                                              \"ixr-e2n\",\n3009:                                              \"ixr-e2n-s\",\n3010: +                                            \"ixr-e2sc\",\n3011: +                                            \"ixr-e3\",\n3012:                                              \"ixr-e3c\",\n3013:                                              \"ixr-e3x\",\n3014:                                              \"ixr-ec\",\n3015:                                              \"ixr-e\",\n3016:                                              \"ixr-r4\",\n3017: @@ -951,10 +953,11 @@\n3018:                                              \"ixr-r6\",\n3019:                                              \"ixr-s\",\n3020:                                              \"ixr-x3\",\n3021:                                              \"ixr-x\",\n3022:                                              \"sar-1\",\n3023: +                                            \"sar-10x\",\n3024:                                              \"sar-hm\",\n3025:                                              \"sar-hmc\",\n3026:                                              \"sar-hx\",\n3027:                                              \"sar-mx\",\n3028:                                              \"sr-1-24d\",\n3029: @@ -2009,11 +2012,14 @@\n3030:                  \"cpm-ixr-e-gnss/imm24-sfp++8-sfp28+2-qsfp28\",\n3031:                  \"cpm-ixr-e/imm14-10g-sfp++4-1g-tx\",\n3032:                  \"cpm-ixr-e/imm24-sfp++8-sfp28+2-qsfp28\",\n3033:                  \"cpm-ixr-e2\",\n3034:                  \"cpm-ixr-e2c\",\n3035: +                \"cpm-ixr-e2n-s/imm4-sfp+4-sfp+-s\",\n3036:                  \"cpm-ixr-e2n/imm4-sfp+4-sfp+\",\n3037: +                \"cpm-ixr-e2sc/imm16-sfp++4-sfp28\",\n3038: +                \"cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd\",\n3039:                  \"cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56\",\n3040:                  \"cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd\",\n3041:                  \"cpm-ixr-ec\",\n3042:                  \"cpm-ixr-s/imm48-sfp++6-qsfp28\",\n3043:                  \"cpm-ixr-x/imm32-qsfp28+4-qsfpdd\",\n3044: @@ -2077,10 +2083,11 @@\n3045:              \"type\": \"string\",\n3046:              \"description\": \"CPM card types for SR OS\",\n3047:              \"enum\": [\n3048:                  \"cpiom-ixr-r6\",\n3049:                  \"cpiom-ixr-r6d\",\n3050: +                \"cpiom-sar-x\",\n3051:                  \"cpm-1\",\n3052:                  \"cpm-1s\",\n3053:                  \"cpm-1se\",\n3054:                  \"cpm-1se/imm36-800g-qsfpdd\",\n3055:                  \"cpm-1x\",\n3056: @@ -2102,11 +2109,14 @@\n3057:                  \"cpm-ixr-e-gnss/imm24-sfp++8-sfp28+2-qsfp28\",\n3058:                  \"cpm-ixr-e/imm14-10g-sfp++4-1g-tx\",\n3059:                  \"cpm-ixr-e/imm24-sfp++8-sfp28+2-qsfp28\",\n3060:                  \"cpm-ixr-e2\",\n3061:                  \"cpm-ixr-e2c\",\n3062: +                \"cpm-ixr-e2n-s/imm4-sfp+4-sfp+-s\",\n3063:                  \"cpm-ixr-e2n/imm4-sfp+4-sfp+\",\n3064: +                \"cpm-ixr-e2sc/imm16-sfp++4-sfp28\",\n3065: +                \"cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd\",\n3066:                  \"cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56\",\n3067:                  \"cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd\",\n3068:                  \"cpm-ixr-ec\",\n3069:                  \"cpm-ixr-r4\",\n3070:                  \"cpm-ixr-s\",\n3071: @@ -2122,11 +2132,12 @@\n3072:                  \"cpm-v/iom-v\",\n3073:                  \"cpm-x20\",\n3074:                  \"cpm2-s\",\n3075:                  \"cpm2-x20\",\n3076:                  \"cpm5\",\n3077: -                \"iom-sar\"\n3078: +                \"iom-sar\",\n3079: +                \"iom-sar-1x\"\n3080:              ]\n3081:          },\n3082:          \"sros-mda-types\": {\n3083:              \"type\": \"string\",\n3084:              \"description\": \"MDA types for SR OS\",\n3085: @@ -2153,10 +2164,11 @@\n3086:                  \"m10-sfp++6-sfp\",\n3087:                  \"m12-sfp28+2-qsfp28\",\n3088:                  \"m14-10g-sfp++4-1g-tx\",\n3089:                  \"m18-25g-sfp28\",\n3090:                  \"m2-100g-qsfp28+16-10g-sfp+\",\n3091: +                \"m2-1g-sfp+2-10g-sfp+\",\n3092:                  \"m2-cfp2\",\n3093:                  \"m2-qsfpdd+2-qsfp28+24-sfp28\",\n3094:                  \"m20-10g-sfp+\",\n3095:                  \"m20-1g-csfp\",\n3096:                  \"m20-v\",\n3097: @@ -2166,11 +2178,13 @@\n3098:                  \"m32-qsfp28+4-qsfpdd\",\n3099:                  \"m36-100g-qsfp28\",\n3100:                  \"m36-qsfpdd\",\n3101:                  \"m4-100g-cfp4\",\n3102:                  \"m4-10g-sfp++1-100g-cfp2\",\n3103: +                \"m4-1g-rj+6-10g-sfp++2-25g-sfp28\",\n3104:                  \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n3105: +                \"m4-rs232-rj45+4-c3794-sfp\",\n3106:                  \"m40-10g-sfp\",\n3107:                  \"m40-10g-sfp-ptp\",\n3108:                  \"m40-200g-sfpdd+6-800g-qsfpdd-1\",\n3109:                  \"m46-10g-sfp+\",\n3110:                  \"m48-400g-qsfpdd-1\",\n3111: @@ -2181,10 +2195,11 @@\n3112:                  \"m5e2-100g-qsfp28+2-800g-qdd\",\n3113:                  \"m5e8-100g-sfp112+2-800g-qdd\",\n3114:                  \"m6-10g-sfp++1-100g-qsfp28\",\n3115:                  \"m6-10g-sfp++4-25g-sfp28\",\n3116:                  \"m6-qsfpdd+48-sfp56\",\n3117: +                \"m8-t1e1-rj48\",\n3118:                  \"m80-1g-csfp\",\n3119:                  \"m80-200g-sfpdd+12-400g-qsfpdd-1\",\n3120:                  \"m80-200g-sfpdd+12-800g-qsfpdd-1x\",\n3121:                  \"ma2-10gb-sfp+12-1gb-sfp\",\n3122:                  \"ma20-1gb-tx\",\n3123: diff --git a/tests/13-srsim/01-sros-to-linux.robot b/tests/13-srsim/01-sros-to-linux.robot\n3124: index c4d9cb2..8226dd7 100644\n3125: --- a/tests/13-srsim/01-sros-to-linux.robot\n3126: +++ b/tests/13-srsim/01-sros-to-linux.robot\n3127: @@ -1,9 +1,10 @@\n3128:  *** Settings ***\n3129:  Library             OperatingSystem\n3130:  Resource            ../ssh.robot\n3131:  Resource            ../common.robot\n3132: +Resource            ../srsim.robot\n3133:  \n3134:  Suite Teardown      Run Keyword    Cleanup\n3135:  \n3136:  \n3137:  *** Variables ***\n3138: @@ -21,15 +22,11 @@ Set key-path Variable\n3139:  Create SSH keypair - RSA\n3140:      ${rc}    ${output} =    Run And Return Rc And Output\n3141:      ...    ssh-keygen -t rsa -N \"\" -f ${key-path}-rsa\n3142:  \n3143:  Deploy ${lab-name} lab\n3144: -    Log    ${CURDIR}\n3145: -    ${rc}    ${output} =    Run And Return Rc And Output\n3146: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3147: -    Log    ${output}\n3148: -    Should Be Equal As Integers    ${rc}    0\n3149: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3150:  \n\n(Output capped at 50 KB. Showing lines 1614-3150. Use offset=3151 to continue.)\n</content>",
    "title": "source/diff.txt",
    "metadata": {
      "preview": " \t\"github.com/brunoga/deep\"\n \t\"github.com/charmbracelet/log\"\n \t\"github.com/scrapli/scrapligo/driver/netconf\"\n \t\"github.com/scrapli/scrapligo/driver/opoptions\"\n-\t\"github.com/vishvananda/netns\"\n \n \t\"github.com/scrapli/scrapligo/response\"\n \n \tclabconstants \"github.com/srl-labs/containerlab/constants\"\n \tclabexec \"github.com/srl-labs/containerlab/exec\"\n@@ -82,32 +78,16 @@ const (\n \tenvNokiaSrosMDA           = \"NOKIA_SROS_MDA\"\n \tenvSrosIPv4Active         = \"NOKIA_SROS_ADDRESS_IPV4_ACTIVE\"\n \tenvSrosIPv6Active         = \"NOKIA_SROS_ADDRESS_IPV6_ACTIVE\"\n \tenvSrosStaticRoutePrefix  = \"NOKIA_SROS_STATIC_ROUTE_\"\n \n-\tdefaultSrosPowerType       = \"dc\"\n-\tdefaultSrosPowerModuleType = \"ps-a-dc-6000\"\n-\n \tsrosMinorError     = \"MINOR:\"",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/diff.txt",
        "text": " \t\"github.com/brunoga/deep\"\n \t\"github.com/charmbracelet/log\"\n \t\"github.com/scrapli/scrapligo/driver/netconf\"\n \t\"github.com/scrapli/scrapligo/driver/opoptions\"\n-\t\"github.com/vishvananda/netns\"\n \n \t\"github.com/scrapli/scrapligo/response\"\n \n \tclabconstants \"github.com/srl-labs/containerlab/constants\"\n \tclabexec \"github.com/srl-labs/containerlab/exec\"\n@@ -82,32 +78,16 @@ const (\n \tenvNokiaSrosMDA           = \"NOKIA_SROS_MDA\"\n \tenvSrosIPv4Active         = \"NOKIA_SROS_ADDRESS_IPV4_ACTIVE\"\n \tenvSrosIPv6Active         = \"NOKIA_SROS_ADDRESS_IPV6_ACTIVE\"\n \tenvSrosStaticRoutePrefix  = \"NOKIA_SROS_STATIC_ROUTE_\"\n \n-\tdefaultSrosPowerType       = \"dc\"\n-\tdefaultSrosPowerModuleType = \"ps-a-dc-6000\"\n-\n \tsrosMinorError     = \"MINOR:\"\n \tsrosCriticalError  = \"CRITICAL:\"\n \tsrosRejectedCfgMsg = \"Configuration load failed - using default configuration\"\n )\n \n var (\n-\n-\t//go:embed configs/sros_config_sros25.go.tpl\n-\tcfgTplSROS25 string\n-\n-\t//go:embed configs/sros_config_classic.go.tpl\n-\tcfgTplClassic string\n-\n-\t//go:embed configs/ixr/ixr_config_classic.go.tpl\n-\tcfgTplClassicIxr string\n-\n-\t//go:embed configs/sar/sar_config_classic.go.tpl\n-\tcfgTplClassicSar string\n-\n \tkindNames  = []string{\"nokia_srsim\"}\n \tsrosSysctl = map[string]string{\n \t\t\"net.ipv4.ip_forward\":                \"0\",\n \t\t\"net.ipv6.conf.all.disable_ipv6\":     \"0\",\n \t\t\"net.ipv6.conf.default.disable_ipv6\": \"0\",\n@@ -160,15 +140,10 @@ var (\n       e1-2-3       -> card 1, mda 2, port 3\n       e1-2-c3-4    -> card 1, mda 2, connector 3, port 4\n       e1-x2-3-4    -> card 1, xiom 2, mda 3, port 4\n       e1-x2-3-c4-5 -> card 1, xiom 2, mda 3, connector 4, port 5\n \t  eth[0-9], for management interfaces of CPM-A/CPM-B or for fabric interfaces`\n-\t// Auxiliary regexps for IXR/SAR detection.\n-\tsarRegexp   = regexp.MustCompile(`(?i)\\bsar-`)\n-\tsarHmRegexp = regexp.MustCompile(`(?i)\\b(sar-hm|sar-hmc)\\b`)\n-\n-\tixrRegexp = regexp.MustCompile(`(?i)\\bixr-`)\n )\n \n // Register registers the node in the NodeRegistry.\n func Register(r *clabnodes.NodeRegistry) {\n \tgenerateNodeAttributes := clabnodes.NewGenerateNodeAttributes(generateable, generateIfFormat)\n@@ -241,10 +216,14 @@ type sros struct {\n \t// rootCtrName is the container that owns the netns.\n \t//  - for components based: the internal netns container.\n \t//  - for network mode based: parsed from network-mode.\n \trootCtrName string\n \n+\t// userEnv is the env map from the topology, before component fields are merged in.\n+\t// Node env overrides component type, XIOM, MDA, SFM, and per-component env.\n+\tuserEnv map[string]string\n+\n \tpreDeployParams *clabnodes.PreDeployParams\n \n \tnetnsNode clabnodes.Node\n }\n \n@@ -279,16 +258,44 @@ func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) err\n \t// if user was not initialized to a value, use root\n \tif n.Cfg.User == \"\" {\n \t\tn.Cfg.User = \"0:0\"\n \t}\n \n-\tif sfm := n.kindSpecificCfg().SFM; sfm != \"\" {\n+\t// Snapshot topology env before component and SFM flags are applied.\n+\t// Component nodes set userEnv from the base node before Init.\n+\tenvAlreadyResolved := n.userEnv != nil\n+\tif !envAlreadyResolved {\n \t\tif n.Cfg.Env == nil {\n-\t\t\tn.Cfg.Env = map[string]string{}\n+\t\t\tn.userEnv = map[string]string{}\n+\t\t} else {\n+\t\t\tn.userEnv = maps.Clone(n.Cfg.Env)\n \t\t}\n+\t}\n+\tif n.Cfg.Env == nil {\n+\t\tn.Cfg.Env = map[string]string{}\n+\t}\n \n-\t\tn.Cfg.Env[envNokiaSrosSFM] = sfm\n+\t// Distributed cards inherit SFM from the base node env. Applying it again\n+\t// would warn once per card when the user also set NOKIA_SROS_SFM.\n+\tif sfm := n.kindSpecificCfg().SFM; sfm != \"\" && !envAlreadyResolved {\n+\t\tif envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {\n+\t\t\tif envSFM != sfm {\n+\t\t\t\tlog.Warn(\n+\t\t\t\t\tfmt.Sprintf(\n+\t\t\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n+\t\t\t\t\t\tsfm,\n+\t\t\t\t\t\tenvNokiaSrosSFM,\n+\t\t\t\t\t),\n+\t\t\t\t\t\"node\", n.Cfg.ShortName,\n+\t\t\t\t\t\"env\", envNokiaSrosSFM,\n+\t\t\t\t\t\"component-value\", sfm,\n+\t\t\t\t\t\"env-value\", envSFM,\n+\t\t\t\t)\n+\t\t\t}\n+\t\t} else {\n+\t\t\tn.Cfg.Env[envNokiaSrosSFM] = sfm\n+\t\t}\n \t}\n \n \tmaps.Copy(n.Cfg.Sysctls, srosSysctl)\n \n \t// make sure we always have uppercase slot definition\n@@ -316,10 +323,11 @@ func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) err\n \n \t\tvars, err := n.setupStandaloneComponents()\n \t\tif err != nil {\n \t\t\treturn err\n \t\t}\n+\t\twarnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)\n \n \t\t// n.Cfg.Env overrides component vars, overrides default srosEnv\n \t\tn.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)\n \t\tlog.Debug(\"Merged env file\", \"env\", fmt.Sprintf(\"%+v\", n.Cfg.Env), \"node\", n.Cfg.ShortName)\n \t} else {\n@@ -348,12 +356,15 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {\n \tif len(n.kindSpecificCfg().Components) == 0 {\n \t\treturn nil, nil\n \t}\n \tif len(n.kindSpecificCfg().Components) > 1 {\n \t\treturn nil, fmt.Errorf(\n-\t\t\t\"expected at most one component override for standalone SR-SIM node %q\",\n+\t\t\t\"expected at most one component override for standalone SR-SIM node %q, \"+\n+\t\t\t\t\"or one component per slot %s for redundant type %q\",\n \t\t\tn.Cfg.ShortName,\n+\t\t\tstrings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), \"/\"),\n+\t\t\tn.Cfg.NodeType,\n \t\t)\n \t}\n \n \tslotA := n.kindSpecificCfg().Components[0]\n \n@@ -370,27 +381,11 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {\n \t\t\tn.Cfg.ShortName,\n \t\t)\n \t}\n \tvars[envNokiaSrosSlot] = slotName\n \n-\tif slotA.Type != \"\" {\n-\t\tif isSingleSlotIntegratedSrosNodeType(n.Cfg.NodeType) {\n-\t\t\treturn nil, fmt.Errorf(\n-\t\t\t\t\"node %q type %q is integrated and does not support component card-type override\",\n-\t\t\t\tn.Cfg.ShortName,\n-\t\t\t\tn.Cfg.NodeType,\n-\t\t\t)\n-\t\t}\n-\t\tvars[envNokiaSrosCard] = slotA.Type\n-\t}\n-\n-\tif len(slotA.MDA) > 0 {\n-\t\tfor _, m := range slotA.MDA {\n-\t\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n-\t\t\tvars[key] = m.Type\n-\t\t}\n-\t}\n+\tsetComponentEnvVars(vars, slotA)\n \n \tmaps.Copy(vars, slotA.Env)\n \n \treturn vars, nil\n }\n@@ -625,39 +620,10 @@ func (n *sros) Delete(ctx context.Context) error {\n \terrs = append(errs, n.DefaultNode.Delete(ctx), n.netnsNode.Delete(ctx))\n \n \treturn errors.Join(errs...)\n }\n \n-// DeleteNetnsSymlink deletes the symlink file created for the container netns.\n-func (n *sros) DeleteNetnsSymlink() error {\n-\tvar errs []error\n-\n-\t// if it is the base node, then we need to delete the symlink for all the components.\n-\tif n.isDistributedBaseNode() {\n-\t\tfor _, componentNode := range n.componentNodes {\n-\t\t\terrs = append(errs, componentNode.DeleteNetnsSymlink())\n-\t\t}\n-\t\tif n.netnsNode != nil {\n-\t\t\terrs = append(errs, n.netnsNode.DeleteNetnsSymlink())\n-\t\t}\n-\t\terrs = append(errs, clabutils.DeleteNetnsSymlink(n.Cfg.LongName))\n-\t}\n-\n-\terrs = append(errs, n.DefaultNode.DeleteNetnsSymlink(), n.cleanupParkingNetNS())\n-\n-\treturn errors.Join(errs...)\n-}\n-\n-func (n *sros) cleanupParkingNetNS() error {\n-\tname := clabutils.ParkingNetnsName(n.Cfg.LongName)\n-\tif _, err := clabutils.GetNamedNetNS(name); err != nil {\n-\t\treturn nil\n-\t}\n-\n-\treturn netns.DeleteNamed(name)\n-}\n-\n func (n *sros) setupComponentNodes() error {\n \tif !n.isDistributedBaseNode() {\n \t\treturn nil\n \t}\n \n@@ -693,17 +659,16 @@ func (n *sros) setupComponentNodes() error {\n \t\tcomponentConfig.Fqdn = n.calcComponentFqdn(c.Slot)\n \t\tcomponentConfig.DNS = nil\n \t\tcomponentConfig.PortBindings = nil\n \t\tcomponentConfig.PortSet = nil\n \n-\t\t// add the component env to the componentConfig env\n-\t\tfor k, v := range c.Env {\n-\t\t\tcomponentConfig.Env[k] = v\n+\t\t// Component fields fill env keys the user did not set. Node env wins.\n+\t\tif componentConfig.Env == nil {\n+\t\t\tcomponentConfig.Env = map[string]string{}\n \t\t}\n-\n-\t\t// set component environment variables\n-\t\tn.setComponentEnvVars(componentConfig, c)\n+\t\tkeepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)\n+\t\t// Slot identifies this container. A node-level NOKIA_SROS_SLOT cannot apply to every card.\n \t\tcomponentConfig.Env[envNokiaSrosSlot] = c.Slot\n \n \t\t// adjust label based env vars\n \t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.NodeName)] = componentConfig.ShortName\n \t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.LongName)] = componentConfig.LongName\n@@ -716,10 +681,14 @@ func (n *sros) setupComponentNodes() error {\n \t\tcomponentConfig.Labels[clabconstants.NodeName] = componentConfig.ShortName\n \t\tcomponentConfig.Labels[clabconstants.LongName] = componentConfig.LongName\n \t\tcomponentConfig.Labels[clabconstants.RootNodeName] = n.Cfg.ShortName\n \t\tcomponentConfig.Labels[clabconstants.RootNodeLongName] = n.Cfg.LongName\n \n+\t\t// Preserve the topology env. Init must not snapshot the merged component env,\n+\t\t// or config generation would treat component flags as user overrides.\n+\t\tsrosNode.userEnv = maps.Clone(n.userEnv)\n+\n \t\t// init the component\n \t\terr = componentNode.Init(componentConfig)\n \t\tif err != nil {\n \t\t\treturn err\n \t\t}\n@@ -737,32 +706,10 @@ func (n *sros) setupComponentNodes() error {\n \t\tn.componentNodes = append(n.componentNodes, componentNode)\n \t}\n \treturn nil\n }\n \n-// setComponentEnvVars sets environment variables for a component.\n-func (n *sros) setComponentEnvVars(componentConfig *clabtypes.NodeConfig, c *Component) {\n-\tif c.Type != \"\" {\n-\t\tcomponentConfig.Env[envNokiaSrosCard] = c.Type\n-\t}\n-\n-\tfor _, x := range c.XIOM {\n-\t\tkey := fmt.Sprintf(\"%s_X%d\", envNokiaSrosXIOM, x.Slot)\n-\t\tcomponentConfig.Env[key] = x.Type\n-\t\t// add the nested MDA\n-\t\tfor _, m := range x.MDA {\n-\t\t\tkey := fmt.Sprintf(\"%s_X%d_%d\", envNokiaSrosMDA, x.Slot, m.Slot)\n-\t\t\tcomponentConfig.Env[key] = m.Type\n-\t\t}\n-\t}\n-\n-\tfor _, m := range c.MDA {\n-\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n-\t\tcomponentConfig.Env[key] = m.Type\n-\t}\n-}\n-\n // deployFabric deploys the distributed SR-SIM when the `components` key is present.\n func (n *sros) deployFabric(ctx context.Context, deployParams *clabnodes.DeployParams) error {\n \tnetnsConfig := n.netnsNode.Config()\n \n \tnetnsConfig.MgmtIPv4Address = n.Cfg.MgmtIPv4Address\n@@ -870,30 +817,20 @@ func (n *sros) isDistributedCardNode() bool {\n \n // isDistributedBaseNode returns true if this is the base node of a distributed\n // SR-SIM deployment. The base node orchestrates multiple component nodes.\n func (n *sros) isDistributedBaseNode() bool {\n \tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n-\t\treturn false\n+\t\treturn isRedundantIntegratedSrosComponents(n.Cfg.NodeType, n.kindSpecificCfg().Components)\n \t}\n \treturn len(n.kindSpecificCfg().Components) > 1\n }\n \n // isStandaloneNode returns true if this is a standalone (non-distributed) SR-SIM node.\n func (n *sros) isStandaloneNode() bool {\n \treturn !n.isDistributedBaseNode() && !n.isDistributedCardNode()\n }\n \n-// GetNSPath retrieves the Namespace Path.\n-func (n *sros) GetNSPath(ctx context.Context) (string, error) {\n-\tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == \"\") {\n-\t\treturn n.DefaultNode.GetNSPath(ctx)\n-\t} else if n.isDistributedCardNode() {\n-\t\treturn n.Runtime.GetNSPath(ctx, n.rootCtrName)\n-\t}\n-\treturn n.netnsNode.GetNSPath(ctx)\n-}\n-\n // calcComponentName appends the line card suffix to the given node name.\n func (n *sros) calcComponentName(name, slot string) string {\n \tif n.renameDone {\n \t\treturn name\n \t}\n@@ -934,19 +871,18 @@ func (n *sros) cpmNode() (clabnodes.Node, error) {\n }\n \n // cpmSlot returns the Slot of the preferred CPM Node (used when Distributed mode).\n // It prefers slot A if present, otherwise returns slot B.\n func (n *sros) cpmSlot() (string, error) {\n-\t// Prefer slot A, fall back to slot B\n+\t// Prefer slot A, fall back to slot B. Slots are accepted in either case.\n \tfor _, comp := range n.kindSpecificCfg().Components {\n-\t\tif comp.Slot == slotAName {\n+\t\tif strings.EqualFold(comp.Slot, slotAName) {\n \t\t\treturn slotAName, nil\n \t\t}\n \t}\n-\t// Check for slot B as fallback\n \tfor _, comp := range n.kindSpecificCfg().Components {\n-\t\tif comp.Slot == slotBName {\n+\t\tif strings.EqualFold(comp.Slot, slotBName) {\n \t\t\treturn slotBName, nil\n \t\t}\n \t}\n \treturn \"\", fmt.Errorf(\"node %s: unable to determine default slot\", n.GetShortName())\n }\n@@ -1041,33 +977,10 @@ func (*sros) checkKernelVersion() error {\n \t\t)\n \t}\n \treturn nil\n }\n \n-// checkComponentSlotsConfig check the sros component slot config for validity.\n-func (n *sros) checkComponentSlotsConfig() error {\n-\t// check Slots are unique\n-\tcomponentNames := map[string]struct{}{}\n-\tfor _, component := range n.kindSpecificCfg().Components {\n-\t\t// convert slot to upper\n-\t\tslot := strings.ToUpper(component.Slot)\n-\t\t// check if slot exists\n-\t\t_, exists := componentNames[slot]\n-\t\tif exists {\n-\t\t\treturn fmt.Errorf(\n-\t\t\t\t\"node %s slot %s duplicate definition\",\n-\t\t\t\tn.GetShortName(),\n-\t\t\t\tcomponent.Slot,\n-\t\t\t)\n-\t\t}\n-\t\t// add to component names map\n-\t\tcomponentNames[component.Slot] = struct{}{}\n-\n-\t}\n-\treturn nil\n-}\n-\n func (n *sros) CheckDeploymentConditions(ctx context.Context) error {\n \t// perform the sros specific kernel version check\n \terr := n.checkKernelVersion()\n \tif err != nil {\n \t\treturn err\n@@ -1148,13 +1061,53 @@ func (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {\n \tlicensed := append([]byte(chassisInfoFileLicense), content...)\n \tif err := os.WriteFile(dstPath, licensed, clabconstants.PermissionsFileDefault); err != nil {\n \t\treturn fmt.Errorf(\"write %s: %w\", dstPath, err)\n \t}\n \tlog.Debug(\"Wrote chassis_info.json to lab dir\", \"node\", n.Cfg.ShortName, \"path\", dstPath)\n+\tn.warnUnsupportedComponents(content)\n \treturn nil\n }\n \n+// warnUnsupportedComponents validates the effective component configuration against the\n+// chassis_info.json extracted from this exact image. Validation is advisory and never blocks\n+// deploy.\n+func (n *sros) warnUnsupportedComponents(content []byte) {\n+\t// A distributed node validates once, from CPM A, to avoid duplicate warnings from CPM B.\n+\tif !n.isStandaloneNode() && !n.isCPM(slotAName) {\n+\t\treturn\n+\t}\n+\n+\tinfo, err := parseChassisInfo(content)\n+\tif err != nil {\n+\t\tlog.Warn(\"Could not validate SR-SIM components against chassis_info.json\",\n+\t\t\t\"node\", n.Cfg.ShortName, \"error\", err)\n+\t\treturn\n+\t}\n+\n+\tcomponents := n.rootComponents\n+\tif len(components) == 0 {\n+\t\tcomponents = n.kindSpecificCfg().Components\n+\t}\n+\n+\teffective := n.componentsForConfig(components)\n+\tif len(effective) == 0 {\n+\t\t// Environment variables can configure integrated hardware without a components entry.\n+\t\teffective = []*Component{n.componentForConfig(nil)}\n+\t}\n+\n+\tnodeType := n.Cfg.NodeType\n+\tif chassis := strings.TrimSpace(n.Cfg.Env[envNokiaSrosChassis]); chassis != \"\" {\n+\t\tnodeType = chassis\n+\t}\n+\tfor _, warning := range info.componentWarnings(nodeType, n.componentSFM(), effective) {\n+\t\tlog.Warn(\"SR-SIM component configuration may not be supported\",\n+\t\t\t\"node\", n.Cfg.ShortName,\n+\t\t\t\"chassis\", nodeType,\n+\t\t\t\"warning\", warning)\n+\t}\n+}\n+\n // Func that Places the Certificates in the right place and format.\n func (n *sros) createSROSCertificates() error {\n \tif *n.Cfg.Certificate.Issue {\n \t\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),\n \t\t\tclabconstants.PermissionsOpen)\n@@ -1170,88 +1123,10 @@ func (n *sros) createSROSCertificates() error {\n \t\t}\n \t}\n \treturn nil\n }\n \n-// createSROSConfigFiles handles config generation for the SR-SIM kind.\n-// Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).\n-func (n *sros) createSROSConfigFiles() error {\n-\t// Get version from image before generating config\n-\tif n.swVersion == nil {\n-\t\tctx := context.Background()\n-\t\tversion, err := n.srosVersionFromImage(ctx)\n-\t\tif err != nil {\n-\t\t\tn.swVersion = n.parseVersionString(srosDefaultVersion)\n-\t\t\tlog.Warn(\"Failed to get SR OS version from image\",\n-\t\t\t\t\"node\", n.Cfg.ShortName, \"version\", n.swVersion, \"error\", err)\n-\t\t} else {\n-\t\t\tn.swVersion = version\n-\t\t\tlog.Info(\"Retrieved SR OS version from image\",\n-\t\t\t\t\"node\", n.Cfg.ShortName,\n-\t\t\t\t\"version\", fmt.Sprintf(\"%s.%s.%s\", version.Major, version.Minor, version.Build))\n-\t\t}\n-\t}\n-\n-\t// Path pointing to the target config file under configCf3 dir\n-\tcf3CfgFile := filepath.Join(\n-\t\tn.Cfg.LabDir,\n-\t\tn.Cfg.Env[envNokiaSrosSlot],\n-\t\tconfigCf3,\n-\t\tstartupCfgName,\n-\t)\n-\tisPartial := clabutils.IsPartialConfigFile(n.Cfg.StartupConfig)\n-\n-\t// generate config and use that to boot node\n-\tlog.Debug(\"Reading startup-config\", \"node\", n.Cfg.ShortName, \"startup-config\",\n-\t\tn.Cfg.StartupConfig, \"isPartial\", isPartial)\n-\n-\tstartupConfig, err := n.buildStartupConfig(isPartial)\n-\tif err != nil {\n-\t\treturn err\n-\t}\n-\n-\tif startupConfig == \"\" {\n-\t\tlog.Debug(\n-\t\t\t\"startup config is empty, skipping startup config file generation\",\n-\t\t\t\"node\",\n-\t\t\tn.Cfg.ShortName,\n-\t\t)\n-\t\treturn nil\n-\t}\n-\n-\treturn n.GenerateConfig(cf3CfgFile, startupConfig)\n-}\n-\n-// buildStartupConfig returns the full startup config string: either from user file (full config)\n-// or from default + partial config generation. It does not return a template; the name is\n-// historical.\n-func (n *sros) buildStartupConfig(isPartial bool) (string, error) {\n-\t// User provides full startup config\n-\tif n.Cfg.StartupConfig != \"\" && !isPartial {\n-\t\tc, err := os.ReadFile(n.Cfg.StartupConfig)\n-\t\tif err != nil {\n-\t\t\treturn \"\", err\n-\t\t}\n-\n-\t\tcBuf, err := clabutils.SubstituteEnvsAndTemplate(bytes.NewReader(c), n.Cfg)\n-\t\tif err != nil {\n-\t\t\treturn \"\", err\n-\t\t}\n-\t\treturn cBuf.String(), nil\n-\t}\n-\n-\t// Generate default config and optionally add partial config\n-\tif err := n.addDefaultConfig(); err != nil {\n-\t\treturn \"\", err\n-\t}\n-\tif err := n.addPartialConfig(); err != nil {\n-\t\treturn \"\", err\n-\t}\n-\n-\treturn string(n.startupCliCfg), nil\n-}\n-\n // SlotIsInteger checks if the slot string represents a valid integer.\n func SlotIsInteger(s string) bool {\n \t_, err := strconv.Atoi(s)\n \treturn err == nil\n }\n@@ -1279,221 +1154,10 @@ func (n *sros) isCPM(cpm string) bool {\n \t}\n \n \treturn true\n }\n \n-// prepareConfigTemplateData prepares all data needed for template selection and execution.\n-// Service configs are filled from a single table-driven result: variant → getFullSnippetSet(v).\n-func (n *sros) prepareConfigTemplateData() (*srosTemplateData, error) {\n-\tb, err := n.banner()\n-\tif err != nil {\n-\t\treturn nil, err\n-\t}\n-\n-\tcomponentConfig := \"\"\n-\tif !isFullConfigFile(n.Cfg.StartupConfig) {\n-\t\tcomponentConfig = n.generateComponentConfig()\n-\t} else {\n-\t\tlog.Debugf(\n-\t\t\t\"SR-SIM node %q has non-partial startup-config defined, skipping component config gen\",\n-\t\t\tn.Cfg.LongName,\n-\t\t)\n-\t}\n-\n-\tv := n.resolveConfigVariant()\n-\tsnippets := getFullSnippetSet(v)\n-\tconfigMode := string(v.Mode)\n-\tif v.ForceClassic {\n-\t\tlog.Warn(\n-\t\t\t\"SAR-Hm nodes only support classic configuration mode. Overriding configuration mode to 'classic'\",\n-\t\t\t\"node\",\n-\t\t\tn.Cfg.LongName,\n-\t\t\t\"node-type\",\n-\t\t\tstrings.ToLower(n.Cfg.NodeType),\n-\t\t)\n-\t\tconfigMode = string(ConfigModeClassic)\n-\t\tn.kindSpecificCfg().ConfigMode = ConfigModeClassic\n-\t}\n-\n-\ttplData := &srosTemplateData{\n-\t\t// Selection criteria\n-\t\tNodeType:          strings.ToLower(n.Cfg.NodeType),\n-\t\tConfigurationMode: configMode,\n-\t\tSwVersion:         n.swVersion,\n-\t\tIsSecureGrpc:      *n.Cfg.Certificate.Issue,\n-\n-\t\t// Node data\n-\t\tName:            n.Cfg.ShortName,\n-\t\tTLSKey:          n.Cfg.TLSKey,\n-\t\tTLSCert:         n.Cfg.TLSCert,\n-\t\tTLSAnchor:       n.Cfg.TLSAnchor,\n-\t\tBanner:          b,\n-\t\tIFaces:          map[string]tplIFace{},\n-\t\tMgmtMTU:         0,\n-\t\tMgmtIPMTU:       n.Runtime.Mgmt().MTU,\n-\t\tComponentConfig: componentConfig,\n-\n-\t\t// Service configs from variant (single source of truth)\n-\t\tSystemConfig:  snippets.SystemConfig,\n-\t\tGRPCConfig:    snippets.GRPCConfig,\n-\t\tSNMPConfig:    snippets.SNMPConfig,\n-\t\tNetconfConfig: snippets.NetconfConfig,\n-\t\tLoggingConfig: snippets.LoggingConfig,\n-\t\tSSHConfig:     snippets.SSHConfig,\n-\t}\n-\n-\tif n.Config().DNS != nil {\n-\t\ttplData.DNSServers = append(tplData.DNSServers, n.Config().DNS.Servers...)\n-\t}\n-\n-\tn.prepareSSHPubKeys(tplData)\n-\n-\tn.setVersionSpecificParams(tplData)\n-\n-\treturn tplData, nil\n-}\n-\n-// isIXRNode returns true if this is an IXR node type (case-insensitive).\n-func (n *sros) isIXRNode() bool {\n-\treturn ixrRegexp.MatchString(n.Cfg.NodeType)\n-}\n-\n-// isSARNode returns true if this is a SAR node type (case-insensitive).\n-func (n *sros) isSARNode() bool {\n-\treturn sarRegexp.MatchString(n.Cfg.NodeType)\n-}\n-\n-// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).\n-func (n *sros) isSARHmNode() bool {\n-\treturn sarHmRegexp.MatchString(n.Cfg.NodeType)\n-}\n-\n-// getTemplateForVariant returns the template string and name for the given config variant.\n-// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= \"26\").\n-func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {\n-\t// Model-driven (or mixed treated as classic below when family is classic)\n-\tif v.Mode == ConfigModeModelDriven {\n-\t\t// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= \"26\"\n-\t\t// { return cfgTplSROS26, \"clab-sros-config-sros26\" }\n-\t\treturn cfgTplSROS25, \"clab-sros-config-sros25\"\n-\t}\n-\t// Classic (or mixed)\n-\ttmpl = cfgTplClassic\n-\ttplName = \"clab-sros-config-classic\"\n-\tswitch v.Family {\n-\tcase ConfigFamilyIXR:\n-\t\treturn cfgTplClassicIxr, \"clab-sros-config-classic-ixr\"\n-\tcase ConfigFamilySAR:\n-\t\treturn cfgTplClassicSar, \"clab-sros-config-classic-sar\"\n-\tdefault:\n-\t\treturn tmpl, tplName\n-\t}\n-}\n-\n-// selectConfigTemplate chooses the config template from the config variant (mode + family).\n-func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {\n-\tv := n.resolveConfigVariant()\n-\ttmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)\n-\treturn template.New(tplName).\n-\t\tFuncs(clabutils.CreateFuncs()).\n-\t\tParse(tmpl)\n-}\n-\n-// addDefaultConfig adds sros default configuration such as tls certs, gnmi/json-rpc, login-banner,\n-// ssh keys.\n-func (n *sros) addDefaultConfig() error {\n-\t// Prepare all template data\n-\ttplData, err := n.prepareConfigTemplateData()\n-\tif err != nil {\n-\t\treturn err\n-\t}\n-\n-\t// Select appropriate template\n-\tsrosCfgTpl, err := n.selectConfigTemplate(tplData)\n-\tif err != nil {\n-\t\treturn fmt.Errorf(\"failed to select config template: %w\", err)\n-\t}\n-\tlog.Debug(\"Prepare SR OS config template\", \"template\", srosCfgTpl.Name(),\n-\t\t\"node\", n.Cfg.LongName,\n-\t\t\"configuration-mode\", tplData.ConfigurationMode,\n-\t\t\"node-type\", tplData.NodeType,\n-\t\t\"secure-grpc\", tplData.IsSecureGrpc,\n-\t\t\"sw-version\", tplData.SwVersion)\n-\n-\t// Execute template\n-\tbuf := new(bytes.Buffer)\n-\terr = srosCfgTpl.Execute(buf, tplData)\n-\tif err != nil {\n-\t\treturn err\n-\t}\n-\n-\tif buf.Len() == 0 {\n-\t\tlog.Warn(\n-\t\t\t\"Buffer empty, template parsing error\",\n-\t\t\t\"node\", n.Cfg.ShortName,\n-\t\t\t\"template\", srosCfgTpl.Name(),\n-\t\t)\n-\t} else {\n-\t\tlog.Debug(\"Additional default config parsed\",\n-\t\t\t\"node\", n.Cfg.ShortName,\n-\t\t\t\"template\", srosCfgTpl.Name())\n-\t\tn.startupCliCfg = append(n.startupCliCfg, buf.String()...)\n-\t}\n-\n-\treturn nil\n-}\n-\n-// applyPartialConfig applies partial configuration to the SR OS.\n-func (n *sros) addPartialConfig() error {\n-\tif n.Cfg.StartupConfig != \"\" {\n-\t\t// b holds the configuration to be applied to the node\n-\t\tb := &bytes.Buffer{}\n-\t\t// apply partial configs if partial config is used\n-\t\tif clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM(\"\") {\n-\t\t\tlog.Info(\"Adding configuration\",\n-\t\t\t\t\"node\", n.Cfg.LongName,\n-\t\t\t\t\"type\", \"partial\",\n-\t\t\t\t\"source\", n.Cfg.StartupConfig)\n-\n-\t\t\tr, err := os.Open(n.Cfg.StartupConfig)\n-\t\t\tif err != nil {\n-\t\t\t\treturn err\n-\t\t\t}\n-\n-\t\t\tdefer r.Close() // skipcq: GO-S2307\n-\n-\t\t\t_, err = io.Copy(b, r)\n-\t\t\tif err != nil {\n-\t\t\t\treturn err\n-\t\t\t}\n-\n-\t\t\tconfigContent, err := clabutils.SubstituteEnvsAndTemplate(b, n.Cfg)\n-\t\t\tif err != nil {\n-\t\t\t\treturn err\n-\t\t\t}\n-\t\t\tif configContent.Len() == 0 {\n-\t\t\t\tlog.Warn(\n-\t\t\t\t\t\"Buffer empty, PARTIAL config template parsing error\",\n-\t\t\t\t\t\"node\",\n-\t\t\t\t\tn.Cfg.ShortName,\n-\t\t\t\t)\n-\t\t\t} else {\n-\t\t\t\tlog.Debug(\"Additional PARTIAL config parsed\", \"node\",\n-\t\t\t\t\tn.Cfg.ShortName, \"partial-config\", configContent.String())\n-\t\t\t\tn.startupCliCfg = append(n.startupCliCfg, configContent.String()...)\n-\t\t\t}\n-\t\t} else {\n-\t\t\tlog.Warn(\n-\t\t\t\t\"Passed startup-config option, but it will not have any effect\",\n-\t\t\t\t\"node\",\n-\t\t\t\tn.Cfg.ShortName,\n-\t\t\t)\n-\t\t}\n-\t}\n-\treturn nil\n-}\n-\n func (n *sros) GetContainers(ctx context.Context) ([]clabruntime.GenericContainer, error) {\n \t// if not a distributed setup call regular GetContainers\n \tif n.isStandaloneNode() || n.isDistributedCardNode() {\n \t\treturn n.DefaultNode.GetContainers(ctx)\n \t}\n@@ -1761,63 +1425,10 @@ func (n *sros) saveConfigWithAddr(ctx context.Context, addr string) error {\n \t)\n \n \treturn nil\n }\n \n-// BuildPKIImportXML.\n-func buildPKIImportXML(inputURL, outputFile, importType string) string {\n-\taction := etree.NewElement(\"action\")\n-\taction.CreateAttr(\"xmlns\", \"urn:ietf:params:xml:ns:yang:1\")\n-\n-\tadmin := action.CreateElement(\"admin\")\n-\tadmin.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:oper-admin\")\n-\n-\timportElem := admin.CreateElement(\"system\").\n-\t\tCreateElement(\"security\").\n-\t\tCreateElement(\"pki\").\n-\t\tCreateElement(\"import\")\n-\n-\t// Add import parameters\n-\timportElem.CreateElement(\"input-url\").SetText(inputURL)\n-\timportElem.CreateElement(\"output-file\").SetText(outputFile)\n-\timportElem.CreateElement(\"type\").SetText(importType)\n-\timportElem.CreateElement(\"format\").SetText(\"pem\")\n-\tvar buf bytes.Buffer\n-\taction.WriteTo(&buf, &etree.WriteSettings{\n-\t\tCanonicalText:    false,\n-\t\tCanonicalAttrVal: false,\n-\t})\n-\treturn buf.String()\n-}\n-\n-// BuildTLSProfileXML builds the TLS profile configuration XML.\n-func buildTLSProfileXML() string {\n-\tconfig := etree.NewElement(\"config\")\n-\tconfigure := config.CreateElement(\"configure\")\n-\tconfigure.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:conf\")\n-\tconfigure.CreateAttr(\"xmlns:nc\", \"urn:ietf:params:xml:ns:netconf:base:1.0\")\n-\n-\tcertProfile := configure.CreateElement(\"system\").\n-\t\tCreateElement(\"security\").\n-\t\tCreateElement(\"tls\").\n-\t\tCreateElement(\"cert-profile\")\n-\n-\t// Set operation attribute\n-\tcertProfile.CreateAttr(\"nc:operation\", \"merge\")\n-\n-\t// Add profile configuration\n-\tcertProfile.CreateElement(\"cert-profile-name\").SetText(tlsCertProfileName)\n-\tcertProfile.CreateElement(\"admin-state\").SetText(\"enable\")\n-\n-\tvar buf bytes.Buffer\n-\tconfig.WriteTo(&buf, &etree.WriteSettings{\n-\t\tCanonicalText:    false,\n-\t\tCanonicalAttrVal: false,\n-\t})\n-\treturn buf.String()\n-}\n-\n // TLS bootstrap via NETCONF to enable secure gRPC.\n func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {\n \t// Always import PKI key and cert:\n \t// \t import \"cf3:\\node.key\" in PEM format as \"cf3:\\system-pki\\node.key\" (encrypted DER)\n \t//   import \"cf3:\\node.crt\" in PEM format as \"cf3:\\system-pki\\node.crt\" (encrypted DER)\n@@ -1867,23 +1478,10 @@ func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {\n \t\t}\n \t}\n \treturn err\n }\n \n-// isConfigClassic reports whether the node is in classic or mixed configuration mode.\n-func (n *sros) isConfigClassic() bool {\n-\tmode := n.kindSpecificCfg().ConfigMode\n-\treturn mode == ConfigModeClassic || mode == ConfigModeMixed\n-}\n-\n-// isFullConfigFile returns true if the config file doesn't contain .partial substring\n-// and the config file is NOT nil (ie. startup config IS defined).\n-// it is intended that the 'c' arg is n.Cfg.StartupConfig.\n-func isFullConfigFile(c string) bool {\n-\treturn c != \"\" && !clabutils.IsPartialConfigFile(c)\n-}\n-\n func (n *sros) IsHealthy(_ context.Context) (bool, error) {\n \tif !n.isCPM(\"\") {\n \t\treturn true, fmt.Errorf(\"node %q is not a CPM, healthcheck has no effect\", n.Cfg.LongName)\n \t}\n \t// non-partial user startup config might not have any netconf config\n@@ -2082,67 +1680,10 @@ func (n *sros) MgmtIPAddr() (string, error) {\n \t\t\"no management IP address (IPv4 or IPv6) configured for node %q\",\n \t\tn.Cfg.LongName,\n \t)\n }\n \n-// generateComponentConfig generates SR OS configuration for explicitly defined distributed\n-// components or known integrated SR-SIM defaults. Power config is appended when supported.\n-func (n *sros) generateComponentConfig() string {\n-\tif !n.kindSpecificCfg().GenComponentConfig {\n-\t\treturn \"\"\n-\t}\n-\tif n.isConfigClassic() {\n-\t\treturn \"\"\n-\t}\n-\n-\tcomponents := n.rootComponents\n-\tif len(components) == 0 {\n-\t\tif len(n.kindSpecificCfg().Components) > 1 || n.rootCtrName != \"\" {\n-\t\t\treturn \"\"\n-\t\t}\n-\n-\t\tlines := buildIntegratedComponentCfgLines(n.Cfg.NodeType, n.Cfg.Env)\n-\t\tif len(lines) == 0 {\n-\t\t\treturn \"\"\n-\t\t}\n-\t\treturn n.componentConfigFromLines(lines)\n-\t}\n-\n-\tfor _, c := range components {\n-\t\tslot := strings.ToUpper(strings.TrimSpace(c.Slot))\n-\t\tif slot == slotAName || slot == slotBName {\n-\t\t\tcontinue\n-\t\t}\n-\t\tif c.Type == \"\" {\n-\t\t\tlog.Warn(\n-\t\t\t\t\"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.\",\n-\t\t\t\t\"node\",\n-\t\t\t\tn.Cfg.ShortName,\n-\t\t\t\t\"slot\",\n-\t\t\t\tslot,\n-\t\t\t)\n-\t\t}\n-\t}\n-\n-\tlines := buildComponentCfgLines(components, n.kindSpecificCfg().SFM)\n-\treturn n.componentConfigFromLines(lines)\n-}\n-\n-func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {\n-\tpowerConfig := n.generatePowerConfig()\n-\tif len(lines) == 0 && powerConfig == \"\" {\n-\t\treturn \"\"\n-\t}\n-\n-\tvar config strings.Builder\n-\tfor _, l := range lines {\n-\t\tconfig.WriteString(l.String())\n-\t}\n-\tconfig.WriteString(powerConfig)\n-\treturn config.String()\n-}\n-\n // override to fetch CPM to avoid renaming the base node to CPM A.\n func (n *sros) GetContainerName() string {\n \tif n.isDistributedBaseNode() && n.cpmContainerName != \"\" {\n \t\treturn n.cpmContainerName\n \t}\n@@ -2365,32 +1906,5 @@ func (n *sros) RestoreEndpoints(ctx context.Context) error {\n \tif err != nil {\n \t\treturn err\n \t}\n \treturn clabutils.LinkContainerNS(nsPath, n.Cfg.LongName)\n }\n-\n-func (n *sros) ensureNetnsRunning(ctx context.Context) error {\n-\tswitch status := n.netnsNode.GetContainerStatus(ctx); status {\n-\tcase clabruntime.Running:\n-\t\t// The namespace holder intentionally survives regular node lifecycle operations.\n-\tcase clabruntime.Created, clabruntime.Stopped:\n-\t\tif err := n.netnsNode.Start(ctx); err != nil {\n-\t\t\treturn fmt.Errorf(\"node %q network namespace container start error: %w\",\n-\t\t\t\tn.Cfg.ShortName, err)\n-\t\t}\n-\tcase clabruntime.Paused:\n-\t\tif err := n.Runtime.UnpauseContainer(ctx, n.netnsNode.Config().LongName); err != nil {\n-\t\t\treturn fmt.Errorf(\"node %q network namespace container unpause error: %w\",\n-\t\t\t\tn.Cfg.ShortName, err)\n-\t\t}\n-\tcase clabruntime.NotFound:\n-\t\treturn fmt.Errorf(\n-\t\t\t\"node %q network namespace container %q not found; recreate the node\",\n-\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName,\n-\t\t)\n-\tdefault:\n-\t\treturn fmt.Errorf(\"node %q network namespace container %q is %s\",\n-\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName, status)\n-\t}\n-\n-\treturn nil\n-}\ndiff --git a/nodes/sros/sros_test.go b/nodes/sros/sros_test.go\nindex 29cace9..dd8aea6 100644\n--- a/nodes/sros/sros_test.go\n+++ b/nodes/sros/sros_test.go\n@@ -272,10 +272,16 @@ func Test_sros_generateComponentConfig(t *testing.T) {\n \t\t\tname:     \"integrated_ixr_e3x_default\",\n \t\t\tnodeType: \"ixr-e3x\",\n \t\t\tcardType: \"imm16-sfp112+15-sfp56+6-qsfpdd\",\n \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"}},\n \t\t},\n+\t\t{\n+\t\t\tname:     \"integrated_ixr_e2sc_default\",\n+\t\t\tnodeType: \"ixr-e2sc\",\n+\t\t\tcardType: \"imm16-sfp++4-sfp28\",\n+\t\t\tmdas:     MDAS{{Slot: 1, Type: \"m16-sfp++4-sfp28\"}},\n+\t\t},\n \t\t{\n \t\t\tname:     \"integrated_ixr_ec_default\",\n \t\t\tnodeType: \"ixr-ec\",\n \t\t\tcardType: \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\"}},\n@@ -311,40 +317,116 @@ func Test_sros_generateComponentConfig(t *testing.T) {\n \t\t\t\tassert.Equal(t, 4, strings.Count(cfg, \"power-module-type ps-a-dc-6000\"))\n \t\t\t}\n \t\t})\n \t}\n \n-\tt.Run(\"integrated_env_overrides_preserve_default_mda_slots\", func(t *testing.T) {\n+\tt.Run(\"integrated_component_mda_override_preserves_default_mda_slots\", func(t *testing.T) {\n+\t\tn := newSrosComponentConfigTestNode(\"sr-1\", nil, []*Component{\n+\t\t\t{MDA: MDAS{{Slot: 1, Type: \"custom-mda\"}}},\n+\t\t})\n+\n+\t\tcfg := n.generateComponentConfig()\n+\n+\t\tassert.Contains(t, cfg, \"/configure card 1 card-type iom-1 admin-state enable\")\n+\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type custom-mda admin-state enable\")\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfg,\n+\t\t\t\"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable\",\n+\t\t)\n+\t})\n+\n+\tt.Run(\"integrated_xiom_replaces_default_mdas\", func(t *testing.T) {\n+\t\tn := newSrosComponentConfigTestNode(\"sr-1s\", nil, []*Component{\n+\t\t\t{\n+\t\t\t\tXIOM: XIOMS{\n+\t\t\t\t\t{\n+\t\t\t\t\t\tSlot: 1,\n+\t\t\t\t\t\tType: \"iom-s-3.0t\",\n+\t\t\t\t\t\tMDA: MDAS{\n+\t\t\t\t\t\t\t{Slot: 1, Type: \"ms18-100gb-qsfp28\"},\n+\t\t\t\t\t\t\t{Slot: 2, Type: \"ms2-400gb-qsfpdd+2-100gb-qsfp28\"},\n+\t\t\t\t\t\t},\n+\t\t\t\t\t},\n+\t\t\t\t},\n+\t\t\t},\n+\t\t})\n+\n+\t\tcfg := n.generateComponentConfig()\n+\n+\t\tassert.Contains(t, cfg, \"/configure card 1 card-type xcm-1s admin-state enable\")\n+\t\tassert.Contains(t, cfg, \"/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\")\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfg,\n+\t\t\t\"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\",\n+\t\t)\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfg,\n+\t\t\t\"/configure card 1 xiom x1 mda 2 mda-type ms2-400gb-qsfpdd+2-100gb-qsfp28 admin-state enable\",\n+\t\t)\n+\t\tassert.NotContains(t, cfg, \"s36-100gb-qsfp28\")\n+\t})\n+\n+\tt.Run(\"integrated_env_mda_overrides_default_component_config\", func(t *testing.T) {\n \t\tn := newSrosComponentConfigTestNode(\n \t\t\t\"sr-1\",\n-\t\t\tmap[string]string{\n-\t\t\t\tenvNokiaSrosCard:       \"env-card\",\n-\t\t\t\tenvNokiaSrosMDA + \"_1\": \"env-mda\",\n-\t\t\t},\n+\t\t\tmap[string]string{envNokiaSrosMDA + \"_1\": \"env-mda\"},\n \t\t\tnil,\n \t\t)\n \n \t\tcfg := n.generateComponentConfig()\n \n-\t\tassert.Contains(t, cfg, \"/configure card 1 card-type env-card admin-state enable\")\n-\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type env-mda admin-state enable\")\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfg,\n+\t\t\t\"/configure card 1 mda 1 mda-type env-mda admin-state enable\",\n+\t\t)\n \t\tassert.Contains(\n \t\t\tt,\n \t\t\tcfg,\n \t\t\t\"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable\",\n \t\t)\n+\t\tassert.NotContains(t, cfg, \"me6-100gb-qsfp28\")\n \t})\n \n-\tt.Run(\"integrated_env_override_adds_mda_slot\", func(t *testing.T) {\n+\tt.Run(\"integrated_env_mda_overrides_component_mda\", func(t *testing.T) {\n \t\tn := newSrosComponentConfigTestNode(\n-\t\t\t\"ixr-r6\",\n+\t\t\t\"sr-1\",\n+\t\t\tmap[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"},\n+\t\t\t[]*Component{{MDA: MDAS{{Slot: 1, Type: \"from-component\"}}}},\n+\t\t)\n+\n+\t\tcfg := n.generateComponentConfig()\n+\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfg,\n+\t\t\t\"/configure card 1 mda 1 mda-type from-env admin-state enable\",\n+\t\t)\n+\t\tassert.NotContains(t, cfg, \"from-component\")\n+\t})\n+\n+\tt.Run(\"integrated_card_override_skips_component_config\", func(t *testing.T) {\n+\t\tn := newSrosComponentConfigTestNode(\n+\t\t\t\"sr-1s\",\n \t\t\tmap[string]string{\n-\t\t\t\tenvNokiaSrosMDA + \"_3\": \"m20-1g-csfp\",\n+\t\t\t\tenvNokiaSrosCard:       \"cpm-1s\",\n+\t\t\t\tenvNokiaSrosMDA + \"_1\": \"env-mda\",\n \t\t\t},\n \t\t\tnil,\n \t\t)\n \n+\t\tassert.Empty(t, n.generateComponentConfig())\n+\t})\n+\n+\tt.Run(\"integrated_component_override_adds_mda_slot\", func(t *testing.T) {\n+\t\tn := newSrosComponentConfigTestNode(\"ixr-r6\", nil, []*Component{\n+\t\t\t{MDA: MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}}},\n+\t\t})\n+\n \t\tcfg := n.generateComponentConfig()\n \n \t\tassert.Contains(\n \t\t\tt,\n \t\t\tcfg,\n@@ -415,41 +497,174 @@ func Test_sros_integratedComponentOverrides(t *testing.T) {\n \t\trequire.NoError(t, err)\n \t\tassert.True(t, n.isStandaloneNode())\n \t\tassert.Equal(t, slotBName, n.Cfg.Env[envNokiaSrosSlot])\n \t\tassert.Equal(t, \"cpiom-ixr-r6\", n.Cfg.Env[envNokiaSrosCard])\n \t\tassert.Equal(t, \"m20-1g-csfp\", n.Cfg.Env[envNokiaSrosMDA+\"_3\"])\n+\n+\t\tassert.Empty(t, n.generateComponentConfig())\n+\t})\n+\n+\tt.Run(\"integrated_component_xiom_sets_env\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"sr-1s\", []*Component{\n+\t\t\t{\n+\t\t\t\tXIOM: XIOMS{\n+\t\t\t\t\t{\n+\t\t\t\t\t\tSlot: 1,\n+\t\t\t\t\t\tType: \"iom-s-3.0t\",\n+\t\t\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"ms18-100gb-qsfp28\"}},\n+\t\t\t\t\t},\n+\t\t\t\t},\n+\t\t\t},\n+\t\t})\n+\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\tassert.Equal(t, \"iom-s-3.0t\", n.Cfg.Env[envNokiaSrosXIOM+\"_X1\"])\n+\t\tassert.Equal(t, \"ms18-100gb-qsfp28\", n.Cfg.Env[envNokiaSrosMDA+\"_X1_1\"])\n+\n+\t\tcfg := n.generateComponentConfig()\n+\t\tassert.Contains(t, cfg, \"/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\")\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfg,\n+\t\t\t\"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\",\n+\t\t)\n \t})\n \n \tt.Run(\"integrated_rejects_multiple_components\", func(t *testing.T) {\n+\t\tfor _, tc := range []struct {\n+\t\t\tnodeType   string\n+\t\t\tcomponents []*Component\n+\t\t}{\n+\t\t\t{\"sr-1\", []*Component{{Slot: slotAName}, {Slot: slotBName}}},\n+\t\t\t{\"ixr-r6\", []*Component{{Slot: slotAName}, {Slot: \"1\"}}},\n+\t\t\t{\"ixr-r6\", []*Component{{Slot: slotAName}, {}}},\n+\t\t} {\n+\t\t\tn := newSrosInitTestNode(tc.nodeType, tc.components)\n+\n+\t\t\terr := n.Init(n.Cfg)\n+\n+\t\t\trequire.Error(t, err, tc.nodeType)\n+\t\t\tassert.Contains(t, err.Error(), \"at most one component override\")\n+\t\t}\n+\t})\n+\n+\tt.Run(\"redundant_integrated_components_are_distributed\", func(t *testing.T) {\n \t\tn := newSrosInitTestNode(\"ixr-r6\", []*Component{\n-\t\t\t{Slot: slotAName, Type: \"cpiom-ixr-r6\"},\n-\t\t\t{Slot: slotBName, Type: \"cpiom-ixr-r6\"},\n+\t\t\t{Slot: slotAName, MDA: MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}}},\n+\t\t\t{Slot: slotBName},\n \t\t})\n \n-\t\terr := n.Init(n.Cfg)\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\tassert.True(t, n.isDistributedBaseNode())\n+\t\trequire.Len(t, n.componentNodes, 2)\n+\n+\t\tcpmA := n.componentNodes[0].(*sros)\n+\t\tcpmB := n.componentNodes[1].(*sros)\n+\t\tassert.Equal(t, slotAName, cpmA.Config().Env[envNokiaSrosSlot])\n+\t\tassert.Equal(t, slotBName, cpmB.Config().Env[envNokiaSrosSlot])\n+\t\tassert.Equal(t, \"container:n1-netns\", cpmA.Config().NetworkMode)\n+\t\tassert.Equal(t, \"container:n1-netns\", cpmB.Config().NetworkMode)\n+\n+\t\tcfgA := cpmA.generateComponentConfig()\n+\t\tassert.Contains(t, cfgA, \"/configure card 1 card-type iom-ixr-r6 admin-state enable\")\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfgA,\n+\t\t\t\"/configure card 1 mda 1 mda-type m6-10g-sfp++1-100g-qsfp28 admin-state enable\",\n+\t\t)\n+\t\tassert.Contains(t, cfgA, \"/configure card 1 mda 3 mda-type m20-1g-csfp admin-state enable\")\n+\n+\t\tcfgB := cpmB.generateComponentConfig()\n+\t\tassert.Contains(t, cfgB, \"/configure card 1 card-type iom-ixr-r6 admin-state enable\")\n+\t\tassert.NotContains(t, cfgB, \"m20-1g-csfp\")\n+\t})\n+\n+\tt.Run(\"lowercase_integrated_slots_resolve_to_cpm_a\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"ixr-r6\", []*Component{\n+\t\t\t{Slot: \"a\"},\n+\t\t\t{Slot: \"b\"},\n+\t\t})\n+\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\tslot, err := n.cpmSlot()\n+\t\trequire.NoError(t, err)\n+\t\tassert.Equal(t, slotAName, slot)\n+\t})\n+\n+\tt.Run(\"node_env_overrides_component_mda\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"sr-1\", []*Component{\n+\t\t\t{MDA: MDAS{{Slot: 1, Type: \"from-component\"}}},\n+\t\t})\n+\t\tn.Cfg.Env = map[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"}\n+\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\tassert.Equal(t, \"from-env\", n.Cfg.Env[envNokiaSrosMDA+\"_1\"])\n+\n+\t\tcfg := n.generateComponentConfig()\n+\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type from-env admin-state enable\")\n+\t\tassert.NotContains(t, cfg, \"from-component\")\n+\t})\n+\n+\tt.Run(\"node_env_overrides_sfm\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"sr-1\", nil)\n+\t\tkindSpecificConfig.Of(n.Cfg).SFM = \"from-sfm\"\n+\t\tn.Cfg.Env = map[string]string{envNokiaSrosSFM: \"from-env\"}\n+\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\tassert.Equal(t, \"from-env\", n.Cfg.Env[envNokiaSrosSFM])\n+\t})\n+\n+\tt.Run(\"distributed_node_env_overrides_component_mda\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n+\t\t\t{Slot: slotAName, Type: \"cpm-2s\"},\n+\t\t\t{\n+\t\t\t\tSlot: \"1\",\n+\t\t\t\tType: \"xcm-2s\",\n+\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"from-component\"}},\n+\t\t\t},\n+\t\t})\n+\t\tn.Cfg.Env = map[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"}\n+\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\trequire.Len(t, n.componentNodes, 2)\n+\n+\t\tlinecard := n.componentNodes[1].(*sros)\n+\t\tassert.Equal(t, \"from-env\", linecard.Config().Env[envNokiaSrosMDA+\"_1\"])\n+\n+\t\tcfg := n.componentNodes[0].(*sros).generateComponentConfig()\n+\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type from-env admin-state enable\")\n+\t\tassert.NotContains(t, cfg, \"from-component\")\n+\t})\n+\n+\tt.Run(\"duplicate_component_slots_are_rejected_regardless_of_case\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n+\t\t\t{Slot: \"a\"},\n+\t\t\t{Slot: \"A\"},\n+\t\t})\n+\n+\t\terr := n.checkComponentSlotsConfig()\n \n \t\trequire.Error(t, err)\n-\t\tassert.Contains(t, err.Error(), \"at most one component override\")\n+\t\tassert.Contains(t, err.Error(), \"duplicate\")\n \t})\n \n \tt.Run(\"sfm_sets_container_env\", func(t *testing.T) {\n \t\tn := newSrosInitTestNode(\"sr-1\", nil)\n \t\tkindSpecificConfig.Of(n.Cfg).SFM = \"m-sfm6-7/12\"\n \n \t\trequire.NoError(t, n.Init(n.Cfg))\n \t\tassert.Equal(t, \"m-sfm6-7/12\", n.Cfg.Env[envNokiaSrosSFM])\n \t})\n \n-\tt.Run(\"single_slot_integrated_rejects_card_type_override\", func(t *testing.T) {\n-\t\tn := newSrosInitTestNode(\"ixr-e2\", []*Component{\n-\t\t\t{Slot: slotAName, Type: \"imm2-qsfpdd+2-qsfp28+24-sfp28\"},\n+\tt.Run(\"single_slot_integrated_allows_card_type_override\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"ixr-e2n\", []*Component{\n+\t\t\t{Slot: slotAName, Type: \"cpm-ixr-e2n/imm4-sfp+4-sfp+\"},\n \t\t})\n \n-\t\terr := n.Init(n.Cfg)\n-\n-\t\trequire.Error(t, err)\n-\t\tassert.Contains(t, err.Error(), \"does not support component card-type override\")\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\tassert.Equal(t, \"cpm-ixr-e2n/imm4-sfp+4-sfp+\", n.Cfg.Env[envNokiaSrosCard])\n+\t\tassert.Empty(t, n.generateComponentConfig())\n \t})\n \n \tt.Run(\"integrated_rejects_invalid_slot\", func(t *testing.T) {\n \t\tn := newSrosInitTestNode(\"ixr-e2\", []*Component{\n \t\t\t{Slot: slotBName, Type: \"cpm-ixr-e2\"},\ndiff --git a/nodes/sros/template.go b/nodes/sros/template.go\nindex 38f1e4d..b538320 100644\n--- a/nodes/sros/template.go\n+++ b/nodes/sros/template.go\n@@ -1,7 +1,28 @@\n package sros\n \n+import (\n+\t_ \"embed\"\n+\t\"text/template\"\n+\n+\tclabutils \"github.com/srl-labs/containerlab/utils\"\n+)\n+\n+var (\n+\t//go:embed configs/sros_config_sros25.go.tpl\n+\tcfgTplSROS25 string\n+\n+\t//go:embed configs/sros_config_classic.go.tpl\n+\tcfgTplClassic string\n+\n+\t//go:embed configs/ixr/ixr_config_classic.go.tpl\n+\tcfgTplClassicIxr string\n+\n+\t//go:embed configs/sar/sar_config_classic.go.tpl\n+\tcfgTplClassicSar string\n+)\n+\n // srosTemplateData holds all data needed for template selection and execution.\n type srosTemplateData struct {\n \t// Template selection criteria\n \tNodeType          string\n \tConfigurationMode string\n@@ -43,5 +64,36 @@ type tplIFace struct {\n \tSlot       string\n \tPort       string\n \tBreakoutNo string\n \tMtu        int\n }\n+\n+// getTemplateForVariant returns the template string and name for the given config variant.\n+// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= \"26\").\n+func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {\n+\t// Model-driven (or mixed treated as classic below when family is classic)\n+\tif v.Mode == ConfigModeModelDriven {\n+\t\t// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= \"26\"\n+\t\t// { return cfgTplSROS26, \"clab-sros-config-sros26\" }\n+\t\treturn cfgTplSROS25, \"clab-sros-config-sros25\"\n+\t}\n+\t// Classic (or mixed)\n+\ttmpl = cfgTplClassic\n+\ttplName = \"clab-sros-config-classic\"\n+\tswitch v.Family {\n+\tcase ConfigFamilyIXR:\n+\t\treturn cfgTplClassicIxr, \"clab-sros-config-classic-ixr\"\n+\tcase ConfigFamilySAR:\n+\t\treturn cfgTplClassicSar, \"clab-sros-config-classic-sar\"\n+\tdefault:\n+\t\treturn tmpl, tplName\n+\t}\n+}\n+\n+// selectConfigTemplate chooses the config template from the config variant (mode + family).\n+func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {\n+\tv := n.resolveConfigVariant()\n+\ttmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)\n+\treturn template.New(tplName).\n+\t\tFuncs(clabutils.CreateFuncs()).\n+\t\tParse(tmpl)\n+}\ndiff --git a/nodes/sros/variant.go b/nodes/sros/variant.go\nindex fad585c..85bcac5 100644\n--- a/nodes/sros/variant.go\n+++ b/nodes/sros/variant.go\n@@ -2,11 +2,21 @@\n // Licensed under the BSD 3-Clause License.\n // SPDX-License-Identifier: BSD-3-Clause\n \n package sros\n \n-import \"fmt\"\n+import (\n+\t\"fmt\"\n+\t\"regexp\"\n+)\n+\n+var (\n+\tsarRegexp   = regexp.MustCompile(`(?i)\\bsar-`)\n+\tsarHmRegexp = regexp.MustCompile(`(?i)\\b(sar-hm|sar-hmc)\\b`)\n+\n+\tixrRegexp = regexp.MustCompile(`(?i)\\bixr-`)\n+)\n \n // ConfigMode is the configuration mode (model-driven or classic).\n type ConfigMode string\n \n const (\n@@ -141,5 +151,20 @@ func getSnippetSet(v ConfigVariant) snippetSet {\n \t\t\tgrpc = grpcConfigSARInsecure\n \t\t}\n \t}\n \treturn snippetSet{SystemConfig: sys, GRPCConfig: grpc}\n }\n+\n+// isIXRNode returns true if this is an IXR node type (case-insensitive).\n+func (n *sros) isIXRNode() bool {\n+\treturn ixrRegexp.MatchString(n.Cfg.NodeType)\n+}\n+\n+// isSARNode returns true if this is a SAR node type (case-insensitive).\n+func (n *sros) isSARNode() bool {\n+\treturn sarRegexp.MatchString(n.Cfg.NodeType)\n+}\n+\n+// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).\n+func (n *sros) isSARHmNode() bool {\n+\treturn sarHmRegexp.MatchString(n.Cfg.NodeType)\n+}\ndiff --git a/schemas/clab.schema.json b/schemas/clab.schema.json\nindex 66679ac..0157106 100644\n--- a/schemas/clab.schema.json\n+++ b/schemas/clab.schema.json\n@@ -939,10 +939,12 @@\n                                             \"ixr-6\",\n                                             \"ixr-e2c\",\n                                             \"ixr-e2\",\n                                             \"ixr-e2n\",\n                                             \"ixr-e2n-s\",\n+                                            \"ixr-e2sc\",\n+                                            \"ixr-e3\",\n                                             \"ixr-e3c\",\n                                             \"ixr-e3x\",\n                                             \"ixr-ec\",\n                                             \"ixr-e\",\n                                             \"ixr-r4\",\n@@ -951,10 +953,11 @@\n                                             \"ixr-r6\",\n                                             \"ixr-s\",\n                                             \"ixr-x3\",\n                                             \"ixr-x\",\n                                             \"sar-1\",\n+                                            \"sar-10x\",\n                                             \"sar-hm\",\n                                             \"sar-hmc\",\n                                             \"sar-hx\",\n                                             \"sar-mx\",\n                                             \"sr-1-24d\",\n@@ -2009,11 +2012,14 @@\n                 \"cpm-ixr-e-gnss/imm24-sfp++8-sfp28+2-qsfp28\",\n                 \"cpm-ixr-e/imm14-10g-sfp++4-1g-tx\",\n                 \"cpm-ixr-e/imm24-sfp++8-sfp28+2-qsfp28\",\n                 \"cpm-ixr-e2\",\n                 \"cpm-ixr-e2c\",\n+                \"cpm-ixr-e2n-s/imm4-sfp+4-sfp+-s\",\n                 \"cpm-ixr-e2n/imm4-sfp+4-sfp+\",\n+                \"cpm-ixr-e2sc/imm16-sfp++4-sfp28\",\n+                \"cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd\",\n                 \"cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56\",\n                 \"cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd\",\n                 \"cpm-ixr-ec\",\n                 \"cpm-ixr-s/imm48-sfp++6-qsfp28\",\n                 \"cpm-ixr-x/imm32-qsfp28+4-qsfpdd\",\n@@ -2077,10 +2083,11 @@\n             \"type\": \"string\",\n             \"description\": \"CPM card types for SR OS\",\n             \"enum\": [\n                 \"cpiom-ixr-r6\",\n                 \"cpiom-ixr-r6d\",\n+                \"cpiom-sar-x\",\n                 \"cpm-1\",\n                 \"cpm-1s\",\n                 \"cpm-1se\",\n                 \"cpm-1se/imm36-800g-qsfpdd\",\n                 \"cpm-1x\",\n@@ -2102,11 +2109,14 @@\n                 \"cpm-ixr-e-gnss/imm24-sfp++8-sfp28+2-qsfp28\",\n                 \"cpm-ixr-e/imm14-10g-sfp++4-1g-tx\",\n                 \"cpm-ixr-e/imm24-sfp++8-sfp28+2-qsfp28\",\n                 \"cpm-ixr-e2\",\n                 \"cpm-ixr-e2c\",\n+                \"cpm-ixr-e2n-s/imm4-sfp+4-sfp+-s\",\n                 \"cpm-ixr-e2n/imm4-sfp+4-sfp+\",\n+                \"cpm-ixr-e2sc/imm16-sfp++4-sfp28\",\n+                \"cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd\",\n                 \"cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56\",\n                 \"cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd\",\n                 \"cpm-ixr-ec\",\n                 \"cpm-ixr-r4\",\n                 \"cpm-ixr-s\",\n@@ -2122,11 +2132,12 @@\n                 \"cpm-v/iom-v\",\n                 \"cpm-x20\",\n                 \"cpm2-s\",\n                 \"cpm2-x20\",\n                 \"cpm5\",\n-                \"iom-sar\"\n+                \"iom-sar\",\n+                \"iom-sar-1x\"\n             ]\n         },\n         \"sros-mda-types\": {\n             \"type\": \"string\",\n             \"description\": \"MDA types for SR OS\",\n@@ -2153,10 +2164,11 @@\n                 \"m10-sfp++6-sfp\",\n                 \"m12-sfp28+2-qsfp28\",\n                 \"m14-10g-sfp++4-1g-tx\",\n                 \"m18-25g-sfp28\",\n                 \"m2-100g-qsfp28+16-10g-sfp+\",\n+                \"m2-1g-sfp+2-10g-sfp+\",\n                 \"m2-cfp2\",\n                 \"m2-qsfpdd+2-qsfp28+24-sfp28\",\n                 \"m20-10g-sfp+\",\n                 \"m20-1g-csfp\",\n                 \"m20-v\",\n@@ -2166,11 +2178,13 @@\n                 \"m32-qsfp28+4-qsfpdd\",\n                 \"m36-100g-qsfp28\",\n                 \"m36-qsfpdd\",\n                 \"m4-100g-cfp4\",\n                 \"m4-10g-sfp++1-100g-cfp2\",\n+                \"m4-1g-rj+6-10g-sfp++2-25g-sfp28\",\n                 \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n+                \"m4-rs232-rj45+4-c3794-sfp\",\n                 \"m40-10g-sfp\",\n                 \"m40-10g-sfp-ptp\",\n                 \"m40-200g-sfpdd+6-800g-qsfpdd-1\",\n                 \"m46-10g-sfp+\",\n                 \"m48-400g-qsfpdd-1\",\n@@ -2181,10 +2195,11 @@\n                 \"m5e2-100g-qsfp28+2-800g-qdd\",\n                 \"m5e8-100g-sfp112+2-800g-qdd\",\n                 \"m6-10g-sfp++1-100g-qsfp28\",\n                 \"m6-10g-sfp++4-25g-sfp28\",\n                 \"m6-qsfpdd+48-sfp56\",\n+                \"m8-t1e1-rj48\",\n                 \"m80-1g-csfp\",\n                 \"m80-200g-sfpdd+12-400g-qsfpdd-1\",\n                 \"m80-200g-sfpdd+12-800g-qsfpdd-1x\",\n                 \"ma2-10gb-sfp+12-1gb-sfp\",\n                 \"ma20-1gb-tx\",\ndiff --git a/tests/13-srsim/01-sros-to-linux.robot b/tests/13-srsim/01-sros-to-linux.robot\nindex c4d9cb2..8226dd7 100644\n--- a/tests/13-srsim/01-sros-to-linux.robot\n+++ b/tests/13-srsim/01-sros-to-linux.robot\n@@ -1,9 +1,10 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n Suite Teardown      Run Keyword    Cleanup\n \n \n *** Variables ***\n@@ -21,15 +22,11 @@ Set key-path Variable\n Create SSH keypair - RSA\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    ssh-keygen -t rsa -N \"\" -f ${key-path}-rsa\n \n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n ",
        "lineStart": 1614,
        "lineEnd": 3150,
        "totalLines": 3151,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346534648,
      "end": 1792346534658
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502db316001KKwnnfdelj1T8L",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502da7a9001g13xnqsXX4pQRr",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 44942,
    "input": 20330,
    "output": 20,
    "reasoning": 16,
    "cache": {
      "read": 24576,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502da7a9001g13xnqsXX4pQRr",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346531753,
    "completed": 1792346534681
  },
  "parentID": "msg_1502d8a66001F2b7xDf6faLOHN",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 44942,
    "input": 20330,
    "output": 20,
    "reasoning": 16,
    "cache": {
      "read": 24576,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 6
step-start
{
  "type": "step-start",
  "id": "prt_1502dbe1f001Tf9eKFtUPY2fiY",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502db31e001gHWujWsTb5hCpw"
}
Reasoning
Continue reading the diff.
read · completed

Input

{
  "filePath": "/source/diff.txt",
  "offset": 3151
}

Output

<path>/source/diff.txt</path>
<type>file</type>
<content>
3151:  Ensure sros is reachable over ssh
3152:      Login via SSH with username and password
3153:      ...    address=clab-${lab-name}-sros
3154:      ...    username=admin
3155: @@ -102,7 +99,7 @@ Verify saving config with copy flag
3156:      [Teardown]    Run    rm -rf ${copy_dst}
3157:  
3158:  
3159:  *** Keywords ***
3160:  Cleanup
3161: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3162: +    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3163:      Run    rm -f ${key-path}*
3164: diff --git a/tests/13-srsim/03-sros-dist-to-linux.robot b/tests/13-srsim/03-sros-dist-to-linux.robot
3165: index b0c6369..a473880 100644
3166: --- a/tests/13-srsim/03-sros-dist-to-linux.robot
3167: +++ b/tests/13-srsim/03-sros-dist-to-linux.robot
3168: @@ -1,35 +1,23 @@
3169:  *** Settings ***
3170:  Library             OperatingSystem
3171:  Resource            ../ssh.robot
3172:  Resource            ../common.robot
3173: +Resource            ../srsim.robot
3174:  
3175: -Suite Teardown      Run Keyword    Cleanup
3176: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3177:  
3178:  
3179:  *** Variables ***
3180:  ${lab-name}         sr03
3181:  ${lab-file-name}    03-srsim-dist.clab.yml
3182:  ${runtime}          docker
3183: -${key-name}         clab-test-key
3184:  
3185:  
3186:  *** Test Cases ***
3187: -Set key-path Variable
3188: -    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}
3189: -    Set Suite Variable    ${key-path}
3190: -
3191: -Create SSH keypair - RSA
3192: -    ${rc}    ${output} =    Run And Return Rc And Output
3193: -    ...    ssh-keygen -t rsa -N "" -f ${key-path}-rsa
3194: -
3195:  Deploy ${lab-name} lab
3196: -    Log    ${CURDIR}
3197: -    ${rc}    ${output} =    Run And Return Rc And Output
3198: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3199: -    Log    ${output}
3200: -    Should Be Equal As Integers    ${rc}    0
3201: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3202:  
3203:  Ensure sros is reachable over ssh
3204:      Login via SSH with username and password
3205:      ...    address=clab-${lab-name}-sros-a
3206:      ...    username=admin
3207: @@ -55,10 +43,5 @@ Do a gNOI cert get-certs
3208:      Skip If    '${runtime}' != 'docker'
3209:      ${rc}    ${output} =    Run And Return Rc And Output
3210:      ...    sudo docker run --network host --rm --mount type=bind,source=${CURDIR}/clab-${lab-name}/.tls/ca,target=/tls ghcr.io/karimra/gnoic:0.2.0 cert get-certs --username admin --password 'NokiaSros1!' --tls-ca /tls/ca.pem --address clab-${lab-name}-sros-a
3211:      Log    ${output}
3212:      Should Contain    ${output}    sros-a.${lab-name}.io
3213: -
3214: -*** Keywords ***
3215: -Cleanup
3216: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3217: -    Run    rm -f ${key-path}*
3218: diff --git a/tests/13-srsim/04-sros-classic.robot b/tests/13-srsim/04-sros-classic.robot
3219: index efdf58f..16b5811 100644
3220: --- a/tests/13-srsim/04-sros-classic.robot
3221: +++ b/tests/13-srsim/04-sros-classic.robot
3222: @@ -1,9 +1,10 @@
3223:  *** Settings ***
3224:  Library             OperatingSystem
3225:  Resource            ../ssh.robot
3226:  Resource            ../common.robot
3227: +Resource            ../srsim.robot
3228:  
3229:  Suite Teardown      Run Keyword    Cleanup
3230:  
3231:  
3232:  *** Variables ***
3233: @@ -23,15 +24,11 @@ Set key-path Variable
3234:  Create SSH keypair - ecdsa512
3235:      ${rc}    ${output} =    Run And Return Rc And Output
3236:      ...    ssh-keygen -t ecdsa -b 521 -N "" -f ${key-path}-ecdsa512
3237:  
3238:  Deploy ${lab-name} lab
3239: -    Log    ${CURDIR}
3240: -    ${rc}    ${output} =    Run And Return Rc And Output
3241: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3242: -    Log    ${output}
3243: -    Should Be Equal As Integers    ${rc}    0
3244: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3245:  
3246:  Ensure sros is reachable over ssh
3247:      Login via SSH with username and password
3248:      ...    address=clab-${lab-name}-srsim
3249:      ...    username=admin
3250: @@ -58,7 +55,7 @@ Check Mixed Config Mode on srsim
3251:      Log    ${output}
3252:      Should Contain    ${output}    mixed
3253:  
3254:  *** Keywords ***
3255:  Cleanup
3256: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3257: +    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3258:      Run    rm -f ${key-path}*
3259: diff --git a/tests/13-srsim/05-sros-comp-to-linux.robot b/tests/13-srsim/05-sros-comp-to-linux.robot
3260: index 4bb4aac..f7db14e 100644
3261: --- a/tests/13-srsim/05-sros-comp-to-linux.robot
3262: +++ b/tests/13-srsim/05-sros-comp-to-linux.robot
3263: @@ -1,9 +1,10 @@
3264:  *** Settings ***
3265:  Library             OperatingSystem
3266:  Resource            ../ssh.robot
3267:  Resource            ../common.robot
3268: +Resource            ../srsim.robot
3269:  
3270:  Suite Teardown      Run Keyword    Cleanup
3271:  
3272:  
3273:  *** Variables ***
3274: @@ -21,15 +22,11 @@ Set key-path Variable
3275:  Create SSH keypair - RSA
3276:      ${rc}    ${output} =    Run And Return Rc And Output
3277:      ...    ssh-keygen -t rsa -N "" -f ${key-path}-rsa
3278:  
3279:  Deploy ${lab-name} lab
3280: -    Log    ${CURDIR}
3281: -    ${rc}    ${output} =    Run And Return Rc And Output
3282: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3283: -    Log    ${output}
3284: -    Should Be Equal As Integers    ${rc}    0
3285: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3286:  
3287:  Ensure sros is reachable over ssh
3288:      Login via SSH with username and password
3289:      ...    address=clab-${lab-name}-sros
3290:      ...    username=admin
3291: @@ -136,7 +133,7 @@ Ensure XIOM MDA x/1 is equipped and up on sr2s-01
3292:      Should Contain    ${output}    in-service
3293:  
3294:  
3295:  *** Keywords ***
3296:  Cleanup
3297: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3298: +    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3299:      Run    rm -f ${key-path}*
3300: diff --git a/tests/13-srsim/06-srsim-sar.robot b/tests/13-srsim/06-srsim-sar.robot
3301: index 0633c48..0ef2dfa 100644
3302: --- a/tests/13-srsim/06-srsim-sar.robot
3303: +++ b/tests/13-srsim/06-srsim-sar.robot
3304: @@ -1,33 +1,25 @@
3305:  *** Settings ***
3306:  Library             OperatingSystem
3307:  Resource            ../ssh.robot
3308:  Resource            ../common.robot
3309: +Resource            ../srsim.robot
3310:  
3311: -Suite Teardown      Run Keyword    Cleanup
3312: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3313:  
3314:  
3315:  *** Variables ***
3316:  ${lab-name}         sr06
3317:  ${lab-file-name}    06-srsim-sar.clab.yml
3318:  ${runtime}          docker
3319: -${key-name}         clab-test-key
3320:  ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1
3321:  ${gnmic_flags}      --username admin --password NokiaSros1! --values-only
3322:  
3323:  
3324:  *** Test Cases ***
3325: -Set key-path Variable
3326: -    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}
3327: -    Set Suite Variable    ${key-path}
3328: -
3329:  Deploy ${lab-name} lab
3330: -    Log    ${CURDIR}
3331: -    ${rc}    ${output} =    Run And Return Rc And Output
3332: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3333: -    Log    ${output}
3334: -    Should Be Equal As Integers    ${rc}    0
3335: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3336:  
3337:  Ensure sros is reachable over ssh
3338:      Login via SSH with username and password
3339:      ...    address=clab-${lab-name}-sar3
3340:      ...    username=admin
3341: @@ -45,10 +37,5 @@ Check Config Mode on sar1
3342:  Check Config Mode on sar2
3343:      ${rc}    ${output} =    Run And Return Rc And Output
3344:      ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --insecure --address clab-${lab-name}-sar2 get --path /state/system/management-interface/configuration-oper-mode
3345:      Log    ${output}
3346:      Should Contain    ${output}    model-driven
3347: -
3348: -*** Keywords ***
3349: -Cleanup
3350: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3351: -    Run    rm -f ${key-path}*
3352: diff --git a/tests/13-srsim/07-srsim-with-mgmt-network.robot b/tests/13-srsim/07-srsim-with-mgmt-network.robot
3353: index 5025036..ce0951f 100644
3354: --- a/tests/13-srsim/07-srsim-with-mgmt-network.robot
3355: +++ b/tests/13-srsim/07-srsim-with-mgmt-network.robot
3356: @@ -1,31 +1,23 @@
3357:  *** Settings ***
3358:  Library             OperatingSystem
3359:  Resource            ../ssh.robot
3360:  Resource            ../common.robot
3361: +Resource            ../srsim.robot
3362:  
3363: -Suite Teardown      Run Keyword    Cleanup
3364: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3365:  
3366:  
3367:  *** Variables ***
3368:  ${lab-name}         sr07
3369:  ${lab-file-name}    07-srsim-mix.clab.yml
3370:  ${runtime}          docker
3371: -${key-name}         clab-test-key
3372:  
3373:  
3374:  *** Test Cases ***
3375: -Set key-path Variable
3376: -    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}
3377: -    Set Suite Variable    ${key-path}
3378: -
3379:  Deploy ${lab-name} lab
3380: -    Log    ${CURDIR}
3381: -    ${rc}    ${output} =    Run And Return Rc And Output
3382: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3383: -    Log    ${output}
3384: -    Should Be Equal As Integers    ${rc}    0
3385: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3386:  
3387:  Ensure sros is reachable over ssh
3388:      Login via SSH with username and password
3389:      ...    address=clab-${lab-name}-srsim10
3390:      ...    username=admin
3391: @@ -57,15 +49,10 @@ Do a gNMI GET using TLS
3392:      Log    ${output}
3393:      Should Be Equal As Integers    ${rc}    0
3394:      Should Contain    ${output}    srsim10-a
3395:  
3396:  *** Keywords ***
3397: -Cleanup
3398: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3399: -    Run    rm -f ${key-path}*
3400: -
3401: -
3402:  Do a gNOI ping to other node
3403:      Skip If    '${runtime}' != 'docker'
3404:      ${rc}    ${output} =    Run And Return Rc And Output
3405:      ...    sudo docker run --network host --rm --mount type=bind,source=${CURDIR}/clab-${lab-name}/.tls/ca,target=/tls ghcr.io/karimra/gnoic:0.2.0 system ping --username admin --password 'NokiaSros1!' --tls-ca /tls/ca.pem --address clab-${lab-name}-srsim10 --destination 100.0.0.11 --ns Base --count 3
3406:      Log    ${output}
3407: diff --git a/tests/13-srsim/08-srsim-comp-cfg-test.robot b/tests/13-srsim/08-srsim-comp-cfg-test.robot
3408: index d276341..c531df4 100644
3409: --- a/tests/13-srsim/08-srsim-comp-cfg-test.robot
3410: +++ b/tests/13-srsim/08-srsim-comp-cfg-test.robot
3411: @@ -1,11 +1,12 @@
3412:  *** Settings ***
3413:  Library             OperatingSystem
3414:  Resource            ../ssh.robot
3415:  Resource            ../common.robot
3416: +Resource            ../srsim.robot
3417:  
3418: -Suite Teardown      Run Keyword    Cleanup
3419: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3420:  
3421:  
3422:  *** Variables ***
3423:  ${lab-name}         comp-cfg-gen-test
3424:  ${lab-file-name}    08-srsim-comp-cfg-test.clab.yml
3425: @@ -14,15 +15,11 @@ ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1
3426:  ${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure
3427:  
3428:  
3429:  *** Test Cases ***
3430:  Deploy ${lab-name} lab
3431: -    Log    ${CURDIR}
3432: -    ${rc}    ${output} =    Run And Return Rc And Output
3433: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3434: -    Log    ${output}
3435: -    Should Be Equal As Integers    ${rc}    0
3436: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3437:  
3438:  Wait for 45s
3439:      Sleep    45s    Let everything fully provision & come up
3440:  
3441:  Check SR-1 card configuration
3442: @@ -121,13 +118,10 @@ Check SR-2s-ncofg has unprovisioned card
3443:      Log    ${output}
3444:      Should Be Equal As Integers    ${rc}    0
3445:      Should Contain    ${output}    unprovisioned
3446:  
3447:  *** Keywords ***
3448: -Cleanup
3449: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3450: -
3451:  Check SR-2S MDA state
3452:      ${rc}    ${output} =    Run And Return Rc And Output
3453:      ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr2s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/hardware-data/oper-state
3454:      Log    ${output}
3455:      Should Be Equal As Integers    ${rc}    0
3456: diff --git a/tests/13-srsim/09-srsim-pause-container.robot b/tests/13-srsim/09-srsim-pause-container.robot
3457: index 0f96bd7..90f57c3 100644
3458: --- a/tests/13-srsim/09-srsim-pause-container.robot
3459: +++ b/tests/13-srsim/09-srsim-pause-container.robot
3460: @@ -1,12 +1,13 @@
3461:  *** Settings ***
3462:  Library             OperatingSystem
3463:  Library             Process
3464:  Resource            ../ssh.robot
3465:  Resource            ../common.robot
3466: +Resource            ../srsim.robot
3467:  
3468: -Suite Teardown      Run Keyword    Cleanup
3469: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3470:  
3471:  
3472:  *** Variables ***
3473:  ${lab-name}         srsim-pause-ctr
3474:  ${lab-file-name}    09-srsim-pause-container.clab.yml
3475: @@ -15,15 +16,11 @@ ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1
3476:  ${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure
3477:  
3478:  
3479:  *** Test Cases ***
3480:  Deploy ${lab-name} lab
3481: -    Log    ${CURDIR}
3482: -    ${rc}    ${output} =    Run And Return Rc And Output
3483: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3484: -    Log    ${output}
3485: -    Should Be Equal As Integers    ${rc}    0
3486: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3487:  
3488:  Wait for 45s
3489:      Sleep    45s    Let everything fully provision & come up
3490:  
3491:  # IPv4
3492: @@ -165,11 +162,5 @@ Check CPM SSH
3493:          Should Contain    ${output}    TiMOS
3494:          Should Match Regexp    ${output}    ${slot}:admin@[^\\r\\n]+#
3495:      FINALLY
3496:          SSHLibrary.Close All Connections
3497:      END
3498: -
3499: -Cleanup
3500: -    ${rc}    ${output} =    Run And Return Rc And Output
3501: -    ...    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3502: -    Log    ${output}
3503: -    Should Be Equal As Integers    ${rc}    0
3504: diff --git a/tests/13-srsim/10-srsim-lifecycle.robot b/tests/13-srsim/10-srsim-lifecycle.robot
3505: index c9085d9..0b24da2 100644
3506: --- a/tests/13-srsim/10-srsim-lifecycle.robot
3507: +++ b/tests/13-srsim/10-srsim-lifecycle.robot
3508: @@ -1,25 +1,22 @@
3509:  *** Settings ***
3510:  Library             OperatingSystem
3511:  Resource            ../common.robot
3512: +Resource            ../srsim.robot
3513:  
3514: -Suite Teardown      Run Keyword    Cleanup
3515: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3516:  
3517:  
3518:  *** Variables ***
3519:  ${lab-name}         lifecycle-test-srsim
3520:  ${lab-file-name}    10-srsim-lifecycle.clab.yml
3521:  ${runtime}          docker
3522:  
3523:  
3524:  *** Test Cases ***
3525:  Deploy ${lab-name} lab
3526: -    Log    ${CURDIR}
3527: -    ${rc}    ${output} =    Run And Return Rc And Output
3528: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3529: -    Log    ${output}
3530: -    Should Be Equal As Integers    ${rc}    0
3531: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3532:  
3533:  Ensure client can ping integrated SR OS node
3534:      Sleep    20s    give time for SR OS nodes to boot
3535:      ${rc}    ${output} =    Run And Return Rc And Output
3536:      ...    ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=client --cmd "ping -c2 -W2 10.0.1.2"
3537: @@ -85,10 +82,5 @@ Verify ping to distributed SR OS recovers after start
3538:      ${rc}    ${output} =    Run And Return Rc And Output
3539:      ...    ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=client --cmd "ping -c2 -W2 10.0.2.2"
3540:      Log    ${output}
3541:      Should Be Equal As Integers    ${rc}    0
3542:      Should Match Regexp    ${output}    2 packets transmitted, 2 (packets )?received, 0% packet loss
3543: -
3544: -
3545: -*** Keywords ***
3546: -Cleanup
3547: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3548: diff --git a/tests/13-srsim/12-srsim-veth-stitch.robot b/tests/13-srsim/12-srsim-veth-stitch.robot
3549: index fac9fe1..9f70b9f 100644
3550: --- a/tests/13-srsim/12-srsim-veth-stitch.robot
3551: +++ b/tests/13-srsim/12-srsim-veth-stitch.robot
3552: @@ -1,11 +1,12 @@
3553:  *** Settings ***
3554:  Library             OperatingSystem
3555:  Resource            ../ssh.robot
3556:  Resource            ../common.robot
3557: +Resource            ../srsim.robot
3558:  
3559: -Suite Teardown      Run Keyword    Cleanup
3560: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3561:  
3562:  
3563:  *** Variables ***
3564:  ${lab-name}         veth-stitch
3565:  ${lab-file-name}    12-srsim-veth-stitch.clab.yml
3566: @@ -14,15 +15,11 @@ ${sros-password}    NokiaSros1!
3567:  ${peer-ip}          10.0.0.2
3568:  
3569:  
3570:  *** Test Cases ***
3571:  Deploy ${lab-name} lab
3572: -    Log    ${CURDIR}
3573: -    ${rc}    ${output} =    Run And Return Rc And Output
3574: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3575: -    Log    ${output}
3576: -    Should Be Equal As Integers    ${rc}    0
3577: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3578:  
3579:  Ensure distributed sros can ping sros2 over the veth-stitch link
3580:      Wait Until Keyword Succeeds    3 minutes    10 seconds    Ping succeeds    sros    ${peer-ip}
3581:  
3582:  Verify inspect interfaces returns the host-side stitch interfaces
3583: @@ -87,13 +84,10 @@ Verify the stitch interfaces are removed on destroy
3584:      Log    ${output}
3585:      Should Not Contain    ${output}    clab-s-
3586:  
3587:  
3588:  *** Keywords ***
3589: -Cleanup
3590: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3591: -
3592:  Ping over SSH
3593:      [Arguments]    ${node}    ${dst}
3594:      Login via SSH with username and password
3595:      ...    address=clab-${lab-name}-${node}
3596:      ...    username=admin
3597: diff --git a/tests/13-srsim/13-srsim-integrated.clab.yml b/tests/13-srsim/13-srsim-integrated.clab.yml
3598: new file mode 100644
3599: index 0000000..a3f2ca3
3600: --- /dev/null
3601: +++ b/tests/13-srsim/13-srsim-integrated.clab.yml
3602: @@ -0,0 +1,33 @@
3603: +# yaml-language-server: $schema=../../schemas/clab.schema.json
3604: +name: srsim-integrated
3605: +
3606: +topology:
3607: +  kinds:
3608: +    nokia_srsim:
3609: +      license: /opt/nokia/sros/license.txt
3610: +      image: registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}
3611: +
3612: +  nodes:
3613: +    ixr-e2n:
3614: +      kind: nokia_srsim
3615: +      type: ixr-e2n
3616: +      components:
3617: +        - type: cpm-ixr-e2n/imm4-sfp+4-sfp+
3618: +
3619: +    ixr-r6:
3620: +      kind: nokia_srsim
3621: +      type: ixr-r6
3622: +      components:
3623: +        - slot: A
3624: +        - slot: B
3625: +
3626: +    sr-1s:
3627: +      kind: nokia_srsim
3628: +      type: sr-1s
3629: +      components:
3630: +        - xiom:
3631: +            - slot: 1
3632: +              type: iom-s-3.0t
3633: +              mda:
3634: +                - slot: 1
3635: +                  type: ms18-100gb-qsfp28
3636: diff --git a/tests/13-srsim/13-srsim-integrated.robot b/tests/13-srsim/13-srsim-integrated.robot
3637: new file mode 100644
3638: index 0000000..8f6b929
3639: --- /dev/null
3640: +++ b/tests/13-srsim/13-srsim-integrated.robot
3641: @@ -0,0 +1,105 @@
3642: +*** Settings ***
3643: +Library             OperatingSystem
3644: +Resource            ../ssh.robot
3645: +Resource            ../common.robot
3646: +Resource            ../srsim.robot
3647: +
3648: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3649: +
3650: +
3651: +*** Variables ***
3652: +${lab-name}         srsim-integrated
3653: +${lab-file-name}    13-srsim-integrated.clab.yml
3654: +${runtime}          docker
3655: +${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1
3656: +${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure
3657: +
3658: +
3659: +*** Test Cases ***
3660: +Deploy ${lab-name} lab
3661: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3662: +
3663: +Wait for 45s
3664: +    Sleep    45s    Let everything fully provision & come up
3665: +
3666: +Check IXR-E2N card override is passed to the container
3667: +    ${rc}    ${output} =    Run And Return Rc And Output
3668: +    ...    sudo ${runtime} inspect clab-${lab-name}-ixr-e2n --format '{{range .Config.Env}}{{println .}}{{end}}'
3669: +    Log    ${output}
3670: +    Should Be Equal As Integers    ${rc}    0
3671: +    Should Contain    ${output}    NOKIA_SROS_CARD=cpm-ixr-e2n/imm4-sfp+4-sfp+
3672: +
3673: +Check IXR-E2N equipped card matches the component
3674: +    ${rc}    ${output} =    Run And Return Rc And Output
3675: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-e2n --path /state/card[slot-number=1]/equipped-type
3676: +    Log    ${output}
3677: +    Should Be Equal As Integers    ${rc}    0
3678: +    Should Contain    ${output}    imm4-sfp+4-sfp+
3679: +
3680: +Check IXR-R6 standby CPM slot is set
3681: +    ${rc}    ${output} =    Run And Return Rc And Output
3682: +    ...    sudo ${runtime} inspect clab-${lab-name}-ixr-r6-b --format '{{range .Config.Env}}{{println .}}{{end}}'
3683: +    Log    ${output}
3684: +    Should Be Equal As Integers    ${rc}    0
3685: +    Should Contain    ${output}    NOKIA_SROS_SLOT=B
3686: +
3687: +Check IXR-R6 card configuration
3688: +    ${rc}    ${output} =    Run And Return Rc And Output
3689: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /configure/card[slot-number=1]/card-type
3690: +    Log    ${output}
3691: +    Should Be Equal As Integers    ${rc}    0
3692: +    Should Contain    ${output}    iom-ixr-r6
3693: +
3694: +Check IXR-R6 MDA configuration
3695: +    ${rc}    ${output} =    Run And Return Rc And Output
3696: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /configure/card[slot-number=1]/mda[mda-slot=1]/mda-type
3697: +    Log    ${output}
3698: +    Should Be Equal As Integers    ${rc}    0
3699: +    Should Contain    ${output}    m6-10g-sfp++1-100g-qsfp28
3700: +
3701: +Ensure IXR-R6 CPM A is up
3702: +    Wait Until Keyword Succeeds    2 minutes    10 seconds    Check IXR-R6 CPM state    A
3703: +
3704: +Ensure IXR-R6 CPM B is up
3705: +    Wait Until Keyword Succeeds    3 minutes    10 seconds    Check IXR-R6 CPM state    B
3706: +
3707: +
3708: +Check SR-1s equipped card
3709: +    ${rc}    ${output} =    Run And Return Rc And Output
3710: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/equipped-type
3711: +    Log    ${output}
3712: +    Should Be Equal As Integers    ${rc}    0
3713: +    Should Contain    ${output}    xcm-1s
3714: +
3715: +Check SR-1s equipped XIOM
3716: +    ${rc}    ${output} =    Run And Return Rc And Output
3717: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/equipped-type
3718: +    Log    ${output}
3719: +    Should Be Equal As Integers    ${rc}    0
3720: +    Should Contain    ${output}    iom-s-3.0t
3721: +
3722: +Check SR-1s equipped XIOM MDA
3723: +    ${rc}    ${output} =    Run And Return Rc And Output
3724: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/equipped-type
3725: +    Log    ${output}
3726: +    Should Be Equal As Integers    ${rc}    0
3727: +    Should Contain    ${output}    ms18-100gb-qsfp28
3728: +
3729: +Ensure SR-1s XIOM MDA is up
3730: +    Wait Until Keyword Succeeds    2 minutes    10 seconds    Check SR-1s XIOM MDA state
3731: +
3732: +*** Keywords ***
3733: +Check IXR-R6 CPM state
3734: +    [Arguments]    ${slot}
3735: +    ${rc}    ${output} =    Run And Return Rc And Output
3736: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /state/cpm[cpm-slot=${slot}]/hardware-data/oper-state
3737: +    Log    ${output}
3738: +    Should Be Equal As Integers    ${rc}    0
3739: +    Should Contain    ${output}    in-service
3740: +
3741: +Check SR-1s XIOM MDA state
3742: +    ${rc}    ${output} =    Run And Return Rc And Output
3743: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/hardware-data/oper-state
3744: +    Log    ${output}
3745: +    Should Be Equal As Integers    ${rc}    0
3746: +    Should Contain    ${output}    in-service
3747: diff --git a/tests/13-srsim/14-srsim-new-chassis.clab.yml b/tests/13-srsim/14-srsim-new-chassis.clab.yml
3748: new file mode 100644
3749: index 0000000..f5f3bc2
3750: --- /dev/null
3751: +++ b/tests/13-srsim/14-srsim-new-chassis.clab.yml
3752: @@ -0,0 +1,53 @@
3753: +# yaml-language-server: $schema=../../schemas/clab.schema.json
3754: +name: srsim-new-chassis
3755: +
3756: +topology:
3757: +  kinds:
3758: +    nokia_srsim:
3759: +      license: /opt/nokia/sros/license.txt
3760: +      image: registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}
3761: +
3762: +  nodes:
3763: +    ixr-e2sc:
3764: +      kind: nokia_srsim
3765: +      type: ixr-e2sc
3766: +
3767: +    ixr-e3:
3768: +      kind: nokia_srsim
3769: +      type: ixr-e3
3770: +
3771: +    sar-10x:
3772: +      kind: nokia_srsim
3773: +      type: sar-10x
3774: +      components:
3775: +        - slot: A
3776: +          type: cpiom-sar-x
3777: +          mda: &mdas
3778: +            - slot: 1
3779: +              type: m2-1g-sfp+2-10g-sfp+
3780: +            - slot: 2
3781: +              type: m8-t1e1-rj48
3782: +            - slot: 3
3783: +              type: m2-1g-sfp+2-10g-sfp+
3784: +            - slot: 4
3785: +              type: m4-rs232-rj45+4-c3794-sfp
3786: +            - slot: 5
3787: +              type: m8-t1e1-rj48
3788: +            - slot: 6
3789: +              type: m4-rs232-rj45+4-c3794-sfp
3790: +            - slot: 7
3791: +              type: m8-t1e1-rj48
3792: +            - slot: 8
3793: +              type: m4-rs232-rj45+4-c3794-sfp
3794: +        - slot: B
3795: +          type: cpiom-sar-x
3796: +          mda: *mdas
3797: +      startup-config: |
3798: +        /configure card 1 mda 1 mda-type m2-1g-sfp+2-10g-sfp+ admin-state enable
3799: +        /configure card 1 mda 2 mda-type m8-t1e1-rj48 admin-state enable
3800: +        /configure card 1 mda 3 mda-type m2-1g-sfp+2-10g-sfp+ admin-state enable
3801: +        /configure card 1 mda 4 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable
3802: +        /configure card 1 mda 5 mda-type m8-t1e1-rj48 admin-state enable
3803: +        /configure card 1 mda 6 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable
3804: +        /configure card 1 mda 7 mda-type m8-t1e1-rj48 admin-state enable
3805: +        /configure card 1 mda 8 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable
3806: diff --git a/tests/13-srsim/14-srsim-new-chassis.robot b/tests/13-srsim/14-srsim-new-chassis.robot
3807: new file mode 100644
3808: index 0000000..0f1b08a
3809: --- /dev/null
3810: +++ b/tests/13-srsim/14-srsim-new-chassis.robot
3811: @@ -0,0 +1,83 @@
3812: +*** Settings ***
3813: +Library             OperatingSystem
3814: +Library             String
3815: +Resource            ../common.robot
3816: +Resource            ../srsim.robot
3817: +
3818: +Suite Setup         Skip If    '${26_10_TESTS}'.lower() != 'true'
3819: +...                 SR-SIM 26.10 is required; enable with --variable 26_10_TESTS:true
3820: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3821: +
3822: +
3823: +*** Variables ***
3824: +${lab-name}         srsim-new-chassis
3825: +${lab-file-name}    14-srsim-new-chassis.clab.yml
3826: +${runtime}          docker
3827: +${26_10_TESTS}      false
3828: +${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1
3829: +${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure
3830: +
3831: +
3832: +*** Test Cases ***
3833: +Deploy ${lab-name} lab
3834: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3835: +
3836: +Check ixr-e2sc chassis
3837: +    Check chassis    ixr-e2sc    ixr-e2sc
3838: +
3839: +Check ixr-e3 chassis
3840: +    Check chassis    ixr-e3    ixr-e3
3841: +
3842: +Check sar-10x chassis
3843: +    Check chassis    sar-10x-a    sar-10x
3844: +    Check chassis    sar-10x-b    sar-10x
3845: +
3846: +Ensure new chassis containers stay running
3847: +    Sleep    30s    Let the simulators get past initial startup
3848: +    Check container is running    ixr-e2sc
3849: +    Check container is running    ixr-e3
3850: +    Check container is running    sar-10x-a
3851: +    Check container is running    sar-10x-b
3852: +
3853: +Check sar-10x line cards are up
3854: +    Wait Until Keyword Succeeds    3 minutes    15 seconds    SAR-10x line cards are up
3855: +
3856: +*** Keywords ***
3857: +SAR-10x line cards are up
3858: +    # Query card 1, MDAs 1/1..1/8, then card 2 in chassis order.
3859: +    ${command} =    Catenate    SEPARATOR=${SPACE}
3860: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags}
3861: +    ...    --address clab-${lab-name}-sar-10x
3862: +    ...    --path /state/card[slot-number=1]/hardware-data/oper-state
3863: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=1]/hardware-data/oper-state
3864: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=2]/hardware-data/oper-state
3865: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=3]/hardware-data/oper-state
3866: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=4]/hardware-data/oper-state
3867: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=5]/hardware-data/oper-state
3868: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=6]/hardware-data/oper-state
3869: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=7]/hardware-data/oper-state
3870: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=8]/hardware-data/oper-state
3871: +    ...    --path /state/card[slot-number=2]/hardware-data/oper-state
3872: +    ${rc}    ${output} =    Run And Return Rc And Output    ${command}
3873: +    Log    ${output}
3874: +    Should Be Equal As Integers    ${rc}    0
3875: +    ${up_states} =    Get Regexp Matches    ${output}    in-service
3876: +    Length Should Be    ${up_states}    10
3877: +    Should Not Contain    ${output}    null
3878: +
3879: +Check chassis
3880: +    [Arguments]    ${node}    ${chassis}
3881: +    ${rc}    ${output} =    Run And Return Rc And Output
3882: +    ...    sudo ${runtime} inspect clab-${lab-name}-${node} --format '{{range .Config.Env}}{{println .}}{{end}}'
3883: +    Log    ${output}
3884: +    Should Be Equal As Integers    ${rc}    0
3885: +    Should Contain    ${output}    NOKIA_SROS_CHASSIS=${chassis}
3886: +
3887: +Check container is running
3888: +    [Arguments]    ${node}
3889: +    ${rc}    ${output} =    Run And Return Rc And Output
3890: +    ...    sudo ${runtime} inspect clab-${lab-name}-${node} --format '{{.State.Running}}'
3891: +    Log    ${output}
3892: +    Should Be Equal As Integers    ${rc}    0
3893: +    ${state} =    Strip String    ${output}
3894: +    Should Be Equal    ${state}    true
3895: diff --git a/tests/srsim.robot b/tests/srsim.robot
3896: new file mode 100644
3897: index 0000000..6d7c7fc
3898: --- /dev/null
3899: +++ b/tests/srsim.robot
3900: @@ -0,0 +1,20 @@
3901: +*** Settings ***
3902: +Library     OperatingSystem
3903: +Resource    common.robot
3904: +
3905: +
3906: +*** Keywords ***
3907: +Deploy SR-SIM Lab
3908: +    [Arguments]    ${topology}    ${runtime}
3909: +    Log    ${topology}
3910: +    ${rc}    ${output} =    Run And Return Rc And Output
3911: +    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${topology}
3912: +    Log    ${output}
3913: +    Should Be Equal As Integers    ${rc}    0
3914: +
3915: +Destroy SR-SIM Lab
3916: +    [Arguments]    ${topology}    ${runtime}
3917: +    ${rc}    ${output} =    Run And Return Rc And Output
3918: +    ...    ${CLAB_BIN} --runtime ${runtime} destroy -t ${topology} --cleanup
3919: +    Log    ${output}
3920: +    Should Be Equal As Integers    ${rc}    0
3921: diff --git a/utils/sros_schema_gen.sh b/utils/sros_schema_gen.sh
3922: index 868c9d9..c2cef5b 100755
3923: --- a/utils/sros_schema_gen.sh
3924: +++ b/utils/sros_schema_gen.sh
3925: @@ -4,15 +4,18 @@
3926:  
3927:  CHASSIS_INFO_FILE=chassis_info.json
3928:  SCHEMA=../schemas/clab.schema.json
3929:  
3930:  jq --indent 4 -s '
3931: -  .[0] as $c | .[1] |
3932: +  .[0] as $all |
3933: +  .[1] |
3934: +  ([.. | objects | select(.enum? and (.enum | index("ixr-e2n"))) | .enum][0]) as $node_types |
3935: +  ($all | with_entries(select((.key | ascii_downcase) as $key | $node_types | index($key)))) as $c |
3936:    ($c | [.[].cpm // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cpms |
3937:    ($c | [.[].iom // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cards |
3938:    ($c | [.[].sfm // [] | .[]]) as $sfms |
3939: -  ($c | [.[].mda // [] | .[] | select(. != null)]) as $mdas |
3940: +  ($c | [.[].mda // [] | .[] | select(. != null)] + [.[].fixed_mdas // {} | .[]]) as $mdas |
3941:    ($c | [.[].xiom // [] | .[]]) as $xioms |
3942:  
3943:    .definitions["sros-cpm-types"].enum |= (. + $cpms | unique | sort) |
3944:    .definitions["sros-card-types"].enum |= (. + $cards | unique | sort) |
3945:    .definitions["sros-sfm-types"].enum |= (. + $sfms | unique | sort) |

(End of file - total 3945 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502dbe85001WWsVOOq6b14xZE",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502db31e001gHWujWsTb5hCpw",
  "callID": "call_30f8b88a6a0a40b89ed93844",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/diff.txt",
      "offset": 3151
    },
    "output": "<path>/source/diff.txt</path>\n<type>file</type>\n<content>\n3151:  Ensure sros is reachable over ssh\n3152:      Login via SSH with username and password\n3153:      ...    address=clab-${lab-name}-sros\n3154:      ...    username=admin\n3155: @@ -102,7 +99,7 @@ Verify saving config with copy flag\n3156:      [Teardown]    Run    rm -rf ${copy_dst}\n3157:  \n3158:  \n3159:  *** Keywords ***\n3160:  Cleanup\n3161: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3162: +    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3163:      Run    rm -f ${key-path}*\n3164: diff --git a/tests/13-srsim/03-sros-dist-to-linux.robot b/tests/13-srsim/03-sros-dist-to-linux.robot\n3165: index b0c6369..a473880 100644\n3166: --- a/tests/13-srsim/03-sros-dist-to-linux.robot\n3167: +++ b/tests/13-srsim/03-sros-dist-to-linux.robot\n3168: @@ -1,35 +1,23 @@\n3169:  *** Settings ***\n3170:  Library             OperatingSystem\n3171:  Resource            ../ssh.robot\n3172:  Resource            ../common.robot\n3173: +Resource            ../srsim.robot\n3174:  \n3175: -Suite Teardown      Run Keyword    Cleanup\n3176: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3177:  \n3178:  \n3179:  *** Variables ***\n3180:  ${lab-name}         sr03\n3181:  ${lab-file-name}    03-srsim-dist.clab.yml\n3182:  ${runtime}          docker\n3183: -${key-name}         clab-test-key\n3184:  \n3185:  \n3186:  *** Test Cases ***\n3187: -Set key-path Variable\n3188: -    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}\n3189: -    Set Suite Variable    ${key-path}\n3190: -\n3191: -Create SSH keypair - RSA\n3192: -    ${rc}    ${output} =    Run And Return Rc And Output\n3193: -    ...    ssh-keygen -t rsa -N \"\" -f ${key-path}-rsa\n3194: -\n3195:  Deploy ${lab-name} lab\n3196: -    Log    ${CURDIR}\n3197: -    ${rc}    ${output} =    Run And Return Rc And Output\n3198: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3199: -    Log    ${output}\n3200: -    Should Be Equal As Integers    ${rc}    0\n3201: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3202:  \n3203:  Ensure sros is reachable over ssh\n3204:      Login via SSH with username and password\n3205:      ...    address=clab-${lab-name}-sros-a\n3206:      ...    username=admin\n3207: @@ -55,10 +43,5 @@ Do a gNOI cert get-certs\n3208:      Skip If    '${runtime}' != 'docker'\n3209:      ${rc}    ${output} =    Run And Return Rc And Output\n3210:      ...    sudo docker run --network host --rm --mount type=bind,source=${CURDIR}/clab-${lab-name}/.tls/ca,target=/tls ghcr.io/karimra/gnoic:0.2.0 cert get-certs --username admin --password 'NokiaSros1!' --tls-ca /tls/ca.pem --address clab-${lab-name}-sros-a\n3211:      Log    ${output}\n3212:      Should Contain    ${output}    sros-a.${lab-name}.io\n3213: -\n3214: -*** Keywords ***\n3215: -Cleanup\n3216: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3217: -    Run    rm -f ${key-path}*\n3218: diff --git a/tests/13-srsim/04-sros-classic.robot b/tests/13-srsim/04-sros-classic.robot\n3219: index efdf58f..16b5811 100644\n3220: --- a/tests/13-srsim/04-sros-classic.robot\n3221: +++ b/tests/13-srsim/04-sros-classic.robot\n3222: @@ -1,9 +1,10 @@\n3223:  *** Settings ***\n3224:  Library             OperatingSystem\n3225:  Resource            ../ssh.robot\n3226:  Resource            ../common.robot\n3227: +Resource            ../srsim.robot\n3228:  \n3229:  Suite Teardown      Run Keyword    Cleanup\n3230:  \n3231:  \n3232:  *** Variables ***\n3233: @@ -23,15 +24,11 @@ Set key-path Variable\n3234:  Create SSH keypair - ecdsa512\n3235:      ${rc}    ${output} =    Run And Return Rc And Output\n3236:      ...    ssh-keygen -t ecdsa -b 521 -N \"\" -f ${key-path}-ecdsa512\n3237:  \n3238:  Deploy ${lab-name} lab\n3239: -    Log    ${CURDIR}\n3240: -    ${rc}    ${output} =    Run And Return Rc And Output\n3241: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3242: -    Log    ${output}\n3243: -    Should Be Equal As Integers    ${rc}    0\n3244: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3245:  \n3246:  Ensure sros is reachable over ssh\n3247:      Login via SSH with username and password\n3248:      ...    address=clab-${lab-name}-srsim\n3249:      ...    username=admin\n3250: @@ -58,7 +55,7 @@ Check Mixed Config Mode on srsim\n3251:      Log    ${output}\n3252:      Should Contain    ${output}    mixed\n3253:  \n3254:  *** Keywords ***\n3255:  Cleanup\n3256: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3257: +    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3258:      Run    rm -f ${key-path}*\n3259: diff --git a/tests/13-srsim/05-sros-comp-to-linux.robot b/tests/13-srsim/05-sros-comp-to-linux.robot\n3260: index 4bb4aac..f7db14e 100644\n3261: --- a/tests/13-srsim/05-sros-comp-to-linux.robot\n3262: +++ b/tests/13-srsim/05-sros-comp-to-linux.robot\n3263: @@ -1,9 +1,10 @@\n3264:  *** Settings ***\n3265:  Library             OperatingSystem\n3266:  Resource            ../ssh.robot\n3267:  Resource            ../common.robot\n3268: +Resource            ../srsim.robot\n3269:  \n3270:  Suite Teardown      Run Keyword    Cleanup\n3271:  \n3272:  \n3273:  *** Variables ***\n3274: @@ -21,15 +22,11 @@ Set key-path Variable\n3275:  Create SSH keypair - RSA\n3276:      ${rc}    ${output} =    Run And Return Rc And Output\n3277:      ...    ssh-keygen -t rsa -N \"\" -f ${key-path}-rsa\n3278:  \n3279:  Deploy ${lab-name} lab\n3280: -    Log    ${CURDIR}\n3281: -    ${rc}    ${output} =    Run And Return Rc And Output\n3282: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3283: -    Log    ${output}\n3284: -    Should Be Equal As Integers    ${rc}    0\n3285: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3286:  \n3287:  Ensure sros is reachable over ssh\n3288:      Login via SSH with username and password\n3289:      ...    address=clab-${lab-name}-sros\n3290:      ...    username=admin\n3291: @@ -136,7 +133,7 @@ Ensure XIOM MDA x/1 is equipped and up on sr2s-01\n3292:      Should Contain    ${output}    in-service\n3293:  \n3294:  \n3295:  *** Keywords ***\n3296:  Cleanup\n3297: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3298: +    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3299:      Run    rm -f ${key-path}*\n3300: diff --git a/tests/13-srsim/06-srsim-sar.robot b/tests/13-srsim/06-srsim-sar.robot\n3301: index 0633c48..0ef2dfa 100644\n3302: --- a/tests/13-srsim/06-srsim-sar.robot\n3303: +++ b/tests/13-srsim/06-srsim-sar.robot\n3304: @@ -1,33 +1,25 @@\n3305:  *** Settings ***\n3306:  Library             OperatingSystem\n3307:  Resource            ../ssh.robot\n3308:  Resource            ../common.robot\n3309: +Resource            ../srsim.robot\n3310:  \n3311: -Suite Teardown      Run Keyword    Cleanup\n3312: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3313:  \n3314:  \n3315:  *** Variables ***\n3316:  ${lab-name}         sr06\n3317:  ${lab-file-name}    06-srsim-sar.clab.yml\n3318:  ${runtime}          docker\n3319: -${key-name}         clab-test-key\n3320:  ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n3321:  ${gnmic_flags}      --username admin --password NokiaSros1! --values-only\n3322:  \n3323:  \n3324:  *** Test Cases ***\n3325: -Set key-path Variable\n3326: -    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}\n3327: -    Set Suite Variable    ${key-path}\n3328: -\n3329:  Deploy ${lab-name} lab\n3330: -    Log    ${CURDIR}\n3331: -    ${rc}    ${output} =    Run And Return Rc And Output\n3332: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3333: -    Log    ${output}\n3334: -    Should Be Equal As Integers    ${rc}    0\n3335: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3336:  \n3337:  Ensure sros is reachable over ssh\n3338:      Login via SSH with username and password\n3339:      ...    address=clab-${lab-name}-sar3\n3340:      ...    username=admin\n3341: @@ -45,10 +37,5 @@ Check Config Mode on sar1\n3342:  Check Config Mode on sar2\n3343:      ${rc}    ${output} =    Run And Return Rc And Output\n3344:      ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --insecure --address clab-${lab-name}-sar2 get --path /state/system/management-interface/configuration-oper-mode\n3345:      Log    ${output}\n3346:      Should Contain    ${output}    model-driven\n3347: -\n3348: -*** Keywords ***\n3349: -Cleanup\n3350: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3351: -    Run    rm -f ${key-path}*\n3352: diff --git a/tests/13-srsim/07-srsim-with-mgmt-network.robot b/tests/13-srsim/07-srsim-with-mgmt-network.robot\n3353: index 5025036..ce0951f 100644\n3354: --- a/tests/13-srsim/07-srsim-with-mgmt-network.robot\n3355: +++ b/tests/13-srsim/07-srsim-with-mgmt-network.robot\n3356: @@ -1,31 +1,23 @@\n3357:  *** Settings ***\n3358:  Library             OperatingSystem\n3359:  Resource            ../ssh.robot\n3360:  Resource            ../common.robot\n3361: +Resource            ../srsim.robot\n3362:  \n3363: -Suite Teardown      Run Keyword    Cleanup\n3364: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3365:  \n3366:  \n3367:  *** Variables ***\n3368:  ${lab-name}         sr07\n3369:  ${lab-file-name}    07-srsim-mix.clab.yml\n3370:  ${runtime}          docker\n3371: -${key-name}         clab-test-key\n3372:  \n3373:  \n3374:  *** Test Cases ***\n3375: -Set key-path Variable\n3376: -    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}\n3377: -    Set Suite Variable    ${key-path}\n3378: -\n3379:  Deploy ${lab-name} lab\n3380: -    Log    ${CURDIR}\n3381: -    ${rc}    ${output} =    Run And Return Rc And Output\n3382: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3383: -    Log    ${output}\n3384: -    Should Be Equal As Integers    ${rc}    0\n3385: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3386:  \n3387:  Ensure sros is reachable over ssh\n3388:      Login via SSH with username and password\n3389:      ...    address=clab-${lab-name}-srsim10\n3390:      ...    username=admin\n3391: @@ -57,15 +49,10 @@ Do a gNMI GET using TLS\n3392:      Log    ${output}\n3393:      Should Be Equal As Integers    ${rc}    0\n3394:      Should Contain    ${output}    srsim10-a\n3395:  \n3396:  *** Keywords ***\n3397: -Cleanup\n3398: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3399: -    Run    rm -f ${key-path}*\n3400: -\n3401: -\n3402:  Do a gNOI ping to other node\n3403:      Skip If    '${runtime}' != 'docker'\n3404:      ${rc}    ${output} =    Run And Return Rc And Output\n3405:      ...    sudo docker run --network host --rm --mount type=bind,source=${CURDIR}/clab-${lab-name}/.tls/ca,target=/tls ghcr.io/karimra/gnoic:0.2.0 system ping --username admin --password 'NokiaSros1!' --tls-ca /tls/ca.pem --address clab-${lab-name}-srsim10 --destination 100.0.0.11 --ns Base --count 3\n3406:      Log    ${output}\n3407: diff --git a/tests/13-srsim/08-srsim-comp-cfg-test.robot b/tests/13-srsim/08-srsim-comp-cfg-test.robot\n3408: index d276341..c531df4 100644\n3409: --- a/tests/13-srsim/08-srsim-comp-cfg-test.robot\n3410: +++ b/tests/13-srsim/08-srsim-comp-cfg-test.robot\n3411: @@ -1,11 +1,12 @@\n3412:  *** Settings ***\n3413:  Library             OperatingSystem\n3414:  Resource            ../ssh.robot\n3415:  Resource            ../common.robot\n3416: +Resource            ../srsim.robot\n3417:  \n3418: -Suite Teardown      Run Keyword    Cleanup\n3419: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3420:  \n3421:  \n3422:  *** Variables ***\n3423:  ${lab-name}         comp-cfg-gen-test\n3424:  ${lab-file-name}    08-srsim-comp-cfg-test.clab.yml\n3425: @@ -14,15 +15,11 @@ ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n3426:  ${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n3427:  \n3428:  \n3429:  *** Test Cases ***\n3430:  Deploy ${lab-name} lab\n3431: -    Log    ${CURDIR}\n3432: -    ${rc}    ${output} =    Run And Return Rc And Output\n3433: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3434: -    Log    ${output}\n3435: -    Should Be Equal As Integers    ${rc}    0\n3436: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3437:  \n3438:  Wait for 45s\n3439:      Sleep    45s    Let everything fully provision & come up\n3440:  \n3441:  Check SR-1 card configuration\n3442: @@ -121,13 +118,10 @@ Check SR-2s-ncofg has unprovisioned card\n3443:      Log    ${output}\n3444:      Should Be Equal As Integers    ${rc}    0\n3445:      Should Contain    ${output}    unprovisioned\n3446:  \n3447:  *** Keywords ***\n3448: -Cleanup\n3449: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3450: -\n3451:  Check SR-2S MDA state\n3452:      ${rc}    ${output} =    Run And Return Rc And Output\n3453:      ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr2s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/hardware-data/oper-state\n3454:      Log    ${output}\n3455:      Should Be Equal As Integers    ${rc}    0\n3456: diff --git a/tests/13-srsim/09-srsim-pause-container.robot b/tests/13-srsim/09-srsim-pause-container.robot\n3457: index 0f96bd7..90f57c3 100644\n3458: --- a/tests/13-srsim/09-srsim-pause-container.robot\n3459: +++ b/tests/13-srsim/09-srsim-pause-container.robot\n3460: @@ -1,12 +1,13 @@\n3461:  *** Settings ***\n3462:  Library             OperatingSystem\n3463:  Library             Process\n3464:  Resource            ../ssh.robot\n3465:  Resource            ../common.robot\n3466: +Resource            ../srsim.robot\n3467:  \n3468: -Suite Teardown      Run Keyword    Cleanup\n3469: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3470:  \n3471:  \n3472:  *** Variables ***\n3473:  ${lab-name}         srsim-pause-ctr\n3474:  ${lab-file-name}    09-srsim-pause-container.clab.yml\n3475: @@ -15,15 +16,11 @@ ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n3476:  ${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n3477:  \n3478:  \n3479:  *** Test Cases ***\n3480:  Deploy ${lab-name} lab\n3481: -    Log    ${CURDIR}\n3482: -    ${rc}    ${output} =    Run And Return Rc And Output\n3483: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3484: -    Log    ${output}\n3485: -    Should Be Equal As Integers    ${rc}    0\n3486: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3487:  \n3488:  Wait for 45s\n3489:      Sleep    45s    Let everything fully provision & come up\n3490:  \n3491:  # IPv4\n3492: @@ -165,11 +162,5 @@ Check CPM SSH\n3493:          Should Contain    ${output}    TiMOS\n3494:          Should Match Regexp    ${output}    ${slot}:admin@[^\\\\r\\\\n]+#\n3495:      FINALLY\n3496:          SSHLibrary.Close All Connections\n3497:      END\n3498: -\n3499: -Cleanup\n3500: -    ${rc}    ${output} =    Run And Return Rc And Output\n3501: -    ...    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3502: -    Log    ${output}\n3503: -    Should Be Equal As Integers    ${rc}    0\n3504: diff --git a/tests/13-srsim/10-srsim-lifecycle.robot b/tests/13-srsim/10-srsim-lifecycle.robot\n3505: index c9085d9..0b24da2 100644\n3506: --- a/tests/13-srsim/10-srsim-lifecycle.robot\n3507: +++ b/tests/13-srsim/10-srsim-lifecycle.robot\n3508: @@ -1,25 +1,22 @@\n3509:  *** Settings ***\n3510:  Library             OperatingSystem\n3511:  Resource            ../common.robot\n3512: +Resource            ../srsim.robot\n3513:  \n3514: -Suite Teardown      Run Keyword    Cleanup\n3515: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3516:  \n3517:  \n3518:  *** Variables ***\n3519:  ${lab-name}         lifecycle-test-srsim\n3520:  ${lab-file-name}    10-srsim-lifecycle.clab.yml\n3521:  ${runtime}          docker\n3522:  \n3523:  \n3524:  *** Test Cases ***\n3525:  Deploy ${lab-name} lab\n3526: -    Log    ${CURDIR}\n3527: -    ${rc}    ${output} =    Run And Return Rc And Output\n3528: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3529: -    Log    ${output}\n3530: -    Should Be Equal As Integers    ${rc}    0\n3531: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3532:  \n3533:  Ensure client can ping integrated SR OS node\n3534:      Sleep    20s    give time for SR OS nodes to boot\n3535:      ${rc}    ${output} =    Run And Return Rc And Output\n3536:      ...    ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\\=client --cmd \"ping -c2 -W2 10.0.1.2\"\n3537: @@ -85,10 +82,5 @@ Verify ping to distributed SR OS recovers after start\n3538:      ${rc}    ${output} =    Run And Return Rc And Output\n3539:      ...    ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\\=client --cmd \"ping -c2 -W2 10.0.2.2\"\n3540:      Log    ${output}\n3541:      Should Be Equal As Integers    ${rc}    0\n3542:      Should Match Regexp    ${output}    2 packets transmitted, 2 (packets )?received, 0% packet loss\n3543: -\n3544: -\n3545: -*** Keywords ***\n3546: -Cleanup\n3547: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3548: diff --git a/tests/13-srsim/12-srsim-veth-stitch.robot b/tests/13-srsim/12-srsim-veth-stitch.robot\n3549: index fac9fe1..9f70b9f 100644\n3550: --- a/tests/13-srsim/12-srsim-veth-stitch.robot\n3551: +++ b/tests/13-srsim/12-srsim-veth-stitch.robot\n3552: @@ -1,11 +1,12 @@\n3553:  *** Settings ***\n3554:  Library             OperatingSystem\n3555:  Resource            ../ssh.robot\n3556:  Resource            ../common.robot\n3557: +Resource            ../srsim.robot\n3558:  \n3559: -Suite Teardown      Run Keyword    Cleanup\n3560: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3561:  \n3562:  \n3563:  *** Variables ***\n3564:  ${lab-name}         veth-stitch\n3565:  ${lab-file-name}    12-srsim-veth-stitch.clab.yml\n3566: @@ -14,15 +15,11 @@ ${sros-password}    NokiaSros1!\n3567:  ${peer-ip}          10.0.0.2\n3568:  \n3569:  \n3570:  *** Test Cases ***\n3571:  Deploy ${lab-name} lab\n3572: -    Log    ${CURDIR}\n3573: -    ${rc}    ${output} =    Run And Return Rc And Output\n3574: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3575: -    Log    ${output}\n3576: -    Should Be Equal As Integers    ${rc}    0\n3577: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3578:  \n3579:  Ensure distributed sros can ping sros2 over the veth-stitch link\n3580:      Wait Until Keyword Succeeds    3 minutes    10 seconds    Ping succeeds    sros    ${peer-ip}\n3581:  \n3582:  Verify inspect interfaces returns the host-side stitch interfaces\n3583: @@ -87,13 +84,10 @@ Verify the stitch interfaces are removed on destroy\n3584:      Log    ${output}\n3585:      Should Not Contain    ${output}    clab-s-\n3586:  \n3587:  \n3588:  *** Keywords ***\n3589: -Cleanup\n3590: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3591: -\n3592:  Ping over SSH\n3593:      [Arguments]    ${node}    ${dst}\n3594:      Login via SSH with username and password\n3595:      ...    address=clab-${lab-name}-${node}\n3596:      ...    username=admin\n3597: diff --git a/tests/13-srsim/13-srsim-integrated.clab.yml b/tests/13-srsim/13-srsim-integrated.clab.yml\n3598: new file mode 100644\n3599: index 0000000..a3f2ca3\n3600: --- /dev/null\n3601: +++ b/tests/13-srsim/13-srsim-integrated.clab.yml\n3602: @@ -0,0 +1,33 @@\n3603: +# yaml-language-server: $schema=../../schemas/clab.schema.json\n3604: +name: srsim-integrated\n3605: +\n3606: +topology:\n3607: +  kinds:\n3608: +    nokia_srsim:\n3609: +      license: /opt/nokia/sros/license.txt\n3610: +      image: registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\n3611: +\n3612: +  nodes:\n3613: +    ixr-e2n:\n3614: +      kind: nokia_srsim\n3615: +      type: ixr-e2n\n3616: +      components:\n3617: +        - type: cpm-ixr-e2n/imm4-sfp+4-sfp+\n3618: +\n3619: +    ixr-r6:\n3620: +      kind: nokia_srsim\n3621: +      type: ixr-r6\n3622: +      components:\n3623: +        - slot: A\n3624: +        - slot: B\n3625: +\n3626: +    sr-1s:\n3627: +      kind: nokia_srsim\n3628: +      type: sr-1s\n3629: +      components:\n3630: +        - xiom:\n3631: +            - slot: 1\n3632: +              type: iom-s-3.0t\n3633: +              mda:\n3634: +                - slot: 1\n3635: +                  type: ms18-100gb-qsfp28\n3636: diff --git a/tests/13-srsim/13-srsim-integrated.robot b/tests/13-srsim/13-srsim-integrated.robot\n3637: new file mode 100644\n3638: index 0000000..8f6b929\n3639: --- /dev/null\n3640: +++ b/tests/13-srsim/13-srsim-integrated.robot\n3641: @@ -0,0 +1,105 @@\n3642: +*** Settings ***\n3643: +Library             OperatingSystem\n3644: +Resource            ../ssh.robot\n3645: +Resource            ../common.robot\n3646: +Resource            ../srsim.robot\n3647: +\n3648: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3649: +\n3650: +\n3651: +*** Variables ***\n3652: +${lab-name}         srsim-integrated\n3653: +${lab-file-name}    13-srsim-integrated.clab.yml\n3654: +${runtime}          docker\n3655: +${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n3656: +${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n3657: +\n3658: +\n3659: +*** Test Cases ***\n3660: +Deploy ${lab-name} lab\n3661: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3662: +\n3663: +Wait for 45s\n3664: +    Sleep    45s    Let everything fully provision & come up\n3665: +\n3666: +Check IXR-E2N card override is passed to the container\n3667: +    ${rc}    ${output} =    Run And Return Rc And Output\n3668: +    ...    sudo ${runtime} inspect clab-${lab-name}-ixr-e2n --format '{{range .Config.Env}}{{println .}}{{end}}'\n3669: +    Log    ${output}\n3670: +    Should Be Equal As Integers    ${rc}    0\n3671: +    Should Contain    ${output}    NOKIA_SROS_CARD=cpm-ixr-e2n/imm4-sfp+4-sfp+\n3672: +\n3673: +Check IXR-E2N equipped card matches the component\n3674: +    ${rc}    ${output} =    Run And Return Rc And Output\n3675: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-e2n --path /state/card[slot-number=1]/equipped-type\n3676: +    Log    ${output}\n3677: +    Should Be Equal As Integers    ${rc}    0\n3678: +    Should Contain    ${output}    imm4-sfp+4-sfp+\n3679: +\n3680: +Check IXR-R6 standby CPM slot is set\n3681: +    ${rc}    ${output} =    Run And Return Rc And Output\n3682: +    ...    sudo ${runtime} inspect clab-${lab-name}-ixr-r6-b --format '{{range .Config.Env}}{{println .}}{{end}}'\n3683: +    Log    ${output}\n3684: +    Should Be Equal As Integers    ${rc}    0\n3685: +    Should Contain    ${output}    NOKIA_SROS_SLOT=B\n3686: +\n3687: +Check IXR-R6 card configuration\n3688: +    ${rc}    ${output} =    Run And Return Rc And Output\n3689: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /configure/card[slot-number=1]/card-type\n3690: +    Log    ${output}\n3691: +    Should Be Equal As Integers    ${rc}    0\n3692: +    Should Contain    ${output}    iom-ixr-r6\n3693: +\n3694: +Check IXR-R6 MDA configuration\n3695: +    ${rc}    ${output} =    Run And Return Rc And Output\n3696: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /configure/card[slot-number=1]/mda[mda-slot=1]/mda-type\n3697: +    Log    ${output}\n3698: +    Should Be Equal As Integers    ${rc}    0\n3699: +    Should Contain    ${output}    m6-10g-sfp++1-100g-qsfp28\n3700: +\n3701: +Ensure IXR-R6 CPM A is up\n3702: +    Wait Until Keyword Succeeds    2 minutes    10 seconds    Check IXR-R6 CPM state    A\n3703: +\n3704: +Ensure IXR-R6 CPM B is up\n3705: +    Wait Until Keyword Succeeds    3 minutes    10 seconds    Check IXR-R6 CPM state    B\n3706: +\n3707: +\n3708: +Check SR-1s equipped card\n3709: +    ${rc}    ${output} =    Run And Return Rc And Output\n3710: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/equipped-type\n3711: +    Log    ${output}\n3712: +    Should Be Equal As Integers    ${rc}    0\n3713: +    Should Contain    ${output}    xcm-1s\n3714: +\n3715: +Check SR-1s equipped XIOM\n3716: +    ${rc}    ${output} =    Run And Return Rc And Output\n3717: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/equipped-type\n3718: +    Log    ${output}\n3719: +    Should Be Equal As Integers    ${rc}    0\n3720: +    Should Contain    ${output}    iom-s-3.0t\n3721: +\n3722: +Check SR-1s equipped XIOM MDA\n3723: +    ${rc}    ${output} =    Run And Return Rc And Output\n3724: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/equipped-type\n3725: +    Log    ${output}\n3726: +    Should Be Equal As Integers    ${rc}    0\n3727: +    Should Contain    ${output}    ms18-100gb-qsfp28\n3728: +\n3729: +Ensure SR-1s XIOM MDA is up\n3730: +    Wait Until Keyword Succeeds    2 minutes    10 seconds    Check SR-1s XIOM MDA state\n3731: +\n3732: +*** Keywords ***\n3733: +Check IXR-R6 CPM state\n3734: +    [Arguments]    ${slot}\n3735: +    ${rc}    ${output} =    Run And Return Rc And Output\n3736: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /state/cpm[cpm-slot=${slot}]/hardware-data/oper-state\n3737: +    Log    ${output}\n3738: +    Should Be Equal As Integers    ${rc}    0\n3739: +    Should Contain    ${output}    in-service\n3740: +\n3741: +Check SR-1s XIOM MDA state\n3742: +    ${rc}    ${output} =    Run And Return Rc And Output\n3743: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/hardware-data/oper-state\n3744: +    Log    ${output}\n3745: +    Should Be Equal As Integers    ${rc}    0\n3746: +    Should Contain    ${output}    in-service\n3747: diff --git a/tests/13-srsim/14-srsim-new-chassis.clab.yml b/tests/13-srsim/14-srsim-new-chassis.clab.yml\n3748: new file mode 100644\n3749: index 0000000..f5f3bc2\n3750: --- /dev/null\n3751: +++ b/tests/13-srsim/14-srsim-new-chassis.clab.yml\n3752: @@ -0,0 +1,53 @@\n3753: +# yaml-language-server: $schema=../../schemas/clab.schema.json\n3754: +name: srsim-new-chassis\n3755: +\n3756: +topology:\n3757: +  kinds:\n3758: +    nokia_srsim:\n3759: +      license: /opt/nokia/sros/license.txt\n3760: +      image: registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\n3761: +\n3762: +  nodes:\n3763: +    ixr-e2sc:\n3764: +      kind: nokia_srsim\n3765: +      type: ixr-e2sc\n3766: +\n3767: +    ixr-e3:\n3768: +      kind: nokia_srsim\n3769: +      type: ixr-e3\n3770: +\n3771: +    sar-10x:\n3772: +      kind: nokia_srsim\n3773: +      type: sar-10x\n3774: +      components:\n3775: +        - slot: A\n3776: +          type: cpiom-sar-x\n3777: +          mda: &mdas\n3778: +            - slot: 1\n3779: +              type: m2-1g-sfp+2-10g-sfp+\n3780: +            - slot: 2\n3781: +              type: m8-t1e1-rj48\n3782: +            - slot: 3\n3783: +              type: m2-1g-sfp+2-10g-sfp+\n3784: +            - slot: 4\n3785: +              type: m4-rs232-rj45+4-c3794-sfp\n3786: +            - slot: 5\n3787: +              type: m8-t1e1-rj48\n3788: +            - slot: 6\n3789: +              type: m4-rs232-rj45+4-c3794-sfp\n3790: +            - slot: 7\n3791: +              type: m8-t1e1-rj48\n3792: +            - slot: 8\n3793: +              type: m4-rs232-rj45+4-c3794-sfp\n3794: +        - slot: B\n3795: +          type: cpiom-sar-x\n3796: +          mda: *mdas\n3797: +      startup-config: |\n3798: +        /configure card 1 mda 1 mda-type m2-1g-sfp+2-10g-sfp+ admin-state enable\n3799: +        /configure card 1 mda 2 mda-type m8-t1e1-rj48 admin-state enable\n3800: +        /configure card 1 mda 3 mda-type m2-1g-sfp+2-10g-sfp+ admin-state enable\n3801: +        /configure card 1 mda 4 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable\n3802: +        /configure card 1 mda 5 mda-type m8-t1e1-rj48 admin-state enable\n3803: +        /configure card 1 mda 6 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable\n3804: +        /configure card 1 mda 7 mda-type m8-t1e1-rj48 admin-state enable\n3805: +        /configure card 1 mda 8 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable\n3806: diff --git a/tests/13-srsim/14-srsim-new-chassis.robot b/tests/13-srsim/14-srsim-new-chassis.robot\n3807: new file mode 100644\n3808: index 0000000..0f1b08a\n3809: --- /dev/null\n3810: +++ b/tests/13-srsim/14-srsim-new-chassis.robot\n3811: @@ -0,0 +1,83 @@\n3812: +*** Settings ***\n3813: +Library             OperatingSystem\n3814: +Library             String\n3815: +Resource            ../common.robot\n3816: +Resource            ../srsim.robot\n3817: +\n3818: +Suite Setup         Skip If    '${26_10_TESTS}'.lower() != 'true'\n3819: +...                 SR-SIM 26.10 is required; enable with --variable 26_10_TESTS:true\n3820: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3821: +\n3822: +\n3823: +*** Variables ***\n3824: +${lab-name}         srsim-new-chassis\n3825: +${lab-file-name}    14-srsim-new-chassis.clab.yml\n3826: +${runtime}          docker\n3827: +${26_10_TESTS}      false\n3828: +${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n3829: +${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n3830: +\n3831: +\n3832: +*** Test Cases ***\n3833: +Deploy ${lab-name} lab\n3834: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3835: +\n3836: +Check ixr-e2sc chassis\n3837: +    Check chassis    ixr-e2sc    ixr-e2sc\n3838: +\n3839: +Check ixr-e3 chassis\n3840: +    Check chassis    ixr-e3    ixr-e3\n3841: +\n3842: +Check sar-10x chassis\n3843: +    Check chassis    sar-10x-a    sar-10x\n3844: +    Check chassis    sar-10x-b    sar-10x\n3845: +\n3846: +Ensure new chassis containers stay running\n3847: +    Sleep    30s    Let the simulators get past initial startup\n3848: +    Check container is running    ixr-e2sc\n3849: +    Check container is running    ixr-e3\n3850: +    Check container is running    sar-10x-a\n3851: +    Check container is running    sar-10x-b\n3852: +\n3853: +Check sar-10x line cards are up\n3854: +    Wait Until Keyword Succeeds    3 minutes    15 seconds    SAR-10x line cards are up\n3855: +\n3856: +*** Keywords ***\n3857: +SAR-10x line cards are up\n3858: +    # Query card 1, MDAs 1/1..1/8, then card 2 in chassis order.\n3859: +    ${command} =    Catenate    SEPARATOR=${SPACE}\n3860: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags}\n3861: +    ...    --address clab-${lab-name}-sar-10x\n3862: +    ...    --path /state/card[slot-number=1]/hardware-data/oper-state\n3863: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=1]/hardware-data/oper-state\n3864: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=2]/hardware-data/oper-state\n3865: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=3]/hardware-data/oper-state\n3866: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=4]/hardware-data/oper-state\n3867: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=5]/hardware-data/oper-state\n3868: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=6]/hardware-data/oper-state\n3869: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=7]/hardware-data/oper-state\n3870: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=8]/hardware-data/oper-state\n3871: +    ...    --path /state/card[slot-number=2]/hardware-data/oper-state\n3872: +    ${rc}    ${output} =    Run And Return Rc And Output    ${command}\n3873: +    Log    ${output}\n3874: +    Should Be Equal As Integers    ${rc}    0\n3875: +    ${up_states} =    Get Regexp Matches    ${output}    in-service\n3876: +    Length Should Be    ${up_states}    10\n3877: +    Should Not Contain    ${output}    null\n3878: +\n3879: +Check chassis\n3880: +    [Arguments]    ${node}    ${chassis}\n3881: +    ${rc}    ${output} =    Run And Return Rc And Output\n3882: +    ...    sudo ${runtime} inspect clab-${lab-name}-${node} --format '{{range .Config.Env}}{{println .}}{{end}}'\n3883: +    Log    ${output}\n3884: +    Should Be Equal As Integers    ${rc}    0\n3885: +    Should Contain    ${output}    NOKIA_SROS_CHASSIS=${chassis}\n3886: +\n3887: +Check container is running\n3888: +    [Arguments]    ${node}\n3889: +    ${rc}    ${output} =    Run And Return Rc And Output\n3890: +    ...    sudo ${runtime} inspect clab-${lab-name}-${node} --format '{{.State.Running}}'\n3891: +    Log    ${output}\n3892: +    Should Be Equal As Integers    ${rc}    0\n3893: +    ${state} =    Strip String    ${output}\n3894: +    Should Be Equal    ${state}    true\n3895: diff --git a/tests/srsim.robot b/tests/srsim.robot\n3896: new file mode 100644\n3897: index 0000000..6d7c7fc\n3898: --- /dev/null\n3899: +++ b/tests/srsim.robot\n3900: @@ -0,0 +1,20 @@\n3901: +*** Settings ***\n3902: +Library     OperatingSystem\n3903: +Resource    common.robot\n3904: +\n3905: +\n3906: +*** Keywords ***\n3907: +Deploy SR-SIM Lab\n3908: +    [Arguments]    ${topology}    ${runtime}\n3909: +    Log    ${topology}\n3910: +    ${rc}    ${output} =    Run And Return Rc And Output\n3911: +    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${topology}\n3912: +    Log    ${output}\n3913: +    Should Be Equal As Integers    ${rc}    0\n3914: +\n3915: +Destroy SR-SIM Lab\n3916: +    [Arguments]    ${topology}    ${runtime}\n3917: +    ${rc}    ${output} =    Run And Return Rc And Output\n3918: +    ...    ${CLAB_BIN} --runtime ${runtime} destroy -t ${topology} --cleanup\n3919: +    Log    ${output}\n3920: +    Should Be Equal As Integers    ${rc}    0\n3921: diff --git a/utils/sros_schema_gen.sh b/utils/sros_schema_gen.sh\n3922: index 868c9d9..c2cef5b 100755\n3923: --- a/utils/sros_schema_gen.sh\n3924: +++ b/utils/sros_schema_gen.sh\n3925: @@ -4,15 +4,18 @@\n3926:  \n3927:  CHASSIS_INFO_FILE=chassis_info.json\n3928:  SCHEMA=../schemas/clab.schema.json\n3929:  \n3930:  jq --indent 4 -s '\n3931: -  .[0] as $c | .[1] |\n3932: +  .[0] as $all |\n3933: +  .[1] |\n3934: +  ([.. | objects | select(.enum? and (.enum | index(\"ixr-e2n\"))) | .enum][0]) as $node_types |\n3935: +  ($all | with_entries(select((.key | ascii_downcase) as $key | $node_types | index($key)))) as $c |\n3936:    ($c | [.[].cpm // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cpms |\n3937:    ($c | [.[].iom // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cards |\n3938:    ($c | [.[].sfm // [] | .[]]) as $sfms |\n3939: -  ($c | [.[].mda // [] | .[] | select(. != null)]) as $mdas |\n3940: +  ($c | [.[].mda // [] | .[] | select(. != null)] + [.[].fixed_mdas // {} | .[]]) as $mdas |\n3941:    ($c | [.[].xiom // [] | .[]]) as $xioms |\n3942:  \n3943:    .definitions[\"sros-cpm-types\"].enum |= (. + $cpms | unique | sort) |\n3944:    .definitions[\"sros-card-types\"].enum |= (. + $cards | unique | sort) |\n3945:    .definitions[\"sros-sfm-types\"].enum |= (. + $sfms | unique | sort) |\n\n(End of file - total 3945 lines)\n</content>",
    "title": "source/diff.txt",
    "metadata": {
      "preview": " Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-sros\n     ...    username=admin\n@@ -102,7 +99,7 @@ Verify saving config with copy flag\n     [Teardown]    Run    rm -rf ${copy_dst}\n \n \n *** Keywords ***\n Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n+    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n     Run    rm -f ${key-path}*\ndiff --git a/tests/13-srsim/03-sros-dist-to-linux.robot b/tests/13-srsim/03-sros-dist-to-linux.robot\nindex b0c6369..a473880 100644\n--- a/tests/13-srsim/03-sros-dist-to-linux.robot\n+++ b/tests/13-srsim/03-sros-dist-to-linux.robot\n@@ -1,35 +1,23 @@\n *** Settings ***\n Library             OperatingSystem",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/diff.txt",
        "text": " Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-sros\n     ...    username=admin\n@@ -102,7 +99,7 @@ Verify saving config with copy flag\n     [Teardown]    Run    rm -rf ${copy_dst}\n \n \n *** Keywords ***\n Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n+    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n     Run    rm -f ${key-path}*\ndiff --git a/tests/13-srsim/03-sros-dist-to-linux.robot b/tests/13-srsim/03-sros-dist-to-linux.robot\nindex b0c6369..a473880 100644\n--- a/tests/13-srsim/03-sros-dist-to-linux.robot\n+++ b/tests/13-srsim/03-sros-dist-to-linux.robot\n@@ -1,35 +1,23 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         sr03\n ${lab-file-name}    03-srsim-dist.clab.yml\n ${runtime}          docker\n-${key-name}         clab-test-key\n \n \n *** Test Cases ***\n-Set key-path Variable\n-    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}\n-    Set Suite Variable    ${key-path}\n-\n-Create SSH keypair - RSA\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ssh-keygen -t rsa -N \"\" -f ${key-path}-rsa\n-\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-sros-a\n     ...    username=admin\n@@ -55,10 +43,5 @@ Do a gNOI cert get-certs\n     Skip If    '${runtime}' != 'docker'\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    sudo docker run --network host --rm --mount type=bind,source=${CURDIR}/clab-${lab-name}/.tls/ca,target=/tls ghcr.io/karimra/gnoic:0.2.0 cert get-certs --username admin --password 'NokiaSros1!' --tls-ca /tls/ca.pem --address clab-${lab-name}-sros-a\n     Log    ${output}\n     Should Contain    ${output}    sros-a.${lab-name}.io\n-\n-*** Keywords ***\n-Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n-    Run    rm -f ${key-path}*\ndiff --git a/tests/13-srsim/04-sros-classic.robot b/tests/13-srsim/04-sros-classic.robot\nindex efdf58f..16b5811 100644\n--- a/tests/13-srsim/04-sros-classic.robot\n+++ b/tests/13-srsim/04-sros-classic.robot\n@@ -1,9 +1,10 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n Suite Teardown      Run Keyword    Cleanup\n \n \n *** Variables ***\n@@ -23,15 +24,11 @@ Set key-path Variable\n Create SSH keypair - ecdsa512\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    ssh-keygen -t ecdsa -b 521 -N \"\" -f ${key-path}-ecdsa512\n \n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-srsim\n     ...    username=admin\n@@ -58,7 +55,7 @@ Check Mixed Config Mode on srsim\n     Log    ${output}\n     Should Contain    ${output}    mixed\n \n *** Keywords ***\n Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n+    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n     Run    rm -f ${key-path}*\ndiff --git a/tests/13-srsim/05-sros-comp-to-linux.robot b/tests/13-srsim/05-sros-comp-to-linux.robot\nindex 4bb4aac..f7db14e 100644\n--- a/tests/13-srsim/05-sros-comp-to-linux.robot\n+++ b/tests/13-srsim/05-sros-comp-to-linux.robot\n@@ -1,9 +1,10 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n Suite Teardown      Run Keyword    Cleanup\n \n \n *** Variables ***\n@@ -21,15 +22,11 @@ Set key-path Variable\n Create SSH keypair - RSA\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    ssh-keygen -t rsa -N \"\" -f ${key-path}-rsa\n \n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-sros\n     ...    username=admin\n@@ -136,7 +133,7 @@ Ensure XIOM MDA x/1 is equipped and up on sr2s-01\n     Should Contain    ${output}    in-service\n \n \n *** Keywords ***\n Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n+    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n     Run    rm -f ${key-path}*\ndiff --git a/tests/13-srsim/06-srsim-sar.robot b/tests/13-srsim/06-srsim-sar.robot\nindex 0633c48..0ef2dfa 100644\n--- a/tests/13-srsim/06-srsim-sar.robot\n+++ b/tests/13-srsim/06-srsim-sar.robot\n@@ -1,33 +1,25 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         sr06\n ${lab-file-name}    06-srsim-sar.clab.yml\n ${runtime}          docker\n-${key-name}         clab-test-key\n ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n ${gnmic_flags}      --username admin --password NokiaSros1! --values-only\n \n \n *** Test Cases ***\n-Set key-path Variable\n-    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}\n-    Set Suite Variable    ${key-path}\n-\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-sar3\n     ...    username=admin\n@@ -45,10 +37,5 @@ Check Config Mode on sar1\n Check Config Mode on sar2\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --insecure --address clab-${lab-name}-sar2 get --path /state/system/management-interface/configuration-oper-mode\n     Log    ${output}\n     Should Contain    ${output}    model-driven\n-\n-*** Keywords ***\n-Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n-    Run    rm -f ${key-path}*\ndiff --git a/tests/13-srsim/07-srsim-with-mgmt-network.robot b/tests/13-srsim/07-srsim-with-mgmt-network.robot\nindex 5025036..ce0951f 100644\n--- a/tests/13-srsim/07-srsim-with-mgmt-network.robot\n+++ b/tests/13-srsim/07-srsim-with-mgmt-network.robot\n@@ -1,31 +1,23 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         sr07\n ${lab-file-name}    07-srsim-mix.clab.yml\n ${runtime}          docker\n-${key-name}         clab-test-key\n \n \n *** Test Cases ***\n-Set key-path Variable\n-    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}\n-    Set Suite Variable    ${key-path}\n-\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-srsim10\n     ...    username=admin\n@@ -57,15 +49,10 @@ Do a gNMI GET using TLS\n     Log    ${output}\n     Should Be Equal As Integers    ${rc}    0\n     Should Contain    ${output}    srsim10-a\n \n *** Keywords ***\n-Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n-    Run    rm -f ${key-path}*\n-\n-\n Do a gNOI ping to other node\n     Skip If    '${runtime}' != 'docker'\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    sudo docker run --network host --rm --mount type=bind,source=${CURDIR}/clab-${lab-name}/.tls/ca,target=/tls ghcr.io/karimra/gnoic:0.2.0 system ping --username admin --password 'NokiaSros1!' --tls-ca /tls/ca.pem --address clab-${lab-name}-srsim10 --destination 100.0.0.11 --ns Base --count 3\n     Log    ${output}\ndiff --git a/tests/13-srsim/08-srsim-comp-cfg-test.robot b/tests/13-srsim/08-srsim-comp-cfg-test.robot\nindex d276341..c531df4 100644\n--- a/tests/13-srsim/08-srsim-comp-cfg-test.robot\n+++ b/tests/13-srsim/08-srsim-comp-cfg-test.robot\n@@ -1,11 +1,12 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         comp-cfg-gen-test\n ${lab-file-name}    08-srsim-comp-cfg-test.clab.yml\n@@ -14,15 +15,11 @@ ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n ${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n \n \n *** Test Cases ***\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Wait for 45s\n     Sleep    45s    Let everything fully provision & come up\n \n Check SR-1 card configuration\n@@ -121,13 +118,10 @@ Check SR-2s-ncofg has unprovisioned card\n     Log    ${output}\n     Should Be Equal As Integers    ${rc}    0\n     Should Contain    ${output}    unprovisioned\n \n *** Keywords ***\n-Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n-\n Check SR-2S MDA state\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr2s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/hardware-data/oper-state\n     Log    ${output}\n     Should Be Equal As Integers    ${rc}    0\ndiff --git a/tests/13-srsim/09-srsim-pause-container.robot b/tests/13-srsim/09-srsim-pause-container.robot\nindex 0f96bd7..90f57c3 100644\n--- a/tests/13-srsim/09-srsim-pause-container.robot\n+++ b/tests/13-srsim/09-srsim-pause-container.robot\n@@ -1,12 +1,13 @@\n *** Settings ***\n Library             OperatingSystem\n Library             Process\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         srsim-pause-ctr\n ${lab-file-name}    09-srsim-pause-container.clab.yml\n@@ -15,15 +16,11 @@ ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n ${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n \n \n *** Test Cases ***\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Wait for 45s\n     Sleep    45s    Let everything fully provision & come up\n \n # IPv4\n@@ -165,11 +162,5 @@ Check CPM SSH\n         Should Contain    ${output}    TiMOS\n         Should Match Regexp    ${output}    ${slot}:admin@[^\\\\r\\\\n]+#\n     FINALLY\n         SSHLibrary.Close All Connections\n     END\n-\n-Cleanup\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\ndiff --git a/tests/13-srsim/10-srsim-lifecycle.robot b/tests/13-srsim/10-srsim-lifecycle.robot\nindex c9085d9..0b24da2 100644\n--- a/tests/13-srsim/10-srsim-lifecycle.robot\n+++ b/tests/13-srsim/10-srsim-lifecycle.robot\n@@ -1,25 +1,22 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         lifecycle-test-srsim\n ${lab-file-name}    10-srsim-lifecycle.clab.yml\n ${runtime}          docker\n \n \n *** Test Cases ***\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure client can ping integrated SR OS node\n     Sleep    20s    give time for SR OS nodes to boot\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\\=client --cmd \"ping -c2 -W2 10.0.1.2\"\n@@ -85,10 +82,5 @@ Verify ping to distributed SR OS recovers after start\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\\=client --cmd \"ping -c2 -W2 10.0.2.2\"\n     Log    ${output}\n     Should Be Equal As Integers    ${rc}    0\n     Should Match Regexp    ${output}    2 packets transmitted, 2 (packets )?received, 0% packet loss\n-\n-\n-*** Keywords ***\n-Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\ndiff --git a/tests/13-srsim/12-srsim-veth-stitch.robot b/tests/13-srsim/12-srsim-veth-stitch.robot\nindex fac9fe1..9f70b9f 100644\n--- a/tests/13-srsim/12-srsim-veth-stitch.robot\n+++ b/tests/13-srsim/12-srsim-veth-stitch.robot\n@@ -1,11 +1,12 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         veth-stitch\n ${lab-file-name}    12-srsim-veth-stitch.clab.yml\n@@ -14,15 +15,11 @@ ${sros-password}    NokiaSros1!\n ${peer-ip}          10.0.0.2\n \n \n *** Test Cases ***\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure distributed sros can ping sros2 over the veth-stitch link\n     Wait Until Keyword Succeeds    3 minutes    10 seconds    Ping succeeds    sros    ${peer-ip}\n \n Verify inspect interfaces returns the host-side stitch interfaces\n@@ -87,13 +84,10 @@ Verify the stitch interfaces are removed on destroy\n     Log    ${output}\n     Should Not Contain    ${output}    clab-s-\n \n \n *** Keywords ***\n-Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n-\n Ping over SSH\n     [Arguments]    ${node}    ${dst}\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-${node}\n     ...    username=admin\ndiff --git a/tests/13-srsim/13-srsim-integrated.clab.yml b/tests/13-srsim/13-srsim-integrated.clab.yml\nnew file mode 100644\nindex 0000000..a3f2ca3\n--- /dev/null\n+++ b/tests/13-srsim/13-srsim-integrated.clab.yml\n@@ -0,0 +1,33 @@\n+# yaml-language-server: $schema=../../schemas/clab.schema.json\n+name: srsim-integrated\n+\n+topology:\n+  kinds:\n+    nokia_srsim:\n+      license: /opt/nokia/sros/license.txt\n+      image: registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\n+\n+  nodes:\n+    ixr-e2n:\n+      kind: nokia_srsim\n+      type: ixr-e2n\n+      components:\n+        - type: cpm-ixr-e2n/imm4-sfp+4-sfp+\n+\n+    ixr-r6:\n+      kind: nokia_srsim\n+      type: ixr-r6\n+      components:\n+        - slot: A\n+        - slot: B\n+\n+    sr-1s:\n+      kind: nokia_srsim\n+      type: sr-1s\n+      components:\n+        - xiom:\n+            - slot: 1\n+              type: iom-s-3.0t\n+              mda:\n+                - slot: 1\n+                  type: ms18-100gb-qsfp28\ndiff --git a/tests/13-srsim/13-srsim-integrated.robot b/tests/13-srsim/13-srsim-integrated.robot\nnew file mode 100644\nindex 0000000..8f6b929\n--- /dev/null\n+++ b/tests/13-srsim/13-srsim-integrated.robot\n@@ -0,0 +1,105 @@\n+*** Settings ***\n+Library             OperatingSystem\n+Resource            ../ssh.robot\n+Resource            ../common.robot\n+Resource            ../srsim.robot\n+\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n+\n+\n+*** Variables ***\n+${lab-name}         srsim-integrated\n+${lab-file-name}    13-srsim-integrated.clab.yml\n+${runtime}          docker\n+${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n+${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n+\n+\n+*** Test Cases ***\n+Deploy ${lab-name} lab\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n+\n+Wait for 45s\n+    Sleep    45s    Let everything fully provision & come up\n+\n+Check IXR-E2N card override is passed to the container\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} inspect clab-${lab-name}-ixr-e2n --format '{{range .Config.Env}}{{println .}}{{end}}'\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    NOKIA_SROS_CARD=cpm-ixr-e2n/imm4-sfp+4-sfp+\n+\n+Check IXR-E2N equipped card matches the component\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-e2n --path /state/card[slot-number=1]/equipped-type\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    imm4-sfp+4-sfp+\n+\n+Check IXR-R6 standby CPM slot is set\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} inspect clab-${lab-name}-ixr-r6-b --format '{{range .Config.Env}}{{println .}}{{end}}'\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    NOKIA_SROS_SLOT=B\n+\n+Check IXR-R6 card configuration\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /configure/card[slot-number=1]/card-type\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    iom-ixr-r6\n+\n+Check IXR-R6 MDA configuration\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /configure/card[slot-number=1]/mda[mda-slot=1]/mda-type\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    m6-10g-sfp++1-100g-qsfp28\n+\n+Ensure IXR-R6 CPM A is up\n+    Wait Until Keyword Succeeds    2 minutes    10 seconds    Check IXR-R6 CPM state    A\n+\n+Ensure IXR-R6 CPM B is up\n+    Wait Until Keyword Succeeds    3 minutes    10 seconds    Check IXR-R6 CPM state    B\n+\n+\n+Check SR-1s equipped card\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/equipped-type\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    xcm-1s\n+\n+Check SR-1s equipped XIOM\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/equipped-type\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    iom-s-3.0t\n+\n+Check SR-1s equipped XIOM MDA\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/equipped-type\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    ms18-100gb-qsfp28\n+\n+Ensure SR-1s XIOM MDA is up\n+    Wait Until Keyword Succeeds    2 minutes    10 seconds    Check SR-1s XIOM MDA state\n+\n+*** Keywords ***\n+Check IXR-R6 CPM state\n+    [Arguments]    ${slot}\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /state/cpm[cpm-slot=${slot}]/hardware-data/oper-state\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    in-service\n+\n+Check SR-1s XIOM MDA state\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/hardware-data/oper-state\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    in-service\ndiff --git a/tests/13-srsim/14-srsim-new-chassis.clab.yml b/tests/13-srsim/14-srsim-new-chassis.clab.yml\nnew file mode 100644\nindex 0000000..f5f3bc2\n--- /dev/null\n+++ b/tests/13-srsim/14-srsim-new-chassis.clab.yml\n@@ -0,0 +1,53 @@\n+# yaml-language-server: $schema=../../schemas/clab.schema.json\n+name: srsim-new-chassis\n+\n+topology:\n+  kinds:\n+    nokia_srsim:\n+      license: /opt/nokia/sros/license.txt\n+      image: registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\n+\n+  nodes:\n+    ixr-e2sc:\n+      kind: nokia_srsim\n+      type: ixr-e2sc\n+\n+    ixr-e3:\n+      kind: nokia_srsim\n+      type: ixr-e3\n+\n+    sar-10x:\n+      kind: nokia_srsim\n+      type: sar-10x\n+      components:\n+        - slot: A\n+          type: cpiom-sar-x\n+          mda: &mdas\n+            - slot: 1\n+              type: m2-1g-sfp+2-10g-sfp+\n+            - slot: 2\n+              type: m8-t1e1-rj48\n+            - slot: 3\n+              type: m2-1g-sfp+2-10g-sfp+\n+            - slot: 4\n+              type: m4-rs232-rj45+4-c3794-sfp\n+            - slot: 5\n+              type: m8-t1e1-rj48\n+            - slot: 6\n+              type: m4-rs232-rj45+4-c3794-sfp\n+            - slot: 7\n+              type: m8-t1e1-rj48\n+            - slot: 8\n+              type: m4-rs232-rj45+4-c3794-sfp\n+        - slot: B\n+          type: cpiom-sar-x\n+          mda: *mdas\n+      startup-config: |\n+        /configure card 1 mda 1 mda-type m2-1g-sfp+2-10g-sfp+ admin-state enable\n+        /configure card 1 mda 2 mda-type m8-t1e1-rj48 admin-state enable\n+        /configure card 1 mda 3 mda-type m2-1g-sfp+2-10g-sfp+ admin-state enable\n+        /configure card 1 mda 4 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable\n+        /configure card 1 mda 5 mda-type m8-t1e1-rj48 admin-state enable\n+        /configure card 1 mda 6 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable\n+        /configure card 1 mda 7 mda-type m8-t1e1-rj48 admin-state enable\n+        /configure card 1 mda 8 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable\ndiff --git a/tests/13-srsim/14-srsim-new-chassis.robot b/tests/13-srsim/14-srsim-new-chassis.robot\nnew file mode 100644\nindex 0000000..0f1b08a\n--- /dev/null\n+++ b/tests/13-srsim/14-srsim-new-chassis.robot\n@@ -0,0 +1,83 @@\n+*** Settings ***\n+Library             OperatingSystem\n+Library             String\n+Resource            ../common.robot\n+Resource            ../srsim.robot\n+\n+Suite Setup         Skip If    '${26_10_TESTS}'.lower() != 'true'\n+...                 SR-SIM 26.10 is required; enable with --variable 26_10_TESTS:true\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n+\n+\n+*** Variables ***\n+${lab-name}         srsim-new-chassis\n+${lab-file-name}    14-srsim-new-chassis.clab.yml\n+${runtime}          docker\n+${26_10_TESTS}      false\n+${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n+${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n+\n+\n+*** Test Cases ***\n+Deploy ${lab-name} lab\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n+\n+Check ixr-e2sc chassis\n+    Check chassis    ixr-e2sc    ixr-e2sc\n+\n+Check ixr-e3 chassis\n+    Check chassis    ixr-e3    ixr-e3\n+\n+Check sar-10x chassis\n+    Check chassis    sar-10x-a    sar-10x\n+    Check chassis    sar-10x-b    sar-10x\n+\n+Ensure new chassis containers stay running\n+    Sleep    30s    Let the simulators get past initial startup\n+    Check container is running    ixr-e2sc\n+    Check container is running    ixr-e3\n+    Check container is running    sar-10x-a\n+    Check container is running    sar-10x-b\n+\n+Check sar-10x line cards are up\n+    Wait Until Keyword Succeeds    3 minutes    15 seconds    SAR-10x line cards are up\n+\n+*** Keywords ***\n+SAR-10x line cards are up\n+    # Query card 1, MDAs 1/1..1/8, then card 2 in chassis order.\n+    ${command} =    Catenate    SEPARATOR=${SPACE}\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags}\n+    ...    --address clab-${lab-name}-sar-10x\n+    ...    --path /state/card[slot-number=1]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=1]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=2]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=3]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=4]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=5]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=6]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=7]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=8]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=2]/hardware-data/oper-state\n+    ${rc}    ${output} =    Run And Return Rc And Output    ${command}\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    ${up_states} =    Get Regexp Matches    ${output}    in-service\n+    Length Should Be    ${up_states}    10\n+    Should Not Contain    ${output}    null\n+\n+Check chassis\n+    [Arguments]    ${node}    ${chassis}\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} inspect clab-${lab-name}-${node} --format '{{range .Config.Env}}{{println .}}{{end}}'\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    NOKIA_SROS_CHASSIS=${chassis}\n+\n+Check container is running\n+    [Arguments]    ${node}\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} inspect clab-${lab-name}-${node} --format '{{.State.Running}}'\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    ${state} =    Strip String    ${output}\n+    Should Be Equal    ${state}    true\ndiff --git a/tests/srsim.robot b/tests/srsim.robot\nnew file mode 100644\nindex 0000000..6d7c7fc\n--- /dev/null\n+++ b/tests/srsim.robot\n@@ -0,0 +1,20 @@\n+*** Settings ***\n+Library     OperatingSystem\n+Resource    common.robot\n+\n+\n+*** Keywords ***\n+Deploy SR-SIM Lab\n+    [Arguments]    ${topology}    ${runtime}\n+    Log    ${topology}\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${topology}\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+\n+Destroy SR-SIM Lab\n+    [Arguments]    ${topology}    ${runtime}\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    ${CLAB_BIN} --runtime ${runtime} destroy -t ${topology} --cleanup\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\ndiff --git a/utils/sros_schema_gen.sh b/utils/sros_schema_gen.sh\nindex 868c9d9..c2cef5b 100755\n--- a/utils/sros_schema_gen.sh\n+++ b/utils/sros_schema_gen.sh\n@@ -4,15 +4,18 @@\n \n CHASSIS_INFO_FILE=chassis_info.json\n SCHEMA=../schemas/clab.schema.json\n \n jq --indent 4 -s '\n-  .[0] as $c | .[1] |\n+  .[0] as $all |\n+  .[1] |\n+  ([.. | objects | select(.enum? and (.enum | index(\"ixr-e2n\"))) | .enum][0]) as $node_types |\n+  ($all | with_entries(select((.key | ascii_downcase) as $key | $node_types | index($key)))) as $c |\n   ($c | [.[].cpm // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cpms |\n   ($c | [.[].iom // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cards |\n   ($c | [.[].sfm // [] | .[]]) as $sfms |\n-  ($c | [.[].mda // [] | .[] | select(. != null)]) as $mdas |\n+  ($c | [.[].mda // [] | .[] | select(. != null)] + [.[].fixed_mdas // {} | .[]]) as $mdas |\n   ($c | [.[].xiom // [] | .[]]) as $xioms |\n \n   .definitions[\"sros-cpm-types\"].enum |= (. + $cpms | unique | sort) |\n   .definitions[\"sros-card-types\"].enum |= (. + $cards | unique | sort) |\n   .definitions[\"sros-sfm-types\"].enum |= (. + $sfms | unique | sort) |",
        "lineStart": 3151,
        "lineEnd": 3945,
        "totalLines": 3945,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346537609,
      "end": 1792346537620
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502dbe97001NfHZSteX5xlsX1",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502db31e001gHWujWsTb5hCpw",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 66639,
    "input": 21813,
    "output": 20,
    "reasoning": 6,
    "cache": {
      "read": 44800,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502db31e001gHWujWsTb5hCpw",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346534686,
    "completed": 1792346537627
  },
  "parentID": "msg_1502d8a66001F2b7xDf6faLOHN",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 66639,
    "input": 21813,
    "output": 20,
    "reasoning": 6,
    "cache": {
      "read": 44800,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 7
step-start
{
  "type": "step-start",
  "id": "prt_1502df6ba001K51PVYfgfbNuBP",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502dbe9f001ek5Hgev3SCmtk8"
}
Reasoning
Now let me read the head files for the changed Go files to check for issues. Key files to examine carefully:

1. `nodes/sros/chassis_info.go` — new validation logic.
2. `nodes/sros/component.go` — env override logic.
3. `nodes/sros/component_config.go` — integrated config generation.
4. `nodes/sros/config.go` — config generation moved from sros.go.
5. `nodes/sros/netns.go` — moved code.
6. `nodes/sros/sros.go` — big changes.
7. Schema changes.

Let me read head files.
Now let me read the head source files in detail.
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/chassis_info.go"
}

Output

<path>/source/head/nodes/sros/chassis_info.go</path>
<type>file</type>
<content>
1: // Copyright 2025 Nokia
2: // Licensed under the BSD 3-Clause License.
3: // SPDX-License-Identifier: BSD-3-Clause
4: 
5: package sros
6: 
7: import (
8: 	"encoding/json"
9: 	"fmt"
10: 	"slices"
11: 	"strconv"
12: 	"strings"
13: )
14: 
15: // DefaultChassisInfoPath is the path to chassis_info.json inside SROS/SR SIM container images.
16: const DefaultChassisInfoPath = "/opt/nokia/chassis_info.json"
17: 
18: // chassisInfoFileLicense is prepended to the chassis_info.json file written to LabDir.
19: const chassisInfoFileLicense = "// Copyright 2026 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\n"
20: 
21: type chassisInfoEntry struct {
22: 	Alias      string            `json:"alias"`
23: 	CPM        []string          `json:"cpm"`
24: 	IOM        []string          `json:"iom"`
25: 	IOMSlots   int               `json:"iom_slots"`
26: 	MDA        []*string         `json:"mda"`
27: 	FixedMDAs  map[string]string `json:"fixed_mdas"`
28: 	SFM        []string          `json:"sfm"`
29: 	XIOM       []string          `json:"xiom"`
30: 	FixedHWCfg string            `json:"fixed_hw_cfg"`
31: 	Integrated bool              `json:"integrated"`
32: 	Redundant  bool              `json:"redundant"`
33: }
34: 
35: type chassisInfo map[string]chassisInfoEntry
36: 
37: func parseChassisInfo(content []byte) (chassisInfo, error) {
38: 	var info chassisInfo
39: 	if err := json.Unmarshal(content, &info); err != nil {
40: 		return nil, fmt.Errorf("parse chassis_info.json: %w", err)
41: 	}
42: 	return info, nil
43: }
44: 
45: func (i chassisInfo) entry(nodeType string) (chassisInfoEntry, bool) {
46: 	key := ""
47: 	for candidate := range i {
48: 		if strings.EqualFold(candidate, strings.TrimSpace(nodeType)) {
49: 			key = candidate
50: 			break
51: 		}
52: 	}
53: 	if key == "" {
54: 		return chassisInfoEntry{}, false
55: 	}
56: 
57: 	seen := map[string]struct{}{}
58: 	for {
59: 		if _, ok := seen[key]; ok {
60: 			return chassisInfoEntry{}, false
61: 		}
62: 		seen[key] = struct{}{}
63: 
64: 		entry := i[key]
65: 		if entry.Alias == "" {
66: 			return entry, true
67: 		}
68: 
69: 		key = ""
70: 		for candidate := range i {
71: 			if strings.EqualFold(candidate, entry.Alias) {
72: 				key = candidate
73: 				break
74: 			}
75: 		}
76: 		if key == "" {
77: 			return chassisInfoEntry{}, false
78: 		}
79: 	}
80: }
81: 
82: // componentWarnings returns best-effort validation warnings. It deliberately skips checks
83: // that chassis_info.json cannot express, such as which MDA types belong under a specific XIOM.
84: func (i chassisInfo) componentWarnings(nodeType, sfm string, components []*Component) []string {
85: 	entry, ok := i.entry(nodeType)
86: 	if !ok {
87: 		return []string{
88: 			fmt.Sprintf(
89: 				"chassis type %q is not present in chassis_info.json; component compatibility was not checked",
90: 				nodeType,
91: 			),
92: 		}
93: 	}
94: 
95: 	var warnings []string
96: 	if sfm != "" && len(entry.SFM) > 0 && !slices.Contains(entry.SFM, sfm) {
97: 		warnings = append(warnings, fmt.Sprintf(
98: 			"SFM type %q is not listed for chassis type %q",
99: 			sfm,
100: 			nodeType,
101: 		))
102: 	}
103: 
104: 	for _, component := range components {
105: 		if component == nil {
106: 			continue
107: 		}
108: 		slot := strings.ToUpper(strings.TrimSpace(component.Slot))
109: 		if slot == "" {
110: 			slot = slotAName
111: 		}
112: 
113: 		switch {
114: 		case slot == slotAName || slot == slotBName:
115: 			if slot == slotBName && !entry.Redundant {
116: 				warnings = append(warnings, fmt.Sprintf(
117: 					"component slot %s is not listed as supported for chassis type %q",
118: 					slot,
119: 					nodeType,
120: 				))
121: 			}
122: 			if component.Type != "" &&
123: 				entry.FixedHWCfg != "" &&
124: 				component.Type != entry.FixedHWCfg {
125: 				warnings = append(warnings, fmt.Sprintf(
126: 					"component type %q in slot %s does not match fixed hardware %q for chassis type %q",
127: 					component.Type,
128: 					slot,
129: 					entry.FixedHWCfg,
130: 					nodeType,
131: 				))
132: 			} else if component.Type != "" &&
133: 				entry.FixedHWCfg == "" &&
134: 				len(entry.CPM) > 0 &&
135: 				!slices.Contains(entry.CPM, component.Type) {
136: 				warnings = append(warnings, fmt.Sprintf(
137: 					"component type %q in slot %s is not listed for chassis type %q",
138: 					component.Type,
139: 					slot,
140: 					nodeType,
141: 				))
142: 			}
143: 		default:
144: 			numericSlot, err := strconv.Atoi(slot)
145: 			if err == nil {
146: 				if entry.IOMSlots > 0 && numericSlot > entry.IOMSlots {
147: 					warnings = append(warnings, fmt.Sprintf(
148: 						"component slot %s exceeds the %d IOM slots listed for chassis type %q",
149: 						slot,
150: 						entry.IOMSlots,
151: 						nodeType,
152: 					))
153: 				}
154: 				if component.Type != "" &&
155: 					len(entry.IOM) > 0 &&
156: 					!slices.Contains(entry.IOM, component.Type) {
157: 					warnings = append(warnings, fmt.Sprintf(
158: 						"component type %q in slot %s is not listed for chassis type %q",
159: 						component.Type,
160: 						slot,
161: 						nodeType,
162: 					))
163: 				}
164: 			}
165: 		}
166: 
167: 		for _, xiom := range component.XIOM {
168: 			if xiom.Type != "" &&
169: 				len(entry.XIOM) > 0 &&
170: 				!slices.Contains(entry.XIOM, xiom.Type) {
171: 				warnings = append(warnings, fmt.Sprintf(
172: 					"XIOM type %q in component slot %s is not listed for chassis type %q",
173: 					xiom.Type,
174: 					slot,
175: 					nodeType,
176: 				))
177: 			}
178: 		}
179: 
180: 		if entry.Integrated || (slot != slotAName && slot != slotBName) {
181: 			warnings = append(warnings, validateMDAs(nodeType, entry, component.MDA)...)
182: 		}
183: 	}
184: 
185: 	return warnings
186: }
187: 
188: func validateMDAs(nodeType string, entry chassisInfoEntry, mdas MDAS) []string {
189: 	var warnings []string
190: 	for _, mda := range mdas {
191: 		if fixed, exists := entry.FixedMDAs[strconv.Itoa(mda.Slot)]; exists {
192: 			if mda.Type != fixed {
193: 				warnings = append(warnings, fmt.Sprintf(
194: 					"MDA type %q in slot %d does not match fixed MDA %q for chassis type %q",
195: 					mda.Type,
196: 					mda.Slot,
197: 					fixed,
198: 					nodeType,
199: 				))
200: 			}
201: 			continue
202: 		}
203: 		if mda.Type != "" && !containsChassisType(entry.MDA, mda.Type) {
204: 			warnings = append(warnings, fmt.Sprintf(
205: 				"MDA type %q in slot %d is not listed for chassis type %q",
206: 				mda.Type,
207: 				mda.Slot,
208: 				nodeType,
209: 			))
210: 		}
211: 	}
212: 	return warnings
213: }
214: 
215: func containsChassisType(types []*string, value string) bool {
216: 	for _, typ := range types {
217: 		if typ != nil && *typ == value {
218: 			return true
219: 		}
220: 	}
221: 	return false
222: }

(End of file - total 222 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502df9c4001FLDF4klF0GI7lz",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502dbe9f001ek5Hgev3SCmtk8",
  "callID": "call_a8933784e2484c4680b5de1d",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/chassis_info.go"
    },
    "output": "<path>/source/head/nodes/sros/chassis_info.go</path>\n<type>file</type>\n<content>\n1: // Copyright 2025 Nokia\n2: // Licensed under the BSD 3-Clause License.\n3: // SPDX-License-Identifier: BSD-3-Clause\n4: \n5: package sros\n6: \n7: import (\n8: \t\"encoding/json\"\n9: \t\"fmt\"\n10: \t\"slices\"\n11: \t\"strconv\"\n12: \t\"strings\"\n13: )\n14: \n15: // DefaultChassisInfoPath is the path to chassis_info.json inside SROS/SR SIM container images.\n16: const DefaultChassisInfoPath = \"/opt/nokia/chassis_info.json\"\n17: \n18: // chassisInfoFileLicense is prepended to the chassis_info.json file written to LabDir.\n19: const chassisInfoFileLicense = \"// Copyright 2026 Nokia\\n// Licensed under the BSD 3-Clause License.\\n// SPDX-License-Identifier: BSD-3-Clause\\n\\n\"\n20: \n21: type chassisInfoEntry struct {\n22: \tAlias      string            `json:\"alias\"`\n23: \tCPM        []string          `json:\"cpm\"`\n24: \tIOM        []string          `json:\"iom\"`\n25: \tIOMSlots   int               `json:\"iom_slots\"`\n26: \tMDA        []*string         `json:\"mda\"`\n27: \tFixedMDAs  map[string]string `json:\"fixed_mdas\"`\n28: \tSFM        []string          `json:\"sfm\"`\n29: \tXIOM       []string          `json:\"xiom\"`\n30: \tFixedHWCfg string            `json:\"fixed_hw_cfg\"`\n31: \tIntegrated bool              `json:\"integrated\"`\n32: \tRedundant  bool              `json:\"redundant\"`\n33: }\n34: \n35: type chassisInfo map[string]chassisInfoEntry\n36: \n37: func parseChassisInfo(content []byte) (chassisInfo, error) {\n38: \tvar info chassisInfo\n39: \tif err := json.Unmarshal(content, &info); err != nil {\n40: \t\treturn nil, fmt.Errorf(\"parse chassis_info.json: %w\", err)\n41: \t}\n42: \treturn info, nil\n43: }\n44: \n45: func (i chassisInfo) entry(nodeType string) (chassisInfoEntry, bool) {\n46: \tkey := \"\"\n47: \tfor candidate := range i {\n48: \t\tif strings.EqualFold(candidate, strings.TrimSpace(nodeType)) {\n49: \t\t\tkey = candidate\n50: \t\t\tbreak\n51: \t\t}\n52: \t}\n53: \tif key == \"\" {\n54: \t\treturn chassisInfoEntry{}, false\n55: \t}\n56: \n57: \tseen := map[string]struct{}{}\n58: \tfor {\n59: \t\tif _, ok := seen[key]; ok {\n60: \t\t\treturn chassisInfoEntry{}, false\n61: \t\t}\n62: \t\tseen[key] = struct{}{}\n63: \n64: \t\tentry := i[key]\n65: \t\tif entry.Alias == \"\" {\n66: \t\t\treturn entry, true\n67: \t\t}\n68: \n69: \t\tkey = \"\"\n70: \t\tfor candidate := range i {\n71: \t\t\tif strings.EqualFold(candidate, entry.Alias) {\n72: \t\t\t\tkey = candidate\n73: \t\t\t\tbreak\n74: \t\t\t}\n75: \t\t}\n76: \t\tif key == \"\" {\n77: \t\t\treturn chassisInfoEntry{}, false\n78: \t\t}\n79: \t}\n80: }\n81: \n82: // componentWarnings returns best-effort validation warnings. It deliberately skips checks\n83: // that chassis_info.json cannot express, such as which MDA types belong under a specific XIOM.\n84: func (i chassisInfo) componentWarnings(nodeType, sfm string, components []*Component) []string {\n85: \tentry, ok := i.entry(nodeType)\n86: \tif !ok {\n87: \t\treturn []string{\n88: \t\t\tfmt.Sprintf(\n89: \t\t\t\t\"chassis type %q is not present in chassis_info.json; component compatibility was not checked\",\n90: \t\t\t\tnodeType,\n91: \t\t\t),\n92: \t\t}\n93: \t}\n94: \n95: \tvar warnings []string\n96: \tif sfm != \"\" && len(entry.SFM) > 0 && !slices.Contains(entry.SFM, sfm) {\n97: \t\twarnings = append(warnings, fmt.Sprintf(\n98: \t\t\t\"SFM type %q is not listed for chassis type %q\",\n99: \t\t\tsfm,\n100: \t\t\tnodeType,\n101: \t\t))\n102: \t}\n103: \n104: \tfor _, component := range components {\n105: \t\tif component == nil {\n106: \t\t\tcontinue\n107: \t\t}\n108: \t\tslot := strings.ToUpper(strings.TrimSpace(component.Slot))\n109: \t\tif slot == \"\" {\n110: \t\t\tslot = slotAName\n111: \t\t}\n112: \n113: \t\tswitch {\n114: \t\tcase slot == slotAName || slot == slotBName:\n115: \t\t\tif slot == slotBName && !entry.Redundant {\n116: \t\t\t\twarnings = append(warnings, fmt.Sprintf(\n117: \t\t\t\t\t\"component slot %s is not listed as supported for chassis type %q\",\n118: \t\t\t\t\tslot,\n119: \t\t\t\t\tnodeType,\n120: \t\t\t\t))\n121: \t\t\t}\n122: \t\t\tif component.Type != \"\" &&\n123: \t\t\t\tentry.FixedHWCfg != \"\" &&\n124: \t\t\t\tcomponent.Type != entry.FixedHWCfg {\n125: \t\t\t\twarnings = append(warnings, fmt.Sprintf(\n126: \t\t\t\t\t\"component type %q in slot %s does not match fixed hardware %q for chassis type %q\",\n127: \t\t\t\t\tcomponent.Type,\n128: \t\t\t\t\tslot,\n129: \t\t\t\t\tentry.FixedHWCfg,\n130: \t\t\t\t\tnodeType,\n131: \t\t\t\t))\n132: \t\t\t} else if component.Type != \"\" &&\n133: \t\t\t\tentry.FixedHWCfg == \"\" &&\n134: \t\t\t\tlen(entry.CPM) > 0 &&\n135: \t\t\t\t!slices.Contains(entry.CPM, component.Type) {\n136: \t\t\t\twarnings = append(warnings, fmt.Sprintf(\n137: \t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n138: \t\t\t\t\tcomponent.Type,\n139: \t\t\t\t\tslot,\n140: \t\t\t\t\tnodeType,\n141: \t\t\t\t))\n142: \t\t\t}\n143: \t\tdefault:\n144: \t\t\tnumericSlot, err := strconv.Atoi(slot)\n145: \t\t\tif err == nil {\n146: \t\t\t\tif entry.IOMSlots > 0 && numericSlot > entry.IOMSlots {\n147: \t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n148: \t\t\t\t\t\t\"component slot %s exceeds the %d IOM slots listed for chassis type %q\",\n149: \t\t\t\t\t\tslot,\n150: \t\t\t\t\t\tentry.IOMSlots,\n151: \t\t\t\t\t\tnodeType,\n152: \t\t\t\t\t))\n153: \t\t\t\t}\n154: \t\t\t\tif component.Type != \"\" &&\n155: \t\t\t\t\tlen(entry.IOM) > 0 &&\n156: \t\t\t\t\t!slices.Contains(entry.IOM, component.Type) {\n157: \t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n158: \t\t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n159: \t\t\t\t\t\tcomponent.Type,\n160: \t\t\t\t\t\tslot,\n161: \t\t\t\t\t\tnodeType,\n162: \t\t\t\t\t))\n163: \t\t\t\t}\n164: \t\t\t}\n165: \t\t}\n166: \n167: \t\tfor _, xiom := range component.XIOM {\n168: \t\t\tif xiom.Type != \"\" &&\n169: \t\t\t\tlen(entry.XIOM) > 0 &&\n170: \t\t\t\t!slices.Contains(entry.XIOM, xiom.Type) {\n171: \t\t\t\twarnings = append(warnings, fmt.Sprintf(\n172: \t\t\t\t\t\"XIOM type %q in component slot %s is not listed for chassis type %q\",\n173: \t\t\t\t\txiom.Type,\n174: \t\t\t\t\tslot,\n175: \t\t\t\t\tnodeType,\n176: \t\t\t\t))\n177: \t\t\t}\n178: \t\t}\n179: \n180: \t\tif entry.Integrated || (slot != slotAName && slot != slotBName) {\n181: \t\t\twarnings = append(warnings, validateMDAs(nodeType, entry, component.MDA)...)\n182: \t\t}\n183: \t}\n184: \n185: \treturn warnings\n186: }\n187: \n188: func validateMDAs(nodeType string, entry chassisInfoEntry, mdas MDAS) []string {\n189: \tvar warnings []string\n190: \tfor _, mda := range mdas {\n191: \t\tif fixed, exists := entry.FixedMDAs[strconv.Itoa(mda.Slot)]; exists {\n192: \t\t\tif mda.Type != fixed {\n193: \t\t\t\twarnings = append(warnings, fmt.Sprintf(\n194: \t\t\t\t\t\"MDA type %q in slot %d does not match fixed MDA %q for chassis type %q\",\n195: \t\t\t\t\tmda.Type,\n196: \t\t\t\t\tmda.Slot,\n197: \t\t\t\t\tfixed,\n198: \t\t\t\t\tnodeType,\n199: \t\t\t\t))\n200: \t\t\t}\n201: \t\t\tcontinue\n202: \t\t}\n203: \t\tif mda.Type != \"\" && !containsChassisType(entry.MDA, mda.Type) {\n204: \t\t\twarnings = append(warnings, fmt.Sprintf(\n205: \t\t\t\t\"MDA type %q in slot %d is not listed for chassis type %q\",\n206: \t\t\t\tmda.Type,\n207: \t\t\t\tmda.Slot,\n208: \t\t\t\tnodeType,\n209: \t\t\t))\n210: \t\t}\n211: \t}\n212: \treturn warnings\n213: }\n214: \n215: func containsChassisType(types []*string, value string) bool {\n216: \tfor _, typ := range types {\n217: \t\tif typ != nil && *typ == value {\n218: \t\t\treturn true\n219: \t\t}\n220: \t}\n221: \treturn false\n222: }\n\n(End of file - total 222 lines)\n</content>",
    "title": "source/head/nodes/sros/chassis_info.go",
    "metadata": {
      "preview": "// Copyright 2025 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\npackage sros\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"slices\"\n\t\"strconv\"\n\t\"strings\"\n)\n\n// DefaultChassisInfoPath is the path to chassis_info.json inside SROS/SR SIM container images.\nconst DefaultChassisInfoPath = \"/opt/nokia/chassis_info.json\"\n\n// chassisInfoFileLicense is prepended to the chassis_info.json file written to LabDir.\nconst chassisInfoFileLicense = \"// Copyright 2026 Nokia\\n// Licensed under the BSD 3-Clause License.\\n// SPDX-License-Identifier: BSD-3-Clause\\n\\n\"\n",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/chassis_info.go",
        "text": "// Copyright 2025 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\npackage sros\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"slices\"\n\t\"strconv\"\n\t\"strings\"\n)\n\n// DefaultChassisInfoPath is the path to chassis_info.json inside SROS/SR SIM container images.\nconst DefaultChassisInfoPath = \"/opt/nokia/chassis_info.json\"\n\n// chassisInfoFileLicense is prepended to the chassis_info.json file written to LabDir.\nconst chassisInfoFileLicense = \"// Copyright 2026 Nokia\\n// Licensed under the BSD 3-Clause License.\\n// SPDX-License-Identifier: BSD-3-Clause\\n\\n\"\n\ntype chassisInfoEntry struct {\n\tAlias      string            `json:\"alias\"`\n\tCPM        []string          `json:\"cpm\"`\n\tIOM        []string          `json:\"iom\"`\n\tIOMSlots   int               `json:\"iom_slots\"`\n\tMDA        []*string         `json:\"mda\"`\n\tFixedMDAs  map[string]string `json:\"fixed_mdas\"`\n\tSFM        []string          `json:\"sfm\"`\n\tXIOM       []string          `json:\"xiom\"`\n\tFixedHWCfg string            `json:\"fixed_hw_cfg\"`\n\tIntegrated bool              `json:\"integrated\"`\n\tRedundant  bool              `json:\"redundant\"`\n}\n\ntype chassisInfo map[string]chassisInfoEntry\n\nfunc parseChassisInfo(content []byte) (chassisInfo, error) {\n\tvar info chassisInfo\n\tif err := json.Unmarshal(content, &info); err != nil {\n\t\treturn nil, fmt.Errorf(\"parse chassis_info.json: %w\", err)\n\t}\n\treturn info, nil\n}\n\nfunc (i chassisInfo) entry(nodeType string) (chassisInfoEntry, bool) {\n\tkey := \"\"\n\tfor candidate := range i {\n\t\tif strings.EqualFold(candidate, strings.TrimSpace(nodeType)) {\n\t\t\tkey = candidate\n\t\t\tbreak\n\t\t}\n\t}\n\tif key == \"\" {\n\t\treturn chassisInfoEntry{}, false\n\t}\n\n\tseen := map[string]struct{}{}\n\tfor {\n\t\tif _, ok := seen[key]; ok {\n\t\t\treturn chassisInfoEntry{}, false\n\t\t}\n\t\tseen[key] = struct{}{}\n\n\t\tentry := i[key]\n\t\tif entry.Alias == \"\" {\n\t\t\treturn entry, true\n\t\t}\n\n\t\tkey = \"\"\n\t\tfor candidate := range i {\n\t\t\tif strings.EqualFold(candidate, entry.Alias) {\n\t\t\t\tkey = candidate\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif key == \"\" {\n\t\t\treturn chassisInfoEntry{}, false\n\t\t}\n\t}\n}\n\n// componentWarnings returns best-effort validation warnings. It deliberately skips checks\n// that chassis_info.json cannot express, such as which MDA types belong under a specific XIOM.\nfunc (i chassisInfo) componentWarnings(nodeType, sfm string, components []*Component) []string {\n\tentry, ok := i.entry(nodeType)\n\tif !ok {\n\t\treturn []string{\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"chassis type %q is not present in chassis_info.json; component compatibility was not checked\",\n\t\t\t\tnodeType,\n\t\t\t),\n\t\t}\n\t}\n\n\tvar warnings []string\n\tif sfm != \"\" && len(entry.SFM) > 0 && !slices.Contains(entry.SFM, sfm) {\n\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\"SFM type %q is not listed for chassis type %q\",\n\t\t\tsfm,\n\t\t\tnodeType,\n\t\t))\n\t}\n\n\tfor _, component := range components {\n\t\tif component == nil {\n\t\t\tcontinue\n\t\t}\n\t\tslot := strings.ToUpper(strings.TrimSpace(component.Slot))\n\t\tif slot == \"\" {\n\t\t\tslot = slotAName\n\t\t}\n\n\t\tswitch {\n\t\tcase slot == slotAName || slot == slotBName:\n\t\t\tif slot == slotBName && !entry.Redundant {\n\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\"component slot %s is not listed as supported for chassis type %q\",\n\t\t\t\t\tslot,\n\t\t\t\t\tnodeType,\n\t\t\t\t))\n\t\t\t}\n\t\t\tif component.Type != \"\" &&\n\t\t\t\tentry.FixedHWCfg != \"\" &&\n\t\t\t\tcomponent.Type != entry.FixedHWCfg {\n\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\"component type %q in slot %s does not match fixed hardware %q for chassis type %q\",\n\t\t\t\t\tcomponent.Type,\n\t\t\t\t\tslot,\n\t\t\t\t\tentry.FixedHWCfg,\n\t\t\t\t\tnodeType,\n\t\t\t\t))\n\t\t\t} else if component.Type != \"\" &&\n\t\t\t\tentry.FixedHWCfg == \"\" &&\n\t\t\t\tlen(entry.CPM) > 0 &&\n\t\t\t\t!slices.Contains(entry.CPM, component.Type) {\n\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n\t\t\t\t\tcomponent.Type,\n\t\t\t\t\tslot,\n\t\t\t\t\tnodeType,\n\t\t\t\t))\n\t\t\t}\n\t\tdefault:\n\t\t\tnumericSlot, err := strconv.Atoi(slot)\n\t\t\tif err == nil {\n\t\t\t\tif entry.IOMSlots > 0 && numericSlot > entry.IOMSlots {\n\t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\t\"component slot %s exceeds the %d IOM slots listed for chassis type %q\",\n\t\t\t\t\t\tslot,\n\t\t\t\t\t\tentry.IOMSlots,\n\t\t\t\t\t\tnodeType,\n\t\t\t\t\t))\n\t\t\t\t}\n\t\t\t\tif component.Type != \"\" &&\n\t\t\t\t\tlen(entry.IOM) > 0 &&\n\t\t\t\t\t!slices.Contains(entry.IOM, component.Type) {\n\t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n\t\t\t\t\t\tcomponent.Type,\n\t\t\t\t\t\tslot,\n\t\t\t\t\t\tnodeType,\n\t\t\t\t\t))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor _, xiom := range component.XIOM {\n\t\t\tif xiom.Type != \"\" &&\n\t\t\t\tlen(entry.XIOM) > 0 &&\n\t\t\t\t!slices.Contains(entry.XIOM, xiom.Type) {\n\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\"XIOM type %q in component slot %s is not listed for chassis type %q\",\n\t\t\t\t\txiom.Type,\n\t\t\t\t\tslot,\n\t\t\t\t\tnodeType,\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\n\t\tif entry.Integrated || (slot != slotAName && slot != slotBName) {\n\t\t\twarnings = append(warnings, validateMDAs(nodeType, entry, component.MDA)...)\n\t\t}\n\t}\n\n\treturn warnings\n}\n\nfunc validateMDAs(nodeType string, entry chassisInfoEntry, mdas MDAS) []string {\n\tvar warnings []string\n\tfor _, mda := range mdas {\n\t\tif fixed, exists := entry.FixedMDAs[strconv.Itoa(mda.Slot)]; exists {\n\t\t\tif mda.Type != fixed {\n\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\"MDA type %q in slot %d does not match fixed MDA %q for chassis type %q\",\n\t\t\t\t\tmda.Type,\n\t\t\t\t\tmda.Slot,\n\t\t\t\t\tfixed,\n\t\t\t\t\tnodeType,\n\t\t\t\t))\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif mda.Type != \"\" && !containsChassisType(entry.MDA, mda.Type) {\n\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\"MDA type %q in slot %d is not listed for chassis type %q\",\n\t\t\t\tmda.Type,\n\t\t\t\tmda.Slot,\n\t\t\t\tnodeType,\n\t\t\t))\n\t\t}\n\t}\n\treturn warnings\n}\n\nfunc containsChassisType(types []*string, value string) bool {\n\tfor _, typ := range types {\n\t\tif typ != nil && *typ == value {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}",
        "lineStart": 1,
        "lineEnd": 222,
        "totalLines": 222,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346552777,
      "end": 1792346552789
    }
  }
}
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/component.go"
}

Output

<path>/source/head/nodes/sros/component.go</path>
<type>file</type>
<content>
1: package sros
2: 
3: import (
4: 	"fmt"
5: 	"maps"
6: 	"slices"
7: 	"strconv"
8: 	"strings"
9: 
10: 	"github.com/charmbracelet/log"
11: )
12: 
13: // Component is an SR-SIM card: a CPM (slot A or B) or a line card.
14: type Component struct {
15: 	Slot string            `yaml:"slot,omitempty" json:"slot,omitempty"`
16: 	Type string            `yaml:"type,omitempty" json:"type,omitempty"`
17: 	Env  map[string]string `yaml:"env,omitempty" json:"env,omitempty"`
18: 	XIOM XIOMS             `yaml:"xiom,omitempty" json:"xiom,omitempty"`
19: 	MDA  MDAS              `yaml:"mda,omitempty" json:"mda,omitempty"`
20: }
21: 
22: func componentsBySlot(components []*Component) map[string]Component {
23: 	m := make(map[string]Component, len(components))
24: 
25: 	for i, c := range components {
26: 		if c == nil {
27: 			continue
28: 		}
29: 
30: 		norm := *c
31: 		norm.Slot = strings.ToUpper(strings.TrimSpace(c.Slot))
32: 
33: 		key := norm.Slot
34: 		if key == "" {
35: 			key = fmt.Sprintf("#%d", i)
36: 		}
37: 
38: 		m[key] = norm
39: 	}
40: 
41: 	return m
42: }
43: 
44: type XIOM struct {
45: 	Slot int    `yaml:"slot,omitempty" json:"slot,omitempty"`
46: 	Type string `yaml:"type,omitempty" json:"type,omitempty"`
47: 	MDA  MDAS   `yaml:"mda,omitempty" json:"mda,omitempty"`
48: }
49: 
50: type XIOMS []XIOM
51: 
52: type MDA struct {
53: 	Slot int    `yaml:"slot,omitempty" json:"slot,omitempty"`
54: 	Type string `yaml:"type,omitempty" json:"type,omitempty"`
55: }
56: 
57: type MDAS []MDA
58: 
59: func (l *MDAS) UnmarshalYAML(unmarshal func(any) error) error {
60: 	var entries []MDA
61: 	if err := unmarshal(&entries); err != nil {
62: 		return err
63: 	}
64: 
65: 	if len(entries) == 0 {
66: 		*l = nil
67: 		return nil
68: 	}
69: 
70: 	slots := map[int]struct{}{}
71: 
72: 	for _, e := range entries {
73: 		if e.Type == "" || e.Slot <= 0 {
74: 			return fmt.Errorf(
75: 				"invalid mda entry. slot and type are required, got slot %d, type %q",
76: 				e.Slot,
77: 				e.Type,
78: 			)
79: 		}
80: 
81: 		if _, exists := slots[e.Slot]; exists {
82: 			return fmt.Errorf("invalid mda entry. duplicate slot %d", e.Slot)
83: 		}
84: 
85: 		slots[e.Slot] = struct{}{}
86: 	}
87: 
88: 	*l = MDAS(entries)
89: 
90: 	return nil
91: }
92: 
93: func (l *XIOMS) UnmarshalYAML(unmarshal func(any) error) error {
94: 	var entries []XIOM
95: 
96: 	if err := unmarshal(&entries); err != nil {
97: 		return err
98: 	}
99: 
100: 	if len(entries) == 0 {
101: 		*l = nil
102: 		return nil
103: 	}
104: 
105: 	slots := map[int]struct{}{}
106: 
107: 	for _, e := range entries {
108: 		if e.Type == "" || e.Slot <= 0 {
109: 			return fmt.Errorf(
110: 				"invalid xiom entry. slot and type are required, got slot %d, type %q",
111: 				e.Slot,
112: 				e.Type,
113: 			)
114: 		}
115: 
116: 		if _, exists := slots[e.Slot]; exists {
117: 			return fmt.Errorf("invalid xiom entry. duplicate slot %d", e.Slot)
118: 		}
119: 
120: 		slots[e.Slot] = struct{}{}
121: 	}
122: 
123: 	*l = XIOMS(entries)
124: 
125: 	return nil
126: }
127: 
128: func setComponentEnvVars(env map[string]string, c *Component) {
129: 	if c.Type != "" {
130: 		env[envNokiaSrosCard] = c.Type
131: 	}
132: 
133: 	for _, x := range c.XIOM {
134: 		key := fmt.Sprintf("%s_X%d", envNokiaSrosXIOM, x.Slot)
135: 		env[key] = x.Type
136: 		// add the nested MDA
137: 		for _, m := range x.MDA {
138: 			key := fmt.Sprintf("%s_X%d_%d", envNokiaSrosMDA, x.Slot, m.Slot)
139: 			env[key] = m.Type
140: 		}
141: 	}
142: 
143: 	for _, m := range c.MDA {
144: 		key := fmt.Sprintf("%s_%d", envNokiaSrosMDA, m.Slot)
145: 		env[key] = m.Type
146: 	}
147: }
148: 
149: func (n *sros) checkComponentSlotsConfig() error {
150: 	// check Slots are unique
151: 	componentNames := map[string]struct{}{}
152: 	for _, component := range n.kindSpecificCfg().Components {
153: 		// convert slot to upper
154: 		slot := strings.ToUpper(component.Slot)
155: 		// check if slot exists
156: 		_, exists := componentNames[slot]
157: 		if exists {
158: 			return fmt.Errorf(
159: 				"node %s slot %s duplicate definition",
160: 				n.GetShortName(),
161: 				component.Slot,
162: 			)
163: 		}
164: 		// add to component names map
165: 		componentNames[slot] = struct{}{}
166: 
167: 	}
168: 	return nil
169: }
170: 
171: // componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,
172: // and per-component env. Per-component env overrides the typed fields.
173: func componentDerivedEnv(c *Component) map[string]string {
174: 	derived := map[string]string{}
175: 	if c == nil {
176: 		return derived
177: 	}
178: 	setComponentEnvVars(derived, c)
179: 	maps.Copy(derived, c.Env)
180: 	return derived
181: }
182: 
183: // warnUserEnvOverrides logs when a node env var replaces a component-derived value.
184: func warnUserEnvOverrides(node string, derived, userEnv map[string]string) {
185: 	for key, componentValue := range derived {
186: 		envValue, userSet := userEnv[key]
187: 		if !userSet || componentValue == envValue {
188: 			continue
189: 		}
190: 		log.Warn(
191: 			fmt.Sprintf(
192: 				"component value %q will not be used because environment variable %s is set",
193: 				componentValue,
194: 				key,
195: 			),
196: 			"node", node,
197: 			"env", key,
198: 			"component-value", componentValue,
199: 			"env-value", envValue,
200: 		)
201: 	}
202: }
203: 
204: // keepUserEnv copies component-derived keys into dst unless the user already set that key.
205: // A user value wins, and a differing component value is logged.
206: func keepUserEnv(node string, dst, derived, userEnv map[string]string) {
207: 	warnUserEnvOverrides(node, derived, userEnv)
208: 	for key, componentValue := range derived {
209: 		if envValue, userSet := userEnv[key]; userSet {
210: 			dst[key] = envValue
211: 			continue
212: 		}
213: 		dst[key] = componentValue
214: 	}
215: }
216: 
217: // cloneComponent returns a deep copy of c suitable for env overrides during config generation.
218: func cloneComponent(c *Component) *Component {
219: 	if c == nil {
220: 		return &Component{}
221: 	}
222: 	out := *c
223: 	out.Env = maps.Clone(c.Env)
224: 	out.MDA = slices.Clone(c.MDA)
225: 	if len(c.XIOM) > 0 {
226: 		out.XIOM = make(XIOMS, len(c.XIOM))
227: 		for i, xiom := range c.XIOM {
228: 			xiom.MDA = slices.Clone(xiom.MDA)
229: 			out.XIOM[i] = xiom
230: 		}
231: 	}
232: 	return &out
233: }
234: 
235: // applyHardwareEnv overlays SR-SIM card, XIOM, and MDA environment variables onto c.
236: // NOKIA_SROS_SLOT is left unchanged; it identifies the container rather than provisioned hardware.
237: func applyHardwareEnv(c *Component, env map[string]string) {
238: 	if c == nil || len(env) == 0 {
239: 		return
240: 	}
241: 	if card := env[envNokiaSrosCard]; card != "" {
242: 		c.Type = card
243: 	}
244: 	for key, val := range env {
245: 		if val == "" {
246: 			continue
247: 		}
248: 		switch {
249: 		case strings.HasPrefix(key, envNokiaSrosMDA+"_X"):
250: 			rest := strings.TrimPrefix(key, envNokiaSrosMDA+"_X")
251: 			xiomStr, mdaStr, ok := strings.Cut(rest, "_")
252: 			if !ok {
253: 				continue
254: 			}
255: 			xiomSlot, errX := strconv.Atoi(xiomStr)
256: 			mdaSlot, errM := strconv.Atoi(mdaStr)
257: 			if errX != nil || errM != nil || xiomSlot <= 0 || mdaSlot <= 0 {
258: 				continue
259: 			}
260: 			upsertXiomMDA(c, xiomSlot, mdaSlot, val)
261: 		case strings.HasPrefix(key, envNokiaSrosMDA+"_"):
262: 			slot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosMDA+"_"))
263: 			if err != nil || slot <= 0 {
264: 				continue
265: 			}
266: 			c.MDA = upsertMDA(c.MDA, slot, val)
267: 		case strings.HasPrefix(key, envNokiaSrosXIOM+"_X"):
268: 			slot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosXIOM+"_X"))
269: 			if err != nil || slot <= 0 {
270: 				continue
271: 			}
272: 			upsertXiomType(c, slot, val)
273: 		}
274: 	}
275: }
276: 
277: func upsertMDA(mdas MDAS, slot int, typ string) MDAS {
278: 	for i := range mdas {
279: 		if mdas[i].Slot == slot {
280: 			mdas[i].Type = typ
281: 			return mdas
282: 		}
283: 	}
284: 	return append(mdas, MDA{Slot: slot, Type: typ})
285: }
286: 
287: func upsertXiomType(c *Component, slot int, typ string) {
288: 	for i := range c.XIOM {
289: 		if c.XIOM[i].Slot == slot {
290: 			c.XIOM[i].Type = typ
291: 			return
292: 		}
293: 	}
294: 	c.XIOM = append(c.XIOM, XIOM{Slot: slot, Type: typ})
295: }
296: 
297: func upsertXiomMDA(c *Component, xiomSlot, mdaSlot int, typ string) {
298: 	for i := range c.XIOM {
299: 		if c.XIOM[i].Slot != xiomSlot {
300: 			continue
301: 		}
302: 		c.XIOM[i].MDA = upsertMDA(c.XIOM[i].MDA, mdaSlot, typ)
303: 		return
304: 	}
305: 	c.XIOM = append(c.XIOM, XIOM{
306: 		Slot: xiomSlot,
307: 		MDA:  MDAS{{Slot: mdaSlot, Type: typ}},
308: 	})
309: }

(End of file - total 309 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502dfa09001CbKdEUY1dF6Ze0",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502dbe9f001ek5Hgev3SCmtk8",
  "callID": "call_cde31834a3cf4ec695ce40a4",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/component.go"
    },
    "output": "<path>/source/head/nodes/sros/component.go</path>\n<type>file</type>\n<content>\n1: package sros\n2: \n3: import (\n4: \t\"fmt\"\n5: \t\"maps\"\n6: \t\"slices\"\n7: \t\"strconv\"\n8: \t\"strings\"\n9: \n10: \t\"github.com/charmbracelet/log\"\n11: )\n12: \n13: // Component is an SR-SIM card: a CPM (slot A or B) or a line card.\n14: type Component struct {\n15: \tSlot string            `yaml:\"slot,omitempty\" json:\"slot,omitempty\"`\n16: \tType string            `yaml:\"type,omitempty\" json:\"type,omitempty\"`\n17: \tEnv  map[string]string `yaml:\"env,omitempty\" json:\"env,omitempty\"`\n18: \tXIOM XIOMS             `yaml:\"xiom,omitempty\" json:\"xiom,omitempty\"`\n19: \tMDA  MDAS              `yaml:\"mda,omitempty\" json:\"mda,omitempty\"`\n20: }\n21: \n22: func componentsBySlot(components []*Component) map[string]Component {\n23: \tm := make(map[string]Component, len(components))\n24: \n25: \tfor i, c := range components {\n26: \t\tif c == nil {\n27: \t\t\tcontinue\n28: \t\t}\n29: \n30: \t\tnorm := *c\n31: \t\tnorm.Slot = strings.ToUpper(strings.TrimSpace(c.Slot))\n32: \n33: \t\tkey := norm.Slot\n34: \t\tif key == \"\" {\n35: \t\t\tkey = fmt.Sprintf(\"#%d\", i)\n36: \t\t}\n37: \n38: \t\tm[key] = norm\n39: \t}\n40: \n41: \treturn m\n42: }\n43: \n44: type XIOM struct {\n45: \tSlot int    `yaml:\"slot,omitempty\" json:\"slot,omitempty\"`\n46: \tType string `yaml:\"type,omitempty\" json:\"type,omitempty\"`\n47: \tMDA  MDAS   `yaml:\"mda,omitempty\" json:\"mda,omitempty\"`\n48: }\n49: \n50: type XIOMS []XIOM\n51: \n52: type MDA struct {\n53: \tSlot int    `yaml:\"slot,omitempty\" json:\"slot,omitempty\"`\n54: \tType string `yaml:\"type,omitempty\" json:\"type,omitempty\"`\n55: }\n56: \n57: type MDAS []MDA\n58: \n59: func (l *MDAS) UnmarshalYAML(unmarshal func(any) error) error {\n60: \tvar entries []MDA\n61: \tif err := unmarshal(&entries); err != nil {\n62: \t\treturn err\n63: \t}\n64: \n65: \tif len(entries) == 0 {\n66: \t\t*l = nil\n67: \t\treturn nil\n68: \t}\n69: \n70: \tslots := map[int]struct{}{}\n71: \n72: \tfor _, e := range entries {\n73: \t\tif e.Type == \"\" || e.Slot <= 0 {\n74: \t\t\treturn fmt.Errorf(\n75: \t\t\t\t\"invalid mda entry. slot and type are required, got slot %d, type %q\",\n76: \t\t\t\te.Slot,\n77: \t\t\t\te.Type,\n78: \t\t\t)\n79: \t\t}\n80: \n81: \t\tif _, exists := slots[e.Slot]; exists {\n82: \t\t\treturn fmt.Errorf(\"invalid mda entry. duplicate slot %d\", e.Slot)\n83: \t\t}\n84: \n85: \t\tslots[e.Slot] = struct{}{}\n86: \t}\n87: \n88: \t*l = MDAS(entries)\n89: \n90: \treturn nil\n91: }\n92: \n93: func (l *XIOMS) UnmarshalYAML(unmarshal func(any) error) error {\n94: \tvar entries []XIOM\n95: \n96: \tif err := unmarshal(&entries); err != nil {\n97: \t\treturn err\n98: \t}\n99: \n100: \tif len(entries) == 0 {\n101: \t\t*l = nil\n102: \t\treturn nil\n103: \t}\n104: \n105: \tslots := map[int]struct{}{}\n106: \n107: \tfor _, e := range entries {\n108: \t\tif e.Type == \"\" || e.Slot <= 0 {\n109: \t\t\treturn fmt.Errorf(\n110: \t\t\t\t\"invalid xiom entry. slot and type are required, got slot %d, type %q\",\n111: \t\t\t\te.Slot,\n112: \t\t\t\te.Type,\n113: \t\t\t)\n114: \t\t}\n115: \n116: \t\tif _, exists := slots[e.Slot]; exists {\n117: \t\t\treturn fmt.Errorf(\"invalid xiom entry. duplicate slot %d\", e.Slot)\n118: \t\t}\n119: \n120: \t\tslots[e.Slot] = struct{}{}\n121: \t}\n122: \n123: \t*l = XIOMS(entries)\n124: \n125: \treturn nil\n126: }\n127: \n128: func setComponentEnvVars(env map[string]string, c *Component) {\n129: \tif c.Type != \"\" {\n130: \t\tenv[envNokiaSrosCard] = c.Type\n131: \t}\n132: \n133: \tfor _, x := range c.XIOM {\n134: \t\tkey := fmt.Sprintf(\"%s_X%d\", envNokiaSrosXIOM, x.Slot)\n135: \t\tenv[key] = x.Type\n136: \t\t// add the nested MDA\n137: \t\tfor _, m := range x.MDA {\n138: \t\t\tkey := fmt.Sprintf(\"%s_X%d_%d\", envNokiaSrosMDA, x.Slot, m.Slot)\n139: \t\t\tenv[key] = m.Type\n140: \t\t}\n141: \t}\n142: \n143: \tfor _, m := range c.MDA {\n144: \t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n145: \t\tenv[key] = m.Type\n146: \t}\n147: }\n148: \n149: func (n *sros) checkComponentSlotsConfig() error {\n150: \t// check Slots are unique\n151: \tcomponentNames := map[string]struct{}{}\n152: \tfor _, component := range n.kindSpecificCfg().Components {\n153: \t\t// convert slot to upper\n154: \t\tslot := strings.ToUpper(component.Slot)\n155: \t\t// check if slot exists\n156: \t\t_, exists := componentNames[slot]\n157: \t\tif exists {\n158: \t\t\treturn fmt.Errorf(\n159: \t\t\t\t\"node %s slot %s duplicate definition\",\n160: \t\t\t\tn.GetShortName(),\n161: \t\t\t\tcomponent.Slot,\n162: \t\t\t)\n163: \t\t}\n164: \t\t// add to component names map\n165: \t\tcomponentNames[slot] = struct{}{}\n166: \n167: \t}\n168: \treturn nil\n169: }\n170: \n171: // componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,\n172: // and per-component env. Per-component env overrides the typed fields.\n173: func componentDerivedEnv(c *Component) map[string]string {\n174: \tderived := map[string]string{}\n175: \tif c == nil {\n176: \t\treturn derived\n177: \t}\n178: \tsetComponentEnvVars(derived, c)\n179: \tmaps.Copy(derived, c.Env)\n180: \treturn derived\n181: }\n182: \n183: // warnUserEnvOverrides logs when a node env var replaces a component-derived value.\n184: func warnUserEnvOverrides(node string, derived, userEnv map[string]string) {\n185: \tfor key, componentValue := range derived {\n186: \t\tenvValue, userSet := userEnv[key]\n187: \t\tif !userSet || componentValue == envValue {\n188: \t\t\tcontinue\n189: \t\t}\n190: \t\tlog.Warn(\n191: \t\t\tfmt.Sprintf(\n192: \t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n193: \t\t\t\tcomponentValue,\n194: \t\t\t\tkey,\n195: \t\t\t),\n196: \t\t\t\"node\", node,\n197: \t\t\t\"env\", key,\n198: \t\t\t\"component-value\", componentValue,\n199: \t\t\t\"env-value\", envValue,\n200: \t\t)\n201: \t}\n202: }\n203: \n204: // keepUserEnv copies component-derived keys into dst unless the user already set that key.\n205: // A user value wins, and a differing component value is logged.\n206: func keepUserEnv(node string, dst, derived, userEnv map[string]string) {\n207: \twarnUserEnvOverrides(node, derived, userEnv)\n208: \tfor key, componentValue := range derived {\n209: \t\tif envValue, userSet := userEnv[key]; userSet {\n210: \t\t\tdst[key] = envValue\n211: \t\t\tcontinue\n212: \t\t}\n213: \t\tdst[key] = componentValue\n214: \t}\n215: }\n216: \n217: // cloneComponent returns a deep copy of c suitable for env overrides during config generation.\n218: func cloneComponent(c *Component) *Component {\n219: \tif c == nil {\n220: \t\treturn &Component{}\n221: \t}\n222: \tout := *c\n223: \tout.Env = maps.Clone(c.Env)\n224: \tout.MDA = slices.Clone(c.MDA)\n225: \tif len(c.XIOM) > 0 {\n226: \t\tout.XIOM = make(XIOMS, len(c.XIOM))\n227: \t\tfor i, xiom := range c.XIOM {\n228: \t\t\txiom.MDA = slices.Clone(xiom.MDA)\n229: \t\t\tout.XIOM[i] = xiom\n230: \t\t}\n231: \t}\n232: \treturn &out\n233: }\n234: \n235: // applyHardwareEnv overlays SR-SIM card, XIOM, and MDA environment variables onto c.\n236: // NOKIA_SROS_SLOT is left unchanged; it identifies the container rather than provisioned hardware.\n237: func applyHardwareEnv(c *Component, env map[string]string) {\n238: \tif c == nil || len(env) == 0 {\n239: \t\treturn\n240: \t}\n241: \tif card := env[envNokiaSrosCard]; card != \"\" {\n242: \t\tc.Type = card\n243: \t}\n244: \tfor key, val := range env {\n245: \t\tif val == \"\" {\n246: \t\t\tcontinue\n247: \t\t}\n248: \t\tswitch {\n249: \t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_X\"):\n250: \t\t\trest := strings.TrimPrefix(key, envNokiaSrosMDA+\"_X\")\n251: \t\t\txiomStr, mdaStr, ok := strings.Cut(rest, \"_\")\n252: \t\t\tif !ok {\n253: \t\t\t\tcontinue\n254: \t\t\t}\n255: \t\t\txiomSlot, errX := strconv.Atoi(xiomStr)\n256: \t\t\tmdaSlot, errM := strconv.Atoi(mdaStr)\n257: \t\t\tif errX != nil || errM != nil || xiomSlot <= 0 || mdaSlot <= 0 {\n258: \t\t\t\tcontinue\n259: \t\t\t}\n260: \t\t\tupsertXiomMDA(c, xiomSlot, mdaSlot, val)\n261: \t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_\"):\n262: \t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosMDA+\"_\"))\n263: \t\t\tif err != nil || slot <= 0 {\n264: \t\t\t\tcontinue\n265: \t\t\t}\n266: \t\t\tc.MDA = upsertMDA(c.MDA, slot, val)\n267: \t\tcase strings.HasPrefix(key, envNokiaSrosXIOM+\"_X\"):\n268: \t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosXIOM+\"_X\"))\n269: \t\t\tif err != nil || slot <= 0 {\n270: \t\t\t\tcontinue\n271: \t\t\t}\n272: \t\t\tupsertXiomType(c, slot, val)\n273: \t\t}\n274: \t}\n275: }\n276: \n277: func upsertMDA(mdas MDAS, slot int, typ string) MDAS {\n278: \tfor i := range mdas {\n279: \t\tif mdas[i].Slot == slot {\n280: \t\t\tmdas[i].Type = typ\n281: \t\t\treturn mdas\n282: \t\t}\n283: \t}\n284: \treturn append(mdas, MDA{Slot: slot, Type: typ})\n285: }\n286: \n287: func upsertXiomType(c *Component, slot int, typ string) {\n288: \tfor i := range c.XIOM {\n289: \t\tif c.XIOM[i].Slot == slot {\n290: \t\t\tc.XIOM[i].Type = typ\n291: \t\t\treturn\n292: \t\t}\n293: \t}\n294: \tc.XIOM = append(c.XIOM, XIOM{Slot: slot, Type: typ})\n295: }\n296: \n297: func upsertXiomMDA(c *Component, xiomSlot, mdaSlot int, typ string) {\n298: \tfor i := range c.XIOM {\n299: \t\tif c.XIOM[i].Slot != xiomSlot {\n300: \t\t\tcontinue\n301: \t\t}\n302: \t\tc.XIOM[i].MDA = upsertMDA(c.XIOM[i].MDA, mdaSlot, typ)\n303: \t\treturn\n304: \t}\n305: \tc.XIOM = append(c.XIOM, XIOM{\n306: \t\tSlot: xiomSlot,\n307: \t\tMDA:  MDAS{{Slot: mdaSlot, Type: typ}},\n308: \t})\n309: }\n\n(End of file - total 309 lines)\n</content>",
    "title": "source/head/nodes/sros/component.go",
    "metadata": {
      "preview": "package sros\n\nimport (\n\t\"fmt\"\n\t\"maps\"\n\t\"slices\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/charmbracelet/log\"\n)\n\n// Component is an SR-SIM card: a CPM (slot A or B) or a line card.\ntype Component struct {\n\tSlot string            `yaml:\"slot,omitempty\" json:\"slot,omitempty\"`\n\tType string            `yaml:\"type,omitempty\" json:\"type,omitempty\"`\n\tEnv  map[string]string `yaml:\"env,omitempty\" json:\"env,omitempty\"`\n\tXIOM XIOMS             `yaml:\"xiom,omitempty\" json:\"xiom,omitempty\"`\n\tMDA  MDAS              `yaml:\"mda,omitempty\" json:\"mda,omitempty\"`\n}",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/component.go",
        "text": "package sros\n\nimport (\n\t\"fmt\"\n\t\"maps\"\n\t\"slices\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/charmbracelet/log\"\n)\n\n// Component is an SR-SIM card: a CPM (slot A or B) or a line card.\ntype Component struct {\n\tSlot string            `yaml:\"slot,omitempty\" json:\"slot,omitempty\"`\n\tType string            `yaml:\"type,omitempty\" json:\"type,omitempty\"`\n\tEnv  map[string]string `yaml:\"env,omitempty\" json:\"env,omitempty\"`\n\tXIOM XIOMS             `yaml:\"xiom,omitempty\" json:\"xiom,omitempty\"`\n\tMDA  MDAS              `yaml:\"mda,omitempty\" json:\"mda,omitempty\"`\n}\n\nfunc componentsBySlot(components []*Component) map[string]Component {\n\tm := make(map[string]Component, len(components))\n\n\tfor i, c := range components {\n\t\tif c == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tnorm := *c\n\t\tnorm.Slot = strings.ToUpper(strings.TrimSpace(c.Slot))\n\n\t\tkey := norm.Slot\n\t\tif key == \"\" {\n\t\t\tkey = fmt.Sprintf(\"#%d\", i)\n\t\t}\n\n\t\tm[key] = norm\n\t}\n\n\treturn m\n}\n\ntype XIOM struct {\n\tSlot int    `yaml:\"slot,omitempty\" json:\"slot,omitempty\"`\n\tType string `yaml:\"type,omitempty\" json:\"type,omitempty\"`\n\tMDA  MDAS   `yaml:\"mda,omitempty\" json:\"mda,omitempty\"`\n}\n\ntype XIOMS []XIOM\n\ntype MDA struct {\n\tSlot int    `yaml:\"slot,omitempty\" json:\"slot,omitempty\"`\n\tType string `yaml:\"type,omitempty\" json:\"type,omitempty\"`\n}\n\ntype MDAS []MDA\n\nfunc (l *MDAS) UnmarshalYAML(unmarshal func(any) error) error {\n\tvar entries []MDA\n\tif err := unmarshal(&entries); err != nil {\n\t\treturn err\n\t}\n\n\tif len(entries) == 0 {\n\t\t*l = nil\n\t\treturn nil\n\t}\n\n\tslots := map[int]struct{}{}\n\n\tfor _, e := range entries {\n\t\tif e.Type == \"\" || e.Slot <= 0 {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"invalid mda entry. slot and type are required, got slot %d, type %q\",\n\t\t\t\te.Slot,\n\t\t\t\te.Type,\n\t\t\t)\n\t\t}\n\n\t\tif _, exists := slots[e.Slot]; exists {\n\t\t\treturn fmt.Errorf(\"invalid mda entry. duplicate slot %d\", e.Slot)\n\t\t}\n\n\t\tslots[e.Slot] = struct{}{}\n\t}\n\n\t*l = MDAS(entries)\n\n\treturn nil\n}\n\nfunc (l *XIOMS) UnmarshalYAML(unmarshal func(any) error) error {\n\tvar entries []XIOM\n\n\tif err := unmarshal(&entries); err != nil {\n\t\treturn err\n\t}\n\n\tif len(entries) == 0 {\n\t\t*l = nil\n\t\treturn nil\n\t}\n\n\tslots := map[int]struct{}{}\n\n\tfor _, e := range entries {\n\t\tif e.Type == \"\" || e.Slot <= 0 {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"invalid xiom entry. slot and type are required, got slot %d, type %q\",\n\t\t\t\te.Slot,\n\t\t\t\te.Type,\n\t\t\t)\n\t\t}\n\n\t\tif _, exists := slots[e.Slot]; exists {\n\t\t\treturn fmt.Errorf(\"invalid xiom entry. duplicate slot %d\", e.Slot)\n\t\t}\n\n\t\tslots[e.Slot] = struct{}{}\n\t}\n\n\t*l = XIOMS(entries)\n\n\treturn nil\n}\n\nfunc setComponentEnvVars(env map[string]string, c *Component) {\n\tif c.Type != \"\" {\n\t\tenv[envNokiaSrosCard] = c.Type\n\t}\n\n\tfor _, x := range c.XIOM {\n\t\tkey := fmt.Sprintf(\"%s_X%d\", envNokiaSrosXIOM, x.Slot)\n\t\tenv[key] = x.Type\n\t\t// add the nested MDA\n\t\tfor _, m := range x.MDA {\n\t\t\tkey := fmt.Sprintf(\"%s_X%d_%d\", envNokiaSrosMDA, x.Slot, m.Slot)\n\t\t\tenv[key] = m.Type\n\t\t}\n\t}\n\n\tfor _, m := range c.MDA {\n\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n\t\tenv[key] = m.Type\n\t}\n}\n\nfunc (n *sros) checkComponentSlotsConfig() error {\n\t// check Slots are unique\n\tcomponentNames := map[string]struct{}{}\n\tfor _, component := range n.kindSpecificCfg().Components {\n\t\t// convert slot to upper\n\t\tslot := strings.ToUpper(component.Slot)\n\t\t// check if slot exists\n\t\t_, exists := componentNames[slot]\n\t\tif exists {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"node %s slot %s duplicate definition\",\n\t\t\t\tn.GetShortName(),\n\t\t\t\tcomponent.Slot,\n\t\t\t)\n\t\t}\n\t\t// add to component names map\n\t\tcomponentNames[slot] = struct{}{}\n\n\t}\n\treturn nil\n}\n\n// componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,\n// and per-component env. Per-component env overrides the typed fields.\nfunc componentDerivedEnv(c *Component) map[string]string {\n\tderived := map[string]string{}\n\tif c == nil {\n\t\treturn derived\n\t}\n\tsetComponentEnvVars(derived, c)\n\tmaps.Copy(derived, c.Env)\n\treturn derived\n}\n\n// warnUserEnvOverrides logs when a node env var replaces a component-derived value.\nfunc warnUserEnvOverrides(node string, derived, userEnv map[string]string) {\n\tfor key, componentValue := range derived {\n\t\tenvValue, userSet := userEnv[key]\n\t\tif !userSet || componentValue == envValue {\n\t\t\tcontinue\n\t\t}\n\t\tlog.Warn(\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n\t\t\t\tcomponentValue,\n\t\t\t\tkey,\n\t\t\t),\n\t\t\t\"node\", node,\n\t\t\t\"env\", key,\n\t\t\t\"component-value\", componentValue,\n\t\t\t\"env-value\", envValue,\n\t\t)\n\t}\n}\n\n// keepUserEnv copies component-derived keys into dst unless the user already set that key.\n// A user value wins, and a differing component value is logged.\nfunc keepUserEnv(node string, dst, derived, userEnv map[string]string) {\n\twarnUserEnvOverrides(node, derived, userEnv)\n\tfor key, componentValue := range derived {\n\t\tif envValue, userSet := userEnv[key]; userSet {\n\t\t\tdst[key] = envValue\n\t\t\tcontinue\n\t\t}\n\t\tdst[key] = componentValue\n\t}\n}\n\n// cloneComponent returns a deep copy of c suitable for env overrides during config generation.\nfunc cloneComponent(c *Component) *Component {\n\tif c == nil {\n\t\treturn &Component{}\n\t}\n\tout := *c\n\tout.Env = maps.Clone(c.Env)\n\tout.MDA = slices.Clone(c.MDA)\n\tif len(c.XIOM) > 0 {\n\t\tout.XIOM = make(XIOMS, len(c.XIOM))\n\t\tfor i, xiom := range c.XIOM {\n\t\t\txiom.MDA = slices.Clone(xiom.MDA)\n\t\t\tout.XIOM[i] = xiom\n\t\t}\n\t}\n\treturn &out\n}\n\n// applyHardwareEnv overlays SR-SIM card, XIOM, and MDA environment variables onto c.\n// NOKIA_SROS_SLOT is left unchanged; it identifies the container rather than provisioned hardware.\nfunc applyHardwareEnv(c *Component, env map[string]string) {\n\tif c == nil || len(env) == 0 {\n\t\treturn\n\t}\n\tif card := env[envNokiaSrosCard]; card != \"\" {\n\t\tc.Type = card\n\t}\n\tfor key, val := range env {\n\t\tif val == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tswitch {\n\t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_X\"):\n\t\t\trest := strings.TrimPrefix(key, envNokiaSrosMDA+\"_X\")\n\t\t\txiomStr, mdaStr, ok := strings.Cut(rest, \"_\")\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\txiomSlot, errX := strconv.Atoi(xiomStr)\n\t\t\tmdaSlot, errM := strconv.Atoi(mdaStr)\n\t\t\tif errX != nil || errM != nil || xiomSlot <= 0 || mdaSlot <= 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tupsertXiomMDA(c, xiomSlot, mdaSlot, val)\n\t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_\"):\n\t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosMDA+\"_\"))\n\t\t\tif err != nil || slot <= 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tc.MDA = upsertMDA(c.MDA, slot, val)\n\t\tcase strings.HasPrefix(key, envNokiaSrosXIOM+\"_X\"):\n\t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosXIOM+\"_X\"))\n\t\t\tif err != nil || slot <= 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tupsertXiomType(c, slot, val)\n\t\t}\n\t}\n}\n\nfunc upsertMDA(mdas MDAS, slot int, typ string) MDAS {\n\tfor i := range mdas {\n\t\tif mdas[i].Slot == slot {\n\t\t\tmdas[i].Type = typ\n\t\t\treturn mdas\n\t\t}\n\t}\n\treturn append(mdas, MDA{Slot: slot, Type: typ})\n}\n\nfunc upsertXiomType(c *Component, slot int, typ string) {\n\tfor i := range c.XIOM {\n\t\tif c.XIOM[i].Slot == slot {\n\t\t\tc.XIOM[i].Type = typ\n\t\t\treturn\n\t\t}\n\t}\n\tc.XIOM = append(c.XIOM, XIOM{Slot: slot, Type: typ})\n}\n\nfunc upsertXiomMDA(c *Component, xiomSlot, mdaSlot int, typ string) {\n\tfor i := range c.XIOM {\n\t\tif c.XIOM[i].Slot != xiomSlot {\n\t\t\tcontinue\n\t\t}\n\t\tc.XIOM[i].MDA = upsertMDA(c.XIOM[i].MDA, mdaSlot, typ)\n\t\treturn\n\t}\n\tc.XIOM = append(c.XIOM, XIOM{\n\t\tSlot: xiomSlot,\n\t\tMDA:  MDAS{{Slot: mdaSlot, Type: typ}},\n\t})\n}",
        "lineStart": 1,
        "lineEnd": 309,
        "totalLines": 309,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346552846,
      "end": 1792346552853
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502dfa170016Jyd0qloAIUn6C",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502dbe9f001ek5Hgev3SCmtk8",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 79900,
    "input": 79728,
    "output": 46,
    "reasoning": 126,
    "cache": {
      "read": 0,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502dbe9f001ek5Hgev3SCmtk8",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346537631,
    "completed": 1792346552859
  },
  "parentID": "msg_1502d8a66001F2b7xDf6faLOHN",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 79900,
    "input": 79728,
    "output": 46,
    "reasoning": 126,
    "cache": {
      "read": 0,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 8
step-start
{
  "type": "step-start",
  "id": "prt_1502e0588001SmZ1Is76uENiVs",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502dfa1f0013gFa7ej4MGIfaF"
}
Reasoning
Note: `applyHardwareEnv` iterates over env map in unspecified order. The MDA_X case is checked before the MDA_ prefix case, good. But there's a subtlety: `applyHardwareEnv(out, out.Env)` — out.Env is per-component env which may also contain `NOKIA_SROS_CARD` etc. Fine.

Wait — one important issue: `cloneComponent` comment says "deep copy" but `out.Env = maps.Clone(c.Env)` — shallow clone of env map is fine. MDA slices cloned. XIOM cloned with MDA cloned. OK.

Another: `checkComponentSlotsConfig` doesn't TrimSpace before ToUpper, so " a" vs "A" won't be detected as duplicates. Minor; the base version had same behavior. Actually base version had same code (in sros.go). Not introduced by PR — moved only. Not a finding.

Now read component_config.go, config.go, netns.go, power.go, variant.go, template.go, sros.go (head).
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/component_config.go"
}

Output

<path>/source/head/nodes/sros/component_config.go</path>
<type>file</type>
<content>
1: // Copyright 2025 Nokia
2: // Licensed under the BSD 3-Clause License.
3: // SPDX-License-Identifier: BSD-3-Clause
4: 
5: package sros
6: 
7: import (
8: 	"fmt"
9: 	"maps"
10: 	"slices"
11: 	"strings"
12: 
13: 	"github.com/charmbracelet/log"
14: )
15: 
16: const integratedSrosCardSlot = "1"
17: 
18: type integratedSrosDefaultComponent struct {
19: 	cardType     string
20: 	mdas         MDAS
21: 	allowedSlots []string
22: }
23: 
24: var integratedSrosDefaultComponents = map[string]integratedSrosDefaultComponent{
25: 	"sr-1": {
26: 		cardType:     "iom-1",
27: 		allowedSlots: []string{slotAName},
28: 		mdas: MDAS{
29: 			{Slot: 1, Type: "me6-100gb-qsfp28"},
30: 			{Slot: 2, Type: "me12-100gb-qsfp28"},
31: 		},
32: 	},
33: 	"sr-1s": {
34: 		cardType:     "xcm-1s",
35: 		allowedSlots: []string{slotAName},
36: 		mdas: MDAS{
37: 			{Slot: 1, Type: "s36-100gb-qsfp28"},
38: 		},
39: 	},
40: 	"ixr-r6": {
41: 		cardType:     "iom-ixr-r6",
42: 		allowedSlots: []string{slotAName, slotBName},
43: 		mdas: MDAS{
44: 			{Slot: 1, Type: "m6-10g-sfp++1-100g-qsfp28"},
45: 		},
46: 	},
47: 	"ixr-e2": {
48: 		cardType:     "imm2-qsfpdd+2-qsfp28+24-sfp28",
49: 		allowedSlots: []string{slotAName},
50: 		mdas: MDAS{
51: 			{Slot: 1, Type: "m2-qsfpdd+2-qsfp28+24-sfp28"},
52: 		},
53: 	},
54: 	"ixr-e2c": {
55: 		cardType:     "imm12-sfp28+2-qsfp28",
56: 		allowedSlots: []string{slotAName},
57: 		mdas: MDAS{
58: 			{Slot: 1, Type: "m12-sfp28+2-qsfp28"},
59: 		},
60: 	},
61: 	"ixr-e2n": {
62: 		cardType:     "imm4-sfp+4-sfp+",
63: 		allowedSlots: []string{slotAName},
64: 		mdas: MDAS{
65: 			{Slot: 1, Type: "m4-sfp+4-sfp+"},
66: 		},
67: 	},
68: 	"ixr-e2n-s": {
69: 		cardType:     "imm4-sfp+4-sfp+-s",
70: 		allowedSlots: []string{slotAName},
71: 		mdas: MDAS{
72: 			{Slot: 1, Type: "m4-sfp+4-sfp+-s"},
73: 		},
74: 	},
75: 	"ixr-e3c": {
76: 		cardType:     "imm4-qsfp28+16-sfp28+8-sfp56",
77: 		allowedSlots: []string{slotAName},
78: 		mdas: MDAS{
79: 			{Slot: 1, Type: "m4-qsfp28+16-sfp28+8-sfp56"},
80: 		},
81: 	},
82: 	"ixr-e3x": {
83: 		cardType:     "imm16-sfp112+15-sfp56+6-qsfpdd",
84: 		allowedSlots: []string{slotAName},
85: 		mdas: MDAS{
86: 			{Slot: 1, Type: "m16-sfp112+15-sfp56+6-qsfpdd"},
87: 		},
88: 	},
89: 	"ixr-e2sc": {
90: 		cardType:     "imm16-sfp++4-sfp28",
91: 		allowedSlots: []string{slotAName},
92: 		mdas: MDAS{
93: 			{Slot: 1, Type: "m16-sfp++4-sfp28"},
94: 		},
95: 	},
96: 	"ixr-ec": {
97: 		cardType:     "imm4-1g-tx+20-1g-sfp+6-10g-sfp+",
98: 		allowedSlots: []string{slotAName},
99: 		mdas: MDAS{
100: 			{Slot: 1, Type: "m4-1g-tx+20-1g-sfp+6-10g-sfp+"},
101: 		},
102: 	},
103: }
104: 
105: // componentCfgLine represents one SR OS config line for a component (card, sfm, xiom, mda).
106: // Adding a new component type = add a Kind and a case in String().
107: type componentCfgLine struct {
108: 	Kind     string // "card", "sfm", "xiom", "xiomMda", "mda"
109: 	Slot     string
110: 	Type     string
111: 	XiomSlot int
112: 	MdaSlot  int
113: }
114: 
115: // String returns the SR OS CLI config line for this component.
116: func (l componentCfgLine) String() string {
117: 	switch l.Kind {
118: 	case "card":
119: 		return fmt.Sprintf("/configure card %s card-type %s admin-state enable\n", l.Slot, l.Type)
120: 	case "sfm":
121: 		return fmt.Sprintf("/configure sfm %s sfm-type %s admin-state enable\n", l.Slot, l.Type)
122: 	case "xiom":
123: 		return fmt.Sprintf("/configure card %s xiom x%d xiom-type %s admin-state enable\n",
124: 			l.Slot, l.XiomSlot, l.Type)
125: 	case "xiomMda":
126: 		return fmt.Sprintf("/configure card %s xiom x%d mda %d mda-type %s admin-state enable\n",
127: 			l.Slot, l.XiomSlot, l.MdaSlot, l.Type)
128: 	case "mda":
129: 		return fmt.Sprintf("/configure card %s mda %d mda-type %s admin-state enable\n",
130: 			l.Slot, l.MdaSlot, l.Type)
131: 	default:
132: 		return ""
133: 	}
134: }
135: 
136: // buildComponentCfgLines turns root components into a slice of config lines (card, sfm, xiom,
137: // xiomMda, mda).
138: // CPM slots (A, B) are skipped. Components without Type are skipped (caller may log).
139: func buildComponentCfgLines(components []*Component, sfm string) []componentCfgLine {
140: 	var lines []componentCfgLine
141: 	for _, component := range components {
142: 		slot := strings.ToUpper(strings.TrimSpace(component.Slot))
143: 		if slot == slotAName || slot == slotBName {
144: 			continue
145: 		}
146: 		if component.Type == "" {
147: 			continue
148: 		}
149: 		lines = append(lines, componentCfgLine{Kind: "card", Slot: slot, Type: component.Type})
150: 		if sfm != "" {
151: 			lines = append(lines, componentCfgLine{Kind: "sfm", Slot: slot, Type: sfm})
152: 		}
153: 		for _, xiom := range component.XIOM {
154: 			if xiom.Type != "" {
155: 				lines = append(
156: 					lines,
157: 					componentCfgLine{
158: 						Kind:     "xiom",
159: 						Slot:     slot,
160: 						Type:     xiom.Type,
161: 						XiomSlot: xiom.Slot,
162: 					},
163: 				)
164: 			}
165: 			for _, mda := range xiom.MDA {
166: 				if mda.Type != "" {
167: 					lines = append(lines, componentCfgLine{
168: 						Kind: "xiomMda", Slot: slot, Type: mda.Type,
169: 						XiomSlot: xiom.Slot, MdaSlot: mda.Slot,
170: 					})
171: 				}
172: 			}
173: 		}
174: 		for _, mda := range component.MDA {
175: 			if mda.Type != "" {
176: 				lines = append(
177: 					lines,
178: 					componentCfgLine{Kind: "mda", Slot: slot, Type: mda.Type, MdaSlot: mda.Slot},
179: 				)
180: 			}
181: 		}
182: 	}
183: 	return lines
184: }
185: 
186: func buildIntegratedComponentCfgLines(nodeType string, override *Component) []componentCfgLine {
187: 	component, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]
188: 	if !ok {
189: 		return nil
190: 	}
191: 	if override == nil {
192: 		override = &Component{}
193: 	}
194: 
195: 	defaultMdas := component.mdas
196: 
197: 	if len(override.XIOM) > 0 {
198: 		defaultMdas = nil
199: 	}
200: 
201: 	card := &Component{
202: 		Slot: integratedSrosCardSlot,
203: 		Type: component.cardType,
204: 		XIOM: override.XIOM,
205: 		MDA:  mergeIntegratedMdas(defaultMdas, override.MDA),
206: 	}
207: 
208: 	return buildComponentCfgLines([]*Component{card}, "")
209: }
210: 
211: func mergeIntegratedMdas(defaults, overrides MDAS) MDAS {
212: 	bySlot := map[int]string{}
213: 	for _, mda := range slices.Concat(defaults, overrides) {
214: 		if mda.Slot > 0 && mda.Type != "" {
215: 			bySlot[mda.Slot] = mda.Type
216: 		}
217: 	}
218: 
219: 	slots := slices.Sorted(maps.Keys(bySlot))
220: 	mdas := make(MDAS, 0, len(slots))
221: 	for _, slot := range slots {
222: 		mdas = append(mdas, MDA{Slot: slot, Type: bySlot[slot]})
223: 	}
224: 	return mdas
225: }
226: 
227: func canonicalSrosNodeType(nodeType string) string {
228: 	return strings.ToLower(strings.TrimSpace(nodeType))
229: }
230: 
231: func integratedSrosDefault(nodeType string) (integratedSrosDefaultComponent, bool) {
232: 	component, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]
233: 	return component, ok
234: }
235: 
236: func isIntegratedSrosNodeType(nodeType string) bool {
237: 	_, ok := integratedSrosDefault(nodeType)
238: 	return ok
239: }
240: 
241: func integratedSrosAllowedSlots(nodeType string) []string {
242: 	component, ok := integratedSrosDefault(nodeType)
243: 	if !ok || len(component.allowedSlots) == 0 {
244: 		return []string{slotAName}
245: 	}
246: 	return component.allowedSlots
247: }
248: 
249: func isRedundantIntegratedSrosComponents(nodeType string, components []*Component) bool {
250: 	if !isIntegratedSrosNodeType(nodeType) || len(components) < 2 {
251: 		return false
252: 	}
253: 	for _, c := range components {
254: 		if strings.TrimSpace(c.Slot) == "" || !integratedSrosSlotAllowed(nodeType, c.Slot) {
255: 			return false
256: 		}
257: 	}
258: 	return true
259: }
260: 
261: func integratedSrosSlotAllowed(nodeType, slot string) bool {
262: 	slot = strings.ToUpper(strings.TrimSpace(slot))
263: 	if slot == "" {
264: 		slot = standaloneSlotName
265: 	}
266: 	return slices.Contains(integratedSrosAllowedSlots(nodeType), slot)
267: }
268: 
269: func (n *sros) generateComponentConfig() string {
270: 	if !n.kindSpecificCfg().GenComponentConfig {
271: 		return ""
272: 	}
273: 	if n.isConfigClassic() {
274: 		return ""
275: 	}
276: 
277: 	if isIntegratedSrosNodeType(n.Cfg.NodeType) {
278: 		return n.generateIntegratedComponentConfig()
279: 	}
280: 
281: 	components := n.rootComponents
282: 	if len(components) == 0 {
283: 		return ""
284: 	}
285: 
286: 	for _, c := range components {
287: 		slot := strings.ToUpper(strings.TrimSpace(c.Slot))
288: 		if slot == slotAName || slot == slotBName {
289: 			continue
290: 		}
291: 		if c.Type == "" {
292: 			log.Warn(
293: 				"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.",
294: 				"node",
295: 				n.Cfg.ShortName,
296: 				"slot",
297: 				slot,
298: 			)
299: 		}
300: 	}
301: 
302: 	lines := buildComponentCfgLines(n.componentsForConfig(components), n.componentSFM())
303: 	return n.componentConfigFromLines(lines)
304: }
305: 
306: // hardwareEnv is the topology env, which overrides component type, XIOM, and MDA.
307: // Nodes that have not been through Init expose that env on Cfg.Env.
308: func (n *sros) hardwareEnv() map[string]string {
309: 	if n.userEnv != nil {
310: 		return n.userEnv
311: 	}
312: 	return n.Cfg.Env
313: }
314: 
315: // componentSFM is the SFM used in generated config. NOKIA_SROS_SFM overrides the sfm key.
316: func (n *sros) componentSFM() string {
317: 	if sfm := n.hardwareEnv()[envNokiaSrosSFM]; sfm != "" {
318: 		return sfm
319: 	}
320: 	return n.kindSpecificCfg().SFM
321: }
322: 
323: // componentForConfig clones c and applies per-component env, then node env.
324: func (n *sros) componentForConfig(c *Component) *Component {
325: 	out := cloneComponent(c)
326: 	applyHardwareEnv(out, out.Env)
327: 	applyHardwareEnv(out, n.hardwareEnv())
328: 	return out
329: }
330: 
331: func (n *sros) componentsForConfig(components []*Component) []*Component {
332: 	out := make([]*Component, len(components))
333: 	for i, c := range components {
334: 		out[i] = n.componentForConfig(c)
335: 	}
336: 	return out
337: }
338: 
339: func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {
340: 	powerConfig := n.generatePowerConfig()
341: 	if len(lines) == 0 && powerConfig == "" {
342: 		return ""
343: 	}
344: 
345: 	var config strings.Builder
346: 	for _, l := range lines {
347: 		config.WriteString(l.String())
348: 	}
349: 	config.WriteString(powerConfig)
350: 	return config.String()
351: }
352: 
353: func (n *sros) generateIntegratedComponentConfig() string {
354: 	card := strings.TrimSpace(n.Cfg.Env[envNokiaSrosCard])
355: 	if card != "" {
356: 		log.Info(
357: 			"Card type override set on integrated chassis type, skipping component SR OS config generation",
358: 			"node",
359: 			n.Cfg.ShortName,
360: 			"type",
361: 			n.Cfg.NodeType,
362: 			"card",
363: 			card,
364: 		)
365: 		return ""
366: 	}
367: 
368: 	lines := buildIntegratedComponentCfgLines(
369: 		n.Cfg.NodeType,
370: 		n.componentForConfig(n.integratedComponentOverride()),
371: 	)
372: 	return n.componentConfigFromLines(lines)
373: }
374: 
375: // integratedComponentOverride returns the component that overrides the integrated defaults:
376: // the single component of a standalone node, or the component matching the slot of a
377: // redundant CPM node.
378: func (n *sros) integratedComponentOverride() *Component {
379: 	if n.rootCtrName == "" {
380: 		if len(n.kindSpecificCfg().Components) == 1 {
381: 			return n.kindSpecificCfg().Components[0]
382: 		}
383: 		return nil
384: 	}
385: 
386: 	slot := n.Cfg.Env[envNokiaSrosSlot]
387: 	for _, c := range n.rootComponents {
388: 		if strings.EqualFold(strings.TrimSpace(c.Slot), slot) {
389: 			return c
390: 		}
391: 	}
392: 	return nil
393: }

(End of file - total 393 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502e0d32001t94kHv7AaK1Pmf",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502dfa1f0013gFa7ej4MGIfaF",
  "callID": "call_e403cd78e4b741839c37e2d2",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/component_config.go"
    },
    "output": "<path>/source/head/nodes/sros/component_config.go</path>\n<type>file</type>\n<content>\n1: // Copyright 2025 Nokia\n2: // Licensed under the BSD 3-Clause License.\n3: // SPDX-License-Identifier: BSD-3-Clause\n4: \n5: package sros\n6: \n7: import (\n8: \t\"fmt\"\n9: \t\"maps\"\n10: \t\"slices\"\n11: \t\"strings\"\n12: \n13: \t\"github.com/charmbracelet/log\"\n14: )\n15: \n16: const integratedSrosCardSlot = \"1\"\n17: \n18: type integratedSrosDefaultComponent struct {\n19: \tcardType     string\n20: \tmdas         MDAS\n21: \tallowedSlots []string\n22: }\n23: \n24: var integratedSrosDefaultComponents = map[string]integratedSrosDefaultComponent{\n25: \t\"sr-1\": {\n26: \t\tcardType:     \"iom-1\",\n27: \t\tallowedSlots: []string{slotAName},\n28: \t\tmdas: MDAS{\n29: \t\t\t{Slot: 1, Type: \"me6-100gb-qsfp28\"},\n30: \t\t\t{Slot: 2, Type: \"me12-100gb-qsfp28\"},\n31: \t\t},\n32: \t},\n33: \t\"sr-1s\": {\n34: \t\tcardType:     \"xcm-1s\",\n35: \t\tallowedSlots: []string{slotAName},\n36: \t\tmdas: MDAS{\n37: \t\t\t{Slot: 1, Type: \"s36-100gb-qsfp28\"},\n38: \t\t},\n39: \t},\n40: \t\"ixr-r6\": {\n41: \t\tcardType:     \"iom-ixr-r6\",\n42: \t\tallowedSlots: []string{slotAName, slotBName},\n43: \t\tmdas: MDAS{\n44: \t\t\t{Slot: 1, Type: \"m6-10g-sfp++1-100g-qsfp28\"},\n45: \t\t},\n46: \t},\n47: \t\"ixr-e2\": {\n48: \t\tcardType:     \"imm2-qsfpdd+2-qsfp28+24-sfp28\",\n49: \t\tallowedSlots: []string{slotAName},\n50: \t\tmdas: MDAS{\n51: \t\t\t{Slot: 1, Type: \"m2-qsfpdd+2-qsfp28+24-sfp28\"},\n52: \t\t},\n53: \t},\n54: \t\"ixr-e2c\": {\n55: \t\tcardType:     \"imm12-sfp28+2-qsfp28\",\n56: \t\tallowedSlots: []string{slotAName},\n57: \t\tmdas: MDAS{\n58: \t\t\t{Slot: 1, Type: \"m12-sfp28+2-qsfp28\"},\n59: \t\t},\n60: \t},\n61: \t\"ixr-e2n\": {\n62: \t\tcardType:     \"imm4-sfp+4-sfp+\",\n63: \t\tallowedSlots: []string{slotAName},\n64: \t\tmdas: MDAS{\n65: \t\t\t{Slot: 1, Type: \"m4-sfp+4-sfp+\"},\n66: \t\t},\n67: \t},\n68: \t\"ixr-e2n-s\": {\n69: \t\tcardType:     \"imm4-sfp+4-sfp+-s\",\n70: \t\tallowedSlots: []string{slotAName},\n71: \t\tmdas: MDAS{\n72: \t\t\t{Slot: 1, Type: \"m4-sfp+4-sfp+-s\"},\n73: \t\t},\n74: \t},\n75: \t\"ixr-e3c\": {\n76: \t\tcardType:     \"imm4-qsfp28+16-sfp28+8-sfp56\",\n77: \t\tallowedSlots: []string{slotAName},\n78: \t\tmdas: MDAS{\n79: \t\t\t{Slot: 1, Type: \"m4-qsfp28+16-sfp28+8-sfp56\"},\n80: \t\t},\n81: \t},\n82: \t\"ixr-e3x\": {\n83: \t\tcardType:     \"imm16-sfp112+15-sfp56+6-qsfpdd\",\n84: \t\tallowedSlots: []string{slotAName},\n85: \t\tmdas: MDAS{\n86: \t\t\t{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"},\n87: \t\t},\n88: \t},\n89: \t\"ixr-e2sc\": {\n90: \t\tcardType:     \"imm16-sfp++4-sfp28\",\n91: \t\tallowedSlots: []string{slotAName},\n92: \t\tmdas: MDAS{\n93: \t\t\t{Slot: 1, Type: \"m16-sfp++4-sfp28\"},\n94: \t\t},\n95: \t},\n96: \t\"ixr-ec\": {\n97: \t\tcardType:     \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n98: \t\tallowedSlots: []string{slotAName},\n99: \t\tmdas: MDAS{\n100: \t\t\t{Slot: 1, Type: \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\"},\n101: \t\t},\n102: \t},\n103: }\n104: \n105: // componentCfgLine represents one SR OS config line for a component (card, sfm, xiom, mda).\n106: // Adding a new component type = add a Kind and a case in String().\n107: type componentCfgLine struct {\n108: \tKind     string // \"card\", \"sfm\", \"xiom\", \"xiomMda\", \"mda\"\n109: \tSlot     string\n110: \tType     string\n111: \tXiomSlot int\n112: \tMdaSlot  int\n113: }\n114: \n115: // String returns the SR OS CLI config line for this component.\n116: func (l componentCfgLine) String() string {\n117: \tswitch l.Kind {\n118: \tcase \"card\":\n119: \t\treturn fmt.Sprintf(\"/configure card %s card-type %s admin-state enable\\n\", l.Slot, l.Type)\n120: \tcase \"sfm\":\n121: \t\treturn fmt.Sprintf(\"/configure sfm %s sfm-type %s admin-state enable\\n\", l.Slot, l.Type)\n122: \tcase \"xiom\":\n123: \t\treturn fmt.Sprintf(\"/configure card %s xiom x%d xiom-type %s admin-state enable\\n\",\n124: \t\t\tl.Slot, l.XiomSlot, l.Type)\n125: \tcase \"xiomMda\":\n126: \t\treturn fmt.Sprintf(\"/configure card %s xiom x%d mda %d mda-type %s admin-state enable\\n\",\n127: \t\t\tl.Slot, l.XiomSlot, l.MdaSlot, l.Type)\n128: \tcase \"mda\":\n129: \t\treturn fmt.Sprintf(\"/configure card %s mda %d mda-type %s admin-state enable\\n\",\n130: \t\t\tl.Slot, l.MdaSlot, l.Type)\n131: \tdefault:\n132: \t\treturn \"\"\n133: \t}\n134: }\n135: \n136: // buildComponentCfgLines turns root components into a slice of config lines (card, sfm, xiom,\n137: // xiomMda, mda).\n138: // CPM slots (A, B) are skipped. Components without Type are skipped (caller may log).\n139: func buildComponentCfgLines(components []*Component, sfm string) []componentCfgLine {\n140: \tvar lines []componentCfgLine\n141: \tfor _, component := range components {\n142: \t\tslot := strings.ToUpper(strings.TrimSpace(component.Slot))\n143: \t\tif slot == slotAName || slot == slotBName {\n144: \t\t\tcontinue\n145: \t\t}\n146: \t\tif component.Type == \"\" {\n147: \t\t\tcontinue\n148: \t\t}\n149: \t\tlines = append(lines, componentCfgLine{Kind: \"card\", Slot: slot, Type: component.Type})\n150: \t\tif sfm != \"\" {\n151: \t\t\tlines = append(lines, componentCfgLine{Kind: \"sfm\", Slot: slot, Type: sfm})\n152: \t\t}\n153: \t\tfor _, xiom := range component.XIOM {\n154: \t\t\tif xiom.Type != \"\" {\n155: \t\t\t\tlines = append(\n156: \t\t\t\t\tlines,\n157: \t\t\t\t\tcomponentCfgLine{\n158: \t\t\t\t\t\tKind:     \"xiom\",\n159: \t\t\t\t\t\tSlot:     slot,\n160: \t\t\t\t\t\tType:     xiom.Type,\n161: \t\t\t\t\t\tXiomSlot: xiom.Slot,\n162: \t\t\t\t\t},\n163: \t\t\t\t)\n164: \t\t\t}\n165: \t\t\tfor _, mda := range xiom.MDA {\n166: \t\t\t\tif mda.Type != \"\" {\n167: \t\t\t\t\tlines = append(lines, componentCfgLine{\n168: \t\t\t\t\t\tKind: \"xiomMda\", Slot: slot, Type: mda.Type,\n169: \t\t\t\t\t\tXiomSlot: xiom.Slot, MdaSlot: mda.Slot,\n170: \t\t\t\t\t})\n171: \t\t\t\t}\n172: \t\t\t}\n173: \t\t}\n174: \t\tfor _, mda := range component.MDA {\n175: \t\t\tif mda.Type != \"\" {\n176: \t\t\t\tlines = append(\n177: \t\t\t\t\tlines,\n178: \t\t\t\t\tcomponentCfgLine{Kind: \"mda\", Slot: slot, Type: mda.Type, MdaSlot: mda.Slot},\n179: \t\t\t\t)\n180: \t\t\t}\n181: \t\t}\n182: \t}\n183: \treturn lines\n184: }\n185: \n186: func buildIntegratedComponentCfgLines(nodeType string, override *Component) []componentCfgLine {\n187: \tcomponent, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]\n188: \tif !ok {\n189: \t\treturn nil\n190: \t}\n191: \tif override == nil {\n192: \t\toverride = &Component{}\n193: \t}\n194: \n195: \tdefaultMdas := component.mdas\n196: \n197: \tif len(override.XIOM) > 0 {\n198: \t\tdefaultMdas = nil\n199: \t}\n200: \n201: \tcard := &Component{\n202: \t\tSlot: integratedSrosCardSlot,\n203: \t\tType: component.cardType,\n204: \t\tXIOM: override.XIOM,\n205: \t\tMDA:  mergeIntegratedMdas(defaultMdas, override.MDA),\n206: \t}\n207: \n208: \treturn buildComponentCfgLines([]*Component{card}, \"\")\n209: }\n210: \n211: func mergeIntegratedMdas(defaults, overrides MDAS) MDAS {\n212: \tbySlot := map[int]string{}\n213: \tfor _, mda := range slices.Concat(defaults, overrides) {\n214: \t\tif mda.Slot > 0 && mda.Type != \"\" {\n215: \t\t\tbySlot[mda.Slot] = mda.Type\n216: \t\t}\n217: \t}\n218: \n219: \tslots := slices.Sorted(maps.Keys(bySlot))\n220: \tmdas := make(MDAS, 0, len(slots))\n221: \tfor _, slot := range slots {\n222: \t\tmdas = append(mdas, MDA{Slot: slot, Type: bySlot[slot]})\n223: \t}\n224: \treturn mdas\n225: }\n226: \n227: func canonicalSrosNodeType(nodeType string) string {\n228: \treturn strings.ToLower(strings.TrimSpace(nodeType))\n229: }\n230: \n231: func integratedSrosDefault(nodeType string) (integratedSrosDefaultComponent, bool) {\n232: \tcomponent, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]\n233: \treturn component, ok\n234: }\n235: \n236: func isIntegratedSrosNodeType(nodeType string) bool {\n237: \t_, ok := integratedSrosDefault(nodeType)\n238: \treturn ok\n239: }\n240: \n241: func integratedSrosAllowedSlots(nodeType string) []string {\n242: \tcomponent, ok := integratedSrosDefault(nodeType)\n243: \tif !ok || len(component.allowedSlots) == 0 {\n244: \t\treturn []string{slotAName}\n245: \t}\n246: \treturn component.allowedSlots\n247: }\n248: \n249: func isRedundantIntegratedSrosComponents(nodeType string, components []*Component) bool {\n250: \tif !isIntegratedSrosNodeType(nodeType) || len(components) < 2 {\n251: \t\treturn false\n252: \t}\n253: \tfor _, c := range components {\n254: \t\tif strings.TrimSpace(c.Slot) == \"\" || !integratedSrosSlotAllowed(nodeType, c.Slot) {\n255: \t\t\treturn false\n256: \t\t}\n257: \t}\n258: \treturn true\n259: }\n260: \n261: func integratedSrosSlotAllowed(nodeType, slot string) bool {\n262: \tslot = strings.ToUpper(strings.TrimSpace(slot))\n263: \tif slot == \"\" {\n264: \t\tslot = standaloneSlotName\n265: \t}\n266: \treturn slices.Contains(integratedSrosAllowedSlots(nodeType), slot)\n267: }\n268: \n269: func (n *sros) generateComponentConfig() string {\n270: \tif !n.kindSpecificCfg().GenComponentConfig {\n271: \t\treturn \"\"\n272: \t}\n273: \tif n.isConfigClassic() {\n274: \t\treturn \"\"\n275: \t}\n276: \n277: \tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n278: \t\treturn n.generateIntegratedComponentConfig()\n279: \t}\n280: \n281: \tcomponents := n.rootComponents\n282: \tif len(components) == 0 {\n283: \t\treturn \"\"\n284: \t}\n285: \n286: \tfor _, c := range components {\n287: \t\tslot := strings.ToUpper(strings.TrimSpace(c.Slot))\n288: \t\tif slot == slotAName || slot == slotBName {\n289: \t\t\tcontinue\n290: \t\t}\n291: \t\tif c.Type == \"\" {\n292: \t\t\tlog.Warn(\n293: \t\t\t\t\"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.\",\n294: \t\t\t\t\"node\",\n295: \t\t\t\tn.Cfg.ShortName,\n296: \t\t\t\t\"slot\",\n297: \t\t\t\tslot,\n298: \t\t\t)\n299: \t\t}\n300: \t}\n301: \n302: \tlines := buildComponentCfgLines(n.componentsForConfig(components), n.componentSFM())\n303: \treturn n.componentConfigFromLines(lines)\n304: }\n305: \n306: // hardwareEnv is the topology env, which overrides component type, XIOM, and MDA.\n307: // Nodes that have not been through Init expose that env on Cfg.Env.\n308: func (n *sros) hardwareEnv() map[string]string {\n309: \tif n.userEnv != nil {\n310: \t\treturn n.userEnv\n311: \t}\n312: \treturn n.Cfg.Env\n313: }\n314: \n315: // componentSFM is the SFM used in generated config. NOKIA_SROS_SFM overrides the sfm key.\n316: func (n *sros) componentSFM() string {\n317: \tif sfm := n.hardwareEnv()[envNokiaSrosSFM]; sfm != \"\" {\n318: \t\treturn sfm\n319: \t}\n320: \treturn n.kindSpecificCfg().SFM\n321: }\n322: \n323: // componentForConfig clones c and applies per-component env, then node env.\n324: func (n *sros) componentForConfig(c *Component) *Component {\n325: \tout := cloneComponent(c)\n326: \tapplyHardwareEnv(out, out.Env)\n327: \tapplyHardwareEnv(out, n.hardwareEnv())\n328: \treturn out\n329: }\n330: \n331: func (n *sros) componentsForConfig(components []*Component) []*Component {\n332: \tout := make([]*Component, len(components))\n333: \tfor i, c := range components {\n334: \t\tout[i] = n.componentForConfig(c)\n335: \t}\n336: \treturn out\n337: }\n338: \n339: func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {\n340: \tpowerConfig := n.generatePowerConfig()\n341: \tif len(lines) == 0 && powerConfig == \"\" {\n342: \t\treturn \"\"\n343: \t}\n344: \n345: \tvar config strings.Builder\n346: \tfor _, l := range lines {\n347: \t\tconfig.WriteString(l.String())\n348: \t}\n349: \tconfig.WriteString(powerConfig)\n350: \treturn config.String()\n351: }\n352: \n353: func (n *sros) generateIntegratedComponentConfig() string {\n354: \tcard := strings.TrimSpace(n.Cfg.Env[envNokiaSrosCard])\n355: \tif card != \"\" {\n356: \t\tlog.Info(\n357: \t\t\t\"Card type override set on integrated chassis type, skipping component SR OS config generation\",\n358: \t\t\t\"node\",\n359: \t\t\tn.Cfg.ShortName,\n360: \t\t\t\"type\",\n361: \t\t\tn.Cfg.NodeType,\n362: \t\t\t\"card\",\n363: \t\t\tcard,\n364: \t\t)\n365: \t\treturn \"\"\n366: \t}\n367: \n368: \tlines := buildIntegratedComponentCfgLines(\n369: \t\tn.Cfg.NodeType,\n370: \t\tn.componentForConfig(n.integratedComponentOverride()),\n371: \t)\n372: \treturn n.componentConfigFromLines(lines)\n373: }\n374: \n375: // integratedComponentOverride returns the component that overrides the integrated defaults:\n376: // the single component of a standalone node, or the component matching the slot of a\n377: // redundant CPM node.\n378: func (n *sros) integratedComponentOverride() *Component {\n379: \tif n.rootCtrName == \"\" {\n380: \t\tif len(n.kindSpecificCfg().Components) == 1 {\n381: \t\t\treturn n.kindSpecificCfg().Components[0]\n382: \t\t}\n383: \t\treturn nil\n384: \t}\n385: \n386: \tslot := n.Cfg.Env[envNokiaSrosSlot]\n387: \tfor _, c := range n.rootComponents {\n388: \t\tif strings.EqualFold(strings.TrimSpace(c.Slot), slot) {\n389: \t\t\treturn c\n390: \t\t}\n391: \t}\n392: \treturn nil\n393: }\n\n(End of file - total 393 lines)\n</content>",
    "title": "source/head/nodes/sros/component_config.go",
    "metadata": {
      "preview": "// Copyright 2025 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\npackage sros\n\nimport (\n\t\"fmt\"\n\t\"maps\"\n\t\"slices\"\n\t\"strings\"\n\n\t\"github.com/charmbracelet/log\"\n)\n\nconst integratedSrosCardSlot = \"1\"\n\ntype integratedSrosDefaultComponent struct {\n\tcardType     string\n\tmdas         MDAS",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/component_config.go",
        "text": "// Copyright 2025 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\npackage sros\n\nimport (\n\t\"fmt\"\n\t\"maps\"\n\t\"slices\"\n\t\"strings\"\n\n\t\"github.com/charmbracelet/log\"\n)\n\nconst integratedSrosCardSlot = \"1\"\n\ntype integratedSrosDefaultComponent struct {\n\tcardType     string\n\tmdas         MDAS\n\tallowedSlots []string\n}\n\nvar integratedSrosDefaultComponents = map[string]integratedSrosDefaultComponent{\n\t\"sr-1\": {\n\t\tcardType:     \"iom-1\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"me6-100gb-qsfp28\"},\n\t\t\t{Slot: 2, Type: \"me12-100gb-qsfp28\"},\n\t\t},\n\t},\n\t\"sr-1s\": {\n\t\tcardType:     \"xcm-1s\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"s36-100gb-qsfp28\"},\n\t\t},\n\t},\n\t\"ixr-r6\": {\n\t\tcardType:     \"iom-ixr-r6\",\n\t\tallowedSlots: []string{slotAName, slotBName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m6-10g-sfp++1-100g-qsfp28\"},\n\t\t},\n\t},\n\t\"ixr-e2\": {\n\t\tcardType:     \"imm2-qsfpdd+2-qsfp28+24-sfp28\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m2-qsfpdd+2-qsfp28+24-sfp28\"},\n\t\t},\n\t},\n\t\"ixr-e2c\": {\n\t\tcardType:     \"imm12-sfp28+2-qsfp28\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m12-sfp28+2-qsfp28\"},\n\t\t},\n\t},\n\t\"ixr-e2n\": {\n\t\tcardType:     \"imm4-sfp+4-sfp+\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m4-sfp+4-sfp+\"},\n\t\t},\n\t},\n\t\"ixr-e2n-s\": {\n\t\tcardType:     \"imm4-sfp+4-sfp+-s\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m4-sfp+4-sfp+-s\"},\n\t\t},\n\t},\n\t\"ixr-e3c\": {\n\t\tcardType:     \"imm4-qsfp28+16-sfp28+8-sfp56\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m4-qsfp28+16-sfp28+8-sfp56\"},\n\t\t},\n\t},\n\t\"ixr-e3x\": {\n\t\tcardType:     \"imm16-sfp112+15-sfp56+6-qsfpdd\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"},\n\t\t},\n\t},\n\t\"ixr-e2sc\": {\n\t\tcardType:     \"imm16-sfp++4-sfp28\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m16-sfp++4-sfp28\"},\n\t\t},\n\t},\n\t\"ixr-ec\": {\n\t\tcardType:     \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\"},\n\t\t},\n\t},\n}\n\n// componentCfgLine represents one SR OS config line for a component (card, sfm, xiom, mda).\n// Adding a new component type = add a Kind and a case in String().\ntype componentCfgLine struct {\n\tKind     string // \"card\", \"sfm\", \"xiom\", \"xiomMda\", \"mda\"\n\tSlot     string\n\tType     string\n\tXiomSlot int\n\tMdaSlot  int\n}\n\n// String returns the SR OS CLI config line for this component.\nfunc (l componentCfgLine) String() string {\n\tswitch l.Kind {\n\tcase \"card\":\n\t\treturn fmt.Sprintf(\"/configure card %s card-type %s admin-state enable\\n\", l.Slot, l.Type)\n\tcase \"sfm\":\n\t\treturn fmt.Sprintf(\"/configure sfm %s sfm-type %s admin-state enable\\n\", l.Slot, l.Type)\n\tcase \"xiom\":\n\t\treturn fmt.Sprintf(\"/configure card %s xiom x%d xiom-type %s admin-state enable\\n\",\n\t\t\tl.Slot, l.XiomSlot, l.Type)\n\tcase \"xiomMda\":\n\t\treturn fmt.Sprintf(\"/configure card %s xiom x%d mda %d mda-type %s admin-state enable\\n\",\n\t\t\tl.Slot, l.XiomSlot, l.MdaSlot, l.Type)\n\tcase \"mda\":\n\t\treturn fmt.Sprintf(\"/configure card %s mda %d mda-type %s admin-state enable\\n\",\n\t\t\tl.Slot, l.MdaSlot, l.Type)\n\tdefault:\n\t\treturn \"\"\n\t}\n}\n\n// buildComponentCfgLines turns root components into a slice of config lines (card, sfm, xiom,\n// xiomMda, mda).\n// CPM slots (A, B) are skipped. Components without Type are skipped (caller may log).\nfunc buildComponentCfgLines(components []*Component, sfm string) []componentCfgLine {\n\tvar lines []componentCfgLine\n\tfor _, component := range components {\n\t\tslot := strings.ToUpper(strings.TrimSpace(component.Slot))\n\t\tif slot == slotAName || slot == slotBName {\n\t\t\tcontinue\n\t\t}\n\t\tif component.Type == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tlines = append(lines, componentCfgLine{Kind: \"card\", Slot: slot, Type: component.Type})\n\t\tif sfm != \"\" {\n\t\t\tlines = append(lines, componentCfgLine{Kind: \"sfm\", Slot: slot, Type: sfm})\n\t\t}\n\t\tfor _, xiom := range component.XIOM {\n\t\t\tif xiom.Type != \"\" {\n\t\t\t\tlines = append(\n\t\t\t\t\tlines,\n\t\t\t\t\tcomponentCfgLine{\n\t\t\t\t\t\tKind:     \"xiom\",\n\t\t\t\t\t\tSlot:     slot,\n\t\t\t\t\t\tType:     xiom.Type,\n\t\t\t\t\t\tXiomSlot: xiom.Slot,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t}\n\t\t\tfor _, mda := range xiom.MDA {\n\t\t\t\tif mda.Type != \"\" {\n\t\t\t\t\tlines = append(lines, componentCfgLine{\n\t\t\t\t\t\tKind: \"xiomMda\", Slot: slot, Type: mda.Type,\n\t\t\t\t\t\tXiomSlot: xiom.Slot, MdaSlot: mda.Slot,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor _, mda := range component.MDA {\n\t\t\tif mda.Type != \"\" {\n\t\t\t\tlines = append(\n\t\t\t\t\tlines,\n\t\t\t\t\tcomponentCfgLine{Kind: \"mda\", Slot: slot, Type: mda.Type, MdaSlot: mda.Slot},\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\treturn lines\n}\n\nfunc buildIntegratedComponentCfgLines(nodeType string, override *Component) []componentCfgLine {\n\tcomponent, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]\n\tif !ok {\n\t\treturn nil\n\t}\n\tif override == nil {\n\t\toverride = &Component{}\n\t}\n\n\tdefaultMdas := component.mdas\n\n\tif len(override.XIOM) > 0 {\n\t\tdefaultMdas = nil\n\t}\n\n\tcard := &Component{\n\t\tSlot: integratedSrosCardSlot,\n\t\tType: component.cardType,\n\t\tXIOM: override.XIOM,\n\t\tMDA:  mergeIntegratedMdas(defaultMdas, override.MDA),\n\t}\n\n\treturn buildComponentCfgLines([]*Component{card}, \"\")\n}\n\nfunc mergeIntegratedMdas(defaults, overrides MDAS) MDAS {\n\tbySlot := map[int]string{}\n\tfor _, mda := range slices.Concat(defaults, overrides) {\n\t\tif mda.Slot > 0 && mda.Type != \"\" {\n\t\t\tbySlot[mda.Slot] = mda.Type\n\t\t}\n\t}\n\n\tslots := slices.Sorted(maps.Keys(bySlot))\n\tmdas := make(MDAS, 0, len(slots))\n\tfor _, slot := range slots {\n\t\tmdas = append(mdas, MDA{Slot: slot, Type: bySlot[slot]})\n\t}\n\treturn mdas\n}\n\nfunc canonicalSrosNodeType(nodeType string) string {\n\treturn strings.ToLower(strings.TrimSpace(nodeType))\n}\n\nfunc integratedSrosDefault(nodeType string) (integratedSrosDefaultComponent, bool) {\n\tcomponent, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]\n\treturn component, ok\n}\n\nfunc isIntegratedSrosNodeType(nodeType string) bool {\n\t_, ok := integratedSrosDefault(nodeType)\n\treturn ok\n}\n\nfunc integratedSrosAllowedSlots(nodeType string) []string {\n\tcomponent, ok := integratedSrosDefault(nodeType)\n\tif !ok || len(component.allowedSlots) == 0 {\n\t\treturn []string{slotAName}\n\t}\n\treturn component.allowedSlots\n}\n\nfunc isRedundantIntegratedSrosComponents(nodeType string, components []*Component) bool {\n\tif !isIntegratedSrosNodeType(nodeType) || len(components) < 2 {\n\t\treturn false\n\t}\n\tfor _, c := range components {\n\t\tif strings.TrimSpace(c.Slot) == \"\" || !integratedSrosSlotAllowed(nodeType, c.Slot) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\nfunc integratedSrosSlotAllowed(nodeType, slot string) bool {\n\tslot = strings.ToUpper(strings.TrimSpace(slot))\n\tif slot == \"\" {\n\t\tslot = standaloneSlotName\n\t}\n\treturn slices.Contains(integratedSrosAllowedSlots(nodeType), slot)\n}\n\nfunc (n *sros) generateComponentConfig() string {\n\tif !n.kindSpecificCfg().GenComponentConfig {\n\t\treturn \"\"\n\t}\n\tif n.isConfigClassic() {\n\t\treturn \"\"\n\t}\n\n\tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n\t\treturn n.generateIntegratedComponentConfig()\n\t}\n\n\tcomponents := n.rootComponents\n\tif len(components) == 0 {\n\t\treturn \"\"\n\t}\n\n\tfor _, c := range components {\n\t\tslot := strings.ToUpper(strings.TrimSpace(c.Slot))\n\t\tif slot == slotAName || slot == slotBName {\n\t\t\tcontinue\n\t\t}\n\t\tif c.Type == \"\" {\n\t\t\tlog.Warn(\n\t\t\t\t\"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.\",\n\t\t\t\t\"node\",\n\t\t\t\tn.Cfg.ShortName,\n\t\t\t\t\"slot\",\n\t\t\t\tslot,\n\t\t\t)\n\t\t}\n\t}\n\n\tlines := buildComponentCfgLines(n.componentsForConfig(components), n.componentSFM())\n\treturn n.componentConfigFromLines(lines)\n}\n\n// hardwareEnv is the topology env, which overrides component type, XIOM, and MDA.\n// Nodes that have not been through Init expose that env on Cfg.Env.\nfunc (n *sros) hardwareEnv() map[string]string {\n\tif n.userEnv != nil {\n\t\treturn n.userEnv\n\t}\n\treturn n.Cfg.Env\n}\n\n// componentSFM is the SFM used in generated config. NOKIA_SROS_SFM overrides the sfm key.\nfunc (n *sros) componentSFM() string {\n\tif sfm := n.hardwareEnv()[envNokiaSrosSFM]; sfm != \"\" {\n\t\treturn sfm\n\t}\n\treturn n.kindSpecificCfg().SFM\n}\n\n// componentForConfig clones c and applies per-component env, then node env.\nfunc (n *sros) componentForConfig(c *Component) *Component {\n\tout := cloneComponent(c)\n\tapplyHardwareEnv(out, out.Env)\n\tapplyHardwareEnv(out, n.hardwareEnv())\n\treturn out\n}\n\nfunc (n *sros) componentsForConfig(components []*Component) []*Component {\n\tout := make([]*Component, len(components))\n\tfor i, c := range components {\n\t\tout[i] = n.componentForConfig(c)\n\t}\n\treturn out\n}\n\nfunc (n *sros) componentConfigFromLines(lines []componentCfgLine) string {\n\tpowerConfig := n.generatePowerConfig()\n\tif len(lines) == 0 && powerConfig == \"\" {\n\t\treturn \"\"\n\t}\n\n\tvar config strings.Builder\n\tfor _, l := range lines {\n\t\tconfig.WriteString(l.String())\n\t}\n\tconfig.WriteString(powerConfig)\n\treturn config.String()\n}\n\nfunc (n *sros) generateIntegratedComponentConfig() string {\n\tcard := strings.TrimSpace(n.Cfg.Env[envNokiaSrosCard])\n\tif card != \"\" {\n\t\tlog.Info(\n\t\t\t\"Card type override set on integrated chassis type, skipping component SR OS config generation\",\n\t\t\t\"node\",\n\t\t\tn.Cfg.ShortName,\n\t\t\t\"type\",\n\t\t\tn.Cfg.NodeType,\n\t\t\t\"card\",\n\t\t\tcard,\n\t\t)\n\t\treturn \"\"\n\t}\n\n\tlines := buildIntegratedComponentCfgLines(\n\t\tn.Cfg.NodeType,\n\t\tn.componentForConfig(n.integratedComponentOverride()),\n\t)\n\treturn n.componentConfigFromLines(lines)\n}\n\n// integratedComponentOverride returns the component that overrides the integrated defaults:\n// the single component of a standalone node, or the component matching the slot of a\n// redundant CPM node.\nfunc (n *sros) integratedComponentOverride() *Component {\n\tif n.rootCtrName == \"\" {\n\t\tif len(n.kindSpecificCfg().Components) == 1 {\n\t\t\treturn n.kindSpecificCfg().Components[0]\n\t\t}\n\t\treturn nil\n\t}\n\n\tslot := n.Cfg.Env[envNokiaSrosSlot]\n\tfor _, c := range n.rootComponents {\n\t\tif strings.EqualFold(strings.TrimSpace(c.Slot), slot) {\n\t\t\treturn c\n\t\t}\n\t}\n\treturn nil\n}",
        "lineStart": 1,
        "lineEnd": 393,
        "totalLines": 393,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346557750,
      "end": 1792346557757
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502e0d41001YV8CEeJSAP1xDt",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502dfa1f0013gFa7ej4MGIfaF",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 85390,
    "input": 18596,
    "output": 18,
    "reasoning": 216,
    "cache": {
      "read": 66560,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502dfa1f0013gFa7ej4MGIfaF",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346552863,
    "completed": 1792346557766
  },
  "parentID": "msg_1502d8a66001F2b7xDf6faLOHN",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 85390,
    "input": 18596,
    "output": 18,
    "reasoning": 216,
    "cache": {
      "read": 66560,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
User · 9
compaction
{
  "type": "compaction",
  "id": "prt_1502e0d48001QYTvzwEUG5McqF",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e0d47001j5ACV2tj1J23hI",
  "auto": true,
  "overflow": false,
  "tail_start_id": "msg_1502dbe9f001ek5Hgev3SCmtk8"
}
Message metadata
{
  "role": "user",
  "id": "msg_1502e0d47001j5ACV2tj1J23hI",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346557767
  },
  "summary": {
    "diffs": []
  },
  "agent": "tofarev",
  "model": {
    "providerID": "tofarev",
    "modelID": "zai-org/GLM-5.3-Flash"
  }
}
Assistant · 10
step-start
{
  "type": "step-start",
  "id": "prt_1502e12cf001e1rHr6Lom7SfEc",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e0d5c001zGtvE22hHJMPos"
}
Reasoning
Summarize. The task: review read-only PR snapshot at /source, 31 changed paths, return trusted result schema. Progress: read standards.json, karpathy-guidelines.mdc, ponytail.mdc, manifest.json, diff.txt partially (lines 1-160ish, 1614-..., 3151-...). Need to continue diff reading, read head/base files, verify all 31 changed paths.

List of changed paths from manifest (partially shown): .github/workflows/srsim-tests.yml (M), docs/manual/kinds/sros.md (M), nodes/sros/README.md (M), nodes/sros/chassis_info.go (M), nodes/sros/chassis_info_test.go (A), nodes/sros/component.go (M), nodes/sros/component_config.go (M), nodes/sros/config.go (M), nodes/sros/netns.go (M), nodes/sros/power.go (M), nodes/sros/sros.go (M), nodes/sros/sros_test.go (M), nodes/sros/template.go (M), nodes/sros/variant.go (M), schemas/clab.schema.json (M), tests/13-srsim/01-sros-to-linux.robot (M), tests/13-srsim/03-sros-dist-to-linux.robot (M), tests/13-srsim/04-sros-classic.robot (M), more truncated (tests 05,06,07,08,09,10,11,12,13,14 likely, srsim.robot possibly added).

Diff content observed: CI matrix sharding change; removal of embedded config templates (cfgTplSROS25, cfgTplClassic, cfgTplClassicIxr, cfgTplClassicSar), removal of netns import, removal of defaultSrosPowerType/defaultSrosPowerModuleType constants; robot tests refactored to use srsim.robot resource with "Destroy SR-SIM Lab" keyword.

Rules: read of /source root denied; use explicit file paths like /source/standards.json. Reading *.env requires ask — not relevant.
## Objective
- Perform a source-only read-only code review of the PR snapshot at `/source` (containerlab repo), covering all 31 changed paths, callers/tests/docs/schema, and return the trusted result schema with disclosed limitation that tests were not executed.

## Important Details
- Head: `d44c69f72ab156474197f12b6fc1407b3f8a65c4`; base/mergeBase: `84cf630e6eedd662d9742fbcd6158a91372e3a56` (target base identical).
- Snapshot incomplete: false; full inventory in `/source/manifest.json`.
- Permalink roots: head=`https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/`, base=`https://github.com/srl-labs/containerlab/blob/84cf630e6eedd662d9742fbcd6158a91372e3a56/`.
- Tooling constraint: plain `read("/source")` is denied by permission rules; must read explicit file paths (e.g. `/source/standards.json`). Read rules allow `source/*` patterns via explicit paths.
- Standards applied (from `standards.json`): `.cursor/rules/karpathy-guidelines.mdc` (surgical changes, no speculative code) and `.cursor/rules/ponytail.mdc` (simplest solution, reuse, shortest diff).
- Changed paths observed so far in manifest (statuses): `M` .github/workflows/srsim-tests.yml; `M` docs/manual/kinds/sros.md; `M` nodes/sros/README.md; `M` nodes/sros/chassis_info.go; `A` nodes/sros/chassis_info_test.go; `M` nodes/sros/component.go; `M` nodes/sros/component_config.go; `M` nodes/sros/config.go; `M` nodes/sros/netns.go; `M` nodes/sros/power.go; `M` nodes/sros/sros.go; `M` nodes/sros/sros_test.go; `M` nodes/sros/template.go; `M` nodes/sros/variant.go; `M` schemas/clab.schema.json; `M` tests/13-srsim/01-sros-to-linux.robot; `M` tests/13-srsim/03-sros-dist-to-linux.robot; `M` tests/13-srsim/04-sros-classic.robot; remainder of the 31 paths truncated in manifest view (likely remaining tests/13-srsim/*.robot and possibly a new tests/13-srsim/srsim.robot resource).
- Key diff themes seen so far:
  - `.github/workflows/srsim-tests.yml`: matrix changed from glob `test-suite` entries (01*–12*.robot) to 5 named shards (`basic`, `lifecycle`, `components`, `provisioning`, `apply`) grouping specific robot files; `SRSIM_IMAGE_TAG: 26.7.R1`; quoting fixes (`echo "PATH=$PATH" >> "$GITHUB_ENV"`); removed "Sanitize test-suite name" step.
  - `nodes/sros/sros.go`: removed `github.com/vishvananda/netns` import; removed `defaultSrosPowerType`/`defaultSrosPowerModuleType` constants; removed four `go:embed` template vars (`cfgTplSROS25`, `cfgTplClassic`, `cfgTplClassicIxr`, `cfgTplClassicSar`) — implies template handling moved (likely to template.go) and netns/power logic moved (netns.go/power.go exist as changed files).
  - Robot tests refactored: shared `Resource ../srsim.robot`, suite teardown replaced with `Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}`, removed per-suite SSH keygen boilerplate (`${key-name}` / `${key-path}`).

## Work State
### Completed
- Read `/source/standards.json`, `/source/standards/karpathy-guidelines.mdc`, `/source/standards/ponytail.mdc`.
- Read `/source/manifest.json` (partially; changed-path list captured above, tail truncated).
- Read `/source/diff.txt` segments: lines ~1–49 (workflow hunk), 1614–~1660 (sros.go hunks), 3151–~3198 (tests/13-srsim/01 & 03 hunks).
- Learned read of directory `/source` is denied; explicit file reads work.

### Active
- Mid-way through reading `/source/diff.txt` (31 paths, large file) with offsets; not yet finished.
- Full manifest tail not yet captured (remaining changed paths beyond `tests/13-srsim/04-sros-classic.robot`).
- Head/base file inspection for changed Go files, schema, docs, README, and new test resource (`srsim.robot`) not started.
- No review verdict assembled yet; trusted result schema not yet returned.

### Blocked
- None blocking; only truncated-output offsets and the directory-read denial (worked around with explicit paths).

## Next Move
1. Continue reading `/source/diff.txt` at subsequent offsets (after ~line 3198) until EOF, capturing remaining hunks; also read the manifest tail to enumerate all 31 changed paths.
2. Read head versions of key changed files (e.g. `/source/head/nodes/sros/sros.go`, `template.go`, `netns.go`, `power.go`, `chassis_info.go`, `chassis_info_test.go`, `schemas/clab.schema.json`, `tests/13-srsim/srsim.robot` if present) plus relevant callers/tests/docs; group independent reads; then produce the review with the trusted result schema, disclosing that tests were not executed.

## Relevant Files
- `/source/standards.json`, `/source/standards/karpathy-guidelines.mdc`, `/source/standards/ponytail.mdc`: review standards to apply.
- `/source/manifest.json`: authoritative list of all 31 changed paths and statuses (tail still unread).
- `/source/diff.txt`: full PR diff, partially read (segments at start, 1614, 3151).
- `.github/workflows/srsim-tests.yml`: CI matrix sharding changes to verify.
- `nodes/sros/*.go` (sros.go, template.go, netns.go, power.go, chassis_info.go, chassis_info_test.go, component.go, component_config.go, config.go, variant.go, sros_test.go): core Go changes incl. removed embedded templates, removed netns import, removed power-type constants.
- `schemas/clab.schema.json`, `docs/manual/kinds/sros.md`, `nodes/sros/README.md`: schema/docs consistency to check.
- `tests/13-srsim/*.robot` (01, 03, 04 seen; others pending) and shared `tests/13-srsim/srsim.robot` (likely new): test refactor to `Destroy SR-SIM Lab` keyword.
- GitHub permalinks above for citing base/head file versions in the final review.
step-finish
{
  "type": "step-finish",
  "id": "prt_1502e41a1001blLX6146EFjZa7",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e0d5c001zGtvE22hHJMPos",
  "reason": "stop",
  "cost": 0,
  "tokens": {
    "total": 7193,
    "input": 5223,
    "output": 1539,
    "reasoning": 431,
    "cache": {
      "read": 0,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502e0d5c001zGtvE22hHJMPos",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346557788,
    "completed": 1792346571174
  },
  "parentID": "msg_1502e0d47001j5ACV2tj1J23hI",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "compaction",
  "agent": "compaction",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "summary": true,
  "cost": 0,
  "tokens": {
    "total": 7193,
    "input": 5223,
    "output": 1539,
    "reasoning": 431,
    "cache": {
      "read": 0,
      "write": 0
    }
  },
  "finish": "stop"
}
User · 11
Continue if you have next steps, or stop and ask for clarification if you are unsure how to proceed.
Message metadata
{
  "role": "user",
  "id": "msg_1502e41aa001XEn2l1GdfLHjHR",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346571178
  },
  "summary": {
    "diffs": []
  },
  "agent": "tofarev",
  "model": {
    "providerID": "tofarev",
    "modelID": "zai-org/GLM-5.3-Flash"
  }
}
Assistant · 12
step-start
{
  "type": "step-start",
  "id": "prt_1502e4e5b001jut4NrF5xZ2u52",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e41b4001UmFGYE2sTMN9pk"
}
Reasoning
Continue reading remaining files: config.go, netns.go, power.go, sros.go, template.go, variant.go, chassis_info_test.go, sros_test.go, schema, docs.
Continuing the review — reading the remaining head source files.
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/config.go"
}

Output

<path>/source/head/nodes/sros/config.go</path>
<type>file</type>
<content>
1: package sros
2: 
3: import (
4: 	"bytes"
5: 	"context"
6: 	"fmt"
7: 	"io"
8: 	"os"
9: 	"path/filepath"
10: 	"strings"
11: 
12: 	clabutils "github.com/srl-labs/containerlab/utils"
13: 
14: 	"github.com/beevik/etree"
15: 	"github.com/charmbracelet/log"
16: 	"golang.org/x/mod/semver"
17: )
18: 
19: const (
20: 	grpcMDCLIConfig    = `/configure system grpc md-cli admin-state enable`
21: 	profileMDCLIConfig = `/configure system security aaa local-profiles profile "administrative" grpc rpc-authorization md-cli-session permit`
22: 	tls13CipherCCM8    = `/configure system security tls server-cipher-list "clab-all" tls13-cipher 5 name tls-aes128-ccm8-sha256`
23: )
24: 
25: func (n *sros) setVersionSpecificParams(tplData *srosTemplateData) {
26: 	currVersion := tplData.SwVersion.MajorMinorSemverString()
27: 
28: 	if semver.Compare(currVersion, "v26.0") < 0 {
29: 		tplData.GRPCConfig += "\n" + grpcMDCLIConfig
30: 		tplData.SystemConfig += "\n" + profileMDCLIConfig
31: 
32: 		if tplData.IsSecureGrpc {
33: 			tplData.GRPCConfig += "\n" + tls13CipherCCM8
34: 		}
35: 	}
36: }
37: 
38: // buildPKIImportXML builds the NETCONF action XML that imports a PEM file into the PKI store.
39: func buildPKIImportXML(inputURL, outputFile, importType string) string {
40: 	action := etree.NewElement("action")
41: 	action.CreateAttr("xmlns", "urn:ietf:params:xml:ns:yang:1")
42: 
43: 	admin := action.CreateElement("admin")
44: 	admin.CreateAttr("xmlns", "urn:nokia.com:sros:ns:yang:sr:oper-admin")
45: 
46: 	importElem := admin.CreateElement("system").
47: 		CreateElement("security").
48: 		CreateElement("pki").
49: 		CreateElement("import")
50: 
51: 	// Add import parameters
52: 	importElem.CreateElement("input-url").SetText(inputURL)
53: 	importElem.CreateElement("output-file").SetText(outputFile)
54: 	importElem.CreateElement("type").SetText(importType)
55: 	importElem.CreateElement("format").SetText("pem")
56: 	var buf bytes.Buffer
57: 	action.WriteTo(&buf, &etree.WriteSettings{
58: 		CanonicalText:    false,
59: 		CanonicalAttrVal: false,
60: 	})
61: 	return buf.String()
62: }
63: 
64: // buildTLSProfileXML builds the TLS profile configuration XML.
65: func buildTLSProfileXML() string {
66: 	config := etree.NewElement("config")
67: 	configure := config.CreateElement("configure")
68: 	configure.CreateAttr("xmlns", "urn:nokia.com:sros:ns:yang:sr:conf")
69: 	configure.CreateAttr("xmlns:nc", "urn:ietf:params:xml:ns:netconf:base:1.0")
70: 
71: 	certProfile := configure.CreateElement("system").
72: 		CreateElement("security").
73: 		CreateElement("tls").
74: 		CreateElement("cert-profile")
75: 
76: 	// Set operation attribute
77: 	certProfile.CreateAttr("nc:operation", "merge")
78: 
79: 	// Add profile configuration
80: 	certProfile.CreateElement("cert-profile-name").SetText(tlsCertProfileName)
81: 	certProfile.CreateElement("admin-state").SetText("enable")
82: 
83: 	var buf bytes.Buffer
84: 	config.WriteTo(&buf, &etree.WriteSettings{
85: 		CanonicalText:    false,
86: 		CanonicalAttrVal: false,
87: 	})
88: 	return buf.String()
89: }
90: 
91: // createSROSConfigFiles handles config generation for the SR-SIM kind.
92: // Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).
93: func (n *sros) createSROSConfigFiles() error {
94: 	// Get version from image before generating config
95: 	if n.swVersion == nil {
96: 		ctx := context.Background()
97: 		version, err := n.srosVersionFromImage(ctx)
98: 		if err != nil {
99: 			n.swVersion = n.parseVersionString(srosDefaultVersion)
100: 			log.Warn("Failed to get SR OS version from image",
101: 				"node", n.Cfg.ShortName, "version", n.swVersion, "error", err)
102: 		} else {
103: 			n.swVersion = version
104: 			log.Info("Retrieved SR OS version from image",
105: 				"node", n.Cfg.ShortName,
106: 				"version", fmt.Sprintf("%s.%s.%s", version.Major, version.Minor, version.Build))
107: 		}
108: 	}
109: 
110: 	// Path pointing to the target config file under configCf3 dir
111: 	cf3CfgFile := filepath.Join(
112: 		n.Cfg.LabDir,
113: 		n.Cfg.Env[envNokiaSrosSlot],
114: 		configCf3,
115: 		startupCfgName,
116: 	)
117: 	isPartial := clabutils.IsPartialConfigFile(n.Cfg.StartupConfig)
118: 
119: 	// generate config and use that to boot node
120: 	log.Debug("Reading startup-config", "node", n.Cfg.ShortName, "startup-config",
121: 		n.Cfg.StartupConfig, "isPartial", isPartial)
122: 
123: 	startupConfig, err := n.buildStartupConfig(isPartial)
124: 	if err != nil {
125: 		return err
126: 	}
127: 
128: 	if startupConfig == "" {
129: 		log.Debug(
130: 			"startup config is empty, skipping startup config file generation",
131: 			"node",
132: 			n.Cfg.ShortName,
133: 		)
134: 		return nil
135: 	}
136: 
137: 	return n.GenerateConfig(cf3CfgFile, startupConfig)
138: }
139: 
140: // buildStartupConfig returns the full startup config string: either from user file (full config)
141: // or from default + partial config generation. It does not return a template; the name is
142: // historical.
143: func (n *sros) buildStartupConfig(isPartial bool) (string, error) {
144: 	// User provides full startup config
145: 	if n.Cfg.StartupConfig != "" && !isPartial {
146: 		c, err := os.ReadFile(n.Cfg.StartupConfig)
147: 		if err != nil {
148: 			return "", err
149: 		}
150: 
151: 		cBuf, err := clabutils.SubstituteEnvsAndTemplate(bytes.NewReader(c), n.Cfg)
152: 		if err != nil {
153: 			return "", err
154: 		}
155: 		return cBuf.String(), nil
156: 	}
157: 
158: 	// Generate default config and optionally add partial config
159: 	if err := n.addDefaultConfig(); err != nil {
160: 		return "", err
161: 	}
162: 	if err := n.addPartialConfig(); err != nil {
163: 		return "", err
164: 	}
165: 
166: 	return string(n.startupCliCfg), nil
167: }
168: 
169: // prepareConfigTemplateData prepares all data needed for template selection and execution.
170: // Service configs are filled from a single table-driven result: variant → getFullSnippetSet(v).
171: func (n *sros) prepareConfigTemplateData() (*srosTemplateData, error) {
172: 	b, err := n.banner()
173: 	if err != nil {
174: 		return nil, err
175: 	}
176: 
177: 	componentConfig := ""
178: 	if !isFullConfigFile(n.Cfg.StartupConfig) {
179: 		componentConfig = n.generateComponentConfig()
180: 	} else {
181: 		log.Debugf(
182: 			"SR-SIM node %q has non-partial startup-config defined, skipping component config gen",
183: 			n.Cfg.LongName,
184: 		)
185: 	}
186: 
187: 	v := n.resolveConfigVariant()
188: 	snippets := getFullSnippetSet(v)
189: 	configMode := string(v.Mode)
190: 	if v.ForceClassic {
191: 		log.Warn(
192: 			"SAR-Hm nodes only support classic configuration mode. Overriding configuration mode to 'classic'",
193: 			"node",
194: 			n.Cfg.LongName,
195: 			"node-type",
196: 			strings.ToLower(n.Cfg.NodeType),
197: 		)
198: 		configMode = string(ConfigModeClassic)
199: 		n.kindSpecificCfg().ConfigMode = ConfigModeClassic
200: 	}
201: 
202: 	tplData := &srosTemplateData{
203: 		// Selection criteria
204: 		NodeType:          strings.ToLower(n.Cfg.NodeType),
205: 		ConfigurationMode: configMode,
206: 		SwVersion:         n.swVersion,
207: 		IsSecureGrpc:      *n.Cfg.Certificate.Issue,
208: 
209: 		// Node data
210: 		Name:            n.Cfg.ShortName,
211: 		TLSKey:          n.Cfg.TLSKey,
212: 		TLSCert:         n.Cfg.TLSCert,
213: 		TLSAnchor:       n.Cfg.TLSAnchor,
214: 		Banner:          b,
215: 		IFaces:          map[string]tplIFace{},
216: 		MgmtMTU:         0,
217: 		MgmtIPMTU:       n.Runtime.Mgmt().MTU,
218: 		ComponentConfig: componentConfig,
219: 
220: 		// Service configs from variant (single source of truth)
221: 		SystemConfig:  snippets.SystemConfig,
222: 		GRPCConfig:    snippets.GRPCConfig,
223: 		SNMPConfig:    snippets.SNMPConfig,
224: 		NetconfConfig: snippets.NetconfConfig,
225: 		LoggingConfig: snippets.LoggingConfig,
226: 		SSHConfig:     snippets.SSHConfig,
227: 	}
228: 
229: 	if n.Config().DNS != nil {
230: 		tplData.DNSServers = append(tplData.DNSServers, n.Config().DNS.Servers...)
231: 	}
232: 
233: 	n.prepareSSHPubKeys(tplData)
234: 
235: 	n.setVersionSpecificParams(tplData)
236: 
237: 	return tplData, nil
238: }
239: 
240: // addDefaultConfig adds sros default configuration such as tls certs, gnmi/json-rpc, login-banner,
241: // ssh keys.
242: func (n *sros) addDefaultConfig() error {
243: 	// Prepare all template data
244: 	tplData, err := n.prepareConfigTemplateData()
245: 	if err != nil {
246: 		return err
247: 	}
248: 
249: 	// Select appropriate template
250: 	srosCfgTpl, err := n.selectConfigTemplate(tplData)
251: 	if err != nil {
252: 		return fmt.Errorf("failed to select config template: %w", err)
253: 	}
254: 	log.Debug("Prepare SR OS config template", "template", srosCfgTpl.Name(),
255: 		"node", n.Cfg.LongName,
256: 		"configuration-mode", tplData.ConfigurationMode,
257: 		"node-type", tplData.NodeType,
258: 		"secure-grpc", tplData.IsSecureGrpc,
259: 		"sw-version", tplData.SwVersion)
260: 
261: 	// Execute template
262: 	buf := new(bytes.Buffer)
263: 	err = srosCfgTpl.Execute(buf, tplData)
264: 	if err != nil {
265: 		return err
266: 	}
267: 
268: 	if buf.Len() == 0 {
269: 		log.Warn(
270: 			"Buffer empty, template parsing error",
271: 			"node", n.Cfg.ShortName,
272: 			"template", srosCfgTpl.Name(),
273: 		)
274: 	} else {
275: 		log.Debug("Additional default config parsed",
276: 			"node", n.Cfg.ShortName,
277: 			"template", srosCfgTpl.Name())
278: 		n.startupCliCfg = append(n.startupCliCfg, buf.String()...)
279: 	}
280: 
281: 	return nil
282: }
283: 
284: // applyPartialConfig applies partial configuration to the SR OS.
285: func (n *sros) addPartialConfig() error {
286: 	if n.Cfg.StartupConfig != "" {
287: 		// b holds the configuration to be applied to the node
288: 		b := &bytes.Buffer{}
289: 		// apply partial configs if partial config is used
290: 		if clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM("") {
291: 			log.Info("Adding configuration",
292: 				"node", n.Cfg.LongName,
293: 				"type", "partial",
294: 				"source", n.Cfg.StartupConfig)
295: 
296: 			r, err := os.Open(n.Cfg.StartupConfig)
297: 			if err != nil {
298: 				return err
299: 			}
300: 
301: 			defer r.Close() // skipcq: GO-S2307
302: 
303: 			_, err = io.Copy(b, r)
304: 			if err != nil {
305: 				return err
306: 			}
307: 
308: 			configContent, err := clabutils.SubstituteEnvsAndTemplate(b, n.Cfg)
309: 			if err != nil {
310: 				return err
311: 			}
312: 			if configContent.Len() == 0 {
313: 				log.Warn(
314: 					"Buffer empty, PARTIAL config template parsing error",
315: 					"node",
316: 					n.Cfg.ShortName,
317: 				)
318: 			} else {
319: 				log.Debug("Additional PARTIAL config parsed", "node",
320: 					n.Cfg.ShortName, "partial-config", configContent.String())
321: 				n.startupCliCfg = append(n.startupCliCfg, configContent.String()...)
322: 			}
323: 		} else {
324: 			log.Warn(
325: 				"Passed startup-config option, but it will not have any effect",
326: 				"node",
327: 				n.Cfg.ShortName,
328: 			)
329: 		}
330: 	}
331: 	return nil
332: }
333: 
334: // isConfigClassic reports whether the node is in classic or mixed configuration mode.
335: func (n *sros) isConfigClassic() bool {
336: 	mode := n.kindSpecificCfg().ConfigMode
337: 	return mode == ConfigModeClassic || mode == ConfigModeMixed
338: }
339: 
340: // isFullConfigFile returns true if the config file doesn't contain .partial substring
341: // and the config file is NOT nil (ie. startup config IS defined).
342: // it is intended that the 'c' arg is n.Cfg.StartupConfig.
343: func isFullConfigFile(c string) bool {
344: 	return c != "" && !clabutils.IsPartialConfigFile(c)
345: }

(End of file - total 345 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502e4f88001ej1SIEbv99f2fM",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e41b4001UmFGYE2sTMN9pk",
  "callID": "call_adfd9508f1b04960a508c2d2",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/config.go"
    },
    "output": "<path>/source/head/nodes/sros/config.go</path>\n<type>file</type>\n<content>\n1: package sros\n2: \n3: import (\n4: \t\"bytes\"\n5: \t\"context\"\n6: \t\"fmt\"\n7: \t\"io\"\n8: \t\"os\"\n9: \t\"path/filepath\"\n10: \t\"strings\"\n11: \n12: \tclabutils \"github.com/srl-labs/containerlab/utils\"\n13: \n14: \t\"github.com/beevik/etree\"\n15: \t\"github.com/charmbracelet/log\"\n16: \t\"golang.org/x/mod/semver\"\n17: )\n18: \n19: const (\n20: \tgrpcMDCLIConfig    = `/configure system grpc md-cli admin-state enable`\n21: \tprofileMDCLIConfig = `/configure system security aaa local-profiles profile \"administrative\" grpc rpc-authorization md-cli-session permit`\n22: \ttls13CipherCCM8    = `/configure system security tls server-cipher-list \"clab-all\" tls13-cipher 5 name tls-aes128-ccm8-sha256`\n23: )\n24: \n25: func (n *sros) setVersionSpecificParams(tplData *srosTemplateData) {\n26: \tcurrVersion := tplData.SwVersion.MajorMinorSemverString()\n27: \n28: \tif semver.Compare(currVersion, \"v26.0\") < 0 {\n29: \t\ttplData.GRPCConfig += \"\\n\" + grpcMDCLIConfig\n30: \t\ttplData.SystemConfig += \"\\n\" + profileMDCLIConfig\n31: \n32: \t\tif tplData.IsSecureGrpc {\n33: \t\t\ttplData.GRPCConfig += \"\\n\" + tls13CipherCCM8\n34: \t\t}\n35: \t}\n36: }\n37: \n38: // buildPKIImportXML builds the NETCONF action XML that imports a PEM file into the PKI store.\n39: func buildPKIImportXML(inputURL, outputFile, importType string) string {\n40: \taction := etree.NewElement(\"action\")\n41: \taction.CreateAttr(\"xmlns\", \"urn:ietf:params:xml:ns:yang:1\")\n42: \n43: \tadmin := action.CreateElement(\"admin\")\n44: \tadmin.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:oper-admin\")\n45: \n46: \timportElem := admin.CreateElement(\"system\").\n47: \t\tCreateElement(\"security\").\n48: \t\tCreateElement(\"pki\").\n49: \t\tCreateElement(\"import\")\n50: \n51: \t// Add import parameters\n52: \timportElem.CreateElement(\"input-url\").SetText(inputURL)\n53: \timportElem.CreateElement(\"output-file\").SetText(outputFile)\n54: \timportElem.CreateElement(\"type\").SetText(importType)\n55: \timportElem.CreateElement(\"format\").SetText(\"pem\")\n56: \tvar buf bytes.Buffer\n57: \taction.WriteTo(&buf, &etree.WriteSettings{\n58: \t\tCanonicalText:    false,\n59: \t\tCanonicalAttrVal: false,\n60: \t})\n61: \treturn buf.String()\n62: }\n63: \n64: // buildTLSProfileXML builds the TLS profile configuration XML.\n65: func buildTLSProfileXML() string {\n66: \tconfig := etree.NewElement(\"config\")\n67: \tconfigure := config.CreateElement(\"configure\")\n68: \tconfigure.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:conf\")\n69: \tconfigure.CreateAttr(\"xmlns:nc\", \"urn:ietf:params:xml:ns:netconf:base:1.0\")\n70: \n71: \tcertProfile := configure.CreateElement(\"system\").\n72: \t\tCreateElement(\"security\").\n73: \t\tCreateElement(\"tls\").\n74: \t\tCreateElement(\"cert-profile\")\n75: \n76: \t// Set operation attribute\n77: \tcertProfile.CreateAttr(\"nc:operation\", \"merge\")\n78: \n79: \t// Add profile configuration\n80: \tcertProfile.CreateElement(\"cert-profile-name\").SetText(tlsCertProfileName)\n81: \tcertProfile.CreateElement(\"admin-state\").SetText(\"enable\")\n82: \n83: \tvar buf bytes.Buffer\n84: \tconfig.WriteTo(&buf, &etree.WriteSettings{\n85: \t\tCanonicalText:    false,\n86: \t\tCanonicalAttrVal: false,\n87: \t})\n88: \treturn buf.String()\n89: }\n90: \n91: // createSROSConfigFiles handles config generation for the SR-SIM kind.\n92: // Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).\n93: func (n *sros) createSROSConfigFiles() error {\n94: \t// Get version from image before generating config\n95: \tif n.swVersion == nil {\n96: \t\tctx := context.Background()\n97: \t\tversion, err := n.srosVersionFromImage(ctx)\n98: \t\tif err != nil {\n99: \t\t\tn.swVersion = n.parseVersionString(srosDefaultVersion)\n100: \t\t\tlog.Warn(\"Failed to get SR OS version from image\",\n101: \t\t\t\t\"node\", n.Cfg.ShortName, \"version\", n.swVersion, \"error\", err)\n102: \t\t} else {\n103: \t\t\tn.swVersion = version\n104: \t\t\tlog.Info(\"Retrieved SR OS version from image\",\n105: \t\t\t\t\"node\", n.Cfg.ShortName,\n106: \t\t\t\t\"version\", fmt.Sprintf(\"%s.%s.%s\", version.Major, version.Minor, version.Build))\n107: \t\t}\n108: \t}\n109: \n110: \t// Path pointing to the target config file under configCf3 dir\n111: \tcf3CfgFile := filepath.Join(\n112: \t\tn.Cfg.LabDir,\n113: \t\tn.Cfg.Env[envNokiaSrosSlot],\n114: \t\tconfigCf3,\n115: \t\tstartupCfgName,\n116: \t)\n117: \tisPartial := clabutils.IsPartialConfigFile(n.Cfg.StartupConfig)\n118: \n119: \t// generate config and use that to boot node\n120: \tlog.Debug(\"Reading startup-config\", \"node\", n.Cfg.ShortName, \"startup-config\",\n121: \t\tn.Cfg.StartupConfig, \"isPartial\", isPartial)\n122: \n123: \tstartupConfig, err := n.buildStartupConfig(isPartial)\n124: \tif err != nil {\n125: \t\treturn err\n126: \t}\n127: \n128: \tif startupConfig == \"\" {\n129: \t\tlog.Debug(\n130: \t\t\t\"startup config is empty, skipping startup config file generation\",\n131: \t\t\t\"node\",\n132: \t\t\tn.Cfg.ShortName,\n133: \t\t)\n134: \t\treturn nil\n135: \t}\n136: \n137: \treturn n.GenerateConfig(cf3CfgFile, startupConfig)\n138: }\n139: \n140: // buildStartupConfig returns the full startup config string: either from user file (full config)\n141: // or from default + partial config generation. It does not return a template; the name is\n142: // historical.\n143: func (n *sros) buildStartupConfig(isPartial bool) (string, error) {\n144: \t// User provides full startup config\n145: \tif n.Cfg.StartupConfig != \"\" && !isPartial {\n146: \t\tc, err := os.ReadFile(n.Cfg.StartupConfig)\n147: \t\tif err != nil {\n148: \t\t\treturn \"\", err\n149: \t\t}\n150: \n151: \t\tcBuf, err := clabutils.SubstituteEnvsAndTemplate(bytes.NewReader(c), n.Cfg)\n152: \t\tif err != nil {\n153: \t\t\treturn \"\", err\n154: \t\t}\n155: \t\treturn cBuf.String(), nil\n156: \t}\n157: \n158: \t// Generate default config and optionally add partial config\n159: \tif err := n.addDefaultConfig(); err != nil {\n160: \t\treturn \"\", err\n161: \t}\n162: \tif err := n.addPartialConfig(); err != nil {\n163: \t\treturn \"\", err\n164: \t}\n165: \n166: \treturn string(n.startupCliCfg), nil\n167: }\n168: \n169: // prepareConfigTemplateData prepares all data needed for template selection and execution.\n170: // Service configs are filled from a single table-driven result: variant → getFullSnippetSet(v).\n171: func (n *sros) prepareConfigTemplateData() (*srosTemplateData, error) {\n172: \tb, err := n.banner()\n173: \tif err != nil {\n174: \t\treturn nil, err\n175: \t}\n176: \n177: \tcomponentConfig := \"\"\n178: \tif !isFullConfigFile(n.Cfg.StartupConfig) {\n179: \t\tcomponentConfig = n.generateComponentConfig()\n180: \t} else {\n181: \t\tlog.Debugf(\n182: \t\t\t\"SR-SIM node %q has non-partial startup-config defined, skipping component config gen\",\n183: \t\t\tn.Cfg.LongName,\n184: \t\t)\n185: \t}\n186: \n187: \tv := n.resolveConfigVariant()\n188: \tsnippets := getFullSnippetSet(v)\n189: \tconfigMode := string(v.Mode)\n190: \tif v.ForceClassic {\n191: \t\tlog.Warn(\n192: \t\t\t\"SAR-Hm nodes only support classic configuration mode. Overriding configuration mode to 'classic'\",\n193: \t\t\t\"node\",\n194: \t\t\tn.Cfg.LongName,\n195: \t\t\t\"node-type\",\n196: \t\t\tstrings.ToLower(n.Cfg.NodeType),\n197: \t\t)\n198: \t\tconfigMode = string(ConfigModeClassic)\n199: \t\tn.kindSpecificCfg().ConfigMode = ConfigModeClassic\n200: \t}\n201: \n202: \ttplData := &srosTemplateData{\n203: \t\t// Selection criteria\n204: \t\tNodeType:          strings.ToLower(n.Cfg.NodeType),\n205: \t\tConfigurationMode: configMode,\n206: \t\tSwVersion:         n.swVersion,\n207: \t\tIsSecureGrpc:      *n.Cfg.Certificate.Issue,\n208: \n209: \t\t// Node data\n210: \t\tName:            n.Cfg.ShortName,\n211: \t\tTLSKey:          n.Cfg.TLSKey,\n212: \t\tTLSCert:         n.Cfg.TLSCert,\n213: \t\tTLSAnchor:       n.Cfg.TLSAnchor,\n214: \t\tBanner:          b,\n215: \t\tIFaces:          map[string]tplIFace{},\n216: \t\tMgmtMTU:         0,\n217: \t\tMgmtIPMTU:       n.Runtime.Mgmt().MTU,\n218: \t\tComponentConfig: componentConfig,\n219: \n220: \t\t// Service configs from variant (single source of truth)\n221: \t\tSystemConfig:  snippets.SystemConfig,\n222: \t\tGRPCConfig:    snippets.GRPCConfig,\n223: \t\tSNMPConfig:    snippets.SNMPConfig,\n224: \t\tNetconfConfig: snippets.NetconfConfig,\n225: \t\tLoggingConfig: snippets.LoggingConfig,\n226: \t\tSSHConfig:     snippets.SSHConfig,\n227: \t}\n228: \n229: \tif n.Config().DNS != nil {\n230: \t\ttplData.DNSServers = append(tplData.DNSServers, n.Config().DNS.Servers...)\n231: \t}\n232: \n233: \tn.prepareSSHPubKeys(tplData)\n234: \n235: \tn.setVersionSpecificParams(tplData)\n236: \n237: \treturn tplData, nil\n238: }\n239: \n240: // addDefaultConfig adds sros default configuration such as tls certs, gnmi/json-rpc, login-banner,\n241: // ssh keys.\n242: func (n *sros) addDefaultConfig() error {\n243: \t// Prepare all template data\n244: \ttplData, err := n.prepareConfigTemplateData()\n245: \tif err != nil {\n246: \t\treturn err\n247: \t}\n248: \n249: \t// Select appropriate template\n250: \tsrosCfgTpl, err := n.selectConfigTemplate(tplData)\n251: \tif err != nil {\n252: \t\treturn fmt.Errorf(\"failed to select config template: %w\", err)\n253: \t}\n254: \tlog.Debug(\"Prepare SR OS config template\", \"template\", srosCfgTpl.Name(),\n255: \t\t\"node\", n.Cfg.LongName,\n256: \t\t\"configuration-mode\", tplData.ConfigurationMode,\n257: \t\t\"node-type\", tplData.NodeType,\n258: \t\t\"secure-grpc\", tplData.IsSecureGrpc,\n259: \t\t\"sw-version\", tplData.SwVersion)\n260: \n261: \t// Execute template\n262: \tbuf := new(bytes.Buffer)\n263: \terr = srosCfgTpl.Execute(buf, tplData)\n264: \tif err != nil {\n265: \t\treturn err\n266: \t}\n267: \n268: \tif buf.Len() == 0 {\n269: \t\tlog.Warn(\n270: \t\t\t\"Buffer empty, template parsing error\",\n271: \t\t\t\"node\", n.Cfg.ShortName,\n272: \t\t\t\"template\", srosCfgTpl.Name(),\n273: \t\t)\n274: \t} else {\n275: \t\tlog.Debug(\"Additional default config parsed\",\n276: \t\t\t\"node\", n.Cfg.ShortName,\n277: \t\t\t\"template\", srosCfgTpl.Name())\n278: \t\tn.startupCliCfg = append(n.startupCliCfg, buf.String()...)\n279: \t}\n280: \n281: \treturn nil\n282: }\n283: \n284: // applyPartialConfig applies partial configuration to the SR OS.\n285: func (n *sros) addPartialConfig() error {\n286: \tif n.Cfg.StartupConfig != \"\" {\n287: \t\t// b holds the configuration to be applied to the node\n288: \t\tb := &bytes.Buffer{}\n289: \t\t// apply partial configs if partial config is used\n290: \t\tif clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM(\"\") {\n291: \t\t\tlog.Info(\"Adding configuration\",\n292: \t\t\t\t\"node\", n.Cfg.LongName,\n293: \t\t\t\t\"type\", \"partial\",\n294: \t\t\t\t\"source\", n.Cfg.StartupConfig)\n295: \n296: \t\t\tr, err := os.Open(n.Cfg.StartupConfig)\n297: \t\t\tif err != nil {\n298: \t\t\t\treturn err\n299: \t\t\t}\n300: \n301: \t\t\tdefer r.Close() // skipcq: GO-S2307\n302: \n303: \t\t\t_, err = io.Copy(b, r)\n304: \t\t\tif err != nil {\n305: \t\t\t\treturn err\n306: \t\t\t}\n307: \n308: \t\t\tconfigContent, err := clabutils.SubstituteEnvsAndTemplate(b, n.Cfg)\n309: \t\t\tif err != nil {\n310: \t\t\t\treturn err\n311: \t\t\t}\n312: \t\t\tif configContent.Len() == 0 {\n313: \t\t\t\tlog.Warn(\n314: \t\t\t\t\t\"Buffer empty, PARTIAL config template parsing error\",\n315: \t\t\t\t\t\"node\",\n316: \t\t\t\t\tn.Cfg.ShortName,\n317: \t\t\t\t)\n318: \t\t\t} else {\n319: \t\t\t\tlog.Debug(\"Additional PARTIAL config parsed\", \"node\",\n320: \t\t\t\t\tn.Cfg.ShortName, \"partial-config\", configContent.String())\n321: \t\t\t\tn.startupCliCfg = append(n.startupCliCfg, configContent.String()...)\n322: \t\t\t}\n323: \t\t} else {\n324: \t\t\tlog.Warn(\n325: \t\t\t\t\"Passed startup-config option, but it will not have any effect\",\n326: \t\t\t\t\"node\",\n327: \t\t\t\tn.Cfg.ShortName,\n328: \t\t\t)\n329: \t\t}\n330: \t}\n331: \treturn nil\n332: }\n333: \n334: // isConfigClassic reports whether the node is in classic or mixed configuration mode.\n335: func (n *sros) isConfigClassic() bool {\n336: \tmode := n.kindSpecificCfg().ConfigMode\n337: \treturn mode == ConfigModeClassic || mode == ConfigModeMixed\n338: }\n339: \n340: // isFullConfigFile returns true if the config file doesn't contain .partial substring\n341: // and the config file is NOT nil (ie. startup config IS defined).\n342: // it is intended that the 'c' arg is n.Cfg.StartupConfig.\n343: func isFullConfigFile(c string) bool {\n344: \treturn c != \"\" && !clabutils.IsPartialConfigFile(c)\n345: }\n\n(End of file - total 345 lines)\n</content>",
    "title": "source/head/nodes/sros/config.go",
    "metadata": {
      "preview": "package sros\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n\n\tclabutils \"github.com/srl-labs/containerlab/utils\"\n\n\t\"github.com/beevik/etree\"\n\t\"github.com/charmbracelet/log\"\n\t\"golang.org/x/mod/semver\"\n)\n\nconst (\n\tgrpcMDCLIConfig    = `/configure system grpc md-cli admin-state enable`",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/config.go",
        "text": "package sros\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n\n\tclabutils \"github.com/srl-labs/containerlab/utils\"\n\n\t\"github.com/beevik/etree\"\n\t\"github.com/charmbracelet/log\"\n\t\"golang.org/x/mod/semver\"\n)\n\nconst (\n\tgrpcMDCLIConfig    = `/configure system grpc md-cli admin-state enable`\n\tprofileMDCLIConfig = `/configure system security aaa local-profiles profile \"administrative\" grpc rpc-authorization md-cli-session permit`\n\ttls13CipherCCM8    = `/configure system security tls server-cipher-list \"clab-all\" tls13-cipher 5 name tls-aes128-ccm8-sha256`\n)\n\nfunc (n *sros) setVersionSpecificParams(tplData *srosTemplateData) {\n\tcurrVersion := tplData.SwVersion.MajorMinorSemverString()\n\n\tif semver.Compare(currVersion, \"v26.0\") < 0 {\n\t\ttplData.GRPCConfig += \"\\n\" + grpcMDCLIConfig\n\t\ttplData.SystemConfig += \"\\n\" + profileMDCLIConfig\n\n\t\tif tplData.IsSecureGrpc {\n\t\t\ttplData.GRPCConfig += \"\\n\" + tls13CipherCCM8\n\t\t}\n\t}\n}\n\n// buildPKIImportXML builds the NETCONF action XML that imports a PEM file into the PKI store.\nfunc buildPKIImportXML(inputURL, outputFile, importType string) string {\n\taction := etree.NewElement(\"action\")\n\taction.CreateAttr(\"xmlns\", \"urn:ietf:params:xml:ns:yang:1\")\n\n\tadmin := action.CreateElement(\"admin\")\n\tadmin.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:oper-admin\")\n\n\timportElem := admin.CreateElement(\"system\").\n\t\tCreateElement(\"security\").\n\t\tCreateElement(\"pki\").\n\t\tCreateElement(\"import\")\n\n\t// Add import parameters\n\timportElem.CreateElement(\"input-url\").SetText(inputURL)\n\timportElem.CreateElement(\"output-file\").SetText(outputFile)\n\timportElem.CreateElement(\"type\").SetText(importType)\n\timportElem.CreateElement(\"format\").SetText(\"pem\")\n\tvar buf bytes.Buffer\n\taction.WriteTo(&buf, &etree.WriteSettings{\n\t\tCanonicalText:    false,\n\t\tCanonicalAttrVal: false,\n\t})\n\treturn buf.String()\n}\n\n// buildTLSProfileXML builds the TLS profile configuration XML.\nfunc buildTLSProfileXML() string {\n\tconfig := etree.NewElement(\"config\")\n\tconfigure := config.CreateElement(\"configure\")\n\tconfigure.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:conf\")\n\tconfigure.CreateAttr(\"xmlns:nc\", \"urn:ietf:params:xml:ns:netconf:base:1.0\")\n\n\tcertProfile := configure.CreateElement(\"system\").\n\t\tCreateElement(\"security\").\n\t\tCreateElement(\"tls\").\n\t\tCreateElement(\"cert-profile\")\n\n\t// Set operation attribute\n\tcertProfile.CreateAttr(\"nc:operation\", \"merge\")\n\n\t// Add profile configuration\n\tcertProfile.CreateElement(\"cert-profile-name\").SetText(tlsCertProfileName)\n\tcertProfile.CreateElement(\"admin-state\").SetText(\"enable\")\n\n\tvar buf bytes.Buffer\n\tconfig.WriteTo(&buf, &etree.WriteSettings{\n\t\tCanonicalText:    false,\n\t\tCanonicalAttrVal: false,\n\t})\n\treturn buf.String()\n}\n\n// createSROSConfigFiles handles config generation for the SR-SIM kind.\n// Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).\nfunc (n *sros) createSROSConfigFiles() error {\n\t// Get version from image before generating config\n\tif n.swVersion == nil {\n\t\tctx := context.Background()\n\t\tversion, err := n.srosVersionFromImage(ctx)\n\t\tif err != nil {\n\t\t\tn.swVersion = n.parseVersionString(srosDefaultVersion)\n\t\t\tlog.Warn(\"Failed to get SR OS version from image\",\n\t\t\t\t\"node\", n.Cfg.ShortName, \"version\", n.swVersion, \"error\", err)\n\t\t} else {\n\t\t\tn.swVersion = version\n\t\t\tlog.Info(\"Retrieved SR OS version from image\",\n\t\t\t\t\"node\", n.Cfg.ShortName,\n\t\t\t\t\"version\", fmt.Sprintf(\"%s.%s.%s\", version.Major, version.Minor, version.Build))\n\t\t}\n\t}\n\n\t// Path pointing to the target config file under configCf3 dir\n\tcf3CfgFile := filepath.Join(\n\t\tn.Cfg.LabDir,\n\t\tn.Cfg.Env[envNokiaSrosSlot],\n\t\tconfigCf3,\n\t\tstartupCfgName,\n\t)\n\tisPartial := clabutils.IsPartialConfigFile(n.Cfg.StartupConfig)\n\n\t// generate config and use that to boot node\n\tlog.Debug(\"Reading startup-config\", \"node\", n.Cfg.ShortName, \"startup-config\",\n\t\tn.Cfg.StartupConfig, \"isPartial\", isPartial)\n\n\tstartupConfig, err := n.buildStartupConfig(isPartial)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif startupConfig == \"\" {\n\t\tlog.Debug(\n\t\t\t\"startup config is empty, skipping startup config file generation\",\n\t\t\t\"node\",\n\t\t\tn.Cfg.ShortName,\n\t\t)\n\t\treturn nil\n\t}\n\n\treturn n.GenerateConfig(cf3CfgFile, startupConfig)\n}\n\n// buildStartupConfig returns the full startup config string: either from user file (full config)\n// or from default + partial config generation. It does not return a template; the name is\n// historical.\nfunc (n *sros) buildStartupConfig(isPartial bool) (string, error) {\n\t// User provides full startup config\n\tif n.Cfg.StartupConfig != \"\" && !isPartial {\n\t\tc, err := os.ReadFile(n.Cfg.StartupConfig)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tcBuf, err := clabutils.SubstituteEnvsAndTemplate(bytes.NewReader(c), n.Cfg)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\treturn cBuf.String(), nil\n\t}\n\n\t// Generate default config and optionally add partial config\n\tif err := n.addDefaultConfig(); err != nil {\n\t\treturn \"\", err\n\t}\n\tif err := n.addPartialConfig(); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(n.startupCliCfg), nil\n}\n\n// prepareConfigTemplateData prepares all data needed for template selection and execution.\n// Service configs are filled from a single table-driven result: variant → getFullSnippetSet(v).\nfunc (n *sros) prepareConfigTemplateData() (*srosTemplateData, error) {\n\tb, err := n.banner()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcomponentConfig := \"\"\n\tif !isFullConfigFile(n.Cfg.StartupConfig) {\n\t\tcomponentConfig = n.generateComponentConfig()\n\t} else {\n\t\tlog.Debugf(\n\t\t\t\"SR-SIM node %q has non-partial startup-config defined, skipping component config gen\",\n\t\t\tn.Cfg.LongName,\n\t\t)\n\t}\n\n\tv := n.resolveConfigVariant()\n\tsnippets := getFullSnippetSet(v)\n\tconfigMode := string(v.Mode)\n\tif v.ForceClassic {\n\t\tlog.Warn(\n\t\t\t\"SAR-Hm nodes only support classic configuration mode. Overriding configuration mode to 'classic'\",\n\t\t\t\"node\",\n\t\t\tn.Cfg.LongName,\n\t\t\t\"node-type\",\n\t\t\tstrings.ToLower(n.Cfg.NodeType),\n\t\t)\n\t\tconfigMode = string(ConfigModeClassic)\n\t\tn.kindSpecificCfg().ConfigMode = ConfigModeClassic\n\t}\n\n\ttplData := &srosTemplateData{\n\t\t// Selection criteria\n\t\tNodeType:          strings.ToLower(n.Cfg.NodeType),\n\t\tConfigurationMode: configMode,\n\t\tSwVersion:         n.swVersion,\n\t\tIsSecureGrpc:      *n.Cfg.Certificate.Issue,\n\n\t\t// Node data\n\t\tName:            n.Cfg.ShortName,\n\t\tTLSKey:          n.Cfg.TLSKey,\n\t\tTLSCert:         n.Cfg.TLSCert,\n\t\tTLSAnchor:       n.Cfg.TLSAnchor,\n\t\tBanner:          b,\n\t\tIFaces:          map[string]tplIFace{},\n\t\tMgmtMTU:         0,\n\t\tMgmtIPMTU:       n.Runtime.Mgmt().MTU,\n\t\tComponentConfig: componentConfig,\n\n\t\t// Service configs from variant (single source of truth)\n\t\tSystemConfig:  snippets.SystemConfig,\n\t\tGRPCConfig:    snippets.GRPCConfig,\n\t\tSNMPConfig:    snippets.SNMPConfig,\n\t\tNetconfConfig: snippets.NetconfConfig,\n\t\tLoggingConfig: snippets.LoggingConfig,\n\t\tSSHConfig:     snippets.SSHConfig,\n\t}\n\n\tif n.Config().DNS != nil {\n\t\ttplData.DNSServers = append(tplData.DNSServers, n.Config().DNS.Servers...)\n\t}\n\n\tn.prepareSSHPubKeys(tplData)\n\n\tn.setVersionSpecificParams(tplData)\n\n\treturn tplData, nil\n}\n\n// addDefaultConfig adds sros default configuration such as tls certs, gnmi/json-rpc, login-banner,\n// ssh keys.\nfunc (n *sros) addDefaultConfig() error {\n\t// Prepare all template data\n\ttplData, err := n.prepareConfigTemplateData()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Select appropriate template\n\tsrosCfgTpl, err := n.selectConfigTemplate(tplData)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to select config template: %w\", err)\n\t}\n\tlog.Debug(\"Prepare SR OS config template\", \"template\", srosCfgTpl.Name(),\n\t\t\"node\", n.Cfg.LongName,\n\t\t\"configuration-mode\", tplData.ConfigurationMode,\n\t\t\"node-type\", tplData.NodeType,\n\t\t\"secure-grpc\", tplData.IsSecureGrpc,\n\t\t\"sw-version\", tplData.SwVersion)\n\n\t// Execute template\n\tbuf := new(bytes.Buffer)\n\terr = srosCfgTpl.Execute(buf, tplData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif buf.Len() == 0 {\n\t\tlog.Warn(\n\t\t\t\"Buffer empty, template parsing error\",\n\t\t\t\"node\", n.Cfg.ShortName,\n\t\t\t\"template\", srosCfgTpl.Name(),\n\t\t)\n\t} else {\n\t\tlog.Debug(\"Additional default config parsed\",\n\t\t\t\"node\", n.Cfg.ShortName,\n\t\t\t\"template\", srosCfgTpl.Name())\n\t\tn.startupCliCfg = append(n.startupCliCfg, buf.String()...)\n\t}\n\n\treturn nil\n}\n\n// applyPartialConfig applies partial configuration to the SR OS.\nfunc (n *sros) addPartialConfig() error {\n\tif n.Cfg.StartupConfig != \"\" {\n\t\t// b holds the configuration to be applied to the node\n\t\tb := &bytes.Buffer{}\n\t\t// apply partial configs if partial config is used\n\t\tif clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM(\"\") {\n\t\t\tlog.Info(\"Adding configuration\",\n\t\t\t\t\"node\", n.Cfg.LongName,\n\t\t\t\t\"type\", \"partial\",\n\t\t\t\t\"source\", n.Cfg.StartupConfig)\n\n\t\t\tr, err := os.Open(n.Cfg.StartupConfig)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tdefer r.Close() // skipcq: GO-S2307\n\n\t\t\t_, err = io.Copy(b, r)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tconfigContent, err := clabutils.SubstituteEnvsAndTemplate(b, n.Cfg)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif configContent.Len() == 0 {\n\t\t\t\tlog.Warn(\n\t\t\t\t\t\"Buffer empty, PARTIAL config template parsing error\",\n\t\t\t\t\t\"node\",\n\t\t\t\t\tn.Cfg.ShortName,\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tlog.Debug(\"Additional PARTIAL config parsed\", \"node\",\n\t\t\t\t\tn.Cfg.ShortName, \"partial-config\", configContent.String())\n\t\t\t\tn.startupCliCfg = append(n.startupCliCfg, configContent.String()...)\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Warn(\n\t\t\t\t\"Passed startup-config option, but it will not have any effect\",\n\t\t\t\t\"node\",\n\t\t\t\tn.Cfg.ShortName,\n\t\t\t)\n\t\t}\n\t}\n\treturn nil\n}\n\n// isConfigClassic reports whether the node is in classic or mixed configuration mode.\nfunc (n *sros) isConfigClassic() bool {\n\tmode := n.kindSpecificCfg().ConfigMode\n\treturn mode == ConfigModeClassic || mode == ConfigModeMixed\n}\n\n// isFullConfigFile returns true if the config file doesn't contain .partial substring\n// and the config file is NOT nil (ie. startup config IS defined).\n// it is intended that the 'c' arg is n.Cfg.StartupConfig.\nfunc isFullConfigFile(c string) bool {\n\treturn c != \"\" && !clabutils.IsPartialConfigFile(c)\n}",
        "lineStart": 1,
        "lineEnd": 345,
        "totalLines": 345,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346574733,
      "end": 1792346574740
    }
  }
}
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/netns.go"
}

Output

<path>/source/head/nodes/sros/netns.go</path>
<type>file</type>
<content>
1: package sros
2: 
3: import (
4: 	"context"
5: 	"errors"
6: 	"fmt"
7: 	"maps"
8: 
9: 	clabutils "github.com/srl-labs/containerlab/utils"
10: 
11: 	clabconstants "github.com/srl-labs/containerlab/constants"
12: 	clabnodes "github.com/srl-labs/containerlab/nodes"
13: 	clabruntime "github.com/srl-labs/containerlab/runtime"
14: 	clabtypes "github.com/srl-labs/containerlab/types"
15: 	"github.com/vishvananda/netns"
16: )
17: 
18: // namespaceNode owns the shared network namespace of a components-based SR-SIM node.
19: type namespaceNode struct {
20: 	clabnodes.DefaultNode
21: }
22: 
23: func (n *namespaceNode) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) error {
24: 	n.DefaultNode = *clabnodes.NewDefaultNode(n)
25: 	n.Cfg = cfg
26: 	n.StopSignal = clabtypes.SIGTERM
27: 
28: 	for _, o := range opts {
29: 		o(n)
30: 	}
31: 
32: 	return nil
33: }
34: 
35: func (n *sros) newNetnsConfig() *clabtypes.NodeConfig {
36: 	labels := maps.Clone(n.Cfg.Labels)
37: 
38: 	if labels == nil {
39: 		labels = map[string]string{}
40: 	}
41: 
42: 	shortName := fmt.Sprintf("%s-%s", n.Cfg.ShortName, "netns")
43: 	labels[clabconstants.NodeName] = shortName
44: 
45: 	longName := fmt.Sprintf("%s-%s", n.Cfg.LongName, "netns")
46: 	labels[clabconstants.LongName] = longName
47: 
48: 	labels[clabconstants.NodeType] = "srsim-netns"
49: 	labels[clabconstants.InternalNode] = "true"
50: 
51: 	// this node will be the root node
52: 	labels[clabconstants.RootNodeName] = n.Cfg.ShortName
53: 	labels[clabconstants.RootNodeLongName] = n.Cfg.LongName
54: 
55: 	return &clabtypes.NodeConfig{
56: 		ShortName:             shortName,
57: 		LongName:              longName,
58: 		LabDir:                n.Cfg.LabDir,
59: 		Index:                 n.Cfg.Index,
60: 		Kind:                  n.Cfg.Kind,
61: 		NodeType:              "srsim-netns",
62: 		Image:                 n.Cfg.Image,
63: 		ImagePullPolicy:       n.Cfg.ImagePullPolicy,
64: 		RestartPolicy:         n.Cfg.RestartPolicy,
65: 		Sysctls:               maps.Clone(n.Cfg.Sysctls),
66: 		User:                  "0:0",
67: 		Entrypoint:            "/bin/sh",
68: 		Cmd:                   `-c "trap 'exit 0' TERM INT; sleep infinity & wait $!"`,
69: 		Env:                   map[string]string{},
70: 		PortBindings:          n.Cfg.PortBindings,
71: 		PortSet:               n.Cfg.PortSet,
72: 		NetworkMode:           n.Cfg.NetworkMode,
73: 		MgmtNet:               n.Cfg.MgmtNet,
74: 		MgmtIntf:              n.Cfg.MgmtIntf,
75: 		MgmtIPv4Address:       n.Cfg.MgmtIPv4Address,
76: 		MgmtIPv4AddressAuto:   n.Cfg.MgmtIPv4AddressAuto,
77: 		MgmtIPv4PrefixLength:  n.Cfg.MgmtIPv4PrefixLength,
78: 		MgmtIPv6Address:       n.Cfg.MgmtIPv6Address,
79: 		MgmtIPv6AddressAuto:   n.Cfg.MgmtIPv6AddressAuto,
80: 		MgmtIPv6PrefixLength:  n.Cfg.MgmtIPv6PrefixLength,
81: 		MgmtIPv4Gateway:       n.Cfg.MgmtIPv4Gateway,
82: 		MgmtIPv6Gateway:       n.Cfg.MgmtIPv6Gateway,
83: 		MacAddress:            n.Cfg.MacAddress,
84: 		Aliases:               n.Cfg.Aliases,
85: 		DNS:                   n.Cfg.DNS,
86: 		ExtraHosts:            n.Cfg.ExtraHosts,
87: 		Labels:                labels,
88: 		Runtime:               n.Cfg.Runtime,
89: 		ResultingPortBindings: n.Cfg.ResultingPortBindings,
90: 	}
91: }
92: 
93: func (n *sros) ensureNetnsRunning(ctx context.Context) error {
94: 	switch status := n.netnsNode.GetContainerStatus(ctx); status {
95: 	case clabruntime.Running:
96: 		// The namespace holder intentionally survives regular node lifecycle operations.
97: 	case clabruntime.Created, clabruntime.Stopped:
98: 		if err := n.netnsNode.Start(ctx); err != nil {
99: 			return fmt.Errorf("node %q network namespace container start error: %w",
100: 				n.Cfg.ShortName, err)
101: 		}
102: 	case clabruntime.Paused:
103: 		if err := n.Runtime.UnpauseContainer(ctx, n.netnsNode.Config().LongName); err != nil {
104: 			return fmt.Errorf("node %q network namespace container unpause error: %w",
105: 				n.Cfg.ShortName, err)
106: 		}
107: 	case clabruntime.NotFound:
108: 		return fmt.Errorf(
109: 			"node %q network namespace container %q not found; recreate the node",
110: 			n.Cfg.ShortName, n.netnsNode.Config().LongName,
111: 		)
112: 	default:
113: 		return fmt.Errorf("node %q network namespace container %q is %s",
114: 			n.Cfg.ShortName, n.netnsNode.Config().LongName, status)
115: 	}
116: 
117: 	return nil
118: }
119: 
120: func (n *sros) cleanupParkingNetNS() error {
121: 	name := clabutils.ParkingNetnsName(n.Cfg.LongName)
122: 	if _, err := clabutils.GetNamedNetNS(name); err != nil {
123: 		return nil
124: 	}
125: 
126: 	return netns.DeleteNamed(name)
127: }
128: 
129: // GetNSPath retrieves the Namespace Path.
130: func (n *sros) GetNSPath(ctx context.Context) (string, error) {
131: 	if n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == "") {
132: 		return n.DefaultNode.GetNSPath(ctx)
133: 	} else if n.isDistributedCardNode() {
134: 		return n.Runtime.GetNSPath(ctx, n.rootCtrName)
135: 	}
136: 	return n.netnsNode.GetNSPath(ctx)
137: }
138: 
139: // DeleteNetnsSymlink deletes the symlink file created for the container netns.
140: func (n *sros) DeleteNetnsSymlink() error {
141: 	var errs []error
142: 
143: 	// if it is the base node, then we need to delete the symlink for all the components.
144: 	if n.isDistributedBaseNode() {
145: 		for _, componentNode := range n.componentNodes {
146: 			errs = append(errs, componentNode.DeleteNetnsSymlink())
147: 		}
148: 		if n.netnsNode != nil {
149: 			errs = append(errs, n.netnsNode.DeleteNetnsSymlink())
150: 		}
151: 		errs = append(errs, clabutils.DeleteNetnsSymlink(n.Cfg.LongName))
152: 	}
153: 
154: 	errs = append(errs, n.DefaultNode.DeleteNetnsSymlink(), n.cleanupParkingNetNS())
155: 
156: 	return errors.Join(errs...)
157: }

(End of file - total 157 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502e4fbe0016Zlh1lYWw3wuZX",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e41b4001UmFGYE2sTMN9pk",
  "callID": "call_1917e861b9184248b966232a",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/netns.go"
    },
    "output": "<path>/source/head/nodes/sros/netns.go</path>\n<type>file</type>\n<content>\n1: package sros\n2: \n3: import (\n4: \t\"context\"\n5: \t\"errors\"\n6: \t\"fmt\"\n7: \t\"maps\"\n8: \n9: \tclabutils \"github.com/srl-labs/containerlab/utils\"\n10: \n11: \tclabconstants \"github.com/srl-labs/containerlab/constants\"\n12: \tclabnodes \"github.com/srl-labs/containerlab/nodes\"\n13: \tclabruntime \"github.com/srl-labs/containerlab/runtime\"\n14: \tclabtypes \"github.com/srl-labs/containerlab/types\"\n15: \t\"github.com/vishvananda/netns\"\n16: )\n17: \n18: // namespaceNode owns the shared network namespace of a components-based SR-SIM node.\n19: type namespaceNode struct {\n20: \tclabnodes.DefaultNode\n21: }\n22: \n23: func (n *namespaceNode) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) error {\n24: \tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n25: \tn.Cfg = cfg\n26: \tn.StopSignal = clabtypes.SIGTERM\n27: \n28: \tfor _, o := range opts {\n29: \t\to(n)\n30: \t}\n31: \n32: \treturn nil\n33: }\n34: \n35: func (n *sros) newNetnsConfig() *clabtypes.NodeConfig {\n36: \tlabels := maps.Clone(n.Cfg.Labels)\n37: \n38: \tif labels == nil {\n39: \t\tlabels = map[string]string{}\n40: \t}\n41: \n42: \tshortName := fmt.Sprintf(\"%s-%s\", n.Cfg.ShortName, \"netns\")\n43: \tlabels[clabconstants.NodeName] = shortName\n44: \n45: \tlongName := fmt.Sprintf(\"%s-%s\", n.Cfg.LongName, \"netns\")\n46: \tlabels[clabconstants.LongName] = longName\n47: \n48: \tlabels[clabconstants.NodeType] = \"srsim-netns\"\n49: \tlabels[clabconstants.InternalNode] = \"true\"\n50: \n51: \t// this node will be the root node\n52: \tlabels[clabconstants.RootNodeName] = n.Cfg.ShortName\n53: \tlabels[clabconstants.RootNodeLongName] = n.Cfg.LongName\n54: \n55: \treturn &clabtypes.NodeConfig{\n56: \t\tShortName:             shortName,\n57: \t\tLongName:              longName,\n58: \t\tLabDir:                n.Cfg.LabDir,\n59: \t\tIndex:                 n.Cfg.Index,\n60: \t\tKind:                  n.Cfg.Kind,\n61: \t\tNodeType:              \"srsim-netns\",\n62: \t\tImage:                 n.Cfg.Image,\n63: \t\tImagePullPolicy:       n.Cfg.ImagePullPolicy,\n64: \t\tRestartPolicy:         n.Cfg.RestartPolicy,\n65: \t\tSysctls:               maps.Clone(n.Cfg.Sysctls),\n66: \t\tUser:                  \"0:0\",\n67: \t\tEntrypoint:            \"/bin/sh\",\n68: \t\tCmd:                   `-c \"trap 'exit 0' TERM INT; sleep infinity & wait $!\"`,\n69: \t\tEnv:                   map[string]string{},\n70: \t\tPortBindings:          n.Cfg.PortBindings,\n71: \t\tPortSet:               n.Cfg.PortSet,\n72: \t\tNetworkMode:           n.Cfg.NetworkMode,\n73: \t\tMgmtNet:               n.Cfg.MgmtNet,\n74: \t\tMgmtIntf:              n.Cfg.MgmtIntf,\n75: \t\tMgmtIPv4Address:       n.Cfg.MgmtIPv4Address,\n76: \t\tMgmtIPv4AddressAuto:   n.Cfg.MgmtIPv4AddressAuto,\n77: \t\tMgmtIPv4PrefixLength:  n.Cfg.MgmtIPv4PrefixLength,\n78: \t\tMgmtIPv6Address:       n.Cfg.MgmtIPv6Address,\n79: \t\tMgmtIPv6AddressAuto:   n.Cfg.MgmtIPv6AddressAuto,\n80: \t\tMgmtIPv6PrefixLength:  n.Cfg.MgmtIPv6PrefixLength,\n81: \t\tMgmtIPv4Gateway:       n.Cfg.MgmtIPv4Gateway,\n82: \t\tMgmtIPv6Gateway:       n.Cfg.MgmtIPv6Gateway,\n83: \t\tMacAddress:            n.Cfg.MacAddress,\n84: \t\tAliases:               n.Cfg.Aliases,\n85: \t\tDNS:                   n.Cfg.DNS,\n86: \t\tExtraHosts:            n.Cfg.ExtraHosts,\n87: \t\tLabels:                labels,\n88: \t\tRuntime:               n.Cfg.Runtime,\n89: \t\tResultingPortBindings: n.Cfg.ResultingPortBindings,\n90: \t}\n91: }\n92: \n93: func (n *sros) ensureNetnsRunning(ctx context.Context) error {\n94: \tswitch status := n.netnsNode.GetContainerStatus(ctx); status {\n95: \tcase clabruntime.Running:\n96: \t\t// The namespace holder intentionally survives regular node lifecycle operations.\n97: \tcase clabruntime.Created, clabruntime.Stopped:\n98: \t\tif err := n.netnsNode.Start(ctx); err != nil {\n99: \t\t\treturn fmt.Errorf(\"node %q network namespace container start error: %w\",\n100: \t\t\t\tn.Cfg.ShortName, err)\n101: \t\t}\n102: \tcase clabruntime.Paused:\n103: \t\tif err := n.Runtime.UnpauseContainer(ctx, n.netnsNode.Config().LongName); err != nil {\n104: \t\t\treturn fmt.Errorf(\"node %q network namespace container unpause error: %w\",\n105: \t\t\t\tn.Cfg.ShortName, err)\n106: \t\t}\n107: \tcase clabruntime.NotFound:\n108: \t\treturn fmt.Errorf(\n109: \t\t\t\"node %q network namespace container %q not found; recreate the node\",\n110: \t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName,\n111: \t\t)\n112: \tdefault:\n113: \t\treturn fmt.Errorf(\"node %q network namespace container %q is %s\",\n114: \t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName, status)\n115: \t}\n116: \n117: \treturn nil\n118: }\n119: \n120: func (n *sros) cleanupParkingNetNS() error {\n121: \tname := clabutils.ParkingNetnsName(n.Cfg.LongName)\n122: \tif _, err := clabutils.GetNamedNetNS(name); err != nil {\n123: \t\treturn nil\n124: \t}\n125: \n126: \treturn netns.DeleteNamed(name)\n127: }\n128: \n129: // GetNSPath retrieves the Namespace Path.\n130: func (n *sros) GetNSPath(ctx context.Context) (string, error) {\n131: \tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == \"\") {\n132: \t\treturn n.DefaultNode.GetNSPath(ctx)\n133: \t} else if n.isDistributedCardNode() {\n134: \t\treturn n.Runtime.GetNSPath(ctx, n.rootCtrName)\n135: \t}\n136: \treturn n.netnsNode.GetNSPath(ctx)\n137: }\n138: \n139: // DeleteNetnsSymlink deletes the symlink file created for the container netns.\n140: func (n *sros) DeleteNetnsSymlink() error {\n141: \tvar errs []error\n142: \n143: \t// if it is the base node, then we need to delete the symlink for all the components.\n144: \tif n.isDistributedBaseNode() {\n145: \t\tfor _, componentNode := range n.componentNodes {\n146: \t\t\terrs = append(errs, componentNode.DeleteNetnsSymlink())\n147: \t\t}\n148: \t\tif n.netnsNode != nil {\n149: \t\t\terrs = append(errs, n.netnsNode.DeleteNetnsSymlink())\n150: \t\t}\n151: \t\terrs = append(errs, clabutils.DeleteNetnsSymlink(n.Cfg.LongName))\n152: \t}\n153: \n154: \terrs = append(errs, n.DefaultNode.DeleteNetnsSymlink(), n.cleanupParkingNetNS())\n155: \n156: \treturn errors.Join(errs...)\n157: }\n\n(End of file - total 157 lines)\n</content>",
    "title": "source/head/nodes/sros/netns.go",
    "metadata": {
      "preview": "package sros\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"maps\"\n\n\tclabutils \"github.com/srl-labs/containerlab/utils\"\n\n\tclabconstants \"github.com/srl-labs/containerlab/constants\"\n\tclabnodes \"github.com/srl-labs/containerlab/nodes\"\n\tclabruntime \"github.com/srl-labs/containerlab/runtime\"\n\tclabtypes \"github.com/srl-labs/containerlab/types\"\n\t\"github.com/vishvananda/netns\"\n)\n\n// namespaceNode owns the shared network namespace of a components-based SR-SIM node.\ntype namespaceNode struct {\n\tclabnodes.DefaultNode",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/netns.go",
        "text": "package sros\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"maps\"\n\n\tclabutils \"github.com/srl-labs/containerlab/utils\"\n\n\tclabconstants \"github.com/srl-labs/containerlab/constants\"\n\tclabnodes \"github.com/srl-labs/containerlab/nodes\"\n\tclabruntime \"github.com/srl-labs/containerlab/runtime\"\n\tclabtypes \"github.com/srl-labs/containerlab/types\"\n\t\"github.com/vishvananda/netns\"\n)\n\n// namespaceNode owns the shared network namespace of a components-based SR-SIM node.\ntype namespaceNode struct {\n\tclabnodes.DefaultNode\n}\n\nfunc (n *namespaceNode) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) error {\n\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n\tn.Cfg = cfg\n\tn.StopSignal = clabtypes.SIGTERM\n\n\tfor _, o := range opts {\n\t\to(n)\n\t}\n\n\treturn nil\n}\n\nfunc (n *sros) newNetnsConfig() *clabtypes.NodeConfig {\n\tlabels := maps.Clone(n.Cfg.Labels)\n\n\tif labels == nil {\n\t\tlabels = map[string]string{}\n\t}\n\n\tshortName := fmt.Sprintf(\"%s-%s\", n.Cfg.ShortName, \"netns\")\n\tlabels[clabconstants.NodeName] = shortName\n\n\tlongName := fmt.Sprintf(\"%s-%s\", n.Cfg.LongName, \"netns\")\n\tlabels[clabconstants.LongName] = longName\n\n\tlabels[clabconstants.NodeType] = \"srsim-netns\"\n\tlabels[clabconstants.InternalNode] = \"true\"\n\n\t// this node will be the root node\n\tlabels[clabconstants.RootNodeName] = n.Cfg.ShortName\n\tlabels[clabconstants.RootNodeLongName] = n.Cfg.LongName\n\n\treturn &clabtypes.NodeConfig{\n\t\tShortName:             shortName,\n\t\tLongName:              longName,\n\t\tLabDir:                n.Cfg.LabDir,\n\t\tIndex:                 n.Cfg.Index,\n\t\tKind:                  n.Cfg.Kind,\n\t\tNodeType:              \"srsim-netns\",\n\t\tImage:                 n.Cfg.Image,\n\t\tImagePullPolicy:       n.Cfg.ImagePullPolicy,\n\t\tRestartPolicy:         n.Cfg.RestartPolicy,\n\t\tSysctls:               maps.Clone(n.Cfg.Sysctls),\n\t\tUser:                  \"0:0\",\n\t\tEntrypoint:            \"/bin/sh\",\n\t\tCmd:                   `-c \"trap 'exit 0' TERM INT; sleep infinity & wait $!\"`,\n\t\tEnv:                   map[string]string{},\n\t\tPortBindings:          n.Cfg.PortBindings,\n\t\tPortSet:               n.Cfg.PortSet,\n\t\tNetworkMode:           n.Cfg.NetworkMode,\n\t\tMgmtNet:               n.Cfg.MgmtNet,\n\t\tMgmtIntf:              n.Cfg.MgmtIntf,\n\t\tMgmtIPv4Address:       n.Cfg.MgmtIPv4Address,\n\t\tMgmtIPv4AddressAuto:   n.Cfg.MgmtIPv4AddressAuto,\n\t\tMgmtIPv4PrefixLength:  n.Cfg.MgmtIPv4PrefixLength,\n\t\tMgmtIPv6Address:       n.Cfg.MgmtIPv6Address,\n\t\tMgmtIPv6AddressAuto:   n.Cfg.MgmtIPv6AddressAuto,\n\t\tMgmtIPv6PrefixLength:  n.Cfg.MgmtIPv6PrefixLength,\n\t\tMgmtIPv4Gateway:       n.Cfg.MgmtIPv4Gateway,\n\t\tMgmtIPv6Gateway:       n.Cfg.MgmtIPv6Gateway,\n\t\tMacAddress:            n.Cfg.MacAddress,\n\t\tAliases:               n.Cfg.Aliases,\n\t\tDNS:                   n.Cfg.DNS,\n\t\tExtraHosts:            n.Cfg.ExtraHosts,\n\t\tLabels:                labels,\n\t\tRuntime:               n.Cfg.Runtime,\n\t\tResultingPortBindings: n.Cfg.ResultingPortBindings,\n\t}\n}\n\nfunc (n *sros) ensureNetnsRunning(ctx context.Context) error {\n\tswitch status := n.netnsNode.GetContainerStatus(ctx); status {\n\tcase clabruntime.Running:\n\t\t// The namespace holder intentionally survives regular node lifecycle operations.\n\tcase clabruntime.Created, clabruntime.Stopped:\n\t\tif err := n.netnsNode.Start(ctx); err != nil {\n\t\t\treturn fmt.Errorf(\"node %q network namespace container start error: %w\",\n\t\t\t\tn.Cfg.ShortName, err)\n\t\t}\n\tcase clabruntime.Paused:\n\t\tif err := n.Runtime.UnpauseContainer(ctx, n.netnsNode.Config().LongName); err != nil {\n\t\t\treturn fmt.Errorf(\"node %q network namespace container unpause error: %w\",\n\t\t\t\tn.Cfg.ShortName, err)\n\t\t}\n\tcase clabruntime.NotFound:\n\t\treturn fmt.Errorf(\n\t\t\t\"node %q network namespace container %q not found; recreate the node\",\n\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName,\n\t\t)\n\tdefault:\n\t\treturn fmt.Errorf(\"node %q network namespace container %q is %s\",\n\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName, status)\n\t}\n\n\treturn nil\n}\n\nfunc (n *sros) cleanupParkingNetNS() error {\n\tname := clabutils.ParkingNetnsName(n.Cfg.LongName)\n\tif _, err := clabutils.GetNamedNetNS(name); err != nil {\n\t\treturn nil\n\t}\n\n\treturn netns.DeleteNamed(name)\n}\n\n// GetNSPath retrieves the Namespace Path.\nfunc (n *sros) GetNSPath(ctx context.Context) (string, error) {\n\tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == \"\") {\n\t\treturn n.DefaultNode.GetNSPath(ctx)\n\t} else if n.isDistributedCardNode() {\n\t\treturn n.Runtime.GetNSPath(ctx, n.rootCtrName)\n\t}\n\treturn n.netnsNode.GetNSPath(ctx)\n}\n\n// DeleteNetnsSymlink deletes the symlink file created for the container netns.\nfunc (n *sros) DeleteNetnsSymlink() error {\n\tvar errs []error\n\n\t// if it is the base node, then we need to delete the symlink for all the components.\n\tif n.isDistributedBaseNode() {\n\t\tfor _, componentNode := range n.componentNodes {\n\t\t\terrs = append(errs, componentNode.DeleteNetnsSymlink())\n\t\t}\n\t\tif n.netnsNode != nil {\n\t\t\terrs = append(errs, n.netnsNode.DeleteNetnsSymlink())\n\t\t}\n\t\terrs = append(errs, clabutils.DeleteNetnsSymlink(n.Cfg.LongName))\n\t}\n\n\terrs = append(errs, n.DefaultNode.DeleteNetnsSymlink(), n.cleanupParkingNetNS())\n\n\treturn errors.Join(errs...)\n}",
        "lineStart": 1,
        "lineEnd": 157,
        "totalLines": 157,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346574788,
      "end": 1792346574803
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502e4fd5001b8aEZgRvJJKrS0",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e41b4001UmFGYE2sTMN9pk",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 14962,
    "input": 14876,
    "output": 46,
    "reasoning": 40,
    "cache": {
      "read": 0,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502e41b4001UmFGYE2sTMN9pk",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346571188,
    "completed": 1792346574808
  },
  "parentID": "msg_1502e41aa001XEn2l1GdfLHjHR",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 14962,
    "input": 14876,
    "output": 46,
    "reasoning": 40,
    "cache": {
      "read": 0,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 13
step-start
{
  "type": "step-start",
  "id": "prt_1502e567e001cuJxY95m2p7dEx",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e4fde001N94er0X5VXLsDq"
}
Reasoning
Note `integratedComponentOverride` uses `n.Cfg.Env[envNokiaSrosSlot]` — but `hardwareEnv()` prefers `n.userEnv`. Here it reads from `n.Cfg.Env` directly rather than `hardwareEnv()`. Is that inconsistent? envNokiaSrosSlot is set during Init presumably (slot identification, applyHardwareEnv leaves it unchanged since it identifies the container). If userEnv contains NOKIA_SROS_SLOT... users wouldn't set that. Probably fine.

Also `generateIntegratedComponentConfig` reads `n.Cfg.Env[envNokiaSrosCard]` but `hardwareEnv()` may have the override in `userEnv` — meaning `NOKIA_SROS_CARD` set in topology `env:` — wait, where does userEnv come from? Let me check sros.go for userEnv assignment. If user's env contains NOKIA_SROS_CARD, `hardwareEnv()` returns userEnv but the integrated skip check reads `n.Cfg.Env`. Need to check how userEnv is populated and whether Cfg.Env includes it.

Let me read power.go and sros.go (head).
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/power.go"
}

Output

<path>/source/head/nodes/sros/power.go</path>
<type>file</type>
<content>
1: package sros
2: 
3: import (
4: 	"fmt"
5: 	"strings"
6: )
7: 
8: const (
9: 	defaultSrosPowerType       = "dc"
10: 	defaultSrosPowerModuleType = "ps-a-dc-6000"
11: )
12: 
13: // SrosPower defines power supply configuration for a given node type.
14: type SrosPower struct {
15: 	Modules any
16: 	Shelves int
17: }
18: 
19: // key = type.
20: var srosPowerConfig = map[string]SrosPower{
21: 	"sr-1s": {
22: 		Modules: map[string]int{
23: 			"ac/hv": 3,
24: 			"dc":    4,
25: 		},
26: 	},
27: 	"sr-1se": {
28: 		Modules: map[string]int{
29: 			"ac/hv": 3,
30: 			"dc":    4,
31: 		},
32: 	},
33: 	"sr-2s": {
34: 		Modules: map[string]int{
35: 			"ac/hv": 3,
36: 			"dc":    4,
37: 		},
38: 	},
39: 	"sr-2se": {
40: 		Modules: map[string]int{
41: 			"ac/hv": 3,
42: 			"dc":    4,
43: 		},
44: 	},
45: 	"sr-7s": {
46: 		Modules: 10,
47: 		Shelves: 2,
48: 	},
49: 	"sr-14s": {
50: 		Modules: 10,
51: 		Shelves: 2,
52: 	},
53: }
54: 
55: func (n *sros) generatePowerConfig() string {
56: 	nodeType := strings.ToLower(n.Cfg.NodeType)
57: 	if _, ok := srosPowerConfig[nodeType]; !ok {
58: 		return ""
59: 	}
60: 
61: 	cfg := srosPowerConfig[nodeType]
62: 
63: 	shelves := max(cfg.Shelves, 1)
64: 
65: 	modules := 0
66: 	switch m := cfg.Modules.(type) {
67: 	case map[string]int:
68: 		modules = m[defaultSrosPowerType]
69: 	case int:
70: 		modules = m
71: 	}
72: 
73: 	shelfType := fmt.Sprintf("ps-a%d-shelf-dc", modules)
74: 
75: 	var config strings.Builder
76: 
77: 	for s := 1; s <= shelves; s++ {
78: 		config.WriteString(
79: 			fmt.Sprintf(
80: 				"/configure chassis router chassis-number 1 power-shelf %d power-shelf-type %s\n",
81: 				s, shelfType))
82: 
83: 		for m := 1; m <= modules; m++ {
84: 			config.WriteString(
85: 				fmt.Sprintf(
86: 					"/configure chassis router chassis-number 1 power-shelf %d power-module %d power-module-type %s\n",
87: 					s,
88: 					m,
89: 					defaultSrosPowerModuleType,
90: 				))
91: 		}
92: 	}
93: 
94: 	return config.String()
95: }

(End of file - total 95 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502e5f2e0019yrwqpeS5GWM3B",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e4fde001N94er0X5VXLsDq",
  "callID": "call_1639f69e302e48bda3a19a8f",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/power.go"
    },
    "output": "<path>/source/head/nodes/sros/power.go</path>\n<type>file</type>\n<content>\n1: package sros\n2: \n3: import (\n4: \t\"fmt\"\n5: \t\"strings\"\n6: )\n7: \n8: const (\n9: \tdefaultSrosPowerType       = \"dc\"\n10: \tdefaultSrosPowerModuleType = \"ps-a-dc-6000\"\n11: )\n12: \n13: // SrosPower defines power supply configuration for a given node type.\n14: type SrosPower struct {\n15: \tModules any\n16: \tShelves int\n17: }\n18: \n19: // key = type.\n20: var srosPowerConfig = map[string]SrosPower{\n21: \t\"sr-1s\": {\n22: \t\tModules: map[string]int{\n23: \t\t\t\"ac/hv\": 3,\n24: \t\t\t\"dc\":    4,\n25: \t\t},\n26: \t},\n27: \t\"sr-1se\": {\n28: \t\tModules: map[string]int{\n29: \t\t\t\"ac/hv\": 3,\n30: \t\t\t\"dc\":    4,\n31: \t\t},\n32: \t},\n33: \t\"sr-2s\": {\n34: \t\tModules: map[string]int{\n35: \t\t\t\"ac/hv\": 3,\n36: \t\t\t\"dc\":    4,\n37: \t\t},\n38: \t},\n39: \t\"sr-2se\": {\n40: \t\tModules: map[string]int{\n41: \t\t\t\"ac/hv\": 3,\n42: \t\t\t\"dc\":    4,\n43: \t\t},\n44: \t},\n45: \t\"sr-7s\": {\n46: \t\tModules: 10,\n47: \t\tShelves: 2,\n48: \t},\n49: \t\"sr-14s\": {\n50: \t\tModules: 10,\n51: \t\tShelves: 2,\n52: \t},\n53: }\n54: \n55: func (n *sros) generatePowerConfig() string {\n56: \tnodeType := strings.ToLower(n.Cfg.NodeType)\n57: \tif _, ok := srosPowerConfig[nodeType]; !ok {\n58: \t\treturn \"\"\n59: \t}\n60: \n61: \tcfg := srosPowerConfig[nodeType]\n62: \n63: \tshelves := max(cfg.Shelves, 1)\n64: \n65: \tmodules := 0\n66: \tswitch m := cfg.Modules.(type) {\n67: \tcase map[string]int:\n68: \t\tmodules = m[defaultSrosPowerType]\n69: \tcase int:\n70: \t\tmodules = m\n71: \t}\n72: \n73: \tshelfType := fmt.Sprintf(\"ps-a%d-shelf-dc\", modules)\n74: \n75: \tvar config strings.Builder\n76: \n77: \tfor s := 1; s <= shelves; s++ {\n78: \t\tconfig.WriteString(\n79: \t\t\tfmt.Sprintf(\n80: \t\t\t\t\"/configure chassis router chassis-number 1 power-shelf %d power-shelf-type %s\\n\",\n81: \t\t\t\ts, shelfType))\n82: \n83: \t\tfor m := 1; m <= modules; m++ {\n84: \t\t\tconfig.WriteString(\n85: \t\t\t\tfmt.Sprintf(\n86: \t\t\t\t\t\"/configure chassis router chassis-number 1 power-shelf %d power-module %d power-module-type %s\\n\",\n87: \t\t\t\t\ts,\n88: \t\t\t\t\tm,\n89: \t\t\t\t\tdefaultSrosPowerModuleType,\n90: \t\t\t\t))\n91: \t\t}\n92: \t}\n93: \n94: \treturn config.String()\n95: }\n\n(End of file - total 95 lines)\n</content>",
    "title": "source/head/nodes/sros/power.go",
    "metadata": {
      "preview": "package sros\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n)\n\nconst (\n\tdefaultSrosPowerType       = \"dc\"\n\tdefaultSrosPowerModuleType = \"ps-a-dc-6000\"\n)\n\n// SrosPower defines power supply configuration for a given node type.\ntype SrosPower struct {\n\tModules any\n\tShelves int\n}\n\n// key = type.\nvar srosPowerConfig = map[string]SrosPower{",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/power.go",
        "text": "package sros\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n)\n\nconst (\n\tdefaultSrosPowerType       = \"dc\"\n\tdefaultSrosPowerModuleType = \"ps-a-dc-6000\"\n)\n\n// SrosPower defines power supply configuration for a given node type.\ntype SrosPower struct {\n\tModules any\n\tShelves int\n}\n\n// key = type.\nvar srosPowerConfig = map[string]SrosPower{\n\t\"sr-1s\": {\n\t\tModules: map[string]int{\n\t\t\t\"ac/hv\": 3,\n\t\t\t\"dc\":    4,\n\t\t},\n\t},\n\t\"sr-1se\": {\n\t\tModules: map[string]int{\n\t\t\t\"ac/hv\": 3,\n\t\t\t\"dc\":    4,\n\t\t},\n\t},\n\t\"sr-2s\": {\n\t\tModules: map[string]int{\n\t\t\t\"ac/hv\": 3,\n\t\t\t\"dc\":    4,\n\t\t},\n\t},\n\t\"sr-2se\": {\n\t\tModules: map[string]int{\n\t\t\t\"ac/hv\": 3,\n\t\t\t\"dc\":    4,\n\t\t},\n\t},\n\t\"sr-7s\": {\n\t\tModules: 10,\n\t\tShelves: 2,\n\t},\n\t\"sr-14s\": {\n\t\tModules: 10,\n\t\tShelves: 2,\n\t},\n}\n\nfunc (n *sros) generatePowerConfig() string {\n\tnodeType := strings.ToLower(n.Cfg.NodeType)\n\tif _, ok := srosPowerConfig[nodeType]; !ok {\n\t\treturn \"\"\n\t}\n\n\tcfg := srosPowerConfig[nodeType]\n\n\tshelves := max(cfg.Shelves, 1)\n\n\tmodules := 0\n\tswitch m := cfg.Modules.(type) {\n\tcase map[string]int:\n\t\tmodules = m[defaultSrosPowerType]\n\tcase int:\n\t\tmodules = m\n\t}\n\n\tshelfType := fmt.Sprintf(\"ps-a%d-shelf-dc\", modules)\n\n\tvar config strings.Builder\n\n\tfor s := 1; s <= shelves; s++ {\n\t\tconfig.WriteString(\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"/configure chassis router chassis-number 1 power-shelf %d power-shelf-type %s\\n\",\n\t\t\t\ts, shelfType))\n\n\t\tfor m := 1; m <= modules; m++ {\n\t\t\tconfig.WriteString(\n\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\"/configure chassis router chassis-number 1 power-shelf %d power-module %d power-module-type %s\\n\",\n\t\t\t\t\ts,\n\t\t\t\t\tm,\n\t\t\t\t\tdefaultSrosPowerModuleType,\n\t\t\t\t))\n\t\t}\n\t}\n\n\treturn config.String()\n}",
        "lineStart": 1,
        "lineEnd": 95,
        "totalLines": 95,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346578738,
      "end": 1792346578744
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502e5f3a001JGDjSqUcvTysta",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e4fde001N94er0X5VXLsDq",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 20827,
    "input": 5726,
    "output": 17,
    "reasoning": 236,
    "cache": {
      "read": 14848,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502e4fde001N94er0X5VXLsDq",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346574814,
    "completed": 1792346578749
  },
  "parentID": "msg_1502e41aa001XEn2l1GdfLHjHR",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 20827,
    "input": 5726,
    "output": 17,
    "reasoning": 236,
    "cache": {
      "read": 14848,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 14
step-start
{
  "type": "step-start",
  "id": "prt_1502e6583001s0f3PJWIpP5C1y",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e5f42001e10roJstImV7H5"
}
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/sros.go"
}

Output

<path>/source/head/nodes/sros/sros.go</path>
<type>file</type>
<content>
1: // Copyright 2025 Nokia
2: // Licensed under the BSD 3-Clause License.
3: // SPDX-License-Identifier: BSD-3-Clause
4: 
5: package sros
6: 
7: import (
8: 	"bufio"
9: 	"bytes"
10: 	"context"
11: 	"errors"
12: 	"fmt"
13: 	"io"
14: 	"maps"
15: 	"net"
16: 	"os"
17: 	"path"
18: 	"path/filepath"
19: 	"reflect"
20: 	"regexp"
21: 	"slices"
22: 	"strconv"
23: 	"strings"
24: 	"time"
25: 
26: 	"github.com/brunoga/deep"
27: 	"github.com/charmbracelet/log"
28: 	"github.com/scrapli/scrapligo/driver/netconf"
29: 	"github.com/scrapli/scrapligo/driver/opoptions"
30: 
31: 	"github.com/scrapli/scrapligo/response"
32: 
33: 	clabconstants "github.com/srl-labs/containerlab/constants"
34: 	clabexec "github.com/srl-labs/containerlab/exec"
35: 	clablinks "github.com/srl-labs/containerlab/links"
36: 	clabnetconf "github.com/srl-labs/containerlab/netconf"
37: 	clabnodes "github.com/srl-labs/containerlab/nodes"
38: 	clabnodesstate "github.com/srl-labs/containerlab/nodes/state"
39: 	clabruntime "github.com/srl-labs/containerlab/runtime"
40: 	clabtypes "github.com/srl-labs/containerlab/types"
41: 	clabutils "github.com/srl-labs/containerlab/utils"
42: 	"golang.org/x/crypto/ssh"
43: )
44: 
45: const (
46: 	SrosDefaultType = "SR-1" // default sros node type
47: 
48: 	readyTimeout   = time.Minute * 1 // max wait time for node to boot
49: 	tcpDialTimeout = time.Second * 1
50: 
51: 	generateable     = true
52: 	generateIfFormat = "%d/%d/%d"
53: 
54: 	slotAName = "A"
55: 	slotBName = "B"
56: 
57: 	standaloneSlotName = slotAName
58: 
59: 	retryTimer = 1 * time.Second
60: 
61: 	scrapliPlatformName        = "nokia_sros"
62: 	scrapliPlatformNameClassic = "nokia_sros_classic"
63: 	configCf3                  = "config/cf3"
64: 	configCf2                  = "config/cf2"
65: 	configCf1                  = "config/cf1"
66: 	startupCfgName             = "config.cfg"
67: 	tlsKeyFile                 = "node.key"
68: 	tlsCertFile                = "node.crt"
69: 	tlsCertProfileName         = "clab-grpc-certs"
70: 
71: 	// SR-SIM ENV VARS.
72: 	envNokiaSrosSlot          = "NOKIA_SROS_SLOT"
73: 	envNokiaSrosChassis       = "NOKIA_SROS_CHASSIS"
74: 	envNokiaSrosSystemBaseMac = "NOKIA_SROS_SYSTEM_BASE_MAC"
75: 	envNokiaSrosCard          = "NOKIA_SROS_CARD"
76: 	envNokiaSrosSFM           = "NOKIA_SROS_SFM"
77: 	envNokiaSrosXIOM          = "NOKIA_SROS_XIOM"
78: 	envNokiaSrosMDA           = "NOKIA_SROS_MDA"
79: 	envSrosIPv4Active         = "NOKIA_SROS_ADDRESS_IPV4_ACTIVE"
80: 	envSrosIPv6Active         = "NOKIA_SROS_ADDRESS_IPV6_ACTIVE"
81: 	envSrosStaticRoutePrefix  = "NOKIA_SROS_STATIC_ROUTE_"
82: 
83: 	srosMinorError     = "MINOR:"
84: 	srosCriticalError  = "CRITICAL:"
85: 	srosRejectedCfgMsg = "Configuration load failed - using default configuration"
86: )
87: 
88: var (
89: 	kindNames  = []string{"nokia_srsim"}
90: 	srosSysctl = map[string]string{
91: 		"net.ipv4.ip_forward":                "0",
92: 		"net.ipv6.conf.all.disable_ipv6":     "0",
93: 		"net.ipv6.conf.default.disable_ipv6": "0",
94: 		"net.ipv6.conf.all.accept_dad":       "0",
95: 		"net.ipv6.conf.default.accept_dad":   "0",
96: 		"net.ipv6.conf.all.autoconf":         "0",
97: 		"net.ipv6.conf.default.autoconf":     "0",
98: 		"net.ipv4.conf.all.rp_filter":        "0",
99: 		"net.ipv6.conf.all.accept_ra":        "0",
100: 		"net.ipv6.conf.default.accept_ra":    "0",
101: 		"net.ipv4.conf.default.rp_filter":    "0",
102: 	}
103: 	defaultCredentials = clabnodes.NewCredentials("admin", "NokiaSros1!")
104: 
105: 	srosEnv = map[string]string{
106: 		"SRSIM":                   "1",
107: 		envNokiaSrosChassis:       SrosDefaultType,     // filler to be overridden
108: 		envNokiaSrosSystemBaseMac: "fa:ac:ff:ff:10:00", // filler to be overridden
109: 		envNokiaSrosSlot:          slotAName,           // filler to be overridden
110: 	}
111: 
112: 	readyCmdCpm  = `/usr/bin/pgrep ^cpm$`
113: 	readyCmdBoth = `/usr/bin/pgrep ^both$`
114: 	readyCmdIom  = `/usr/bin/pgrep ^iom$`
115: 
116: 	requiredKernelVersion = &clabutils.KernelVersion{
117: 		Major:    5,
118: 		Minor:    5,
119: 		Revision: 0,
120: 	}
121: 	// Internal directories inside SR-SIM container.
122: 	cf1Dir = "/home/sros/flash1"
123: 	cf2Dir = "/home/sros/flash2"
124: 	cf3Dir = "/home/sros/flash3" // Where the running config will be stored
125: 	licDir = "/nokia/license"
126: 
127: 	InterfaceRegexp = regexp.MustCompile(
128: 		`^(?P<card>\d+)/(?:x(?P<xiom>\d+)/)?(?P<mda>\d+)(?:/c(?P<connector>\d+))?/(?P<port>\d+)$`,
129: 	)
130: 	MappedInterfaceRegexp = regexp.MustCompile(
131: 		`^(?:e(?P<card>\d+)-(?:x(?P<xiom>\d+)-)?(?P<mda>\d+)(?:-c(?P<connector>\d+))?-(?P<port>\d+)|eth(?P<mgmtPort>\d+))$`,
132: 	)
133: 	InterfaceHelp = `The format of the interface name need to be one of:
134: 	  Regular SR OS interface names, that is:
135: 	  1/2/3       -> card 1, mda 2, port 3
136:       1/2/c3/4    -> card 1, mda 2, connector 3, port 4
137:       1/x2/3/4    -> card 1, xiom 2, mda 3, port 4
138:       1/x2/3/c4/5 -> card 1, xiom 2, mda 3, connector 4, port 5
139: 	  The mapped Linux interface names, that is:
140:       e1-2-3       -> card 1, mda 2, port 3
141:       e1-2-c3-4    -> card 1, mda 2, connector 3, port 4
142:       e1-x2-3-4    -> card 1, xiom 2, mda 3, port 4
143:       e1-x2-3-c4-5 -> card 1, xiom 2, mda 3, connector 4, port 5
144: 	  eth[0-9], for management interfaces of CPM-A/CPM-B or for fabric interfaces`
145: )
146: 
147: // Register registers the node in the NodeRegistry.
148: func Register(r *clabnodes.NodeRegistry) {
149: 	generateNodeAttributes := clabnodes.NewGenerateNodeAttributes(generateable, generateIfFormat)
150: 	platformOpts := &clabnodes.PlatformAttrs{
151: 		ScrapliPlatformName: scrapliPlatformName,
152: 	}
153: 	nrea := clabnodes.NewNodeRegistryEntryAttributes(
154: 		defaultCredentials,
155: 		generateNodeAttributes,
156: 		platformOpts,
157: 	).WithKindSpecificConfig(kindSpecificConfig)
158: 
159: 	r.Register(kindNames, func() clabnodes.Node {
160: 		return new(sros)
161: 	}, nrea)
162: }
163: 
164: // KindSpecificConfig is the nokia_srsim kind-specific config, set as keys on the node definition.
165: type KindSpecificConfig struct {
166: 	// ConfigMode is the SR OS configuration mode: model-driven (default), classic or mixed.
167: 	ConfigMode ConfigMode `yaml:"config-mode,omitempty" json:"config-mode,omitempty"`
168: 	// GenComponentConfig generates the configuration of the node's components. Defaults to true.
169: 	GenComponentConfig bool         `yaml:"gen-component-config" json:"gen-component-config"`
170: 	SFM                string       `yaml:"sfm,omitempty" json:"sfm,omitempty"`
171: 	Components         []*Component `yaml:"components,omitempty" json:"components,omitempty"`
172: }
173: 
174: // SetDefaults implements clabnodes.KindSpecificConfigDefaulter.
175: func (c *KindSpecificConfig) SetDefaults() { c.GenComponentConfig = true }
176: 
177: // equalIgnoringComponentOrder reports whether c and o are equal, comparing components by slot
178: // regardless of their order and the case of the slot.
179: func (c *KindSpecificConfig) equalIgnoringComponentOrder(o *KindSpecificConfig) bool {
180: 	a, b := *c, *o
181: 	a.Components, b.Components = nil, nil
182: 
183: 	return reflect.DeepEqual(a, b) &&
184: 		reflect.DeepEqual(componentsBySlot(c.Components), componentsBySlot(o.Components))
185: }
186: 
187: var kindSpecificConfig clabnodes.KindSpecificConfigSpec[KindSpecificConfig]
188: 
189: // sros SR-SIM Kind structure.
190: type sros struct {
191: 	clabnodes.DefaultNode
192: 	// startup-config passed as a path to a file with CLI instructions will be read into this byte
193: 	// slice
194: 	startupCliCfg []byte
195: 
196: 	// SSH public keys extracted from the clab host
197: 	sshPubKeys []ssh.PublicKey
198: 
199: 	// software version SR OS x node runs
200: 	swVersion      *SrosVersion
201: 	componentNodes []clabnodes.Node
202: 
203: 	// in distributed mode we rename the Cfg.LongName and Cfg.ShortName and Cfg.Fqdn attributes when
204: 	// deploying. e.g. inspect is either called after deploy or independently. Hence we need to
205: 	// differentiate if we need to perform the
206: 	// component cpm based rename or not. This field indicates just that
207: 	renameDone bool
208: 	// rootComponents stores the OG components from root node for dist setups
209: 	// ..allows children of the distributed root node to access root components (ie. for cfg gen)
210: 	rootComponents []*Component
211: 	// store the longname with cpm suffix
212: 	cpmContainerName string
213: 	// for component nodes, store base nodes
214: 	baseShortName string
215: 	baseLongName  string
216: 	// rootCtrName is the container that owns the netns.
217: 	//  - for components based: the internal netns container.
218: 	//  - for network mode based: parsed from network-mode.
219: 	rootCtrName string
220: 
221: 	// userEnv is the env map from the topology, before component fields are merged in.
222: 	// Node env overrides component type, XIOM, MDA, SFM, and per-component env.
223: 	userEnv map[string]string
224: 
225: 	preDeployParams *clabnodes.PreDeployParams
226: 
227: 	netnsNode clabnodes.Node
228: }
229: 
230: func (*sros) LinkApplyMode(context.Context) clabnodes.LinkApplyMode {
231: 	return clabnodes.LinkApplyModeLive
232: }
233: 
234: // Init Function for SR-SIM kind.
235: func (n *sros) kindSpecificCfg() *KindSpecificConfig { return kindSpecificConfig.Of(n.Cfg) }
236: 
237: func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) error {
238: 	// Init DefaultNode
239: 	n.DefaultNode = *clabnodes.NewDefaultNode(n)
240: 	// set virtualization requirement
241: 	n.HostRequirements.SSSE3 = true
242: 	n.HostRequirements.MinVCPU = 4
243: 	n.HostRequirements.MinVCPUFailAction = clabtypes.FailBehaviourError
244: 	n.HostRequirements.MinAvailMemoryGb = 4
245: 	n.HostRequirements.MinAvailMemoryGbFailAction = clabtypes.FailBehaviourLog
246: 
247: 	n.LicensePolicy = clabtypes.LicensePolicyRequired
248: 
249: 	n.Cfg = cfg
250: 
251: 	n.InterfaceHelp = InterfaceHelp
252: 	n.InterfaceRegexp = InterfaceRegexp
253: 
254: 	for _, o := range opts {
255: 		o(n)
256: 	}
257: 
258: 	// if user was not initialized to a value, use root
259: 	if n.Cfg.User == "" {
260: 		n.Cfg.User = "0:0"
261: 	}
262: 
263: 	// Snapshot topology env before component and SFM flags are applied.
264: 	// Component nodes set userEnv from the base node before Init.
265: 	envAlreadyResolved := n.userEnv != nil
266: 	if !envAlreadyResolved {
267: 		if n.Cfg.Env == nil {
268: 			n.userEnv = map[string]string{}
269: 		} else {
270: 			n.userEnv = maps.Clone(n.Cfg.Env)
271: 		}
272: 	}
273: 	if n.Cfg.Env == nil {
274: 		n.Cfg.Env = map[string]string{}
275: 	}
276: 
277: 	// Distributed cards inherit SFM from the base node env. Applying it again
278: 	// would warn once per card when the user also set NOKIA_SROS_SFM.
279: 	if sfm := n.kindSpecificCfg().SFM; sfm != "" && !envAlreadyResolved {
280: 		if envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {
281: 			if envSFM != sfm {
282: 				log.Warn(
283: 					fmt.Sprintf(
284: 						"component value %q will not be used because environment variable %s is set",
285: 						sfm,
286: 						envNokiaSrosSFM,
287: 					),
288: 					"node", n.Cfg.ShortName,
289: 					"env", envNokiaSrosSFM,
290: 					"component-value", sfm,
291: 					"env-value", envSFM,
292: 				)
293: 			}
294: 		} else {
295: 			n.Cfg.Env[envNokiaSrosSFM] = sfm
296: 		}
297: 	}
298: 
299: 	maps.Copy(n.Cfg.Sysctls, srosSysctl)
300: 
301: 	// make sure we always have uppercase slot definition
302: 	for _, c := range n.kindSpecificCfg().Components {
303: 		c.Slot = strings.ToUpper(c.Slot)
304: 	}
305: 	// Merge Environment
306: 	if n.Cfg.NodeType == "" {
307: 		n.Cfg.NodeType = SrosDefaultType
308: 	}
309: 	srosEnv[envNokiaSrosChassis] = n.Cfg.NodeType // Override NodeType var with existing env
310: 
311: 	mac := genMac(n.Cfg)
312: 	srosEnv[envNokiaSrosSystemBaseMac] = mac
313: 	// Ensure n.Cfg.Certificate.Issue is not nil
314: 	if n.Cfg.Certificate.Issue == nil {
315: 		n.Cfg.Certificate.Issue = new(false)
316: 	}
317: 	if n.isStandaloneNode() {
318: 		log.Debugf(
319: 			"%q is standalone node. %v",
320: 			n.Cfg.ShortName,
321: 			len(n.kindSpecificCfg().Components),
322: 		)
323: 
324: 		vars, err := n.setupStandaloneComponents()
325: 		if err != nil {
326: 			return err
327: 		}
328: 		warnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)
329: 
330: 		// n.Cfg.Env overrides component vars, overrides default srosEnv
331: 		n.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)
332: 		log.Debug("Merged env file", "env", fmt.Sprintf("%+v", n.Cfg.Env), "node", n.Cfg.ShortName)
333: 	} else {
334: 		log.Debugf(
335: 			"%q is distributed node. %v",
336: 			n.Cfg.ShortName,
337: 			len(n.kindSpecificCfg().Components),
338: 		)
339: 
340: 		n.Cfg.Env = clabutils.MergeStringMaps(srosEnv, n.Cfg.Env)
341: 		log.Debug("Merged env file", "env", fmt.Sprintf("%+v", n.Cfg.Env), "node", n.Cfg.ShortName)
342: 
343: 		err := n.setupComponentNodes()
344: 		if err != nil {
345: 			return err
346: 		}
347: 	}
348: 
349: 	return nil
350: }
351: 
352: // integrated -> pull component info from slot A components.
353: func (n *sros) setupStandaloneComponents() (map[string]string, error) {
354: 	vars := map[string]string{}
355: 
356: 	if len(n.kindSpecificCfg().Components) == 0 {
357: 		return nil, nil
358: 	}
359: 	if len(n.kindSpecificCfg().Components) > 1 {
360: 		return nil, fmt.Errorf(
361: 			"expected at most one component override for standalone SR-SIM node %q, "+
362: 				"or one component per slot %s for redundant type %q",
363: 			n.Cfg.ShortName,
364: 			strings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), "/"),
365: 			n.Cfg.NodeType,
366: 		)
367: 	}
368: 
369: 	slotA := n.kindSpecificCfg().Components[0]
370: 
371: 	slotName := strings.ToUpper(strings.TrimSpace(slotA.Slot))
372: 	// single undefined slot is implicitly set to A
373: 	if slotName == "" {
374: 		slotName = standaloneSlotName
375: 	}
376: 
377: 	if !integratedSrosSlotAllowed(n.Cfg.NodeType, slotName) {
378: 		return nil, fmt.Errorf(
379: 			"expected no slot, or slot %s for components of standalone SR-SIM node %q",
380: 			strings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), "/"),
381: 			n.Cfg.ShortName,
382: 		)
383: 	}
384: 	vars[envNokiaSrosSlot] = slotName
385: 
386: 	setComponentEnvVars(vars, slotA)
387: 
388: 	maps.Copy(vars, slotA.Env)
389: 
390: 	return vars, nil
391: }
392: 
393: // Pre Deploy func for SR-SIM kind.
394: func (n *sros) PreDeploy(ctx context.Context, params *clabnodes.PreDeployParams) error {
395: 	log.Debug("Running pre-deploy")
396: 
397: 	if err := n.verifyNokiaSrsimImage(ctx); err != nil {
398: 		return err
399: 	}
400: 
401: 	// store the preDeployParams
402: 	n.preDeployParams = params
403: 
404: 	n.InterfaceHelp = InterfaceHelp
405: 
406: 	// store provided pubkeys
407: 	n.sshPubKeys = params.SSHPubKeys
408: 
409: 	// Create files/dir structure for standalone nodes or distributed CPM nodes
410: 	if n.isStandaloneNode() || (n.isDistributedCardNode() && n.isCPM("")) {
411: 		// generate the certificate
412: 		if *n.Cfg.Certificate.Issue {
413: 			n.Cfg.Certificate.SANs = append(n.Cfg.Certificate.SANs, n.baseShortName, n.baseLongName)
414: 			certificate, err := n.LoadOrGenerateCertificate(params.Cert, params.TopologyName)
415: 			if err != nil {
416: 				return err
417: 			}
418: 
419: 			// set the certificate data
420: 			n.Config().TLSCert = string(certificate.Cert)
421: 			n.Config().TLSKey = string(certificate.Key)
422: 		}
423: 		clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),
424: 			clabconstants.PermissionsOpen)
425: 		slot := n.Cfg.Env[envNokiaSrosSlot]
426: 		if slot == "" {
427: 			return fmt.Errorf("fail to init node because Env var %q is set to %q",
428: 				envNokiaSrosSlot, n.Cfg.Env[envNokiaSrosSlot])
429: 		}
430: 		// add the config specific mounts
431: 		cf1Path := filepath.Join(n.Cfg.LabDir, slot, configCf1)
432: 		cf2Path := filepath.Join(n.Cfg.LabDir, slot, configCf2)
433: 		cf3Path := filepath.Join(n.Cfg.LabDir, slot, configCf3)
434: 		n.Cfg.Binds = append(n.Cfg.Binds,
435: 			fmt.Sprint(cf1Path, ":", cf1Dir, "/:rw"),
436: 			fmt.Sprint(cf2Path, ":", cf2Dir, "/:rw"),
437: 			fmt.Sprint(cf3Path, ":", cf3Dir, "/:rw"),
438: 		)
439: 
440: 		if n.Cfg.License != "" && (n.isCPM("") || n.isStandaloneNode()) {
441: 			// we mount a fixed path node.Labdir/license.key as the license referenced in topo file
442: 			// will be copied to that path
443: 			n.Cfg.Binds = append(n.Cfg.Binds, fmt.Sprint(
444: 				filepath.Join(n.Cfg.LabDir, "license.key"), ":", licDir, "/license.txt:ro"))
445: 		}
446: 
447: 		return n.createSROSFiles(ctx)
448: 	}
449: 	return nil
450: }
451: 
452: func (n *sros) DeployEndpoints(ctx context.Context) error {
453: 	if err := n.DefaultNode.DeployEndpoints(ctx); err != nil {
454: 		return err
455: 	}
456: 
457: 	return n.PostDeployEndpoints(ctx)
458: }
459: 
460: // PostDeployEndpoints runs SR-SIM endpoint fixups after dataplane links exist.
461: func (n *sros) PostDeployEndpoints(ctx context.Context) error {
462: 	if n.Runtime.Mgmt().Driver == clabtypes.MgmtDriverMacvlan {
463: 		return nil
464: 	}
465: 	// Disable TX checksum offload on the host NS veth for the mgmt interface.
466: 	var peerIfIndex int
467: 	err := n.ExecFunction(ctx, clabutils.VethPeerIndex("eth0", &peerIfIndex))
468: 	if err != nil {
469: 		log.Warn("Failed to get veth peer index for SR-SIM mgmt interface",
470: 			"node", n.Cfg.ShortName,
471: 			"error", err)
472: 		return nil
473: 	}
474: 
475: 	if err := clabutils.DisableTxOffloadByIndex(peerIfIndex); err != nil {
476: 		log.Warn("Failed to disable TX checksum offload on SR-SIM mgmt host veth",
477: 			"node", n.Cfg.ShortName,
478: 			"error", err)
479: 	}
480: 
481: 	return nil
482: }
483: 
484: // Post Deploy func for SR-SIM kind.
485: func (n *sros) PostDeploy(ctx context.Context, params *clabnodes.PostDeployParams) error {
486: 	log.Info("Running postdeploy actions",
487: 		"kind", n.Cfg.Kind,
488: 		"node", n.Cfg.ShortName)
489: 
490: 	// start waiting for container ready (PID based check)
491: 	if err := n.Ready(ctx); err != nil {
492: 		return err
493: 	}
494: 
495: 	errChan := make(chan error, 1)
496: 
497: 	logs, err := n.Runtime.StreamLogs(ctx, n.GetContainerName())
498: 	if err != nil {
499: 		log.Debug("Failed to get container log stream", "node", n.Cfg.ShortName, "err", err)
500: 	} else {
501: 		// Start monitoring in a goroutine
502: 		monitoringCtx, cancel := context.WithCancel(ctx)
503: 		defer cancel()
504: 		defer logs.Close()
505: 
506: 		go n.MonitorLogs(monitoringCtx, logs, errChan)
507: 	}
508: 
509: 	// Populate /etc/hosts for service discovery on mgmt interface
510: 	if err = n.populateHosts(ctx, params.Nodes); err != nil {
511: 		log.Warn("Unable to populate hosts list", "node", n.Cfg.ShortName, "err", err)
512: 	}
513: 
514: 	n.swVersion, err = n.RunningVersion(ctx)
515: 	if err != nil {
516: 		return err
517: 	}
518: 	if !n.isCPM(slotAName) {
519: 		return nil
520: 	}
521: 
522: 	if err := n.RequireMgmtReachable(); err != nil {
523: 		return err
524: 	}
525: 
526: 	// Execute SaveConfig after boot. This code should only run on active CPM
527: 	deadline := time.Now().Add(readyTimeout)
528: 	var lastHealthErr error
529: 	for time.Now().Before(deadline) {
530: 		// Check if context is canceled
531: 		if err := ctx.Err(); err != nil {
532: 			return fmt.Errorf("context canceled: %w", err)
533: 		}
534: 
535: 		isHealthy, err := n.IsHealthy(ctx)
536: 		if err != nil {
537: 			lastHealthErr = err
538: 			log.Debug(
539: 				fmt.Errorf(
540: 					"health check failed, check 'docker logs -f %s': %w",
541: 					n.Cfg.LongName,
542: 					err,
543: 				),
544: 			)
545: 		}
546: 
547: 		if isHealthy {
548: 			addr, err := n.MgmtIPAddr()
549: 			if err != nil {
550: 				return err
551: 			}
552: 			// TLS bootstrap in case of n.Cfg.Certificate.Issue flag
553: 			if *n.Cfg.Certificate.Issue {
554: 				log.Infof("TLS cert/key bootstrap for node %q", n.Cfg.LongName)
555: 
556: 				err = n.tlsCertBootstrap(ctx, addr)
557: 				if err != nil {
558: 					return fmt.Errorf(
559: 						"TLS cert/key bootstrap to node %q failed: %w",
560: 						n.Cfg.LongName,
561: 						err,
562: 					)
563: 				}
564: 				log.Infof(
565: 					"Completed bootstrap for gRPC-TLS profile on node %s",
566: 					n.Cfg.ShortName,
567: 				)
568: 			}
569: 
570: 			// Partial or NO Config Provided
571: 			if !isFullConfigFile(n.Cfg.StartupConfig) {
572: 				log.Infof("Saving node %q config as startup...", n.Cfg.LongName)
573: 				err = n.saveConfigWithAddr(ctx, addr)
574: 				if err != nil {
575: 					return fmt.Errorf("save config to node %q, failed: %w", n.Cfg.LongName, err)
576: 				}
577: 			}
578: 			return nil
579: 		}
580: 
581: 		// Wait before next check
582: 		select {
583: 		case <-ctx.Done():
584: 			return ctx.Err()
585: 		case err := <-errChan:
586: 			log.With("kind", n.Cfg.Kind, "node", n.Cfg.ShortName).Debugf("got %q on errChan", err)
587: 			log.Info("Skipping postdeploy actions", "kind", n.Cfg.Kind, "node", n.Cfg.ShortName)
588: 			return nil
589: 		case <-time.After(retryTimer):
590: 			// continue to next iteration
591: 		}
592: 	}
593: 
594: 	if lastHealthErr != nil {
595: 		return fmt.Errorf("node %q did not become healthy before timeout: %w",
596: 			n.Cfg.LongName, lastHealthErr)
597: 	}
598: 
599: 	return fmt.Errorf("node %q did not become healthy before timeout", n.Cfg.LongName)
600: }
601: 
602: // Delete func for SR-SIM kind.
603: func (n *sros) Delete(ctx context.Context) error {
604: 	// if not distributed, follow default node implementation
605: 	if n.isStandaloneNode() || n.isDistributedCardNode() {
606: 		return n.DefaultNode.Delete(ctx)
607: 	}
608: 
609: 	var errs []error
610: 
611: 	// Delete all the component containers
612: 	for _, componentNode := range n.componentNodes {
613: 		err := componentNode.Delete(ctx)
614: 		if err != nil {
615: 			log.Warn(err)
616: 			errs = append(errs, err)
617: 		}
618: 	}
619: 
620: 	errs = append(errs, n.DefaultNode.Delete(ctx), n.netnsNode.Delete(ctx))
621: 
622: 	return errors.Join(errs...)
623: }
624: 
625: func (n *sros) setupComponentNodes() error {
626: 	if !n.isDistributedBaseNode() {
627: 		return nil
628: 	}
629: 
630: 	n.netnsNode = new(namespaceNode)
631: 	if err := n.netnsNode.Init(
632: 		n.newNetnsConfig(),
633: 		clabnodes.WithRuntime(n.GetRuntime()),
634: 	); err != nil {
635: 		return err
636: 	}
637: 	rootCtrName := n.netnsNode.Config().LongName
638: 
639: 	// loop through the components, creating them
640: 	for _, c := range n.kindSpecificCfg().Components {
641: 		// instantiate a new nokia_srsim instance
642: 		srosNode := new(sros)
643: 		componentNode := clabnodes.Node(srosNode)
644: 
645: 		// copy the original node's NodeConfig to the component
646: 		componentConfig, err := deep.Copy(n.Cfg)
647: 		if err != nil {
648: 			return fmt.Errorf("failed to deep copy node config for component: %w", err)
649: 		}
650: 
651: 		// component nodes join to the nents pause container
652: 		componentConfig.NetworkMode = fmt.Sprintf("container:%s", n.netnsNode.GetShortName())
653: 
654: 		// adjust the config values from the original node
655: 		componentConfig.ShortName = n.calcComponentName(componentConfig.ShortName, c.Slot)
656: 		componentConfig.LongName = n.calcComponentName(componentConfig.LongName, c.Slot)
657: 		componentConfig.NodeType = n.Cfg.NodeType
658: 		kindSpecificConfig.Of(componentConfig).Components = nil
659: 		componentConfig.Fqdn = n.calcComponentFqdn(c.Slot)
660: 		componentConfig.DNS = nil
661: 		componentConfig.PortBindings = nil
662: 		componentConfig.PortSet = nil
663: 
664: 		// Component fields fill env keys the user did not set. Node env wins.
665: 		if componentConfig.Env == nil {
666: 			componentConfig.Env = map[string]string{}
667: 		}
668: 		keepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)
669: 		// Slot identifies this container. A node-level NOKIA_SROS_SLOT cannot apply to every card.
670: 		componentConfig.Env[envNokiaSrosSlot] = c.Slot
671: 
672: 		// adjust label based env vars
673: 		componentConfig.Env["CLAB_LABEL_"+clabutils.ToEnvKey(clabconstants.NodeName)] = componentConfig.ShortName
674: 		componentConfig.Env["CLAB_LABEL_"+clabutils.ToEnvKey(clabconstants.LongName)] = componentConfig.LongName
675: 
676: 		if componentConfig.Labels == nil {
677: 			componentConfig.Labels = map[string]string{}
678: 		}
679: 
680: 		// adjust labels
681: 		componentConfig.Labels[clabconstants.NodeName] = componentConfig.ShortName
682: 		componentConfig.Labels[clabconstants.LongName] = componentConfig.LongName
683: 		componentConfig.Labels[clabconstants.RootNodeName] = n.Cfg.ShortName
684: 		componentConfig.Labels[clabconstants.RootNodeLongName] = n.Cfg.LongName
685: 
686: 		// Preserve the topology env. Init must not snapshot the merged component env,
687: 		// or config generation would treat component flags as user overrides.
688: 		srosNode.userEnv = maps.Clone(n.userEnv)
689: 
690: 		// init the component
691: 		err = componentNode.Init(componentConfig)
692: 		if err != nil {
693: 			return err
694: 		}
695: 		// set the runtime by copying it from the general node
696: 		componentNode.WithRuntime(n.GetRuntime())
697: 
698: 		// store root components for cpms, for config gen
699: 		srosNode.rootComponents = n.kindSpecificCfg().Components
700: 		// store base node name
701: 		srosNode.baseShortName = n.Cfg.ShortName
702: 		srosNode.baseLongName = n.Cfg.LongName
703: 		srosNode.rootCtrName = rootCtrName
704: 
705: 		// store the node in the componentNodes
706: 		n.componentNodes = append(n.componentNodes, componentNode)
707: 	}
708: 	return nil
709: }
710: 
711: // deployFabric deploys the distributed SR-SIM when the `components` key is present.
712: func (n *sros) deployFabric(ctx context.Context, deployParams *clabnodes.DeployParams) error {
713: 	netnsConfig := n.netnsNode.Config()
714: 
715: 	netnsConfig.MgmtIPv4Address = n.Cfg.MgmtIPv4Address
716: 	netnsConfig.MgmtIPv4AddressAuto = n.Cfg.MgmtIPv4AddressAuto
717: 	netnsConfig.MgmtIPv4PrefixLength = n.Cfg.MgmtIPv4PrefixLength
718: 	netnsConfig.MgmtIPv4Gateway = n.Cfg.MgmtIPv4Gateway
719: 	netnsConfig.MgmtIPv6Address = n.Cfg.MgmtIPv6Address
720: 	netnsConfig.MgmtIPv6AddressAuto = n.Cfg.MgmtIPv6AddressAuto
721: 	netnsConfig.MgmtIPv6PrefixLength = n.Cfg.MgmtIPv6PrefixLength
722: 	netnsConfig.MgmtIPv6Gateway = n.Cfg.MgmtIPv6Gateway
723: 
724: 	if err := n.netnsNode.Deploy(ctx, deployParams); err != nil {
725: 		return fmt.Errorf("deploy network namespace node %q: %w", n.netnsNode.GetShortName(), err)
726: 	}
727: 
728: 	ips, err := n.distNodeMgmtIPs()
729: 	if err != nil {
730: 		return err
731: 	}
732: 
733: 	n.setComponentMgmtEnv(ips)
734: 
735: 	// loop through the components, creating them
736: 	for _, c := range n.componentNodes {
737: 		if err := c.PreDeploy(ctx, n.preDeployParams); err != nil {
738: 			return fmt.Errorf("pre-deploy for component node %q: %w", c.GetShortName(), err)
739: 		}
740: 		// deploy the component
741: 		err := c.Deploy(ctx, deployParams)
742: 		if err != nil {
743: 			return err
744: 		}
745: 	}
746: 
747: 	cpmSlot, err := n.cpmSlot()
748: 	if err != nil {
749: 		return err
750: 	}
751: 	// store the CPM container name
752: 	n.cpmContainerName = n.calcComponentName(n.Cfg.LongName, cpmSlot)
753: 	n.renameDone = true
754: 
755: 	// adjust also the mgmt IP addresses of the general node
756: 	n.Cfg.MgmtIPv4Address = ips.IPv4
757: 	n.Cfg.MgmtIPv6Address = ips.IPv6
758: 
759: 	return nil
760: }
761: 
762: // set env vars for the CPMs so that they are aware of mgmt info.
763: func (n *sros) setComponentMgmtEnv(ips MgmtIP) {
764: 	for _, component := range n.componentNodes {
765: 		cfg := component.Config()
766: 		slot := strings.ToUpper(cfg.Env[envNokiaSrosSlot])
767: 
768: 		if slot != slotAName && slot != slotBName {
769: 			continue
770: 		}
771: 
772: 		env := cfg.Env
773: 		if intf := env["NOKIA_SROS_MGMT_IF"]; intf != "" && intf != "eth0" {
774: 			continue
775: 		}
776: 		if env[envSrosIPv4Active] != "" || env[envSrosIPv6Active] != "" {
777: 			continue
778: 		}
779: 
780: 		// SKIP if the user defines this env var
781: 		explicitRoutes := false
782: 		for key := range env {
783: 			if strings.HasPrefix(key, envSrosStaticRoutePrefix) {
784: 				explicitRoutes = true
785: 				break
786: 			}
787: 		}
788: 		if explicitRoutes {
789: 			continue
790: 		}
791: 
792: 		if ips.IPv4 != "" {
793: 			env[envSrosIPv4Active] = fmt.Sprintf("%s/%d", ips.IPv4, ips.IPv4pLen)
794: 			if ips.IPv4Gw != "" {
795: 				env[envSrosStaticRoutePrefix+"1"] = "0.0.0.0/0@" + ips.IPv4Gw
796: 			}
797: 		}
798: 
799: 		if ips.IPv6 != "" {
800: 			env[envSrosIPv6Active] = fmt.Sprintf("%s/%d", ips.IPv6, ips.IPv6pLen)
801: 			if ips.IPv6Gw != "" {
802: 				env[envSrosStaticRoutePrefix+"2"] = "::/0@" + ips.IPv6Gw
803: 			}
804: 		}
805: 	}
806: }
807: 
808: // isDistributedCard checks if the slot variable is set, hence it is an instance (slot) of a
809: // distributed setup.
810: // isDistributedCardNode returns true if this node is a card (linecard/IOM)
811: // in a distributed SR-SIM deployment. A distributed card has a slot assignment
812: // but no components of its own.
813: func (n *sros) isDistributedCardNode() bool {
814: 	_, exists := n.Cfg.Env[envNokiaSrosSlot]
815: 	return exists && len(n.kindSpecificCfg().Components) == 0
816: }
817: 
818: // isDistributedBaseNode returns true if this is the base node of a distributed
819: // SR-SIM deployment. The base node orchestrates multiple component nodes.
820: func (n *sros) isDistributedBaseNode() bool {
821: 	if isIntegratedSrosNodeType(n.Cfg.NodeType) {
822: 		return isRedundantIntegratedSrosComponents(n.Cfg.NodeType, n.kindSpecificCfg().Components)
823: 	}
824: 	return len(n.kindSpecificCfg().Components) > 1
825: }
826: 
827: // isStandaloneNode returns true if this is a standalone (non-distributed) SR-SIM node.
828: func (n *sros) isStandaloneNode() bool {
829: 	return !n.isDistributedBaseNode() && !n.isDistributedCardNode()
830: }
831: 
832: // calcComponentName appends the line card suffix to the given node name.
833: func (n *sros) calcComponentName(name, slot string) string {
834: 	if n.renameDone {
835: 		return name
836: 	}
837: 	return fmt.Sprintf("%s-%s", name, strings.ToLower(slot))
838: }
839: 
840: // calcComponentFqdn computes the FQDN for a given slot.
841: func (n *sros) calcComponentFqdn(slot string) string {
842: 	if n.renameDone {
843: 		return n.Cfg.Fqdn
844: 	}
845: 	fqdnDotIndex := strings.Index(n.Cfg.Fqdn, ".")
846: 	if fqdnDotIndex < 0 {
847: 		return fmt.Sprintf("%s-%s", n.Cfg.Fqdn, strings.ToLower(slot))
848: 	}
849: 	result := fmt.Sprintf(
850: 		"%s-%s%s",
851: 		n.Cfg.Fqdn[:fqdnDotIndex],
852: 		strings.ToLower(slot),
853: 		n.Cfg.Fqdn[fqdnDotIndex:],
854: 	)
855: 	return result
856: }
857: 
858: // cpmNode returns a CPM Node (used in Distributed mode).
859: func (n *sros) cpmNode() (clabnodes.Node, error) {
860: 	defaultSlot, err := n.cpmSlot()
861: 	if err != nil {
862: 		return nil, err
863: 	}
864: 	defaultSlot = strings.ToLower(defaultSlot)
865: 	for _, cn := range n.componentNodes {
866: 		if cn.GetShortName()[len(cn.GetShortName())-1:] == defaultSlot {
867: 			return cn, nil
868: 		}
869: 	}
870: 	return nil, fmt.Errorf("node %s: node for slot %s not found", n.GetShortName(), defaultSlot)
871: }
872: 
873: // cpmSlot returns the Slot of the preferred CPM Node (used when Distributed mode).
874: // It prefers slot A if present, otherwise returns slot B.
875: func (n *sros) cpmSlot() (string, error) {
876: 	// Prefer slot A, fall back to slot B. Slots are accepted in either case.
877: 	for _, comp := range n.kindSpecificCfg().Components {
878: 		if strings.EqualFold(comp.Slot, slotAName) {
879: 			return slotAName, nil
880: 		}
881: 	}
882: 	for _, comp := range n.kindSpecificCfg().Components {
883: 		if strings.EqualFold(comp.Slot, slotBName) {
884: 			return slotBName, nil
885: 		}
886: 	}
887: 	return "", fmt.Errorf("node %s: unable to determine default slot", n.GetShortName())
888: }
889: 
890: // Deploy deploys the SR-SIM kind.
891: func (n *sros) Deploy(ctx context.Context, deployParams *clabnodes.DeployParams) error {
892: 	// if it is a chassis with multiple cards (i.e. components)
893: 	if n.isDistributedBaseNode() {
894: 		err := n.deployFabric(ctx, deployParams)
895: 		if err != nil {
896: 			return err
897: 		}
898: 
899: 		// Update the nodes state
900: 		n.SetState(clabnodesstate.Deployed)
901: 		return nil
902: 	}
903: 
904: 	// if it is a regular node
905: 	err := n.DefaultNode.Deploy(ctx, deployParams)
906: 	if err != nil {
907: 		return err
908: 	}
909: 
910: 	return nil
911: }
912: 
913: // Ready returns when the node boot sequence reached the stage when it is ready to accept config
914: // commands
915: // returns an error if not ready by the expiry of the timer readyTimeout.
916: func (n *sros) Ready(ctx context.Context) error {
917: 	ctx, cancel := context.WithTimeout(ctx, readyTimeout)
918: 	defer cancel()
919: 	var err error
920: 	readyCmds := []string{readyCmdCpm, readyCmdBoth, readyCmdIom}
921: 	readyCmdsStrings := []string{"CPM", "BOTH", "IOM"}
922: 	log.Debug("Waiting for SR OS node to boot...", "node", n.Cfg.ShortName)
923: 	for {
924: 		select {
925: 		case <-ctx.Done():
926: 			return fmt.Errorf(
927: 				"timed out waiting for SR OS node %s to boot: %v",
928: 				n.Cfg.ShortName,
929: 				err,
930: 			)
931: 		default:
932: 			// check if cpm is running
933: 			for k, cmd := range readyCmds {
934: 				cmd, _ := clabexec.NewExecCmdFromString(cmd)
935: 				execResult, err := n.RunExec(ctx, cmd)
936: 				if err != nil || (execResult != nil && execResult.GetReturnCode() != 0) {
937: 					logMsg := fmt.Sprintf(
938: 						"status check %s failed on %s retrying",
939: 						readyCmdsStrings[k],
940: 						n.Cfg.ShortName,
941: 					)
942: 					if err != nil {
943: 						logMsg += fmt.Sprintf(" error: %v", err)
944: 					}
945: 					if execResult != nil && execResult.GetReturnCode() != 0 {
946: 						logMsg += fmt.Sprintf(
947: 							", output:%s",
948: 							strings.ReplaceAll(execResult.String(), "\n", "; "),
949: 						)
950: 					}
951: 					log.Debug(logMsg)
952: 				}
953: 				if execResult != nil && execResult.GetReturnCode() == 0 {
954: 					log.Debug("SR OS is ready to be configured", "node", n.Cfg.ShortName)
955: 					return nil
956: 				}
957: 				time.Sleep(retryTimer)
958: 			}
959: 		}
960: 	}
961: }
962: 
963: // checkKernelVersion emits a warning if the present kernel version is lower than the required one.
964: func (*sros) checkKernelVersion() error {
965: 	// retrieve running kernel version
966: 	kv, err := clabutils.GetKernelVersion()
967: 	if err != nil {
968: 		return err
969: 	}
970: 
971: 	// do the comparison
972: 	if !kv.GreaterOrEqual(requiredKernelVersion) {
973: 		log.Warnf(
974: 			"Nokia SR OS requires a kernel version greater than %s. Detected kernel version: %s. Not all features might function properly!",
975: 			requiredKernelVersion,
976: 			kv,
977: 		)
978: 	}
979: 	return nil
980: }
981: 
982: func (n *sros) CheckDeploymentConditions(ctx context.Context) error {
983: 	// perform the sros specific kernel version check
984: 	err := n.checkKernelVersion()
985: 	if err != nil {
986: 		return err
987: 	}
988: 
989: 	// check the sros component slot config for validaity
990: 	err = n.checkComponentSlotsConfig()
991: 	if err != nil {
992: 		return err
993: 	}
994: 
995: 	return n.DefaultNode.CheckDeploymentConditions(ctx)
996: }
997: 
998: // Func that creates the Dirs used for the kind SR-SIM and sets/merges the default Env vars.
999: func (n *sros) createSROSFiles(ctx context.Context) error {
1000: 	log.Debug("Creating directory structure for SR OS container", "node", n.Cfg.ShortName)
1001: 
1002: 	var err error
1003: 
1004: 	if n.Cfg.License != "" && (n.isCPM("") || n.isStandaloneNode()) {
1005: 		// copy license file to node specific directory in lab
1006: 		licPath := filepath.Join(n.Cfg.LabDir, "license.key")
1007: 		if err := clabutils.CopyFile(context.Background(), n.Cfg.License, licPath,
1008: 			clabconstants.PermissionsFileDefault); err != nil {
1009: 			return fmt.Errorf(
1010: 				"license copying src %s -> dst %s failed: %v",
1011: 				n.Cfg.License,
1012: 				licPath,
1013: 				err,
1014: 			)
1015: 		}
1016: 		log.Debug("SR OS license copied", "src", n.Cfg.License, "dst", licPath)
1017: 	}
1018: 	clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),
1019: 		clabconstants.PermissionsOpen)
1020: 	clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], "config"),
1021: 		clabconstants.PermissionsOpen)
1022: 	clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf1),
1023: 		clabconstants.PermissionsOpen)
1024: 	clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf2),
1025: 		clabconstants.PermissionsOpen)
1026: 	clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),
1027: 		clabconstants.PermissionsOpen)
1028: 	if err := n.writeChassisInfoToLabDir(ctx); err != nil {
1029: 		log.Debug("Didn't write chassis_info.json to lab dir. Docker version is likely too new.",
1030: 			"node", n.Cfg.ShortName, "path", n.Cfg.LabDir, "error", err)
1031: 	}
1032: 	if n.isCPM(slotAName) || n.isStandaloneNode() {
1033: 		err = n.createSROSCertificates()
1034: 	}
1035: 	if err != nil {
1036: 		return err
1037: 	}
1038: 	// Skip config if node is not CPM
1039: 	if n.isCPM("") || n.isStandaloneNode() {
1040: 		err = n.createSROSConfigFiles()
1041: 		if err != nil {
1042: 			return err
1043: 		}
1044: 	}
1045: 	return nil
1046: }
1047: 
1048: // writeChassisInfoToLabDir fetches /opt/nokia/chassis_info.json from the node image
1049: // (via graph driver, same as srosVersionFromImage) and writes it under n.Cfg.LabDir
1050: // with the same filename (chassis_info.json).
1051: func (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {
1052: 	imageInspect, err := n.Runtime.InspectImage(ctx, n.Cfg.Image)
1053: 	if err != nil {
1054: 		return fmt.Errorf("inspect image: %w", err)
1055: 	}
1056: 	content, err := ReadFileFromImageInspect(imageInspect, DefaultChassisInfoPath)
1057: 	if err != nil {
1058: 		return err
1059: 	}
1060: 	dstPath := filepath.Join(n.Cfg.LabDir, filepath.Base(DefaultChassisInfoPath))
1061: 	licensed := append([]byte(chassisInfoFileLicense), content...)
1062: 	if err := os.WriteFile(dstPath, licensed, clabconstants.PermissionsFileDefault); err != nil {
1063: 		return fmt.Errorf("write %s: %w", dstPath, err)
1064: 	}
1065: 	log.Debug("Wrote chassis_info.json to lab dir", "node", n.Cfg.ShortName, "path", dstPath)
1066: 	n.warnUnsupportedComponents(content)
1067: 	return nil
1068: }
1069: 
1070: // warnUnsupportedComponents validates the effective component configuration against the
1071: // chassis_info.json extracted from this exact image. Validation is advisory and never blocks
1072: // deploy.
1073: func (n *sros) warnUnsupportedComponents(content []byte) {
1074: 	// A distributed node validates once, from CPM A, to avoid duplicate warnings from CPM B.
1075: 	if !n.isStandaloneNode() && !n.isCPM(slotAName) {
1076: 		return
1077: 	}
1078: 
1079: 	info, err := parseChassisInfo(content)
1080: 	if err != nil {
1081: 		log.Warn("Could not validate SR-SIM components against chassis_info.json",
1082: 			"node", n.Cfg.ShortName, "error", err)
1083: 		return
1084: 	}
1085: 
1086: 	components := n.rootComponents
1087: 	if len(components) == 0 {
1088: 		components = n.kindSpecificCfg().Components
1089: 	}
1090: 
1091: 	effective := n.componentsForConfig(components)
1092: 	if len(effective) == 0 {
1093: 		// Environment variables can configure integrated hardware without a components entry.
1094: 		effective = []*Component{n.componentForConfig(nil)}
1095: 	}
1096: 
1097: 	nodeType := n.Cfg.NodeType
1098: 	if chassis := strings.TrimSpace(n.Cfg.Env[envNokiaSrosChassis]); chassis != "" {
1099: 		nodeType = chassis
1100: 	}
1101: 	for _, warning := range info.componentWarnings(nodeType, n.componentSFM(), effective) {
1102: 		log.Warn("SR-SIM component configuration may not be supported",
1103: 			"node", n.Cfg.ShortName,
1104: 			"chassis", nodeType,
1105: 			"warning", warning)
1106: 	}
1107: }
1108: 
1109: // Func that Places the Certificates in the right place and format.
1110: func (n *sros) createSROSCertificates() error {
1111: 	if *n.Cfg.Certificate.Issue {
1112: 		clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),
1113: 			clabconstants.PermissionsOpen)
1114: 		keyPath := filepath.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3, tlsKeyFile)
1115: 		if err := clabutils.CreateFile(keyPath, n.Config().TLSKey); err != nil {
1116: 			return err
1117: 		}
1118: 
1119: 		certPath := filepath.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3, tlsCertFile)
1120: 		err := clabutils.CreateFile(certPath, n.Config().TLSCert)
1121: 		if err != nil {
1122: 			return err
1123: 		}
1124: 	}
1125: 	return nil
1126: }
1127: 
1128: // SlotIsInteger checks if the slot string represents a valid integer.
1129: func SlotIsInteger(s string) bool {
1130: 	_, err := strconv.Atoi(s)
1131: 	return err == nil
1132: }
1133: 
1134: // Check if a container is a CPM.
1135: // isCPM checks if a container is a CPM (Control Processing Module).
1136: // Returns false if the slot is a linecard (integer slot).
1137: // If a specific CPM name is provided, returns false if this is a different CPM.
1138: func (n *sros) isCPM(cpm string) bool {
1139: 	slot, exists := n.Cfg.Env[envNokiaSrosSlot]
1140: 	if !exists {
1141: 		// No slot specified - this is a CPM
1142: 		return true
1143: 	}
1144: 
1145: 	// If slot is an integer, it's a linecard, not a CPM
1146: 	if SlotIsInteger(slot) {
1147: 		return false
1148: 	}
1149: 
1150: 	// Slot is non-integer (CPM slot). If a specific CPM was requested,
1151: 	// check if this is that CPM
1152: 	if cpm != "" && !strings.EqualFold(slot, cpm) {
1153: 		return false
1154: 	}
1155: 
1156: 	return true
1157: }
1158: 
1159: func (n *sros) GetContainers(ctx context.Context) ([]clabruntime.GenericContainer, error) {
1160: 	// if not a distributed setup call regular GetContainers
1161: 	if n.isStandaloneNode() || n.isDistributedCardNode() {
1162: 		return n.DefaultNode.GetContainers(ctx)
1163: 	}
1164: 
1165: 	cpmSlot, err := n.cpmSlot()
1166: 	if err != nil {
1167: 		return nil, err
1168: 	}
1169: 	containerName := n.calcComponentName(n.GetContainerName(), cpmSlot)
1170: 
1171: 	cnts, err := n.Runtime.ListContainers(ctx, []*clabtypes.GenericFilter{
1172: 		{
1173: 			FilterType: "name",
1174: 			Match:      containerName,
1175: 		},
1176: 	})
1177: 	if err != nil {
1178: 		return nil, err
1179: 	}
1180: 	// check that we retrieved some container information
1181: 	// otherwise throw ErrContainersNotFound error
1182: 	if len(cnts) == 0 {
1183: 		// check for the netns holder as to never orphan it.
1184: 		if n.netnsNode != nil {
1185: 			return n.netnsNode.GetContainers(ctx)
1186: 		}
1187: 		return nil, fmt.Errorf("node: %s. %w", n.GetContainerName(),
1188: 			clabnodes.ErrContainersNotFound)
1189: 	}
1190: 
1191: 	// Forge the IP address to be the actual IP of mgmt
1192: 	// because the CPM A might not own the netns & mgmt IP
1193: 	if len(n.kindSpecificCfg().Components) > 0 {
1194: 		ips, err := n.distNodeMgmtIPs()
1195: 		if err == nil {
1196: 			if ips.IPv4 != "" {
1197: 				cnts[0].NetworkSettings.IPv4addr = ips.IPv4
1198: 				cnts[0].NetworkSettings.IPv4pLen = ips.IPv4pLen
1199: 			}
1200: 			if ips.IPv6 != "" {
1201: 				cnts[0].NetworkSettings.IPv6addr = ips.IPv6
1202: 				cnts[0].NetworkSettings.IPv6pLen = ips.IPv6pLen
1203: 			}
1204: 		}
1205: 	}
1206: 
1207: 	return cnts, err
1208: }
1209: 
1210: // populateHosts adds container hostnames for other nodes of a lab to SR Linux /etc/hosts file
1211: // to mitigate the fact that srlinux uses non default netns for management and thus
1212: // can't leverage docker DNS service.
1213: func (n *sros) populateHosts(ctx context.Context, nodes map[string]clabnodes.Node) error {
1214: 	containerName := n.Cfg.LongName
1215: 	if n.isDistributedBaseNode() && n.cpmContainerName != "" {
1216: 		containerName = n.cpmContainerName
1217: 	}
1218: 
1219: 	hosts, err := n.Runtime.GetHostsPath(ctx, containerName)
1220: 	if err != nil {
1221: 		log.Warn("Unable to locate SR OS node /etc/hosts file", "node", n.Cfg.ShortName, "err", err)
1222: 		return err
1223: 	}
1224: 	var entriesv4, entriesv6 bytes.Buffer
1225: 	const (
1226: 		v4Prefix = "###### CLAB-v4-START ######"
1227: 		v4Suffix = "###### CLAB-v4-END ######"
1228: 		v6Prefix = "###### CLAB-v6-START ######"
1229: 		v6Suffix = "###### CLAB-v6-END ######"
1230: 	)
1231: 	fmt.Fprintf(&entriesv4, "\n%s\n", v4Prefix)
1232: 	fmt.Fprintf(&entriesv6, "\n%s\n", v6Prefix)
1233: 	for node, params := range nodes {
1234: 		if v4 := params.Config().MgmtIPv4Address; v4 != "" {
1235: 			fmt.Fprintf(&entriesv4, "%s\t%s\n", v4, node)
1236: 		}
1237: 		if v6 := params.Config().MgmtIPv6Address; v6 != "" {
1238: 			fmt.Fprintf(&entriesv6, "%s\t%s\n", v6, node)
1239: 		}
1240: 	}
1241: 	fmt.Fprintf(&entriesv4, "%s\n", v4Suffix)
1242: 	fmt.Fprintf(&entriesv6, "%s\n", v6Suffix)
1243: 
1244: 	file, err := os.OpenFile(hosts, os.O_APPEND|os.O_WRONLY, 0o666) // skipcq: GSC-G302
1245: 	if err != nil {
1246: 		log.Warn("Unable to open SR OS node /etc/hosts file", "node", n.Cfg.ShortName, "err", err)
1247: 		return err
1248: 	}
1249: 
1250: 	_, err = file.Write(entriesv4.Bytes())
1251: 	if err != nil {
1252: 		return err
1253: 	}
1254: 	_, err = file.Write(entriesv6.Bytes())
1255: 	if err != nil {
1256: 		return err
1257: 	}
1258: 
1259: 	return file.Close()
1260: }
1261: 
1262: func (n *sros) GetMappedInterfaceName(ifName string) (string, error) {
1263: 	captureGroups, err := clabutils.GetRegexpCaptureGroups(n.InterfaceRegexp, ifName)
1264: 	if err != nil {
1265: 		return "", err
1266: 	}
1267: 
1268: 	indexGroups := []string{"card", "xiom", "mda", "connector", "port"}
1269: 	parsedIndices := make(map[string]int)
1270: 	foundIndices := make(map[string]bool)
1271: 
1272: 	for _, indexKey := range indexGroups {
1273: 		if index, found := captureGroups[indexKey]; found && index != "" {
1274: 			foundIndices[indexKey] = true
1275: 			parsedIndices[indexKey], err = strconv.Atoi(index)
1276: 			if err != nil {
1277: 				return "", fmt.Errorf(
1278: 					"%q parsed %s index %q could not be cast to an integer",
1279: 					ifName,
1280: 					indexKey,
1281: 					index,
1282: 				)
1283: 			}
1284: 			if parsedIndices[indexKey] < 1 {
1285: 				return "", fmt.Errorf(
1286: 					"%q parsed %q index %q does not match requirement >= 1",
1287: 					ifName,
1288: 					indexKey,
1289: 					index,
1290: 				)
1291: 			}
1292: 		} else {
1293: 			foundIndices[indexKey] = false
1294: 		}
1295: 	}
1296: 
1297: 	// Card, MDA and port are present
1298: 	if foundIndices["card"] && foundIndices["mda"] && foundIndices["port"] {
1299: 		switch {
1300: 		case foundIndices["xiom"] && foundIndices["connector"]:
1301: 			// XIOM and connector are present, format will be: e1-x2-3-c4-5 -> card 1, xiom 2, mda
1302: 			// 3, connector 4, port 5
1303: 			return fmt.Sprintf(
1304: 				"e%d-x%d-%d-c%d-%d",
1305: 				parsedIndices["card"],
1306: 				parsedIndices["xiom"],
1307: 				parsedIndices["mda"],
1308: 				parsedIndices["connector"],
1309: 				parsedIndices["port"],
1310: 			), nil
1311: 
1312: 		case foundIndices["xiom"]:
1313: 			// Only XIOM present, format will be: e1-x2-3-4 -> card 1, xiom 2, mda 3, port 4
1314: 			return fmt.Sprintf("e%d-x%d-%d-%d", parsedIndices["card"],
1315: 				parsedIndices["xiom"], parsedIndices["mda"], parsedIndices["port"]), nil
1316: 		case foundIndices["connector"]:
1317: 			// Only connector present, format will be: e1-2-c3-4 -> card 1, mda 2, connector 3, port
1318: 			// 4
1319: 			return fmt.Sprintf("e%d-%d-c%d-%d", parsedIndices["card"],
1320: 				parsedIndices["mda"], parsedIndices["connector"], parsedIndices["port"]), nil
1321: 		default:
1322: 			// No XIOM or connector present, format will be: e1-2-3 -> card 1, mda 2, port 3
1323: 			return fmt.Sprintf("e%d-%d-%d", parsedIndices["card"],
1324: 				parsedIndices["mda"], parsedIndices["port"]), nil
1325: 		}
1326: 	} else {
1327: 		return "", fmt.Errorf("%q missing card, mda or port index", ifName)
1328: 	}
1329: }
1330: 
1331: // CheckInterfaceName checks if a name of the interface referenced in the topology file correct.
1332: func (n *sros) CheckInterfaceName() error {
1333: 	nm := n.Cfg.NetworkMode
1334: 
1335: 	err := n.CheckInterfaceOverlap()
1336: 	if err != nil {
1337: 		return err
1338: 	}
1339: 
1340: 	for _, e := range n.Endpoints {
1341: 		if !MappedInterfaceRegexp.MatchString(e.GetIfaceName()) {
1342: 			return fmt.Errorf(
1343: 				"nokia SR OS interface name %q doesn't match the required pattern: %s",
1344: 				e.GetIfaceName(),
1345: 				n.InterfaceHelp,
1346: 			)
1347: 		}
1348: 
1349: 		if e.GetIfaceName() == "eth0" && nm != "none" {
1350: 			return fmt.Errorf(
1351: 				"eth0 interface name is not allowed for %s node when network mode is not set to none",
1352: 				n.Cfg.ShortName,
1353: 			)
1354: 		}
1355: 	}
1356: 
1357: 	return nil
1358: }
1359: 
1360: func (n *sros) SaveConfig(ctx context.Context) (*clabnodes.SaveConfigResult, error) {
1361: 	fqdn := ""
1362: 	switch {
1363: 	case n.isStandaloneNode():
1364: 		// check if it is a cpm node. return without error if not
1365: 		if !n.isCPM("") {
1366: 			return nil, nil
1367: 		}
1368: 		// if it is a standalone node use the fqdn
1369: 		fqdn = n.Cfg.Fqdn
1370: 	case n.isDistributedBaseNode():
1371: 		// if it is the
1372: 		cmpNode, err := n.cpmNode()
1373: 		if err != nil {
1374: 			return nil, err
1375: 		}
1376: 		// delegate to cpm node
1377: 		return cmpNode.SaveConfig(ctx)
1378: 	case n.isDistributedCardNode():
1379: 		// check if it is a cpm node. return without error if not
1380: 		if !n.isCPM("") {
1381: 			return nil, nil
1382: 		}
1383: 		fqdn = n.Cfg.LongName
1384: 	}
1385: 
1386: 	if err := n.saveConfigWithAddr(ctx, fqdn); err != nil {
1387: 		return nil, err
1388: 	}
1389: 
1390: 	cfgPath := filepath.Join(
1391: 		n.Cfg.LabDir,
1392: 		n.Cfg.Env[envNokiaSrosSlot],
1393: 		configCf3,
1394: 		startupCfgName,
1395: 	)
1396: 
1397: 	return &clabnodes.SaveConfigResult{
1398: 		ConfigPath: cfgPath,
1399: 	}, nil
1400: }
1401: 
1402: // saveConfigWithAddr will use the addr string to try to save the config of the node.
1403: func (n *sros) saveConfigWithAddr(ctx context.Context, addr string) error {
1404: 	if n.isConfigClassic() {
1405: 		cmd := []string{"/admin save", "/bof persist on", "/bof save"}
1406: 		return n.srosSendCommandsSSH(ctx, scrapliPlatformNameClassic, cmd)
1407: 	}
1408: 	err := clabnetconf.SaveRunningConfig(fmt.Sprintf("[%s]", addr),
1409: 		n.Cfg.Credentials.Username,
1410: 		n.Cfg.Credentials.Password,
1411: 		scrapliPlatformName,
1412: 	)
1413: 	if err != nil {
1414: 		return err
1415: 	}
1416: 
1417: 	log.Info(
1418: 		"Saved running configuration",
1419: 		"node",
1420: 		n.Cfg.ShortName,
1421: 		"addr",
1422: 		addr,
1423: 		"config-mode",
1424: 		n.kindSpecificCfg().ConfigMode,
1425: 	)
1426: 
1427: 	return nil
1428: }
1429: 
1430: // TLS bootstrap via NETCONF to enable secure gRPC.
1431: func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {
1432: 	// Always import PKI key and cert:
1433: 	// 	 import "cf3:\node.key" in PEM format as "cf3:\system-pki\node.key" (encrypted DER)
1434: 	//   import "cf3:\node.crt" in PEM format as "cf3:\system-pki\node.crt" (encrypted DER)
1435: 	operations := []clabnetconf.Operation{
1436: 		func(d *netconf.Driver) (*response.NetconfResponse, error) {
1437: 			return d.RPC(opoptions.WithFilter(buildPKIImportXML(
1438: 				fmt.Sprintf("cf3:/%s", tlsKeyFile), tlsKeyFile, "key")))
1439: 		},
1440: 		func(d *netconf.Driver) (*response.NetconfResponse, error) {
1441: 			return d.RPC(opoptions.WithFilter(buildPKIImportXML(
1442: 				fmt.Sprintf("cf3:/%s", tlsCertFile), tlsCertFile, "certificate")))
1443: 		},
1444: 	}
1445: 
1446: 	// Activate cert-profile in MD is via NETCONF, in Classic mode is via SSH
1447: 	//  enable enables cert-profile "clab-grpc-certs" administratively
1448: 	cmd := []string{}
1449: 	if n.isConfigClassic() {
1450: 		cmd = append(
1451: 			cmd,
1452: 			fmt.Sprintf(
1453: 				"/configure system security tls cert-profile %s no shutdown",
1454: 				tlsCertProfileName,
1455: 			),
1456: 		)
1457: 	} else {
1458: 		operations = append(operations,
1459: 			func(d *netconf.Driver) (*response.NetconfResponse, error) {
1460: 				return d.EditConfig("candidate", buildTLSProfileXML())
1461: 			},
1462: 			func(d *netconf.Driver) (*response.NetconfResponse, error) {
1463: 				return d.Commit()
1464: 			},
1465: 		)
1466: 	}
1467: 
1468: 	err := clabnetconf.MultiExec(
1469: 		fmt.Sprintf("[%s]", addr),
1470: 		n.Cfg.Credentials.Username,
1471: 		n.Cfg.Credentials.Password,
1472: 		operations,
1473: 	)
1474: 	if len(cmd) > 0 && n.isConfigClassic() {
1475: 		err := n.srosSendCommandsSSH(ctx, scrapliPlatformNameClassic, cmd)
1476: 		if err != nil {
1477: 			return err
1478: 		}
1479: 	}
1480: 	return err
1481: }
1482: 
1483: func (n *sros) IsHealthy(_ context.Context) (bool, error) {
1484: 	if !n.isCPM("") {
1485: 		return true, fmt.Errorf("node %q is not a CPM, healthcheck has no effect", n.Cfg.LongName)
1486: 	}
1487: 	// non-partial user startup config might not have any netconf config
1488: 	// so we shouldn't check for this.
1489: 	if isFullConfigFile(n.Cfg.StartupConfig) {
1490: 		log.Debug(
1491: 			"node has full startup config, skipping NETCONF check",
1492: 			"kind",
1493: 			n.Cfg.Kind,
1494: 			"node",
1495: 			n.Cfg.ShortName,
1496: 		)
1497: 		return true, nil
1498: 	}
1499: 	addr, err := n.MgmtIPAddr()
1500: 	if err != nil {
1501: 		return false, err
1502: 	}
1503: 	log.Debug(
1504: 		"Checking netconf connection",
1505: 		"node",
1506: 		n.Cfg.LongName,
1507: 		"addr",
1508: 		fmt.Sprintf("%q:830", addr),
1509: 	)
1510: 	return CheckPortWithRetry(addr, 830, readyTimeout, int(readyTimeout/retryTimer), retryTimer)
1511: }
1512: 
1513: // CheckPortWithRetry checks if a port is open with retry logic.
1514: func CheckPortWithRetry(
1515: 	host string,
1516: 	port int,
1517: 	timeout time.Duration,
1518: 	maxRetries int,
1519: 	retryDelay time.Duration,
1520: ) (bool, error) {
1521: 	var lastErr error
1522: 	address := net.JoinHostPort(host, fmt.Sprintf("%d", port))
1523: 	deadline := time.Now().Add(timeout)
1524: 
1525: 	for i := range maxRetries {
1526: 		if i > 0 {
1527: 			if remaining := time.Until(deadline); remaining <= 0 {
1528: 				break
1529: 			} else if retryDelay < remaining {
1530: 				time.Sleep(retryDelay)
1531: 			} else {
1532: 				time.Sleep(remaining)
1533: 			}
1534: 		}
1535: 
1536: 		remaining := time.Until(deadline)
1537: 		if remaining <= 0 {
1538: 			break
1539: 		}
1540: 
1541: 		dialTimeout := tcpDialTimeout
1542: 		if remaining < dialTimeout {
1543: 			dialTimeout = remaining
1544: 		}
1545: 
1546: 		conn, err := net.DialTimeout("tcp", address, dialTimeout)
1547: 		if err == nil {
1548: 			conn.Close()
1549: 			return true, nil
1550: 		}
1551: 		lastErr = err
1552: 	}
1553: 
1554: 	if lastErr == nil {
1555: 		lastErr = fmt.Errorf("timed out checking tcp port %s", address)
1556: 	}
1557: 
1558: 	return false, lastErr
1559: }
1560: 
1561: // MgmtIP represents the management IPv4/v6 addresses of a node.
1562: type MgmtIP struct {
1563: 	IPv4        string
1564: 	IPv4pLen    int
1565: 	IPv4Gw      string
1566: 	IPv6        string
1567: 	IPv6pLen    int
1568: 	IPv6Gw      string
1569: 	ContainerID string
1570: }
1571: 
1572: // distNodeMgmtIPs returns both ipv4 and ipv6 management IP address of a
1573: // distributed node defined via components.
1574: // It returns an error if neither is set in the node config.
1575: func (n *sros) distNodeMgmtIPs() (MgmtIP, error) {
1576: 	ips := MgmtIP{}
1577: 
1578: 	var containerName string
1579: 	if n.isDistributedBaseNode() {
1580: 		if n.netnsNode != nil {
1581: 			containerName = n.netnsNode.Config().LongName
1582: 		}
1583: 	} else {
1584: 		containerName = n.rootCtrName
1585: 	}
1586: 
1587: 	if containerName == "" {
1588: 		return ips, nil
1589: 	}
1590: 
1591: 	containers, err := n.Runtime.ListContainers(
1592: 		context.Background(),
1593: 		[]*clabtypes.GenericFilter{
1594: 			{
1595: 				FilterType: "name",
1596: 				Match:      containerName,
1597: 			},
1598: 		},
1599: 	)
1600: 	if err != nil {
1601: 		return MgmtIP{}, fmt.Errorf("unable to get container %q: %v", containerName, err)
1602: 	}
1603: 
1604: 	for _, container := range containers {
1605: 		if container.NetworkSettings.IPv4addr != "" {
1606: 			ips.IPv4 = container.NetworkSettings.IPv4addr
1607: 			ips.IPv4pLen = container.NetworkSettings.IPv4pLen
1608: 			ips.IPv4Gw = container.NetworkSettings.IPv4Gw
1609: 			ips.ContainerID = container.ID
1610: 		}
1611: 		if container.NetworkSettings.IPv6addr != "" {
1612: 			ips.IPv6 = container.NetworkSettings.IPv6addr
1613: 			ips.IPv6pLen = container.NetworkSettings.IPv6pLen
1614: 			ips.IPv6Gw = container.NetworkSettings.IPv6Gw
1615: 			ips.ContainerID = container.ID
1616: 		}
1617: 	}
1618: 
1619: 	return ips, nil
1620: }
1621: 
1622: // custom override for hosts file entry to write basename when using component nodes.
1623: func (n *sros) GetHostsEntries(ctx context.Context) (clabtypes.HostEntries, error) {
1624: 	result, err := n.DefaultNode.GetHostsEntries(ctx)
1625: 	if err != nil {
1626: 		return nil, err
1627: 	}
1628: 
1629: 	if n.isDistributedBaseNode() {
1630: 		ips, err := n.distNodeMgmtIPs()
1631: 		if err != nil {
1632: 			return clabtypes.HostEntries{}, err
1633: 		}
1634: 
1635: 		if ips.IPv4 != "" { // v4
1636: 			result = append(result, clabtypes.NewHostEntry(
1637: 				ips.IPv4,
1638: 				n.Cfg.LongName,
1639: 				clabtypes.IpVersionV4,
1640: 			).SetDescription(fmt.Sprintf("Kind: %s", n.Cfg.Kind)).SetContainerID(ips.ContainerID))
1641: 		}
1642: 
1643: 		if ips.IPv6 != "" {
1644: 			result = append(result, clabtypes.NewHostEntry(
1645: 				ips.IPv6,
1646: 				n.Cfg.LongName,
1647: 				clabtypes.IpVersionV6,
1648: 			).SetDescription(fmt.Sprintf("Kind: %s", n.Cfg.Kind)).SetContainerID(ips.ContainerID))
1649: 		}
1650: 	}
1651: 
1652: 	return result, nil
1653: }
1654: 
1655: // MgmtIPAddr returns ipv4 or ipv6 management IP address of the node.
1656: // It returns an error if neither is set in the node config.
1657: func (n *sros) MgmtIPAddr() (string, error) {
1658: 	switch {
1659: 	case n.Cfg.MgmtIPv6Address != "":
1660: 		return n.Cfg.MgmtIPv6Address, nil
1661: 	case n.Cfg.MgmtIPv4Address != "":
1662: 		return n.Cfg.MgmtIPv4Address, nil
1663: 	}
1664: 
1665: 	if !n.isStandaloneNode() {
1666: 		ips, err := n.distNodeMgmtIPs()
1667: 		if err != nil {
1668: 			return "", err
1669: 		}
1670: 
1671: 		switch {
1672: 		case ips.IPv6 != "":
1673: 			return ips.IPv6, nil
1674: 		case ips.IPv4 != "":
1675: 			return ips.IPv4, nil
1676: 		}
1677: 	}
1678: 
1679: 	return n.Cfg.LongName, fmt.Errorf(
1680: 		"no management IP address (IPv4 or IPv6) configured for node %q",
1681: 		n.Cfg.LongName,
1682: 	)
1683: }
1684: 
1685: // override to fetch CPM to avoid renaming the base node to CPM A.
1686: func (n *sros) GetContainerName() string {
1687: 	if n.isDistributedBaseNode() && n.cpmContainerName != "" {
1688: 		return n.cpmContainerName
1689: 	}
1690: 	return n.DefaultNode.GetContainerName()
1691: }
1692: 
1693: // MonitorLogs monitors log output from the provided reader during the PostDeploy phase of SRSIM.
1694: // It scans each line for SR OS error messages (minor or critical) and logs them as warnings
1695: // The method checks for context cancellation on each line and returns immediately if the
1696: // context is cancelled.
1697: // Parameters:
1698: //   - ctx: context for cancellation; if cancelled, the method returns.
1699: //   - reader: io.ReadCloser providing log lines to scan.

(Output capped at 50 KB. Showing lines 1-1699. Use offset=1700 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502e65c2001FRS52Tjj8d3S16",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e5f42001e10roJstImV7H5",
  "callID": "call_f61a09a2bb7347a7b68e64dc",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/sros.go"
    },
    "output": "<path>/source/head/nodes/sros/sros.go</path>\n<type>file</type>\n<content>\n1: // Copyright 2025 Nokia\n2: // Licensed under the BSD 3-Clause License.\n3: // SPDX-License-Identifier: BSD-3-Clause\n4: \n5: package sros\n6: \n7: import (\n8: \t\"bufio\"\n9: \t\"bytes\"\n10: \t\"context\"\n11: \t\"errors\"\n12: \t\"fmt\"\n13: \t\"io\"\n14: \t\"maps\"\n15: \t\"net\"\n16: \t\"os\"\n17: \t\"path\"\n18: \t\"path/filepath\"\n19: \t\"reflect\"\n20: \t\"regexp\"\n21: \t\"slices\"\n22: \t\"strconv\"\n23: \t\"strings\"\n24: \t\"time\"\n25: \n26: \t\"github.com/brunoga/deep\"\n27: \t\"github.com/charmbracelet/log\"\n28: \t\"github.com/scrapli/scrapligo/driver/netconf\"\n29: \t\"github.com/scrapli/scrapligo/driver/opoptions\"\n30: \n31: \t\"github.com/scrapli/scrapligo/response\"\n32: \n33: \tclabconstants \"github.com/srl-labs/containerlab/constants\"\n34: \tclabexec \"github.com/srl-labs/containerlab/exec\"\n35: \tclablinks \"github.com/srl-labs/containerlab/links\"\n36: \tclabnetconf \"github.com/srl-labs/containerlab/netconf\"\n37: \tclabnodes \"github.com/srl-labs/containerlab/nodes\"\n38: \tclabnodesstate \"github.com/srl-labs/containerlab/nodes/state\"\n39: \tclabruntime \"github.com/srl-labs/containerlab/runtime\"\n40: \tclabtypes \"github.com/srl-labs/containerlab/types\"\n41: \tclabutils \"github.com/srl-labs/containerlab/utils\"\n42: \t\"golang.org/x/crypto/ssh\"\n43: )\n44: \n45: const (\n46: \tSrosDefaultType = \"SR-1\" // default sros node type\n47: \n48: \treadyTimeout   = time.Minute * 1 // max wait time for node to boot\n49: \ttcpDialTimeout = time.Second * 1\n50: \n51: \tgenerateable     = true\n52: \tgenerateIfFormat = \"%d/%d/%d\"\n53: \n54: \tslotAName = \"A\"\n55: \tslotBName = \"B\"\n56: \n57: \tstandaloneSlotName = slotAName\n58: \n59: \tretryTimer = 1 * time.Second\n60: \n61: \tscrapliPlatformName        = \"nokia_sros\"\n62: \tscrapliPlatformNameClassic = \"nokia_sros_classic\"\n63: \tconfigCf3                  = \"config/cf3\"\n64: \tconfigCf2                  = \"config/cf2\"\n65: \tconfigCf1                  = \"config/cf1\"\n66: \tstartupCfgName             = \"config.cfg\"\n67: \ttlsKeyFile                 = \"node.key\"\n68: \ttlsCertFile                = \"node.crt\"\n69: \ttlsCertProfileName         = \"clab-grpc-certs\"\n70: \n71: \t// SR-SIM ENV VARS.\n72: \tenvNokiaSrosSlot          = \"NOKIA_SROS_SLOT\"\n73: \tenvNokiaSrosChassis       = \"NOKIA_SROS_CHASSIS\"\n74: \tenvNokiaSrosSystemBaseMac = \"NOKIA_SROS_SYSTEM_BASE_MAC\"\n75: \tenvNokiaSrosCard          = \"NOKIA_SROS_CARD\"\n76: \tenvNokiaSrosSFM           = \"NOKIA_SROS_SFM\"\n77: \tenvNokiaSrosXIOM          = \"NOKIA_SROS_XIOM\"\n78: \tenvNokiaSrosMDA           = \"NOKIA_SROS_MDA\"\n79: \tenvSrosIPv4Active         = \"NOKIA_SROS_ADDRESS_IPV4_ACTIVE\"\n80: \tenvSrosIPv6Active         = \"NOKIA_SROS_ADDRESS_IPV6_ACTIVE\"\n81: \tenvSrosStaticRoutePrefix  = \"NOKIA_SROS_STATIC_ROUTE_\"\n82: \n83: \tsrosMinorError     = \"MINOR:\"\n84: \tsrosCriticalError  = \"CRITICAL:\"\n85: \tsrosRejectedCfgMsg = \"Configuration load failed - using default configuration\"\n86: )\n87: \n88: var (\n89: \tkindNames  = []string{\"nokia_srsim\"}\n90: \tsrosSysctl = map[string]string{\n91: \t\t\"net.ipv4.ip_forward\":                \"0\",\n92: \t\t\"net.ipv6.conf.all.disable_ipv6\":     \"0\",\n93: \t\t\"net.ipv6.conf.default.disable_ipv6\": \"0\",\n94: \t\t\"net.ipv6.conf.all.accept_dad\":       \"0\",\n95: \t\t\"net.ipv6.conf.default.accept_dad\":   \"0\",\n96: \t\t\"net.ipv6.conf.all.autoconf\":         \"0\",\n97: \t\t\"net.ipv6.conf.default.autoconf\":     \"0\",\n98: \t\t\"net.ipv4.conf.all.rp_filter\":        \"0\",\n99: \t\t\"net.ipv6.conf.all.accept_ra\":        \"0\",\n100: \t\t\"net.ipv6.conf.default.accept_ra\":    \"0\",\n101: \t\t\"net.ipv4.conf.default.rp_filter\":    \"0\",\n102: \t}\n103: \tdefaultCredentials = clabnodes.NewCredentials(\"admin\", \"NokiaSros1!\")\n104: \n105: \tsrosEnv = map[string]string{\n106: \t\t\"SRSIM\":                   \"1\",\n107: \t\tenvNokiaSrosChassis:       SrosDefaultType,     // filler to be overridden\n108: \t\tenvNokiaSrosSystemBaseMac: \"fa:ac:ff:ff:10:00\", // filler to be overridden\n109: \t\tenvNokiaSrosSlot:          slotAName,           // filler to be overridden\n110: \t}\n111: \n112: \treadyCmdCpm  = `/usr/bin/pgrep ^cpm$`\n113: \treadyCmdBoth = `/usr/bin/pgrep ^both$`\n114: \treadyCmdIom  = `/usr/bin/pgrep ^iom$`\n115: \n116: \trequiredKernelVersion = &clabutils.KernelVersion{\n117: \t\tMajor:    5,\n118: \t\tMinor:    5,\n119: \t\tRevision: 0,\n120: \t}\n121: \t// Internal directories inside SR-SIM container.\n122: \tcf1Dir = \"/home/sros/flash1\"\n123: \tcf2Dir = \"/home/sros/flash2\"\n124: \tcf3Dir = \"/home/sros/flash3\" // Where the running config will be stored\n125: \tlicDir = \"/nokia/license\"\n126: \n127: \tInterfaceRegexp = regexp.MustCompile(\n128: \t\t`^(?P<card>\\d+)/(?:x(?P<xiom>\\d+)/)?(?P<mda>\\d+)(?:/c(?P<connector>\\d+))?/(?P<port>\\d+)$`,\n129: \t)\n130: \tMappedInterfaceRegexp = regexp.MustCompile(\n131: \t\t`^(?:e(?P<card>\\d+)-(?:x(?P<xiom>\\d+)-)?(?P<mda>\\d+)(?:-c(?P<connector>\\d+))?-(?P<port>\\d+)|eth(?P<mgmtPort>\\d+))$`,\n132: \t)\n133: \tInterfaceHelp = `The format of the interface name need to be one of:\n134: \t  Regular SR OS interface names, that is:\n135: \t  1/2/3       -> card 1, mda 2, port 3\n136:       1/2/c3/4    -> card 1, mda 2, connector 3, port 4\n137:       1/x2/3/4    -> card 1, xiom 2, mda 3, port 4\n138:       1/x2/3/c4/5 -> card 1, xiom 2, mda 3, connector 4, port 5\n139: \t  The mapped Linux interface names, that is:\n140:       e1-2-3       -> card 1, mda 2, port 3\n141:       e1-2-c3-4    -> card 1, mda 2, connector 3, port 4\n142:       e1-x2-3-4    -> card 1, xiom 2, mda 3, port 4\n143:       e1-x2-3-c4-5 -> card 1, xiom 2, mda 3, connector 4, port 5\n144: \t  eth[0-9], for management interfaces of CPM-A/CPM-B or for fabric interfaces`\n145: )\n146: \n147: // Register registers the node in the NodeRegistry.\n148: func Register(r *clabnodes.NodeRegistry) {\n149: \tgenerateNodeAttributes := clabnodes.NewGenerateNodeAttributes(generateable, generateIfFormat)\n150: \tplatformOpts := &clabnodes.PlatformAttrs{\n151: \t\tScrapliPlatformName: scrapliPlatformName,\n152: \t}\n153: \tnrea := clabnodes.NewNodeRegistryEntryAttributes(\n154: \t\tdefaultCredentials,\n155: \t\tgenerateNodeAttributes,\n156: \t\tplatformOpts,\n157: \t).WithKindSpecificConfig(kindSpecificConfig)\n158: \n159: \tr.Register(kindNames, func() clabnodes.Node {\n160: \t\treturn new(sros)\n161: \t}, nrea)\n162: }\n163: \n164: // KindSpecificConfig is the nokia_srsim kind-specific config, set as keys on the node definition.\n165: type KindSpecificConfig struct {\n166: \t// ConfigMode is the SR OS configuration mode: model-driven (default), classic or mixed.\n167: \tConfigMode ConfigMode `yaml:\"config-mode,omitempty\" json:\"config-mode,omitempty\"`\n168: \t// GenComponentConfig generates the configuration of the node's components. Defaults to true.\n169: \tGenComponentConfig bool         `yaml:\"gen-component-config\" json:\"gen-component-config\"`\n170: \tSFM                string       `yaml:\"sfm,omitempty\" json:\"sfm,omitempty\"`\n171: \tComponents         []*Component `yaml:\"components,omitempty\" json:\"components,omitempty\"`\n172: }\n173: \n174: // SetDefaults implements clabnodes.KindSpecificConfigDefaulter.\n175: func (c *KindSpecificConfig) SetDefaults() { c.GenComponentConfig = true }\n176: \n177: // equalIgnoringComponentOrder reports whether c and o are equal, comparing components by slot\n178: // regardless of their order and the case of the slot.\n179: func (c *KindSpecificConfig) equalIgnoringComponentOrder(o *KindSpecificConfig) bool {\n180: \ta, b := *c, *o\n181: \ta.Components, b.Components = nil, nil\n182: \n183: \treturn reflect.DeepEqual(a, b) &&\n184: \t\treflect.DeepEqual(componentsBySlot(c.Components), componentsBySlot(o.Components))\n185: }\n186: \n187: var kindSpecificConfig clabnodes.KindSpecificConfigSpec[KindSpecificConfig]\n188: \n189: // sros SR-SIM Kind structure.\n190: type sros struct {\n191: \tclabnodes.DefaultNode\n192: \t// startup-config passed as a path to a file with CLI instructions will be read into this byte\n193: \t// slice\n194: \tstartupCliCfg []byte\n195: \n196: \t// SSH public keys extracted from the clab host\n197: \tsshPubKeys []ssh.PublicKey\n198: \n199: \t// software version SR OS x node runs\n200: \tswVersion      *SrosVersion\n201: \tcomponentNodes []clabnodes.Node\n202: \n203: \t// in distributed mode we rename the Cfg.LongName and Cfg.ShortName and Cfg.Fqdn attributes when\n204: \t// deploying. e.g. inspect is either called after deploy or independently. Hence we need to\n205: \t// differentiate if we need to perform the\n206: \t// component cpm based rename or not. This field indicates just that\n207: \trenameDone bool\n208: \t// rootComponents stores the OG components from root node for dist setups\n209: \t// ..allows children of the distributed root node to access root components (ie. for cfg gen)\n210: \trootComponents []*Component\n211: \t// store the longname with cpm suffix\n212: \tcpmContainerName string\n213: \t// for component nodes, store base nodes\n214: \tbaseShortName string\n215: \tbaseLongName  string\n216: \t// rootCtrName is the container that owns the netns.\n217: \t//  - for components based: the internal netns container.\n218: \t//  - for network mode based: parsed from network-mode.\n219: \trootCtrName string\n220: \n221: \t// userEnv is the env map from the topology, before component fields are merged in.\n222: \t// Node env overrides component type, XIOM, MDA, SFM, and per-component env.\n223: \tuserEnv map[string]string\n224: \n225: \tpreDeployParams *clabnodes.PreDeployParams\n226: \n227: \tnetnsNode clabnodes.Node\n228: }\n229: \n230: func (*sros) LinkApplyMode(context.Context) clabnodes.LinkApplyMode {\n231: \treturn clabnodes.LinkApplyModeLive\n232: }\n233: \n234: // Init Function for SR-SIM kind.\n235: func (n *sros) kindSpecificCfg() *KindSpecificConfig { return kindSpecificConfig.Of(n.Cfg) }\n236: \n237: func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) error {\n238: \t// Init DefaultNode\n239: \tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n240: \t// set virtualization requirement\n241: \tn.HostRequirements.SSSE3 = true\n242: \tn.HostRequirements.MinVCPU = 4\n243: \tn.HostRequirements.MinVCPUFailAction = clabtypes.FailBehaviourError\n244: \tn.HostRequirements.MinAvailMemoryGb = 4\n245: \tn.HostRequirements.MinAvailMemoryGbFailAction = clabtypes.FailBehaviourLog\n246: \n247: \tn.LicensePolicy = clabtypes.LicensePolicyRequired\n248: \n249: \tn.Cfg = cfg\n250: \n251: \tn.InterfaceHelp = InterfaceHelp\n252: \tn.InterfaceRegexp = InterfaceRegexp\n253: \n254: \tfor _, o := range opts {\n255: \t\to(n)\n256: \t}\n257: \n258: \t// if user was not initialized to a value, use root\n259: \tif n.Cfg.User == \"\" {\n260: \t\tn.Cfg.User = \"0:0\"\n261: \t}\n262: \n263: \t// Snapshot topology env before component and SFM flags are applied.\n264: \t// Component nodes set userEnv from the base node before Init.\n265: \tenvAlreadyResolved := n.userEnv != nil\n266: \tif !envAlreadyResolved {\n267: \t\tif n.Cfg.Env == nil {\n268: \t\t\tn.userEnv = map[string]string{}\n269: \t\t} else {\n270: \t\t\tn.userEnv = maps.Clone(n.Cfg.Env)\n271: \t\t}\n272: \t}\n273: \tif n.Cfg.Env == nil {\n274: \t\tn.Cfg.Env = map[string]string{}\n275: \t}\n276: \n277: \t// Distributed cards inherit SFM from the base node env. Applying it again\n278: \t// would warn once per card when the user also set NOKIA_SROS_SFM.\n279: \tif sfm := n.kindSpecificCfg().SFM; sfm != \"\" && !envAlreadyResolved {\n280: \t\tif envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {\n281: \t\t\tif envSFM != sfm {\n282: \t\t\t\tlog.Warn(\n283: \t\t\t\t\tfmt.Sprintf(\n284: \t\t\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n285: \t\t\t\t\t\tsfm,\n286: \t\t\t\t\t\tenvNokiaSrosSFM,\n287: \t\t\t\t\t),\n288: \t\t\t\t\t\"node\", n.Cfg.ShortName,\n289: \t\t\t\t\t\"env\", envNokiaSrosSFM,\n290: \t\t\t\t\t\"component-value\", sfm,\n291: \t\t\t\t\t\"env-value\", envSFM,\n292: \t\t\t\t)\n293: \t\t\t}\n294: \t\t} else {\n295: \t\t\tn.Cfg.Env[envNokiaSrosSFM] = sfm\n296: \t\t}\n297: \t}\n298: \n299: \tmaps.Copy(n.Cfg.Sysctls, srosSysctl)\n300: \n301: \t// make sure we always have uppercase slot definition\n302: \tfor _, c := range n.kindSpecificCfg().Components {\n303: \t\tc.Slot = strings.ToUpper(c.Slot)\n304: \t}\n305: \t// Merge Environment\n306: \tif n.Cfg.NodeType == \"\" {\n307: \t\tn.Cfg.NodeType = SrosDefaultType\n308: \t}\n309: \tsrosEnv[envNokiaSrosChassis] = n.Cfg.NodeType // Override NodeType var with existing env\n310: \n311: \tmac := genMac(n.Cfg)\n312: \tsrosEnv[envNokiaSrosSystemBaseMac] = mac\n313: \t// Ensure n.Cfg.Certificate.Issue is not nil\n314: \tif n.Cfg.Certificate.Issue == nil {\n315: \t\tn.Cfg.Certificate.Issue = new(false)\n316: \t}\n317: \tif n.isStandaloneNode() {\n318: \t\tlog.Debugf(\n319: \t\t\t\"%q is standalone node. %v\",\n320: \t\t\tn.Cfg.ShortName,\n321: \t\t\tlen(n.kindSpecificCfg().Components),\n322: \t\t)\n323: \n324: \t\tvars, err := n.setupStandaloneComponents()\n325: \t\tif err != nil {\n326: \t\t\treturn err\n327: \t\t}\n328: \t\twarnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)\n329: \n330: \t\t// n.Cfg.Env overrides component vars, overrides default srosEnv\n331: \t\tn.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)\n332: \t\tlog.Debug(\"Merged env file\", \"env\", fmt.Sprintf(\"%+v\", n.Cfg.Env), \"node\", n.Cfg.ShortName)\n333: \t} else {\n334: \t\tlog.Debugf(\n335: \t\t\t\"%q is distributed node. %v\",\n336: \t\t\tn.Cfg.ShortName,\n337: \t\t\tlen(n.kindSpecificCfg().Components),\n338: \t\t)\n339: \n340: \t\tn.Cfg.Env = clabutils.MergeStringMaps(srosEnv, n.Cfg.Env)\n341: \t\tlog.Debug(\"Merged env file\", \"env\", fmt.Sprintf(\"%+v\", n.Cfg.Env), \"node\", n.Cfg.ShortName)\n342: \n343: \t\terr := n.setupComponentNodes()\n344: \t\tif err != nil {\n345: \t\t\treturn err\n346: \t\t}\n347: \t}\n348: \n349: \treturn nil\n350: }\n351: \n352: // integrated -> pull component info from slot A components.\n353: func (n *sros) setupStandaloneComponents() (map[string]string, error) {\n354: \tvars := map[string]string{}\n355: \n356: \tif len(n.kindSpecificCfg().Components) == 0 {\n357: \t\treturn nil, nil\n358: \t}\n359: \tif len(n.kindSpecificCfg().Components) > 1 {\n360: \t\treturn nil, fmt.Errorf(\n361: \t\t\t\"expected at most one component override for standalone SR-SIM node %q, \"+\n362: \t\t\t\t\"or one component per slot %s for redundant type %q\",\n363: \t\t\tn.Cfg.ShortName,\n364: \t\t\tstrings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), \"/\"),\n365: \t\t\tn.Cfg.NodeType,\n366: \t\t)\n367: \t}\n368: \n369: \tslotA := n.kindSpecificCfg().Components[0]\n370: \n371: \tslotName := strings.ToUpper(strings.TrimSpace(slotA.Slot))\n372: \t// single undefined slot is implicitly set to A\n373: \tif slotName == \"\" {\n374: \t\tslotName = standaloneSlotName\n375: \t}\n376: \n377: \tif !integratedSrosSlotAllowed(n.Cfg.NodeType, slotName) {\n378: \t\treturn nil, fmt.Errorf(\n379: \t\t\t\"expected no slot, or slot %s for components of standalone SR-SIM node %q\",\n380: \t\t\tstrings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), \"/\"),\n381: \t\t\tn.Cfg.ShortName,\n382: \t\t)\n383: \t}\n384: \tvars[envNokiaSrosSlot] = slotName\n385: \n386: \tsetComponentEnvVars(vars, slotA)\n387: \n388: \tmaps.Copy(vars, slotA.Env)\n389: \n390: \treturn vars, nil\n391: }\n392: \n393: // Pre Deploy func for SR-SIM kind.\n394: func (n *sros) PreDeploy(ctx context.Context, params *clabnodes.PreDeployParams) error {\n395: \tlog.Debug(\"Running pre-deploy\")\n396: \n397: \tif err := n.verifyNokiaSrsimImage(ctx); err != nil {\n398: \t\treturn err\n399: \t}\n400: \n401: \t// store the preDeployParams\n402: \tn.preDeployParams = params\n403: \n404: \tn.InterfaceHelp = InterfaceHelp\n405: \n406: \t// store provided pubkeys\n407: \tn.sshPubKeys = params.SSHPubKeys\n408: \n409: \t// Create files/dir structure for standalone nodes or distributed CPM nodes\n410: \tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.isCPM(\"\")) {\n411: \t\t// generate the certificate\n412: \t\tif *n.Cfg.Certificate.Issue {\n413: \t\t\tn.Cfg.Certificate.SANs = append(n.Cfg.Certificate.SANs, n.baseShortName, n.baseLongName)\n414: \t\t\tcertificate, err := n.LoadOrGenerateCertificate(params.Cert, params.TopologyName)\n415: \t\t\tif err != nil {\n416: \t\t\t\treturn err\n417: \t\t\t}\n418: \n419: \t\t\t// set the certificate data\n420: \t\t\tn.Config().TLSCert = string(certificate.Cert)\n421: \t\t\tn.Config().TLSKey = string(certificate.Key)\n422: \t\t}\n423: \t\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),\n424: \t\t\tclabconstants.PermissionsOpen)\n425: \t\tslot := n.Cfg.Env[envNokiaSrosSlot]\n426: \t\tif slot == \"\" {\n427: \t\t\treturn fmt.Errorf(\"fail to init node because Env var %q is set to %q\",\n428: \t\t\t\tenvNokiaSrosSlot, n.Cfg.Env[envNokiaSrosSlot])\n429: \t\t}\n430: \t\t// add the config specific mounts\n431: \t\tcf1Path := filepath.Join(n.Cfg.LabDir, slot, configCf1)\n432: \t\tcf2Path := filepath.Join(n.Cfg.LabDir, slot, configCf2)\n433: \t\tcf3Path := filepath.Join(n.Cfg.LabDir, slot, configCf3)\n434: \t\tn.Cfg.Binds = append(n.Cfg.Binds,\n435: \t\t\tfmt.Sprint(cf1Path, \":\", cf1Dir, \"/:rw\"),\n436: \t\t\tfmt.Sprint(cf2Path, \":\", cf2Dir, \"/:rw\"),\n437: \t\t\tfmt.Sprint(cf3Path, \":\", cf3Dir, \"/:rw\"),\n438: \t\t)\n439: \n440: \t\tif n.Cfg.License != \"\" && (n.isCPM(\"\") || n.isStandaloneNode()) {\n441: \t\t\t// we mount a fixed path node.Labdir/license.key as the license referenced in topo file\n442: \t\t\t// will be copied to that path\n443: \t\t\tn.Cfg.Binds = append(n.Cfg.Binds, fmt.Sprint(\n444: \t\t\t\tfilepath.Join(n.Cfg.LabDir, \"license.key\"), \":\", licDir, \"/license.txt:ro\"))\n445: \t\t}\n446: \n447: \t\treturn n.createSROSFiles(ctx)\n448: \t}\n449: \treturn nil\n450: }\n451: \n452: func (n *sros) DeployEndpoints(ctx context.Context) error {\n453: \tif err := n.DefaultNode.DeployEndpoints(ctx); err != nil {\n454: \t\treturn err\n455: \t}\n456: \n457: \treturn n.PostDeployEndpoints(ctx)\n458: }\n459: \n460: // PostDeployEndpoints runs SR-SIM endpoint fixups after dataplane links exist.\n461: func (n *sros) PostDeployEndpoints(ctx context.Context) error {\n462: \tif n.Runtime.Mgmt().Driver == clabtypes.MgmtDriverMacvlan {\n463: \t\treturn nil\n464: \t}\n465: \t// Disable TX checksum offload on the host NS veth for the mgmt interface.\n466: \tvar peerIfIndex int\n467: \terr := n.ExecFunction(ctx, clabutils.VethPeerIndex(\"eth0\", &peerIfIndex))\n468: \tif err != nil {\n469: \t\tlog.Warn(\"Failed to get veth peer index for SR-SIM mgmt interface\",\n470: \t\t\t\"node\", n.Cfg.ShortName,\n471: \t\t\t\"error\", err)\n472: \t\treturn nil\n473: \t}\n474: \n475: \tif err := clabutils.DisableTxOffloadByIndex(peerIfIndex); err != nil {\n476: \t\tlog.Warn(\"Failed to disable TX checksum offload on SR-SIM mgmt host veth\",\n477: \t\t\t\"node\", n.Cfg.ShortName,\n478: \t\t\t\"error\", err)\n479: \t}\n480: \n481: \treturn nil\n482: }\n483: \n484: // Post Deploy func for SR-SIM kind.\n485: func (n *sros) PostDeploy(ctx context.Context, params *clabnodes.PostDeployParams) error {\n486: \tlog.Info(\"Running postdeploy actions\",\n487: \t\t\"kind\", n.Cfg.Kind,\n488: \t\t\"node\", n.Cfg.ShortName)\n489: \n490: \t// start waiting for container ready (PID based check)\n491: \tif err := n.Ready(ctx); err != nil {\n492: \t\treturn err\n493: \t}\n494: \n495: \terrChan := make(chan error, 1)\n496: \n497: \tlogs, err := n.Runtime.StreamLogs(ctx, n.GetContainerName())\n498: \tif err != nil {\n499: \t\tlog.Debug(\"Failed to get container log stream\", \"node\", n.Cfg.ShortName, \"err\", err)\n500: \t} else {\n501: \t\t// Start monitoring in a goroutine\n502: \t\tmonitoringCtx, cancel := context.WithCancel(ctx)\n503: \t\tdefer cancel()\n504: \t\tdefer logs.Close()\n505: \n506: \t\tgo n.MonitorLogs(monitoringCtx, logs, errChan)\n507: \t}\n508: \n509: \t// Populate /etc/hosts for service discovery on mgmt interface\n510: \tif err = n.populateHosts(ctx, params.Nodes); err != nil {\n511: \t\tlog.Warn(\"Unable to populate hosts list\", \"node\", n.Cfg.ShortName, \"err\", err)\n512: \t}\n513: \n514: \tn.swVersion, err = n.RunningVersion(ctx)\n515: \tif err != nil {\n516: \t\treturn err\n517: \t}\n518: \tif !n.isCPM(slotAName) {\n519: \t\treturn nil\n520: \t}\n521: \n522: \tif err := n.RequireMgmtReachable(); err != nil {\n523: \t\treturn err\n524: \t}\n525: \n526: \t// Execute SaveConfig after boot. This code should only run on active CPM\n527: \tdeadline := time.Now().Add(readyTimeout)\n528: \tvar lastHealthErr error\n529: \tfor time.Now().Before(deadline) {\n530: \t\t// Check if context is canceled\n531: \t\tif err := ctx.Err(); err != nil {\n532: \t\t\treturn fmt.Errorf(\"context canceled: %w\", err)\n533: \t\t}\n534: \n535: \t\tisHealthy, err := n.IsHealthy(ctx)\n536: \t\tif err != nil {\n537: \t\t\tlastHealthErr = err\n538: \t\t\tlog.Debug(\n539: \t\t\t\tfmt.Errorf(\n540: \t\t\t\t\t\"health check failed, check 'docker logs -f %s': %w\",\n541: \t\t\t\t\tn.Cfg.LongName,\n542: \t\t\t\t\terr,\n543: \t\t\t\t),\n544: \t\t\t)\n545: \t\t}\n546: \n547: \t\tif isHealthy {\n548: \t\t\taddr, err := n.MgmtIPAddr()\n549: \t\t\tif err != nil {\n550: \t\t\t\treturn err\n551: \t\t\t}\n552: \t\t\t// TLS bootstrap in case of n.Cfg.Certificate.Issue flag\n553: \t\t\tif *n.Cfg.Certificate.Issue {\n554: \t\t\t\tlog.Infof(\"TLS cert/key bootstrap for node %q\", n.Cfg.LongName)\n555: \n556: \t\t\t\terr = n.tlsCertBootstrap(ctx, addr)\n557: \t\t\t\tif err != nil {\n558: \t\t\t\t\treturn fmt.Errorf(\n559: \t\t\t\t\t\t\"TLS cert/key bootstrap to node %q failed: %w\",\n560: \t\t\t\t\t\tn.Cfg.LongName,\n561: \t\t\t\t\t\terr,\n562: \t\t\t\t\t)\n563: \t\t\t\t}\n564: \t\t\t\tlog.Infof(\n565: \t\t\t\t\t\"Completed bootstrap for gRPC-TLS profile on node %s\",\n566: \t\t\t\t\tn.Cfg.ShortName,\n567: \t\t\t\t)\n568: \t\t\t}\n569: \n570: \t\t\t// Partial or NO Config Provided\n571: \t\t\tif !isFullConfigFile(n.Cfg.StartupConfig) {\n572: \t\t\t\tlog.Infof(\"Saving node %q config as startup...\", n.Cfg.LongName)\n573: \t\t\t\terr = n.saveConfigWithAddr(ctx, addr)\n574: \t\t\t\tif err != nil {\n575: \t\t\t\t\treturn fmt.Errorf(\"save config to node %q, failed: %w\", n.Cfg.LongName, err)\n576: \t\t\t\t}\n577: \t\t\t}\n578: \t\t\treturn nil\n579: \t\t}\n580: \n581: \t\t// Wait before next check\n582: \t\tselect {\n583: \t\tcase <-ctx.Done():\n584: \t\t\treturn ctx.Err()\n585: \t\tcase err := <-errChan:\n586: \t\t\tlog.With(\"kind\", n.Cfg.Kind, \"node\", n.Cfg.ShortName).Debugf(\"got %q on errChan\", err)\n587: \t\t\tlog.Info(\"Skipping postdeploy actions\", \"kind\", n.Cfg.Kind, \"node\", n.Cfg.ShortName)\n588: \t\t\treturn nil\n589: \t\tcase <-time.After(retryTimer):\n590: \t\t\t// continue to next iteration\n591: \t\t}\n592: \t}\n593: \n594: \tif lastHealthErr != nil {\n595: \t\treturn fmt.Errorf(\"node %q did not become healthy before timeout: %w\",\n596: \t\t\tn.Cfg.LongName, lastHealthErr)\n597: \t}\n598: \n599: \treturn fmt.Errorf(\"node %q did not become healthy before timeout\", n.Cfg.LongName)\n600: }\n601: \n602: // Delete func for SR-SIM kind.\n603: func (n *sros) Delete(ctx context.Context) error {\n604: \t// if not distributed, follow default node implementation\n605: \tif n.isStandaloneNode() || n.isDistributedCardNode() {\n606: \t\treturn n.DefaultNode.Delete(ctx)\n607: \t}\n608: \n609: \tvar errs []error\n610: \n611: \t// Delete all the component containers\n612: \tfor _, componentNode := range n.componentNodes {\n613: \t\terr := componentNode.Delete(ctx)\n614: \t\tif err != nil {\n615: \t\t\tlog.Warn(err)\n616: \t\t\terrs = append(errs, err)\n617: \t\t}\n618: \t}\n619: \n620: \terrs = append(errs, n.DefaultNode.Delete(ctx), n.netnsNode.Delete(ctx))\n621: \n622: \treturn errors.Join(errs...)\n623: }\n624: \n625: func (n *sros) setupComponentNodes() error {\n626: \tif !n.isDistributedBaseNode() {\n627: \t\treturn nil\n628: \t}\n629: \n630: \tn.netnsNode = new(namespaceNode)\n631: \tif err := n.netnsNode.Init(\n632: \t\tn.newNetnsConfig(),\n633: \t\tclabnodes.WithRuntime(n.GetRuntime()),\n634: \t); err != nil {\n635: \t\treturn err\n636: \t}\n637: \trootCtrName := n.netnsNode.Config().LongName\n638: \n639: \t// loop through the components, creating them\n640: \tfor _, c := range n.kindSpecificCfg().Components {\n641: \t\t// instantiate a new nokia_srsim instance\n642: \t\tsrosNode := new(sros)\n643: \t\tcomponentNode := clabnodes.Node(srosNode)\n644: \n645: \t\t// copy the original node's NodeConfig to the component\n646: \t\tcomponentConfig, err := deep.Copy(n.Cfg)\n647: \t\tif err != nil {\n648: \t\t\treturn fmt.Errorf(\"failed to deep copy node config for component: %w\", err)\n649: \t\t}\n650: \n651: \t\t// component nodes join to the nents pause container\n652: \t\tcomponentConfig.NetworkMode = fmt.Sprintf(\"container:%s\", n.netnsNode.GetShortName())\n653: \n654: \t\t// adjust the config values from the original node\n655: \t\tcomponentConfig.ShortName = n.calcComponentName(componentConfig.ShortName, c.Slot)\n656: \t\tcomponentConfig.LongName = n.calcComponentName(componentConfig.LongName, c.Slot)\n657: \t\tcomponentConfig.NodeType = n.Cfg.NodeType\n658: \t\tkindSpecificConfig.Of(componentConfig).Components = nil\n659: \t\tcomponentConfig.Fqdn = n.calcComponentFqdn(c.Slot)\n660: \t\tcomponentConfig.DNS = nil\n661: \t\tcomponentConfig.PortBindings = nil\n662: \t\tcomponentConfig.PortSet = nil\n663: \n664: \t\t// Component fields fill env keys the user did not set. Node env wins.\n665: \t\tif componentConfig.Env == nil {\n666: \t\t\tcomponentConfig.Env = map[string]string{}\n667: \t\t}\n668: \t\tkeepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)\n669: \t\t// Slot identifies this container. A node-level NOKIA_SROS_SLOT cannot apply to every card.\n670: \t\tcomponentConfig.Env[envNokiaSrosSlot] = c.Slot\n671: \n672: \t\t// adjust label based env vars\n673: \t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.NodeName)] = componentConfig.ShortName\n674: \t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.LongName)] = componentConfig.LongName\n675: \n676: \t\tif componentConfig.Labels == nil {\n677: \t\t\tcomponentConfig.Labels = map[string]string{}\n678: \t\t}\n679: \n680: \t\t// adjust labels\n681: \t\tcomponentConfig.Labels[clabconstants.NodeName] = componentConfig.ShortName\n682: \t\tcomponentConfig.Labels[clabconstants.LongName] = componentConfig.LongName\n683: \t\tcomponentConfig.Labels[clabconstants.RootNodeName] = n.Cfg.ShortName\n684: \t\tcomponentConfig.Labels[clabconstants.RootNodeLongName] = n.Cfg.LongName\n685: \n686: \t\t// Preserve the topology env. Init must not snapshot the merged component env,\n687: \t\t// or config generation would treat component flags as user overrides.\n688: \t\tsrosNode.userEnv = maps.Clone(n.userEnv)\n689: \n690: \t\t// init the component\n691: \t\terr = componentNode.Init(componentConfig)\n692: \t\tif err != nil {\n693: \t\t\treturn err\n694: \t\t}\n695: \t\t// set the runtime by copying it from the general node\n696: \t\tcomponentNode.WithRuntime(n.GetRuntime())\n697: \n698: \t\t// store root components for cpms, for config gen\n699: \t\tsrosNode.rootComponents = n.kindSpecificCfg().Components\n700: \t\t// store base node name\n701: \t\tsrosNode.baseShortName = n.Cfg.ShortName\n702: \t\tsrosNode.baseLongName = n.Cfg.LongName\n703: \t\tsrosNode.rootCtrName = rootCtrName\n704: \n705: \t\t// store the node in the componentNodes\n706: \t\tn.componentNodes = append(n.componentNodes, componentNode)\n707: \t}\n708: \treturn nil\n709: }\n710: \n711: // deployFabric deploys the distributed SR-SIM when the `components` key is present.\n712: func (n *sros) deployFabric(ctx context.Context, deployParams *clabnodes.DeployParams) error {\n713: \tnetnsConfig := n.netnsNode.Config()\n714: \n715: \tnetnsConfig.MgmtIPv4Address = n.Cfg.MgmtIPv4Address\n716: \tnetnsConfig.MgmtIPv4AddressAuto = n.Cfg.MgmtIPv4AddressAuto\n717: \tnetnsConfig.MgmtIPv4PrefixLength = n.Cfg.MgmtIPv4PrefixLength\n718: \tnetnsConfig.MgmtIPv4Gateway = n.Cfg.MgmtIPv4Gateway\n719: \tnetnsConfig.MgmtIPv6Address = n.Cfg.MgmtIPv6Address\n720: \tnetnsConfig.MgmtIPv6AddressAuto = n.Cfg.MgmtIPv6AddressAuto\n721: \tnetnsConfig.MgmtIPv6PrefixLength = n.Cfg.MgmtIPv6PrefixLength\n722: \tnetnsConfig.MgmtIPv6Gateway = n.Cfg.MgmtIPv6Gateway\n723: \n724: \tif err := n.netnsNode.Deploy(ctx, deployParams); err != nil {\n725: \t\treturn fmt.Errorf(\"deploy network namespace node %q: %w\", n.netnsNode.GetShortName(), err)\n726: \t}\n727: \n728: \tips, err := n.distNodeMgmtIPs()\n729: \tif err != nil {\n730: \t\treturn err\n731: \t}\n732: \n733: \tn.setComponentMgmtEnv(ips)\n734: \n735: \t// loop through the components, creating them\n736: \tfor _, c := range n.componentNodes {\n737: \t\tif err := c.PreDeploy(ctx, n.preDeployParams); err != nil {\n738: \t\t\treturn fmt.Errorf(\"pre-deploy for component node %q: %w\", c.GetShortName(), err)\n739: \t\t}\n740: \t\t// deploy the component\n741: \t\terr := c.Deploy(ctx, deployParams)\n742: \t\tif err != nil {\n743: \t\t\treturn err\n744: \t\t}\n745: \t}\n746: \n747: \tcpmSlot, err := n.cpmSlot()\n748: \tif err != nil {\n749: \t\treturn err\n750: \t}\n751: \t// store the CPM container name\n752: \tn.cpmContainerName = n.calcComponentName(n.Cfg.LongName, cpmSlot)\n753: \tn.renameDone = true\n754: \n755: \t// adjust also the mgmt IP addresses of the general node\n756: \tn.Cfg.MgmtIPv4Address = ips.IPv4\n757: \tn.Cfg.MgmtIPv6Address = ips.IPv6\n758: \n759: \treturn nil\n760: }\n761: \n762: // set env vars for the CPMs so that they are aware of mgmt info.\n763: func (n *sros) setComponentMgmtEnv(ips MgmtIP) {\n764: \tfor _, component := range n.componentNodes {\n765: \t\tcfg := component.Config()\n766: \t\tslot := strings.ToUpper(cfg.Env[envNokiaSrosSlot])\n767: \n768: \t\tif slot != slotAName && slot != slotBName {\n769: \t\t\tcontinue\n770: \t\t}\n771: \n772: \t\tenv := cfg.Env\n773: \t\tif intf := env[\"NOKIA_SROS_MGMT_IF\"]; intf != \"\" && intf != \"eth0\" {\n774: \t\t\tcontinue\n775: \t\t}\n776: \t\tif env[envSrosIPv4Active] != \"\" || env[envSrosIPv6Active] != \"\" {\n777: \t\t\tcontinue\n778: \t\t}\n779: \n780: \t\t// SKIP if the user defines this env var\n781: \t\texplicitRoutes := false\n782: \t\tfor key := range env {\n783: \t\t\tif strings.HasPrefix(key, envSrosStaticRoutePrefix) {\n784: \t\t\t\texplicitRoutes = true\n785: \t\t\t\tbreak\n786: \t\t\t}\n787: \t\t}\n788: \t\tif explicitRoutes {\n789: \t\t\tcontinue\n790: \t\t}\n791: \n792: \t\tif ips.IPv4 != \"\" {\n793: \t\t\tenv[envSrosIPv4Active] = fmt.Sprintf(\"%s/%d\", ips.IPv4, ips.IPv4pLen)\n794: \t\t\tif ips.IPv4Gw != \"\" {\n795: \t\t\t\tenv[envSrosStaticRoutePrefix+\"1\"] = \"0.0.0.0/0@\" + ips.IPv4Gw\n796: \t\t\t}\n797: \t\t}\n798: \n799: \t\tif ips.IPv6 != \"\" {\n800: \t\t\tenv[envSrosIPv6Active] = fmt.Sprintf(\"%s/%d\", ips.IPv6, ips.IPv6pLen)\n801: \t\t\tif ips.IPv6Gw != \"\" {\n802: \t\t\t\tenv[envSrosStaticRoutePrefix+\"2\"] = \"::/0@\" + ips.IPv6Gw\n803: \t\t\t}\n804: \t\t}\n805: \t}\n806: }\n807: \n808: // isDistributedCard checks if the slot variable is set, hence it is an instance (slot) of a\n809: // distributed setup.\n810: // isDistributedCardNode returns true if this node is a card (linecard/IOM)\n811: // in a distributed SR-SIM deployment. A distributed card has a slot assignment\n812: // but no components of its own.\n813: func (n *sros) isDistributedCardNode() bool {\n814: \t_, exists := n.Cfg.Env[envNokiaSrosSlot]\n815: \treturn exists && len(n.kindSpecificCfg().Components) == 0\n816: }\n817: \n818: // isDistributedBaseNode returns true if this is the base node of a distributed\n819: // SR-SIM deployment. The base node orchestrates multiple component nodes.\n820: func (n *sros) isDistributedBaseNode() bool {\n821: \tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n822: \t\treturn isRedundantIntegratedSrosComponents(n.Cfg.NodeType, n.kindSpecificCfg().Components)\n823: \t}\n824: \treturn len(n.kindSpecificCfg().Components) > 1\n825: }\n826: \n827: // isStandaloneNode returns true if this is a standalone (non-distributed) SR-SIM node.\n828: func (n *sros) isStandaloneNode() bool {\n829: \treturn !n.isDistributedBaseNode() && !n.isDistributedCardNode()\n830: }\n831: \n832: // calcComponentName appends the line card suffix to the given node name.\n833: func (n *sros) calcComponentName(name, slot string) string {\n834: \tif n.renameDone {\n835: \t\treturn name\n836: \t}\n837: \treturn fmt.Sprintf(\"%s-%s\", name, strings.ToLower(slot))\n838: }\n839: \n840: // calcComponentFqdn computes the FQDN for a given slot.\n841: func (n *sros) calcComponentFqdn(slot string) string {\n842: \tif n.renameDone {\n843: \t\treturn n.Cfg.Fqdn\n844: \t}\n845: \tfqdnDotIndex := strings.Index(n.Cfg.Fqdn, \".\")\n846: \tif fqdnDotIndex < 0 {\n847: \t\treturn fmt.Sprintf(\"%s-%s\", n.Cfg.Fqdn, strings.ToLower(slot))\n848: \t}\n849: \tresult := fmt.Sprintf(\n850: \t\t\"%s-%s%s\",\n851: \t\tn.Cfg.Fqdn[:fqdnDotIndex],\n852: \t\tstrings.ToLower(slot),\n853: \t\tn.Cfg.Fqdn[fqdnDotIndex:],\n854: \t)\n855: \treturn result\n856: }\n857: \n858: // cpmNode returns a CPM Node (used in Distributed mode).\n859: func (n *sros) cpmNode() (clabnodes.Node, error) {\n860: \tdefaultSlot, err := n.cpmSlot()\n861: \tif err != nil {\n862: \t\treturn nil, err\n863: \t}\n864: \tdefaultSlot = strings.ToLower(defaultSlot)\n865: \tfor _, cn := range n.componentNodes {\n866: \t\tif cn.GetShortName()[len(cn.GetShortName())-1:] == defaultSlot {\n867: \t\t\treturn cn, nil\n868: \t\t}\n869: \t}\n870: \treturn nil, fmt.Errorf(\"node %s: node for slot %s not found\", n.GetShortName(), defaultSlot)\n871: }\n872: \n873: // cpmSlot returns the Slot of the preferred CPM Node (used when Distributed mode).\n874: // It prefers slot A if present, otherwise returns slot B.\n875: func (n *sros) cpmSlot() (string, error) {\n876: \t// Prefer slot A, fall back to slot B. Slots are accepted in either case.\n877: \tfor _, comp := range n.kindSpecificCfg().Components {\n878: \t\tif strings.EqualFold(comp.Slot, slotAName) {\n879: \t\t\treturn slotAName, nil\n880: \t\t}\n881: \t}\n882: \tfor _, comp := range n.kindSpecificCfg().Components {\n883: \t\tif strings.EqualFold(comp.Slot, slotBName) {\n884: \t\t\treturn slotBName, nil\n885: \t\t}\n886: \t}\n887: \treturn \"\", fmt.Errorf(\"node %s: unable to determine default slot\", n.GetShortName())\n888: }\n889: \n890: // Deploy deploys the SR-SIM kind.\n891: func (n *sros) Deploy(ctx context.Context, deployParams *clabnodes.DeployParams) error {\n892: \t// if it is a chassis with multiple cards (i.e. components)\n893: \tif n.isDistributedBaseNode() {\n894: \t\terr := n.deployFabric(ctx, deployParams)\n895: \t\tif err != nil {\n896: \t\t\treturn err\n897: \t\t}\n898: \n899: \t\t// Update the nodes state\n900: \t\tn.SetState(clabnodesstate.Deployed)\n901: \t\treturn nil\n902: \t}\n903: \n904: \t// if it is a regular node\n905: \terr := n.DefaultNode.Deploy(ctx, deployParams)\n906: \tif err != nil {\n907: \t\treturn err\n908: \t}\n909: \n910: \treturn nil\n911: }\n912: \n913: // Ready returns when the node boot sequence reached the stage when it is ready to accept config\n914: // commands\n915: // returns an error if not ready by the expiry of the timer readyTimeout.\n916: func (n *sros) Ready(ctx context.Context) error {\n917: \tctx, cancel := context.WithTimeout(ctx, readyTimeout)\n918: \tdefer cancel()\n919: \tvar err error\n920: \treadyCmds := []string{readyCmdCpm, readyCmdBoth, readyCmdIom}\n921: \treadyCmdsStrings := []string{\"CPM\", \"BOTH\", \"IOM\"}\n922: \tlog.Debug(\"Waiting for SR OS node to boot...\", \"node\", n.Cfg.ShortName)\n923: \tfor {\n924: \t\tselect {\n925: \t\tcase <-ctx.Done():\n926: \t\t\treturn fmt.Errorf(\n927: \t\t\t\t\"timed out waiting for SR OS node %s to boot: %v\",\n928: \t\t\t\tn.Cfg.ShortName,\n929: \t\t\t\terr,\n930: \t\t\t)\n931: \t\tdefault:\n932: \t\t\t// check if cpm is running\n933: \t\t\tfor k, cmd := range readyCmds {\n934: \t\t\t\tcmd, _ := clabexec.NewExecCmdFromString(cmd)\n935: \t\t\t\texecResult, err := n.RunExec(ctx, cmd)\n936: \t\t\t\tif err != nil || (execResult != nil && execResult.GetReturnCode() != 0) {\n937: \t\t\t\t\tlogMsg := fmt.Sprintf(\n938: \t\t\t\t\t\t\"status check %s failed on %s retrying\",\n939: \t\t\t\t\t\treadyCmdsStrings[k],\n940: \t\t\t\t\t\tn.Cfg.ShortName,\n941: \t\t\t\t\t)\n942: \t\t\t\t\tif err != nil {\n943: \t\t\t\t\t\tlogMsg += fmt.Sprintf(\" error: %v\", err)\n944: \t\t\t\t\t}\n945: \t\t\t\t\tif execResult != nil && execResult.GetReturnCode() != 0 {\n946: \t\t\t\t\t\tlogMsg += fmt.Sprintf(\n947: \t\t\t\t\t\t\t\", output:%s\",\n948: \t\t\t\t\t\t\tstrings.ReplaceAll(execResult.String(), \"\\n\", \"; \"),\n949: \t\t\t\t\t\t)\n950: \t\t\t\t\t}\n951: \t\t\t\t\tlog.Debug(logMsg)\n952: \t\t\t\t}\n953: \t\t\t\tif execResult != nil && execResult.GetReturnCode() == 0 {\n954: \t\t\t\t\tlog.Debug(\"SR OS is ready to be configured\", \"node\", n.Cfg.ShortName)\n955: \t\t\t\t\treturn nil\n956: \t\t\t\t}\n957: \t\t\t\ttime.Sleep(retryTimer)\n958: \t\t\t}\n959: \t\t}\n960: \t}\n961: }\n962: \n963: // checkKernelVersion emits a warning if the present kernel version is lower than the required one.\n964: func (*sros) checkKernelVersion() error {\n965: \t// retrieve running kernel version\n966: \tkv, err := clabutils.GetKernelVersion()\n967: \tif err != nil {\n968: \t\treturn err\n969: \t}\n970: \n971: \t// do the comparison\n972: \tif !kv.GreaterOrEqual(requiredKernelVersion) {\n973: \t\tlog.Warnf(\n974: \t\t\t\"Nokia SR OS requires a kernel version greater than %s. Detected kernel version: %s. Not all features might function properly!\",\n975: \t\t\trequiredKernelVersion,\n976: \t\t\tkv,\n977: \t\t)\n978: \t}\n979: \treturn nil\n980: }\n981: \n982: func (n *sros) CheckDeploymentConditions(ctx context.Context) error {\n983: \t// perform the sros specific kernel version check\n984: \terr := n.checkKernelVersion()\n985: \tif err != nil {\n986: \t\treturn err\n987: \t}\n988: \n989: \t// check the sros component slot config for validaity\n990: \terr = n.checkComponentSlotsConfig()\n991: \tif err != nil {\n992: \t\treturn err\n993: \t}\n994: \n995: \treturn n.DefaultNode.CheckDeploymentConditions(ctx)\n996: }\n997: \n998: // Func that creates the Dirs used for the kind SR-SIM and sets/merges the default Env vars.\n999: func (n *sros) createSROSFiles(ctx context.Context) error {\n1000: \tlog.Debug(\"Creating directory structure for SR OS container\", \"node\", n.Cfg.ShortName)\n1001: \n1002: \tvar err error\n1003: \n1004: \tif n.Cfg.License != \"\" && (n.isCPM(\"\") || n.isStandaloneNode()) {\n1005: \t\t// copy license file to node specific directory in lab\n1006: \t\tlicPath := filepath.Join(n.Cfg.LabDir, \"license.key\")\n1007: \t\tif err := clabutils.CopyFile(context.Background(), n.Cfg.License, licPath,\n1008: \t\t\tclabconstants.PermissionsFileDefault); err != nil {\n1009: \t\t\treturn fmt.Errorf(\n1010: \t\t\t\t\"license copying src %s -> dst %s failed: %v\",\n1011: \t\t\t\tn.Cfg.License,\n1012: \t\t\t\tlicPath,\n1013: \t\t\t\terr,\n1014: \t\t\t)\n1015: \t\t}\n1016: \t\tlog.Debug(\"SR OS license copied\", \"src\", n.Cfg.License, \"dst\", licPath)\n1017: \t}\n1018: \tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),\n1019: \t\tclabconstants.PermissionsOpen)\n1020: \tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], \"config\"),\n1021: \t\tclabconstants.PermissionsOpen)\n1022: \tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf1),\n1023: \t\tclabconstants.PermissionsOpen)\n1024: \tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf2),\n1025: \t\tclabconstants.PermissionsOpen)\n1026: \tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),\n1027: \t\tclabconstants.PermissionsOpen)\n1028: \tif err := n.writeChassisInfoToLabDir(ctx); err != nil {\n1029: \t\tlog.Debug(\"Didn't write chassis_info.json to lab dir. Docker version is likely too new.\",\n1030: \t\t\t\"node\", n.Cfg.ShortName, \"path\", n.Cfg.LabDir, \"error\", err)\n1031: \t}\n1032: \tif n.isCPM(slotAName) || n.isStandaloneNode() {\n1033: \t\terr = n.createSROSCertificates()\n1034: \t}\n1035: \tif err != nil {\n1036: \t\treturn err\n1037: \t}\n1038: \t// Skip config if node is not CPM\n1039: \tif n.isCPM(\"\") || n.isStandaloneNode() {\n1040: \t\terr = n.createSROSConfigFiles()\n1041: \t\tif err != nil {\n1042: \t\t\treturn err\n1043: \t\t}\n1044: \t}\n1045: \treturn nil\n1046: }\n1047: \n1048: // writeChassisInfoToLabDir fetches /opt/nokia/chassis_info.json from the node image\n1049: // (via graph driver, same as srosVersionFromImage) and writes it under n.Cfg.LabDir\n1050: // with the same filename (chassis_info.json).\n1051: func (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {\n1052: \timageInspect, err := n.Runtime.InspectImage(ctx, n.Cfg.Image)\n1053: \tif err != nil {\n1054: \t\treturn fmt.Errorf(\"inspect image: %w\", err)\n1055: \t}\n1056: \tcontent, err := ReadFileFromImageInspect(imageInspect, DefaultChassisInfoPath)\n1057: \tif err != nil {\n1058: \t\treturn err\n1059: \t}\n1060: \tdstPath := filepath.Join(n.Cfg.LabDir, filepath.Base(DefaultChassisInfoPath))\n1061: \tlicensed := append([]byte(chassisInfoFileLicense), content...)\n1062: \tif err := os.WriteFile(dstPath, licensed, clabconstants.PermissionsFileDefault); err != nil {\n1063: \t\treturn fmt.Errorf(\"write %s: %w\", dstPath, err)\n1064: \t}\n1065: \tlog.Debug(\"Wrote chassis_info.json to lab dir\", \"node\", n.Cfg.ShortName, \"path\", dstPath)\n1066: \tn.warnUnsupportedComponents(content)\n1067: \treturn nil\n1068: }\n1069: \n1070: // warnUnsupportedComponents validates the effective component configuration against the\n1071: // chassis_info.json extracted from this exact image. Validation is advisory and never blocks\n1072: // deploy.\n1073: func (n *sros) warnUnsupportedComponents(content []byte) {\n1074: \t// A distributed node validates once, from CPM A, to avoid duplicate warnings from CPM B.\n1075: \tif !n.isStandaloneNode() && !n.isCPM(slotAName) {\n1076: \t\treturn\n1077: \t}\n1078: \n1079: \tinfo, err := parseChassisInfo(content)\n1080: \tif err != nil {\n1081: \t\tlog.Warn(\"Could not validate SR-SIM components against chassis_info.json\",\n1082: \t\t\t\"node\", n.Cfg.ShortName, \"error\", err)\n1083: \t\treturn\n1084: \t}\n1085: \n1086: \tcomponents := n.rootComponents\n1087: \tif len(components) == 0 {\n1088: \t\tcomponents = n.kindSpecificCfg().Components\n1089: \t}\n1090: \n1091: \teffective := n.componentsForConfig(components)\n1092: \tif len(effective) == 0 {\n1093: \t\t// Environment variables can configure integrated hardware without a components entry.\n1094: \t\teffective = []*Component{n.componentForConfig(nil)}\n1095: \t}\n1096: \n1097: \tnodeType := n.Cfg.NodeType\n1098: \tif chassis := strings.TrimSpace(n.Cfg.Env[envNokiaSrosChassis]); chassis != \"\" {\n1099: \t\tnodeType = chassis\n1100: \t}\n1101: \tfor _, warning := range info.componentWarnings(nodeType, n.componentSFM(), effective) {\n1102: \t\tlog.Warn(\"SR-SIM component configuration may not be supported\",\n1103: \t\t\t\"node\", n.Cfg.ShortName,\n1104: \t\t\t\"chassis\", nodeType,\n1105: \t\t\t\"warning\", warning)\n1106: \t}\n1107: }\n1108: \n1109: // Func that Places the Certificates in the right place and format.\n1110: func (n *sros) createSROSCertificates() error {\n1111: \tif *n.Cfg.Certificate.Issue {\n1112: \t\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),\n1113: \t\t\tclabconstants.PermissionsOpen)\n1114: \t\tkeyPath := filepath.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3, tlsKeyFile)\n1115: \t\tif err := clabutils.CreateFile(keyPath, n.Config().TLSKey); err != nil {\n1116: \t\t\treturn err\n1117: \t\t}\n1118: \n1119: \t\tcertPath := filepath.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3, tlsCertFile)\n1120: \t\terr := clabutils.CreateFile(certPath, n.Config().TLSCert)\n1121: \t\tif err != nil {\n1122: \t\t\treturn err\n1123: \t\t}\n1124: \t}\n1125: \treturn nil\n1126: }\n1127: \n1128: // SlotIsInteger checks if the slot string represents a valid integer.\n1129: func SlotIsInteger(s string) bool {\n1130: \t_, err := strconv.Atoi(s)\n1131: \treturn err == nil\n1132: }\n1133: \n1134: // Check if a container is a CPM.\n1135: // isCPM checks if a container is a CPM (Control Processing Module).\n1136: // Returns false if the slot is a linecard (integer slot).\n1137: // If a specific CPM name is provided, returns false if this is a different CPM.\n1138: func (n *sros) isCPM(cpm string) bool {\n1139: \tslot, exists := n.Cfg.Env[envNokiaSrosSlot]\n1140: \tif !exists {\n1141: \t\t// No slot specified - this is a CPM\n1142: \t\treturn true\n1143: \t}\n1144: \n1145: \t// If slot is an integer, it's a linecard, not a CPM\n1146: \tif SlotIsInteger(slot) {\n1147: \t\treturn false\n1148: \t}\n1149: \n1150: \t// Slot is non-integer (CPM slot). If a specific CPM was requested,\n1151: \t// check if this is that CPM\n1152: \tif cpm != \"\" && !strings.EqualFold(slot, cpm) {\n1153: \t\treturn false\n1154: \t}\n1155: \n1156: \treturn true\n1157: }\n1158: \n1159: func (n *sros) GetContainers(ctx context.Context) ([]clabruntime.GenericContainer, error) {\n1160: \t// if not a distributed setup call regular GetContainers\n1161: \tif n.isStandaloneNode() || n.isDistributedCardNode() {\n1162: \t\treturn n.DefaultNode.GetContainers(ctx)\n1163: \t}\n1164: \n1165: \tcpmSlot, err := n.cpmSlot()\n1166: \tif err != nil {\n1167: \t\treturn nil, err\n1168: \t}\n1169: \tcontainerName := n.calcComponentName(n.GetContainerName(), cpmSlot)\n1170: \n1171: \tcnts, err := n.Runtime.ListContainers(ctx, []*clabtypes.GenericFilter{\n1172: \t\t{\n1173: \t\t\tFilterType: \"name\",\n1174: \t\t\tMatch:      containerName,\n1175: \t\t},\n1176: \t})\n1177: \tif err != nil {\n1178: \t\treturn nil, err\n1179: \t}\n1180: \t// check that we retrieved some container information\n1181: \t// otherwise throw ErrContainersNotFound error\n1182: \tif len(cnts) == 0 {\n1183: \t\t// check for the netns holder as to never orphan it.\n1184: \t\tif n.netnsNode != nil {\n1185: \t\t\treturn n.netnsNode.GetContainers(ctx)\n1186: \t\t}\n1187: \t\treturn nil, fmt.Errorf(\"node: %s. %w\", n.GetContainerName(),\n1188: \t\t\tclabnodes.ErrContainersNotFound)\n1189: \t}\n1190: \n1191: \t// Forge the IP address to be the actual IP of mgmt\n1192: \t// because the CPM A might not own the netns & mgmt IP\n1193: \tif len(n.kindSpecificCfg().Components) > 0 {\n1194: \t\tips, err := n.distNodeMgmtIPs()\n1195: \t\tif err == nil {\n1196: \t\t\tif ips.IPv4 != \"\" {\n1197: \t\t\t\tcnts[0].NetworkSettings.IPv4addr = ips.IPv4\n1198: \t\t\t\tcnts[0].NetworkSettings.IPv4pLen = ips.IPv4pLen\n1199: \t\t\t}\n1200: \t\t\tif ips.IPv6 != \"\" {\n1201: \t\t\t\tcnts[0].NetworkSettings.IPv6addr = ips.IPv6\n1202: \t\t\t\tcnts[0].NetworkSettings.IPv6pLen = ips.IPv6pLen\n1203: \t\t\t}\n1204: \t\t}\n1205: \t}\n1206: \n1207: \treturn cnts, err\n1208: }\n1209: \n1210: // populateHosts adds container hostnames for other nodes of a lab to SR Linux /etc/hosts file\n1211: // to mitigate the fact that srlinux uses non default netns for management and thus\n1212: // can't leverage docker DNS service.\n1213: func (n *sros) populateHosts(ctx context.Context, nodes map[string]clabnodes.Node) error {\n1214: \tcontainerName := n.Cfg.LongName\n1215: \tif n.isDistributedBaseNode() && n.cpmContainerName != \"\" {\n1216: \t\tcontainerName = n.cpmContainerName\n1217: \t}\n1218: \n1219: \thosts, err := n.Runtime.GetHostsPath(ctx, containerName)\n1220: \tif err != nil {\n1221: \t\tlog.Warn(\"Unable to locate SR OS node /etc/hosts file\", \"node\", n.Cfg.ShortName, \"err\", err)\n1222: \t\treturn err\n1223: \t}\n1224: \tvar entriesv4, entriesv6 bytes.Buffer\n1225: \tconst (\n1226: \t\tv4Prefix = \"###### CLAB-v4-START ######\"\n1227: \t\tv4Suffix = \"###### CLAB-v4-END ######\"\n1228: \t\tv6Prefix = \"###### CLAB-v6-START ######\"\n1229: \t\tv6Suffix = \"###### CLAB-v6-END ######\"\n1230: \t)\n1231: \tfmt.Fprintf(&entriesv4, \"\\n%s\\n\", v4Prefix)\n1232: \tfmt.Fprintf(&entriesv6, \"\\n%s\\n\", v6Prefix)\n1233: \tfor node, params := range nodes {\n1234: \t\tif v4 := params.Config().MgmtIPv4Address; v4 != \"\" {\n1235: \t\t\tfmt.Fprintf(&entriesv4, \"%s\\t%s\\n\", v4, node)\n1236: \t\t}\n1237: \t\tif v6 := params.Config().MgmtIPv6Address; v6 != \"\" {\n1238: \t\t\tfmt.Fprintf(&entriesv6, \"%s\\t%s\\n\", v6, node)\n1239: \t\t}\n1240: \t}\n1241: \tfmt.Fprintf(&entriesv4, \"%s\\n\", v4Suffix)\n1242: \tfmt.Fprintf(&entriesv6, \"%s\\n\", v6Suffix)\n1243: \n1244: \tfile, err := os.OpenFile(hosts, os.O_APPEND|os.O_WRONLY, 0o666) // skipcq: GSC-G302\n1245: \tif err != nil {\n1246: \t\tlog.Warn(\"Unable to open SR OS node /etc/hosts file\", \"node\", n.Cfg.ShortName, \"err\", err)\n1247: \t\treturn err\n1248: \t}\n1249: \n1250: \t_, err = file.Write(entriesv4.Bytes())\n1251: \tif err != nil {\n1252: \t\treturn err\n1253: \t}\n1254: \t_, err = file.Write(entriesv6.Bytes())\n1255: \tif err != nil {\n1256: \t\treturn err\n1257: \t}\n1258: \n1259: \treturn file.Close()\n1260: }\n1261: \n1262: func (n *sros) GetMappedInterfaceName(ifName string) (string, error) {\n1263: \tcaptureGroups, err := clabutils.GetRegexpCaptureGroups(n.InterfaceRegexp, ifName)\n1264: \tif err != nil {\n1265: \t\treturn \"\", err\n1266: \t}\n1267: \n1268: \tindexGroups := []string{\"card\", \"xiom\", \"mda\", \"connector\", \"port\"}\n1269: \tparsedIndices := make(map[string]int)\n1270: \tfoundIndices := make(map[string]bool)\n1271: \n1272: \tfor _, indexKey := range indexGroups {\n1273: \t\tif index, found := captureGroups[indexKey]; found && index != \"\" {\n1274: \t\t\tfoundIndices[indexKey] = true\n1275: \t\t\tparsedIndices[indexKey], err = strconv.Atoi(index)\n1276: \t\t\tif err != nil {\n1277: \t\t\t\treturn \"\", fmt.Errorf(\n1278: \t\t\t\t\t\"%q parsed %s index %q could not be cast to an integer\",\n1279: \t\t\t\t\tifName,\n1280: \t\t\t\t\tindexKey,\n1281: \t\t\t\t\tindex,\n1282: \t\t\t\t)\n1283: \t\t\t}\n1284: \t\t\tif parsedIndices[indexKey] < 1 {\n1285: \t\t\t\treturn \"\", fmt.Errorf(\n1286: \t\t\t\t\t\"%q parsed %q index %q does not match requirement >= 1\",\n1287: \t\t\t\t\tifName,\n1288: \t\t\t\t\tindexKey,\n1289: \t\t\t\t\tindex,\n1290: \t\t\t\t)\n1291: \t\t\t}\n1292: \t\t} else {\n1293: \t\t\tfoundIndices[indexKey] = false\n1294: \t\t}\n1295: \t}\n1296: \n1297: \t// Card, MDA and port are present\n1298: \tif foundIndices[\"card\"] && foundIndices[\"mda\"] && foundIndices[\"port\"] {\n1299: \t\tswitch {\n1300: \t\tcase foundIndices[\"xiom\"] && foundIndices[\"connector\"]:\n1301: \t\t\t// XIOM and connector are present, format will be: e1-x2-3-c4-5 -> card 1, xiom 2, mda\n1302: \t\t\t// 3, connector 4, port 5\n1303: \t\t\treturn fmt.Sprintf(\n1304: \t\t\t\t\"e%d-x%d-%d-c%d-%d\",\n1305: \t\t\t\tparsedIndices[\"card\"],\n1306: \t\t\t\tparsedIndices[\"xiom\"],\n1307: \t\t\t\tparsedIndices[\"mda\"],\n1308: \t\t\t\tparsedIndices[\"connector\"],\n1309: \t\t\t\tparsedIndices[\"port\"],\n1310: \t\t\t), nil\n1311: \n1312: \t\tcase foundIndices[\"xiom\"]:\n1313: \t\t\t// Only XIOM present, format will be: e1-x2-3-4 -> card 1, xiom 2, mda 3, port 4\n1314: \t\t\treturn fmt.Sprintf(\"e%d-x%d-%d-%d\", parsedIndices[\"card\"],\n1315: \t\t\t\tparsedIndices[\"xiom\"], parsedIndices[\"mda\"], parsedIndices[\"port\"]), nil\n1316: \t\tcase foundIndices[\"connector\"]:\n1317: \t\t\t// Only connector present, format will be: e1-2-c3-4 -> card 1, mda 2, connector 3, port\n1318: \t\t\t// 4\n1319: \t\t\treturn fmt.Sprintf(\"e%d-%d-c%d-%d\", parsedIndices[\"card\"],\n1320: \t\t\t\tparsedIndices[\"mda\"], parsedIndices[\"connector\"], parsedIndices[\"port\"]), nil\n1321: \t\tdefault:\n1322: \t\t\t// No XIOM or connector present, format will be: e1-2-3 -> card 1, mda 2, port 3\n1323: \t\t\treturn fmt.Sprintf(\"e%d-%d-%d\", parsedIndices[\"card\"],\n1324: \t\t\t\tparsedIndices[\"mda\"], parsedIndices[\"port\"]), nil\n1325: \t\t}\n1326: \t} else {\n1327: \t\treturn \"\", fmt.Errorf(\"%q missing card, mda or port index\", ifName)\n1328: \t}\n1329: }\n1330: \n1331: // CheckInterfaceName checks if a name of the interface referenced in the topology file correct.\n1332: func (n *sros) CheckInterfaceName() error {\n1333: \tnm := n.Cfg.NetworkMode\n1334: \n1335: \terr := n.CheckInterfaceOverlap()\n1336: \tif err != nil {\n1337: \t\treturn err\n1338: \t}\n1339: \n1340: \tfor _, e := range n.Endpoints {\n1341: \t\tif !MappedInterfaceRegexp.MatchString(e.GetIfaceName()) {\n1342: \t\t\treturn fmt.Errorf(\n1343: \t\t\t\t\"nokia SR OS interface name %q doesn't match the required pattern: %s\",\n1344: \t\t\t\te.GetIfaceName(),\n1345: \t\t\t\tn.InterfaceHelp,\n1346: \t\t\t)\n1347: \t\t}\n1348: \n1349: \t\tif e.GetIfaceName() == \"eth0\" && nm != \"none\" {\n1350: \t\t\treturn fmt.Errorf(\n1351: \t\t\t\t\"eth0 interface name is not allowed for %s node when network mode is not set to none\",\n1352: \t\t\t\tn.Cfg.ShortName,\n1353: \t\t\t)\n1354: \t\t}\n1355: \t}\n1356: \n1357: \treturn nil\n1358: }\n1359: \n1360: func (n *sros) SaveConfig(ctx context.Context) (*clabnodes.SaveConfigResult, error) {\n1361: \tfqdn := \"\"\n1362: \tswitch {\n1363: \tcase n.isStandaloneNode():\n1364: \t\t// check if it is a cpm node. return without error if not\n1365: \t\tif !n.isCPM(\"\") {\n1366: \t\t\treturn nil, nil\n1367: \t\t}\n1368: \t\t// if it is a standalone node use the fqdn\n1369: \t\tfqdn = n.Cfg.Fqdn\n1370: \tcase n.isDistributedBaseNode():\n1371: \t\t// if it is the\n1372: \t\tcmpNode, err := n.cpmNode()\n1373: \t\tif err != nil {\n1374: \t\t\treturn nil, err\n1375: \t\t}\n1376: \t\t// delegate to cpm node\n1377: \t\treturn cmpNode.SaveConfig(ctx)\n1378: \tcase n.isDistributedCardNode():\n1379: \t\t// check if it is a cpm node. return without error if not\n1380: \t\tif !n.isCPM(\"\") {\n1381: \t\t\treturn nil, nil\n1382: \t\t}\n1383: \t\tfqdn = n.Cfg.LongName\n1384: \t}\n1385: \n1386: \tif err := n.saveConfigWithAddr(ctx, fqdn); err != nil {\n1387: \t\treturn nil, err\n1388: \t}\n1389: \n1390: \tcfgPath := filepath.Join(\n1391: \t\tn.Cfg.LabDir,\n1392: \t\tn.Cfg.Env[envNokiaSrosSlot],\n1393: \t\tconfigCf3,\n1394: \t\tstartupCfgName,\n1395: \t)\n1396: \n1397: \treturn &clabnodes.SaveConfigResult{\n1398: \t\tConfigPath: cfgPath,\n1399: \t}, nil\n1400: }\n1401: \n1402: // saveConfigWithAddr will use the addr string to try to save the config of the node.\n1403: func (n *sros) saveConfigWithAddr(ctx context.Context, addr string) error {\n1404: \tif n.isConfigClassic() {\n1405: \t\tcmd := []string{\"/admin save\", \"/bof persist on\", \"/bof save\"}\n1406: \t\treturn n.srosSendCommandsSSH(ctx, scrapliPlatformNameClassic, cmd)\n1407: \t}\n1408: \terr := clabnetconf.SaveRunningConfig(fmt.Sprintf(\"[%s]\", addr),\n1409: \t\tn.Cfg.Credentials.Username,\n1410: \t\tn.Cfg.Credentials.Password,\n1411: \t\tscrapliPlatformName,\n1412: \t)\n1413: \tif err != nil {\n1414: \t\treturn err\n1415: \t}\n1416: \n1417: \tlog.Info(\n1418: \t\t\"Saved running configuration\",\n1419: \t\t\"node\",\n1420: \t\tn.Cfg.ShortName,\n1421: \t\t\"addr\",\n1422: \t\taddr,\n1423: \t\t\"config-mode\",\n1424: \t\tn.kindSpecificCfg().ConfigMode,\n1425: \t)\n1426: \n1427: \treturn nil\n1428: }\n1429: \n1430: // TLS bootstrap via NETCONF to enable secure gRPC.\n1431: func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {\n1432: \t// Always import PKI key and cert:\n1433: \t// \t import \"cf3:\\node.key\" in PEM format as \"cf3:\\system-pki\\node.key\" (encrypted DER)\n1434: \t//   import \"cf3:\\node.crt\" in PEM format as \"cf3:\\system-pki\\node.crt\" (encrypted DER)\n1435: \toperations := []clabnetconf.Operation{\n1436: \t\tfunc(d *netconf.Driver) (*response.NetconfResponse, error) {\n1437: \t\t\treturn d.RPC(opoptions.WithFilter(buildPKIImportXML(\n1438: \t\t\t\tfmt.Sprintf(\"cf3:/%s\", tlsKeyFile), tlsKeyFile, \"key\")))\n1439: \t\t},\n1440: \t\tfunc(d *netconf.Driver) (*response.NetconfResponse, error) {\n1441: \t\t\treturn d.RPC(opoptions.WithFilter(buildPKIImportXML(\n1442: \t\t\t\tfmt.Sprintf(\"cf3:/%s\", tlsCertFile), tlsCertFile, \"certificate\")))\n1443: \t\t},\n1444: \t}\n1445: \n1446: \t// Activate cert-profile in MD is via NETCONF, in Classic mode is via SSH\n1447: \t//  enable enables cert-profile \"clab-grpc-certs\" administratively\n1448: \tcmd := []string{}\n1449: \tif n.isConfigClassic() {\n1450: \t\tcmd = append(\n1451: \t\t\tcmd,\n1452: \t\t\tfmt.Sprintf(\n1453: \t\t\t\t\"/configure system security tls cert-profile %s no shutdown\",\n1454: \t\t\t\ttlsCertProfileName,\n1455: \t\t\t),\n1456: \t\t)\n1457: \t} else {\n1458: \t\toperations = append(operations,\n1459: \t\t\tfunc(d *netconf.Driver) (*response.NetconfResponse, error) {\n1460: \t\t\t\treturn d.EditConfig(\"candidate\", buildTLSProfileXML())\n1461: \t\t\t},\n1462: \t\t\tfunc(d *netconf.Driver) (*response.NetconfResponse, error) {\n1463: \t\t\t\treturn d.Commit()\n1464: \t\t\t},\n1465: \t\t)\n1466: \t}\n1467: \n1468: \terr := clabnetconf.MultiExec(\n1469: \t\tfmt.Sprintf(\"[%s]\", addr),\n1470: \t\tn.Cfg.Credentials.Username,\n1471: \t\tn.Cfg.Credentials.Password,\n1472: \t\toperations,\n1473: \t)\n1474: \tif len(cmd) > 0 && n.isConfigClassic() {\n1475: \t\terr := n.srosSendCommandsSSH(ctx, scrapliPlatformNameClassic, cmd)\n1476: \t\tif err != nil {\n1477: \t\t\treturn err\n1478: \t\t}\n1479: \t}\n1480: \treturn err\n1481: }\n1482: \n1483: func (n *sros) IsHealthy(_ context.Context) (bool, error) {\n1484: \tif !n.isCPM(\"\") {\n1485: \t\treturn true, fmt.Errorf(\"node %q is not a CPM, healthcheck has no effect\", n.Cfg.LongName)\n1486: \t}\n1487: \t// non-partial user startup config might not have any netconf config\n1488: \t// so we shouldn't check for this.\n1489: \tif isFullConfigFile(n.Cfg.StartupConfig) {\n1490: \t\tlog.Debug(\n1491: \t\t\t\"node has full startup config, skipping NETCONF check\",\n1492: \t\t\t\"kind\",\n1493: \t\t\tn.Cfg.Kind,\n1494: \t\t\t\"node\",\n1495: \t\t\tn.Cfg.ShortName,\n1496: \t\t)\n1497: \t\treturn true, nil\n1498: \t}\n1499: \taddr, err := n.MgmtIPAddr()\n1500: \tif err != nil {\n1501: \t\treturn false, err\n1502: \t}\n1503: \tlog.Debug(\n1504: \t\t\"Checking netconf connection\",\n1505: \t\t\"node\",\n1506: \t\tn.Cfg.LongName,\n1507: \t\t\"addr\",\n1508: \t\tfmt.Sprintf(\"%q:830\", addr),\n1509: \t)\n1510: \treturn CheckPortWithRetry(addr, 830, readyTimeout, int(readyTimeout/retryTimer), retryTimer)\n1511: }\n1512: \n1513: // CheckPortWithRetry checks if a port is open with retry logic.\n1514: func CheckPortWithRetry(\n1515: \thost string,\n1516: \tport int,\n1517: \ttimeout time.Duration,\n1518: \tmaxRetries int,\n1519: \tretryDelay time.Duration,\n1520: ) (bool, error) {\n1521: \tvar lastErr error\n1522: \taddress := net.JoinHostPort(host, fmt.Sprintf(\"%d\", port))\n1523: \tdeadline := time.Now().Add(timeout)\n1524: \n1525: \tfor i := range maxRetries {\n1526: \t\tif i > 0 {\n1527: \t\t\tif remaining := time.Until(deadline); remaining <= 0 {\n1528: \t\t\t\tbreak\n1529: \t\t\t} else if retryDelay < remaining {\n1530: \t\t\t\ttime.Sleep(retryDelay)\n1531: \t\t\t} else {\n1532: \t\t\t\ttime.Sleep(remaining)\n1533: \t\t\t}\n1534: \t\t}\n1535: \n1536: \t\tremaining := time.Until(deadline)\n1537: \t\tif remaining <= 0 {\n1538: \t\t\tbreak\n1539: \t\t}\n1540: \n1541: \t\tdialTimeout := tcpDialTimeout\n1542: \t\tif remaining < dialTimeout {\n1543: \t\t\tdialTimeout = remaining\n1544: \t\t}\n1545: \n1546: \t\tconn, err := net.DialTimeout(\"tcp\", address, dialTimeout)\n1547: \t\tif err == nil {\n1548: \t\t\tconn.Close()\n1549: \t\t\treturn true, nil\n1550: \t\t}\n1551: \t\tlastErr = err\n1552: \t}\n1553: \n1554: \tif lastErr == nil {\n1555: \t\tlastErr = fmt.Errorf(\"timed out checking tcp port %s\", address)\n1556: \t}\n1557: \n1558: \treturn false, lastErr\n1559: }\n1560: \n1561: // MgmtIP represents the management IPv4/v6 addresses of a node.\n1562: type MgmtIP struct {\n1563: \tIPv4        string\n1564: \tIPv4pLen    int\n1565: \tIPv4Gw      string\n1566: \tIPv6        string\n1567: \tIPv6pLen    int\n1568: \tIPv6Gw      string\n1569: \tContainerID string\n1570: }\n1571: \n1572: // distNodeMgmtIPs returns both ipv4 and ipv6 management IP address of a\n1573: // distributed node defined via components.\n1574: // It returns an error if neither is set in the node config.\n1575: func (n *sros) distNodeMgmtIPs() (MgmtIP, error) {\n1576: \tips := MgmtIP{}\n1577: \n1578: \tvar containerName string\n1579: \tif n.isDistributedBaseNode() {\n1580: \t\tif n.netnsNode != nil {\n1581: \t\t\tcontainerName = n.netnsNode.Config().LongName\n1582: \t\t}\n1583: \t} else {\n1584: \t\tcontainerName = n.rootCtrName\n1585: \t}\n1586: \n1587: \tif containerName == \"\" {\n1588: \t\treturn ips, nil\n1589: \t}\n1590: \n1591: \tcontainers, err := n.Runtime.ListContainers(\n1592: \t\tcontext.Background(),\n1593: \t\t[]*clabtypes.GenericFilter{\n1594: \t\t\t{\n1595: \t\t\t\tFilterType: \"name\",\n1596: \t\t\t\tMatch:      containerName,\n1597: \t\t\t},\n1598: \t\t},\n1599: \t)\n1600: \tif err != nil {\n1601: \t\treturn MgmtIP{}, fmt.Errorf(\"unable to get container %q: %v\", containerName, err)\n1602: \t}\n1603: \n1604: \tfor _, container := range containers {\n1605: \t\tif container.NetworkSettings.IPv4addr != \"\" {\n1606: \t\t\tips.IPv4 = container.NetworkSettings.IPv4addr\n1607: \t\t\tips.IPv4pLen = container.NetworkSettings.IPv4pLen\n1608: \t\t\tips.IPv4Gw = container.NetworkSettings.IPv4Gw\n1609: \t\t\tips.ContainerID = container.ID\n1610: \t\t}\n1611: \t\tif container.NetworkSettings.IPv6addr != \"\" {\n1612: \t\t\tips.IPv6 = container.NetworkSettings.IPv6addr\n1613: \t\t\tips.IPv6pLen = container.NetworkSettings.IPv6pLen\n1614: \t\t\tips.IPv6Gw = container.NetworkSettings.IPv6Gw\n1615: \t\t\tips.ContainerID = container.ID\n1616: \t\t}\n1617: \t}\n1618: \n1619: \treturn ips, nil\n1620: }\n1621: \n1622: // custom override for hosts file entry to write basename when using component nodes.\n1623: func (n *sros) GetHostsEntries(ctx context.Context) (clabtypes.HostEntries, error) {\n1624: \tresult, err := n.DefaultNode.GetHostsEntries(ctx)\n1625: \tif err != nil {\n1626: \t\treturn nil, err\n1627: \t}\n1628: \n1629: \tif n.isDistributedBaseNode() {\n1630: \t\tips, err := n.distNodeMgmtIPs()\n1631: \t\tif err != nil {\n1632: \t\t\treturn clabtypes.HostEntries{}, err\n1633: \t\t}\n1634: \n1635: \t\tif ips.IPv4 != \"\" { // v4\n1636: \t\t\tresult = append(result, clabtypes.NewHostEntry(\n1637: \t\t\t\tips.IPv4,\n1638: \t\t\t\tn.Cfg.LongName,\n1639: \t\t\t\tclabtypes.IpVersionV4,\n1640: \t\t\t).SetDescription(fmt.Sprintf(\"Kind: %s\", n.Cfg.Kind)).SetContainerID(ips.ContainerID))\n1641: \t\t}\n1642: \n1643: \t\tif ips.IPv6 != \"\" {\n1644: \t\t\tresult = append(result, clabtypes.NewHostEntry(\n1645: \t\t\t\tips.IPv6,\n1646: \t\t\t\tn.Cfg.LongName,\n1647: \t\t\t\tclabtypes.IpVersionV6,\n1648: \t\t\t).SetDescription(fmt.Sprintf(\"Kind: %s\", n.Cfg.Kind)).SetContainerID(ips.ContainerID))\n1649: \t\t}\n1650: \t}\n1651: \n1652: \treturn result, nil\n1653: }\n1654: \n1655: // MgmtIPAddr returns ipv4 or ipv6 management IP address of the node.\n1656: // It returns an error if neither is set in the node config.\n1657: func (n *sros) MgmtIPAddr() (string, error) {\n1658: \tswitch {\n1659: \tcase n.Cfg.MgmtIPv6Address != \"\":\n1660: \t\treturn n.Cfg.MgmtIPv6Address, nil\n1661: \tcase n.Cfg.MgmtIPv4Address != \"\":\n1662: \t\treturn n.Cfg.MgmtIPv4Address, nil\n1663: \t}\n1664: \n1665: \tif !n.isStandaloneNode() {\n1666: \t\tips, err := n.distNodeMgmtIPs()\n1667: \t\tif err != nil {\n1668: \t\t\treturn \"\", err\n1669: \t\t}\n1670: \n1671: \t\tswitch {\n1672: \t\tcase ips.IPv6 != \"\":\n1673: \t\t\treturn ips.IPv6, nil\n1674: \t\tcase ips.IPv4 != \"\":\n1675: \t\t\treturn ips.IPv4, nil\n1676: \t\t}\n1677: \t}\n1678: \n1679: \treturn n.Cfg.LongName, fmt.Errorf(\n1680: \t\t\"no management IP address (IPv4 or IPv6) configured for node %q\",\n1681: \t\tn.Cfg.LongName,\n1682: \t)\n1683: }\n1684: \n1685: // override to fetch CPM to avoid renaming the base node to CPM A.\n1686: func (n *sros) GetContainerName() string {\n1687: \tif n.isDistributedBaseNode() && n.cpmContainerName != \"\" {\n1688: \t\treturn n.cpmContainerName\n1689: \t}\n1690: \treturn n.DefaultNode.GetContainerName()\n1691: }\n1692: \n1693: // MonitorLogs monitors log output from the provided reader during the PostDeploy phase of SRSIM.\n1694: // It scans each line for SR OS error messages (minor or critical) and logs them as warnings\n1695: // The method checks for context cancellation on each line and returns immediately if the\n1696: // context is cancelled.\n1697: // Parameters:\n1698: //   - ctx: context for cancellation; if cancelled, the method returns.\n1699: //   - reader: io.ReadCloser providing log lines to scan.\n\n(Output capped at 50 KB. Showing lines 1-1699. Use offset=1700 to continue.)\n</content>",
    "title": "source/head/nodes/sros/sros.go",
    "metadata": {
      "preview": "// Copyright 2025 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\npackage sros\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"maps\"\n\t\"net\"\n\t\"os\"\n\t\"path\"\n\t\"path/filepath\"\n\t\"reflect\"\n\t\"regexp\"",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/sros.go",
        "text": "// Copyright 2025 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\npackage sros\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"maps\"\n\t\"net\"\n\t\"os\"\n\t\"path\"\n\t\"path/filepath\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"slices\"\n\t\"strconv\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/brunoga/deep\"\n\t\"github.com/charmbracelet/log\"\n\t\"github.com/scrapli/scrapligo/driver/netconf\"\n\t\"github.com/scrapli/scrapligo/driver/opoptions\"\n\n\t\"github.com/scrapli/scrapligo/response\"\n\n\tclabconstants \"github.com/srl-labs/containerlab/constants\"\n\tclabexec \"github.com/srl-labs/containerlab/exec\"\n\tclablinks \"github.com/srl-labs/containerlab/links\"\n\tclabnetconf \"github.com/srl-labs/containerlab/netconf\"\n\tclabnodes \"github.com/srl-labs/containerlab/nodes\"\n\tclabnodesstate \"github.com/srl-labs/containerlab/nodes/state\"\n\tclabruntime \"github.com/srl-labs/containerlab/runtime\"\n\tclabtypes \"github.com/srl-labs/containerlab/types\"\n\tclabutils \"github.com/srl-labs/containerlab/utils\"\n\t\"golang.org/x/crypto/ssh\"\n)\n\nconst (\n\tSrosDefaultType = \"SR-1\" // default sros node type\n\n\treadyTimeout   = time.Minute * 1 // max wait time for node to boot\n\ttcpDialTimeout = time.Second * 1\n\n\tgenerateable     = true\n\tgenerateIfFormat = \"%d/%d/%d\"\n\n\tslotAName = \"A\"\n\tslotBName = \"B\"\n\n\tstandaloneSlotName = slotAName\n\n\tretryTimer = 1 * time.Second\n\n\tscrapliPlatformName        = \"nokia_sros\"\n\tscrapliPlatformNameClassic = \"nokia_sros_classic\"\n\tconfigCf3                  = \"config/cf3\"\n\tconfigCf2                  = \"config/cf2\"\n\tconfigCf1                  = \"config/cf1\"\n\tstartupCfgName             = \"config.cfg\"\n\ttlsKeyFile                 = \"node.key\"\n\ttlsCertFile                = \"node.crt\"\n\ttlsCertProfileName         = \"clab-grpc-certs\"\n\n\t// SR-SIM ENV VARS.\n\tenvNokiaSrosSlot          = \"NOKIA_SROS_SLOT\"\n\tenvNokiaSrosChassis       = \"NOKIA_SROS_CHASSIS\"\n\tenvNokiaSrosSystemBaseMac = \"NOKIA_SROS_SYSTEM_BASE_MAC\"\n\tenvNokiaSrosCard          = \"NOKIA_SROS_CARD\"\n\tenvNokiaSrosSFM           = \"NOKIA_SROS_SFM\"\n\tenvNokiaSrosXIOM          = \"NOKIA_SROS_XIOM\"\n\tenvNokiaSrosMDA           = \"NOKIA_SROS_MDA\"\n\tenvSrosIPv4Active         = \"NOKIA_SROS_ADDRESS_IPV4_ACTIVE\"\n\tenvSrosIPv6Active         = \"NOKIA_SROS_ADDRESS_IPV6_ACTIVE\"\n\tenvSrosStaticRoutePrefix  = \"NOKIA_SROS_STATIC_ROUTE_\"\n\n\tsrosMinorError     = \"MINOR:\"\n\tsrosCriticalError  = \"CRITICAL:\"\n\tsrosRejectedCfgMsg = \"Configuration load failed - using default configuration\"\n)\n\nvar (\n\tkindNames  = []string{\"nokia_srsim\"}\n\tsrosSysctl = map[string]string{\n\t\t\"net.ipv4.ip_forward\":                \"0\",\n\t\t\"net.ipv6.conf.all.disable_ipv6\":     \"0\",\n\t\t\"net.ipv6.conf.default.disable_ipv6\": \"0\",\n\t\t\"net.ipv6.conf.all.accept_dad\":       \"0\",\n\t\t\"net.ipv6.conf.default.accept_dad\":   \"0\",\n\t\t\"net.ipv6.conf.all.autoconf\":         \"0\",\n\t\t\"net.ipv6.conf.default.autoconf\":     \"0\",\n\t\t\"net.ipv4.conf.all.rp_filter\":        \"0\",\n\t\t\"net.ipv6.conf.all.accept_ra\":        \"0\",\n\t\t\"net.ipv6.conf.default.accept_ra\":    \"0\",\n\t\t\"net.ipv4.conf.default.rp_filter\":    \"0\",\n\t}\n\tdefaultCredentials = clabnodes.NewCredentials(\"admin\", \"NokiaSros1!\")\n\n\tsrosEnv = map[string]string{\n\t\t\"SRSIM\":                   \"1\",\n\t\tenvNokiaSrosChassis:       SrosDefaultType,     // filler to be overridden\n\t\tenvNokiaSrosSystemBaseMac: \"fa:ac:ff:ff:10:00\", // filler to be overridden\n\t\tenvNokiaSrosSlot:          slotAName,           // filler to be overridden\n\t}\n\n\treadyCmdCpm  = `/usr/bin/pgrep ^cpm$`\n\treadyCmdBoth = `/usr/bin/pgrep ^both$`\n\treadyCmdIom  = `/usr/bin/pgrep ^iom$`\n\n\trequiredKernelVersion = &clabutils.KernelVersion{\n\t\tMajor:    5,\n\t\tMinor:    5,\n\t\tRevision: 0,\n\t}\n\t// Internal directories inside SR-SIM container.\n\tcf1Dir = \"/home/sros/flash1\"\n\tcf2Dir = \"/home/sros/flash2\"\n\tcf3Dir = \"/home/sros/flash3\" // Where the running config will be stored\n\tlicDir = \"/nokia/license\"\n\n\tInterfaceRegexp = regexp.MustCompile(\n\t\t`^(?P<card>\\d+)/(?:x(?P<xiom>\\d+)/)?(?P<mda>\\d+)(?:/c(?P<connector>\\d+))?/(?P<port>\\d+)$`,\n\t)\n\tMappedInterfaceRegexp = regexp.MustCompile(\n\t\t`^(?:e(?P<card>\\d+)-(?:x(?P<xiom>\\d+)-)?(?P<mda>\\d+)(?:-c(?P<connector>\\d+))?-(?P<port>\\d+)|eth(?P<mgmtPort>\\d+))$`,\n\t)\n\tInterfaceHelp = `The format of the interface name need to be one of:\n\t  Regular SR OS interface names, that is:\n\t  1/2/3       -> card 1, mda 2, port 3\n      1/2/c3/4    -> card 1, mda 2, connector 3, port 4\n      1/x2/3/4    -> card 1, xiom 2, mda 3, port 4\n      1/x2/3/c4/5 -> card 1, xiom 2, mda 3, connector 4, port 5\n\t  The mapped Linux interface names, that is:\n      e1-2-3       -> card 1, mda 2, port 3\n      e1-2-c3-4    -> card 1, mda 2, connector 3, port 4\n      e1-x2-3-4    -> card 1, xiom 2, mda 3, port 4\n      e1-x2-3-c4-5 -> card 1, xiom 2, mda 3, connector 4, port 5\n\t  eth[0-9], for management interfaces of CPM-A/CPM-B or for fabric interfaces`\n)\n\n// Register registers the node in the NodeRegistry.\nfunc Register(r *clabnodes.NodeRegistry) {\n\tgenerateNodeAttributes := clabnodes.NewGenerateNodeAttributes(generateable, generateIfFormat)\n\tplatformOpts := &clabnodes.PlatformAttrs{\n\t\tScrapliPlatformName: scrapliPlatformName,\n\t}\n\tnrea := clabnodes.NewNodeRegistryEntryAttributes(\n\t\tdefaultCredentials,\n\t\tgenerateNodeAttributes,\n\t\tplatformOpts,\n\t).WithKindSpecificConfig(kindSpecificConfig)\n\n\tr.Register(kindNames, func() clabnodes.Node {\n\t\treturn new(sros)\n\t}, nrea)\n}\n\n// KindSpecificConfig is the nokia_srsim kind-specific config, set as keys on the node definition.\ntype KindSpecificConfig struct {\n\t// ConfigMode is the SR OS configuration mode: model-driven (default), classic or mixed.\n\tConfigMode ConfigMode `yaml:\"config-mode,omitempty\" json:\"config-mode,omitempty\"`\n\t// GenComponentConfig generates the configuration of the node's components. Defaults to true.\n\tGenComponentConfig bool         `yaml:\"gen-component-config\" json:\"gen-component-config\"`\n\tSFM                string       `yaml:\"sfm,omitempty\" json:\"sfm,omitempty\"`\n\tComponents         []*Component `yaml:\"components,omitempty\" json:\"components,omitempty\"`\n}\n\n// SetDefaults implements clabnodes.KindSpecificConfigDefaulter.\nfunc (c *KindSpecificConfig) SetDefaults() { c.GenComponentConfig = true }\n\n// equalIgnoringComponentOrder reports whether c and o are equal, comparing components by slot\n// regardless of their order and the case of the slot.\nfunc (c *KindSpecificConfig) equalIgnoringComponentOrder(o *KindSpecificConfig) bool {\n\ta, b := *c, *o\n\ta.Components, b.Components = nil, nil\n\n\treturn reflect.DeepEqual(a, b) &&\n\t\treflect.DeepEqual(componentsBySlot(c.Components), componentsBySlot(o.Components))\n}\n\nvar kindSpecificConfig clabnodes.KindSpecificConfigSpec[KindSpecificConfig]\n\n// sros SR-SIM Kind structure.\ntype sros struct {\n\tclabnodes.DefaultNode\n\t// startup-config passed as a path to a file with CLI instructions will be read into this byte\n\t// slice\n\tstartupCliCfg []byte\n\n\t// SSH public keys extracted from the clab host\n\tsshPubKeys []ssh.PublicKey\n\n\t// software version SR OS x node runs\n\tswVersion      *SrosVersion\n\tcomponentNodes []clabnodes.Node\n\n\t// in distributed mode we rename the Cfg.LongName and Cfg.ShortName and Cfg.Fqdn attributes when\n\t// deploying. e.g. inspect is either called after deploy or independently. Hence we need to\n\t// differentiate if we need to perform the\n\t// component cpm based rename or not. This field indicates just that\n\trenameDone bool\n\t// rootComponents stores the OG components from root node for dist setups\n\t// ..allows children of the distributed root node to access root components (ie. for cfg gen)\n\trootComponents []*Component\n\t// store the longname with cpm suffix\n\tcpmContainerName string\n\t// for component nodes, store base nodes\n\tbaseShortName string\n\tbaseLongName  string\n\t// rootCtrName is the container that owns the netns.\n\t//  - for components based: the internal netns container.\n\t//  - for network mode based: parsed from network-mode.\n\trootCtrName string\n\n\t// userEnv is the env map from the topology, before component fields are merged in.\n\t// Node env overrides component type, XIOM, MDA, SFM, and per-component env.\n\tuserEnv map[string]string\n\n\tpreDeployParams *clabnodes.PreDeployParams\n\n\tnetnsNode clabnodes.Node\n}\n\nfunc (*sros) LinkApplyMode(context.Context) clabnodes.LinkApplyMode {\n\treturn clabnodes.LinkApplyModeLive\n}\n\n// Init Function for SR-SIM kind.\nfunc (n *sros) kindSpecificCfg() *KindSpecificConfig { return kindSpecificConfig.Of(n.Cfg) }\n\nfunc (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) error {\n\t// Init DefaultNode\n\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n\t// set virtualization requirement\n\tn.HostRequirements.SSSE3 = true\n\tn.HostRequirements.MinVCPU = 4\n\tn.HostRequirements.MinVCPUFailAction = clabtypes.FailBehaviourError\n\tn.HostRequirements.MinAvailMemoryGb = 4\n\tn.HostRequirements.MinAvailMemoryGbFailAction = clabtypes.FailBehaviourLog\n\n\tn.LicensePolicy = clabtypes.LicensePolicyRequired\n\n\tn.Cfg = cfg\n\n\tn.InterfaceHelp = InterfaceHelp\n\tn.InterfaceRegexp = InterfaceRegexp\n\n\tfor _, o := range opts {\n\t\to(n)\n\t}\n\n\t// if user was not initialized to a value, use root\n\tif n.Cfg.User == \"\" {\n\t\tn.Cfg.User = \"0:0\"\n\t}\n\n\t// Snapshot topology env before component and SFM flags are applied.\n\t// Component nodes set userEnv from the base node before Init.\n\tenvAlreadyResolved := n.userEnv != nil\n\tif !envAlreadyResolved {\n\t\tif n.Cfg.Env == nil {\n\t\t\tn.userEnv = map[string]string{}\n\t\t} else {\n\t\t\tn.userEnv = maps.Clone(n.Cfg.Env)\n\t\t}\n\t}\n\tif n.Cfg.Env == nil {\n\t\tn.Cfg.Env = map[string]string{}\n\t}\n\n\t// Distributed cards inherit SFM from the base node env. Applying it again\n\t// would warn once per card when the user also set NOKIA_SROS_SFM.\n\tif sfm := n.kindSpecificCfg().SFM; sfm != \"\" && !envAlreadyResolved {\n\t\tif envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {\n\t\t\tif envSFM != sfm {\n\t\t\t\tlog.Warn(\n\t\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n\t\t\t\t\t\tsfm,\n\t\t\t\t\t\tenvNokiaSrosSFM,\n\t\t\t\t\t),\n\t\t\t\t\t\"node\", n.Cfg.ShortName,\n\t\t\t\t\t\"env\", envNokiaSrosSFM,\n\t\t\t\t\t\"component-value\", sfm,\n\t\t\t\t\t\"env-value\", envSFM,\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\tn.Cfg.Env[envNokiaSrosSFM] = sfm\n\t\t}\n\t}\n\n\tmaps.Copy(n.Cfg.Sysctls, srosSysctl)\n\n\t// make sure we always have uppercase slot definition\n\tfor _, c := range n.kindSpecificCfg().Components {\n\t\tc.Slot = strings.ToUpper(c.Slot)\n\t}\n\t// Merge Environment\n\tif n.Cfg.NodeType == \"\" {\n\t\tn.Cfg.NodeType = SrosDefaultType\n\t}\n\tsrosEnv[envNokiaSrosChassis] = n.Cfg.NodeType // Override NodeType var with existing env\n\n\tmac := genMac(n.Cfg)\n\tsrosEnv[envNokiaSrosSystemBaseMac] = mac\n\t// Ensure n.Cfg.Certificate.Issue is not nil\n\tif n.Cfg.Certificate.Issue == nil {\n\t\tn.Cfg.Certificate.Issue = new(false)\n\t}\n\tif n.isStandaloneNode() {\n\t\tlog.Debugf(\n\t\t\t\"%q is standalone node. %v\",\n\t\t\tn.Cfg.ShortName,\n\t\t\tlen(n.kindSpecificCfg().Components),\n\t\t)\n\n\t\tvars, err := n.setupStandaloneComponents()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\twarnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)\n\n\t\t// n.Cfg.Env overrides component vars, overrides default srosEnv\n\t\tn.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)\n\t\tlog.Debug(\"Merged env file\", \"env\", fmt.Sprintf(\"%+v\", n.Cfg.Env), \"node\", n.Cfg.ShortName)\n\t} else {\n\t\tlog.Debugf(\n\t\t\t\"%q is distributed node. %v\",\n\t\t\tn.Cfg.ShortName,\n\t\t\tlen(n.kindSpecificCfg().Components),\n\t\t)\n\n\t\tn.Cfg.Env = clabutils.MergeStringMaps(srosEnv, n.Cfg.Env)\n\t\tlog.Debug(\"Merged env file\", \"env\", fmt.Sprintf(\"%+v\", n.Cfg.Env), \"node\", n.Cfg.ShortName)\n\n\t\terr := n.setupComponentNodes()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// integrated -> pull component info from slot A components.\nfunc (n *sros) setupStandaloneComponents() (map[string]string, error) {\n\tvars := map[string]string{}\n\n\tif len(n.kindSpecificCfg().Components) == 0 {\n\t\treturn nil, nil\n\t}\n\tif len(n.kindSpecificCfg().Components) > 1 {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"expected at most one component override for standalone SR-SIM node %q, \"+\n\t\t\t\t\"or one component per slot %s for redundant type %q\",\n\t\t\tn.Cfg.ShortName,\n\t\t\tstrings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), \"/\"),\n\t\t\tn.Cfg.NodeType,\n\t\t)\n\t}\n\n\tslotA := n.kindSpecificCfg().Components[0]\n\n\tslotName := strings.ToUpper(strings.TrimSpace(slotA.Slot))\n\t// single undefined slot is implicitly set to A\n\tif slotName == \"\" {\n\t\tslotName = standaloneSlotName\n\t}\n\n\tif !integratedSrosSlotAllowed(n.Cfg.NodeType, slotName) {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"expected no slot, or slot %s for components of standalone SR-SIM node %q\",\n\t\t\tstrings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), \"/\"),\n\t\t\tn.Cfg.ShortName,\n\t\t)\n\t}\n\tvars[envNokiaSrosSlot] = slotName\n\n\tsetComponentEnvVars(vars, slotA)\n\n\tmaps.Copy(vars, slotA.Env)\n\n\treturn vars, nil\n}\n\n// Pre Deploy func for SR-SIM kind.\nfunc (n *sros) PreDeploy(ctx context.Context, params *clabnodes.PreDeployParams) error {\n\tlog.Debug(\"Running pre-deploy\")\n\n\tif err := n.verifyNokiaSrsimImage(ctx); err != nil {\n\t\treturn err\n\t}\n\n\t// store the preDeployParams\n\tn.preDeployParams = params\n\n\tn.InterfaceHelp = InterfaceHelp\n\n\t// store provided pubkeys\n\tn.sshPubKeys = params.SSHPubKeys\n\n\t// Create files/dir structure for standalone nodes or distributed CPM nodes\n\tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.isCPM(\"\")) {\n\t\t// generate the certificate\n\t\tif *n.Cfg.Certificate.Issue {\n\t\t\tn.Cfg.Certificate.SANs = append(n.Cfg.Certificate.SANs, n.baseShortName, n.baseLongName)\n\t\t\tcertificate, err := n.LoadOrGenerateCertificate(params.Cert, params.TopologyName)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// set the certificate data\n\t\t\tn.Config().TLSCert = string(certificate.Cert)\n\t\t\tn.Config().TLSKey = string(certificate.Key)\n\t\t}\n\t\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),\n\t\t\tclabconstants.PermissionsOpen)\n\t\tslot := n.Cfg.Env[envNokiaSrosSlot]\n\t\tif slot == \"\" {\n\t\t\treturn fmt.Errorf(\"fail to init node because Env var %q is set to %q\",\n\t\t\t\tenvNokiaSrosSlot, n.Cfg.Env[envNokiaSrosSlot])\n\t\t}\n\t\t// add the config specific mounts\n\t\tcf1Path := filepath.Join(n.Cfg.LabDir, slot, configCf1)\n\t\tcf2Path := filepath.Join(n.Cfg.LabDir, slot, configCf2)\n\t\tcf3Path := filepath.Join(n.Cfg.LabDir, slot, configCf3)\n\t\tn.Cfg.Binds = append(n.Cfg.Binds,\n\t\t\tfmt.Sprint(cf1Path, \":\", cf1Dir, \"/:rw\"),\n\t\t\tfmt.Sprint(cf2Path, \":\", cf2Dir, \"/:rw\"),\n\t\t\tfmt.Sprint(cf3Path, \":\", cf3Dir, \"/:rw\"),\n\t\t)\n\n\t\tif n.Cfg.License != \"\" && (n.isCPM(\"\") || n.isStandaloneNode()) {\n\t\t\t// we mount a fixed path node.Labdir/license.key as the license referenced in topo file\n\t\t\t// will be copied to that path\n\t\t\tn.Cfg.Binds = append(n.Cfg.Binds, fmt.Sprint(\n\t\t\t\tfilepath.Join(n.Cfg.LabDir, \"license.key\"), \":\", licDir, \"/license.txt:ro\"))\n\t\t}\n\n\t\treturn n.createSROSFiles(ctx)\n\t}\n\treturn nil\n}\n\nfunc (n *sros) DeployEndpoints(ctx context.Context) error {\n\tif err := n.DefaultNode.DeployEndpoints(ctx); err != nil {\n\t\treturn err\n\t}\n\n\treturn n.PostDeployEndpoints(ctx)\n}\n\n// PostDeployEndpoints runs SR-SIM endpoint fixups after dataplane links exist.\nfunc (n *sros) PostDeployEndpoints(ctx context.Context) error {\n\tif n.Runtime.Mgmt().Driver == clabtypes.MgmtDriverMacvlan {\n\t\treturn nil\n\t}\n\t// Disable TX checksum offload on the host NS veth for the mgmt interface.\n\tvar peerIfIndex int\n\terr := n.ExecFunction(ctx, clabutils.VethPeerIndex(\"eth0\", &peerIfIndex))\n\tif err != nil {\n\t\tlog.Warn(\"Failed to get veth peer index for SR-SIM mgmt interface\",\n\t\t\t\"node\", n.Cfg.ShortName,\n\t\t\t\"error\", err)\n\t\treturn nil\n\t}\n\n\tif err := clabutils.DisableTxOffloadByIndex(peerIfIndex); err != nil {\n\t\tlog.Warn(\"Failed to disable TX checksum offload on SR-SIM mgmt host veth\",\n\t\t\t\"node\", n.Cfg.ShortName,\n\t\t\t\"error\", err)\n\t}\n\n\treturn nil\n}\n\n// Post Deploy func for SR-SIM kind.\nfunc (n *sros) PostDeploy(ctx context.Context, params *clabnodes.PostDeployParams) error {\n\tlog.Info(\"Running postdeploy actions\",\n\t\t\"kind\", n.Cfg.Kind,\n\t\t\"node\", n.Cfg.ShortName)\n\n\t// start waiting for container ready (PID based check)\n\tif err := n.Ready(ctx); err != nil {\n\t\treturn err\n\t}\n\n\terrChan := make(chan error, 1)\n\n\tlogs, err := n.Runtime.StreamLogs(ctx, n.GetContainerName())\n\tif err != nil {\n\t\tlog.Debug(\"Failed to get container log stream\", \"node\", n.Cfg.ShortName, \"err\", err)\n\t} else {\n\t\t// Start monitoring in a goroutine\n\t\tmonitoringCtx, cancel := context.WithCancel(ctx)\n\t\tdefer cancel()\n\t\tdefer logs.Close()\n\n\t\tgo n.MonitorLogs(monitoringCtx, logs, errChan)\n\t}\n\n\t// Populate /etc/hosts for service discovery on mgmt interface\n\tif err = n.populateHosts(ctx, params.Nodes); err != nil {\n\t\tlog.Warn(\"Unable to populate hosts list\", \"node\", n.Cfg.ShortName, \"err\", err)\n\t}\n\n\tn.swVersion, err = n.RunningVersion(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !n.isCPM(slotAName) {\n\t\treturn nil\n\t}\n\n\tif err := n.RequireMgmtReachable(); err != nil {\n\t\treturn err\n\t}\n\n\t// Execute SaveConfig after boot. This code should only run on active CPM\n\tdeadline := time.Now().Add(readyTimeout)\n\tvar lastHealthErr error\n\tfor time.Now().Before(deadline) {\n\t\t// Check if context is canceled\n\t\tif err := ctx.Err(); err != nil {\n\t\t\treturn fmt.Errorf(\"context canceled: %w\", err)\n\t\t}\n\n\t\tisHealthy, err := n.IsHealthy(ctx)\n\t\tif err != nil {\n\t\t\tlastHealthErr = err\n\t\t\tlog.Debug(\n\t\t\t\tfmt.Errorf(\n\t\t\t\t\t\"health check failed, check 'docker logs -f %s': %w\",\n\t\t\t\t\tn.Cfg.LongName,\n\t\t\t\t\terr,\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\n\t\tif isHealthy {\n\t\t\taddr, err := n.MgmtIPAddr()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// TLS bootstrap in case of n.Cfg.Certificate.Issue flag\n\t\t\tif *n.Cfg.Certificate.Issue {\n\t\t\t\tlog.Infof(\"TLS cert/key bootstrap for node %q\", n.Cfg.LongName)\n\n\t\t\t\terr = n.tlsCertBootstrap(ctx, addr)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\t\"TLS cert/key bootstrap to node %q failed: %w\",\n\t\t\t\t\t\tn.Cfg.LongName,\n\t\t\t\t\t\terr,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tlog.Infof(\n\t\t\t\t\t\"Completed bootstrap for gRPC-TLS profile on node %s\",\n\t\t\t\t\tn.Cfg.ShortName,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// Partial or NO Config Provided\n\t\t\tif !isFullConfigFile(n.Cfg.StartupConfig) {\n\t\t\t\tlog.Infof(\"Saving node %q config as startup...\", n.Cfg.LongName)\n\t\t\t\terr = n.saveConfigWithAddr(ctx, addr)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"save config to node %q, failed: %w\", n.Cfg.LongName, err)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\t// Wait before next check\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase err := <-errChan:\n\t\t\tlog.With(\"kind\", n.Cfg.Kind, \"node\", n.Cfg.ShortName).Debugf(\"got %q on errChan\", err)\n\t\t\tlog.Info(\"Skipping postdeploy actions\", \"kind\", n.Cfg.Kind, \"node\", n.Cfg.ShortName)\n\t\t\treturn nil\n\t\tcase <-time.After(retryTimer):\n\t\t\t// continue to next iteration\n\t\t}\n\t}\n\n\tif lastHealthErr != nil {\n\t\treturn fmt.Errorf(\"node %q did not become healthy before timeout: %w\",\n\t\t\tn.Cfg.LongName, lastHealthErr)\n\t}\n\n\treturn fmt.Errorf(\"node %q did not become healthy before timeout\", n.Cfg.LongName)\n}\n\n// Delete func for SR-SIM kind.\nfunc (n *sros) Delete(ctx context.Context) error {\n\t// if not distributed, follow default node implementation\n\tif n.isStandaloneNode() || n.isDistributedCardNode() {\n\t\treturn n.DefaultNode.Delete(ctx)\n\t}\n\n\tvar errs []error\n\n\t// Delete all the component containers\n\tfor _, componentNode := range n.componentNodes {\n\t\terr := componentNode.Delete(ctx)\n\t\tif err != nil {\n\t\t\tlog.Warn(err)\n\t\t\terrs = append(errs, err)\n\t\t}\n\t}\n\n\terrs = append(errs, n.DefaultNode.Delete(ctx), n.netnsNode.Delete(ctx))\n\n\treturn errors.Join(errs...)\n}\n\nfunc (n *sros) setupComponentNodes() error {\n\tif !n.isDistributedBaseNode() {\n\t\treturn nil\n\t}\n\n\tn.netnsNode = new(namespaceNode)\n\tif err := n.netnsNode.Init(\n\t\tn.newNetnsConfig(),\n\t\tclabnodes.WithRuntime(n.GetRuntime()),\n\t); err != nil {\n\t\treturn err\n\t}\n\trootCtrName := n.netnsNode.Config().LongName\n\n\t// loop through the components, creating them\n\tfor _, c := range n.kindSpecificCfg().Components {\n\t\t// instantiate a new nokia_srsim instance\n\t\tsrosNode := new(sros)\n\t\tcomponentNode := clabnodes.Node(srosNode)\n\n\t\t// copy the original node's NodeConfig to the component\n\t\tcomponentConfig, err := deep.Copy(n.Cfg)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to deep copy node config for component: %w\", err)\n\t\t}\n\n\t\t// component nodes join to the nents pause container\n\t\tcomponentConfig.NetworkMode = fmt.Sprintf(\"container:%s\", n.netnsNode.GetShortName())\n\n\t\t// adjust the config values from the original node\n\t\tcomponentConfig.ShortName = n.calcComponentName(componentConfig.ShortName, c.Slot)\n\t\tcomponentConfig.LongName = n.calcComponentName(componentConfig.LongName, c.Slot)\n\t\tcomponentConfig.NodeType = n.Cfg.NodeType\n\t\tkindSpecificConfig.Of(componentConfig).Components = nil\n\t\tcomponentConfig.Fqdn = n.calcComponentFqdn(c.Slot)\n\t\tcomponentConfig.DNS = nil\n\t\tcomponentConfig.PortBindings = nil\n\t\tcomponentConfig.PortSet = nil\n\n\t\t// Component fields fill env keys the user did not set. Node env wins.\n\t\tif componentConfig.Env == nil {\n\t\t\tcomponentConfig.Env = map[string]string{}\n\t\t}\n\t\tkeepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)\n\t\t// Slot identifies this container. A node-level NOKIA_SROS_SLOT cannot apply to every card.\n\t\tcomponentConfig.Env[envNokiaSrosSlot] = c.Slot\n\n\t\t// adjust label based env vars\n\t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.NodeName)] = componentConfig.ShortName\n\t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.LongName)] = componentConfig.LongName\n\n\t\tif componentConfig.Labels == nil {\n\t\t\tcomponentConfig.Labels = map[string]string{}\n\t\t}\n\n\t\t// adjust labels\n\t\tcomponentConfig.Labels[clabconstants.NodeName] = componentConfig.ShortName\n\t\tcomponentConfig.Labels[clabconstants.LongName] = componentConfig.LongName\n\t\tcomponentConfig.Labels[clabconstants.RootNodeName] = n.Cfg.ShortName\n\t\tcomponentConfig.Labels[clabconstants.RootNodeLongName] = n.Cfg.LongName\n\n\t\t// Preserve the topology env. Init must not snapshot the merged component env,\n\t\t// or config generation would treat component flags as user overrides.\n\t\tsrosNode.userEnv = maps.Clone(n.userEnv)\n\n\t\t// init the component\n\t\terr = componentNode.Init(componentConfig)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// set the runtime by copying it from the general node\n\t\tcomponentNode.WithRuntime(n.GetRuntime())\n\n\t\t// store root components for cpms, for config gen\n\t\tsrosNode.rootComponents = n.kindSpecificCfg().Components\n\t\t// store base node name\n\t\tsrosNode.baseShortName = n.Cfg.ShortName\n\t\tsrosNode.baseLongName = n.Cfg.LongName\n\t\tsrosNode.rootCtrName = rootCtrName\n\n\t\t// store the node in the componentNodes\n\t\tn.componentNodes = append(n.componentNodes, componentNode)\n\t}\n\treturn nil\n}\n\n// deployFabric deploys the distributed SR-SIM when the `components` key is present.\nfunc (n *sros) deployFabric(ctx context.Context, deployParams *clabnodes.DeployParams) error {\n\tnetnsConfig := n.netnsNode.Config()\n\n\tnetnsConfig.MgmtIPv4Address = n.Cfg.MgmtIPv4Address\n\tnetnsConfig.MgmtIPv4AddressAuto = n.Cfg.MgmtIPv4AddressAuto\n\tnetnsConfig.MgmtIPv4PrefixLength = n.Cfg.MgmtIPv4PrefixLength\n\tnetnsConfig.MgmtIPv4Gateway = n.Cfg.MgmtIPv4Gateway\n\tnetnsConfig.MgmtIPv6Address = n.Cfg.MgmtIPv6Address\n\tnetnsConfig.MgmtIPv6AddressAuto = n.Cfg.MgmtIPv6AddressAuto\n\tnetnsConfig.MgmtIPv6PrefixLength = n.Cfg.MgmtIPv6PrefixLength\n\tnetnsConfig.MgmtIPv6Gateway = n.Cfg.MgmtIPv6Gateway\n\n\tif err := n.netnsNode.Deploy(ctx, deployParams); err != nil {\n\t\treturn fmt.Errorf(\"deploy network namespace node %q: %w\", n.netnsNode.GetShortName(), err)\n\t}\n\n\tips, err := n.distNodeMgmtIPs()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tn.setComponentMgmtEnv(ips)\n\n\t// loop through the components, creating them\n\tfor _, c := range n.componentNodes {\n\t\tif err := c.PreDeploy(ctx, n.preDeployParams); err != nil {\n\t\t\treturn fmt.Errorf(\"pre-deploy for component node %q: %w\", c.GetShortName(), err)\n\t\t}\n\t\t// deploy the component\n\t\terr := c.Deploy(ctx, deployParams)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tcpmSlot, err := n.cpmSlot()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// store the CPM container name\n\tn.cpmContainerName = n.calcComponentName(n.Cfg.LongName, cpmSlot)\n\tn.renameDone = true\n\n\t// adjust also the mgmt IP addresses of the general node\n\tn.Cfg.MgmtIPv4Address = ips.IPv4\n\tn.Cfg.MgmtIPv6Address = ips.IPv6\n\n\treturn nil\n}\n\n// set env vars for the CPMs so that they are aware of mgmt info.\nfunc (n *sros) setComponentMgmtEnv(ips MgmtIP) {\n\tfor _, component := range n.componentNodes {\n\t\tcfg := component.Config()\n\t\tslot := strings.ToUpper(cfg.Env[envNokiaSrosSlot])\n\n\t\tif slot != slotAName && slot != slotBName {\n\t\t\tcontinue\n\t\t}\n\n\t\tenv := cfg.Env\n\t\tif intf := env[\"NOKIA_SROS_MGMT_IF\"]; intf != \"\" && intf != \"eth0\" {\n\t\t\tcontinue\n\t\t}\n\t\tif env[envSrosIPv4Active] != \"\" || env[envSrosIPv6Active] != \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\t// SKIP if the user defines this env var\n\t\texplicitRoutes := false\n\t\tfor key := range env {\n\t\t\tif strings.HasPrefix(key, envSrosStaticRoutePrefix) {\n\t\t\t\texplicitRoutes = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif explicitRoutes {\n\t\t\tcontinue\n\t\t}\n\n\t\tif ips.IPv4 != \"\" {\n\t\t\tenv[envSrosIPv4Active] = fmt.Sprintf(\"%s/%d\", ips.IPv4, ips.IPv4pLen)\n\t\t\tif ips.IPv4Gw != \"\" {\n\t\t\t\tenv[envSrosStaticRoutePrefix+\"1\"] = \"0.0.0.0/0@\" + ips.IPv4Gw\n\t\t\t}\n\t\t}\n\n\t\tif ips.IPv6 != \"\" {\n\t\t\tenv[envSrosIPv6Active] = fmt.Sprintf(\"%s/%d\", ips.IPv6, ips.IPv6pLen)\n\t\t\tif ips.IPv6Gw != \"\" {\n\t\t\t\tenv[envSrosStaticRoutePrefix+\"2\"] = \"::/0@\" + ips.IPv6Gw\n\t\t\t}\n\t\t}\n\t}\n}\n\n// isDistributedCard checks if the slot variable is set, hence it is an instance (slot) of a\n// distributed setup.\n// isDistributedCardNode returns true if this node is a card (linecard/IOM)\n// in a distributed SR-SIM deployment. A distributed card has a slot assignment\n// but no components of its own.\nfunc (n *sros) isDistributedCardNode() bool {\n\t_, exists := n.Cfg.Env[envNokiaSrosSlot]\n\treturn exists && len(n.kindSpecificCfg().Components) == 0\n}\n\n// isDistributedBaseNode returns true if this is the base node of a distributed\n// SR-SIM deployment. The base node orchestrates multiple component nodes.\nfunc (n *sros) isDistributedBaseNode() bool {\n\tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n\t\treturn isRedundantIntegratedSrosComponents(n.Cfg.NodeType, n.kindSpecificCfg().Components)\n\t}\n\treturn len(n.kindSpecificCfg().Components) > 1\n}\n\n// isStandaloneNode returns true if this is a standalone (non-distributed) SR-SIM node.\nfunc (n *sros) isStandaloneNode() bool {\n\treturn !n.isDistributedBaseNode() && !n.isDistributedCardNode()\n}\n\n// calcComponentName appends the line card suffix to the given node name.\nfunc (n *sros) calcComponentName(name, slot string) string {\n\tif n.renameDone {\n\t\treturn name\n\t}\n\treturn fmt.Sprintf(\"%s-%s\", name, strings.ToLower(slot))\n}\n\n// calcComponentFqdn computes the FQDN for a given slot.\nfunc (n *sros) calcComponentFqdn(slot string) string {\n\tif n.renameDone {\n\t\treturn n.Cfg.Fqdn\n\t}\n\tfqdnDotIndex := strings.Index(n.Cfg.Fqdn, \".\")\n\tif fqdnDotIndex < 0 {\n\t\treturn fmt.Sprintf(\"%s-%s\", n.Cfg.Fqdn, strings.ToLower(slot))\n\t}\n\tresult := fmt.Sprintf(\n\t\t\"%s-%s%s\",\n\t\tn.Cfg.Fqdn[:fqdnDotIndex],\n\t\tstrings.ToLower(slot),\n\t\tn.Cfg.Fqdn[fqdnDotIndex:],\n\t)\n\treturn result\n}\n\n// cpmNode returns a CPM Node (used in Distributed mode).\nfunc (n *sros) cpmNode() (clabnodes.Node, error) {\n\tdefaultSlot, err := n.cpmSlot()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefaultSlot = strings.ToLower(defaultSlot)\n\tfor _, cn := range n.componentNodes {\n\t\tif cn.GetShortName()[len(cn.GetShortName())-1:] == defaultSlot {\n\t\t\treturn cn, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"node %s: node for slot %s not found\", n.GetShortName(), defaultSlot)\n}\n\n// cpmSlot returns the Slot of the preferred CPM Node (used when Distributed mode).\n// It prefers slot A if present, otherwise returns slot B.\nfunc (n *sros) cpmSlot() (string, error) {\n\t// Prefer slot A, fall back to slot B. Slots are accepted in either case.\n\tfor _, comp := range n.kindSpecificCfg().Components {\n\t\tif strings.EqualFold(comp.Slot, slotAName) {\n\t\t\treturn slotAName, nil\n\t\t}\n\t}\n\tfor _, comp := range n.kindSpecificCfg().Components {\n\t\tif strings.EqualFold(comp.Slot, slotBName) {\n\t\t\treturn slotBName, nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"node %s: unable to determine default slot\", n.GetShortName())\n}\n\n// Deploy deploys the SR-SIM kind.\nfunc (n *sros) Deploy(ctx context.Context, deployParams *clabnodes.DeployParams) error {\n\t// if it is a chassis with multiple cards (i.e. components)\n\tif n.isDistributedBaseNode() {\n\t\terr := n.deployFabric(ctx, deployParams)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Update the nodes state\n\t\tn.SetState(clabnodesstate.Deployed)\n\t\treturn nil\n\t}\n\n\t// if it is a regular node\n\terr := n.DefaultNode.Deploy(ctx, deployParams)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\n// Ready returns when the node boot sequence reached the stage when it is ready to accept config\n// commands\n// returns an error if not ready by the expiry of the timer readyTimeout.\nfunc (n *sros) Ready(ctx context.Context) error {\n\tctx, cancel := context.WithTimeout(ctx, readyTimeout)\n\tdefer cancel()\n\tvar err error\n\treadyCmds := []string{readyCmdCpm, readyCmdBoth, readyCmdIom}\n\treadyCmdsStrings := []string{\"CPM\", \"BOTH\", \"IOM\"}\n\tlog.Debug(\"Waiting for SR OS node to boot...\", \"node\", n.Cfg.ShortName)\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"timed out waiting for SR OS node %s to boot: %v\",\n\t\t\t\tn.Cfg.ShortName,\n\t\t\t\terr,\n\t\t\t)\n\t\tdefault:\n\t\t\t// check if cpm is running\n\t\t\tfor k, cmd := range readyCmds {\n\t\t\t\tcmd, _ := clabexec.NewExecCmdFromString(cmd)\n\t\t\t\texecResult, err := n.RunExec(ctx, cmd)\n\t\t\t\tif err != nil || (execResult != nil && execResult.GetReturnCode() != 0) {\n\t\t\t\t\tlogMsg := fmt.Sprintf(\n\t\t\t\t\t\t\"status check %s failed on %s retrying\",\n\t\t\t\t\t\treadyCmdsStrings[k],\n\t\t\t\t\t\tn.Cfg.ShortName,\n\t\t\t\t\t)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlogMsg += fmt.Sprintf(\" error: %v\", err)\n\t\t\t\t\t}\n\t\t\t\t\tif execResult != nil && execResult.GetReturnCode() != 0 {\n\t\t\t\t\t\tlogMsg += fmt.Sprintf(\n\t\t\t\t\t\t\t\", output:%s\",\n\t\t\t\t\t\t\tstrings.ReplaceAll(execResult.String(), \"\\n\", \"; \"),\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tlog.Debug(logMsg)\n\t\t\t\t}\n\t\t\t\tif execResult != nil && execResult.GetReturnCode() == 0 {\n\t\t\t\t\tlog.Debug(\"SR OS is ready to be configured\", \"node\", n.Cfg.ShortName)\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\ttime.Sleep(retryTimer)\n\t\t\t}\n\t\t}\n\t}\n}\n\n// checkKernelVersion emits a warning if the present kernel version is lower than the required one.\nfunc (*sros) checkKernelVersion() error {\n\t// retrieve running kernel version\n\tkv, err := clabutils.GetKernelVersion()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// do the comparison\n\tif !kv.GreaterOrEqual(requiredKernelVersion) {\n\t\tlog.Warnf(\n\t\t\t\"Nokia SR OS requires a kernel version greater than %s. Detected kernel version: %s. Not all features might function properly!\",\n\t\t\trequiredKernelVersion,\n\t\t\tkv,\n\t\t)\n\t}\n\treturn nil\n}\n\nfunc (n *sros) CheckDeploymentConditions(ctx context.Context) error {\n\t// perform the sros specific kernel version check\n\terr := n.checkKernelVersion()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// check the sros component slot config for validaity\n\terr = n.checkComponentSlotsConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn n.DefaultNode.CheckDeploymentConditions(ctx)\n}\n\n// Func that creates the Dirs used for the kind SR-SIM and sets/merges the default Env vars.\nfunc (n *sros) createSROSFiles(ctx context.Context) error {\n\tlog.Debug(\"Creating directory structure for SR OS container\", \"node\", n.Cfg.ShortName)\n\n\tvar err error\n\n\tif n.Cfg.License != \"\" && (n.isCPM(\"\") || n.isStandaloneNode()) {\n\t\t// copy license file to node specific directory in lab\n\t\tlicPath := filepath.Join(n.Cfg.LabDir, \"license.key\")\n\t\tif err := clabutils.CopyFile(context.Background(), n.Cfg.License, licPath,\n\t\t\tclabconstants.PermissionsFileDefault); err != nil {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"license copying src %s -> dst %s failed: %v\",\n\t\t\t\tn.Cfg.License,\n\t\t\t\tlicPath,\n\t\t\t\terr,\n\t\t\t)\n\t\t}\n\t\tlog.Debug(\"SR OS license copied\", \"src\", n.Cfg.License, \"dst\", licPath)\n\t}\n\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),\n\t\tclabconstants.PermissionsOpen)\n\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], \"config\"),\n\t\tclabconstants.PermissionsOpen)\n\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf1),\n\t\tclabconstants.PermissionsOpen)\n\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf2),\n\t\tclabconstants.PermissionsOpen)\n\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),\n\t\tclabconstants.PermissionsOpen)\n\tif err := n.writeChassisInfoToLabDir(ctx); err != nil {\n\t\tlog.Debug(\"Didn't write chassis_info.json to lab dir. Docker version is likely too new.\",\n\t\t\t\"node\", n.Cfg.ShortName, \"path\", n.Cfg.LabDir, \"error\", err)\n\t}\n\tif n.isCPM(slotAName) || n.isStandaloneNode() {\n\t\terr = n.createSROSCertificates()\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Skip config if node is not CPM\n\tif n.isCPM(\"\") || n.isStandaloneNode() {\n\t\terr = n.createSROSConfigFiles()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// writeChassisInfoToLabDir fetches /opt/nokia/chassis_info.json from the node image\n// (via graph driver, same as srosVersionFromImage) and writes it under n.Cfg.LabDir\n// with the same filename (chassis_info.json).\nfunc (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {\n\timageInspect, err := n.Runtime.InspectImage(ctx, n.Cfg.Image)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"inspect image: %w\", err)\n\t}\n\tcontent, err := ReadFileFromImageInspect(imageInspect, DefaultChassisInfoPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdstPath := filepath.Join(n.Cfg.LabDir, filepath.Base(DefaultChassisInfoPath))\n\tlicensed := append([]byte(chassisInfoFileLicense), content...)\n\tif err := os.WriteFile(dstPath, licensed, clabconstants.PermissionsFileDefault); err != nil {\n\t\treturn fmt.Errorf(\"write %s: %w\", dstPath, err)\n\t}\n\tlog.Debug(\"Wrote chassis_info.json to lab dir\", \"node\", n.Cfg.ShortName, \"path\", dstPath)\n\tn.warnUnsupportedComponents(content)\n\treturn nil\n}\n\n// warnUnsupportedComponents validates the effective component configuration against the\n// chassis_info.json extracted from this exact image. Validation is advisory and never blocks\n// deploy.\nfunc (n *sros) warnUnsupportedComponents(content []byte) {\n\t// A distributed node validates once, from CPM A, to avoid duplicate warnings from CPM B.\n\tif !n.isStandaloneNode() && !n.isCPM(slotAName) {\n\t\treturn\n\t}\n\n\tinfo, err := parseChassisInfo(content)\n\tif err != nil {\n\t\tlog.Warn(\"Could not validate SR-SIM components against chassis_info.json\",\n\t\t\t\"node\", n.Cfg.ShortName, \"error\", err)\n\t\treturn\n\t}\n\n\tcomponents := n.rootComponents\n\tif len(components) == 0 {\n\t\tcomponents = n.kindSpecificCfg().Components\n\t}\n\n\teffective := n.componentsForConfig(components)\n\tif len(effective) == 0 {\n\t\t// Environment variables can configure integrated hardware without a components entry.\n\t\teffective = []*Component{n.componentForConfig(nil)}\n\t}\n\n\tnodeType := n.Cfg.NodeType\n\tif chassis := strings.TrimSpace(n.Cfg.Env[envNokiaSrosChassis]); chassis != \"\" {\n\t\tnodeType = chassis\n\t}\n\tfor _, warning := range info.componentWarnings(nodeType, n.componentSFM(), effective) {\n\t\tlog.Warn(\"SR-SIM component configuration may not be supported\",\n\t\t\t\"node\", n.Cfg.ShortName,\n\t\t\t\"chassis\", nodeType,\n\t\t\t\"warning\", warning)\n\t}\n}\n\n// Func that Places the Certificates in the right place and format.\nfunc (n *sros) createSROSCertificates() error {\n\tif *n.Cfg.Certificate.Issue {\n\t\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),\n\t\t\tclabconstants.PermissionsOpen)\n\t\tkeyPath := filepath.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3, tlsKeyFile)\n\t\tif err := clabutils.CreateFile(keyPath, n.Config().TLSKey); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tcertPath := filepath.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3, tlsCertFile)\n\t\terr := clabutils.CreateFile(certPath, n.Config().TLSCert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// SlotIsInteger checks if the slot string represents a valid integer.\nfunc SlotIsInteger(s string) bool {\n\t_, err := strconv.Atoi(s)\n\treturn err == nil\n}\n\n// Check if a container is a CPM.\n// isCPM checks if a container is a CPM (Control Processing Module).\n// Returns false if the slot is a linecard (integer slot).\n// If a specific CPM name is provided, returns false if this is a different CPM.\nfunc (n *sros) isCPM(cpm string) bool {\n\tslot, exists := n.Cfg.Env[envNokiaSrosSlot]\n\tif !exists {\n\t\t// No slot specified - this is a CPM\n\t\treturn true\n\t}\n\n\t// If slot is an integer, it's a linecard, not a CPM\n\tif SlotIsInteger(slot) {\n\t\treturn false\n\t}\n\n\t// Slot is non-integer (CPM slot). If a specific CPM was requested,\n\t// check if this is that CPM\n\tif cpm != \"\" && !strings.EqualFold(slot, cpm) {\n\t\treturn false\n\t}\n\n\treturn true\n}\n\nfunc (n *sros) GetContainers(ctx context.Context) ([]clabruntime.GenericContainer, error) {\n\t// if not a distributed setup call regular GetContainers\n\tif n.isStandaloneNode() || n.isDistributedCardNode() {\n\t\treturn n.DefaultNode.GetContainers(ctx)\n\t}\n\n\tcpmSlot, err := n.cpmSlot()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcontainerName := n.calcComponentName(n.GetContainerName(), cpmSlot)\n\n\tcnts, err := n.Runtime.ListContainers(ctx, []*clabtypes.GenericFilter{\n\t\t{\n\t\t\tFilterType: \"name\",\n\t\t\tMatch:      containerName,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// check that we retrieved some container information\n\t// otherwise throw ErrContainersNotFound error\n\tif len(cnts) == 0 {\n\t\t// check for the netns holder as to never orphan it.\n\t\tif n.netnsNode != nil {\n\t\t\treturn n.netnsNode.GetContainers(ctx)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"node: %s. %w\", n.GetContainerName(),\n\t\t\tclabnodes.ErrContainersNotFound)\n\t}\n\n\t// Forge the IP address to be the actual IP of mgmt\n\t// because the CPM A might not own the netns & mgmt IP\n\tif len(n.kindSpecificCfg().Components) > 0 {\n\t\tips, err := n.distNodeMgmtIPs()\n\t\tif err == nil {\n\t\t\tif ips.IPv4 != \"\" {\n\t\t\t\tcnts[0].NetworkSettings.IPv4addr = ips.IPv4\n\t\t\t\tcnts[0].NetworkSettings.IPv4pLen = ips.IPv4pLen\n\t\t\t}\n\t\t\tif ips.IPv6 != \"\" {\n\t\t\t\tcnts[0].NetworkSettings.IPv6addr = ips.IPv6\n\t\t\t\tcnts[0].NetworkSettings.IPv6pLen = ips.IPv6pLen\n\t\t\t}\n\t\t}\n\t}\n\n\treturn cnts, err\n}\n\n// populateHosts adds container hostnames for other nodes of a lab to SR Linux /etc/hosts file\n// to mitigate the fact that srlinux uses non default netns for management and thus\n// can't leverage docker DNS service.\nfunc (n *sros) populateHosts(ctx context.Context, nodes map[string]clabnodes.Node) error {\n\tcontainerName := n.Cfg.LongName\n\tif n.isDistributedBaseNode() && n.cpmContainerName != \"\" {\n\t\tcontainerName = n.cpmContainerName\n\t}\n\n\thosts, err := n.Runtime.GetHostsPath(ctx, containerName)\n\tif err != nil {\n\t\tlog.Warn(\"Unable to locate SR OS node /etc/hosts file\", \"node\", n.Cfg.ShortName, \"err\", err)\n\t\treturn err\n\t}\n\tvar entriesv4, entriesv6 bytes.Buffer\n\tconst (\n\t\tv4Prefix = \"###### CLAB-v4-START ######\"\n\t\tv4Suffix = \"###### CLAB-v4-END ######\"\n\t\tv6Prefix = \"###### CLAB-v6-START ######\"\n\t\tv6Suffix = \"###### CLAB-v6-END ######\"\n\t)\n\tfmt.Fprintf(&entriesv4, \"\\n%s\\n\", v4Prefix)\n\tfmt.Fprintf(&entriesv6, \"\\n%s\\n\", v6Prefix)\n\tfor node, params := range nodes {\n\t\tif v4 := params.Config().MgmtIPv4Address; v4 != \"\" {\n\t\t\tfmt.Fprintf(&entriesv4, \"%s\\t%s\\n\", v4, node)\n\t\t}\n\t\tif v6 := params.Config().MgmtIPv6Address; v6 != \"\" {\n\t\t\tfmt.Fprintf(&entriesv6, \"%s\\t%s\\n\", v6, node)\n\t\t}\n\t}\n\tfmt.Fprintf(&entriesv4, \"%s\\n\", v4Suffix)\n\tfmt.Fprintf(&entriesv6, \"%s\\n\", v6Suffix)\n\n\tfile, err := os.OpenFile(hosts, os.O_APPEND|os.O_WRONLY, 0o666) // skipcq: GSC-G302\n\tif err != nil {\n\t\tlog.Warn(\"Unable to open SR OS node /etc/hosts file\", \"node\", n.Cfg.ShortName, \"err\", err)\n\t\treturn err\n\t}\n\n\t_, err = file.Write(entriesv4.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = file.Write(entriesv6.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn file.Close()\n}\n\nfunc (n *sros) GetMappedInterfaceName(ifName string) (string, error) {\n\tcaptureGroups, err := clabutils.GetRegexpCaptureGroups(n.InterfaceRegexp, ifName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tindexGroups := []string{\"card\", \"xiom\", \"mda\", \"connector\", \"port\"}\n\tparsedIndices := make(map[string]int)\n\tfoundIndices := make(map[string]bool)\n\n\tfor _, indexKey := range indexGroups {\n\t\tif index, found := captureGroups[indexKey]; found && index != \"\" {\n\t\t\tfoundIndices[indexKey] = true\n\t\t\tparsedIndices[indexKey], err = strconv.Atoi(index)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", fmt.Errorf(\n\t\t\t\t\t\"%q parsed %s index %q could not be cast to an integer\",\n\t\t\t\t\tifName,\n\t\t\t\t\tindexKey,\n\t\t\t\t\tindex,\n\t\t\t\t)\n\t\t\t}\n\t\t\tif parsedIndices[indexKey] < 1 {\n\t\t\t\treturn \"\", fmt.Errorf(\n\t\t\t\t\t\"%q parsed %q index %q does not match requirement >= 1\",\n\t\t\t\t\tifName,\n\t\t\t\t\tindexKey,\n\t\t\t\t\tindex,\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\tfoundIndices[indexKey] = false\n\t\t}\n\t}\n\n\t// Card, MDA and port are present\n\tif foundIndices[\"card\"] && foundIndices[\"mda\"] && foundIndices[\"port\"] {\n\t\tswitch {\n\t\tcase foundIndices[\"xiom\"] && foundIndices[\"connector\"]:\n\t\t\t// XIOM and connector are present, format will be: e1-x2-3-c4-5 -> card 1, xiom 2, mda\n\t\t\t// 3, connector 4, port 5\n\t\t\treturn fmt.Sprintf(\n\t\t\t\t\"e%d-x%d-%d-c%d-%d\",\n\t\t\t\tparsedIndices[\"card\"],\n\t\t\t\tparsedIndices[\"xiom\"],\n\t\t\t\tparsedIndices[\"mda\"],\n\t\t\t\tparsedIndices[\"connector\"],\n\t\t\t\tparsedIndices[\"port\"],\n\t\t\t), nil\n\n\t\tcase foundIndices[\"xiom\"]:\n\t\t\t// Only XIOM present, format will be: e1-x2-3-4 -> card 1, xiom 2, mda 3, port 4\n\t\t\treturn fmt.Sprintf(\"e%d-x%d-%d-%d\", parsedIndices[\"card\"],\n\t\t\t\tparsedIndices[\"xiom\"], parsedIndices[\"mda\"], parsedIndices[\"port\"]), nil\n\t\tcase foundIndices[\"connector\"]:\n\t\t\t// Only connector present, format will be: e1-2-c3-4 -> card 1, mda 2, connector 3, port\n\t\t\t// 4\n\t\t\treturn fmt.Sprintf(\"e%d-%d-c%d-%d\", parsedIndices[\"card\"],\n\t\t\t\tparsedIndices[\"mda\"], parsedIndices[\"connector\"], parsedIndices[\"port\"]), nil\n\t\tdefault:\n\t\t\t// No XIOM or connector present, format will be: e1-2-3 -> card 1, mda 2, port 3\n\t\t\treturn fmt.Sprintf(\"e%d-%d-%d\", parsedIndices[\"card\"],\n\t\t\t\tparsedIndices[\"mda\"], parsedIndices[\"port\"]), nil\n\t\t}\n\t} else {\n\t\treturn \"\", fmt.Errorf(\"%q missing card, mda or port index\", ifName)\n\t}\n}\n\n// CheckInterfaceName checks if a name of the interface referenced in the topology file correct.\nfunc (n *sros) CheckInterfaceName() error {\n\tnm := n.Cfg.NetworkMode\n\n\terr := n.CheckInterfaceOverlap()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, e := range n.Endpoints {\n\t\tif !MappedInterfaceRegexp.MatchString(e.GetIfaceName()) {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"nokia SR OS interface name %q doesn't match the required pattern: %s\",\n\t\t\t\te.GetIfaceName(),\n\t\t\t\tn.InterfaceHelp,\n\t\t\t)\n\t\t}\n\n\t\tif e.GetIfaceName() == \"eth0\" && nm != \"none\" {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"eth0 interface name is not allowed for %s node when network mode is not set to none\",\n\t\t\t\tn.Cfg.ShortName,\n\t\t\t)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (n *sros) SaveConfig(ctx context.Context) (*clabnodes.SaveConfigResult, error) {\n\tfqdn := \"\"\n\tswitch {\n\tcase n.isStandaloneNode():\n\t\t// check if it is a cpm node. return without error if not\n\t\tif !n.isCPM(\"\") {\n\t\t\treturn nil, nil\n\t\t}\n\t\t// if it is a standalone node use the fqdn\n\t\tfqdn = n.Cfg.Fqdn\n\tcase n.isDistributedBaseNode():\n\t\t// if it is the\n\t\tcmpNode, err := n.cpmNode()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// delegate to cpm node\n\t\treturn cmpNode.SaveConfig(ctx)\n\tcase n.isDistributedCardNode():\n\t\t// check if it is a cpm node. return without error if not\n\t\tif !n.isCPM(\"\") {\n\t\t\treturn nil, nil\n\t\t}\n\t\tfqdn = n.Cfg.LongName\n\t}\n\n\tif err := n.saveConfigWithAddr(ctx, fqdn); err != nil {\n\t\treturn nil, err\n\t}\n\n\tcfgPath := filepath.Join(\n\t\tn.Cfg.LabDir,\n\t\tn.Cfg.Env[envNokiaSrosSlot],\n\t\tconfigCf3,\n\t\tstartupCfgName,\n\t)\n\n\treturn &clabnodes.SaveConfigResult{\n\t\tConfigPath: cfgPath,\n\t}, nil\n}\n\n// saveConfigWithAddr will use the addr string to try to save the config of the node.\nfunc (n *sros) saveConfigWithAddr(ctx context.Context, addr string) error {\n\tif n.isConfigClassic() {\n\t\tcmd := []string{\"/admin save\", \"/bof persist on\", \"/bof save\"}\n\t\treturn n.srosSendCommandsSSH(ctx, scrapliPlatformNameClassic, cmd)\n\t}\n\terr := clabnetconf.SaveRunningConfig(fmt.Sprintf(\"[%s]\", addr),\n\t\tn.Cfg.Credentials.Username,\n\t\tn.Cfg.Credentials.Password,\n\t\tscrapliPlatformName,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Info(\n\t\t\"Saved running configuration\",\n\t\t\"node\",\n\t\tn.Cfg.ShortName,\n\t\t\"addr\",\n\t\taddr,\n\t\t\"config-mode\",\n\t\tn.kindSpecificCfg().ConfigMode,\n\t)\n\n\treturn nil\n}\n\n// TLS bootstrap via NETCONF to enable secure gRPC.\nfunc (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {\n\t// Always import PKI key and cert:\n\t// \t import \"cf3:\\node.key\" in PEM format as \"cf3:\\system-pki\\node.key\" (encrypted DER)\n\t//   import \"cf3:\\node.crt\" in PEM format as \"cf3:\\system-pki\\node.crt\" (encrypted DER)\n\toperations := []clabnetconf.Operation{\n\t\tfunc(d *netconf.Driver) (*response.NetconfResponse, error) {\n\t\t\treturn d.RPC(opoptions.WithFilter(buildPKIImportXML(\n\t\t\t\tfmt.Sprintf(\"cf3:/%s\", tlsKeyFile), tlsKeyFile, \"key\")))\n\t\t},\n\t\tfunc(d *netconf.Driver) (*response.NetconfResponse, error) {\n\t\t\treturn d.RPC(opoptions.WithFilter(buildPKIImportXML(\n\t\t\t\tfmt.Sprintf(\"cf3:/%s\", tlsCertFile), tlsCertFile, \"certificate\")))\n\t\t},\n\t}\n\n\t// Activate cert-profile in MD is via NETCONF, in Classic mode is via SSH\n\t//  enable enables cert-profile \"clab-grpc-certs\" administratively\n\tcmd := []string{}\n\tif n.isConfigClassic() {\n\t\tcmd = append(\n\t\t\tcmd,\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"/configure system security tls cert-profile %s no shutdown\",\n\t\t\t\ttlsCertProfileName,\n\t\t\t),\n\t\t)\n\t} else {\n\t\toperations = append(operations,\n\t\t\tfunc(d *netconf.Driver) (*response.NetconfResponse, error) {\n\t\t\t\treturn d.EditConfig(\"candidate\", buildTLSProfileXML())\n\t\t\t},\n\t\t\tfunc(d *netconf.Driver) (*response.NetconfResponse, error) {\n\t\t\t\treturn d.Commit()\n\t\t\t},\n\t\t)\n\t}\n\n\terr := clabnetconf.MultiExec(\n\t\tfmt.Sprintf(\"[%s]\", addr),\n\t\tn.Cfg.Credentials.Username,\n\t\tn.Cfg.Credentials.Password,\n\t\toperations,\n\t)\n\tif len(cmd) > 0 && n.isConfigClassic() {\n\t\terr := n.srosSendCommandsSSH(ctx, scrapliPlatformNameClassic, cmd)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}\n\nfunc (n *sros) IsHealthy(_ context.Context) (bool, error) {\n\tif !n.isCPM(\"\") {\n\t\treturn true, fmt.Errorf(\"node %q is not a CPM, healthcheck has no effect\", n.Cfg.LongName)\n\t}\n\t// non-partial user startup config might not have any netconf config\n\t// so we shouldn't check for this.\n\tif isFullConfigFile(n.Cfg.StartupConfig) {\n\t\tlog.Debug(\n\t\t\t\"node has full startup config, skipping NETCONF check\",\n\t\t\t\"kind\",\n\t\t\tn.Cfg.Kind,\n\t\t\t\"node\",\n\t\t\tn.Cfg.ShortName,\n\t\t)\n\t\treturn true, nil\n\t}\n\taddr, err := n.MgmtIPAddr()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tlog.Debug(\n\t\t\"Checking netconf connection\",\n\t\t\"node\",\n\t\tn.Cfg.LongName,\n\t\t\"addr\",\n\t\tfmt.Sprintf(\"%q:830\", addr),\n\t)\n\treturn CheckPortWithRetry(addr, 830, readyTimeout, int(readyTimeout/retryTimer), retryTimer)\n}\n\n// CheckPortWithRetry checks if a port is open with retry logic.\nfunc CheckPortWithRetry(\n\thost string,\n\tport int,\n\ttimeout time.Duration,\n\tmaxRetries int,\n\tretryDelay time.Duration,\n) (bool, error) {\n\tvar lastErr error\n\taddress := net.JoinHostPort(host, fmt.Sprintf(\"%d\", port))\n\tdeadline := time.Now().Add(timeout)\n\n\tfor i := range maxRetries {\n\t\tif i > 0 {\n\t\t\tif remaining := time.Until(deadline); remaining <= 0 {\n\t\t\t\tbreak\n\t\t\t} else if retryDelay < remaining {\n\t\t\t\ttime.Sleep(retryDelay)\n\t\t\t} else {\n\t\t\t\ttime.Sleep(remaining)\n\t\t\t}\n\t\t}\n\n\t\tremaining := time.Until(deadline)\n\t\tif remaining <= 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tdialTimeout := tcpDialTimeout\n\t\tif remaining < dialTimeout {\n\t\t\tdialTimeout = remaining\n\t\t}\n\n\t\tconn, err := net.DialTimeout(\"tcp\", address, dialTimeout)\n\t\tif err == nil {\n\t\t\tconn.Close()\n\t\t\treturn true, nil\n\t\t}\n\t\tlastErr = err\n\t}\n\n\tif lastErr == nil {\n\t\tlastErr = fmt.Errorf(\"timed out checking tcp port %s\", address)\n\t}\n\n\treturn false, lastErr\n}\n\n// MgmtIP represents the management IPv4/v6 addresses of a node.\ntype MgmtIP struct {\n\tIPv4        string\n\tIPv4pLen    int\n\tIPv4Gw      string\n\tIPv6        string\n\tIPv6pLen    int\n\tIPv6Gw      string\n\tContainerID string\n}\n\n// distNodeMgmtIPs returns both ipv4 and ipv6 management IP address of a\n// distributed node defined via components.\n// It returns an error if neither is set in the node config.\nfunc (n *sros) distNodeMgmtIPs() (MgmtIP, error) {\n\tips := MgmtIP{}\n\n\tvar containerName string\n\tif n.isDistributedBaseNode() {\n\t\tif n.netnsNode != nil {\n\t\t\tcontainerName = n.netnsNode.Config().LongName\n\t\t}\n\t} else {\n\t\tcontainerName = n.rootCtrName\n\t}\n\n\tif containerName == \"\" {\n\t\treturn ips, nil\n\t}\n\n\tcontainers, err := n.Runtime.ListContainers(\n\t\tcontext.Background(),\n\t\t[]*clabtypes.GenericFilter{\n\t\t\t{\n\t\t\t\tFilterType: \"name\",\n\t\t\t\tMatch:      containerName,\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn MgmtIP{}, fmt.Errorf(\"unable to get container %q: %v\", containerName, err)\n\t}\n\n\tfor _, container := range containers {\n\t\tif container.NetworkSettings.IPv4addr != \"\" {\n\t\t\tips.IPv4 = container.NetworkSettings.IPv4addr\n\t\t\tips.IPv4pLen = container.NetworkSettings.IPv4pLen\n\t\t\tips.IPv4Gw = container.NetworkSettings.IPv4Gw\n\t\t\tips.ContainerID = container.ID\n\t\t}\n\t\tif container.NetworkSettings.IPv6addr != \"\" {\n\t\t\tips.IPv6 = container.NetworkSettings.IPv6addr\n\t\t\tips.IPv6pLen = container.NetworkSettings.IPv6pLen\n\t\t\tips.IPv6Gw = container.NetworkSettings.IPv6Gw\n\t\t\tips.ContainerID = container.ID\n\t\t}\n\t}\n\n\treturn ips, nil\n}\n\n// custom override for hosts file entry to write basename when using component nodes.\nfunc (n *sros) GetHostsEntries(ctx context.Context) (clabtypes.HostEntries, error) {\n\tresult, err := n.DefaultNode.GetHostsEntries(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif n.isDistributedBaseNode() {\n\t\tips, err := n.distNodeMgmtIPs()\n\t\tif err != nil {\n\t\t\treturn clabtypes.HostEntries{}, err\n\t\t}\n\n\t\tif ips.IPv4 != \"\" { // v4\n\t\t\tresult = append(result, clabtypes.NewHostEntry(\n\t\t\t\tips.IPv4,\n\t\t\t\tn.Cfg.LongName,\n\t\t\t\tclabtypes.IpVersionV4,\n\t\t\t).SetDescription(fmt.Sprintf(\"Kind: %s\", n.Cfg.Kind)).SetContainerID(ips.ContainerID))\n\t\t}\n\n\t\tif ips.IPv6 != \"\" {\n\t\t\tresult = append(result, clabtypes.NewHostEntry(\n\t\t\t\tips.IPv6,\n\t\t\t\tn.Cfg.LongName,\n\t\t\t\tclabtypes.IpVersionV6,\n\t\t\t).SetDescription(fmt.Sprintf(\"Kind: %s\", n.Cfg.Kind)).SetContainerID(ips.ContainerID))\n\t\t}\n\t}\n\n\treturn result, nil\n}\n\n// MgmtIPAddr returns ipv4 or ipv6 management IP address of the node.\n// It returns an error if neither is set in the node config.\nfunc (n *sros) MgmtIPAddr() (string, error) {\n\tswitch {\n\tcase n.Cfg.MgmtIPv6Address != \"\":\n\t\treturn n.Cfg.MgmtIPv6Address, nil\n\tcase n.Cfg.MgmtIPv4Address != \"\":\n\t\treturn n.Cfg.MgmtIPv4Address, nil\n\t}\n\n\tif !n.isStandaloneNode() {\n\t\tips, err := n.distNodeMgmtIPs()\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tswitch {\n\t\tcase ips.IPv6 != \"\":\n\t\t\treturn ips.IPv6, nil\n\t\tcase ips.IPv4 != \"\":\n\t\t\treturn ips.IPv4, nil\n\t\t}\n\t}\n\n\treturn n.Cfg.LongName, fmt.Errorf(\n\t\t\"no management IP address (IPv4 or IPv6) configured for node %q\",\n\t\tn.Cfg.LongName,\n\t)\n}\n\n// override to fetch CPM to avoid renaming the base node to CPM A.\nfunc (n *sros) GetContainerName() string {\n\tif n.isDistributedBaseNode() && n.cpmContainerName != \"\" {\n\t\treturn n.cpmContainerName\n\t}\n\treturn n.DefaultNode.GetContainerName()\n}\n\n// MonitorLogs monitors log output from the provided reader during the PostDeploy phase of SRSIM.\n// It scans each line for SR OS error messages (minor or critical) and logs them as warnings\n// The method checks for context cancellation on each line and returns immediately if the\n// context is cancelled.\n// Parameters:\n//   - ctx: context for cancellation; if cancelled, the method returns.\n//   - reader: io.ReadCloser providing log lines to scan.",
        "lineStart": 1,
        "lineEnd": 1699,
        "totalLines": 1700,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346580422,
      "end": 1792346580432
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502e65d5001dlToAawF96kWAN",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e5f42001e10roJstImV7H5",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 21676,
    "input": 921,
    "output": 18,
    "reasoning": 1,
    "cache": {
      "read": 20736,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502e5f42001e10roJstImV7H5",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346578754,
    "completed": 1792346580441
  },
  "parentID": "msg_1502e41aa001XEn2l1GdfLHjHR",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 21676,
    "input": 921,
    "output": 18,
    "reasoning": 1,
    "cache": {
      "read": 20736,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 15
step-start
{
  "type": "step-start",
  "id": "prt_1502e73d6001CQBgPyiwAzJNYr",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e65e1001OgTBP5VcFf5FbI"
}
Reasoning
Let me continue reading sros.go from line 1700, then template.go, variant.go, chassis_info_test.go, sros_test.go, schema, docs, README.
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/sros.go",
  "offset": 1700
}

Output

<path>/source/head/nodes/sros/sros.go</path>
<type>file</type>
<content>
1700: //   - exitChan: channel which will signal an error for postdeploy to skip.
1701: //
1702: // The method returns when the context is cancelled, when the reader is exhausted or if
1703: // it detects that SR OS rejected the config as per the const srosRejectedCfgMsg.
1704: func (n *sros) MonitorLogs(ctx context.Context, reader io.ReadCloser, exitChan chan<- error) {
1705: 	scanner := bufio.NewScanner(reader)
1706: 	for scanner.Scan() {
1707: 		line := scanner.Text()
1708: 		line = clabutils.StripNonPrintChars(line)
1709: 
1710: 		if strings.Contains(line, srosMinorError) ||
1711: 			strings.Contains(line, srosCriticalError) {
1712: 			log.Warn(
1713: 				"Got SR OS log message",
1714: 				"node",
1715: 				n.Cfg.ShortName,
1716: 				"message",
1717: 				line+"\n",
1718: 			)
1719: 		}
1720: 
1721: 		if strings.Contains(line, srosRejectedCfgMsg) {
1722: 			exitChan <- errors.New("configuration rejected by SR OS")
1723: 			return
1724: 		}
1725: 
1726: 		select {
1727: 		case <-ctx.Done():
1728: 			return
1729: 		default:
1730: 		}
1731: 	}
1732: }
1733: 
1734: // verifyNokiaSrosImage ensures the image used with kind nokia_srsim has the correct labels
1735: // It inspects the image label
1736: // org.opencontainers.image.title and returns an error if it is not "srsim".
1737: func (n *sros) verifyNokiaSrsimImage(ctx context.Context) error {
1738: 	if n.GetRuntime() == nil {
1739: 		return nil
1740: 	}
1741: 	insp, err := n.GetRuntime().InspectImage(ctx, n.Cfg.Image)
1742: 	if err != nil {
1743: 		// Skip check when runtime does not support image inspection (e.g. Podman).
1744: 		if strings.Contains(err.Error(), "not implemented") {
1745: 			log.Debug(
1746: 				"Skipping nokia_srsim image kind check: runtime does not support image inspection",
1747: 			)
1748: 			return nil
1749: 		}
1750: 		return err
1751: 	}
1752: 	if insp != nil && insp.Config.Labels != nil {
1753: 		if _, hasVrnetlab := insp.Config.Labels[vrnetlabVersionLabel]; hasVrnetlab {
1754: 			return fmt.Errorf(
1755: 				"node %q: kind is nokia_srsim but the image is a vrnetlab image; use kind: nokia_sros with this image, or use the SR-SIM container image for kind: nokia_srsim",
1756: 				n.Cfg.ShortName,
1757: 			)
1758: 		}
1759: 		if title, ok := insp.Config.Labels[srosImageTitleLabel]; ok && title == srosImageTitle {
1760: 			return nil
1761: 		}
1762: 	}
1763: 	log.Warnf(
1764: 		"node %q: kind is nokia_srsim but the provided image does not have the correct labels; please use a valid SR-SIM container image or run a more recent version of the SR-SIM container image to suppress this warning",
1765: 		n.Cfg.ShortName,
1766: 	)
1767: 	return nil
1768: }
1769: 
1770: func (n *sros) GetContainerStatus(ctx context.Context) clabruntime.ContainerStatus {
1771: 	if n.isStandaloneNode() || n.isDistributedCardNode() {
1772: 		return n.DefaultNode.GetContainerStatus(ctx)
1773: 	}
1774: 
1775: 	var (
1776: 		hasRunning    bool
1777: 		hasPaused     bool
1778: 		hasRestarting bool
1779: 		hasCreated    bool
1780: 		hasStopped    bool
1781: 		hasRemoving   bool
1782: 	)
1783: 
1784: 	for _, componentNode := range n.componentNodes {
1785: 		switch componentNode.GetContainerStatus(ctx) {
1786: 		case clabruntime.Running:
1787: 			hasRunning = true
1788: 		case clabruntime.Paused:
1789: 			hasPaused = true
1790: 		case clabruntime.Restarting:
1791: 			hasRestarting = true
1792: 		case clabruntime.Created:
1793: 			hasCreated = true
1794: 		case clabruntime.Stopped:
1795: 			hasStopped = true
1796: 		case clabruntime.Removing:
1797: 			hasRemoving = true
1798: 		}
1799: 	}
1800: 
1801: 	switch {
1802: 	case hasRunning:
1803: 		return clabruntime.Running
1804: 	case hasPaused:
1805: 		return clabruntime.Paused
1806: 	case hasRestarting:
1807: 		return clabruntime.Restarting
1808: 	case hasCreated:
1809: 		return clabruntime.Created
1810: 	case hasStopped:
1811: 		return clabruntime.Stopped
1812: 	case hasRemoving:
1813: 		return clabruntime.Removing
1814: 	default:
1815: 		return clabruntime.NotFound
1816: 	}
1817: }
1818: 
1819: func (n *sros) Start(ctx context.Context) error {
1820: 	if n.isStandaloneNode() || n.isDistributedCardNode() {
1821: 		if err := n.DefaultNode.Start(ctx); err != nil {
1822: 			return err
1823: 		}
1824: 		return n.PostDeployEndpoints(ctx)
1825: 	}
1826: 
1827: 	if err := n.ensureNetnsRunning(ctx); err != nil {
1828: 		return err
1829: 	}
1830: 
1831: 	for _, c := range n.componentNodes {
1832: 		if _, err := n.Runtime.StartContainer(ctx, c.Config().LongName, c); err != nil {
1833: 			return fmt.Errorf("node %q component %q start error: %w",
1834: 				n.Cfg.ShortName, c.Config().ShortName, err)
1835: 		}
1836: 	}
1837: 
1838: 	if err := n.RestoreEndpoints(ctx); err != nil {
1839: 		return err
1840: 	}
1841: 	return n.PostDeployEndpoints(ctx)
1842: }
1843: 
1844: func (n *sros) Stop(ctx context.Context) error {
1845: 	if n.isStandaloneNode() || n.isDistributedCardNode() {
1846: 		return n.DefaultNode.Stop(ctx)
1847: 	}
1848: 
1849: 	if n.GetContainerStatus(ctx) == clabruntime.Stopped {
1850: 		return nil
1851: 	}
1852: 	if err := n.ParkEndpoints(ctx); err != nil {
1853: 		return err
1854: 	}
1855: 
1856: 	for _, c := range n.componentNodes {
1857: 		if err := n.Runtime.StopContainer(ctx, c.Config().LongName, n.StopSignal); err != nil {
1858: 			log.Warnf("node %q component %q stop error: %v",
1859: 				n.Cfg.ShortName, c.Config().ShortName, err)
1860: 		}
1861: 	}
1862: 
1863: 	return nil
1864: }
1865: 
1866: // ComputeDiff extends the default diff by ignoring component order and slot case, so that only
1867: // a change to the set of components marks the kind-specific config as changed.
1868: func (n *sros) ComputeDiff(oldCfg, newCfg *clabtypes.NodeConfig) *clabtypes.TopologyDiff {
1869: 	diff := n.DefaultNode.ComputeDiff(oldCfg, newCfg)
1870: 
1871: 	if oldCfg == nil || newCfg == nil {
1872: 		return diff
1873: 	}
1874: 
1875: 	oldKC, oldOK := oldCfg.KindSpecificConfig.(*KindSpecificConfig)
1876: 	newKC, newOK := newCfg.KindSpecificConfig.(*KindSpecificConfig)
1877: 
1878: 	if oldOK && newOK && oldKC.equalIgnoringComponentOrder(newKC) {
1879: 		diff.Fields = slices.DeleteFunc(
1880: 			diff.Fields,
1881: 			func(f string) bool { return f == "KindSpecificConfig" },
1882: 		)
1883: 	}
1884: 
1885: 	return diff
1886: }
1887: 
1888: // DefaultLinkType returns the default link type for an SR-SIM node
1889: // when the brief notation of a link definition is used.
1890: // It returns veth-stitch for SR-SIM nodes to support pcap and netem features,
1891: // see https://github.com/srl-labs/containerlab/pull/3270.
1892: func (*sros) DefaultLinkType() clablinks.LinkType {
1893: 	return clablinks.LinkTypeVethStitch
1894: }
1895: 
1896: // RestoreEndpoints retains normal lifecycle parking while restoring the logical
1897: // node's symlink as well as the component symlinks created by the runtime.
1898: func (n *sros) RestoreEndpoints(ctx context.Context) error {
1899: 	if err := n.DefaultNode.RestoreEndpoints(ctx); err != nil {
1900: 		return err
1901: 	}
1902: 	if !n.isDistributedBaseNode() {
1903: 		return nil
1904: 	}
1905: 	nsPath, err := n.GetNSPath(ctx)
1906: 	if err != nil {
1907: 		return err
1908: 	}
1909: 	return clabutils.LinkContainerNS(nsPath, n.Cfg.LongName)
1910: }

(End of file - total 1910 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502e7484001vjjWTDkIBnbRqu",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e65e1001OgTBP5VcFf5FbI",
  "callID": "call_95e348508dbb40e4b35b332e",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/sros.go",
      "offset": 1700
    },
    "output": "<path>/source/head/nodes/sros/sros.go</path>\n<type>file</type>\n<content>\n1700: //   - exitChan: channel which will signal an error for postdeploy to skip.\n1701: //\n1702: // The method returns when the context is cancelled, when the reader is exhausted or if\n1703: // it detects that SR OS rejected the config as per the const srosRejectedCfgMsg.\n1704: func (n *sros) MonitorLogs(ctx context.Context, reader io.ReadCloser, exitChan chan<- error) {\n1705: \tscanner := bufio.NewScanner(reader)\n1706: \tfor scanner.Scan() {\n1707: \t\tline := scanner.Text()\n1708: \t\tline = clabutils.StripNonPrintChars(line)\n1709: \n1710: \t\tif strings.Contains(line, srosMinorError) ||\n1711: \t\t\tstrings.Contains(line, srosCriticalError) {\n1712: \t\t\tlog.Warn(\n1713: \t\t\t\t\"Got SR OS log message\",\n1714: \t\t\t\t\"node\",\n1715: \t\t\t\tn.Cfg.ShortName,\n1716: \t\t\t\t\"message\",\n1717: \t\t\t\tline+\"\\n\",\n1718: \t\t\t)\n1719: \t\t}\n1720: \n1721: \t\tif strings.Contains(line, srosRejectedCfgMsg) {\n1722: \t\t\texitChan <- errors.New(\"configuration rejected by SR OS\")\n1723: \t\t\treturn\n1724: \t\t}\n1725: \n1726: \t\tselect {\n1727: \t\tcase <-ctx.Done():\n1728: \t\t\treturn\n1729: \t\tdefault:\n1730: \t\t}\n1731: \t}\n1732: }\n1733: \n1734: // verifyNokiaSrosImage ensures the image used with kind nokia_srsim has the correct labels\n1735: // It inspects the image label\n1736: // org.opencontainers.image.title and returns an error if it is not \"srsim\".\n1737: func (n *sros) verifyNokiaSrsimImage(ctx context.Context) error {\n1738: \tif n.GetRuntime() == nil {\n1739: \t\treturn nil\n1740: \t}\n1741: \tinsp, err := n.GetRuntime().InspectImage(ctx, n.Cfg.Image)\n1742: \tif err != nil {\n1743: \t\t// Skip check when runtime does not support image inspection (e.g. Podman).\n1744: \t\tif strings.Contains(err.Error(), \"not implemented\") {\n1745: \t\t\tlog.Debug(\n1746: \t\t\t\t\"Skipping nokia_srsim image kind check: runtime does not support image inspection\",\n1747: \t\t\t)\n1748: \t\t\treturn nil\n1749: \t\t}\n1750: \t\treturn err\n1751: \t}\n1752: \tif insp != nil && insp.Config.Labels != nil {\n1753: \t\tif _, hasVrnetlab := insp.Config.Labels[vrnetlabVersionLabel]; hasVrnetlab {\n1754: \t\t\treturn fmt.Errorf(\n1755: \t\t\t\t\"node %q: kind is nokia_srsim but the image is a vrnetlab image; use kind: nokia_sros with this image, or use the SR-SIM container image for kind: nokia_srsim\",\n1756: \t\t\t\tn.Cfg.ShortName,\n1757: \t\t\t)\n1758: \t\t}\n1759: \t\tif title, ok := insp.Config.Labels[srosImageTitleLabel]; ok && title == srosImageTitle {\n1760: \t\t\treturn nil\n1761: \t\t}\n1762: \t}\n1763: \tlog.Warnf(\n1764: \t\t\"node %q: kind is nokia_srsim but the provided image does not have the correct labels; please use a valid SR-SIM container image or run a more recent version of the SR-SIM container image to suppress this warning\",\n1765: \t\tn.Cfg.ShortName,\n1766: \t)\n1767: \treturn nil\n1768: }\n1769: \n1770: func (n *sros) GetContainerStatus(ctx context.Context) clabruntime.ContainerStatus {\n1771: \tif n.isStandaloneNode() || n.isDistributedCardNode() {\n1772: \t\treturn n.DefaultNode.GetContainerStatus(ctx)\n1773: \t}\n1774: \n1775: \tvar (\n1776: \t\thasRunning    bool\n1777: \t\thasPaused     bool\n1778: \t\thasRestarting bool\n1779: \t\thasCreated    bool\n1780: \t\thasStopped    bool\n1781: \t\thasRemoving   bool\n1782: \t)\n1783: \n1784: \tfor _, componentNode := range n.componentNodes {\n1785: \t\tswitch componentNode.GetContainerStatus(ctx) {\n1786: \t\tcase clabruntime.Running:\n1787: \t\t\thasRunning = true\n1788: \t\tcase clabruntime.Paused:\n1789: \t\t\thasPaused = true\n1790: \t\tcase clabruntime.Restarting:\n1791: \t\t\thasRestarting = true\n1792: \t\tcase clabruntime.Created:\n1793: \t\t\thasCreated = true\n1794: \t\tcase clabruntime.Stopped:\n1795: \t\t\thasStopped = true\n1796: \t\tcase clabruntime.Removing:\n1797: \t\t\thasRemoving = true\n1798: \t\t}\n1799: \t}\n1800: \n1801: \tswitch {\n1802: \tcase hasRunning:\n1803: \t\treturn clabruntime.Running\n1804: \tcase hasPaused:\n1805: \t\treturn clabruntime.Paused\n1806: \tcase hasRestarting:\n1807: \t\treturn clabruntime.Restarting\n1808: \tcase hasCreated:\n1809: \t\treturn clabruntime.Created\n1810: \tcase hasStopped:\n1811: \t\treturn clabruntime.Stopped\n1812: \tcase hasRemoving:\n1813: \t\treturn clabruntime.Removing\n1814: \tdefault:\n1815: \t\treturn clabruntime.NotFound\n1816: \t}\n1817: }\n1818: \n1819: func (n *sros) Start(ctx context.Context) error {\n1820: \tif n.isStandaloneNode() || n.isDistributedCardNode() {\n1821: \t\tif err := n.DefaultNode.Start(ctx); err != nil {\n1822: \t\t\treturn err\n1823: \t\t}\n1824: \t\treturn n.PostDeployEndpoints(ctx)\n1825: \t}\n1826: \n1827: \tif err := n.ensureNetnsRunning(ctx); err != nil {\n1828: \t\treturn err\n1829: \t}\n1830: \n1831: \tfor _, c := range n.componentNodes {\n1832: \t\tif _, err := n.Runtime.StartContainer(ctx, c.Config().LongName, c); err != nil {\n1833: \t\t\treturn fmt.Errorf(\"node %q component %q start error: %w\",\n1834: \t\t\t\tn.Cfg.ShortName, c.Config().ShortName, err)\n1835: \t\t}\n1836: \t}\n1837: \n1838: \tif err := n.RestoreEndpoints(ctx); err != nil {\n1839: \t\treturn err\n1840: \t}\n1841: \treturn n.PostDeployEndpoints(ctx)\n1842: }\n1843: \n1844: func (n *sros) Stop(ctx context.Context) error {\n1845: \tif n.isStandaloneNode() || n.isDistributedCardNode() {\n1846: \t\treturn n.DefaultNode.Stop(ctx)\n1847: \t}\n1848: \n1849: \tif n.GetContainerStatus(ctx) == clabruntime.Stopped {\n1850: \t\treturn nil\n1851: \t}\n1852: \tif err := n.ParkEndpoints(ctx); err != nil {\n1853: \t\treturn err\n1854: \t}\n1855: \n1856: \tfor _, c := range n.componentNodes {\n1857: \t\tif err := n.Runtime.StopContainer(ctx, c.Config().LongName, n.StopSignal); err != nil {\n1858: \t\t\tlog.Warnf(\"node %q component %q stop error: %v\",\n1859: \t\t\t\tn.Cfg.ShortName, c.Config().ShortName, err)\n1860: \t\t}\n1861: \t}\n1862: \n1863: \treturn nil\n1864: }\n1865: \n1866: // ComputeDiff extends the default diff by ignoring component order and slot case, so that only\n1867: // a change to the set of components marks the kind-specific config as changed.\n1868: func (n *sros) ComputeDiff(oldCfg, newCfg *clabtypes.NodeConfig) *clabtypes.TopologyDiff {\n1869: \tdiff := n.DefaultNode.ComputeDiff(oldCfg, newCfg)\n1870: \n1871: \tif oldCfg == nil || newCfg == nil {\n1872: \t\treturn diff\n1873: \t}\n1874: \n1875: \toldKC, oldOK := oldCfg.KindSpecificConfig.(*KindSpecificConfig)\n1876: \tnewKC, newOK := newCfg.KindSpecificConfig.(*KindSpecificConfig)\n1877: \n1878: \tif oldOK && newOK && oldKC.equalIgnoringComponentOrder(newKC) {\n1879: \t\tdiff.Fields = slices.DeleteFunc(\n1880: \t\t\tdiff.Fields,\n1881: \t\t\tfunc(f string) bool { return f == \"KindSpecificConfig\" },\n1882: \t\t)\n1883: \t}\n1884: \n1885: \treturn diff\n1886: }\n1887: \n1888: // DefaultLinkType returns the default link type for an SR-SIM node\n1889: // when the brief notation of a link definition is used.\n1890: // It returns veth-stitch for SR-SIM nodes to support pcap and netem features,\n1891: // see https://github.com/srl-labs/containerlab/pull/3270.\n1892: func (*sros) DefaultLinkType() clablinks.LinkType {\n1893: \treturn clablinks.LinkTypeVethStitch\n1894: }\n1895: \n1896: // RestoreEndpoints retains normal lifecycle parking while restoring the logical\n1897: // node's symlink as well as the component symlinks created by the runtime.\n1898: func (n *sros) RestoreEndpoints(ctx context.Context) error {\n1899: \tif err := n.DefaultNode.RestoreEndpoints(ctx); err != nil {\n1900: \t\treturn err\n1901: \t}\n1902: \tif !n.isDistributedBaseNode() {\n1903: \t\treturn nil\n1904: \t}\n1905: \tnsPath, err := n.GetNSPath(ctx)\n1906: \tif err != nil {\n1907: \t\treturn err\n1908: \t}\n1909: \treturn clabutils.LinkContainerNS(nsPath, n.Cfg.LongName)\n1910: }\n\n(End of file - total 1910 lines)\n</content>",
    "title": "source/head/nodes/sros/sros.go",
    "metadata": {
      "preview": "//   - exitChan: channel which will signal an error for postdeploy to skip.\n//\n// The method returns when the context is cancelled, when the reader is exhausted or if\n// it detects that SR OS rejected the config as per the const srosRejectedCfgMsg.\nfunc (n *sros) MonitorLogs(ctx context.Context, reader io.ReadCloser, exitChan chan<- error) {\n\tscanner := bufio.NewScanner(reader)\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tline = clabutils.StripNonPrintChars(line)\n\n\t\tif strings.Contains(line, srosMinorError) ||\n\t\t\tstrings.Contains(line, srosCriticalError) {\n\t\t\tlog.Warn(\n\t\t\t\t\"Got SR OS log message\",\n\t\t\t\t\"node\",\n\t\t\t\tn.Cfg.ShortName,\n\t\t\t\t\"message\",\n\t\t\t\tline+\"\\n\",\n\t\t\t)\n\t\t}",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/sros.go",
        "text": "//   - exitChan: channel which will signal an error for postdeploy to skip.\n//\n// The method returns when the context is cancelled, when the reader is exhausted or if\n// it detects that SR OS rejected the config as per the const srosRejectedCfgMsg.\nfunc (n *sros) MonitorLogs(ctx context.Context, reader io.ReadCloser, exitChan chan<- error) {\n\tscanner := bufio.NewScanner(reader)\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tline = clabutils.StripNonPrintChars(line)\n\n\t\tif strings.Contains(line, srosMinorError) ||\n\t\t\tstrings.Contains(line, srosCriticalError) {\n\t\t\tlog.Warn(\n\t\t\t\t\"Got SR OS log message\",\n\t\t\t\t\"node\",\n\t\t\t\tn.Cfg.ShortName,\n\t\t\t\t\"message\",\n\t\t\t\tline+\"\\n\",\n\t\t\t)\n\t\t}\n\n\t\tif strings.Contains(line, srosRejectedCfgMsg) {\n\t\t\texitChan <- errors.New(\"configuration rejected by SR OS\")\n\t\t\treturn\n\t\t}\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tdefault:\n\t\t}\n\t}\n}\n\n// verifyNokiaSrosImage ensures the image used with kind nokia_srsim has the correct labels\n// It inspects the image label\n// org.opencontainers.image.title and returns an error if it is not \"srsim\".\nfunc (n *sros) verifyNokiaSrsimImage(ctx context.Context) error {\n\tif n.GetRuntime() == nil {\n\t\treturn nil\n\t}\n\tinsp, err := n.GetRuntime().InspectImage(ctx, n.Cfg.Image)\n\tif err != nil {\n\t\t// Skip check when runtime does not support image inspection (e.g. Podman).\n\t\tif strings.Contains(err.Error(), \"not implemented\") {\n\t\t\tlog.Debug(\n\t\t\t\t\"Skipping nokia_srsim image kind check: runtime does not support image inspection\",\n\t\t\t)\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\tif insp != nil && insp.Config.Labels != nil {\n\t\tif _, hasVrnetlab := insp.Config.Labels[vrnetlabVersionLabel]; hasVrnetlab {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"node %q: kind is nokia_srsim but the image is a vrnetlab image; use kind: nokia_sros with this image, or use the SR-SIM container image for kind: nokia_srsim\",\n\t\t\t\tn.Cfg.ShortName,\n\t\t\t)\n\t\t}\n\t\tif title, ok := insp.Config.Labels[srosImageTitleLabel]; ok && title == srosImageTitle {\n\t\t\treturn nil\n\t\t}\n\t}\n\tlog.Warnf(\n\t\t\"node %q: kind is nokia_srsim but the provided image does not have the correct labels; please use a valid SR-SIM container image or run a more recent version of the SR-SIM container image to suppress this warning\",\n\t\tn.Cfg.ShortName,\n\t)\n\treturn nil\n}\n\nfunc (n *sros) GetContainerStatus(ctx context.Context) clabruntime.ContainerStatus {\n\tif n.isStandaloneNode() || n.isDistributedCardNode() {\n\t\treturn n.DefaultNode.GetContainerStatus(ctx)\n\t}\n\n\tvar (\n\t\thasRunning    bool\n\t\thasPaused     bool\n\t\thasRestarting bool\n\t\thasCreated    bool\n\t\thasStopped    bool\n\t\thasRemoving   bool\n\t)\n\n\tfor _, componentNode := range n.componentNodes {\n\t\tswitch componentNode.GetContainerStatus(ctx) {\n\t\tcase clabruntime.Running:\n\t\t\thasRunning = true\n\t\tcase clabruntime.Paused:\n\t\t\thasPaused = true\n\t\tcase clabruntime.Restarting:\n\t\t\thasRestarting = true\n\t\tcase clabruntime.Created:\n\t\t\thasCreated = true\n\t\tcase clabruntime.Stopped:\n\t\t\thasStopped = true\n\t\tcase clabruntime.Removing:\n\t\t\thasRemoving = true\n\t\t}\n\t}\n\n\tswitch {\n\tcase hasRunning:\n\t\treturn clabruntime.Running\n\tcase hasPaused:\n\t\treturn clabruntime.Paused\n\tcase hasRestarting:\n\t\treturn clabruntime.Restarting\n\tcase hasCreated:\n\t\treturn clabruntime.Created\n\tcase hasStopped:\n\t\treturn clabruntime.Stopped\n\tcase hasRemoving:\n\t\treturn clabruntime.Removing\n\tdefault:\n\t\treturn clabruntime.NotFound\n\t}\n}\n\nfunc (n *sros) Start(ctx context.Context) error {\n\tif n.isStandaloneNode() || n.isDistributedCardNode() {\n\t\tif err := n.DefaultNode.Start(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn n.PostDeployEndpoints(ctx)\n\t}\n\n\tif err := n.ensureNetnsRunning(ctx); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, c := range n.componentNodes {\n\t\tif _, err := n.Runtime.StartContainer(ctx, c.Config().LongName, c); err != nil {\n\t\t\treturn fmt.Errorf(\"node %q component %q start error: %w\",\n\t\t\t\tn.Cfg.ShortName, c.Config().ShortName, err)\n\t\t}\n\t}\n\n\tif err := n.RestoreEndpoints(ctx); err != nil {\n\t\treturn err\n\t}\n\treturn n.PostDeployEndpoints(ctx)\n}\n\nfunc (n *sros) Stop(ctx context.Context) error {\n\tif n.isStandaloneNode() || n.isDistributedCardNode() {\n\t\treturn n.DefaultNode.Stop(ctx)\n\t}\n\n\tif n.GetContainerStatus(ctx) == clabruntime.Stopped {\n\t\treturn nil\n\t}\n\tif err := n.ParkEndpoints(ctx); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, c := range n.componentNodes {\n\t\tif err := n.Runtime.StopContainer(ctx, c.Config().LongName, n.StopSignal); err != nil {\n\t\t\tlog.Warnf(\"node %q component %q stop error: %v\",\n\t\t\t\tn.Cfg.ShortName, c.Config().ShortName, err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// ComputeDiff extends the default diff by ignoring component order and slot case, so that only\n// a change to the set of components marks the kind-specific config as changed.\nfunc (n *sros) ComputeDiff(oldCfg, newCfg *clabtypes.NodeConfig) *clabtypes.TopologyDiff {\n\tdiff := n.DefaultNode.ComputeDiff(oldCfg, newCfg)\n\n\tif oldCfg == nil || newCfg == nil {\n\t\treturn diff\n\t}\n\n\toldKC, oldOK := oldCfg.KindSpecificConfig.(*KindSpecificConfig)\n\tnewKC, newOK := newCfg.KindSpecificConfig.(*KindSpecificConfig)\n\n\tif oldOK && newOK && oldKC.equalIgnoringComponentOrder(newKC) {\n\t\tdiff.Fields = slices.DeleteFunc(\n\t\t\tdiff.Fields,\n\t\t\tfunc(f string) bool { return f == \"KindSpecificConfig\" },\n\t\t)\n\t}\n\n\treturn diff\n}\n\n// DefaultLinkType returns the default link type for an SR-SIM node\n// when the brief notation of a link definition is used.\n// It returns veth-stitch for SR-SIM nodes to support pcap and netem features,\n// see https://github.com/srl-labs/containerlab/pull/3270.\nfunc (*sros) DefaultLinkType() clablinks.LinkType {\n\treturn clablinks.LinkTypeVethStitch\n}\n\n// RestoreEndpoints retains normal lifecycle parking while restoring the logical\n// node's symlink as well as the component symlinks created by the runtime.\nfunc (n *sros) RestoreEndpoints(ctx context.Context) error {\n\tif err := n.DefaultNode.RestoreEndpoints(ctx); err != nil {\n\t\treturn err\n\t}\n\tif !n.isDistributedBaseNode() {\n\t\treturn nil\n\t}\n\tnsPath, err := n.GetNSPath(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn clabutils.LinkContainerNS(nsPath, n.Cfg.LongName)\n}",
        "lineStart": 1700,
        "lineEnd": 1910,
        "totalLines": 1910,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346584200,
      "end": 1792346584208
    }
  }
}
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/variant.go"
}

Output

<path>/source/head/nodes/sros/variant.go</path>
<type>file</type>
<content>
1: // Copyright 2025 Nokia
2: // Licensed under the BSD 3-Clause License.
3: // SPDX-License-Identifier: BSD-3-Clause
4: 
5: package sros
6: 
7: import (
8: 	"fmt"
9: 	"regexp"
10: )
11: 
12: var (
13: 	sarRegexp   = regexp.MustCompile(`(?i)\bsar-`)
14: 	sarHmRegexp = regexp.MustCompile(`(?i)\b(sar-hm|sar-hmc)\b`)
15: 
16: 	ixrRegexp = regexp.MustCompile(`(?i)\bixr-`)
17: )
18: 
19: // ConfigMode is the configuration mode (model-driven or classic).
20: type ConfigMode string
21: 
22: const (
23: 	ConfigModeModelDriven ConfigMode = "model-driven"
24: 	ConfigModeClassic     ConfigMode = "classic"
25: 	ConfigModeMixed       ConfigMode = "mixed"
26: )
27: 
28: // UnmarshalYAML accepts only the known configuration modes.
29: func (m *ConfigMode) UnmarshalYAML(unmarshal func(any) error) error {
30: 	var s string
31: 	if err := unmarshal(&s); err != nil {
32: 		return err
33: 	}
34: 
35: 	switch mode := ConfigMode(s); mode {
36: 	case ConfigModeModelDriven, ConfigModeClassic, ConfigModeMixed:
37: 		*m = mode
38: 
39: 		return nil
40: 	}
41: 
42: 	return fmt.Errorf("invalid config-mode %q, valid values: %s, %s, %s",
43: 		s, ConfigModeModelDriven, ConfigModeClassic, ConfigModeMixed)
44: }
45: 
46: // ConfigFamily is the node family (SR, IXR, SAR).
47: type ConfigFamily string
48: 
49: const (
50: 	ConfigFamilySR  ConfigFamily = "sr"
51: 	ConfigFamilyIXR ConfigFamily = "ixr"
52: 	ConfigFamilySAR ConfigFamily = "sar"
53: )
54: 
55: // ConfigVariant encodes mode, node family, and security for template and snippet selection.
56: // Single source of truth for "what config do we use for this node.".
57: type ConfigVariant struct {
58: 	Mode         ConfigMode   // model-driven, classic, or mixed
59: 	Family       ConfigFamily // sr, ixr, sar
60: 	SecureGrpc   bool
61: 	ForceClassic bool // true when SAR-Hm forces classic (MD disabled)
62: }
63: 
64: // snippetSet holds the system and gRPC config snippets for a variant.
65: // Other snippets (SNMP, logging, netconf, SSH) are shared across variants.
66: type snippetSet struct {
67: 	SystemConfig string
68: 	GRPCConfig   string
69: }
70: 
71: // FullSnippetSet holds all config snippet strings for a variant (system, grpc, snmp, netconf,
72: // logging, ssh).
73: // Single table-driven result for "which snippets apply to this variant.".
74: type FullSnippetSet struct {
75: 	SystemConfig  string
76: 	GRPCConfig    string
77: 	SNMPConfig    string
78: 	NetconfConfig string
79: 	LoggingConfig string
80: 	SSHConfig     string
81: }
82: 
83: // getFullSnippetSet returns the full set of snippet strings for the given variant.
84: // Shared snippets (SNMP, logging, netconf, SSH) are the same for all variants.
85: func getFullSnippetSet(v ConfigVariant) FullSnippetSet {
86: 	s := getSnippetSet(v)
87: 	return FullSnippetSet{
88: 		SystemConfig:  s.SystemConfig,
89: 		GRPCConfig:    s.GRPCConfig,
90: 		SNMPConfig:    snmpv2Config,
91: 		NetconfConfig: netconfConfig,
92: 		LoggingConfig: loggingConfig,
93: 		SSHConfig:     sshConfig,
94: 	}
95: }
96: 
97: // resolveConfigVariant returns the config variant for node n from NodeType,
98: // the config-mode kind-specific config key, and Certificate.Issue. SAR-Hm forces classic mode;
99: // the caller should apply that to tplData and the kind-specific config when ForceClassic is true.
100: func (n *sros) resolveConfigVariant() ConfigVariant {
101: 	mode := n.kindSpecificCfg().ConfigMode
102: 	if mode == "" {
103: 		mode = ConfigModeModelDriven
104: 	}
105: 	secureGrpc := n.Cfg.Certificate.Issue != nil && *n.Cfg.Certificate.Issue
106: 
107: 	var family ConfigFamily
108: 	switch {
109: 	case n.isIXRNode():
110: 		family = ConfigFamilyIXR
111: 	case n.isSARNode():
112: 		family = ConfigFamilySAR
113: 	default:
114: 		family = ConfigFamilySR
115: 	}
116: 
117: 	forceClassic := false
118: 	if family == ConfigFamilySAR && n.isSARHmNode() {
119: 		forceClassic = true
120: 		if mode != ConfigModeClassic && mode != ConfigModeMixed {
121: 			mode = ConfigModeClassic
122: 		}
123: 	}
124: 
125: 	return ConfigVariant{
126: 		Mode:         mode,
127: 		Family:       family,
128: 		SecureGrpc:   secureGrpc,
129: 		ForceClassic: forceClassic,
130: 	}
131: }
132: 
133: // getSnippetSet returns the system and gRPC snippet set for the given variant.
134: func getSnippetSet(v ConfigVariant) snippetSet {
135: 	sys := systemCfg
136: 	grpc := grpcConfig
137: 	if !v.SecureGrpc {
138: 		grpc = grpcConfigInsecure
139: 	}
140: 	switch v.Family {
141: 	case ConfigFamilyIXR:
142: 		sys = systemCfgIXR
143: 		grpc = grpcConfigIXR
144: 		if !v.SecureGrpc {
145: 			grpc = grpcConfigIXRInsecure
146: 		}
147: 	case ConfigFamilySAR:
148: 		sys = systemCfgSAR
149: 		grpc = grpcConfigSAR
150: 		if !v.SecureGrpc {
151: 			grpc = grpcConfigSARInsecure
152: 		}
153: 	}
154: 	return snippetSet{SystemConfig: sys, GRPCConfig: grpc}
155: }
156: 
157: // isIXRNode returns true if this is an IXR node type (case-insensitive).
158: func (n *sros) isIXRNode() bool {
159: 	return ixrRegexp.MatchString(n.Cfg.NodeType)
160: }
161: 
162: // isSARNode returns true if this is a SAR node type (case-insensitive).
163: func (n *sros) isSARNode() bool {
164: 	return sarRegexp.MatchString(n.Cfg.NodeType)
165: }
166: 
167: // isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).
168: func (n *sros) isSARHmNode() bool {
169: 	return sarHmRegexp.MatchString(n.Cfg.NodeType)
170: }

(End of file - total 170 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502e74bb001WBPkOVhy9PoxsO",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e65e1001OgTBP5VcFf5FbI",
  "callID": "call_e5b5ce9a0b9948eeb91a6859",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/variant.go"
    },
    "output": "<path>/source/head/nodes/sros/variant.go</path>\n<type>file</type>\n<content>\n1: // Copyright 2025 Nokia\n2: // Licensed under the BSD 3-Clause License.\n3: // SPDX-License-Identifier: BSD-3-Clause\n4: \n5: package sros\n6: \n7: import (\n8: \t\"fmt\"\n9: \t\"regexp\"\n10: )\n11: \n12: var (\n13: \tsarRegexp   = regexp.MustCompile(`(?i)\\bsar-`)\n14: \tsarHmRegexp = regexp.MustCompile(`(?i)\\b(sar-hm|sar-hmc)\\b`)\n15: \n16: \tixrRegexp = regexp.MustCompile(`(?i)\\bixr-`)\n17: )\n18: \n19: // ConfigMode is the configuration mode (model-driven or classic).\n20: type ConfigMode string\n21: \n22: const (\n23: \tConfigModeModelDriven ConfigMode = \"model-driven\"\n24: \tConfigModeClassic     ConfigMode = \"classic\"\n25: \tConfigModeMixed       ConfigMode = \"mixed\"\n26: )\n27: \n28: // UnmarshalYAML accepts only the known configuration modes.\n29: func (m *ConfigMode) UnmarshalYAML(unmarshal func(any) error) error {\n30: \tvar s string\n31: \tif err := unmarshal(&s); err != nil {\n32: \t\treturn err\n33: \t}\n34: \n35: \tswitch mode := ConfigMode(s); mode {\n36: \tcase ConfigModeModelDriven, ConfigModeClassic, ConfigModeMixed:\n37: \t\t*m = mode\n38: \n39: \t\treturn nil\n40: \t}\n41: \n42: \treturn fmt.Errorf(\"invalid config-mode %q, valid values: %s, %s, %s\",\n43: \t\ts, ConfigModeModelDriven, ConfigModeClassic, ConfigModeMixed)\n44: }\n45: \n46: // ConfigFamily is the node family (SR, IXR, SAR).\n47: type ConfigFamily string\n48: \n49: const (\n50: \tConfigFamilySR  ConfigFamily = \"sr\"\n51: \tConfigFamilyIXR ConfigFamily = \"ixr\"\n52: \tConfigFamilySAR ConfigFamily = \"sar\"\n53: )\n54: \n55: // ConfigVariant encodes mode, node family, and security for template and snippet selection.\n56: // Single source of truth for \"what config do we use for this node.\".\n57: type ConfigVariant struct {\n58: \tMode         ConfigMode   // model-driven, classic, or mixed\n59: \tFamily       ConfigFamily // sr, ixr, sar\n60: \tSecureGrpc   bool\n61: \tForceClassic bool // true when SAR-Hm forces classic (MD disabled)\n62: }\n63: \n64: // snippetSet holds the system and gRPC config snippets for a variant.\n65: // Other snippets (SNMP, logging, netconf, SSH) are shared across variants.\n66: type snippetSet struct {\n67: \tSystemConfig string\n68: \tGRPCConfig   string\n69: }\n70: \n71: // FullSnippetSet holds all config snippet strings for a variant (system, grpc, snmp, netconf,\n72: // logging, ssh).\n73: // Single table-driven result for \"which snippets apply to this variant.\".\n74: type FullSnippetSet struct {\n75: \tSystemConfig  string\n76: \tGRPCConfig    string\n77: \tSNMPConfig    string\n78: \tNetconfConfig string\n79: \tLoggingConfig string\n80: \tSSHConfig     string\n81: }\n82: \n83: // getFullSnippetSet returns the full set of snippet strings for the given variant.\n84: // Shared snippets (SNMP, logging, netconf, SSH) are the same for all variants.\n85: func getFullSnippetSet(v ConfigVariant) FullSnippetSet {\n86: \ts := getSnippetSet(v)\n87: \treturn FullSnippetSet{\n88: \t\tSystemConfig:  s.SystemConfig,\n89: \t\tGRPCConfig:    s.GRPCConfig,\n90: \t\tSNMPConfig:    snmpv2Config,\n91: \t\tNetconfConfig: netconfConfig,\n92: \t\tLoggingConfig: loggingConfig,\n93: \t\tSSHConfig:     sshConfig,\n94: \t}\n95: }\n96: \n97: // resolveConfigVariant returns the config variant for node n from NodeType,\n98: // the config-mode kind-specific config key, and Certificate.Issue. SAR-Hm forces classic mode;\n99: // the caller should apply that to tplData and the kind-specific config when ForceClassic is true.\n100: func (n *sros) resolveConfigVariant() ConfigVariant {\n101: \tmode := n.kindSpecificCfg().ConfigMode\n102: \tif mode == \"\" {\n103: \t\tmode = ConfigModeModelDriven\n104: \t}\n105: \tsecureGrpc := n.Cfg.Certificate.Issue != nil && *n.Cfg.Certificate.Issue\n106: \n107: \tvar family ConfigFamily\n108: \tswitch {\n109: \tcase n.isIXRNode():\n110: \t\tfamily = ConfigFamilyIXR\n111: \tcase n.isSARNode():\n112: \t\tfamily = ConfigFamilySAR\n113: \tdefault:\n114: \t\tfamily = ConfigFamilySR\n115: \t}\n116: \n117: \tforceClassic := false\n118: \tif family == ConfigFamilySAR && n.isSARHmNode() {\n119: \t\tforceClassic = true\n120: \t\tif mode != ConfigModeClassic && mode != ConfigModeMixed {\n121: \t\t\tmode = ConfigModeClassic\n122: \t\t}\n123: \t}\n124: \n125: \treturn ConfigVariant{\n126: \t\tMode:         mode,\n127: \t\tFamily:       family,\n128: \t\tSecureGrpc:   secureGrpc,\n129: \t\tForceClassic: forceClassic,\n130: \t}\n131: }\n132: \n133: // getSnippetSet returns the system and gRPC snippet set for the given variant.\n134: func getSnippetSet(v ConfigVariant) snippetSet {\n135: \tsys := systemCfg\n136: \tgrpc := grpcConfig\n137: \tif !v.SecureGrpc {\n138: \t\tgrpc = grpcConfigInsecure\n139: \t}\n140: \tswitch v.Family {\n141: \tcase ConfigFamilyIXR:\n142: \t\tsys = systemCfgIXR\n143: \t\tgrpc = grpcConfigIXR\n144: \t\tif !v.SecureGrpc {\n145: \t\t\tgrpc = grpcConfigIXRInsecure\n146: \t\t}\n147: \tcase ConfigFamilySAR:\n148: \t\tsys = systemCfgSAR\n149: \t\tgrpc = grpcConfigSAR\n150: \t\tif !v.SecureGrpc {\n151: \t\t\tgrpc = grpcConfigSARInsecure\n152: \t\t}\n153: \t}\n154: \treturn snippetSet{SystemConfig: sys, GRPCConfig: grpc}\n155: }\n156: \n157: // isIXRNode returns true if this is an IXR node type (case-insensitive).\n158: func (n *sros) isIXRNode() bool {\n159: \treturn ixrRegexp.MatchString(n.Cfg.NodeType)\n160: }\n161: \n162: // isSARNode returns true if this is a SAR node type (case-insensitive).\n163: func (n *sros) isSARNode() bool {\n164: \treturn sarRegexp.MatchString(n.Cfg.NodeType)\n165: }\n166: \n167: // isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).\n168: func (n *sros) isSARHmNode() bool {\n169: \treturn sarHmRegexp.MatchString(n.Cfg.NodeType)\n170: }\n\n(End of file - total 170 lines)\n</content>",
    "title": "source/head/nodes/sros/variant.go",
    "metadata": {
      "preview": "// Copyright 2025 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\npackage sros\n\nimport (\n\t\"fmt\"\n\t\"regexp\"\n)\n\nvar (\n\tsarRegexp   = regexp.MustCompile(`(?i)\\bsar-`)\n\tsarHmRegexp = regexp.MustCompile(`(?i)\\b(sar-hm|sar-hmc)\\b`)\n\n\tixrRegexp = regexp.MustCompile(`(?i)\\bixr-`)\n)\n\n// ConfigMode is the configuration mode (model-driven or classic).\ntype ConfigMode string",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/variant.go",
        "text": "// Copyright 2025 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\npackage sros\n\nimport (\n\t\"fmt\"\n\t\"regexp\"\n)\n\nvar (\n\tsarRegexp   = regexp.MustCompile(`(?i)\\bsar-`)\n\tsarHmRegexp = regexp.MustCompile(`(?i)\\b(sar-hm|sar-hmc)\\b`)\n\n\tixrRegexp = regexp.MustCompile(`(?i)\\bixr-`)\n)\n\n// ConfigMode is the configuration mode (model-driven or classic).\ntype ConfigMode string\n\nconst (\n\tConfigModeModelDriven ConfigMode = \"model-driven\"\n\tConfigModeClassic     ConfigMode = \"classic\"\n\tConfigModeMixed       ConfigMode = \"mixed\"\n)\n\n// UnmarshalYAML accepts only the known configuration modes.\nfunc (m *ConfigMode) UnmarshalYAML(unmarshal func(any) error) error {\n\tvar s string\n\tif err := unmarshal(&s); err != nil {\n\t\treturn err\n\t}\n\n\tswitch mode := ConfigMode(s); mode {\n\tcase ConfigModeModelDriven, ConfigModeClassic, ConfigModeMixed:\n\t\t*m = mode\n\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"invalid config-mode %q, valid values: %s, %s, %s\",\n\t\ts, ConfigModeModelDriven, ConfigModeClassic, ConfigModeMixed)\n}\n\n// ConfigFamily is the node family (SR, IXR, SAR).\ntype ConfigFamily string\n\nconst (\n\tConfigFamilySR  ConfigFamily = \"sr\"\n\tConfigFamilyIXR ConfigFamily = \"ixr\"\n\tConfigFamilySAR ConfigFamily = \"sar\"\n)\n\n// ConfigVariant encodes mode, node family, and security for template and snippet selection.\n// Single source of truth for \"what config do we use for this node.\".\ntype ConfigVariant struct {\n\tMode         ConfigMode   // model-driven, classic, or mixed\n\tFamily       ConfigFamily // sr, ixr, sar\n\tSecureGrpc   bool\n\tForceClassic bool // true when SAR-Hm forces classic (MD disabled)\n}\n\n// snippetSet holds the system and gRPC config snippets for a variant.\n// Other snippets (SNMP, logging, netconf, SSH) are shared across variants.\ntype snippetSet struct {\n\tSystemConfig string\n\tGRPCConfig   string\n}\n\n// FullSnippetSet holds all config snippet strings for a variant (system, grpc, snmp, netconf,\n// logging, ssh).\n// Single table-driven result for \"which snippets apply to this variant.\".\ntype FullSnippetSet struct {\n\tSystemConfig  string\n\tGRPCConfig    string\n\tSNMPConfig    string\n\tNetconfConfig string\n\tLoggingConfig string\n\tSSHConfig     string\n}\n\n// getFullSnippetSet returns the full set of snippet strings for the given variant.\n// Shared snippets (SNMP, logging, netconf, SSH) are the same for all variants.\nfunc getFullSnippetSet(v ConfigVariant) FullSnippetSet {\n\ts := getSnippetSet(v)\n\treturn FullSnippetSet{\n\t\tSystemConfig:  s.SystemConfig,\n\t\tGRPCConfig:    s.GRPCConfig,\n\t\tSNMPConfig:    snmpv2Config,\n\t\tNetconfConfig: netconfConfig,\n\t\tLoggingConfig: loggingConfig,\n\t\tSSHConfig:     sshConfig,\n\t}\n}\n\n// resolveConfigVariant returns the config variant for node n from NodeType,\n// the config-mode kind-specific config key, and Certificate.Issue. SAR-Hm forces classic mode;\n// the caller should apply that to tplData and the kind-specific config when ForceClassic is true.\nfunc (n *sros) resolveConfigVariant() ConfigVariant {\n\tmode := n.kindSpecificCfg().ConfigMode\n\tif mode == \"\" {\n\t\tmode = ConfigModeModelDriven\n\t}\n\tsecureGrpc := n.Cfg.Certificate.Issue != nil && *n.Cfg.Certificate.Issue\n\n\tvar family ConfigFamily\n\tswitch {\n\tcase n.isIXRNode():\n\t\tfamily = ConfigFamilyIXR\n\tcase n.isSARNode():\n\t\tfamily = ConfigFamilySAR\n\tdefault:\n\t\tfamily = ConfigFamilySR\n\t}\n\n\tforceClassic := false\n\tif family == ConfigFamilySAR && n.isSARHmNode() {\n\t\tforceClassic = true\n\t\tif mode != ConfigModeClassic && mode != ConfigModeMixed {\n\t\t\tmode = ConfigModeClassic\n\t\t}\n\t}\n\n\treturn ConfigVariant{\n\t\tMode:         mode,\n\t\tFamily:       family,\n\t\tSecureGrpc:   secureGrpc,\n\t\tForceClassic: forceClassic,\n\t}\n}\n\n// getSnippetSet returns the system and gRPC snippet set for the given variant.\nfunc getSnippetSet(v ConfigVariant) snippetSet {\n\tsys := systemCfg\n\tgrpc := grpcConfig\n\tif !v.SecureGrpc {\n\t\tgrpc = grpcConfigInsecure\n\t}\n\tswitch v.Family {\n\tcase ConfigFamilyIXR:\n\t\tsys = systemCfgIXR\n\t\tgrpc = grpcConfigIXR\n\t\tif !v.SecureGrpc {\n\t\t\tgrpc = grpcConfigIXRInsecure\n\t\t}\n\tcase ConfigFamilySAR:\n\t\tsys = systemCfgSAR\n\t\tgrpc = grpcConfigSAR\n\t\tif !v.SecureGrpc {\n\t\t\tgrpc = grpcConfigSARInsecure\n\t\t}\n\t}\n\treturn snippetSet{SystemConfig: sys, GRPCConfig: grpc}\n}\n\n// isIXRNode returns true if this is an IXR node type (case-insensitive).\nfunc (n *sros) isIXRNode() bool {\n\treturn ixrRegexp.MatchString(n.Cfg.NodeType)\n}\n\n// isSARNode returns true if this is a SAR node type (case-insensitive).\nfunc (n *sros) isSARNode() bool {\n\treturn sarRegexp.MatchString(n.Cfg.NodeType)\n}\n\n// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).\nfunc (n *sros) isSARHmNode() bool {\n\treturn sarHmRegexp.MatchString(n.Cfg.NodeType)\n}",
        "lineStart": 1,
        "lineEnd": 170,
        "totalLines": 170,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346584255,
      "end": 1792346584266
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502e74cc001WU255OyAlrMYun",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e65e1001OgTBP5VcFf5FbI",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 42407,
    "input": 42328,
    "output": 42,
    "reasoning": 37,
    "cache": {
      "read": 0,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502e65e1001OgTBP5VcFf5FbI",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346580449,
    "completed": 1792346584271
  },
  "parentID": "msg_1502e41aa001XEn2l1GdfLHjHR",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 42407,
    "input": 42328,
    "output": 42,
    "reasoning": 37,
    "cache": {
      "read": 0,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 16
step-start
{
  "type": "step-start",
  "id": "prt_1502e7d6d001NHK12EsP06ofz8",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e74d500149rk6g1A9t7MNG"
}
Reasoning
Note: `isDistributedBaseNode` for integrated node types returns true only when `isRedundantIntegratedSrosComponents` — meaning ixr-r6 with components on slot A and B is distributed. But `integratedSrosDefaultComponents["ixr-r6"].allowedSlots` = [A, B]; others only [A]. So redundant integrated chassis only for ixr-r6. Hmm, but sr-1s with components A+B... `isRedundantIntegratedSrosComponents` requires all slots allowed; for sr-1s, B is not allowed → false → standalone. But then `setupStandaloneComponents` errors if >1 component. Good.

Wait: for ixr-r6 with components A and B → isDistributedBaseNode true → distributed path. But integrated nodes (ixr-r6) in distributed mode... generateIntegratedComponentConfig on component nodes: rootCtrName != "" (netns container). It uses `n.Cfg.Env[envNokiaSrosSlot]` to find matching rootComponents entry. That's for integrated redundant. But the integrated components are CPM slots only (A/B) — buildIntegratedComponentCfgLines uses override.XIOM/MDA but discards override's slot; card slot is "1". OK.

But note: for redundant integrated, each component node (CPM A and CPM B) generates integrated config with the same card config? componentForConfig(n.integratedComponentOverride()) — the override is the component matching this node's slot; each CPM would apply its own component env. Probably fine.

Now template.go.
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/template.go"
}

Output

<path>/source/head/nodes/sros/template.go</path>
<type>file</type>
<content>
1: package sros
2: 
3: import (
4: 	_ "embed"
5: 	"text/template"
6: 
7: 	clabutils "github.com/srl-labs/containerlab/utils"
8: )
9: 
10: var (
11: 	//go:embed configs/sros_config_sros25.go.tpl
12: 	cfgTplSROS25 string
13: 
14: 	//go:embed configs/sros_config_classic.go.tpl
15: 	cfgTplClassic string
16: 
17: 	//go:embed configs/ixr/ixr_config_classic.go.tpl
18: 	cfgTplClassicIxr string
19: 
20: 	//go:embed configs/sar/sar_config_classic.go.tpl
21: 	cfgTplClassicSar string
22: )
23: 
24: // srosTemplateData holds all data needed for template selection and execution.
25: type srosTemplateData struct {
26: 	// Template selection criteria
27: 	NodeType          string
28: 	ConfigurationMode string
29: 	SwVersion         *SrosVersion
30: 	IsSecureGrpc      bool
31: 
32: 	// Node identification
33: 	Name string
34: 
35: 	// Certificate data
36: 	TLSKey    string
37: 	TLSCert   string
38: 	TLSAnchor string
39: 
40: 	// Banner and SSH
41: 	Banner            string
42: 	SSHPubKeysRSA     []string
43: 	SSHPubKeysECDSA   []string
44: 	SSHPubKeysED25519 []string
45: 
46: 	// Network configuration
47: 	IFaces     map[string]tplIFace
48: 	MgmtMTU    int
49: 	MgmtIPMTU  int
50: 	DNSServers []string
51: 
52: 	// Service configurations (populated based on node type and security)
53: 	SystemConfig    string
54: 	SNMPConfig      string
55: 	GRPCConfig      string
56: 	NetconfConfig   string
57: 	LoggingConfig   string
58: 	SSHConfig       string
59: 	ComponentConfig string
60: }
61: 
62: // tplIFace template interface struct.
63: type tplIFace struct {
64: 	Slot       string
65: 	Port       string
66: 	BreakoutNo string
67: 	Mtu        int
68: }
69: 
70: // getTemplateForVariant returns the template string and name for the given config variant.
71: // swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= "26").
72: func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {
73: 	// Model-driven (or mixed treated as classic below when family is classic)
74: 	if v.Mode == ConfigModeModelDriven {
75: 		// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= "26"
76: 		// { return cfgTplSROS26, "clab-sros-config-sros26" }
77: 		return cfgTplSROS25, "clab-sros-config-sros25"
78: 	}
79: 	// Classic (or mixed)
80: 	tmpl = cfgTplClassic
81: 	tplName = "clab-sros-config-classic"
82: 	switch v.Family {
83: 	case ConfigFamilyIXR:
84: 		return cfgTplClassicIxr, "clab-sros-config-classic-ixr"
85: 	case ConfigFamilySAR:
86: 		return cfgTplClassicSar, "clab-sros-config-classic-sar"
87: 	default:
88: 		return tmpl, tplName
89: 	}
90: }
91: 
92: // selectConfigTemplate chooses the config template from the config variant (mode + family).
93: func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {
94: 	v := n.resolveConfigVariant()
95: 	tmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)
96: 	return template.New(tplName).
97: 		Funcs(clabutils.CreateFuncs()).
98: 		Parse(tmpl)
99: }

(End of file - total 99 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502e89c8001BFkm43fUmACzIm",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e74d500149rk6g1A9t7MNG",
  "callID": "call_7a60412f90a1473b81ac7a8d",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/template.go"
    },
    "output": "<path>/source/head/nodes/sros/template.go</path>\n<type>file</type>\n<content>\n1: package sros\n2: \n3: import (\n4: \t_ \"embed\"\n5: \t\"text/template\"\n6: \n7: \tclabutils \"github.com/srl-labs/containerlab/utils\"\n8: )\n9: \n10: var (\n11: \t//go:embed configs/sros_config_sros25.go.tpl\n12: \tcfgTplSROS25 string\n13: \n14: \t//go:embed configs/sros_config_classic.go.tpl\n15: \tcfgTplClassic string\n16: \n17: \t//go:embed configs/ixr/ixr_config_classic.go.tpl\n18: \tcfgTplClassicIxr string\n19: \n20: \t//go:embed configs/sar/sar_config_classic.go.tpl\n21: \tcfgTplClassicSar string\n22: )\n23: \n24: // srosTemplateData holds all data needed for template selection and execution.\n25: type srosTemplateData struct {\n26: \t// Template selection criteria\n27: \tNodeType          string\n28: \tConfigurationMode string\n29: \tSwVersion         *SrosVersion\n30: \tIsSecureGrpc      bool\n31: \n32: \t// Node identification\n33: \tName string\n34: \n35: \t// Certificate data\n36: \tTLSKey    string\n37: \tTLSCert   string\n38: \tTLSAnchor string\n39: \n40: \t// Banner and SSH\n41: \tBanner            string\n42: \tSSHPubKeysRSA     []string\n43: \tSSHPubKeysECDSA   []string\n44: \tSSHPubKeysED25519 []string\n45: \n46: \t// Network configuration\n47: \tIFaces     map[string]tplIFace\n48: \tMgmtMTU    int\n49: \tMgmtIPMTU  int\n50: \tDNSServers []string\n51: \n52: \t// Service configurations (populated based on node type and security)\n53: \tSystemConfig    string\n54: \tSNMPConfig      string\n55: \tGRPCConfig      string\n56: \tNetconfConfig   string\n57: \tLoggingConfig   string\n58: \tSSHConfig       string\n59: \tComponentConfig string\n60: }\n61: \n62: // tplIFace template interface struct.\n63: type tplIFace struct {\n64: \tSlot       string\n65: \tPort       string\n66: \tBreakoutNo string\n67: \tMtu        int\n68: }\n69: \n70: // getTemplateForVariant returns the template string and name for the given config variant.\n71: // swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= \"26\").\n72: func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {\n73: \t// Model-driven (or mixed treated as classic below when family is classic)\n74: \tif v.Mode == ConfigModeModelDriven {\n75: \t\t// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= \"26\"\n76: \t\t// { return cfgTplSROS26, \"clab-sros-config-sros26\" }\n77: \t\treturn cfgTplSROS25, \"clab-sros-config-sros25\"\n78: \t}\n79: \t// Classic (or mixed)\n80: \ttmpl = cfgTplClassic\n81: \ttplName = \"clab-sros-config-classic\"\n82: \tswitch v.Family {\n83: \tcase ConfigFamilyIXR:\n84: \t\treturn cfgTplClassicIxr, \"clab-sros-config-classic-ixr\"\n85: \tcase ConfigFamilySAR:\n86: \t\treturn cfgTplClassicSar, \"clab-sros-config-classic-sar\"\n87: \tdefault:\n88: \t\treturn tmpl, tplName\n89: \t}\n90: }\n91: \n92: // selectConfigTemplate chooses the config template from the config variant (mode + family).\n93: func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {\n94: \tv := n.resolveConfigVariant()\n95: \ttmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)\n96: \treturn template.New(tplName).\n97: \t\tFuncs(clabutils.CreateFuncs()).\n98: \t\tParse(tmpl)\n99: }\n\n(End of file - total 99 lines)\n</content>",
    "title": "source/head/nodes/sros/template.go",
    "metadata": {
      "preview": "package sros\n\nimport (\n\t_ \"embed\"\n\t\"text/template\"\n\n\tclabutils \"github.com/srl-labs/containerlab/utils\"\n)\n\nvar (\n\t//go:embed configs/sros_config_sros25.go.tpl\n\tcfgTplSROS25 string\n\n\t//go:embed configs/sros_config_classic.go.tpl\n\tcfgTplClassic string\n\n\t//go:embed configs/ixr/ixr_config_classic.go.tpl\n\tcfgTplClassicIxr string\n\n\t//go:embed configs/sar/sar_config_classic.go.tpl",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/template.go",
        "text": "package sros\n\nimport (\n\t_ \"embed\"\n\t\"text/template\"\n\n\tclabutils \"github.com/srl-labs/containerlab/utils\"\n)\n\nvar (\n\t//go:embed configs/sros_config_sros25.go.tpl\n\tcfgTplSROS25 string\n\n\t//go:embed configs/sros_config_classic.go.tpl\n\tcfgTplClassic string\n\n\t//go:embed configs/ixr/ixr_config_classic.go.tpl\n\tcfgTplClassicIxr string\n\n\t//go:embed configs/sar/sar_config_classic.go.tpl\n\tcfgTplClassicSar string\n)\n\n// srosTemplateData holds all data needed for template selection and execution.\ntype srosTemplateData struct {\n\t// Template selection criteria\n\tNodeType          string\n\tConfigurationMode string\n\tSwVersion         *SrosVersion\n\tIsSecureGrpc      bool\n\n\t// Node identification\n\tName string\n\n\t// Certificate data\n\tTLSKey    string\n\tTLSCert   string\n\tTLSAnchor string\n\n\t// Banner and SSH\n\tBanner            string\n\tSSHPubKeysRSA     []string\n\tSSHPubKeysECDSA   []string\n\tSSHPubKeysED25519 []string\n\n\t// Network configuration\n\tIFaces     map[string]tplIFace\n\tMgmtMTU    int\n\tMgmtIPMTU  int\n\tDNSServers []string\n\n\t// Service configurations (populated based on node type and security)\n\tSystemConfig    string\n\tSNMPConfig      string\n\tGRPCConfig      string\n\tNetconfConfig   string\n\tLoggingConfig   string\n\tSSHConfig       string\n\tComponentConfig string\n}\n\n// tplIFace template interface struct.\ntype tplIFace struct {\n\tSlot       string\n\tPort       string\n\tBreakoutNo string\n\tMtu        int\n}\n\n// getTemplateForVariant returns the template string and name for the given config variant.\n// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= \"26\").\nfunc getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {\n\t// Model-driven (or mixed treated as classic below when family is classic)\n\tif v.Mode == ConfigModeModelDriven {\n\t\t// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= \"26\"\n\t\t// { return cfgTplSROS26, \"clab-sros-config-sros26\" }\n\t\treturn cfgTplSROS25, \"clab-sros-config-sros25\"\n\t}\n\t// Classic (or mixed)\n\ttmpl = cfgTplClassic\n\ttplName = \"clab-sros-config-classic\"\n\tswitch v.Family {\n\tcase ConfigFamilyIXR:\n\t\treturn cfgTplClassicIxr, \"clab-sros-config-classic-ixr\"\n\tcase ConfigFamilySAR:\n\t\treturn cfgTplClassicSar, \"clab-sros-config-classic-sar\"\n\tdefault:\n\t\treturn tmpl, tplName\n\t}\n}\n\n// selectConfigTemplate chooses the config template from the config variant (mode + family).\nfunc (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {\n\tv := n.resolveConfigVariant()\n\ttmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)\n\treturn template.New(tplName).\n\t\tFuncs(clabutils.CreateFuncs()).\n\t\tParse(tmpl)\n}",
        "lineStart": 1,
        "lineEnd": 99,
        "totalLines": 99,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346589648,
      "end": 1792346589662
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502e89e2001Ymzd9zaHLnOduw",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e74d500149rk6g1A9t7MNG",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 46901,
    "input": 4312,
    "output": 17,
    "reasoning": 332,
    "cache": {
      "read": 42240,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502e74d500149rk6g1A9t7MNG",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346584277,
    "completed": 1792346589672
  },
  "parentID": "msg_1502e41aa001XEn2l1GdfLHjHR",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 46901,
    "input": 4312,
    "output": 17,
    "reasoning": 332,
    "cache": {
      "read": 42240,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 17
step-start
{
  "type": "step-start",
  "id": "prt_1502e91d2001uLXwLTtxxcOjXE",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e89f6001yZyZ9L3yksryNy"
}
Reasoning
Now read the tests: chassis_info_test.go and sros_test.go.
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/chassis_info_test.go"
}

Output

<path>/source/head/nodes/sros/chassis_info_test.go</path>
<type>file</type>
<content>
1: // Copyright 2026 Nokia
2: // Licensed under the BSD 3-Clause License.
3: // SPDX-License-Identifier: BSD-3-Clause
4: 
5: package sros
6: 
7: import (
8: 	"testing"
9: 
10: 	"github.com/stretchr/testify/assert"
11: 	"github.com/stretchr/testify/require"
12: )
13: 
14: func TestChassisInfoComponentWarnings(t *testing.T) {
15: 	info, err := parseChassisInfo([]byte(`{
16: 		"IXR-x": {
17: 			"cpm": ["cpm-ixr-x"],
18: 			"iom": ["imm6-qsfpdd+48-sfp56"],
19: 			"iom_slots": 1,
20: 			"mda": [null],
21: 			"sfm": ["sfm-ixr-x"]
22: 		},
23: 		"SAR-Hx": {
24: 			"cpm": ["iom-sar-1x"],
25: 			"fixed_mdas": {"2": "fixed-mda"},
26: 			"integrated": true,
27: 			"mda": ["supported-mda"],
28: 			"xiom": ["supported-xiom"]
29: 		},
30: 		"SAR-Mx": {"alias": "SAR-Hx"}
31: 	}`))
32: 	require.NoError(t, err)
33: 
34: 	t.Run("supported configuration", func(t *testing.T) {
35: 		warnings := info.componentWarnings("sar-mx", "", []*Component{{
36: 			Slot: slotAName,
37: 			Type: "iom-sar-1x",
38: 			MDA: MDAS{
39: 				{Slot: 1, Type: "supported-mda"},
40: 				{Slot: 2, Type: "fixed-mda"},
41: 			},
42: 			XIOM: XIOMS{{Slot: 1, Type: "supported-xiom"}},
43: 		}})
44: 
45: 		assert.Empty(t, warnings)
46: 	})
47: 
48: 	t.Run("unsupported values warn", func(t *testing.T) {
49: 		warnings := info.componentWarnings("IXR-x", "wrong-sfm", []*Component{
50: 			{Slot: slotAName, Type: "wrong-cpm"},
51: 			{Slot: "2", Type: "wrong-iom", MDA: MDAS{{Slot: 1, Type: "wrong-mda"}}},
52: 		})
53: 
54: 		assert.Len(t, warnings, 5)
55: 		assert.Contains(t, warnings[0], "SFM type")
56: 		assert.Contains(t, warnings[1], "component type")
57: 		assert.Contains(t, warnings[2], "exceeds")
58: 		assert.Contains(t, warnings[3], "component type")
59: 		assert.Contains(t, warnings[4], "MDA type")
60: 	})
61: 
62: 	t.Run("fixed MDA mismatch warns", func(t *testing.T) {
63: 		warnings := info.componentWarnings("SAR-Hx", "", []*Component{{
64: 			Slot: slotAName,
65: 			MDA:  MDAS{{Slot: 2, Type: "wrong-mda"}},
66: 		}})
67: 
68: 		require.Len(t, warnings, 1)
69: 		assert.Contains(t, warnings[0], "does not match fixed MDA")
70: 	})
71: 
72: 	t.Run("distributed CPM slot does not validate direct MDAs", func(t *testing.T) {
73: 		warnings := info.componentWarnings("IXR-x", "", []*Component{{
74: 			Slot: slotAName,
75: 			Type: "cpm-ixr-x",
76: 			MDA:  MDAS{{Slot: 1, Type: "not-a-cpm-mda"}},
77: 		}})
78: 
79: 		assert.Empty(t, warnings)
80: 	})
81: 
82: 	t.Run("nested XIOM MDA is not guessed", func(t *testing.T) {
83: 		warnings := info.componentWarnings("SAR-Hx", "", []*Component{{
84: 			Slot: slotAName,
85: 			XIOM: XIOMS{{
86: 				Slot: 1,
87: 				Type: "supported-xiom",
88: 				MDA:  MDAS{{Slot: 1, Type: "not-in-chassis-mda-list"}},
89: 			}},
90: 		}})
91: 
92: 		assert.Empty(t, warnings)
93: 	})
94: }
95: 
96: func TestParseChassisInfoRejectsInvalidJSON(t *testing.T) {
97: 	_, err := parseChassisInfo([]byte(`{"SR-1":`))
98: 	require.Error(t, err)
99: }

(End of file - total 99 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502e926c0017Y1IXn3pTrDqIJ",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e89f6001yZyZ9L3yksryNy",
  "callID": "call_5aa931d8f23e42848e5654cf",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/chassis_info_test.go"
    },
    "output": "<path>/source/head/nodes/sros/chassis_info_test.go</path>\n<type>file</type>\n<content>\n1: // Copyright 2026 Nokia\n2: // Licensed under the BSD 3-Clause License.\n3: // SPDX-License-Identifier: BSD-3-Clause\n4: \n5: package sros\n6: \n7: import (\n8: \t\"testing\"\n9: \n10: \t\"github.com/stretchr/testify/assert\"\n11: \t\"github.com/stretchr/testify/require\"\n12: )\n13: \n14: func TestChassisInfoComponentWarnings(t *testing.T) {\n15: \tinfo, err := parseChassisInfo([]byte(`{\n16: \t\t\"IXR-x\": {\n17: \t\t\t\"cpm\": [\"cpm-ixr-x\"],\n18: \t\t\t\"iom\": [\"imm6-qsfpdd+48-sfp56\"],\n19: \t\t\t\"iom_slots\": 1,\n20: \t\t\t\"mda\": [null],\n21: \t\t\t\"sfm\": [\"sfm-ixr-x\"]\n22: \t\t},\n23: \t\t\"SAR-Hx\": {\n24: \t\t\t\"cpm\": [\"iom-sar-1x\"],\n25: \t\t\t\"fixed_mdas\": {\"2\": \"fixed-mda\"},\n26: \t\t\t\"integrated\": true,\n27: \t\t\t\"mda\": [\"supported-mda\"],\n28: \t\t\t\"xiom\": [\"supported-xiom\"]\n29: \t\t},\n30: \t\t\"SAR-Mx\": {\"alias\": \"SAR-Hx\"}\n31: \t}`))\n32: \trequire.NoError(t, err)\n33: \n34: \tt.Run(\"supported configuration\", func(t *testing.T) {\n35: \t\twarnings := info.componentWarnings(\"sar-mx\", \"\", []*Component{{\n36: \t\t\tSlot: slotAName,\n37: \t\t\tType: \"iom-sar-1x\",\n38: \t\t\tMDA: MDAS{\n39: \t\t\t\t{Slot: 1, Type: \"supported-mda\"},\n40: \t\t\t\t{Slot: 2, Type: \"fixed-mda\"},\n41: \t\t\t},\n42: \t\t\tXIOM: XIOMS{{Slot: 1, Type: \"supported-xiom\"}},\n43: \t\t}})\n44: \n45: \t\tassert.Empty(t, warnings)\n46: \t})\n47: \n48: \tt.Run(\"unsupported values warn\", func(t *testing.T) {\n49: \t\twarnings := info.componentWarnings(\"IXR-x\", \"wrong-sfm\", []*Component{\n50: \t\t\t{Slot: slotAName, Type: \"wrong-cpm\"},\n51: \t\t\t{Slot: \"2\", Type: \"wrong-iom\", MDA: MDAS{{Slot: 1, Type: \"wrong-mda\"}}},\n52: \t\t})\n53: \n54: \t\tassert.Len(t, warnings, 5)\n55: \t\tassert.Contains(t, warnings[0], \"SFM type\")\n56: \t\tassert.Contains(t, warnings[1], \"component type\")\n57: \t\tassert.Contains(t, warnings[2], \"exceeds\")\n58: \t\tassert.Contains(t, warnings[3], \"component type\")\n59: \t\tassert.Contains(t, warnings[4], \"MDA type\")\n60: \t})\n61: \n62: \tt.Run(\"fixed MDA mismatch warns\", func(t *testing.T) {\n63: \t\twarnings := info.componentWarnings(\"SAR-Hx\", \"\", []*Component{{\n64: \t\t\tSlot: slotAName,\n65: \t\t\tMDA:  MDAS{{Slot: 2, Type: \"wrong-mda\"}},\n66: \t\t}})\n67: \n68: \t\trequire.Len(t, warnings, 1)\n69: \t\tassert.Contains(t, warnings[0], \"does not match fixed MDA\")\n70: \t})\n71: \n72: \tt.Run(\"distributed CPM slot does not validate direct MDAs\", func(t *testing.T) {\n73: \t\twarnings := info.componentWarnings(\"IXR-x\", \"\", []*Component{{\n74: \t\t\tSlot: slotAName,\n75: \t\t\tType: \"cpm-ixr-x\",\n76: \t\t\tMDA:  MDAS{{Slot: 1, Type: \"not-a-cpm-mda\"}},\n77: \t\t}})\n78: \n79: \t\tassert.Empty(t, warnings)\n80: \t})\n81: \n82: \tt.Run(\"nested XIOM MDA is not guessed\", func(t *testing.T) {\n83: \t\twarnings := info.componentWarnings(\"SAR-Hx\", \"\", []*Component{{\n84: \t\t\tSlot: slotAName,\n85: \t\t\tXIOM: XIOMS{{\n86: \t\t\t\tSlot: 1,\n87: \t\t\t\tType: \"supported-xiom\",\n88: \t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"not-in-chassis-mda-list\"}},\n89: \t\t\t}},\n90: \t\t}})\n91: \n92: \t\tassert.Empty(t, warnings)\n93: \t})\n94: }\n95: \n96: func TestParseChassisInfoRejectsInvalidJSON(t *testing.T) {\n97: \t_, err := parseChassisInfo([]byte(`{\"SR-1\":`))\n98: \trequire.Error(t, err)\n99: }\n\n(End of file - total 99 lines)\n</content>",
    "title": "source/head/nodes/sros/chassis_info_test.go",
    "metadata": {
      "preview": "// Copyright 2026 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\npackage sros\n\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testify/require\"\n)\n\nfunc TestChassisInfoComponentWarnings(t *testing.T) {\n\tinfo, err := parseChassisInfo([]byte(`{\n\t\t\"IXR-x\": {\n\t\t\t\"cpm\": [\"cpm-ixr-x\"],\n\t\t\t\"iom\": [\"imm6-qsfpdd+48-sfp56\"],\n\t\t\t\"iom_slots\": 1,\n\t\t\t\"mda\": [null],",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/chassis_info_test.go",
        "text": "// Copyright 2026 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\npackage sros\n\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testify/require\"\n)\n\nfunc TestChassisInfoComponentWarnings(t *testing.T) {\n\tinfo, err := parseChassisInfo([]byte(`{\n\t\t\"IXR-x\": {\n\t\t\t\"cpm\": [\"cpm-ixr-x\"],\n\t\t\t\"iom\": [\"imm6-qsfpdd+48-sfp56\"],\n\t\t\t\"iom_slots\": 1,\n\t\t\t\"mda\": [null],\n\t\t\t\"sfm\": [\"sfm-ixr-x\"]\n\t\t},\n\t\t\"SAR-Hx\": {\n\t\t\t\"cpm\": [\"iom-sar-1x\"],\n\t\t\t\"fixed_mdas\": {\"2\": \"fixed-mda\"},\n\t\t\t\"integrated\": true,\n\t\t\t\"mda\": [\"supported-mda\"],\n\t\t\t\"xiom\": [\"supported-xiom\"]\n\t\t},\n\t\t\"SAR-Mx\": {\"alias\": \"SAR-Hx\"}\n\t}`))\n\trequire.NoError(t, err)\n\n\tt.Run(\"supported configuration\", func(t *testing.T) {\n\t\twarnings := info.componentWarnings(\"sar-mx\", \"\", []*Component{{\n\t\t\tSlot: slotAName,\n\t\t\tType: \"iom-sar-1x\",\n\t\t\tMDA: MDAS{\n\t\t\t\t{Slot: 1, Type: \"supported-mda\"},\n\t\t\t\t{Slot: 2, Type: \"fixed-mda\"},\n\t\t\t},\n\t\t\tXIOM: XIOMS{{Slot: 1, Type: \"supported-xiom\"}},\n\t\t}})\n\n\t\tassert.Empty(t, warnings)\n\t})\n\n\tt.Run(\"unsupported values warn\", func(t *testing.T) {\n\t\twarnings := info.componentWarnings(\"IXR-x\", \"wrong-sfm\", []*Component{\n\t\t\t{Slot: slotAName, Type: \"wrong-cpm\"},\n\t\t\t{Slot: \"2\", Type: \"wrong-iom\", MDA: MDAS{{Slot: 1, Type: \"wrong-mda\"}}},\n\t\t})\n\n\t\tassert.Len(t, warnings, 5)\n\t\tassert.Contains(t, warnings[0], \"SFM type\")\n\t\tassert.Contains(t, warnings[1], \"component type\")\n\t\tassert.Contains(t, warnings[2], \"exceeds\")\n\t\tassert.Contains(t, warnings[3], \"component type\")\n\t\tassert.Contains(t, warnings[4], \"MDA type\")\n\t})\n\n\tt.Run(\"fixed MDA mismatch warns\", func(t *testing.T) {\n\t\twarnings := info.componentWarnings(\"SAR-Hx\", \"\", []*Component{{\n\t\t\tSlot: slotAName,\n\t\t\tMDA:  MDAS{{Slot: 2, Type: \"wrong-mda\"}},\n\t\t}})\n\n\t\trequire.Len(t, warnings, 1)\n\t\tassert.Contains(t, warnings[0], \"does not match fixed MDA\")\n\t})\n\n\tt.Run(\"distributed CPM slot does not validate direct MDAs\", func(t *testing.T) {\n\t\twarnings := info.componentWarnings(\"IXR-x\", \"\", []*Component{{\n\t\t\tSlot: slotAName,\n\t\t\tType: \"cpm-ixr-x\",\n\t\t\tMDA:  MDAS{{Slot: 1, Type: \"not-a-cpm-mda\"}},\n\t\t}})\n\n\t\tassert.Empty(t, warnings)\n\t})\n\n\tt.Run(\"nested XIOM MDA is not guessed\", func(t *testing.T) {\n\t\twarnings := info.componentWarnings(\"SAR-Hx\", \"\", []*Component{{\n\t\t\tSlot: slotAName,\n\t\t\tXIOM: XIOMS{{\n\t\t\t\tSlot: 1,\n\t\t\t\tType: \"supported-xiom\",\n\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"not-in-chassis-mda-list\"}},\n\t\t\t}},\n\t\t}})\n\n\t\tassert.Empty(t, warnings)\n\t})\n}\n\nfunc TestParseChassisInfoRejectsInvalidJSON(t *testing.T) {\n\t_, err := parseChassisInfo([]byte(`{\"SR-1\":`))\n\trequire.Error(t, err)\n}",
        "lineStart": 1,
        "lineEnd": 99,
        "totalLines": 99,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346591857,
      "end": 1792346591865
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502e927c001dgS5ArtTLR6RNU",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e89f6001yZyZ9L3yksryNy",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 47978,
    "input": 1094,
    "output": 20,
    "reasoning": 16,
    "cache": {
      "read": 46848,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502e89f6001yZyZ9L3yksryNy",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346589686,
    "completed": 1792346591874
  },
  "parentID": "msg_1502e41aa001XEn2l1GdfLHjHR",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 47978,
    "input": 1094,
    "output": 20,
    "reasoning": 16,
    "cache": {
      "read": 46848,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 18
step-start
{
  "type": "step-start",
  "id": "prt_1502ea1c0001gdM6jnFl8Yq006",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e928b001Djua5Ij7UHMAJo"
}
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/sros_test.go"
}

Output

<path>/source/head/nodes/sros/sros_test.go</path>
<type>file</type>
<content>
1: package sros
2: 
3: import (
4: 	"context"
5: 	"errors"
6: 	"fmt"
7: 	"net"
8: 	"os"
9: 	"path/filepath"
10: 	"slices"
11: 	"strings"
12: 	"testing"
13: 	"time"
14: 
15: 	clabconstants "github.com/srl-labs/containerlab/constants"
16: 	clabmocksmocknodes "github.com/srl-labs/containerlab/mocks/mocknodes"
17: 	clabmocksmockruntime "github.com/srl-labs/containerlab/mocks/mockruntime"
18: 	clabnodes "github.com/srl-labs/containerlab/nodes"
19: 	clabruntime "github.com/srl-labs/containerlab/runtime"
20: 	clabtypes "github.com/srl-labs/containerlab/types"
21: 	"github.com/stretchr/testify/assert"
22: 	"github.com/stretchr/testify/require"
23: 	"go.uber.org/mock/gomock"
24: )
25: 
26: func TestSrosLinkApplyMode(t *testing.T) {
27: 	if got := (&sros{}).LinkApplyMode(context.Background()); got != clabnodes.LinkApplyModeLive {
28: 		t.Fatalf("LinkApplyMode() = %q, want %q", got, clabnodes.LinkApplyModeLive)
29: 	}
30: }
31: 
32: func TestCheckPortWithRetry(t *testing.T) {
33: 	seed, err := net.Listen("tcp", "127.0.0.1:0")
34: 	require.NoError(t, err)
35: 
36: 	addr := seed.Addr().(*net.TCPAddr)
37: 	port := addr.Port
38: 	require.NoError(t, seed.Close())
39: 
40: 	done := make(chan struct{})
41: 	errCh := make(chan error, 1)
42: 	go func() {
43: 		defer close(done)
44: 
45: 		time.Sleep(50 * time.Millisecond)
46: 		ln, err := net.Listen("tcp", fmt.Sprintf("127.0.0.1:%d", port))
47: 		if err != nil {
48: 			errCh <- err
49: 			return
50: 		}
51: 		defer ln.Close()
52: 
53: 		conn, err := ln.Accept()
54: 		if err != nil {
55: 			errCh <- err
56: 			return
57: 		}
58: 		conn.Close()
59: 	}()
60: 
61: 	ok, err := CheckPortWithRetry("127.0.0.1", port, time.Second, 10, 25*time.Millisecond)
62: 	require.NoError(t, err)
63: 	require.True(t, ok)
64: 
65: 	select {
66: 	case <-done:
67: 		select {
68: 		case err := <-errCh:
69: 			require.NoError(t, err)
70: 		default:
71: 		}
72: 	case <-time.After(time.Second):
73: 		t.Fatal("listener did not accept a connection")
74: 	}
75: }
76: 
77: func Test_sros_verifyNokiaSrsimImage(t *testing.T) {
78: 	ctx := context.Background()
79: 
80: 	t.Run("nil_runtime_returns_nil", func(t *testing.T) {
81: 		n := &sros{}
82: 		n.DefaultNode = *clabnodes.NewDefaultNode(n)
83: 		n.Cfg = &clabtypes.NodeConfig{ShortName: "n1", Image: "img"}
84: 		err := n.verifyNokiaSrsimImage(ctx)
85: 		assert.NoError(t, err)
86: 	})
87: 
88: 	t.Run("inspect_not_implemented_returns_nil", func(t *testing.T) {
89: 		ctrl := gomock.NewController(t)
90: 		mockRt := clabmocksmockruntime.NewMockContainerRuntime(ctrl)
91: 		mockRt.EXPECT().
92: 			InspectImage(gomock.Any(), "img").
93: 			Return(nil, fmt.Errorf("InspectImage not implemented for Podman runtime"))
94: 		n := &sros{}
95: 		n.DefaultNode = *clabnodes.NewDefaultNode(n)
96: 		n.Cfg = &clabtypes.NodeConfig{ShortName: "n1", Image: "img"}
97: 		n.WithRuntime(mockRt)
98: 		err := n.verifyNokiaSrsimImage(ctx)
99: 		assert.NoError(t, err)
100: 	})
101: 
102: 	t.Run("image_with_vrnetlab_label_returns_error", func(t *testing.T) {
103: 		ctrl := gomock.NewController(t)
104: 		mockRt := clabmocksmockruntime.NewMockContainerRuntime(ctrl)
105: 		mockRt.EXPECT().
106: 			InspectImage(gomock.Any(), "img").
107: 			Return(&clabruntime.ImageInspect{
108: 				Config: clabruntime.ImageConfig{
109: 					Labels: map[string]string{vrnetlabVersionLabel: "abc"},
110: 				},
111: 			}, nil)
112: 		n := &sros{}
113: 		n.DefaultNode = *clabnodes.NewDefaultNode(n)
114: 		n.Cfg = &clabtypes.NodeConfig{ShortName: "n1", Image: "img"}
115: 		n.WithRuntime(mockRt)
116: 		err := n.verifyNokiaSrsimImage(ctx)
117: 		require.Error(t, err)
118: 		assert.Contains(t, err.Error(), "vrnetlab")
119: 		assert.Contains(t, err.Error(), "n1")
120: 	})
121: 
122: 	t.Run("image_with_srsim_title_returns_nil", func(t *testing.T) {
123: 		ctrl := gomock.NewController(t)
124: 		mockRt := clabmocksmockruntime.NewMockContainerRuntime(ctrl)
125: 		mockRt.EXPECT().
126: 			InspectImage(gomock.Any(), "img").
127: 			Return(&clabruntime.ImageInspect{
128: 				Config: clabruntime.ImageConfig{
129: 					Labels: map[string]string{srosImageTitleLabel: srosImageTitle},
130: 				},
131: 			}, nil)
132: 		n := &sros{}
133: 		n.DefaultNode = *clabnodes.NewDefaultNode(n)
134: 		n.Cfg = &clabtypes.NodeConfig{ShortName: "n1", Image: "img"}
135: 		n.WithRuntime(mockRt)
136: 		err := n.verifyNokiaSrsimImage(ctx)
137: 		assert.NoError(t, err)
138: 	})
139: 
140: 	t.Run("image_without_correct_labels_returns_nil_and_warns", func(t *testing.T) {
141: 		ctrl := gomock.NewController(t)
142: 		mockRt := clabmocksmockruntime.NewMockContainerRuntime(ctrl)
143: 		mockRt.EXPECT().
144: 			InspectImage(gomock.Any(), "img").
145: 			Return(&clabruntime.ImageInspect{
146: 				Config: clabruntime.ImageConfig{
147: 					Labels: map[string]string{"other": "label"},
148: 				},
149: 			}, nil)
150: 		n := &sros{}
151: 		n.DefaultNode = *clabnodes.NewDefaultNode(n)
152: 		n.Cfg = &clabtypes.NodeConfig{ShortName: "n1", Image: "img"}
153: 		n.WithRuntime(mockRt)
154: 		err := n.verifyNokiaSrsimImage(ctx)
155: 		assert.NoError(t, err)
156: 	})
157: }
158: 
159: func Test_sros_buildStartupConfig(t *testing.T) {
160: 	t.Run("full_config_from_file", func(t *testing.T) {
161: 		dir := t.TempDir()
162: 		cfgPath := filepath.Join(dir, "startup.cfg")
163: 		const content = "system name foo\n"
164: 		require.NoError(t, os.WriteFile(cfgPath, []byte(content), 0o600))
165: 
166: 		n := &sros{}
167: 		n.DefaultNode = *clabnodes.NewDefaultNode(n)
168: 		n.Cfg = &clabtypes.NodeConfig{
169: 			ShortName:     "n1",
170: 			LongName:      "lab-n1",
171: 			StartupConfig: cfgPath,
172: 		}
173: 		n.swVersion = &SrosVersion{"0", "0", "0"}
174: 
175: 		cfg, err := n.buildStartupConfig(false) // full config, not partial
176: 		require.NoError(t, err)
177: 		assert.Contains(t, cfg, "system name foo")
178: 	})
179: 
180: 	t.Run("default_and_partial_path", func(t *testing.T) {
181: 		ctrl := gomock.NewController(t)
182: 		mockRt := clabmocksmockruntime.NewMockContainerRuntime(ctrl)
183: 		mockRt.EXPECT().Mgmt().Return(&clabtypes.MgmtNet{MTU: 1500}).AnyTimes()
184: 
185: 		issueCert := false
186: 		n := &sros{}
187: 		n.DefaultNode = *clabnodes.NewDefaultNode(n)
188: 		n.Cfg = &clabtypes.NodeConfig{
189: 			ShortName:     "n1",
190: 			LongName:      "lab-n1",
191: 			NodeType:      "sr-1",
192: 			StartupConfig: "",
193: 			Certificate:   &clabtypes.CertificateConfig{Issue: &issueCert},
194: 			TLSKey:        "",
195: 			TLSCert:       "",
196: 			TLSAnchor:     "",
197: 			LabDir:        t.TempDir(),
198: 		}
199: 		kindSpecificConfig.Of(n.Cfg).ConfigMode = ConfigModeModelDriven
200: 		n.WithRuntime(mockRt)
201: 		n.swVersion = &SrosVersion{"0", "0", "0"}
202: 
203: 		cfg, err := n.buildStartupConfig(true) // no full config; use default + partial
204: 		require.NoError(t, err)
205: 		assert.NotEmpty(t, cfg)
206: 		// Default config should include typical SR OS snippets (banner, system, etc.)
207: 		assert.Contains(t, cfg, "Welcome to Nokia SR OS")
208: 	})
209: }
210: 
211: func Test_sros_generateComponentConfig(t *testing.T) {
212: 	integratedDefaults := []struct {
213: 		name      string
214: 		nodeType  string
215: 		cardType  string
216: 		mdas      MDAS
217: 		powerType string
218: 	}{
219: 		{
220: 			name:     "integrated_sr1_default",
221: 			nodeType: "sr-1",
222: 			cardType: "iom-1",
223: 			mdas: MDAS{
224: 				{Slot: 1, Type: "me6-100gb-qsfp28"},
225: 				{Slot: 2, Type: "me12-100gb-qsfp28"},
226: 			},
227: 		},
228: 		{
229: 			name:      "integrated_sr1s_default",
230: 			nodeType:  "sr-1s",
231: 			cardType:  "xcm-1s",
232: 			mdas:      MDAS{{Slot: 1, Type: "s36-100gb-qsfp28"}},
233: 			powerType: "ps-a4-shelf-dc",
234: 		},
235: 		{
236: 			name:     "integrated_ixr_r6_default",
237: 			nodeType: "ixr-r6",
238: 			cardType: "iom-ixr-r6",
239: 			mdas:     MDAS{{Slot: 1, Type: "m6-10g-sfp++1-100g-qsfp28"}},
240: 		},
241: 		{
242: 			name:     "integrated_ixr_e2_default",
243: 			nodeType: "ixr-e2",
244: 			cardType: "imm2-qsfpdd+2-qsfp28+24-sfp28",
245: 			mdas:     MDAS{{Slot: 1, Type: "m2-qsfpdd+2-qsfp28+24-sfp28"}},
246: 		},
247: 		{
248: 			name:     "integrated_ixr_e2c_default",
249: 			nodeType: "ixr-e2c",
250: 			cardType: "imm12-sfp28+2-qsfp28",
251: 			mdas:     MDAS{{Slot: 1, Type: "m12-sfp28+2-qsfp28"}},
252: 		},
253: 		{
254: 			name:     "integrated_ixr_e2n_default",
255: 			nodeType: "ixr-e2n",
256: 			cardType: "imm4-sfp+4-sfp+",
257: 			mdas:     MDAS{{Slot: 1, Type: "m4-sfp+4-sfp+"}},
258: 		},
259: 		{
260: 			name:     "integrated_ixr_e2n_s_default",
261: 			nodeType: "ixr-e2n-s",
262: 			cardType: "imm4-sfp+4-sfp+-s",
263: 			mdas:     MDAS{{Slot: 1, Type: "m4-sfp+4-sfp+-s"}},
264: 		},
265: 		{
266: 			name:     "integrated_ixr_e3c_default",
267: 			nodeType: "ixr-e3c",
268: 			cardType: "imm4-qsfp28+16-sfp28+8-sfp56",
269: 			mdas:     MDAS{{Slot: 1, Type: "m4-qsfp28+16-sfp28+8-sfp56"}},
270: 		},
271: 		{
272: 			name:     "integrated_ixr_e3x_default",
273: 			nodeType: "ixr-e3x",
274: 			cardType: "imm16-sfp112+15-sfp56+6-qsfpdd",
275: 			mdas:     MDAS{{Slot: 1, Type: "m16-sfp112+15-sfp56+6-qsfpdd"}},
276: 		},
277: 		{
278: 			name:     "integrated_ixr_e2sc_default",
279: 			nodeType: "ixr-e2sc",
280: 			cardType: "imm16-sfp++4-sfp28",
281: 			mdas:     MDAS{{Slot: 1, Type: "m16-sfp++4-sfp28"}},
282: 		},
283: 		{
284: 			name:     "integrated_ixr_ec_default",
285: 			nodeType: "ixr-ec",
286: 			cardType: "imm4-1g-tx+20-1g-sfp+6-10g-sfp+",
287: 			mdas:     MDAS{{Slot: 1, Type: "m4-1g-tx+20-1g-sfp+6-10g-sfp+"}},
288: 		},
289: 	}
290: 	for _, tc := range integratedDefaults {
291: 		t.Run(tc.name, func(t *testing.T) {
292: 			n := newSrosComponentConfigTestNode(tc.nodeType, nil, nil)
293: 
294: 			cfg := n.generateComponentConfig()
295: 
296: 			assert.Contains(
297: 				t,
298: 				cfg,
299: 				fmt.Sprintf("/configure card 1 card-type %s admin-state enable", tc.cardType),
300: 			)
301: 			for _, mda := range tc.mdas {
302: 				assert.Contains(t, cfg, fmt.Sprintf(
303: 					"/configure card 1 mda %d mda-type %s admin-state enable",
304: 					mda.Slot,
305: 					mda.Type,
306: 				))
307: 			}
308: 			if tc.powerType == "" {
309: 				assert.NotContains(t, cfg, "power-shelf")
310: 				assert.NotContains(t, cfg, "power-module")
311: 			} else {
312: 				assert.Contains(
313: 					t,
314: 					cfg,
315: 					fmt.Sprintf("power-shelf 1 power-shelf-type %s", tc.powerType),
316: 				)
317: 				assert.Equal(t, 4, strings.Count(cfg, "power-module-type ps-a-dc-6000"))
318: 			}
319: 		})
320: 	}
321: 
322: 	t.Run("integrated_component_mda_override_preserves_default_mda_slots", func(t *testing.T) {
323: 		n := newSrosComponentConfigTestNode("sr-1", nil, []*Component{
324: 			{MDA: MDAS{{Slot: 1, Type: "custom-mda"}}},
325: 		})
326: 
327: 		cfg := n.generateComponentConfig()
328: 
329: 		assert.Contains(t, cfg, "/configure card 1 card-type iom-1 admin-state enable")
330: 		assert.Contains(t, cfg, "/configure card 1 mda 1 mda-type custom-mda admin-state enable")
331: 		assert.Contains(
332: 			t,
333: 			cfg,
334: 			"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable",
335: 		)
336: 	})
337: 
338: 	t.Run("integrated_xiom_replaces_default_mdas", func(t *testing.T) {
339: 		n := newSrosComponentConfigTestNode("sr-1s", nil, []*Component{
340: 			{
341: 				XIOM: XIOMS{
342: 					{
343: 						Slot: 1,
344: 						Type: "iom-s-3.0t",
345: 						MDA: MDAS{
346: 							{Slot: 1, Type: "ms18-100gb-qsfp28"},
347: 							{Slot: 2, Type: "ms2-400gb-qsfpdd+2-100gb-qsfp28"},
348: 						},
349: 					},
350: 				},
351: 			},
352: 		})
353: 
354: 		cfg := n.generateComponentConfig()
355: 
356: 		assert.Contains(t, cfg, "/configure card 1 card-type xcm-1s admin-state enable")
357: 		assert.Contains(t, cfg, "/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable")
358: 		assert.Contains(
359: 			t,
360: 			cfg,
361: 			"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable",
362: 		)
363: 		assert.Contains(
364: 			t,
365: 			cfg,
366: 			"/configure card 1 xiom x1 mda 2 mda-type ms2-400gb-qsfpdd+2-100gb-qsfp28 admin-state enable",
367: 		)
368: 		assert.NotContains(t, cfg, "s36-100gb-qsfp28")
369: 	})
370: 
371: 	t.Run("integrated_env_mda_overrides_default_component_config", func(t *testing.T) {
372: 		n := newSrosComponentConfigTestNode(
373: 			"sr-1",
374: 			map[string]string{envNokiaSrosMDA + "_1": "env-mda"},
375: 			nil,
376: 		)
377: 
378: 		cfg := n.generateComponentConfig()
379: 
380: 		assert.Contains(
381: 			t,
382: 			cfg,
383: 			"/configure card 1 mda 1 mda-type env-mda admin-state enable",
384: 		)
385: 		assert.Contains(
386: 			t,
387: 			cfg,
388: 			"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable",
389: 		)
390: 		assert.NotContains(t, cfg, "me6-100gb-qsfp28")
391: 	})
392: 
393: 	t.Run("integrated_env_mda_overrides_component_mda", func(t *testing.T) {
394: 		n := newSrosComponentConfigTestNode(
395: 			"sr-1",
396: 			map[string]string{envNokiaSrosMDA + "_1": "from-env"},
397: 			[]*Component{{MDA: MDAS{{Slot: 1, Type: "from-component"}}}},
398: 		)
399: 
400: 		cfg := n.generateComponentConfig()
401: 
402: 		assert.Contains(
403: 			t,
404: 			cfg,
405: 			"/configure card 1 mda 1 mda-type from-env admin-state enable",
406: 		)
407: 		assert.NotContains(t, cfg, "from-component")
408: 	})
409: 
410: 	t.Run("integrated_card_override_skips_component_config", func(t *testing.T) {
411: 		n := newSrosComponentConfigTestNode(
412: 			"sr-1s",
413: 			map[string]string{
414: 				envNokiaSrosCard:       "cpm-1s",
415: 				envNokiaSrosMDA + "_1": "env-mda",
416: 			},
417: 			nil,
418: 		)
419: 
420: 		assert.Empty(t, n.generateComponentConfig())
421: 	})
422: 
423: 	t.Run("integrated_component_override_adds_mda_slot", func(t *testing.T) {
424: 		n := newSrosComponentConfigTestNode("ixr-r6", nil, []*Component{
425: 			{MDA: MDAS{{Slot: 3, Type: "m20-1g-csfp"}}},
426: 		})
427: 
428: 		cfg := n.generateComponentConfig()
429: 
430: 		assert.Contains(
431: 			t,
432: 			cfg,
433: 			"/configure card 1 mda 1 mda-type m6-10g-sfp++1-100g-qsfp28 admin-state enable",
434: 		)
435: 		assert.Contains(t, cfg, "/configure card 1 mda 3 mda-type m20-1g-csfp admin-state enable")
436: 	})
437: 
438: 	t.Run("disabled_component_config_returns_empty", func(t *testing.T) {
439: 		n := newSrosComponentConfigTestNode("sr-1", nil, nil)
440: 		kindSpecificConfig.Of(n.Cfg).GenComponentConfig = false
441: 
442: 		assert.Empty(t, n.generateComponentConfig())
443: 	})
444: 
445: 	t.Run("classic_config_returns_empty", func(t *testing.T) {
446: 		n := newSrosComponentConfigTestNode("sr-1", nil, nil)
447: 		kindSpecificConfig.Of(n.Cfg).ConfigMode = ConfigModeClassic
448: 
449: 		assert.Empty(t, n.generateComponentConfig())
450: 	})
451: 
452: 	t.Run("distributed_components_still_generate", func(t *testing.T) {
453: 		n := newSrosComponentConfigTestNode("sr-2s", nil, nil)
454: 		kindSpecificConfig.Of(n.Cfg).SFM = "sfm-2s"
455: 		n.rootCtrName = "clab-test-sr2s-a"
456: 		n.rootComponents = []*Component{
457: 			{Slot: slotAName, Type: "cpm-2s"},
458: 			{
459: 				Slot: "1",
460: 				Type: "xcm-2s",
461: 				XIOM: XIOMS{
462: 					{
463: 						Slot: 1,
464: 						Type: "iom-s-3.0t",
465: 						MDA:  MDAS{{Slot: 1, Type: "ms18-100gb-qsfp28"}},
466: 					},
467: 				},
468: 			},
469: 		}
470: 
471: 		cfg := n.generateComponentConfig()
472: 
473: 		assert.Contains(t, cfg, "/configure card 1 card-type xcm-2s admin-state enable")
474: 		assert.Contains(t, cfg, "/configure sfm 1 sfm-type sfm-2s admin-state enable")
475: 		assert.Contains(t, cfg, "/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable")
476: 		assert.Contains(
477: 			t,
478: 			cfg,
479: 			"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable",
480: 		)
481: 		assert.Contains(t, cfg, "power-shelf 1 power-shelf-type ps-a4-shelf-dc")
482: 	})
483: }
484: 
485: func Test_sros_integratedComponentOverrides(t *testing.T) {
486: 	t.Run("integrated_component_override_sets_env", func(t *testing.T) {
487: 		n := newSrosInitTestNode("ixr-r6", []*Component{
488: 			{
489: 				Slot: slotBName,
490: 				Type: "cpiom-ixr-r6",
491: 				MDA:  MDAS{{Slot: 3, Type: "m20-1g-csfp"}},
492: 			},
493: 		})
494: 
495: 		err := n.Init(n.Cfg)
496: 
497: 		require.NoError(t, err)
498: 		assert.True(t, n.isStandaloneNode())
499: 		assert.Equal(t, slotBName, n.Cfg.Env[envNokiaSrosSlot])
500: 		assert.Equal(t, "cpiom-ixr-r6", n.Cfg.Env[envNokiaSrosCard])
501: 		assert.Equal(t, "m20-1g-csfp", n.Cfg.Env[envNokiaSrosMDA+"_3"])
502: 
503: 		assert.Empty(t, n.generateComponentConfig())
504: 	})
505: 
506: 	t.Run("integrated_component_xiom_sets_env", func(t *testing.T) {
507: 		n := newSrosInitTestNode("sr-1s", []*Component{
508: 			{
509: 				XIOM: XIOMS{
510: 					{
511: 						Slot: 1,
512: 						Type: "iom-s-3.0t",
513: 						MDA:  MDAS{{Slot: 1, Type: "ms18-100gb-qsfp28"}},
514: 					},
515: 				},
516: 			},
517: 		})
518: 
519: 		require.NoError(t, n.Init(n.Cfg))
520: 		assert.Equal(t, "iom-s-3.0t", n.Cfg.Env[envNokiaSrosXIOM+"_X1"])
521: 		assert.Equal(t, "ms18-100gb-qsfp28", n.Cfg.Env[envNokiaSrosMDA+"_X1_1"])
522: 
523: 		cfg := n.generateComponentConfig()
524: 		assert.Contains(t, cfg, "/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable")
525: 		assert.Contains(
526: 			t,
527: 			cfg,
528: 			"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable",
529: 		)
530: 	})
531: 
532: 	t.Run("integrated_rejects_multiple_components", func(t *testing.T) {
533: 		for _, tc := range []struct {
534: 			nodeType   string
535: 			components []*Component
536: 		}{
537: 			{"sr-1", []*Component{{Slot: slotAName}, {Slot: slotBName}}},
538: 			{"ixr-r6", []*Component{{Slot: slotAName}, {Slot: "1"}}},
539: 			{"ixr-r6", []*Component{{Slot: slotAName}, {}}},
540: 		} {
541: 			n := newSrosInitTestNode(tc.nodeType, tc.components)
542: 
543: 			err := n.Init(n.Cfg)
544: 
545: 			require.Error(t, err, tc.nodeType)
546: 			assert.Contains(t, err.Error(), "at most one component override")
547: 		}
548: 	})
549: 
550: 	t.Run("redundant_integrated_components_are_distributed", func(t *testing.T) {
551: 		n := newSrosInitTestNode("ixr-r6", []*Component{
552: 			{Slot: slotAName, MDA: MDAS{{Slot: 3, Type: "m20-1g-csfp"}}},
553: 			{Slot: slotBName},
554: 		})
555: 
556: 		require.NoError(t, n.Init(n.Cfg))
557: 		assert.True(t, n.isDistributedBaseNode())
558: 		require.Len(t, n.componentNodes, 2)
559: 
560: 		cpmA := n.componentNodes[0].(*sros)
561: 		cpmB := n.componentNodes[1].(*sros)
562: 		assert.Equal(t, slotAName, cpmA.Config().Env[envNokiaSrosSlot])
563: 		assert.Equal(t, slotBName, cpmB.Config().Env[envNokiaSrosSlot])
564: 		assert.Equal(t, "container:n1-netns", cpmA.Config().NetworkMode)
565: 		assert.Equal(t, "container:n1-netns", cpmB.Config().NetworkMode)
566: 
567: 		cfgA := cpmA.generateComponentConfig()
568: 		assert.Contains(t, cfgA, "/configure card 1 card-type iom-ixr-r6 admin-state enable")
569: 		assert.Contains(
570: 			t,
571: 			cfgA,
572: 			"/configure card 1 mda 1 mda-type m6-10g-sfp++1-100g-qsfp28 admin-state enable",
573: 		)
574: 		assert.Contains(t, cfgA, "/configure card 1 mda 3 mda-type m20-1g-csfp admin-state enable")
575: 
576: 		cfgB := cpmB.generateComponentConfig()
577: 		assert.Contains(t, cfgB, "/configure card 1 card-type iom-ixr-r6 admin-state enable")
578: 		assert.NotContains(t, cfgB, "m20-1g-csfp")
579: 	})
580: 
581: 	t.Run("lowercase_integrated_slots_resolve_to_cpm_a", func(t *testing.T) {
582: 		n := newSrosInitTestNode("ixr-r6", []*Component{
583: 			{Slot: "a"},
584: 			{Slot: "b"},
585: 		})
586: 
587: 		require.NoError(t, n.Init(n.Cfg))
588: 		slot, err := n.cpmSlot()
589: 		require.NoError(t, err)
590: 		assert.Equal(t, slotAName, slot)
591: 	})
592: 
593: 	t.Run("node_env_overrides_component_mda", func(t *testing.T) {
594: 		n := newSrosInitTestNode("sr-1", []*Component{
595: 			{MDA: MDAS{{Slot: 1, Type: "from-component"}}},
596: 		})
597: 		n.Cfg.Env = map[string]string{envNokiaSrosMDA + "_1": "from-env"}
598: 
599: 		require.NoError(t, n.Init(n.Cfg))
600: 		assert.Equal(t, "from-env", n.Cfg.Env[envNokiaSrosMDA+"_1"])
601: 
602: 		cfg := n.generateComponentConfig()
603: 		assert.Contains(t, cfg, "/configure card 1 mda 1 mda-type from-env admin-state enable")
604: 		assert.NotContains(t, cfg, "from-component")
605: 	})
606: 
607: 	t.Run("node_env_overrides_sfm", func(t *testing.T) {
608: 		n := newSrosInitTestNode("sr-1", nil)
609: 		kindSpecificConfig.Of(n.Cfg).SFM = "from-sfm"
610: 		n.Cfg.Env = map[string]string{envNokiaSrosSFM: "from-env"}
611: 
612: 		require.NoError(t, n.Init(n.Cfg))
613: 		assert.Equal(t, "from-env", n.Cfg.Env[envNokiaSrosSFM])
614: 	})
615: 
616: 	t.Run("distributed_node_env_overrides_component_mda", func(t *testing.T) {
617: 		n := newSrosInitTestNode("sr-2s", []*Component{
618: 			{Slot: slotAName, Type: "cpm-2s"},
619: 			{
620: 				Slot: "1",
621: 				Type: "xcm-2s",
622: 				MDA:  MDAS{{Slot: 1, Type: "from-component"}},
623: 			},
624: 		})
625: 		n.Cfg.Env = map[string]string{envNokiaSrosMDA + "_1": "from-env"}
626: 
627: 		require.NoError(t, n.Init(n.Cfg))
628: 		require.Len(t, n.componentNodes, 2)
629: 
630: 		linecard := n.componentNodes[1].(*sros)
631: 		assert.Equal(t, "from-env", linecard.Config().Env[envNokiaSrosMDA+"_1"])
632: 
633: 		cfg := n.componentNodes[0].(*sros).generateComponentConfig()
634: 		assert.Contains(t, cfg, "/configure card 1 mda 1 mda-type from-env admin-state enable")
635: 		assert.NotContains(t, cfg, "from-component")
636: 	})
637: 
638: 	t.Run("duplicate_component_slots_are_rejected_regardless_of_case", func(t *testing.T) {
639: 		n := newSrosInitTestNode("sr-2s", []*Component{
640: 			{Slot: "a"},
641: 			{Slot: "A"},
642: 		})
643: 
644: 		err := n.checkComponentSlotsConfig()
645: 
646: 		require.Error(t, err)
647: 		assert.Contains(t, err.Error(), "duplicate")
648: 	})
649: 
650: 	t.Run("sfm_sets_container_env", func(t *testing.T) {
651: 		n := newSrosInitTestNode("sr-1", nil)
652: 		kindSpecificConfig.Of(n.Cfg).SFM = "m-sfm6-7/12"
653: 
654: 		require.NoError(t, n.Init(n.Cfg))
655: 		assert.Equal(t, "m-sfm6-7/12", n.Cfg.Env[envNokiaSrosSFM])
656: 	})
657: 
658: 	t.Run("single_slot_integrated_allows_card_type_override", func(t *testing.T) {
659: 		n := newSrosInitTestNode("ixr-e2n", []*Component{
660: 			{Slot: slotAName, Type: "cpm-ixr-e2n/imm4-sfp+4-sfp+"},
661: 		})
662: 
663: 		require.NoError(t, n.Init(n.Cfg))
664: 		assert.Equal(t, "cpm-ixr-e2n/imm4-sfp+4-sfp+", n.Cfg.Env[envNokiaSrosCard])
665: 		assert.Empty(t, n.generateComponentConfig())
666: 	})
667: 
668: 	t.Run("integrated_rejects_invalid_slot", func(t *testing.T) {
669: 		n := newSrosInitTestNode("ixr-e2", []*Component{
670: 			{Slot: slotBName, Type: "cpm-ixr-e2"},
671: 		})
672: 
673: 		err := n.Init(n.Cfg)
674: 
675: 		require.Error(t, err)
676: 		assert.Contains(t, err.Error(), "expected no slot, or slot A")
677: 	})
678: 
679: 	t.Run("distributed_node_still_uses_components", func(t *testing.T) {
680: 		n := newSrosInitTestNode("sr-2s", []*Component{
681: 			{Slot: slotAName, Type: "cpm-2s"},
682: 			{Slot: "1", Type: "xcm-2s"},
683: 		})
684: 
685: 		err := n.Init(n.Cfg)
686: 
687: 		require.NoError(t, err)
688: 		assert.False(t, n.isStandaloneNode())
689: 		assert.Len(t, n.componentNodes, 2)
690: 	})
691: }
692: 
693: func newSrosComponentConfigTestNode(
694: 	nodeType string,
695: 	env map[string]string,
696: 	components []*Component,
697: ) *sros {
698: 	if env == nil {
699: 		env = map[string]string{}
700: 	}
701: 
702: 	n := &sros{}
703: 	n.DefaultNode = *clabnodes.NewDefaultNode(n)
704: 	n.Cfg = &clabtypes.NodeConfig{
705: 		ShortName: "n1",
706: 		LongName:  "clab-test-n1",
707: 		NodeType:  nodeType,
708: 		Env:       env,
709: 	}
710: 	kindSpecificConfig.Of(n.Cfg).Components = components
711: 	return n
712: }
713: 
714: func newSrosInitTestNode(nodeType string, components []*Component) *sros {
715: 	issueCert := false
716: 	n := &sros{}
717: 	n.Cfg = &clabtypes.NodeConfig{
718: 		ShortName:   "n1",
719: 		LongName:    "clab-test-n1",
720: 		Fqdn:        "n1.clab-test.io",
721: 		NodeType:    nodeType,
722: 		Env:         map[string]string{},
723: 		Sysctls:     map[string]string{},
724: 		Certificate: &clabtypes.CertificateConfig{Issue: &issueCert},
725: 	}
726: 	kindSpecificConfig.Of(n.Cfg).Components = components
727: 	return n
728: }
729: 
730: func TestDistributedComponentsUseNetnsContainer(t *testing.T) {
731: 	components := []*Component{
732: 		{Slot: slotAName},
733: 		{Slot: "2"},
734: 		{Slot: slotBName},
735: 		{Slot: "1"},
736: 	}
737: 	n := newSrosInitTestNode("sr-14s", components)
738: 	n.Cfg.Image = "nokia_srsim:test"
739: 	n.Cfg.RestartPolicy = "unless-stopped"
740: 	n.Cfg.MgmtIPv4Address = "172.20.20.10"
741: 	n.Cfg.Labels = map[string]string{clabconstants.Containerlab: "test"}
742: 
743: 	require.NoError(t, n.Init(n.Cfg))
744: 	require.NotNil(t, n.netnsNode)
745: 	assert.Equal(t, "n1-netns", n.netnsNode.Config().ShortName)
746: 	assert.Equal(t, "clab-test-n1-netns", n.netnsNode.Config().LongName)
747: 	assert.Equal(t, n.Cfg.Image, n.netnsNode.Config().Image)
748: 	assert.Equal(t, "unless-stopped", n.netnsNode.Config().RestartPolicy)
749: 	assert.Equal(t, "true", n.netnsNode.Config().Labels[clabconstants.InternalNode])
750: 	assert.Equal(t, "/bin/sh", n.netnsNode.Config().Entrypoint)
751: 	assert.Equal(
752: 		t,
753: 		`-c "trap 'exit 0' TERM INT; sleep infinity & wait $!"`,
754: 		n.netnsNode.Config().Cmd,
755: 	)
756: 	assert.Equal(t, "srsim-netns", n.netnsNode.Config().Labels[clabconstants.NodeType])
757: 	assert.Empty(t, n.netnsNode.Config().Labels[clabconstants.ToolType])
758: 	assert.Equal(t, n.Cfg.ShortName, n.netnsNode.Config().Labels[clabconstants.RootNodeName])
759: 	assert.Equal(t, n.Cfg.MgmtIPv4Address, n.netnsNode.Config().MgmtIPv4Address)
760: 	assert.Equal(t, n.Cfg.Sysctls, n.netnsNode.Config().Sysctls)
761: 	assert.Empty(t, n.netnsNode.Config().Env)
762: 	assert.Empty(t, n.netnsNode.Config().Binds)
763: 
764: 	require.Len(t, n.componentNodes, len(components))
765: 	for i, component := range n.componentNodes {
766: 		assert.Equal(t, components[i].Slot, component.Config().Env[envNokiaSrosSlot])
767: 		assert.Equal(t, "container:n1-netns", component.Config().NetworkMode)
768: 		assert.Equal(t, n.Cfg.MgmtIPv4Address, component.Config().MgmtIPv4Address)
769: 		assert.Nil(t, component.Config().DNS)
770: 		assert.Nil(t, component.Config().PortBindings)
771: 		assert.Equal(t, n.Cfg.Sysctls, component.Config().Sysctls)
772: 	}
773: }
774: 
775: func TestDistributedHolderOnlyRemainsDiscoverableForDestroy(t *testing.T) {
776: 	ctx := context.Background()
777: 	ctrl := gomock.NewController(t)
778: 	mockRuntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)
779: 	n := newSrosInitTestNode("sr-14s", []*Component{
780: 		{Slot: slotAName},
781: 		{Slot: "1"},
782: 	})
783: 
784: 	require.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(mockRuntime)))
785: 
786: 	holder := clabruntime.GenericContainer{
787: 		Names:  []string{n.netnsNode.Config().LongName},
788: 		Labels: n.netnsNode.Config().Labels,
789: 	}
790: 	mockRuntime.EXPECT().ListContainers(ctx, []*clabtypes.GenericFilter{
791: 		{FilterType: "name", Match: "clab-test-n1-a"},
792: 	}).Return(nil, nil)
793: 	mockRuntime.EXPECT().ListContainers(ctx, []*clabtypes.GenericFilter{
794: 		{FilterType: "name", Match: n.netnsNode.Config().LongName},
795: 	}).Return([]clabruntime.GenericContainer{holder}, nil)
796: 
797: 	got, err := n.GetContainers(ctx)
798: 	require.NoError(t, err)
799: 	require.Equal(t, []clabruntime.GenericContainer{holder}, got)
800: 
801: 	mockRuntime.EXPECT().
802: 		GetContainerStatus(ctx, "clab-test-n1-a").
803: 		Return(clabruntime.NotFound).
804: 		AnyTimes()
805: 	mockRuntime.EXPECT().
806: 		GetContainerStatus(ctx, "clab-test-n1-1").
807: 		Return(clabruntime.NotFound).
808: 		AnyTimes()
809: 	mockRuntime.EXPECT().
810: 		GetContainerStatus(ctx, n.netnsNode.Config().LongName).
811: 		Return(clabruntime.Running)
812: 	mockRuntime.EXPECT().DeleteContainer(ctx, n.netnsNode.Config().LongName).Return(nil)
813: 
814: 	require.NoError(t, n.Delete(ctx))
815: }
816: 
817: func TestDistributedDeleteAttemptsHolderAfterComponentError(t *testing.T) {
818: 	ctx := context.Background()
819: 	ctrl := gomock.NewController(t)
820: 	mockRuntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)
821: 	n := newSrosInitTestNode("sr-14s", []*Component{
822: 		{Slot: slotAName},
823: 		{Slot: "1"},
824: 	})
825: 
826: 	require.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(mockRuntime)))
827: 
828: 	component := clabmocksmocknodes.NewMockNode(ctrl)
829: 	n.componentNodes = []clabnodes.Node{component}
830: 
831: 	deleteErr := errors.New("component deletion failed")
832: 	component.EXPECT().Delete(ctx).Return(deleteErr)
833: 	component.EXPECT().GetContainerStatus(ctx).Return(clabruntime.NotFound)
834: 	mockRuntime.EXPECT().
835: 		GetContainerStatus(ctx, n.netnsNode.Config().LongName).
836: 		Return(clabruntime.Running)
837: 	mockRuntime.EXPECT().DeleteContainer(ctx, n.netnsNode.Config().LongName).Return(nil)
838: 
839: 	require.ErrorIs(t, n.Delete(ctx), deleteErr)
840: }
841: 
842: func TestEnsureNetnsRunning(t *testing.T) {
843: 	ctx := context.Background()
844: 
845: 	t.Run("already running", func(t *testing.T) {
846: 		ctrl := gomock.NewController(t)
847: 		runtime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)
848: 		n := newSrosInitTestNode("sr-14s", []*Component{
849: 			{Slot: slotAName}, {Slot: "1"},
850: 		})
851: 		require.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(runtime)))
852: 		runtime.EXPECT().GetContainerStatus(ctx, n.netnsNode.Config().LongName).
853: 			Return(clabruntime.Running)
854: 
855: 		require.NoError(t, n.ensureNetnsRunning(ctx))
856: 	})
857: 
858: 	t.Run("starts stopped holder", func(t *testing.T) {
859: 		ctrl := gomock.NewController(t)
860: 		runtime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)
861: 		n := newSrosInitTestNode("sr-14s", []*Component{
862: 			{Slot: slotAName}, {Slot: "1"},
863: 		})
864: 		require.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(runtime)))
865: 		runtime.EXPECT().GetContainerStatus(ctx, n.netnsNode.Config().LongName).
866: 			Return(clabruntime.Stopped).Times(2)
867: 		runtime.EXPECT().
868: 			StartContainer(ctx, n.netnsNode.Config().LongName, gomock.Any()).
869: 			Return(nil, nil)
870: 
871: 		require.NoError(t, n.ensureNetnsRunning(ctx))
872: 	})
873: 
874: 	t.Run("missing holder requires recreate", func(t *testing.T) {
875: 		ctrl := gomock.NewController(t)
876: 		runtime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)
877: 		n := newSrosInitTestNode("sr-14s", []*Component{
878: 			{Slot: slotAName}, {Slot: "1"},
879: 		})
880: 		require.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(runtime)))
881: 		runtime.EXPECT().GetContainerStatus(ctx, n.netnsNode.Config().LongName).
882: 			Return(clabruntime.NotFound)
883: 
884: 		err := n.ensureNetnsRunning(ctx)
885: 		require.Error(t, err)
886: 		assert.Contains(t, err.Error(), "recreate the node")
887: 	})
888: }
889: 
890: func TestComponentMgmtEnv(t *testing.T) {
891: 	dualStack := MgmtIP{
892: 		IPv4: "172.20.20.10", IPv4pLen: 24, IPv4Gw: "172.20.20.1",
893: 		IPv6: "3fff:172:20:20::10", IPv6pLen: 64, IPv6Gw: "3fff:172:20:20::1",
894: 	}
895: 	tests := []struct {
896: 		name string
897: 		ips  MgmtIP
898: 		env  map[string]string
899: 		want map[string]string
900: 	}{
901: 		{
902: 			name: "dual stack runtime allocation", ips: dualStack,
903: 			want: map[string]string{
904: 				envSrosIPv4Active: "172.20.20.10/24", envSrosIPv6Active: "3fff:172:20:20::10/64",
905: 				envSrosStaticRoutePrefix + "1": "0.0.0.0/0@172.20.20.1",
906: 				envSrosStaticRoutePrefix + "2": "::/0@3fff:172:20:20::1",
907: 			},
908: 		},
909: 		{
910: 			name: "IPv4 without gateway", ips: MgmtIP{IPv4: "192.0.2.10", IPv4pLen: 27},
911: 			want: map[string]string{envSrosIPv4Active: "192.0.2.10/27"},
912: 		},
913: 		{
914: 			name: "IPv6 only",
915: 			ips:  MgmtIP{IPv6: "2001:db8::10", IPv6pLen: 80, IPv6Gw: "2001:db8::1"},
916: 			want: map[string]string{
917: 				envSrosIPv6Active:              "2001:db8::10/80",
918: 				envSrosStaticRoutePrefix + "2": "::/0@2001:db8::1",
919: 			},
920: 		},
921: 		{name: "no management addresses"},
922: 		{
923: 			name: "explicit IPv4 opts out of both families", ips: dualStack,
924: 			env:  map[string]string{envSrosIPv4Active: "192.0.2.2/24"},
925: 			want: map[string]string{envSrosIPv4Active: "192.0.2.2/24"},
926: 		},
927: 		{
928: 			name: "explicit IPv6", ips: dualStack,
929: 			env:  map[string]string{envSrosIPv6Active: "2001:db8::2/64"},
930: 			want: map[string]string{envSrosIPv6Active: "2001:db8::2/64"},
931: 		},
932: 		{
933: 			name: "explicit route", ips: dualStack,
934: 			env:  map[string]string{envSrosStaticRoutePrefix + "1": "192.0.2.0/24@172.20.20.9"},
935: 			want: map[string]string{envSrosStaticRoutePrefix + "1": "192.0.2.0/24@172.20.20.9"},
936: 		},
937: 		{
938: 			name: "empty explicit route still opts out", ips: dualStack,
939: 			env:  map[string]string{envSrosStaticRoutePrefix + "CUSTOM": ""},
940: 			want: map[string]string{envSrosStaticRoutePrefix + "CUSTOM": ""},
941: 		},
942: 		{
943: 			name: "custom management interface", ips: dualStack,
944: 			env:  map[string]string{"NOKIA_SROS_MGMT_IF": "eth9"},
945: 			want: map[string]string{"NOKIA_SROS_MGMT_IF": "eth9"},
946: 		},
947: 	}
948: 	for _, tt := range tests {
949: 		t.Run(tt.name, func(t *testing.T) {
950: 			n := newSrosInitTestNode("sr-14s", []*Component{
951: 				{Slot: slotAName, Env: tt.env}, {Slot: slotBName}, {Slot: "1"},
952: 			})
953: 			require.NoError(t, n.Init(n.Cfg))
954: 			n.setComponentMgmtEnv(tt.ips)
955: 			got := map[string]string{}
956: 			for key, value := range n.componentNodes[0].Config().Env {
957: 				isAddress := key == envSrosIPv4Active || key == envSrosIPv6Active
958: 				isRoute := strings.HasPrefix(key, envSrosStaticRoutePrefix)
959: 				if isAddress || isRoute || key == "NOKIA_SROS_MGMT_IF" {
960: 					got[key] = value
961: 				}
962: 			}
963: 			if tt.want == nil {
964: 				assert.Empty(t, got)
965: 			} else {
966: 				assert.Equal(t, tt.want, got)
967: 			}
968: 			// A per-CPM override must not suppress automatic configuration for B.
969: 			if tt.ips.IPv4 != "" {
970: 				assert.Equal(t, fmt.Sprintf("%s/%d", tt.ips.IPv4, tt.ips.IPv4pLen),
971: 					n.componentNodes[1].Config().Env[envSrosIPv4Active])
972: 			}
973: 			assert.NotContains(t, n.componentNodes[2].Config().Env, envSrosIPv4Active)
974: 			assert.NotContains(t, n.componentNodes[2].Config().Env, envSrosIPv6Active)
975: 		})
976: 	}
977: }
978: 
979: func TestComponentMgmtEnvOnlyCPMSlots(t *testing.T) {
980: 	for _, slot := range []string{"A", "B", "a", "b", "1", "10", "", "C", "invalid"} {
981: 		t.Run(slot, func(t *testing.T) {
982: 			n := newSrosInitTestNode("sr-14s", []*Component{
983: 				{Slot: slotAName}, {Slot: "1"},
984: 			})
985: 			require.NoError(t, n.Init(n.Cfg))
986: 			env := n.componentNodes[0].Config().Env
987: 			env[envNokiaSrosSlot] = slot
988: 
989: 			n.setComponentMgmtEnv(MgmtIP{
990: 				IPv4: "192.0.2.10", IPv4pLen: 24, IPv4Gw: "192.0.2.1",
991: 				IPv6: "2001:db8::10", IPv6pLen: 64, IPv6Gw: "2001:db8::1",
992: 			})
993: 
994: 			wantMgmt := slot == "A" || slot == "B" || slot == "a" || slot == "b"
995: 			for _, key := range []string{
996: 				envSrosIPv4Active, envSrosIPv6Active,
997: 				envSrosStaticRoutePrefix + "1", envSrosStaticRoutePrefix + "2",
998: 			} {
999: 				_, present := env[key]
1000: 				assert.Equal(t, wantMgmt, present, key)
1001: 			}
1002: 		})
1003: 	}
1004: }
1005: 
1006: func TestDistributedNetnsLookupAndMgmtIPs(t *testing.T) {
1007: 	ctx := context.Background()
1008: 	ctrl := gomock.NewController(t)
1009: 	runtime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)
1010: 	n := newSrosInitTestNode("sr-2s", []*Component{
1011: 		{Slot: slotAName},
1012: 		{Slot: "1"},
1013: 	})
1014: 	require.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(runtime)))
1015: 
1016: 	runtime.EXPECT().GetNSPath(ctx, "clab-test-n1-netns").Return("/proc/123/ns/net", nil)
1017: 	nsPath, err := n.GetNSPath(ctx)
1018: 	require.NoError(t, err)
1019: 	assert.Equal(t, "/proc/123/ns/net", nsPath)
1020: 
1021: 	runtime.EXPECT().
1022: 		ListContainers(gomock.Any(), gomock.Any()).
1023: 		Return([]clabruntime.GenericContainer{{
1024: 			ID: "holder-id",
1025: 			NetworkSettings: clabruntime.GenericMgmtIPs{
1026: 				IPv4addr: "172.20.20.10",
1027: 				IPv4pLen: 24,
1028: 				IPv4Gw:   "172.20.20.1",
1029: 				IPv6addr: "3fff:172:20:20::10",
1030: 				IPv6pLen: 64,
1031: 				IPv6Gw:   "3fff:172:20:20::1",
1032: 			},
1033: 		}}, nil)
1034: 
1035: 	ips, err := n.distNodeMgmtIPs()
1036: 	require.NoError(t, err)
1037: 	assert.Equal(t, "172.20.20.10", ips.IPv4)
1038: 	assert.Equal(t, "3fff:172:20:20::10", ips.IPv6)
1039: 	assert.Equal(t, "holder-id", ips.ContainerID)
1040: 	assert.Equal(t, "172.20.20.1", ips.IPv4Gw)
1041: 	assert.Equal(t, "3fff:172:20:20::1", ips.IPv6Gw)
1042: }
1043: 
1044: func TestNamespaceNodeUsesDefaultLifecycle(t *testing.T) {
1045: 	ctx := context.Background()
1046: 	ctrl := gomock.NewController(t)
1047: 	mockRuntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)
1048: 	n := newSrosInitTestNode("sr-14s", []*Component{
1049: 		{Slot: slotAName}, {Slot: "1"},
1050: 	})
1051: 	require.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(mockRuntime)))
1052: 
1053: 	holder := n.netnsNode
1054: 	require.IsType(t, &namespaceNode{}, holder)
1055: 	require.Same(t, mockRuntime, holder.GetRuntime())
1056: 	mockRuntime.EXPECT().CreateContainer(ctx, holder.Config()).Return("holder-id", nil)
1057: 	mockRuntime.EXPECT().StartContainer(ctx, "holder-id", gomock.Any()).Return(nil, nil)
1058: 	require.NoError(t, holder.Deploy(ctx, nil))
1059: 
1060: 	mockRuntime.EXPECT().GetNSPath(ctx, holder.Config().LongName).Return("/proc/123/ns/net", nil)
1061: 	nsPath, err := n.GetNSPath(ctx)
1062: 	require.NoError(t, err)
1063: 	require.Equal(t, "/proc/123/ns/net", nsPath)
1064: 
1065: 	mockRuntime.EXPECT().
1066: 		GetContainerStatus(ctx, holder.Config().LongName).
1067: 		Return(clabruntime.Running)
1068: 	mockRuntime.EXPECT().DeleteContainer(ctx, holder.Config().LongName).Return(nil)
1069: 	require.NoError(t, holder.Delete(ctx))
1070: }
1071: 
1072: func TestDeployFabricUsesResolvedManagementAddresses(t *testing.T) {
1073: 	ctx := context.Background()
1074: 	ctrl := gomock.NewController(t)
1075: 	mockRuntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)
1076: 	n := newSrosInitTestNode("sr-14s", []*Component{
1077: 		{Slot: slotAName}, {Slot: "1"},
1078: 	})
1079: 	require.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(mockRuntime)))
1080: 
1081: 	n.Cfg.MgmtIPv4Address = "172.20.20.10"
1082: 	n.Cfg.MgmtIPv4AddressAuto = true
1083: 	n.Cfg.MgmtIPv4PrefixLength = 24
1084: 	n.Cfg.MgmtIPv4Gateway = "172.20.20.1"
1085: 	n.Cfg.MgmtIPv6Address = "3fff:172:20:20::10"
1086: 	n.Cfg.MgmtIPv6AddressAuto = true
1087: 	n.Cfg.MgmtIPv6PrefixLength = 64
1088: 	n.Cfg.MgmtIPv6Gateway = "3fff:172:20:20::1"
1089: 
1090: 	var components []clabnodes.Node
1091: 	for _, slot := range []string{slotAName, "1"} {
1092: 		component := clabmocksmocknodes.NewMockNode(ctrl)
1093: 		component.EXPECT().Config().Return(&clabtypes.NodeConfig{
1094: 			Env: map[string]string{envNokiaSrosSlot: slot},
1095: 		}).AnyTimes()
1096: 		component.EXPECT().GetShortName().Return("n1-" + strings.ToLower(slot)).AnyTimes()
1097: 		component.EXPECT().PreDeploy(ctx, gomock.Any()).Return(nil)
1098: 		component.EXPECT().Deploy(ctx, gomock.Any()).Return(nil)
1099: 		components = append(components, component)
1100: 	}
1101: 	n.componentNodes = components
1102: 
1103: 	mockRuntime.EXPECT().
1104: 		CreateContainer(ctx, gomock.Any()).
1105: 		DoAndReturn(func(_ context.Context, cfg *clabtypes.NodeConfig) (string, error) {
1106: 			assert.Equal(t, n.Cfg.MgmtIPv4Address, cfg.MgmtIPv4Address)
1107: 			assert.Equal(t, n.Cfg.MgmtIPv4AddressAuto, cfg.MgmtIPv4AddressAuto)
1108: 			assert.Equal(t, n.Cfg.MgmtIPv4PrefixLength, cfg.MgmtIPv4PrefixLength)
1109: 			assert.Equal(t, n.Cfg.MgmtIPv4Gateway, cfg.MgmtIPv4Gateway)
1110: 			assert.Equal(t, n.Cfg.MgmtIPv6Address, cfg.MgmtIPv6Address)
1111: 			assert.Equal(t, n.Cfg.MgmtIPv6AddressAuto, cfg.MgmtIPv6AddressAuto)
1112: 			assert.Equal(t, n.Cfg.MgmtIPv6PrefixLength, cfg.MgmtIPv6PrefixLength)
1113: 			assert.Equal(t, n.Cfg.MgmtIPv6Gateway, cfg.MgmtIPv6Gateway)
1114: 			return "holder-id", nil
1115: 		})
1116: 	mockRuntime.EXPECT().StartContainer(ctx, "holder-id", gomock.Any()).Return(nil, nil)
1117: 	mockRuntime.EXPECT().
1118: 		ListContainers(gomock.Any(), gomock.Any()).
1119: 		Return([]clabruntime.GenericContainer{{
1120: 			ID: "holder-id",
1121: 			NetworkSettings: clabruntime.GenericMgmtIPs{
1122: 				IPv4addr: n.Cfg.MgmtIPv4Address,
1123: 				IPv4pLen: n.Cfg.MgmtIPv4PrefixLength,
1124: 				IPv4Gw:   n.Cfg.MgmtIPv4Gateway,
1125: 				IPv6addr: n.Cfg.MgmtIPv6Address,
1126: 				IPv6pLen: n.Cfg.MgmtIPv6PrefixLength,
1127: 				IPv6Gw:   n.Cfg.MgmtIPv6Gateway,
1128: 			},
1129: 		}}, nil)
1130: 
1131: 	require.NoError(t, n.deployFabric(ctx, nil))
1132: }
1133: 
1134: func TestNamespaceNodeOnlyForDistributedComponents(t *testing.T) {
1135: 	tests := []struct {
1136: 		name       string
1137: 		nodeType   string
1138: 		components []*Component
1139: 		env        map[string]string
1140: 		wantHolder bool
1141: 	}{
1142: 		{name: "integrated", nodeType: "sr-1"},
1143: 		{
1144: 			name: "integrated component override", nodeType: "sr-1",
1145: 			components: []*Component{{Slot: slotAName}},
1146: 		},
1147: 		{
1148: 			name: "explicit distributed card", nodeType: "sr-14s",
1149: 			env: map[string]string{envNokiaSrosSlot: slotAName},
1150: 		},
1151: 		{
1152: 			name: "distributed components", nodeType: "sr-14s",
1153: 			components: []*Component{{Slot: slotAName}, {Slot: "1"}},
1154: 			wantHolder: true,
1155: 		},
1156: 	}
1157: 
1158: 	for _, tt := range tests {
1159: 		t.Run(tt.name, func(t *testing.T) {
1160: 			n := newSrosInitTestNode(tt.nodeType, tt.components)
1161: 			if tt.env != nil {
1162: 				n.Cfg.Env = tt.env
1163: 			}
1164: 			require.NoError(t, n.Init(n.Cfg))
1165: 			if tt.wantHolder {
1166: 				require.NotNil(t, n.netnsNode)
1167: 			} else {
1168: 				require.Nil(t, n.netnsNode)
1169: 			}
1170: 		})
1171: 	}
1172: }
1173: 
1174: func TestWithoutComponentsDoesNotUseNamespaceHolder(t *testing.T) {
1175: 	for _, tt := range []struct {
1176: 		name       string
1177: 		nodeType   string
1178: 		slot       string
1179: 		components []*Component
1180: 	}{
1181: 		{name: "integrated without components", nodeType: "sr-1"},
1182: 		{name: "integrated empty components", nodeType: "sr-1", components: []*Component{}},
1183: 		{name: "explicit CPM A", nodeType: "sr-14s", slot: "A"},
1184: 		{name: "explicit CPM B", nodeType: "sr-14s", slot: "B"},
1185: 		{name: "explicit line card", nodeType: "sr-14s", slot: "1"},
1186: 	} {
1187: 		t.Run(tt.name, func(t *testing.T) {
1188: 			ctx := context.Background()
1189: 			ctrl := gomock.NewController(t)
1190: 			runtime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)
1191: 			n := newSrosInitTestNode(tt.nodeType, tt.components)
1192: 			if tt.slot != "" {
1193: 				n.Cfg.Env[envNokiaSrosSlot] = tt.slot
1194: 			}
1195: 			require.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(runtime)))
1196: 			require.Nil(t, n.netnsNode)
1197: 			require.Empty(t, n.componentNodes)
1198: 			assert.Empty(t, n.Cfg.NetworkMode)
1199: 
1200: 			// Only the SR-SIM container may be created, started, queried or deleted.
1201: 			// Any additional runtime call for a holder fails the mock expectations.
1202: 			runtime.EXPECT().CreateContainer(ctx, n.Cfg).Return("srsim-id", nil)
1203: 			runtime.EXPECT().StartContainer(ctx, "srsim-id", gomock.Any()).Return(nil, nil)
1204: 			require.NoError(t, n.Deploy(ctx, nil))
1205: 			runtime.EXPECT().GetNSPath(ctx, n.Cfg.LongName).Return("/proc/123/ns/net", nil)
1206: 			nsPath, err := n.GetNSPath(ctx)
1207: 			require.NoError(t, err)
1208: 			assert.Equal(t, "/proc/123/ns/net", nsPath)
1209: 			runtime.EXPECT().GetContainerStatus(ctx, n.Cfg.LongName).Return(clabruntime.Running)
1210: 			runtime.EXPECT().DeleteContainer(ctx, n.Cfg.LongName).Return(nil)
1211: 			require.NoError(t, n.Delete(ctx))
1212: 			require.Nil(t, n.netnsNode)
1213: 		})
1214: 	}
1215: }
1216: 
1217: func TestDistributedComponentNodes(t *testing.T) {
1218: 	tests := map[string]struct {
1219: 		nodeType   string
1220: 		components []*Component
1221: 		want       bool
1222: 	}{
1223: 		"standalone_without_components": {
1224: 			nodeType: "sr-1",
1225: 		},
1226: 		"integrated_with_component": {
1227: 			nodeType: "ixr-r6",
1228: 			components: []*Component{
1229: 				{Slot: slotBName, Type: "cpiom-ixr-r6", MDA: MDAS{{Slot: 3, Type: "m20-1g-csfp"}}},
1230: 			},
1231: 		},
1232: 		"distributed_chassis_single_cpm": {
1233: 			nodeType:   "sr-2s",
1234: 			components: []*Component{{Slot: slotAName, Type: "cpm-2s"}},
1235: 		},
1236: 		"distributed_chassis_cpm_and_linecard": {
1237: 			nodeType: "sr-2s",
1238: 			components: []*Component{
1239: 				{Slot: slotAName, Type: "cpm-2s"},
1240: 				{Slot: "1", Type: "xcm-2s"},
1241: 			},
1242: 			want: true,
1243: 		},
1244: 		"distributed_chassis_dual_cpm": {
1245: 			nodeType:   "sr-7",
1246: 			components: []*Component{{Slot: slotAName}, {Slot: slotBName}},
1247: 			want:       true,
1248: 		},
1249: 	}
1250: 
1251: 	for name, tc := range tests {
1252: 		t.Run(name, func(t *testing.T) {
1253: 			n := newSrosInitTestNode(tc.nodeType, tc.components)
1254: 			require.NoError(t, n.Init(n.Cfg))
1255: 			assert.Equal(t, tc.want, len(n.componentNodes) > 0)
1256: 		})
1257: 	}
1258: }
1259: 
1260: func TestComputeDiffComponents(t *testing.T) {
1261: 	chassis := func(components ...*Component) *clabtypes.NodeConfig {
1262: 		kc := &KindSpecificConfig{GenComponentConfig: true, Components: components}
1263: 		return &clabtypes.NodeConfig{Kind: "nokia_srsim", NodeType: "sr-2s", KindSpecificConfig: kc}
1264: 	}
1265: 
1266: 	tests := map[string]struct {
1267: 		old, new *clabtypes.NodeConfig
1268: 		want     bool
1269: 	}{
1270: 		"same_components": {
1271: 			old: chassis(
1272: 				&Component{Slot: "A", Type: "cpm-2s"},
1273: 				&Component{Slot: "1", Type: "xcm-2s"},
1274: 			),
1275: 			new: chassis(
1276: 				&Component{Slot: "A", Type: "cpm-2s"},
1277: 				&Component{Slot: "1", Type: "xcm-2s"},
1278: 			),
1279: 		},
1280: 		"reordered_components": {
1281: 			old: chassis(
1282: 				&Component{Slot: "A", Type: "cpm-2s"},
1283: 				&Component{Slot: "1", Type: "xcm-2s"},
1284: 			),
1285: 			new: chassis(
1286: 				&Component{Slot: "1", Type: "xcm-2s"},
1287: 				&Component{Slot: "A", Type: "cpm-2s"},
1288: 			),
1289: 		},
1290: 		"slot_case_only": {
1291: 			old: chassis(&Component{Slot: "a", Type: "cpm-2s"}),
1292: 			new: chassis(&Component{Slot: "A", Type: "cpm-2s"}),
1293: 		},
1294: 		"card_type_changed": {
1295: 			old:  chassis(&Component{Slot: "1", Type: "xcm-2s"}),
1296: 			new:  chassis(&Component{Slot: "1", Type: "xcm-1s"}),
1297: 			want: true,
1298: 		},
1299: 		"component_added": {
1300: 			old: chassis(&Component{Slot: "A", Type: "cpm-2s"}),
1301: 			new: chassis(
1302: 				&Component{Slot: "A", Type: "cpm-2s"},
1303: 				&Component{Slot: "1", Type: "xcm-2s"},
1304: 			),
1305: 			want: true,
1306: 		},
1307: 		"other_key_changed": {
1308: 			old: chassis(&Component{Slot: "A", Type: "cpm-2s"}),
1309: 			new: func() *clabtypes.NodeConfig {
1310: 				c := chassis(&Component{Slot: "A", Type: "cpm-2s"})
1311: 				c.KindSpecificConfig.(*KindSpecificConfig).SFM = "sfm-2s"
1312: 				return c
1313: 			}(),
1314: 			want: true,
1315: 		},
1316: 	}
1317: 
1318: 	for name, tc := range tests {
1319: 		t.Run(name, func(t *testing.T) {
1320: 			n := &sros{}
1321: 			n.DefaultNode = *clabnodes.NewDefaultNode(n)
1322: 
1323: 			diff := n.ComputeDiff(tc.old, tc.new)
1324: 			assert.Equal(
1325: 				t,
1326: 				tc.want,
1327: 				slices.Contains(diff.Fields, "KindSpecificConfig"),
1328: 				"fields %v",
1329: 				diff.Fields,
1330: 			)
1331: 		})
1332: 	}
1333: }
1334: 
1335: // Sub-nodes must use the parent's runtime, which is bound to the parent's management network.
1336: func TestDistributedSubNodesUseParentRuntime(t *testing.T) {
1337: 	rt := clabmocksmockruntime.NewMockContainerRuntime(gomock.NewController(t))
1338: 	rt.EXPECT().Mgmt().Return(&clabtypes.MgmtNet{Network: "oob"}).AnyTimes()
1339: 
1340: 	n := newSrosInitTestNode("sr-14s", []*Component{{Slot: slotAName}, {Slot: "1"}})
1341: 	n.Cfg.MgmtNet = "oob"
1342: 	require.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(rt)))
1343: 
1344: 	require.NotNil(t, n.netnsNode)
1345: 	assert.Same(t, rt, n.netnsNode.GetRuntime())
1346: 	assert.Equal(t, "oob", n.netnsNode.Config().MgmtNet)
1347: 	require.Len(t, n.componentNodes, 2)
1348: 	for _, c := range n.componentNodes {
1349: 		assert.Same(t, rt, c.GetRuntime(), "component %s", c.Config().ShortName)
1350: 	}
1351: }

(End of file - total 1351 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502ea1f40018m1qtuH3aEEWqV",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e928b001Djua5Ij7UHMAJo",
  "callID": "call_35bbaa59586d4dca94afd56b",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/sros_test.go"
    },
    "output": "<path>/source/head/nodes/sros/sros_test.go</path>\n<type>file</type>\n<content>\n1: package sros\n2: \n3: import (\n4: \t\"context\"\n5: \t\"errors\"\n6: \t\"fmt\"\n7: \t\"net\"\n8: \t\"os\"\n9: \t\"path/filepath\"\n10: \t\"slices\"\n11: \t\"strings\"\n12: \t\"testing\"\n13: \t\"time\"\n14: \n15: \tclabconstants \"github.com/srl-labs/containerlab/constants\"\n16: \tclabmocksmocknodes \"github.com/srl-labs/containerlab/mocks/mocknodes\"\n17: \tclabmocksmockruntime \"github.com/srl-labs/containerlab/mocks/mockruntime\"\n18: \tclabnodes \"github.com/srl-labs/containerlab/nodes\"\n19: \tclabruntime \"github.com/srl-labs/containerlab/runtime\"\n20: \tclabtypes \"github.com/srl-labs/containerlab/types\"\n21: \t\"github.com/stretchr/testify/assert\"\n22: \t\"github.com/stretchr/testify/require\"\n23: \t\"go.uber.org/mock/gomock\"\n24: )\n25: \n26: func TestSrosLinkApplyMode(t *testing.T) {\n27: \tif got := (&sros{}).LinkApplyMode(context.Background()); got != clabnodes.LinkApplyModeLive {\n28: \t\tt.Fatalf(\"LinkApplyMode() = %q, want %q\", got, clabnodes.LinkApplyModeLive)\n29: \t}\n30: }\n31: \n32: func TestCheckPortWithRetry(t *testing.T) {\n33: \tseed, err := net.Listen(\"tcp\", \"127.0.0.1:0\")\n34: \trequire.NoError(t, err)\n35: \n36: \taddr := seed.Addr().(*net.TCPAddr)\n37: \tport := addr.Port\n38: \trequire.NoError(t, seed.Close())\n39: \n40: \tdone := make(chan struct{})\n41: \terrCh := make(chan error, 1)\n42: \tgo func() {\n43: \t\tdefer close(done)\n44: \n45: \t\ttime.Sleep(50 * time.Millisecond)\n46: \t\tln, err := net.Listen(\"tcp\", fmt.Sprintf(\"127.0.0.1:%d\", port))\n47: \t\tif err != nil {\n48: \t\t\terrCh <- err\n49: \t\t\treturn\n50: \t\t}\n51: \t\tdefer ln.Close()\n52: \n53: \t\tconn, err := ln.Accept()\n54: \t\tif err != nil {\n55: \t\t\terrCh <- err\n56: \t\t\treturn\n57: \t\t}\n58: \t\tconn.Close()\n59: \t}()\n60: \n61: \tok, err := CheckPortWithRetry(\"127.0.0.1\", port, time.Second, 10, 25*time.Millisecond)\n62: \trequire.NoError(t, err)\n63: \trequire.True(t, ok)\n64: \n65: \tselect {\n66: \tcase <-done:\n67: \t\tselect {\n68: \t\tcase err := <-errCh:\n69: \t\t\trequire.NoError(t, err)\n70: \t\tdefault:\n71: \t\t}\n72: \tcase <-time.After(time.Second):\n73: \t\tt.Fatal(\"listener did not accept a connection\")\n74: \t}\n75: }\n76: \n77: func Test_sros_verifyNokiaSrsimImage(t *testing.T) {\n78: \tctx := context.Background()\n79: \n80: \tt.Run(\"nil_runtime_returns_nil\", func(t *testing.T) {\n81: \t\tn := &sros{}\n82: \t\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n83: \t\tn.Cfg = &clabtypes.NodeConfig{ShortName: \"n1\", Image: \"img\"}\n84: \t\terr := n.verifyNokiaSrsimImage(ctx)\n85: \t\tassert.NoError(t, err)\n86: \t})\n87: \n88: \tt.Run(\"inspect_not_implemented_returns_nil\", func(t *testing.T) {\n89: \t\tctrl := gomock.NewController(t)\n90: \t\tmockRt := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n91: \t\tmockRt.EXPECT().\n92: \t\t\tInspectImage(gomock.Any(), \"img\").\n93: \t\t\tReturn(nil, fmt.Errorf(\"InspectImage not implemented for Podman runtime\"))\n94: \t\tn := &sros{}\n95: \t\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n96: \t\tn.Cfg = &clabtypes.NodeConfig{ShortName: \"n1\", Image: \"img\"}\n97: \t\tn.WithRuntime(mockRt)\n98: \t\terr := n.verifyNokiaSrsimImage(ctx)\n99: \t\tassert.NoError(t, err)\n100: \t})\n101: \n102: \tt.Run(\"image_with_vrnetlab_label_returns_error\", func(t *testing.T) {\n103: \t\tctrl := gomock.NewController(t)\n104: \t\tmockRt := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n105: \t\tmockRt.EXPECT().\n106: \t\t\tInspectImage(gomock.Any(), \"img\").\n107: \t\t\tReturn(&clabruntime.ImageInspect{\n108: \t\t\t\tConfig: clabruntime.ImageConfig{\n109: \t\t\t\t\tLabels: map[string]string{vrnetlabVersionLabel: \"abc\"},\n110: \t\t\t\t},\n111: \t\t\t}, nil)\n112: \t\tn := &sros{}\n113: \t\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n114: \t\tn.Cfg = &clabtypes.NodeConfig{ShortName: \"n1\", Image: \"img\"}\n115: \t\tn.WithRuntime(mockRt)\n116: \t\terr := n.verifyNokiaSrsimImage(ctx)\n117: \t\trequire.Error(t, err)\n118: \t\tassert.Contains(t, err.Error(), \"vrnetlab\")\n119: \t\tassert.Contains(t, err.Error(), \"n1\")\n120: \t})\n121: \n122: \tt.Run(\"image_with_srsim_title_returns_nil\", func(t *testing.T) {\n123: \t\tctrl := gomock.NewController(t)\n124: \t\tmockRt := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n125: \t\tmockRt.EXPECT().\n126: \t\t\tInspectImage(gomock.Any(), \"img\").\n127: \t\t\tReturn(&clabruntime.ImageInspect{\n128: \t\t\t\tConfig: clabruntime.ImageConfig{\n129: \t\t\t\t\tLabels: map[string]string{srosImageTitleLabel: srosImageTitle},\n130: \t\t\t\t},\n131: \t\t\t}, nil)\n132: \t\tn := &sros{}\n133: \t\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n134: \t\tn.Cfg = &clabtypes.NodeConfig{ShortName: \"n1\", Image: \"img\"}\n135: \t\tn.WithRuntime(mockRt)\n136: \t\terr := n.verifyNokiaSrsimImage(ctx)\n137: \t\tassert.NoError(t, err)\n138: \t})\n139: \n140: \tt.Run(\"image_without_correct_labels_returns_nil_and_warns\", func(t *testing.T) {\n141: \t\tctrl := gomock.NewController(t)\n142: \t\tmockRt := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n143: \t\tmockRt.EXPECT().\n144: \t\t\tInspectImage(gomock.Any(), \"img\").\n145: \t\t\tReturn(&clabruntime.ImageInspect{\n146: \t\t\t\tConfig: clabruntime.ImageConfig{\n147: \t\t\t\t\tLabels: map[string]string{\"other\": \"label\"},\n148: \t\t\t\t},\n149: \t\t\t}, nil)\n150: \t\tn := &sros{}\n151: \t\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n152: \t\tn.Cfg = &clabtypes.NodeConfig{ShortName: \"n1\", Image: \"img\"}\n153: \t\tn.WithRuntime(mockRt)\n154: \t\terr := n.verifyNokiaSrsimImage(ctx)\n155: \t\tassert.NoError(t, err)\n156: \t})\n157: }\n158: \n159: func Test_sros_buildStartupConfig(t *testing.T) {\n160: \tt.Run(\"full_config_from_file\", func(t *testing.T) {\n161: \t\tdir := t.TempDir()\n162: \t\tcfgPath := filepath.Join(dir, \"startup.cfg\")\n163: \t\tconst content = \"system name foo\\n\"\n164: \t\trequire.NoError(t, os.WriteFile(cfgPath, []byte(content), 0o600))\n165: \n166: \t\tn := &sros{}\n167: \t\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n168: \t\tn.Cfg = &clabtypes.NodeConfig{\n169: \t\t\tShortName:     \"n1\",\n170: \t\t\tLongName:      \"lab-n1\",\n171: \t\t\tStartupConfig: cfgPath,\n172: \t\t}\n173: \t\tn.swVersion = &SrosVersion{\"0\", \"0\", \"0\"}\n174: \n175: \t\tcfg, err := n.buildStartupConfig(false) // full config, not partial\n176: \t\trequire.NoError(t, err)\n177: \t\tassert.Contains(t, cfg, \"system name foo\")\n178: \t})\n179: \n180: \tt.Run(\"default_and_partial_path\", func(t *testing.T) {\n181: \t\tctrl := gomock.NewController(t)\n182: \t\tmockRt := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n183: \t\tmockRt.EXPECT().Mgmt().Return(&clabtypes.MgmtNet{MTU: 1500}).AnyTimes()\n184: \n185: \t\tissueCert := false\n186: \t\tn := &sros{}\n187: \t\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n188: \t\tn.Cfg = &clabtypes.NodeConfig{\n189: \t\t\tShortName:     \"n1\",\n190: \t\t\tLongName:      \"lab-n1\",\n191: \t\t\tNodeType:      \"sr-1\",\n192: \t\t\tStartupConfig: \"\",\n193: \t\t\tCertificate:   &clabtypes.CertificateConfig{Issue: &issueCert},\n194: \t\t\tTLSKey:        \"\",\n195: \t\t\tTLSCert:       \"\",\n196: \t\t\tTLSAnchor:     \"\",\n197: \t\t\tLabDir:        t.TempDir(),\n198: \t\t}\n199: \t\tkindSpecificConfig.Of(n.Cfg).ConfigMode = ConfigModeModelDriven\n200: \t\tn.WithRuntime(mockRt)\n201: \t\tn.swVersion = &SrosVersion{\"0\", \"0\", \"0\"}\n202: \n203: \t\tcfg, err := n.buildStartupConfig(true) // no full config; use default + partial\n204: \t\trequire.NoError(t, err)\n205: \t\tassert.NotEmpty(t, cfg)\n206: \t\t// Default config should include typical SR OS snippets (banner, system, etc.)\n207: \t\tassert.Contains(t, cfg, \"Welcome to Nokia SR OS\")\n208: \t})\n209: }\n210: \n211: func Test_sros_generateComponentConfig(t *testing.T) {\n212: \tintegratedDefaults := []struct {\n213: \t\tname      string\n214: \t\tnodeType  string\n215: \t\tcardType  string\n216: \t\tmdas      MDAS\n217: \t\tpowerType string\n218: \t}{\n219: \t\t{\n220: \t\t\tname:     \"integrated_sr1_default\",\n221: \t\t\tnodeType: \"sr-1\",\n222: \t\t\tcardType: \"iom-1\",\n223: \t\t\tmdas: MDAS{\n224: \t\t\t\t{Slot: 1, Type: \"me6-100gb-qsfp28\"},\n225: \t\t\t\t{Slot: 2, Type: \"me12-100gb-qsfp28\"},\n226: \t\t\t},\n227: \t\t},\n228: \t\t{\n229: \t\t\tname:      \"integrated_sr1s_default\",\n230: \t\t\tnodeType:  \"sr-1s\",\n231: \t\t\tcardType:  \"xcm-1s\",\n232: \t\t\tmdas:      MDAS{{Slot: 1, Type: \"s36-100gb-qsfp28\"}},\n233: \t\t\tpowerType: \"ps-a4-shelf-dc\",\n234: \t\t},\n235: \t\t{\n236: \t\t\tname:     \"integrated_ixr_r6_default\",\n237: \t\t\tnodeType: \"ixr-r6\",\n238: \t\t\tcardType: \"iom-ixr-r6\",\n239: \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m6-10g-sfp++1-100g-qsfp28\"}},\n240: \t\t},\n241: \t\t{\n242: \t\t\tname:     \"integrated_ixr_e2_default\",\n243: \t\t\tnodeType: \"ixr-e2\",\n244: \t\t\tcardType: \"imm2-qsfpdd+2-qsfp28+24-sfp28\",\n245: \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m2-qsfpdd+2-qsfp28+24-sfp28\"}},\n246: \t\t},\n247: \t\t{\n248: \t\t\tname:     \"integrated_ixr_e2c_default\",\n249: \t\t\tnodeType: \"ixr-e2c\",\n250: \t\t\tcardType: \"imm12-sfp28+2-qsfp28\",\n251: \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m12-sfp28+2-qsfp28\"}},\n252: \t\t},\n253: \t\t{\n254: \t\t\tname:     \"integrated_ixr_e2n_default\",\n255: \t\t\tnodeType: \"ixr-e2n\",\n256: \t\t\tcardType: \"imm4-sfp+4-sfp+\",\n257: \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m4-sfp+4-sfp+\"}},\n258: \t\t},\n259: \t\t{\n260: \t\t\tname:     \"integrated_ixr_e2n_s_default\",\n261: \t\t\tnodeType: \"ixr-e2n-s\",\n262: \t\t\tcardType: \"imm4-sfp+4-sfp+-s\",\n263: \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m4-sfp+4-sfp+-s\"}},\n264: \t\t},\n265: \t\t{\n266: \t\t\tname:     \"integrated_ixr_e3c_default\",\n267: \t\t\tnodeType: \"ixr-e3c\",\n268: \t\t\tcardType: \"imm4-qsfp28+16-sfp28+8-sfp56\",\n269: \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m4-qsfp28+16-sfp28+8-sfp56\"}},\n270: \t\t},\n271: \t\t{\n272: \t\t\tname:     \"integrated_ixr_e3x_default\",\n273: \t\t\tnodeType: \"ixr-e3x\",\n274: \t\t\tcardType: \"imm16-sfp112+15-sfp56+6-qsfpdd\",\n275: \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"}},\n276: \t\t},\n277: \t\t{\n278: \t\t\tname:     \"integrated_ixr_e2sc_default\",\n279: \t\t\tnodeType: \"ixr-e2sc\",\n280: \t\t\tcardType: \"imm16-sfp++4-sfp28\",\n281: \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m16-sfp++4-sfp28\"}},\n282: \t\t},\n283: \t\t{\n284: \t\t\tname:     \"integrated_ixr_ec_default\",\n285: \t\t\tnodeType: \"ixr-ec\",\n286: \t\t\tcardType: \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n287: \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\"}},\n288: \t\t},\n289: \t}\n290: \tfor _, tc := range integratedDefaults {\n291: \t\tt.Run(tc.name, func(t *testing.T) {\n292: \t\t\tn := newSrosComponentConfigTestNode(tc.nodeType, nil, nil)\n293: \n294: \t\t\tcfg := n.generateComponentConfig()\n295: \n296: \t\t\tassert.Contains(\n297: \t\t\t\tt,\n298: \t\t\t\tcfg,\n299: \t\t\t\tfmt.Sprintf(\"/configure card 1 card-type %s admin-state enable\", tc.cardType),\n300: \t\t\t)\n301: \t\t\tfor _, mda := range tc.mdas {\n302: \t\t\t\tassert.Contains(t, cfg, fmt.Sprintf(\n303: \t\t\t\t\t\"/configure card 1 mda %d mda-type %s admin-state enable\",\n304: \t\t\t\t\tmda.Slot,\n305: \t\t\t\t\tmda.Type,\n306: \t\t\t\t))\n307: \t\t\t}\n308: \t\t\tif tc.powerType == \"\" {\n309: \t\t\t\tassert.NotContains(t, cfg, \"power-shelf\")\n310: \t\t\t\tassert.NotContains(t, cfg, \"power-module\")\n311: \t\t\t} else {\n312: \t\t\t\tassert.Contains(\n313: \t\t\t\t\tt,\n314: \t\t\t\t\tcfg,\n315: \t\t\t\t\tfmt.Sprintf(\"power-shelf 1 power-shelf-type %s\", tc.powerType),\n316: \t\t\t\t)\n317: \t\t\t\tassert.Equal(t, 4, strings.Count(cfg, \"power-module-type ps-a-dc-6000\"))\n318: \t\t\t}\n319: \t\t})\n320: \t}\n321: \n322: \tt.Run(\"integrated_component_mda_override_preserves_default_mda_slots\", func(t *testing.T) {\n323: \t\tn := newSrosComponentConfigTestNode(\"sr-1\", nil, []*Component{\n324: \t\t\t{MDA: MDAS{{Slot: 1, Type: \"custom-mda\"}}},\n325: \t\t})\n326: \n327: \t\tcfg := n.generateComponentConfig()\n328: \n329: \t\tassert.Contains(t, cfg, \"/configure card 1 card-type iom-1 admin-state enable\")\n330: \t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type custom-mda admin-state enable\")\n331: \t\tassert.Contains(\n332: \t\t\tt,\n333: \t\t\tcfg,\n334: \t\t\t\"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable\",\n335: \t\t)\n336: \t})\n337: \n338: \tt.Run(\"integrated_xiom_replaces_default_mdas\", func(t *testing.T) {\n339: \t\tn := newSrosComponentConfigTestNode(\"sr-1s\", nil, []*Component{\n340: \t\t\t{\n341: \t\t\t\tXIOM: XIOMS{\n342: \t\t\t\t\t{\n343: \t\t\t\t\t\tSlot: 1,\n344: \t\t\t\t\t\tType: \"iom-s-3.0t\",\n345: \t\t\t\t\t\tMDA: MDAS{\n346: \t\t\t\t\t\t\t{Slot: 1, Type: \"ms18-100gb-qsfp28\"},\n347: \t\t\t\t\t\t\t{Slot: 2, Type: \"ms2-400gb-qsfpdd+2-100gb-qsfp28\"},\n348: \t\t\t\t\t\t},\n349: \t\t\t\t\t},\n350: \t\t\t\t},\n351: \t\t\t},\n352: \t\t})\n353: \n354: \t\tcfg := n.generateComponentConfig()\n355: \n356: \t\tassert.Contains(t, cfg, \"/configure card 1 card-type xcm-1s admin-state enable\")\n357: \t\tassert.Contains(t, cfg, \"/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\")\n358: \t\tassert.Contains(\n359: \t\t\tt,\n360: \t\t\tcfg,\n361: \t\t\t\"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\",\n362: \t\t)\n363: \t\tassert.Contains(\n364: \t\t\tt,\n365: \t\t\tcfg,\n366: \t\t\t\"/configure card 1 xiom x1 mda 2 mda-type ms2-400gb-qsfpdd+2-100gb-qsfp28 admin-state enable\",\n367: \t\t)\n368: \t\tassert.NotContains(t, cfg, \"s36-100gb-qsfp28\")\n369: \t})\n370: \n371: \tt.Run(\"integrated_env_mda_overrides_default_component_config\", func(t *testing.T) {\n372: \t\tn := newSrosComponentConfigTestNode(\n373: \t\t\t\"sr-1\",\n374: \t\t\tmap[string]string{envNokiaSrosMDA + \"_1\": \"env-mda\"},\n375: \t\t\tnil,\n376: \t\t)\n377: \n378: \t\tcfg := n.generateComponentConfig()\n379: \n380: \t\tassert.Contains(\n381: \t\t\tt,\n382: \t\t\tcfg,\n383: \t\t\t\"/configure card 1 mda 1 mda-type env-mda admin-state enable\",\n384: \t\t)\n385: \t\tassert.Contains(\n386: \t\t\tt,\n387: \t\t\tcfg,\n388: \t\t\t\"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable\",\n389: \t\t)\n390: \t\tassert.NotContains(t, cfg, \"me6-100gb-qsfp28\")\n391: \t})\n392: \n393: \tt.Run(\"integrated_env_mda_overrides_component_mda\", func(t *testing.T) {\n394: \t\tn := newSrosComponentConfigTestNode(\n395: \t\t\t\"sr-1\",\n396: \t\t\tmap[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"},\n397: \t\t\t[]*Component{{MDA: MDAS{{Slot: 1, Type: \"from-component\"}}}},\n398: \t\t)\n399: \n400: \t\tcfg := n.generateComponentConfig()\n401: \n402: \t\tassert.Contains(\n403: \t\t\tt,\n404: \t\t\tcfg,\n405: \t\t\t\"/configure card 1 mda 1 mda-type from-env admin-state enable\",\n406: \t\t)\n407: \t\tassert.NotContains(t, cfg, \"from-component\")\n408: \t})\n409: \n410: \tt.Run(\"integrated_card_override_skips_component_config\", func(t *testing.T) {\n411: \t\tn := newSrosComponentConfigTestNode(\n412: \t\t\t\"sr-1s\",\n413: \t\t\tmap[string]string{\n414: \t\t\t\tenvNokiaSrosCard:       \"cpm-1s\",\n415: \t\t\t\tenvNokiaSrosMDA + \"_1\": \"env-mda\",\n416: \t\t\t},\n417: \t\t\tnil,\n418: \t\t)\n419: \n420: \t\tassert.Empty(t, n.generateComponentConfig())\n421: \t})\n422: \n423: \tt.Run(\"integrated_component_override_adds_mda_slot\", func(t *testing.T) {\n424: \t\tn := newSrosComponentConfigTestNode(\"ixr-r6\", nil, []*Component{\n425: \t\t\t{MDA: MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}}},\n426: \t\t})\n427: \n428: \t\tcfg := n.generateComponentConfig()\n429: \n430: \t\tassert.Contains(\n431: \t\t\tt,\n432: \t\t\tcfg,\n433: \t\t\t\"/configure card 1 mda 1 mda-type m6-10g-sfp++1-100g-qsfp28 admin-state enable\",\n434: \t\t)\n435: \t\tassert.Contains(t, cfg, \"/configure card 1 mda 3 mda-type m20-1g-csfp admin-state enable\")\n436: \t})\n437: \n438: \tt.Run(\"disabled_component_config_returns_empty\", func(t *testing.T) {\n439: \t\tn := newSrosComponentConfigTestNode(\"sr-1\", nil, nil)\n440: \t\tkindSpecificConfig.Of(n.Cfg).GenComponentConfig = false\n441: \n442: \t\tassert.Empty(t, n.generateComponentConfig())\n443: \t})\n444: \n445: \tt.Run(\"classic_config_returns_empty\", func(t *testing.T) {\n446: \t\tn := newSrosComponentConfigTestNode(\"sr-1\", nil, nil)\n447: \t\tkindSpecificConfig.Of(n.Cfg).ConfigMode = ConfigModeClassic\n448: \n449: \t\tassert.Empty(t, n.generateComponentConfig())\n450: \t})\n451: \n452: \tt.Run(\"distributed_components_still_generate\", func(t *testing.T) {\n453: \t\tn := newSrosComponentConfigTestNode(\"sr-2s\", nil, nil)\n454: \t\tkindSpecificConfig.Of(n.Cfg).SFM = \"sfm-2s\"\n455: \t\tn.rootCtrName = \"clab-test-sr2s-a\"\n456: \t\tn.rootComponents = []*Component{\n457: \t\t\t{Slot: slotAName, Type: \"cpm-2s\"},\n458: \t\t\t{\n459: \t\t\t\tSlot: \"1\",\n460: \t\t\t\tType: \"xcm-2s\",\n461: \t\t\t\tXIOM: XIOMS{\n462: \t\t\t\t\t{\n463: \t\t\t\t\t\tSlot: 1,\n464: \t\t\t\t\t\tType: \"iom-s-3.0t\",\n465: \t\t\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"ms18-100gb-qsfp28\"}},\n466: \t\t\t\t\t},\n467: \t\t\t\t},\n468: \t\t\t},\n469: \t\t}\n470: \n471: \t\tcfg := n.generateComponentConfig()\n472: \n473: \t\tassert.Contains(t, cfg, \"/configure card 1 card-type xcm-2s admin-state enable\")\n474: \t\tassert.Contains(t, cfg, \"/configure sfm 1 sfm-type sfm-2s admin-state enable\")\n475: \t\tassert.Contains(t, cfg, \"/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\")\n476: \t\tassert.Contains(\n477: \t\t\tt,\n478: \t\t\tcfg,\n479: \t\t\t\"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\",\n480: \t\t)\n481: \t\tassert.Contains(t, cfg, \"power-shelf 1 power-shelf-type ps-a4-shelf-dc\")\n482: \t})\n483: }\n484: \n485: func Test_sros_integratedComponentOverrides(t *testing.T) {\n486: \tt.Run(\"integrated_component_override_sets_env\", func(t *testing.T) {\n487: \t\tn := newSrosInitTestNode(\"ixr-r6\", []*Component{\n488: \t\t\t{\n489: \t\t\t\tSlot: slotBName,\n490: \t\t\t\tType: \"cpiom-ixr-r6\",\n491: \t\t\t\tMDA:  MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}},\n492: \t\t\t},\n493: \t\t})\n494: \n495: \t\terr := n.Init(n.Cfg)\n496: \n497: \t\trequire.NoError(t, err)\n498: \t\tassert.True(t, n.isStandaloneNode())\n499: \t\tassert.Equal(t, slotBName, n.Cfg.Env[envNokiaSrosSlot])\n500: \t\tassert.Equal(t, \"cpiom-ixr-r6\", n.Cfg.Env[envNokiaSrosCard])\n501: \t\tassert.Equal(t, \"m20-1g-csfp\", n.Cfg.Env[envNokiaSrosMDA+\"_3\"])\n502: \n503: \t\tassert.Empty(t, n.generateComponentConfig())\n504: \t})\n505: \n506: \tt.Run(\"integrated_component_xiom_sets_env\", func(t *testing.T) {\n507: \t\tn := newSrosInitTestNode(\"sr-1s\", []*Component{\n508: \t\t\t{\n509: \t\t\t\tXIOM: XIOMS{\n510: \t\t\t\t\t{\n511: \t\t\t\t\t\tSlot: 1,\n512: \t\t\t\t\t\tType: \"iom-s-3.0t\",\n513: \t\t\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"ms18-100gb-qsfp28\"}},\n514: \t\t\t\t\t},\n515: \t\t\t\t},\n516: \t\t\t},\n517: \t\t})\n518: \n519: \t\trequire.NoError(t, n.Init(n.Cfg))\n520: \t\tassert.Equal(t, \"iom-s-3.0t\", n.Cfg.Env[envNokiaSrosXIOM+\"_X1\"])\n521: \t\tassert.Equal(t, \"ms18-100gb-qsfp28\", n.Cfg.Env[envNokiaSrosMDA+\"_X1_1\"])\n522: \n523: \t\tcfg := n.generateComponentConfig()\n524: \t\tassert.Contains(t, cfg, \"/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\")\n525: \t\tassert.Contains(\n526: \t\t\tt,\n527: \t\t\tcfg,\n528: \t\t\t\"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\",\n529: \t\t)\n530: \t})\n531: \n532: \tt.Run(\"integrated_rejects_multiple_components\", func(t *testing.T) {\n533: \t\tfor _, tc := range []struct {\n534: \t\t\tnodeType   string\n535: \t\t\tcomponents []*Component\n536: \t\t}{\n537: \t\t\t{\"sr-1\", []*Component{{Slot: slotAName}, {Slot: slotBName}}},\n538: \t\t\t{\"ixr-r6\", []*Component{{Slot: slotAName}, {Slot: \"1\"}}},\n539: \t\t\t{\"ixr-r6\", []*Component{{Slot: slotAName}, {}}},\n540: \t\t} {\n541: \t\t\tn := newSrosInitTestNode(tc.nodeType, tc.components)\n542: \n543: \t\t\terr := n.Init(n.Cfg)\n544: \n545: \t\t\trequire.Error(t, err, tc.nodeType)\n546: \t\t\tassert.Contains(t, err.Error(), \"at most one component override\")\n547: \t\t}\n548: \t})\n549: \n550: \tt.Run(\"redundant_integrated_components_are_distributed\", func(t *testing.T) {\n551: \t\tn := newSrosInitTestNode(\"ixr-r6\", []*Component{\n552: \t\t\t{Slot: slotAName, MDA: MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}}},\n553: \t\t\t{Slot: slotBName},\n554: \t\t})\n555: \n556: \t\trequire.NoError(t, n.Init(n.Cfg))\n557: \t\tassert.True(t, n.isDistributedBaseNode())\n558: \t\trequire.Len(t, n.componentNodes, 2)\n559: \n560: \t\tcpmA := n.componentNodes[0].(*sros)\n561: \t\tcpmB := n.componentNodes[1].(*sros)\n562: \t\tassert.Equal(t, slotAName, cpmA.Config().Env[envNokiaSrosSlot])\n563: \t\tassert.Equal(t, slotBName, cpmB.Config().Env[envNokiaSrosSlot])\n564: \t\tassert.Equal(t, \"container:n1-netns\", cpmA.Config().NetworkMode)\n565: \t\tassert.Equal(t, \"container:n1-netns\", cpmB.Config().NetworkMode)\n566: \n567: \t\tcfgA := cpmA.generateComponentConfig()\n568: \t\tassert.Contains(t, cfgA, \"/configure card 1 card-type iom-ixr-r6 admin-state enable\")\n569: \t\tassert.Contains(\n570: \t\t\tt,\n571: \t\t\tcfgA,\n572: \t\t\t\"/configure card 1 mda 1 mda-type m6-10g-sfp++1-100g-qsfp28 admin-state enable\",\n573: \t\t)\n574: \t\tassert.Contains(t, cfgA, \"/configure card 1 mda 3 mda-type m20-1g-csfp admin-state enable\")\n575: \n576: \t\tcfgB := cpmB.generateComponentConfig()\n577: \t\tassert.Contains(t, cfgB, \"/configure card 1 card-type iom-ixr-r6 admin-state enable\")\n578: \t\tassert.NotContains(t, cfgB, \"m20-1g-csfp\")\n579: \t})\n580: \n581: \tt.Run(\"lowercase_integrated_slots_resolve_to_cpm_a\", func(t *testing.T) {\n582: \t\tn := newSrosInitTestNode(\"ixr-r6\", []*Component{\n583: \t\t\t{Slot: \"a\"},\n584: \t\t\t{Slot: \"b\"},\n585: \t\t})\n586: \n587: \t\trequire.NoError(t, n.Init(n.Cfg))\n588: \t\tslot, err := n.cpmSlot()\n589: \t\trequire.NoError(t, err)\n590: \t\tassert.Equal(t, slotAName, slot)\n591: \t})\n592: \n593: \tt.Run(\"node_env_overrides_component_mda\", func(t *testing.T) {\n594: \t\tn := newSrosInitTestNode(\"sr-1\", []*Component{\n595: \t\t\t{MDA: MDAS{{Slot: 1, Type: \"from-component\"}}},\n596: \t\t})\n597: \t\tn.Cfg.Env = map[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"}\n598: \n599: \t\trequire.NoError(t, n.Init(n.Cfg))\n600: \t\tassert.Equal(t, \"from-env\", n.Cfg.Env[envNokiaSrosMDA+\"_1\"])\n601: \n602: \t\tcfg := n.generateComponentConfig()\n603: \t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type from-env admin-state enable\")\n604: \t\tassert.NotContains(t, cfg, \"from-component\")\n605: \t})\n606: \n607: \tt.Run(\"node_env_overrides_sfm\", func(t *testing.T) {\n608: \t\tn := newSrosInitTestNode(\"sr-1\", nil)\n609: \t\tkindSpecificConfig.Of(n.Cfg).SFM = \"from-sfm\"\n610: \t\tn.Cfg.Env = map[string]string{envNokiaSrosSFM: \"from-env\"}\n611: \n612: \t\trequire.NoError(t, n.Init(n.Cfg))\n613: \t\tassert.Equal(t, \"from-env\", n.Cfg.Env[envNokiaSrosSFM])\n614: \t})\n615: \n616: \tt.Run(\"distributed_node_env_overrides_component_mda\", func(t *testing.T) {\n617: \t\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n618: \t\t\t{Slot: slotAName, Type: \"cpm-2s\"},\n619: \t\t\t{\n620: \t\t\t\tSlot: \"1\",\n621: \t\t\t\tType: \"xcm-2s\",\n622: \t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"from-component\"}},\n623: \t\t\t},\n624: \t\t})\n625: \t\tn.Cfg.Env = map[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"}\n626: \n627: \t\trequire.NoError(t, n.Init(n.Cfg))\n628: \t\trequire.Len(t, n.componentNodes, 2)\n629: \n630: \t\tlinecard := n.componentNodes[1].(*sros)\n631: \t\tassert.Equal(t, \"from-env\", linecard.Config().Env[envNokiaSrosMDA+\"_1\"])\n632: \n633: \t\tcfg := n.componentNodes[0].(*sros).generateComponentConfig()\n634: \t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type from-env admin-state enable\")\n635: \t\tassert.NotContains(t, cfg, \"from-component\")\n636: \t})\n637: \n638: \tt.Run(\"duplicate_component_slots_are_rejected_regardless_of_case\", func(t *testing.T) {\n639: \t\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n640: \t\t\t{Slot: \"a\"},\n641: \t\t\t{Slot: \"A\"},\n642: \t\t})\n643: \n644: \t\terr := n.checkComponentSlotsConfig()\n645: \n646: \t\trequire.Error(t, err)\n647: \t\tassert.Contains(t, err.Error(), \"duplicate\")\n648: \t})\n649: \n650: \tt.Run(\"sfm_sets_container_env\", func(t *testing.T) {\n651: \t\tn := newSrosInitTestNode(\"sr-1\", nil)\n652: \t\tkindSpecificConfig.Of(n.Cfg).SFM = \"m-sfm6-7/12\"\n653: \n654: \t\trequire.NoError(t, n.Init(n.Cfg))\n655: \t\tassert.Equal(t, \"m-sfm6-7/12\", n.Cfg.Env[envNokiaSrosSFM])\n656: \t})\n657: \n658: \tt.Run(\"single_slot_integrated_allows_card_type_override\", func(t *testing.T) {\n659: \t\tn := newSrosInitTestNode(\"ixr-e2n\", []*Component{\n660: \t\t\t{Slot: slotAName, Type: \"cpm-ixr-e2n/imm4-sfp+4-sfp+\"},\n661: \t\t})\n662: \n663: \t\trequire.NoError(t, n.Init(n.Cfg))\n664: \t\tassert.Equal(t, \"cpm-ixr-e2n/imm4-sfp+4-sfp+\", n.Cfg.Env[envNokiaSrosCard])\n665: \t\tassert.Empty(t, n.generateComponentConfig())\n666: \t})\n667: \n668: \tt.Run(\"integrated_rejects_invalid_slot\", func(t *testing.T) {\n669: \t\tn := newSrosInitTestNode(\"ixr-e2\", []*Component{\n670: \t\t\t{Slot: slotBName, Type: \"cpm-ixr-e2\"},\n671: \t\t})\n672: \n673: \t\terr := n.Init(n.Cfg)\n674: \n675: \t\trequire.Error(t, err)\n676: \t\tassert.Contains(t, err.Error(), \"expected no slot, or slot A\")\n677: \t})\n678: \n679: \tt.Run(\"distributed_node_still_uses_components\", func(t *testing.T) {\n680: \t\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n681: \t\t\t{Slot: slotAName, Type: \"cpm-2s\"},\n682: \t\t\t{Slot: \"1\", Type: \"xcm-2s\"},\n683: \t\t})\n684: \n685: \t\terr := n.Init(n.Cfg)\n686: \n687: \t\trequire.NoError(t, err)\n688: \t\tassert.False(t, n.isStandaloneNode())\n689: \t\tassert.Len(t, n.componentNodes, 2)\n690: \t})\n691: }\n692: \n693: func newSrosComponentConfigTestNode(\n694: \tnodeType string,\n695: \tenv map[string]string,\n696: \tcomponents []*Component,\n697: ) *sros {\n698: \tif env == nil {\n699: \t\tenv = map[string]string{}\n700: \t}\n701: \n702: \tn := &sros{}\n703: \tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n704: \tn.Cfg = &clabtypes.NodeConfig{\n705: \t\tShortName: \"n1\",\n706: \t\tLongName:  \"clab-test-n1\",\n707: \t\tNodeType:  nodeType,\n708: \t\tEnv:       env,\n709: \t}\n710: \tkindSpecificConfig.Of(n.Cfg).Components = components\n711: \treturn n\n712: }\n713: \n714: func newSrosInitTestNode(nodeType string, components []*Component) *sros {\n715: \tissueCert := false\n716: \tn := &sros{}\n717: \tn.Cfg = &clabtypes.NodeConfig{\n718: \t\tShortName:   \"n1\",\n719: \t\tLongName:    \"clab-test-n1\",\n720: \t\tFqdn:        \"n1.clab-test.io\",\n721: \t\tNodeType:    nodeType,\n722: \t\tEnv:         map[string]string{},\n723: \t\tSysctls:     map[string]string{},\n724: \t\tCertificate: &clabtypes.CertificateConfig{Issue: &issueCert},\n725: \t}\n726: \tkindSpecificConfig.Of(n.Cfg).Components = components\n727: \treturn n\n728: }\n729: \n730: func TestDistributedComponentsUseNetnsContainer(t *testing.T) {\n731: \tcomponents := []*Component{\n732: \t\t{Slot: slotAName},\n733: \t\t{Slot: \"2\"},\n734: \t\t{Slot: slotBName},\n735: \t\t{Slot: \"1\"},\n736: \t}\n737: \tn := newSrosInitTestNode(\"sr-14s\", components)\n738: \tn.Cfg.Image = \"nokia_srsim:test\"\n739: \tn.Cfg.RestartPolicy = \"unless-stopped\"\n740: \tn.Cfg.MgmtIPv4Address = \"172.20.20.10\"\n741: \tn.Cfg.Labels = map[string]string{clabconstants.Containerlab: \"test\"}\n742: \n743: \trequire.NoError(t, n.Init(n.Cfg))\n744: \trequire.NotNil(t, n.netnsNode)\n745: \tassert.Equal(t, \"n1-netns\", n.netnsNode.Config().ShortName)\n746: \tassert.Equal(t, \"clab-test-n1-netns\", n.netnsNode.Config().LongName)\n747: \tassert.Equal(t, n.Cfg.Image, n.netnsNode.Config().Image)\n748: \tassert.Equal(t, \"unless-stopped\", n.netnsNode.Config().RestartPolicy)\n749: \tassert.Equal(t, \"true\", n.netnsNode.Config().Labels[clabconstants.InternalNode])\n750: \tassert.Equal(t, \"/bin/sh\", n.netnsNode.Config().Entrypoint)\n751: \tassert.Equal(\n752: \t\tt,\n753: \t\t`-c \"trap 'exit 0' TERM INT; sleep infinity & wait $!\"`,\n754: \t\tn.netnsNode.Config().Cmd,\n755: \t)\n756: \tassert.Equal(t, \"srsim-netns\", n.netnsNode.Config().Labels[clabconstants.NodeType])\n757: \tassert.Empty(t, n.netnsNode.Config().Labels[clabconstants.ToolType])\n758: \tassert.Equal(t, n.Cfg.ShortName, n.netnsNode.Config().Labels[clabconstants.RootNodeName])\n759: \tassert.Equal(t, n.Cfg.MgmtIPv4Address, n.netnsNode.Config().MgmtIPv4Address)\n760: \tassert.Equal(t, n.Cfg.Sysctls, n.netnsNode.Config().Sysctls)\n761: \tassert.Empty(t, n.netnsNode.Config().Env)\n762: \tassert.Empty(t, n.netnsNode.Config().Binds)\n763: \n764: \trequire.Len(t, n.componentNodes, len(components))\n765: \tfor i, component := range n.componentNodes {\n766: \t\tassert.Equal(t, components[i].Slot, component.Config().Env[envNokiaSrosSlot])\n767: \t\tassert.Equal(t, \"container:n1-netns\", component.Config().NetworkMode)\n768: \t\tassert.Equal(t, n.Cfg.MgmtIPv4Address, component.Config().MgmtIPv4Address)\n769: \t\tassert.Nil(t, component.Config().DNS)\n770: \t\tassert.Nil(t, component.Config().PortBindings)\n771: \t\tassert.Equal(t, n.Cfg.Sysctls, component.Config().Sysctls)\n772: \t}\n773: }\n774: \n775: func TestDistributedHolderOnlyRemainsDiscoverableForDestroy(t *testing.T) {\n776: \tctx := context.Background()\n777: \tctrl := gomock.NewController(t)\n778: \tmockRuntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n779: \tn := newSrosInitTestNode(\"sr-14s\", []*Component{\n780: \t\t{Slot: slotAName},\n781: \t\t{Slot: \"1\"},\n782: \t})\n783: \n784: \trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(mockRuntime)))\n785: \n786: \tholder := clabruntime.GenericContainer{\n787: \t\tNames:  []string{n.netnsNode.Config().LongName},\n788: \t\tLabels: n.netnsNode.Config().Labels,\n789: \t}\n790: \tmockRuntime.EXPECT().ListContainers(ctx, []*clabtypes.GenericFilter{\n791: \t\t{FilterType: \"name\", Match: \"clab-test-n1-a\"},\n792: \t}).Return(nil, nil)\n793: \tmockRuntime.EXPECT().ListContainers(ctx, []*clabtypes.GenericFilter{\n794: \t\t{FilterType: \"name\", Match: n.netnsNode.Config().LongName},\n795: \t}).Return([]clabruntime.GenericContainer{holder}, nil)\n796: \n797: \tgot, err := n.GetContainers(ctx)\n798: \trequire.NoError(t, err)\n799: \trequire.Equal(t, []clabruntime.GenericContainer{holder}, got)\n800: \n801: \tmockRuntime.EXPECT().\n802: \t\tGetContainerStatus(ctx, \"clab-test-n1-a\").\n803: \t\tReturn(clabruntime.NotFound).\n804: \t\tAnyTimes()\n805: \tmockRuntime.EXPECT().\n806: \t\tGetContainerStatus(ctx, \"clab-test-n1-1\").\n807: \t\tReturn(clabruntime.NotFound).\n808: \t\tAnyTimes()\n809: \tmockRuntime.EXPECT().\n810: \t\tGetContainerStatus(ctx, n.netnsNode.Config().LongName).\n811: \t\tReturn(clabruntime.Running)\n812: \tmockRuntime.EXPECT().DeleteContainer(ctx, n.netnsNode.Config().LongName).Return(nil)\n813: \n814: \trequire.NoError(t, n.Delete(ctx))\n815: }\n816: \n817: func TestDistributedDeleteAttemptsHolderAfterComponentError(t *testing.T) {\n818: \tctx := context.Background()\n819: \tctrl := gomock.NewController(t)\n820: \tmockRuntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n821: \tn := newSrosInitTestNode(\"sr-14s\", []*Component{\n822: \t\t{Slot: slotAName},\n823: \t\t{Slot: \"1\"},\n824: \t})\n825: \n826: \trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(mockRuntime)))\n827: \n828: \tcomponent := clabmocksmocknodes.NewMockNode(ctrl)\n829: \tn.componentNodes = []clabnodes.Node{component}\n830: \n831: \tdeleteErr := errors.New(\"component deletion failed\")\n832: \tcomponent.EXPECT().Delete(ctx).Return(deleteErr)\n833: \tcomponent.EXPECT().GetContainerStatus(ctx).Return(clabruntime.NotFound)\n834: \tmockRuntime.EXPECT().\n835: \t\tGetContainerStatus(ctx, n.netnsNode.Config().LongName).\n836: \t\tReturn(clabruntime.Running)\n837: \tmockRuntime.EXPECT().DeleteContainer(ctx, n.netnsNode.Config().LongName).Return(nil)\n838: \n839: \trequire.ErrorIs(t, n.Delete(ctx), deleteErr)\n840: }\n841: \n842: func TestEnsureNetnsRunning(t *testing.T) {\n843: \tctx := context.Background()\n844: \n845: \tt.Run(\"already running\", func(t *testing.T) {\n846: \t\tctrl := gomock.NewController(t)\n847: \t\truntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n848: \t\tn := newSrosInitTestNode(\"sr-14s\", []*Component{\n849: \t\t\t{Slot: slotAName}, {Slot: \"1\"},\n850: \t\t})\n851: \t\trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(runtime)))\n852: \t\truntime.EXPECT().GetContainerStatus(ctx, n.netnsNode.Config().LongName).\n853: \t\t\tReturn(clabruntime.Running)\n854: \n855: \t\trequire.NoError(t, n.ensureNetnsRunning(ctx))\n856: \t})\n857: \n858: \tt.Run(\"starts stopped holder\", func(t *testing.T) {\n859: \t\tctrl := gomock.NewController(t)\n860: \t\truntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n861: \t\tn := newSrosInitTestNode(\"sr-14s\", []*Component{\n862: \t\t\t{Slot: slotAName}, {Slot: \"1\"},\n863: \t\t})\n864: \t\trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(runtime)))\n865: \t\truntime.EXPECT().GetContainerStatus(ctx, n.netnsNode.Config().LongName).\n866: \t\t\tReturn(clabruntime.Stopped).Times(2)\n867: \t\truntime.EXPECT().\n868: \t\t\tStartContainer(ctx, n.netnsNode.Config().LongName, gomock.Any()).\n869: \t\t\tReturn(nil, nil)\n870: \n871: \t\trequire.NoError(t, n.ensureNetnsRunning(ctx))\n872: \t})\n873: \n874: \tt.Run(\"missing holder requires recreate\", func(t *testing.T) {\n875: \t\tctrl := gomock.NewController(t)\n876: \t\truntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n877: \t\tn := newSrosInitTestNode(\"sr-14s\", []*Component{\n878: \t\t\t{Slot: slotAName}, {Slot: \"1\"},\n879: \t\t})\n880: \t\trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(runtime)))\n881: \t\truntime.EXPECT().GetContainerStatus(ctx, n.netnsNode.Config().LongName).\n882: \t\t\tReturn(clabruntime.NotFound)\n883: \n884: \t\terr := n.ensureNetnsRunning(ctx)\n885: \t\trequire.Error(t, err)\n886: \t\tassert.Contains(t, err.Error(), \"recreate the node\")\n887: \t})\n888: }\n889: \n890: func TestComponentMgmtEnv(t *testing.T) {\n891: \tdualStack := MgmtIP{\n892: \t\tIPv4: \"172.20.20.10\", IPv4pLen: 24, IPv4Gw: \"172.20.20.1\",\n893: \t\tIPv6: \"3fff:172:20:20::10\", IPv6pLen: 64, IPv6Gw: \"3fff:172:20:20::1\",\n894: \t}\n895: \ttests := []struct {\n896: \t\tname string\n897: \t\tips  MgmtIP\n898: \t\tenv  map[string]string\n899: \t\twant map[string]string\n900: \t}{\n901: \t\t{\n902: \t\t\tname: \"dual stack runtime allocation\", ips: dualStack,\n903: \t\t\twant: map[string]string{\n904: \t\t\t\tenvSrosIPv4Active: \"172.20.20.10/24\", envSrosIPv6Active: \"3fff:172:20:20::10/64\",\n905: \t\t\t\tenvSrosStaticRoutePrefix + \"1\": \"0.0.0.0/0@172.20.20.1\",\n906: \t\t\t\tenvSrosStaticRoutePrefix + \"2\": \"::/0@3fff:172:20:20::1\",\n907: \t\t\t},\n908: \t\t},\n909: \t\t{\n910: \t\t\tname: \"IPv4 without gateway\", ips: MgmtIP{IPv4: \"192.0.2.10\", IPv4pLen: 27},\n911: \t\t\twant: map[string]string{envSrosIPv4Active: \"192.0.2.10/27\"},\n912: \t\t},\n913: \t\t{\n914: \t\t\tname: \"IPv6 only\",\n915: \t\t\tips:  MgmtIP{IPv6: \"2001:db8::10\", IPv6pLen: 80, IPv6Gw: \"2001:db8::1\"},\n916: \t\t\twant: map[string]string{\n917: \t\t\t\tenvSrosIPv6Active:              \"2001:db8::10/80\",\n918: \t\t\t\tenvSrosStaticRoutePrefix + \"2\": \"::/0@2001:db8::1\",\n919: \t\t\t},\n920: \t\t},\n921: \t\t{name: \"no management addresses\"},\n922: \t\t{\n923: \t\t\tname: \"explicit IPv4 opts out of both families\", ips: dualStack,\n924: \t\t\tenv:  map[string]string{envSrosIPv4Active: \"192.0.2.2/24\"},\n925: \t\t\twant: map[string]string{envSrosIPv4Active: \"192.0.2.2/24\"},\n926: \t\t},\n927: \t\t{\n928: \t\t\tname: \"explicit IPv6\", ips: dualStack,\n929: \t\t\tenv:  map[string]string{envSrosIPv6Active: \"2001:db8::2/64\"},\n930: \t\t\twant: map[string]string{envSrosIPv6Active: \"2001:db8::2/64\"},\n931: \t\t},\n932: \t\t{\n933: \t\t\tname: \"explicit route\", ips: dualStack,\n934: \t\t\tenv:  map[string]string{envSrosStaticRoutePrefix + \"1\": \"192.0.2.0/24@172.20.20.9\"},\n935: \t\t\twant: map[string]string{envSrosStaticRoutePrefix + \"1\": \"192.0.2.0/24@172.20.20.9\"},\n936: \t\t},\n937: \t\t{\n938: \t\t\tname: \"empty explicit route still opts out\", ips: dualStack,\n939: \t\t\tenv:  map[string]string{envSrosStaticRoutePrefix + \"CUSTOM\": \"\"},\n940: \t\t\twant: map[string]string{envSrosStaticRoutePrefix + \"CUSTOM\": \"\"},\n941: \t\t},\n942: \t\t{\n943: \t\t\tname: \"custom management interface\", ips: dualStack,\n944: \t\t\tenv:  map[string]string{\"NOKIA_SROS_MGMT_IF\": \"eth9\"},\n945: \t\t\twant: map[string]string{\"NOKIA_SROS_MGMT_IF\": \"eth9\"},\n946: \t\t},\n947: \t}\n948: \tfor _, tt := range tests {\n949: \t\tt.Run(tt.name, func(t *testing.T) {\n950: \t\t\tn := newSrosInitTestNode(\"sr-14s\", []*Component{\n951: \t\t\t\t{Slot: slotAName, Env: tt.env}, {Slot: slotBName}, {Slot: \"1\"},\n952: \t\t\t})\n953: \t\t\trequire.NoError(t, n.Init(n.Cfg))\n954: \t\t\tn.setComponentMgmtEnv(tt.ips)\n955: \t\t\tgot := map[string]string{}\n956: \t\t\tfor key, value := range n.componentNodes[0].Config().Env {\n957: \t\t\t\tisAddress := key == envSrosIPv4Active || key == envSrosIPv6Active\n958: \t\t\t\tisRoute := strings.HasPrefix(key, envSrosStaticRoutePrefix)\n959: \t\t\t\tif isAddress || isRoute || key == \"NOKIA_SROS_MGMT_IF\" {\n960: \t\t\t\t\tgot[key] = value\n961: \t\t\t\t}\n962: \t\t\t}\n963: \t\t\tif tt.want == nil {\n964: \t\t\t\tassert.Empty(t, got)\n965: \t\t\t} else {\n966: \t\t\t\tassert.Equal(t, tt.want, got)\n967: \t\t\t}\n968: \t\t\t// A per-CPM override must not suppress automatic configuration for B.\n969: \t\t\tif tt.ips.IPv4 != \"\" {\n970: \t\t\t\tassert.Equal(t, fmt.Sprintf(\"%s/%d\", tt.ips.IPv4, tt.ips.IPv4pLen),\n971: \t\t\t\t\tn.componentNodes[1].Config().Env[envSrosIPv4Active])\n972: \t\t\t}\n973: \t\t\tassert.NotContains(t, n.componentNodes[2].Config().Env, envSrosIPv4Active)\n974: \t\t\tassert.NotContains(t, n.componentNodes[2].Config().Env, envSrosIPv6Active)\n975: \t\t})\n976: \t}\n977: }\n978: \n979: func TestComponentMgmtEnvOnlyCPMSlots(t *testing.T) {\n980: \tfor _, slot := range []string{\"A\", \"B\", \"a\", \"b\", \"1\", \"10\", \"\", \"C\", \"invalid\"} {\n981: \t\tt.Run(slot, func(t *testing.T) {\n982: \t\t\tn := newSrosInitTestNode(\"sr-14s\", []*Component{\n983: \t\t\t\t{Slot: slotAName}, {Slot: \"1\"},\n984: \t\t\t})\n985: \t\t\trequire.NoError(t, n.Init(n.Cfg))\n986: \t\t\tenv := n.componentNodes[0].Config().Env\n987: \t\t\tenv[envNokiaSrosSlot] = slot\n988: \n989: \t\t\tn.setComponentMgmtEnv(MgmtIP{\n990: \t\t\t\tIPv4: \"192.0.2.10\", IPv4pLen: 24, IPv4Gw: \"192.0.2.1\",\n991: \t\t\t\tIPv6: \"2001:db8::10\", IPv6pLen: 64, IPv6Gw: \"2001:db8::1\",\n992: \t\t\t})\n993: \n994: \t\t\twantMgmt := slot == \"A\" || slot == \"B\" || slot == \"a\" || slot == \"b\"\n995: \t\t\tfor _, key := range []string{\n996: \t\t\t\tenvSrosIPv4Active, envSrosIPv6Active,\n997: \t\t\t\tenvSrosStaticRoutePrefix + \"1\", envSrosStaticRoutePrefix + \"2\",\n998: \t\t\t} {\n999: \t\t\t\t_, present := env[key]\n1000: \t\t\t\tassert.Equal(t, wantMgmt, present, key)\n1001: \t\t\t}\n1002: \t\t})\n1003: \t}\n1004: }\n1005: \n1006: func TestDistributedNetnsLookupAndMgmtIPs(t *testing.T) {\n1007: \tctx := context.Background()\n1008: \tctrl := gomock.NewController(t)\n1009: \truntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n1010: \tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n1011: \t\t{Slot: slotAName},\n1012: \t\t{Slot: \"1\"},\n1013: \t})\n1014: \trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(runtime)))\n1015: \n1016: \truntime.EXPECT().GetNSPath(ctx, \"clab-test-n1-netns\").Return(\"/proc/123/ns/net\", nil)\n1017: \tnsPath, err := n.GetNSPath(ctx)\n1018: \trequire.NoError(t, err)\n1019: \tassert.Equal(t, \"/proc/123/ns/net\", nsPath)\n1020: \n1021: \truntime.EXPECT().\n1022: \t\tListContainers(gomock.Any(), gomock.Any()).\n1023: \t\tReturn([]clabruntime.GenericContainer{{\n1024: \t\t\tID: \"holder-id\",\n1025: \t\t\tNetworkSettings: clabruntime.GenericMgmtIPs{\n1026: \t\t\t\tIPv4addr: \"172.20.20.10\",\n1027: \t\t\t\tIPv4pLen: 24,\n1028: \t\t\t\tIPv4Gw:   \"172.20.20.1\",\n1029: \t\t\t\tIPv6addr: \"3fff:172:20:20::10\",\n1030: \t\t\t\tIPv6pLen: 64,\n1031: \t\t\t\tIPv6Gw:   \"3fff:172:20:20::1\",\n1032: \t\t\t},\n1033: \t\t}}, nil)\n1034: \n1035: \tips, err := n.distNodeMgmtIPs()\n1036: \trequire.NoError(t, err)\n1037: \tassert.Equal(t, \"172.20.20.10\", ips.IPv4)\n1038: \tassert.Equal(t, \"3fff:172:20:20::10\", ips.IPv6)\n1039: \tassert.Equal(t, \"holder-id\", ips.ContainerID)\n1040: \tassert.Equal(t, \"172.20.20.1\", ips.IPv4Gw)\n1041: \tassert.Equal(t, \"3fff:172:20:20::1\", ips.IPv6Gw)\n1042: }\n1043: \n1044: func TestNamespaceNodeUsesDefaultLifecycle(t *testing.T) {\n1045: \tctx := context.Background()\n1046: \tctrl := gomock.NewController(t)\n1047: \tmockRuntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n1048: \tn := newSrosInitTestNode(\"sr-14s\", []*Component{\n1049: \t\t{Slot: slotAName}, {Slot: \"1\"},\n1050: \t})\n1051: \trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(mockRuntime)))\n1052: \n1053: \tholder := n.netnsNode\n1054: \trequire.IsType(t, &namespaceNode{}, holder)\n1055: \trequire.Same(t, mockRuntime, holder.GetRuntime())\n1056: \tmockRuntime.EXPECT().CreateContainer(ctx, holder.Config()).Return(\"holder-id\", nil)\n1057: \tmockRuntime.EXPECT().StartContainer(ctx, \"holder-id\", gomock.Any()).Return(nil, nil)\n1058: \trequire.NoError(t, holder.Deploy(ctx, nil))\n1059: \n1060: \tmockRuntime.EXPECT().GetNSPath(ctx, holder.Config().LongName).Return(\"/proc/123/ns/net\", nil)\n1061: \tnsPath, err := n.GetNSPath(ctx)\n1062: \trequire.NoError(t, err)\n1063: \trequire.Equal(t, \"/proc/123/ns/net\", nsPath)\n1064: \n1065: \tmockRuntime.EXPECT().\n1066: \t\tGetContainerStatus(ctx, holder.Config().LongName).\n1067: \t\tReturn(clabruntime.Running)\n1068: \tmockRuntime.EXPECT().DeleteContainer(ctx, holder.Config().LongName).Return(nil)\n1069: \trequire.NoError(t, holder.Delete(ctx))\n1070: }\n1071: \n1072: func TestDeployFabricUsesResolvedManagementAddresses(t *testing.T) {\n1073: \tctx := context.Background()\n1074: \tctrl := gomock.NewController(t)\n1075: \tmockRuntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n1076: \tn := newSrosInitTestNode(\"sr-14s\", []*Component{\n1077: \t\t{Slot: slotAName}, {Slot: \"1\"},\n1078: \t})\n1079: \trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(mockRuntime)))\n1080: \n1081: \tn.Cfg.MgmtIPv4Address = \"172.20.20.10\"\n1082: \tn.Cfg.MgmtIPv4AddressAuto = true\n1083: \tn.Cfg.MgmtIPv4PrefixLength = 24\n1084: \tn.Cfg.MgmtIPv4Gateway = \"172.20.20.1\"\n1085: \tn.Cfg.MgmtIPv6Address = \"3fff:172:20:20::10\"\n1086: \tn.Cfg.MgmtIPv6AddressAuto = true\n1087: \tn.Cfg.MgmtIPv6PrefixLength = 64\n1088: \tn.Cfg.MgmtIPv6Gateway = \"3fff:172:20:20::1\"\n1089: \n1090: \tvar components []clabnodes.Node\n1091: \tfor _, slot := range []string{slotAName, \"1\"} {\n1092: \t\tcomponent := clabmocksmocknodes.NewMockNode(ctrl)\n1093: \t\tcomponent.EXPECT().Config().Return(&clabtypes.NodeConfig{\n1094: \t\t\tEnv: map[string]string{envNokiaSrosSlot: slot},\n1095: \t\t}).AnyTimes()\n1096: \t\tcomponent.EXPECT().GetShortName().Return(\"n1-\" + strings.ToLower(slot)).AnyTimes()\n1097: \t\tcomponent.EXPECT().PreDeploy(ctx, gomock.Any()).Return(nil)\n1098: \t\tcomponent.EXPECT().Deploy(ctx, gomock.Any()).Return(nil)\n1099: \t\tcomponents = append(components, component)\n1100: \t}\n1101: \tn.componentNodes = components\n1102: \n1103: \tmockRuntime.EXPECT().\n1104: \t\tCreateContainer(ctx, gomock.Any()).\n1105: \t\tDoAndReturn(func(_ context.Context, cfg *clabtypes.NodeConfig) (string, error) {\n1106: \t\t\tassert.Equal(t, n.Cfg.MgmtIPv4Address, cfg.MgmtIPv4Address)\n1107: \t\t\tassert.Equal(t, n.Cfg.MgmtIPv4AddressAuto, cfg.MgmtIPv4AddressAuto)\n1108: \t\t\tassert.Equal(t, n.Cfg.MgmtIPv4PrefixLength, cfg.MgmtIPv4PrefixLength)\n1109: \t\t\tassert.Equal(t, n.Cfg.MgmtIPv4Gateway, cfg.MgmtIPv4Gateway)\n1110: \t\t\tassert.Equal(t, n.Cfg.MgmtIPv6Address, cfg.MgmtIPv6Address)\n1111: \t\t\tassert.Equal(t, n.Cfg.MgmtIPv6AddressAuto, cfg.MgmtIPv6AddressAuto)\n1112: \t\t\tassert.Equal(t, n.Cfg.MgmtIPv6PrefixLength, cfg.MgmtIPv6PrefixLength)\n1113: \t\t\tassert.Equal(t, n.Cfg.MgmtIPv6Gateway, cfg.MgmtIPv6Gateway)\n1114: \t\t\treturn \"holder-id\", nil\n1115: \t\t})\n1116: \tmockRuntime.EXPECT().StartContainer(ctx, \"holder-id\", gomock.Any()).Return(nil, nil)\n1117: \tmockRuntime.EXPECT().\n1118: \t\tListContainers(gomock.Any(), gomock.Any()).\n1119: \t\tReturn([]clabruntime.GenericContainer{{\n1120: \t\t\tID: \"holder-id\",\n1121: \t\t\tNetworkSettings: clabruntime.GenericMgmtIPs{\n1122: \t\t\t\tIPv4addr: n.Cfg.MgmtIPv4Address,\n1123: \t\t\t\tIPv4pLen: n.Cfg.MgmtIPv4PrefixLength,\n1124: \t\t\t\tIPv4Gw:   n.Cfg.MgmtIPv4Gateway,\n1125: \t\t\t\tIPv6addr: n.Cfg.MgmtIPv6Address,\n1126: \t\t\t\tIPv6pLen: n.Cfg.MgmtIPv6PrefixLength,\n1127: \t\t\t\tIPv6Gw:   n.Cfg.MgmtIPv6Gateway,\n1128: \t\t\t},\n1129: \t\t}}, nil)\n1130: \n1131: \trequire.NoError(t, n.deployFabric(ctx, nil))\n1132: }\n1133: \n1134: func TestNamespaceNodeOnlyForDistributedComponents(t *testing.T) {\n1135: \ttests := []struct {\n1136: \t\tname       string\n1137: \t\tnodeType   string\n1138: \t\tcomponents []*Component\n1139: \t\tenv        map[string]string\n1140: \t\twantHolder bool\n1141: \t}{\n1142: \t\t{name: \"integrated\", nodeType: \"sr-1\"},\n1143: \t\t{\n1144: \t\t\tname: \"integrated component override\", nodeType: \"sr-1\",\n1145: \t\t\tcomponents: []*Component{{Slot: slotAName}},\n1146: \t\t},\n1147: \t\t{\n1148: \t\t\tname: \"explicit distributed card\", nodeType: \"sr-14s\",\n1149: \t\t\tenv: map[string]string{envNokiaSrosSlot: slotAName},\n1150: \t\t},\n1151: \t\t{\n1152: \t\t\tname: \"distributed components\", nodeType: \"sr-14s\",\n1153: \t\t\tcomponents: []*Component{{Slot: slotAName}, {Slot: \"1\"}},\n1154: \t\t\twantHolder: true,\n1155: \t\t},\n1156: \t}\n1157: \n1158: \tfor _, tt := range tests {\n1159: \t\tt.Run(tt.name, func(t *testing.T) {\n1160: \t\t\tn := newSrosInitTestNode(tt.nodeType, tt.components)\n1161: \t\t\tif tt.env != nil {\n1162: \t\t\t\tn.Cfg.Env = tt.env\n1163: \t\t\t}\n1164: \t\t\trequire.NoError(t, n.Init(n.Cfg))\n1165: \t\t\tif tt.wantHolder {\n1166: \t\t\t\trequire.NotNil(t, n.netnsNode)\n1167: \t\t\t} else {\n1168: \t\t\t\trequire.Nil(t, n.netnsNode)\n1169: \t\t\t}\n1170: \t\t})\n1171: \t}\n1172: }\n1173: \n1174: func TestWithoutComponentsDoesNotUseNamespaceHolder(t *testing.T) {\n1175: \tfor _, tt := range []struct {\n1176: \t\tname       string\n1177: \t\tnodeType   string\n1178: \t\tslot       string\n1179: \t\tcomponents []*Component\n1180: \t}{\n1181: \t\t{name: \"integrated without components\", nodeType: \"sr-1\"},\n1182: \t\t{name: \"integrated empty components\", nodeType: \"sr-1\", components: []*Component{}},\n1183: \t\t{name: \"explicit CPM A\", nodeType: \"sr-14s\", slot: \"A\"},\n1184: \t\t{name: \"explicit CPM B\", nodeType: \"sr-14s\", slot: \"B\"},\n1185: \t\t{name: \"explicit line card\", nodeType: \"sr-14s\", slot: \"1\"},\n1186: \t} {\n1187: \t\tt.Run(tt.name, func(t *testing.T) {\n1188: \t\t\tctx := context.Background()\n1189: \t\t\tctrl := gomock.NewController(t)\n1190: \t\t\truntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n1191: \t\t\tn := newSrosInitTestNode(tt.nodeType, tt.components)\n1192: \t\t\tif tt.slot != \"\" {\n1193: \t\t\t\tn.Cfg.Env[envNokiaSrosSlot] = tt.slot\n1194: \t\t\t}\n1195: \t\t\trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(runtime)))\n1196: \t\t\trequire.Nil(t, n.netnsNode)\n1197: \t\t\trequire.Empty(t, n.componentNodes)\n1198: \t\t\tassert.Empty(t, n.Cfg.NetworkMode)\n1199: \n1200: \t\t\t// Only the SR-SIM container may be created, started, queried or deleted.\n1201: \t\t\t// Any additional runtime call for a holder fails the mock expectations.\n1202: \t\t\truntime.EXPECT().CreateContainer(ctx, n.Cfg).Return(\"srsim-id\", nil)\n1203: \t\t\truntime.EXPECT().StartContainer(ctx, \"srsim-id\", gomock.Any()).Return(nil, nil)\n1204: \t\t\trequire.NoError(t, n.Deploy(ctx, nil))\n1205: \t\t\truntime.EXPECT().GetNSPath(ctx, n.Cfg.LongName).Return(\"/proc/123/ns/net\", nil)\n1206: \t\t\tnsPath, err := n.GetNSPath(ctx)\n1207: \t\t\trequire.NoError(t, err)\n1208: \t\t\tassert.Equal(t, \"/proc/123/ns/net\", nsPath)\n1209: \t\t\truntime.EXPECT().GetContainerStatus(ctx, n.Cfg.LongName).Return(clabruntime.Running)\n1210: \t\t\truntime.EXPECT().DeleteContainer(ctx, n.Cfg.LongName).Return(nil)\n1211: \t\t\trequire.NoError(t, n.Delete(ctx))\n1212: \t\t\trequire.Nil(t, n.netnsNode)\n1213: \t\t})\n1214: \t}\n1215: }\n1216: \n1217: func TestDistributedComponentNodes(t *testing.T) {\n1218: \ttests := map[string]struct {\n1219: \t\tnodeType   string\n1220: \t\tcomponents []*Component\n1221: \t\twant       bool\n1222: \t}{\n1223: \t\t\"standalone_without_components\": {\n1224: \t\t\tnodeType: \"sr-1\",\n1225: \t\t},\n1226: \t\t\"integrated_with_component\": {\n1227: \t\t\tnodeType: \"ixr-r6\",\n1228: \t\t\tcomponents: []*Component{\n1229: \t\t\t\t{Slot: slotBName, Type: \"cpiom-ixr-r6\", MDA: MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}}},\n1230: \t\t\t},\n1231: \t\t},\n1232: \t\t\"distributed_chassis_single_cpm\": {\n1233: \t\t\tnodeType:   \"sr-2s\",\n1234: \t\t\tcomponents: []*Component{{Slot: slotAName, Type: \"cpm-2s\"}},\n1235: \t\t},\n1236: \t\t\"distributed_chassis_cpm_and_linecard\": {\n1237: \t\t\tnodeType: \"sr-2s\",\n1238: \t\t\tcomponents: []*Component{\n1239: \t\t\t\t{Slot: slotAName, Type: \"cpm-2s\"},\n1240: \t\t\t\t{Slot: \"1\", Type: \"xcm-2s\"},\n1241: \t\t\t},\n1242: \t\t\twant: true,\n1243: \t\t},\n1244: \t\t\"distributed_chassis_dual_cpm\": {\n1245: \t\t\tnodeType:   \"sr-7\",\n1246: \t\t\tcomponents: []*Component{{Slot: slotAName}, {Slot: slotBName}},\n1247: \t\t\twant:       true,\n1248: \t\t},\n1249: \t}\n1250: \n1251: \tfor name, tc := range tests {\n1252: \t\tt.Run(name, func(t *testing.T) {\n1253: \t\t\tn := newSrosInitTestNode(tc.nodeType, tc.components)\n1254: \t\t\trequire.NoError(t, n.Init(n.Cfg))\n1255: \t\t\tassert.Equal(t, tc.want, len(n.componentNodes) > 0)\n1256: \t\t})\n1257: \t}\n1258: }\n1259: \n1260: func TestComputeDiffComponents(t *testing.T) {\n1261: \tchassis := func(components ...*Component) *clabtypes.NodeConfig {\n1262: \t\tkc := &KindSpecificConfig{GenComponentConfig: true, Components: components}\n1263: \t\treturn &clabtypes.NodeConfig{Kind: \"nokia_srsim\", NodeType: \"sr-2s\", KindSpecificConfig: kc}\n1264: \t}\n1265: \n1266: \ttests := map[string]struct {\n1267: \t\told, new *clabtypes.NodeConfig\n1268: \t\twant     bool\n1269: \t}{\n1270: \t\t\"same_components\": {\n1271: \t\t\told: chassis(\n1272: \t\t\t\t&Component{Slot: \"A\", Type: \"cpm-2s\"},\n1273: \t\t\t\t&Component{Slot: \"1\", Type: \"xcm-2s\"},\n1274: \t\t\t),\n1275: \t\t\tnew: chassis(\n1276: \t\t\t\t&Component{Slot: \"A\", Type: \"cpm-2s\"},\n1277: \t\t\t\t&Component{Slot: \"1\", Type: \"xcm-2s\"},\n1278: \t\t\t),\n1279: \t\t},\n1280: \t\t\"reordered_components\": {\n1281: \t\t\told: chassis(\n1282: \t\t\t\t&Component{Slot: \"A\", Type: \"cpm-2s\"},\n1283: \t\t\t\t&Component{Slot: \"1\", Type: \"xcm-2s\"},\n1284: \t\t\t),\n1285: \t\t\tnew: chassis(\n1286: \t\t\t\t&Component{Slot: \"1\", Type: \"xcm-2s\"},\n1287: \t\t\t\t&Component{Slot: \"A\", Type: \"cpm-2s\"},\n1288: \t\t\t),\n1289: \t\t},\n1290: \t\t\"slot_case_only\": {\n1291: \t\t\told: chassis(&Component{Slot: \"a\", Type: \"cpm-2s\"}),\n1292: \t\t\tnew: chassis(&Component{Slot: \"A\", Type: \"cpm-2s\"}),\n1293: \t\t},\n1294: \t\t\"card_type_changed\": {\n1295: \t\t\told:  chassis(&Component{Slot: \"1\", Type: \"xcm-2s\"}),\n1296: \t\t\tnew:  chassis(&Component{Slot: \"1\", Type: \"xcm-1s\"}),\n1297: \t\t\twant: true,\n1298: \t\t},\n1299: \t\t\"component_added\": {\n1300: \t\t\told: chassis(&Component{Slot: \"A\", Type: \"cpm-2s\"}),\n1301: \t\t\tnew: chassis(\n1302: \t\t\t\t&Component{Slot: \"A\", Type: \"cpm-2s\"},\n1303: \t\t\t\t&Component{Slot: \"1\", Type: \"xcm-2s\"},\n1304: \t\t\t),\n1305: \t\t\twant: true,\n1306: \t\t},\n1307: \t\t\"other_key_changed\": {\n1308: \t\t\told: chassis(&Component{Slot: \"A\", Type: \"cpm-2s\"}),\n1309: \t\t\tnew: func() *clabtypes.NodeConfig {\n1310: \t\t\t\tc := chassis(&Component{Slot: \"A\", Type: \"cpm-2s\"})\n1311: \t\t\t\tc.KindSpecificConfig.(*KindSpecificConfig).SFM = \"sfm-2s\"\n1312: \t\t\t\treturn c\n1313: \t\t\t}(),\n1314: \t\t\twant: true,\n1315: \t\t},\n1316: \t}\n1317: \n1318: \tfor name, tc := range tests {\n1319: \t\tt.Run(name, func(t *testing.T) {\n1320: \t\t\tn := &sros{}\n1321: \t\t\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n1322: \n1323: \t\t\tdiff := n.ComputeDiff(tc.old, tc.new)\n1324: \t\t\tassert.Equal(\n1325: \t\t\t\tt,\n1326: \t\t\t\ttc.want,\n1327: \t\t\t\tslices.Contains(diff.Fields, \"KindSpecificConfig\"),\n1328: \t\t\t\t\"fields %v\",\n1329: \t\t\t\tdiff.Fields,\n1330: \t\t\t)\n1331: \t\t})\n1332: \t}\n1333: }\n1334: \n1335: // Sub-nodes must use the parent's runtime, which is bound to the parent's management network.\n1336: func TestDistributedSubNodesUseParentRuntime(t *testing.T) {\n1337: \trt := clabmocksmockruntime.NewMockContainerRuntime(gomock.NewController(t))\n1338: \trt.EXPECT().Mgmt().Return(&clabtypes.MgmtNet{Network: \"oob\"}).AnyTimes()\n1339: \n1340: \tn := newSrosInitTestNode(\"sr-14s\", []*Component{{Slot: slotAName}, {Slot: \"1\"}})\n1341: \tn.Cfg.MgmtNet = \"oob\"\n1342: \trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(rt)))\n1343: \n1344: \trequire.NotNil(t, n.netnsNode)\n1345: \tassert.Same(t, rt, n.netnsNode.GetRuntime())\n1346: \tassert.Equal(t, \"oob\", n.netnsNode.Config().MgmtNet)\n1347: \trequire.Len(t, n.componentNodes, 2)\n1348: \tfor _, c := range n.componentNodes {\n1349: \t\tassert.Same(t, rt, c.GetRuntime(), \"component %s\", c.Config().ShortName)\n1350: \t}\n1351: }\n\n(End of file - total 1351 lines)\n</content>",
    "title": "source/head/nodes/sros/sros_test.go",
    "metadata": {
      "preview": "package sros\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"net\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"slices\"\n\t\"strings\"\n\t\"testing\"\n\t\"time\"\n\n\tclabconstants \"github.com/srl-labs/containerlab/constants\"\n\tclabmocksmocknodes \"github.com/srl-labs/containerlab/mocks/mocknodes\"\n\tclabmocksmockruntime \"github.com/srl-labs/containerlab/mocks/mockruntime\"\n\tclabnodes \"github.com/srl-labs/containerlab/nodes\"\n\tclabruntime \"github.com/srl-labs/containerlab/runtime\"\n\tclabtypes \"github.com/srl-labs/containerlab/types\"",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/sros_test.go",
        "text": "package sros\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"net\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"slices\"\n\t\"strings\"\n\t\"testing\"\n\t\"time\"\n\n\tclabconstants \"github.com/srl-labs/containerlab/constants\"\n\tclabmocksmocknodes \"github.com/srl-labs/containerlab/mocks/mocknodes\"\n\tclabmocksmockruntime \"github.com/srl-labs/containerlab/mocks/mockruntime\"\n\tclabnodes \"github.com/srl-labs/containerlab/nodes\"\n\tclabruntime \"github.com/srl-labs/containerlab/runtime\"\n\tclabtypes \"github.com/srl-labs/containerlab/types\"\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testify/require\"\n\t\"go.uber.org/mock/gomock\"\n)\n\nfunc TestSrosLinkApplyMode(t *testing.T) {\n\tif got := (&sros{}).LinkApplyMode(context.Background()); got != clabnodes.LinkApplyModeLive {\n\t\tt.Fatalf(\"LinkApplyMode() = %q, want %q\", got, clabnodes.LinkApplyModeLive)\n\t}\n}\n\nfunc TestCheckPortWithRetry(t *testing.T) {\n\tseed, err := net.Listen(\"tcp\", \"127.0.0.1:0\")\n\trequire.NoError(t, err)\n\n\taddr := seed.Addr().(*net.TCPAddr)\n\tport := addr.Port\n\trequire.NoError(t, seed.Close())\n\n\tdone := make(chan struct{})\n\terrCh := make(chan error, 1)\n\tgo func() {\n\t\tdefer close(done)\n\n\t\ttime.Sleep(50 * time.Millisecond)\n\t\tln, err := net.Listen(\"tcp\", fmt.Sprintf(\"127.0.0.1:%d\", port))\n\t\tif err != nil {\n\t\t\terrCh <- err\n\t\t\treturn\n\t\t}\n\t\tdefer ln.Close()\n\n\t\tconn, err := ln.Accept()\n\t\tif err != nil {\n\t\t\terrCh <- err\n\t\t\treturn\n\t\t}\n\t\tconn.Close()\n\t}()\n\n\tok, err := CheckPortWithRetry(\"127.0.0.1\", port, time.Second, 10, 25*time.Millisecond)\n\trequire.NoError(t, err)\n\trequire.True(t, ok)\n\n\tselect {\n\tcase <-done:\n\t\tselect {\n\t\tcase err := <-errCh:\n\t\t\trequire.NoError(t, err)\n\t\tdefault:\n\t\t}\n\tcase <-time.After(time.Second):\n\t\tt.Fatal(\"listener did not accept a connection\")\n\t}\n}\n\nfunc Test_sros_verifyNokiaSrsimImage(t *testing.T) {\n\tctx := context.Background()\n\n\tt.Run(\"nil_runtime_returns_nil\", func(t *testing.T) {\n\t\tn := &sros{}\n\t\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n\t\tn.Cfg = &clabtypes.NodeConfig{ShortName: \"n1\", Image: \"img\"}\n\t\terr := n.verifyNokiaSrsimImage(ctx)\n\t\tassert.NoError(t, err)\n\t})\n\n\tt.Run(\"inspect_not_implemented_returns_nil\", func(t *testing.T) {\n\t\tctrl := gomock.NewController(t)\n\t\tmockRt := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n\t\tmockRt.EXPECT().\n\t\t\tInspectImage(gomock.Any(), \"img\").\n\t\t\tReturn(nil, fmt.Errorf(\"InspectImage not implemented for Podman runtime\"))\n\t\tn := &sros{}\n\t\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n\t\tn.Cfg = &clabtypes.NodeConfig{ShortName: \"n1\", Image: \"img\"}\n\t\tn.WithRuntime(mockRt)\n\t\terr := n.verifyNokiaSrsimImage(ctx)\n\t\tassert.NoError(t, err)\n\t})\n\n\tt.Run(\"image_with_vrnetlab_label_returns_error\", func(t *testing.T) {\n\t\tctrl := gomock.NewController(t)\n\t\tmockRt := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n\t\tmockRt.EXPECT().\n\t\t\tInspectImage(gomock.Any(), \"img\").\n\t\t\tReturn(&clabruntime.ImageInspect{\n\t\t\t\tConfig: clabruntime.ImageConfig{\n\t\t\t\t\tLabels: map[string]string{vrnetlabVersionLabel: \"abc\"},\n\t\t\t\t},\n\t\t\t}, nil)\n\t\tn := &sros{}\n\t\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n\t\tn.Cfg = &clabtypes.NodeConfig{ShortName: \"n1\", Image: \"img\"}\n\t\tn.WithRuntime(mockRt)\n\t\terr := n.verifyNokiaSrsimImage(ctx)\n\t\trequire.Error(t, err)\n\t\tassert.Contains(t, err.Error(), \"vrnetlab\")\n\t\tassert.Contains(t, err.Error(), \"n1\")\n\t})\n\n\tt.Run(\"image_with_srsim_title_returns_nil\", func(t *testing.T) {\n\t\tctrl := gomock.NewController(t)\n\t\tmockRt := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n\t\tmockRt.EXPECT().\n\t\t\tInspectImage(gomock.Any(), \"img\").\n\t\t\tReturn(&clabruntime.ImageInspect{\n\t\t\t\tConfig: clabruntime.ImageConfig{\n\t\t\t\t\tLabels: map[string]string{srosImageTitleLabel: srosImageTitle},\n\t\t\t\t},\n\t\t\t}, nil)\n\t\tn := &sros{}\n\t\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n\t\tn.Cfg = &clabtypes.NodeConfig{ShortName: \"n1\", Image: \"img\"}\n\t\tn.WithRuntime(mockRt)\n\t\terr := n.verifyNokiaSrsimImage(ctx)\n\t\tassert.NoError(t, err)\n\t})\n\n\tt.Run(\"image_without_correct_labels_returns_nil_and_warns\", func(t *testing.T) {\n\t\tctrl := gomock.NewController(t)\n\t\tmockRt := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n\t\tmockRt.EXPECT().\n\t\t\tInspectImage(gomock.Any(), \"img\").\n\t\t\tReturn(&clabruntime.ImageInspect{\n\t\t\t\tConfig: clabruntime.ImageConfig{\n\t\t\t\t\tLabels: map[string]string{\"other\": \"label\"},\n\t\t\t\t},\n\t\t\t}, nil)\n\t\tn := &sros{}\n\t\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n\t\tn.Cfg = &clabtypes.NodeConfig{ShortName: \"n1\", Image: \"img\"}\n\t\tn.WithRuntime(mockRt)\n\t\terr := n.verifyNokiaSrsimImage(ctx)\n\t\tassert.NoError(t, err)\n\t})\n}\n\nfunc Test_sros_buildStartupConfig(t *testing.T) {\n\tt.Run(\"full_config_from_file\", func(t *testing.T) {\n\t\tdir := t.TempDir()\n\t\tcfgPath := filepath.Join(dir, \"startup.cfg\")\n\t\tconst content = \"system name foo\\n\"\n\t\trequire.NoError(t, os.WriteFile(cfgPath, []byte(content), 0o600))\n\n\t\tn := &sros{}\n\t\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n\t\tn.Cfg = &clabtypes.NodeConfig{\n\t\t\tShortName:     \"n1\",\n\t\t\tLongName:      \"lab-n1\",\n\t\t\tStartupConfig: cfgPath,\n\t\t}\n\t\tn.swVersion = &SrosVersion{\"0\", \"0\", \"0\"}\n\n\t\tcfg, err := n.buildStartupConfig(false) // full config, not partial\n\t\trequire.NoError(t, err)\n\t\tassert.Contains(t, cfg, \"system name foo\")\n\t})\n\n\tt.Run(\"default_and_partial_path\", func(t *testing.T) {\n\t\tctrl := gomock.NewController(t)\n\t\tmockRt := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n\t\tmockRt.EXPECT().Mgmt().Return(&clabtypes.MgmtNet{MTU: 1500}).AnyTimes()\n\n\t\tissueCert := false\n\t\tn := &sros{}\n\t\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n\t\tn.Cfg = &clabtypes.NodeConfig{\n\t\t\tShortName:     \"n1\",\n\t\t\tLongName:      \"lab-n1\",\n\t\t\tNodeType:      \"sr-1\",\n\t\t\tStartupConfig: \"\",\n\t\t\tCertificate:   &clabtypes.CertificateConfig{Issue: &issueCert},\n\t\t\tTLSKey:        \"\",\n\t\t\tTLSCert:       \"\",\n\t\t\tTLSAnchor:     \"\",\n\t\t\tLabDir:        t.TempDir(),\n\t\t}\n\t\tkindSpecificConfig.Of(n.Cfg).ConfigMode = ConfigModeModelDriven\n\t\tn.WithRuntime(mockRt)\n\t\tn.swVersion = &SrosVersion{\"0\", \"0\", \"0\"}\n\n\t\tcfg, err := n.buildStartupConfig(true) // no full config; use default + partial\n\t\trequire.NoError(t, err)\n\t\tassert.NotEmpty(t, cfg)\n\t\t// Default config should include typical SR OS snippets (banner, system, etc.)\n\t\tassert.Contains(t, cfg, \"Welcome to Nokia SR OS\")\n\t})\n}\n\nfunc Test_sros_generateComponentConfig(t *testing.T) {\n\tintegratedDefaults := []struct {\n\t\tname      string\n\t\tnodeType  string\n\t\tcardType  string\n\t\tmdas      MDAS\n\t\tpowerType string\n\t}{\n\t\t{\n\t\t\tname:     \"integrated_sr1_default\",\n\t\t\tnodeType: \"sr-1\",\n\t\t\tcardType: \"iom-1\",\n\t\t\tmdas: MDAS{\n\t\t\t\t{Slot: 1, Type: \"me6-100gb-qsfp28\"},\n\t\t\t\t{Slot: 2, Type: \"me12-100gb-qsfp28\"},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname:      \"integrated_sr1s_default\",\n\t\t\tnodeType:  \"sr-1s\",\n\t\t\tcardType:  \"xcm-1s\",\n\t\t\tmdas:      MDAS{{Slot: 1, Type: \"s36-100gb-qsfp28\"}},\n\t\t\tpowerType: \"ps-a4-shelf-dc\",\n\t\t},\n\t\t{\n\t\t\tname:     \"integrated_ixr_r6_default\",\n\t\t\tnodeType: \"ixr-r6\",\n\t\t\tcardType: \"iom-ixr-r6\",\n\t\t\tmdas:     MDAS{{Slot: 1, Type: \"m6-10g-sfp++1-100g-qsfp28\"}},\n\t\t},\n\t\t{\n\t\t\tname:     \"integrated_ixr_e2_default\",\n\t\t\tnodeType: \"ixr-e2\",\n\t\t\tcardType: \"imm2-qsfpdd+2-qsfp28+24-sfp28\",\n\t\t\tmdas:     MDAS{{Slot: 1, Type: \"m2-qsfpdd+2-qsfp28+24-sfp28\"}},\n\t\t},\n\t\t{\n\t\t\tname:     \"integrated_ixr_e2c_default\",\n\t\t\tnodeType: \"ixr-e2c\",\n\t\t\tcardType: \"imm12-sfp28+2-qsfp28\",\n\t\t\tmdas:     MDAS{{Slot: 1, Type: \"m12-sfp28+2-qsfp28\"}},\n\t\t},\n\t\t{\n\t\t\tname:     \"integrated_ixr_e2n_default\",\n\t\t\tnodeType: \"ixr-e2n\",\n\t\t\tcardType: \"imm4-sfp+4-sfp+\",\n\t\t\tmdas:     MDAS{{Slot: 1, Type: \"m4-sfp+4-sfp+\"}},\n\t\t},\n\t\t{\n\t\t\tname:     \"integrated_ixr_e2n_s_default\",\n\t\t\tnodeType: \"ixr-e2n-s\",\n\t\t\tcardType: \"imm4-sfp+4-sfp+-s\",\n\t\t\tmdas:     MDAS{{Slot: 1, Type: \"m4-sfp+4-sfp+-s\"}},\n\t\t},\n\t\t{\n\t\t\tname:     \"integrated_ixr_e3c_default\",\n\t\t\tnodeType: \"ixr-e3c\",\n\t\t\tcardType: \"imm4-qsfp28+16-sfp28+8-sfp56\",\n\t\t\tmdas:     MDAS{{Slot: 1, Type: \"m4-qsfp28+16-sfp28+8-sfp56\"}},\n\t\t},\n\t\t{\n\t\t\tname:     \"integrated_ixr_e3x_default\",\n\t\t\tnodeType: \"ixr-e3x\",\n\t\t\tcardType: \"imm16-sfp112+15-sfp56+6-qsfpdd\",\n\t\t\tmdas:     MDAS{{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"}},\n\t\t},\n\t\t{\n\t\t\tname:     \"integrated_ixr_e2sc_default\",\n\t\t\tnodeType: \"ixr-e2sc\",\n\t\t\tcardType: \"imm16-sfp++4-sfp28\",\n\t\t\tmdas:     MDAS{{Slot: 1, Type: \"m16-sfp++4-sfp28\"}},\n\t\t},\n\t\t{\n\t\t\tname:     \"integrated_ixr_ec_default\",\n\t\t\tnodeType: \"ixr-ec\",\n\t\t\tcardType: \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n\t\t\tmdas:     MDAS{{Slot: 1, Type: \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\"}},\n\t\t},\n\t}\n\tfor _, tc := range integratedDefaults {\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\tn := newSrosComponentConfigTestNode(tc.nodeType, nil, nil)\n\n\t\t\tcfg := n.generateComponentConfig()\n\n\t\t\tassert.Contains(\n\t\t\t\tt,\n\t\t\t\tcfg,\n\t\t\t\tfmt.Sprintf(\"/configure card 1 card-type %s admin-state enable\", tc.cardType),\n\t\t\t)\n\t\t\tfor _, mda := range tc.mdas {\n\t\t\t\tassert.Contains(t, cfg, fmt.Sprintf(\n\t\t\t\t\t\"/configure card 1 mda %d mda-type %s admin-state enable\",\n\t\t\t\t\tmda.Slot,\n\t\t\t\t\tmda.Type,\n\t\t\t\t))\n\t\t\t}\n\t\t\tif tc.powerType == \"\" {\n\t\t\t\tassert.NotContains(t, cfg, \"power-shelf\")\n\t\t\t\tassert.NotContains(t, cfg, \"power-module\")\n\t\t\t} else {\n\t\t\t\tassert.Contains(\n\t\t\t\t\tt,\n\t\t\t\t\tcfg,\n\t\t\t\t\tfmt.Sprintf(\"power-shelf 1 power-shelf-type %s\", tc.powerType),\n\t\t\t\t)\n\t\t\t\tassert.Equal(t, 4, strings.Count(cfg, \"power-module-type ps-a-dc-6000\"))\n\t\t\t}\n\t\t})\n\t}\n\n\tt.Run(\"integrated_component_mda_override_preserves_default_mda_slots\", func(t *testing.T) {\n\t\tn := newSrosComponentConfigTestNode(\"sr-1\", nil, []*Component{\n\t\t\t{MDA: MDAS{{Slot: 1, Type: \"custom-mda\"}}},\n\t\t})\n\n\t\tcfg := n.generateComponentConfig()\n\n\t\tassert.Contains(t, cfg, \"/configure card 1 card-type iom-1 admin-state enable\")\n\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type custom-mda admin-state enable\")\n\t\tassert.Contains(\n\t\t\tt,\n\t\t\tcfg,\n\t\t\t\"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable\",\n\t\t)\n\t})\n\n\tt.Run(\"integrated_xiom_replaces_default_mdas\", func(t *testing.T) {\n\t\tn := newSrosComponentConfigTestNode(\"sr-1s\", nil, []*Component{\n\t\t\t{\n\t\t\t\tXIOM: XIOMS{\n\t\t\t\t\t{\n\t\t\t\t\t\tSlot: 1,\n\t\t\t\t\t\tType: \"iom-s-3.0t\",\n\t\t\t\t\t\tMDA: MDAS{\n\t\t\t\t\t\t\t{Slot: 1, Type: \"ms18-100gb-qsfp28\"},\n\t\t\t\t\t\t\t{Slot: 2, Type: \"ms2-400gb-qsfpdd+2-100gb-qsfp28\"},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\n\t\tcfg := n.generateComponentConfig()\n\n\t\tassert.Contains(t, cfg, \"/configure card 1 card-type xcm-1s admin-state enable\")\n\t\tassert.Contains(t, cfg, \"/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\")\n\t\tassert.Contains(\n\t\t\tt,\n\t\t\tcfg,\n\t\t\t\"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\",\n\t\t)\n\t\tassert.Contains(\n\t\t\tt,\n\t\t\tcfg,\n\t\t\t\"/configure card 1 xiom x1 mda 2 mda-type ms2-400gb-qsfpdd+2-100gb-qsfp28 admin-state enable\",\n\t\t)\n\t\tassert.NotContains(t, cfg, \"s36-100gb-qsfp28\")\n\t})\n\n\tt.Run(\"integrated_env_mda_overrides_default_component_config\", func(t *testing.T) {\n\t\tn := newSrosComponentConfigTestNode(\n\t\t\t\"sr-1\",\n\t\t\tmap[string]string{envNokiaSrosMDA + \"_1\": \"env-mda\"},\n\t\t\tnil,\n\t\t)\n\n\t\tcfg := n.generateComponentConfig()\n\n\t\tassert.Contains(\n\t\t\tt,\n\t\t\tcfg,\n\t\t\t\"/configure card 1 mda 1 mda-type env-mda admin-state enable\",\n\t\t)\n\t\tassert.Contains(\n\t\t\tt,\n\t\t\tcfg,\n\t\t\t\"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable\",\n\t\t)\n\t\tassert.NotContains(t, cfg, \"me6-100gb-qsfp28\")\n\t})\n\n\tt.Run(\"integrated_env_mda_overrides_component_mda\", func(t *testing.T) {\n\t\tn := newSrosComponentConfigTestNode(\n\t\t\t\"sr-1\",\n\t\t\tmap[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"},\n\t\t\t[]*Component{{MDA: MDAS{{Slot: 1, Type: \"from-component\"}}}},\n\t\t)\n\n\t\tcfg := n.generateComponentConfig()\n\n\t\tassert.Contains(\n\t\t\tt,\n\t\t\tcfg,\n\t\t\t\"/configure card 1 mda 1 mda-type from-env admin-state enable\",\n\t\t)\n\t\tassert.NotContains(t, cfg, \"from-component\")\n\t})\n\n\tt.Run(\"integrated_card_override_skips_component_config\", func(t *testing.T) {\n\t\tn := newSrosComponentConfigTestNode(\n\t\t\t\"sr-1s\",\n\t\t\tmap[string]string{\n\t\t\t\tenvNokiaSrosCard:       \"cpm-1s\",\n\t\t\t\tenvNokiaSrosMDA + \"_1\": \"env-mda\",\n\t\t\t},\n\t\t\tnil,\n\t\t)\n\n\t\tassert.Empty(t, n.generateComponentConfig())\n\t})\n\n\tt.Run(\"integrated_component_override_adds_mda_slot\", func(t *testing.T) {\n\t\tn := newSrosComponentConfigTestNode(\"ixr-r6\", nil, []*Component{\n\t\t\t{MDA: MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}}},\n\t\t})\n\n\t\tcfg := n.generateComponentConfig()\n\n\t\tassert.Contains(\n\t\t\tt,\n\t\t\tcfg,\n\t\t\t\"/configure card 1 mda 1 mda-type m6-10g-sfp++1-100g-qsfp28 admin-state enable\",\n\t\t)\n\t\tassert.Contains(t, cfg, \"/configure card 1 mda 3 mda-type m20-1g-csfp admin-state enable\")\n\t})\n\n\tt.Run(\"disabled_component_config_returns_empty\", func(t *testing.T) {\n\t\tn := newSrosComponentConfigTestNode(\"sr-1\", nil, nil)\n\t\tkindSpecificConfig.Of(n.Cfg).GenComponentConfig = false\n\n\t\tassert.Empty(t, n.generateComponentConfig())\n\t})\n\n\tt.Run(\"classic_config_returns_empty\", func(t *testing.T) {\n\t\tn := newSrosComponentConfigTestNode(\"sr-1\", nil, nil)\n\t\tkindSpecificConfig.Of(n.Cfg).ConfigMode = ConfigModeClassic\n\n\t\tassert.Empty(t, n.generateComponentConfig())\n\t})\n\n\tt.Run(\"distributed_components_still_generate\", func(t *testing.T) {\n\t\tn := newSrosComponentConfigTestNode(\"sr-2s\", nil, nil)\n\t\tkindSpecificConfig.Of(n.Cfg).SFM = \"sfm-2s\"\n\t\tn.rootCtrName = \"clab-test-sr2s-a\"\n\t\tn.rootComponents = []*Component{\n\t\t\t{Slot: slotAName, Type: \"cpm-2s\"},\n\t\t\t{\n\t\t\t\tSlot: \"1\",\n\t\t\t\tType: \"xcm-2s\",\n\t\t\t\tXIOM: XIOMS{\n\t\t\t\t\t{\n\t\t\t\t\t\tSlot: 1,\n\t\t\t\t\t\tType: \"iom-s-3.0t\",\n\t\t\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"ms18-100gb-qsfp28\"}},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\tcfg := n.generateComponentConfig()\n\n\t\tassert.Contains(t, cfg, \"/configure card 1 card-type xcm-2s admin-state enable\")\n\t\tassert.Contains(t, cfg, \"/configure sfm 1 sfm-type sfm-2s admin-state enable\")\n\t\tassert.Contains(t, cfg, \"/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\")\n\t\tassert.Contains(\n\t\t\tt,\n\t\t\tcfg,\n\t\t\t\"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\",\n\t\t)\n\t\tassert.Contains(t, cfg, \"power-shelf 1 power-shelf-type ps-a4-shelf-dc\")\n\t})\n}\n\nfunc Test_sros_integratedComponentOverrides(t *testing.T) {\n\tt.Run(\"integrated_component_override_sets_env\", func(t *testing.T) {\n\t\tn := newSrosInitTestNode(\"ixr-r6\", []*Component{\n\t\t\t{\n\t\t\t\tSlot: slotBName,\n\t\t\t\tType: \"cpiom-ixr-r6\",\n\t\t\t\tMDA:  MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}},\n\t\t\t},\n\t\t})\n\n\t\terr := n.Init(n.Cfg)\n\n\t\trequire.NoError(t, err)\n\t\tassert.True(t, n.isStandaloneNode())\n\t\tassert.Equal(t, slotBName, n.Cfg.Env[envNokiaSrosSlot])\n\t\tassert.Equal(t, \"cpiom-ixr-r6\", n.Cfg.Env[envNokiaSrosCard])\n\t\tassert.Equal(t, \"m20-1g-csfp\", n.Cfg.Env[envNokiaSrosMDA+\"_3\"])\n\n\t\tassert.Empty(t, n.generateComponentConfig())\n\t})\n\n\tt.Run(\"integrated_component_xiom_sets_env\", func(t *testing.T) {\n\t\tn := newSrosInitTestNode(\"sr-1s\", []*Component{\n\t\t\t{\n\t\t\t\tXIOM: XIOMS{\n\t\t\t\t\t{\n\t\t\t\t\t\tSlot: 1,\n\t\t\t\t\t\tType: \"iom-s-3.0t\",\n\t\t\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"ms18-100gb-qsfp28\"}},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\n\t\trequire.NoError(t, n.Init(n.Cfg))\n\t\tassert.Equal(t, \"iom-s-3.0t\", n.Cfg.Env[envNokiaSrosXIOM+\"_X1\"])\n\t\tassert.Equal(t, \"ms18-100gb-qsfp28\", n.Cfg.Env[envNokiaSrosMDA+\"_X1_1\"])\n\n\t\tcfg := n.generateComponentConfig()\n\t\tassert.Contains(t, cfg, \"/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\")\n\t\tassert.Contains(\n\t\t\tt,\n\t\t\tcfg,\n\t\t\t\"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\",\n\t\t)\n\t})\n\n\tt.Run(\"integrated_rejects_multiple_components\", func(t *testing.T) {\n\t\tfor _, tc := range []struct {\n\t\t\tnodeType   string\n\t\t\tcomponents []*Component\n\t\t}{\n\t\t\t{\"sr-1\", []*Component{{Slot: slotAName}, {Slot: slotBName}}},\n\t\t\t{\"ixr-r6\", []*Component{{Slot: slotAName}, {Slot: \"1\"}}},\n\t\t\t{\"ixr-r6\", []*Component{{Slot: slotAName}, {}}},\n\t\t} {\n\t\t\tn := newSrosInitTestNode(tc.nodeType, tc.components)\n\n\t\t\terr := n.Init(n.Cfg)\n\n\t\t\trequire.Error(t, err, tc.nodeType)\n\t\t\tassert.Contains(t, err.Error(), \"at most one component override\")\n\t\t}\n\t})\n\n\tt.Run(\"redundant_integrated_components_are_distributed\", func(t *testing.T) {\n\t\tn := newSrosInitTestNode(\"ixr-r6\", []*Component{\n\t\t\t{Slot: slotAName, MDA: MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}}},\n\t\t\t{Slot: slotBName},\n\t\t})\n\n\t\trequire.NoError(t, n.Init(n.Cfg))\n\t\tassert.True(t, n.isDistributedBaseNode())\n\t\trequire.Len(t, n.componentNodes, 2)\n\n\t\tcpmA := n.componentNodes[0].(*sros)\n\t\tcpmB := n.componentNodes[1].(*sros)\n\t\tassert.Equal(t, slotAName, cpmA.Config().Env[envNokiaSrosSlot])\n\t\tassert.Equal(t, slotBName, cpmB.Config().Env[envNokiaSrosSlot])\n\t\tassert.Equal(t, \"container:n1-netns\", cpmA.Config().NetworkMode)\n\t\tassert.Equal(t, \"container:n1-netns\", cpmB.Config().NetworkMode)\n\n\t\tcfgA := cpmA.generateComponentConfig()\n\t\tassert.Contains(t, cfgA, \"/configure card 1 card-type iom-ixr-r6 admin-state enable\")\n\t\tassert.Contains(\n\t\t\tt,\n\t\t\tcfgA,\n\t\t\t\"/configure card 1 mda 1 mda-type m6-10g-sfp++1-100g-qsfp28 admin-state enable\",\n\t\t)\n\t\tassert.Contains(t, cfgA, \"/configure card 1 mda 3 mda-type m20-1g-csfp admin-state enable\")\n\n\t\tcfgB := cpmB.generateComponentConfig()\n\t\tassert.Contains(t, cfgB, \"/configure card 1 card-type iom-ixr-r6 admin-state enable\")\n\t\tassert.NotContains(t, cfgB, \"m20-1g-csfp\")\n\t})\n\n\tt.Run(\"lowercase_integrated_slots_resolve_to_cpm_a\", func(t *testing.T) {\n\t\tn := newSrosInitTestNode(\"ixr-r6\", []*Component{\n\t\t\t{Slot: \"a\"},\n\t\t\t{Slot: \"b\"},\n\t\t})\n\n\t\trequire.NoError(t, n.Init(n.Cfg))\n\t\tslot, err := n.cpmSlot()\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, slotAName, slot)\n\t})\n\n\tt.Run(\"node_env_overrides_component_mda\", func(t *testing.T) {\n\t\tn := newSrosInitTestNode(\"sr-1\", []*Component{\n\t\t\t{MDA: MDAS{{Slot: 1, Type: \"from-component\"}}},\n\t\t})\n\t\tn.Cfg.Env = map[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"}\n\n\t\trequire.NoError(t, n.Init(n.Cfg))\n\t\tassert.Equal(t, \"from-env\", n.Cfg.Env[envNokiaSrosMDA+\"_1\"])\n\n\t\tcfg := n.generateComponentConfig()\n\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type from-env admin-state enable\")\n\t\tassert.NotContains(t, cfg, \"from-component\")\n\t})\n\n\tt.Run(\"node_env_overrides_sfm\", func(t *testing.T) {\n\t\tn := newSrosInitTestNode(\"sr-1\", nil)\n\t\tkindSpecificConfig.Of(n.Cfg).SFM = \"from-sfm\"\n\t\tn.Cfg.Env = map[string]string{envNokiaSrosSFM: \"from-env\"}\n\n\t\trequire.NoError(t, n.Init(n.Cfg))\n\t\tassert.Equal(t, \"from-env\", n.Cfg.Env[envNokiaSrosSFM])\n\t})\n\n\tt.Run(\"distributed_node_env_overrides_component_mda\", func(t *testing.T) {\n\t\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n\t\t\t{Slot: slotAName, Type: \"cpm-2s\"},\n\t\t\t{\n\t\t\t\tSlot: \"1\",\n\t\t\t\tType: \"xcm-2s\",\n\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"from-component\"}},\n\t\t\t},\n\t\t})\n\t\tn.Cfg.Env = map[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"}\n\n\t\trequire.NoError(t, n.Init(n.Cfg))\n\t\trequire.Len(t, n.componentNodes, 2)\n\n\t\tlinecard := n.componentNodes[1].(*sros)\n\t\tassert.Equal(t, \"from-env\", linecard.Config().Env[envNokiaSrosMDA+\"_1\"])\n\n\t\tcfg := n.componentNodes[0].(*sros).generateComponentConfig()\n\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type from-env admin-state enable\")\n\t\tassert.NotContains(t, cfg, \"from-component\")\n\t})\n\n\tt.Run(\"duplicate_component_slots_are_rejected_regardless_of_case\", func(t *testing.T) {\n\t\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n\t\t\t{Slot: \"a\"},\n\t\t\t{Slot: \"A\"},\n\t\t})\n\n\t\terr := n.checkComponentSlotsConfig()\n\n\t\trequire.Error(t, err)\n\t\tassert.Contains(t, err.Error(), \"duplicate\")\n\t})\n\n\tt.Run(\"sfm_sets_container_env\", func(t *testing.T) {\n\t\tn := newSrosInitTestNode(\"sr-1\", nil)\n\t\tkindSpecificConfig.Of(n.Cfg).SFM = \"m-sfm6-7/12\"\n\n\t\trequire.NoError(t, n.Init(n.Cfg))\n\t\tassert.Equal(t, \"m-sfm6-7/12\", n.Cfg.Env[envNokiaSrosSFM])\n\t})\n\n\tt.Run(\"single_slot_integrated_allows_card_type_override\", func(t *testing.T) {\n\t\tn := newSrosInitTestNode(\"ixr-e2n\", []*Component{\n\t\t\t{Slot: slotAName, Type: \"cpm-ixr-e2n/imm4-sfp+4-sfp+\"},\n\t\t})\n\n\t\trequire.NoError(t, n.Init(n.Cfg))\n\t\tassert.Equal(t, \"cpm-ixr-e2n/imm4-sfp+4-sfp+\", n.Cfg.Env[envNokiaSrosCard])\n\t\tassert.Empty(t, n.generateComponentConfig())\n\t})\n\n\tt.Run(\"integrated_rejects_invalid_slot\", func(t *testing.T) {\n\t\tn := newSrosInitTestNode(\"ixr-e2\", []*Component{\n\t\t\t{Slot: slotBName, Type: \"cpm-ixr-e2\"},\n\t\t})\n\n\t\terr := n.Init(n.Cfg)\n\n\t\trequire.Error(t, err)\n\t\tassert.Contains(t, err.Error(), \"expected no slot, or slot A\")\n\t})\n\n\tt.Run(\"distributed_node_still_uses_components\", func(t *testing.T) {\n\t\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n\t\t\t{Slot: slotAName, Type: \"cpm-2s\"},\n\t\t\t{Slot: \"1\", Type: \"xcm-2s\"},\n\t\t})\n\n\t\terr := n.Init(n.Cfg)\n\n\t\trequire.NoError(t, err)\n\t\tassert.False(t, n.isStandaloneNode())\n\t\tassert.Len(t, n.componentNodes, 2)\n\t})\n}\n\nfunc newSrosComponentConfigTestNode(\n\tnodeType string,\n\tenv map[string]string,\n\tcomponents []*Component,\n) *sros {\n\tif env == nil {\n\t\tenv = map[string]string{}\n\t}\n\n\tn := &sros{}\n\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n\tn.Cfg = &clabtypes.NodeConfig{\n\t\tShortName: \"n1\",\n\t\tLongName:  \"clab-test-n1\",\n\t\tNodeType:  nodeType,\n\t\tEnv:       env,\n\t}\n\tkindSpecificConfig.Of(n.Cfg).Components = components\n\treturn n\n}\n\nfunc newSrosInitTestNode(nodeType string, components []*Component) *sros {\n\tissueCert := false\n\tn := &sros{}\n\tn.Cfg = &clabtypes.NodeConfig{\n\t\tShortName:   \"n1\",\n\t\tLongName:    \"clab-test-n1\",\n\t\tFqdn:        \"n1.clab-test.io\",\n\t\tNodeType:    nodeType,\n\t\tEnv:         map[string]string{},\n\t\tSysctls:     map[string]string{},\n\t\tCertificate: &clabtypes.CertificateConfig{Issue: &issueCert},\n\t}\n\tkindSpecificConfig.Of(n.Cfg).Components = components\n\treturn n\n}\n\nfunc TestDistributedComponentsUseNetnsContainer(t *testing.T) {\n\tcomponents := []*Component{\n\t\t{Slot: slotAName},\n\t\t{Slot: \"2\"},\n\t\t{Slot: slotBName},\n\t\t{Slot: \"1\"},\n\t}\n\tn := newSrosInitTestNode(\"sr-14s\", components)\n\tn.Cfg.Image = \"nokia_srsim:test\"\n\tn.Cfg.RestartPolicy = \"unless-stopped\"\n\tn.Cfg.MgmtIPv4Address = \"172.20.20.10\"\n\tn.Cfg.Labels = map[string]string{clabconstants.Containerlab: \"test\"}\n\n\trequire.NoError(t, n.Init(n.Cfg))\n\trequire.NotNil(t, n.netnsNode)\n\tassert.Equal(t, \"n1-netns\", n.netnsNode.Config().ShortName)\n\tassert.Equal(t, \"clab-test-n1-netns\", n.netnsNode.Config().LongName)\n\tassert.Equal(t, n.Cfg.Image, n.netnsNode.Config().Image)\n\tassert.Equal(t, \"unless-stopped\", n.netnsNode.Config().RestartPolicy)\n\tassert.Equal(t, \"true\", n.netnsNode.Config().Labels[clabconstants.InternalNode])\n\tassert.Equal(t, \"/bin/sh\", n.netnsNode.Config().Entrypoint)\n\tassert.Equal(\n\t\tt,\n\t\t`-c \"trap 'exit 0' TERM INT; sleep infinity & wait $!\"`,\n\t\tn.netnsNode.Config().Cmd,\n\t)\n\tassert.Equal(t, \"srsim-netns\", n.netnsNode.Config().Labels[clabconstants.NodeType])\n\tassert.Empty(t, n.netnsNode.Config().Labels[clabconstants.ToolType])\n\tassert.Equal(t, n.Cfg.ShortName, n.netnsNode.Config().Labels[clabconstants.RootNodeName])\n\tassert.Equal(t, n.Cfg.MgmtIPv4Address, n.netnsNode.Config().MgmtIPv4Address)\n\tassert.Equal(t, n.Cfg.Sysctls, n.netnsNode.Config().Sysctls)\n\tassert.Empty(t, n.netnsNode.Config().Env)\n\tassert.Empty(t, n.netnsNode.Config().Binds)\n\n\trequire.Len(t, n.componentNodes, len(components))\n\tfor i, component := range n.componentNodes {\n\t\tassert.Equal(t, components[i].Slot, component.Config().Env[envNokiaSrosSlot])\n\t\tassert.Equal(t, \"container:n1-netns\", component.Config().NetworkMode)\n\t\tassert.Equal(t, n.Cfg.MgmtIPv4Address, component.Config().MgmtIPv4Address)\n\t\tassert.Nil(t, component.Config().DNS)\n\t\tassert.Nil(t, component.Config().PortBindings)\n\t\tassert.Equal(t, n.Cfg.Sysctls, component.Config().Sysctls)\n\t}\n}\n\nfunc TestDistributedHolderOnlyRemainsDiscoverableForDestroy(t *testing.T) {\n\tctx := context.Background()\n\tctrl := gomock.NewController(t)\n\tmockRuntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n\tn := newSrosInitTestNode(\"sr-14s\", []*Component{\n\t\t{Slot: slotAName},\n\t\t{Slot: \"1\"},\n\t})\n\n\trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(mockRuntime)))\n\n\tholder := clabruntime.GenericContainer{\n\t\tNames:  []string{n.netnsNode.Config().LongName},\n\t\tLabels: n.netnsNode.Config().Labels,\n\t}\n\tmockRuntime.EXPECT().ListContainers(ctx, []*clabtypes.GenericFilter{\n\t\t{FilterType: \"name\", Match: \"clab-test-n1-a\"},\n\t}).Return(nil, nil)\n\tmockRuntime.EXPECT().ListContainers(ctx, []*clabtypes.GenericFilter{\n\t\t{FilterType: \"name\", Match: n.netnsNode.Config().LongName},\n\t}).Return([]clabruntime.GenericContainer{holder}, nil)\n\n\tgot, err := n.GetContainers(ctx)\n\trequire.NoError(t, err)\n\trequire.Equal(t, []clabruntime.GenericContainer{holder}, got)\n\n\tmockRuntime.EXPECT().\n\t\tGetContainerStatus(ctx, \"clab-test-n1-a\").\n\t\tReturn(clabruntime.NotFound).\n\t\tAnyTimes()\n\tmockRuntime.EXPECT().\n\t\tGetContainerStatus(ctx, \"clab-test-n1-1\").\n\t\tReturn(clabruntime.NotFound).\n\t\tAnyTimes()\n\tmockRuntime.EXPECT().\n\t\tGetContainerStatus(ctx, n.netnsNode.Config().LongName).\n\t\tReturn(clabruntime.Running)\n\tmockRuntime.EXPECT().DeleteContainer(ctx, n.netnsNode.Config().LongName).Return(nil)\n\n\trequire.NoError(t, n.Delete(ctx))\n}\n\nfunc TestDistributedDeleteAttemptsHolderAfterComponentError(t *testing.T) {\n\tctx := context.Background()\n\tctrl := gomock.NewController(t)\n\tmockRuntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n\tn := newSrosInitTestNode(\"sr-14s\", []*Component{\n\t\t{Slot: slotAName},\n\t\t{Slot: \"1\"},\n\t})\n\n\trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(mockRuntime)))\n\n\tcomponent := clabmocksmocknodes.NewMockNode(ctrl)\n\tn.componentNodes = []clabnodes.Node{component}\n\n\tdeleteErr := errors.New(\"component deletion failed\")\n\tcomponent.EXPECT().Delete(ctx).Return(deleteErr)\n\tcomponent.EXPECT().GetContainerStatus(ctx).Return(clabruntime.NotFound)\n\tmockRuntime.EXPECT().\n\t\tGetContainerStatus(ctx, n.netnsNode.Config().LongName).\n\t\tReturn(clabruntime.Running)\n\tmockRuntime.EXPECT().DeleteContainer(ctx, n.netnsNode.Config().LongName).Return(nil)\n\n\trequire.ErrorIs(t, n.Delete(ctx), deleteErr)\n}\n\nfunc TestEnsureNetnsRunning(t *testing.T) {\n\tctx := context.Background()\n\n\tt.Run(\"already running\", func(t *testing.T) {\n\t\tctrl := gomock.NewController(t)\n\t\truntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n\t\tn := newSrosInitTestNode(\"sr-14s\", []*Component{\n\t\t\t{Slot: slotAName}, {Slot: \"1\"},\n\t\t})\n\t\trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(runtime)))\n\t\truntime.EXPECT().GetContainerStatus(ctx, n.netnsNode.Config().LongName).\n\t\t\tReturn(clabruntime.Running)\n\n\t\trequire.NoError(t, n.ensureNetnsRunning(ctx))\n\t})\n\n\tt.Run(\"starts stopped holder\", func(t *testing.T) {\n\t\tctrl := gomock.NewController(t)\n\t\truntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n\t\tn := newSrosInitTestNode(\"sr-14s\", []*Component{\n\t\t\t{Slot: slotAName}, {Slot: \"1\"},\n\t\t})\n\t\trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(runtime)))\n\t\truntime.EXPECT().GetContainerStatus(ctx, n.netnsNode.Config().LongName).\n\t\t\tReturn(clabruntime.Stopped).Times(2)\n\t\truntime.EXPECT().\n\t\t\tStartContainer(ctx, n.netnsNode.Config().LongName, gomock.Any()).\n\t\t\tReturn(nil, nil)\n\n\t\trequire.NoError(t, n.ensureNetnsRunning(ctx))\n\t})\n\n\tt.Run(\"missing holder requires recreate\", func(t *testing.T) {\n\t\tctrl := gomock.NewController(t)\n\t\truntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n\t\tn := newSrosInitTestNode(\"sr-14s\", []*Component{\n\t\t\t{Slot: slotAName}, {Slot: \"1\"},\n\t\t})\n\t\trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(runtime)))\n\t\truntime.EXPECT().GetContainerStatus(ctx, n.netnsNode.Config().LongName).\n\t\t\tReturn(clabruntime.NotFound)\n\n\t\terr := n.ensureNetnsRunning(ctx)\n\t\trequire.Error(t, err)\n\t\tassert.Contains(t, err.Error(), \"recreate the node\")\n\t})\n}\n\nfunc TestComponentMgmtEnv(t *testing.T) {\n\tdualStack := MgmtIP{\n\t\tIPv4: \"172.20.20.10\", IPv4pLen: 24, IPv4Gw: \"172.20.20.1\",\n\t\tIPv6: \"3fff:172:20:20::10\", IPv6pLen: 64, IPv6Gw: \"3fff:172:20:20::1\",\n\t}\n\ttests := []struct {\n\t\tname string\n\t\tips  MgmtIP\n\t\tenv  map[string]string\n\t\twant map[string]string\n\t}{\n\t\t{\n\t\t\tname: \"dual stack runtime allocation\", ips: dualStack,\n\t\t\twant: map[string]string{\n\t\t\t\tenvSrosIPv4Active: \"172.20.20.10/24\", envSrosIPv6Active: \"3fff:172:20:20::10/64\",\n\t\t\t\tenvSrosStaticRoutePrefix + \"1\": \"0.0.0.0/0@172.20.20.1\",\n\t\t\t\tenvSrosStaticRoutePrefix + \"2\": \"::/0@3fff:172:20:20::1\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"IPv4 without gateway\", ips: MgmtIP{IPv4: \"192.0.2.10\", IPv4pLen: 27},\n\t\t\twant: map[string]string{envSrosIPv4Active: \"192.0.2.10/27\"},\n\t\t},\n\t\t{\n\t\t\tname: \"IPv6 only\",\n\t\t\tips:  MgmtIP{IPv6: \"2001:db8::10\", IPv6pLen: 80, IPv6Gw: \"2001:db8::1\"},\n\t\t\twant: map[string]string{\n\t\t\t\tenvSrosIPv6Active:              \"2001:db8::10/80\",\n\t\t\t\tenvSrosStaticRoutePrefix + \"2\": \"::/0@2001:db8::1\",\n\t\t\t},\n\t\t},\n\t\t{name: \"no management addresses\"},\n\t\t{\n\t\t\tname: \"explicit IPv4 opts out of both families\", ips: dualStack,\n\t\t\tenv:  map[string]string{envSrosIPv4Active: \"192.0.2.2/24\"},\n\t\t\twant: map[string]string{envSrosIPv4Active: \"192.0.2.2/24\"},\n\t\t},\n\t\t{\n\t\t\tname: \"explicit IPv6\", ips: dualStack,\n\t\t\tenv:  map[string]string{envSrosIPv6Active: \"2001:db8::2/64\"},\n\t\t\twant: map[string]string{envSrosIPv6Active: \"2001:db8::2/64\"},\n\t\t},\n\t\t{\n\t\t\tname: \"explicit route\", ips: dualStack,\n\t\t\tenv:  map[string]string{envSrosStaticRoutePrefix + \"1\": \"192.0.2.0/24@172.20.20.9\"},\n\t\t\twant: map[string]string{envSrosStaticRoutePrefix + \"1\": \"192.0.2.0/24@172.20.20.9\"},\n\t\t},\n\t\t{\n\t\t\tname: \"empty explicit route still opts out\", ips: dualStack,\n\t\t\tenv:  map[string]string{envSrosStaticRoutePrefix + \"CUSTOM\": \"\"},\n\t\t\twant: map[string]string{envSrosStaticRoutePrefix + \"CUSTOM\": \"\"},\n\t\t},\n\t\t{\n\t\t\tname: \"custom management interface\", ips: dualStack,\n\t\t\tenv:  map[string]string{\"NOKIA_SROS_MGMT_IF\": \"eth9\"},\n\t\t\twant: map[string]string{\"NOKIA_SROS_MGMT_IF\": \"eth9\"},\n\t\t},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tn := newSrosInitTestNode(\"sr-14s\", []*Component{\n\t\t\t\t{Slot: slotAName, Env: tt.env}, {Slot: slotBName}, {Slot: \"1\"},\n\t\t\t})\n\t\t\trequire.NoError(t, n.Init(n.Cfg))\n\t\t\tn.setComponentMgmtEnv(tt.ips)\n\t\t\tgot := map[string]string{}\n\t\t\tfor key, value := range n.componentNodes[0].Config().Env {\n\t\t\t\tisAddress := key == envSrosIPv4Active || key == envSrosIPv6Active\n\t\t\t\tisRoute := strings.HasPrefix(key, envSrosStaticRoutePrefix)\n\t\t\t\tif isAddress || isRoute || key == \"NOKIA_SROS_MGMT_IF\" {\n\t\t\t\t\tgot[key] = value\n\t\t\t\t}\n\t\t\t}\n\t\t\tif tt.want == nil {\n\t\t\t\tassert.Empty(t, got)\n\t\t\t} else {\n\t\t\t\tassert.Equal(t, tt.want, got)\n\t\t\t}\n\t\t\t// A per-CPM override must not suppress automatic configuration for B.\n\t\t\tif tt.ips.IPv4 != \"\" {\n\t\t\t\tassert.Equal(t, fmt.Sprintf(\"%s/%d\", tt.ips.IPv4, tt.ips.IPv4pLen),\n\t\t\t\t\tn.componentNodes[1].Config().Env[envSrosIPv4Active])\n\t\t\t}\n\t\t\tassert.NotContains(t, n.componentNodes[2].Config().Env, envSrosIPv4Active)\n\t\t\tassert.NotContains(t, n.componentNodes[2].Config().Env, envSrosIPv6Active)\n\t\t})\n\t}\n}\n\nfunc TestComponentMgmtEnvOnlyCPMSlots(t *testing.T) {\n\tfor _, slot := range []string{\"A\", \"B\", \"a\", \"b\", \"1\", \"10\", \"\", \"C\", \"invalid\"} {\n\t\tt.Run(slot, func(t *testing.T) {\n\t\t\tn := newSrosInitTestNode(\"sr-14s\", []*Component{\n\t\t\t\t{Slot: slotAName}, {Slot: \"1\"},\n\t\t\t})\n\t\t\trequire.NoError(t, n.Init(n.Cfg))\n\t\t\tenv := n.componentNodes[0].Config().Env\n\t\t\tenv[envNokiaSrosSlot] = slot\n\n\t\t\tn.setComponentMgmtEnv(MgmtIP{\n\t\t\t\tIPv4: \"192.0.2.10\", IPv4pLen: 24, IPv4Gw: \"192.0.2.1\",\n\t\t\t\tIPv6: \"2001:db8::10\", IPv6pLen: 64, IPv6Gw: \"2001:db8::1\",\n\t\t\t})\n\n\t\t\twantMgmt := slot == \"A\" || slot == \"B\" || slot == \"a\" || slot == \"b\"\n\t\t\tfor _, key := range []string{\n\t\t\t\tenvSrosIPv4Active, envSrosIPv6Active,\n\t\t\t\tenvSrosStaticRoutePrefix + \"1\", envSrosStaticRoutePrefix + \"2\",\n\t\t\t} {\n\t\t\t\t_, present := env[key]\n\t\t\t\tassert.Equal(t, wantMgmt, present, key)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestDistributedNetnsLookupAndMgmtIPs(t *testing.T) {\n\tctx := context.Background()\n\tctrl := gomock.NewController(t)\n\truntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n\t\t{Slot: slotAName},\n\t\t{Slot: \"1\"},\n\t})\n\trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(runtime)))\n\n\truntime.EXPECT().GetNSPath(ctx, \"clab-test-n1-netns\").Return(\"/proc/123/ns/net\", nil)\n\tnsPath, err := n.GetNSPath(ctx)\n\trequire.NoError(t, err)\n\tassert.Equal(t, \"/proc/123/ns/net\", nsPath)\n\n\truntime.EXPECT().\n\t\tListContainers(gomock.Any(), gomock.Any()).\n\t\tReturn([]clabruntime.GenericContainer{{\n\t\t\tID: \"holder-id\",\n\t\t\tNetworkSettings: clabruntime.GenericMgmtIPs{\n\t\t\t\tIPv4addr: \"172.20.20.10\",\n\t\t\t\tIPv4pLen: 24,\n\t\t\t\tIPv4Gw:   \"172.20.20.1\",\n\t\t\t\tIPv6addr: \"3fff:172:20:20::10\",\n\t\t\t\tIPv6pLen: 64,\n\t\t\t\tIPv6Gw:   \"3fff:172:20:20::1\",\n\t\t\t},\n\t\t}}, nil)\n\n\tips, err := n.distNodeMgmtIPs()\n\trequire.NoError(t, err)\n\tassert.Equal(t, \"172.20.20.10\", ips.IPv4)\n\tassert.Equal(t, \"3fff:172:20:20::10\", ips.IPv6)\n\tassert.Equal(t, \"holder-id\", ips.ContainerID)\n\tassert.Equal(t, \"172.20.20.1\", ips.IPv4Gw)\n\tassert.Equal(t, \"3fff:172:20:20::1\", ips.IPv6Gw)\n}\n\nfunc TestNamespaceNodeUsesDefaultLifecycle(t *testing.T) {\n\tctx := context.Background()\n\tctrl := gomock.NewController(t)\n\tmockRuntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n\tn := newSrosInitTestNode(\"sr-14s\", []*Component{\n\t\t{Slot: slotAName}, {Slot: \"1\"},\n\t})\n\trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(mockRuntime)))\n\n\tholder := n.netnsNode\n\trequire.IsType(t, &namespaceNode{}, holder)\n\trequire.Same(t, mockRuntime, holder.GetRuntime())\n\tmockRuntime.EXPECT().CreateContainer(ctx, holder.Config()).Return(\"holder-id\", nil)\n\tmockRuntime.EXPECT().StartContainer(ctx, \"holder-id\", gomock.Any()).Return(nil, nil)\n\trequire.NoError(t, holder.Deploy(ctx, nil))\n\n\tmockRuntime.EXPECT().GetNSPath(ctx, holder.Config().LongName).Return(\"/proc/123/ns/net\", nil)\n\tnsPath, err := n.GetNSPath(ctx)\n\trequire.NoError(t, err)\n\trequire.Equal(t, \"/proc/123/ns/net\", nsPath)\n\n\tmockRuntime.EXPECT().\n\t\tGetContainerStatus(ctx, holder.Config().LongName).\n\t\tReturn(clabruntime.Running)\n\tmockRuntime.EXPECT().DeleteContainer(ctx, holder.Config().LongName).Return(nil)\n\trequire.NoError(t, holder.Delete(ctx))\n}\n\nfunc TestDeployFabricUsesResolvedManagementAddresses(t *testing.T) {\n\tctx := context.Background()\n\tctrl := gomock.NewController(t)\n\tmockRuntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n\tn := newSrosInitTestNode(\"sr-14s\", []*Component{\n\t\t{Slot: slotAName}, {Slot: \"1\"},\n\t})\n\trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(mockRuntime)))\n\n\tn.Cfg.MgmtIPv4Address = \"172.20.20.10\"\n\tn.Cfg.MgmtIPv4AddressAuto = true\n\tn.Cfg.MgmtIPv4PrefixLength = 24\n\tn.Cfg.MgmtIPv4Gateway = \"172.20.20.1\"\n\tn.Cfg.MgmtIPv6Address = \"3fff:172:20:20::10\"\n\tn.Cfg.MgmtIPv6AddressAuto = true\n\tn.Cfg.MgmtIPv6PrefixLength = 64\n\tn.Cfg.MgmtIPv6Gateway = \"3fff:172:20:20::1\"\n\n\tvar components []clabnodes.Node\n\tfor _, slot := range []string{slotAName, \"1\"} {\n\t\tcomponent := clabmocksmocknodes.NewMockNode(ctrl)\n\t\tcomponent.EXPECT().Config().Return(&clabtypes.NodeConfig{\n\t\t\tEnv: map[string]string{envNokiaSrosSlot: slot},\n\t\t}).AnyTimes()\n\t\tcomponent.EXPECT().GetShortName().Return(\"n1-\" + strings.ToLower(slot)).AnyTimes()\n\t\tcomponent.EXPECT().PreDeploy(ctx, gomock.Any()).Return(nil)\n\t\tcomponent.EXPECT().Deploy(ctx, gomock.Any()).Return(nil)\n\t\tcomponents = append(components, component)\n\t}\n\tn.componentNodes = components\n\n\tmockRuntime.EXPECT().\n\t\tCreateContainer(ctx, gomock.Any()).\n\t\tDoAndReturn(func(_ context.Context, cfg *clabtypes.NodeConfig) (string, error) {\n\t\t\tassert.Equal(t, n.Cfg.MgmtIPv4Address, cfg.MgmtIPv4Address)\n\t\t\tassert.Equal(t, n.Cfg.MgmtIPv4AddressAuto, cfg.MgmtIPv4AddressAuto)\n\t\t\tassert.Equal(t, n.Cfg.MgmtIPv4PrefixLength, cfg.MgmtIPv4PrefixLength)\n\t\t\tassert.Equal(t, n.Cfg.MgmtIPv4Gateway, cfg.MgmtIPv4Gateway)\n\t\t\tassert.Equal(t, n.Cfg.MgmtIPv6Address, cfg.MgmtIPv6Address)\n\t\t\tassert.Equal(t, n.Cfg.MgmtIPv6AddressAuto, cfg.MgmtIPv6AddressAuto)\n\t\t\tassert.Equal(t, n.Cfg.MgmtIPv6PrefixLength, cfg.MgmtIPv6PrefixLength)\n\t\t\tassert.Equal(t, n.Cfg.MgmtIPv6Gateway, cfg.MgmtIPv6Gateway)\n\t\t\treturn \"holder-id\", nil\n\t\t})\n\tmockRuntime.EXPECT().StartContainer(ctx, \"holder-id\", gomock.Any()).Return(nil, nil)\n\tmockRuntime.EXPECT().\n\t\tListContainers(gomock.Any(), gomock.Any()).\n\t\tReturn([]clabruntime.GenericContainer{{\n\t\t\tID: \"holder-id\",\n\t\t\tNetworkSettings: clabruntime.GenericMgmtIPs{\n\t\t\t\tIPv4addr: n.Cfg.MgmtIPv4Address,\n\t\t\t\tIPv4pLen: n.Cfg.MgmtIPv4PrefixLength,\n\t\t\t\tIPv4Gw:   n.Cfg.MgmtIPv4Gateway,\n\t\t\t\tIPv6addr: n.Cfg.MgmtIPv6Address,\n\t\t\t\tIPv6pLen: n.Cfg.MgmtIPv6PrefixLength,\n\t\t\t\tIPv6Gw:   n.Cfg.MgmtIPv6Gateway,\n\t\t\t},\n\t\t}}, nil)\n\n\trequire.NoError(t, n.deployFabric(ctx, nil))\n}\n\nfunc TestNamespaceNodeOnlyForDistributedComponents(t *testing.T) {\n\ttests := []struct {\n\t\tname       string\n\t\tnodeType   string\n\t\tcomponents []*Component\n\t\tenv        map[string]string\n\t\twantHolder bool\n\t}{\n\t\t{name: \"integrated\", nodeType: \"sr-1\"},\n\t\t{\n\t\t\tname: \"integrated component override\", nodeType: \"sr-1\",\n\t\t\tcomponents: []*Component{{Slot: slotAName}},\n\t\t},\n\t\t{\n\t\t\tname: \"explicit distributed card\", nodeType: \"sr-14s\",\n\t\t\tenv: map[string]string{envNokiaSrosSlot: slotAName},\n\t\t},\n\t\t{\n\t\t\tname: \"distributed components\", nodeType: \"sr-14s\",\n\t\t\tcomponents: []*Component{{Slot: slotAName}, {Slot: \"1\"}},\n\t\t\twantHolder: true,\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tn := newSrosInitTestNode(tt.nodeType, tt.components)\n\t\t\tif tt.env != nil {\n\t\t\t\tn.Cfg.Env = tt.env\n\t\t\t}\n\t\t\trequire.NoError(t, n.Init(n.Cfg))\n\t\t\tif tt.wantHolder {\n\t\t\t\trequire.NotNil(t, n.netnsNode)\n\t\t\t} else {\n\t\t\t\trequire.Nil(t, n.netnsNode)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestWithoutComponentsDoesNotUseNamespaceHolder(t *testing.T) {\n\tfor _, tt := range []struct {\n\t\tname       string\n\t\tnodeType   string\n\t\tslot       string\n\t\tcomponents []*Component\n\t}{\n\t\t{name: \"integrated without components\", nodeType: \"sr-1\"},\n\t\t{name: \"integrated empty components\", nodeType: \"sr-1\", components: []*Component{}},\n\t\t{name: \"explicit CPM A\", nodeType: \"sr-14s\", slot: \"A\"},\n\t\t{name: \"explicit CPM B\", nodeType: \"sr-14s\", slot: \"B\"},\n\t\t{name: \"explicit line card\", nodeType: \"sr-14s\", slot: \"1\"},\n\t} {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tctx := context.Background()\n\t\t\tctrl := gomock.NewController(t)\n\t\t\truntime := clabmocksmockruntime.NewMockContainerRuntime(ctrl)\n\t\t\tn := newSrosInitTestNode(tt.nodeType, tt.components)\n\t\t\tif tt.slot != \"\" {\n\t\t\t\tn.Cfg.Env[envNokiaSrosSlot] = tt.slot\n\t\t\t}\n\t\t\trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(runtime)))\n\t\t\trequire.Nil(t, n.netnsNode)\n\t\t\trequire.Empty(t, n.componentNodes)\n\t\t\tassert.Empty(t, n.Cfg.NetworkMode)\n\n\t\t\t// Only the SR-SIM container may be created, started, queried or deleted.\n\t\t\t// Any additional runtime call for a holder fails the mock expectations.\n\t\t\truntime.EXPECT().CreateContainer(ctx, n.Cfg).Return(\"srsim-id\", nil)\n\t\t\truntime.EXPECT().StartContainer(ctx, \"srsim-id\", gomock.Any()).Return(nil, nil)\n\t\t\trequire.NoError(t, n.Deploy(ctx, nil))\n\t\t\truntime.EXPECT().GetNSPath(ctx, n.Cfg.LongName).Return(\"/proc/123/ns/net\", nil)\n\t\t\tnsPath, err := n.GetNSPath(ctx)\n\t\t\trequire.NoError(t, err)\n\t\t\tassert.Equal(t, \"/proc/123/ns/net\", nsPath)\n\t\t\truntime.EXPECT().GetContainerStatus(ctx, n.Cfg.LongName).Return(clabruntime.Running)\n\t\t\truntime.EXPECT().DeleteContainer(ctx, n.Cfg.LongName).Return(nil)\n\t\t\trequire.NoError(t, n.Delete(ctx))\n\t\t\trequire.Nil(t, n.netnsNode)\n\t\t})\n\t}\n}\n\nfunc TestDistributedComponentNodes(t *testing.T) {\n\ttests := map[string]struct {\n\t\tnodeType   string\n\t\tcomponents []*Component\n\t\twant       bool\n\t}{\n\t\t\"standalone_without_components\": {\n\t\t\tnodeType: \"sr-1\",\n\t\t},\n\t\t\"integrated_with_component\": {\n\t\t\tnodeType: \"ixr-r6\",\n\t\t\tcomponents: []*Component{\n\t\t\t\t{Slot: slotBName, Type: \"cpiom-ixr-r6\", MDA: MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}}},\n\t\t\t},\n\t\t},\n\t\t\"distributed_chassis_single_cpm\": {\n\t\t\tnodeType:   \"sr-2s\",\n\t\t\tcomponents: []*Component{{Slot: slotAName, Type: \"cpm-2s\"}},\n\t\t},\n\t\t\"distributed_chassis_cpm_and_linecard\": {\n\t\t\tnodeType: \"sr-2s\",\n\t\t\tcomponents: []*Component{\n\t\t\t\t{Slot: slotAName, Type: \"cpm-2s\"},\n\t\t\t\t{Slot: \"1\", Type: \"xcm-2s\"},\n\t\t\t},\n\t\t\twant: true,\n\t\t},\n\t\t\"distributed_chassis_dual_cpm\": {\n\t\t\tnodeType:   \"sr-7\",\n\t\t\tcomponents: []*Component{{Slot: slotAName}, {Slot: slotBName}},\n\t\t\twant:       true,\n\t\t},\n\t}\n\n\tfor name, tc := range tests {\n\t\tt.Run(name, func(t *testing.T) {\n\t\t\tn := newSrosInitTestNode(tc.nodeType, tc.components)\n\t\t\trequire.NoError(t, n.Init(n.Cfg))\n\t\t\tassert.Equal(t, tc.want, len(n.componentNodes) > 0)\n\t\t})\n\t}\n}\n\nfunc TestComputeDiffComponents(t *testing.T) {\n\tchassis := func(components ...*Component) *clabtypes.NodeConfig {\n\t\tkc := &KindSpecificConfig{GenComponentConfig: true, Components: components}\n\t\treturn &clabtypes.NodeConfig{Kind: \"nokia_srsim\", NodeType: \"sr-2s\", KindSpecificConfig: kc}\n\t}\n\n\ttests := map[string]struct {\n\t\told, new *clabtypes.NodeConfig\n\t\twant     bool\n\t}{\n\t\t\"same_components\": {\n\t\t\told: chassis(\n\t\t\t\t&Component{Slot: \"A\", Type: \"cpm-2s\"},\n\t\t\t\t&Component{Slot: \"1\", Type: \"xcm-2s\"},\n\t\t\t),\n\t\t\tnew: chassis(\n\t\t\t\t&Component{Slot: \"A\", Type: \"cpm-2s\"},\n\t\t\t\t&Component{Slot: \"1\", Type: \"xcm-2s\"},\n\t\t\t),\n\t\t},\n\t\t\"reordered_components\": {\n\t\t\told: chassis(\n\t\t\t\t&Component{Slot: \"A\", Type: \"cpm-2s\"},\n\t\t\t\t&Component{Slot: \"1\", Type: \"xcm-2s\"},\n\t\t\t),\n\t\t\tnew: chassis(\n\t\t\t\t&Component{Slot: \"1\", Type: \"xcm-2s\"},\n\t\t\t\t&Component{Slot: \"A\", Type: \"cpm-2s\"},\n\t\t\t),\n\t\t},\n\t\t\"slot_case_only\": {\n\t\t\told: chassis(&Component{Slot: \"a\", Type: \"cpm-2s\"}),\n\t\t\tnew: chassis(&Component{Slot: \"A\", Type: \"cpm-2s\"}),\n\t\t},\n\t\t\"card_type_changed\": {\n\t\t\told:  chassis(&Component{Slot: \"1\", Type: \"xcm-2s\"}),\n\t\t\tnew:  chassis(&Component{Slot: \"1\", Type: \"xcm-1s\"}),\n\t\t\twant: true,\n\t\t},\n\t\t\"component_added\": {\n\t\t\told: chassis(&Component{Slot: \"A\", Type: \"cpm-2s\"}),\n\t\t\tnew: chassis(\n\t\t\t\t&Component{Slot: \"A\", Type: \"cpm-2s\"},\n\t\t\t\t&Component{Slot: \"1\", Type: \"xcm-2s\"},\n\t\t\t),\n\t\t\twant: true,\n\t\t},\n\t\t\"other_key_changed\": {\n\t\t\told: chassis(&Component{Slot: \"A\", Type: \"cpm-2s\"}),\n\t\t\tnew: func() *clabtypes.NodeConfig {\n\t\t\t\tc := chassis(&Component{Slot: \"A\", Type: \"cpm-2s\"})\n\t\t\t\tc.KindSpecificConfig.(*KindSpecificConfig).SFM = \"sfm-2s\"\n\t\t\t\treturn c\n\t\t\t}(),\n\t\t\twant: true,\n\t\t},\n\t}\n\n\tfor name, tc := range tests {\n\t\tt.Run(name, func(t *testing.T) {\n\t\t\tn := &sros{}\n\t\t\tn.DefaultNode = *clabnodes.NewDefaultNode(n)\n\n\t\t\tdiff := n.ComputeDiff(tc.old, tc.new)\n\t\t\tassert.Equal(\n\t\t\t\tt,\n\t\t\t\ttc.want,\n\t\t\t\tslices.Contains(diff.Fields, \"KindSpecificConfig\"),\n\t\t\t\t\"fields %v\",\n\t\t\t\tdiff.Fields,\n\t\t\t)\n\t\t})\n\t}\n}\n\n// Sub-nodes must use the parent's runtime, which is bound to the parent's management network.\nfunc TestDistributedSubNodesUseParentRuntime(t *testing.T) {\n\trt := clabmocksmockruntime.NewMockContainerRuntime(gomock.NewController(t))\n\trt.EXPECT().Mgmt().Return(&clabtypes.MgmtNet{Network: \"oob\"}).AnyTimes()\n\n\tn := newSrosInitTestNode(\"sr-14s\", []*Component{{Slot: slotAName}, {Slot: \"1\"}})\n\tn.Cfg.MgmtNet = \"oob\"\n\trequire.NoError(t, n.Init(n.Cfg, clabnodes.WithRuntime(rt)))\n\n\trequire.NotNil(t, n.netnsNode)\n\tassert.Same(t, rt, n.netnsNode.GetRuntime())\n\tassert.Equal(t, \"oob\", n.netnsNode.Config().MgmtNet)\n\trequire.Len(t, n.componentNodes, 2)\n\tfor _, c := range n.componentNodes {\n\t\tassert.Same(t, rt, c.GetRuntime(), \"component %s\", c.Config().ShortName)\n\t}\n}",
        "lineStart": 1,
        "lineEnd": 1351,
        "totalLines": 1351,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346595834,
      "end": 1792346595848
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502ea20d001ko2t1PK5tQDjgN",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502e928b001Djua5Ij7UHMAJo",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 49145,
    "input": 49125,
    "output": 19,
    "reasoning": 1,
    "cache": {
      "read": 0,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502e928b001Djua5Ij7UHMAJo",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346591883,
    "completed": 1792346595856
  },
  "parentID": "msg_1502e41aa001XEn2l1GdfLHjHR",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 49145,
    "input": 49125,
    "output": 19,
    "reasoning": 1,
    "cache": {
      "read": 0,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 19
step-start
{
  "type": "step-start",
  "id": "prt_1502ead97001SF6xbjTo4UBsW1",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502ea218001TxfPGVQVV0MLpz"
}
Reasoning
Now let me read the diff for schema, docs, README, workflow, and remaining tests. First let me check the diff for schema and docs, and also the diff for sros.go to understand what changed vs moved. Also I should check `warnUserEnvOverrides` duplication: it's duplicated inline in `Init` for SFM (lines 279-297) versus the helper in component.go. Minor.

Potential issue 1: In `Init`, `srosEnv` is a package-level map that gets mutated (`srosEnv[envNokiaSrosChassis] = n.Cfg.NodeType; srosEnv[envNokiaSrosSystemBaseMac] = mac`). This existed in base too? Let me check base sros.go. This is a data race across concurrent nodes Init — likely pre-existing. Let me check base.

Also `n.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)` — srosEnv is shared. Pre-existing presumably.

Potential issue 2: In `warnUnsupportedComponents`, when `components` is empty and node is integrated, `n.componentForConfig(nil)` → cloneComponent(nil) returns &Component{} and applyHardwareEnv applies env overrides. Then componentWarnings(nodeType, sfm, effective) — effective has one component with empty Slot → defaults to slotAName. For integrated nodes like sr-1, entry.Integrated? For "sr-1" chassis entry from chassis_info.json... componentWarnings with slotA: redundant check skip; FixedHWCfg check... For sr-1, FixedHWCfg likely empty and CPM list has iom-1? Hmm, actual chassis_info.json content unknown; test chassis doesn't have sr-1. This is best-effort warnings anyway.

Wait — there's a subtle issue: `warnUnsupportedComponents` is called from `writeChassisInfoToLabDir`, which is called in `createSROSFiles` for all standalone/card nodes... For distributed base node, createSROSFiles is called by PreDeploy of the component nodes? Actually the base node itself — does the base node's PreDeploy get called? In deployFabric, only componentNodes get PreDeploy. The base node PreDeploy is presumably called by the framework? Hmm, for distributed base node, isCPM("") returns true (no slot env) so PreDeploy would create files for base node... Actually let me check base version to see if this flow is new or moved.

Let me now look at the diff for the remaining files: schema, docs, README, workflow, tests. Let me read the diff fully from the beginning. The diff is large (~3500+ lines). Let me read it in chunks.
Now let me read the diff systematically to understand what changed versus what was moved.
read · completed

Input

{
  "filePath": "/source/diff.txt",
  "limit": 1200
}

Output

<path>/source/diff.txt</path>
<type>file</type>
<content>
1: diff --git a/.github/workflows/srsim-tests.yml b/.github/workflows/srsim-tests.yml
2: index e9896cd..4aa8f48 100644
3: --- a/.github/workflows/srsim-tests.yml
4: +++ b/.github/workflows/srsim-tests.yml
5: @@ -41,22 +41,21 @@ jobs:
6:      if: needs.check-license.outputs.available == 'true'
7:      env:
8:        SRSIM_IMAGE_TAG: 26.7.R1
9:      strategy:
10:        matrix:
11: -        test-suite:
12: -          - "01*.robot"
13: -          - "03*.robot"
14: -          - "04*.robot"
15: -          - "05*.robot"
16: -          - "06*.robot"
17: -          - "07*.robot"
18: -          - "08*.robot"
19: -          - "09*.robot"
20: -          - "10*.robot"
21: -          - "11*.robot"
22: -          - "12*.robot"
23: +        include:
24: +          - shard: basic
25: +            test_suites: "01-sros-to-linux.robot 07-srsim-with-mgmt-network.robot 12-srsim-veth-stitch.robot"
26: +          - shard: lifecycle
27: +            test_suites: "04-sros-classic.robot 06-srsim-sar.robot 10-srsim-lifecycle.robot"
28: +          - shard: components
29: +            test_suites: "05-sros-comp-to-linux.robot 09-srsim-pause-container.robot 14-srsim-new-chassis.robot"
30: +          - shard: provisioning
31: +            test_suites: "03-sros-dist-to-linux.robot 08-srsim-comp-cfg-test.robot 13-srsim-integrated.robot"
32: +          - shard: apply
33: +            test_suites: "11-srsim-apply.robot"
34:      steps:
35:        - name: Checkout
36:          uses: actions/checkout@v7
37:          with:
38:            fetch-depth: 0
39: @@ -92,34 +91,39 @@ jobs:
40:          run: uv sync --all-extras --dev
41:  
42:        - name: Activate virtualenv
43:          run: |
44:            . .venv/bin/activate
45: -          echo PATH=$PATH >> $GITHUB_ENV
46: +          echo "PATH=$PATH" >> "$GITHUB_ENV"
47:  
48: -      - name: Sanitize test-suite name
49: -        run: echo "TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')" >> $GITHUB_ENV
50: +      - name: Set shard name
51: +        run: echo "TEST_SUITE=${{ matrix.shard }}" >> "$GITHUB_ENV"
52:  
53:        - name: Login to GitHub Container Registry
54:          uses: docker/login-action@v4
55:          with:
56:            registry: ghcr.io
57:            username: ${{ github.actor }}
58:            password: ${{ github.token }}
59:  
60:        - name: Pull and re-tag srsim image
61: -        run: docker pull ghcr.io/srl-labs/containerlab/nokia_srsim:${SRSIM_IMAGE_TAG} && docker tag ghcr.io/srl-labs/containerlab/nokia_srsim:${SRSIM_IMAGE_TAG} registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}
62: +        run: |
63: +          image="ghcr.io/srl-labs/containerlab/nokia_srsim:${SRSIM_IMAGE_TAG}"
64: +          docker pull "$image"
65: +          docker tag "$image" "registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}"
66:  
67:        - name: Logout from GitHub Container Registry
68:          run: docker logout ghcr.io
69:  
70:        # - name: setup tmate session
71:        #   uses: mxschmitt/action-tmate@v3
72:  
73:        - name: Run sros-srsim tests
74:          run: |
75: -          ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/13-srsim/${{ matrix.test-suite }}
76: +          for test_suite in ${{ matrix.test_suites }}; do
77: +            ./tests/rf-run.sh ${{ inputs.runtime }} "./tests/13-srsim/${test_suite}"
78: +          done
79:        # upload test reports as a zip file
80:        - name: Upload test logs
81:          uses: actions/upload-artifact@v7
82:          if: always()
83:          with:
84: diff --git a/docs/manual/kinds/sros.md b/docs/manual/kinds/sros.md
85: index 633972e..7c0f2e1 100644
86: --- a/docs/manual/kinds/sros.md
87: +++ b/docs/manual/kinds/sros.md
88: @@ -239,13 +239,19 @@ topology:
89:          NOKIA_SROS_MDA_1: me12-100gb-qsfp28 # override default MDA type in slot 1
90:  ```
91:  
92:  ///
93:  
94: -For known SR/IXR integrated nodes, containerlab's default model-driven configuration also provisions the default card and MDA configuration. The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`. If the hardware is overridden with `components` or SR-SIM environment variables, the generated SR OS card/MDA configuration follows those overrides.
95: +For known SR and IXR integrated types, containerlab generates model-driven configuration for the default card and MDA(s).
96:  
97: -Integrated nodes accept at most one `components` entry because they still run as a single container. The component slot can be omitted or set to `A`; `ixr-r6` also accepts a single `B` slot override.
98: +The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e2sc`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`.
99: +
100: +An integrated node other than `ixr-r6` runs as one container and accepts one `components` entry. The slot can be omitted or set to `A`. `ixr-r6` accepts slots `A` and `B`. Two `ixr-r6` entries, one for `A` and one for `B`, run as a dual-CPIOM node with one container per CPM. Integrated nodes do not accept numeric line-card slots.
101: +
102: +A `components` entry with `type` sets `NOKIA_SROS_CARD`. Containerlab then skips generated card and MDA configuration, because those defaults belong to the built-in card. Set `type` when the integrated card itself must change, for example `cpm-ixr-e2n/imm4-sfp+4-sfp+`.
103: +
104: +Node `env` overrides `components`: `type`, `xiom`, `mda`, per-component `env`, and the `sfm` key. When both set the same variable to different values, the environment variable wins and containerlab logs a warning naming that variable. `NOKIA_SROS_MDA_*` and `NOKIA_SROS_XIOM_*` are written into the generated configuration. `NOKIA_SROS_CARD` skips that generation, the same as a component `type`. On a distributed node, `NOKIA_SROS_SLOT` does not replace each component's slot.
105:  
106:  ### Distributed
107:  
108:  When the emulated platform is chassis-based, like SR-7, SR-14s, etc., the SR-SIM node must be defined in a distributed mode in the topology file.
109:  
110: @@ -385,16 +391,18 @@ topology:
111:  When a distributed SR-SIM node is defined using `components`, we need to take into account the following:
112:  
113:  1. Component containers are attached to an internal namespace pause container.
114:  2. When changing a MDA or card type from its default value, the configuration for card, SFM and MDA must be also defined.
115:  3. Links can be added referring to the node name. The same [interface naming](#interface-naming) convention holds for all SR-SIM nodes.
116: -4. Environment variable based configuration on per-component, or node-level will override the configuration set in `type`, `xiom` and `mda` fields.
117: +4. Environment variable based configuration on per-component, or node-level will override the configuration set in `type`, `xiom` and `mda` fields. Node-level `env` wins over both. When the values differ, containerlab logs a warning naming the environment variable that was kept.
118:  
119:  ##### Configuration for components
120:  
121:  When using the `components` structure in the node definition for a distributed node, containerlab will also generate the SR OS configuration for the installed components in the chassis, as well as relevant power supply configuration[^6] to ensure the installed components come up without requiring a user to manually provide the configuration. The same generated configuration mechanism is used for the built-in SR/IXR integrated defaults.
122:  
123: +At deploy time, containerlab reads `chassis_info.json` from the selected SR-SIM image and compares the effective `components` configuration with the hardware types listed for that chassis. Unsupported card slots and card, SFM, XIOM, or MDA types produce warnings but do not stop deployment. This is a best-effort check: compatibility that is not represented in `chassis_info.json`, such as the MDA types supported by a specific XIOM, is not validated.
124: +
125:  /// details | Disabling generated SR OS configuration for `components`
126:      type: tip
127:  You can disable this config generation behavior by setting the `gen-component-config: false` [kind-specific config key](../nodes.md#kind-specific-config) on the node, or on the base node for a distributed chassis.
128:  
129:  ```yaml hl_lines="6"
130: diff --git a/nodes/sros/README.md b/nodes/sros/README.md
131: index 3fbdee2..435bf6d 100644
132: --- a/nodes/sros/README.md
133: +++ b/nodes/sros/README.md
134: @@ -37,11 +37,23 @@ The SR OS node kind supports deploying Nokia's SR OS network operating system in
135:  - **`sros_test.go`**: Unit tests
136:    - Node type helper method tests
137:    - Edge case validation
138:    - Version parsing tests
139:  
140: -- During PreDeploy, `chassis_info.json` is read from the node image (`/opt/nokia/chassis_info.json`) and written under the node's lab directory (`n.Cfg.LabDir`) with the same filename.
141: +- **`component.go`**: Component model, slot checks, and environment precedence
142: +- **`component_config.go`**: Generated card, SFM, XIOM, and MDA configuration, including integrated defaults
143: +- **`chassis_info.go`**: Parses `chassis_info.json` and returns advisory compatibility warnings
144: +
145: +### Chassis info and component checks
146: +
147: +During PreDeploy, `createSROSFiles` reads `/opt/nokia/chassis_info.json` from the node image and writes it to `n.Cfg.LabDir/chassis_info.json`, prefixed with the license header. Failure to read the file is logged and does not stop deployment.
148: +
149: +The same file is then compared with the effective component configuration. Aliases such as `SAR-Mx` to `SAR-Hx` are followed. Unsupported slots, CPM/IOM types, SFM, XIOM, direct MDAs, and fixed-hardware mismatches produce warnings only. MDAs nested under an XIOM are not checked, because the file does not say which MDA types a given XIOM accepts.
150: +
151: +### Environment precedence
152: +
153: +Node `env` overrides per-component `env`, which overrides `type`, `xiom`, `mda`, and `sfm`. When a node environment variable replaces a different component value, containerlab logs that the component value will not be used and names the variable. `NOKIA_SROS_SLOT` still comes from each component in a distributed node, because one node-level slot cannot identify every card.
154:  
155:  ## Architecture
156:  
157:  ### Node Type Detection
158:  
159: @@ -346,29 +358,16 @@ componentConfig := ""
160:  if !isFullConfigFile(n.Cfg.StartupConfig) {
161:      componentConfig = n.generateComponentConfig()
162:  }
163:  ```
164:  
165: -For distributed SR OS deployments with multiple CPMs and linecards, this generates:
166: -- Slot-specific configuration
167: -- Card type definitions
168: -- MDA (Media Dependent Adapter) configurations
169: -- Fabric connectivity
170: +For integrated nodes and distributed line cards, this appends flat MD-CLI lines. CPM slots `A` and `B` are not provisioned as cards. `NOKIA_SROS_CARD`, or a component `type` on an integrated node, skips this generation because the built-in MDA defaults belong to the default card.
171:  
172: -Example generated component config:
173:  ```
174: -/configure {
175: -    card 1 {
176: -        card-type iom-e
177: -        mda 1 {
178: -            mda-type me12-100gb-qsfp28
179: -        }
180: -    }
181: -    card A {
182: -        card-type cpm-ixr
183: -    }
184: -}
185: +/configure card 1 card-type iom-1 admin-state enable
186: +/configure card 1 mda 1 mda-type me6-100gb-qsfp28 admin-state enable
187: +/configure sfm 1 sfm-type sfm-2s admin-state enable
188:  ```
189:  
190:  #### Phase 3: Node-Type Specific Configuration (`applyNodeTypeSpecificConfig`)
191:  
192:  This phase customizes the template data based on the node's platform type and security settings.
193: @@ -1047,83 +1046,22 @@ Each platform type has tailored configurations embedded in the `configs/` direct
194:  **SAR Classic Mode:**
195:  - **No gRPC configuration embedded**
196:  - SAR in classic mode doesn't support gRPC
197:  - Uses only CLI/NETCONF for management
198:  
199: -### Distributed SR OS Configuration
200: -
201: -For distributed deployments with multiple components (CPMs and line cards), additional configuration is generated.
202: -
203: -#### Component Configuration Generation
204: -
205: -```go
206: -func (n *sros) generateComponentConfig() string
207: -```
208: -
209: -**Generated Configuration Structure:**
210: -
211: -```
212: -/configure {
213: -    {{- range .Components }}
214: -    card {{ .Slot }} {
215: -        card-type {{ .Type }}
216: -        {{- if .MDAs }}
217: -        {{- range .MDAs }}
218: -        mda {{ .Slot }} {
219: -            mda-type {{ .Type }}
220: -        }
221: -        {{- end }}
222: -        {{- end }}
223: -    }
224: -    {{- end }}
225: -    
226: -    {{- if .FabricConfig }}
227: -    fabric {
228: -        {{ .FabricConfig }}
229: -    }
230: -    {{- end }}
231: -}
232: -```
233: +### Component configuration
234:  
235: -**Example Distributed Topology:**
236: +`generateComponentConfig` runs for integrated nodes and for the CPM of a distributed node, unless the user supplied a full startup config, selected classic mode, or set `gen-component-config: false`.
237:  
238: -```yaml
239: -nodes:
240: -  chassis1:
241: -    kind: nokia_srsim
242: -    components:
243: -      - slot: A
244: -        type: cpm-ixr
245: -      - slot: B
246: -        type: cpm-ixr
247: -      - slot: 1
248: -        type: iom-ixr
249: -        mda:
250: -          - slot: 1
251: -            type: m20-1gb-sfp-b
252: -```
253: +Known integrated types (`sr-1`, `sr-1s`, `ixr-r6`, and the `ixr-e*` pizza boxes) get built-in card and MDA lines. One `components` entry is accepted, with the slot omitted or set to `A`. `ixr-r6` also accepts `B`, and two entries (`A` and `B`) deploy a dual-CPIOM node. A component `type` sets `NOKIA_SROS_CARD` and skips generated card and MDA lines.
254:  
255: -**Generated Component Config:**
256: +Distributed line cards produce one line per card, SFM, XIOM, and direct MDA. The values are the effective ones after environment precedence, so `NOKIA_SROS_MDA_*` and `NOKIA_SROS_XIOM_*` change the generated lines.
257:  
258:  ```
259: -/configure {
260: -    card A {
261: -        card-type cpm-ixr
262: -    }
263: -    card B {
264: -        card-type cpm-ixr
265: -    }
266: -    card 1 {
267: -        card-type iom-ixr
268: -        mda 1 {
269: -            mda-type m20-1gb-sfp-b
270: -        }
271: -    }
272: -    fabric {
273: -        multiplane-mode enabled
274: -    }
275: -}
276: +/configure card 1 card-type xcm-2s admin-state enable
277: +/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable
278: +/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable
279:  ```
280:  
281:  ### Security and Certificate Management
282:  
283:  When `certificate.issue: true` is set, the system generates and injects TLS certificates.
284: @@ -1538,14 +1476,14 @@ docker ps | grep chassis1
285:  # Verify slot assignments
286:  ssh admin@clab-mylab-chassis1-cpm-a "show card state"
287:  ```
288:  
289:  **Common Causes:**
290: -- Component slots not properly defined
291: -- CPM slot names must be "A" or "B" (uppercase)
292: +- Component slots are duplicated, including slots that differ only by case
293:  - Line card slots must be numeric
294: -- Environment variables not set on components
295: +- The component type or MDA is not listed for that chassis in the image's `chassis_info.json` (this is logged as a warning and does not stop deployment)
296: +- A node-level environment variable overrides the component value; the log names the variable that was kept
297:  
298:  ## Performance Considerations
299:  
300:  ### Template Execution Performance
301:  
302: @@ -1638,7 +1576,7 @@ BSD 3-Clause License - See LICENSE file for details
303:  
304:  **Maintainers:**
305:  - Nokia Containerlab Team
306:  - Community Contributors
307:  
308: -**Last Updated:** 2025-11-15
309: -**SR OS Versions Supported:**  25.7+, 26.x (planned)
310: +**Last Updated:** 2026-10-14
311: +**SR OS Versions Supported:**  25.7+, 26.x
312: diff --git a/nodes/sros/chassis_info.go b/nodes/sros/chassis_info.go
313: index ace213b..fe5b7f8 100644
314: --- a/nodes/sros/chassis_info.go
315: +++ b/nodes/sros/chassis_info.go
316: @@ -2,10 +2,221 @@
317:  // Licensed under the BSD 3-Clause License.
318:  // SPDX-License-Identifier: BSD-3-Clause
319:  
320:  package sros
321:  
322: +import (
323: +	"encoding/json"
324: +	"fmt"
325: +	"slices"
326: +	"strconv"
327: +	"strings"
328: +)
329: +
330:  // DefaultChassisInfoPath is the path to chassis_info.json inside SROS/SR SIM container images.
331:  const DefaultChassisInfoPath = "/opt/nokia/chassis_info.json"
332:  
333:  // chassisInfoFileLicense is prepended to the chassis_info.json file written to LabDir.
334:  const chassisInfoFileLicense = "// Copyright 2026 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\n"
335: +
336: +type chassisInfoEntry struct {
337: +	Alias      string            `json:"alias"`
338: +	CPM        []string          `json:"cpm"`
339: +	IOM        []string          `json:"iom"`
340: +	IOMSlots   int               `json:"iom_slots"`
341: +	MDA        []*string         `json:"mda"`
342: +	FixedMDAs  map[string]string `json:"fixed_mdas"`
343: +	SFM        []string          `json:"sfm"`
344: +	XIOM       []string          `json:"xiom"`
345: +	FixedHWCfg string            `json:"fixed_hw_cfg"`
346: +	Integrated bool              `json:"integrated"`
347: +	Redundant  bool              `json:"redundant"`
348: +}
349: +
350: +type chassisInfo map[string]chassisInfoEntry
351: +
352: +func parseChassisInfo(content []byte) (chassisInfo, error) {
353: +	var info chassisInfo
354: +	if err := json.Unmarshal(content, &info); err != nil {
355: +		return nil, fmt.Errorf("parse chassis_info.json: %w", err)
356: +	}
357: +	return info, nil
358: +}
359: +
360: +func (i chassisInfo) entry(nodeType string) (chassisInfoEntry, bool) {
361: +	key := ""
362: +	for candidate := range i {
363: +		if strings.EqualFold(candidate, strings.TrimSpace(nodeType)) {
364: +			key = candidate
365: +			break
366: +		}
367: +	}
368: +	if key == "" {
369: +		return chassisInfoEntry{}, false
370: +	}
371: +
372: +	seen := map[string]struct{}{}
373: +	for {
374: +		if _, ok := seen[key]; ok {
375: +			return chassisInfoEntry{}, false
376: +		}
377: +		seen[key] = struct{}{}
378: +
379: +		entry := i[key]
380: +		if entry.Alias == "" {
381: +			return entry, true
382: +		}
383: +
384: +		key = ""
385: +		for candidate := range i {
386: +			if strings.EqualFold(candidate, entry.Alias) {
387: +				key = candidate
388: +				break
389: +			}
390: +		}
391: +		if key == "" {
392: +			return chassisInfoEntry{}, false
393: +		}
394: +	}
395: +}
396: +
397: +// componentWarnings returns best-effort validation warnings. It deliberately skips checks
398: +// that chassis_info.json cannot express, such as which MDA types belong under a specific XIOM.
399: +func (i chassisInfo) componentWarnings(nodeType, sfm string, components []*Component) []string {
400: +	entry, ok := i.entry(nodeType)
401: +	if !ok {
402: +		return []string{
403: +			fmt.Sprintf(
404: +				"chassis type %q is not present in chassis_info.json; component compatibility was not checked",
405: +				nodeType,
406: +			),
407: +		}
408: +	}
409: +
410: +	var warnings []string
411: +	if sfm != "" && len(entry.SFM) > 0 && !slices.Contains(entry.SFM, sfm) {
412: +		warnings = append(warnings, fmt.Sprintf(
413: +			"SFM type %q is not listed for chassis type %q",
414: +			sfm,
415: +			nodeType,
416: +		))
417: +	}
418: +
419: +	for _, component := range components {
420: +		if component == nil {
421: +			continue
422: +		}
423: +		slot := strings.ToUpper(strings.TrimSpace(component.Slot))
424: +		if slot == "" {
425: +			slot = slotAName
426: +		}
427: +
428: +		switch {
429: +		case slot == slotAName || slot == slotBName:
430: +			if slot == slotBName && !entry.Redundant {
431: +				warnings = append(warnings, fmt.Sprintf(
432: +					"component slot %s is not listed as supported for chassis type %q",
433: +					slot,
434: +					nodeType,
435: +				))
436: +			}
437: +			if component.Type != "" &&
438: +				entry.FixedHWCfg != "" &&
439: +				component.Type != entry.FixedHWCfg {
440: +				warnings = append(warnings, fmt.Sprintf(
441: +					"component type %q in slot %s does not match fixed hardware %q for chassis type %q",
442: +					component.Type,
443: +					slot,
444: +					entry.FixedHWCfg,
445: +					nodeType,
446: +				))
447: +			} else if component.Type != "" &&
448: +				entry.FixedHWCfg == "" &&
449: +				len(entry.CPM) > 0 &&
450: +				!slices.Contains(entry.CPM, component.Type) {
451: +				warnings = append(warnings, fmt.Sprintf(
452: +					"component type %q in slot %s is not listed for chassis type %q",
453: +					component.Type,
454: +					slot,
455: +					nodeType,
456: +				))
457: +			}
458: +		default:
459: +			numericSlot, err := strconv.Atoi(slot)
460: +			if err == nil {
461: +				if entry.IOMSlots > 0 && numericSlot > entry.IOMSlots {
462: +					warnings = append(warnings, fmt.Sprintf(
463: +						"component slot %s exceeds the %d IOM slots listed for chassis type %q",
464: +						slot,
465: +						entry.IOMSlots,
466: +						nodeType,
467: +					))
468: +				}
469: +				if component.Type != "" &&
470: +					len(entry.IOM) > 0 &&
471: +					!slices.Contains(entry.IOM, component.Type) {
472: +					warnings = append(warnings, fmt.Sprintf(
473: +						"component type %q in slot %s is not listed for chassis type %q",
474: +						component.Type,
475: +						slot,
476: +						nodeType,
477: +					))
478: +				}
479: +			}
480: +		}
481: +
482: +		for _, xiom := range component.XIOM {
483: +			if xiom.Type != "" &&
484: +				len(entry.XIOM) > 0 &&
485: +				!slices.Contains(entry.XIOM, xiom.Type) {
486: +				warnings = append(warnings, fmt.Sprintf(
487: +					"XIOM type %q in component slot %s is not listed for chassis type %q",
488: +					xiom.Type,
489: +					slot,
490: +					nodeType,
491: +				))
492: +			}
493: +		}
494: +
495: +		if entry.Integrated || (slot != slotAName && slot != slotBName) {
496: +			warnings = append(warnings, validateMDAs(nodeType, entry, component.MDA)...)
497: +		}
498: +	}
499: +
500: +	return warnings
501: +}
502: +
503: +func validateMDAs(nodeType string, entry chassisInfoEntry, mdas MDAS) []string {
504: +	var warnings []string
505: +	for _, mda := range mdas {
506: +		if fixed, exists := entry.FixedMDAs[strconv.Itoa(mda.Slot)]; exists {
507: +			if mda.Type != fixed {
508: +				warnings = append(warnings, fmt.Sprintf(
509: +					"MDA type %q in slot %d does not match fixed MDA %q for chassis type %q",
510: +					mda.Type,
511: +					mda.Slot,
512: +					fixed,
513: +					nodeType,
514: +				))
515: +			}
516: +			continue
517: +		}
518: +		if mda.Type != "" && !containsChassisType(entry.MDA, mda.Type) {
519: +			warnings = append(warnings, fmt.Sprintf(
520: +				"MDA type %q in slot %d is not listed for chassis type %q",
521: +				mda.Type,
522: +				mda.Slot,
523: +				nodeType,
524: +			))
525: +		}
526: +	}
527: +	return warnings
528: +}
529: +
530: +func containsChassisType(types []*string, value string) bool {
531: +	for _, typ := range types {
532: +		if typ != nil && *typ == value {
533: +			return true
534: +		}
535: +	}
536: +	return false
537: +}
538: diff --git a/nodes/sros/chassis_info_test.go b/nodes/sros/chassis_info_test.go
539: new file mode 100644
540: index 0000000..befd2b4
541: --- /dev/null
542: +++ b/nodes/sros/chassis_info_test.go
543: @@ -0,0 +1,99 @@
544: +// Copyright 2026 Nokia
545: +// Licensed under the BSD 3-Clause License.
546: +// SPDX-License-Identifier: BSD-3-Clause
547: +
548: +package sros
549: +
550: +import (
551: +	"testing"
552: +
553: +	"github.com/stretchr/testify/assert"
554: +	"github.com/stretchr/testify/require"
555: +)
556: +
557: +func TestChassisInfoComponentWarnings(t *testing.T) {
558: +	info, err := parseChassisInfo([]byte(`{
559: +		"IXR-x": {
560: +			"cpm": ["cpm-ixr-x"],
561: +			"iom": ["imm6-qsfpdd+48-sfp56"],
562: +			"iom_slots": 1,
563: +			"mda": [null],
564: +			"sfm": ["sfm-ixr-x"]
565: +		},
566: +		"SAR-Hx": {
567: +			"cpm": ["iom-sar-1x"],
568: +			"fixed_mdas": {"2": "fixed-mda"},
569: +			"integrated": true,
570: +			"mda": ["supported-mda"],
571: +			"xiom": ["supported-xiom"]
572: +		},
573: +		"SAR-Mx": {"alias": "SAR-Hx"}
574: +	}`))
575: +	require.NoError(t, err)
576: +
577: +	t.Run("supported configuration", func(t *testing.T) {
578: +		warnings := info.componentWarnings("sar-mx", "", []*Component{{
579: +			Slot: slotAName,
580: +			Type: "iom-sar-1x",
581: +			MDA: MDAS{
582: +				{Slot: 1, Type: "supported-mda"},
583: +				{Slot: 2, Type: "fixed-mda"},
584: +			},
585: +			XIOM: XIOMS{{Slot: 1, Type: "supported-xiom"}},
586: +		}})
587: +
588: +		assert.Empty(t, warnings)
589: +	})
590: +
591: +	t.Run("unsupported values warn", func(t *testing.T) {
592: +		warnings := info.componentWarnings("IXR-x", "wrong-sfm", []*Component{
593: +			{Slot: slotAName, Type: "wrong-cpm"},
594: +			{Slot: "2", Type: "wrong-iom", MDA: MDAS{{Slot: 1, Type: "wrong-mda"}}},
595: +		})
596: +
597: +		assert.Len(t, warnings, 5)
598: +		assert.Contains(t, warnings[0], "SFM type")
599: +		assert.Contains(t, warnings[1], "component type")
600: +		assert.Contains(t, warnings[2], "exceeds")
601: +		assert.Contains(t, warnings[3], "component type")
602: +		assert.Contains(t, warnings[4], "MDA type")
603: +	})
604: +
605: +	t.Run("fixed MDA mismatch warns", func(t *testing.T) {
606: +		warnings := info.componentWarnings("SAR-Hx", "", []*Component{{
607: +			Slot: slotAName,
608: +			MDA:  MDAS{{Slot: 2, Type: "wrong-mda"}},
609: +		}})
610: +
611: +		require.Len(t, warnings, 1)
612: +		assert.Contains(t, warnings[0], "does not match fixed MDA")
613: +	})
614: +
615: +	t.Run("distributed CPM slot does not validate direct MDAs", func(t *testing.T) {
616: +		warnings := info.componentWarnings("IXR-x", "", []*Component{{
617: +			Slot: slotAName,
618: +			Type: "cpm-ixr-x",
619: +			MDA:  MDAS{{Slot: 1, Type: "not-a-cpm-mda"}},
620: +		}})
621: +
622: +		assert.Empty(t, warnings)
623: +	})
624: +
625: +	t.Run("nested XIOM MDA is not guessed", func(t *testing.T) {
626: +		warnings := info.componentWarnings("SAR-Hx", "", []*Component{{
627: +			Slot: slotAName,
628: +			XIOM: XIOMS{{
629: +				Slot: 1,
630: +				Type: "supported-xiom",
631: +				MDA:  MDAS{{Slot: 1, Type: "not-in-chassis-mda-list"}},
632: +			}},
633: +		}})
634: +
635: +		assert.Empty(t, warnings)
636: +	})
637: +}
638: +
639: +func TestParseChassisInfoRejectsInvalidJSON(t *testing.T) {
640: +	_, err := parseChassisInfo([]byte(`{"SR-1":`))
641: +	require.Error(t, err)
642: +}
643: diff --git a/nodes/sros/component.go b/nodes/sros/component.go
644: index bdac689..b62efb3 100644
645: --- a/nodes/sros/component.go
646: +++ b/nodes/sros/component.go
647: @@ -1,10 +1,15 @@
648:  package sros
649:  
650:  import (
651:  	"fmt"
652: +	"maps"
653: +	"slices"
654: +	"strconv"
655:  	"strings"
656: +
657: +	"github.com/charmbracelet/log"
658:  )
659:  
660:  // Component is an SR-SIM card: a CPM (slot A or B) or a line card.
661:  type Component struct {
662:  	Slot string            `yaml:"slot,omitempty" json:"slot,omitempty"`
663: @@ -117,5 +122,188 @@ func (l *XIOMS) UnmarshalYAML(unmarshal func(any) error) error {
664:  
665:  	*l = XIOMS(entries)
666:  
667:  	return nil
668:  }
669: +
670: +func setComponentEnvVars(env map[string]string, c *Component) {
671: +	if c.Type != "" {
672: +		env[envNokiaSrosCard] = c.Type
673: +	}
674: +
675: +	for _, x := range c.XIOM {
676: +		key := fmt.Sprintf("%s_X%d", envNokiaSrosXIOM, x.Slot)
677: +		env[key] = x.Type
678: +		// add the nested MDA
679: +		for _, m := range x.MDA {
680: +			key := fmt.Sprintf("%s_X%d_%d", envNokiaSrosMDA, x.Slot, m.Slot)
681: +			env[key] = m.Type
682: +		}
683: +	}
684: +
685: +	for _, m := range c.MDA {
686: +		key := fmt.Sprintf("%s_%d", envNokiaSrosMDA, m.Slot)
687: +		env[key] = m.Type
688: +	}
689: +}
690: +
691: +func (n *sros) checkComponentSlotsConfig() error {
692: +	// check Slots are unique
693: +	componentNames := map[string]struct{}{}
694: +	for _, component := range n.kindSpecificCfg().Components {
695: +		// convert slot to upper
696: +		slot := strings.ToUpper(component.Slot)
697: +		// check if slot exists
698: +		_, exists := componentNames[slot]
699: +		if exists {
700: +			return fmt.Errorf(
701: +				"node %s slot %s duplicate definition",
702: +				n.GetShortName(),
703: +				component.Slot,
704: +			)
705: +		}
706: +		// add to component names map
707: +		componentNames[slot] = struct{}{}
708: +
709: +	}
710: +	return nil
711: +}
712: +
713: +// componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,
714: +// and per-component env. Per-component env overrides the typed fields.
715: +func componentDerivedEnv(c *Component) map[string]string {
716: +	derived := map[string]string{}
717: +	if c == nil {
718: +		return derived
719: +	}
720: +	setComponentEnvVars(derived, c)
721: +	maps.Copy(derived, c.Env)
722: +	return derived
723: +}
724: +
725: +// warnUserEnvOverrides logs when a node env var replaces a component-derived value.
726: +func warnUserEnvOverrides(node string, derived, userEnv map[string]string) {
727: +	for key, componentValue := range derived {
728: +		envValue, userSet := userEnv[key]
729: +		if !userSet || componentValue == envValue {
730: +			continue
731: +		}
732: +		log.Warn(
733: +			fmt.Sprintf(
734: +				"component value %q will not be used because environment variable %s is set",
735: +				componentValue,
736: +				key,
737: +			),
738: +			"node", node,
739: +			"env", key,
740: +			"component-value", componentValue,
741: +			"env-value", envValue,
742: +		)
743: +	}
744: +}
745: +
746: +// keepUserEnv copies component-derived keys into dst unless the user already set that key.
747: +// A user value wins, and a differing component value is logged.
748: +func keepUserEnv(node string, dst, derived, userEnv map[string]string) {
749: +	warnUserEnvOverrides(node, derived, userEnv)
750: +	for key, componentValue := range derived {
751: +		if envValue, userSet := userEnv[key]; userSet {
752: +			dst[key] = envValue
753: +			continue
754: +		}
755: +		dst[key] = componentValue
756: +	}
757: +}
758: +
759: +// cloneComponent returns a deep copy of c suitable for env overrides during config generation.
760: +func cloneComponent(c *Component) *Component {
761: +	if c == nil {
762: +		return &Component{}
763: +	}
764: +	out := *c
765: +	out.Env = maps.Clone(c.Env)
766: +	out.MDA = slices.Clone(c.MDA)
767: +	if len(c.XIOM) > 0 {
768: +		out.XIOM = make(XIOMS, len(c.XIOM))
769: +		for i, xiom := range c.XIOM {
770: +			xiom.MDA = slices.Clone(xiom.MDA)
771: +			out.XIOM[i] = xiom
772: +		}
773: +	}
774: +	return &out
775: +}
776: +
777: +// applyHardwareEnv overlays SR-SIM card, XIOM, and MDA environment variables onto c.
778: +// NOKIA_SROS_SLOT is left unchanged; it identifies the container rather than provisioned hardware.
779: +func applyHardwareEnv(c *Component, env map[string]string) {
780: +	if c == nil || len(env) == 0 {
781: +		return
782: +	}
783: +	if card := env[envNokiaSrosCard]; card != "" {
784: +		c.Type = card
785: +	}
786: +	for key, val := range env {
787: +		if val == "" {
788: +			continue
789: +		}
790: +		switch {
791: +		case strings.HasPrefix(key, envNokiaSrosMDA+"_X"):
792: +			rest := strings.TrimPrefix(key, envNokiaSrosMDA+"_X")
793: +			xiomStr, mdaStr, ok := strings.Cut(rest, "_")
794: +			if !ok {
795: +				continue
796: +			}
797: +			xiomSlot, errX := strconv.Atoi(xiomStr)
798: +			mdaSlot, errM := strconv.Atoi(mdaStr)
799: +			if errX != nil || errM != nil || xiomSlot <= 0 || mdaSlot <= 0 {
800: +				continue
801: +			}
802: +			upsertXiomMDA(c, xiomSlot, mdaSlot, val)
803: +		case strings.HasPrefix(key, envNokiaSrosMDA+"_"):
804: +			slot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosMDA+"_"))
805: +			if err != nil || slot <= 0 {
806: +				continue
807: +			}
808: +			c.MDA = upsertMDA(c.MDA, slot, val)
809: +		case strings.HasPrefix(key, envNokiaSrosXIOM+"_X"):
810: +			slot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosXIOM+"_X"))
811: +			if err != nil || slot <= 0 {
812: +				continue
813: +			}
814: +			upsertXiomType(c, slot, val)
815: +		}
816: +	}
817: +}
818: +
819: +func upsertMDA(mdas MDAS, slot int, typ string) MDAS {
820: +	for i := range mdas {
821: +		if mdas[i].Slot == slot {
822: +			mdas[i].Type = typ
823: +			return mdas
824: +		}
825: +	}
826: +	return append(mdas, MDA{Slot: slot, Type: typ})
827: +}
828: +
829: +func upsertXiomType(c *Component, slot int, typ string) {
830: +	for i := range c.XIOM {
831: +		if c.XIOM[i].Slot == slot {
832: +			c.XIOM[i].Type = typ
833: +			return
834: +		}
835: +	}
836: +	c.XIOM = append(c.XIOM, XIOM{Slot: slot, Type: typ})
837: +}
838: +
839: +func upsertXiomMDA(c *Component, xiomSlot, mdaSlot int, typ string) {
840: +	for i := range c.XIOM {
841: +		if c.XIOM[i].Slot != xiomSlot {
842: +			continue
843: +		}
844: +		c.XIOM[i].MDA = upsertMDA(c.XIOM[i].MDA, mdaSlot, typ)
845: +		return
846: +	}
847: +	c.XIOM = append(c.XIOM, XIOM{
848: +		Slot: xiomSlot,
849: +		MDA:  MDAS{{Slot: mdaSlot, Type: typ}},
850: +	})
851: +}
852: diff --git a/nodes/sros/component_config.go b/nodes/sros/component_config.go
853: index 914f3de..3985e12 100644
854: --- a/nodes/sros/component_config.go
855: +++ b/nodes/sros/component_config.go
856: @@ -4,13 +4,15 @@
857:  
858:  package sros
859:  
860:  import (
861:  	"fmt"
862: +	"maps"
863:  	"slices"
864: -	"strconv"
865:  	"strings"
866: +
867: +	"github.com/charmbracelet/log"
868:  )
869:  
870:  const integratedSrosCardSlot = "1"
871:  
872:  type integratedSrosDefaultComponent struct {
873: @@ -82,10 +84,17 @@ var integratedSrosDefaultComponents = map[string]integratedSrosDefaultComponent{
874:  		allowedSlots: []string{slotAName},
875:  		mdas: MDAS{
876:  			{Slot: 1, Type: "m16-sfp112+15-sfp56+6-qsfpdd"},
877:  		},
878:  	},
879: +	"ixr-e2sc": {
880: +		cardType:     "imm16-sfp++4-sfp28",
881: +		allowedSlots: []string{slotAName},
882: +		mdas: MDAS{
883: +			{Slot: 1, Type: "m16-sfp++4-sfp28"},
884: +		},
885: +	},
886:  	"ixr-ec": {
887:  		cardType:     "imm4-1g-tx+20-1g-sfp+6-10g-sfp+",
888:  		allowedSlots: []string{slotAName},
889:  		mdas: MDAS{
890:  			{Slot: 1, Type: "m4-1g-tx+20-1g-sfp+6-10g-sfp+"},
891: @@ -172,66 +181,44 @@ func buildComponentCfgLines(components []*Component, sfm string) []componentCfgL
892:  		}
893:  	}
894:  	return lines
895:  }
896:  
897: -func buildIntegratedComponentCfgLines(
898: -	nodeType string,
899: -	env map[string]string,
900: -) []componentCfgLine {
901: +func buildIntegratedComponentCfgLines(nodeType string, override *Component) []componentCfgLine {
902:  	component, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]
903:  	if !ok {
904:  		return nil
905:  	}
906: -
907: -	cardType := component.cardType
908: -	if envCardType := strings.TrimSpace(env[envNokiaSrosCard]); envCardType != "" {
909: -		cardType = envCardType
910: +	if override == nil {
911: +		override = &Component{}
912:  	}
913:  
914: -	lines := []componentCfgLine{
915: -		{Kind: "card", Slot: integratedSrosCardSlot, Type: cardType},
916: +	defaultMdas := component.mdas
917: +
918: +	if len(override.XIOM) > 0 {
919: +		defaultMdas = nil
920:  	}
921:  
922: -	for _, mda := range mergeIntegratedMdas(component.mdas, env) {
923: -		lines = append(lines, componentCfgLine{
924: -			Kind: "mda", Slot: integratedSrosCardSlot, MdaSlot: mda.Slot, Type: mda.Type,
925: -		})
926: +	card := &Component{
927: +		Slot: integratedSrosCardSlot,
928: +		Type: component.cardType,
929: +		XIOM: override.XIOM,
930: +		MDA:  mergeIntegratedMdas(defaultMdas, override.MDA),
931:  	}
932:  
933: -	return lines
934: +	return buildComponentCfgLines([]*Component{card}, "")
935:  }
936:  
937: -func mergeIntegratedMdas(defaults MDAS, env map[string]string) MDAS {
938: +func mergeIntegratedMdas(defaults, overrides MDAS) MDAS {
939:  	bySlot := map[int]string{}
940: -	for _, mda := range defaults {
941: +	for _, mda := range slices.Concat(defaults, overrides) {
942:  		if mda.Slot > 0 && mda.Type != "" {
943:  			bySlot[mda.Slot] = mda.Type
944:  		}
945:  	}
946:  
947: -	const prefix = envNokiaSrosMDA + "_"
948: -	for key, value := range env {
949: -		slotText, ok := strings.CutPrefix(key, prefix)
950: -		if !ok {
951: -			continue
952: -		}
953: -		slot, err := strconv.Atoi(slotText)
954: -		if err != nil || slot <= 0 {
955: -			continue
956: -		}
957: -		if value = strings.TrimSpace(value); value != "" {
958: -			bySlot[slot] = value
959: -		}
960: -	}
961: -
962: -	slots := make([]int, 0, len(bySlot))
963: -	for slot := range bySlot {
964: -		slots = append(slots, slot)
965: -	}
966: -	slices.Sort(slots)
967: -
968: +	slots := slices.Sorted(maps.Keys(bySlot))
969:  	mdas := make(MDAS, 0, len(slots))
970:  	for _, slot := range slots {
971:  		mdas = append(mdas, MDA{Slot: slot, Type: bySlot[slot]})
972:  	}
973:  	return mdas
974: @@ -257,19 +244,150 @@ func integratedSrosAllowedSlots(nodeType string) []string {
975:  		return []string{slotAName}
976:  	}
977:  	return component.allowedSlots
978:  }
979:  
980: -func isSingleSlotIntegratedSrosNodeType(nodeType string) bool {
981: -	if !isIntegratedSrosNodeType(nodeType) {
982: +func isRedundantIntegratedSrosComponents(nodeType string, components []*Component) bool {
983: +	if !isIntegratedSrosNodeType(nodeType) || len(components) < 2 {
984:  		return false
985:  	}
986: -	return len(integratedSrosAllowedSlots(nodeType)) == 1
987: +	for _, c := range components {
988: +		if strings.TrimSpace(c.Slot) == "" || !integratedSrosSlotAllowed(nodeType, c.Slot) {
989: +			return false
990: +		}
991: +	}
992: +	return true
993:  }
994:  
995:  func integratedSrosSlotAllowed(nodeType, slot string) bool {
996:  	slot = strings.ToUpper(strings.TrimSpace(slot))
997:  	if slot == "" {
998:  		slot = standaloneSlotName
999:  	}
1000:  	return slices.Contains(integratedSrosAllowedSlots(nodeType), slot)
1001:  }
1002: +
1003: +func (n *sros) generateComponentConfig() string {
1004: +	if !n.kindSpecificCfg().GenComponentConfig {
1005: +		return ""
1006: +	}
1007: +	if n.isConfigClassic() {
1008: +		return ""
1009: +	}
1010: +
1011: +	if isIntegratedSrosNodeType(n.Cfg.NodeType) {
1012: +		return n.generateIntegratedComponentConfig()
1013: +	}
1014: +
1015: +	components := n.rootComponents
1016: +	if len(components) == 0 {
1017: +		return ""
1018: +	}
1019: +
1020: +	for _, c := range components {
1021: +		slot := strings.ToUpper(strings.TrimSpace(c.Slot))
1022: +		if slot == slotAName || slot == slotBName {
1023: +			continue
1024: +		}
1025: +		if c.Type == "" {
1026: +			log.Warn(
1027: +				"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.",
1028: +				"node",
1029: +				n.Cfg.ShortName,
1030: +				"slot",
1031: +				slot,
1032: +			)
1033: +		}
1034: +	}
1035: +
1036: +	lines := buildComponentCfgLines(n.componentsForConfig(components), n.componentSFM())
1037: +	return n.componentConfigFromLines(lines)
1038: +}
1039: +
1040: +// hardwareEnv is the topology env, which overrides component type, XIOM, and MDA.
1041: +// Nodes that have not been through Init expose that env on Cfg.Env.
1042: +func (n *sros) hardwareEnv() map[string]string {
1043: +	if n.userEnv != nil {
1044: +		return n.userEnv
1045: +	}
1046: +	return n.Cfg.Env
1047: +}
1048: +
1049: +// componentSFM is the SFM used in generated config. NOKIA_SROS_SFM overrides the sfm key.
1050: +func (n *sros) componentSFM() string {
1051: +	if sfm := n.hardwareEnv()[envNokiaSrosSFM]; sfm != "" {
1052: +		return sfm
1053: +	}
1054: +	return n.kindSpecificCfg().SFM
1055: +}
1056: +
1057: +// componentForConfig clones c and applies per-component env, then node env.
1058: +func (n *sros) componentForConfig(c *Component) *Component {
1059: +	out := cloneComponent(c)
1060: +	applyHardwareEnv(out, out.Env)
1061: +	applyHardwareEnv(out, n.hardwareEnv())
1062: +	return out
1063: +}
1064: +
1065: +func (n *sros) componentsForConfig(components []*Component) []*Component {
1066: +	out := make([]*Component, len(components))
1067: +	for i, c := range components {
1068: +		out[i] = n.componentForConfig(c)
1069: +	}
1070: +	return out
1071: +}
1072: +
1073: +func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {
1074: +	powerConfig := n.generatePowerConfig()
1075: +	if len(lines) == 0 && powerConfig == "" {
1076: +		return ""
1077: +	}
1078: +
1079: +	var config strings.Builder
1080: +	for _, l := range lines {
1081: +		config.WriteString(l.String())
1082: +	}
1083: +	config.WriteString(powerConfig)
1084: +	return config.String()
1085: +}
1086: +
1087: +func (n *sros) generateIntegratedComponentConfig() string {
1088: +	card := strings.TrimSpace(n.Cfg.Env[envNokiaSrosCard])
1089: +	if card != "" {
1090: +		log.Info(
1091: +			"Card type override set on integrated chassis type, skipping component SR OS config generation",
1092: +			"node",
1093: +			n.Cfg.ShortName,
1094: +			"type",
1095: +			n.Cfg.NodeType,
1096: +			"card",
1097: +			card,
1098: +		)
1099: +		return ""
1100: +	}
1101: +
1102: +	lines := buildIntegratedComponentCfgLines(
1103: +		n.Cfg.NodeType,
1104: +		n.componentForConfig(n.integratedComponentOverride()),
1105: +	)
1106: +	return n.componentConfigFromLines(lines)
1107: +}
1108: +
1109: +// integratedComponentOverride returns the component that overrides the integrated defaults:
1110: +// the single component of a standalone node, or the component matching the slot of a
1111: +// redundant CPM node.
1112: +func (n *sros) integratedComponentOverride() *Component {
1113: +	if n.rootCtrName == "" {
1114: +		if len(n.kindSpecificCfg().Components) == 1 {
1115: +			return n.kindSpecificCfg().Components[0]
1116: +		}
1117: +		return nil
1118: +	}
1119: +
1120: +	slot := n.Cfg.Env[envNokiaSrosSlot]
1121: +	for _, c := range n.rootComponents {
1122: +		if strings.EqualFold(strings.TrimSpace(c.Slot), slot) {
1123: +			return c
1124: +		}
1125: +	}
1126: +	return nil
1127: +}
1128: diff --git a/nodes/sros/config.go b/nodes/sros/config.go
1129: index b46ae42..8ddbb21 100644
1130: --- a/nodes/sros/config.go
1131: +++ b/nodes/sros/config.go
1132: @@ -1,8 +1,22 @@
1133:  package sros
1134:  
1135: -import "golang.org/x/mod/semver"
1136: +import (
1137: +	"bytes"
1138: +	"context"
1139: +	"fmt"
1140: +	"io"
1141: +	"os"
1142: +	"path/filepath"
1143: +	"strings"
1144: +
1145: +	clabutils "github.com/srl-labs/containerlab/utils"
1146: +
1147: +	"github.com/beevik/etree"
1148: +	"github.com/charmbracelet/log"
1149: +	"golang.org/x/mod/semver"
1150: +)
1151:  
1152:  const (
1153:  	grpcMDCLIConfig    = `/configure system grpc md-cli admin-state enable`
1154:  	profileMDCLIConfig = `/configure system security aaa local-profiles profile "administrative" grpc rpc-authorization md-cli-session permit`
1155:  	tls13CipherCCM8    = `/configure system security tls server-cipher-list "clab-all" tls13-cipher 5 name tls-aes128-ccm8-sha256`
1156: @@ -18,5 +32,314 @@ func (n *sros) setVersionSpecificParams(tplData *srosTemplateData) {
1157:  		if tplData.IsSecureGrpc {
1158:  			tplData.GRPCConfig += "\n" + tls13CipherCCM8
1159:  		}
1160:  	}
1161:  }
1162: +
1163: +// buildPKIImportXML builds the NETCONF action XML that imports a PEM file into the PKI store.
1164: +func buildPKIImportXML(inputURL, outputFile, importType string) string {
1165: +	action := etree.NewElement("action")
1166: +	action.CreateAttr("xmlns", "urn:ietf:params:xml:ns:yang:1")
1167: +
1168: +	admin := action.CreateElement("admin")
1169: +	admin.CreateAttr("xmlns", "urn:nokia.com:sros:ns:yang:sr:oper-admin")
1170: +
1171: +	importElem := admin.CreateElement("system").
1172: +		CreateElement("security").
1173: +		CreateElement("pki").
1174: +		CreateElement("import")
1175: +
1176: +	// Add import parameters
1177: +	importElem.CreateElement("input-url").SetText(inputURL)
1178: +	importElem.CreateElement("output-file").SetText(outputFile)
1179: +	importElem.CreateElement("type").SetText(importType)
1180: +	importElem.CreateElement("format").SetText("pem")
1181: +	var buf bytes.Buffer
1182: +	action.WriteTo(&buf, &etree.WriteSettings{
1183: +		CanonicalText:    false,
1184: +		CanonicalAttrVal: false,
1185: +	})
1186: +	return buf.String()
1187: +}
1188: +
1189: +// buildTLSProfileXML builds the TLS profile configuration XML.
1190: +func buildTLSProfileXML() string {
1191: +	config := etree.NewElement("config")
1192: +	configure := config.CreateElement("configure")
1193: +	configure.CreateAttr("xmlns", "urn:nokia.com:sros:ns:yang:sr:conf")
1194: +	configure.CreateAttr("xmlns:nc", "urn:ietf:params:xml:ns:netconf:base:1.0")
1195: +
1196: +	certProfile := configure.CreateElement("system").
1197: +		CreateElement("security").
1198: +		CreateElement("tls").
1199: +		CreateElement("cert-profile")
1200: +

(Showing lines 1-1200 of 3945. Use offset=1201 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502ec428001X0RrZrQSaIl6iq",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502ea218001TxfPGVQVV0MLpz",
  "callID": "call_481439b83d3447ca8e460f3c",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/diff.txt",
      "limit": 1200
    },
    "output": "<path>/source/diff.txt</path>\n<type>file</type>\n<content>\n1: diff --git a/.github/workflows/srsim-tests.yml b/.github/workflows/srsim-tests.yml\n2: index e9896cd..4aa8f48 100644\n3: --- a/.github/workflows/srsim-tests.yml\n4: +++ b/.github/workflows/srsim-tests.yml\n5: @@ -41,22 +41,21 @@ jobs:\n6:      if: needs.check-license.outputs.available == 'true'\n7:      env:\n8:        SRSIM_IMAGE_TAG: 26.7.R1\n9:      strategy:\n10:        matrix:\n11: -        test-suite:\n12: -          - \"01*.robot\"\n13: -          - \"03*.robot\"\n14: -          - \"04*.robot\"\n15: -          - \"05*.robot\"\n16: -          - \"06*.robot\"\n17: -          - \"07*.robot\"\n18: -          - \"08*.robot\"\n19: -          - \"09*.robot\"\n20: -          - \"10*.robot\"\n21: -          - \"11*.robot\"\n22: -          - \"12*.robot\"\n23: +        include:\n24: +          - shard: basic\n25: +            test_suites: \"01-sros-to-linux.robot 07-srsim-with-mgmt-network.robot 12-srsim-veth-stitch.robot\"\n26: +          - shard: lifecycle\n27: +            test_suites: \"04-sros-classic.robot 06-srsim-sar.robot 10-srsim-lifecycle.robot\"\n28: +          - shard: components\n29: +            test_suites: \"05-sros-comp-to-linux.robot 09-srsim-pause-container.robot 14-srsim-new-chassis.robot\"\n30: +          - shard: provisioning\n31: +            test_suites: \"03-sros-dist-to-linux.robot 08-srsim-comp-cfg-test.robot 13-srsim-integrated.robot\"\n32: +          - shard: apply\n33: +            test_suites: \"11-srsim-apply.robot\"\n34:      steps:\n35:        - name: Checkout\n36:          uses: actions/checkout@v7\n37:          with:\n38:            fetch-depth: 0\n39: @@ -92,34 +91,39 @@ jobs:\n40:          run: uv sync --all-extras --dev\n41:  \n42:        - name: Activate virtualenv\n43:          run: |\n44:            . .venv/bin/activate\n45: -          echo PATH=$PATH >> $GITHUB_ENV\n46: +          echo \"PATH=$PATH\" >> \"$GITHUB_ENV\"\n47:  \n48: -      - name: Sanitize test-suite name\n49: -        run: echo \"TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')\" >> $GITHUB_ENV\n50: +      - name: Set shard name\n51: +        run: echo \"TEST_SUITE=${{ matrix.shard }}\" >> \"$GITHUB_ENV\"\n52:  \n53:        - name: Login to GitHub Container Registry\n54:          uses: docker/login-action@v4\n55:          with:\n56:            registry: ghcr.io\n57:            username: ${{ github.actor }}\n58:            password: ${{ github.token }}\n59:  \n60:        - name: Pull and re-tag srsim image\n61: -        run: docker pull ghcr.io/srl-labs/containerlab/nokia_srsim:${SRSIM_IMAGE_TAG} && docker tag ghcr.io/srl-labs/containerlab/nokia_srsim:${SRSIM_IMAGE_TAG} registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\n62: +        run: |\n63: +          image=\"ghcr.io/srl-labs/containerlab/nokia_srsim:${SRSIM_IMAGE_TAG}\"\n64: +          docker pull \"$image\"\n65: +          docker tag \"$image\" \"registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\"\n66:  \n67:        - name: Logout from GitHub Container Registry\n68:          run: docker logout ghcr.io\n69:  \n70:        # - name: setup tmate session\n71:        #   uses: mxschmitt/action-tmate@v3\n72:  \n73:        - name: Run sros-srsim tests\n74:          run: |\n75: -          ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/13-srsim/${{ matrix.test-suite }}\n76: +          for test_suite in ${{ matrix.test_suites }}; do\n77: +            ./tests/rf-run.sh ${{ inputs.runtime }} \"./tests/13-srsim/${test_suite}\"\n78: +          done\n79:        # upload test reports as a zip file\n80:        - name: Upload test logs\n81:          uses: actions/upload-artifact@v7\n82:          if: always()\n83:          with:\n84: diff --git a/docs/manual/kinds/sros.md b/docs/manual/kinds/sros.md\n85: index 633972e..7c0f2e1 100644\n86: --- a/docs/manual/kinds/sros.md\n87: +++ b/docs/manual/kinds/sros.md\n88: @@ -239,13 +239,19 @@ topology:\n89:          NOKIA_SROS_MDA_1: me12-100gb-qsfp28 # override default MDA type in slot 1\n90:  ```\n91:  \n92:  ///\n93:  \n94: -For known SR/IXR integrated nodes, containerlab's default model-driven configuration also provisions the default card and MDA configuration. The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`. If the hardware is overridden with `components` or SR-SIM environment variables, the generated SR OS card/MDA configuration follows those overrides.\n95: +For known SR and IXR integrated types, containerlab generates model-driven configuration for the default card and MDA(s).\n96:  \n97: -Integrated nodes accept at most one `components` entry because they still run as a single container. The component slot can be omitted or set to `A`; `ixr-r6` also accepts a single `B` slot override.\n98: +The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e2sc`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`.\n99: +\n100: +An integrated node other than `ixr-r6` runs as one container and accepts one `components` entry. The slot can be omitted or set to `A`. `ixr-r6` accepts slots `A` and `B`. Two `ixr-r6` entries, one for `A` and one for `B`, run as a dual-CPIOM node with one container per CPM. Integrated nodes do not accept numeric line-card slots.\n101: +\n102: +A `components` entry with `type` sets `NOKIA_SROS_CARD`. Containerlab then skips generated card and MDA configuration, because those defaults belong to the built-in card. Set `type` when the integrated card itself must change, for example `cpm-ixr-e2n/imm4-sfp+4-sfp+`.\n103: +\n104: +Node `env` overrides `components`: `type`, `xiom`, `mda`, per-component `env`, and the `sfm` key. When both set the same variable to different values, the environment variable wins and containerlab logs a warning naming that variable. `NOKIA_SROS_MDA_*` and `NOKIA_SROS_XIOM_*` are written into the generated configuration. `NOKIA_SROS_CARD` skips that generation, the same as a component `type`. On a distributed node, `NOKIA_SROS_SLOT` does not replace each component's slot.\n105:  \n106:  ### Distributed\n107:  \n108:  When the emulated platform is chassis-based, like SR-7, SR-14s, etc., the SR-SIM node must be defined in a distributed mode in the topology file.\n109:  \n110: @@ -385,16 +391,18 @@ topology:\n111:  When a distributed SR-SIM node is defined using `components`, we need to take into account the following:\n112:  \n113:  1. Component containers are attached to an internal namespace pause container.\n114:  2. When changing a MDA or card type from its default value, the configuration for card, SFM and MDA must be also defined.\n115:  3. Links can be added referring to the node name. The same [interface naming](#interface-naming) convention holds for all SR-SIM nodes.\n116: -4. Environment variable based configuration on per-component, or node-level will override the configuration set in `type`, `xiom` and `mda` fields.\n117: +4. Environment variable based configuration on per-component, or node-level will override the configuration set in `type`, `xiom` and `mda` fields. Node-level `env` wins over both. When the values differ, containerlab logs a warning naming the environment variable that was kept.\n118:  \n119:  ##### Configuration for components\n120:  \n121:  When using the `components` structure in the node definition for a distributed node, containerlab will also generate the SR OS configuration for the installed components in the chassis, as well as relevant power supply configuration[^6] to ensure the installed components come up without requiring a user to manually provide the configuration. The same generated configuration mechanism is used for the built-in SR/IXR integrated defaults.\n122:  \n123: +At deploy time, containerlab reads `chassis_info.json` from the selected SR-SIM image and compares the effective `components` configuration with the hardware types listed for that chassis. Unsupported card slots and card, SFM, XIOM, or MDA types produce warnings but do not stop deployment. This is a best-effort check: compatibility that is not represented in `chassis_info.json`, such as the MDA types supported by a specific XIOM, is not validated.\n124: +\n125:  /// details | Disabling generated SR OS configuration for `components`\n126:      type: tip\n127:  You can disable this config generation behavior by setting the `gen-component-config: false` [kind-specific config key](../nodes.md#kind-specific-config) on the node, or on the base node for a distributed chassis.\n128:  \n129:  ```yaml hl_lines=\"6\"\n130: diff --git a/nodes/sros/README.md b/nodes/sros/README.md\n131: index 3fbdee2..435bf6d 100644\n132: --- a/nodes/sros/README.md\n133: +++ b/nodes/sros/README.md\n134: @@ -37,11 +37,23 @@ The SR OS node kind supports deploying Nokia's SR OS network operating system in\n135:  - **`sros_test.go`**: Unit tests\n136:    - Node type helper method tests\n137:    - Edge case validation\n138:    - Version parsing tests\n139:  \n140: -- During PreDeploy, `chassis_info.json` is read from the node image (`/opt/nokia/chassis_info.json`) and written under the node's lab directory (`n.Cfg.LabDir`) with the same filename.\n141: +- **`component.go`**: Component model, slot checks, and environment precedence\n142: +- **`component_config.go`**: Generated card, SFM, XIOM, and MDA configuration, including integrated defaults\n143: +- **`chassis_info.go`**: Parses `chassis_info.json` and returns advisory compatibility warnings\n144: +\n145: +### Chassis info and component checks\n146: +\n147: +During PreDeploy, `createSROSFiles` reads `/opt/nokia/chassis_info.json` from the node image and writes it to `n.Cfg.LabDir/chassis_info.json`, prefixed with the license header. Failure to read the file is logged and does not stop deployment.\n148: +\n149: +The same file is then compared with the effective component configuration. Aliases such as `SAR-Mx` to `SAR-Hx` are followed. Unsupported slots, CPM/IOM types, SFM, XIOM, direct MDAs, and fixed-hardware mismatches produce warnings only. MDAs nested under an XIOM are not checked, because the file does not say which MDA types a given XIOM accepts.\n150: +\n151: +### Environment precedence\n152: +\n153: +Node `env` overrides per-component `env`, which overrides `type`, `xiom`, `mda`, and `sfm`. When a node environment variable replaces a different component value, containerlab logs that the component value will not be used and names the variable. `NOKIA_SROS_SLOT` still comes from each component in a distributed node, because one node-level slot cannot identify every card.\n154:  \n155:  ## Architecture\n156:  \n157:  ### Node Type Detection\n158:  \n159: @@ -346,29 +358,16 @@ componentConfig := \"\"\n160:  if !isFullConfigFile(n.Cfg.StartupConfig) {\n161:      componentConfig = n.generateComponentConfig()\n162:  }\n163:  ```\n164:  \n165: -For distributed SR OS deployments with multiple CPMs and linecards, this generates:\n166: -- Slot-specific configuration\n167: -- Card type definitions\n168: -- MDA (Media Dependent Adapter) configurations\n169: -- Fabric connectivity\n170: +For integrated nodes and distributed line cards, this appends flat MD-CLI lines. CPM slots `A` and `B` are not provisioned as cards. `NOKIA_SROS_CARD`, or a component `type` on an integrated node, skips this generation because the built-in MDA defaults belong to the default card.\n171:  \n172: -Example generated component config:\n173:  ```\n174: -/configure {\n175: -    card 1 {\n176: -        card-type iom-e\n177: -        mda 1 {\n178: -            mda-type me12-100gb-qsfp28\n179: -        }\n180: -    }\n181: -    card A {\n182: -        card-type cpm-ixr\n183: -    }\n184: -}\n185: +/configure card 1 card-type iom-1 admin-state enable\n186: +/configure card 1 mda 1 mda-type me6-100gb-qsfp28 admin-state enable\n187: +/configure sfm 1 sfm-type sfm-2s admin-state enable\n188:  ```\n189:  \n190:  #### Phase 3: Node-Type Specific Configuration (`applyNodeTypeSpecificConfig`)\n191:  \n192:  This phase customizes the template data based on the node's platform type and security settings.\n193: @@ -1047,83 +1046,22 @@ Each platform type has tailored configurations embedded in the `configs/` direct\n194:  **SAR Classic Mode:**\n195:  - **No gRPC configuration embedded**\n196:  - SAR in classic mode doesn't support gRPC\n197:  - Uses only CLI/NETCONF for management\n198:  \n199: -### Distributed SR OS Configuration\n200: -\n201: -For distributed deployments with multiple components (CPMs and line cards), additional configuration is generated.\n202: -\n203: -#### Component Configuration Generation\n204: -\n205: -```go\n206: -func (n *sros) generateComponentConfig() string\n207: -```\n208: -\n209: -**Generated Configuration Structure:**\n210: -\n211: -```\n212: -/configure {\n213: -    {{- range .Components }}\n214: -    card {{ .Slot }} {\n215: -        card-type {{ .Type }}\n216: -        {{- if .MDAs }}\n217: -        {{- range .MDAs }}\n218: -        mda {{ .Slot }} {\n219: -            mda-type {{ .Type }}\n220: -        }\n221: -        {{- end }}\n222: -        {{- end }}\n223: -    }\n224: -    {{- end }}\n225: -    \n226: -    {{- if .FabricConfig }}\n227: -    fabric {\n228: -        {{ .FabricConfig }}\n229: -    }\n230: -    {{- end }}\n231: -}\n232: -```\n233: +### Component configuration\n234:  \n235: -**Example Distributed Topology:**\n236: +`generateComponentConfig` runs for integrated nodes and for the CPM of a distributed node, unless the user supplied a full startup config, selected classic mode, or set `gen-component-config: false`.\n237:  \n238: -```yaml\n239: -nodes:\n240: -  chassis1:\n241: -    kind: nokia_srsim\n242: -    components:\n243: -      - slot: A\n244: -        type: cpm-ixr\n245: -      - slot: B\n246: -        type: cpm-ixr\n247: -      - slot: 1\n248: -        type: iom-ixr\n249: -        mda:\n250: -          - slot: 1\n251: -            type: m20-1gb-sfp-b\n252: -```\n253: +Known integrated types (`sr-1`, `sr-1s`, `ixr-r6`, and the `ixr-e*` pizza boxes) get built-in card and MDA lines. One `components` entry is accepted, with the slot omitted or set to `A`. `ixr-r6` also accepts `B`, and two entries (`A` and `B`) deploy a dual-CPIOM node. A component `type` sets `NOKIA_SROS_CARD` and skips generated card and MDA lines.\n254:  \n255: -**Generated Component Config:**\n256: +Distributed line cards produce one line per card, SFM, XIOM, and direct MDA. The values are the effective ones after environment precedence, so `NOKIA_SROS_MDA_*` and `NOKIA_SROS_XIOM_*` change the generated lines.\n257:  \n258:  ```\n259: -/configure {\n260: -    card A {\n261: -        card-type cpm-ixr\n262: -    }\n263: -    card B {\n264: -        card-type cpm-ixr\n265: -    }\n266: -    card 1 {\n267: -        card-type iom-ixr\n268: -        mda 1 {\n269: -            mda-type m20-1gb-sfp-b\n270: -        }\n271: -    }\n272: -    fabric {\n273: -        multiplane-mode enabled\n274: -    }\n275: -}\n276: +/configure card 1 card-type xcm-2s admin-state enable\n277: +/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\n278: +/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\n279:  ```\n280:  \n281:  ### Security and Certificate Management\n282:  \n283:  When `certificate.issue: true` is set, the system generates and injects TLS certificates.\n284: @@ -1538,14 +1476,14 @@ docker ps | grep chassis1\n285:  # Verify slot assignments\n286:  ssh admin@clab-mylab-chassis1-cpm-a \"show card state\"\n287:  ```\n288:  \n289:  **Common Causes:**\n290: -- Component slots not properly defined\n291: -- CPM slot names must be \"A\" or \"B\" (uppercase)\n292: +- Component slots are duplicated, including slots that differ only by case\n293:  - Line card slots must be numeric\n294: -- Environment variables not set on components\n295: +- The component type or MDA is not listed for that chassis in the image's `chassis_info.json` (this is logged as a warning and does not stop deployment)\n296: +- A node-level environment variable overrides the component value; the log names the variable that was kept\n297:  \n298:  ## Performance Considerations\n299:  \n300:  ### Template Execution Performance\n301:  \n302: @@ -1638,7 +1576,7 @@ BSD 3-Clause License - See LICENSE file for details\n303:  \n304:  **Maintainers:**\n305:  - Nokia Containerlab Team\n306:  - Community Contributors\n307:  \n308: -**Last Updated:** 2025-11-15\n309: -**SR OS Versions Supported:**  25.7+, 26.x (planned)\n310: +**Last Updated:** 2026-10-14\n311: +**SR OS Versions Supported:**  25.7+, 26.x\n312: diff --git a/nodes/sros/chassis_info.go b/nodes/sros/chassis_info.go\n313: index ace213b..fe5b7f8 100644\n314: --- a/nodes/sros/chassis_info.go\n315: +++ b/nodes/sros/chassis_info.go\n316: @@ -2,10 +2,221 @@\n317:  // Licensed under the BSD 3-Clause License.\n318:  // SPDX-License-Identifier: BSD-3-Clause\n319:  \n320:  package sros\n321:  \n322: +import (\n323: +\t\"encoding/json\"\n324: +\t\"fmt\"\n325: +\t\"slices\"\n326: +\t\"strconv\"\n327: +\t\"strings\"\n328: +)\n329: +\n330:  // DefaultChassisInfoPath is the path to chassis_info.json inside SROS/SR SIM container images.\n331:  const DefaultChassisInfoPath = \"/opt/nokia/chassis_info.json\"\n332:  \n333:  // chassisInfoFileLicense is prepended to the chassis_info.json file written to LabDir.\n334:  const chassisInfoFileLicense = \"// Copyright 2026 Nokia\\n// Licensed under the BSD 3-Clause License.\\n// SPDX-License-Identifier: BSD-3-Clause\\n\\n\"\n335: +\n336: +type chassisInfoEntry struct {\n337: +\tAlias      string            `json:\"alias\"`\n338: +\tCPM        []string          `json:\"cpm\"`\n339: +\tIOM        []string          `json:\"iom\"`\n340: +\tIOMSlots   int               `json:\"iom_slots\"`\n341: +\tMDA        []*string         `json:\"mda\"`\n342: +\tFixedMDAs  map[string]string `json:\"fixed_mdas\"`\n343: +\tSFM        []string          `json:\"sfm\"`\n344: +\tXIOM       []string          `json:\"xiom\"`\n345: +\tFixedHWCfg string            `json:\"fixed_hw_cfg\"`\n346: +\tIntegrated bool              `json:\"integrated\"`\n347: +\tRedundant  bool              `json:\"redundant\"`\n348: +}\n349: +\n350: +type chassisInfo map[string]chassisInfoEntry\n351: +\n352: +func parseChassisInfo(content []byte) (chassisInfo, error) {\n353: +\tvar info chassisInfo\n354: +\tif err := json.Unmarshal(content, &info); err != nil {\n355: +\t\treturn nil, fmt.Errorf(\"parse chassis_info.json: %w\", err)\n356: +\t}\n357: +\treturn info, nil\n358: +}\n359: +\n360: +func (i chassisInfo) entry(nodeType string) (chassisInfoEntry, bool) {\n361: +\tkey := \"\"\n362: +\tfor candidate := range i {\n363: +\t\tif strings.EqualFold(candidate, strings.TrimSpace(nodeType)) {\n364: +\t\t\tkey = candidate\n365: +\t\t\tbreak\n366: +\t\t}\n367: +\t}\n368: +\tif key == \"\" {\n369: +\t\treturn chassisInfoEntry{}, false\n370: +\t}\n371: +\n372: +\tseen := map[string]struct{}{}\n373: +\tfor {\n374: +\t\tif _, ok := seen[key]; ok {\n375: +\t\t\treturn chassisInfoEntry{}, false\n376: +\t\t}\n377: +\t\tseen[key] = struct{}{}\n378: +\n379: +\t\tentry := i[key]\n380: +\t\tif entry.Alias == \"\" {\n381: +\t\t\treturn entry, true\n382: +\t\t}\n383: +\n384: +\t\tkey = \"\"\n385: +\t\tfor candidate := range i {\n386: +\t\t\tif strings.EqualFold(candidate, entry.Alias) {\n387: +\t\t\t\tkey = candidate\n388: +\t\t\t\tbreak\n389: +\t\t\t}\n390: +\t\t}\n391: +\t\tif key == \"\" {\n392: +\t\t\treturn chassisInfoEntry{}, false\n393: +\t\t}\n394: +\t}\n395: +}\n396: +\n397: +// componentWarnings returns best-effort validation warnings. It deliberately skips checks\n398: +// that chassis_info.json cannot express, such as which MDA types belong under a specific XIOM.\n399: +func (i chassisInfo) componentWarnings(nodeType, sfm string, components []*Component) []string {\n400: +\tentry, ok := i.entry(nodeType)\n401: +\tif !ok {\n402: +\t\treturn []string{\n403: +\t\t\tfmt.Sprintf(\n404: +\t\t\t\t\"chassis type %q is not present in chassis_info.json; component compatibility was not checked\",\n405: +\t\t\t\tnodeType,\n406: +\t\t\t),\n407: +\t\t}\n408: +\t}\n409: +\n410: +\tvar warnings []string\n411: +\tif sfm != \"\" && len(entry.SFM) > 0 && !slices.Contains(entry.SFM, sfm) {\n412: +\t\twarnings = append(warnings, fmt.Sprintf(\n413: +\t\t\t\"SFM type %q is not listed for chassis type %q\",\n414: +\t\t\tsfm,\n415: +\t\t\tnodeType,\n416: +\t\t))\n417: +\t}\n418: +\n419: +\tfor _, component := range components {\n420: +\t\tif component == nil {\n421: +\t\t\tcontinue\n422: +\t\t}\n423: +\t\tslot := strings.ToUpper(strings.TrimSpace(component.Slot))\n424: +\t\tif slot == \"\" {\n425: +\t\t\tslot = slotAName\n426: +\t\t}\n427: +\n428: +\t\tswitch {\n429: +\t\tcase slot == slotAName || slot == slotBName:\n430: +\t\t\tif slot == slotBName && !entry.Redundant {\n431: +\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n432: +\t\t\t\t\t\"component slot %s is not listed as supported for chassis type %q\",\n433: +\t\t\t\t\tslot,\n434: +\t\t\t\t\tnodeType,\n435: +\t\t\t\t))\n436: +\t\t\t}\n437: +\t\t\tif component.Type != \"\" &&\n438: +\t\t\t\tentry.FixedHWCfg != \"\" &&\n439: +\t\t\t\tcomponent.Type != entry.FixedHWCfg {\n440: +\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n441: +\t\t\t\t\t\"component type %q in slot %s does not match fixed hardware %q for chassis type %q\",\n442: +\t\t\t\t\tcomponent.Type,\n443: +\t\t\t\t\tslot,\n444: +\t\t\t\t\tentry.FixedHWCfg,\n445: +\t\t\t\t\tnodeType,\n446: +\t\t\t\t))\n447: +\t\t\t} else if component.Type != \"\" &&\n448: +\t\t\t\tentry.FixedHWCfg == \"\" &&\n449: +\t\t\t\tlen(entry.CPM) > 0 &&\n450: +\t\t\t\t!slices.Contains(entry.CPM, component.Type) {\n451: +\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n452: +\t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n453: +\t\t\t\t\tcomponent.Type,\n454: +\t\t\t\t\tslot,\n455: +\t\t\t\t\tnodeType,\n456: +\t\t\t\t))\n457: +\t\t\t}\n458: +\t\tdefault:\n459: +\t\t\tnumericSlot, err := strconv.Atoi(slot)\n460: +\t\t\tif err == nil {\n461: +\t\t\t\tif entry.IOMSlots > 0 && numericSlot > entry.IOMSlots {\n462: +\t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n463: +\t\t\t\t\t\t\"component slot %s exceeds the %d IOM slots listed for chassis type %q\",\n464: +\t\t\t\t\t\tslot,\n465: +\t\t\t\t\t\tentry.IOMSlots,\n466: +\t\t\t\t\t\tnodeType,\n467: +\t\t\t\t\t))\n468: +\t\t\t\t}\n469: +\t\t\t\tif component.Type != \"\" &&\n470: +\t\t\t\t\tlen(entry.IOM) > 0 &&\n471: +\t\t\t\t\t!slices.Contains(entry.IOM, component.Type) {\n472: +\t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n473: +\t\t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n474: +\t\t\t\t\t\tcomponent.Type,\n475: +\t\t\t\t\t\tslot,\n476: +\t\t\t\t\t\tnodeType,\n477: +\t\t\t\t\t))\n478: +\t\t\t\t}\n479: +\t\t\t}\n480: +\t\t}\n481: +\n482: +\t\tfor _, xiom := range component.XIOM {\n483: +\t\t\tif xiom.Type != \"\" &&\n484: +\t\t\t\tlen(entry.XIOM) > 0 &&\n485: +\t\t\t\t!slices.Contains(entry.XIOM, xiom.Type) {\n486: +\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n487: +\t\t\t\t\t\"XIOM type %q in component slot %s is not listed for chassis type %q\",\n488: +\t\t\t\t\txiom.Type,\n489: +\t\t\t\t\tslot,\n490: +\t\t\t\t\tnodeType,\n491: +\t\t\t\t))\n492: +\t\t\t}\n493: +\t\t}\n494: +\n495: +\t\tif entry.Integrated || (slot != slotAName && slot != slotBName) {\n496: +\t\t\twarnings = append(warnings, validateMDAs(nodeType, entry, component.MDA)...)\n497: +\t\t}\n498: +\t}\n499: +\n500: +\treturn warnings\n501: +}\n502: +\n503: +func validateMDAs(nodeType string, entry chassisInfoEntry, mdas MDAS) []string {\n504: +\tvar warnings []string\n505: +\tfor _, mda := range mdas {\n506: +\t\tif fixed, exists := entry.FixedMDAs[strconv.Itoa(mda.Slot)]; exists {\n507: +\t\t\tif mda.Type != fixed {\n508: +\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n509: +\t\t\t\t\t\"MDA type %q in slot %d does not match fixed MDA %q for chassis type %q\",\n510: +\t\t\t\t\tmda.Type,\n511: +\t\t\t\t\tmda.Slot,\n512: +\t\t\t\t\tfixed,\n513: +\t\t\t\t\tnodeType,\n514: +\t\t\t\t))\n515: +\t\t\t}\n516: +\t\t\tcontinue\n517: +\t\t}\n518: +\t\tif mda.Type != \"\" && !containsChassisType(entry.MDA, mda.Type) {\n519: +\t\t\twarnings = append(warnings, fmt.Sprintf(\n520: +\t\t\t\t\"MDA type %q in slot %d is not listed for chassis type %q\",\n521: +\t\t\t\tmda.Type,\n522: +\t\t\t\tmda.Slot,\n523: +\t\t\t\tnodeType,\n524: +\t\t\t))\n525: +\t\t}\n526: +\t}\n527: +\treturn warnings\n528: +}\n529: +\n530: +func containsChassisType(types []*string, value string) bool {\n531: +\tfor _, typ := range types {\n532: +\t\tif typ != nil && *typ == value {\n533: +\t\t\treturn true\n534: +\t\t}\n535: +\t}\n536: +\treturn false\n537: +}\n538: diff --git a/nodes/sros/chassis_info_test.go b/nodes/sros/chassis_info_test.go\n539: new file mode 100644\n540: index 0000000..befd2b4\n541: --- /dev/null\n542: +++ b/nodes/sros/chassis_info_test.go\n543: @@ -0,0 +1,99 @@\n544: +// Copyright 2026 Nokia\n545: +// Licensed under the BSD 3-Clause License.\n546: +// SPDX-License-Identifier: BSD-3-Clause\n547: +\n548: +package sros\n549: +\n550: +import (\n551: +\t\"testing\"\n552: +\n553: +\t\"github.com/stretchr/testify/assert\"\n554: +\t\"github.com/stretchr/testify/require\"\n555: +)\n556: +\n557: +func TestChassisInfoComponentWarnings(t *testing.T) {\n558: +\tinfo, err := parseChassisInfo([]byte(`{\n559: +\t\t\"IXR-x\": {\n560: +\t\t\t\"cpm\": [\"cpm-ixr-x\"],\n561: +\t\t\t\"iom\": [\"imm6-qsfpdd+48-sfp56\"],\n562: +\t\t\t\"iom_slots\": 1,\n563: +\t\t\t\"mda\": [null],\n564: +\t\t\t\"sfm\": [\"sfm-ixr-x\"]\n565: +\t\t},\n566: +\t\t\"SAR-Hx\": {\n567: +\t\t\t\"cpm\": [\"iom-sar-1x\"],\n568: +\t\t\t\"fixed_mdas\": {\"2\": \"fixed-mda\"},\n569: +\t\t\t\"integrated\": true,\n570: +\t\t\t\"mda\": [\"supported-mda\"],\n571: +\t\t\t\"xiom\": [\"supported-xiom\"]\n572: +\t\t},\n573: +\t\t\"SAR-Mx\": {\"alias\": \"SAR-Hx\"}\n574: +\t}`))\n575: +\trequire.NoError(t, err)\n576: +\n577: +\tt.Run(\"supported configuration\", func(t *testing.T) {\n578: +\t\twarnings := info.componentWarnings(\"sar-mx\", \"\", []*Component{{\n579: +\t\t\tSlot: slotAName,\n580: +\t\t\tType: \"iom-sar-1x\",\n581: +\t\t\tMDA: MDAS{\n582: +\t\t\t\t{Slot: 1, Type: \"supported-mda\"},\n583: +\t\t\t\t{Slot: 2, Type: \"fixed-mda\"},\n584: +\t\t\t},\n585: +\t\t\tXIOM: XIOMS{{Slot: 1, Type: \"supported-xiom\"}},\n586: +\t\t}})\n587: +\n588: +\t\tassert.Empty(t, warnings)\n589: +\t})\n590: +\n591: +\tt.Run(\"unsupported values warn\", func(t *testing.T) {\n592: +\t\twarnings := info.componentWarnings(\"IXR-x\", \"wrong-sfm\", []*Component{\n593: +\t\t\t{Slot: slotAName, Type: \"wrong-cpm\"},\n594: +\t\t\t{Slot: \"2\", Type: \"wrong-iom\", MDA: MDAS{{Slot: 1, Type: \"wrong-mda\"}}},\n595: +\t\t})\n596: +\n597: +\t\tassert.Len(t, warnings, 5)\n598: +\t\tassert.Contains(t, warnings[0], \"SFM type\")\n599: +\t\tassert.Contains(t, warnings[1], \"component type\")\n600: +\t\tassert.Contains(t, warnings[2], \"exceeds\")\n601: +\t\tassert.Contains(t, warnings[3], \"component type\")\n602: +\t\tassert.Contains(t, warnings[4], \"MDA type\")\n603: +\t})\n604: +\n605: +\tt.Run(\"fixed MDA mismatch warns\", func(t *testing.T) {\n606: +\t\twarnings := info.componentWarnings(\"SAR-Hx\", \"\", []*Component{{\n607: +\t\t\tSlot: slotAName,\n608: +\t\t\tMDA:  MDAS{{Slot: 2, Type: \"wrong-mda\"}},\n609: +\t\t}})\n610: +\n611: +\t\trequire.Len(t, warnings, 1)\n612: +\t\tassert.Contains(t, warnings[0], \"does not match fixed MDA\")\n613: +\t})\n614: +\n615: +\tt.Run(\"distributed CPM slot does not validate direct MDAs\", func(t *testing.T) {\n616: +\t\twarnings := info.componentWarnings(\"IXR-x\", \"\", []*Component{{\n617: +\t\t\tSlot: slotAName,\n618: +\t\t\tType: \"cpm-ixr-x\",\n619: +\t\t\tMDA:  MDAS{{Slot: 1, Type: \"not-a-cpm-mda\"}},\n620: +\t\t}})\n621: +\n622: +\t\tassert.Empty(t, warnings)\n623: +\t})\n624: +\n625: +\tt.Run(\"nested XIOM MDA is not guessed\", func(t *testing.T) {\n626: +\t\twarnings := info.componentWarnings(\"SAR-Hx\", \"\", []*Component{{\n627: +\t\t\tSlot: slotAName,\n628: +\t\t\tXIOM: XIOMS{{\n629: +\t\t\t\tSlot: 1,\n630: +\t\t\t\tType: \"supported-xiom\",\n631: +\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"not-in-chassis-mda-list\"}},\n632: +\t\t\t}},\n633: +\t\t}})\n634: +\n635: +\t\tassert.Empty(t, warnings)\n636: +\t})\n637: +}\n638: +\n639: +func TestParseChassisInfoRejectsInvalidJSON(t *testing.T) {\n640: +\t_, err := parseChassisInfo([]byte(`{\"SR-1\":`))\n641: +\trequire.Error(t, err)\n642: +}\n643: diff --git a/nodes/sros/component.go b/nodes/sros/component.go\n644: index bdac689..b62efb3 100644\n645: --- a/nodes/sros/component.go\n646: +++ b/nodes/sros/component.go\n647: @@ -1,10 +1,15 @@\n648:  package sros\n649:  \n650:  import (\n651:  \t\"fmt\"\n652: +\t\"maps\"\n653: +\t\"slices\"\n654: +\t\"strconv\"\n655:  \t\"strings\"\n656: +\n657: +\t\"github.com/charmbracelet/log\"\n658:  )\n659:  \n660:  // Component is an SR-SIM card: a CPM (slot A or B) or a line card.\n661:  type Component struct {\n662:  \tSlot string            `yaml:\"slot,omitempty\" json:\"slot,omitempty\"`\n663: @@ -117,5 +122,188 @@ func (l *XIOMS) UnmarshalYAML(unmarshal func(any) error) error {\n664:  \n665:  \t*l = XIOMS(entries)\n666:  \n667:  \treturn nil\n668:  }\n669: +\n670: +func setComponentEnvVars(env map[string]string, c *Component) {\n671: +\tif c.Type != \"\" {\n672: +\t\tenv[envNokiaSrosCard] = c.Type\n673: +\t}\n674: +\n675: +\tfor _, x := range c.XIOM {\n676: +\t\tkey := fmt.Sprintf(\"%s_X%d\", envNokiaSrosXIOM, x.Slot)\n677: +\t\tenv[key] = x.Type\n678: +\t\t// add the nested MDA\n679: +\t\tfor _, m := range x.MDA {\n680: +\t\t\tkey := fmt.Sprintf(\"%s_X%d_%d\", envNokiaSrosMDA, x.Slot, m.Slot)\n681: +\t\t\tenv[key] = m.Type\n682: +\t\t}\n683: +\t}\n684: +\n685: +\tfor _, m := range c.MDA {\n686: +\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n687: +\t\tenv[key] = m.Type\n688: +\t}\n689: +}\n690: +\n691: +func (n *sros) checkComponentSlotsConfig() error {\n692: +\t// check Slots are unique\n693: +\tcomponentNames := map[string]struct{}{}\n694: +\tfor _, component := range n.kindSpecificCfg().Components {\n695: +\t\t// convert slot to upper\n696: +\t\tslot := strings.ToUpper(component.Slot)\n697: +\t\t// check if slot exists\n698: +\t\t_, exists := componentNames[slot]\n699: +\t\tif exists {\n700: +\t\t\treturn fmt.Errorf(\n701: +\t\t\t\t\"node %s slot %s duplicate definition\",\n702: +\t\t\t\tn.GetShortName(),\n703: +\t\t\t\tcomponent.Slot,\n704: +\t\t\t)\n705: +\t\t}\n706: +\t\t// add to component names map\n707: +\t\tcomponentNames[slot] = struct{}{}\n708: +\n709: +\t}\n710: +\treturn nil\n711: +}\n712: +\n713: +// componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,\n714: +// and per-component env. Per-component env overrides the typed fields.\n715: +func componentDerivedEnv(c *Component) map[string]string {\n716: +\tderived := map[string]string{}\n717: +\tif c == nil {\n718: +\t\treturn derived\n719: +\t}\n720: +\tsetComponentEnvVars(derived, c)\n721: +\tmaps.Copy(derived, c.Env)\n722: +\treturn derived\n723: +}\n724: +\n725: +// warnUserEnvOverrides logs when a node env var replaces a component-derived value.\n726: +func warnUserEnvOverrides(node string, derived, userEnv map[string]string) {\n727: +\tfor key, componentValue := range derived {\n728: +\t\tenvValue, userSet := userEnv[key]\n729: +\t\tif !userSet || componentValue == envValue {\n730: +\t\t\tcontinue\n731: +\t\t}\n732: +\t\tlog.Warn(\n733: +\t\t\tfmt.Sprintf(\n734: +\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n735: +\t\t\t\tcomponentValue,\n736: +\t\t\t\tkey,\n737: +\t\t\t),\n738: +\t\t\t\"node\", node,\n739: +\t\t\t\"env\", key,\n740: +\t\t\t\"component-value\", componentValue,\n741: +\t\t\t\"env-value\", envValue,\n742: +\t\t)\n743: +\t}\n744: +}\n745: +\n746: +// keepUserEnv copies component-derived keys into dst unless the user already set that key.\n747: +// A user value wins, and a differing component value is logged.\n748: +func keepUserEnv(node string, dst, derived, userEnv map[string]string) {\n749: +\twarnUserEnvOverrides(node, derived, userEnv)\n750: +\tfor key, componentValue := range derived {\n751: +\t\tif envValue, userSet := userEnv[key]; userSet {\n752: +\t\t\tdst[key] = envValue\n753: +\t\t\tcontinue\n754: +\t\t}\n755: +\t\tdst[key] = componentValue\n756: +\t}\n757: +}\n758: +\n759: +// cloneComponent returns a deep copy of c suitable for env overrides during config generation.\n760: +func cloneComponent(c *Component) *Component {\n761: +\tif c == nil {\n762: +\t\treturn &Component{}\n763: +\t}\n764: +\tout := *c\n765: +\tout.Env = maps.Clone(c.Env)\n766: +\tout.MDA = slices.Clone(c.MDA)\n767: +\tif len(c.XIOM) > 0 {\n768: +\t\tout.XIOM = make(XIOMS, len(c.XIOM))\n769: +\t\tfor i, xiom := range c.XIOM {\n770: +\t\t\txiom.MDA = slices.Clone(xiom.MDA)\n771: +\t\t\tout.XIOM[i] = xiom\n772: +\t\t}\n773: +\t}\n774: +\treturn &out\n775: +}\n776: +\n777: +// applyHardwareEnv overlays SR-SIM card, XIOM, and MDA environment variables onto c.\n778: +// NOKIA_SROS_SLOT is left unchanged; it identifies the container rather than provisioned hardware.\n779: +func applyHardwareEnv(c *Component, env map[string]string) {\n780: +\tif c == nil || len(env) == 0 {\n781: +\t\treturn\n782: +\t}\n783: +\tif card := env[envNokiaSrosCard]; card != \"\" {\n784: +\t\tc.Type = card\n785: +\t}\n786: +\tfor key, val := range env {\n787: +\t\tif val == \"\" {\n788: +\t\t\tcontinue\n789: +\t\t}\n790: +\t\tswitch {\n791: +\t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_X\"):\n792: +\t\t\trest := strings.TrimPrefix(key, envNokiaSrosMDA+\"_X\")\n793: +\t\t\txiomStr, mdaStr, ok := strings.Cut(rest, \"_\")\n794: +\t\t\tif !ok {\n795: +\t\t\t\tcontinue\n796: +\t\t\t}\n797: +\t\t\txiomSlot, errX := strconv.Atoi(xiomStr)\n798: +\t\t\tmdaSlot, errM := strconv.Atoi(mdaStr)\n799: +\t\t\tif errX != nil || errM != nil || xiomSlot <= 0 || mdaSlot <= 0 {\n800: +\t\t\t\tcontinue\n801: +\t\t\t}\n802: +\t\t\tupsertXiomMDA(c, xiomSlot, mdaSlot, val)\n803: +\t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_\"):\n804: +\t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosMDA+\"_\"))\n805: +\t\t\tif err != nil || slot <= 0 {\n806: +\t\t\t\tcontinue\n807: +\t\t\t}\n808: +\t\t\tc.MDA = upsertMDA(c.MDA, slot, val)\n809: +\t\tcase strings.HasPrefix(key, envNokiaSrosXIOM+\"_X\"):\n810: +\t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosXIOM+\"_X\"))\n811: +\t\t\tif err != nil || slot <= 0 {\n812: +\t\t\t\tcontinue\n813: +\t\t\t}\n814: +\t\t\tupsertXiomType(c, slot, val)\n815: +\t\t}\n816: +\t}\n817: +}\n818: +\n819: +func upsertMDA(mdas MDAS, slot int, typ string) MDAS {\n820: +\tfor i := range mdas {\n821: +\t\tif mdas[i].Slot == slot {\n822: +\t\t\tmdas[i].Type = typ\n823: +\t\t\treturn mdas\n824: +\t\t}\n825: +\t}\n826: +\treturn append(mdas, MDA{Slot: slot, Type: typ})\n827: +}\n828: +\n829: +func upsertXiomType(c *Component, slot int, typ string) {\n830: +\tfor i := range c.XIOM {\n831: +\t\tif c.XIOM[i].Slot == slot {\n832: +\t\t\tc.XIOM[i].Type = typ\n833: +\t\t\treturn\n834: +\t\t}\n835: +\t}\n836: +\tc.XIOM = append(c.XIOM, XIOM{Slot: slot, Type: typ})\n837: +}\n838: +\n839: +func upsertXiomMDA(c *Component, xiomSlot, mdaSlot int, typ string) {\n840: +\tfor i := range c.XIOM {\n841: +\t\tif c.XIOM[i].Slot != xiomSlot {\n842: +\t\t\tcontinue\n843: +\t\t}\n844: +\t\tc.XIOM[i].MDA = upsertMDA(c.XIOM[i].MDA, mdaSlot, typ)\n845: +\t\treturn\n846: +\t}\n847: +\tc.XIOM = append(c.XIOM, XIOM{\n848: +\t\tSlot: xiomSlot,\n849: +\t\tMDA:  MDAS{{Slot: mdaSlot, Type: typ}},\n850: +\t})\n851: +}\n852: diff --git a/nodes/sros/component_config.go b/nodes/sros/component_config.go\n853: index 914f3de..3985e12 100644\n854: --- a/nodes/sros/component_config.go\n855: +++ b/nodes/sros/component_config.go\n856: @@ -4,13 +4,15 @@\n857:  \n858:  package sros\n859:  \n860:  import (\n861:  \t\"fmt\"\n862: +\t\"maps\"\n863:  \t\"slices\"\n864: -\t\"strconv\"\n865:  \t\"strings\"\n866: +\n867: +\t\"github.com/charmbracelet/log\"\n868:  )\n869:  \n870:  const integratedSrosCardSlot = \"1\"\n871:  \n872:  type integratedSrosDefaultComponent struct {\n873: @@ -82,10 +84,17 @@ var integratedSrosDefaultComponents = map[string]integratedSrosDefaultComponent{\n874:  \t\tallowedSlots: []string{slotAName},\n875:  \t\tmdas: MDAS{\n876:  \t\t\t{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"},\n877:  \t\t},\n878:  \t},\n879: +\t\"ixr-e2sc\": {\n880: +\t\tcardType:     \"imm16-sfp++4-sfp28\",\n881: +\t\tallowedSlots: []string{slotAName},\n882: +\t\tmdas: MDAS{\n883: +\t\t\t{Slot: 1, Type: \"m16-sfp++4-sfp28\"},\n884: +\t\t},\n885: +\t},\n886:  \t\"ixr-ec\": {\n887:  \t\tcardType:     \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n888:  \t\tallowedSlots: []string{slotAName},\n889:  \t\tmdas: MDAS{\n890:  \t\t\t{Slot: 1, Type: \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\"},\n891: @@ -172,66 +181,44 @@ func buildComponentCfgLines(components []*Component, sfm string) []componentCfgL\n892:  \t\t}\n893:  \t}\n894:  \treturn lines\n895:  }\n896:  \n897: -func buildIntegratedComponentCfgLines(\n898: -\tnodeType string,\n899: -\tenv map[string]string,\n900: -) []componentCfgLine {\n901: +func buildIntegratedComponentCfgLines(nodeType string, override *Component) []componentCfgLine {\n902:  \tcomponent, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]\n903:  \tif !ok {\n904:  \t\treturn nil\n905:  \t}\n906: -\n907: -\tcardType := component.cardType\n908: -\tif envCardType := strings.TrimSpace(env[envNokiaSrosCard]); envCardType != \"\" {\n909: -\t\tcardType = envCardType\n910: +\tif override == nil {\n911: +\t\toverride = &Component{}\n912:  \t}\n913:  \n914: -\tlines := []componentCfgLine{\n915: -\t\t{Kind: \"card\", Slot: integratedSrosCardSlot, Type: cardType},\n916: +\tdefaultMdas := component.mdas\n917: +\n918: +\tif len(override.XIOM) > 0 {\n919: +\t\tdefaultMdas = nil\n920:  \t}\n921:  \n922: -\tfor _, mda := range mergeIntegratedMdas(component.mdas, env) {\n923: -\t\tlines = append(lines, componentCfgLine{\n924: -\t\t\tKind: \"mda\", Slot: integratedSrosCardSlot, MdaSlot: mda.Slot, Type: mda.Type,\n925: -\t\t})\n926: +\tcard := &Component{\n927: +\t\tSlot: integratedSrosCardSlot,\n928: +\t\tType: component.cardType,\n929: +\t\tXIOM: override.XIOM,\n930: +\t\tMDA:  mergeIntegratedMdas(defaultMdas, override.MDA),\n931:  \t}\n932:  \n933: -\treturn lines\n934: +\treturn buildComponentCfgLines([]*Component{card}, \"\")\n935:  }\n936:  \n937: -func mergeIntegratedMdas(defaults MDAS, env map[string]string) MDAS {\n938: +func mergeIntegratedMdas(defaults, overrides MDAS) MDAS {\n939:  \tbySlot := map[int]string{}\n940: -\tfor _, mda := range defaults {\n941: +\tfor _, mda := range slices.Concat(defaults, overrides) {\n942:  \t\tif mda.Slot > 0 && mda.Type != \"\" {\n943:  \t\t\tbySlot[mda.Slot] = mda.Type\n944:  \t\t}\n945:  \t}\n946:  \n947: -\tconst prefix = envNokiaSrosMDA + \"_\"\n948: -\tfor key, value := range env {\n949: -\t\tslotText, ok := strings.CutPrefix(key, prefix)\n950: -\t\tif !ok {\n951: -\t\t\tcontinue\n952: -\t\t}\n953: -\t\tslot, err := strconv.Atoi(slotText)\n954: -\t\tif err != nil || slot <= 0 {\n955: -\t\t\tcontinue\n956: -\t\t}\n957: -\t\tif value = strings.TrimSpace(value); value != \"\" {\n958: -\t\t\tbySlot[slot] = value\n959: -\t\t}\n960: -\t}\n961: -\n962: -\tslots := make([]int, 0, len(bySlot))\n963: -\tfor slot := range bySlot {\n964: -\t\tslots = append(slots, slot)\n965: -\t}\n966: -\tslices.Sort(slots)\n967: -\n968: +\tslots := slices.Sorted(maps.Keys(bySlot))\n969:  \tmdas := make(MDAS, 0, len(slots))\n970:  \tfor _, slot := range slots {\n971:  \t\tmdas = append(mdas, MDA{Slot: slot, Type: bySlot[slot]})\n972:  \t}\n973:  \treturn mdas\n974: @@ -257,19 +244,150 @@ func integratedSrosAllowedSlots(nodeType string) []string {\n975:  \t\treturn []string{slotAName}\n976:  \t}\n977:  \treturn component.allowedSlots\n978:  }\n979:  \n980: -func isSingleSlotIntegratedSrosNodeType(nodeType string) bool {\n981: -\tif !isIntegratedSrosNodeType(nodeType) {\n982: +func isRedundantIntegratedSrosComponents(nodeType string, components []*Component) bool {\n983: +\tif !isIntegratedSrosNodeType(nodeType) || len(components) < 2 {\n984:  \t\treturn false\n985:  \t}\n986: -\treturn len(integratedSrosAllowedSlots(nodeType)) == 1\n987: +\tfor _, c := range components {\n988: +\t\tif strings.TrimSpace(c.Slot) == \"\" || !integratedSrosSlotAllowed(nodeType, c.Slot) {\n989: +\t\t\treturn false\n990: +\t\t}\n991: +\t}\n992: +\treturn true\n993:  }\n994:  \n995:  func integratedSrosSlotAllowed(nodeType, slot string) bool {\n996:  \tslot = strings.ToUpper(strings.TrimSpace(slot))\n997:  \tif slot == \"\" {\n998:  \t\tslot = standaloneSlotName\n999:  \t}\n1000:  \treturn slices.Contains(integratedSrosAllowedSlots(nodeType), slot)\n1001:  }\n1002: +\n1003: +func (n *sros) generateComponentConfig() string {\n1004: +\tif !n.kindSpecificCfg().GenComponentConfig {\n1005: +\t\treturn \"\"\n1006: +\t}\n1007: +\tif n.isConfigClassic() {\n1008: +\t\treturn \"\"\n1009: +\t}\n1010: +\n1011: +\tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n1012: +\t\treturn n.generateIntegratedComponentConfig()\n1013: +\t}\n1014: +\n1015: +\tcomponents := n.rootComponents\n1016: +\tif len(components) == 0 {\n1017: +\t\treturn \"\"\n1018: +\t}\n1019: +\n1020: +\tfor _, c := range components {\n1021: +\t\tslot := strings.ToUpper(strings.TrimSpace(c.Slot))\n1022: +\t\tif slot == slotAName || slot == slotBName {\n1023: +\t\t\tcontinue\n1024: +\t\t}\n1025: +\t\tif c.Type == \"\" {\n1026: +\t\t\tlog.Warn(\n1027: +\t\t\t\t\"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.\",\n1028: +\t\t\t\t\"node\",\n1029: +\t\t\t\tn.Cfg.ShortName,\n1030: +\t\t\t\t\"slot\",\n1031: +\t\t\t\tslot,\n1032: +\t\t\t)\n1033: +\t\t}\n1034: +\t}\n1035: +\n1036: +\tlines := buildComponentCfgLines(n.componentsForConfig(components), n.componentSFM())\n1037: +\treturn n.componentConfigFromLines(lines)\n1038: +}\n1039: +\n1040: +// hardwareEnv is the topology env, which overrides component type, XIOM, and MDA.\n1041: +// Nodes that have not been through Init expose that env on Cfg.Env.\n1042: +func (n *sros) hardwareEnv() map[string]string {\n1043: +\tif n.userEnv != nil {\n1044: +\t\treturn n.userEnv\n1045: +\t}\n1046: +\treturn n.Cfg.Env\n1047: +}\n1048: +\n1049: +// componentSFM is the SFM used in generated config. NOKIA_SROS_SFM overrides the sfm key.\n1050: +func (n *sros) componentSFM() string {\n1051: +\tif sfm := n.hardwareEnv()[envNokiaSrosSFM]; sfm != \"\" {\n1052: +\t\treturn sfm\n1053: +\t}\n1054: +\treturn n.kindSpecificCfg().SFM\n1055: +}\n1056: +\n1057: +// componentForConfig clones c and applies per-component env, then node env.\n1058: +func (n *sros) componentForConfig(c *Component) *Component {\n1059: +\tout := cloneComponent(c)\n1060: +\tapplyHardwareEnv(out, out.Env)\n1061: +\tapplyHardwareEnv(out, n.hardwareEnv())\n1062: +\treturn out\n1063: +}\n1064: +\n1065: +func (n *sros) componentsForConfig(components []*Component) []*Component {\n1066: +\tout := make([]*Component, len(components))\n1067: +\tfor i, c := range components {\n1068: +\t\tout[i] = n.componentForConfig(c)\n1069: +\t}\n1070: +\treturn out\n1071: +}\n1072: +\n1073: +func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {\n1074: +\tpowerConfig := n.generatePowerConfig()\n1075: +\tif len(lines) == 0 && powerConfig == \"\" {\n1076: +\t\treturn \"\"\n1077: +\t}\n1078: +\n1079: +\tvar config strings.Builder\n1080: +\tfor _, l := range lines {\n1081: +\t\tconfig.WriteString(l.String())\n1082: +\t}\n1083: +\tconfig.WriteString(powerConfig)\n1084: +\treturn config.String()\n1085: +}\n1086: +\n1087: +func (n *sros) generateIntegratedComponentConfig() string {\n1088: +\tcard := strings.TrimSpace(n.Cfg.Env[envNokiaSrosCard])\n1089: +\tif card != \"\" {\n1090: +\t\tlog.Info(\n1091: +\t\t\t\"Card type override set on integrated chassis type, skipping component SR OS config generation\",\n1092: +\t\t\t\"node\",\n1093: +\t\t\tn.Cfg.ShortName,\n1094: +\t\t\t\"type\",\n1095: +\t\t\tn.Cfg.NodeType,\n1096: +\t\t\t\"card\",\n1097: +\t\t\tcard,\n1098: +\t\t)\n1099: +\t\treturn \"\"\n1100: +\t}\n1101: +\n1102: +\tlines := buildIntegratedComponentCfgLines(\n1103: +\t\tn.Cfg.NodeType,\n1104: +\t\tn.componentForConfig(n.integratedComponentOverride()),\n1105: +\t)\n1106: +\treturn n.componentConfigFromLines(lines)\n1107: +}\n1108: +\n1109: +// integratedComponentOverride returns the component that overrides the integrated defaults:\n1110: +// the single component of a standalone node, or the component matching the slot of a\n1111: +// redundant CPM node.\n1112: +func (n *sros) integratedComponentOverride() *Component {\n1113: +\tif n.rootCtrName == \"\" {\n1114: +\t\tif len(n.kindSpecificCfg().Components) == 1 {\n1115: +\t\t\treturn n.kindSpecificCfg().Components[0]\n1116: +\t\t}\n1117: +\t\treturn nil\n1118: +\t}\n1119: +\n1120: +\tslot := n.Cfg.Env[envNokiaSrosSlot]\n1121: +\tfor _, c := range n.rootComponents {\n1122: +\t\tif strings.EqualFold(strings.TrimSpace(c.Slot), slot) {\n1123: +\t\t\treturn c\n1124: +\t\t}\n1125: +\t}\n1126: +\treturn nil\n1127: +}\n1128: diff --git a/nodes/sros/config.go b/nodes/sros/config.go\n1129: index b46ae42..8ddbb21 100644\n1130: --- a/nodes/sros/config.go\n1131: +++ b/nodes/sros/config.go\n1132: @@ -1,8 +1,22 @@\n1133:  package sros\n1134:  \n1135: -import \"golang.org/x/mod/semver\"\n1136: +import (\n1137: +\t\"bytes\"\n1138: +\t\"context\"\n1139: +\t\"fmt\"\n1140: +\t\"io\"\n1141: +\t\"os\"\n1142: +\t\"path/filepath\"\n1143: +\t\"strings\"\n1144: +\n1145: +\tclabutils \"github.com/srl-labs/containerlab/utils\"\n1146: +\n1147: +\t\"github.com/beevik/etree\"\n1148: +\t\"github.com/charmbracelet/log\"\n1149: +\t\"golang.org/x/mod/semver\"\n1150: +)\n1151:  \n1152:  const (\n1153:  \tgrpcMDCLIConfig    = `/configure system grpc md-cli admin-state enable`\n1154:  \tprofileMDCLIConfig = `/configure system security aaa local-profiles profile \"administrative\" grpc rpc-authorization md-cli-session permit`\n1155:  \ttls13CipherCCM8    = `/configure system security tls server-cipher-list \"clab-all\" tls13-cipher 5 name tls-aes128-ccm8-sha256`\n1156: @@ -18,5 +32,314 @@ func (n *sros) setVersionSpecificParams(tplData *srosTemplateData) {\n1157:  \t\tif tplData.IsSecureGrpc {\n1158:  \t\t\ttplData.GRPCConfig += \"\\n\" + tls13CipherCCM8\n1159:  \t\t}\n1160:  \t}\n1161:  }\n1162: +\n1163: +// buildPKIImportXML builds the NETCONF action XML that imports a PEM file into the PKI store.\n1164: +func buildPKIImportXML(inputURL, outputFile, importType string) string {\n1165: +\taction := etree.NewElement(\"action\")\n1166: +\taction.CreateAttr(\"xmlns\", \"urn:ietf:params:xml:ns:yang:1\")\n1167: +\n1168: +\tadmin := action.CreateElement(\"admin\")\n1169: +\tadmin.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:oper-admin\")\n1170: +\n1171: +\timportElem := admin.CreateElement(\"system\").\n1172: +\t\tCreateElement(\"security\").\n1173: +\t\tCreateElement(\"pki\").\n1174: +\t\tCreateElement(\"import\")\n1175: +\n1176: +\t// Add import parameters\n1177: +\timportElem.CreateElement(\"input-url\").SetText(inputURL)\n1178: +\timportElem.CreateElement(\"output-file\").SetText(outputFile)\n1179: +\timportElem.CreateElement(\"type\").SetText(importType)\n1180: +\timportElem.CreateElement(\"format\").SetText(\"pem\")\n1181: +\tvar buf bytes.Buffer\n1182: +\taction.WriteTo(&buf, &etree.WriteSettings{\n1183: +\t\tCanonicalText:    false,\n1184: +\t\tCanonicalAttrVal: false,\n1185: +\t})\n1186: +\treturn buf.String()\n1187: +}\n1188: +\n1189: +// buildTLSProfileXML builds the TLS profile configuration XML.\n1190: +func buildTLSProfileXML() string {\n1191: +\tconfig := etree.NewElement(\"config\")\n1192: +\tconfigure := config.CreateElement(\"configure\")\n1193: +\tconfigure.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:conf\")\n1194: +\tconfigure.CreateAttr(\"xmlns:nc\", \"urn:ietf:params:xml:ns:netconf:base:1.0\")\n1195: +\n1196: +\tcertProfile := configure.CreateElement(\"system\").\n1197: +\t\tCreateElement(\"security\").\n1198: +\t\tCreateElement(\"tls\").\n1199: +\t\tCreateElement(\"cert-profile\")\n1200: +\n\n(Showing lines 1-1200 of 3945. Use offset=1201 to continue.)\n</content>",
    "title": "source/diff.txt",
    "metadata": {
      "preview": "diff --git a/.github/workflows/srsim-tests.yml b/.github/workflows/srsim-tests.yml\nindex e9896cd..4aa8f48 100644\n--- a/.github/workflows/srsim-tests.yml\n+++ b/.github/workflows/srsim-tests.yml\n@@ -41,22 +41,21 @@ jobs:\n     if: needs.check-license.outputs.available == 'true'\n     env:\n       SRSIM_IMAGE_TAG: 26.7.R1\n     strategy:\n       matrix:\n-        test-suite:\n-          - \"01*.robot\"\n-          - \"03*.robot\"\n-          - \"04*.robot\"\n-          - \"05*.robot\"\n-          - \"06*.robot\"\n-          - \"07*.robot\"\n-          - \"08*.robot\"\n-          - \"09*.robot\"\n-          - \"10*.robot\"",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/diff.txt",
        "text": "diff --git a/.github/workflows/srsim-tests.yml b/.github/workflows/srsim-tests.yml\nindex e9896cd..4aa8f48 100644\n--- a/.github/workflows/srsim-tests.yml\n+++ b/.github/workflows/srsim-tests.yml\n@@ -41,22 +41,21 @@ jobs:\n     if: needs.check-license.outputs.available == 'true'\n     env:\n       SRSIM_IMAGE_TAG: 26.7.R1\n     strategy:\n       matrix:\n-        test-suite:\n-          - \"01*.robot\"\n-          - \"03*.robot\"\n-          - \"04*.robot\"\n-          - \"05*.robot\"\n-          - \"06*.robot\"\n-          - \"07*.robot\"\n-          - \"08*.robot\"\n-          - \"09*.robot\"\n-          - \"10*.robot\"\n-          - \"11*.robot\"\n-          - \"12*.robot\"\n+        include:\n+          - shard: basic\n+            test_suites: \"01-sros-to-linux.robot 07-srsim-with-mgmt-network.robot 12-srsim-veth-stitch.robot\"\n+          - shard: lifecycle\n+            test_suites: \"04-sros-classic.robot 06-srsim-sar.robot 10-srsim-lifecycle.robot\"\n+          - shard: components\n+            test_suites: \"05-sros-comp-to-linux.robot 09-srsim-pause-container.robot 14-srsim-new-chassis.robot\"\n+          - shard: provisioning\n+            test_suites: \"03-sros-dist-to-linux.robot 08-srsim-comp-cfg-test.robot 13-srsim-integrated.robot\"\n+          - shard: apply\n+            test_suites: \"11-srsim-apply.robot\"\n     steps:\n       - name: Checkout\n         uses: actions/checkout@v7\n         with:\n           fetch-depth: 0\n@@ -92,34 +91,39 @@ jobs:\n         run: uv sync --all-extras --dev\n \n       - name: Activate virtualenv\n         run: |\n           . .venv/bin/activate\n-          echo PATH=$PATH >> $GITHUB_ENV\n+          echo \"PATH=$PATH\" >> \"$GITHUB_ENV\"\n \n-      - name: Sanitize test-suite name\n-        run: echo \"TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')\" >> $GITHUB_ENV\n+      - name: Set shard name\n+        run: echo \"TEST_SUITE=${{ matrix.shard }}\" >> \"$GITHUB_ENV\"\n \n       - name: Login to GitHub Container Registry\n         uses: docker/login-action@v4\n         with:\n           registry: ghcr.io\n           username: ${{ github.actor }}\n           password: ${{ github.token }}\n \n       - name: Pull and re-tag srsim image\n-        run: docker pull ghcr.io/srl-labs/containerlab/nokia_srsim:${SRSIM_IMAGE_TAG} && docker tag ghcr.io/srl-labs/containerlab/nokia_srsim:${SRSIM_IMAGE_TAG} registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\n+        run: |\n+          image=\"ghcr.io/srl-labs/containerlab/nokia_srsim:${SRSIM_IMAGE_TAG}\"\n+          docker pull \"$image\"\n+          docker tag \"$image\" \"registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\"\n \n       - name: Logout from GitHub Container Registry\n         run: docker logout ghcr.io\n \n       # - name: setup tmate session\n       #   uses: mxschmitt/action-tmate@v3\n \n       - name: Run sros-srsim tests\n         run: |\n-          ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/13-srsim/${{ matrix.test-suite }}\n+          for test_suite in ${{ matrix.test_suites }}; do\n+            ./tests/rf-run.sh ${{ inputs.runtime }} \"./tests/13-srsim/${test_suite}\"\n+          done\n       # upload test reports as a zip file\n       - name: Upload test logs\n         uses: actions/upload-artifact@v7\n         if: always()\n         with:\ndiff --git a/docs/manual/kinds/sros.md b/docs/manual/kinds/sros.md\nindex 633972e..7c0f2e1 100644\n--- a/docs/manual/kinds/sros.md\n+++ b/docs/manual/kinds/sros.md\n@@ -239,13 +239,19 @@ topology:\n         NOKIA_SROS_MDA_1: me12-100gb-qsfp28 # override default MDA type in slot 1\n ```\n \n ///\n \n-For known SR/IXR integrated nodes, containerlab's default model-driven configuration also provisions the default card and MDA configuration. The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`. If the hardware is overridden with `components` or SR-SIM environment variables, the generated SR OS card/MDA configuration follows those overrides.\n+For known SR and IXR integrated types, containerlab generates model-driven configuration for the default card and MDA(s).\n \n-Integrated nodes accept at most one `components` entry because they still run as a single container. The component slot can be omitted or set to `A`; `ixr-r6` also accepts a single `B` slot override.\n+The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e2sc`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`.\n+\n+An integrated node other than `ixr-r6` runs as one container and accepts one `components` entry. The slot can be omitted or set to `A`. `ixr-r6` accepts slots `A` and `B`. Two `ixr-r6` entries, one for `A` and one for `B`, run as a dual-CPIOM node with one container per CPM. Integrated nodes do not accept numeric line-card slots.\n+\n+A `components` entry with `type` sets `NOKIA_SROS_CARD`. Containerlab then skips generated card and MDA configuration, because those defaults belong to the built-in card. Set `type` when the integrated card itself must change, for example `cpm-ixr-e2n/imm4-sfp+4-sfp+`.\n+\n+Node `env` overrides `components`: `type`, `xiom`, `mda`, per-component `env`, and the `sfm` key. When both set the same variable to different values, the environment variable wins and containerlab logs a warning naming that variable. `NOKIA_SROS_MDA_*` and `NOKIA_SROS_XIOM_*` are written into the generated configuration. `NOKIA_SROS_CARD` skips that generation, the same as a component `type`. On a distributed node, `NOKIA_SROS_SLOT` does not replace each component's slot.\n \n ### Distributed\n \n When the emulated platform is chassis-based, like SR-7, SR-14s, etc., the SR-SIM node must be defined in a distributed mode in the topology file.\n \n@@ -385,16 +391,18 @@ topology:\n When a distributed SR-SIM node is defined using `components`, we need to take into account the following:\n \n 1. Component containers are attached to an internal namespace pause container.\n 2. When changing a MDA or card type from its default value, the configuration for card, SFM and MDA must be also defined.\n 3. Links can be added referring to the node name. The same [interface naming](#interface-naming) convention holds for all SR-SIM nodes.\n-4. Environment variable based configuration on per-component, or node-level will override the configuration set in `type`, `xiom` and `mda` fields.\n+4. Environment variable based configuration on per-component, or node-level will override the configuration set in `type`, `xiom` and `mda` fields. Node-level `env` wins over both. When the values differ, containerlab logs a warning naming the environment variable that was kept.\n \n ##### Configuration for components\n \n When using the `components` structure in the node definition for a distributed node, containerlab will also generate the SR OS configuration for the installed components in the chassis, as well as relevant power supply configuration[^6] to ensure the installed components come up without requiring a user to manually provide the configuration. The same generated configuration mechanism is used for the built-in SR/IXR integrated defaults.\n \n+At deploy time, containerlab reads `chassis_info.json` from the selected SR-SIM image and compares the effective `components` configuration with the hardware types listed for that chassis. Unsupported card slots and card, SFM, XIOM, or MDA types produce warnings but do not stop deployment. This is a best-effort check: compatibility that is not represented in `chassis_info.json`, such as the MDA types supported by a specific XIOM, is not validated.\n+\n /// details | Disabling generated SR OS configuration for `components`\n     type: tip\n You can disable this config generation behavior by setting the `gen-component-config: false` [kind-specific config key](../nodes.md#kind-specific-config) on the node, or on the base node for a distributed chassis.\n \n ```yaml hl_lines=\"6\"\ndiff --git a/nodes/sros/README.md b/nodes/sros/README.md\nindex 3fbdee2..435bf6d 100644\n--- a/nodes/sros/README.md\n+++ b/nodes/sros/README.md\n@@ -37,11 +37,23 @@ The SR OS node kind supports deploying Nokia's SR OS network operating system in\n - **`sros_test.go`**: Unit tests\n   - Node type helper method tests\n   - Edge case validation\n   - Version parsing tests\n \n-- During PreDeploy, `chassis_info.json` is read from the node image (`/opt/nokia/chassis_info.json`) and written under the node's lab directory (`n.Cfg.LabDir`) with the same filename.\n+- **`component.go`**: Component model, slot checks, and environment precedence\n+- **`component_config.go`**: Generated card, SFM, XIOM, and MDA configuration, including integrated defaults\n+- **`chassis_info.go`**: Parses `chassis_info.json` and returns advisory compatibility warnings\n+\n+### Chassis info and component checks\n+\n+During PreDeploy, `createSROSFiles` reads `/opt/nokia/chassis_info.json` from the node image and writes it to `n.Cfg.LabDir/chassis_info.json`, prefixed with the license header. Failure to read the file is logged and does not stop deployment.\n+\n+The same file is then compared with the effective component configuration. Aliases such as `SAR-Mx` to `SAR-Hx` are followed. Unsupported slots, CPM/IOM types, SFM, XIOM, direct MDAs, and fixed-hardware mismatches produce warnings only. MDAs nested under an XIOM are not checked, because the file does not say which MDA types a given XIOM accepts.\n+\n+### Environment precedence\n+\n+Node `env` overrides per-component `env`, which overrides `type`, `xiom`, `mda`, and `sfm`. When a node environment variable replaces a different component value, containerlab logs that the component value will not be used and names the variable. `NOKIA_SROS_SLOT` still comes from each component in a distributed node, because one node-level slot cannot identify every card.\n \n ## Architecture\n \n ### Node Type Detection\n \n@@ -346,29 +358,16 @@ componentConfig := \"\"\n if !isFullConfigFile(n.Cfg.StartupConfig) {\n     componentConfig = n.generateComponentConfig()\n }\n ```\n \n-For distributed SR OS deployments with multiple CPMs and linecards, this generates:\n-- Slot-specific configuration\n-- Card type definitions\n-- MDA (Media Dependent Adapter) configurations\n-- Fabric connectivity\n+For integrated nodes and distributed line cards, this appends flat MD-CLI lines. CPM slots `A` and `B` are not provisioned as cards. `NOKIA_SROS_CARD`, or a component `type` on an integrated node, skips this generation because the built-in MDA defaults belong to the default card.\n \n-Example generated component config:\n ```\n-/configure {\n-    card 1 {\n-        card-type iom-e\n-        mda 1 {\n-            mda-type me12-100gb-qsfp28\n-        }\n-    }\n-    card A {\n-        card-type cpm-ixr\n-    }\n-}\n+/configure card 1 card-type iom-1 admin-state enable\n+/configure card 1 mda 1 mda-type me6-100gb-qsfp28 admin-state enable\n+/configure sfm 1 sfm-type sfm-2s admin-state enable\n ```\n \n #### Phase 3: Node-Type Specific Configuration (`applyNodeTypeSpecificConfig`)\n \n This phase customizes the template data based on the node's platform type and security settings.\n@@ -1047,83 +1046,22 @@ Each platform type has tailored configurations embedded in the `configs/` direct\n **SAR Classic Mode:**\n - **No gRPC configuration embedded**\n - SAR in classic mode doesn't support gRPC\n - Uses only CLI/NETCONF for management\n \n-### Distributed SR OS Configuration\n-\n-For distributed deployments with multiple components (CPMs and line cards), additional configuration is generated.\n-\n-#### Component Configuration Generation\n-\n-```go\n-func (n *sros) generateComponentConfig() string\n-```\n-\n-**Generated Configuration Structure:**\n-\n-```\n-/configure {\n-    {{- range .Components }}\n-    card {{ .Slot }} {\n-        card-type {{ .Type }}\n-        {{- if .MDAs }}\n-        {{- range .MDAs }}\n-        mda {{ .Slot }} {\n-            mda-type {{ .Type }}\n-        }\n-        {{- end }}\n-        {{- end }}\n-    }\n-    {{- end }}\n-    \n-    {{- if .FabricConfig }}\n-    fabric {\n-        {{ .FabricConfig }}\n-    }\n-    {{- end }}\n-}\n-```\n+### Component configuration\n \n-**Example Distributed Topology:**\n+`generateComponentConfig` runs for integrated nodes and for the CPM of a distributed node, unless the user supplied a full startup config, selected classic mode, or set `gen-component-config: false`.\n \n-```yaml\n-nodes:\n-  chassis1:\n-    kind: nokia_srsim\n-    components:\n-      - slot: A\n-        type: cpm-ixr\n-      - slot: B\n-        type: cpm-ixr\n-      - slot: 1\n-        type: iom-ixr\n-        mda:\n-          - slot: 1\n-            type: m20-1gb-sfp-b\n-```\n+Known integrated types (`sr-1`, `sr-1s`, `ixr-r6`, and the `ixr-e*` pizza boxes) get built-in card and MDA lines. One `components` entry is accepted, with the slot omitted or set to `A`. `ixr-r6` also accepts `B`, and two entries (`A` and `B`) deploy a dual-CPIOM node. A component `type` sets `NOKIA_SROS_CARD` and skips generated card and MDA lines.\n \n-**Generated Component Config:**\n+Distributed line cards produce one line per card, SFM, XIOM, and direct MDA. The values are the effective ones after environment precedence, so `NOKIA_SROS_MDA_*` and `NOKIA_SROS_XIOM_*` change the generated lines.\n \n ```\n-/configure {\n-    card A {\n-        card-type cpm-ixr\n-    }\n-    card B {\n-        card-type cpm-ixr\n-    }\n-    card 1 {\n-        card-type iom-ixr\n-        mda 1 {\n-            mda-type m20-1gb-sfp-b\n-        }\n-    }\n-    fabric {\n-        multiplane-mode enabled\n-    }\n-}\n+/configure card 1 card-type xcm-2s admin-state enable\n+/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\n+/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\n ```\n \n ### Security and Certificate Management\n \n When `certificate.issue: true` is set, the system generates and injects TLS certificates.\n@@ -1538,14 +1476,14 @@ docker ps | grep chassis1\n # Verify slot assignments\n ssh admin@clab-mylab-chassis1-cpm-a \"show card state\"\n ```\n \n **Common Causes:**\n-- Component slots not properly defined\n-- CPM slot names must be \"A\" or \"B\" (uppercase)\n+- Component slots are duplicated, including slots that differ only by case\n - Line card slots must be numeric\n-- Environment variables not set on components\n+- The component type or MDA is not listed for that chassis in the image's `chassis_info.json` (this is logged as a warning and does not stop deployment)\n+- A node-level environment variable overrides the component value; the log names the variable that was kept\n \n ## Performance Considerations\n \n ### Template Execution Performance\n \n@@ -1638,7 +1576,7 @@ BSD 3-Clause License - See LICENSE file for details\n \n **Maintainers:**\n - Nokia Containerlab Team\n - Community Contributors\n \n-**Last Updated:** 2025-11-15\n-**SR OS Versions Supported:**  25.7+, 26.x (planned)\n+**Last Updated:** 2026-10-14\n+**SR OS Versions Supported:**  25.7+, 26.x\ndiff --git a/nodes/sros/chassis_info.go b/nodes/sros/chassis_info.go\nindex ace213b..fe5b7f8 100644\n--- a/nodes/sros/chassis_info.go\n+++ b/nodes/sros/chassis_info.go\n@@ -2,10 +2,221 @@\n // Licensed under the BSD 3-Clause License.\n // SPDX-License-Identifier: BSD-3-Clause\n \n package sros\n \n+import (\n+\t\"encoding/json\"\n+\t\"fmt\"\n+\t\"slices\"\n+\t\"strconv\"\n+\t\"strings\"\n+)\n+\n // DefaultChassisInfoPath is the path to chassis_info.json inside SROS/SR SIM container images.\n const DefaultChassisInfoPath = \"/opt/nokia/chassis_info.json\"\n \n // chassisInfoFileLicense is prepended to the chassis_info.json file written to LabDir.\n const chassisInfoFileLicense = \"// Copyright 2026 Nokia\\n// Licensed under the BSD 3-Clause License.\\n// SPDX-License-Identifier: BSD-3-Clause\\n\\n\"\n+\n+type chassisInfoEntry struct {\n+\tAlias      string            `json:\"alias\"`\n+\tCPM        []string          `json:\"cpm\"`\n+\tIOM        []string          `json:\"iom\"`\n+\tIOMSlots   int               `json:\"iom_slots\"`\n+\tMDA        []*string         `json:\"mda\"`\n+\tFixedMDAs  map[string]string `json:\"fixed_mdas\"`\n+\tSFM        []string          `json:\"sfm\"`\n+\tXIOM       []string          `json:\"xiom\"`\n+\tFixedHWCfg string            `json:\"fixed_hw_cfg\"`\n+\tIntegrated bool              `json:\"integrated\"`\n+\tRedundant  bool              `json:\"redundant\"`\n+}\n+\n+type chassisInfo map[string]chassisInfoEntry\n+\n+func parseChassisInfo(content []byte) (chassisInfo, error) {\n+\tvar info chassisInfo\n+\tif err := json.Unmarshal(content, &info); err != nil {\n+\t\treturn nil, fmt.Errorf(\"parse chassis_info.json: %w\", err)\n+\t}\n+\treturn info, nil\n+}\n+\n+func (i chassisInfo) entry(nodeType string) (chassisInfoEntry, bool) {\n+\tkey := \"\"\n+\tfor candidate := range i {\n+\t\tif strings.EqualFold(candidate, strings.TrimSpace(nodeType)) {\n+\t\t\tkey = candidate\n+\t\t\tbreak\n+\t\t}\n+\t}\n+\tif key == \"\" {\n+\t\treturn chassisInfoEntry{}, false\n+\t}\n+\n+\tseen := map[string]struct{}{}\n+\tfor {\n+\t\tif _, ok := seen[key]; ok {\n+\t\t\treturn chassisInfoEntry{}, false\n+\t\t}\n+\t\tseen[key] = struct{}{}\n+\n+\t\tentry := i[key]\n+\t\tif entry.Alias == \"\" {\n+\t\t\treturn entry, true\n+\t\t}\n+\n+\t\tkey = \"\"\n+\t\tfor candidate := range i {\n+\t\t\tif strings.EqualFold(candidate, entry.Alias) {\n+\t\t\t\tkey = candidate\n+\t\t\t\tbreak\n+\t\t\t}\n+\t\t}\n+\t\tif key == \"\" {\n+\t\t\treturn chassisInfoEntry{}, false\n+\t\t}\n+\t}\n+}\n+\n+// componentWarnings returns best-effort validation warnings. It deliberately skips checks\n+// that chassis_info.json cannot express, such as which MDA types belong under a specific XIOM.\n+func (i chassisInfo) componentWarnings(nodeType, sfm string, components []*Component) []string {\n+\tentry, ok := i.entry(nodeType)\n+\tif !ok {\n+\t\treturn []string{\n+\t\t\tfmt.Sprintf(\n+\t\t\t\t\"chassis type %q is not present in chassis_info.json; component compatibility was not checked\",\n+\t\t\t\tnodeType,\n+\t\t\t),\n+\t\t}\n+\t}\n+\n+\tvar warnings []string\n+\tif sfm != \"\" && len(entry.SFM) > 0 && !slices.Contains(entry.SFM, sfm) {\n+\t\twarnings = append(warnings, fmt.Sprintf(\n+\t\t\t\"SFM type %q is not listed for chassis type %q\",\n+\t\t\tsfm,\n+\t\t\tnodeType,\n+\t\t))\n+\t}\n+\n+\tfor _, component := range components {\n+\t\tif component == nil {\n+\t\t\tcontinue\n+\t\t}\n+\t\tslot := strings.ToUpper(strings.TrimSpace(component.Slot))\n+\t\tif slot == \"\" {\n+\t\t\tslot = slotAName\n+\t\t}\n+\n+\t\tswitch {\n+\t\tcase slot == slotAName || slot == slotBName:\n+\t\t\tif slot == slotBName && !entry.Redundant {\n+\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n+\t\t\t\t\t\"component slot %s is not listed as supported for chassis type %q\",\n+\t\t\t\t\tslot,\n+\t\t\t\t\tnodeType,\n+\t\t\t\t))\n+\t\t\t}\n+\t\t\tif component.Type != \"\" &&\n+\t\t\t\tentry.FixedHWCfg != \"\" &&\n+\t\t\t\tcomponent.Type != entry.FixedHWCfg {\n+\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n+\t\t\t\t\t\"component type %q in slot %s does not match fixed hardware %q for chassis type %q\",\n+\t\t\t\t\tcomponent.Type,\n+\t\t\t\t\tslot,\n+\t\t\t\t\tentry.FixedHWCfg,\n+\t\t\t\t\tnodeType,\n+\t\t\t\t))\n+\t\t\t} else if component.Type != \"\" &&\n+\t\t\t\tentry.FixedHWCfg == \"\" &&\n+\t\t\t\tlen(entry.CPM) > 0 &&\n+\t\t\t\t!slices.Contains(entry.CPM, component.Type) {\n+\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n+\t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n+\t\t\t\t\tcomponent.Type,\n+\t\t\t\t\tslot,\n+\t\t\t\t\tnodeType,\n+\t\t\t\t))\n+\t\t\t}\n+\t\tdefault:\n+\t\t\tnumericSlot, err := strconv.Atoi(slot)\n+\t\t\tif err == nil {\n+\t\t\t\tif entry.IOMSlots > 0 && numericSlot > entry.IOMSlots {\n+\t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n+\t\t\t\t\t\t\"component slot %s exceeds the %d IOM slots listed for chassis type %q\",\n+\t\t\t\t\t\tslot,\n+\t\t\t\t\t\tentry.IOMSlots,\n+\t\t\t\t\t\tnodeType,\n+\t\t\t\t\t))\n+\t\t\t\t}\n+\t\t\t\tif component.Type != \"\" &&\n+\t\t\t\t\tlen(entry.IOM) > 0 &&\n+\t\t\t\t\t!slices.Contains(entry.IOM, component.Type) {\n+\t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n+\t\t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n+\t\t\t\t\t\tcomponent.Type,\n+\t\t\t\t\t\tslot,\n+\t\t\t\t\t\tnodeType,\n+\t\t\t\t\t))\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\n+\n+\t\tfor _, xiom := range component.XIOM {\n+\t\t\tif xiom.Type != \"\" &&\n+\t\t\t\tlen(entry.XIOM) > 0 &&\n+\t\t\t\t!slices.Contains(entry.XIOM, xiom.Type) {\n+\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n+\t\t\t\t\t\"XIOM type %q in component slot %s is not listed for chassis type %q\",\n+\t\t\t\t\txiom.Type,\n+\t\t\t\t\tslot,\n+\t\t\t\t\tnodeType,\n+\t\t\t\t))\n+\t\t\t}\n+\t\t}\n+\n+\t\tif entry.Integrated || (slot != slotAName && slot != slotBName) {\n+\t\t\twarnings = append(warnings, validateMDAs(nodeType, entry, component.MDA)...)\n+\t\t}\n+\t}\n+\n+\treturn warnings\n+}\n+\n+func validateMDAs(nodeType string, entry chassisInfoEntry, mdas MDAS) []string {\n+\tvar warnings []string\n+\tfor _, mda := range mdas {\n+\t\tif fixed, exists := entry.FixedMDAs[strconv.Itoa(mda.Slot)]; exists {\n+\t\t\tif mda.Type != fixed {\n+\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n+\t\t\t\t\t\"MDA type %q in slot %d does not match fixed MDA %q for chassis type %q\",\n+\t\t\t\t\tmda.Type,\n+\t\t\t\t\tmda.Slot,\n+\t\t\t\t\tfixed,\n+\t\t\t\t\tnodeType,\n+\t\t\t\t))\n+\t\t\t}\n+\t\t\tcontinue\n+\t\t}\n+\t\tif mda.Type != \"\" && !containsChassisType(entry.MDA, mda.Type) {\n+\t\t\twarnings = append(warnings, fmt.Sprintf(\n+\t\t\t\t\"MDA type %q in slot %d is not listed for chassis type %q\",\n+\t\t\t\tmda.Type,\n+\t\t\t\tmda.Slot,\n+\t\t\t\tnodeType,\n+\t\t\t))\n+\t\t}\n+\t}\n+\treturn warnings\n+}\n+\n+func containsChassisType(types []*string, value string) bool {\n+\tfor _, typ := range types {\n+\t\tif typ != nil && *typ == value {\n+\t\t\treturn true\n+\t\t}\n+\t}\n+\treturn false\n+}\ndiff --git a/nodes/sros/chassis_info_test.go b/nodes/sros/chassis_info_test.go\nnew file mode 100644\nindex 0000000..befd2b4\n--- /dev/null\n+++ b/nodes/sros/chassis_info_test.go\n@@ -0,0 +1,99 @@\n+// Copyright 2026 Nokia\n+// Licensed under the BSD 3-Clause License.\n+// SPDX-License-Identifier: BSD-3-Clause\n+\n+package sros\n+\n+import (\n+\t\"testing\"\n+\n+\t\"github.com/stretchr/testify/assert\"\n+\t\"github.com/stretchr/testify/require\"\n+)\n+\n+func TestChassisInfoComponentWarnings(t *testing.T) {\n+\tinfo, err := parseChassisInfo([]byte(`{\n+\t\t\"IXR-x\": {\n+\t\t\t\"cpm\": [\"cpm-ixr-x\"],\n+\t\t\t\"iom\": [\"imm6-qsfpdd+48-sfp56\"],\n+\t\t\t\"iom_slots\": 1,\n+\t\t\t\"mda\": [null],\n+\t\t\t\"sfm\": [\"sfm-ixr-x\"]\n+\t\t},\n+\t\t\"SAR-Hx\": {\n+\t\t\t\"cpm\": [\"iom-sar-1x\"],\n+\t\t\t\"fixed_mdas\": {\"2\": \"fixed-mda\"},\n+\t\t\t\"integrated\": true,\n+\t\t\t\"mda\": [\"supported-mda\"],\n+\t\t\t\"xiom\": [\"supported-xiom\"]\n+\t\t},\n+\t\t\"SAR-Mx\": {\"alias\": \"SAR-Hx\"}\n+\t}`))\n+\trequire.NoError(t, err)\n+\n+\tt.Run(\"supported configuration\", func(t *testing.T) {\n+\t\twarnings := info.componentWarnings(\"sar-mx\", \"\", []*Component{{\n+\t\t\tSlot: slotAName,\n+\t\t\tType: \"iom-sar-1x\",\n+\t\t\tMDA: MDAS{\n+\t\t\t\t{Slot: 1, Type: \"supported-mda\"},\n+\t\t\t\t{Slot: 2, Type: \"fixed-mda\"},\n+\t\t\t},\n+\t\t\tXIOM: XIOMS{{Slot: 1, Type: \"supported-xiom\"}},\n+\t\t}})\n+\n+\t\tassert.Empty(t, warnings)\n+\t})\n+\n+\tt.Run(\"unsupported values warn\", func(t *testing.T) {\n+\t\twarnings := info.componentWarnings(\"IXR-x\", \"wrong-sfm\", []*Component{\n+\t\t\t{Slot: slotAName, Type: \"wrong-cpm\"},\n+\t\t\t{Slot: \"2\", Type: \"wrong-iom\", MDA: MDAS{{Slot: 1, Type: \"wrong-mda\"}}},\n+\t\t})\n+\n+\t\tassert.Len(t, warnings, 5)\n+\t\tassert.Contains(t, warnings[0], \"SFM type\")\n+\t\tassert.Contains(t, warnings[1], \"component type\")\n+\t\tassert.Contains(t, warnings[2], \"exceeds\")\n+\t\tassert.Contains(t, warnings[3], \"component type\")\n+\t\tassert.Contains(t, warnings[4], \"MDA type\")\n+\t})\n+\n+\tt.Run(\"fixed MDA mismatch warns\", func(t *testing.T) {\n+\t\twarnings := info.componentWarnings(\"SAR-Hx\", \"\", []*Component{{\n+\t\t\tSlot: slotAName,\n+\t\t\tMDA:  MDAS{{Slot: 2, Type: \"wrong-mda\"}},\n+\t\t}})\n+\n+\t\trequire.Len(t, warnings, 1)\n+\t\tassert.Contains(t, warnings[0], \"does not match fixed MDA\")\n+\t})\n+\n+\tt.Run(\"distributed CPM slot does not validate direct MDAs\", func(t *testing.T) {\n+\t\twarnings := info.componentWarnings(\"IXR-x\", \"\", []*Component{{\n+\t\t\tSlot: slotAName,\n+\t\t\tType: \"cpm-ixr-x\",\n+\t\t\tMDA:  MDAS{{Slot: 1, Type: \"not-a-cpm-mda\"}},\n+\t\t}})\n+\n+\t\tassert.Empty(t, warnings)\n+\t})\n+\n+\tt.Run(\"nested XIOM MDA is not guessed\", func(t *testing.T) {\n+\t\twarnings := info.componentWarnings(\"SAR-Hx\", \"\", []*Component{{\n+\t\t\tSlot: slotAName,\n+\t\t\tXIOM: XIOMS{{\n+\t\t\t\tSlot: 1,\n+\t\t\t\tType: \"supported-xiom\",\n+\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"not-in-chassis-mda-list\"}},\n+\t\t\t}},\n+\t\t}})\n+\n+\t\tassert.Empty(t, warnings)\n+\t})\n+}\n+\n+func TestParseChassisInfoRejectsInvalidJSON(t *testing.T) {\n+\t_, err := parseChassisInfo([]byte(`{\"SR-1\":`))\n+\trequire.Error(t, err)\n+}\ndiff --git a/nodes/sros/component.go b/nodes/sros/component.go\nindex bdac689..b62efb3 100644\n--- a/nodes/sros/component.go\n+++ b/nodes/sros/component.go\n@@ -1,10 +1,15 @@\n package sros\n \n import (\n \t\"fmt\"\n+\t\"maps\"\n+\t\"slices\"\n+\t\"strconv\"\n \t\"strings\"\n+\n+\t\"github.com/charmbracelet/log\"\n )\n \n // Component is an SR-SIM card: a CPM (slot A or B) or a line card.\n type Component struct {\n \tSlot string            `yaml:\"slot,omitempty\" json:\"slot,omitempty\"`\n@@ -117,5 +122,188 @@ func (l *XIOMS) UnmarshalYAML(unmarshal func(any) error) error {\n \n \t*l = XIOMS(entries)\n \n \treturn nil\n }\n+\n+func setComponentEnvVars(env map[string]string, c *Component) {\n+\tif c.Type != \"\" {\n+\t\tenv[envNokiaSrosCard] = c.Type\n+\t}\n+\n+\tfor _, x := range c.XIOM {\n+\t\tkey := fmt.Sprintf(\"%s_X%d\", envNokiaSrosXIOM, x.Slot)\n+\t\tenv[key] = x.Type\n+\t\t// add the nested MDA\n+\t\tfor _, m := range x.MDA {\n+\t\t\tkey := fmt.Sprintf(\"%s_X%d_%d\", envNokiaSrosMDA, x.Slot, m.Slot)\n+\t\t\tenv[key] = m.Type\n+\t\t}\n+\t}\n+\n+\tfor _, m := range c.MDA {\n+\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n+\t\tenv[key] = m.Type\n+\t}\n+}\n+\n+func (n *sros) checkComponentSlotsConfig() error {\n+\t// check Slots are unique\n+\tcomponentNames := map[string]struct{}{}\n+\tfor _, component := range n.kindSpecificCfg().Components {\n+\t\t// convert slot to upper\n+\t\tslot := strings.ToUpper(component.Slot)\n+\t\t// check if slot exists\n+\t\t_, exists := componentNames[slot]\n+\t\tif exists {\n+\t\t\treturn fmt.Errorf(\n+\t\t\t\t\"node %s slot %s duplicate definition\",\n+\t\t\t\tn.GetShortName(),\n+\t\t\t\tcomponent.Slot,\n+\t\t\t)\n+\t\t}\n+\t\t// add to component names map\n+\t\tcomponentNames[slot] = struct{}{}\n+\n+\t}\n+\treturn nil\n+}\n+\n+// componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,\n+// and per-component env. Per-component env overrides the typed fields.\n+func componentDerivedEnv(c *Component) map[string]string {\n+\tderived := map[string]string{}\n+\tif c == nil {\n+\t\treturn derived\n+\t}\n+\tsetComponentEnvVars(derived, c)\n+\tmaps.Copy(derived, c.Env)\n+\treturn derived\n+}\n+\n+// warnUserEnvOverrides logs when a node env var replaces a component-derived value.\n+func warnUserEnvOverrides(node string, derived, userEnv map[string]string) {\n+\tfor key, componentValue := range derived {\n+\t\tenvValue, userSet := userEnv[key]\n+\t\tif !userSet || componentValue == envValue {\n+\t\t\tcontinue\n+\t\t}\n+\t\tlog.Warn(\n+\t\t\tfmt.Sprintf(\n+\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n+\t\t\t\tcomponentValue,\n+\t\t\t\tkey,\n+\t\t\t),\n+\t\t\t\"node\", node,\n+\t\t\t\"env\", key,\n+\t\t\t\"component-value\", componentValue,\n+\t\t\t\"env-value\", envValue,\n+\t\t)\n+\t}\n+}\n+\n+// keepUserEnv copies component-derived keys into dst unless the user already set that key.\n+// A user value wins, and a differing component value is logged.\n+func keepUserEnv(node string, dst, derived, userEnv map[string]string) {\n+\twarnUserEnvOverrides(node, derived, userEnv)\n+\tfor key, componentValue := range derived {\n+\t\tif envValue, userSet := userEnv[key]; userSet {\n+\t\t\tdst[key] = envValue\n+\t\t\tcontinue\n+\t\t}\n+\t\tdst[key] = componentValue\n+\t}\n+}\n+\n+// cloneComponent returns a deep copy of c suitable for env overrides during config generation.\n+func cloneComponent(c *Component) *Component {\n+\tif c == nil {\n+\t\treturn &Component{}\n+\t}\n+\tout := *c\n+\tout.Env = maps.Clone(c.Env)\n+\tout.MDA = slices.Clone(c.MDA)\n+\tif len(c.XIOM) > 0 {\n+\t\tout.XIOM = make(XIOMS, len(c.XIOM))\n+\t\tfor i, xiom := range c.XIOM {\n+\t\t\txiom.MDA = slices.Clone(xiom.MDA)\n+\t\t\tout.XIOM[i] = xiom\n+\t\t}\n+\t}\n+\treturn &out\n+}\n+\n+// applyHardwareEnv overlays SR-SIM card, XIOM, and MDA environment variables onto c.\n+// NOKIA_SROS_SLOT is left unchanged; it identifies the container rather than provisioned hardware.\n+func applyHardwareEnv(c *Component, env map[string]string) {\n+\tif c == nil || len(env) == 0 {\n+\t\treturn\n+\t}\n+\tif card := env[envNokiaSrosCard]; card != \"\" {\n+\t\tc.Type = card\n+\t}\n+\tfor key, val := range env {\n+\t\tif val == \"\" {\n+\t\t\tcontinue\n+\t\t}\n+\t\tswitch {\n+\t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_X\"):\n+\t\t\trest := strings.TrimPrefix(key, envNokiaSrosMDA+\"_X\")\n+\t\t\txiomStr, mdaStr, ok := strings.Cut(rest, \"_\")\n+\t\t\tif !ok {\n+\t\t\t\tcontinue\n+\t\t\t}\n+\t\t\txiomSlot, errX := strconv.Atoi(xiomStr)\n+\t\t\tmdaSlot, errM := strconv.Atoi(mdaStr)\n+\t\t\tif errX != nil || errM != nil || xiomSlot <= 0 || mdaSlot <= 0 {\n+\t\t\t\tcontinue\n+\t\t\t}\n+\t\t\tupsertXiomMDA(c, xiomSlot, mdaSlot, val)\n+\t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_\"):\n+\t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosMDA+\"_\"))\n+\t\t\tif err != nil || slot <= 0 {\n+\t\t\t\tcontinue\n+\t\t\t}\n+\t\t\tc.MDA = upsertMDA(c.MDA, slot, val)\n+\t\tcase strings.HasPrefix(key, envNokiaSrosXIOM+\"_X\"):\n+\t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosXIOM+\"_X\"))\n+\t\t\tif err != nil || slot <= 0 {\n+\t\t\t\tcontinue\n+\t\t\t}\n+\t\t\tupsertXiomType(c, slot, val)\n+\t\t}\n+\t}\n+}\n+\n+func upsertMDA(mdas MDAS, slot int, typ string) MDAS {\n+\tfor i := range mdas {\n+\t\tif mdas[i].Slot == slot {\n+\t\t\tmdas[i].Type = typ\n+\t\t\treturn mdas\n+\t\t}\n+\t}\n+\treturn append(mdas, MDA{Slot: slot, Type: typ})\n+}\n+\n+func upsertXiomType(c *Component, slot int, typ string) {\n+\tfor i := range c.XIOM {\n+\t\tif c.XIOM[i].Slot == slot {\n+\t\t\tc.XIOM[i].Type = typ\n+\t\t\treturn\n+\t\t}\n+\t}\n+\tc.XIOM = append(c.XIOM, XIOM{Slot: slot, Type: typ})\n+}\n+\n+func upsertXiomMDA(c *Component, xiomSlot, mdaSlot int, typ string) {\n+\tfor i := range c.XIOM {\n+\t\tif c.XIOM[i].Slot != xiomSlot {\n+\t\t\tcontinue\n+\t\t}\n+\t\tc.XIOM[i].MDA = upsertMDA(c.XIOM[i].MDA, mdaSlot, typ)\n+\t\treturn\n+\t}\n+\tc.XIOM = append(c.XIOM, XIOM{\n+\t\tSlot: xiomSlot,\n+\t\tMDA:  MDAS{{Slot: mdaSlot, Type: typ}},\n+\t})\n+}\ndiff --git a/nodes/sros/component_config.go b/nodes/sros/component_config.go\nindex 914f3de..3985e12 100644\n--- a/nodes/sros/component_config.go\n+++ b/nodes/sros/component_config.go\n@@ -4,13 +4,15 @@\n \n package sros\n \n import (\n \t\"fmt\"\n+\t\"maps\"\n \t\"slices\"\n-\t\"strconv\"\n \t\"strings\"\n+\n+\t\"github.com/charmbracelet/log\"\n )\n \n const integratedSrosCardSlot = \"1\"\n \n type integratedSrosDefaultComponent struct {\n@@ -82,10 +84,17 @@ var integratedSrosDefaultComponents = map[string]integratedSrosDefaultComponent{\n \t\tallowedSlots: []string{slotAName},\n \t\tmdas: MDAS{\n \t\t\t{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"},\n \t\t},\n \t},\n+\t\"ixr-e2sc\": {\n+\t\tcardType:     \"imm16-sfp++4-sfp28\",\n+\t\tallowedSlots: []string{slotAName},\n+\t\tmdas: MDAS{\n+\t\t\t{Slot: 1, Type: \"m16-sfp++4-sfp28\"},\n+\t\t},\n+\t},\n \t\"ixr-ec\": {\n \t\tcardType:     \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n \t\tallowedSlots: []string{slotAName},\n \t\tmdas: MDAS{\n \t\t\t{Slot: 1, Type: \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\"},\n@@ -172,66 +181,44 @@ func buildComponentCfgLines(components []*Component, sfm string) []componentCfgL\n \t\t}\n \t}\n \treturn lines\n }\n \n-func buildIntegratedComponentCfgLines(\n-\tnodeType string,\n-\tenv map[string]string,\n-) []componentCfgLine {\n+func buildIntegratedComponentCfgLines(nodeType string, override *Component) []componentCfgLine {\n \tcomponent, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]\n \tif !ok {\n \t\treturn nil\n \t}\n-\n-\tcardType := component.cardType\n-\tif envCardType := strings.TrimSpace(env[envNokiaSrosCard]); envCardType != \"\" {\n-\t\tcardType = envCardType\n+\tif override == nil {\n+\t\toverride = &Component{}\n \t}\n \n-\tlines := []componentCfgLine{\n-\t\t{Kind: \"card\", Slot: integratedSrosCardSlot, Type: cardType},\n+\tdefaultMdas := component.mdas\n+\n+\tif len(override.XIOM) > 0 {\n+\t\tdefaultMdas = nil\n \t}\n \n-\tfor _, mda := range mergeIntegratedMdas(component.mdas, env) {\n-\t\tlines = append(lines, componentCfgLine{\n-\t\t\tKind: \"mda\", Slot: integratedSrosCardSlot, MdaSlot: mda.Slot, Type: mda.Type,\n-\t\t})\n+\tcard := &Component{\n+\t\tSlot: integratedSrosCardSlot,\n+\t\tType: component.cardType,\n+\t\tXIOM: override.XIOM,\n+\t\tMDA:  mergeIntegratedMdas(defaultMdas, override.MDA),\n \t}\n \n-\treturn lines\n+\treturn buildComponentCfgLines([]*Component{card}, \"\")\n }\n \n-func mergeIntegratedMdas(defaults MDAS, env map[string]string) MDAS {\n+func mergeIntegratedMdas(defaults, overrides MDAS) MDAS {\n \tbySlot := map[int]string{}\n-\tfor _, mda := range defaults {\n+\tfor _, mda := range slices.Concat(defaults, overrides) {\n \t\tif mda.Slot > 0 && mda.Type != \"\" {\n \t\t\tbySlot[mda.Slot] = mda.Type\n \t\t}\n \t}\n \n-\tconst prefix = envNokiaSrosMDA + \"_\"\n-\tfor key, value := range env {\n-\t\tslotText, ok := strings.CutPrefix(key, prefix)\n-\t\tif !ok {\n-\t\t\tcontinue\n-\t\t}\n-\t\tslot, err := strconv.Atoi(slotText)\n-\t\tif err != nil || slot <= 0 {\n-\t\t\tcontinue\n-\t\t}\n-\t\tif value = strings.TrimSpace(value); value != \"\" {\n-\t\t\tbySlot[slot] = value\n-\t\t}\n-\t}\n-\n-\tslots := make([]int, 0, len(bySlot))\n-\tfor slot := range bySlot {\n-\t\tslots = append(slots, slot)\n-\t}\n-\tslices.Sort(slots)\n-\n+\tslots := slices.Sorted(maps.Keys(bySlot))\n \tmdas := make(MDAS, 0, len(slots))\n \tfor _, slot := range slots {\n \t\tmdas = append(mdas, MDA{Slot: slot, Type: bySlot[slot]})\n \t}\n \treturn mdas\n@@ -257,19 +244,150 @@ func integratedSrosAllowedSlots(nodeType string) []string {\n \t\treturn []string{slotAName}\n \t}\n \treturn component.allowedSlots\n }\n \n-func isSingleSlotIntegratedSrosNodeType(nodeType string) bool {\n-\tif !isIntegratedSrosNodeType(nodeType) {\n+func isRedundantIntegratedSrosComponents(nodeType string, components []*Component) bool {\n+\tif !isIntegratedSrosNodeType(nodeType) || len(components) < 2 {\n \t\treturn false\n \t}\n-\treturn len(integratedSrosAllowedSlots(nodeType)) == 1\n+\tfor _, c := range components {\n+\t\tif strings.TrimSpace(c.Slot) == \"\" || !integratedSrosSlotAllowed(nodeType, c.Slot) {\n+\t\t\treturn false\n+\t\t}\n+\t}\n+\treturn true\n }\n \n func integratedSrosSlotAllowed(nodeType, slot string) bool {\n \tslot = strings.ToUpper(strings.TrimSpace(slot))\n \tif slot == \"\" {\n \t\tslot = standaloneSlotName\n \t}\n \treturn slices.Contains(integratedSrosAllowedSlots(nodeType), slot)\n }\n+\n+func (n *sros) generateComponentConfig() string {\n+\tif !n.kindSpecificCfg().GenComponentConfig {\n+\t\treturn \"\"\n+\t}\n+\tif n.isConfigClassic() {\n+\t\treturn \"\"\n+\t}\n+\n+\tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n+\t\treturn n.generateIntegratedComponentConfig()\n+\t}\n+\n+\tcomponents := n.rootComponents\n+\tif len(components) == 0 {\n+\t\treturn \"\"\n+\t}\n+\n+\tfor _, c := range components {\n+\t\tslot := strings.ToUpper(strings.TrimSpace(c.Slot))\n+\t\tif slot == slotAName || slot == slotBName {\n+\t\t\tcontinue\n+\t\t}\n+\t\tif c.Type == \"\" {\n+\t\t\tlog.Warn(\n+\t\t\t\t\"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.\",\n+\t\t\t\t\"node\",\n+\t\t\t\tn.Cfg.ShortName,\n+\t\t\t\t\"slot\",\n+\t\t\t\tslot,\n+\t\t\t)\n+\t\t}\n+\t}\n+\n+\tlines := buildComponentCfgLines(n.componentsForConfig(components), n.componentSFM())\n+\treturn n.componentConfigFromLines(lines)\n+}\n+\n+// hardwareEnv is the topology env, which overrides component type, XIOM, and MDA.\n+// Nodes that have not been through Init expose that env on Cfg.Env.\n+func (n *sros) hardwareEnv() map[string]string {\n+\tif n.userEnv != nil {\n+\t\treturn n.userEnv\n+\t}\n+\treturn n.Cfg.Env\n+}\n+\n+// componentSFM is the SFM used in generated config. NOKIA_SROS_SFM overrides the sfm key.\n+func (n *sros) componentSFM() string {\n+\tif sfm := n.hardwareEnv()[envNokiaSrosSFM]; sfm != \"\" {\n+\t\treturn sfm\n+\t}\n+\treturn n.kindSpecificCfg().SFM\n+}\n+\n+// componentForConfig clones c and applies per-component env, then node env.\n+func (n *sros) componentForConfig(c *Component) *Component {\n+\tout := cloneComponent(c)\n+\tapplyHardwareEnv(out, out.Env)\n+\tapplyHardwareEnv(out, n.hardwareEnv())\n+\treturn out\n+}\n+\n+func (n *sros) componentsForConfig(components []*Component) []*Component {\n+\tout := make([]*Component, len(components))\n+\tfor i, c := range components {\n+\t\tout[i] = n.componentForConfig(c)\n+\t}\n+\treturn out\n+}\n+\n+func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {\n+\tpowerConfig := n.generatePowerConfig()\n+\tif len(lines) == 0 && powerConfig == \"\" {\n+\t\treturn \"\"\n+\t}\n+\n+\tvar config strings.Builder\n+\tfor _, l := range lines {\n+\t\tconfig.WriteString(l.String())\n+\t}\n+\tconfig.WriteString(powerConfig)\n+\treturn config.String()\n+}\n+\n+func (n *sros) generateIntegratedComponentConfig() string {\n+\tcard := strings.TrimSpace(n.Cfg.Env[envNokiaSrosCard])\n+\tif card != \"\" {\n+\t\tlog.Info(\n+\t\t\t\"Card type override set on integrated chassis type, skipping component SR OS config generation\",\n+\t\t\t\"node\",\n+\t\t\tn.Cfg.ShortName,\n+\t\t\t\"type\",\n+\t\t\tn.Cfg.NodeType,\n+\t\t\t\"card\",\n+\t\t\tcard,\n+\t\t)\n+\t\treturn \"\"\n+\t}\n+\n+\tlines := buildIntegratedComponentCfgLines(\n+\t\tn.Cfg.NodeType,\n+\t\tn.componentForConfig(n.integratedComponentOverride()),\n+\t)\n+\treturn n.componentConfigFromLines(lines)\n+}\n+\n+// integratedComponentOverride returns the component that overrides the integrated defaults:\n+// the single component of a standalone node, or the component matching the slot of a\n+// redundant CPM node.\n+func (n *sros) integratedComponentOverride() *Component {\n+\tif n.rootCtrName == \"\" {\n+\t\tif len(n.kindSpecificCfg().Components) == 1 {\n+\t\t\treturn n.kindSpecificCfg().Components[0]\n+\t\t}\n+\t\treturn nil\n+\t}\n+\n+\tslot := n.Cfg.Env[envNokiaSrosSlot]\n+\tfor _, c := range n.rootComponents {\n+\t\tif strings.EqualFold(strings.TrimSpace(c.Slot), slot) {\n+\t\t\treturn c\n+\t\t}\n+\t}\n+\treturn nil\n+}\ndiff --git a/nodes/sros/config.go b/nodes/sros/config.go\nindex b46ae42..8ddbb21 100644\n--- a/nodes/sros/config.go\n+++ b/nodes/sros/config.go\n@@ -1,8 +1,22 @@\n package sros\n \n-import \"golang.org/x/mod/semver\"\n+import (\n+\t\"bytes\"\n+\t\"context\"\n+\t\"fmt\"\n+\t\"io\"\n+\t\"os\"\n+\t\"path/filepath\"\n+\t\"strings\"\n+\n+\tclabutils \"github.com/srl-labs/containerlab/utils\"\n+\n+\t\"github.com/beevik/etree\"\n+\t\"github.com/charmbracelet/log\"\n+\t\"golang.org/x/mod/semver\"\n+)\n \n const (\n \tgrpcMDCLIConfig    = `/configure system grpc md-cli admin-state enable`\n \tprofileMDCLIConfig = `/configure system security aaa local-profiles profile \"administrative\" grpc rpc-authorization md-cli-session permit`\n \ttls13CipherCCM8    = `/configure system security tls server-cipher-list \"clab-all\" tls13-cipher 5 name tls-aes128-ccm8-sha256`\n@@ -18,5 +32,314 @@ func (n *sros) setVersionSpecificParams(tplData *srosTemplateData) {\n \t\tif tplData.IsSecureGrpc {\n \t\t\ttplData.GRPCConfig += \"\\n\" + tls13CipherCCM8\n \t\t}\n \t}\n }\n+\n+// buildPKIImportXML builds the NETCONF action XML that imports a PEM file into the PKI store.\n+func buildPKIImportXML(inputURL, outputFile, importType string) string {\n+\taction := etree.NewElement(\"action\")\n+\taction.CreateAttr(\"xmlns\", \"urn:ietf:params:xml:ns:yang:1\")\n+\n+\tadmin := action.CreateElement(\"admin\")\n+\tadmin.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:oper-admin\")\n+\n+\timportElem := admin.CreateElement(\"system\").\n+\t\tCreateElement(\"security\").\n+\t\tCreateElement(\"pki\").\n+\t\tCreateElement(\"import\")\n+\n+\t// Add import parameters\n+\timportElem.CreateElement(\"input-url\").SetText(inputURL)\n+\timportElem.CreateElement(\"output-file\").SetText(outputFile)\n+\timportElem.CreateElement(\"type\").SetText(importType)\n+\timportElem.CreateElement(\"format\").SetText(\"pem\")\n+\tvar buf bytes.Buffer\n+\taction.WriteTo(&buf, &etree.WriteSettings{\n+\t\tCanonicalText:    false,\n+\t\tCanonicalAttrVal: false,\n+\t})\n+\treturn buf.String()\n+}\n+\n+// buildTLSProfileXML builds the TLS profile configuration XML.\n+func buildTLSProfileXML() string {\n+\tconfig := etree.NewElement(\"config\")\n+\tconfigure := config.CreateElement(\"configure\")\n+\tconfigure.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:conf\")\n+\tconfigure.CreateAttr(\"xmlns:nc\", \"urn:ietf:params:xml:ns:netconf:base:1.0\")\n+\n+\tcertProfile := configure.CreateElement(\"system\").\n+\t\tCreateElement(\"security\").\n+\t\tCreateElement(\"tls\").\n+\t\tCreateElement(\"cert-profile\")\n+",
        "lineStart": 1,
        "lineEnd": 1200,
        "totalLines": 3945,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346604589,
      "end": 1792346604605
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502ec440001Gh8ClWHovtJk9u",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502ea218001TxfPGVQVV0MLpz",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 67793,
    "input": 19320,
    "output": 36,
    "reasoning": 565,
    "cache": {
      "read": 47872,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502ea218001TxfPGVQVV0MLpz",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346595864,
    "completed": 1792346604612
  },
  "parentID": "msg_1502e41aa001XEn2l1GdfLHjHR",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 67793,
    "input": 19320,
    "output": 36,
    "reasoning": 565,
    "cache": {
      "read": 47872,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 20
step-start
{
  "type": "step-start",
  "id": "prt_1502ecf3e001PU3bPGAFwIbIUQ",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502ec44d001escZDwyW8y5PXF"
}
Reasoning
Let me continue reading the diff from line 1201.
read · completed

Input

{
  "filePath": "/source/diff.txt",
  "offset": 1201,
  "limit": 1300
}

Output

<path>/source/diff.txt</path>
<type>file</type>
<content>
1201: +	// Set operation attribute
1202: +	certProfile.CreateAttr("nc:operation", "merge")
1203: +
1204: +	// Add profile configuration
1205: +	certProfile.CreateElement("cert-profile-name").SetText(tlsCertProfileName)
1206: +	certProfile.CreateElement("admin-state").SetText("enable")
1207: +
1208: +	var buf bytes.Buffer
1209: +	config.WriteTo(&buf, &etree.WriteSettings{
1210: +		CanonicalText:    false,
1211: +		CanonicalAttrVal: false,
1212: +	})
1213: +	return buf.String()
1214: +}
1215: +
1216: +// createSROSConfigFiles handles config generation for the SR-SIM kind.
1217: +// Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).
1218: +func (n *sros) createSROSConfigFiles() error {
1219: +	// Get version from image before generating config
1220: +	if n.swVersion == nil {
1221: +		ctx := context.Background()
1222: +		version, err := n.srosVersionFromImage(ctx)
1223: +		if err != nil {
1224: +			n.swVersion = n.parseVersionString(srosDefaultVersion)
1225: +			log.Warn("Failed to get SR OS version from image",
1226: +				"node", n.Cfg.ShortName, "version", n.swVersion, "error", err)
1227: +		} else {
1228: +			n.swVersion = version
1229: +			log.Info("Retrieved SR OS version from image",
1230: +				"node", n.Cfg.ShortName,
1231: +				"version", fmt.Sprintf("%s.%s.%s", version.Major, version.Minor, version.Build))
1232: +		}
1233: +	}
1234: +
1235: +	// Path pointing to the target config file under configCf3 dir
1236: +	cf3CfgFile := filepath.Join(
1237: +		n.Cfg.LabDir,
1238: +		n.Cfg.Env[envNokiaSrosSlot],
1239: +		configCf3,
1240: +		startupCfgName,
1241: +	)
1242: +	isPartial := clabutils.IsPartialConfigFile(n.Cfg.StartupConfig)
1243: +
1244: +	// generate config and use that to boot node
1245: +	log.Debug("Reading startup-config", "node", n.Cfg.ShortName, "startup-config",
1246: +		n.Cfg.StartupConfig, "isPartial", isPartial)
1247: +
1248: +	startupConfig, err := n.buildStartupConfig(isPartial)
1249: +	if err != nil {
1250: +		return err
1251: +	}
1252: +
1253: +	if startupConfig == "" {
1254: +		log.Debug(
1255: +			"startup config is empty, skipping startup config file generation",
1256: +			"node",
1257: +			n.Cfg.ShortName,
1258: +		)
1259: +		return nil
1260: +	}
1261: +
1262: +	return n.GenerateConfig(cf3CfgFile, startupConfig)
1263: +}
1264: +
1265: +// buildStartupConfig returns the full startup config string: either from user file (full config)
1266: +// or from default + partial config generation. It does not return a template; the name is
1267: +// historical.
1268: +func (n *sros) buildStartupConfig(isPartial bool) (string, error) {
1269: +	// User provides full startup config
1270: +	if n.Cfg.StartupConfig != "" && !isPartial {
1271: +		c, err := os.ReadFile(n.Cfg.StartupConfig)
1272: +		if err != nil {
1273: +			return "", err
1274: +		}
1275: +
1276: +		cBuf, err := clabutils.SubstituteEnvsAndTemplate(bytes.NewReader(c), n.Cfg)
1277: +		if err != nil {
1278: +			return "", err
1279: +		}
1280: +		return cBuf.String(), nil
1281: +	}
1282: +
1283: +	// Generate default config and optionally add partial config
1284: +	if err := n.addDefaultConfig(); err != nil {
1285: +		return "", err
1286: +	}
1287: +	if err := n.addPartialConfig(); err != nil {
1288: +		return "", err
1289: +	}
1290: +
1291: +	return string(n.startupCliCfg), nil
1292: +}
1293: +
1294: +// prepareConfigTemplateData prepares all data needed for template selection and execution.
1295: +// Service configs are filled from a single table-driven result: variant → getFullSnippetSet(v).
1296: +func (n *sros) prepareConfigTemplateData() (*srosTemplateData, error) {
1297: +	b, err := n.banner()
1298: +	if err != nil {
1299: +		return nil, err
1300: +	}
1301: +
1302: +	componentConfig := ""
1303: +	if !isFullConfigFile(n.Cfg.StartupConfig) {
1304: +		componentConfig = n.generateComponentConfig()
1305: +	} else {
1306: +		log.Debugf(
1307: +			"SR-SIM node %q has non-partial startup-config defined, skipping component config gen",
1308: +			n.Cfg.LongName,
1309: +		)
1310: +	}
1311: +
1312: +	v := n.resolveConfigVariant()
1313: +	snippets := getFullSnippetSet(v)
1314: +	configMode := string(v.Mode)
1315: +	if v.ForceClassic {
1316: +		log.Warn(
1317: +			"SAR-Hm nodes only support classic configuration mode. Overriding configuration mode to 'classic'",
1318: +			"node",
1319: +			n.Cfg.LongName,
1320: +			"node-type",
1321: +			strings.ToLower(n.Cfg.NodeType),
1322: +		)
1323: +		configMode = string(ConfigModeClassic)
1324: +		n.kindSpecificCfg().ConfigMode = ConfigModeClassic
1325: +	}
1326: +
1327: +	tplData := &srosTemplateData{
1328: +		// Selection criteria
1329: +		NodeType:          strings.ToLower(n.Cfg.NodeType),
1330: +		ConfigurationMode: configMode,
1331: +		SwVersion:         n.swVersion,
1332: +		IsSecureGrpc:      *n.Cfg.Certificate.Issue,
1333: +
1334: +		// Node data
1335: +		Name:            n.Cfg.ShortName,
1336: +		TLSKey:          n.Cfg.TLSKey,
1337: +		TLSCert:         n.Cfg.TLSCert,
1338: +		TLSAnchor:       n.Cfg.TLSAnchor,
1339: +		Banner:          b,
1340: +		IFaces:          map[string]tplIFace{},
1341: +		MgmtMTU:         0,
1342: +		MgmtIPMTU:       n.Runtime.Mgmt().MTU,
1343: +		ComponentConfig: componentConfig,
1344: +
1345: +		// Service configs from variant (single source of truth)
1346: +		SystemConfig:  snippets.SystemConfig,
1347: +		GRPCConfig:    snippets.GRPCConfig,
1348: +		SNMPConfig:    snippets.SNMPConfig,
1349: +		NetconfConfig: snippets.NetconfConfig,
1350: +		LoggingConfig: snippets.LoggingConfig,
1351: +		SSHConfig:     snippets.SSHConfig,
1352: +	}
1353: +
1354: +	if n.Config().DNS != nil {
1355: +		tplData.DNSServers = append(tplData.DNSServers, n.Config().DNS.Servers...)
1356: +	}
1357: +
1358: +	n.prepareSSHPubKeys(tplData)
1359: +
1360: +	n.setVersionSpecificParams(tplData)
1361: +
1362: +	return tplData, nil
1363: +}
1364: +
1365: +// addDefaultConfig adds sros default configuration such as tls certs, gnmi/json-rpc, login-banner,
1366: +// ssh keys.
1367: +func (n *sros) addDefaultConfig() error {
1368: +	// Prepare all template data
1369: +	tplData, err := n.prepareConfigTemplateData()
1370: +	if err != nil {
1371: +		return err
1372: +	}
1373: +
1374: +	// Select appropriate template
1375: +	srosCfgTpl, err := n.selectConfigTemplate(tplData)
1376: +	if err != nil {
1377: +		return fmt.Errorf("failed to select config template: %w", err)
1378: +	}
1379: +	log.Debug("Prepare SR OS config template", "template", srosCfgTpl.Name(),
1380: +		"node", n.Cfg.LongName,
1381: +		"configuration-mode", tplData.ConfigurationMode,
1382: +		"node-type", tplData.NodeType,
1383: +		"secure-grpc", tplData.IsSecureGrpc,
1384: +		"sw-version", tplData.SwVersion)
1385: +
1386: +	// Execute template
1387: +	buf := new(bytes.Buffer)
1388: +	err = srosCfgTpl.Execute(buf, tplData)
1389: +	if err != nil {
1390: +		return err
1391: +	}
1392: +
1393: +	if buf.Len() == 0 {
1394: +		log.Warn(
1395: +			"Buffer empty, template parsing error",
1396: +			"node", n.Cfg.ShortName,
1397: +			"template", srosCfgTpl.Name(),
1398: +		)
1399: +	} else {
1400: +		log.Debug("Additional default config parsed",
1401: +			"node", n.Cfg.ShortName,
1402: +			"template", srosCfgTpl.Name())
1403: +		n.startupCliCfg = append(n.startupCliCfg, buf.String()...)
1404: +	}
1405: +
1406: +	return nil
1407: +}
1408: +
1409: +// applyPartialConfig applies partial configuration to the SR OS.
1410: +func (n *sros) addPartialConfig() error {
1411: +	if n.Cfg.StartupConfig != "" {
1412: +		// b holds the configuration to be applied to the node
1413: +		b := &bytes.Buffer{}
1414: +		// apply partial configs if partial config is used
1415: +		if clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM("") {
1416: +			log.Info("Adding configuration",
1417: +				"node", n.Cfg.LongName,
1418: +				"type", "partial",
1419: +				"source", n.Cfg.StartupConfig)
1420: +
1421: +			r, err := os.Open(n.Cfg.StartupConfig)
1422: +			if err != nil {
1423: +				return err
1424: +			}
1425: +
1426: +			defer r.Close() // skipcq: GO-S2307
1427: +
1428: +			_, err = io.Copy(b, r)
1429: +			if err != nil {
1430: +				return err
1431: +			}
1432: +
1433: +			configContent, err := clabutils.SubstituteEnvsAndTemplate(b, n.Cfg)
1434: +			if err != nil {
1435: +				return err
1436: +			}
1437: +			if configContent.Len() == 0 {
1438: +				log.Warn(
1439: +					"Buffer empty, PARTIAL config template parsing error",
1440: +					"node",
1441: +					n.Cfg.ShortName,
1442: +				)
1443: +			} else {
1444: +				log.Debug("Additional PARTIAL config parsed", "node",
1445: +					n.Cfg.ShortName, "partial-config", configContent.String())
1446: +				n.startupCliCfg = append(n.startupCliCfg, configContent.String()...)
1447: +			}
1448: +		} else {
1449: +			log.Warn(
1450: +				"Passed startup-config option, but it will not have any effect",
1451: +				"node",
1452: +				n.Cfg.ShortName,
1453: +			)
1454: +		}
1455: +	}
1456: +	return nil
1457: +}
1458: +
1459: +// isConfigClassic reports whether the node is in classic or mixed configuration mode.
1460: +func (n *sros) isConfigClassic() bool {
1461: +	mode := n.kindSpecificCfg().ConfigMode
1462: +	return mode == ConfigModeClassic || mode == ConfigModeMixed
1463: +}
1464: +
1465: +// isFullConfigFile returns true if the config file doesn't contain .partial substring
1466: +// and the config file is NOT nil (ie. startup config IS defined).
1467: +// it is intended that the 'c' arg is n.Cfg.StartupConfig.
1468: +func isFullConfigFile(c string) bool {
1469: +	return c != "" && !clabutils.IsPartialConfigFile(c)
1470: +}
1471: diff --git a/nodes/sros/netns.go b/nodes/sros/netns.go
1472: index dbd9af7..e7ec511 100644
1473: --- a/nodes/sros/netns.go
1474: +++ b/nodes/sros/netns.go
1475: @@ -1,14 +1,20 @@
1476:  package sros
1477:  
1478:  import (
1479: +	"context"
1480: +	"errors"
1481:  	"fmt"
1482:  	"maps"
1483:  
1484: +	clabutils "github.com/srl-labs/containerlab/utils"
1485: +
1486:  	clabconstants "github.com/srl-labs/containerlab/constants"
1487:  	clabnodes "github.com/srl-labs/containerlab/nodes"
1488: +	clabruntime "github.com/srl-labs/containerlab/runtime"
1489:  	clabtypes "github.com/srl-labs/containerlab/types"
1490: +	"github.com/vishvananda/netns"
1491:  )
1492:  
1493:  // namespaceNode owns the shared network namespace of a components-based SR-SIM node.
1494:  type namespaceNode struct {
1495:  	clabnodes.DefaultNode
1496: @@ -81,5 +87,71 @@ func (n *sros) newNetnsConfig() *clabtypes.NodeConfig {
1497:  		Labels:                labels,
1498:  		Runtime:               n.Cfg.Runtime,
1499:  		ResultingPortBindings: n.Cfg.ResultingPortBindings,
1500:  	}
1501:  }
1502: +
1503: +func (n *sros) ensureNetnsRunning(ctx context.Context) error {
1504: +	switch status := n.netnsNode.GetContainerStatus(ctx); status {
1505: +	case clabruntime.Running:
1506: +		// The namespace holder intentionally survives regular node lifecycle operations.
1507: +	case clabruntime.Created, clabruntime.Stopped:
1508: +		if err := n.netnsNode.Start(ctx); err != nil {
1509: +			return fmt.Errorf("node %q network namespace container start error: %w",
1510: +				n.Cfg.ShortName, err)
1511: +		}
1512: +	case clabruntime.Paused:
1513: +		if err := n.Runtime.UnpauseContainer(ctx, n.netnsNode.Config().LongName); err != nil {
1514: +			return fmt.Errorf("node %q network namespace container unpause error: %w",
1515: +				n.Cfg.ShortName, err)
1516: +		}
1517: +	case clabruntime.NotFound:
1518: +		return fmt.Errorf(
1519: +			"node %q network namespace container %q not found; recreate the node",
1520: +			n.Cfg.ShortName, n.netnsNode.Config().LongName,
1521: +		)
1522: +	default:
1523: +		return fmt.Errorf("node %q network namespace container %q is %s",
1524: +			n.Cfg.ShortName, n.netnsNode.Config().LongName, status)
1525: +	}
1526: +
1527: +	return nil
1528: +}
1529: +
1530: +func (n *sros) cleanupParkingNetNS() error {
1531: +	name := clabutils.ParkingNetnsName(n.Cfg.LongName)
1532: +	if _, err := clabutils.GetNamedNetNS(name); err != nil {
1533: +		return nil
1534: +	}
1535: +
1536: +	return netns.DeleteNamed(name)
1537: +}
1538: +
1539: +// GetNSPath retrieves the Namespace Path.
1540: +func (n *sros) GetNSPath(ctx context.Context) (string, error) {
1541: +	if n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == "") {
1542: +		return n.DefaultNode.GetNSPath(ctx)
1543: +	} else if n.isDistributedCardNode() {
1544: +		return n.Runtime.GetNSPath(ctx, n.rootCtrName)
1545: +	}
1546: +	return n.netnsNode.GetNSPath(ctx)
1547: +}
1548: +
1549: +// DeleteNetnsSymlink deletes the symlink file created for the container netns.
1550: +func (n *sros) DeleteNetnsSymlink() error {
1551: +	var errs []error
1552: +
1553: +	// if it is the base node, then we need to delete the symlink for all the components.
1554: +	if n.isDistributedBaseNode() {
1555: +		for _, componentNode := range n.componentNodes {
1556: +			errs = append(errs, componentNode.DeleteNetnsSymlink())
1557: +		}
1558: +		if n.netnsNode != nil {
1559: +			errs = append(errs, n.netnsNode.DeleteNetnsSymlink())
1560: +		}
1561: +		errs = append(errs, clabutils.DeleteNetnsSymlink(n.Cfg.LongName))
1562: +	}
1563: +
1564: +	errs = append(errs, n.DefaultNode.DeleteNetnsSymlink(), n.cleanupParkingNetNS())
1565: +
1566: +	return errors.Join(errs...)
1567: +}
1568: diff --git a/nodes/sros/power.go b/nodes/sros/power.go
1569: index 7ab11bd..07509f3 100644
1570: --- a/nodes/sros/power.go
1571: +++ b/nodes/sros/power.go
1572: @@ -3,10 +3,15 @@ package sros
1573:  import (
1574:  	"fmt"
1575:  	"strings"
1576:  )
1577:  
1578: +const (
1579: +	defaultSrosPowerType       = "dc"
1580: +	defaultSrosPowerModuleType = "ps-a-dc-6000"
1581: +)
1582: +
1583:  // SrosPower defines power supply configuration for a given node type.
1584:  type SrosPower struct {
1585:  	Modules any
1586:  	Shelves int
1587:  }
1588: diff --git a/nodes/sros/sros.go b/nodes/sros/sros.go
1589: index 1eac470..20ae973 100644
1590: --- a/nodes/sros/sros.go
1591: +++ b/nodes/sros/sros.go
1592: @@ -6,11 +6,10 @@ package sros
1593:  
1594:  import (
1595:  	"bufio"
1596:  	"bytes"
1597:  	"context"
1598: -	_ "embed"
1599:  	"errors"
1600:  	"fmt"
1601:  	"io"
1602:  	"maps"
1603:  	"net"
1604: @@ -20,19 +19,16 @@ import (
1605:  	"reflect"
1606:  	"regexp"
1607:  	"slices"
1608:  	"strconv"
1609:  	"strings"
1610: -	"text/template"
1611:  	"time"
1612:  
1613: -	"github.com/beevik/etree"
1614:  	"github.com/brunoga/deep"
1615:  	"github.com/charmbracelet/log"
1616:  	"github.com/scrapli/scrapligo/driver/netconf"
1617:  	"github.com/scrapli/scrapligo/driver/opoptions"
1618: -	"github.com/vishvananda/netns"
1619:  
1620:  	"github.com/scrapli/scrapligo/response"
1621:  
1622:  	clabconstants "github.com/srl-labs/containerlab/constants"
1623:  	clabexec "github.com/srl-labs/containerlab/exec"
1624: @@ -82,32 +78,16 @@ const (
1625:  	envNokiaSrosMDA           = "NOKIA_SROS_MDA"
1626:  	envSrosIPv4Active         = "NOKIA_SROS_ADDRESS_IPV4_ACTIVE"
1627:  	envSrosIPv6Active         = "NOKIA_SROS_ADDRESS_IPV6_ACTIVE"
1628:  	envSrosStaticRoutePrefix  = "NOKIA_SROS_STATIC_ROUTE_"
1629:  
1630: -	defaultSrosPowerType       = "dc"
1631: -	defaultSrosPowerModuleType = "ps-a-dc-6000"
1632: -
1633:  	srosMinorError     = "MINOR:"
1634:  	srosCriticalError  = "CRITICAL:"
1635:  	srosRejectedCfgMsg = "Configuration load failed - using default configuration"
1636:  )
1637:  
1638:  var (
1639: -
1640: -	//go:embed configs/sros_config_sros25.go.tpl
1641: -	cfgTplSROS25 string
1642: -
1643: -	//go:embed configs/sros_config_classic.go.tpl
1644: -	cfgTplClassic string
1645: -
1646: -	//go:embed configs/ixr/ixr_config_classic.go.tpl
1647: -	cfgTplClassicIxr string
1648: -
1649: -	//go:embed configs/sar/sar_config_classic.go.tpl
1650: -	cfgTplClassicSar string
1651: -
1652:  	kindNames  = []string{"nokia_srsim"}
1653:  	srosSysctl = map[string]string{
1654:  		"net.ipv4.ip_forward":                "0",
1655:  		"net.ipv6.conf.all.disable_ipv6":     "0",
1656:  		"net.ipv6.conf.default.disable_ipv6": "0",
1657: @@ -160,15 +140,10 @@ var (
1658:        e1-2-3       -> card 1, mda 2, port 3
1659:        e1-2-c3-4    -> card 1, mda 2, connector 3, port 4
1660:        e1-x2-3-4    -> card 1, xiom 2, mda 3, port 4
1661:        e1-x2-3-c4-5 -> card 1, xiom 2, mda 3, connector 4, port 5
1662:  	  eth[0-9], for management interfaces of CPM-A/CPM-B or for fabric interfaces`
1663: -	// Auxiliary regexps for IXR/SAR detection.
1664: -	sarRegexp   = regexp.MustCompile(`(?i)\bsar-`)
1665: -	sarHmRegexp = regexp.MustCompile(`(?i)\b(sar-hm|sar-hmc)\b`)
1666: -
1667: -	ixrRegexp = regexp.MustCompile(`(?i)\bixr-`)
1668:  )
1669:  
1670:  // Register registers the node in the NodeRegistry.
1671:  func Register(r *clabnodes.NodeRegistry) {
1672:  	generateNodeAttributes := clabnodes.NewGenerateNodeAttributes(generateable, generateIfFormat)
1673: @@ -241,10 +216,14 @@ type sros struct {
1674:  	// rootCtrName is the container that owns the netns.
1675:  	//  - for components based: the internal netns container.
1676:  	//  - for network mode based: parsed from network-mode.
1677:  	rootCtrName string
1678:  
1679: +	// userEnv is the env map from the topology, before component fields are merged in.
1680: +	// Node env overrides component type, XIOM, MDA, SFM, and per-component env.
1681: +	userEnv map[string]string
1682: +
1683:  	preDeployParams *clabnodes.PreDeployParams
1684:  
1685:  	netnsNode clabnodes.Node
1686:  }
1687:  
1688: @@ -279,16 +258,44 @@ func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) err
1689:  	// if user was not initialized to a value, use root
1690:  	if n.Cfg.User == "" {
1691:  		n.Cfg.User = "0:0"
1692:  	}
1693:  
1694: -	if sfm := n.kindSpecificCfg().SFM; sfm != "" {
1695: +	// Snapshot topology env before component and SFM flags are applied.
1696: +	// Component nodes set userEnv from the base node before Init.
1697: +	envAlreadyResolved := n.userEnv != nil
1698: +	if !envAlreadyResolved {
1699:  		if n.Cfg.Env == nil {
1700: -			n.Cfg.Env = map[string]string{}
1701: +			n.userEnv = map[string]string{}
1702: +		} else {
1703: +			n.userEnv = maps.Clone(n.Cfg.Env)
1704:  		}
1705: +	}
1706: +	if n.Cfg.Env == nil {
1707: +		n.Cfg.Env = map[string]string{}
1708: +	}
1709:  
1710: -		n.Cfg.Env[envNokiaSrosSFM] = sfm
1711: +	// Distributed cards inherit SFM from the base node env. Applying it again
1712: +	// would warn once per card when the user also set NOKIA_SROS_SFM.
1713: +	if sfm := n.kindSpecificCfg().SFM; sfm != "" && !envAlreadyResolved {
1714: +		if envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {
1715: +			if envSFM != sfm {
1716: +				log.Warn(
1717: +					fmt.Sprintf(
1718: +						"component value %q will not be used because environment variable %s is set",
1719: +						sfm,
1720: +						envNokiaSrosSFM,
1721: +					),
1722: +					"node", n.Cfg.ShortName,
1723: +					"env", envNokiaSrosSFM,
1724: +					"component-value", sfm,
1725: +					"env-value", envSFM,
1726: +				)
1727: +			}
1728: +		} else {
1729: +			n.Cfg.Env[envNokiaSrosSFM] = sfm
1730: +		}
1731:  	}
1732:  
1733:  	maps.Copy(n.Cfg.Sysctls, srosSysctl)
1734:  
1735:  	// make sure we always have uppercase slot definition
1736: @@ -316,10 +323,11 @@ func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) err
1737:  
1738:  		vars, err := n.setupStandaloneComponents()
1739:  		if err != nil {
1740:  			return err
1741:  		}
1742: +		warnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)
1743:  
1744:  		// n.Cfg.Env overrides component vars, overrides default srosEnv
1745:  		n.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)
1746:  		log.Debug("Merged env file", "env", fmt.Sprintf("%+v", n.Cfg.Env), "node", n.Cfg.ShortName)
1747:  	} else {
1748: @@ -348,12 +356,15 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {
1749:  	if len(n.kindSpecificCfg().Components) == 0 {
1750:  		return nil, nil
1751:  	}
1752:  	if len(n.kindSpecificCfg().Components) > 1 {
1753:  		return nil, fmt.Errorf(
1754: -			"expected at most one component override for standalone SR-SIM node %q",
1755: +			"expected at most one component override for standalone SR-SIM node %q, "+
1756: +				"or one component per slot %s for redundant type %q",
1757:  			n.Cfg.ShortName,
1758: +			strings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), "/"),
1759: +			n.Cfg.NodeType,
1760:  		)
1761:  	}
1762:  
1763:  	slotA := n.kindSpecificCfg().Components[0]
1764:  
1765: @@ -370,27 +381,11 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {
1766:  			n.Cfg.ShortName,
1767:  		)
1768:  	}
1769:  	vars[envNokiaSrosSlot] = slotName
1770:  
1771: -	if slotA.Type != "" {
1772: -		if isSingleSlotIntegratedSrosNodeType(n.Cfg.NodeType) {
1773: -			return nil, fmt.Errorf(
1774: -				"node %q type %q is integrated and does not support component card-type override",
1775: -				n.Cfg.ShortName,
1776: -				n.Cfg.NodeType,
1777: -			)
1778: -		}
1779: -		vars[envNokiaSrosCard] = slotA.Type
1780: -	}
1781: -
1782: -	if len(slotA.MDA) > 0 {
1783: -		for _, m := range slotA.MDA {
1784: -			key := fmt.Sprintf("%s_%d", envNokiaSrosMDA, m.Slot)
1785: -			vars[key] = m.Type
1786: -		}
1787: -	}
1788: +	setComponentEnvVars(vars, slotA)
1789:  
1790:  	maps.Copy(vars, slotA.Env)
1791:  
1792:  	return vars, nil
1793:  }
1794: @@ -625,39 +620,10 @@ func (n *sros) Delete(ctx context.Context) error {
1795:  	errs = append(errs, n.DefaultNode.Delete(ctx), n.netnsNode.Delete(ctx))
1796:  
1797:  	return errors.Join(errs...)
1798:  }
1799:  
1800: -// DeleteNetnsSymlink deletes the symlink file created for the container netns.
1801: -func (n *sros) DeleteNetnsSymlink() error {
1802: -	var errs []error
1803: -
1804: -	// if it is the base node, then we need to delete the symlink for all the components.
1805: -	if n.isDistributedBaseNode() {
1806: -		for _, componentNode := range n.componentNodes {
1807: -			errs = append(errs, componentNode.DeleteNetnsSymlink())
1808: -		}
1809: -		if n.netnsNode != nil {
1810: -			errs = append(errs, n.netnsNode.DeleteNetnsSymlink())
1811: -		}
1812: -		errs = append(errs, clabutils.DeleteNetnsSymlink(n.Cfg.LongName))
1813: -	}
1814: -
1815: -	errs = append(errs, n.DefaultNode.DeleteNetnsSymlink(), n.cleanupParkingNetNS())
1816: -
1817: -	return errors.Join(errs...)
1818: -}
1819: -
1820: -func (n *sros) cleanupParkingNetNS() error {
1821: -	name := clabutils.ParkingNetnsName(n.Cfg.LongName)
1822: -	if _, err := clabutils.GetNamedNetNS(name); err != nil {
1823: -		return nil
1824: -	}
1825: -
1826: -	return netns.DeleteNamed(name)
1827: -}
1828: -
1829:  func (n *sros) setupComponentNodes() error {
1830:  	if !n.isDistributedBaseNode() {
1831:  		return nil
1832:  	}
1833:  
1834: @@ -693,17 +659,16 @@ func (n *sros) setupComponentNodes() error {
1835:  		componentConfig.Fqdn = n.calcComponentFqdn(c.Slot)
1836:  		componentConfig.DNS = nil
1837:  		componentConfig.PortBindings = nil
1838:  		componentConfig.PortSet = nil
1839:  
1840: -		// add the component env to the componentConfig env
1841: -		for k, v := range c.Env {
1842: -			componentConfig.Env[k] = v
1843: +		// Component fields fill env keys the user did not set. Node env wins.
1844: +		if componentConfig.Env == nil {
1845: +			componentConfig.Env = map[string]string{}
1846:  		}
1847: -
1848: -		// set component environment variables
1849: -		n.setComponentEnvVars(componentConfig, c)
1850: +		keepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)
1851: +		// Slot identifies this container. A node-level NOKIA_SROS_SLOT cannot apply to every card.
1852:  		componentConfig.Env[envNokiaSrosSlot] = c.Slot
1853:  
1854:  		// adjust label based env vars
1855:  		componentConfig.Env["CLAB_LABEL_"+clabutils.ToEnvKey(clabconstants.NodeName)] = componentConfig.ShortName
1856:  		componentConfig.Env["CLAB_LABEL_"+clabutils.ToEnvKey(clabconstants.LongName)] = componentConfig.LongName
1857: @@ -716,10 +681,14 @@ func (n *sros) setupComponentNodes() error {
1858:  		componentConfig.Labels[clabconstants.NodeName] = componentConfig.ShortName
1859:  		componentConfig.Labels[clabconstants.LongName] = componentConfig.LongName
1860:  		componentConfig.Labels[clabconstants.RootNodeName] = n.Cfg.ShortName
1861:  		componentConfig.Labels[clabconstants.RootNodeLongName] = n.Cfg.LongName
1862:  
1863: +		// Preserve the topology env. Init must not snapshot the merged component env,
1864: +		// or config generation would treat component flags as user overrides.
1865: +		srosNode.userEnv = maps.Clone(n.userEnv)
1866: +
1867:  		// init the component
1868:  		err = componentNode.Init(componentConfig)
1869:  		if err != nil {
1870:  			return err
1871:  		}
1872: @@ -737,32 +706,10 @@ func (n *sros) setupComponentNodes() error {
1873:  		n.componentNodes = append(n.componentNodes, componentNode)
1874:  	}
1875:  	return nil
1876:  }
1877:  
1878: -// setComponentEnvVars sets environment variables for a component.
1879: -func (n *sros) setComponentEnvVars(componentConfig *clabtypes.NodeConfig, c *Component) {
1880: -	if c.Type != "" {
1881: -		componentConfig.Env[envNokiaSrosCard] = c.Type
1882: -	}
1883: -
1884: -	for _, x := range c.XIOM {
1885: -		key := fmt.Sprintf("%s_X%d", envNokiaSrosXIOM, x.Slot)
1886: -		componentConfig.Env[key] = x.Type
1887: -		// add the nested MDA
1888: -		for _, m := range x.MDA {
1889: -			key := fmt.Sprintf("%s_X%d_%d", envNokiaSrosMDA, x.Slot, m.Slot)
1890: -			componentConfig.Env[key] = m.Type
1891: -		}
1892: -	}
1893: -
1894: -	for _, m := range c.MDA {
1895: -		key := fmt.Sprintf("%s_%d", envNokiaSrosMDA, m.Slot)
1896: -		componentConfig.Env[key] = m.Type
1897: -	}
1898: -}
1899: -
1900:  // deployFabric deploys the distributed SR-SIM when the `components` key is present.
1901:  func (n *sros) deployFabric(ctx context.Context, deployParams *clabnodes.DeployParams) error {
1902:  	netnsConfig := n.netnsNode.Config()
1903:  
1904:  	netnsConfig.MgmtIPv4Address = n.Cfg.MgmtIPv4Address
1905: @@ -870,30 +817,20 @@ func (n *sros) isDistributedCardNode() bool {
1906:  
1907:  // isDistributedBaseNode returns true if this is the base node of a distributed
1908:  // SR-SIM deployment. The base node orchestrates multiple component nodes.
1909:  func (n *sros) isDistributedBaseNode() bool {
1910:  	if isIntegratedSrosNodeType(n.Cfg.NodeType) {
1911: -		return false
1912: +		return isRedundantIntegratedSrosComponents(n.Cfg.NodeType, n.kindSpecificCfg().Components)
1913:  	}
1914:  	return len(n.kindSpecificCfg().Components) > 1
1915:  }
1916:  
1917:  // isStandaloneNode returns true if this is a standalone (non-distributed) SR-SIM node.
1918:  func (n *sros) isStandaloneNode() bool {
1919:  	return !n.isDistributedBaseNode() && !n.isDistributedCardNode()
1920:  }
1921:  
1922: -// GetNSPath retrieves the Namespace Path.
1923: -func (n *sros) GetNSPath(ctx context.Context) (string, error) {
1924: -	if n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == "") {
1925: -		return n.DefaultNode.GetNSPath(ctx)
1926: -	} else if n.isDistributedCardNode() {
1927: -		return n.Runtime.GetNSPath(ctx, n.rootCtrName)
1928: -	}
1929: -	return n.netnsNode.GetNSPath(ctx)
1930: -}
1931: -
1932:  // calcComponentName appends the line card suffix to the given node name.
1933:  func (n *sros) calcComponentName(name, slot string) string {
1934:  	if n.renameDone {
1935:  		return name
1936:  	}
1937: @@ -934,19 +871,18 @@ func (n *sros) cpmNode() (clabnodes.Node, error) {
1938:  }
1939:  
1940:  // cpmSlot returns the Slot of the preferred CPM Node (used when Distributed mode).
1941:  // It prefers slot A if present, otherwise returns slot B.
1942:  func (n *sros) cpmSlot() (string, error) {
1943: -	// Prefer slot A, fall back to slot B
1944: +	// Prefer slot A, fall back to slot B. Slots are accepted in either case.
1945:  	for _, comp := range n.kindSpecificCfg().Components {
1946: -		if comp.Slot == slotAName {
1947: +		if strings.EqualFold(comp.Slot, slotAName) {
1948:  			return slotAName, nil
1949:  		}
1950:  	}
1951: -	// Check for slot B as fallback
1952:  	for _, comp := range n.kindSpecificCfg().Components {
1953: -		if comp.Slot == slotBName {
1954: +		if strings.EqualFold(comp.Slot, slotBName) {
1955:  			return slotBName, nil
1956:  		}
1957:  	}
1958:  	return "", fmt.Errorf("node %s: unable to determine default slot", n.GetShortName())
1959:  }
1960: @@ -1041,33 +977,10 @@ func (*sros) checkKernelVersion() error {
1961:  		)
1962:  	}
1963:  	return nil
1964:  }
1965:  
1966: -// checkComponentSlotsConfig check the sros component slot config for validity.
1967: -func (n *sros) checkComponentSlotsConfig() error {
1968: -	// check Slots are unique
1969: -	componentNames := map[string]struct{}{}
1970: -	for _, component := range n.kindSpecificCfg().Components {
1971: -		// convert slot to upper
1972: -		slot := strings.ToUpper(component.Slot)
1973: -		// check if slot exists
1974: -		_, exists := componentNames[slot]
1975: -		if exists {
1976: -			return fmt.Errorf(
1977: -				"node %s slot %s duplicate definition",
1978: -				n.GetShortName(),
1979: -				component.Slot,
1980: -			)
1981: -		}
1982: -		// add to component names map
1983: -		componentNames[component.Slot] = struct{}{}
1984: -
1985: -	}
1986: -	return nil
1987: -}
1988: -
1989:  func (n *sros) CheckDeploymentConditions(ctx context.Context) error {
1990:  	// perform the sros specific kernel version check
1991:  	err := n.checkKernelVersion()
1992:  	if err != nil {
1993:  		return err
1994: @@ -1148,13 +1061,53 @@ func (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {
1995:  	licensed := append([]byte(chassisInfoFileLicense), content...)
1996:  	if err := os.WriteFile(dstPath, licensed, clabconstants.PermissionsFileDefault); err != nil {
1997:  		return fmt.Errorf("write %s: %w", dstPath, err)
1998:  	}
1999:  	log.Debug("Wrote chassis_info.json to lab dir", "node", n.Cfg.ShortName, "path", dstPath)
2000: +	n.warnUnsupportedComponents(content)
2001:  	return nil
2002:  }
2003:  
2004: +// warnUnsupportedComponents validates the effective component configuration against the
2005: +// chassis_info.json extracted from this exact image. Validation is advisory and never blocks
2006: +// deploy.
2007: +func (n *sros) warnUnsupportedComponents(content []byte) {
2008: +	// A distributed node validates once, from CPM A, to avoid duplicate warnings from CPM B.
2009: +	if !n.isStandaloneNode() && !n.isCPM(slotAName) {
2010: +		return
2011: +	}
2012: +
2013: +	info, err := parseChassisInfo(content)
2014: +	if err != nil {
2015: +		log.Warn("Could not validate SR-SIM components against chassis_info.json",
2016: +			"node", n.Cfg.ShortName, "error", err)
2017: +		return
2018: +	}
2019: +
2020: +	components := n.rootComponents
2021: +	if len(components) == 0 {
2022: +		components = n.kindSpecificCfg().Components
2023: +	}
2024: +
2025: +	effective := n.componentsForConfig(components)
2026: +	if len(effective) == 0 {
2027: +		// Environment variables can configure integrated hardware without a components entry.
2028: +		effective = []*Component{n.componentForConfig(nil)}
2029: +	}
2030: +
2031: +	nodeType := n.Cfg.NodeType
2032: +	if chassis := strings.TrimSpace(n.Cfg.Env[envNokiaSrosChassis]); chassis != "" {
2033: +		nodeType = chassis
2034: +	}
2035: +	for _, warning := range info.componentWarnings(nodeType, n.componentSFM(), effective) {
2036: +		log.Warn("SR-SIM component configuration may not be supported",
2037: +			"node", n.Cfg.ShortName,
2038: +			"chassis", nodeType,
2039: +			"warning", warning)
2040: +	}
2041: +}
2042: +
2043:  // Func that Places the Certificates in the right place and format.
2044:  func (n *sros) createSROSCertificates() error {
2045:  	if *n.Cfg.Certificate.Issue {
2046:  		clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),
2047:  			clabconstants.PermissionsOpen)
2048: @@ -1170,88 +1123,10 @@ func (n *sros) createSROSCertificates() error {
2049:  		}
2050:  	}
2051:  	return nil
2052:  }
2053:  
2054: -// createSROSConfigFiles handles config generation for the SR-SIM kind.
2055: -// Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).
2056: -func (n *sros) createSROSConfigFiles() error {
2057: -	// Get version from image before generating config
2058: -	if n.swVersion == nil {
2059: -		ctx := context.Background()
2060: -		version, err := n.srosVersionFromImage(ctx)
2061: -		if err != nil {
2062: -			n.swVersion = n.parseVersionString(srosDefaultVersion)
2063: -			log.Warn("Failed to get SR OS version from image",
2064: -				"node", n.Cfg.ShortName, "version", n.swVersion, "error", err)
2065: -		} else {
2066: -			n.swVersion = version
2067: -			log.Info("Retrieved SR OS version from image",
2068: -				"node", n.Cfg.ShortName,
2069: -				"version", fmt.Sprintf("%s.%s.%s", version.Major, version.Minor, version.Build))
2070: -		}
2071: -	}
2072: -
2073: -	// Path pointing to the target config file under configCf3 dir
2074: -	cf3CfgFile := filepath.Join(
2075: -		n.Cfg.LabDir,
2076: -		n.Cfg.Env[envNokiaSrosSlot],
2077: -		configCf3,
2078: -		startupCfgName,
2079: -	)
2080: -	isPartial := clabutils.IsPartialConfigFile(n.Cfg.StartupConfig)
2081: -
2082: -	// generate config and use that to boot node
2083: -	log.Debug("Reading startup-config", "node", n.Cfg.ShortName, "startup-config",
2084: -		n.Cfg.StartupConfig, "isPartial", isPartial)
2085: -
2086: -	startupConfig, err := n.buildStartupConfig(isPartial)
2087: -	if err != nil {
2088: -		return err
2089: -	}
2090: -
2091: -	if startupConfig == "" {
2092: -		log.Debug(
2093: -			"startup config is empty, skipping startup config file generation",
2094: -			"node",
2095: -			n.Cfg.ShortName,
2096: -		)
2097: -		return nil
2098: -	}
2099: -
2100: -	return n.GenerateConfig(cf3CfgFile, startupConfig)
2101: -}
2102: -
2103: -// buildStartupConfig returns the full startup config string: either from user file (full config)
2104: -// or from default + partial config generation. It does not return a template; the name is
2105: -// historical.
2106: -func (n *sros) buildStartupConfig(isPartial bool) (string, error) {
2107: -	// User provides full startup config
2108: -	if n.Cfg.StartupConfig != "" && !isPartial {
2109: -		c, err := os.ReadFile(n.Cfg.StartupConfig)
2110: -		if err != nil {
2111: -			return "", err
2112: -		}
2113: -
2114: -		cBuf, err := clabutils.SubstituteEnvsAndTemplate(bytes.NewReader(c), n.Cfg)
2115: -		if err != nil {
2116: -			return "", err
2117: -		}
2118: -		return cBuf.String(), nil
2119: -	}
2120: -
2121: -	// Generate default config and optionally add partial config
2122: -	if err := n.addDefaultConfig(); err != nil {
2123: -		return "", err
2124: -	}
2125: -	if err := n.addPartialConfig(); err != nil {
2126: -		return "", err
2127: -	}
2128: -
2129: -	return string(n.startupCliCfg), nil
2130: -}
2131: -
2132:  // SlotIsInteger checks if the slot string represents a valid integer.
2133:  func SlotIsInteger(s string) bool {
2134:  	_, err := strconv.Atoi(s)
2135:  	return err == nil
2136:  }
2137: @@ -1279,221 +1154,10 @@ func (n *sros) isCPM(cpm string) bool {
2138:  	}
2139:  
2140:  	return true
2141:  }
2142:  
2143: -// prepareConfigTemplateData prepares all data needed for template selection and execution.
2144: -// Service configs are filled from a single table-driven result: variant → getFullSnippetSet(v).
2145: -func (n *sros) prepareConfigTemplateData() (*srosTemplateData, error) {
2146: -	b, err := n.banner()
2147: -	if err != nil {
2148: -		return nil, err
2149: -	}
2150: -
2151: -	componentConfig := ""
2152: -	if !isFullConfigFile(n.Cfg.StartupConfig) {
2153: -		componentConfig = n.generateComponentConfig()
2154: -	} else {
2155: -		log.Debugf(
2156: -			"SR-SIM node %q has non-partial startup-config defined, skipping component config gen",
2157: -			n.Cfg.LongName,
2158: -		)
2159: -	}
2160: -
2161: -	v := n.resolveConfigVariant()
2162: -	snippets := getFullSnippetSet(v)
2163: -	configMode := string(v.Mode)
2164: -	if v.ForceClassic {
2165: -		log.Warn(
2166: -			"SAR-Hm nodes only support classic configuration mode. Overriding configuration mode to 'classic'",
2167: -			"node",
2168: -			n.Cfg.LongName,
2169: -			"node-type",
2170: -			strings.ToLower(n.Cfg.NodeType),
2171: -		)
2172: -		configMode = string(ConfigModeClassic)
2173: -		n.kindSpecificCfg().ConfigMode = ConfigModeClassic
2174: -	}
2175: -
2176: -	tplData := &srosTemplateData{
2177: -		// Selection criteria
2178: -		NodeType:          strings.ToLower(n.Cfg.NodeType),
2179: -		ConfigurationMode: configMode,
2180: -		SwVersion:         n.swVersion,
2181: -		IsSecureGrpc:      *n.Cfg.Certificate.Issue,
2182: -
2183: -		// Node data
2184: -		Name:            n.Cfg.ShortName,
2185: -		TLSKey:          n.Cfg.TLSKey,
2186: -		TLSCert:         n.Cfg.TLSCert,
2187: -		TLSAnchor:       n.Cfg.TLSAnchor,
2188: -		Banner:          b,
2189: -		IFaces:          map[string]tplIFace{},
2190: -		MgmtMTU:         0,
2191: -		MgmtIPMTU:       n.Runtime.Mgmt().MTU,
2192: -		ComponentConfig: componentConfig,
2193: -
2194: -		// Service configs from variant (single source of truth)
2195: -		SystemConfig:  snippets.SystemConfig,
2196: -		GRPCConfig:    snippets.GRPCConfig,
2197: -		SNMPConfig:    snippets.SNMPConfig,
2198: -		NetconfConfig: snippets.NetconfConfig,
2199: -		LoggingConfig: snippets.LoggingConfig,
2200: -		SSHConfig:     snippets.SSHConfig,
2201: -	}
2202: -
2203: -	if n.Config().DNS != nil {
2204: -		tplData.DNSServers = append(tplData.DNSServers, n.Config().DNS.Servers...)
2205: -	}
2206: -
2207: -	n.prepareSSHPubKeys(tplData)
2208: -
2209: -	n.setVersionSpecificParams(tplData)
2210: -
2211: -	return tplData, nil
2212: -}
2213: -
2214: -// isIXRNode returns true if this is an IXR node type (case-insensitive).
2215: -func (n *sros) isIXRNode() bool {
2216: -	return ixrRegexp.MatchString(n.Cfg.NodeType)
2217: -}
2218: -
2219: -// isSARNode returns true if this is a SAR node type (case-insensitive).
2220: -func (n *sros) isSARNode() bool {
2221: -	return sarRegexp.MatchString(n.Cfg.NodeType)
2222: -}
2223: -
2224: -// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).
2225: -func (n *sros) isSARHmNode() bool {
2226: -	return sarHmRegexp.MatchString(n.Cfg.NodeType)
2227: -}
2228: -
2229: -// getTemplateForVariant returns the template string and name for the given config variant.
2230: -// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= "26").
2231: -func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {
2232: -	// Model-driven (or mixed treated as classic below when family is classic)
2233: -	if v.Mode == ConfigModeModelDriven {
2234: -		// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= "26"
2235: -		// { return cfgTplSROS26, "clab-sros-config-sros26" }
2236: -		return cfgTplSROS25, "clab-sros-config-sros25"
2237: -	}
2238: -	// Classic (or mixed)
2239: -	tmpl = cfgTplClassic
2240: -	tplName = "clab-sros-config-classic"
2241: -	switch v.Family {
2242: -	case ConfigFamilyIXR:
2243: -		return cfgTplClassicIxr, "clab-sros-config-classic-ixr"
2244: -	case ConfigFamilySAR:
2245: -		return cfgTplClassicSar, "clab-sros-config-classic-sar"
2246: -	default:
2247: -		return tmpl, tplName
2248: -	}
2249: -}
2250: -
2251: -// selectConfigTemplate chooses the config template from the config variant (mode + family).
2252: -func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {
2253: -	v := n.resolveConfigVariant()
2254: -	tmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)
2255: -	return template.New(tplName).
2256: -		Funcs(clabutils.CreateFuncs()).
2257: -		Parse(tmpl)
2258: -}
2259: -
2260: -// addDefaultConfig adds sros default configuration such as tls certs, gnmi/json-rpc, login-banner,
2261: -// ssh keys.
2262: -func (n *sros) addDefaultConfig() error {
2263: -	// Prepare all template data
2264: -	tplData, err := n.prepareConfigTemplateData()
2265: -	if err != nil {
2266: -		return err
2267: -	}
2268: -
2269: -	// Select appropriate template
2270: -	srosCfgTpl, err := n.selectConfigTemplate(tplData)
2271: -	if err != nil {
2272: -		return fmt.Errorf("failed to select config template: %w", err)
2273: -	}
2274: -	log.Debug("Prepare SR OS config template", "template", srosCfgTpl.Name(),
2275: -		"node", n.Cfg.LongName,
2276: -		"configuration-mode", tplData.ConfigurationMode,
2277: -		"node-type", tplData.NodeType,
2278: -		"secure-grpc", tplData.IsSecureGrpc,
2279: -		"sw-version", tplData.SwVersion)
2280: -
2281: -	// Execute template
2282: -	buf := new(bytes.Buffer)
2283: -	err = srosCfgTpl.Execute(buf, tplData)
2284: -	if err != nil {
2285: -		return err
2286: -	}
2287: -
2288: -	if buf.Len() == 0 {
2289: -		log.Warn(
2290: -			"Buffer empty, template parsing error",
2291: -			"node", n.Cfg.ShortName,
2292: -			"template", srosCfgTpl.Name(),
2293: -		)
2294: -	} else {
2295: -		log.Debug("Additional default config parsed",
2296: -			"node", n.Cfg.ShortName,
2297: -			"template", srosCfgTpl.Name())
2298: -		n.startupCliCfg = append(n.startupCliCfg, buf.String()...)
2299: -	}
2300: -
2301: -	return nil
2302: -}
2303: -
2304: -// applyPartialConfig applies partial configuration to the SR OS.
2305: -func (n *sros) addPartialConfig() error {
2306: -	if n.Cfg.StartupConfig != "" {
2307: -		// b holds the configuration to be applied to the node
2308: -		b := &bytes.Buffer{}
2309: -		// apply partial configs if partial config is used
2310: -		if clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM("") {
2311: -			log.Info("Adding configuration",
2312: -				"node", n.Cfg.LongName,
2313: -				"type", "partial",
2314: -				"source", n.Cfg.StartupConfig)
2315: -
2316: -			r, err := os.Open(n.Cfg.StartupConfig)
2317: -			if err != nil {
2318: -				return err
2319: -			}
2320: -
2321: -			defer r.Close() // skipcq: GO-S2307
2322: -
2323: -			_, err = io.Copy(b, r)
2324: -			if err != nil {
2325: -				return err
2326: -			}
2327: -
2328: -			configContent, err := clabutils.SubstituteEnvsAndTemplate(b, n.Cfg)
2329: -			if err != nil {
2330: -				return err
2331: -			}
2332: -			if configContent.Len() == 0 {
2333: -				log.Warn(
2334: -					"Buffer empty, PARTIAL config template parsing error",
2335: -					"node",
2336: -					n.Cfg.ShortName,
2337: -				)
2338: -			} else {
2339: -				log.Debug("Additional PARTIAL config parsed", "node",
2340: -					n.Cfg.ShortName, "partial-config", configContent.String())
2341: -				n.startupCliCfg = append(n.startupCliCfg, configContent.String()...)
2342: -			}
2343: -		} else {
2344: -			log.Warn(
2345: -				"Passed startup-config option, but it will not have any effect",
2346: -				"node",
2347: -				n.Cfg.ShortName,
2348: -			)
2349: -		}
2350: -	}
2351: -	return nil
2352: -}
2353: -
2354:  func (n *sros) GetContainers(ctx context.Context) ([]clabruntime.GenericContainer, error) {
2355:  	// if not a distributed setup call regular GetContainers
2356:  	if n.isStandaloneNode() || n.isDistributedCardNode() {
2357:  		return n.DefaultNode.GetContainers(ctx)
2358:  	}
2359: @@ -1761,63 +1425,10 @@ func (n *sros) saveConfigWithAddr(ctx context.Context, addr string) error {
2360:  	)
2361:  
2362:  	return nil
2363:  }
2364:  
2365: -// BuildPKIImportXML.
2366: -func buildPKIImportXML(inputURL, outputFile, importType string) string {
2367: -	action := etree.NewElement("action")
2368: -	action.CreateAttr("xmlns", "urn:ietf:params:xml:ns:yang:1")
2369: -
2370: -	admin := action.CreateElement("admin")
2371: -	admin.CreateAttr("xmlns", "urn:nokia.com:sros:ns:yang:sr:oper-admin")
2372: -
2373: -	importElem := admin.CreateElement("system").
2374: -		CreateElement("security").
2375: -		CreateElement("pki").
2376: -		CreateElement("import")
2377: -
2378: -	// Add import parameters
2379: -	importElem.CreateElement("input-url").SetText(inputURL)
2380: -	importElem.CreateElement("output-file").SetText(outputFile)
2381: -	importElem.CreateElement("type").SetText(importType)
2382: -	importElem.CreateElement("format").SetText("pem")
2383: -	var buf bytes.Buffer
2384: -	action.WriteTo(&buf, &etree.WriteSettings{
2385: -		CanonicalText:    false,
2386: -		CanonicalAttrVal: false,
2387: -	})
2388: -	return buf.String()
2389: -}
2390: -
2391: -// BuildTLSProfileXML builds the TLS profile configuration XML.
2392: -func buildTLSProfileXML() string {
2393: -	config := etree.NewElement("config")
2394: -	configure := config.CreateElement("configure")
2395: -	configure.CreateAttr("xmlns", "urn:nokia.com:sros:ns:yang:sr:conf")
2396: -	configure.CreateAttr("xmlns:nc", "urn:ietf:params:xml:ns:netconf:base:1.0")
2397: -
2398: -	certProfile := configure.CreateElement("system").
2399: -		CreateElement("security").
2400: -		CreateElement("tls").
2401: -		CreateElement("cert-profile")
2402: -
2403: -	// Set operation attribute
2404: -	certProfile.CreateAttr("nc:operation", "merge")
2405: -
2406: -	// Add profile configuration
2407: -	certProfile.CreateElement("cert-profile-name").SetText(tlsCertProfileName)
2408: -	certProfile.CreateElement("admin-state").SetText("enable")
2409: -
2410: -	var buf bytes.Buffer
2411: -	config.WriteTo(&buf, &etree.WriteSettings{
2412: -		CanonicalText:    false,
2413: -		CanonicalAttrVal: false,
2414: -	})
2415: -	return buf.String()
2416: -}
2417: -
2418:  // TLS bootstrap via NETCONF to enable secure gRPC.
2419:  func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {
2420:  	// Always import PKI key and cert:
2421:  	// 	 import "cf3:\node.key" in PEM format as "cf3:\system-pki\node.key" (encrypted DER)
2422:  	//   import "cf3:\node.crt" in PEM format as "cf3:\system-pki\node.crt" (encrypted DER)
2423: @@ -1867,23 +1478,10 @@ func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {
2424:  		}
2425:  	}
2426:  	return err
2427:  }
2428:  
2429: -// isConfigClassic reports whether the node is in classic or mixed configuration mode.
2430: -func (n *sros) isConfigClassic() bool {
2431: -	mode := n.kindSpecificCfg().ConfigMode
2432: -	return mode == ConfigModeClassic || mode == ConfigModeMixed
2433: -}
2434: -
2435: -// isFullConfigFile returns true if the config file doesn't contain .partial substring
2436: -// and the config file is NOT nil (ie. startup config IS defined).
2437: -// it is intended that the 'c' arg is n.Cfg.StartupConfig.
2438: -func isFullConfigFile(c string) bool {
2439: -	return c != "" && !clabutils.IsPartialConfigFile(c)
2440: -}
2441: -
2442:  func (n *sros) IsHealthy(_ context.Context) (bool, error) {
2443:  	if !n.isCPM("") {
2444:  		return true, fmt.Errorf("node %q is not a CPM, healthcheck has no effect", n.Cfg.LongName)
2445:  	}
2446:  	// non-partial user startup config might not have any netconf config
2447: @@ -2082,67 +1680,10 @@ func (n *sros) MgmtIPAddr() (string, error) {
2448:  		"no management IP address (IPv4 or IPv6) configured for node %q",
2449:  		n.Cfg.LongName,
2450:  	)
2451:  }
2452:  
2453: -// generateComponentConfig generates SR OS configuration for explicitly defined distributed
2454: -// components or known integrated SR-SIM defaults. Power config is appended when supported.
2455: -func (n *sros) generateComponentConfig() string {
2456: -	if !n.kindSpecificCfg().GenComponentConfig {
2457: -		return ""
2458: -	}
2459: -	if n.isConfigClassic() {
2460: -		return ""
2461: -	}
2462: -
2463: -	components := n.rootComponents
2464: -	if len(components) == 0 {
2465: -		if len(n.kindSpecificCfg().Components) > 1 || n.rootCtrName != "" {
2466: -			return ""
2467: -		}
2468: -
2469: -		lines := buildIntegratedComponentCfgLines(n.Cfg.NodeType, n.Cfg.Env)
2470: -		if len(lines) == 0 {
2471: -			return ""
2472: -		}
2473: -		return n.componentConfigFromLines(lines)
2474: -	}
2475: -
2476: -	for _, c := range components {
2477: -		slot := strings.ToUpper(strings.TrimSpace(c.Slot))
2478: -		if slot == slotAName || slot == slotBName {
2479: -			continue
2480: -		}
2481: -		if c.Type == "" {
2482: -			log.Warn(
2483: -				"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.",
2484: -				"node",
2485: -				n.Cfg.ShortName,
2486: -				"slot",
2487: -				slot,
2488: -			)
2489: -		}
2490: -	}
2491: -
2492: -	lines := buildComponentCfgLines(components, n.kindSpecificCfg().SFM)
2493: -	return n.componentConfigFromLines(lines)
2494: -}
2495: -
2496: -func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {
2497: -	powerConfig := n.generatePowerConfig()
2498: -	if len(lines) == 0 && powerConfig == "" {
2499: -		return ""
2500: -	}

(Showing lines 1201-2500 of 3945. Use offset=2501 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502ecff6001cuYKlu8uHi5r9X",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502ec44d001escZDwyW8y5PXF",
  "callID": "call_92b8f6c389a142b0b24b561c",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/diff.txt",
      "offset": 1201,
      "limit": 1300
    },
    "output": "<path>/source/diff.txt</path>\n<type>file</type>\n<content>\n1201: +\t// Set operation attribute\n1202: +\tcertProfile.CreateAttr(\"nc:operation\", \"merge\")\n1203: +\n1204: +\t// Add profile configuration\n1205: +\tcertProfile.CreateElement(\"cert-profile-name\").SetText(tlsCertProfileName)\n1206: +\tcertProfile.CreateElement(\"admin-state\").SetText(\"enable\")\n1207: +\n1208: +\tvar buf bytes.Buffer\n1209: +\tconfig.WriteTo(&buf, &etree.WriteSettings{\n1210: +\t\tCanonicalText:    false,\n1211: +\t\tCanonicalAttrVal: false,\n1212: +\t})\n1213: +\treturn buf.String()\n1214: +}\n1215: +\n1216: +// createSROSConfigFiles handles config generation for the SR-SIM kind.\n1217: +// Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).\n1218: +func (n *sros) createSROSConfigFiles() error {\n1219: +\t// Get version from image before generating config\n1220: +\tif n.swVersion == nil {\n1221: +\t\tctx := context.Background()\n1222: +\t\tversion, err := n.srosVersionFromImage(ctx)\n1223: +\t\tif err != nil {\n1224: +\t\t\tn.swVersion = n.parseVersionString(srosDefaultVersion)\n1225: +\t\t\tlog.Warn(\"Failed to get SR OS version from image\",\n1226: +\t\t\t\t\"node\", n.Cfg.ShortName, \"version\", n.swVersion, \"error\", err)\n1227: +\t\t} else {\n1228: +\t\t\tn.swVersion = version\n1229: +\t\t\tlog.Info(\"Retrieved SR OS version from image\",\n1230: +\t\t\t\t\"node\", n.Cfg.ShortName,\n1231: +\t\t\t\t\"version\", fmt.Sprintf(\"%s.%s.%s\", version.Major, version.Minor, version.Build))\n1232: +\t\t}\n1233: +\t}\n1234: +\n1235: +\t// Path pointing to the target config file under configCf3 dir\n1236: +\tcf3CfgFile := filepath.Join(\n1237: +\t\tn.Cfg.LabDir,\n1238: +\t\tn.Cfg.Env[envNokiaSrosSlot],\n1239: +\t\tconfigCf3,\n1240: +\t\tstartupCfgName,\n1241: +\t)\n1242: +\tisPartial := clabutils.IsPartialConfigFile(n.Cfg.StartupConfig)\n1243: +\n1244: +\t// generate config and use that to boot node\n1245: +\tlog.Debug(\"Reading startup-config\", \"node\", n.Cfg.ShortName, \"startup-config\",\n1246: +\t\tn.Cfg.StartupConfig, \"isPartial\", isPartial)\n1247: +\n1248: +\tstartupConfig, err := n.buildStartupConfig(isPartial)\n1249: +\tif err != nil {\n1250: +\t\treturn err\n1251: +\t}\n1252: +\n1253: +\tif startupConfig == \"\" {\n1254: +\t\tlog.Debug(\n1255: +\t\t\t\"startup config is empty, skipping startup config file generation\",\n1256: +\t\t\t\"node\",\n1257: +\t\t\tn.Cfg.ShortName,\n1258: +\t\t)\n1259: +\t\treturn nil\n1260: +\t}\n1261: +\n1262: +\treturn n.GenerateConfig(cf3CfgFile, startupConfig)\n1263: +}\n1264: +\n1265: +// buildStartupConfig returns the full startup config string: either from user file (full config)\n1266: +// or from default + partial config generation. It does not return a template; the name is\n1267: +// historical.\n1268: +func (n *sros) buildStartupConfig(isPartial bool) (string, error) {\n1269: +\t// User provides full startup config\n1270: +\tif n.Cfg.StartupConfig != \"\" && !isPartial {\n1271: +\t\tc, err := os.ReadFile(n.Cfg.StartupConfig)\n1272: +\t\tif err != nil {\n1273: +\t\t\treturn \"\", err\n1274: +\t\t}\n1275: +\n1276: +\t\tcBuf, err := clabutils.SubstituteEnvsAndTemplate(bytes.NewReader(c), n.Cfg)\n1277: +\t\tif err != nil {\n1278: +\t\t\treturn \"\", err\n1279: +\t\t}\n1280: +\t\treturn cBuf.String(), nil\n1281: +\t}\n1282: +\n1283: +\t// Generate default config and optionally add partial config\n1284: +\tif err := n.addDefaultConfig(); err != nil {\n1285: +\t\treturn \"\", err\n1286: +\t}\n1287: +\tif err := n.addPartialConfig(); err != nil {\n1288: +\t\treturn \"\", err\n1289: +\t}\n1290: +\n1291: +\treturn string(n.startupCliCfg), nil\n1292: +}\n1293: +\n1294: +// prepareConfigTemplateData prepares all data needed for template selection and execution.\n1295: +// Service configs are filled from a single table-driven result: variant → getFullSnippetSet(v).\n1296: +func (n *sros) prepareConfigTemplateData() (*srosTemplateData, error) {\n1297: +\tb, err := n.banner()\n1298: +\tif err != nil {\n1299: +\t\treturn nil, err\n1300: +\t}\n1301: +\n1302: +\tcomponentConfig := \"\"\n1303: +\tif !isFullConfigFile(n.Cfg.StartupConfig) {\n1304: +\t\tcomponentConfig = n.generateComponentConfig()\n1305: +\t} else {\n1306: +\t\tlog.Debugf(\n1307: +\t\t\t\"SR-SIM node %q has non-partial startup-config defined, skipping component config gen\",\n1308: +\t\t\tn.Cfg.LongName,\n1309: +\t\t)\n1310: +\t}\n1311: +\n1312: +\tv := n.resolveConfigVariant()\n1313: +\tsnippets := getFullSnippetSet(v)\n1314: +\tconfigMode := string(v.Mode)\n1315: +\tif v.ForceClassic {\n1316: +\t\tlog.Warn(\n1317: +\t\t\t\"SAR-Hm nodes only support classic configuration mode. Overriding configuration mode to 'classic'\",\n1318: +\t\t\t\"node\",\n1319: +\t\t\tn.Cfg.LongName,\n1320: +\t\t\t\"node-type\",\n1321: +\t\t\tstrings.ToLower(n.Cfg.NodeType),\n1322: +\t\t)\n1323: +\t\tconfigMode = string(ConfigModeClassic)\n1324: +\t\tn.kindSpecificCfg().ConfigMode = ConfigModeClassic\n1325: +\t}\n1326: +\n1327: +\ttplData := &srosTemplateData{\n1328: +\t\t// Selection criteria\n1329: +\t\tNodeType:          strings.ToLower(n.Cfg.NodeType),\n1330: +\t\tConfigurationMode: configMode,\n1331: +\t\tSwVersion:         n.swVersion,\n1332: +\t\tIsSecureGrpc:      *n.Cfg.Certificate.Issue,\n1333: +\n1334: +\t\t// Node data\n1335: +\t\tName:            n.Cfg.ShortName,\n1336: +\t\tTLSKey:          n.Cfg.TLSKey,\n1337: +\t\tTLSCert:         n.Cfg.TLSCert,\n1338: +\t\tTLSAnchor:       n.Cfg.TLSAnchor,\n1339: +\t\tBanner:          b,\n1340: +\t\tIFaces:          map[string]tplIFace{},\n1341: +\t\tMgmtMTU:         0,\n1342: +\t\tMgmtIPMTU:       n.Runtime.Mgmt().MTU,\n1343: +\t\tComponentConfig: componentConfig,\n1344: +\n1345: +\t\t// Service configs from variant (single source of truth)\n1346: +\t\tSystemConfig:  snippets.SystemConfig,\n1347: +\t\tGRPCConfig:    snippets.GRPCConfig,\n1348: +\t\tSNMPConfig:    snippets.SNMPConfig,\n1349: +\t\tNetconfConfig: snippets.NetconfConfig,\n1350: +\t\tLoggingConfig: snippets.LoggingConfig,\n1351: +\t\tSSHConfig:     snippets.SSHConfig,\n1352: +\t}\n1353: +\n1354: +\tif n.Config().DNS != nil {\n1355: +\t\ttplData.DNSServers = append(tplData.DNSServers, n.Config().DNS.Servers...)\n1356: +\t}\n1357: +\n1358: +\tn.prepareSSHPubKeys(tplData)\n1359: +\n1360: +\tn.setVersionSpecificParams(tplData)\n1361: +\n1362: +\treturn tplData, nil\n1363: +}\n1364: +\n1365: +// addDefaultConfig adds sros default configuration such as tls certs, gnmi/json-rpc, login-banner,\n1366: +// ssh keys.\n1367: +func (n *sros) addDefaultConfig() error {\n1368: +\t// Prepare all template data\n1369: +\ttplData, err := n.prepareConfigTemplateData()\n1370: +\tif err != nil {\n1371: +\t\treturn err\n1372: +\t}\n1373: +\n1374: +\t// Select appropriate template\n1375: +\tsrosCfgTpl, err := n.selectConfigTemplate(tplData)\n1376: +\tif err != nil {\n1377: +\t\treturn fmt.Errorf(\"failed to select config template: %w\", err)\n1378: +\t}\n1379: +\tlog.Debug(\"Prepare SR OS config template\", \"template\", srosCfgTpl.Name(),\n1380: +\t\t\"node\", n.Cfg.LongName,\n1381: +\t\t\"configuration-mode\", tplData.ConfigurationMode,\n1382: +\t\t\"node-type\", tplData.NodeType,\n1383: +\t\t\"secure-grpc\", tplData.IsSecureGrpc,\n1384: +\t\t\"sw-version\", tplData.SwVersion)\n1385: +\n1386: +\t// Execute template\n1387: +\tbuf := new(bytes.Buffer)\n1388: +\terr = srosCfgTpl.Execute(buf, tplData)\n1389: +\tif err != nil {\n1390: +\t\treturn err\n1391: +\t}\n1392: +\n1393: +\tif buf.Len() == 0 {\n1394: +\t\tlog.Warn(\n1395: +\t\t\t\"Buffer empty, template parsing error\",\n1396: +\t\t\t\"node\", n.Cfg.ShortName,\n1397: +\t\t\t\"template\", srosCfgTpl.Name(),\n1398: +\t\t)\n1399: +\t} else {\n1400: +\t\tlog.Debug(\"Additional default config parsed\",\n1401: +\t\t\t\"node\", n.Cfg.ShortName,\n1402: +\t\t\t\"template\", srosCfgTpl.Name())\n1403: +\t\tn.startupCliCfg = append(n.startupCliCfg, buf.String()...)\n1404: +\t}\n1405: +\n1406: +\treturn nil\n1407: +}\n1408: +\n1409: +// applyPartialConfig applies partial configuration to the SR OS.\n1410: +func (n *sros) addPartialConfig() error {\n1411: +\tif n.Cfg.StartupConfig != \"\" {\n1412: +\t\t// b holds the configuration to be applied to the node\n1413: +\t\tb := &bytes.Buffer{}\n1414: +\t\t// apply partial configs if partial config is used\n1415: +\t\tif clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM(\"\") {\n1416: +\t\t\tlog.Info(\"Adding configuration\",\n1417: +\t\t\t\t\"node\", n.Cfg.LongName,\n1418: +\t\t\t\t\"type\", \"partial\",\n1419: +\t\t\t\t\"source\", n.Cfg.StartupConfig)\n1420: +\n1421: +\t\t\tr, err := os.Open(n.Cfg.StartupConfig)\n1422: +\t\t\tif err != nil {\n1423: +\t\t\t\treturn err\n1424: +\t\t\t}\n1425: +\n1426: +\t\t\tdefer r.Close() // skipcq: GO-S2307\n1427: +\n1428: +\t\t\t_, err = io.Copy(b, r)\n1429: +\t\t\tif err != nil {\n1430: +\t\t\t\treturn err\n1431: +\t\t\t}\n1432: +\n1433: +\t\t\tconfigContent, err := clabutils.SubstituteEnvsAndTemplate(b, n.Cfg)\n1434: +\t\t\tif err != nil {\n1435: +\t\t\t\treturn err\n1436: +\t\t\t}\n1437: +\t\t\tif configContent.Len() == 0 {\n1438: +\t\t\t\tlog.Warn(\n1439: +\t\t\t\t\t\"Buffer empty, PARTIAL config template parsing error\",\n1440: +\t\t\t\t\t\"node\",\n1441: +\t\t\t\t\tn.Cfg.ShortName,\n1442: +\t\t\t\t)\n1443: +\t\t\t} else {\n1444: +\t\t\t\tlog.Debug(\"Additional PARTIAL config parsed\", \"node\",\n1445: +\t\t\t\t\tn.Cfg.ShortName, \"partial-config\", configContent.String())\n1446: +\t\t\t\tn.startupCliCfg = append(n.startupCliCfg, configContent.String()...)\n1447: +\t\t\t}\n1448: +\t\t} else {\n1449: +\t\t\tlog.Warn(\n1450: +\t\t\t\t\"Passed startup-config option, but it will not have any effect\",\n1451: +\t\t\t\t\"node\",\n1452: +\t\t\t\tn.Cfg.ShortName,\n1453: +\t\t\t)\n1454: +\t\t}\n1455: +\t}\n1456: +\treturn nil\n1457: +}\n1458: +\n1459: +// isConfigClassic reports whether the node is in classic or mixed configuration mode.\n1460: +func (n *sros) isConfigClassic() bool {\n1461: +\tmode := n.kindSpecificCfg().ConfigMode\n1462: +\treturn mode == ConfigModeClassic || mode == ConfigModeMixed\n1463: +}\n1464: +\n1465: +// isFullConfigFile returns true if the config file doesn't contain .partial substring\n1466: +// and the config file is NOT nil (ie. startup config IS defined).\n1467: +// it is intended that the 'c' arg is n.Cfg.StartupConfig.\n1468: +func isFullConfigFile(c string) bool {\n1469: +\treturn c != \"\" && !clabutils.IsPartialConfigFile(c)\n1470: +}\n1471: diff --git a/nodes/sros/netns.go b/nodes/sros/netns.go\n1472: index dbd9af7..e7ec511 100644\n1473: --- a/nodes/sros/netns.go\n1474: +++ b/nodes/sros/netns.go\n1475: @@ -1,14 +1,20 @@\n1476:  package sros\n1477:  \n1478:  import (\n1479: +\t\"context\"\n1480: +\t\"errors\"\n1481:  \t\"fmt\"\n1482:  \t\"maps\"\n1483:  \n1484: +\tclabutils \"github.com/srl-labs/containerlab/utils\"\n1485: +\n1486:  \tclabconstants \"github.com/srl-labs/containerlab/constants\"\n1487:  \tclabnodes \"github.com/srl-labs/containerlab/nodes\"\n1488: +\tclabruntime \"github.com/srl-labs/containerlab/runtime\"\n1489:  \tclabtypes \"github.com/srl-labs/containerlab/types\"\n1490: +\t\"github.com/vishvananda/netns\"\n1491:  )\n1492:  \n1493:  // namespaceNode owns the shared network namespace of a components-based SR-SIM node.\n1494:  type namespaceNode struct {\n1495:  \tclabnodes.DefaultNode\n1496: @@ -81,5 +87,71 @@ func (n *sros) newNetnsConfig() *clabtypes.NodeConfig {\n1497:  \t\tLabels:                labels,\n1498:  \t\tRuntime:               n.Cfg.Runtime,\n1499:  \t\tResultingPortBindings: n.Cfg.ResultingPortBindings,\n1500:  \t}\n1501:  }\n1502: +\n1503: +func (n *sros) ensureNetnsRunning(ctx context.Context) error {\n1504: +\tswitch status := n.netnsNode.GetContainerStatus(ctx); status {\n1505: +\tcase clabruntime.Running:\n1506: +\t\t// The namespace holder intentionally survives regular node lifecycle operations.\n1507: +\tcase clabruntime.Created, clabruntime.Stopped:\n1508: +\t\tif err := n.netnsNode.Start(ctx); err != nil {\n1509: +\t\t\treturn fmt.Errorf(\"node %q network namespace container start error: %w\",\n1510: +\t\t\t\tn.Cfg.ShortName, err)\n1511: +\t\t}\n1512: +\tcase clabruntime.Paused:\n1513: +\t\tif err := n.Runtime.UnpauseContainer(ctx, n.netnsNode.Config().LongName); err != nil {\n1514: +\t\t\treturn fmt.Errorf(\"node %q network namespace container unpause error: %w\",\n1515: +\t\t\t\tn.Cfg.ShortName, err)\n1516: +\t\t}\n1517: +\tcase clabruntime.NotFound:\n1518: +\t\treturn fmt.Errorf(\n1519: +\t\t\t\"node %q network namespace container %q not found; recreate the node\",\n1520: +\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName,\n1521: +\t\t)\n1522: +\tdefault:\n1523: +\t\treturn fmt.Errorf(\"node %q network namespace container %q is %s\",\n1524: +\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName, status)\n1525: +\t}\n1526: +\n1527: +\treturn nil\n1528: +}\n1529: +\n1530: +func (n *sros) cleanupParkingNetNS() error {\n1531: +\tname := clabutils.ParkingNetnsName(n.Cfg.LongName)\n1532: +\tif _, err := clabutils.GetNamedNetNS(name); err != nil {\n1533: +\t\treturn nil\n1534: +\t}\n1535: +\n1536: +\treturn netns.DeleteNamed(name)\n1537: +}\n1538: +\n1539: +// GetNSPath retrieves the Namespace Path.\n1540: +func (n *sros) GetNSPath(ctx context.Context) (string, error) {\n1541: +\tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == \"\") {\n1542: +\t\treturn n.DefaultNode.GetNSPath(ctx)\n1543: +\t} else if n.isDistributedCardNode() {\n1544: +\t\treturn n.Runtime.GetNSPath(ctx, n.rootCtrName)\n1545: +\t}\n1546: +\treturn n.netnsNode.GetNSPath(ctx)\n1547: +}\n1548: +\n1549: +// DeleteNetnsSymlink deletes the symlink file created for the container netns.\n1550: +func (n *sros) DeleteNetnsSymlink() error {\n1551: +\tvar errs []error\n1552: +\n1553: +\t// if it is the base node, then we need to delete the symlink for all the components.\n1554: +\tif n.isDistributedBaseNode() {\n1555: +\t\tfor _, componentNode := range n.componentNodes {\n1556: +\t\t\terrs = append(errs, componentNode.DeleteNetnsSymlink())\n1557: +\t\t}\n1558: +\t\tif n.netnsNode != nil {\n1559: +\t\t\terrs = append(errs, n.netnsNode.DeleteNetnsSymlink())\n1560: +\t\t}\n1561: +\t\terrs = append(errs, clabutils.DeleteNetnsSymlink(n.Cfg.LongName))\n1562: +\t}\n1563: +\n1564: +\terrs = append(errs, n.DefaultNode.DeleteNetnsSymlink(), n.cleanupParkingNetNS())\n1565: +\n1566: +\treturn errors.Join(errs...)\n1567: +}\n1568: diff --git a/nodes/sros/power.go b/nodes/sros/power.go\n1569: index 7ab11bd..07509f3 100644\n1570: --- a/nodes/sros/power.go\n1571: +++ b/nodes/sros/power.go\n1572: @@ -3,10 +3,15 @@ package sros\n1573:  import (\n1574:  \t\"fmt\"\n1575:  \t\"strings\"\n1576:  )\n1577:  \n1578: +const (\n1579: +\tdefaultSrosPowerType       = \"dc\"\n1580: +\tdefaultSrosPowerModuleType = \"ps-a-dc-6000\"\n1581: +)\n1582: +\n1583:  // SrosPower defines power supply configuration for a given node type.\n1584:  type SrosPower struct {\n1585:  \tModules any\n1586:  \tShelves int\n1587:  }\n1588: diff --git a/nodes/sros/sros.go b/nodes/sros/sros.go\n1589: index 1eac470..20ae973 100644\n1590: --- a/nodes/sros/sros.go\n1591: +++ b/nodes/sros/sros.go\n1592: @@ -6,11 +6,10 @@ package sros\n1593:  \n1594:  import (\n1595:  \t\"bufio\"\n1596:  \t\"bytes\"\n1597:  \t\"context\"\n1598: -\t_ \"embed\"\n1599:  \t\"errors\"\n1600:  \t\"fmt\"\n1601:  \t\"io\"\n1602:  \t\"maps\"\n1603:  \t\"net\"\n1604: @@ -20,19 +19,16 @@ import (\n1605:  \t\"reflect\"\n1606:  \t\"regexp\"\n1607:  \t\"slices\"\n1608:  \t\"strconv\"\n1609:  \t\"strings\"\n1610: -\t\"text/template\"\n1611:  \t\"time\"\n1612:  \n1613: -\t\"github.com/beevik/etree\"\n1614:  \t\"github.com/brunoga/deep\"\n1615:  \t\"github.com/charmbracelet/log\"\n1616:  \t\"github.com/scrapli/scrapligo/driver/netconf\"\n1617:  \t\"github.com/scrapli/scrapligo/driver/opoptions\"\n1618: -\t\"github.com/vishvananda/netns\"\n1619:  \n1620:  \t\"github.com/scrapli/scrapligo/response\"\n1621:  \n1622:  \tclabconstants \"github.com/srl-labs/containerlab/constants\"\n1623:  \tclabexec \"github.com/srl-labs/containerlab/exec\"\n1624: @@ -82,32 +78,16 @@ const (\n1625:  \tenvNokiaSrosMDA           = \"NOKIA_SROS_MDA\"\n1626:  \tenvSrosIPv4Active         = \"NOKIA_SROS_ADDRESS_IPV4_ACTIVE\"\n1627:  \tenvSrosIPv6Active         = \"NOKIA_SROS_ADDRESS_IPV6_ACTIVE\"\n1628:  \tenvSrosStaticRoutePrefix  = \"NOKIA_SROS_STATIC_ROUTE_\"\n1629:  \n1630: -\tdefaultSrosPowerType       = \"dc\"\n1631: -\tdefaultSrosPowerModuleType = \"ps-a-dc-6000\"\n1632: -\n1633:  \tsrosMinorError     = \"MINOR:\"\n1634:  \tsrosCriticalError  = \"CRITICAL:\"\n1635:  \tsrosRejectedCfgMsg = \"Configuration load failed - using default configuration\"\n1636:  )\n1637:  \n1638:  var (\n1639: -\n1640: -\t//go:embed configs/sros_config_sros25.go.tpl\n1641: -\tcfgTplSROS25 string\n1642: -\n1643: -\t//go:embed configs/sros_config_classic.go.tpl\n1644: -\tcfgTplClassic string\n1645: -\n1646: -\t//go:embed configs/ixr/ixr_config_classic.go.tpl\n1647: -\tcfgTplClassicIxr string\n1648: -\n1649: -\t//go:embed configs/sar/sar_config_classic.go.tpl\n1650: -\tcfgTplClassicSar string\n1651: -\n1652:  \tkindNames  = []string{\"nokia_srsim\"}\n1653:  \tsrosSysctl = map[string]string{\n1654:  \t\t\"net.ipv4.ip_forward\":                \"0\",\n1655:  \t\t\"net.ipv6.conf.all.disable_ipv6\":     \"0\",\n1656:  \t\t\"net.ipv6.conf.default.disable_ipv6\": \"0\",\n1657: @@ -160,15 +140,10 @@ var (\n1658:        e1-2-3       -> card 1, mda 2, port 3\n1659:        e1-2-c3-4    -> card 1, mda 2, connector 3, port 4\n1660:        e1-x2-3-4    -> card 1, xiom 2, mda 3, port 4\n1661:        e1-x2-3-c4-5 -> card 1, xiom 2, mda 3, connector 4, port 5\n1662:  \t  eth[0-9], for management interfaces of CPM-A/CPM-B or for fabric interfaces`\n1663: -\t// Auxiliary regexps for IXR/SAR detection.\n1664: -\tsarRegexp   = regexp.MustCompile(`(?i)\\bsar-`)\n1665: -\tsarHmRegexp = regexp.MustCompile(`(?i)\\b(sar-hm|sar-hmc)\\b`)\n1666: -\n1667: -\tixrRegexp = regexp.MustCompile(`(?i)\\bixr-`)\n1668:  )\n1669:  \n1670:  // Register registers the node in the NodeRegistry.\n1671:  func Register(r *clabnodes.NodeRegistry) {\n1672:  \tgenerateNodeAttributes := clabnodes.NewGenerateNodeAttributes(generateable, generateIfFormat)\n1673: @@ -241,10 +216,14 @@ type sros struct {\n1674:  \t// rootCtrName is the container that owns the netns.\n1675:  \t//  - for components based: the internal netns container.\n1676:  \t//  - for network mode based: parsed from network-mode.\n1677:  \trootCtrName string\n1678:  \n1679: +\t// userEnv is the env map from the topology, before component fields are merged in.\n1680: +\t// Node env overrides component type, XIOM, MDA, SFM, and per-component env.\n1681: +\tuserEnv map[string]string\n1682: +\n1683:  \tpreDeployParams *clabnodes.PreDeployParams\n1684:  \n1685:  \tnetnsNode clabnodes.Node\n1686:  }\n1687:  \n1688: @@ -279,16 +258,44 @@ func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) err\n1689:  \t// if user was not initialized to a value, use root\n1690:  \tif n.Cfg.User == \"\" {\n1691:  \t\tn.Cfg.User = \"0:0\"\n1692:  \t}\n1693:  \n1694: -\tif sfm := n.kindSpecificCfg().SFM; sfm != \"\" {\n1695: +\t// Snapshot topology env before component and SFM flags are applied.\n1696: +\t// Component nodes set userEnv from the base node before Init.\n1697: +\tenvAlreadyResolved := n.userEnv != nil\n1698: +\tif !envAlreadyResolved {\n1699:  \t\tif n.Cfg.Env == nil {\n1700: -\t\t\tn.Cfg.Env = map[string]string{}\n1701: +\t\t\tn.userEnv = map[string]string{}\n1702: +\t\t} else {\n1703: +\t\t\tn.userEnv = maps.Clone(n.Cfg.Env)\n1704:  \t\t}\n1705: +\t}\n1706: +\tif n.Cfg.Env == nil {\n1707: +\t\tn.Cfg.Env = map[string]string{}\n1708: +\t}\n1709:  \n1710: -\t\tn.Cfg.Env[envNokiaSrosSFM] = sfm\n1711: +\t// Distributed cards inherit SFM from the base node env. Applying it again\n1712: +\t// would warn once per card when the user also set NOKIA_SROS_SFM.\n1713: +\tif sfm := n.kindSpecificCfg().SFM; sfm != \"\" && !envAlreadyResolved {\n1714: +\t\tif envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {\n1715: +\t\t\tif envSFM != sfm {\n1716: +\t\t\t\tlog.Warn(\n1717: +\t\t\t\t\tfmt.Sprintf(\n1718: +\t\t\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n1719: +\t\t\t\t\t\tsfm,\n1720: +\t\t\t\t\t\tenvNokiaSrosSFM,\n1721: +\t\t\t\t\t),\n1722: +\t\t\t\t\t\"node\", n.Cfg.ShortName,\n1723: +\t\t\t\t\t\"env\", envNokiaSrosSFM,\n1724: +\t\t\t\t\t\"component-value\", sfm,\n1725: +\t\t\t\t\t\"env-value\", envSFM,\n1726: +\t\t\t\t)\n1727: +\t\t\t}\n1728: +\t\t} else {\n1729: +\t\t\tn.Cfg.Env[envNokiaSrosSFM] = sfm\n1730: +\t\t}\n1731:  \t}\n1732:  \n1733:  \tmaps.Copy(n.Cfg.Sysctls, srosSysctl)\n1734:  \n1735:  \t// make sure we always have uppercase slot definition\n1736: @@ -316,10 +323,11 @@ func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) err\n1737:  \n1738:  \t\tvars, err := n.setupStandaloneComponents()\n1739:  \t\tif err != nil {\n1740:  \t\t\treturn err\n1741:  \t\t}\n1742: +\t\twarnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)\n1743:  \n1744:  \t\t// n.Cfg.Env overrides component vars, overrides default srosEnv\n1745:  \t\tn.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)\n1746:  \t\tlog.Debug(\"Merged env file\", \"env\", fmt.Sprintf(\"%+v\", n.Cfg.Env), \"node\", n.Cfg.ShortName)\n1747:  \t} else {\n1748: @@ -348,12 +356,15 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {\n1749:  \tif len(n.kindSpecificCfg().Components) == 0 {\n1750:  \t\treturn nil, nil\n1751:  \t}\n1752:  \tif len(n.kindSpecificCfg().Components) > 1 {\n1753:  \t\treturn nil, fmt.Errorf(\n1754: -\t\t\t\"expected at most one component override for standalone SR-SIM node %q\",\n1755: +\t\t\t\"expected at most one component override for standalone SR-SIM node %q, \"+\n1756: +\t\t\t\t\"or one component per slot %s for redundant type %q\",\n1757:  \t\t\tn.Cfg.ShortName,\n1758: +\t\t\tstrings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), \"/\"),\n1759: +\t\t\tn.Cfg.NodeType,\n1760:  \t\t)\n1761:  \t}\n1762:  \n1763:  \tslotA := n.kindSpecificCfg().Components[0]\n1764:  \n1765: @@ -370,27 +381,11 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {\n1766:  \t\t\tn.Cfg.ShortName,\n1767:  \t\t)\n1768:  \t}\n1769:  \tvars[envNokiaSrosSlot] = slotName\n1770:  \n1771: -\tif slotA.Type != \"\" {\n1772: -\t\tif isSingleSlotIntegratedSrosNodeType(n.Cfg.NodeType) {\n1773: -\t\t\treturn nil, fmt.Errorf(\n1774: -\t\t\t\t\"node %q type %q is integrated and does not support component card-type override\",\n1775: -\t\t\t\tn.Cfg.ShortName,\n1776: -\t\t\t\tn.Cfg.NodeType,\n1777: -\t\t\t)\n1778: -\t\t}\n1779: -\t\tvars[envNokiaSrosCard] = slotA.Type\n1780: -\t}\n1781: -\n1782: -\tif len(slotA.MDA) > 0 {\n1783: -\t\tfor _, m := range slotA.MDA {\n1784: -\t\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n1785: -\t\t\tvars[key] = m.Type\n1786: -\t\t}\n1787: -\t}\n1788: +\tsetComponentEnvVars(vars, slotA)\n1789:  \n1790:  \tmaps.Copy(vars, slotA.Env)\n1791:  \n1792:  \treturn vars, nil\n1793:  }\n1794: @@ -625,39 +620,10 @@ func (n *sros) Delete(ctx context.Context) error {\n1795:  \terrs = append(errs, n.DefaultNode.Delete(ctx), n.netnsNode.Delete(ctx))\n1796:  \n1797:  \treturn errors.Join(errs...)\n1798:  }\n1799:  \n1800: -// DeleteNetnsSymlink deletes the symlink file created for the container netns.\n1801: -func (n *sros) DeleteNetnsSymlink() error {\n1802: -\tvar errs []error\n1803: -\n1804: -\t// if it is the base node, then we need to delete the symlink for all the components.\n1805: -\tif n.isDistributedBaseNode() {\n1806: -\t\tfor _, componentNode := range n.componentNodes {\n1807: -\t\t\terrs = append(errs, componentNode.DeleteNetnsSymlink())\n1808: -\t\t}\n1809: -\t\tif n.netnsNode != nil {\n1810: -\t\t\terrs = append(errs, n.netnsNode.DeleteNetnsSymlink())\n1811: -\t\t}\n1812: -\t\terrs = append(errs, clabutils.DeleteNetnsSymlink(n.Cfg.LongName))\n1813: -\t}\n1814: -\n1815: -\terrs = append(errs, n.DefaultNode.DeleteNetnsSymlink(), n.cleanupParkingNetNS())\n1816: -\n1817: -\treturn errors.Join(errs...)\n1818: -}\n1819: -\n1820: -func (n *sros) cleanupParkingNetNS() error {\n1821: -\tname := clabutils.ParkingNetnsName(n.Cfg.LongName)\n1822: -\tif _, err := clabutils.GetNamedNetNS(name); err != nil {\n1823: -\t\treturn nil\n1824: -\t}\n1825: -\n1826: -\treturn netns.DeleteNamed(name)\n1827: -}\n1828: -\n1829:  func (n *sros) setupComponentNodes() error {\n1830:  \tif !n.isDistributedBaseNode() {\n1831:  \t\treturn nil\n1832:  \t}\n1833:  \n1834: @@ -693,17 +659,16 @@ func (n *sros) setupComponentNodes() error {\n1835:  \t\tcomponentConfig.Fqdn = n.calcComponentFqdn(c.Slot)\n1836:  \t\tcomponentConfig.DNS = nil\n1837:  \t\tcomponentConfig.PortBindings = nil\n1838:  \t\tcomponentConfig.PortSet = nil\n1839:  \n1840: -\t\t// add the component env to the componentConfig env\n1841: -\t\tfor k, v := range c.Env {\n1842: -\t\t\tcomponentConfig.Env[k] = v\n1843: +\t\t// Component fields fill env keys the user did not set. Node env wins.\n1844: +\t\tif componentConfig.Env == nil {\n1845: +\t\t\tcomponentConfig.Env = map[string]string{}\n1846:  \t\t}\n1847: -\n1848: -\t\t// set component environment variables\n1849: -\t\tn.setComponentEnvVars(componentConfig, c)\n1850: +\t\tkeepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)\n1851: +\t\t// Slot identifies this container. A node-level NOKIA_SROS_SLOT cannot apply to every card.\n1852:  \t\tcomponentConfig.Env[envNokiaSrosSlot] = c.Slot\n1853:  \n1854:  \t\t// adjust label based env vars\n1855:  \t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.NodeName)] = componentConfig.ShortName\n1856:  \t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.LongName)] = componentConfig.LongName\n1857: @@ -716,10 +681,14 @@ func (n *sros) setupComponentNodes() error {\n1858:  \t\tcomponentConfig.Labels[clabconstants.NodeName] = componentConfig.ShortName\n1859:  \t\tcomponentConfig.Labels[clabconstants.LongName] = componentConfig.LongName\n1860:  \t\tcomponentConfig.Labels[clabconstants.RootNodeName] = n.Cfg.ShortName\n1861:  \t\tcomponentConfig.Labels[clabconstants.RootNodeLongName] = n.Cfg.LongName\n1862:  \n1863: +\t\t// Preserve the topology env. Init must not snapshot the merged component env,\n1864: +\t\t// or config generation would treat component flags as user overrides.\n1865: +\t\tsrosNode.userEnv = maps.Clone(n.userEnv)\n1866: +\n1867:  \t\t// init the component\n1868:  \t\terr = componentNode.Init(componentConfig)\n1869:  \t\tif err != nil {\n1870:  \t\t\treturn err\n1871:  \t\t}\n1872: @@ -737,32 +706,10 @@ func (n *sros) setupComponentNodes() error {\n1873:  \t\tn.componentNodes = append(n.componentNodes, componentNode)\n1874:  \t}\n1875:  \treturn nil\n1876:  }\n1877:  \n1878: -// setComponentEnvVars sets environment variables for a component.\n1879: -func (n *sros) setComponentEnvVars(componentConfig *clabtypes.NodeConfig, c *Component) {\n1880: -\tif c.Type != \"\" {\n1881: -\t\tcomponentConfig.Env[envNokiaSrosCard] = c.Type\n1882: -\t}\n1883: -\n1884: -\tfor _, x := range c.XIOM {\n1885: -\t\tkey := fmt.Sprintf(\"%s_X%d\", envNokiaSrosXIOM, x.Slot)\n1886: -\t\tcomponentConfig.Env[key] = x.Type\n1887: -\t\t// add the nested MDA\n1888: -\t\tfor _, m := range x.MDA {\n1889: -\t\t\tkey := fmt.Sprintf(\"%s_X%d_%d\", envNokiaSrosMDA, x.Slot, m.Slot)\n1890: -\t\t\tcomponentConfig.Env[key] = m.Type\n1891: -\t\t}\n1892: -\t}\n1893: -\n1894: -\tfor _, m := range c.MDA {\n1895: -\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n1896: -\t\tcomponentConfig.Env[key] = m.Type\n1897: -\t}\n1898: -}\n1899: -\n1900:  // deployFabric deploys the distributed SR-SIM when the `components` key is present.\n1901:  func (n *sros) deployFabric(ctx context.Context, deployParams *clabnodes.DeployParams) error {\n1902:  \tnetnsConfig := n.netnsNode.Config()\n1903:  \n1904:  \tnetnsConfig.MgmtIPv4Address = n.Cfg.MgmtIPv4Address\n1905: @@ -870,30 +817,20 @@ func (n *sros) isDistributedCardNode() bool {\n1906:  \n1907:  // isDistributedBaseNode returns true if this is the base node of a distributed\n1908:  // SR-SIM deployment. The base node orchestrates multiple component nodes.\n1909:  func (n *sros) isDistributedBaseNode() bool {\n1910:  \tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n1911: -\t\treturn false\n1912: +\t\treturn isRedundantIntegratedSrosComponents(n.Cfg.NodeType, n.kindSpecificCfg().Components)\n1913:  \t}\n1914:  \treturn len(n.kindSpecificCfg().Components) > 1\n1915:  }\n1916:  \n1917:  // isStandaloneNode returns true if this is a standalone (non-distributed) SR-SIM node.\n1918:  func (n *sros) isStandaloneNode() bool {\n1919:  \treturn !n.isDistributedBaseNode() && !n.isDistributedCardNode()\n1920:  }\n1921:  \n1922: -// GetNSPath retrieves the Namespace Path.\n1923: -func (n *sros) GetNSPath(ctx context.Context) (string, error) {\n1924: -\tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == \"\") {\n1925: -\t\treturn n.DefaultNode.GetNSPath(ctx)\n1926: -\t} else if n.isDistributedCardNode() {\n1927: -\t\treturn n.Runtime.GetNSPath(ctx, n.rootCtrName)\n1928: -\t}\n1929: -\treturn n.netnsNode.GetNSPath(ctx)\n1930: -}\n1931: -\n1932:  // calcComponentName appends the line card suffix to the given node name.\n1933:  func (n *sros) calcComponentName(name, slot string) string {\n1934:  \tif n.renameDone {\n1935:  \t\treturn name\n1936:  \t}\n1937: @@ -934,19 +871,18 @@ func (n *sros) cpmNode() (clabnodes.Node, error) {\n1938:  }\n1939:  \n1940:  // cpmSlot returns the Slot of the preferred CPM Node (used when Distributed mode).\n1941:  // It prefers slot A if present, otherwise returns slot B.\n1942:  func (n *sros) cpmSlot() (string, error) {\n1943: -\t// Prefer slot A, fall back to slot B\n1944: +\t// Prefer slot A, fall back to slot B. Slots are accepted in either case.\n1945:  \tfor _, comp := range n.kindSpecificCfg().Components {\n1946: -\t\tif comp.Slot == slotAName {\n1947: +\t\tif strings.EqualFold(comp.Slot, slotAName) {\n1948:  \t\t\treturn slotAName, nil\n1949:  \t\t}\n1950:  \t}\n1951: -\t// Check for slot B as fallback\n1952:  \tfor _, comp := range n.kindSpecificCfg().Components {\n1953: -\t\tif comp.Slot == slotBName {\n1954: +\t\tif strings.EqualFold(comp.Slot, slotBName) {\n1955:  \t\t\treturn slotBName, nil\n1956:  \t\t}\n1957:  \t}\n1958:  \treturn \"\", fmt.Errorf(\"node %s: unable to determine default slot\", n.GetShortName())\n1959:  }\n1960: @@ -1041,33 +977,10 @@ func (*sros) checkKernelVersion() error {\n1961:  \t\t)\n1962:  \t}\n1963:  \treturn nil\n1964:  }\n1965:  \n1966: -// checkComponentSlotsConfig check the sros component slot config for validity.\n1967: -func (n *sros) checkComponentSlotsConfig() error {\n1968: -\t// check Slots are unique\n1969: -\tcomponentNames := map[string]struct{}{}\n1970: -\tfor _, component := range n.kindSpecificCfg().Components {\n1971: -\t\t// convert slot to upper\n1972: -\t\tslot := strings.ToUpper(component.Slot)\n1973: -\t\t// check if slot exists\n1974: -\t\t_, exists := componentNames[slot]\n1975: -\t\tif exists {\n1976: -\t\t\treturn fmt.Errorf(\n1977: -\t\t\t\t\"node %s slot %s duplicate definition\",\n1978: -\t\t\t\tn.GetShortName(),\n1979: -\t\t\t\tcomponent.Slot,\n1980: -\t\t\t)\n1981: -\t\t}\n1982: -\t\t// add to component names map\n1983: -\t\tcomponentNames[component.Slot] = struct{}{}\n1984: -\n1985: -\t}\n1986: -\treturn nil\n1987: -}\n1988: -\n1989:  func (n *sros) CheckDeploymentConditions(ctx context.Context) error {\n1990:  \t// perform the sros specific kernel version check\n1991:  \terr := n.checkKernelVersion()\n1992:  \tif err != nil {\n1993:  \t\treturn err\n1994: @@ -1148,13 +1061,53 @@ func (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {\n1995:  \tlicensed := append([]byte(chassisInfoFileLicense), content...)\n1996:  \tif err := os.WriteFile(dstPath, licensed, clabconstants.PermissionsFileDefault); err != nil {\n1997:  \t\treturn fmt.Errorf(\"write %s: %w\", dstPath, err)\n1998:  \t}\n1999:  \tlog.Debug(\"Wrote chassis_info.json to lab dir\", \"node\", n.Cfg.ShortName, \"path\", dstPath)\n2000: +\tn.warnUnsupportedComponents(content)\n2001:  \treturn nil\n2002:  }\n2003:  \n2004: +// warnUnsupportedComponents validates the effective component configuration against the\n2005: +// chassis_info.json extracted from this exact image. Validation is advisory and never blocks\n2006: +// deploy.\n2007: +func (n *sros) warnUnsupportedComponents(content []byte) {\n2008: +\t// A distributed node validates once, from CPM A, to avoid duplicate warnings from CPM B.\n2009: +\tif !n.isStandaloneNode() && !n.isCPM(slotAName) {\n2010: +\t\treturn\n2011: +\t}\n2012: +\n2013: +\tinfo, err := parseChassisInfo(content)\n2014: +\tif err != nil {\n2015: +\t\tlog.Warn(\"Could not validate SR-SIM components against chassis_info.json\",\n2016: +\t\t\t\"node\", n.Cfg.ShortName, \"error\", err)\n2017: +\t\treturn\n2018: +\t}\n2019: +\n2020: +\tcomponents := n.rootComponents\n2021: +\tif len(components) == 0 {\n2022: +\t\tcomponents = n.kindSpecificCfg().Components\n2023: +\t}\n2024: +\n2025: +\teffective := n.componentsForConfig(components)\n2026: +\tif len(effective) == 0 {\n2027: +\t\t// Environment variables can configure integrated hardware without a components entry.\n2028: +\t\teffective = []*Component{n.componentForConfig(nil)}\n2029: +\t}\n2030: +\n2031: +\tnodeType := n.Cfg.NodeType\n2032: +\tif chassis := strings.TrimSpace(n.Cfg.Env[envNokiaSrosChassis]); chassis != \"\" {\n2033: +\t\tnodeType = chassis\n2034: +\t}\n2035: +\tfor _, warning := range info.componentWarnings(nodeType, n.componentSFM(), effective) {\n2036: +\t\tlog.Warn(\"SR-SIM component configuration may not be supported\",\n2037: +\t\t\t\"node\", n.Cfg.ShortName,\n2038: +\t\t\t\"chassis\", nodeType,\n2039: +\t\t\t\"warning\", warning)\n2040: +\t}\n2041: +}\n2042: +\n2043:  // Func that Places the Certificates in the right place and format.\n2044:  func (n *sros) createSROSCertificates() error {\n2045:  \tif *n.Cfg.Certificate.Issue {\n2046:  \t\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),\n2047:  \t\t\tclabconstants.PermissionsOpen)\n2048: @@ -1170,88 +1123,10 @@ func (n *sros) createSROSCertificates() error {\n2049:  \t\t}\n2050:  \t}\n2051:  \treturn nil\n2052:  }\n2053:  \n2054: -// createSROSConfigFiles handles config generation for the SR-SIM kind.\n2055: -// Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).\n2056: -func (n *sros) createSROSConfigFiles() error {\n2057: -\t// Get version from image before generating config\n2058: -\tif n.swVersion == nil {\n2059: -\t\tctx := context.Background()\n2060: -\t\tversion, err := n.srosVersionFromImage(ctx)\n2061: -\t\tif err != nil {\n2062: -\t\t\tn.swVersion = n.parseVersionString(srosDefaultVersion)\n2063: -\t\t\tlog.Warn(\"Failed to get SR OS version from image\",\n2064: -\t\t\t\t\"node\", n.Cfg.ShortName, \"version\", n.swVersion, \"error\", err)\n2065: -\t\t} else {\n2066: -\t\t\tn.swVersion = version\n2067: -\t\t\tlog.Info(\"Retrieved SR OS version from image\",\n2068: -\t\t\t\t\"node\", n.Cfg.ShortName,\n2069: -\t\t\t\t\"version\", fmt.Sprintf(\"%s.%s.%s\", version.Major, version.Minor, version.Build))\n2070: -\t\t}\n2071: -\t}\n2072: -\n2073: -\t// Path pointing to the target config file under configCf3 dir\n2074: -\tcf3CfgFile := filepath.Join(\n2075: -\t\tn.Cfg.LabDir,\n2076: -\t\tn.Cfg.Env[envNokiaSrosSlot],\n2077: -\t\tconfigCf3,\n2078: -\t\tstartupCfgName,\n2079: -\t)\n2080: -\tisPartial := clabutils.IsPartialConfigFile(n.Cfg.StartupConfig)\n2081: -\n2082: -\t// generate config and use that to boot node\n2083: -\tlog.Debug(\"Reading startup-config\", \"node\", n.Cfg.ShortName, \"startup-config\",\n2084: -\t\tn.Cfg.StartupConfig, \"isPartial\", isPartial)\n2085: -\n2086: -\tstartupConfig, err := n.buildStartupConfig(isPartial)\n2087: -\tif err != nil {\n2088: -\t\treturn err\n2089: -\t}\n2090: -\n2091: -\tif startupConfig == \"\" {\n2092: -\t\tlog.Debug(\n2093: -\t\t\t\"startup config is empty, skipping startup config file generation\",\n2094: -\t\t\t\"node\",\n2095: -\t\t\tn.Cfg.ShortName,\n2096: -\t\t)\n2097: -\t\treturn nil\n2098: -\t}\n2099: -\n2100: -\treturn n.GenerateConfig(cf3CfgFile, startupConfig)\n2101: -}\n2102: -\n2103: -// buildStartupConfig returns the full startup config string: either from user file (full config)\n2104: -// or from default + partial config generation. It does not return a template; the name is\n2105: -// historical.\n2106: -func (n *sros) buildStartupConfig(isPartial bool) (string, error) {\n2107: -\t// User provides full startup config\n2108: -\tif n.Cfg.StartupConfig != \"\" && !isPartial {\n2109: -\t\tc, err := os.ReadFile(n.Cfg.StartupConfig)\n2110: -\t\tif err != nil {\n2111: -\t\t\treturn \"\", err\n2112: -\t\t}\n2113: -\n2114: -\t\tcBuf, err := clabutils.SubstituteEnvsAndTemplate(bytes.NewReader(c), n.Cfg)\n2115: -\t\tif err != nil {\n2116: -\t\t\treturn \"\", err\n2117: -\t\t}\n2118: -\t\treturn cBuf.String(), nil\n2119: -\t}\n2120: -\n2121: -\t// Generate default config and optionally add partial config\n2122: -\tif err := n.addDefaultConfig(); err != nil {\n2123: -\t\treturn \"\", err\n2124: -\t}\n2125: -\tif err := n.addPartialConfig(); err != nil {\n2126: -\t\treturn \"\", err\n2127: -\t}\n2128: -\n2129: -\treturn string(n.startupCliCfg), nil\n2130: -}\n2131: -\n2132:  // SlotIsInteger checks if the slot string represents a valid integer.\n2133:  func SlotIsInteger(s string) bool {\n2134:  \t_, err := strconv.Atoi(s)\n2135:  \treturn err == nil\n2136:  }\n2137: @@ -1279,221 +1154,10 @@ func (n *sros) isCPM(cpm string) bool {\n2138:  \t}\n2139:  \n2140:  \treturn true\n2141:  }\n2142:  \n2143: -// prepareConfigTemplateData prepares all data needed for template selection and execution.\n2144: -// Service configs are filled from a single table-driven result: variant → getFullSnippetSet(v).\n2145: -func (n *sros) prepareConfigTemplateData() (*srosTemplateData, error) {\n2146: -\tb, err := n.banner()\n2147: -\tif err != nil {\n2148: -\t\treturn nil, err\n2149: -\t}\n2150: -\n2151: -\tcomponentConfig := \"\"\n2152: -\tif !isFullConfigFile(n.Cfg.StartupConfig) {\n2153: -\t\tcomponentConfig = n.generateComponentConfig()\n2154: -\t} else {\n2155: -\t\tlog.Debugf(\n2156: -\t\t\t\"SR-SIM node %q has non-partial startup-config defined, skipping component config gen\",\n2157: -\t\t\tn.Cfg.LongName,\n2158: -\t\t)\n2159: -\t}\n2160: -\n2161: -\tv := n.resolveConfigVariant()\n2162: -\tsnippets := getFullSnippetSet(v)\n2163: -\tconfigMode := string(v.Mode)\n2164: -\tif v.ForceClassic {\n2165: -\t\tlog.Warn(\n2166: -\t\t\t\"SAR-Hm nodes only support classic configuration mode. Overriding configuration mode to 'classic'\",\n2167: -\t\t\t\"node\",\n2168: -\t\t\tn.Cfg.LongName,\n2169: -\t\t\t\"node-type\",\n2170: -\t\t\tstrings.ToLower(n.Cfg.NodeType),\n2171: -\t\t)\n2172: -\t\tconfigMode = string(ConfigModeClassic)\n2173: -\t\tn.kindSpecificCfg().ConfigMode = ConfigModeClassic\n2174: -\t}\n2175: -\n2176: -\ttplData := &srosTemplateData{\n2177: -\t\t// Selection criteria\n2178: -\t\tNodeType:          strings.ToLower(n.Cfg.NodeType),\n2179: -\t\tConfigurationMode: configMode,\n2180: -\t\tSwVersion:         n.swVersion,\n2181: -\t\tIsSecureGrpc:      *n.Cfg.Certificate.Issue,\n2182: -\n2183: -\t\t// Node data\n2184: -\t\tName:            n.Cfg.ShortName,\n2185: -\t\tTLSKey:          n.Cfg.TLSKey,\n2186: -\t\tTLSCert:         n.Cfg.TLSCert,\n2187: -\t\tTLSAnchor:       n.Cfg.TLSAnchor,\n2188: -\t\tBanner:          b,\n2189: -\t\tIFaces:          map[string]tplIFace{},\n2190: -\t\tMgmtMTU:         0,\n2191: -\t\tMgmtIPMTU:       n.Runtime.Mgmt().MTU,\n2192: -\t\tComponentConfig: componentConfig,\n2193: -\n2194: -\t\t// Service configs from variant (single source of truth)\n2195: -\t\tSystemConfig:  snippets.SystemConfig,\n2196: -\t\tGRPCConfig:    snippets.GRPCConfig,\n2197: -\t\tSNMPConfig:    snippets.SNMPConfig,\n2198: -\t\tNetconfConfig: snippets.NetconfConfig,\n2199: -\t\tLoggingConfig: snippets.LoggingConfig,\n2200: -\t\tSSHConfig:     snippets.SSHConfig,\n2201: -\t}\n2202: -\n2203: -\tif n.Config().DNS != nil {\n2204: -\t\ttplData.DNSServers = append(tplData.DNSServers, n.Config().DNS.Servers...)\n2205: -\t}\n2206: -\n2207: -\tn.prepareSSHPubKeys(tplData)\n2208: -\n2209: -\tn.setVersionSpecificParams(tplData)\n2210: -\n2211: -\treturn tplData, nil\n2212: -}\n2213: -\n2214: -// isIXRNode returns true if this is an IXR node type (case-insensitive).\n2215: -func (n *sros) isIXRNode() bool {\n2216: -\treturn ixrRegexp.MatchString(n.Cfg.NodeType)\n2217: -}\n2218: -\n2219: -// isSARNode returns true if this is a SAR node type (case-insensitive).\n2220: -func (n *sros) isSARNode() bool {\n2221: -\treturn sarRegexp.MatchString(n.Cfg.NodeType)\n2222: -}\n2223: -\n2224: -// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).\n2225: -func (n *sros) isSARHmNode() bool {\n2226: -\treturn sarHmRegexp.MatchString(n.Cfg.NodeType)\n2227: -}\n2228: -\n2229: -// getTemplateForVariant returns the template string and name for the given config variant.\n2230: -// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= \"26\").\n2231: -func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {\n2232: -\t// Model-driven (or mixed treated as classic below when family is classic)\n2233: -\tif v.Mode == ConfigModeModelDriven {\n2234: -\t\t// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= \"26\"\n2235: -\t\t// { return cfgTplSROS26, \"clab-sros-config-sros26\" }\n2236: -\t\treturn cfgTplSROS25, \"clab-sros-config-sros25\"\n2237: -\t}\n2238: -\t// Classic (or mixed)\n2239: -\ttmpl = cfgTplClassic\n2240: -\ttplName = \"clab-sros-config-classic\"\n2241: -\tswitch v.Family {\n2242: -\tcase ConfigFamilyIXR:\n2243: -\t\treturn cfgTplClassicIxr, \"clab-sros-config-classic-ixr\"\n2244: -\tcase ConfigFamilySAR:\n2245: -\t\treturn cfgTplClassicSar, \"clab-sros-config-classic-sar\"\n2246: -\tdefault:\n2247: -\t\treturn tmpl, tplName\n2248: -\t}\n2249: -}\n2250: -\n2251: -// selectConfigTemplate chooses the config template from the config variant (mode + family).\n2252: -func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {\n2253: -\tv := n.resolveConfigVariant()\n2254: -\ttmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)\n2255: -\treturn template.New(tplName).\n2256: -\t\tFuncs(clabutils.CreateFuncs()).\n2257: -\t\tParse(tmpl)\n2258: -}\n2259: -\n2260: -// addDefaultConfig adds sros default configuration such as tls certs, gnmi/json-rpc, login-banner,\n2261: -// ssh keys.\n2262: -func (n *sros) addDefaultConfig() error {\n2263: -\t// Prepare all template data\n2264: -\ttplData, err := n.prepareConfigTemplateData()\n2265: -\tif err != nil {\n2266: -\t\treturn err\n2267: -\t}\n2268: -\n2269: -\t// Select appropriate template\n2270: -\tsrosCfgTpl, err := n.selectConfigTemplate(tplData)\n2271: -\tif err != nil {\n2272: -\t\treturn fmt.Errorf(\"failed to select config template: %w\", err)\n2273: -\t}\n2274: -\tlog.Debug(\"Prepare SR OS config template\", \"template\", srosCfgTpl.Name(),\n2275: -\t\t\"node\", n.Cfg.LongName,\n2276: -\t\t\"configuration-mode\", tplData.ConfigurationMode,\n2277: -\t\t\"node-type\", tplData.NodeType,\n2278: -\t\t\"secure-grpc\", tplData.IsSecureGrpc,\n2279: -\t\t\"sw-version\", tplData.SwVersion)\n2280: -\n2281: -\t// Execute template\n2282: -\tbuf := new(bytes.Buffer)\n2283: -\terr = srosCfgTpl.Execute(buf, tplData)\n2284: -\tif err != nil {\n2285: -\t\treturn err\n2286: -\t}\n2287: -\n2288: -\tif buf.Len() == 0 {\n2289: -\t\tlog.Warn(\n2290: -\t\t\t\"Buffer empty, template parsing error\",\n2291: -\t\t\t\"node\", n.Cfg.ShortName,\n2292: -\t\t\t\"template\", srosCfgTpl.Name(),\n2293: -\t\t)\n2294: -\t} else {\n2295: -\t\tlog.Debug(\"Additional default config parsed\",\n2296: -\t\t\t\"node\", n.Cfg.ShortName,\n2297: -\t\t\t\"template\", srosCfgTpl.Name())\n2298: -\t\tn.startupCliCfg = append(n.startupCliCfg, buf.String()...)\n2299: -\t}\n2300: -\n2301: -\treturn nil\n2302: -}\n2303: -\n2304: -// applyPartialConfig applies partial configuration to the SR OS.\n2305: -func (n *sros) addPartialConfig() error {\n2306: -\tif n.Cfg.StartupConfig != \"\" {\n2307: -\t\t// b holds the configuration to be applied to the node\n2308: -\t\tb := &bytes.Buffer{}\n2309: -\t\t// apply partial configs if partial config is used\n2310: -\t\tif clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM(\"\") {\n2311: -\t\t\tlog.Info(\"Adding configuration\",\n2312: -\t\t\t\t\"node\", n.Cfg.LongName,\n2313: -\t\t\t\t\"type\", \"partial\",\n2314: -\t\t\t\t\"source\", n.Cfg.StartupConfig)\n2315: -\n2316: -\t\t\tr, err := os.Open(n.Cfg.StartupConfig)\n2317: -\t\t\tif err != nil {\n2318: -\t\t\t\treturn err\n2319: -\t\t\t}\n2320: -\n2321: -\t\t\tdefer r.Close() // skipcq: GO-S2307\n2322: -\n2323: -\t\t\t_, err = io.Copy(b, r)\n2324: -\t\t\tif err != nil {\n2325: -\t\t\t\treturn err\n2326: -\t\t\t}\n2327: -\n2328: -\t\t\tconfigContent, err := clabutils.SubstituteEnvsAndTemplate(b, n.Cfg)\n2329: -\t\t\tif err != nil {\n2330: -\t\t\t\treturn err\n2331: -\t\t\t}\n2332: -\t\t\tif configContent.Len() == 0 {\n2333: -\t\t\t\tlog.Warn(\n2334: -\t\t\t\t\t\"Buffer empty, PARTIAL config template parsing error\",\n2335: -\t\t\t\t\t\"node\",\n2336: -\t\t\t\t\tn.Cfg.ShortName,\n2337: -\t\t\t\t)\n2338: -\t\t\t} else {\n2339: -\t\t\t\tlog.Debug(\"Additional PARTIAL config parsed\", \"node\",\n2340: -\t\t\t\t\tn.Cfg.ShortName, \"partial-config\", configContent.String())\n2341: -\t\t\t\tn.startupCliCfg = append(n.startupCliCfg, configContent.String()...)\n2342: -\t\t\t}\n2343: -\t\t} else {\n2344: -\t\t\tlog.Warn(\n2345: -\t\t\t\t\"Passed startup-config option, but it will not have any effect\",\n2346: -\t\t\t\t\"node\",\n2347: -\t\t\t\tn.Cfg.ShortName,\n2348: -\t\t\t)\n2349: -\t\t}\n2350: -\t}\n2351: -\treturn nil\n2352: -}\n2353: -\n2354:  func (n *sros) GetContainers(ctx context.Context) ([]clabruntime.GenericContainer, error) {\n2355:  \t// if not a distributed setup call regular GetContainers\n2356:  \tif n.isStandaloneNode() || n.isDistributedCardNode() {\n2357:  \t\treturn n.DefaultNode.GetContainers(ctx)\n2358:  \t}\n2359: @@ -1761,63 +1425,10 @@ func (n *sros) saveConfigWithAddr(ctx context.Context, addr string) error {\n2360:  \t)\n2361:  \n2362:  \treturn nil\n2363:  }\n2364:  \n2365: -// BuildPKIImportXML.\n2366: -func buildPKIImportXML(inputURL, outputFile, importType string) string {\n2367: -\taction := etree.NewElement(\"action\")\n2368: -\taction.CreateAttr(\"xmlns\", \"urn:ietf:params:xml:ns:yang:1\")\n2369: -\n2370: -\tadmin := action.CreateElement(\"admin\")\n2371: -\tadmin.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:oper-admin\")\n2372: -\n2373: -\timportElem := admin.CreateElement(\"system\").\n2374: -\t\tCreateElement(\"security\").\n2375: -\t\tCreateElement(\"pki\").\n2376: -\t\tCreateElement(\"import\")\n2377: -\n2378: -\t// Add import parameters\n2379: -\timportElem.CreateElement(\"input-url\").SetText(inputURL)\n2380: -\timportElem.CreateElement(\"output-file\").SetText(outputFile)\n2381: -\timportElem.CreateElement(\"type\").SetText(importType)\n2382: -\timportElem.CreateElement(\"format\").SetText(\"pem\")\n2383: -\tvar buf bytes.Buffer\n2384: -\taction.WriteTo(&buf, &etree.WriteSettings{\n2385: -\t\tCanonicalText:    false,\n2386: -\t\tCanonicalAttrVal: false,\n2387: -\t})\n2388: -\treturn buf.String()\n2389: -}\n2390: -\n2391: -// BuildTLSProfileXML builds the TLS profile configuration XML.\n2392: -func buildTLSProfileXML() string {\n2393: -\tconfig := etree.NewElement(\"config\")\n2394: -\tconfigure := config.CreateElement(\"configure\")\n2395: -\tconfigure.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:conf\")\n2396: -\tconfigure.CreateAttr(\"xmlns:nc\", \"urn:ietf:params:xml:ns:netconf:base:1.0\")\n2397: -\n2398: -\tcertProfile := configure.CreateElement(\"system\").\n2399: -\t\tCreateElement(\"security\").\n2400: -\t\tCreateElement(\"tls\").\n2401: -\t\tCreateElement(\"cert-profile\")\n2402: -\n2403: -\t// Set operation attribute\n2404: -\tcertProfile.CreateAttr(\"nc:operation\", \"merge\")\n2405: -\n2406: -\t// Add profile configuration\n2407: -\tcertProfile.CreateElement(\"cert-profile-name\").SetText(tlsCertProfileName)\n2408: -\tcertProfile.CreateElement(\"admin-state\").SetText(\"enable\")\n2409: -\n2410: -\tvar buf bytes.Buffer\n2411: -\tconfig.WriteTo(&buf, &etree.WriteSettings{\n2412: -\t\tCanonicalText:    false,\n2413: -\t\tCanonicalAttrVal: false,\n2414: -\t})\n2415: -\treturn buf.String()\n2416: -}\n2417: -\n2418:  // TLS bootstrap via NETCONF to enable secure gRPC.\n2419:  func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {\n2420:  \t// Always import PKI key and cert:\n2421:  \t// \t import \"cf3:\\node.key\" in PEM format as \"cf3:\\system-pki\\node.key\" (encrypted DER)\n2422:  \t//   import \"cf3:\\node.crt\" in PEM format as \"cf3:\\system-pki\\node.crt\" (encrypted DER)\n2423: @@ -1867,23 +1478,10 @@ func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {\n2424:  \t\t}\n2425:  \t}\n2426:  \treturn err\n2427:  }\n2428:  \n2429: -// isConfigClassic reports whether the node is in classic or mixed configuration mode.\n2430: -func (n *sros) isConfigClassic() bool {\n2431: -\tmode := n.kindSpecificCfg().ConfigMode\n2432: -\treturn mode == ConfigModeClassic || mode == ConfigModeMixed\n2433: -}\n2434: -\n2435: -// isFullConfigFile returns true if the config file doesn't contain .partial substring\n2436: -// and the config file is NOT nil (ie. startup config IS defined).\n2437: -// it is intended that the 'c' arg is n.Cfg.StartupConfig.\n2438: -func isFullConfigFile(c string) bool {\n2439: -\treturn c != \"\" && !clabutils.IsPartialConfigFile(c)\n2440: -}\n2441: -\n2442:  func (n *sros) IsHealthy(_ context.Context) (bool, error) {\n2443:  \tif !n.isCPM(\"\") {\n2444:  \t\treturn true, fmt.Errorf(\"node %q is not a CPM, healthcheck has no effect\", n.Cfg.LongName)\n2445:  \t}\n2446:  \t// non-partial user startup config might not have any netconf config\n2447: @@ -2082,67 +1680,10 @@ func (n *sros) MgmtIPAddr() (string, error) {\n2448:  \t\t\"no management IP address (IPv4 or IPv6) configured for node %q\",\n2449:  \t\tn.Cfg.LongName,\n2450:  \t)\n2451:  }\n2452:  \n2453: -// generateComponentConfig generates SR OS configuration for explicitly defined distributed\n2454: -// components or known integrated SR-SIM defaults. Power config is appended when supported.\n2455: -func (n *sros) generateComponentConfig() string {\n2456: -\tif !n.kindSpecificCfg().GenComponentConfig {\n2457: -\t\treturn \"\"\n2458: -\t}\n2459: -\tif n.isConfigClassic() {\n2460: -\t\treturn \"\"\n2461: -\t}\n2462: -\n2463: -\tcomponents := n.rootComponents\n2464: -\tif len(components) == 0 {\n2465: -\t\tif len(n.kindSpecificCfg().Components) > 1 || n.rootCtrName != \"\" {\n2466: -\t\t\treturn \"\"\n2467: -\t\t}\n2468: -\n2469: -\t\tlines := buildIntegratedComponentCfgLines(n.Cfg.NodeType, n.Cfg.Env)\n2470: -\t\tif len(lines) == 0 {\n2471: -\t\t\treturn \"\"\n2472: -\t\t}\n2473: -\t\treturn n.componentConfigFromLines(lines)\n2474: -\t}\n2475: -\n2476: -\tfor _, c := range components {\n2477: -\t\tslot := strings.ToUpper(strings.TrimSpace(c.Slot))\n2478: -\t\tif slot == slotAName || slot == slotBName {\n2479: -\t\t\tcontinue\n2480: -\t\t}\n2481: -\t\tif c.Type == \"\" {\n2482: -\t\t\tlog.Warn(\n2483: -\t\t\t\t\"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.\",\n2484: -\t\t\t\t\"node\",\n2485: -\t\t\t\tn.Cfg.ShortName,\n2486: -\t\t\t\t\"slot\",\n2487: -\t\t\t\tslot,\n2488: -\t\t\t)\n2489: -\t\t}\n2490: -\t}\n2491: -\n2492: -\tlines := buildComponentCfgLines(components, n.kindSpecificCfg().SFM)\n2493: -\treturn n.componentConfigFromLines(lines)\n2494: -}\n2495: -\n2496: -func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {\n2497: -\tpowerConfig := n.generatePowerConfig()\n2498: -\tif len(lines) == 0 && powerConfig == \"\" {\n2499: -\t\treturn \"\"\n2500: -\t}\n\n(Showing lines 1201-2500 of 3945. Use offset=2501 to continue.)\n</content>",
    "title": "source/diff.txt",
    "metadata": {
      "preview": "+\t// Set operation attribute\n+\tcertProfile.CreateAttr(\"nc:operation\", \"merge\")\n+\n+\t// Add profile configuration\n+\tcertProfile.CreateElement(\"cert-profile-name\").SetText(tlsCertProfileName)\n+\tcertProfile.CreateElement(\"admin-state\").SetText(\"enable\")\n+\n+\tvar buf bytes.Buffer\n+\tconfig.WriteTo(&buf, &etree.WriteSettings{\n+\t\tCanonicalText:    false,\n+\t\tCanonicalAttrVal: false,\n+\t})\n+\treturn buf.String()\n+}\n+\n+// createSROSConfigFiles handles config generation for the SR-SIM kind.\n+// Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).\n+func (n *sros) createSROSConfigFiles() error {\n+\t// Get version from image before generating config\n+\tif n.swVersion == nil {",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/diff.txt",
        "text": "+\t// Set operation attribute\n+\tcertProfile.CreateAttr(\"nc:operation\", \"merge\")\n+\n+\t// Add profile configuration\n+\tcertProfile.CreateElement(\"cert-profile-name\").SetText(tlsCertProfileName)\n+\tcertProfile.CreateElement(\"admin-state\").SetText(\"enable\")\n+\n+\tvar buf bytes.Buffer\n+\tconfig.WriteTo(&buf, &etree.WriteSettings{\n+\t\tCanonicalText:    false,\n+\t\tCanonicalAttrVal: false,\n+\t})\n+\treturn buf.String()\n+}\n+\n+// createSROSConfigFiles handles config generation for the SR-SIM kind.\n+// Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).\n+func (n *sros) createSROSConfigFiles() error {\n+\t// Get version from image before generating config\n+\tif n.swVersion == nil {\n+\t\tctx := context.Background()\n+\t\tversion, err := n.srosVersionFromImage(ctx)\n+\t\tif err != nil {\n+\t\t\tn.swVersion = n.parseVersionString(srosDefaultVersion)\n+\t\t\tlog.Warn(\"Failed to get SR OS version from image\",\n+\t\t\t\t\"node\", n.Cfg.ShortName, \"version\", n.swVersion, \"error\", err)\n+\t\t} else {\n+\t\t\tn.swVersion = version\n+\t\t\tlog.Info(\"Retrieved SR OS version from image\",\n+\t\t\t\t\"node\", n.Cfg.ShortName,\n+\t\t\t\t\"version\", fmt.Sprintf(\"%s.%s.%s\", version.Major, version.Minor, version.Build))\n+\t\t}\n+\t}\n+\n+\t// Path pointing to the target config file under configCf3 dir\n+\tcf3CfgFile := filepath.Join(\n+\t\tn.Cfg.LabDir,\n+\t\tn.Cfg.Env[envNokiaSrosSlot],\n+\t\tconfigCf3,\n+\t\tstartupCfgName,\n+\t)\n+\tisPartial := clabutils.IsPartialConfigFile(n.Cfg.StartupConfig)\n+\n+\t// generate config and use that to boot node\n+\tlog.Debug(\"Reading startup-config\", \"node\", n.Cfg.ShortName, \"startup-config\",\n+\t\tn.Cfg.StartupConfig, \"isPartial\", isPartial)\n+\n+\tstartupConfig, err := n.buildStartupConfig(isPartial)\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\tif startupConfig == \"\" {\n+\t\tlog.Debug(\n+\t\t\t\"startup config is empty, skipping startup config file generation\",\n+\t\t\t\"node\",\n+\t\t\tn.Cfg.ShortName,\n+\t\t)\n+\t\treturn nil\n+\t}\n+\n+\treturn n.GenerateConfig(cf3CfgFile, startupConfig)\n+}\n+\n+// buildStartupConfig returns the full startup config string: either from user file (full config)\n+// or from default + partial config generation. It does not return a template; the name is\n+// historical.\n+func (n *sros) buildStartupConfig(isPartial bool) (string, error) {\n+\t// User provides full startup config\n+\tif n.Cfg.StartupConfig != \"\" && !isPartial {\n+\t\tc, err := os.ReadFile(n.Cfg.StartupConfig)\n+\t\tif err != nil {\n+\t\t\treturn \"\", err\n+\t\t}\n+\n+\t\tcBuf, err := clabutils.SubstituteEnvsAndTemplate(bytes.NewReader(c), n.Cfg)\n+\t\tif err != nil {\n+\t\t\treturn \"\", err\n+\t\t}\n+\t\treturn cBuf.String(), nil\n+\t}\n+\n+\t// Generate default config and optionally add partial config\n+\tif err := n.addDefaultConfig(); err != nil {\n+\t\treturn \"\", err\n+\t}\n+\tif err := n.addPartialConfig(); err != nil {\n+\t\treturn \"\", err\n+\t}\n+\n+\treturn string(n.startupCliCfg), nil\n+}\n+\n+// prepareConfigTemplateData prepares all data needed for template selection and execution.\n+// Service configs are filled from a single table-driven result: variant → getFullSnippetSet(v).\n+func (n *sros) prepareConfigTemplateData() (*srosTemplateData, error) {\n+\tb, err := n.banner()\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\tcomponentConfig := \"\"\n+\tif !isFullConfigFile(n.Cfg.StartupConfig) {\n+\t\tcomponentConfig = n.generateComponentConfig()\n+\t} else {\n+\t\tlog.Debugf(\n+\t\t\t\"SR-SIM node %q has non-partial startup-config defined, skipping component config gen\",\n+\t\t\tn.Cfg.LongName,\n+\t\t)\n+\t}\n+\n+\tv := n.resolveConfigVariant()\n+\tsnippets := getFullSnippetSet(v)\n+\tconfigMode := string(v.Mode)\n+\tif v.ForceClassic {\n+\t\tlog.Warn(\n+\t\t\t\"SAR-Hm nodes only support classic configuration mode. Overriding configuration mode to 'classic'\",\n+\t\t\t\"node\",\n+\t\t\tn.Cfg.LongName,\n+\t\t\t\"node-type\",\n+\t\t\tstrings.ToLower(n.Cfg.NodeType),\n+\t\t)\n+\t\tconfigMode = string(ConfigModeClassic)\n+\t\tn.kindSpecificCfg().ConfigMode = ConfigModeClassic\n+\t}\n+\n+\ttplData := &srosTemplateData{\n+\t\t// Selection criteria\n+\t\tNodeType:          strings.ToLower(n.Cfg.NodeType),\n+\t\tConfigurationMode: configMode,\n+\t\tSwVersion:         n.swVersion,\n+\t\tIsSecureGrpc:      *n.Cfg.Certificate.Issue,\n+\n+\t\t// Node data\n+\t\tName:            n.Cfg.ShortName,\n+\t\tTLSKey:          n.Cfg.TLSKey,\n+\t\tTLSCert:         n.Cfg.TLSCert,\n+\t\tTLSAnchor:       n.Cfg.TLSAnchor,\n+\t\tBanner:          b,\n+\t\tIFaces:          map[string]tplIFace{},\n+\t\tMgmtMTU:         0,\n+\t\tMgmtIPMTU:       n.Runtime.Mgmt().MTU,\n+\t\tComponentConfig: componentConfig,\n+\n+\t\t// Service configs from variant (single source of truth)\n+\t\tSystemConfig:  snippets.SystemConfig,\n+\t\tGRPCConfig:    snippets.GRPCConfig,\n+\t\tSNMPConfig:    snippets.SNMPConfig,\n+\t\tNetconfConfig: snippets.NetconfConfig,\n+\t\tLoggingConfig: snippets.LoggingConfig,\n+\t\tSSHConfig:     snippets.SSHConfig,\n+\t}\n+\n+\tif n.Config().DNS != nil {\n+\t\ttplData.DNSServers = append(tplData.DNSServers, n.Config().DNS.Servers...)\n+\t}\n+\n+\tn.prepareSSHPubKeys(tplData)\n+\n+\tn.setVersionSpecificParams(tplData)\n+\n+\treturn tplData, nil\n+}\n+\n+// addDefaultConfig adds sros default configuration such as tls certs, gnmi/json-rpc, login-banner,\n+// ssh keys.\n+func (n *sros) addDefaultConfig() error {\n+\t// Prepare all template data\n+\ttplData, err := n.prepareConfigTemplateData()\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\t// Select appropriate template\n+\tsrosCfgTpl, err := n.selectConfigTemplate(tplData)\n+\tif err != nil {\n+\t\treturn fmt.Errorf(\"failed to select config template: %w\", err)\n+\t}\n+\tlog.Debug(\"Prepare SR OS config template\", \"template\", srosCfgTpl.Name(),\n+\t\t\"node\", n.Cfg.LongName,\n+\t\t\"configuration-mode\", tplData.ConfigurationMode,\n+\t\t\"node-type\", tplData.NodeType,\n+\t\t\"secure-grpc\", tplData.IsSecureGrpc,\n+\t\t\"sw-version\", tplData.SwVersion)\n+\n+\t// Execute template\n+\tbuf := new(bytes.Buffer)\n+\terr = srosCfgTpl.Execute(buf, tplData)\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\tif buf.Len() == 0 {\n+\t\tlog.Warn(\n+\t\t\t\"Buffer empty, template parsing error\",\n+\t\t\t\"node\", n.Cfg.ShortName,\n+\t\t\t\"template\", srosCfgTpl.Name(),\n+\t\t)\n+\t} else {\n+\t\tlog.Debug(\"Additional default config parsed\",\n+\t\t\t\"node\", n.Cfg.ShortName,\n+\t\t\t\"template\", srosCfgTpl.Name())\n+\t\tn.startupCliCfg = append(n.startupCliCfg, buf.String()...)\n+\t}\n+\n+\treturn nil\n+}\n+\n+// applyPartialConfig applies partial configuration to the SR OS.\n+func (n *sros) addPartialConfig() error {\n+\tif n.Cfg.StartupConfig != \"\" {\n+\t\t// b holds the configuration to be applied to the node\n+\t\tb := &bytes.Buffer{}\n+\t\t// apply partial configs if partial config is used\n+\t\tif clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM(\"\") {\n+\t\t\tlog.Info(\"Adding configuration\",\n+\t\t\t\t\"node\", n.Cfg.LongName,\n+\t\t\t\t\"type\", \"partial\",\n+\t\t\t\t\"source\", n.Cfg.StartupConfig)\n+\n+\t\t\tr, err := os.Open(n.Cfg.StartupConfig)\n+\t\t\tif err != nil {\n+\t\t\t\treturn err\n+\t\t\t}\n+\n+\t\t\tdefer r.Close() // skipcq: GO-S2307\n+\n+\t\t\t_, err = io.Copy(b, r)\n+\t\t\tif err != nil {\n+\t\t\t\treturn err\n+\t\t\t}\n+\n+\t\t\tconfigContent, err := clabutils.SubstituteEnvsAndTemplate(b, n.Cfg)\n+\t\t\tif err != nil {\n+\t\t\t\treturn err\n+\t\t\t}\n+\t\t\tif configContent.Len() == 0 {\n+\t\t\t\tlog.Warn(\n+\t\t\t\t\t\"Buffer empty, PARTIAL config template parsing error\",\n+\t\t\t\t\t\"node\",\n+\t\t\t\t\tn.Cfg.ShortName,\n+\t\t\t\t)\n+\t\t\t} else {\n+\t\t\t\tlog.Debug(\"Additional PARTIAL config parsed\", \"node\",\n+\t\t\t\t\tn.Cfg.ShortName, \"partial-config\", configContent.String())\n+\t\t\t\tn.startupCliCfg = append(n.startupCliCfg, configContent.String()...)\n+\t\t\t}\n+\t\t} else {\n+\t\t\tlog.Warn(\n+\t\t\t\t\"Passed startup-config option, but it will not have any effect\",\n+\t\t\t\t\"node\",\n+\t\t\t\tn.Cfg.ShortName,\n+\t\t\t)\n+\t\t}\n+\t}\n+\treturn nil\n+}\n+\n+// isConfigClassic reports whether the node is in classic or mixed configuration mode.\n+func (n *sros) isConfigClassic() bool {\n+\tmode := n.kindSpecificCfg().ConfigMode\n+\treturn mode == ConfigModeClassic || mode == ConfigModeMixed\n+}\n+\n+// isFullConfigFile returns true if the config file doesn't contain .partial substring\n+// and the config file is NOT nil (ie. startup config IS defined).\n+// it is intended that the 'c' arg is n.Cfg.StartupConfig.\n+func isFullConfigFile(c string) bool {\n+\treturn c != \"\" && !clabutils.IsPartialConfigFile(c)\n+}\ndiff --git a/nodes/sros/netns.go b/nodes/sros/netns.go\nindex dbd9af7..e7ec511 100644\n--- a/nodes/sros/netns.go\n+++ b/nodes/sros/netns.go\n@@ -1,14 +1,20 @@\n package sros\n \n import (\n+\t\"context\"\n+\t\"errors\"\n \t\"fmt\"\n \t\"maps\"\n \n+\tclabutils \"github.com/srl-labs/containerlab/utils\"\n+\n \tclabconstants \"github.com/srl-labs/containerlab/constants\"\n \tclabnodes \"github.com/srl-labs/containerlab/nodes\"\n+\tclabruntime \"github.com/srl-labs/containerlab/runtime\"\n \tclabtypes \"github.com/srl-labs/containerlab/types\"\n+\t\"github.com/vishvananda/netns\"\n )\n \n // namespaceNode owns the shared network namespace of a components-based SR-SIM node.\n type namespaceNode struct {\n \tclabnodes.DefaultNode\n@@ -81,5 +87,71 @@ func (n *sros) newNetnsConfig() *clabtypes.NodeConfig {\n \t\tLabels:                labels,\n \t\tRuntime:               n.Cfg.Runtime,\n \t\tResultingPortBindings: n.Cfg.ResultingPortBindings,\n \t}\n }\n+\n+func (n *sros) ensureNetnsRunning(ctx context.Context) error {\n+\tswitch status := n.netnsNode.GetContainerStatus(ctx); status {\n+\tcase clabruntime.Running:\n+\t\t// The namespace holder intentionally survives regular node lifecycle operations.\n+\tcase clabruntime.Created, clabruntime.Stopped:\n+\t\tif err := n.netnsNode.Start(ctx); err != nil {\n+\t\t\treturn fmt.Errorf(\"node %q network namespace container start error: %w\",\n+\t\t\t\tn.Cfg.ShortName, err)\n+\t\t}\n+\tcase clabruntime.Paused:\n+\t\tif err := n.Runtime.UnpauseContainer(ctx, n.netnsNode.Config().LongName); err != nil {\n+\t\t\treturn fmt.Errorf(\"node %q network namespace container unpause error: %w\",\n+\t\t\t\tn.Cfg.ShortName, err)\n+\t\t}\n+\tcase clabruntime.NotFound:\n+\t\treturn fmt.Errorf(\n+\t\t\t\"node %q network namespace container %q not found; recreate the node\",\n+\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName,\n+\t\t)\n+\tdefault:\n+\t\treturn fmt.Errorf(\"node %q network namespace container %q is %s\",\n+\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName, status)\n+\t}\n+\n+\treturn nil\n+}\n+\n+func (n *sros) cleanupParkingNetNS() error {\n+\tname := clabutils.ParkingNetnsName(n.Cfg.LongName)\n+\tif _, err := clabutils.GetNamedNetNS(name); err != nil {\n+\t\treturn nil\n+\t}\n+\n+\treturn netns.DeleteNamed(name)\n+}\n+\n+// GetNSPath retrieves the Namespace Path.\n+func (n *sros) GetNSPath(ctx context.Context) (string, error) {\n+\tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == \"\") {\n+\t\treturn n.DefaultNode.GetNSPath(ctx)\n+\t} else if n.isDistributedCardNode() {\n+\t\treturn n.Runtime.GetNSPath(ctx, n.rootCtrName)\n+\t}\n+\treturn n.netnsNode.GetNSPath(ctx)\n+}\n+\n+// DeleteNetnsSymlink deletes the symlink file created for the container netns.\n+func (n *sros) DeleteNetnsSymlink() error {\n+\tvar errs []error\n+\n+\t// if it is the base node, then we need to delete the symlink for all the components.\n+\tif n.isDistributedBaseNode() {\n+\t\tfor _, componentNode := range n.componentNodes {\n+\t\t\terrs = append(errs, componentNode.DeleteNetnsSymlink())\n+\t\t}\n+\t\tif n.netnsNode != nil {\n+\t\t\terrs = append(errs, n.netnsNode.DeleteNetnsSymlink())\n+\t\t}\n+\t\terrs = append(errs, clabutils.DeleteNetnsSymlink(n.Cfg.LongName))\n+\t}\n+\n+\terrs = append(errs, n.DefaultNode.DeleteNetnsSymlink(), n.cleanupParkingNetNS())\n+\n+\treturn errors.Join(errs...)\n+}\ndiff --git a/nodes/sros/power.go b/nodes/sros/power.go\nindex 7ab11bd..07509f3 100644\n--- a/nodes/sros/power.go\n+++ b/nodes/sros/power.go\n@@ -3,10 +3,15 @@ package sros\n import (\n \t\"fmt\"\n \t\"strings\"\n )\n \n+const (\n+\tdefaultSrosPowerType       = \"dc\"\n+\tdefaultSrosPowerModuleType = \"ps-a-dc-6000\"\n+)\n+\n // SrosPower defines power supply configuration for a given node type.\n type SrosPower struct {\n \tModules any\n \tShelves int\n }\ndiff --git a/nodes/sros/sros.go b/nodes/sros/sros.go\nindex 1eac470..20ae973 100644\n--- a/nodes/sros/sros.go\n+++ b/nodes/sros/sros.go\n@@ -6,11 +6,10 @@ package sros\n \n import (\n \t\"bufio\"\n \t\"bytes\"\n \t\"context\"\n-\t_ \"embed\"\n \t\"errors\"\n \t\"fmt\"\n \t\"io\"\n \t\"maps\"\n \t\"net\"\n@@ -20,19 +19,16 @@ import (\n \t\"reflect\"\n \t\"regexp\"\n \t\"slices\"\n \t\"strconv\"\n \t\"strings\"\n-\t\"text/template\"\n \t\"time\"\n \n-\t\"github.com/beevik/etree\"\n \t\"github.com/brunoga/deep\"\n \t\"github.com/charmbracelet/log\"\n \t\"github.com/scrapli/scrapligo/driver/netconf\"\n \t\"github.com/scrapli/scrapligo/driver/opoptions\"\n-\t\"github.com/vishvananda/netns\"\n \n \t\"github.com/scrapli/scrapligo/response\"\n \n \tclabconstants \"github.com/srl-labs/containerlab/constants\"\n \tclabexec \"github.com/srl-labs/containerlab/exec\"\n@@ -82,32 +78,16 @@ const (\n \tenvNokiaSrosMDA           = \"NOKIA_SROS_MDA\"\n \tenvSrosIPv4Active         = \"NOKIA_SROS_ADDRESS_IPV4_ACTIVE\"\n \tenvSrosIPv6Active         = \"NOKIA_SROS_ADDRESS_IPV6_ACTIVE\"\n \tenvSrosStaticRoutePrefix  = \"NOKIA_SROS_STATIC_ROUTE_\"\n \n-\tdefaultSrosPowerType       = \"dc\"\n-\tdefaultSrosPowerModuleType = \"ps-a-dc-6000\"\n-\n \tsrosMinorError     = \"MINOR:\"\n \tsrosCriticalError  = \"CRITICAL:\"\n \tsrosRejectedCfgMsg = \"Configuration load failed - using default configuration\"\n )\n \n var (\n-\n-\t//go:embed configs/sros_config_sros25.go.tpl\n-\tcfgTplSROS25 string\n-\n-\t//go:embed configs/sros_config_classic.go.tpl\n-\tcfgTplClassic string\n-\n-\t//go:embed configs/ixr/ixr_config_classic.go.tpl\n-\tcfgTplClassicIxr string\n-\n-\t//go:embed configs/sar/sar_config_classic.go.tpl\n-\tcfgTplClassicSar string\n-\n \tkindNames  = []string{\"nokia_srsim\"}\n \tsrosSysctl = map[string]string{\n \t\t\"net.ipv4.ip_forward\":                \"0\",\n \t\t\"net.ipv6.conf.all.disable_ipv6\":     \"0\",\n \t\t\"net.ipv6.conf.default.disable_ipv6\": \"0\",\n@@ -160,15 +140,10 @@ var (\n       e1-2-3       -> card 1, mda 2, port 3\n       e1-2-c3-4    -> card 1, mda 2, connector 3, port 4\n       e1-x2-3-4    -> card 1, xiom 2, mda 3, port 4\n       e1-x2-3-c4-5 -> card 1, xiom 2, mda 3, connector 4, port 5\n \t  eth[0-9], for management interfaces of CPM-A/CPM-B or for fabric interfaces`\n-\t// Auxiliary regexps for IXR/SAR detection.\n-\tsarRegexp   = regexp.MustCompile(`(?i)\\bsar-`)\n-\tsarHmRegexp = regexp.MustCompile(`(?i)\\b(sar-hm|sar-hmc)\\b`)\n-\n-\tixrRegexp = regexp.MustCompile(`(?i)\\bixr-`)\n )\n \n // Register registers the node in the NodeRegistry.\n func Register(r *clabnodes.NodeRegistry) {\n \tgenerateNodeAttributes := clabnodes.NewGenerateNodeAttributes(generateable, generateIfFormat)\n@@ -241,10 +216,14 @@ type sros struct {\n \t// rootCtrName is the container that owns the netns.\n \t//  - for components based: the internal netns container.\n \t//  - for network mode based: parsed from network-mode.\n \trootCtrName string\n \n+\t// userEnv is the env map from the topology, before component fields are merged in.\n+\t// Node env overrides component type, XIOM, MDA, SFM, and per-component env.\n+\tuserEnv map[string]string\n+\n \tpreDeployParams *clabnodes.PreDeployParams\n \n \tnetnsNode clabnodes.Node\n }\n \n@@ -279,16 +258,44 @@ func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) err\n \t// if user was not initialized to a value, use root\n \tif n.Cfg.User == \"\" {\n \t\tn.Cfg.User = \"0:0\"\n \t}\n \n-\tif sfm := n.kindSpecificCfg().SFM; sfm != \"\" {\n+\t// Snapshot topology env before component and SFM flags are applied.\n+\t// Component nodes set userEnv from the base node before Init.\n+\tenvAlreadyResolved := n.userEnv != nil\n+\tif !envAlreadyResolved {\n \t\tif n.Cfg.Env == nil {\n-\t\t\tn.Cfg.Env = map[string]string{}\n+\t\t\tn.userEnv = map[string]string{}\n+\t\t} else {\n+\t\t\tn.userEnv = maps.Clone(n.Cfg.Env)\n \t\t}\n+\t}\n+\tif n.Cfg.Env == nil {\n+\t\tn.Cfg.Env = map[string]string{}\n+\t}\n \n-\t\tn.Cfg.Env[envNokiaSrosSFM] = sfm\n+\t// Distributed cards inherit SFM from the base node env. Applying it again\n+\t// would warn once per card when the user also set NOKIA_SROS_SFM.\n+\tif sfm := n.kindSpecificCfg().SFM; sfm != \"\" && !envAlreadyResolved {\n+\t\tif envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {\n+\t\t\tif envSFM != sfm {\n+\t\t\t\tlog.Warn(\n+\t\t\t\t\tfmt.Sprintf(\n+\t\t\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n+\t\t\t\t\t\tsfm,\n+\t\t\t\t\t\tenvNokiaSrosSFM,\n+\t\t\t\t\t),\n+\t\t\t\t\t\"node\", n.Cfg.ShortName,\n+\t\t\t\t\t\"env\", envNokiaSrosSFM,\n+\t\t\t\t\t\"component-value\", sfm,\n+\t\t\t\t\t\"env-value\", envSFM,\n+\t\t\t\t)\n+\t\t\t}\n+\t\t} else {\n+\t\t\tn.Cfg.Env[envNokiaSrosSFM] = sfm\n+\t\t}\n \t}\n \n \tmaps.Copy(n.Cfg.Sysctls, srosSysctl)\n \n \t// make sure we always have uppercase slot definition\n@@ -316,10 +323,11 @@ func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) err\n \n \t\tvars, err := n.setupStandaloneComponents()\n \t\tif err != nil {\n \t\t\treturn err\n \t\t}\n+\t\twarnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)\n \n \t\t// n.Cfg.Env overrides component vars, overrides default srosEnv\n \t\tn.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)\n \t\tlog.Debug(\"Merged env file\", \"env\", fmt.Sprintf(\"%+v\", n.Cfg.Env), \"node\", n.Cfg.ShortName)\n \t} else {\n@@ -348,12 +356,15 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {\n \tif len(n.kindSpecificCfg().Components) == 0 {\n \t\treturn nil, nil\n \t}\n \tif len(n.kindSpecificCfg().Components) > 1 {\n \t\treturn nil, fmt.Errorf(\n-\t\t\t\"expected at most one component override for standalone SR-SIM node %q\",\n+\t\t\t\"expected at most one component override for standalone SR-SIM node %q, \"+\n+\t\t\t\t\"or one component per slot %s for redundant type %q\",\n \t\t\tn.Cfg.ShortName,\n+\t\t\tstrings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), \"/\"),\n+\t\t\tn.Cfg.NodeType,\n \t\t)\n \t}\n \n \tslotA := n.kindSpecificCfg().Components[0]\n \n@@ -370,27 +381,11 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {\n \t\t\tn.Cfg.ShortName,\n \t\t)\n \t}\n \tvars[envNokiaSrosSlot] = slotName\n \n-\tif slotA.Type != \"\" {\n-\t\tif isSingleSlotIntegratedSrosNodeType(n.Cfg.NodeType) {\n-\t\t\treturn nil, fmt.Errorf(\n-\t\t\t\t\"node %q type %q is integrated and does not support component card-type override\",\n-\t\t\t\tn.Cfg.ShortName,\n-\t\t\t\tn.Cfg.NodeType,\n-\t\t\t)\n-\t\t}\n-\t\tvars[envNokiaSrosCard] = slotA.Type\n-\t}\n-\n-\tif len(slotA.MDA) > 0 {\n-\t\tfor _, m := range slotA.MDA {\n-\t\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n-\t\t\tvars[key] = m.Type\n-\t\t}\n-\t}\n+\tsetComponentEnvVars(vars, slotA)\n \n \tmaps.Copy(vars, slotA.Env)\n \n \treturn vars, nil\n }\n@@ -625,39 +620,10 @@ func (n *sros) Delete(ctx context.Context) error {\n \terrs = append(errs, n.DefaultNode.Delete(ctx), n.netnsNode.Delete(ctx))\n \n \treturn errors.Join(errs...)\n }\n \n-// DeleteNetnsSymlink deletes the symlink file created for the container netns.\n-func (n *sros) DeleteNetnsSymlink() error {\n-\tvar errs []error\n-\n-\t// if it is the base node, then we need to delete the symlink for all the components.\n-\tif n.isDistributedBaseNode() {\n-\t\tfor _, componentNode := range n.componentNodes {\n-\t\t\terrs = append(errs, componentNode.DeleteNetnsSymlink())\n-\t\t}\n-\t\tif n.netnsNode != nil {\n-\t\t\terrs = append(errs, n.netnsNode.DeleteNetnsSymlink())\n-\t\t}\n-\t\terrs = append(errs, clabutils.DeleteNetnsSymlink(n.Cfg.LongName))\n-\t}\n-\n-\terrs = append(errs, n.DefaultNode.DeleteNetnsSymlink(), n.cleanupParkingNetNS())\n-\n-\treturn errors.Join(errs...)\n-}\n-\n-func (n *sros) cleanupParkingNetNS() error {\n-\tname := clabutils.ParkingNetnsName(n.Cfg.LongName)\n-\tif _, err := clabutils.GetNamedNetNS(name); err != nil {\n-\t\treturn nil\n-\t}\n-\n-\treturn netns.DeleteNamed(name)\n-}\n-\n func (n *sros) setupComponentNodes() error {\n \tif !n.isDistributedBaseNode() {\n \t\treturn nil\n \t}\n \n@@ -693,17 +659,16 @@ func (n *sros) setupComponentNodes() error {\n \t\tcomponentConfig.Fqdn = n.calcComponentFqdn(c.Slot)\n \t\tcomponentConfig.DNS = nil\n \t\tcomponentConfig.PortBindings = nil\n \t\tcomponentConfig.PortSet = nil\n \n-\t\t// add the component env to the componentConfig env\n-\t\tfor k, v := range c.Env {\n-\t\t\tcomponentConfig.Env[k] = v\n+\t\t// Component fields fill env keys the user did not set. Node env wins.\n+\t\tif componentConfig.Env == nil {\n+\t\t\tcomponentConfig.Env = map[string]string{}\n \t\t}\n-\n-\t\t// set component environment variables\n-\t\tn.setComponentEnvVars(componentConfig, c)\n+\t\tkeepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)\n+\t\t// Slot identifies this container. A node-level NOKIA_SROS_SLOT cannot apply to every card.\n \t\tcomponentConfig.Env[envNokiaSrosSlot] = c.Slot\n \n \t\t// adjust label based env vars\n \t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.NodeName)] = componentConfig.ShortName\n \t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.LongName)] = componentConfig.LongName\n@@ -716,10 +681,14 @@ func (n *sros) setupComponentNodes() error {\n \t\tcomponentConfig.Labels[clabconstants.NodeName] = componentConfig.ShortName\n \t\tcomponentConfig.Labels[clabconstants.LongName] = componentConfig.LongName\n \t\tcomponentConfig.Labels[clabconstants.RootNodeName] = n.Cfg.ShortName\n \t\tcomponentConfig.Labels[clabconstants.RootNodeLongName] = n.Cfg.LongName\n \n+\t\t// Preserve the topology env. Init must not snapshot the merged component env,\n+\t\t// or config generation would treat component flags as user overrides.\n+\t\tsrosNode.userEnv = maps.Clone(n.userEnv)\n+\n \t\t// init the component\n \t\terr = componentNode.Init(componentConfig)\n \t\tif err != nil {\n \t\t\treturn err\n \t\t}\n@@ -737,32 +706,10 @@ func (n *sros) setupComponentNodes() error {\n \t\tn.componentNodes = append(n.componentNodes, componentNode)\n \t}\n \treturn nil\n }\n \n-// setComponentEnvVars sets environment variables for a component.\n-func (n *sros) setComponentEnvVars(componentConfig *clabtypes.NodeConfig, c *Component) {\n-\tif c.Type != \"\" {\n-\t\tcomponentConfig.Env[envNokiaSrosCard] = c.Type\n-\t}\n-\n-\tfor _, x := range c.XIOM {\n-\t\tkey := fmt.Sprintf(\"%s_X%d\", envNokiaSrosXIOM, x.Slot)\n-\t\tcomponentConfig.Env[key] = x.Type\n-\t\t// add the nested MDA\n-\t\tfor _, m := range x.MDA {\n-\t\t\tkey := fmt.Sprintf(\"%s_X%d_%d\", envNokiaSrosMDA, x.Slot, m.Slot)\n-\t\t\tcomponentConfig.Env[key] = m.Type\n-\t\t}\n-\t}\n-\n-\tfor _, m := range c.MDA {\n-\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n-\t\tcomponentConfig.Env[key] = m.Type\n-\t}\n-}\n-\n // deployFabric deploys the distributed SR-SIM when the `components` key is present.\n func (n *sros) deployFabric(ctx context.Context, deployParams *clabnodes.DeployParams) error {\n \tnetnsConfig := n.netnsNode.Config()\n \n \tnetnsConfig.MgmtIPv4Address = n.Cfg.MgmtIPv4Address\n@@ -870,30 +817,20 @@ func (n *sros) isDistributedCardNode() bool {\n \n // isDistributedBaseNode returns true if this is the base node of a distributed\n // SR-SIM deployment. The base node orchestrates multiple component nodes.\n func (n *sros) isDistributedBaseNode() bool {\n \tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n-\t\treturn false\n+\t\treturn isRedundantIntegratedSrosComponents(n.Cfg.NodeType, n.kindSpecificCfg().Components)\n \t}\n \treturn len(n.kindSpecificCfg().Components) > 1\n }\n \n // isStandaloneNode returns true if this is a standalone (non-distributed) SR-SIM node.\n func (n *sros) isStandaloneNode() bool {\n \treturn !n.isDistributedBaseNode() && !n.isDistributedCardNode()\n }\n \n-// GetNSPath retrieves the Namespace Path.\n-func (n *sros) GetNSPath(ctx context.Context) (string, error) {\n-\tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == \"\") {\n-\t\treturn n.DefaultNode.GetNSPath(ctx)\n-\t} else if n.isDistributedCardNode() {\n-\t\treturn n.Runtime.GetNSPath(ctx, n.rootCtrName)\n-\t}\n-\treturn n.netnsNode.GetNSPath(ctx)\n-}\n-\n // calcComponentName appends the line card suffix to the given node name.\n func (n *sros) calcComponentName(name, slot string) string {\n \tif n.renameDone {\n \t\treturn name\n \t}\n@@ -934,19 +871,18 @@ func (n *sros) cpmNode() (clabnodes.Node, error) {\n }\n \n // cpmSlot returns the Slot of the preferred CPM Node (used when Distributed mode).\n // It prefers slot A if present, otherwise returns slot B.\n func (n *sros) cpmSlot() (string, error) {\n-\t// Prefer slot A, fall back to slot B\n+\t// Prefer slot A, fall back to slot B. Slots are accepted in either case.\n \tfor _, comp := range n.kindSpecificCfg().Components {\n-\t\tif comp.Slot == slotAName {\n+\t\tif strings.EqualFold(comp.Slot, slotAName) {\n \t\t\treturn slotAName, nil\n \t\t}\n \t}\n-\t// Check for slot B as fallback\n \tfor _, comp := range n.kindSpecificCfg().Components {\n-\t\tif comp.Slot == slotBName {\n+\t\tif strings.EqualFold(comp.Slot, slotBName) {\n \t\t\treturn slotBName, nil\n \t\t}\n \t}\n \treturn \"\", fmt.Errorf(\"node %s: unable to determine default slot\", n.GetShortName())\n }\n@@ -1041,33 +977,10 @@ func (*sros) checkKernelVersion() error {\n \t\t)\n \t}\n \treturn nil\n }\n \n-// checkComponentSlotsConfig check the sros component slot config for validity.\n-func (n *sros) checkComponentSlotsConfig() error {\n-\t// check Slots are unique\n-\tcomponentNames := map[string]struct{}{}\n-\tfor _, component := range n.kindSpecificCfg().Components {\n-\t\t// convert slot to upper\n-\t\tslot := strings.ToUpper(component.Slot)\n-\t\t// check if slot exists\n-\t\t_, exists := componentNames[slot]\n-\t\tif exists {\n-\t\t\treturn fmt.Errorf(\n-\t\t\t\t\"node %s slot %s duplicate definition\",\n-\t\t\t\tn.GetShortName(),\n-\t\t\t\tcomponent.Slot,\n-\t\t\t)\n-\t\t}\n-\t\t// add to component names map\n-\t\tcomponentNames[component.Slot] = struct{}{}\n-\n-\t}\n-\treturn nil\n-}\n-\n func (n *sros) CheckDeploymentConditions(ctx context.Context) error {\n \t// perform the sros specific kernel version check\n \terr := n.checkKernelVersion()\n \tif err != nil {\n \t\treturn err\n@@ -1148,13 +1061,53 @@ func (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {\n \tlicensed := append([]byte(chassisInfoFileLicense), content...)\n \tif err := os.WriteFile(dstPath, licensed, clabconstants.PermissionsFileDefault); err != nil {\n \t\treturn fmt.Errorf(\"write %s: %w\", dstPath, err)\n \t}\n \tlog.Debug(\"Wrote chassis_info.json to lab dir\", \"node\", n.Cfg.ShortName, \"path\", dstPath)\n+\tn.warnUnsupportedComponents(content)\n \treturn nil\n }\n \n+// warnUnsupportedComponents validates the effective component configuration against the\n+// chassis_info.json extracted from this exact image. Validation is advisory and never blocks\n+// deploy.\n+func (n *sros) warnUnsupportedComponents(content []byte) {\n+\t// A distributed node validates once, from CPM A, to avoid duplicate warnings from CPM B.\n+\tif !n.isStandaloneNode() && !n.isCPM(slotAName) {\n+\t\treturn\n+\t}\n+\n+\tinfo, err := parseChassisInfo(content)\n+\tif err != nil {\n+\t\tlog.Warn(\"Could not validate SR-SIM components against chassis_info.json\",\n+\t\t\t\"node\", n.Cfg.ShortName, \"error\", err)\n+\t\treturn\n+\t}\n+\n+\tcomponents := n.rootComponents\n+\tif len(components) == 0 {\n+\t\tcomponents = n.kindSpecificCfg().Components\n+\t}\n+\n+\teffective := n.componentsForConfig(components)\n+\tif len(effective) == 0 {\n+\t\t// Environment variables can configure integrated hardware without a components entry.\n+\t\teffective = []*Component{n.componentForConfig(nil)}\n+\t}\n+\n+\tnodeType := n.Cfg.NodeType\n+\tif chassis := strings.TrimSpace(n.Cfg.Env[envNokiaSrosChassis]); chassis != \"\" {\n+\t\tnodeType = chassis\n+\t}\n+\tfor _, warning := range info.componentWarnings(nodeType, n.componentSFM(), effective) {\n+\t\tlog.Warn(\"SR-SIM component configuration may not be supported\",\n+\t\t\t\"node\", n.Cfg.ShortName,\n+\t\t\t\"chassis\", nodeType,\n+\t\t\t\"warning\", warning)\n+\t}\n+}\n+\n // Func that Places the Certificates in the right place and format.\n func (n *sros) createSROSCertificates() error {\n \tif *n.Cfg.Certificate.Issue {\n \t\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),\n \t\t\tclabconstants.PermissionsOpen)\n@@ -1170,88 +1123,10 @@ func (n *sros) createSROSCertificates() error {\n \t\t}\n \t}\n \treturn nil\n }\n \n-// createSROSConfigFiles handles config generation for the SR-SIM kind.\n-// Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).\n-func (n *sros) createSROSConfigFiles() error {\n-\t// Get version from image before generating config\n-\tif n.swVersion == nil {\n-\t\tctx := context.Background()\n-\t\tversion, err := n.srosVersionFromImage(ctx)\n-\t\tif err != nil {\n-\t\t\tn.swVersion = n.parseVersionString(srosDefaultVersion)\n-\t\t\tlog.Warn(\"Failed to get SR OS version from image\",\n-\t\t\t\t\"node\", n.Cfg.ShortName, \"version\", n.swVersion, \"error\", err)\n-\t\t} else {\n-\t\t\tn.swVersion = version\n-\t\t\tlog.Info(\"Retrieved SR OS version from image\",\n-\t\t\t\t\"node\", n.Cfg.ShortName,\n-\t\t\t\t\"version\", fmt.Sprintf(\"%s.%s.%s\", version.Major, version.Minor, version.Build))\n-\t\t}\n-\t}\n-\n-\t// Path pointing to the target config file under configCf3 dir\n-\tcf3CfgFile := filepath.Join(\n-\t\tn.Cfg.LabDir,\n-\t\tn.Cfg.Env[envNokiaSrosSlot],\n-\t\tconfigCf3,\n-\t\tstartupCfgName,\n-\t)\n-\tisPartial := clabutils.IsPartialConfigFile(n.Cfg.StartupConfig)\n-\n-\t// generate config and use that to boot node\n-\tlog.Debug(\"Reading startup-config\", \"node\", n.Cfg.ShortName, \"startup-config\",\n-\t\tn.Cfg.StartupConfig, \"isPartial\", isPartial)\n-\n-\tstartupConfig, err := n.buildStartupConfig(isPartial)\n-\tif err != nil {\n-\t\treturn err\n-\t}\n-\n-\tif startupConfig == \"\" {\n-\t\tlog.Debug(\n-\t\t\t\"startup config is empty, skipping startup config file generation\",\n-\t\t\t\"node\",\n-\t\t\tn.Cfg.ShortName,\n-\t\t)\n-\t\treturn nil\n-\t}\n-\n-\treturn n.GenerateConfig(cf3CfgFile, startupConfig)\n-}\n-\n-// buildStartupConfig returns the full startup config string: either from user file (full config)\n-// or from default + partial config generation. It does not return a template; the name is\n-// historical.\n-func (n *sros) buildStartupConfig(isPartial bool) (string, error) {\n-\t// User provides full startup config\n-\tif n.Cfg.StartupConfig != \"\" && !isPartial {\n-\t\tc, err := os.ReadFile(n.Cfg.StartupConfig)\n-\t\tif err != nil {\n-\t\t\treturn \"\", err\n-\t\t}\n-\n-\t\tcBuf, err := clabutils.SubstituteEnvsAndTemplate(bytes.NewReader(c), n.Cfg)\n-\t\tif err != nil {\n-\t\t\treturn \"\", err\n-\t\t}\n-\t\treturn cBuf.String(), nil\n-\t}\n-\n-\t// Generate default config and optionally add partial config\n-\tif err := n.addDefaultConfig(); err != nil {\n-\t\treturn \"\", err\n-\t}\n-\tif err := n.addPartialConfig(); err != nil {\n-\t\treturn \"\", err\n-\t}\n-\n-\treturn string(n.startupCliCfg), nil\n-}\n-\n // SlotIsInteger checks if the slot string represents a valid integer.\n func SlotIsInteger(s string) bool {\n \t_, err := strconv.Atoi(s)\n \treturn err == nil\n }\n@@ -1279,221 +1154,10 @@ func (n *sros) isCPM(cpm string) bool {\n \t}\n \n \treturn true\n }\n \n-// prepareConfigTemplateData prepares all data needed for template selection and execution.\n-// Service configs are filled from a single table-driven result: variant → getFullSnippetSet(v).\n-func (n *sros) prepareConfigTemplateData() (*srosTemplateData, error) {\n-\tb, err := n.banner()\n-\tif err != nil {\n-\t\treturn nil, err\n-\t}\n-\n-\tcomponentConfig := \"\"\n-\tif !isFullConfigFile(n.Cfg.StartupConfig) {\n-\t\tcomponentConfig = n.generateComponentConfig()\n-\t} else {\n-\t\tlog.Debugf(\n-\t\t\t\"SR-SIM node %q has non-partial startup-config defined, skipping component config gen\",\n-\t\t\tn.Cfg.LongName,\n-\t\t)\n-\t}\n-\n-\tv := n.resolveConfigVariant()\n-\tsnippets := getFullSnippetSet(v)\n-\tconfigMode := string(v.Mode)\n-\tif v.ForceClassic {\n-\t\tlog.Warn(\n-\t\t\t\"SAR-Hm nodes only support classic configuration mode. Overriding configuration mode to 'classic'\",\n-\t\t\t\"node\",\n-\t\t\tn.Cfg.LongName,\n-\t\t\t\"node-type\",\n-\t\t\tstrings.ToLower(n.Cfg.NodeType),\n-\t\t)\n-\t\tconfigMode = string(ConfigModeClassic)\n-\t\tn.kindSpecificCfg().ConfigMode = ConfigModeClassic\n-\t}\n-\n-\ttplData := &srosTemplateData{\n-\t\t// Selection criteria\n-\t\tNodeType:          strings.ToLower(n.Cfg.NodeType),\n-\t\tConfigurationMode: configMode,\n-\t\tSwVersion:         n.swVersion,\n-\t\tIsSecureGrpc:      *n.Cfg.Certificate.Issue,\n-\n-\t\t// Node data\n-\t\tName:            n.Cfg.ShortName,\n-\t\tTLSKey:          n.Cfg.TLSKey,\n-\t\tTLSCert:         n.Cfg.TLSCert,\n-\t\tTLSAnchor:       n.Cfg.TLSAnchor,\n-\t\tBanner:          b,\n-\t\tIFaces:          map[string]tplIFace{},\n-\t\tMgmtMTU:         0,\n-\t\tMgmtIPMTU:       n.Runtime.Mgmt().MTU,\n-\t\tComponentConfig: componentConfig,\n-\n-\t\t// Service configs from variant (single source of truth)\n-\t\tSystemConfig:  snippets.SystemConfig,\n-\t\tGRPCConfig:    snippets.GRPCConfig,\n-\t\tSNMPConfig:    snippets.SNMPConfig,\n-\t\tNetconfConfig: snippets.NetconfConfig,\n-\t\tLoggingConfig: snippets.LoggingConfig,\n-\t\tSSHConfig:     snippets.SSHConfig,\n-\t}\n-\n-\tif n.Config().DNS != nil {\n-\t\ttplData.DNSServers = append(tplData.DNSServers, n.Config().DNS.Servers...)\n-\t}\n-\n-\tn.prepareSSHPubKeys(tplData)\n-\n-\tn.setVersionSpecificParams(tplData)\n-\n-\treturn tplData, nil\n-}\n-\n-// isIXRNode returns true if this is an IXR node type (case-insensitive).\n-func (n *sros) isIXRNode() bool {\n-\treturn ixrRegexp.MatchString(n.Cfg.NodeType)\n-}\n-\n-// isSARNode returns true if this is a SAR node type (case-insensitive).\n-func (n *sros) isSARNode() bool {\n-\treturn sarRegexp.MatchString(n.Cfg.NodeType)\n-}\n-\n-// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).\n-func (n *sros) isSARHmNode() bool {\n-\treturn sarHmRegexp.MatchString(n.Cfg.NodeType)\n-}\n-\n-// getTemplateForVariant returns the template string and name for the given config variant.\n-// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= \"26\").\n-func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {\n-\t// Model-driven (or mixed treated as classic below when family is classic)\n-\tif v.Mode == ConfigModeModelDriven {\n-\t\t// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= \"26\"\n-\t\t// { return cfgTplSROS26, \"clab-sros-config-sros26\" }\n-\t\treturn cfgTplSROS25, \"clab-sros-config-sros25\"\n-\t}\n-\t// Classic (or mixed)\n-\ttmpl = cfgTplClassic\n-\ttplName = \"clab-sros-config-classic\"\n-\tswitch v.Family {\n-\tcase ConfigFamilyIXR:\n-\t\treturn cfgTplClassicIxr, \"clab-sros-config-classic-ixr\"\n-\tcase ConfigFamilySAR:\n-\t\treturn cfgTplClassicSar, \"clab-sros-config-classic-sar\"\n-\tdefault:\n-\t\treturn tmpl, tplName\n-\t}\n-}\n-\n-// selectConfigTemplate chooses the config template from the config variant (mode + family).\n-func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {\n-\tv := n.resolveConfigVariant()\n-\ttmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)\n-\treturn template.New(tplName).\n-\t\tFuncs(clabutils.CreateFuncs()).\n-\t\tParse(tmpl)\n-}\n-\n-// addDefaultConfig adds sros default configuration such as tls certs, gnmi/json-rpc, login-banner,\n-// ssh keys.\n-func (n *sros) addDefaultConfig() error {\n-\t// Prepare all template data\n-\ttplData, err := n.prepareConfigTemplateData()\n-\tif err != nil {\n-\t\treturn err\n-\t}\n-\n-\t// Select appropriate template\n-\tsrosCfgTpl, err := n.selectConfigTemplate(tplData)\n-\tif err != nil {\n-\t\treturn fmt.Errorf(\"failed to select config template: %w\", err)\n-\t}\n-\tlog.Debug(\"Prepare SR OS config template\", \"template\", srosCfgTpl.Name(),\n-\t\t\"node\", n.Cfg.LongName,\n-\t\t\"configuration-mode\", tplData.ConfigurationMode,\n-\t\t\"node-type\", tplData.NodeType,\n-\t\t\"secure-grpc\", tplData.IsSecureGrpc,\n-\t\t\"sw-version\", tplData.SwVersion)\n-\n-\t// Execute template\n-\tbuf := new(bytes.Buffer)\n-\terr = srosCfgTpl.Execute(buf, tplData)\n-\tif err != nil {\n-\t\treturn err\n-\t}\n-\n-\tif buf.Len() == 0 {\n-\t\tlog.Warn(\n-\t\t\t\"Buffer empty, template parsing error\",\n-\t\t\t\"node\", n.Cfg.ShortName,\n-\t\t\t\"template\", srosCfgTpl.Name(),\n-\t\t)\n-\t} else {\n-\t\tlog.Debug(\"Additional default config parsed\",\n-\t\t\t\"node\", n.Cfg.ShortName,\n-\t\t\t\"template\", srosCfgTpl.Name())\n-\t\tn.startupCliCfg = append(n.startupCliCfg, buf.String()...)\n-\t}\n-\n-\treturn nil\n-}\n-\n-// applyPartialConfig applies partial configuration to the SR OS.\n-func (n *sros) addPartialConfig() error {\n-\tif n.Cfg.StartupConfig != \"\" {\n-\t\t// b holds the configuration to be applied to the node\n-\t\tb := &bytes.Buffer{}\n-\t\t// apply partial configs if partial config is used\n-\t\tif clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM(\"\") {\n-\t\t\tlog.Info(\"Adding configuration\",\n-\t\t\t\t\"node\", n.Cfg.LongName,\n-\t\t\t\t\"type\", \"partial\",\n-\t\t\t\t\"source\", n.Cfg.StartupConfig)\n-\n-\t\t\tr, err := os.Open(n.Cfg.StartupConfig)\n-\t\t\tif err != nil {\n-\t\t\t\treturn err\n-\t\t\t}\n-\n-\t\t\tdefer r.Close() // skipcq: GO-S2307\n-\n-\t\t\t_, err = io.Copy(b, r)\n-\t\t\tif err != nil {\n-\t\t\t\treturn err\n-\t\t\t}\n-\n-\t\t\tconfigContent, err := clabutils.SubstituteEnvsAndTemplate(b, n.Cfg)\n-\t\t\tif err != nil {\n-\t\t\t\treturn err\n-\t\t\t}\n-\t\t\tif configContent.Len() == 0 {\n-\t\t\t\tlog.Warn(\n-\t\t\t\t\t\"Buffer empty, PARTIAL config template parsing error\",\n-\t\t\t\t\t\"node\",\n-\t\t\t\t\tn.Cfg.ShortName,\n-\t\t\t\t)\n-\t\t\t} else {\n-\t\t\t\tlog.Debug(\"Additional PARTIAL config parsed\", \"node\",\n-\t\t\t\t\tn.Cfg.ShortName, \"partial-config\", configContent.String())\n-\t\t\t\tn.startupCliCfg = append(n.startupCliCfg, configContent.String()...)\n-\t\t\t}\n-\t\t} else {\n-\t\t\tlog.Warn(\n-\t\t\t\t\"Passed startup-config option, but it will not have any effect\",\n-\t\t\t\t\"node\",\n-\t\t\t\tn.Cfg.ShortName,\n-\t\t\t)\n-\t\t}\n-\t}\n-\treturn nil\n-}\n-\n func (n *sros) GetContainers(ctx context.Context) ([]clabruntime.GenericContainer, error) {\n \t// if not a distributed setup call regular GetContainers\n \tif n.isStandaloneNode() || n.isDistributedCardNode() {\n \t\treturn n.DefaultNode.GetContainers(ctx)\n \t}\n@@ -1761,63 +1425,10 @@ func (n *sros) saveConfigWithAddr(ctx context.Context, addr string) error {\n \t)\n \n \treturn nil\n }\n \n-// BuildPKIImportXML.\n-func buildPKIImportXML(inputURL, outputFile, importType string) string {\n-\taction := etree.NewElement(\"action\")\n-\taction.CreateAttr(\"xmlns\", \"urn:ietf:params:xml:ns:yang:1\")\n-\n-\tadmin := action.CreateElement(\"admin\")\n-\tadmin.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:oper-admin\")\n-\n-\timportElem := admin.CreateElement(\"system\").\n-\t\tCreateElement(\"security\").\n-\t\tCreateElement(\"pki\").\n-\t\tCreateElement(\"import\")\n-\n-\t// Add import parameters\n-\timportElem.CreateElement(\"input-url\").SetText(inputURL)\n-\timportElem.CreateElement(\"output-file\").SetText(outputFile)\n-\timportElem.CreateElement(\"type\").SetText(importType)\n-\timportElem.CreateElement(\"format\").SetText(\"pem\")\n-\tvar buf bytes.Buffer\n-\taction.WriteTo(&buf, &etree.WriteSettings{\n-\t\tCanonicalText:    false,\n-\t\tCanonicalAttrVal: false,\n-\t})\n-\treturn buf.String()\n-}\n-\n-// BuildTLSProfileXML builds the TLS profile configuration XML.\n-func buildTLSProfileXML() string {\n-\tconfig := etree.NewElement(\"config\")\n-\tconfigure := config.CreateElement(\"configure\")\n-\tconfigure.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:conf\")\n-\tconfigure.CreateAttr(\"xmlns:nc\", \"urn:ietf:params:xml:ns:netconf:base:1.0\")\n-\n-\tcertProfile := configure.CreateElement(\"system\").\n-\t\tCreateElement(\"security\").\n-\t\tCreateElement(\"tls\").\n-\t\tCreateElement(\"cert-profile\")\n-\n-\t// Set operation attribute\n-\tcertProfile.CreateAttr(\"nc:operation\", \"merge\")\n-\n-\t// Add profile configuration\n-\tcertProfile.CreateElement(\"cert-profile-name\").SetText(tlsCertProfileName)\n-\tcertProfile.CreateElement(\"admin-state\").SetText(\"enable\")\n-\n-\tvar buf bytes.Buffer\n-\tconfig.WriteTo(&buf, &etree.WriteSettings{\n-\t\tCanonicalText:    false,\n-\t\tCanonicalAttrVal: false,\n-\t})\n-\treturn buf.String()\n-}\n-\n // TLS bootstrap via NETCONF to enable secure gRPC.\n func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {\n \t// Always import PKI key and cert:\n \t// \t import \"cf3:\\node.key\" in PEM format as \"cf3:\\system-pki\\node.key\" (encrypted DER)\n \t//   import \"cf3:\\node.crt\" in PEM format as \"cf3:\\system-pki\\node.crt\" (encrypted DER)\n@@ -1867,23 +1478,10 @@ func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {\n \t\t}\n \t}\n \treturn err\n }\n \n-// isConfigClassic reports whether the node is in classic or mixed configuration mode.\n-func (n *sros) isConfigClassic() bool {\n-\tmode := n.kindSpecificCfg().ConfigMode\n-\treturn mode == ConfigModeClassic || mode == ConfigModeMixed\n-}\n-\n-// isFullConfigFile returns true if the config file doesn't contain .partial substring\n-// and the config file is NOT nil (ie. startup config IS defined).\n-// it is intended that the 'c' arg is n.Cfg.StartupConfig.\n-func isFullConfigFile(c string) bool {\n-\treturn c != \"\" && !clabutils.IsPartialConfigFile(c)\n-}\n-\n func (n *sros) IsHealthy(_ context.Context) (bool, error) {\n \tif !n.isCPM(\"\") {\n \t\treturn true, fmt.Errorf(\"node %q is not a CPM, healthcheck has no effect\", n.Cfg.LongName)\n \t}\n \t// non-partial user startup config might not have any netconf config\n@@ -2082,67 +1680,10 @@ func (n *sros) MgmtIPAddr() (string, error) {\n \t\t\"no management IP address (IPv4 or IPv6) configured for node %q\",\n \t\tn.Cfg.LongName,\n \t)\n }\n \n-// generateComponentConfig generates SR OS configuration for explicitly defined distributed\n-// components or known integrated SR-SIM defaults. Power config is appended when supported.\n-func (n *sros) generateComponentConfig() string {\n-\tif !n.kindSpecificCfg().GenComponentConfig {\n-\t\treturn \"\"\n-\t}\n-\tif n.isConfigClassic() {\n-\t\treturn \"\"\n-\t}\n-\n-\tcomponents := n.rootComponents\n-\tif len(components) == 0 {\n-\t\tif len(n.kindSpecificCfg().Components) > 1 || n.rootCtrName != \"\" {\n-\t\t\treturn \"\"\n-\t\t}\n-\n-\t\tlines := buildIntegratedComponentCfgLines(n.Cfg.NodeType, n.Cfg.Env)\n-\t\tif len(lines) == 0 {\n-\t\t\treturn \"\"\n-\t\t}\n-\t\treturn n.componentConfigFromLines(lines)\n-\t}\n-\n-\tfor _, c := range components {\n-\t\tslot := strings.ToUpper(strings.TrimSpace(c.Slot))\n-\t\tif slot == slotAName || slot == slotBName {\n-\t\t\tcontinue\n-\t\t}\n-\t\tif c.Type == \"\" {\n-\t\t\tlog.Warn(\n-\t\t\t\t\"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.\",\n-\t\t\t\t\"node\",\n-\t\t\t\tn.Cfg.ShortName,\n-\t\t\t\t\"slot\",\n-\t\t\t\tslot,\n-\t\t\t)\n-\t\t}\n-\t}\n-\n-\tlines := buildComponentCfgLines(components, n.kindSpecificCfg().SFM)\n-\treturn n.componentConfigFromLines(lines)\n-}\n-\n-func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {\n-\tpowerConfig := n.generatePowerConfig()\n-\tif len(lines) == 0 && powerConfig == \"\" {\n-\t\treturn \"\"\n-\t}",
        "lineStart": 1201,
        "lineEnd": 2500,
        "totalLines": 3945,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346607611,
      "end": 1792346607626
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502ed00f001UBv5fRICi0djFP",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502ec44d001escZDwyW8y5PXF",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 83075,
    "input": 15451,
    "output": 27,
    "reasoning": 13,
    "cache": {
      "read": 67584,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502ec44d001escZDwyW8y5PXF",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346604621,
    "completed": 1792346607636
  },
  "parentID": "msg_1502e41aa001XEn2l1GdfLHjHR",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 83075,
    "input": 15451,
    "output": 27,
    "reasoning": 13,
    "cache": {
      "read": 67584,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 21
step-start
{
  "type": "step-start",
  "id": "prt_1502ef89d001aST6NBLqP9SrwQ",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502ed01c001YCpcFvJ3o9WYH6"
}
Reasoning
Continuing diff read from 2501. Also I need to check the `srosEnv` global mutation issue — is it pre-existing? The diff at line 309 of head shows `srosEnv[envNokiaSrosChassis] = n.Cfg.NodeType` unchanged (not in diff), so pre-existing.

One notable behavior change: previously `setupStandaloneComponents` rejected a component `type` override on integrated single-slot node types ("isSingleSlotIntegratedSrosNodeType" check). Now it allows it and sets NOKIA_SROS_CARD, and `generateIntegratedComponentConfig` skips generation when NOKIA_SROS_CARD set. The test "single_slot_integrated_allows_card_type_override" covers this. OK, intentional per docs.

Now `generateIntegratedComponentConfig` reads `n.Cfg.Env[envNokiaSrosCard]` — but per docs, node env `NOKIA_SROS_CARD` should also skip generation. For a standalone node without components, `n.Cfg.Env` contains merged env including user's `NOKIA_SROS_CARD` (via MergeStringMaps(srosEnv, vars, n.Cfg.Env)), so it works. For distributed linecard? Not integrated so not applicable. For component nodes of redundant ixr-r6: componentConfig.Env includes node env (keepUserEnv copies user env? Actually keepUserEnv copies only derived keys; the base componentConfig comes from deep.Copy(n.Cfg) which already includes node env). Fine.

But wait — for integrated redundant (ixr-r6 with A and B), the base node itself: isDistributedBaseNode → true. The base node's own `generateComponentConfig`? During PreDeploy of component nodes only. But the base node's `createSROSFiles` — is base node PreDeploy invoked? In deployFabric, only componentNodes PreDeploy. Hmm, but the framework calls PreDeploy on all nodes? Let's check: in the lab deploy flow, nodes are deployed via n.Deploy for each node in topology. The base node IS a topology node. Does base node get PreDeploy called? Looking at deployFabric — it calls `c.PreDeploy(ctx, n.preDeployParams)` for components. And `n.preDeployParams` is set in base's PreDeploy. So base's PreDeploy IS called by the framework (setting preDeployParams), then in PreDeploy: `if n.isStandaloneNode() || (n.isDistributedCardNode() && n.isCPM(""))` — for distributed base, both false → returns nil, no files created. OK so base node doesn't create config files; components do. And components: `n.isDistributedCardNode()` — for CPM A of ixr-r6 redundant: userEnv != nil set by base; Cfg.Env has NOKIA_SROS_SLOT (set to c.Slot); kindSpecificCfg().Components is nil (cleared) → isDistributedCardNode returns true. So PreDeploy proceeds: isCPM("") true (slot "A" non-integer). createSROSFiles → createSROSConfigFiles → buildStartupConfig → prepareConfigTemplateData → generateComponentConfig → isIntegratedSrosNodeType("ixr-r6") true → generateIntegratedComponentConfig: reads n.Cfg.Env[NOKIA_SROS_CARD]. For ixr-r6 redundant with component A having no Type, env var set? setComponentEnvVars sets envNokiaSrosCard only if Type != "". So empty → proceed. buildIntegratedComponentCfgLines with override = integratedComponentOverride(): rootCtrName != "" (set by base) → slot = n.Cfg.Env[NOKIA_SROS_SLOT] = "A" → find rootComponents entry with slot A → the component with MDA override → good. CPM B: override matches B, which has empty MDA → generates default config. Test covers.

Now, `integratedComponentOverride` when rootCtrName == "": `len(n.kindSpecificCfg().Components) == 1` returns components[0]. But if components is empty (env-only integrated), returns nil → buildIntegratedComponentCfgLines with nil override → fine.

Now potential bug: `generateIntegratedComponentConfig` checks `n.Cfg.Env[envNokiaSrosCard]` but for distributed linecard component nodes of a NON-integrated type... not applicable.

But consider: integrated node type with node-level env `NOKIA_SROS_CARD` set by user (no components). generateIntegratedComponentConfig reads Cfg.Env — user env merged into Cfg.Env. Good.

However `componentSFM` uses `hardwareEnv()` which prefers userEnv. Fine.

Now, an important subtle bug candidate: In `warnUnsupportedComponents`, for a standalone integrated node with components, `n.Cfg.Env[envNokiaSrosChassis]` — srosEnv sets envNokiaSrosChassis = NodeType in Init. So nodeType = chassis = NodeType. Fine.

Another: `applyHardwareEnv` — per-component env also includes non-hardware keys; fine.

Now, `keepUserEnv`: for componentConfig.Env — deep copy of n.Cfg includes node env (merged with srosEnv, which includes NOKIA_SROS_CHASSIS=NodeType and NOKIA_SROS_SYSTEM_BASE_MAC and possibly SFM). Derived component env fills keys user did not set. But note: keepUserEnv does NOT remove node env keys that components would set differently... it does: userEnv[key] exists → dst[key] = envValue (user). Fine.

Wait, there's a subtle problem: in the standalone path, `warnUserEnvOverrides` is called BEFORE the merge... with `vars` (component derived env incl. per-component env copy) and n.userEnv. Good.

Now potential issue: `setupStandaloneComponents` sets `vars[envNokiaSrosSlot] = slotName` even when components empty? No — early return nil if len==0. If empty, srosEnv provides default slot A. OK.

Now: srosEnv mutation — package-level map mutated per node Init. Pre-existing.

Now the diff so far. Let me continue reading from 2501.
read · completed

Input

{
  "filePath": "/source/diff.txt",
  "limit": 1445,
  "offset": 2501
}

Output

<path>/source/diff.txt</path>
<type>file</type>
<content>
2501: -
2502: -	var config strings.Builder
2503: -	for _, l := range lines {
2504: -		config.WriteString(l.String())
2505: -	}
2506: -	config.WriteString(powerConfig)
2507: -	return config.String()
2508: -}
2509: -
2510:  // override to fetch CPM to avoid renaming the base node to CPM A.
2511:  func (n *sros) GetContainerName() string {
2512:  	if n.isDistributedBaseNode() && n.cpmContainerName != "" {
2513:  		return n.cpmContainerName
2514:  	}
2515: @@ -2365,32 +1906,5 @@ func (n *sros) RestoreEndpoints(ctx context.Context) error {
2516:  	if err != nil {
2517:  		return err
2518:  	}
2519:  	return clabutils.LinkContainerNS(nsPath, n.Cfg.LongName)
2520:  }
2521: -
2522: -func (n *sros) ensureNetnsRunning(ctx context.Context) error {
2523: -	switch status := n.netnsNode.GetContainerStatus(ctx); status {
2524: -	case clabruntime.Running:
2525: -		// The namespace holder intentionally survives regular node lifecycle operations.
2526: -	case clabruntime.Created, clabruntime.Stopped:
2527: -		if err := n.netnsNode.Start(ctx); err != nil {
2528: -			return fmt.Errorf("node %q network namespace container start error: %w",
2529: -				n.Cfg.ShortName, err)
2530: -		}
2531: -	case clabruntime.Paused:
2532: -		if err := n.Runtime.UnpauseContainer(ctx, n.netnsNode.Config().LongName); err != nil {
2533: -			return fmt.Errorf("node %q network namespace container unpause error: %w",
2534: -				n.Cfg.ShortName, err)
2535: -		}
2536: -	case clabruntime.NotFound:
2537: -		return fmt.Errorf(
2538: -			"node %q network namespace container %q not found; recreate the node",
2539: -			n.Cfg.ShortName, n.netnsNode.Config().LongName,
2540: -		)
2541: -	default:
2542: -		return fmt.Errorf("node %q network namespace container %q is %s",
2543: -			n.Cfg.ShortName, n.netnsNode.Config().LongName, status)
2544: -	}
2545: -
2546: -	return nil
2547: -}
2548: diff --git a/nodes/sros/sros_test.go b/nodes/sros/sros_test.go
2549: index 29cace9..dd8aea6 100644
2550: --- a/nodes/sros/sros_test.go
2551: +++ b/nodes/sros/sros_test.go
2552: @@ -272,10 +272,16 @@ func Test_sros_generateComponentConfig(t *testing.T) {
2553:  			name:     "integrated_ixr_e3x_default",
2554:  			nodeType: "ixr-e3x",
2555:  			cardType: "imm16-sfp112+15-sfp56+6-qsfpdd",
2556:  			mdas:     MDAS{{Slot: 1, Type: "m16-sfp112+15-sfp56+6-qsfpdd"}},
2557:  		},
2558: +		{
2559: +			name:     "integrated_ixr_e2sc_default",
2560: +			nodeType: "ixr-e2sc",
2561: +			cardType: "imm16-sfp++4-sfp28",
2562: +			mdas:     MDAS{{Slot: 1, Type: "m16-sfp++4-sfp28"}},
2563: +		},
2564:  		{
2565:  			name:     "integrated_ixr_ec_default",
2566:  			nodeType: "ixr-ec",
2567:  			cardType: "imm4-1g-tx+20-1g-sfp+6-10g-sfp+",
2568:  			mdas:     MDAS{{Slot: 1, Type: "m4-1g-tx+20-1g-sfp+6-10g-sfp+"}},
2569: @@ -311,40 +317,116 @@ func Test_sros_generateComponentConfig(t *testing.T) {
2570:  				assert.Equal(t, 4, strings.Count(cfg, "power-module-type ps-a-dc-6000"))
2571:  			}
2572:  		})
2573:  	}
2574:  
2575: -	t.Run("integrated_env_overrides_preserve_default_mda_slots", func(t *testing.T) {
2576: +	t.Run("integrated_component_mda_override_preserves_default_mda_slots", func(t *testing.T) {
2577: +		n := newSrosComponentConfigTestNode("sr-1", nil, []*Component{
2578: +			{MDA: MDAS{{Slot: 1, Type: "custom-mda"}}},
2579: +		})
2580: +
2581: +		cfg := n.generateComponentConfig()
2582: +
2583: +		assert.Contains(t, cfg, "/configure card 1 card-type iom-1 admin-state enable")
2584: +		assert.Contains(t, cfg, "/configure card 1 mda 1 mda-type custom-mda admin-state enable")
2585: +		assert.Contains(
2586: +			t,
2587: +			cfg,
2588: +			"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable",
2589: +		)
2590: +	})
2591: +
2592: +	t.Run("integrated_xiom_replaces_default_mdas", func(t *testing.T) {
2593: +		n := newSrosComponentConfigTestNode("sr-1s", nil, []*Component{
2594: +			{
2595: +				XIOM: XIOMS{
2596: +					{
2597: +						Slot: 1,
2598: +						Type: "iom-s-3.0t",
2599: +						MDA: MDAS{
2600: +							{Slot: 1, Type: "ms18-100gb-qsfp28"},
2601: +							{Slot: 2, Type: "ms2-400gb-qsfpdd+2-100gb-qsfp28"},
2602: +						},
2603: +					},
2604: +				},
2605: +			},
2606: +		})
2607: +
2608: +		cfg := n.generateComponentConfig()
2609: +
2610: +		assert.Contains(t, cfg, "/configure card 1 card-type xcm-1s admin-state enable")
2611: +		assert.Contains(t, cfg, "/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable")
2612: +		assert.Contains(
2613: +			t,
2614: +			cfg,
2615: +			"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable",
2616: +		)
2617: +		assert.Contains(
2618: +			t,
2619: +			cfg,
2620: +			"/configure card 1 xiom x1 mda 2 mda-type ms2-400gb-qsfpdd+2-100gb-qsfp28 admin-state enable",
2621: +		)
2622: +		assert.NotContains(t, cfg, "s36-100gb-qsfp28")
2623: +	})
2624: +
2625: +	t.Run("integrated_env_mda_overrides_default_component_config", func(t *testing.T) {
2626:  		n := newSrosComponentConfigTestNode(
2627:  			"sr-1",
2628: -			map[string]string{
2629: -				envNokiaSrosCard:       "env-card",
2630: -				envNokiaSrosMDA + "_1": "env-mda",
2631: -			},
2632: +			map[string]string{envNokiaSrosMDA + "_1": "env-mda"},
2633:  			nil,
2634:  		)
2635:  
2636:  		cfg := n.generateComponentConfig()
2637:  
2638: -		assert.Contains(t, cfg, "/configure card 1 card-type env-card admin-state enable")
2639: -		assert.Contains(t, cfg, "/configure card 1 mda 1 mda-type env-mda admin-state enable")
2640: +		assert.Contains(
2641: +			t,
2642: +			cfg,
2643: +			"/configure card 1 mda 1 mda-type env-mda admin-state enable",
2644: +		)
2645:  		assert.Contains(
2646:  			t,
2647:  			cfg,
2648:  			"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable",
2649:  		)
2650: +		assert.NotContains(t, cfg, "me6-100gb-qsfp28")
2651:  	})
2652:  
2653: -	t.Run("integrated_env_override_adds_mda_slot", func(t *testing.T) {
2654: +	t.Run("integrated_env_mda_overrides_component_mda", func(t *testing.T) {
2655:  		n := newSrosComponentConfigTestNode(
2656: -			"ixr-r6",
2657: +			"sr-1",
2658: +			map[string]string{envNokiaSrosMDA + "_1": "from-env"},
2659: +			[]*Component{{MDA: MDAS{{Slot: 1, Type: "from-component"}}}},
2660: +		)
2661: +
2662: +		cfg := n.generateComponentConfig()
2663: +
2664: +		assert.Contains(
2665: +			t,
2666: +			cfg,
2667: +			"/configure card 1 mda 1 mda-type from-env admin-state enable",
2668: +		)
2669: +		assert.NotContains(t, cfg, "from-component")
2670: +	})
2671: +
2672: +	t.Run("integrated_card_override_skips_component_config", func(t *testing.T) {
2673: +		n := newSrosComponentConfigTestNode(
2674: +			"sr-1s",
2675:  			map[string]string{
2676: -				envNokiaSrosMDA + "_3": "m20-1g-csfp",
2677: +				envNokiaSrosCard:       "cpm-1s",
2678: +				envNokiaSrosMDA + "_1": "env-mda",
2679:  			},
2680:  			nil,
2681:  		)
2682:  
2683: +		assert.Empty(t, n.generateComponentConfig())
2684: +	})
2685: +
2686: +	t.Run("integrated_component_override_adds_mda_slot", func(t *testing.T) {
2687: +		n := newSrosComponentConfigTestNode("ixr-r6", nil, []*Component{
2688: +			{MDA: MDAS{{Slot: 3, Type: "m20-1g-csfp"}}},
2689: +		})
2690: +
2691:  		cfg := n.generateComponentConfig()
2692:  
2693:  		assert.Contains(
2694:  			t,
2695:  			cfg,
2696: @@ -415,41 +497,174 @@ func Test_sros_integratedComponentOverrides(t *testing.T) {
2697:  		require.NoError(t, err)
2698:  		assert.True(t, n.isStandaloneNode())
2699:  		assert.Equal(t, slotBName, n.Cfg.Env[envNokiaSrosSlot])
2700:  		assert.Equal(t, "cpiom-ixr-r6", n.Cfg.Env[envNokiaSrosCard])
2701:  		assert.Equal(t, "m20-1g-csfp", n.Cfg.Env[envNokiaSrosMDA+"_3"])
2702: +
2703: +		assert.Empty(t, n.generateComponentConfig())
2704: +	})
2705: +
2706: +	t.Run("integrated_component_xiom_sets_env", func(t *testing.T) {
2707: +		n := newSrosInitTestNode("sr-1s", []*Component{
2708: +			{
2709: +				XIOM: XIOMS{
2710: +					{
2711: +						Slot: 1,
2712: +						Type: "iom-s-3.0t",
2713: +						MDA:  MDAS{{Slot: 1, Type: "ms18-100gb-qsfp28"}},
2714: +					},
2715: +				},
2716: +			},
2717: +		})
2718: +
2719: +		require.NoError(t, n.Init(n.Cfg))
2720: +		assert.Equal(t, "iom-s-3.0t", n.Cfg.Env[envNokiaSrosXIOM+"_X1"])
2721: +		assert.Equal(t, "ms18-100gb-qsfp28", n.Cfg.Env[envNokiaSrosMDA+"_X1_1"])
2722: +
2723: +		cfg := n.generateComponentConfig()
2724: +		assert.Contains(t, cfg, "/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable")
2725: +		assert.Contains(
2726: +			t,
2727: +			cfg,
2728: +			"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable",
2729: +		)
2730:  	})
2731:  
2732:  	t.Run("integrated_rejects_multiple_components", func(t *testing.T) {
2733: +		for _, tc := range []struct {
2734: +			nodeType   string
2735: +			components []*Component
2736: +		}{
2737: +			{"sr-1", []*Component{{Slot: slotAName}, {Slot: slotBName}}},
2738: +			{"ixr-r6", []*Component{{Slot: slotAName}, {Slot: "1"}}},
2739: +			{"ixr-r6", []*Component{{Slot: slotAName}, {}}},
2740: +		} {
2741: +			n := newSrosInitTestNode(tc.nodeType, tc.components)
2742: +
2743: +			err := n.Init(n.Cfg)
2744: +
2745: +			require.Error(t, err, tc.nodeType)
2746: +			assert.Contains(t, err.Error(), "at most one component override")
2747: +		}
2748: +	})
2749: +
2750: +	t.Run("redundant_integrated_components_are_distributed", func(t *testing.T) {
2751:  		n := newSrosInitTestNode("ixr-r6", []*Component{
2752: -			{Slot: slotAName, Type: "cpiom-ixr-r6"},
2753: -			{Slot: slotBName, Type: "cpiom-ixr-r6"},
2754: +			{Slot: slotAName, MDA: MDAS{{Slot: 3, Type: "m20-1g-csfp"}}},
2755: +			{Slot: slotBName},
2756:  		})
2757:  
2758: -		err := n.Init(n.Cfg)
2759: +		require.NoError(t, n.Init(n.Cfg))
2760: +		assert.True(t, n.isDistributedBaseNode())
2761: +		require.Len(t, n.componentNodes, 2)
2762: +
2763: +		cpmA := n.componentNodes[0].(*sros)
2764: +		cpmB := n.componentNodes[1].(*sros)
2765: +		assert.Equal(t, slotAName, cpmA.Config().Env[envNokiaSrosSlot])
2766: +		assert.Equal(t, slotBName, cpmB.Config().Env[envNokiaSrosSlot])
2767: +		assert.Equal(t, "container:n1-netns", cpmA.Config().NetworkMode)
2768: +		assert.Equal(t, "container:n1-netns", cpmB.Config().NetworkMode)
2769: +
2770: +		cfgA := cpmA.generateComponentConfig()
2771: +		assert.Contains(t, cfgA, "/configure card 1 card-type iom-ixr-r6 admin-state enable")
2772: +		assert.Contains(
2773: +			t,
2774: +			cfgA,
2775: +			"/configure card 1 mda 1 mda-type m6-10g-sfp++1-100g-qsfp28 admin-state enable",
2776: +		)
2777: +		assert.Contains(t, cfgA, "/configure card 1 mda 3 mda-type m20-1g-csfp admin-state enable")
2778: +
2779: +		cfgB := cpmB.generateComponentConfig()
2780: +		assert.Contains(t, cfgB, "/configure card 1 card-type iom-ixr-r6 admin-state enable")
2781: +		assert.NotContains(t, cfgB, "m20-1g-csfp")
2782: +	})
2783: +
2784: +	t.Run("lowercase_integrated_slots_resolve_to_cpm_a", func(t *testing.T) {
2785: +		n := newSrosInitTestNode("ixr-r6", []*Component{
2786: +			{Slot: "a"},
2787: +			{Slot: "b"},
2788: +		})
2789: +
2790: +		require.NoError(t, n.Init(n.Cfg))
2791: +		slot, err := n.cpmSlot()
2792: +		require.NoError(t, err)
2793: +		assert.Equal(t, slotAName, slot)
2794: +	})
2795: +
2796: +	t.Run("node_env_overrides_component_mda", func(t *testing.T) {
2797: +		n := newSrosInitTestNode("sr-1", []*Component{
2798: +			{MDA: MDAS{{Slot: 1, Type: "from-component"}}},
2799: +		})
2800: +		n.Cfg.Env = map[string]string{envNokiaSrosMDA + "_1": "from-env"}
2801: +
2802: +		require.NoError(t, n.Init(n.Cfg))
2803: +		assert.Equal(t, "from-env", n.Cfg.Env[envNokiaSrosMDA+"_1"])
2804: +
2805: +		cfg := n.generateComponentConfig()
2806: +		assert.Contains(t, cfg, "/configure card 1 mda 1 mda-type from-env admin-state enable")
2807: +		assert.NotContains(t, cfg, "from-component")
2808: +	})
2809: +
2810: +	t.Run("node_env_overrides_sfm", func(t *testing.T) {
2811: +		n := newSrosInitTestNode("sr-1", nil)
2812: +		kindSpecificConfig.Of(n.Cfg).SFM = "from-sfm"
2813: +		n.Cfg.Env = map[string]string{envNokiaSrosSFM: "from-env"}
2814: +
2815: +		require.NoError(t, n.Init(n.Cfg))
2816: +		assert.Equal(t, "from-env", n.Cfg.Env[envNokiaSrosSFM])
2817: +	})
2818: +
2819: +	t.Run("distributed_node_env_overrides_component_mda", func(t *testing.T) {
2820: +		n := newSrosInitTestNode("sr-2s", []*Component{
2821: +			{Slot: slotAName, Type: "cpm-2s"},
2822: +			{
2823: +				Slot: "1",
2824: +				Type: "xcm-2s",
2825: +				MDA:  MDAS{{Slot: 1, Type: "from-component"}},
2826: +			},
2827: +		})
2828: +		n.Cfg.Env = map[string]string{envNokiaSrosMDA + "_1": "from-env"}
2829: +
2830: +		require.NoError(t, n.Init(n.Cfg))
2831: +		require.Len(t, n.componentNodes, 2)
2832: +
2833: +		linecard := n.componentNodes[1].(*sros)
2834: +		assert.Equal(t, "from-env", linecard.Config().Env[envNokiaSrosMDA+"_1"])
2835: +
2836: +		cfg := n.componentNodes[0].(*sros).generateComponentConfig()
2837: +		assert.Contains(t, cfg, "/configure card 1 mda 1 mda-type from-env admin-state enable")
2838: +		assert.NotContains(t, cfg, "from-component")
2839: +	})
2840: +
2841: +	t.Run("duplicate_component_slots_are_rejected_regardless_of_case", func(t *testing.T) {
2842: +		n := newSrosInitTestNode("sr-2s", []*Component{
2843: +			{Slot: "a"},
2844: +			{Slot: "A"},
2845: +		})
2846: +
2847: +		err := n.checkComponentSlotsConfig()
2848:  
2849:  		require.Error(t, err)
2850: -		assert.Contains(t, err.Error(), "at most one component override")
2851: +		assert.Contains(t, err.Error(), "duplicate")
2852:  	})
2853:  
2854:  	t.Run("sfm_sets_container_env", func(t *testing.T) {
2855:  		n := newSrosInitTestNode("sr-1", nil)
2856:  		kindSpecificConfig.Of(n.Cfg).SFM = "m-sfm6-7/12"
2857:  
2858:  		require.NoError(t, n.Init(n.Cfg))
2859:  		assert.Equal(t, "m-sfm6-7/12", n.Cfg.Env[envNokiaSrosSFM])
2860:  	})
2861:  
2862: -	t.Run("single_slot_integrated_rejects_card_type_override", func(t *testing.T) {
2863: -		n := newSrosInitTestNode("ixr-e2", []*Component{
2864: -			{Slot: slotAName, Type: "imm2-qsfpdd+2-qsfp28+24-sfp28"},
2865: +	t.Run("single_slot_integrated_allows_card_type_override", func(t *testing.T) {
2866: +		n := newSrosInitTestNode("ixr-e2n", []*Component{
2867: +			{Slot: slotAName, Type: "cpm-ixr-e2n/imm4-sfp+4-sfp+"},
2868:  		})
2869:  
2870: -		err := n.Init(n.Cfg)
2871: -
2872: -		require.Error(t, err)
2873: -		assert.Contains(t, err.Error(), "does not support component card-type override")
2874: +		require.NoError(t, n.Init(n.Cfg))
2875: +		assert.Equal(t, "cpm-ixr-e2n/imm4-sfp+4-sfp+", n.Cfg.Env[envNokiaSrosCard])
2876: +		assert.Empty(t, n.generateComponentConfig())
2877:  	})
2878:  
2879:  	t.Run("integrated_rejects_invalid_slot", func(t *testing.T) {
2880:  		n := newSrosInitTestNode("ixr-e2", []*Component{
2881:  			{Slot: slotBName, Type: "cpm-ixr-e2"},
2882: diff --git a/nodes/sros/template.go b/nodes/sros/template.go
2883: index 38f1e4d..b538320 100644
2884: --- a/nodes/sros/template.go
2885: +++ b/nodes/sros/template.go
2886: @@ -1,7 +1,28 @@
2887:  package sros
2888:  
2889: +import (
2890: +	_ "embed"
2891: +	"text/template"
2892: +
2893: +	clabutils "github.com/srl-labs/containerlab/utils"
2894: +)
2895: +
2896: +var (
2897: +	//go:embed configs/sros_config_sros25.go.tpl
2898: +	cfgTplSROS25 string
2899: +
2900: +	//go:embed configs/sros_config_classic.go.tpl
2901: +	cfgTplClassic string
2902: +
2903: +	//go:embed configs/ixr/ixr_config_classic.go.tpl
2904: +	cfgTplClassicIxr string
2905: +
2906: +	//go:embed configs/sar/sar_config_classic.go.tpl
2907: +	cfgTplClassicSar string
2908: +)
2909: +
2910:  // srosTemplateData holds all data needed for template selection and execution.
2911:  type srosTemplateData struct {
2912:  	// Template selection criteria
2913:  	NodeType          string
2914:  	ConfigurationMode string
2915: @@ -43,5 +64,36 @@ type tplIFace struct {
2916:  	Slot       string
2917:  	Port       string
2918:  	BreakoutNo string
2919:  	Mtu        int
2920:  }
2921: +
2922: +// getTemplateForVariant returns the template string and name for the given config variant.
2923: +// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= "26").
2924: +func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {
2925: +	// Model-driven (or mixed treated as classic below when family is classic)
2926: +	if v.Mode == ConfigModeModelDriven {
2927: +		// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= "26"
2928: +		// { return cfgTplSROS26, "clab-sros-config-sros26" }
2929: +		return cfgTplSROS25, "clab-sros-config-sros25"
2930: +	}
2931: +	// Classic (or mixed)
2932: +	tmpl = cfgTplClassic
2933: +	tplName = "clab-sros-config-classic"
2934: +	switch v.Family {
2935: +	case ConfigFamilyIXR:
2936: +		return cfgTplClassicIxr, "clab-sros-config-classic-ixr"
2937: +	case ConfigFamilySAR:
2938: +		return cfgTplClassicSar, "clab-sros-config-classic-sar"
2939: +	default:
2940: +		return tmpl, tplName
2941: +	}
2942: +}
2943: +
2944: +// selectConfigTemplate chooses the config template from the config variant (mode + family).
2945: +func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {
2946: +	v := n.resolveConfigVariant()
2947: +	tmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)
2948: +	return template.New(tplName).
2949: +		Funcs(clabutils.CreateFuncs()).
2950: +		Parse(tmpl)
2951: +}
2952: diff --git a/nodes/sros/variant.go b/nodes/sros/variant.go
2953: index fad585c..85bcac5 100644
2954: --- a/nodes/sros/variant.go
2955: +++ b/nodes/sros/variant.go
2956: @@ -2,11 +2,21 @@
2957:  // Licensed under the BSD 3-Clause License.
2958:  // SPDX-License-Identifier: BSD-3-Clause
2959:  
2960:  package sros
2961:  
2962: -import "fmt"
2963: +import (
2964: +	"fmt"
2965: +	"regexp"
2966: +)
2967: +
2968: +var (
2969: +	sarRegexp   = regexp.MustCompile(`(?i)\bsar-`)
2970: +	sarHmRegexp = regexp.MustCompile(`(?i)\b(sar-hm|sar-hmc)\b`)
2971: +
2972: +	ixrRegexp = regexp.MustCompile(`(?i)\bixr-`)
2973: +)
2974:  
2975:  // ConfigMode is the configuration mode (model-driven or classic).
2976:  type ConfigMode string
2977:  
2978:  const (
2979: @@ -141,5 +151,20 @@ func getSnippetSet(v ConfigVariant) snippetSet {
2980:  			grpc = grpcConfigSARInsecure
2981:  		}
2982:  	}
2983:  	return snippetSet{SystemConfig: sys, GRPCConfig: grpc}
2984:  }
2985: +
2986: +// isIXRNode returns true if this is an IXR node type (case-insensitive).
2987: +func (n *sros) isIXRNode() bool {
2988: +	return ixrRegexp.MatchString(n.Cfg.NodeType)
2989: +}
2990: +
2991: +// isSARNode returns true if this is a SAR node type (case-insensitive).
2992: +func (n *sros) isSARNode() bool {
2993: +	return sarRegexp.MatchString(n.Cfg.NodeType)
2994: +}
2995: +
2996: +// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).
2997: +func (n *sros) isSARHmNode() bool {
2998: +	return sarHmRegexp.MatchString(n.Cfg.NodeType)
2999: +}
3000: diff --git a/schemas/clab.schema.json b/schemas/clab.schema.json
3001: index 66679ac..0157106 100644
3002: --- a/schemas/clab.schema.json
3003: +++ b/schemas/clab.schema.json
3004: @@ -939,10 +939,12 @@
3005:                                              "ixr-6",
3006:                                              "ixr-e2c",
3007:                                              "ixr-e2",
3008:                                              "ixr-e2n",
3009:                                              "ixr-e2n-s",
3010: +                                            "ixr-e2sc",
3011: +                                            "ixr-e3",
3012:                                              "ixr-e3c",
3013:                                              "ixr-e3x",
3014:                                              "ixr-ec",
3015:                                              "ixr-e",
3016:                                              "ixr-r4",
3017: @@ -951,10 +953,11 @@
3018:                                              "ixr-r6",
3019:                                              "ixr-s",
3020:                                              "ixr-x3",
3021:                                              "ixr-x",
3022:                                              "sar-1",
3023: +                                            "sar-10x",
3024:                                              "sar-hm",
3025:                                              "sar-hmc",
3026:                                              "sar-hx",
3027:                                              "sar-mx",
3028:                                              "sr-1-24d",
3029: @@ -2009,11 +2012,14 @@
3030:                  "cpm-ixr-e-gnss/imm24-sfp++8-sfp28+2-qsfp28",
3031:                  "cpm-ixr-e/imm14-10g-sfp++4-1g-tx",
3032:                  "cpm-ixr-e/imm24-sfp++8-sfp28+2-qsfp28",
3033:                  "cpm-ixr-e2",
3034:                  "cpm-ixr-e2c",
3035: +                "cpm-ixr-e2n-s/imm4-sfp+4-sfp+-s",
3036:                  "cpm-ixr-e2n/imm4-sfp+4-sfp+",
3037: +                "cpm-ixr-e2sc/imm16-sfp++4-sfp28",
3038: +                "cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd",
3039:                  "cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56",
3040:                  "cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd",
3041:                  "cpm-ixr-ec",
3042:                  "cpm-ixr-s/imm48-sfp++6-qsfp28",
3043:                  "cpm-ixr-x/imm32-qsfp28+4-qsfpdd",
3044: @@ -2077,10 +2083,11 @@
3045:              "type": "string",
3046:              "description": "CPM card types for SR OS",
3047:              "enum": [
3048:                  "cpiom-ixr-r6",
3049:                  "cpiom-ixr-r6d",
3050: +                "cpiom-sar-x",
3051:                  "cpm-1",
3052:                  "cpm-1s",
3053:                  "cpm-1se",
3054:                  "cpm-1se/imm36-800g-qsfpdd",
3055:                  "cpm-1x",
3056: @@ -2102,11 +2109,14 @@
3057:                  "cpm-ixr-e-gnss/imm24-sfp++8-sfp28+2-qsfp28",
3058:                  "cpm-ixr-e/imm14-10g-sfp++4-1g-tx",
3059:                  "cpm-ixr-e/imm24-sfp++8-sfp28+2-qsfp28",
3060:                  "cpm-ixr-e2",
3061:                  "cpm-ixr-e2c",
3062: +                "cpm-ixr-e2n-s/imm4-sfp+4-sfp+-s",
3063:                  "cpm-ixr-e2n/imm4-sfp+4-sfp+",
3064: +                "cpm-ixr-e2sc/imm16-sfp++4-sfp28",
3065: +                "cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd",
3066:                  "cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56",
3067:                  "cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd",
3068:                  "cpm-ixr-ec",
3069:                  "cpm-ixr-r4",
3070:                  "cpm-ixr-s",
3071: @@ -2122,11 +2132,12 @@
3072:                  "cpm-v/iom-v",
3073:                  "cpm-x20",
3074:                  "cpm2-s",
3075:                  "cpm2-x20",
3076:                  "cpm5",
3077: -                "iom-sar"
3078: +                "iom-sar",
3079: +                "iom-sar-1x"
3080:              ]
3081:          },
3082:          "sros-mda-types": {
3083:              "type": "string",
3084:              "description": "MDA types for SR OS",
3085: @@ -2153,10 +2164,11 @@
3086:                  "m10-sfp++6-sfp",
3087:                  "m12-sfp28+2-qsfp28",
3088:                  "m14-10g-sfp++4-1g-tx",
3089:                  "m18-25g-sfp28",
3090:                  "m2-100g-qsfp28+16-10g-sfp+",
3091: +                "m2-1g-sfp+2-10g-sfp+",
3092:                  "m2-cfp2",
3093:                  "m2-qsfpdd+2-qsfp28+24-sfp28",
3094:                  "m20-10g-sfp+",
3095:                  "m20-1g-csfp",
3096:                  "m20-v",
3097: @@ -2166,11 +2178,13 @@
3098:                  "m32-qsfp28+4-qsfpdd",
3099:                  "m36-100g-qsfp28",
3100:                  "m36-qsfpdd",
3101:                  "m4-100g-cfp4",
3102:                  "m4-10g-sfp++1-100g-cfp2",
3103: +                "m4-1g-rj+6-10g-sfp++2-25g-sfp28",
3104:                  "m4-1g-tx+20-1g-sfp+6-10g-sfp+",
3105: +                "m4-rs232-rj45+4-c3794-sfp",
3106:                  "m40-10g-sfp",
3107:                  "m40-10g-sfp-ptp",
3108:                  "m40-200g-sfpdd+6-800g-qsfpdd-1",
3109:                  "m46-10g-sfp+",
3110:                  "m48-400g-qsfpdd-1",
3111: @@ -2181,10 +2195,11 @@
3112:                  "m5e2-100g-qsfp28+2-800g-qdd",
3113:                  "m5e8-100g-sfp112+2-800g-qdd",
3114:                  "m6-10g-sfp++1-100g-qsfp28",
3115:                  "m6-10g-sfp++4-25g-sfp28",
3116:                  "m6-qsfpdd+48-sfp56",
3117: +                "m8-t1e1-rj48",
3118:                  "m80-1g-csfp",
3119:                  "m80-200g-sfpdd+12-400g-qsfpdd-1",
3120:                  "m80-200g-sfpdd+12-800g-qsfpdd-1x",
3121:                  "ma2-10gb-sfp+12-1gb-sfp",
3122:                  "ma20-1gb-tx",
3123: diff --git a/tests/13-srsim/01-sros-to-linux.robot b/tests/13-srsim/01-sros-to-linux.robot
3124: index c4d9cb2..8226dd7 100644
3125: --- a/tests/13-srsim/01-sros-to-linux.robot
3126: +++ b/tests/13-srsim/01-sros-to-linux.robot
3127: @@ -1,9 +1,10 @@
3128:  *** Settings ***
3129:  Library             OperatingSystem
3130:  Resource            ../ssh.robot
3131:  Resource            ../common.robot
3132: +Resource            ../srsim.robot
3133:  
3134:  Suite Teardown      Run Keyword    Cleanup
3135:  
3136:  
3137:  *** Variables ***
3138: @@ -21,15 +22,11 @@ Set key-path Variable
3139:  Create SSH keypair - RSA
3140:      ${rc}    ${output} =    Run And Return Rc And Output
3141:      ...    ssh-keygen -t rsa -N "" -f ${key-path}-rsa
3142:  
3143:  Deploy ${lab-name} lab
3144: -    Log    ${CURDIR}
3145: -    ${rc}    ${output} =    Run And Return Rc And Output
3146: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3147: -    Log    ${output}
3148: -    Should Be Equal As Integers    ${rc}    0
3149: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3150:  
3151:  Ensure sros is reachable over ssh
3152:      Login via SSH with username and password
3153:      ...    address=clab-${lab-name}-sros
3154:      ...    username=admin
3155: @@ -102,7 +99,7 @@ Verify saving config with copy flag
3156:      [Teardown]    Run    rm -rf ${copy_dst}
3157:  
3158:  
3159:  *** Keywords ***
3160:  Cleanup
3161: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3162: +    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3163:      Run    rm -f ${key-path}*
3164: diff --git a/tests/13-srsim/03-sros-dist-to-linux.robot b/tests/13-srsim/03-sros-dist-to-linux.robot
3165: index b0c6369..a473880 100644
3166: --- a/tests/13-srsim/03-sros-dist-to-linux.robot
3167: +++ b/tests/13-srsim/03-sros-dist-to-linux.robot
3168: @@ -1,35 +1,23 @@
3169:  *** Settings ***
3170:  Library             OperatingSystem
3171:  Resource            ../ssh.robot
3172:  Resource            ../common.robot
3173: +Resource            ../srsim.robot
3174:  
3175: -Suite Teardown      Run Keyword    Cleanup
3176: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3177:  
3178:  
3179:  *** Variables ***
3180:  ${lab-name}         sr03
3181:  ${lab-file-name}    03-srsim-dist.clab.yml
3182:  ${runtime}          docker
3183: -${key-name}         clab-test-key
3184:  
3185:  
3186:  *** Test Cases ***
3187: -Set key-path Variable
3188: -    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}
3189: -    Set Suite Variable    ${key-path}
3190: -
3191: -Create SSH keypair - RSA
3192: -    ${rc}    ${output} =    Run And Return Rc And Output
3193: -    ...    ssh-keygen -t rsa -N "" -f ${key-path}-rsa
3194: -
3195:  Deploy ${lab-name} lab
3196: -    Log    ${CURDIR}
3197: -    ${rc}    ${output} =    Run And Return Rc And Output
3198: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3199: -    Log    ${output}
3200: -    Should Be Equal As Integers    ${rc}    0
3201: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3202:  
3203:  Ensure sros is reachable over ssh
3204:      Login via SSH with username and password
3205:      ...    address=clab-${lab-name}-sros-a
3206:      ...    username=admin
3207: @@ -55,10 +43,5 @@ Do a gNOI cert get-certs
3208:      Skip If    '${runtime}' != 'docker'
3209:      ${rc}    ${output} =    Run And Return Rc And Output
3210:      ...    sudo docker run --network host --rm --mount type=bind,source=${CURDIR}/clab-${lab-name}/.tls/ca,target=/tls ghcr.io/karimra/gnoic:0.2.0 cert get-certs --username admin --password 'NokiaSros1!' --tls-ca /tls/ca.pem --address clab-${lab-name}-sros-a
3211:      Log    ${output}
3212:      Should Contain    ${output}    sros-a.${lab-name}.io
3213: -
3214: -*** Keywords ***
3215: -Cleanup
3216: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3217: -    Run    rm -f ${key-path}*
3218: diff --git a/tests/13-srsim/04-sros-classic.robot b/tests/13-srsim/04-sros-classic.robot
3219: index efdf58f..16b5811 100644
3220: --- a/tests/13-srsim/04-sros-classic.robot
3221: +++ b/tests/13-srsim/04-sros-classic.robot
3222: @@ -1,9 +1,10 @@
3223:  *** Settings ***
3224:  Library             OperatingSystem
3225:  Resource            ../ssh.robot
3226:  Resource            ../common.robot
3227: +Resource            ../srsim.robot
3228:  
3229:  Suite Teardown      Run Keyword    Cleanup
3230:  
3231:  
3232:  *** Variables ***
3233: @@ -23,15 +24,11 @@ Set key-path Variable
3234:  Create SSH keypair - ecdsa512
3235:      ${rc}    ${output} =    Run And Return Rc And Output
3236:      ...    ssh-keygen -t ecdsa -b 521 -N "" -f ${key-path}-ecdsa512
3237:  
3238:  Deploy ${lab-name} lab
3239: -    Log    ${CURDIR}
3240: -    ${rc}    ${output} =    Run And Return Rc And Output
3241: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3242: -    Log    ${output}
3243: -    Should Be Equal As Integers    ${rc}    0
3244: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3245:  
3246:  Ensure sros is reachable over ssh
3247:      Login via SSH with username and password
3248:      ...    address=clab-${lab-name}-srsim
3249:      ...    username=admin
3250: @@ -58,7 +55,7 @@ Check Mixed Config Mode on srsim
3251:      Log    ${output}
3252:      Should Contain    ${output}    mixed
3253:  
3254:  *** Keywords ***
3255:  Cleanup
3256: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3257: +    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3258:      Run    rm -f ${key-path}*
3259: diff --git a/tests/13-srsim/05-sros-comp-to-linux.robot b/tests/13-srsim/05-sros-comp-to-linux.robot
3260: index 4bb4aac..f7db14e 100644
3261: --- a/tests/13-srsim/05-sros-comp-to-linux.robot
3262: +++ b/tests/13-srsim/05-sros-comp-to-linux.robot
3263: @@ -1,9 +1,10 @@
3264:  *** Settings ***
3265:  Library             OperatingSystem
3266:  Resource            ../ssh.robot
3267:  Resource            ../common.robot
3268: +Resource            ../srsim.robot
3269:  
3270:  Suite Teardown      Run Keyword    Cleanup
3271:  
3272:  
3273:  *** Variables ***
3274: @@ -21,15 +22,11 @@ Set key-path Variable
3275:  Create SSH keypair - RSA
3276:      ${rc}    ${output} =    Run And Return Rc And Output
3277:      ...    ssh-keygen -t rsa -N "" -f ${key-path}-rsa
3278:  
3279:  Deploy ${lab-name} lab
3280: -    Log    ${CURDIR}
3281: -    ${rc}    ${output} =    Run And Return Rc And Output
3282: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3283: -    Log    ${output}
3284: -    Should Be Equal As Integers    ${rc}    0
3285: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3286:  
3287:  Ensure sros is reachable over ssh
3288:      Login via SSH with username and password
3289:      ...    address=clab-${lab-name}-sros
3290:      ...    username=admin
3291: @@ -136,7 +133,7 @@ Ensure XIOM MDA x/1 is equipped and up on sr2s-01
3292:      Should Contain    ${output}    in-service
3293:  
3294:  
3295:  *** Keywords ***
3296:  Cleanup
3297: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3298: +    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3299:      Run    rm -f ${key-path}*
3300: diff --git a/tests/13-srsim/06-srsim-sar.robot b/tests/13-srsim/06-srsim-sar.robot
3301: index 0633c48..0ef2dfa 100644
3302: --- a/tests/13-srsim/06-srsim-sar.robot
3303: +++ b/tests/13-srsim/06-srsim-sar.robot
3304: @@ -1,33 +1,25 @@
3305:  *** Settings ***
3306:  Library             OperatingSystem
3307:  Resource            ../ssh.robot
3308:  Resource            ../common.robot
3309: +Resource            ../srsim.robot
3310:  
3311: -Suite Teardown      Run Keyword    Cleanup
3312: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3313:  
3314:  
3315:  *** Variables ***
3316:  ${lab-name}         sr06
3317:  ${lab-file-name}    06-srsim-sar.clab.yml
3318:  ${runtime}          docker
3319: -${key-name}         clab-test-key
3320:  ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1
3321:  ${gnmic_flags}      --username admin --password NokiaSros1! --values-only
3322:  
3323:  
3324:  *** Test Cases ***
3325: -Set key-path Variable
3326: -    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}
3327: -    Set Suite Variable    ${key-path}
3328: -
3329:  Deploy ${lab-name} lab
3330: -    Log    ${CURDIR}
3331: -    ${rc}    ${output} =    Run And Return Rc And Output
3332: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3333: -    Log    ${output}
3334: -    Should Be Equal As Integers    ${rc}    0
3335: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3336:  
3337:  Ensure sros is reachable over ssh
3338:      Login via SSH with username and password
3339:      ...    address=clab-${lab-name}-sar3
3340:      ...    username=admin
3341: @@ -45,10 +37,5 @@ Check Config Mode on sar1
3342:  Check Config Mode on sar2
3343:      ${rc}    ${output} =    Run And Return Rc And Output
3344:      ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --insecure --address clab-${lab-name}-sar2 get --path /state/system/management-interface/configuration-oper-mode
3345:      Log    ${output}
3346:      Should Contain    ${output}    model-driven
3347: -
3348: -*** Keywords ***
3349: -Cleanup
3350: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3351: -    Run    rm -f ${key-path}*
3352: diff --git a/tests/13-srsim/07-srsim-with-mgmt-network.robot b/tests/13-srsim/07-srsim-with-mgmt-network.robot
3353: index 5025036..ce0951f 100644
3354: --- a/tests/13-srsim/07-srsim-with-mgmt-network.robot
3355: +++ b/tests/13-srsim/07-srsim-with-mgmt-network.robot
3356: @@ -1,31 +1,23 @@
3357:  *** Settings ***
3358:  Library             OperatingSystem
3359:  Resource            ../ssh.robot
3360:  Resource            ../common.robot
3361: +Resource            ../srsim.robot
3362:  
3363: -Suite Teardown      Run Keyword    Cleanup
3364: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3365:  
3366:  
3367:  *** Variables ***
3368:  ${lab-name}         sr07
3369:  ${lab-file-name}    07-srsim-mix.clab.yml
3370:  ${runtime}          docker
3371: -${key-name}         clab-test-key
3372:  
3373:  
3374:  *** Test Cases ***
3375: -Set key-path Variable
3376: -    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}
3377: -    Set Suite Variable    ${key-path}
3378: -
3379:  Deploy ${lab-name} lab
3380: -    Log    ${CURDIR}
3381: -    ${rc}    ${output} =    Run And Return Rc And Output
3382: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3383: -    Log    ${output}
3384: -    Should Be Equal As Integers    ${rc}    0
3385: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3386:  
3387:  Ensure sros is reachable over ssh
3388:      Login via SSH with username and password
3389:      ...    address=clab-${lab-name}-srsim10
3390:      ...    username=admin
3391: @@ -57,15 +49,10 @@ Do a gNMI GET using TLS
3392:      Log    ${output}
3393:      Should Be Equal As Integers    ${rc}    0
3394:      Should Contain    ${output}    srsim10-a
3395:  
3396:  *** Keywords ***
3397: -Cleanup
3398: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3399: -    Run    rm -f ${key-path}*
3400: -
3401: -
3402:  Do a gNOI ping to other node
3403:      Skip If    '${runtime}' != 'docker'
3404:      ${rc}    ${output} =    Run And Return Rc And Output
3405:      ...    sudo docker run --network host --rm --mount type=bind,source=${CURDIR}/clab-${lab-name}/.tls/ca,target=/tls ghcr.io/karimra/gnoic:0.2.0 system ping --username admin --password 'NokiaSros1!' --tls-ca /tls/ca.pem --address clab-${lab-name}-srsim10 --destination 100.0.0.11 --ns Base --count 3
3406:      Log    ${output}
3407: diff --git a/tests/13-srsim/08-srsim-comp-cfg-test.robot b/tests/13-srsim/08-srsim-comp-cfg-test.robot
3408: index d276341..c531df4 100644
3409: --- a/tests/13-srsim/08-srsim-comp-cfg-test.robot
3410: +++ b/tests/13-srsim/08-srsim-comp-cfg-test.robot
3411: @@ -1,11 +1,12 @@
3412:  *** Settings ***
3413:  Library             OperatingSystem
3414:  Resource            ../ssh.robot
3415:  Resource            ../common.robot
3416: +Resource            ../srsim.robot
3417:  
3418: -Suite Teardown      Run Keyword    Cleanup
3419: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3420:  
3421:  
3422:  *** Variables ***
3423:  ${lab-name}         comp-cfg-gen-test
3424:  ${lab-file-name}    08-srsim-comp-cfg-test.clab.yml
3425: @@ -14,15 +15,11 @@ ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1
3426:  ${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure
3427:  
3428:  
3429:  *** Test Cases ***
3430:  Deploy ${lab-name} lab
3431: -    Log    ${CURDIR}
3432: -    ${rc}    ${output} =    Run And Return Rc And Output
3433: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3434: -    Log    ${output}
3435: -    Should Be Equal As Integers    ${rc}    0
3436: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3437:  
3438:  Wait for 45s
3439:      Sleep    45s    Let everything fully provision & come up
3440:  
3441:  Check SR-1 card configuration
3442: @@ -121,13 +118,10 @@ Check SR-2s-ncofg has unprovisioned card
3443:      Log    ${output}
3444:      Should Be Equal As Integers    ${rc}    0
3445:      Should Contain    ${output}    unprovisioned
3446:  
3447:  *** Keywords ***
3448: -Cleanup
3449: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3450: -
3451:  Check SR-2S MDA state
3452:      ${rc}    ${output} =    Run And Return Rc And Output
3453:      ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr2s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/hardware-data/oper-state
3454:      Log    ${output}
3455:      Should Be Equal As Integers    ${rc}    0
3456: diff --git a/tests/13-srsim/09-srsim-pause-container.robot b/tests/13-srsim/09-srsim-pause-container.robot
3457: index 0f96bd7..90f57c3 100644
3458: --- a/tests/13-srsim/09-srsim-pause-container.robot
3459: +++ b/tests/13-srsim/09-srsim-pause-container.robot
3460: @@ -1,12 +1,13 @@
3461:  *** Settings ***
3462:  Library             OperatingSystem
3463:  Library             Process
3464:  Resource            ../ssh.robot
3465:  Resource            ../common.robot
3466: +Resource            ../srsim.robot
3467:  
3468: -Suite Teardown      Run Keyword    Cleanup
3469: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3470:  
3471:  
3472:  *** Variables ***
3473:  ${lab-name}         srsim-pause-ctr
3474:  ${lab-file-name}    09-srsim-pause-container.clab.yml
3475: @@ -15,15 +16,11 @@ ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1
3476:  ${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure
3477:  
3478:  
3479:  *** Test Cases ***
3480:  Deploy ${lab-name} lab
3481: -    Log    ${CURDIR}
3482: -    ${rc}    ${output} =    Run And Return Rc And Output
3483: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3484: -    Log    ${output}
3485: -    Should Be Equal As Integers    ${rc}    0
3486: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3487:  
3488:  Wait for 45s
3489:      Sleep    45s    Let everything fully provision & come up
3490:  
3491:  # IPv4
3492: @@ -165,11 +162,5 @@ Check CPM SSH
3493:          Should Contain    ${output}    TiMOS
3494:          Should Match Regexp    ${output}    ${slot}:admin@[^\\r\\n]+#
3495:      FINALLY
3496:          SSHLibrary.Close All Connections
3497:      END
3498: -
3499: -Cleanup
3500: -    ${rc}    ${output} =    Run And Return Rc And Output
3501: -    ...    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3502: -    Log    ${output}
3503: -    Should Be Equal As Integers    ${rc}    0
3504: diff --git a/tests/13-srsim/10-srsim-lifecycle.robot b/tests/13-srsim/10-srsim-lifecycle.robot
3505: index c9085d9..0b24da2 100644
3506: --- a/tests/13-srsim/10-srsim-lifecycle.robot
3507: +++ b/tests/13-srsim/10-srsim-lifecycle.robot
3508: @@ -1,25 +1,22 @@
3509:  *** Settings ***
3510:  Library             OperatingSystem
3511:  Resource            ../common.robot
3512: +Resource            ../srsim.robot
3513:  
3514: -Suite Teardown      Run Keyword    Cleanup
3515: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3516:  
3517:  
3518:  *** Variables ***
3519:  ${lab-name}         lifecycle-test-srsim
3520:  ${lab-file-name}    10-srsim-lifecycle.clab.yml
3521:  ${runtime}          docker
3522:  
3523:  
3524:  *** Test Cases ***
3525:  Deploy ${lab-name} lab
3526: -    Log    ${CURDIR}
3527: -    ${rc}    ${output} =    Run And Return Rc And Output
3528: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3529: -    Log    ${output}
3530: -    Should Be Equal As Integers    ${rc}    0
3531: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3532:  
3533:  Ensure client can ping integrated SR OS node
3534:      Sleep    20s    give time for SR OS nodes to boot
3535:      ${rc}    ${output} =    Run And Return Rc And Output
3536:      ...    ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=client --cmd "ping -c2 -W2 10.0.1.2"
3537: @@ -85,10 +82,5 @@ Verify ping to distributed SR OS recovers after start
3538:      ${rc}    ${output} =    Run And Return Rc And Output
3539:      ...    ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=client --cmd "ping -c2 -W2 10.0.2.2"
3540:      Log    ${output}
3541:      Should Be Equal As Integers    ${rc}    0
3542:      Should Match Regexp    ${output}    2 packets transmitted, 2 (packets )?received, 0% packet loss
3543: -
3544: -
3545: -*** Keywords ***
3546: -Cleanup
3547: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3548: diff --git a/tests/13-srsim/12-srsim-veth-stitch.robot b/tests/13-srsim/12-srsim-veth-stitch.robot
3549: index fac9fe1..9f70b9f 100644
3550: --- a/tests/13-srsim/12-srsim-veth-stitch.robot
3551: +++ b/tests/13-srsim/12-srsim-veth-stitch.robot
3552: @@ -1,11 +1,12 @@
3553:  *** Settings ***
3554:  Library             OperatingSystem
3555:  Resource            ../ssh.robot
3556:  Resource            ../common.robot
3557: +Resource            ../srsim.robot
3558:  
3559: -Suite Teardown      Run Keyword    Cleanup
3560: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3561:  
3562:  
3563:  *** Variables ***
3564:  ${lab-name}         veth-stitch
3565:  ${lab-file-name}    12-srsim-veth-stitch.clab.yml
3566: @@ -14,15 +15,11 @@ ${sros-password}    NokiaSros1!
3567:  ${peer-ip}          10.0.0.2
3568:  
3569:  
3570:  *** Test Cases ***
3571:  Deploy ${lab-name} lab
3572: -    Log    ${CURDIR}
3573: -    ${rc}    ${output} =    Run And Return Rc And Output
3574: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3575: -    Log    ${output}
3576: -    Should Be Equal As Integers    ${rc}    0
3577: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3578:  
3579:  Ensure distributed sros can ping sros2 over the veth-stitch link
3580:      Wait Until Keyword Succeeds    3 minutes    10 seconds    Ping succeeds    sros    ${peer-ip}
3581:  
3582:  Verify inspect interfaces returns the host-side stitch interfaces
3583: @@ -87,13 +84,10 @@ Verify the stitch interfaces are removed on destroy
3584:      Log    ${output}
3585:      Should Not Contain    ${output}    clab-s-
3586:  
3587:  
3588:  *** Keywords ***
3589: -Cleanup
3590: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3591: -
3592:  Ping over SSH
3593:      [Arguments]    ${node}    ${dst}
3594:      Login via SSH with username and password
3595:      ...    address=clab-${lab-name}-${node}
3596:      ...    username=admin
3597: diff --git a/tests/13-srsim/13-srsim-integrated.clab.yml b/tests/13-srsim/13-srsim-integrated.clab.yml
3598: new file mode 100644
3599: index 0000000..a3f2ca3
3600: --- /dev/null
3601: +++ b/tests/13-srsim/13-srsim-integrated.clab.yml
3602: @@ -0,0 +1,33 @@
3603: +# yaml-language-server: $schema=../../schemas/clab.schema.json
3604: +name: srsim-integrated
3605: +
3606: +topology:
3607: +  kinds:
3608: +    nokia_srsim:
3609: +      license: /opt/nokia/sros/license.txt
3610: +      image: registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}
3611: +
3612: +  nodes:
3613: +    ixr-e2n:
3614: +      kind: nokia_srsim
3615: +      type: ixr-e2n
3616: +      components:
3617: +        - type: cpm-ixr-e2n/imm4-sfp+4-sfp+
3618: +
3619: +    ixr-r6:
3620: +      kind: nokia_srsim
3621: +      type: ixr-r6
3622: +      components:
3623: +        - slot: A
3624: +        - slot: B
3625: +
3626: +    sr-1s:
3627: +      kind: nokia_srsim
3628: +      type: sr-1s
3629: +      components:
3630: +        - xiom:
3631: +            - slot: 1
3632: +              type: iom-s-3.0t
3633: +              mda:
3634: +                - slot: 1
3635: +                  type: ms18-100gb-qsfp28
3636: diff --git a/tests/13-srsim/13-srsim-integrated.robot b/tests/13-srsim/13-srsim-integrated.robot
3637: new file mode 100644
3638: index 0000000..8f6b929
3639: --- /dev/null
3640: +++ b/tests/13-srsim/13-srsim-integrated.robot
3641: @@ -0,0 +1,105 @@
3642: +*** Settings ***
3643: +Library             OperatingSystem
3644: +Resource            ../ssh.robot
3645: +Resource            ../common.robot
3646: +Resource            ../srsim.robot
3647: +
3648: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3649: +
3650: +
3651: +*** Variables ***
3652: +${lab-name}         srsim-integrated
3653: +${lab-file-name}    13-srsim-integrated.clab.yml
3654: +${runtime}          docker
3655: +${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1
3656: +${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure
3657: +
3658: +
3659: +*** Test Cases ***
3660: +Deploy ${lab-name} lab
3661: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3662: +
3663: +Wait for 45s
3664: +    Sleep    45s    Let everything fully provision & come up
3665: +
3666: +Check IXR-E2N card override is passed to the container
3667: +    ${rc}    ${output} =    Run And Return Rc And Output
3668: +    ...    sudo ${runtime} inspect clab-${lab-name}-ixr-e2n --format '{{range .Config.Env}}{{println .}}{{end}}'
3669: +    Log    ${output}
3670: +    Should Be Equal As Integers    ${rc}    0
3671: +    Should Contain    ${output}    NOKIA_SROS_CARD=cpm-ixr-e2n/imm4-sfp+4-sfp+
3672: +
3673: +Check IXR-E2N equipped card matches the component
3674: +    ${rc}    ${output} =    Run And Return Rc And Output
3675: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-e2n --path /state/card[slot-number=1]/equipped-type
3676: +    Log    ${output}
3677: +    Should Be Equal As Integers    ${rc}    0
3678: +    Should Contain    ${output}    imm4-sfp+4-sfp+
3679: +
3680: +Check IXR-R6 standby CPM slot is set
3681: +    ${rc}    ${output} =    Run And Return Rc And Output
3682: +    ...    sudo ${runtime} inspect clab-${lab-name}-ixr-r6-b --format '{{range .Config.Env}}{{println .}}{{end}}'
3683: +    Log    ${output}
3684: +    Should Be Equal As Integers    ${rc}    0
3685: +    Should Contain    ${output}    NOKIA_SROS_SLOT=B
3686: +
3687: +Check IXR-R6 card configuration
3688: +    ${rc}    ${output} =    Run And Return Rc And Output
3689: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /configure/card[slot-number=1]/card-type
3690: +    Log    ${output}
3691: +    Should Be Equal As Integers    ${rc}    0
3692: +    Should Contain    ${output}    iom-ixr-r6
3693: +
3694: +Check IXR-R6 MDA configuration
3695: +    ${rc}    ${output} =    Run And Return Rc And Output
3696: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /configure/card[slot-number=1]/mda[mda-slot=1]/mda-type
3697: +    Log    ${output}
3698: +    Should Be Equal As Integers    ${rc}    0
3699: +    Should Contain    ${output}    m6-10g-sfp++1-100g-qsfp28
3700: +
3701: +Ensure IXR-R6 CPM A is up
3702: +    Wait Until Keyword Succeeds    2 minutes    10 seconds    Check IXR-R6 CPM state    A
3703: +
3704: +Ensure IXR-R6 CPM B is up
3705: +    Wait Until Keyword Succeeds    3 minutes    10 seconds    Check IXR-R6 CPM state    B
3706: +
3707: +
3708: +Check SR-1s equipped card
3709: +    ${rc}    ${output} =    Run And Return Rc And Output
3710: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/equipped-type
3711: +    Log    ${output}
3712: +    Should Be Equal As Integers    ${rc}    0
3713: +    Should Contain    ${output}    xcm-1s
3714: +
3715: +Check SR-1s equipped XIOM
3716: +    ${rc}    ${output} =    Run And Return Rc And Output
3717: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/equipped-type
3718: +    Log    ${output}
3719: +    Should Be Equal As Integers    ${rc}    0
3720: +    Should Contain    ${output}    iom-s-3.0t
3721: +
3722: +Check SR-1s equipped XIOM MDA
3723: +    ${rc}    ${output} =    Run And Return Rc And Output
3724: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/equipped-type
3725: +    Log    ${output}
3726: +    Should Be Equal As Integers    ${rc}    0
3727: +    Should Contain    ${output}    ms18-100gb-qsfp28
3728: +
3729: +Ensure SR-1s XIOM MDA is up
3730: +    Wait Until Keyword Succeeds    2 minutes    10 seconds    Check SR-1s XIOM MDA state
3731: +
3732: +*** Keywords ***
3733: +Check IXR-R6 CPM state
3734: +    [Arguments]    ${slot}
3735: +    ${rc}    ${output} =    Run And Return Rc And Output
3736: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /state/cpm[cpm-slot=${slot}]/hardware-data/oper-state
3737: +    Log    ${output}
3738: +    Should Be Equal As Integers    ${rc}    0
3739: +    Should Contain    ${output}    in-service
3740: +
3741: +Check SR-1s XIOM MDA state
3742: +    ${rc}    ${output} =    Run And Return Rc And Output
3743: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/hardware-data/oper-state
3744: +    Log    ${output}
3745: +    Should Be Equal As Integers    ${rc}    0
3746: +    Should Contain    ${output}    in-service
3747: diff --git a/tests/13-srsim/14-srsim-new-chassis.clab.yml b/tests/13-srsim/14-srsim-new-chassis.clab.yml
3748: new file mode 100644
3749: index 0000000..f5f3bc2
3750: --- /dev/null
3751: +++ b/tests/13-srsim/14-srsim-new-chassis.clab.yml
3752: @@ -0,0 +1,53 @@
3753: +# yaml-language-server: $schema=../../schemas/clab.schema.json
3754: +name: srsim-new-chassis
3755: +
3756: +topology:
3757: +  kinds:
3758: +    nokia_srsim:
3759: +      license: /opt/nokia/sros/license.txt
3760: +      image: registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}
3761: +
3762: +  nodes:
3763: +    ixr-e2sc:
3764: +      kind: nokia_srsim
3765: +      type: ixr-e2sc
3766: +
3767: +    ixr-e3:
3768: +      kind: nokia_srsim
3769: +      type: ixr-e3
3770: +
3771: +    sar-10x:
3772: +      kind: nokia_srsim
3773: +      type: sar-10x
3774: +      components:
3775: +        - slot: A
3776: +          type: cpiom-sar-x
3777: +          mda: &mdas
3778: +            - slot: 1
3779: +              type: m2-1g-sfp+2-10g-sfp+
3780: +            - slot: 2
3781: +              type: m8-t1e1-rj48
3782: +            - slot: 3
3783: +              type: m2-1g-sfp+2-10g-sfp+
3784: +            - slot: 4
3785: +              type: m4-rs232-rj45+4-c3794-sfp
3786: +            - slot: 5
3787: +              type: m8-t1e1-rj48
3788: +            - slot: 6
3789: +              type: m4-rs232-rj45+4-c3794-sfp
3790: +            - slot: 7
3791: +              type: m8-t1e1-rj48
3792: +            - slot: 8
3793: +              type: m4-rs232-rj45+4-c3794-sfp
3794: +        - slot: B
3795: +          type: cpiom-sar-x
3796: +          mda: *mdas
3797: +      startup-config: |
3798: +        /configure card 1 mda 1 mda-type m2-1g-sfp+2-10g-sfp+ admin-state enable
3799: +        /configure card 1 mda 2 mda-type m8-t1e1-rj48 admin-state enable
3800: +        /configure card 1 mda 3 mda-type m2-1g-sfp+2-10g-sfp+ admin-state enable
3801: +        /configure card 1 mda 4 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable
3802: +        /configure card 1 mda 5 mda-type m8-t1e1-rj48 admin-state enable
3803: +        /configure card 1 mda 6 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable
3804: +        /configure card 1 mda 7 mda-type m8-t1e1-rj48 admin-state enable
3805: +        /configure card 1 mda 8 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable
3806: diff --git a/tests/13-srsim/14-srsim-new-chassis.robot b/tests/13-srsim/14-srsim-new-chassis.robot
3807: new file mode 100644
3808: index 0000000..0f1b08a
3809: --- /dev/null
3810: +++ b/tests/13-srsim/14-srsim-new-chassis.robot
3811: @@ -0,0 +1,83 @@
3812: +*** Settings ***
3813: +Library             OperatingSystem
3814: +Library             String
3815: +Resource            ../common.robot
3816: +Resource            ../srsim.robot
3817: +
3818: +Suite Setup         Skip If    '${26_10_TESTS}'.lower() != 'true'
3819: +...                 SR-SIM 26.10 is required; enable with --variable 26_10_TESTS:true
3820: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3821: +
3822: +
3823: +*** Variables ***
3824: +${lab-name}         srsim-new-chassis
3825: +${lab-file-name}    14-srsim-new-chassis.clab.yml
3826: +${runtime}          docker
3827: +${26_10_TESTS}      false
3828: +${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1
3829: +${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure
3830: +
3831: +
3832: +*** Test Cases ***
3833: +Deploy ${lab-name} lab
3834: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3835: +
3836: +Check ixr-e2sc chassis
3837: +    Check chassis    ixr-e2sc    ixr-e2sc
3838: +
3839: +Check ixr-e3 chassis
3840: +    Check chassis    ixr-e3    ixr-e3
3841: +
3842: +Check sar-10x chassis
3843: +    Check chassis    sar-10x-a    sar-10x
3844: +    Check chassis    sar-10x-b    sar-10x
3845: +
3846: +Ensure new chassis containers stay running
3847: +    Sleep    30s    Let the simulators get past initial startup
3848: +    Check container is running    ixr-e2sc
3849: +    Check container is running    ixr-e3
3850: +    Check container is running    sar-10x-a
3851: +    Check container is running    sar-10x-b
3852: +
3853: +Check sar-10x line cards are up
3854: +    Wait Until Keyword Succeeds    3 minutes    15 seconds    SAR-10x line cards are up
3855: +
3856: +*** Keywords ***
3857: +SAR-10x line cards are up
3858: +    # Query card 1, MDAs 1/1..1/8, then card 2 in chassis order.
3859: +    ${command} =    Catenate    SEPARATOR=${SPACE}
3860: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags}
3861: +    ...    --address clab-${lab-name}-sar-10x
3862: +    ...    --path /state/card[slot-number=1]/hardware-data/oper-state
3863: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=1]/hardware-data/oper-state
3864: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=2]/hardware-data/oper-state
3865: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=3]/hardware-data/oper-state
3866: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=4]/hardware-data/oper-state
3867: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=5]/hardware-data/oper-state
3868: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=6]/hardware-data/oper-state
3869: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=7]/hardware-data/oper-state
3870: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=8]/hardware-data/oper-state
3871: +    ...    --path /state/card[slot-number=2]/hardware-data/oper-state
3872: +    ${rc}    ${output} =    Run And Return Rc And Output    ${command}
3873: +    Log    ${output}
3874: +    Should Be Equal As Integers    ${rc}    0
3875: +    ${up_states} =    Get Regexp Matches    ${output}    in-service
3876: +    Length Should Be    ${up_states}    10
3877: +    Should Not Contain    ${output}    null
3878: +
3879: +Check chassis
3880: +    [Arguments]    ${node}    ${chassis}
3881: +    ${rc}    ${output} =    Run And Return Rc And Output
3882: +    ...    sudo ${runtime} inspect clab-${lab-name}-${node} --format '{{range .Config.Env}}{{println .}}{{end}}'
3883: +    Log    ${output}
3884: +    Should Be Equal As Integers    ${rc}    0
3885: +    Should Contain    ${output}    NOKIA_SROS_CHASSIS=${chassis}
3886: +
3887: +Check container is running
3888: +    [Arguments]    ${node}
3889: +    ${rc}    ${output} =    Run And Return Rc And Output
3890: +    ...    sudo ${runtime} inspect clab-${lab-name}-${node} --format '{{.State.Running}}'
3891: +    Log    ${output}
3892: +    Should Be Equal As Integers    ${rc}    0
3893: +    ${state} =    Strip String    ${output}
3894: +    Should Be Equal    ${state}    true
3895: diff --git a/tests/srsim.robot b/tests/srsim.robot
3896: new file mode 100644
3897: index 0000000..6d7c7fc
3898: --- /dev/null
3899: +++ b/tests/srsim.robot

(Output capped at 50 KB. Showing lines 2501-3899. Use offset=3900 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502f212d001pfd733PrOg2KKu",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502ed01c001YCpcFvJ3o9WYH6",
  "callID": "call_c58d2ceb83534e8b83a356c3",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/diff.txt",
      "limit": 1445,
      "offset": 2501
    },
    "output": "<path>/source/diff.txt</path>\n<type>file</type>\n<content>\n2501: -\n2502: -\tvar config strings.Builder\n2503: -\tfor _, l := range lines {\n2504: -\t\tconfig.WriteString(l.String())\n2505: -\t}\n2506: -\tconfig.WriteString(powerConfig)\n2507: -\treturn config.String()\n2508: -}\n2509: -\n2510:  // override to fetch CPM to avoid renaming the base node to CPM A.\n2511:  func (n *sros) GetContainerName() string {\n2512:  \tif n.isDistributedBaseNode() && n.cpmContainerName != \"\" {\n2513:  \t\treturn n.cpmContainerName\n2514:  \t}\n2515: @@ -2365,32 +1906,5 @@ func (n *sros) RestoreEndpoints(ctx context.Context) error {\n2516:  \tif err != nil {\n2517:  \t\treturn err\n2518:  \t}\n2519:  \treturn clabutils.LinkContainerNS(nsPath, n.Cfg.LongName)\n2520:  }\n2521: -\n2522: -func (n *sros) ensureNetnsRunning(ctx context.Context) error {\n2523: -\tswitch status := n.netnsNode.GetContainerStatus(ctx); status {\n2524: -\tcase clabruntime.Running:\n2525: -\t\t// The namespace holder intentionally survives regular node lifecycle operations.\n2526: -\tcase clabruntime.Created, clabruntime.Stopped:\n2527: -\t\tif err := n.netnsNode.Start(ctx); err != nil {\n2528: -\t\t\treturn fmt.Errorf(\"node %q network namespace container start error: %w\",\n2529: -\t\t\t\tn.Cfg.ShortName, err)\n2530: -\t\t}\n2531: -\tcase clabruntime.Paused:\n2532: -\t\tif err := n.Runtime.UnpauseContainer(ctx, n.netnsNode.Config().LongName); err != nil {\n2533: -\t\t\treturn fmt.Errorf(\"node %q network namespace container unpause error: %w\",\n2534: -\t\t\t\tn.Cfg.ShortName, err)\n2535: -\t\t}\n2536: -\tcase clabruntime.NotFound:\n2537: -\t\treturn fmt.Errorf(\n2538: -\t\t\t\"node %q network namespace container %q not found; recreate the node\",\n2539: -\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName,\n2540: -\t\t)\n2541: -\tdefault:\n2542: -\t\treturn fmt.Errorf(\"node %q network namespace container %q is %s\",\n2543: -\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName, status)\n2544: -\t}\n2545: -\n2546: -\treturn nil\n2547: -}\n2548: diff --git a/nodes/sros/sros_test.go b/nodes/sros/sros_test.go\n2549: index 29cace9..dd8aea6 100644\n2550: --- a/nodes/sros/sros_test.go\n2551: +++ b/nodes/sros/sros_test.go\n2552: @@ -272,10 +272,16 @@ func Test_sros_generateComponentConfig(t *testing.T) {\n2553:  \t\t\tname:     \"integrated_ixr_e3x_default\",\n2554:  \t\t\tnodeType: \"ixr-e3x\",\n2555:  \t\t\tcardType: \"imm16-sfp112+15-sfp56+6-qsfpdd\",\n2556:  \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"}},\n2557:  \t\t},\n2558: +\t\t{\n2559: +\t\t\tname:     \"integrated_ixr_e2sc_default\",\n2560: +\t\t\tnodeType: \"ixr-e2sc\",\n2561: +\t\t\tcardType: \"imm16-sfp++4-sfp28\",\n2562: +\t\t\tmdas:     MDAS{{Slot: 1, Type: \"m16-sfp++4-sfp28\"}},\n2563: +\t\t},\n2564:  \t\t{\n2565:  \t\t\tname:     \"integrated_ixr_ec_default\",\n2566:  \t\t\tnodeType: \"ixr-ec\",\n2567:  \t\t\tcardType: \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n2568:  \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\"}},\n2569: @@ -311,40 +317,116 @@ func Test_sros_generateComponentConfig(t *testing.T) {\n2570:  \t\t\t\tassert.Equal(t, 4, strings.Count(cfg, \"power-module-type ps-a-dc-6000\"))\n2571:  \t\t\t}\n2572:  \t\t})\n2573:  \t}\n2574:  \n2575: -\tt.Run(\"integrated_env_overrides_preserve_default_mda_slots\", func(t *testing.T) {\n2576: +\tt.Run(\"integrated_component_mda_override_preserves_default_mda_slots\", func(t *testing.T) {\n2577: +\t\tn := newSrosComponentConfigTestNode(\"sr-1\", nil, []*Component{\n2578: +\t\t\t{MDA: MDAS{{Slot: 1, Type: \"custom-mda\"}}},\n2579: +\t\t})\n2580: +\n2581: +\t\tcfg := n.generateComponentConfig()\n2582: +\n2583: +\t\tassert.Contains(t, cfg, \"/configure card 1 card-type iom-1 admin-state enable\")\n2584: +\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type custom-mda admin-state enable\")\n2585: +\t\tassert.Contains(\n2586: +\t\t\tt,\n2587: +\t\t\tcfg,\n2588: +\t\t\t\"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable\",\n2589: +\t\t)\n2590: +\t})\n2591: +\n2592: +\tt.Run(\"integrated_xiom_replaces_default_mdas\", func(t *testing.T) {\n2593: +\t\tn := newSrosComponentConfigTestNode(\"sr-1s\", nil, []*Component{\n2594: +\t\t\t{\n2595: +\t\t\t\tXIOM: XIOMS{\n2596: +\t\t\t\t\t{\n2597: +\t\t\t\t\t\tSlot: 1,\n2598: +\t\t\t\t\t\tType: \"iom-s-3.0t\",\n2599: +\t\t\t\t\t\tMDA: MDAS{\n2600: +\t\t\t\t\t\t\t{Slot: 1, Type: \"ms18-100gb-qsfp28\"},\n2601: +\t\t\t\t\t\t\t{Slot: 2, Type: \"ms2-400gb-qsfpdd+2-100gb-qsfp28\"},\n2602: +\t\t\t\t\t\t},\n2603: +\t\t\t\t\t},\n2604: +\t\t\t\t},\n2605: +\t\t\t},\n2606: +\t\t})\n2607: +\n2608: +\t\tcfg := n.generateComponentConfig()\n2609: +\n2610: +\t\tassert.Contains(t, cfg, \"/configure card 1 card-type xcm-1s admin-state enable\")\n2611: +\t\tassert.Contains(t, cfg, \"/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\")\n2612: +\t\tassert.Contains(\n2613: +\t\t\tt,\n2614: +\t\t\tcfg,\n2615: +\t\t\t\"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\",\n2616: +\t\t)\n2617: +\t\tassert.Contains(\n2618: +\t\t\tt,\n2619: +\t\t\tcfg,\n2620: +\t\t\t\"/configure card 1 xiom x1 mda 2 mda-type ms2-400gb-qsfpdd+2-100gb-qsfp28 admin-state enable\",\n2621: +\t\t)\n2622: +\t\tassert.NotContains(t, cfg, \"s36-100gb-qsfp28\")\n2623: +\t})\n2624: +\n2625: +\tt.Run(\"integrated_env_mda_overrides_default_component_config\", func(t *testing.T) {\n2626:  \t\tn := newSrosComponentConfigTestNode(\n2627:  \t\t\t\"sr-1\",\n2628: -\t\t\tmap[string]string{\n2629: -\t\t\t\tenvNokiaSrosCard:       \"env-card\",\n2630: -\t\t\t\tenvNokiaSrosMDA + \"_1\": \"env-mda\",\n2631: -\t\t\t},\n2632: +\t\t\tmap[string]string{envNokiaSrosMDA + \"_1\": \"env-mda\"},\n2633:  \t\t\tnil,\n2634:  \t\t)\n2635:  \n2636:  \t\tcfg := n.generateComponentConfig()\n2637:  \n2638: -\t\tassert.Contains(t, cfg, \"/configure card 1 card-type env-card admin-state enable\")\n2639: -\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type env-mda admin-state enable\")\n2640: +\t\tassert.Contains(\n2641: +\t\t\tt,\n2642: +\t\t\tcfg,\n2643: +\t\t\t\"/configure card 1 mda 1 mda-type env-mda admin-state enable\",\n2644: +\t\t)\n2645:  \t\tassert.Contains(\n2646:  \t\t\tt,\n2647:  \t\t\tcfg,\n2648:  \t\t\t\"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable\",\n2649:  \t\t)\n2650: +\t\tassert.NotContains(t, cfg, \"me6-100gb-qsfp28\")\n2651:  \t})\n2652:  \n2653: -\tt.Run(\"integrated_env_override_adds_mda_slot\", func(t *testing.T) {\n2654: +\tt.Run(\"integrated_env_mda_overrides_component_mda\", func(t *testing.T) {\n2655:  \t\tn := newSrosComponentConfigTestNode(\n2656: -\t\t\t\"ixr-r6\",\n2657: +\t\t\t\"sr-1\",\n2658: +\t\t\tmap[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"},\n2659: +\t\t\t[]*Component{{MDA: MDAS{{Slot: 1, Type: \"from-component\"}}}},\n2660: +\t\t)\n2661: +\n2662: +\t\tcfg := n.generateComponentConfig()\n2663: +\n2664: +\t\tassert.Contains(\n2665: +\t\t\tt,\n2666: +\t\t\tcfg,\n2667: +\t\t\t\"/configure card 1 mda 1 mda-type from-env admin-state enable\",\n2668: +\t\t)\n2669: +\t\tassert.NotContains(t, cfg, \"from-component\")\n2670: +\t})\n2671: +\n2672: +\tt.Run(\"integrated_card_override_skips_component_config\", func(t *testing.T) {\n2673: +\t\tn := newSrosComponentConfigTestNode(\n2674: +\t\t\t\"sr-1s\",\n2675:  \t\t\tmap[string]string{\n2676: -\t\t\t\tenvNokiaSrosMDA + \"_3\": \"m20-1g-csfp\",\n2677: +\t\t\t\tenvNokiaSrosCard:       \"cpm-1s\",\n2678: +\t\t\t\tenvNokiaSrosMDA + \"_1\": \"env-mda\",\n2679:  \t\t\t},\n2680:  \t\t\tnil,\n2681:  \t\t)\n2682:  \n2683: +\t\tassert.Empty(t, n.generateComponentConfig())\n2684: +\t})\n2685: +\n2686: +\tt.Run(\"integrated_component_override_adds_mda_slot\", func(t *testing.T) {\n2687: +\t\tn := newSrosComponentConfigTestNode(\"ixr-r6\", nil, []*Component{\n2688: +\t\t\t{MDA: MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}}},\n2689: +\t\t})\n2690: +\n2691:  \t\tcfg := n.generateComponentConfig()\n2692:  \n2693:  \t\tassert.Contains(\n2694:  \t\t\tt,\n2695:  \t\t\tcfg,\n2696: @@ -415,41 +497,174 @@ func Test_sros_integratedComponentOverrides(t *testing.T) {\n2697:  \t\trequire.NoError(t, err)\n2698:  \t\tassert.True(t, n.isStandaloneNode())\n2699:  \t\tassert.Equal(t, slotBName, n.Cfg.Env[envNokiaSrosSlot])\n2700:  \t\tassert.Equal(t, \"cpiom-ixr-r6\", n.Cfg.Env[envNokiaSrosCard])\n2701:  \t\tassert.Equal(t, \"m20-1g-csfp\", n.Cfg.Env[envNokiaSrosMDA+\"_3\"])\n2702: +\n2703: +\t\tassert.Empty(t, n.generateComponentConfig())\n2704: +\t})\n2705: +\n2706: +\tt.Run(\"integrated_component_xiom_sets_env\", func(t *testing.T) {\n2707: +\t\tn := newSrosInitTestNode(\"sr-1s\", []*Component{\n2708: +\t\t\t{\n2709: +\t\t\t\tXIOM: XIOMS{\n2710: +\t\t\t\t\t{\n2711: +\t\t\t\t\t\tSlot: 1,\n2712: +\t\t\t\t\t\tType: \"iom-s-3.0t\",\n2713: +\t\t\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"ms18-100gb-qsfp28\"}},\n2714: +\t\t\t\t\t},\n2715: +\t\t\t\t},\n2716: +\t\t\t},\n2717: +\t\t})\n2718: +\n2719: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2720: +\t\tassert.Equal(t, \"iom-s-3.0t\", n.Cfg.Env[envNokiaSrosXIOM+\"_X1\"])\n2721: +\t\tassert.Equal(t, \"ms18-100gb-qsfp28\", n.Cfg.Env[envNokiaSrosMDA+\"_X1_1\"])\n2722: +\n2723: +\t\tcfg := n.generateComponentConfig()\n2724: +\t\tassert.Contains(t, cfg, \"/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\")\n2725: +\t\tassert.Contains(\n2726: +\t\t\tt,\n2727: +\t\t\tcfg,\n2728: +\t\t\t\"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\",\n2729: +\t\t)\n2730:  \t})\n2731:  \n2732:  \tt.Run(\"integrated_rejects_multiple_components\", func(t *testing.T) {\n2733: +\t\tfor _, tc := range []struct {\n2734: +\t\t\tnodeType   string\n2735: +\t\t\tcomponents []*Component\n2736: +\t\t}{\n2737: +\t\t\t{\"sr-1\", []*Component{{Slot: slotAName}, {Slot: slotBName}}},\n2738: +\t\t\t{\"ixr-r6\", []*Component{{Slot: slotAName}, {Slot: \"1\"}}},\n2739: +\t\t\t{\"ixr-r6\", []*Component{{Slot: slotAName}, {}}},\n2740: +\t\t} {\n2741: +\t\t\tn := newSrosInitTestNode(tc.nodeType, tc.components)\n2742: +\n2743: +\t\t\terr := n.Init(n.Cfg)\n2744: +\n2745: +\t\t\trequire.Error(t, err, tc.nodeType)\n2746: +\t\t\tassert.Contains(t, err.Error(), \"at most one component override\")\n2747: +\t\t}\n2748: +\t})\n2749: +\n2750: +\tt.Run(\"redundant_integrated_components_are_distributed\", func(t *testing.T) {\n2751:  \t\tn := newSrosInitTestNode(\"ixr-r6\", []*Component{\n2752: -\t\t\t{Slot: slotAName, Type: \"cpiom-ixr-r6\"},\n2753: -\t\t\t{Slot: slotBName, Type: \"cpiom-ixr-r6\"},\n2754: +\t\t\t{Slot: slotAName, MDA: MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}}},\n2755: +\t\t\t{Slot: slotBName},\n2756:  \t\t})\n2757:  \n2758: -\t\terr := n.Init(n.Cfg)\n2759: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2760: +\t\tassert.True(t, n.isDistributedBaseNode())\n2761: +\t\trequire.Len(t, n.componentNodes, 2)\n2762: +\n2763: +\t\tcpmA := n.componentNodes[0].(*sros)\n2764: +\t\tcpmB := n.componentNodes[1].(*sros)\n2765: +\t\tassert.Equal(t, slotAName, cpmA.Config().Env[envNokiaSrosSlot])\n2766: +\t\tassert.Equal(t, slotBName, cpmB.Config().Env[envNokiaSrosSlot])\n2767: +\t\tassert.Equal(t, \"container:n1-netns\", cpmA.Config().NetworkMode)\n2768: +\t\tassert.Equal(t, \"container:n1-netns\", cpmB.Config().NetworkMode)\n2769: +\n2770: +\t\tcfgA := cpmA.generateComponentConfig()\n2771: +\t\tassert.Contains(t, cfgA, \"/configure card 1 card-type iom-ixr-r6 admin-state enable\")\n2772: +\t\tassert.Contains(\n2773: +\t\t\tt,\n2774: +\t\t\tcfgA,\n2775: +\t\t\t\"/configure card 1 mda 1 mda-type m6-10g-sfp++1-100g-qsfp28 admin-state enable\",\n2776: +\t\t)\n2777: +\t\tassert.Contains(t, cfgA, \"/configure card 1 mda 3 mda-type m20-1g-csfp admin-state enable\")\n2778: +\n2779: +\t\tcfgB := cpmB.generateComponentConfig()\n2780: +\t\tassert.Contains(t, cfgB, \"/configure card 1 card-type iom-ixr-r6 admin-state enable\")\n2781: +\t\tassert.NotContains(t, cfgB, \"m20-1g-csfp\")\n2782: +\t})\n2783: +\n2784: +\tt.Run(\"lowercase_integrated_slots_resolve_to_cpm_a\", func(t *testing.T) {\n2785: +\t\tn := newSrosInitTestNode(\"ixr-r6\", []*Component{\n2786: +\t\t\t{Slot: \"a\"},\n2787: +\t\t\t{Slot: \"b\"},\n2788: +\t\t})\n2789: +\n2790: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2791: +\t\tslot, err := n.cpmSlot()\n2792: +\t\trequire.NoError(t, err)\n2793: +\t\tassert.Equal(t, slotAName, slot)\n2794: +\t})\n2795: +\n2796: +\tt.Run(\"node_env_overrides_component_mda\", func(t *testing.T) {\n2797: +\t\tn := newSrosInitTestNode(\"sr-1\", []*Component{\n2798: +\t\t\t{MDA: MDAS{{Slot: 1, Type: \"from-component\"}}},\n2799: +\t\t})\n2800: +\t\tn.Cfg.Env = map[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"}\n2801: +\n2802: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2803: +\t\tassert.Equal(t, \"from-env\", n.Cfg.Env[envNokiaSrosMDA+\"_1\"])\n2804: +\n2805: +\t\tcfg := n.generateComponentConfig()\n2806: +\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type from-env admin-state enable\")\n2807: +\t\tassert.NotContains(t, cfg, \"from-component\")\n2808: +\t})\n2809: +\n2810: +\tt.Run(\"node_env_overrides_sfm\", func(t *testing.T) {\n2811: +\t\tn := newSrosInitTestNode(\"sr-1\", nil)\n2812: +\t\tkindSpecificConfig.Of(n.Cfg).SFM = \"from-sfm\"\n2813: +\t\tn.Cfg.Env = map[string]string{envNokiaSrosSFM: \"from-env\"}\n2814: +\n2815: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2816: +\t\tassert.Equal(t, \"from-env\", n.Cfg.Env[envNokiaSrosSFM])\n2817: +\t})\n2818: +\n2819: +\tt.Run(\"distributed_node_env_overrides_component_mda\", func(t *testing.T) {\n2820: +\t\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n2821: +\t\t\t{Slot: slotAName, Type: \"cpm-2s\"},\n2822: +\t\t\t{\n2823: +\t\t\t\tSlot: \"1\",\n2824: +\t\t\t\tType: \"xcm-2s\",\n2825: +\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"from-component\"}},\n2826: +\t\t\t},\n2827: +\t\t})\n2828: +\t\tn.Cfg.Env = map[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"}\n2829: +\n2830: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2831: +\t\trequire.Len(t, n.componentNodes, 2)\n2832: +\n2833: +\t\tlinecard := n.componentNodes[1].(*sros)\n2834: +\t\tassert.Equal(t, \"from-env\", linecard.Config().Env[envNokiaSrosMDA+\"_1\"])\n2835: +\n2836: +\t\tcfg := n.componentNodes[0].(*sros).generateComponentConfig()\n2837: +\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type from-env admin-state enable\")\n2838: +\t\tassert.NotContains(t, cfg, \"from-component\")\n2839: +\t})\n2840: +\n2841: +\tt.Run(\"duplicate_component_slots_are_rejected_regardless_of_case\", func(t *testing.T) {\n2842: +\t\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n2843: +\t\t\t{Slot: \"a\"},\n2844: +\t\t\t{Slot: \"A\"},\n2845: +\t\t})\n2846: +\n2847: +\t\terr := n.checkComponentSlotsConfig()\n2848:  \n2849:  \t\trequire.Error(t, err)\n2850: -\t\tassert.Contains(t, err.Error(), \"at most one component override\")\n2851: +\t\tassert.Contains(t, err.Error(), \"duplicate\")\n2852:  \t})\n2853:  \n2854:  \tt.Run(\"sfm_sets_container_env\", func(t *testing.T) {\n2855:  \t\tn := newSrosInitTestNode(\"sr-1\", nil)\n2856:  \t\tkindSpecificConfig.Of(n.Cfg).SFM = \"m-sfm6-7/12\"\n2857:  \n2858:  \t\trequire.NoError(t, n.Init(n.Cfg))\n2859:  \t\tassert.Equal(t, \"m-sfm6-7/12\", n.Cfg.Env[envNokiaSrosSFM])\n2860:  \t})\n2861:  \n2862: -\tt.Run(\"single_slot_integrated_rejects_card_type_override\", func(t *testing.T) {\n2863: -\t\tn := newSrosInitTestNode(\"ixr-e2\", []*Component{\n2864: -\t\t\t{Slot: slotAName, Type: \"imm2-qsfpdd+2-qsfp28+24-sfp28\"},\n2865: +\tt.Run(\"single_slot_integrated_allows_card_type_override\", func(t *testing.T) {\n2866: +\t\tn := newSrosInitTestNode(\"ixr-e2n\", []*Component{\n2867: +\t\t\t{Slot: slotAName, Type: \"cpm-ixr-e2n/imm4-sfp+4-sfp+\"},\n2868:  \t\t})\n2869:  \n2870: -\t\terr := n.Init(n.Cfg)\n2871: -\n2872: -\t\trequire.Error(t, err)\n2873: -\t\tassert.Contains(t, err.Error(), \"does not support component card-type override\")\n2874: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2875: +\t\tassert.Equal(t, \"cpm-ixr-e2n/imm4-sfp+4-sfp+\", n.Cfg.Env[envNokiaSrosCard])\n2876: +\t\tassert.Empty(t, n.generateComponentConfig())\n2877:  \t})\n2878:  \n2879:  \tt.Run(\"integrated_rejects_invalid_slot\", func(t *testing.T) {\n2880:  \t\tn := newSrosInitTestNode(\"ixr-e2\", []*Component{\n2881:  \t\t\t{Slot: slotBName, Type: \"cpm-ixr-e2\"},\n2882: diff --git a/nodes/sros/template.go b/nodes/sros/template.go\n2883: index 38f1e4d..b538320 100644\n2884: --- a/nodes/sros/template.go\n2885: +++ b/nodes/sros/template.go\n2886: @@ -1,7 +1,28 @@\n2887:  package sros\n2888:  \n2889: +import (\n2890: +\t_ \"embed\"\n2891: +\t\"text/template\"\n2892: +\n2893: +\tclabutils \"github.com/srl-labs/containerlab/utils\"\n2894: +)\n2895: +\n2896: +var (\n2897: +\t//go:embed configs/sros_config_sros25.go.tpl\n2898: +\tcfgTplSROS25 string\n2899: +\n2900: +\t//go:embed configs/sros_config_classic.go.tpl\n2901: +\tcfgTplClassic string\n2902: +\n2903: +\t//go:embed configs/ixr/ixr_config_classic.go.tpl\n2904: +\tcfgTplClassicIxr string\n2905: +\n2906: +\t//go:embed configs/sar/sar_config_classic.go.tpl\n2907: +\tcfgTplClassicSar string\n2908: +)\n2909: +\n2910:  // srosTemplateData holds all data needed for template selection and execution.\n2911:  type srosTemplateData struct {\n2912:  \t// Template selection criteria\n2913:  \tNodeType          string\n2914:  \tConfigurationMode string\n2915: @@ -43,5 +64,36 @@ type tplIFace struct {\n2916:  \tSlot       string\n2917:  \tPort       string\n2918:  \tBreakoutNo string\n2919:  \tMtu        int\n2920:  }\n2921: +\n2922: +// getTemplateForVariant returns the template string and name for the given config variant.\n2923: +// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= \"26\").\n2924: +func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {\n2925: +\t// Model-driven (or mixed treated as classic below when family is classic)\n2926: +\tif v.Mode == ConfigModeModelDriven {\n2927: +\t\t// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= \"26\"\n2928: +\t\t// { return cfgTplSROS26, \"clab-sros-config-sros26\" }\n2929: +\t\treturn cfgTplSROS25, \"clab-sros-config-sros25\"\n2930: +\t}\n2931: +\t// Classic (or mixed)\n2932: +\ttmpl = cfgTplClassic\n2933: +\ttplName = \"clab-sros-config-classic\"\n2934: +\tswitch v.Family {\n2935: +\tcase ConfigFamilyIXR:\n2936: +\t\treturn cfgTplClassicIxr, \"clab-sros-config-classic-ixr\"\n2937: +\tcase ConfigFamilySAR:\n2938: +\t\treturn cfgTplClassicSar, \"clab-sros-config-classic-sar\"\n2939: +\tdefault:\n2940: +\t\treturn tmpl, tplName\n2941: +\t}\n2942: +}\n2943: +\n2944: +// selectConfigTemplate chooses the config template from the config variant (mode + family).\n2945: +func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {\n2946: +\tv := n.resolveConfigVariant()\n2947: +\ttmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)\n2948: +\treturn template.New(tplName).\n2949: +\t\tFuncs(clabutils.CreateFuncs()).\n2950: +\t\tParse(tmpl)\n2951: +}\n2952: diff --git a/nodes/sros/variant.go b/nodes/sros/variant.go\n2953: index fad585c..85bcac5 100644\n2954: --- a/nodes/sros/variant.go\n2955: +++ b/nodes/sros/variant.go\n2956: @@ -2,11 +2,21 @@\n2957:  // Licensed under the BSD 3-Clause License.\n2958:  // SPDX-License-Identifier: BSD-3-Clause\n2959:  \n2960:  package sros\n2961:  \n2962: -import \"fmt\"\n2963: +import (\n2964: +\t\"fmt\"\n2965: +\t\"regexp\"\n2966: +)\n2967: +\n2968: +var (\n2969: +\tsarRegexp   = regexp.MustCompile(`(?i)\\bsar-`)\n2970: +\tsarHmRegexp = regexp.MustCompile(`(?i)\\b(sar-hm|sar-hmc)\\b`)\n2971: +\n2972: +\tixrRegexp = regexp.MustCompile(`(?i)\\bixr-`)\n2973: +)\n2974:  \n2975:  // ConfigMode is the configuration mode (model-driven or classic).\n2976:  type ConfigMode string\n2977:  \n2978:  const (\n2979: @@ -141,5 +151,20 @@ func getSnippetSet(v ConfigVariant) snippetSet {\n2980:  \t\t\tgrpc = grpcConfigSARInsecure\n2981:  \t\t}\n2982:  \t}\n2983:  \treturn snippetSet{SystemConfig: sys, GRPCConfig: grpc}\n2984:  }\n2985: +\n2986: +// isIXRNode returns true if this is an IXR node type (case-insensitive).\n2987: +func (n *sros) isIXRNode() bool {\n2988: +\treturn ixrRegexp.MatchString(n.Cfg.NodeType)\n2989: +}\n2990: +\n2991: +// isSARNode returns true if this is a SAR node type (case-insensitive).\n2992: +func (n *sros) isSARNode() bool {\n2993: +\treturn sarRegexp.MatchString(n.Cfg.NodeType)\n2994: +}\n2995: +\n2996: +// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).\n2997: +func (n *sros) isSARHmNode() bool {\n2998: +\treturn sarHmRegexp.MatchString(n.Cfg.NodeType)\n2999: +}\n3000: diff --git a/schemas/clab.schema.json b/schemas/clab.schema.json\n3001: index 66679ac..0157106 100644\n3002: --- a/schemas/clab.schema.json\n3003: +++ b/schemas/clab.schema.json\n3004: @@ -939,10 +939,12 @@\n3005:                                              \"ixr-6\",\n3006:                                              \"ixr-e2c\",\n3007:                                              \"ixr-e2\",\n3008:                                              \"ixr-e2n\",\n3009:                                              \"ixr-e2n-s\",\n3010: +                                            \"ixr-e2sc\",\n3011: +                                            \"ixr-e3\",\n3012:                                              \"ixr-e3c\",\n3013:                                              \"ixr-e3x\",\n3014:                                              \"ixr-ec\",\n3015:                                              \"ixr-e\",\n3016:                                              \"ixr-r4\",\n3017: @@ -951,10 +953,11 @@\n3018:                                              \"ixr-r6\",\n3019:                                              \"ixr-s\",\n3020:                                              \"ixr-x3\",\n3021:                                              \"ixr-x\",\n3022:                                              \"sar-1\",\n3023: +                                            \"sar-10x\",\n3024:                                              \"sar-hm\",\n3025:                                              \"sar-hmc\",\n3026:                                              \"sar-hx\",\n3027:                                              \"sar-mx\",\n3028:                                              \"sr-1-24d\",\n3029: @@ -2009,11 +2012,14 @@\n3030:                  \"cpm-ixr-e-gnss/imm24-sfp++8-sfp28+2-qsfp28\",\n3031:                  \"cpm-ixr-e/imm14-10g-sfp++4-1g-tx\",\n3032:                  \"cpm-ixr-e/imm24-sfp++8-sfp28+2-qsfp28\",\n3033:                  \"cpm-ixr-e2\",\n3034:                  \"cpm-ixr-e2c\",\n3035: +                \"cpm-ixr-e2n-s/imm4-sfp+4-sfp+-s\",\n3036:                  \"cpm-ixr-e2n/imm4-sfp+4-sfp+\",\n3037: +                \"cpm-ixr-e2sc/imm16-sfp++4-sfp28\",\n3038: +                \"cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd\",\n3039:                  \"cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56\",\n3040:                  \"cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd\",\n3041:                  \"cpm-ixr-ec\",\n3042:                  \"cpm-ixr-s/imm48-sfp++6-qsfp28\",\n3043:                  \"cpm-ixr-x/imm32-qsfp28+4-qsfpdd\",\n3044: @@ -2077,10 +2083,11 @@\n3045:              \"type\": \"string\",\n3046:              \"description\": \"CPM card types for SR OS\",\n3047:              \"enum\": [\n3048:                  \"cpiom-ixr-r6\",\n3049:                  \"cpiom-ixr-r6d\",\n3050: +                \"cpiom-sar-x\",\n3051:                  \"cpm-1\",\n3052:                  \"cpm-1s\",\n3053:                  \"cpm-1se\",\n3054:                  \"cpm-1se/imm36-800g-qsfpdd\",\n3055:                  \"cpm-1x\",\n3056: @@ -2102,11 +2109,14 @@\n3057:                  \"cpm-ixr-e-gnss/imm24-sfp++8-sfp28+2-qsfp28\",\n3058:                  \"cpm-ixr-e/imm14-10g-sfp++4-1g-tx\",\n3059:                  \"cpm-ixr-e/imm24-sfp++8-sfp28+2-qsfp28\",\n3060:                  \"cpm-ixr-e2\",\n3061:                  \"cpm-ixr-e2c\",\n3062: +                \"cpm-ixr-e2n-s/imm4-sfp+4-sfp+-s\",\n3063:                  \"cpm-ixr-e2n/imm4-sfp+4-sfp+\",\n3064: +                \"cpm-ixr-e2sc/imm16-sfp++4-sfp28\",\n3065: +                \"cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd\",\n3066:                  \"cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56\",\n3067:                  \"cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd\",\n3068:                  \"cpm-ixr-ec\",\n3069:                  \"cpm-ixr-r4\",\n3070:                  \"cpm-ixr-s\",\n3071: @@ -2122,11 +2132,12 @@\n3072:                  \"cpm-v/iom-v\",\n3073:                  \"cpm-x20\",\n3074:                  \"cpm2-s\",\n3075:                  \"cpm2-x20\",\n3076:                  \"cpm5\",\n3077: -                \"iom-sar\"\n3078: +                \"iom-sar\",\n3079: +                \"iom-sar-1x\"\n3080:              ]\n3081:          },\n3082:          \"sros-mda-types\": {\n3083:              \"type\": \"string\",\n3084:              \"description\": \"MDA types for SR OS\",\n3085: @@ -2153,10 +2164,11 @@\n3086:                  \"m10-sfp++6-sfp\",\n3087:                  \"m12-sfp28+2-qsfp28\",\n3088:                  \"m14-10g-sfp++4-1g-tx\",\n3089:                  \"m18-25g-sfp28\",\n3090:                  \"m2-100g-qsfp28+16-10g-sfp+\",\n3091: +                \"m2-1g-sfp+2-10g-sfp+\",\n3092:                  \"m2-cfp2\",\n3093:                  \"m2-qsfpdd+2-qsfp28+24-sfp28\",\n3094:                  \"m20-10g-sfp+\",\n3095:                  \"m20-1g-csfp\",\n3096:                  \"m20-v\",\n3097: @@ -2166,11 +2178,13 @@\n3098:                  \"m32-qsfp28+4-qsfpdd\",\n3099:                  \"m36-100g-qsfp28\",\n3100:                  \"m36-qsfpdd\",\n3101:                  \"m4-100g-cfp4\",\n3102:                  \"m4-10g-sfp++1-100g-cfp2\",\n3103: +                \"m4-1g-rj+6-10g-sfp++2-25g-sfp28\",\n3104:                  \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n3105: +                \"m4-rs232-rj45+4-c3794-sfp\",\n3106:                  \"m40-10g-sfp\",\n3107:                  \"m40-10g-sfp-ptp\",\n3108:                  \"m40-200g-sfpdd+6-800g-qsfpdd-1\",\n3109:                  \"m46-10g-sfp+\",\n3110:                  \"m48-400g-qsfpdd-1\",\n3111: @@ -2181,10 +2195,11 @@\n3112:                  \"m5e2-100g-qsfp28+2-800g-qdd\",\n3113:                  \"m5e8-100g-sfp112+2-800g-qdd\",\n3114:                  \"m6-10g-sfp++1-100g-qsfp28\",\n3115:                  \"m6-10g-sfp++4-25g-sfp28\",\n3116:                  \"m6-qsfpdd+48-sfp56\",\n3117: +                \"m8-t1e1-rj48\",\n3118:                  \"m80-1g-csfp\",\n3119:                  \"m80-200g-sfpdd+12-400g-qsfpdd-1\",\n3120:                  \"m80-200g-sfpdd+12-800g-qsfpdd-1x\",\n3121:                  \"ma2-10gb-sfp+12-1gb-sfp\",\n3122:                  \"ma20-1gb-tx\",\n3123: diff --git a/tests/13-srsim/01-sros-to-linux.robot b/tests/13-srsim/01-sros-to-linux.robot\n3124: index c4d9cb2..8226dd7 100644\n3125: --- a/tests/13-srsim/01-sros-to-linux.robot\n3126: +++ b/tests/13-srsim/01-sros-to-linux.robot\n3127: @@ -1,9 +1,10 @@\n3128:  *** Settings ***\n3129:  Library             OperatingSystem\n3130:  Resource            ../ssh.robot\n3131:  Resource            ../common.robot\n3132: +Resource            ../srsim.robot\n3133:  \n3134:  Suite Teardown      Run Keyword    Cleanup\n3135:  \n3136:  \n3137:  *** Variables ***\n3138: @@ -21,15 +22,11 @@ Set key-path Variable\n3139:  Create SSH keypair - RSA\n3140:      ${rc}    ${output} =    Run And Return Rc And Output\n3141:      ...    ssh-keygen -t rsa -N \"\" -f ${key-path}-rsa\n3142:  \n3143:  Deploy ${lab-name} lab\n3144: -    Log    ${CURDIR}\n3145: -    ${rc}    ${output} =    Run And Return Rc And Output\n3146: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3147: -    Log    ${output}\n3148: -    Should Be Equal As Integers    ${rc}    0\n3149: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3150:  \n3151:  Ensure sros is reachable over ssh\n3152:      Login via SSH with username and password\n3153:      ...    address=clab-${lab-name}-sros\n3154:      ...    username=admin\n3155: @@ -102,7 +99,7 @@ Verify saving config with copy flag\n3156:      [Teardown]    Run    rm -rf ${copy_dst}\n3157:  \n3158:  \n3159:  *** Keywords ***\n3160:  Cleanup\n3161: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3162: +    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3163:      Run    rm -f ${key-path}*\n3164: diff --git a/tests/13-srsim/03-sros-dist-to-linux.robot b/tests/13-srsim/03-sros-dist-to-linux.robot\n3165: index b0c6369..a473880 100644\n3166: --- a/tests/13-srsim/03-sros-dist-to-linux.robot\n3167: +++ b/tests/13-srsim/03-sros-dist-to-linux.robot\n3168: @@ -1,35 +1,23 @@\n3169:  *** Settings ***\n3170:  Library             OperatingSystem\n3171:  Resource            ../ssh.robot\n3172:  Resource            ../common.robot\n3173: +Resource            ../srsim.robot\n3174:  \n3175: -Suite Teardown      Run Keyword    Cleanup\n3176: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3177:  \n3178:  \n3179:  *** Variables ***\n3180:  ${lab-name}         sr03\n3181:  ${lab-file-name}    03-srsim-dist.clab.yml\n3182:  ${runtime}          docker\n3183: -${key-name}         clab-test-key\n3184:  \n3185:  \n3186:  *** Test Cases ***\n3187: -Set key-path Variable\n3188: -    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}\n3189: -    Set Suite Variable    ${key-path}\n3190: -\n3191: -Create SSH keypair - RSA\n3192: -    ${rc}    ${output} =    Run And Return Rc And Output\n3193: -    ...    ssh-keygen -t rsa -N \"\" -f ${key-path}-rsa\n3194: -\n3195:  Deploy ${lab-name} lab\n3196: -    Log    ${CURDIR}\n3197: -    ${rc}    ${output} =    Run And Return Rc And Output\n3198: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3199: -    Log    ${output}\n3200: -    Should Be Equal As Integers    ${rc}    0\n3201: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3202:  \n3203:  Ensure sros is reachable over ssh\n3204:      Login via SSH with username and password\n3205:      ...    address=clab-${lab-name}-sros-a\n3206:      ...    username=admin\n3207: @@ -55,10 +43,5 @@ Do a gNOI cert get-certs\n3208:      Skip If    '${runtime}' != 'docker'\n3209:      ${rc}    ${output} =    Run And Return Rc And Output\n3210:      ...    sudo docker run --network host --rm --mount type=bind,source=${CURDIR}/clab-${lab-name}/.tls/ca,target=/tls ghcr.io/karimra/gnoic:0.2.0 cert get-certs --username admin --password 'NokiaSros1!' --tls-ca /tls/ca.pem --address clab-${lab-name}-sros-a\n3211:      Log    ${output}\n3212:      Should Contain    ${output}    sros-a.${lab-name}.io\n3213: -\n3214: -*** Keywords ***\n3215: -Cleanup\n3216: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3217: -    Run    rm -f ${key-path}*\n3218: diff --git a/tests/13-srsim/04-sros-classic.robot b/tests/13-srsim/04-sros-classic.robot\n3219: index efdf58f..16b5811 100644\n3220: --- a/tests/13-srsim/04-sros-classic.robot\n3221: +++ b/tests/13-srsim/04-sros-classic.robot\n3222: @@ -1,9 +1,10 @@\n3223:  *** Settings ***\n3224:  Library             OperatingSystem\n3225:  Resource            ../ssh.robot\n3226:  Resource            ../common.robot\n3227: +Resource            ../srsim.robot\n3228:  \n3229:  Suite Teardown      Run Keyword    Cleanup\n3230:  \n3231:  \n3232:  *** Variables ***\n3233: @@ -23,15 +24,11 @@ Set key-path Variable\n3234:  Create SSH keypair - ecdsa512\n3235:      ${rc}    ${output} =    Run And Return Rc And Output\n3236:      ...    ssh-keygen -t ecdsa -b 521 -N \"\" -f ${key-path}-ecdsa512\n3237:  \n3238:  Deploy ${lab-name} lab\n3239: -    Log    ${CURDIR}\n3240: -    ${rc}    ${output} =    Run And Return Rc And Output\n3241: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3242: -    Log    ${output}\n3243: -    Should Be Equal As Integers    ${rc}    0\n3244: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3245:  \n3246:  Ensure sros is reachable over ssh\n3247:      Login via SSH with username and password\n3248:      ...    address=clab-${lab-name}-srsim\n3249:      ...    username=admin\n3250: @@ -58,7 +55,7 @@ Check Mixed Config Mode on srsim\n3251:      Log    ${output}\n3252:      Should Contain    ${output}    mixed\n3253:  \n3254:  *** Keywords ***\n3255:  Cleanup\n3256: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3257: +    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3258:      Run    rm -f ${key-path}*\n3259: diff --git a/tests/13-srsim/05-sros-comp-to-linux.robot b/tests/13-srsim/05-sros-comp-to-linux.robot\n3260: index 4bb4aac..f7db14e 100644\n3261: --- a/tests/13-srsim/05-sros-comp-to-linux.robot\n3262: +++ b/tests/13-srsim/05-sros-comp-to-linux.robot\n3263: @@ -1,9 +1,10 @@\n3264:  *** Settings ***\n3265:  Library             OperatingSystem\n3266:  Resource            ../ssh.robot\n3267:  Resource            ../common.robot\n3268: +Resource            ../srsim.robot\n3269:  \n3270:  Suite Teardown      Run Keyword    Cleanup\n3271:  \n3272:  \n3273:  *** Variables ***\n3274: @@ -21,15 +22,11 @@ Set key-path Variable\n3275:  Create SSH keypair - RSA\n3276:      ${rc}    ${output} =    Run And Return Rc And Output\n3277:      ...    ssh-keygen -t rsa -N \"\" -f ${key-path}-rsa\n3278:  \n3279:  Deploy ${lab-name} lab\n3280: -    Log    ${CURDIR}\n3281: -    ${rc}    ${output} =    Run And Return Rc And Output\n3282: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3283: -    Log    ${output}\n3284: -    Should Be Equal As Integers    ${rc}    0\n3285: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3286:  \n3287:  Ensure sros is reachable over ssh\n3288:      Login via SSH with username and password\n3289:      ...    address=clab-${lab-name}-sros\n3290:      ...    username=admin\n3291: @@ -136,7 +133,7 @@ Ensure XIOM MDA x/1 is equipped and up on sr2s-01\n3292:      Should Contain    ${output}    in-service\n3293:  \n3294:  \n3295:  *** Keywords ***\n3296:  Cleanup\n3297: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3298: +    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3299:      Run    rm -f ${key-path}*\n3300: diff --git a/tests/13-srsim/06-srsim-sar.robot b/tests/13-srsim/06-srsim-sar.robot\n3301: index 0633c48..0ef2dfa 100644\n3302: --- a/tests/13-srsim/06-srsim-sar.robot\n3303: +++ b/tests/13-srsim/06-srsim-sar.robot\n3304: @@ -1,33 +1,25 @@\n3305:  *** Settings ***\n3306:  Library             OperatingSystem\n3307:  Resource            ../ssh.robot\n3308:  Resource            ../common.robot\n3309: +Resource            ../srsim.robot\n3310:  \n3311: -Suite Teardown      Run Keyword    Cleanup\n3312: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3313:  \n3314:  \n3315:  *** Variables ***\n3316:  ${lab-name}         sr06\n3317:  ${lab-file-name}    06-srsim-sar.clab.yml\n3318:  ${runtime}          docker\n3319: -${key-name}         clab-test-key\n3320:  ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n3321:  ${gnmic_flags}      --username admin --password NokiaSros1! --values-only\n3322:  \n3323:  \n3324:  *** Test Cases ***\n3325: -Set key-path Variable\n3326: -    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}\n3327: -    Set Suite Variable    ${key-path}\n3328: -\n3329:  Deploy ${lab-name} lab\n3330: -    Log    ${CURDIR}\n3331: -    ${rc}    ${output} =    Run And Return Rc And Output\n3332: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3333: -    Log    ${output}\n3334: -    Should Be Equal As Integers    ${rc}    0\n3335: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3336:  \n3337:  Ensure sros is reachable over ssh\n3338:      Login via SSH with username and password\n3339:      ...    address=clab-${lab-name}-sar3\n3340:      ...    username=admin\n3341: @@ -45,10 +37,5 @@ Check Config Mode on sar1\n3342:  Check Config Mode on sar2\n3343:      ${rc}    ${output} =    Run And Return Rc And Output\n3344:      ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --insecure --address clab-${lab-name}-sar2 get --path /state/system/management-interface/configuration-oper-mode\n3345:      Log    ${output}\n3346:      Should Contain    ${output}    model-driven\n3347: -\n3348: -*** Keywords ***\n3349: -Cleanup\n3350: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3351: -    Run    rm -f ${key-path}*\n3352: diff --git a/tests/13-srsim/07-srsim-with-mgmt-network.robot b/tests/13-srsim/07-srsim-with-mgmt-network.robot\n3353: index 5025036..ce0951f 100644\n3354: --- a/tests/13-srsim/07-srsim-with-mgmt-network.robot\n3355: +++ b/tests/13-srsim/07-srsim-with-mgmt-network.robot\n3356: @@ -1,31 +1,23 @@\n3357:  *** Settings ***\n3358:  Library             OperatingSystem\n3359:  Resource            ../ssh.robot\n3360:  Resource            ../common.robot\n3361: +Resource            ../srsim.robot\n3362:  \n3363: -Suite Teardown      Run Keyword    Cleanup\n3364: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3365:  \n3366:  \n3367:  *** Variables ***\n3368:  ${lab-name}         sr07\n3369:  ${lab-file-name}    07-srsim-mix.clab.yml\n3370:  ${runtime}          docker\n3371: -${key-name}         clab-test-key\n3372:  \n3373:  \n3374:  *** Test Cases ***\n3375: -Set key-path Variable\n3376: -    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}\n3377: -    Set Suite Variable    ${key-path}\n3378: -\n3379:  Deploy ${lab-name} lab\n3380: -    Log    ${CURDIR}\n3381: -    ${rc}    ${output} =    Run And Return Rc And Output\n3382: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3383: -    Log    ${output}\n3384: -    Should Be Equal As Integers    ${rc}    0\n3385: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3386:  \n3387:  Ensure sros is reachable over ssh\n3388:      Login via SSH with username and password\n3389:      ...    address=clab-${lab-name}-srsim10\n3390:      ...    username=admin\n3391: @@ -57,15 +49,10 @@ Do a gNMI GET using TLS\n3392:      Log    ${output}\n3393:      Should Be Equal As Integers    ${rc}    0\n3394:      Should Contain    ${output}    srsim10-a\n3395:  \n3396:  *** Keywords ***\n3397: -Cleanup\n3398: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3399: -    Run    rm -f ${key-path}*\n3400: -\n3401: -\n3402:  Do a gNOI ping to other node\n3403:      Skip If    '${runtime}' != 'docker'\n3404:      ${rc}    ${output} =    Run And Return Rc And Output\n3405:      ...    sudo docker run --network host --rm --mount type=bind,source=${CURDIR}/clab-${lab-name}/.tls/ca,target=/tls ghcr.io/karimra/gnoic:0.2.0 system ping --username admin --password 'NokiaSros1!' --tls-ca /tls/ca.pem --address clab-${lab-name}-srsim10 --destination 100.0.0.11 --ns Base --count 3\n3406:      Log    ${output}\n3407: diff --git a/tests/13-srsim/08-srsim-comp-cfg-test.robot b/tests/13-srsim/08-srsim-comp-cfg-test.robot\n3408: index d276341..c531df4 100644\n3409: --- a/tests/13-srsim/08-srsim-comp-cfg-test.robot\n3410: +++ b/tests/13-srsim/08-srsim-comp-cfg-test.robot\n3411: @@ -1,11 +1,12 @@\n3412:  *** Settings ***\n3413:  Library             OperatingSystem\n3414:  Resource            ../ssh.robot\n3415:  Resource            ../common.robot\n3416: +Resource            ../srsim.robot\n3417:  \n3418: -Suite Teardown      Run Keyword    Cleanup\n3419: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3420:  \n3421:  \n3422:  *** Variables ***\n3423:  ${lab-name}         comp-cfg-gen-test\n3424:  ${lab-file-name}    08-srsim-comp-cfg-test.clab.yml\n3425: @@ -14,15 +15,11 @@ ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n3426:  ${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n3427:  \n3428:  \n3429:  *** Test Cases ***\n3430:  Deploy ${lab-name} lab\n3431: -    Log    ${CURDIR}\n3432: -    ${rc}    ${output} =    Run And Return Rc And Output\n3433: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3434: -    Log    ${output}\n3435: -    Should Be Equal As Integers    ${rc}    0\n3436: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3437:  \n3438:  Wait for 45s\n3439:      Sleep    45s    Let everything fully provision & come up\n3440:  \n3441:  Check SR-1 card configuration\n3442: @@ -121,13 +118,10 @@ Check SR-2s-ncofg has unprovisioned card\n3443:      Log    ${output}\n3444:      Should Be Equal As Integers    ${rc}    0\n3445:      Should Contain    ${output}    unprovisioned\n3446:  \n3447:  *** Keywords ***\n3448: -Cleanup\n3449: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3450: -\n3451:  Check SR-2S MDA state\n3452:      ${rc}    ${output} =    Run And Return Rc And Output\n3453:      ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr2s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/hardware-data/oper-state\n3454:      Log    ${output}\n3455:      Should Be Equal As Integers    ${rc}    0\n3456: diff --git a/tests/13-srsim/09-srsim-pause-container.robot b/tests/13-srsim/09-srsim-pause-container.robot\n3457: index 0f96bd7..90f57c3 100644\n3458: --- a/tests/13-srsim/09-srsim-pause-container.robot\n3459: +++ b/tests/13-srsim/09-srsim-pause-container.robot\n3460: @@ -1,12 +1,13 @@\n3461:  *** Settings ***\n3462:  Library             OperatingSystem\n3463:  Library             Process\n3464:  Resource            ../ssh.robot\n3465:  Resource            ../common.robot\n3466: +Resource            ../srsim.robot\n3467:  \n3468: -Suite Teardown      Run Keyword    Cleanup\n3469: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3470:  \n3471:  \n3472:  *** Variables ***\n3473:  ${lab-name}         srsim-pause-ctr\n3474:  ${lab-file-name}    09-srsim-pause-container.clab.yml\n3475: @@ -15,15 +16,11 @@ ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n3476:  ${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n3477:  \n3478:  \n3479:  *** Test Cases ***\n3480:  Deploy ${lab-name} lab\n3481: -    Log    ${CURDIR}\n3482: -    ${rc}    ${output} =    Run And Return Rc And Output\n3483: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3484: -    Log    ${output}\n3485: -    Should Be Equal As Integers    ${rc}    0\n3486: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3487:  \n3488:  Wait for 45s\n3489:      Sleep    45s    Let everything fully provision & come up\n3490:  \n3491:  # IPv4\n3492: @@ -165,11 +162,5 @@ Check CPM SSH\n3493:          Should Contain    ${output}    TiMOS\n3494:          Should Match Regexp    ${output}    ${slot}:admin@[^\\\\r\\\\n]+#\n3495:      FINALLY\n3496:          SSHLibrary.Close All Connections\n3497:      END\n3498: -\n3499: -Cleanup\n3500: -    ${rc}    ${output} =    Run And Return Rc And Output\n3501: -    ...    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3502: -    Log    ${output}\n3503: -    Should Be Equal As Integers    ${rc}    0\n3504: diff --git a/tests/13-srsim/10-srsim-lifecycle.robot b/tests/13-srsim/10-srsim-lifecycle.robot\n3505: index c9085d9..0b24da2 100644\n3506: --- a/tests/13-srsim/10-srsim-lifecycle.robot\n3507: +++ b/tests/13-srsim/10-srsim-lifecycle.robot\n3508: @@ -1,25 +1,22 @@\n3509:  *** Settings ***\n3510:  Library             OperatingSystem\n3511:  Resource            ../common.robot\n3512: +Resource            ../srsim.robot\n3513:  \n3514: -Suite Teardown      Run Keyword    Cleanup\n3515: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3516:  \n3517:  \n3518:  *** Variables ***\n3519:  ${lab-name}         lifecycle-test-srsim\n3520:  ${lab-file-name}    10-srsim-lifecycle.clab.yml\n3521:  ${runtime}          docker\n3522:  \n3523:  \n3524:  *** Test Cases ***\n3525:  Deploy ${lab-name} lab\n3526: -    Log    ${CURDIR}\n3527: -    ${rc}    ${output} =    Run And Return Rc And Output\n3528: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3529: -    Log    ${output}\n3530: -    Should Be Equal As Integers    ${rc}    0\n3531: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3532:  \n3533:  Ensure client can ping integrated SR OS node\n3534:      Sleep    20s    give time for SR OS nodes to boot\n3535:      ${rc}    ${output} =    Run And Return Rc And Output\n3536:      ...    ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\\=client --cmd \"ping -c2 -W2 10.0.1.2\"\n3537: @@ -85,10 +82,5 @@ Verify ping to distributed SR OS recovers after start\n3538:      ${rc}    ${output} =    Run And Return Rc And Output\n3539:      ...    ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\\=client --cmd \"ping -c2 -W2 10.0.2.2\"\n3540:      Log    ${output}\n3541:      Should Be Equal As Integers    ${rc}    0\n3542:      Should Match Regexp    ${output}    2 packets transmitted, 2 (packets )?received, 0% packet loss\n3543: -\n3544: -\n3545: -*** Keywords ***\n3546: -Cleanup\n3547: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3548: diff --git a/tests/13-srsim/12-srsim-veth-stitch.robot b/tests/13-srsim/12-srsim-veth-stitch.robot\n3549: index fac9fe1..9f70b9f 100644\n3550: --- a/tests/13-srsim/12-srsim-veth-stitch.robot\n3551: +++ b/tests/13-srsim/12-srsim-veth-stitch.robot\n3552: @@ -1,11 +1,12 @@\n3553:  *** Settings ***\n3554:  Library             OperatingSystem\n3555:  Resource            ../ssh.robot\n3556:  Resource            ../common.robot\n3557: +Resource            ../srsim.robot\n3558:  \n3559: -Suite Teardown      Run Keyword    Cleanup\n3560: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3561:  \n3562:  \n3563:  *** Variables ***\n3564:  ${lab-name}         veth-stitch\n3565:  ${lab-file-name}    12-srsim-veth-stitch.clab.yml\n3566: @@ -14,15 +15,11 @@ ${sros-password}    NokiaSros1!\n3567:  ${peer-ip}          10.0.0.2\n3568:  \n3569:  \n3570:  *** Test Cases ***\n3571:  Deploy ${lab-name} lab\n3572: -    Log    ${CURDIR}\n3573: -    ${rc}    ${output} =    Run And Return Rc And Output\n3574: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3575: -    Log    ${output}\n3576: -    Should Be Equal As Integers    ${rc}    0\n3577: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3578:  \n3579:  Ensure distributed sros can ping sros2 over the veth-stitch link\n3580:      Wait Until Keyword Succeeds    3 minutes    10 seconds    Ping succeeds    sros    ${peer-ip}\n3581:  \n3582:  Verify inspect interfaces returns the host-side stitch interfaces\n3583: @@ -87,13 +84,10 @@ Verify the stitch interfaces are removed on destroy\n3584:      Log    ${output}\n3585:      Should Not Contain    ${output}    clab-s-\n3586:  \n3587:  \n3588:  *** Keywords ***\n3589: -Cleanup\n3590: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3591: -\n3592:  Ping over SSH\n3593:      [Arguments]    ${node}    ${dst}\n3594:      Login via SSH with username and password\n3595:      ...    address=clab-${lab-name}-${node}\n3596:      ...    username=admin\n3597: diff --git a/tests/13-srsim/13-srsim-integrated.clab.yml b/tests/13-srsim/13-srsim-integrated.clab.yml\n3598: new file mode 100644\n3599: index 0000000..a3f2ca3\n3600: --- /dev/null\n3601: +++ b/tests/13-srsim/13-srsim-integrated.clab.yml\n3602: @@ -0,0 +1,33 @@\n3603: +# yaml-language-server: $schema=../../schemas/clab.schema.json\n3604: +name: srsim-integrated\n3605: +\n3606: +topology:\n3607: +  kinds:\n3608: +    nokia_srsim:\n3609: +      license: /opt/nokia/sros/license.txt\n3610: +      image: registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\n3611: +\n3612: +  nodes:\n3613: +    ixr-e2n:\n3614: +      kind: nokia_srsim\n3615: +      type: ixr-e2n\n3616: +      components:\n3617: +        - type: cpm-ixr-e2n/imm4-sfp+4-sfp+\n3618: +\n3619: +    ixr-r6:\n3620: +      kind: nokia_srsim\n3621: +      type: ixr-r6\n3622: +      components:\n3623: +        - slot: A\n3624: +        - slot: B\n3625: +\n3626: +    sr-1s:\n3627: +      kind: nokia_srsim\n3628: +      type: sr-1s\n3629: +      components:\n3630: +        - xiom:\n3631: +            - slot: 1\n3632: +              type: iom-s-3.0t\n3633: +              mda:\n3634: +                - slot: 1\n3635: +                  type: ms18-100gb-qsfp28\n3636: diff --git a/tests/13-srsim/13-srsim-integrated.robot b/tests/13-srsim/13-srsim-integrated.robot\n3637: new file mode 100644\n3638: index 0000000..8f6b929\n3639: --- /dev/null\n3640: +++ b/tests/13-srsim/13-srsim-integrated.robot\n3641: @@ -0,0 +1,105 @@\n3642: +*** Settings ***\n3643: +Library             OperatingSystem\n3644: +Resource            ../ssh.robot\n3645: +Resource            ../common.robot\n3646: +Resource            ../srsim.robot\n3647: +\n3648: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3649: +\n3650: +\n3651: +*** Variables ***\n3652: +${lab-name}         srsim-integrated\n3653: +${lab-file-name}    13-srsim-integrated.clab.yml\n3654: +${runtime}          docker\n3655: +${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n3656: +${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n3657: +\n3658: +\n3659: +*** Test Cases ***\n3660: +Deploy ${lab-name} lab\n3661: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3662: +\n3663: +Wait for 45s\n3664: +    Sleep    45s    Let everything fully provision & come up\n3665: +\n3666: +Check IXR-E2N card override is passed to the container\n3667: +    ${rc}    ${output} =    Run And Return Rc And Output\n3668: +    ...    sudo ${runtime} inspect clab-${lab-name}-ixr-e2n --format '{{range .Config.Env}}{{println .}}{{end}}'\n3669: +    Log    ${output}\n3670: +    Should Be Equal As Integers    ${rc}    0\n3671: +    Should Contain    ${output}    NOKIA_SROS_CARD=cpm-ixr-e2n/imm4-sfp+4-sfp+\n3672: +\n3673: +Check IXR-E2N equipped card matches the component\n3674: +    ${rc}    ${output} =    Run And Return Rc And Output\n3675: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-e2n --path /state/card[slot-number=1]/equipped-type\n3676: +    Log    ${output}\n3677: +    Should Be Equal As Integers    ${rc}    0\n3678: +    Should Contain    ${output}    imm4-sfp+4-sfp+\n3679: +\n3680: +Check IXR-R6 standby CPM slot is set\n3681: +    ${rc}    ${output} =    Run And Return Rc And Output\n3682: +    ...    sudo ${runtime} inspect clab-${lab-name}-ixr-r6-b --format '{{range .Config.Env}}{{println .}}{{end}}'\n3683: +    Log    ${output}\n3684: +    Should Be Equal As Integers    ${rc}    0\n3685: +    Should Contain    ${output}    NOKIA_SROS_SLOT=B\n3686: +\n3687: +Check IXR-R6 card configuration\n3688: +    ${rc}    ${output} =    Run And Return Rc And Output\n3689: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /configure/card[slot-number=1]/card-type\n3690: +    Log    ${output}\n3691: +    Should Be Equal As Integers    ${rc}    0\n3692: +    Should Contain    ${output}    iom-ixr-r6\n3693: +\n3694: +Check IXR-R6 MDA configuration\n3695: +    ${rc}    ${output} =    Run And Return Rc And Output\n3696: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /configure/card[slot-number=1]/mda[mda-slot=1]/mda-type\n3697: +    Log    ${output}\n3698: +    Should Be Equal As Integers    ${rc}    0\n3699: +    Should Contain    ${output}    m6-10g-sfp++1-100g-qsfp28\n3700: +\n3701: +Ensure IXR-R6 CPM A is up\n3702: +    Wait Until Keyword Succeeds    2 minutes    10 seconds    Check IXR-R6 CPM state    A\n3703: +\n3704: +Ensure IXR-R6 CPM B is up\n3705: +    Wait Until Keyword Succeeds    3 minutes    10 seconds    Check IXR-R6 CPM state    B\n3706: +\n3707: +\n3708: +Check SR-1s equipped card\n3709: +    ${rc}    ${output} =    Run And Return Rc And Output\n3710: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/equipped-type\n3711: +    Log    ${output}\n3712: +    Should Be Equal As Integers    ${rc}    0\n3713: +    Should Contain    ${output}    xcm-1s\n3714: +\n3715: +Check SR-1s equipped XIOM\n3716: +    ${rc}    ${output} =    Run And Return Rc And Output\n3717: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/equipped-type\n3718: +    Log    ${output}\n3719: +    Should Be Equal As Integers    ${rc}    0\n3720: +    Should Contain    ${output}    iom-s-3.0t\n3721: +\n3722: +Check SR-1s equipped XIOM MDA\n3723: +    ${rc}    ${output} =    Run And Return Rc And Output\n3724: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/equipped-type\n3725: +    Log    ${output}\n3726: +    Should Be Equal As Integers    ${rc}    0\n3727: +    Should Contain    ${output}    ms18-100gb-qsfp28\n3728: +\n3729: +Ensure SR-1s XIOM MDA is up\n3730: +    Wait Until Keyword Succeeds    2 minutes    10 seconds    Check SR-1s XIOM MDA state\n3731: +\n3732: +*** Keywords ***\n3733: +Check IXR-R6 CPM state\n3734: +    [Arguments]    ${slot}\n3735: +    ${rc}    ${output} =    Run And Return Rc And Output\n3736: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /state/cpm[cpm-slot=${slot}]/hardware-data/oper-state\n3737: +    Log    ${output}\n3738: +    Should Be Equal As Integers    ${rc}    0\n3739: +    Should Contain    ${output}    in-service\n3740: +\n3741: +Check SR-1s XIOM MDA state\n3742: +    ${rc}    ${output} =    Run And Return Rc And Output\n3743: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/hardware-data/oper-state\n3744: +    Log    ${output}\n3745: +    Should Be Equal As Integers    ${rc}    0\n3746: +    Should Contain    ${output}    in-service\n3747: diff --git a/tests/13-srsim/14-srsim-new-chassis.clab.yml b/tests/13-srsim/14-srsim-new-chassis.clab.yml\n3748: new file mode 100644\n3749: index 0000000..f5f3bc2\n3750: --- /dev/null\n3751: +++ b/tests/13-srsim/14-srsim-new-chassis.clab.yml\n3752: @@ -0,0 +1,53 @@\n3753: +# yaml-language-server: $schema=../../schemas/clab.schema.json\n3754: +name: srsim-new-chassis\n3755: +\n3756: +topology:\n3757: +  kinds:\n3758: +    nokia_srsim:\n3759: +      license: /opt/nokia/sros/license.txt\n3760: +      image: registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\n3761: +\n3762: +  nodes:\n3763: +    ixr-e2sc:\n3764: +      kind: nokia_srsim\n3765: +      type: ixr-e2sc\n3766: +\n3767: +    ixr-e3:\n3768: +      kind: nokia_srsim\n3769: +      type: ixr-e3\n3770: +\n3771: +    sar-10x:\n3772: +      kind: nokia_srsim\n3773: +      type: sar-10x\n3774: +      components:\n3775: +        - slot: A\n3776: +          type: cpiom-sar-x\n3777: +          mda: &mdas\n3778: +            - slot: 1\n3779: +              type: m2-1g-sfp+2-10g-sfp+\n3780: +            - slot: 2\n3781: +              type: m8-t1e1-rj48\n3782: +            - slot: 3\n3783: +              type: m2-1g-sfp+2-10g-sfp+\n3784: +            - slot: 4\n3785: +              type: m4-rs232-rj45+4-c3794-sfp\n3786: +            - slot: 5\n3787: +              type: m8-t1e1-rj48\n3788: +            - slot: 6\n3789: +              type: m4-rs232-rj45+4-c3794-sfp\n3790: +            - slot: 7\n3791: +              type: m8-t1e1-rj48\n3792: +            - slot: 8\n3793: +              type: m4-rs232-rj45+4-c3794-sfp\n3794: +        - slot: B\n3795: +          type: cpiom-sar-x\n3796: +          mda: *mdas\n3797: +      startup-config: |\n3798: +        /configure card 1 mda 1 mda-type m2-1g-sfp+2-10g-sfp+ admin-state enable\n3799: +        /configure card 1 mda 2 mda-type m8-t1e1-rj48 admin-state enable\n3800: +        /configure card 1 mda 3 mda-type m2-1g-sfp+2-10g-sfp+ admin-state enable\n3801: +        /configure card 1 mda 4 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable\n3802: +        /configure card 1 mda 5 mda-type m8-t1e1-rj48 admin-state enable\n3803: +        /configure card 1 mda 6 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable\n3804: +        /configure card 1 mda 7 mda-type m8-t1e1-rj48 admin-state enable\n3805: +        /configure card 1 mda 8 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable\n3806: diff --git a/tests/13-srsim/14-srsim-new-chassis.robot b/tests/13-srsim/14-srsim-new-chassis.robot\n3807: new file mode 100644\n3808: index 0000000..0f1b08a\n3809: --- /dev/null\n3810: +++ b/tests/13-srsim/14-srsim-new-chassis.robot\n3811: @@ -0,0 +1,83 @@\n3812: +*** Settings ***\n3813: +Library             OperatingSystem\n3814: +Library             String\n3815: +Resource            ../common.robot\n3816: +Resource            ../srsim.robot\n3817: +\n3818: +Suite Setup         Skip If    '${26_10_TESTS}'.lower() != 'true'\n3819: +...                 SR-SIM 26.10 is required; enable with --variable 26_10_TESTS:true\n3820: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3821: +\n3822: +\n3823: +*** Variables ***\n3824: +${lab-name}         srsim-new-chassis\n3825: +${lab-file-name}    14-srsim-new-chassis.clab.yml\n3826: +${runtime}          docker\n3827: +${26_10_TESTS}      false\n3828: +${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n3829: +${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n3830: +\n3831: +\n3832: +*** Test Cases ***\n3833: +Deploy ${lab-name} lab\n3834: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3835: +\n3836: +Check ixr-e2sc chassis\n3837: +    Check chassis    ixr-e2sc    ixr-e2sc\n3838: +\n3839: +Check ixr-e3 chassis\n3840: +    Check chassis    ixr-e3    ixr-e3\n3841: +\n3842: +Check sar-10x chassis\n3843: +    Check chassis    sar-10x-a    sar-10x\n3844: +    Check chassis    sar-10x-b    sar-10x\n3845: +\n3846: +Ensure new chassis containers stay running\n3847: +    Sleep    30s    Let the simulators get past initial startup\n3848: +    Check container is running    ixr-e2sc\n3849: +    Check container is running    ixr-e3\n3850: +    Check container is running    sar-10x-a\n3851: +    Check container is running    sar-10x-b\n3852: +\n3853: +Check sar-10x line cards are up\n3854: +    Wait Until Keyword Succeeds    3 minutes    15 seconds    SAR-10x line cards are up\n3855: +\n3856: +*** Keywords ***\n3857: +SAR-10x line cards are up\n3858: +    # Query card 1, MDAs 1/1..1/8, then card 2 in chassis order.\n3859: +    ${command} =    Catenate    SEPARATOR=${SPACE}\n3860: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags}\n3861: +    ...    --address clab-${lab-name}-sar-10x\n3862: +    ...    --path /state/card[slot-number=1]/hardware-data/oper-state\n3863: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=1]/hardware-data/oper-state\n3864: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=2]/hardware-data/oper-state\n3865: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=3]/hardware-data/oper-state\n3866: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=4]/hardware-data/oper-state\n3867: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=5]/hardware-data/oper-state\n3868: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=6]/hardware-data/oper-state\n3869: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=7]/hardware-data/oper-state\n3870: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=8]/hardware-data/oper-state\n3871: +    ...    --path /state/card[slot-number=2]/hardware-data/oper-state\n3872: +    ${rc}    ${output} =    Run And Return Rc And Output    ${command}\n3873: +    Log    ${output}\n3874: +    Should Be Equal As Integers    ${rc}    0\n3875: +    ${up_states} =    Get Regexp Matches    ${output}    in-service\n3876: +    Length Should Be    ${up_states}    10\n3877: +    Should Not Contain    ${output}    null\n3878: +\n3879: +Check chassis\n3880: +    [Arguments]    ${node}    ${chassis}\n3881: +    ${rc}    ${output} =    Run And Return Rc And Output\n3882: +    ...    sudo ${runtime} inspect clab-${lab-name}-${node} --format '{{range .Config.Env}}{{println .}}{{end}}'\n3883: +    Log    ${output}\n3884: +    Should Be Equal As Integers    ${rc}    0\n3885: +    Should Contain    ${output}    NOKIA_SROS_CHASSIS=${chassis}\n3886: +\n3887: +Check container is running\n3888: +    [Arguments]    ${node}\n3889: +    ${rc}    ${output} =    Run And Return Rc And Output\n3890: +    ...    sudo ${runtime} inspect clab-${lab-name}-${node} --format '{{.State.Running}}'\n3891: +    Log    ${output}\n3892: +    Should Be Equal As Integers    ${rc}    0\n3893: +    ${state} =    Strip String    ${output}\n3894: +    Should Be Equal    ${state}    true\n3895: diff --git a/tests/srsim.robot b/tests/srsim.robot\n3896: new file mode 100644\n3897: index 0000000..6d7c7fc\n3898: --- /dev/null\n3899: +++ b/tests/srsim.robot\n\n(Output capped at 50 KB. Showing lines 2501-3899. Use offset=3900 to continue.)\n</content>",
    "title": "source/diff.txt",
    "metadata": {
      "preview": "-\n-\tvar config strings.Builder\n-\tfor _, l := range lines {\n-\t\tconfig.WriteString(l.String())\n-\t}\n-\tconfig.WriteString(powerConfig)\n-\treturn config.String()\n-}\n-\n // override to fetch CPM to avoid renaming the base node to CPM A.\n func (n *sros) GetContainerName() string {\n \tif n.isDistributedBaseNode() && n.cpmContainerName != \"\" {\n \t\treturn n.cpmContainerName\n \t}\n@@ -2365,32 +1906,5 @@ func (n *sros) RestoreEndpoints(ctx context.Context) error {\n \tif err != nil {\n \t\treturn err\n \t}\n \treturn clabutils.LinkContainerNS(nsPath, n.Cfg.LongName)\n }",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/diff.txt",
        "text": "-\n-\tvar config strings.Builder\n-\tfor _, l := range lines {\n-\t\tconfig.WriteString(l.String())\n-\t}\n-\tconfig.WriteString(powerConfig)\n-\treturn config.String()\n-}\n-\n // override to fetch CPM to avoid renaming the base node to CPM A.\n func (n *sros) GetContainerName() string {\n \tif n.isDistributedBaseNode() && n.cpmContainerName != \"\" {\n \t\treturn n.cpmContainerName\n \t}\n@@ -2365,32 +1906,5 @@ func (n *sros) RestoreEndpoints(ctx context.Context) error {\n \tif err != nil {\n \t\treturn err\n \t}\n \treturn clabutils.LinkContainerNS(nsPath, n.Cfg.LongName)\n }\n-\n-func (n *sros) ensureNetnsRunning(ctx context.Context) error {\n-\tswitch status := n.netnsNode.GetContainerStatus(ctx); status {\n-\tcase clabruntime.Running:\n-\t\t// The namespace holder intentionally survives regular node lifecycle operations.\n-\tcase clabruntime.Created, clabruntime.Stopped:\n-\t\tif err := n.netnsNode.Start(ctx); err != nil {\n-\t\t\treturn fmt.Errorf(\"node %q network namespace container start error: %w\",\n-\t\t\t\tn.Cfg.ShortName, err)\n-\t\t}\n-\tcase clabruntime.Paused:\n-\t\tif err := n.Runtime.UnpauseContainer(ctx, n.netnsNode.Config().LongName); err != nil {\n-\t\t\treturn fmt.Errorf(\"node %q network namespace container unpause error: %w\",\n-\t\t\t\tn.Cfg.ShortName, err)\n-\t\t}\n-\tcase clabruntime.NotFound:\n-\t\treturn fmt.Errorf(\n-\t\t\t\"node %q network namespace container %q not found; recreate the node\",\n-\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName,\n-\t\t)\n-\tdefault:\n-\t\treturn fmt.Errorf(\"node %q network namespace container %q is %s\",\n-\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName, status)\n-\t}\n-\n-\treturn nil\n-}\ndiff --git a/nodes/sros/sros_test.go b/nodes/sros/sros_test.go\nindex 29cace9..dd8aea6 100644\n--- a/nodes/sros/sros_test.go\n+++ b/nodes/sros/sros_test.go\n@@ -272,10 +272,16 @@ func Test_sros_generateComponentConfig(t *testing.T) {\n \t\t\tname:     \"integrated_ixr_e3x_default\",\n \t\t\tnodeType: \"ixr-e3x\",\n \t\t\tcardType: \"imm16-sfp112+15-sfp56+6-qsfpdd\",\n \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"}},\n \t\t},\n+\t\t{\n+\t\t\tname:     \"integrated_ixr_e2sc_default\",\n+\t\t\tnodeType: \"ixr-e2sc\",\n+\t\t\tcardType: \"imm16-sfp++4-sfp28\",\n+\t\t\tmdas:     MDAS{{Slot: 1, Type: \"m16-sfp++4-sfp28\"}},\n+\t\t},\n \t\t{\n \t\t\tname:     \"integrated_ixr_ec_default\",\n \t\t\tnodeType: \"ixr-ec\",\n \t\t\tcardType: \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\"}},\n@@ -311,40 +317,116 @@ func Test_sros_generateComponentConfig(t *testing.T) {\n \t\t\t\tassert.Equal(t, 4, strings.Count(cfg, \"power-module-type ps-a-dc-6000\"))\n \t\t\t}\n \t\t})\n \t}\n \n-\tt.Run(\"integrated_env_overrides_preserve_default_mda_slots\", func(t *testing.T) {\n+\tt.Run(\"integrated_component_mda_override_preserves_default_mda_slots\", func(t *testing.T) {\n+\t\tn := newSrosComponentConfigTestNode(\"sr-1\", nil, []*Component{\n+\t\t\t{MDA: MDAS{{Slot: 1, Type: \"custom-mda\"}}},\n+\t\t})\n+\n+\t\tcfg := n.generateComponentConfig()\n+\n+\t\tassert.Contains(t, cfg, \"/configure card 1 card-type iom-1 admin-state enable\")\n+\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type custom-mda admin-state enable\")\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfg,\n+\t\t\t\"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable\",\n+\t\t)\n+\t})\n+\n+\tt.Run(\"integrated_xiom_replaces_default_mdas\", func(t *testing.T) {\n+\t\tn := newSrosComponentConfigTestNode(\"sr-1s\", nil, []*Component{\n+\t\t\t{\n+\t\t\t\tXIOM: XIOMS{\n+\t\t\t\t\t{\n+\t\t\t\t\t\tSlot: 1,\n+\t\t\t\t\t\tType: \"iom-s-3.0t\",\n+\t\t\t\t\t\tMDA: MDAS{\n+\t\t\t\t\t\t\t{Slot: 1, Type: \"ms18-100gb-qsfp28\"},\n+\t\t\t\t\t\t\t{Slot: 2, Type: \"ms2-400gb-qsfpdd+2-100gb-qsfp28\"},\n+\t\t\t\t\t\t},\n+\t\t\t\t\t},\n+\t\t\t\t},\n+\t\t\t},\n+\t\t})\n+\n+\t\tcfg := n.generateComponentConfig()\n+\n+\t\tassert.Contains(t, cfg, \"/configure card 1 card-type xcm-1s admin-state enable\")\n+\t\tassert.Contains(t, cfg, \"/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\")\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfg,\n+\t\t\t\"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\",\n+\t\t)\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfg,\n+\t\t\t\"/configure card 1 xiom x1 mda 2 mda-type ms2-400gb-qsfpdd+2-100gb-qsfp28 admin-state enable\",\n+\t\t)\n+\t\tassert.NotContains(t, cfg, \"s36-100gb-qsfp28\")\n+\t})\n+\n+\tt.Run(\"integrated_env_mda_overrides_default_component_config\", func(t *testing.T) {\n \t\tn := newSrosComponentConfigTestNode(\n \t\t\t\"sr-1\",\n-\t\t\tmap[string]string{\n-\t\t\t\tenvNokiaSrosCard:       \"env-card\",\n-\t\t\t\tenvNokiaSrosMDA + \"_1\": \"env-mda\",\n-\t\t\t},\n+\t\t\tmap[string]string{envNokiaSrosMDA + \"_1\": \"env-mda\"},\n \t\t\tnil,\n \t\t)\n \n \t\tcfg := n.generateComponentConfig()\n \n-\t\tassert.Contains(t, cfg, \"/configure card 1 card-type env-card admin-state enable\")\n-\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type env-mda admin-state enable\")\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfg,\n+\t\t\t\"/configure card 1 mda 1 mda-type env-mda admin-state enable\",\n+\t\t)\n \t\tassert.Contains(\n \t\t\tt,\n \t\t\tcfg,\n \t\t\t\"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable\",\n \t\t)\n+\t\tassert.NotContains(t, cfg, \"me6-100gb-qsfp28\")\n \t})\n \n-\tt.Run(\"integrated_env_override_adds_mda_slot\", func(t *testing.T) {\n+\tt.Run(\"integrated_env_mda_overrides_component_mda\", func(t *testing.T) {\n \t\tn := newSrosComponentConfigTestNode(\n-\t\t\t\"ixr-r6\",\n+\t\t\t\"sr-1\",\n+\t\t\tmap[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"},\n+\t\t\t[]*Component{{MDA: MDAS{{Slot: 1, Type: \"from-component\"}}}},\n+\t\t)\n+\n+\t\tcfg := n.generateComponentConfig()\n+\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfg,\n+\t\t\t\"/configure card 1 mda 1 mda-type from-env admin-state enable\",\n+\t\t)\n+\t\tassert.NotContains(t, cfg, \"from-component\")\n+\t})\n+\n+\tt.Run(\"integrated_card_override_skips_component_config\", func(t *testing.T) {\n+\t\tn := newSrosComponentConfigTestNode(\n+\t\t\t\"sr-1s\",\n \t\t\tmap[string]string{\n-\t\t\t\tenvNokiaSrosMDA + \"_3\": \"m20-1g-csfp\",\n+\t\t\t\tenvNokiaSrosCard:       \"cpm-1s\",\n+\t\t\t\tenvNokiaSrosMDA + \"_1\": \"env-mda\",\n \t\t\t},\n \t\t\tnil,\n \t\t)\n \n+\t\tassert.Empty(t, n.generateComponentConfig())\n+\t})\n+\n+\tt.Run(\"integrated_component_override_adds_mda_slot\", func(t *testing.T) {\n+\t\tn := newSrosComponentConfigTestNode(\"ixr-r6\", nil, []*Component{\n+\t\t\t{MDA: MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}}},\n+\t\t})\n+\n \t\tcfg := n.generateComponentConfig()\n \n \t\tassert.Contains(\n \t\t\tt,\n \t\t\tcfg,\n@@ -415,41 +497,174 @@ func Test_sros_integratedComponentOverrides(t *testing.T) {\n \t\trequire.NoError(t, err)\n \t\tassert.True(t, n.isStandaloneNode())\n \t\tassert.Equal(t, slotBName, n.Cfg.Env[envNokiaSrosSlot])\n \t\tassert.Equal(t, \"cpiom-ixr-r6\", n.Cfg.Env[envNokiaSrosCard])\n \t\tassert.Equal(t, \"m20-1g-csfp\", n.Cfg.Env[envNokiaSrosMDA+\"_3\"])\n+\n+\t\tassert.Empty(t, n.generateComponentConfig())\n+\t})\n+\n+\tt.Run(\"integrated_component_xiom_sets_env\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"sr-1s\", []*Component{\n+\t\t\t{\n+\t\t\t\tXIOM: XIOMS{\n+\t\t\t\t\t{\n+\t\t\t\t\t\tSlot: 1,\n+\t\t\t\t\t\tType: \"iom-s-3.0t\",\n+\t\t\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"ms18-100gb-qsfp28\"}},\n+\t\t\t\t\t},\n+\t\t\t\t},\n+\t\t\t},\n+\t\t})\n+\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\tassert.Equal(t, \"iom-s-3.0t\", n.Cfg.Env[envNokiaSrosXIOM+\"_X1\"])\n+\t\tassert.Equal(t, \"ms18-100gb-qsfp28\", n.Cfg.Env[envNokiaSrosMDA+\"_X1_1\"])\n+\n+\t\tcfg := n.generateComponentConfig()\n+\t\tassert.Contains(t, cfg, \"/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\")\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfg,\n+\t\t\t\"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\",\n+\t\t)\n \t})\n \n \tt.Run(\"integrated_rejects_multiple_components\", func(t *testing.T) {\n+\t\tfor _, tc := range []struct {\n+\t\t\tnodeType   string\n+\t\t\tcomponents []*Component\n+\t\t}{\n+\t\t\t{\"sr-1\", []*Component{{Slot: slotAName}, {Slot: slotBName}}},\n+\t\t\t{\"ixr-r6\", []*Component{{Slot: slotAName}, {Slot: \"1\"}}},\n+\t\t\t{\"ixr-r6\", []*Component{{Slot: slotAName}, {}}},\n+\t\t} {\n+\t\t\tn := newSrosInitTestNode(tc.nodeType, tc.components)\n+\n+\t\t\terr := n.Init(n.Cfg)\n+\n+\t\t\trequire.Error(t, err, tc.nodeType)\n+\t\t\tassert.Contains(t, err.Error(), \"at most one component override\")\n+\t\t}\n+\t})\n+\n+\tt.Run(\"redundant_integrated_components_are_distributed\", func(t *testing.T) {\n \t\tn := newSrosInitTestNode(\"ixr-r6\", []*Component{\n-\t\t\t{Slot: slotAName, Type: \"cpiom-ixr-r6\"},\n-\t\t\t{Slot: slotBName, Type: \"cpiom-ixr-r6\"},\n+\t\t\t{Slot: slotAName, MDA: MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}}},\n+\t\t\t{Slot: slotBName},\n \t\t})\n \n-\t\terr := n.Init(n.Cfg)\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\tassert.True(t, n.isDistributedBaseNode())\n+\t\trequire.Len(t, n.componentNodes, 2)\n+\n+\t\tcpmA := n.componentNodes[0].(*sros)\n+\t\tcpmB := n.componentNodes[1].(*sros)\n+\t\tassert.Equal(t, slotAName, cpmA.Config().Env[envNokiaSrosSlot])\n+\t\tassert.Equal(t, slotBName, cpmB.Config().Env[envNokiaSrosSlot])\n+\t\tassert.Equal(t, \"container:n1-netns\", cpmA.Config().NetworkMode)\n+\t\tassert.Equal(t, \"container:n1-netns\", cpmB.Config().NetworkMode)\n+\n+\t\tcfgA := cpmA.generateComponentConfig()\n+\t\tassert.Contains(t, cfgA, \"/configure card 1 card-type iom-ixr-r6 admin-state enable\")\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfgA,\n+\t\t\t\"/configure card 1 mda 1 mda-type m6-10g-sfp++1-100g-qsfp28 admin-state enable\",\n+\t\t)\n+\t\tassert.Contains(t, cfgA, \"/configure card 1 mda 3 mda-type m20-1g-csfp admin-state enable\")\n+\n+\t\tcfgB := cpmB.generateComponentConfig()\n+\t\tassert.Contains(t, cfgB, \"/configure card 1 card-type iom-ixr-r6 admin-state enable\")\n+\t\tassert.NotContains(t, cfgB, \"m20-1g-csfp\")\n+\t})\n+\n+\tt.Run(\"lowercase_integrated_slots_resolve_to_cpm_a\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"ixr-r6\", []*Component{\n+\t\t\t{Slot: \"a\"},\n+\t\t\t{Slot: \"b\"},\n+\t\t})\n+\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\tslot, err := n.cpmSlot()\n+\t\trequire.NoError(t, err)\n+\t\tassert.Equal(t, slotAName, slot)\n+\t})\n+\n+\tt.Run(\"node_env_overrides_component_mda\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"sr-1\", []*Component{\n+\t\t\t{MDA: MDAS{{Slot: 1, Type: \"from-component\"}}},\n+\t\t})\n+\t\tn.Cfg.Env = map[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"}\n+\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\tassert.Equal(t, \"from-env\", n.Cfg.Env[envNokiaSrosMDA+\"_1\"])\n+\n+\t\tcfg := n.generateComponentConfig()\n+\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type from-env admin-state enable\")\n+\t\tassert.NotContains(t, cfg, \"from-component\")\n+\t})\n+\n+\tt.Run(\"node_env_overrides_sfm\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"sr-1\", nil)\n+\t\tkindSpecificConfig.Of(n.Cfg).SFM = \"from-sfm\"\n+\t\tn.Cfg.Env = map[string]string{envNokiaSrosSFM: \"from-env\"}\n+\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\tassert.Equal(t, \"from-env\", n.Cfg.Env[envNokiaSrosSFM])\n+\t})\n+\n+\tt.Run(\"distributed_node_env_overrides_component_mda\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n+\t\t\t{Slot: slotAName, Type: \"cpm-2s\"},\n+\t\t\t{\n+\t\t\t\tSlot: \"1\",\n+\t\t\t\tType: \"xcm-2s\",\n+\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"from-component\"}},\n+\t\t\t},\n+\t\t})\n+\t\tn.Cfg.Env = map[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"}\n+\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\trequire.Len(t, n.componentNodes, 2)\n+\n+\t\tlinecard := n.componentNodes[1].(*sros)\n+\t\tassert.Equal(t, \"from-env\", linecard.Config().Env[envNokiaSrosMDA+\"_1\"])\n+\n+\t\tcfg := n.componentNodes[0].(*sros).generateComponentConfig()\n+\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type from-env admin-state enable\")\n+\t\tassert.NotContains(t, cfg, \"from-component\")\n+\t})\n+\n+\tt.Run(\"duplicate_component_slots_are_rejected_regardless_of_case\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n+\t\t\t{Slot: \"a\"},\n+\t\t\t{Slot: \"A\"},\n+\t\t})\n+\n+\t\terr := n.checkComponentSlotsConfig()\n \n \t\trequire.Error(t, err)\n-\t\tassert.Contains(t, err.Error(), \"at most one component override\")\n+\t\tassert.Contains(t, err.Error(), \"duplicate\")\n \t})\n \n \tt.Run(\"sfm_sets_container_env\", func(t *testing.T) {\n \t\tn := newSrosInitTestNode(\"sr-1\", nil)\n \t\tkindSpecificConfig.Of(n.Cfg).SFM = \"m-sfm6-7/12\"\n \n \t\trequire.NoError(t, n.Init(n.Cfg))\n \t\tassert.Equal(t, \"m-sfm6-7/12\", n.Cfg.Env[envNokiaSrosSFM])\n \t})\n \n-\tt.Run(\"single_slot_integrated_rejects_card_type_override\", func(t *testing.T) {\n-\t\tn := newSrosInitTestNode(\"ixr-e2\", []*Component{\n-\t\t\t{Slot: slotAName, Type: \"imm2-qsfpdd+2-qsfp28+24-sfp28\"},\n+\tt.Run(\"single_slot_integrated_allows_card_type_override\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"ixr-e2n\", []*Component{\n+\t\t\t{Slot: slotAName, Type: \"cpm-ixr-e2n/imm4-sfp+4-sfp+\"},\n \t\t})\n \n-\t\terr := n.Init(n.Cfg)\n-\n-\t\trequire.Error(t, err)\n-\t\tassert.Contains(t, err.Error(), \"does not support component card-type override\")\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\tassert.Equal(t, \"cpm-ixr-e2n/imm4-sfp+4-sfp+\", n.Cfg.Env[envNokiaSrosCard])\n+\t\tassert.Empty(t, n.generateComponentConfig())\n \t})\n \n \tt.Run(\"integrated_rejects_invalid_slot\", func(t *testing.T) {\n \t\tn := newSrosInitTestNode(\"ixr-e2\", []*Component{\n \t\t\t{Slot: slotBName, Type: \"cpm-ixr-e2\"},\ndiff --git a/nodes/sros/template.go b/nodes/sros/template.go\nindex 38f1e4d..b538320 100644\n--- a/nodes/sros/template.go\n+++ b/nodes/sros/template.go\n@@ -1,7 +1,28 @@\n package sros\n \n+import (\n+\t_ \"embed\"\n+\t\"text/template\"\n+\n+\tclabutils \"github.com/srl-labs/containerlab/utils\"\n+)\n+\n+var (\n+\t//go:embed configs/sros_config_sros25.go.tpl\n+\tcfgTplSROS25 string\n+\n+\t//go:embed configs/sros_config_classic.go.tpl\n+\tcfgTplClassic string\n+\n+\t//go:embed configs/ixr/ixr_config_classic.go.tpl\n+\tcfgTplClassicIxr string\n+\n+\t//go:embed configs/sar/sar_config_classic.go.tpl\n+\tcfgTplClassicSar string\n+)\n+\n // srosTemplateData holds all data needed for template selection and execution.\n type srosTemplateData struct {\n \t// Template selection criteria\n \tNodeType          string\n \tConfigurationMode string\n@@ -43,5 +64,36 @@ type tplIFace struct {\n \tSlot       string\n \tPort       string\n \tBreakoutNo string\n \tMtu        int\n }\n+\n+// getTemplateForVariant returns the template string and name for the given config variant.\n+// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= \"26\").\n+func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {\n+\t// Model-driven (or mixed treated as classic below when family is classic)\n+\tif v.Mode == ConfigModeModelDriven {\n+\t\t// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= \"26\"\n+\t\t// { return cfgTplSROS26, \"clab-sros-config-sros26\" }\n+\t\treturn cfgTplSROS25, \"clab-sros-config-sros25\"\n+\t}\n+\t// Classic (or mixed)\n+\ttmpl = cfgTplClassic\n+\ttplName = \"clab-sros-config-classic\"\n+\tswitch v.Family {\n+\tcase ConfigFamilyIXR:\n+\t\treturn cfgTplClassicIxr, \"clab-sros-config-classic-ixr\"\n+\tcase ConfigFamilySAR:\n+\t\treturn cfgTplClassicSar, \"clab-sros-config-classic-sar\"\n+\tdefault:\n+\t\treturn tmpl, tplName\n+\t}\n+}\n+\n+// selectConfigTemplate chooses the config template from the config variant (mode + family).\n+func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {\n+\tv := n.resolveConfigVariant()\n+\ttmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)\n+\treturn template.New(tplName).\n+\t\tFuncs(clabutils.CreateFuncs()).\n+\t\tParse(tmpl)\n+}\ndiff --git a/nodes/sros/variant.go b/nodes/sros/variant.go\nindex fad585c..85bcac5 100644\n--- a/nodes/sros/variant.go\n+++ b/nodes/sros/variant.go\n@@ -2,11 +2,21 @@\n // Licensed under the BSD 3-Clause License.\n // SPDX-License-Identifier: BSD-3-Clause\n \n package sros\n \n-import \"fmt\"\n+import (\n+\t\"fmt\"\n+\t\"regexp\"\n+)\n+\n+var (\n+\tsarRegexp   = regexp.MustCompile(`(?i)\\bsar-`)\n+\tsarHmRegexp = regexp.MustCompile(`(?i)\\b(sar-hm|sar-hmc)\\b`)\n+\n+\tixrRegexp = regexp.MustCompile(`(?i)\\bixr-`)\n+)\n \n // ConfigMode is the configuration mode (model-driven or classic).\n type ConfigMode string\n \n const (\n@@ -141,5 +151,20 @@ func getSnippetSet(v ConfigVariant) snippetSet {\n \t\t\tgrpc = grpcConfigSARInsecure\n \t\t}\n \t}\n \treturn snippetSet{SystemConfig: sys, GRPCConfig: grpc}\n }\n+\n+// isIXRNode returns true if this is an IXR node type (case-insensitive).\n+func (n *sros) isIXRNode() bool {\n+\treturn ixrRegexp.MatchString(n.Cfg.NodeType)\n+}\n+\n+// isSARNode returns true if this is a SAR node type (case-insensitive).\n+func (n *sros) isSARNode() bool {\n+\treturn sarRegexp.MatchString(n.Cfg.NodeType)\n+}\n+\n+// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).\n+func (n *sros) isSARHmNode() bool {\n+\treturn sarHmRegexp.MatchString(n.Cfg.NodeType)\n+}\ndiff --git a/schemas/clab.schema.json b/schemas/clab.schema.json\nindex 66679ac..0157106 100644\n--- a/schemas/clab.schema.json\n+++ b/schemas/clab.schema.json\n@@ -939,10 +939,12 @@\n                                             \"ixr-6\",\n                                             \"ixr-e2c\",\n                                             \"ixr-e2\",\n                                             \"ixr-e2n\",\n                                             \"ixr-e2n-s\",\n+                                            \"ixr-e2sc\",\n+                                            \"ixr-e3\",\n                                             \"ixr-e3c\",\n                                             \"ixr-e3x\",\n                                             \"ixr-ec\",\n                                             \"ixr-e\",\n                                             \"ixr-r4\",\n@@ -951,10 +953,11 @@\n                                             \"ixr-r6\",\n                                             \"ixr-s\",\n                                             \"ixr-x3\",\n                                             \"ixr-x\",\n                                             \"sar-1\",\n+                                            \"sar-10x\",\n                                             \"sar-hm\",\n                                             \"sar-hmc\",\n                                             \"sar-hx\",\n                                             \"sar-mx\",\n                                             \"sr-1-24d\",\n@@ -2009,11 +2012,14 @@\n                 \"cpm-ixr-e-gnss/imm24-sfp++8-sfp28+2-qsfp28\",\n                 \"cpm-ixr-e/imm14-10g-sfp++4-1g-tx\",\n                 \"cpm-ixr-e/imm24-sfp++8-sfp28+2-qsfp28\",\n                 \"cpm-ixr-e2\",\n                 \"cpm-ixr-e2c\",\n+                \"cpm-ixr-e2n-s/imm4-sfp+4-sfp+-s\",\n                 \"cpm-ixr-e2n/imm4-sfp+4-sfp+\",\n+                \"cpm-ixr-e2sc/imm16-sfp++4-sfp28\",\n+                \"cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd\",\n                 \"cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56\",\n                 \"cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd\",\n                 \"cpm-ixr-ec\",\n                 \"cpm-ixr-s/imm48-sfp++6-qsfp28\",\n                 \"cpm-ixr-x/imm32-qsfp28+4-qsfpdd\",\n@@ -2077,10 +2083,11 @@\n             \"type\": \"string\",\n             \"description\": \"CPM card types for SR OS\",\n             \"enum\": [\n                 \"cpiom-ixr-r6\",\n                 \"cpiom-ixr-r6d\",\n+                \"cpiom-sar-x\",\n                 \"cpm-1\",\n                 \"cpm-1s\",\n                 \"cpm-1se\",\n                 \"cpm-1se/imm36-800g-qsfpdd\",\n                 \"cpm-1x\",\n@@ -2102,11 +2109,14 @@\n                 \"cpm-ixr-e-gnss/imm24-sfp++8-sfp28+2-qsfp28\",\n                 \"cpm-ixr-e/imm14-10g-sfp++4-1g-tx\",\n                 \"cpm-ixr-e/imm24-sfp++8-sfp28+2-qsfp28\",\n                 \"cpm-ixr-e2\",\n                 \"cpm-ixr-e2c\",\n+                \"cpm-ixr-e2n-s/imm4-sfp+4-sfp+-s\",\n                 \"cpm-ixr-e2n/imm4-sfp+4-sfp+\",\n+                \"cpm-ixr-e2sc/imm16-sfp++4-sfp28\",\n+                \"cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd\",\n                 \"cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56\",\n                 \"cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd\",\n                 \"cpm-ixr-ec\",\n                 \"cpm-ixr-r4\",\n                 \"cpm-ixr-s\",\n@@ -2122,11 +2132,12 @@\n                 \"cpm-v/iom-v\",\n                 \"cpm-x20\",\n                 \"cpm2-s\",\n                 \"cpm2-x20\",\n                 \"cpm5\",\n-                \"iom-sar\"\n+                \"iom-sar\",\n+                \"iom-sar-1x\"\n             ]\n         },\n         \"sros-mda-types\": {\n             \"type\": \"string\",\n             \"description\": \"MDA types for SR OS\",\n@@ -2153,10 +2164,11 @@\n                 \"m10-sfp++6-sfp\",\n                 \"m12-sfp28+2-qsfp28\",\n                 \"m14-10g-sfp++4-1g-tx\",\n                 \"m18-25g-sfp28\",\n                 \"m2-100g-qsfp28+16-10g-sfp+\",\n+                \"m2-1g-sfp+2-10g-sfp+\",\n                 \"m2-cfp2\",\n                 \"m2-qsfpdd+2-qsfp28+24-sfp28\",\n                 \"m20-10g-sfp+\",\n                 \"m20-1g-csfp\",\n                 \"m20-v\",\n@@ -2166,11 +2178,13 @@\n                 \"m32-qsfp28+4-qsfpdd\",\n                 \"m36-100g-qsfp28\",\n                 \"m36-qsfpdd\",\n                 \"m4-100g-cfp4\",\n                 \"m4-10g-sfp++1-100g-cfp2\",\n+                \"m4-1g-rj+6-10g-sfp++2-25g-sfp28\",\n                 \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n+                \"m4-rs232-rj45+4-c3794-sfp\",\n                 \"m40-10g-sfp\",\n                 \"m40-10g-sfp-ptp\",\n                 \"m40-200g-sfpdd+6-800g-qsfpdd-1\",\n                 \"m46-10g-sfp+\",\n                 \"m48-400g-qsfpdd-1\",\n@@ -2181,10 +2195,11 @@\n                 \"m5e2-100g-qsfp28+2-800g-qdd\",\n                 \"m5e8-100g-sfp112+2-800g-qdd\",\n                 \"m6-10g-sfp++1-100g-qsfp28\",\n                 \"m6-10g-sfp++4-25g-sfp28\",\n                 \"m6-qsfpdd+48-sfp56\",\n+                \"m8-t1e1-rj48\",\n                 \"m80-1g-csfp\",\n                 \"m80-200g-sfpdd+12-400g-qsfpdd-1\",\n                 \"m80-200g-sfpdd+12-800g-qsfpdd-1x\",\n                 \"ma2-10gb-sfp+12-1gb-sfp\",\n                 \"ma20-1gb-tx\",\ndiff --git a/tests/13-srsim/01-sros-to-linux.robot b/tests/13-srsim/01-sros-to-linux.robot\nindex c4d9cb2..8226dd7 100644\n--- a/tests/13-srsim/01-sros-to-linux.robot\n+++ b/tests/13-srsim/01-sros-to-linux.robot\n@@ -1,9 +1,10 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n Suite Teardown      Run Keyword    Cleanup\n \n \n *** Variables ***\n@@ -21,15 +22,11 @@ Set key-path Variable\n Create SSH keypair - RSA\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    ssh-keygen -t rsa -N \"\" -f ${key-path}-rsa\n \n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-sros\n     ...    username=admin\n@@ -102,7 +99,7 @@ Verify saving config with copy flag\n     [Teardown]    Run    rm -rf ${copy_dst}\n \n \n *** Keywords ***\n Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n+    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n     Run    rm -f ${key-path}*\ndiff --git a/tests/13-srsim/03-sros-dist-to-linux.robot b/tests/13-srsim/03-sros-dist-to-linux.robot\nindex b0c6369..a473880 100644\n--- a/tests/13-srsim/03-sros-dist-to-linux.robot\n+++ b/tests/13-srsim/03-sros-dist-to-linux.robot\n@@ -1,35 +1,23 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         sr03\n ${lab-file-name}    03-srsim-dist.clab.yml\n ${runtime}          docker\n-${key-name}         clab-test-key\n \n \n *** Test Cases ***\n-Set key-path Variable\n-    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}\n-    Set Suite Variable    ${key-path}\n-\n-Create SSH keypair - RSA\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ssh-keygen -t rsa -N \"\" -f ${key-path}-rsa\n-\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-sros-a\n     ...    username=admin\n@@ -55,10 +43,5 @@ Do a gNOI cert get-certs\n     Skip If    '${runtime}' != 'docker'\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    sudo docker run --network host --rm --mount type=bind,source=${CURDIR}/clab-${lab-name}/.tls/ca,target=/tls ghcr.io/karimra/gnoic:0.2.0 cert get-certs --username admin --password 'NokiaSros1!' --tls-ca /tls/ca.pem --address clab-${lab-name}-sros-a\n     Log    ${output}\n     Should Contain    ${output}    sros-a.${lab-name}.io\n-\n-*** Keywords ***\n-Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n-    Run    rm -f ${key-path}*\ndiff --git a/tests/13-srsim/04-sros-classic.robot b/tests/13-srsim/04-sros-classic.robot\nindex efdf58f..16b5811 100644\n--- a/tests/13-srsim/04-sros-classic.robot\n+++ b/tests/13-srsim/04-sros-classic.robot\n@@ -1,9 +1,10 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n Suite Teardown      Run Keyword    Cleanup\n \n \n *** Variables ***\n@@ -23,15 +24,11 @@ Set key-path Variable\n Create SSH keypair - ecdsa512\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    ssh-keygen -t ecdsa -b 521 -N \"\" -f ${key-path}-ecdsa512\n \n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-srsim\n     ...    username=admin\n@@ -58,7 +55,7 @@ Check Mixed Config Mode on srsim\n     Log    ${output}\n     Should Contain    ${output}    mixed\n \n *** Keywords ***\n Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n+    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n     Run    rm -f ${key-path}*\ndiff --git a/tests/13-srsim/05-sros-comp-to-linux.robot b/tests/13-srsim/05-sros-comp-to-linux.robot\nindex 4bb4aac..f7db14e 100644\n--- a/tests/13-srsim/05-sros-comp-to-linux.robot\n+++ b/tests/13-srsim/05-sros-comp-to-linux.robot\n@@ -1,9 +1,10 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n Suite Teardown      Run Keyword    Cleanup\n \n \n *** Variables ***\n@@ -21,15 +22,11 @@ Set key-path Variable\n Create SSH keypair - RSA\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    ssh-keygen -t rsa -N \"\" -f ${key-path}-rsa\n \n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-sros\n     ...    username=admin\n@@ -136,7 +133,7 @@ Ensure XIOM MDA x/1 is equipped and up on sr2s-01\n     Should Contain    ${output}    in-service\n \n \n *** Keywords ***\n Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n+    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n     Run    rm -f ${key-path}*\ndiff --git a/tests/13-srsim/06-srsim-sar.robot b/tests/13-srsim/06-srsim-sar.robot\nindex 0633c48..0ef2dfa 100644\n--- a/tests/13-srsim/06-srsim-sar.robot\n+++ b/tests/13-srsim/06-srsim-sar.robot\n@@ -1,33 +1,25 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         sr06\n ${lab-file-name}    06-srsim-sar.clab.yml\n ${runtime}          docker\n-${key-name}         clab-test-key\n ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n ${gnmic_flags}      --username admin --password NokiaSros1! --values-only\n \n \n *** Test Cases ***\n-Set key-path Variable\n-    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}\n-    Set Suite Variable    ${key-path}\n-\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-sar3\n     ...    username=admin\n@@ -45,10 +37,5 @@ Check Config Mode on sar1\n Check Config Mode on sar2\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --insecure --address clab-${lab-name}-sar2 get --path /state/system/management-interface/configuration-oper-mode\n     Log    ${output}\n     Should Contain    ${output}    model-driven\n-\n-*** Keywords ***\n-Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n-    Run    rm -f ${key-path}*\ndiff --git a/tests/13-srsim/07-srsim-with-mgmt-network.robot b/tests/13-srsim/07-srsim-with-mgmt-network.robot\nindex 5025036..ce0951f 100644\n--- a/tests/13-srsim/07-srsim-with-mgmt-network.robot\n+++ b/tests/13-srsim/07-srsim-with-mgmt-network.robot\n@@ -1,31 +1,23 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         sr07\n ${lab-file-name}    07-srsim-mix.clab.yml\n ${runtime}          docker\n-${key-name}         clab-test-key\n \n \n *** Test Cases ***\n-Set key-path Variable\n-    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}\n-    Set Suite Variable    ${key-path}\n-\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-srsim10\n     ...    username=admin\n@@ -57,15 +49,10 @@ Do a gNMI GET using TLS\n     Log    ${output}\n     Should Be Equal As Integers    ${rc}    0\n     Should Contain    ${output}    srsim10-a\n \n *** Keywords ***\n-Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n-    Run    rm -f ${key-path}*\n-\n-\n Do a gNOI ping to other node\n     Skip If    '${runtime}' != 'docker'\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    sudo docker run --network host --rm --mount type=bind,source=${CURDIR}/clab-${lab-name}/.tls/ca,target=/tls ghcr.io/karimra/gnoic:0.2.0 system ping --username admin --password 'NokiaSros1!' --tls-ca /tls/ca.pem --address clab-${lab-name}-srsim10 --destination 100.0.0.11 --ns Base --count 3\n     Log    ${output}\ndiff --git a/tests/13-srsim/08-srsim-comp-cfg-test.robot b/tests/13-srsim/08-srsim-comp-cfg-test.robot\nindex d276341..c531df4 100644\n--- a/tests/13-srsim/08-srsim-comp-cfg-test.robot\n+++ b/tests/13-srsim/08-srsim-comp-cfg-test.robot\n@@ -1,11 +1,12 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         comp-cfg-gen-test\n ${lab-file-name}    08-srsim-comp-cfg-test.clab.yml\n@@ -14,15 +15,11 @@ ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n ${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n \n \n *** Test Cases ***\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Wait for 45s\n     Sleep    45s    Let everything fully provision & come up\n \n Check SR-1 card configuration\n@@ -121,13 +118,10 @@ Check SR-2s-ncofg has unprovisioned card\n     Log    ${output}\n     Should Be Equal As Integers    ${rc}    0\n     Should Contain    ${output}    unprovisioned\n \n *** Keywords ***\n-Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n-\n Check SR-2S MDA state\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr2s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/hardware-data/oper-state\n     Log    ${output}\n     Should Be Equal As Integers    ${rc}    0\ndiff --git a/tests/13-srsim/09-srsim-pause-container.robot b/tests/13-srsim/09-srsim-pause-container.robot\nindex 0f96bd7..90f57c3 100644\n--- a/tests/13-srsim/09-srsim-pause-container.robot\n+++ b/tests/13-srsim/09-srsim-pause-container.robot\n@@ -1,12 +1,13 @@\n *** Settings ***\n Library             OperatingSystem\n Library             Process\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         srsim-pause-ctr\n ${lab-file-name}    09-srsim-pause-container.clab.yml\n@@ -15,15 +16,11 @@ ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n ${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n \n \n *** Test Cases ***\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Wait for 45s\n     Sleep    45s    Let everything fully provision & come up\n \n # IPv4\n@@ -165,11 +162,5 @@ Check CPM SSH\n         Should Contain    ${output}    TiMOS\n         Should Match Regexp    ${output}    ${slot}:admin@[^\\\\r\\\\n]+#\n     FINALLY\n         SSHLibrary.Close All Connections\n     END\n-\n-Cleanup\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\ndiff --git a/tests/13-srsim/10-srsim-lifecycle.robot b/tests/13-srsim/10-srsim-lifecycle.robot\nindex c9085d9..0b24da2 100644\n--- a/tests/13-srsim/10-srsim-lifecycle.robot\n+++ b/tests/13-srsim/10-srsim-lifecycle.robot\n@@ -1,25 +1,22 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         lifecycle-test-srsim\n ${lab-file-name}    10-srsim-lifecycle.clab.yml\n ${runtime}          docker\n \n \n *** Test Cases ***\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure client can ping integrated SR OS node\n     Sleep    20s    give time for SR OS nodes to boot\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\\=client --cmd \"ping -c2 -W2 10.0.1.2\"\n@@ -85,10 +82,5 @@ Verify ping to distributed SR OS recovers after start\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\\=client --cmd \"ping -c2 -W2 10.0.2.2\"\n     Log    ${output}\n     Should Be Equal As Integers    ${rc}    0\n     Should Match Regexp    ${output}    2 packets transmitted, 2 (packets )?received, 0% packet loss\n-\n-\n-*** Keywords ***\n-Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\ndiff --git a/tests/13-srsim/12-srsim-veth-stitch.robot b/tests/13-srsim/12-srsim-veth-stitch.robot\nindex fac9fe1..9f70b9f 100644\n--- a/tests/13-srsim/12-srsim-veth-stitch.robot\n+++ b/tests/13-srsim/12-srsim-veth-stitch.robot\n@@ -1,11 +1,12 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         veth-stitch\n ${lab-file-name}    12-srsim-veth-stitch.clab.yml\n@@ -14,15 +15,11 @@ ${sros-password}    NokiaSros1!\n ${peer-ip}          10.0.0.2\n \n \n *** Test Cases ***\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure distributed sros can ping sros2 over the veth-stitch link\n     Wait Until Keyword Succeeds    3 minutes    10 seconds    Ping succeeds    sros    ${peer-ip}\n \n Verify inspect interfaces returns the host-side stitch interfaces\n@@ -87,13 +84,10 @@ Verify the stitch interfaces are removed on destroy\n     Log    ${output}\n     Should Not Contain    ${output}    clab-s-\n \n \n *** Keywords ***\n-Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n-\n Ping over SSH\n     [Arguments]    ${node}    ${dst}\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-${node}\n     ...    username=admin\ndiff --git a/tests/13-srsim/13-srsim-integrated.clab.yml b/tests/13-srsim/13-srsim-integrated.clab.yml\nnew file mode 100644\nindex 0000000..a3f2ca3\n--- /dev/null\n+++ b/tests/13-srsim/13-srsim-integrated.clab.yml\n@@ -0,0 +1,33 @@\n+# yaml-language-server: $schema=../../schemas/clab.schema.json\n+name: srsim-integrated\n+\n+topology:\n+  kinds:\n+    nokia_srsim:\n+      license: /opt/nokia/sros/license.txt\n+      image: registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\n+\n+  nodes:\n+    ixr-e2n:\n+      kind: nokia_srsim\n+      type: ixr-e2n\n+      components:\n+        - type: cpm-ixr-e2n/imm4-sfp+4-sfp+\n+\n+    ixr-r6:\n+      kind: nokia_srsim\n+      type: ixr-r6\n+      components:\n+        - slot: A\n+        - slot: B\n+\n+    sr-1s:\n+      kind: nokia_srsim\n+      type: sr-1s\n+      components:\n+        - xiom:\n+            - slot: 1\n+              type: iom-s-3.0t\n+              mda:\n+                - slot: 1\n+                  type: ms18-100gb-qsfp28\ndiff --git a/tests/13-srsim/13-srsim-integrated.robot b/tests/13-srsim/13-srsim-integrated.robot\nnew file mode 100644\nindex 0000000..8f6b929\n--- /dev/null\n+++ b/tests/13-srsim/13-srsim-integrated.robot\n@@ -0,0 +1,105 @@\n+*** Settings ***\n+Library             OperatingSystem\n+Resource            ../ssh.robot\n+Resource            ../common.robot\n+Resource            ../srsim.robot\n+\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n+\n+\n+*** Variables ***\n+${lab-name}         srsim-integrated\n+${lab-file-name}    13-srsim-integrated.clab.yml\n+${runtime}          docker\n+${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n+${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n+\n+\n+*** Test Cases ***\n+Deploy ${lab-name} lab\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n+\n+Wait for 45s\n+    Sleep    45s    Let everything fully provision & come up\n+\n+Check IXR-E2N card override is passed to the container\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} inspect clab-${lab-name}-ixr-e2n --format '{{range .Config.Env}}{{println .}}{{end}}'\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    NOKIA_SROS_CARD=cpm-ixr-e2n/imm4-sfp+4-sfp+\n+\n+Check IXR-E2N equipped card matches the component\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-e2n --path /state/card[slot-number=1]/equipped-type\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    imm4-sfp+4-sfp+\n+\n+Check IXR-R6 standby CPM slot is set\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} inspect clab-${lab-name}-ixr-r6-b --format '{{range .Config.Env}}{{println .}}{{end}}'\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    NOKIA_SROS_SLOT=B\n+\n+Check IXR-R6 card configuration\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /configure/card[slot-number=1]/card-type\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    iom-ixr-r6\n+\n+Check IXR-R6 MDA configuration\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /configure/card[slot-number=1]/mda[mda-slot=1]/mda-type\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    m6-10g-sfp++1-100g-qsfp28\n+\n+Ensure IXR-R6 CPM A is up\n+    Wait Until Keyword Succeeds    2 minutes    10 seconds    Check IXR-R6 CPM state    A\n+\n+Ensure IXR-R6 CPM B is up\n+    Wait Until Keyword Succeeds    3 minutes    10 seconds    Check IXR-R6 CPM state    B\n+\n+\n+Check SR-1s equipped card\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/equipped-type\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    xcm-1s\n+\n+Check SR-1s equipped XIOM\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/equipped-type\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    iom-s-3.0t\n+\n+Check SR-1s equipped XIOM MDA\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/equipped-type\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    ms18-100gb-qsfp28\n+\n+Ensure SR-1s XIOM MDA is up\n+    Wait Until Keyword Succeeds    2 minutes    10 seconds    Check SR-1s XIOM MDA state\n+\n+*** Keywords ***\n+Check IXR-R6 CPM state\n+    [Arguments]    ${slot}\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /state/cpm[cpm-slot=${slot}]/hardware-data/oper-state\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    in-service\n+\n+Check SR-1s XIOM MDA state\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/hardware-data/oper-state\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    in-service\ndiff --git a/tests/13-srsim/14-srsim-new-chassis.clab.yml b/tests/13-srsim/14-srsim-new-chassis.clab.yml\nnew file mode 100644\nindex 0000000..f5f3bc2\n--- /dev/null\n+++ b/tests/13-srsim/14-srsim-new-chassis.clab.yml\n@@ -0,0 +1,53 @@\n+# yaml-language-server: $schema=../../schemas/clab.schema.json\n+name: srsim-new-chassis\n+\n+topology:\n+  kinds:\n+    nokia_srsim:\n+      license: /opt/nokia/sros/license.txt\n+      image: registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\n+\n+  nodes:\n+    ixr-e2sc:\n+      kind: nokia_srsim\n+      type: ixr-e2sc\n+\n+    ixr-e3:\n+      kind: nokia_srsim\n+      type: ixr-e3\n+\n+    sar-10x:\n+      kind: nokia_srsim\n+      type: sar-10x\n+      components:\n+        - slot: A\n+          type: cpiom-sar-x\n+          mda: &mdas\n+            - slot: 1\n+              type: m2-1g-sfp+2-10g-sfp+\n+            - slot: 2\n+              type: m8-t1e1-rj48\n+            - slot: 3\n+              type: m2-1g-sfp+2-10g-sfp+\n+            - slot: 4\n+              type: m4-rs232-rj45+4-c3794-sfp\n+            - slot: 5\n+              type: m8-t1e1-rj48\n+            - slot: 6\n+              type: m4-rs232-rj45+4-c3794-sfp\n+            - slot: 7\n+              type: m8-t1e1-rj48\n+            - slot: 8\n+              type: m4-rs232-rj45+4-c3794-sfp\n+        - slot: B\n+          type: cpiom-sar-x\n+          mda: *mdas\n+      startup-config: |\n+        /configure card 1 mda 1 mda-type m2-1g-sfp+2-10g-sfp+ admin-state enable\n+        /configure card 1 mda 2 mda-type m8-t1e1-rj48 admin-state enable\n+        /configure card 1 mda 3 mda-type m2-1g-sfp+2-10g-sfp+ admin-state enable\n+        /configure card 1 mda 4 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable\n+        /configure card 1 mda 5 mda-type m8-t1e1-rj48 admin-state enable\n+        /configure card 1 mda 6 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable\n+        /configure card 1 mda 7 mda-type m8-t1e1-rj48 admin-state enable\n+        /configure card 1 mda 8 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable\ndiff --git a/tests/13-srsim/14-srsim-new-chassis.robot b/tests/13-srsim/14-srsim-new-chassis.robot\nnew file mode 100644\nindex 0000000..0f1b08a\n--- /dev/null\n+++ b/tests/13-srsim/14-srsim-new-chassis.robot\n@@ -0,0 +1,83 @@\n+*** Settings ***\n+Library             OperatingSystem\n+Library             String\n+Resource            ../common.robot\n+Resource            ../srsim.robot\n+\n+Suite Setup         Skip If    '${26_10_TESTS}'.lower() != 'true'\n+...                 SR-SIM 26.10 is required; enable with --variable 26_10_TESTS:true\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n+\n+\n+*** Variables ***\n+${lab-name}         srsim-new-chassis\n+${lab-file-name}    14-srsim-new-chassis.clab.yml\n+${runtime}          docker\n+${26_10_TESTS}      false\n+${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n+${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n+\n+\n+*** Test Cases ***\n+Deploy ${lab-name} lab\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n+\n+Check ixr-e2sc chassis\n+    Check chassis    ixr-e2sc    ixr-e2sc\n+\n+Check ixr-e3 chassis\n+    Check chassis    ixr-e3    ixr-e3\n+\n+Check sar-10x chassis\n+    Check chassis    sar-10x-a    sar-10x\n+    Check chassis    sar-10x-b    sar-10x\n+\n+Ensure new chassis containers stay running\n+    Sleep    30s    Let the simulators get past initial startup\n+    Check container is running    ixr-e2sc\n+    Check container is running    ixr-e3\n+    Check container is running    sar-10x-a\n+    Check container is running    sar-10x-b\n+\n+Check sar-10x line cards are up\n+    Wait Until Keyword Succeeds    3 minutes    15 seconds    SAR-10x line cards are up\n+\n+*** Keywords ***\n+SAR-10x line cards are up\n+    # Query card 1, MDAs 1/1..1/8, then card 2 in chassis order.\n+    ${command} =    Catenate    SEPARATOR=${SPACE}\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags}\n+    ...    --address clab-${lab-name}-sar-10x\n+    ...    --path /state/card[slot-number=1]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=1]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=2]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=3]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=4]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=5]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=6]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=7]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=8]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=2]/hardware-data/oper-state\n+    ${rc}    ${output} =    Run And Return Rc And Output    ${command}\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    ${up_states} =    Get Regexp Matches    ${output}    in-service\n+    Length Should Be    ${up_states}    10\n+    Should Not Contain    ${output}    null\n+\n+Check chassis\n+    [Arguments]    ${node}    ${chassis}\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} inspect clab-${lab-name}-${node} --format '{{range .Config.Env}}{{println .}}{{end}}'\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    NOKIA_SROS_CHASSIS=${chassis}\n+\n+Check container is running\n+    [Arguments]    ${node}\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} inspect clab-${lab-name}-${node} --format '{{.State.Running}}'\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    ${state} =    Strip String    ${output}\n+    Should Be Equal    ${state}    true\ndiff --git a/tests/srsim.robot b/tests/srsim.robot\nnew file mode 100644\nindex 0000000..6d7c7fc\n--- /dev/null\n+++ b/tests/srsim.robot",
        "lineStart": 2501,
        "lineEnd": 3899,
        "totalLines": 3900,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346628403,
      "end": 1792346628431
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502f2153001ZWZsJigLb6iUHi",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502ed01c001YCpcFvJ3o9WYH6",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 101068,
    "input": 99754,
    "output": 27,
    "reasoning": 1287,
    "cache": {
      "read": 0,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502ed01c001YCpcFvJ3o9WYH6",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346607644,
    "completed": 1792346628439
  },
  "parentID": "msg_1502e41aa001XEn2l1GdfLHjHR",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 101068,
    "input": 99754,
    "output": 27,
    "reasoning": 1287,
    "cache": {
      "read": 0,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
User · 22
compaction
{
  "type": "compaction",
  "id": "prt_1502f2159001ah3jS46nB5bnib",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502f2158001O67Rj9uC9d2IPd",
  "auto": true,
  "overflow": false
}
Message metadata
{
  "role": "user",
  "id": "msg_1502f2158001O67Rj9uC9d2IPd",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346628440
  },
  "summary": {
    "diffs": []
  },
  "agent": "tofarev",
  "model": {
    "providerID": "tofarev",
    "modelID": "zai-org/GLM-5.3-Flash"
  }
}
Assistant · 23
step-start
{
  "type": "step-start",
  "id": "prt_1502f2959001s4qnw58H4KlWQc",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502f216f001OjleXo6mnSylCp"
}
Reasoning
Combine the prior summary with the new conversation progress. The conversation shows deep reading of head files and diff segments. Update completed/active accordingly.
## Objective
- Perform a source-only read-only code review of the PR snapshot at `/source` (containerlab repo), covering all 31 changed paths, callers/tests/docs/schema, and return the trusted result schema with disclosed limitation that tests were not executed.

## Important Details
- Head: `d44c69f72ab156474197f12b6fc1407b3f8a65c4`; base/mergeBase: `84cf630e6eedd662d9742fbcd6158a91372e3a56`.
- Permalink roots: head=`https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/`, base=`https://github.com/srl-labs/containerlab/blob/84cf630e6eedd662d9742fbcd6158a91372e3a56/`.
- Tooling constraint: plain `read("/source")` is denied; must read explicit file paths. Large files need offset/limit reads (diff.txt read in chunks).
- Standards applied (from `standards.json`): `.cursor/rules/karpathy-guidelines.mdc` (surgical changes) and `.cursor/rules/ponytail.mdc` (simplest solution, shortest diff).
- PR theme: major refactor of `nodes/sros` package — code moved out of `sros.go` into new/split files (`chassis_info.go`, `component.go`, `component_config.go`, `config.go`, `netns.go`, `power.go`, `template.go`, `variant.go`), plus new chassis_info-driven component validation with warnings, SR-SIM components model (CPM/line-card/XIOM/MDA), integrated vs distributed node handling, and CI test-matrix sharding.
- Key head-file facts learned:
  - `chassis_info.go`: `DefaultChassisInfoPath = "/opt/nokia/chassis_info.json"`, `parseChassisInfo`, `chassisInfo.entry(nodeType)` with case-insensitive match + alias support, `componentWarnings(...)` producing warnings for unsupported CPM/IOM/MDA/XIOM/SFM types, `iom_slots` exceeding, fixed MDA mismatch. `chassisInfoFileLicense` const prepended (copyright 2026).
  - `component.go`: `Component{Slot,Type,Env,XIOM,MDA}`, `componentsBySlot` (uppercase/trim, `#N` fallback key), `MDAS.UnmarshalYAML` validates slot>0 and type non-empty.
  - `component_config.go`: `integratedSrosDefaultComponents` map (sr-1, sr-1s, ixr-r6, ixr-e2, ixr-e2c, ixr-e2n, ixr-e2n-s, ixr-e3c, …) with `cardType`, `allowedSlots`, default `mdas`.
  - `config.go`: `setVersionSpecificParams` (semver < v26.0 adds md-cli/grpc/profile/tls13-cipher snippets), `buildPKIImportXML` (etree NETCONF action), `createSROSConfigFiles` (version detection from image with fallback to `srosDefaultVersion`, cf3 path `n.Cfg.Env[envNokiaSrosSlot]/config/cf3/config.cfg`, partial-config support).
  - `netns.go`: `namespaceNode` wrapper, `newNetnsConfig` builds `srsim-netns` labels (`NodeName`, `LongName`, `NodeType`, `InternalNode`, `RootNodeName`, `RootNodeLongName`).
  - `power.go`: `srosPowerConfig` map (sr-1s/se, sr-2s/se: modules map ac/hv=3 dc=4; sr-7s/sr-14s: 10 modules, 2 shelves), `generatePowerConfig` builds power-shelf/module config lines with `ps-a%d-shelf-dc` and `ps-a-dc-6000`.
  - `template.go`: embedded templates `cfgTplSROS25`, `cfgTplClassic`, `cfgTplClassicIxr`, `cfgTplClassicSar`; `srosTemplateData` struct (incl. `ComponentConfig` field); `getTemplateForVariant(v ConfigVariant, swVersion...)` — swVersion noted "for future SR OS 26+ template selection".
  - `variant.go`: `ConfigMode` (model-driven/classic/mixed) with strict UnmarshalYAML, `ConfigFamily` (sr/ixr/sar), `ConfigVariant{Mode,Family,SecureGrpc,ForceClassic}` (ForceClassic for SAR-Hm).
  - `sros.go`: consts `slotAName="A"`, `slotBName="B"`, `standaloneSlotName=slotAName`, scrapli platforms, config dirs; `MonitorLogs` (srosRejectedCfgMsg → exitChan error), `verifyNokiaSrsimImage` (checks OCI title label == "srsim"; skips when runtime "not implemented" e.g. Podman).
  - `sros_test.go`: `TestSrosLinkApplyMode`, `TestCheckPortWithRetry`, mocknodes/mockruntime usage.
  - `chassis_info_test.go`: TestChassisInfoComponentWarnings (supported config empty; 5 warnings with SFM type/component type/exceeds/MDA type; fixed MDA mismatch case).
- Candidate findings noted (not yet finalized):
  - `checkComponentSlotsConfig` doesn't TrimSpace before ToUpper (duplicate " a" vs "A" undetected) — moved code, pre-existing, likely not a PR finding.
  - Package-level `srosEnv` map mutated per-node in `Init` (`srosEnv[envNokiaSrosChassis] = n.Cfg.NodeType` etc.) — pre-existing (not in diff), potential data race across concurrent Init.
  - Possible inconsistency: `generateIntegratedComponentConfig` reads `n.Cfg.Env[envNokiaSrosCard]` while `hardwareEnv()` prefers `n.userEnv` — resolved as OK by reasoning: user env merged into `n.Cfg.Env` via `clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)`; component configs inherit node env via deep copy, so both paths work.
  - `warnUserEnvOverrides` duplicated inline in `Init` for SFM vs helper — minor.
  - New behavior (intentional, covered by test `single_slot_integrated_allows_card_type_override`): `setupStandaloneComponents` now allows card-type override on single-slot integrated types (sets `NOKIA_SROS_CARD`); `generateIntegratedComponentConfig` skips generation when `NOKIA_SROS_CARD` is set.
  - Distributed flow verified by reasoning: base node's PreDeploy sets `preDeployParams` then returns early (no files) for distributed base; component nodes (`isDistributedCardNode` + `isCPM("")`) run `createSROSFiles` → `createSROSConfigFiles` → `generateComponentConfig` → `generateIntegratedComponentConfig` for integrated redundant (ixr-r6 A+B only; other integrated types allow only slot A → standalone).
- Workflow change: CI matrix now 5 named shards (basic/lifecycle/components/provisioning/apply) grouping robot suites; `SRSIM_IMAGE_TAG: 26.7.R1`; removed "Sanitize test-suite name" step; quoting fixes.
- Robot tests refactored to shared `Resource ../srsim.robot` with `Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}` teardown; per-suite SSH keygen boilerplate removed.
- Diff file is large (~3547+ lines); read so far: lines 1–1200, 1201–2500, 2501–~2548 (tail of sros.go hunks at 2548 transitions to `sros_test.go` diff).

## Work State
### Completed
- Read standards (`standards.json`, karpathy-guidelines.mdc, ponytail.mdc) and learned read-tool constraints.
- Read manifest.json (changed-path list captured in prior summary; tail possibly still truncated).
- Read head files: `nodes/sros/chassis_info.go`, `component.go`, `component_config.go`, `config.go`, `netns.go`, `power.go`, `sros.go` (start + lines 1700+), `variant.go`, `template.go`, `chassis_info_test.go`, `sros_test.go` (truncated reads — content beyond truncation points unseen).
- Read diff.txt segments: lines 1–1200 (workflow hunks), 1201–2500 (component_config/config.go hunks), 2501–2548 (end of sros.go deletions incl. `ensureNetnsRunning` removal; sros_test.go diff starts at 2548).
- Resolved env-override consistency question (`Cfg.Env` vs `userEnv`) and traced PreDeploy flow for integrated/distributed nodes (documented above in Important Details).
- Collected candidate findings (pre-existing/global map race, TrimSpace in slot dedup, warnUserEnvOverrides duplication) with base-version checks showing most are moved/pre-existing.

### Active
- Finish reading diff.txt from line ~2548 to EOF (remaining hunks: sros_test.go, schema, docs, README, robot tests, possibly srsim.robot resource).
- Verify the full 31-path manifest tail (paths beyond `tests/13-srsim/04-sros-classic.robot`).
- Read remaining head files not yet seen: `docs/manual/kinds/sros.md`, `nodes/sros/README.md`, `schemas/clab.schema.json`, `tests/13-srsim/srsim.robot` (if new), remaining robot test diffs.
- Assemble final review verdict and return trusted result schema, disclosing that tests were not executed.

### Blocked
- None blocking; only output truncation requiring offset reads and directory-read denial (worked around with explicit paths).

## Next Move
1. Continue reading `/source/diff.txt` from offset ~2548 to EOF in chunks (≤1200–1400 lines per read) to capture remaining sros_test.go, schema, docs, README, and robot-test hunks.
2. Read/verify remaining head files (`schemas/clab.schema.json`, `docs/manual/kinds/sros.md`, `nodes/sros/README.md`, `tests/13-srsim/srsim.robot`, any unread test diffs) and confirm the complete manifest changed-path list.
3. Produce the final structured review per trusted result schema with disclosed limitation that tests were not executed.

## Relevant Files
- `/source/manifest.json`: authoritative list of all 31 changed paths and statuses (tail verification pending).
- `/source/diff.txt`: full PR diff; read up to line ~2548; remaining tail (sros_test.go, schema, docs, README, tests) pending.
- `nodes/sros/{chassis_info.go,component.go,component_config.go,config.go,netns.go,power.go,template.go,variant.go,sros.go}`: core Go changes — all head files read (some truncated mid-file; e.g. chassis_info.go truncated at line 57, component.go at ~75, config.go at ~56, netns.go at ~63, power.go at ~90, template.go at ~72, variant.go at ~64, sros.go start + 1700–1753 seen).
- `nodes/sros/{chassis_info_test.go,sros_test.go}`: tests read (truncated portions unseen).
- `schemas/clab.schema.json`: schema consistency check pending.
- `docs/manual/kinds/sros.md`, `nodes/sros/README.md`: docs consistency check pending.
- `.github/workflows/srsim-tests.yml`: CI matrix sharding changes (hunk read; verify rest of file hunk in diff).
- `tests/13-srsim/*.robot` and likely-new `tests/13-srsim/srsim.robot`: test refactor to `Destroy SR-SIM Lab` keyword; diffs pending.
- `/source/standards.json`, `/source/standards/{karpathy-guidelines.mdc,ponytail.mdc}`: review standards applied.
- GitHub permalinks (head/base roots above) for citing file versions in the final review.
step-finish
{
  "type": "step-finish",
  "id": "prt_1502f68e6001PQ31CjvuIPGSz8",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502f216f001OjleXo6mnSylCp",
  "reason": "stop",
  "cost": 0,
  "tokens": {
    "total": 18541,
    "input": 15859,
    "output": 2653,
    "reasoning": 29,
    "cache": {
      "read": 0,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502f216f001OjleXo6mnSylCp",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346628463,
    "completed": 1792346646769
  },
  "parentID": "msg_1502f2158001O67Rj9uC9d2IPd",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "compaction",
  "agent": "compaction",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "summary": true,
  "cost": 0,
  "tokens": {
    "total": 18541,
    "input": 15859,
    "output": 2653,
    "reasoning": 29,
    "cache": {
      "read": 0,
      "write": 0
    }
  },
  "finish": "stop"
}
User · 24
Continue if you have next steps, or stop and ask for clarification if you are unsure how to proceed.
Message metadata
{
  "role": "user",
  "id": "msg_1502f68f300142aYYM85hGexse",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346646771
  },
  "summary": {
    "diffs": []
  },
  "agent": "tofarev",
  "model": {
    "providerID": "tofarev",
    "modelID": "zai-org/GLM-5.3-Flash"
  }
}
Assistant · 25
step-start
{
  "type": "step-start",
  "id": "prt_1502f6d8f001IJ1kTe2SOQjyXj",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502f69070017hU0PHIctAauDc"
}
Reasoning
Continue: read diff.txt from offset 2548, and verify manifest.json tail.
read · completed

Input

{
  "filePath": "/source/diff.txt",
  "offset": 2548,
  "limit": 1400
}

Output

<path>/source/diff.txt</path>
<type>file</type>
<content>
2548: diff --git a/nodes/sros/sros_test.go b/nodes/sros/sros_test.go
2549: index 29cace9..dd8aea6 100644
2550: --- a/nodes/sros/sros_test.go
2551: +++ b/nodes/sros/sros_test.go
2552: @@ -272,10 +272,16 @@ func Test_sros_generateComponentConfig(t *testing.T) {
2553:  			name:     "integrated_ixr_e3x_default",
2554:  			nodeType: "ixr-e3x",
2555:  			cardType: "imm16-sfp112+15-sfp56+6-qsfpdd",
2556:  			mdas:     MDAS{{Slot: 1, Type: "m16-sfp112+15-sfp56+6-qsfpdd"}},
2557:  		},
2558: +		{
2559: +			name:     "integrated_ixr_e2sc_default",
2560: +			nodeType: "ixr-e2sc",
2561: +			cardType: "imm16-sfp++4-sfp28",
2562: +			mdas:     MDAS{{Slot: 1, Type: "m16-sfp++4-sfp28"}},
2563: +		},
2564:  		{
2565:  			name:     "integrated_ixr_ec_default",
2566:  			nodeType: "ixr-ec",
2567:  			cardType: "imm4-1g-tx+20-1g-sfp+6-10g-sfp+",
2568:  			mdas:     MDAS{{Slot: 1, Type: "m4-1g-tx+20-1g-sfp+6-10g-sfp+"}},
2569: @@ -311,40 +317,116 @@ func Test_sros_generateComponentConfig(t *testing.T) {
2570:  				assert.Equal(t, 4, strings.Count(cfg, "power-module-type ps-a-dc-6000"))
2571:  			}
2572:  		})
2573:  	}
2574:  
2575: -	t.Run("integrated_env_overrides_preserve_default_mda_slots", func(t *testing.T) {
2576: +	t.Run("integrated_component_mda_override_preserves_default_mda_slots", func(t *testing.T) {
2577: +		n := newSrosComponentConfigTestNode("sr-1", nil, []*Component{
2578: +			{MDA: MDAS{{Slot: 1, Type: "custom-mda"}}},
2579: +		})
2580: +
2581: +		cfg := n.generateComponentConfig()
2582: +
2583: +		assert.Contains(t, cfg, "/configure card 1 card-type iom-1 admin-state enable")
2584: +		assert.Contains(t, cfg, "/configure card 1 mda 1 mda-type custom-mda admin-state enable")
2585: +		assert.Contains(
2586: +			t,
2587: +			cfg,
2588: +			"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable",
2589: +		)
2590: +	})
2591: +
2592: +	t.Run("integrated_xiom_replaces_default_mdas", func(t *testing.T) {
2593: +		n := newSrosComponentConfigTestNode("sr-1s", nil, []*Component{
2594: +			{
2595: +				XIOM: XIOMS{
2596: +					{
2597: +						Slot: 1,
2598: +						Type: "iom-s-3.0t",
2599: +						MDA: MDAS{
2600: +							{Slot: 1, Type: "ms18-100gb-qsfp28"},
2601: +							{Slot: 2, Type: "ms2-400gb-qsfpdd+2-100gb-qsfp28"},
2602: +						},
2603: +					},
2604: +				},
2605: +			},
2606: +		})
2607: +
2608: +		cfg := n.generateComponentConfig()
2609: +
2610: +		assert.Contains(t, cfg, "/configure card 1 card-type xcm-1s admin-state enable")
2611: +		assert.Contains(t, cfg, "/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable")
2612: +		assert.Contains(
2613: +			t,
2614: +			cfg,
2615: +			"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable",
2616: +		)
2617: +		assert.Contains(
2618: +			t,
2619: +			cfg,
2620: +			"/configure card 1 xiom x1 mda 2 mda-type ms2-400gb-qsfpdd+2-100gb-qsfp28 admin-state enable",
2621: +		)
2622: +		assert.NotContains(t, cfg, "s36-100gb-qsfp28")
2623: +	})
2624: +
2625: +	t.Run("integrated_env_mda_overrides_default_component_config", func(t *testing.T) {
2626:  		n := newSrosComponentConfigTestNode(
2627:  			"sr-1",
2628: -			map[string]string{
2629: -				envNokiaSrosCard:       "env-card",
2630: -				envNokiaSrosMDA + "_1": "env-mda",
2631: -			},
2632: +			map[string]string{envNokiaSrosMDA + "_1": "env-mda"},
2633:  			nil,
2634:  		)
2635:  
2636:  		cfg := n.generateComponentConfig()
2637:  
2638: -		assert.Contains(t, cfg, "/configure card 1 card-type env-card admin-state enable")
2639: -		assert.Contains(t, cfg, "/configure card 1 mda 1 mda-type env-mda admin-state enable")
2640: +		assert.Contains(
2641: +			t,
2642: +			cfg,
2643: +			"/configure card 1 mda 1 mda-type env-mda admin-state enable",
2644: +		)
2645:  		assert.Contains(
2646:  			t,
2647:  			cfg,
2648:  			"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable",
2649:  		)
2650: +		assert.NotContains(t, cfg, "me6-100gb-qsfp28")
2651:  	})
2652:  
2653: -	t.Run("integrated_env_override_adds_mda_slot", func(t *testing.T) {
2654: +	t.Run("integrated_env_mda_overrides_component_mda", func(t *testing.T) {
2655:  		n := newSrosComponentConfigTestNode(
2656: -			"ixr-r6",
2657: +			"sr-1",
2658: +			map[string]string{envNokiaSrosMDA + "_1": "from-env"},
2659: +			[]*Component{{MDA: MDAS{{Slot: 1, Type: "from-component"}}}},
2660: +		)
2661: +
2662: +		cfg := n.generateComponentConfig()
2663: +
2664: +		assert.Contains(
2665: +			t,
2666: +			cfg,
2667: +			"/configure card 1 mda 1 mda-type from-env admin-state enable",
2668: +		)
2669: +		assert.NotContains(t, cfg, "from-component")
2670: +	})
2671: +
2672: +	t.Run("integrated_card_override_skips_component_config", func(t *testing.T) {
2673: +		n := newSrosComponentConfigTestNode(
2674: +			"sr-1s",
2675:  			map[string]string{
2676: -				envNokiaSrosMDA + "_3": "m20-1g-csfp",
2677: +				envNokiaSrosCard:       "cpm-1s",
2678: +				envNokiaSrosMDA + "_1": "env-mda",
2679:  			},
2680:  			nil,
2681:  		)
2682:  
2683: +		assert.Empty(t, n.generateComponentConfig())
2684: +	})
2685: +
2686: +	t.Run("integrated_component_override_adds_mda_slot", func(t *testing.T) {
2687: +		n := newSrosComponentConfigTestNode("ixr-r6", nil, []*Component{
2688: +			{MDA: MDAS{{Slot: 3, Type: "m20-1g-csfp"}}},
2689: +		})
2690: +
2691:  		cfg := n.generateComponentConfig()
2692:  
2693:  		assert.Contains(
2694:  			t,
2695:  			cfg,
2696: @@ -415,41 +497,174 @@ func Test_sros_integratedComponentOverrides(t *testing.T) {
2697:  		require.NoError(t, err)
2698:  		assert.True(t, n.isStandaloneNode())
2699:  		assert.Equal(t, slotBName, n.Cfg.Env[envNokiaSrosSlot])
2700:  		assert.Equal(t, "cpiom-ixr-r6", n.Cfg.Env[envNokiaSrosCard])
2701:  		assert.Equal(t, "m20-1g-csfp", n.Cfg.Env[envNokiaSrosMDA+"_3"])
2702: +
2703: +		assert.Empty(t, n.generateComponentConfig())
2704: +	})
2705: +
2706: +	t.Run("integrated_component_xiom_sets_env", func(t *testing.T) {
2707: +		n := newSrosInitTestNode("sr-1s", []*Component{
2708: +			{
2709: +				XIOM: XIOMS{
2710: +					{
2711: +						Slot: 1,
2712: +						Type: "iom-s-3.0t",
2713: +						MDA:  MDAS{{Slot: 1, Type: "ms18-100gb-qsfp28"}},
2714: +					},
2715: +				},
2716: +			},
2717: +		})
2718: +
2719: +		require.NoError(t, n.Init(n.Cfg))
2720: +		assert.Equal(t, "iom-s-3.0t", n.Cfg.Env[envNokiaSrosXIOM+"_X1"])
2721: +		assert.Equal(t, "ms18-100gb-qsfp28", n.Cfg.Env[envNokiaSrosMDA+"_X1_1"])
2722: +
2723: +		cfg := n.generateComponentConfig()
2724: +		assert.Contains(t, cfg, "/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable")
2725: +		assert.Contains(
2726: +			t,
2727: +			cfg,
2728: +			"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable",
2729: +		)
2730:  	})
2731:  
2732:  	t.Run("integrated_rejects_multiple_components", func(t *testing.T) {
2733: +		for _, tc := range []struct {
2734: +			nodeType   string
2735: +			components []*Component
2736: +		}{
2737: +			{"sr-1", []*Component{{Slot: slotAName}, {Slot: slotBName}}},
2738: +			{"ixr-r6", []*Component{{Slot: slotAName}, {Slot: "1"}}},
2739: +			{"ixr-r6", []*Component{{Slot: slotAName}, {}}},
2740: +		} {
2741: +			n := newSrosInitTestNode(tc.nodeType, tc.components)
2742: +
2743: +			err := n.Init(n.Cfg)
2744: +
2745: +			require.Error(t, err, tc.nodeType)
2746: +			assert.Contains(t, err.Error(), "at most one component override")
2747: +		}
2748: +	})
2749: +
2750: +	t.Run("redundant_integrated_components_are_distributed", func(t *testing.T) {
2751:  		n := newSrosInitTestNode("ixr-r6", []*Component{
2752: -			{Slot: slotAName, Type: "cpiom-ixr-r6"},
2753: -			{Slot: slotBName, Type: "cpiom-ixr-r6"},
2754: +			{Slot: slotAName, MDA: MDAS{{Slot: 3, Type: "m20-1g-csfp"}}},
2755: +			{Slot: slotBName},
2756:  		})
2757:  
2758: -		err := n.Init(n.Cfg)
2759: +		require.NoError(t, n.Init(n.Cfg))
2760: +		assert.True(t, n.isDistributedBaseNode())
2761: +		require.Len(t, n.componentNodes, 2)
2762: +
2763: +		cpmA := n.componentNodes[0].(*sros)
2764: +		cpmB := n.componentNodes[1].(*sros)
2765: +		assert.Equal(t, slotAName, cpmA.Config().Env[envNokiaSrosSlot])
2766: +		assert.Equal(t, slotBName, cpmB.Config().Env[envNokiaSrosSlot])
2767: +		assert.Equal(t, "container:n1-netns", cpmA.Config().NetworkMode)
2768: +		assert.Equal(t, "container:n1-netns", cpmB.Config().NetworkMode)
2769: +
2770: +		cfgA := cpmA.generateComponentConfig()
2771: +		assert.Contains(t, cfgA, "/configure card 1 card-type iom-ixr-r6 admin-state enable")
2772: +		assert.Contains(
2773: +			t,
2774: +			cfgA,
2775: +			"/configure card 1 mda 1 mda-type m6-10g-sfp++1-100g-qsfp28 admin-state enable",
2776: +		)
2777: +		assert.Contains(t, cfgA, "/configure card 1 mda 3 mda-type m20-1g-csfp admin-state enable")
2778: +
2779: +		cfgB := cpmB.generateComponentConfig()
2780: +		assert.Contains(t, cfgB, "/configure card 1 card-type iom-ixr-r6 admin-state enable")
2781: +		assert.NotContains(t, cfgB, "m20-1g-csfp")
2782: +	})
2783: +
2784: +	t.Run("lowercase_integrated_slots_resolve_to_cpm_a", func(t *testing.T) {
2785: +		n := newSrosInitTestNode("ixr-r6", []*Component{
2786: +			{Slot: "a"},
2787: +			{Slot: "b"},
2788: +		})
2789: +
2790: +		require.NoError(t, n.Init(n.Cfg))
2791: +		slot, err := n.cpmSlot()
2792: +		require.NoError(t, err)
2793: +		assert.Equal(t, slotAName, slot)
2794: +	})
2795: +
2796: +	t.Run("node_env_overrides_component_mda", func(t *testing.T) {
2797: +		n := newSrosInitTestNode("sr-1", []*Component{
2798: +			{MDA: MDAS{{Slot: 1, Type: "from-component"}}},
2799: +		})
2800: +		n.Cfg.Env = map[string]string{envNokiaSrosMDA + "_1": "from-env"}
2801: +
2802: +		require.NoError(t, n.Init(n.Cfg))
2803: +		assert.Equal(t, "from-env", n.Cfg.Env[envNokiaSrosMDA+"_1"])
2804: +
2805: +		cfg := n.generateComponentConfig()
2806: +		assert.Contains(t, cfg, "/configure card 1 mda 1 mda-type from-env admin-state enable")
2807: +		assert.NotContains(t, cfg, "from-component")
2808: +	})
2809: +
2810: +	t.Run("node_env_overrides_sfm", func(t *testing.T) {
2811: +		n := newSrosInitTestNode("sr-1", nil)
2812: +		kindSpecificConfig.Of(n.Cfg).SFM = "from-sfm"
2813: +		n.Cfg.Env = map[string]string{envNokiaSrosSFM: "from-env"}
2814: +
2815: +		require.NoError(t, n.Init(n.Cfg))
2816: +		assert.Equal(t, "from-env", n.Cfg.Env[envNokiaSrosSFM])
2817: +	})
2818: +
2819: +	t.Run("distributed_node_env_overrides_component_mda", func(t *testing.T) {
2820: +		n := newSrosInitTestNode("sr-2s", []*Component{
2821: +			{Slot: slotAName, Type: "cpm-2s"},
2822: +			{
2823: +				Slot: "1",
2824: +				Type: "xcm-2s",
2825: +				MDA:  MDAS{{Slot: 1, Type: "from-component"}},
2826: +			},
2827: +		})
2828: +		n.Cfg.Env = map[string]string{envNokiaSrosMDA + "_1": "from-env"}
2829: +
2830: +		require.NoError(t, n.Init(n.Cfg))
2831: +		require.Len(t, n.componentNodes, 2)
2832: +
2833: +		linecard := n.componentNodes[1].(*sros)
2834: +		assert.Equal(t, "from-env", linecard.Config().Env[envNokiaSrosMDA+"_1"])
2835: +
2836: +		cfg := n.componentNodes[0].(*sros).generateComponentConfig()
2837: +		assert.Contains(t, cfg, "/configure card 1 mda 1 mda-type from-env admin-state enable")
2838: +		assert.NotContains(t, cfg, "from-component")
2839: +	})
2840: +
2841: +	t.Run("duplicate_component_slots_are_rejected_regardless_of_case", func(t *testing.T) {
2842: +		n := newSrosInitTestNode("sr-2s", []*Component{
2843: +			{Slot: "a"},
2844: +			{Slot: "A"},
2845: +		})
2846: +
2847: +		err := n.checkComponentSlotsConfig()
2848:  
2849:  		require.Error(t, err)
2850: -		assert.Contains(t, err.Error(), "at most one component override")
2851: +		assert.Contains(t, err.Error(), "duplicate")
2852:  	})
2853:  
2854:  	t.Run("sfm_sets_container_env", func(t *testing.T) {
2855:  		n := newSrosInitTestNode("sr-1", nil)
2856:  		kindSpecificConfig.Of(n.Cfg).SFM = "m-sfm6-7/12"
2857:  
2858:  		require.NoError(t, n.Init(n.Cfg))
2859:  		assert.Equal(t, "m-sfm6-7/12", n.Cfg.Env[envNokiaSrosSFM])
2860:  	})
2861:  
2862: -	t.Run("single_slot_integrated_rejects_card_type_override", func(t *testing.T) {
2863: -		n := newSrosInitTestNode("ixr-e2", []*Component{
2864: -			{Slot: slotAName, Type: "imm2-qsfpdd+2-qsfp28+24-sfp28"},
2865: +	t.Run("single_slot_integrated_allows_card_type_override", func(t *testing.T) {
2866: +		n := newSrosInitTestNode("ixr-e2n", []*Component{
2867: +			{Slot: slotAName, Type: "cpm-ixr-e2n/imm4-sfp+4-sfp+"},
2868:  		})
2869:  
2870: -		err := n.Init(n.Cfg)
2871: -
2872: -		require.Error(t, err)
2873: -		assert.Contains(t, err.Error(), "does not support component card-type override")
2874: +		require.NoError(t, n.Init(n.Cfg))
2875: +		assert.Equal(t, "cpm-ixr-e2n/imm4-sfp+4-sfp+", n.Cfg.Env[envNokiaSrosCard])
2876: +		assert.Empty(t, n.generateComponentConfig())
2877:  	})
2878:  
2879:  	t.Run("integrated_rejects_invalid_slot", func(t *testing.T) {
2880:  		n := newSrosInitTestNode("ixr-e2", []*Component{
2881:  			{Slot: slotBName, Type: "cpm-ixr-e2"},
2882: diff --git a/nodes/sros/template.go b/nodes/sros/template.go
2883: index 38f1e4d..b538320 100644
2884: --- a/nodes/sros/template.go
2885: +++ b/nodes/sros/template.go
2886: @@ -1,7 +1,28 @@
2887:  package sros
2888:  
2889: +import (
2890: +	_ "embed"
2891: +	"text/template"
2892: +
2893: +	clabutils "github.com/srl-labs/containerlab/utils"
2894: +)
2895: +
2896: +var (
2897: +	//go:embed configs/sros_config_sros25.go.tpl
2898: +	cfgTplSROS25 string
2899: +
2900: +	//go:embed configs/sros_config_classic.go.tpl
2901: +	cfgTplClassic string
2902: +
2903: +	//go:embed configs/ixr/ixr_config_classic.go.tpl
2904: +	cfgTplClassicIxr string
2905: +
2906: +	//go:embed configs/sar/sar_config_classic.go.tpl
2907: +	cfgTplClassicSar string
2908: +)
2909: +
2910:  // srosTemplateData holds all data needed for template selection and execution.
2911:  type srosTemplateData struct {
2912:  	// Template selection criteria
2913:  	NodeType          string
2914:  	ConfigurationMode string
2915: @@ -43,5 +64,36 @@ type tplIFace struct {
2916:  	Slot       string
2917:  	Port       string
2918:  	BreakoutNo string
2919:  	Mtu        int
2920:  }
2921: +
2922: +// getTemplateForVariant returns the template string and name for the given config variant.
2923: +// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= "26").
2924: +func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {
2925: +	// Model-driven (or mixed treated as classic below when family is classic)
2926: +	if v.Mode == ConfigModeModelDriven {
2927: +		// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= "26"
2928: +		// { return cfgTplSROS26, "clab-sros-config-sros26" }
2929: +		return cfgTplSROS25, "clab-sros-config-sros25"
2930: +	}
2931: +	// Classic (or mixed)
2932: +	tmpl = cfgTplClassic
2933: +	tplName = "clab-sros-config-classic"
2934: +	switch v.Family {
2935: +	case ConfigFamilyIXR:
2936: +		return cfgTplClassicIxr, "clab-sros-config-classic-ixr"
2937: +	case ConfigFamilySAR:
2938: +		return cfgTplClassicSar, "clab-sros-config-classic-sar"
2939: +	default:
2940: +		return tmpl, tplName
2941: +	}
2942: +}
2943: +
2944: +// selectConfigTemplate chooses the config template from the config variant (mode + family).
2945: +func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {
2946: +	v := n.resolveConfigVariant()
2947: +	tmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)
2948: +	return template.New(tplName).
2949: +		Funcs(clabutils.CreateFuncs()).
2950: +		Parse(tmpl)
2951: +}
2952: diff --git a/nodes/sros/variant.go b/nodes/sros/variant.go
2953: index fad585c..85bcac5 100644
2954: --- a/nodes/sros/variant.go
2955: +++ b/nodes/sros/variant.go
2956: @@ -2,11 +2,21 @@
2957:  // Licensed under the BSD 3-Clause License.
2958:  // SPDX-License-Identifier: BSD-3-Clause
2959:  
2960:  package sros
2961:  
2962: -import "fmt"
2963: +import (
2964: +	"fmt"
2965: +	"regexp"
2966: +)
2967: +
2968: +var (
2969: +	sarRegexp   = regexp.MustCompile(`(?i)\bsar-`)
2970: +	sarHmRegexp = regexp.MustCompile(`(?i)\b(sar-hm|sar-hmc)\b`)
2971: +
2972: +	ixrRegexp = regexp.MustCompile(`(?i)\bixr-`)
2973: +)
2974:  
2975:  // ConfigMode is the configuration mode (model-driven or classic).
2976:  type ConfigMode string
2977:  
2978:  const (
2979: @@ -141,5 +151,20 @@ func getSnippetSet(v ConfigVariant) snippetSet {
2980:  			grpc = grpcConfigSARInsecure
2981:  		}
2982:  	}
2983:  	return snippetSet{SystemConfig: sys, GRPCConfig: grpc}
2984:  }
2985: +
2986: +// isIXRNode returns true if this is an IXR node type (case-insensitive).
2987: +func (n *sros) isIXRNode() bool {
2988: +	return ixrRegexp.MatchString(n.Cfg.NodeType)
2989: +}
2990: +
2991: +// isSARNode returns true if this is a SAR node type (case-insensitive).
2992: +func (n *sros) isSARNode() bool {
2993: +	return sarRegexp.MatchString(n.Cfg.NodeType)
2994: +}
2995: +
2996: +// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).
2997: +func (n *sros) isSARHmNode() bool {
2998: +	return sarHmRegexp.MatchString(n.Cfg.NodeType)
2999: +}
3000: diff --git a/schemas/clab.schema.json b/schemas/clab.schema.json
3001: index 66679ac..0157106 100644
3002: --- a/schemas/clab.schema.json
3003: +++ b/schemas/clab.schema.json
3004: @@ -939,10 +939,12 @@
3005:                                              "ixr-6",
3006:                                              "ixr-e2c",
3007:                                              "ixr-e2",
3008:                                              "ixr-e2n",
3009:                                              "ixr-e2n-s",
3010: +                                            "ixr-e2sc",
3011: +                                            "ixr-e3",
3012:                                              "ixr-e3c",
3013:                                              "ixr-e3x",
3014:                                              "ixr-ec",
3015:                                              "ixr-e",
3016:                                              "ixr-r4",
3017: @@ -951,10 +953,11 @@
3018:                                              "ixr-r6",
3019:                                              "ixr-s",
3020:                                              "ixr-x3",
3021:                                              "ixr-x",
3022:                                              "sar-1",
3023: +                                            "sar-10x",
3024:                                              "sar-hm",
3025:                                              "sar-hmc",
3026:                                              "sar-hx",
3027:                                              "sar-mx",
3028:                                              "sr-1-24d",
3029: @@ -2009,11 +2012,14 @@
3030:                  "cpm-ixr-e-gnss/imm24-sfp++8-sfp28+2-qsfp28",
3031:                  "cpm-ixr-e/imm14-10g-sfp++4-1g-tx",
3032:                  "cpm-ixr-e/imm24-sfp++8-sfp28+2-qsfp28",
3033:                  "cpm-ixr-e2",
3034:                  "cpm-ixr-e2c",
3035: +                "cpm-ixr-e2n-s/imm4-sfp+4-sfp+-s",
3036:                  "cpm-ixr-e2n/imm4-sfp+4-sfp+",
3037: +                "cpm-ixr-e2sc/imm16-sfp++4-sfp28",
3038: +                "cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd",
3039:                  "cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56",
3040:                  "cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd",
3041:                  "cpm-ixr-ec",
3042:                  "cpm-ixr-s/imm48-sfp++6-qsfp28",
3043:                  "cpm-ixr-x/imm32-qsfp28+4-qsfpdd",
3044: @@ -2077,10 +2083,11 @@
3045:              "type": "string",
3046:              "description": "CPM card types for SR OS",
3047:              "enum": [
3048:                  "cpiom-ixr-r6",
3049:                  "cpiom-ixr-r6d",
3050: +                "cpiom-sar-x",
3051:                  "cpm-1",
3052:                  "cpm-1s",
3053:                  "cpm-1se",
3054:                  "cpm-1se/imm36-800g-qsfpdd",
3055:                  "cpm-1x",
3056: @@ -2102,11 +2109,14 @@
3057:                  "cpm-ixr-e-gnss/imm24-sfp++8-sfp28+2-qsfp28",
3058:                  "cpm-ixr-e/imm14-10g-sfp++4-1g-tx",
3059:                  "cpm-ixr-e/imm24-sfp++8-sfp28+2-qsfp28",
3060:                  "cpm-ixr-e2",
3061:                  "cpm-ixr-e2c",
3062: +                "cpm-ixr-e2n-s/imm4-sfp+4-sfp+-s",
3063:                  "cpm-ixr-e2n/imm4-sfp+4-sfp+",
3064: +                "cpm-ixr-e2sc/imm16-sfp++4-sfp28",
3065: +                "cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd",
3066:                  "cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56",
3067:                  "cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd",
3068:                  "cpm-ixr-ec",
3069:                  "cpm-ixr-r4",
3070:                  "cpm-ixr-s",
3071: @@ -2122,11 +2132,12 @@
3072:                  "cpm-v/iom-v",
3073:                  "cpm-x20",
3074:                  "cpm2-s",
3075:                  "cpm2-x20",
3076:                  "cpm5",
3077: -                "iom-sar"
3078: +                "iom-sar",
3079: +                "iom-sar-1x"
3080:              ]
3081:          },
3082:          "sros-mda-types": {
3083:              "type": "string",
3084:              "description": "MDA types for SR OS",
3085: @@ -2153,10 +2164,11 @@
3086:                  "m10-sfp++6-sfp",
3087:                  "m12-sfp28+2-qsfp28",
3088:                  "m14-10g-sfp++4-1g-tx",
3089:                  "m18-25g-sfp28",
3090:                  "m2-100g-qsfp28+16-10g-sfp+",
3091: +                "m2-1g-sfp+2-10g-sfp+",
3092:                  "m2-cfp2",
3093:                  "m2-qsfpdd+2-qsfp28+24-sfp28",
3094:                  "m20-10g-sfp+",
3095:                  "m20-1g-csfp",
3096:                  "m20-v",
3097: @@ -2166,11 +2178,13 @@
3098:                  "m32-qsfp28+4-qsfpdd",
3099:                  "m36-100g-qsfp28",
3100:                  "m36-qsfpdd",
3101:                  "m4-100g-cfp4",
3102:                  "m4-10g-sfp++1-100g-cfp2",
3103: +                "m4-1g-rj+6-10g-sfp++2-25g-sfp28",
3104:                  "m4-1g-tx+20-1g-sfp+6-10g-sfp+",
3105: +                "m4-rs232-rj45+4-c3794-sfp",
3106:                  "m40-10g-sfp",
3107:                  "m40-10g-sfp-ptp",
3108:                  "m40-200g-sfpdd+6-800g-qsfpdd-1",
3109:                  "m46-10g-sfp+",
3110:                  "m48-400g-qsfpdd-1",
3111: @@ -2181,10 +2195,11 @@
3112:                  "m5e2-100g-qsfp28+2-800g-qdd",
3113:                  "m5e8-100g-sfp112+2-800g-qdd",
3114:                  "m6-10g-sfp++1-100g-qsfp28",
3115:                  "m6-10g-sfp++4-25g-sfp28",
3116:                  "m6-qsfpdd+48-sfp56",
3117: +                "m8-t1e1-rj48",
3118:                  "m80-1g-csfp",
3119:                  "m80-200g-sfpdd+12-400g-qsfpdd-1",
3120:                  "m80-200g-sfpdd+12-800g-qsfpdd-1x",
3121:                  "ma2-10gb-sfp+12-1gb-sfp",
3122:                  "ma20-1gb-tx",
3123: diff --git a/tests/13-srsim/01-sros-to-linux.robot b/tests/13-srsim/01-sros-to-linux.robot
3124: index c4d9cb2..8226dd7 100644
3125: --- a/tests/13-srsim/01-sros-to-linux.robot
3126: +++ b/tests/13-srsim/01-sros-to-linux.robot
3127: @@ -1,9 +1,10 @@
3128:  *** Settings ***
3129:  Library             OperatingSystem
3130:  Resource            ../ssh.robot
3131:  Resource            ../common.robot
3132: +Resource            ../srsim.robot
3133:  
3134:  Suite Teardown      Run Keyword    Cleanup
3135:  
3136:  
3137:  *** Variables ***
3138: @@ -21,15 +22,11 @@ Set key-path Variable
3139:  Create SSH keypair - RSA
3140:      ${rc}    ${output} =    Run And Return Rc And Output
3141:      ...    ssh-keygen -t rsa -N "" -f ${key-path}-rsa
3142:  
3143:  Deploy ${lab-name} lab
3144: -    Log    ${CURDIR}
3145: -    ${rc}    ${output} =    Run And Return Rc And Output
3146: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3147: -    Log    ${output}
3148: -    Should Be Equal As Integers    ${rc}    0
3149: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3150:  
3151:  Ensure sros is reachable over ssh
3152:      Login via SSH with username and password
3153:      ...    address=clab-${lab-name}-sros
3154:      ...    username=admin
3155: @@ -102,7 +99,7 @@ Verify saving config with copy flag
3156:      [Teardown]    Run    rm -rf ${copy_dst}
3157:  
3158:  
3159:  *** Keywords ***
3160:  Cleanup
3161: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3162: +    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3163:      Run    rm -f ${key-path}*
3164: diff --git a/tests/13-srsim/03-sros-dist-to-linux.robot b/tests/13-srsim/03-sros-dist-to-linux.robot
3165: index b0c6369..a473880 100644
3166: --- a/tests/13-srsim/03-sros-dist-to-linux.robot
3167: +++ b/tests/13-srsim/03-sros-dist-to-linux.robot
3168: @@ -1,35 +1,23 @@
3169:  *** Settings ***
3170:  Library             OperatingSystem
3171:  Resource            ../ssh.robot
3172:  Resource            ../common.robot
3173: +Resource            ../srsim.robot
3174:  
3175: -Suite Teardown      Run Keyword    Cleanup
3176: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3177:  
3178:  
3179:  *** Variables ***
3180:  ${lab-name}         sr03
3181:  ${lab-file-name}    03-srsim-dist.clab.yml
3182:  ${runtime}          docker
3183: -${key-name}         clab-test-key
3184:  
3185:  
3186:  *** Test Cases ***
3187: -Set key-path Variable
3188: -    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}
3189: -    Set Suite Variable    ${key-path}
3190: -
3191: -Create SSH keypair - RSA
3192: -    ${rc}    ${output} =    Run And Return Rc And Output
3193: -    ...    ssh-keygen -t rsa -N "" -f ${key-path}-rsa
3194: -
3195:  Deploy ${lab-name} lab
3196: -    Log    ${CURDIR}
3197: -    ${rc}    ${output} =    Run And Return Rc And Output
3198: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3199: -    Log    ${output}
3200: -    Should Be Equal As Integers    ${rc}    0
3201: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3202:  
3203:  Ensure sros is reachable over ssh
3204:      Login via SSH with username and password
3205:      ...    address=clab-${lab-name}-sros-a
3206:      ...    username=admin
3207: @@ -55,10 +43,5 @@ Do a gNOI cert get-certs
3208:      Skip If    '${runtime}' != 'docker'
3209:      ${rc}    ${output} =    Run And Return Rc And Output
3210:      ...    sudo docker run --network host --rm --mount type=bind,source=${CURDIR}/clab-${lab-name}/.tls/ca,target=/tls ghcr.io/karimra/gnoic:0.2.0 cert get-certs --username admin --password 'NokiaSros1!' --tls-ca /tls/ca.pem --address clab-${lab-name}-sros-a
3211:      Log    ${output}
3212:      Should Contain    ${output}    sros-a.${lab-name}.io
3213: -
3214: -*** Keywords ***
3215: -Cleanup
3216: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3217: -    Run    rm -f ${key-path}*
3218: diff --git a/tests/13-srsim/04-sros-classic.robot b/tests/13-srsim/04-sros-classic.robot
3219: index efdf58f..16b5811 100644
3220: --- a/tests/13-srsim/04-sros-classic.robot
3221: +++ b/tests/13-srsim/04-sros-classic.robot
3222: @@ -1,9 +1,10 @@
3223:  *** Settings ***
3224:  Library             OperatingSystem
3225:  Resource            ../ssh.robot
3226:  Resource            ../common.robot
3227: +Resource            ../srsim.robot
3228:  
3229:  Suite Teardown      Run Keyword    Cleanup
3230:  
3231:  
3232:  *** Variables ***
3233: @@ -23,15 +24,11 @@ Set key-path Variable
3234:  Create SSH keypair - ecdsa512
3235:      ${rc}    ${output} =    Run And Return Rc And Output
3236:      ...    ssh-keygen -t ecdsa -b 521 -N "" -f ${key-path}-ecdsa512
3237:  
3238:  Deploy ${lab-name} lab
3239: -    Log    ${CURDIR}
3240: -    ${rc}    ${output} =    Run And Return Rc And Output
3241: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3242: -    Log    ${output}
3243: -    Should Be Equal As Integers    ${rc}    0
3244: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3245:  
3246:  Ensure sros is reachable over ssh
3247:      Login via SSH with username and password
3248:      ...    address=clab-${lab-name}-srsim
3249:      ...    username=admin
3250: @@ -58,7 +55,7 @@ Check Mixed Config Mode on srsim
3251:      Log    ${output}
3252:      Should Contain    ${output}    mixed
3253:  
3254:  *** Keywords ***
3255:  Cleanup
3256: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3257: +    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3258:      Run    rm -f ${key-path}*
3259: diff --git a/tests/13-srsim/05-sros-comp-to-linux.robot b/tests/13-srsim/05-sros-comp-to-linux.robot
3260: index 4bb4aac..f7db14e 100644
3261: --- a/tests/13-srsim/05-sros-comp-to-linux.robot
3262: +++ b/tests/13-srsim/05-sros-comp-to-linux.robot
3263: @@ -1,9 +1,10 @@
3264:  *** Settings ***
3265:  Library             OperatingSystem
3266:  Resource            ../ssh.robot
3267:  Resource            ../common.robot
3268: +Resource            ../srsim.robot
3269:  
3270:  Suite Teardown      Run Keyword    Cleanup
3271:  
3272:  
3273:  *** Variables ***
3274: @@ -21,15 +22,11 @@ Set key-path Variable
3275:  Create SSH keypair - RSA
3276:      ${rc}    ${output} =    Run And Return Rc And Output
3277:      ...    ssh-keygen -t rsa -N "" -f ${key-path}-rsa
3278:  
3279:  Deploy ${lab-name} lab
3280: -    Log    ${CURDIR}
3281: -    ${rc}    ${output} =    Run And Return Rc And Output
3282: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3283: -    Log    ${output}
3284: -    Should Be Equal As Integers    ${rc}    0
3285: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3286:  
3287:  Ensure sros is reachable over ssh
3288:      Login via SSH with username and password
3289:      ...    address=clab-${lab-name}-sros
3290:      ...    username=admin
3291: @@ -136,7 +133,7 @@ Ensure XIOM MDA x/1 is equipped and up on sr2s-01
3292:      Should Contain    ${output}    in-service
3293:  
3294:  
3295:  *** Keywords ***
3296:  Cleanup
3297: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3298: +    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3299:      Run    rm -f ${key-path}*
3300: diff --git a/tests/13-srsim/06-srsim-sar.robot b/tests/13-srsim/06-srsim-sar.robot
3301: index 0633c48..0ef2dfa 100644
3302: --- a/tests/13-srsim/06-srsim-sar.robot
3303: +++ b/tests/13-srsim/06-srsim-sar.robot
3304: @@ -1,33 +1,25 @@
3305:  *** Settings ***
3306:  Library             OperatingSystem
3307:  Resource            ../ssh.robot
3308:  Resource            ../common.robot
3309: +Resource            ../srsim.robot
3310:  
3311: -Suite Teardown      Run Keyword    Cleanup
3312: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3313:  
3314:  
3315:  *** Variables ***
3316:  ${lab-name}         sr06
3317:  ${lab-file-name}    06-srsim-sar.clab.yml
3318:  ${runtime}          docker
3319: -${key-name}         clab-test-key
3320:  ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1
3321:  ${gnmic_flags}      --username admin --password NokiaSros1! --values-only
3322:  
3323:  
3324:  *** Test Cases ***
3325: -Set key-path Variable
3326: -    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}
3327: -    Set Suite Variable    ${key-path}
3328: -
3329:  Deploy ${lab-name} lab
3330: -    Log    ${CURDIR}
3331: -    ${rc}    ${output} =    Run And Return Rc And Output
3332: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3333: -    Log    ${output}
3334: -    Should Be Equal As Integers    ${rc}    0
3335: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3336:  
3337:  Ensure sros is reachable over ssh
3338:      Login via SSH with username and password
3339:      ...    address=clab-${lab-name}-sar3
3340:      ...    username=admin
3341: @@ -45,10 +37,5 @@ Check Config Mode on sar1
3342:  Check Config Mode on sar2
3343:      ${rc}    ${output} =    Run And Return Rc And Output
3344:      ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --insecure --address clab-${lab-name}-sar2 get --path /state/system/management-interface/configuration-oper-mode
3345:      Log    ${output}
3346:      Should Contain    ${output}    model-driven
3347: -
3348: -*** Keywords ***
3349: -Cleanup
3350: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3351: -    Run    rm -f ${key-path}*
3352: diff --git a/tests/13-srsim/07-srsim-with-mgmt-network.robot b/tests/13-srsim/07-srsim-with-mgmt-network.robot
3353: index 5025036..ce0951f 100644
3354: --- a/tests/13-srsim/07-srsim-with-mgmt-network.robot
3355: +++ b/tests/13-srsim/07-srsim-with-mgmt-network.robot
3356: @@ -1,31 +1,23 @@
3357:  *** Settings ***
3358:  Library             OperatingSystem
3359:  Resource            ../ssh.robot
3360:  Resource            ../common.robot
3361: +Resource            ../srsim.robot
3362:  
3363: -Suite Teardown      Run Keyword    Cleanup
3364: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3365:  
3366:  
3367:  *** Variables ***
3368:  ${lab-name}         sr07
3369:  ${lab-file-name}    07-srsim-mix.clab.yml
3370:  ${runtime}          docker
3371: -${key-name}         clab-test-key
3372:  
3373:  
3374:  *** Test Cases ***
3375: -Set key-path Variable
3376: -    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}
3377: -    Set Suite Variable    ${key-path}
3378: -
3379:  Deploy ${lab-name} lab
3380: -    Log    ${CURDIR}
3381: -    ${rc}    ${output} =    Run And Return Rc And Output
3382: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3383: -    Log    ${output}
3384: -    Should Be Equal As Integers    ${rc}    0
3385: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3386:  
3387:  Ensure sros is reachable over ssh
3388:      Login via SSH with username and password
3389:      ...    address=clab-${lab-name}-srsim10
3390:      ...    username=admin
3391: @@ -57,15 +49,10 @@ Do a gNMI GET using TLS
3392:      Log    ${output}
3393:      Should Be Equal As Integers    ${rc}    0
3394:      Should Contain    ${output}    srsim10-a
3395:  
3396:  *** Keywords ***
3397: -Cleanup
3398: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3399: -    Run    rm -f ${key-path}*
3400: -
3401: -
3402:  Do a gNOI ping to other node
3403:      Skip If    '${runtime}' != 'docker'
3404:      ${rc}    ${output} =    Run And Return Rc And Output
3405:      ...    sudo docker run --network host --rm --mount type=bind,source=${CURDIR}/clab-${lab-name}/.tls/ca,target=/tls ghcr.io/karimra/gnoic:0.2.0 system ping --username admin --password 'NokiaSros1!' --tls-ca /tls/ca.pem --address clab-${lab-name}-srsim10 --destination 100.0.0.11 --ns Base --count 3
3406:      Log    ${output}
3407: diff --git a/tests/13-srsim/08-srsim-comp-cfg-test.robot b/tests/13-srsim/08-srsim-comp-cfg-test.robot
3408: index d276341..c531df4 100644
3409: --- a/tests/13-srsim/08-srsim-comp-cfg-test.robot
3410: +++ b/tests/13-srsim/08-srsim-comp-cfg-test.robot
3411: @@ -1,11 +1,12 @@
3412:  *** Settings ***
3413:  Library             OperatingSystem
3414:  Resource            ../ssh.robot
3415:  Resource            ../common.robot
3416: +Resource            ../srsim.robot
3417:  
3418: -Suite Teardown      Run Keyword    Cleanup
3419: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3420:  
3421:  
3422:  *** Variables ***
3423:  ${lab-name}         comp-cfg-gen-test
3424:  ${lab-file-name}    08-srsim-comp-cfg-test.clab.yml
3425: @@ -14,15 +15,11 @@ ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1
3426:  ${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure
3427:  
3428:  
3429:  *** Test Cases ***
3430:  Deploy ${lab-name} lab
3431: -    Log    ${CURDIR}
3432: -    ${rc}    ${output} =    Run And Return Rc And Output
3433: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3434: -    Log    ${output}
3435: -    Should Be Equal As Integers    ${rc}    0
3436: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3437:  
3438:  Wait for 45s
3439:      Sleep    45s    Let everything fully provision & come up
3440:  
3441:  Check SR-1 card configuration
3442: @@ -121,13 +118,10 @@ Check SR-2s-ncofg has unprovisioned card
3443:      Log    ${output}
3444:      Should Be Equal As Integers    ${rc}    0
3445:      Should Contain    ${output}    unprovisioned
3446:  
3447:  *** Keywords ***
3448: -Cleanup
3449: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3450: -
3451:  Check SR-2S MDA state
3452:      ${rc}    ${output} =    Run And Return Rc And Output
3453:      ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr2s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/hardware-data/oper-state
3454:      Log    ${output}
3455:      Should Be Equal As Integers    ${rc}    0
3456: diff --git a/tests/13-srsim/09-srsim-pause-container.robot b/tests/13-srsim/09-srsim-pause-container.robot
3457: index 0f96bd7..90f57c3 100644
3458: --- a/tests/13-srsim/09-srsim-pause-container.robot
3459: +++ b/tests/13-srsim/09-srsim-pause-container.robot
3460: @@ -1,12 +1,13 @@
3461:  *** Settings ***
3462:  Library             OperatingSystem
3463:  Library             Process
3464:  Resource            ../ssh.robot
3465:  Resource            ../common.robot
3466: +Resource            ../srsim.robot
3467:  
3468: -Suite Teardown      Run Keyword    Cleanup
3469: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3470:  
3471:  
3472:  *** Variables ***
3473:  ${lab-name}         srsim-pause-ctr
3474:  ${lab-file-name}    09-srsim-pause-container.clab.yml
3475: @@ -15,15 +16,11 @@ ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1
3476:  ${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure
3477:  
3478:  
3479:  *** Test Cases ***
3480:  Deploy ${lab-name} lab
3481: -    Log    ${CURDIR}
3482: -    ${rc}    ${output} =    Run And Return Rc And Output
3483: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3484: -    Log    ${output}
3485: -    Should Be Equal As Integers    ${rc}    0
3486: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3487:  
3488:  Wait for 45s
3489:      Sleep    45s    Let everything fully provision & come up
3490:  
3491:  # IPv4
3492: @@ -165,11 +162,5 @@ Check CPM SSH
3493:          Should Contain    ${output}    TiMOS
3494:          Should Match Regexp    ${output}    ${slot}:admin@[^\\r\\n]+#
3495:      FINALLY
3496:          SSHLibrary.Close All Connections
3497:      END
3498: -
3499: -Cleanup
3500: -    ${rc}    ${output} =    Run And Return Rc And Output
3501: -    ...    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3502: -    Log    ${output}
3503: -    Should Be Equal As Integers    ${rc}    0
3504: diff --git a/tests/13-srsim/10-srsim-lifecycle.robot b/tests/13-srsim/10-srsim-lifecycle.robot
3505: index c9085d9..0b24da2 100644
3506: --- a/tests/13-srsim/10-srsim-lifecycle.robot
3507: +++ b/tests/13-srsim/10-srsim-lifecycle.robot
3508: @@ -1,25 +1,22 @@
3509:  *** Settings ***
3510:  Library             OperatingSystem
3511:  Resource            ../common.robot
3512: +Resource            ../srsim.robot
3513:  
3514: -Suite Teardown      Run Keyword    Cleanup
3515: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3516:  
3517:  
3518:  *** Variables ***
3519:  ${lab-name}         lifecycle-test-srsim
3520:  ${lab-file-name}    10-srsim-lifecycle.clab.yml
3521:  ${runtime}          docker
3522:  
3523:  
3524:  *** Test Cases ***
3525:  Deploy ${lab-name} lab
3526: -    Log    ${CURDIR}
3527: -    ${rc}    ${output} =    Run And Return Rc And Output
3528: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3529: -    Log    ${output}
3530: -    Should Be Equal As Integers    ${rc}    0
3531: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3532:  
3533:  Ensure client can ping integrated SR OS node
3534:      Sleep    20s    give time for SR OS nodes to boot
3535:      ${rc}    ${output} =    Run And Return Rc And Output
3536:      ...    ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=client --cmd "ping -c2 -W2 10.0.1.2"
3537: @@ -85,10 +82,5 @@ Verify ping to distributed SR OS recovers after start
3538:      ${rc}    ${output} =    Run And Return Rc And Output
3539:      ...    ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=client --cmd "ping -c2 -W2 10.0.2.2"
3540:      Log    ${output}
3541:      Should Be Equal As Integers    ${rc}    0
3542:      Should Match Regexp    ${output}    2 packets transmitted, 2 (packets )?received, 0% packet loss
3543: -
3544: -
3545: -*** Keywords ***
3546: -Cleanup
3547: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3548: diff --git a/tests/13-srsim/12-srsim-veth-stitch.robot b/tests/13-srsim/12-srsim-veth-stitch.robot
3549: index fac9fe1..9f70b9f 100644
3550: --- a/tests/13-srsim/12-srsim-veth-stitch.robot
3551: +++ b/tests/13-srsim/12-srsim-veth-stitch.robot
3552: @@ -1,11 +1,12 @@
3553:  *** Settings ***
3554:  Library             OperatingSystem
3555:  Resource            ../ssh.robot
3556:  Resource            ../common.robot
3557: +Resource            ../srsim.robot
3558:  
3559: -Suite Teardown      Run Keyword    Cleanup
3560: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3561:  
3562:  
3563:  *** Variables ***
3564:  ${lab-name}         veth-stitch
3565:  ${lab-file-name}    12-srsim-veth-stitch.clab.yml
3566: @@ -14,15 +15,11 @@ ${sros-password}    NokiaSros1!
3567:  ${peer-ip}          10.0.0.2
3568:  
3569:  
3570:  *** Test Cases ***
3571:  Deploy ${lab-name} lab
3572: -    Log    ${CURDIR}
3573: -    ${rc}    ${output} =    Run And Return Rc And Output
3574: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
3575: -    Log    ${output}
3576: -    Should Be Equal As Integers    ${rc}    0
3577: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3578:  
3579:  Ensure distributed sros can ping sros2 over the veth-stitch link
3580:      Wait Until Keyword Succeeds    3 minutes    10 seconds    Ping succeeds    sros    ${peer-ip}
3581:  
3582:  Verify inspect interfaces returns the host-side stitch interfaces
3583: @@ -87,13 +84,10 @@ Verify the stitch interfaces are removed on destroy
3584:      Log    ${output}
3585:      Should Not Contain    ${output}    clab-s-
3586:  
3587:  
3588:  *** Keywords ***
3589: -Cleanup
3590: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
3591: -
3592:  Ping over SSH
3593:      [Arguments]    ${node}    ${dst}
3594:      Login via SSH with username and password
3595:      ...    address=clab-${lab-name}-${node}
3596:      ...    username=admin
3597: diff --git a/tests/13-srsim/13-srsim-integrated.clab.yml b/tests/13-srsim/13-srsim-integrated.clab.yml
3598: new file mode 100644
3599: index 0000000..a3f2ca3
3600: --- /dev/null
3601: +++ b/tests/13-srsim/13-srsim-integrated.clab.yml
3602: @@ -0,0 +1,33 @@
3603: +# yaml-language-server: $schema=../../schemas/clab.schema.json
3604: +name: srsim-integrated
3605: +
3606: +topology:
3607: +  kinds:
3608: +    nokia_srsim:
3609: +      license: /opt/nokia/sros/license.txt
3610: +      image: registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}
3611: +
3612: +  nodes:
3613: +    ixr-e2n:
3614: +      kind: nokia_srsim
3615: +      type: ixr-e2n
3616: +      components:
3617: +        - type: cpm-ixr-e2n/imm4-sfp+4-sfp+
3618: +
3619: +    ixr-r6:
3620: +      kind: nokia_srsim
3621: +      type: ixr-r6
3622: +      components:
3623: +        - slot: A
3624: +        - slot: B
3625: +
3626: +    sr-1s:
3627: +      kind: nokia_srsim
3628: +      type: sr-1s
3629: +      components:
3630: +        - xiom:
3631: +            - slot: 1
3632: +              type: iom-s-3.0t
3633: +              mda:
3634: +                - slot: 1
3635: +                  type: ms18-100gb-qsfp28
3636: diff --git a/tests/13-srsim/13-srsim-integrated.robot b/tests/13-srsim/13-srsim-integrated.robot
3637: new file mode 100644
3638: index 0000000..8f6b929
3639: --- /dev/null
3640: +++ b/tests/13-srsim/13-srsim-integrated.robot
3641: @@ -0,0 +1,105 @@
3642: +*** Settings ***
3643: +Library             OperatingSystem
3644: +Resource            ../ssh.robot
3645: +Resource            ../common.robot
3646: +Resource            ../srsim.robot
3647: +
3648: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3649: +
3650: +
3651: +*** Variables ***
3652: +${lab-name}         srsim-integrated
3653: +${lab-file-name}    13-srsim-integrated.clab.yml
3654: +${runtime}          docker
3655: +${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1
3656: +${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure
3657: +
3658: +
3659: +*** Test Cases ***
3660: +Deploy ${lab-name} lab
3661: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3662: +
3663: +Wait for 45s
3664: +    Sleep    45s    Let everything fully provision & come up
3665: +
3666: +Check IXR-E2N card override is passed to the container
3667: +    ${rc}    ${output} =    Run And Return Rc And Output
3668: +    ...    sudo ${runtime} inspect clab-${lab-name}-ixr-e2n --format '{{range .Config.Env}}{{println .}}{{end}}'
3669: +    Log    ${output}
3670: +    Should Be Equal As Integers    ${rc}    0
3671: +    Should Contain    ${output}    NOKIA_SROS_CARD=cpm-ixr-e2n/imm4-sfp+4-sfp+
3672: +
3673: +Check IXR-E2N equipped card matches the component
3674: +    ${rc}    ${output} =    Run And Return Rc And Output
3675: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-e2n --path /state/card[slot-number=1]/equipped-type
3676: +    Log    ${output}
3677: +    Should Be Equal As Integers    ${rc}    0
3678: +    Should Contain    ${output}    imm4-sfp+4-sfp+
3679: +
3680: +Check IXR-R6 standby CPM slot is set
3681: +    ${rc}    ${output} =    Run And Return Rc And Output
3682: +    ...    sudo ${runtime} inspect clab-${lab-name}-ixr-r6-b --format '{{range .Config.Env}}{{println .}}{{end}}'
3683: +    Log    ${output}
3684: +    Should Be Equal As Integers    ${rc}    0
3685: +    Should Contain    ${output}    NOKIA_SROS_SLOT=B
3686: +
3687: +Check IXR-R6 card configuration
3688: +    ${rc}    ${output} =    Run And Return Rc And Output
3689: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /configure/card[slot-number=1]/card-type
3690: +    Log    ${output}
3691: +    Should Be Equal As Integers    ${rc}    0
3692: +    Should Contain    ${output}    iom-ixr-r6
3693: +
3694: +Check IXR-R6 MDA configuration
3695: +    ${rc}    ${output} =    Run And Return Rc And Output
3696: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /configure/card[slot-number=1]/mda[mda-slot=1]/mda-type
3697: +    Log    ${output}
3698: +    Should Be Equal As Integers    ${rc}    0
3699: +    Should Contain    ${output}    m6-10g-sfp++1-100g-qsfp28
3700: +
3701: +Ensure IXR-R6 CPM A is up
3702: +    Wait Until Keyword Succeeds    2 minutes    10 seconds    Check IXR-R6 CPM state    A
3703: +
3704: +Ensure IXR-R6 CPM B is up
3705: +    Wait Until Keyword Succeeds    3 minutes    10 seconds    Check IXR-R6 CPM state    B
3706: +
3707: +
3708: +Check SR-1s equipped card
3709: +    ${rc}    ${output} =    Run And Return Rc And Output
3710: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/equipped-type
3711: +    Log    ${output}
3712: +    Should Be Equal As Integers    ${rc}    0
3713: +    Should Contain    ${output}    xcm-1s
3714: +
3715: +Check SR-1s equipped XIOM
3716: +    ${rc}    ${output} =    Run And Return Rc And Output
3717: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/equipped-type
3718: +    Log    ${output}
3719: +    Should Be Equal As Integers    ${rc}    0
3720: +    Should Contain    ${output}    iom-s-3.0t
3721: +
3722: +Check SR-1s equipped XIOM MDA
3723: +    ${rc}    ${output} =    Run And Return Rc And Output
3724: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/equipped-type
3725: +    Log    ${output}
3726: +    Should Be Equal As Integers    ${rc}    0
3727: +    Should Contain    ${output}    ms18-100gb-qsfp28
3728: +
3729: +Ensure SR-1s XIOM MDA is up
3730: +    Wait Until Keyword Succeeds    2 minutes    10 seconds    Check SR-1s XIOM MDA state
3731: +
3732: +*** Keywords ***
3733: +Check IXR-R6 CPM state
3734: +    [Arguments]    ${slot}
3735: +    ${rc}    ${output} =    Run And Return Rc And Output
3736: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /state/cpm[cpm-slot=${slot}]/hardware-data/oper-state
3737: +    Log    ${output}
3738: +    Should Be Equal As Integers    ${rc}    0
3739: +    Should Contain    ${output}    in-service
3740: +
3741: +Check SR-1s XIOM MDA state
3742: +    ${rc}    ${output} =    Run And Return Rc And Output
3743: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/hardware-data/oper-state
3744: +    Log    ${output}
3745: +    Should Be Equal As Integers    ${rc}    0
3746: +    Should Contain    ${output}    in-service
3747: diff --git a/tests/13-srsim/14-srsim-new-chassis.clab.yml b/tests/13-srsim/14-srsim-new-chassis.clab.yml
3748: new file mode 100644
3749: index 0000000..f5f3bc2
3750: --- /dev/null
3751: +++ b/tests/13-srsim/14-srsim-new-chassis.clab.yml
3752: @@ -0,0 +1,53 @@
3753: +# yaml-language-server: $schema=../../schemas/clab.schema.json
3754: +name: srsim-new-chassis
3755: +
3756: +topology:
3757: +  kinds:
3758: +    nokia_srsim:
3759: +      license: /opt/nokia/sros/license.txt
3760: +      image: registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}
3761: +
3762: +  nodes:
3763: +    ixr-e2sc:
3764: +      kind: nokia_srsim
3765: +      type: ixr-e2sc
3766: +
3767: +    ixr-e3:
3768: +      kind: nokia_srsim
3769: +      type: ixr-e3
3770: +
3771: +    sar-10x:
3772: +      kind: nokia_srsim
3773: +      type: sar-10x
3774: +      components:
3775: +        - slot: A
3776: +          type: cpiom-sar-x
3777: +          mda: &mdas
3778: +            - slot: 1
3779: +              type: m2-1g-sfp+2-10g-sfp+
3780: +            - slot: 2
3781: +              type: m8-t1e1-rj48
3782: +            - slot: 3
3783: +              type: m2-1g-sfp+2-10g-sfp+
3784: +            - slot: 4
3785: +              type: m4-rs232-rj45+4-c3794-sfp
3786: +            - slot: 5
3787: +              type: m8-t1e1-rj48
3788: +            - slot: 6
3789: +              type: m4-rs232-rj45+4-c3794-sfp
3790: +            - slot: 7
3791: +              type: m8-t1e1-rj48
3792: +            - slot: 8
3793: +              type: m4-rs232-rj45+4-c3794-sfp
3794: +        - slot: B
3795: +          type: cpiom-sar-x
3796: +          mda: *mdas
3797: +      startup-config: |
3798: +        /configure card 1 mda 1 mda-type m2-1g-sfp+2-10g-sfp+ admin-state enable
3799: +        /configure card 1 mda 2 mda-type m8-t1e1-rj48 admin-state enable
3800: +        /configure card 1 mda 3 mda-type m2-1g-sfp+2-10g-sfp+ admin-state enable
3801: +        /configure card 1 mda 4 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable
3802: +        /configure card 1 mda 5 mda-type m8-t1e1-rj48 admin-state enable
3803: +        /configure card 1 mda 6 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable
3804: +        /configure card 1 mda 7 mda-type m8-t1e1-rj48 admin-state enable
3805: +        /configure card 1 mda 8 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable
3806: diff --git a/tests/13-srsim/14-srsim-new-chassis.robot b/tests/13-srsim/14-srsim-new-chassis.robot
3807: new file mode 100644
3808: index 0000000..0f1b08a
3809: --- /dev/null
3810: +++ b/tests/13-srsim/14-srsim-new-chassis.robot
3811: @@ -0,0 +1,83 @@
3812: +*** Settings ***
3813: +Library             OperatingSystem
3814: +Library             String
3815: +Resource            ../common.robot
3816: +Resource            ../srsim.robot
3817: +
3818: +Suite Setup         Skip If    '${26_10_TESTS}'.lower() != 'true'
3819: +...                 SR-SIM 26.10 is required; enable with --variable 26_10_TESTS:true
3820: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3821: +
3822: +
3823: +*** Variables ***
3824: +${lab-name}         srsim-new-chassis
3825: +${lab-file-name}    14-srsim-new-chassis.clab.yml
3826: +${runtime}          docker
3827: +${26_10_TESTS}      false
3828: +${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1
3829: +${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure
3830: +
3831: +
3832: +*** Test Cases ***
3833: +Deploy ${lab-name} lab
3834: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}
3835: +
3836: +Check ixr-e2sc chassis
3837: +    Check chassis    ixr-e2sc    ixr-e2sc
3838: +
3839: +Check ixr-e3 chassis
3840: +    Check chassis    ixr-e3    ixr-e3
3841: +
3842: +Check sar-10x chassis
3843: +    Check chassis    sar-10x-a    sar-10x
3844: +    Check chassis    sar-10x-b    sar-10x
3845: +
3846: +Ensure new chassis containers stay running
3847: +    Sleep    30s    Let the simulators get past initial startup
3848: +    Check container is running    ixr-e2sc
3849: +    Check container is running    ixr-e3
3850: +    Check container is running    sar-10x-a
3851: +    Check container is running    sar-10x-b
3852: +
3853: +Check sar-10x line cards are up
3854: +    Wait Until Keyword Succeeds    3 minutes    15 seconds    SAR-10x line cards are up
3855: +
3856: +*** Keywords ***
3857: +SAR-10x line cards are up
3858: +    # Query card 1, MDAs 1/1..1/8, then card 2 in chassis order.
3859: +    ${command} =    Catenate    SEPARATOR=${SPACE}
3860: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags}
3861: +    ...    --address clab-${lab-name}-sar-10x
3862: +    ...    --path /state/card[slot-number=1]/hardware-data/oper-state
3863: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=1]/hardware-data/oper-state
3864: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=2]/hardware-data/oper-state
3865: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=3]/hardware-data/oper-state
3866: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=4]/hardware-data/oper-state
3867: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=5]/hardware-data/oper-state
3868: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=6]/hardware-data/oper-state
3869: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=7]/hardware-data/oper-state
3870: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=8]/hardware-data/oper-state
3871: +    ...    --path /state/card[slot-number=2]/hardware-data/oper-state
3872: +    ${rc}    ${output} =    Run And Return Rc And Output    ${command}
3873: +    Log    ${output}
3874: +    Should Be Equal As Integers    ${rc}    0
3875: +    ${up_states} =    Get Regexp Matches    ${output}    in-service
3876: +    Length Should Be    ${up_states}    10
3877: +    Should Not Contain    ${output}    null
3878: +
3879: +Check chassis
3880: +    [Arguments]    ${node}    ${chassis}
3881: +    ${rc}    ${output} =    Run And Return Rc And Output
3882: +    ...    sudo ${runtime} inspect clab-${lab-name}-${node} --format '{{range .Config.Env}}{{println .}}{{end}}'
3883: +    Log    ${output}
3884: +    Should Be Equal As Integers    ${rc}    0
3885: +    Should Contain    ${output}    NOKIA_SROS_CHASSIS=${chassis}
3886: +
3887: +Check container is running
3888: +    [Arguments]    ${node}
3889: +    ${rc}    ${output} =    Run And Return Rc And Output
3890: +    ...    sudo ${runtime} inspect clab-${lab-name}-${node} --format '{{.State.Running}}'
3891: +    Log    ${output}
3892: +    Should Be Equal As Integers    ${rc}    0
3893: +    ${state} =    Strip String    ${output}
3894: +    Should Be Equal    ${state}    true
3895: diff --git a/tests/srsim.robot b/tests/srsim.robot
3896: new file mode 100644
3897: index 0000000..6d7c7fc
3898: --- /dev/null
3899: +++ b/tests/srsim.robot
3900: @@ -0,0 +1,20 @@
3901: +*** Settings ***
3902: +Library     OperatingSystem
3903: +Resource    common.robot
3904: +
3905: +
3906: +*** Keywords ***
3907: +Deploy SR-SIM Lab
3908: +    [Arguments]    ${topology}    ${runtime}
3909: +    Log    ${topology}
3910: +    ${rc}    ${output} =    Run And Return Rc And Output
3911: +    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${topology}
3912: +    Log    ${output}
3913: +    Should Be Equal As Integers    ${rc}    0
3914: +
3915: +Destroy SR-SIM Lab
3916: +    [Arguments]    ${topology}    ${runtime}
3917: +    ${rc}    ${output} =    Run And Return Rc And Output
3918: +    ...    ${CLAB_BIN} --runtime ${runtime} destroy -t ${topology} --cleanup
3919: +    Log    ${output}
3920: +    Should Be Equal As Integers    ${rc}    0
3921: diff --git a/utils/sros_schema_gen.sh b/utils/sros_schema_gen.sh
3922: index 868c9d9..c2cef5b 100755
3923: --- a/utils/sros_schema_gen.sh
3924: +++ b/utils/sros_schema_gen.sh
3925: @@ -4,15 +4,18 @@
3926:  
3927:  CHASSIS_INFO_FILE=chassis_info.json
3928:  SCHEMA=../schemas/clab.schema.json
3929:  
3930:  jq --indent 4 -s '
3931: -  .[0] as $c | .[1] |
3932: +  .[0] as $all |
3933: +  .[1] |
3934: +  ([.. | objects | select(.enum? and (.enum | index("ixr-e2n"))) | .enum][0]) as $node_types |
3935: +  ($all | with_entries(select((.key | ascii_downcase) as $key | $node_types | index($key)))) as $c |
3936:    ($c | [.[].cpm // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cpms |
3937:    ($c | [.[].iom // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cards |
3938:    ($c | [.[].sfm // [] | .[]]) as $sfms |
3939: -  ($c | [.[].mda // [] | .[] | select(. != null)]) as $mdas |
3940: +  ($c | [.[].mda // [] | .[] | select(. != null)] + [.[].fixed_mdas // {} | .[]]) as $mdas |

(Output capped at 50 KB. Showing lines 2548-3940. Use offset=3941 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502f6e56001pX2zsr95hLyv0D",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502f69070017hU0PHIctAauDc",
  "callID": "call_0fb3318a32984862a3cc0925",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/diff.txt",
      "offset": 2548,
      "limit": 1400
    },
    "output": "<path>/source/diff.txt</path>\n<type>file</type>\n<content>\n2548: diff --git a/nodes/sros/sros_test.go b/nodes/sros/sros_test.go\n2549: index 29cace9..dd8aea6 100644\n2550: --- a/nodes/sros/sros_test.go\n2551: +++ b/nodes/sros/sros_test.go\n2552: @@ -272,10 +272,16 @@ func Test_sros_generateComponentConfig(t *testing.T) {\n2553:  \t\t\tname:     \"integrated_ixr_e3x_default\",\n2554:  \t\t\tnodeType: \"ixr-e3x\",\n2555:  \t\t\tcardType: \"imm16-sfp112+15-sfp56+6-qsfpdd\",\n2556:  \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"}},\n2557:  \t\t},\n2558: +\t\t{\n2559: +\t\t\tname:     \"integrated_ixr_e2sc_default\",\n2560: +\t\t\tnodeType: \"ixr-e2sc\",\n2561: +\t\t\tcardType: \"imm16-sfp++4-sfp28\",\n2562: +\t\t\tmdas:     MDAS{{Slot: 1, Type: \"m16-sfp++4-sfp28\"}},\n2563: +\t\t},\n2564:  \t\t{\n2565:  \t\t\tname:     \"integrated_ixr_ec_default\",\n2566:  \t\t\tnodeType: \"ixr-ec\",\n2567:  \t\t\tcardType: \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n2568:  \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\"}},\n2569: @@ -311,40 +317,116 @@ func Test_sros_generateComponentConfig(t *testing.T) {\n2570:  \t\t\t\tassert.Equal(t, 4, strings.Count(cfg, \"power-module-type ps-a-dc-6000\"))\n2571:  \t\t\t}\n2572:  \t\t})\n2573:  \t}\n2574:  \n2575: -\tt.Run(\"integrated_env_overrides_preserve_default_mda_slots\", func(t *testing.T) {\n2576: +\tt.Run(\"integrated_component_mda_override_preserves_default_mda_slots\", func(t *testing.T) {\n2577: +\t\tn := newSrosComponentConfigTestNode(\"sr-1\", nil, []*Component{\n2578: +\t\t\t{MDA: MDAS{{Slot: 1, Type: \"custom-mda\"}}},\n2579: +\t\t})\n2580: +\n2581: +\t\tcfg := n.generateComponentConfig()\n2582: +\n2583: +\t\tassert.Contains(t, cfg, \"/configure card 1 card-type iom-1 admin-state enable\")\n2584: +\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type custom-mda admin-state enable\")\n2585: +\t\tassert.Contains(\n2586: +\t\t\tt,\n2587: +\t\t\tcfg,\n2588: +\t\t\t\"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable\",\n2589: +\t\t)\n2590: +\t})\n2591: +\n2592: +\tt.Run(\"integrated_xiom_replaces_default_mdas\", func(t *testing.T) {\n2593: +\t\tn := newSrosComponentConfigTestNode(\"sr-1s\", nil, []*Component{\n2594: +\t\t\t{\n2595: +\t\t\t\tXIOM: XIOMS{\n2596: +\t\t\t\t\t{\n2597: +\t\t\t\t\t\tSlot: 1,\n2598: +\t\t\t\t\t\tType: \"iom-s-3.0t\",\n2599: +\t\t\t\t\t\tMDA: MDAS{\n2600: +\t\t\t\t\t\t\t{Slot: 1, Type: \"ms18-100gb-qsfp28\"},\n2601: +\t\t\t\t\t\t\t{Slot: 2, Type: \"ms2-400gb-qsfpdd+2-100gb-qsfp28\"},\n2602: +\t\t\t\t\t\t},\n2603: +\t\t\t\t\t},\n2604: +\t\t\t\t},\n2605: +\t\t\t},\n2606: +\t\t})\n2607: +\n2608: +\t\tcfg := n.generateComponentConfig()\n2609: +\n2610: +\t\tassert.Contains(t, cfg, \"/configure card 1 card-type xcm-1s admin-state enable\")\n2611: +\t\tassert.Contains(t, cfg, \"/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\")\n2612: +\t\tassert.Contains(\n2613: +\t\t\tt,\n2614: +\t\t\tcfg,\n2615: +\t\t\t\"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\",\n2616: +\t\t)\n2617: +\t\tassert.Contains(\n2618: +\t\t\tt,\n2619: +\t\t\tcfg,\n2620: +\t\t\t\"/configure card 1 xiom x1 mda 2 mda-type ms2-400gb-qsfpdd+2-100gb-qsfp28 admin-state enable\",\n2621: +\t\t)\n2622: +\t\tassert.NotContains(t, cfg, \"s36-100gb-qsfp28\")\n2623: +\t})\n2624: +\n2625: +\tt.Run(\"integrated_env_mda_overrides_default_component_config\", func(t *testing.T) {\n2626:  \t\tn := newSrosComponentConfigTestNode(\n2627:  \t\t\t\"sr-1\",\n2628: -\t\t\tmap[string]string{\n2629: -\t\t\t\tenvNokiaSrosCard:       \"env-card\",\n2630: -\t\t\t\tenvNokiaSrosMDA + \"_1\": \"env-mda\",\n2631: -\t\t\t},\n2632: +\t\t\tmap[string]string{envNokiaSrosMDA + \"_1\": \"env-mda\"},\n2633:  \t\t\tnil,\n2634:  \t\t)\n2635:  \n2636:  \t\tcfg := n.generateComponentConfig()\n2637:  \n2638: -\t\tassert.Contains(t, cfg, \"/configure card 1 card-type env-card admin-state enable\")\n2639: -\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type env-mda admin-state enable\")\n2640: +\t\tassert.Contains(\n2641: +\t\t\tt,\n2642: +\t\t\tcfg,\n2643: +\t\t\t\"/configure card 1 mda 1 mda-type env-mda admin-state enable\",\n2644: +\t\t)\n2645:  \t\tassert.Contains(\n2646:  \t\t\tt,\n2647:  \t\t\tcfg,\n2648:  \t\t\t\"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable\",\n2649:  \t\t)\n2650: +\t\tassert.NotContains(t, cfg, \"me6-100gb-qsfp28\")\n2651:  \t})\n2652:  \n2653: -\tt.Run(\"integrated_env_override_adds_mda_slot\", func(t *testing.T) {\n2654: +\tt.Run(\"integrated_env_mda_overrides_component_mda\", func(t *testing.T) {\n2655:  \t\tn := newSrosComponentConfigTestNode(\n2656: -\t\t\t\"ixr-r6\",\n2657: +\t\t\t\"sr-1\",\n2658: +\t\t\tmap[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"},\n2659: +\t\t\t[]*Component{{MDA: MDAS{{Slot: 1, Type: \"from-component\"}}}},\n2660: +\t\t)\n2661: +\n2662: +\t\tcfg := n.generateComponentConfig()\n2663: +\n2664: +\t\tassert.Contains(\n2665: +\t\t\tt,\n2666: +\t\t\tcfg,\n2667: +\t\t\t\"/configure card 1 mda 1 mda-type from-env admin-state enable\",\n2668: +\t\t)\n2669: +\t\tassert.NotContains(t, cfg, \"from-component\")\n2670: +\t})\n2671: +\n2672: +\tt.Run(\"integrated_card_override_skips_component_config\", func(t *testing.T) {\n2673: +\t\tn := newSrosComponentConfigTestNode(\n2674: +\t\t\t\"sr-1s\",\n2675:  \t\t\tmap[string]string{\n2676: -\t\t\t\tenvNokiaSrosMDA + \"_3\": \"m20-1g-csfp\",\n2677: +\t\t\t\tenvNokiaSrosCard:       \"cpm-1s\",\n2678: +\t\t\t\tenvNokiaSrosMDA + \"_1\": \"env-mda\",\n2679:  \t\t\t},\n2680:  \t\t\tnil,\n2681:  \t\t)\n2682:  \n2683: +\t\tassert.Empty(t, n.generateComponentConfig())\n2684: +\t})\n2685: +\n2686: +\tt.Run(\"integrated_component_override_adds_mda_slot\", func(t *testing.T) {\n2687: +\t\tn := newSrosComponentConfigTestNode(\"ixr-r6\", nil, []*Component{\n2688: +\t\t\t{MDA: MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}}},\n2689: +\t\t})\n2690: +\n2691:  \t\tcfg := n.generateComponentConfig()\n2692:  \n2693:  \t\tassert.Contains(\n2694:  \t\t\tt,\n2695:  \t\t\tcfg,\n2696: @@ -415,41 +497,174 @@ func Test_sros_integratedComponentOverrides(t *testing.T) {\n2697:  \t\trequire.NoError(t, err)\n2698:  \t\tassert.True(t, n.isStandaloneNode())\n2699:  \t\tassert.Equal(t, slotBName, n.Cfg.Env[envNokiaSrosSlot])\n2700:  \t\tassert.Equal(t, \"cpiom-ixr-r6\", n.Cfg.Env[envNokiaSrosCard])\n2701:  \t\tassert.Equal(t, \"m20-1g-csfp\", n.Cfg.Env[envNokiaSrosMDA+\"_3\"])\n2702: +\n2703: +\t\tassert.Empty(t, n.generateComponentConfig())\n2704: +\t})\n2705: +\n2706: +\tt.Run(\"integrated_component_xiom_sets_env\", func(t *testing.T) {\n2707: +\t\tn := newSrosInitTestNode(\"sr-1s\", []*Component{\n2708: +\t\t\t{\n2709: +\t\t\t\tXIOM: XIOMS{\n2710: +\t\t\t\t\t{\n2711: +\t\t\t\t\t\tSlot: 1,\n2712: +\t\t\t\t\t\tType: \"iom-s-3.0t\",\n2713: +\t\t\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"ms18-100gb-qsfp28\"}},\n2714: +\t\t\t\t\t},\n2715: +\t\t\t\t},\n2716: +\t\t\t},\n2717: +\t\t})\n2718: +\n2719: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2720: +\t\tassert.Equal(t, \"iom-s-3.0t\", n.Cfg.Env[envNokiaSrosXIOM+\"_X1\"])\n2721: +\t\tassert.Equal(t, \"ms18-100gb-qsfp28\", n.Cfg.Env[envNokiaSrosMDA+\"_X1_1\"])\n2722: +\n2723: +\t\tcfg := n.generateComponentConfig()\n2724: +\t\tassert.Contains(t, cfg, \"/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\")\n2725: +\t\tassert.Contains(\n2726: +\t\t\tt,\n2727: +\t\t\tcfg,\n2728: +\t\t\t\"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\",\n2729: +\t\t)\n2730:  \t})\n2731:  \n2732:  \tt.Run(\"integrated_rejects_multiple_components\", func(t *testing.T) {\n2733: +\t\tfor _, tc := range []struct {\n2734: +\t\t\tnodeType   string\n2735: +\t\t\tcomponents []*Component\n2736: +\t\t}{\n2737: +\t\t\t{\"sr-1\", []*Component{{Slot: slotAName}, {Slot: slotBName}}},\n2738: +\t\t\t{\"ixr-r6\", []*Component{{Slot: slotAName}, {Slot: \"1\"}}},\n2739: +\t\t\t{\"ixr-r6\", []*Component{{Slot: slotAName}, {}}},\n2740: +\t\t} {\n2741: +\t\t\tn := newSrosInitTestNode(tc.nodeType, tc.components)\n2742: +\n2743: +\t\t\terr := n.Init(n.Cfg)\n2744: +\n2745: +\t\t\trequire.Error(t, err, tc.nodeType)\n2746: +\t\t\tassert.Contains(t, err.Error(), \"at most one component override\")\n2747: +\t\t}\n2748: +\t})\n2749: +\n2750: +\tt.Run(\"redundant_integrated_components_are_distributed\", func(t *testing.T) {\n2751:  \t\tn := newSrosInitTestNode(\"ixr-r6\", []*Component{\n2752: -\t\t\t{Slot: slotAName, Type: \"cpiom-ixr-r6\"},\n2753: -\t\t\t{Slot: slotBName, Type: \"cpiom-ixr-r6\"},\n2754: +\t\t\t{Slot: slotAName, MDA: MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}}},\n2755: +\t\t\t{Slot: slotBName},\n2756:  \t\t})\n2757:  \n2758: -\t\terr := n.Init(n.Cfg)\n2759: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2760: +\t\tassert.True(t, n.isDistributedBaseNode())\n2761: +\t\trequire.Len(t, n.componentNodes, 2)\n2762: +\n2763: +\t\tcpmA := n.componentNodes[0].(*sros)\n2764: +\t\tcpmB := n.componentNodes[1].(*sros)\n2765: +\t\tassert.Equal(t, slotAName, cpmA.Config().Env[envNokiaSrosSlot])\n2766: +\t\tassert.Equal(t, slotBName, cpmB.Config().Env[envNokiaSrosSlot])\n2767: +\t\tassert.Equal(t, \"container:n1-netns\", cpmA.Config().NetworkMode)\n2768: +\t\tassert.Equal(t, \"container:n1-netns\", cpmB.Config().NetworkMode)\n2769: +\n2770: +\t\tcfgA := cpmA.generateComponentConfig()\n2771: +\t\tassert.Contains(t, cfgA, \"/configure card 1 card-type iom-ixr-r6 admin-state enable\")\n2772: +\t\tassert.Contains(\n2773: +\t\t\tt,\n2774: +\t\t\tcfgA,\n2775: +\t\t\t\"/configure card 1 mda 1 mda-type m6-10g-sfp++1-100g-qsfp28 admin-state enable\",\n2776: +\t\t)\n2777: +\t\tassert.Contains(t, cfgA, \"/configure card 1 mda 3 mda-type m20-1g-csfp admin-state enable\")\n2778: +\n2779: +\t\tcfgB := cpmB.generateComponentConfig()\n2780: +\t\tassert.Contains(t, cfgB, \"/configure card 1 card-type iom-ixr-r6 admin-state enable\")\n2781: +\t\tassert.NotContains(t, cfgB, \"m20-1g-csfp\")\n2782: +\t})\n2783: +\n2784: +\tt.Run(\"lowercase_integrated_slots_resolve_to_cpm_a\", func(t *testing.T) {\n2785: +\t\tn := newSrosInitTestNode(\"ixr-r6\", []*Component{\n2786: +\t\t\t{Slot: \"a\"},\n2787: +\t\t\t{Slot: \"b\"},\n2788: +\t\t})\n2789: +\n2790: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2791: +\t\tslot, err := n.cpmSlot()\n2792: +\t\trequire.NoError(t, err)\n2793: +\t\tassert.Equal(t, slotAName, slot)\n2794: +\t})\n2795: +\n2796: +\tt.Run(\"node_env_overrides_component_mda\", func(t *testing.T) {\n2797: +\t\tn := newSrosInitTestNode(\"sr-1\", []*Component{\n2798: +\t\t\t{MDA: MDAS{{Slot: 1, Type: \"from-component\"}}},\n2799: +\t\t})\n2800: +\t\tn.Cfg.Env = map[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"}\n2801: +\n2802: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2803: +\t\tassert.Equal(t, \"from-env\", n.Cfg.Env[envNokiaSrosMDA+\"_1\"])\n2804: +\n2805: +\t\tcfg := n.generateComponentConfig()\n2806: +\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type from-env admin-state enable\")\n2807: +\t\tassert.NotContains(t, cfg, \"from-component\")\n2808: +\t})\n2809: +\n2810: +\tt.Run(\"node_env_overrides_sfm\", func(t *testing.T) {\n2811: +\t\tn := newSrosInitTestNode(\"sr-1\", nil)\n2812: +\t\tkindSpecificConfig.Of(n.Cfg).SFM = \"from-sfm\"\n2813: +\t\tn.Cfg.Env = map[string]string{envNokiaSrosSFM: \"from-env\"}\n2814: +\n2815: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2816: +\t\tassert.Equal(t, \"from-env\", n.Cfg.Env[envNokiaSrosSFM])\n2817: +\t})\n2818: +\n2819: +\tt.Run(\"distributed_node_env_overrides_component_mda\", func(t *testing.T) {\n2820: +\t\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n2821: +\t\t\t{Slot: slotAName, Type: \"cpm-2s\"},\n2822: +\t\t\t{\n2823: +\t\t\t\tSlot: \"1\",\n2824: +\t\t\t\tType: \"xcm-2s\",\n2825: +\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"from-component\"}},\n2826: +\t\t\t},\n2827: +\t\t})\n2828: +\t\tn.Cfg.Env = map[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"}\n2829: +\n2830: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2831: +\t\trequire.Len(t, n.componentNodes, 2)\n2832: +\n2833: +\t\tlinecard := n.componentNodes[1].(*sros)\n2834: +\t\tassert.Equal(t, \"from-env\", linecard.Config().Env[envNokiaSrosMDA+\"_1\"])\n2835: +\n2836: +\t\tcfg := n.componentNodes[0].(*sros).generateComponentConfig()\n2837: +\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type from-env admin-state enable\")\n2838: +\t\tassert.NotContains(t, cfg, \"from-component\")\n2839: +\t})\n2840: +\n2841: +\tt.Run(\"duplicate_component_slots_are_rejected_regardless_of_case\", func(t *testing.T) {\n2842: +\t\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n2843: +\t\t\t{Slot: \"a\"},\n2844: +\t\t\t{Slot: \"A\"},\n2845: +\t\t})\n2846: +\n2847: +\t\terr := n.checkComponentSlotsConfig()\n2848:  \n2849:  \t\trequire.Error(t, err)\n2850: -\t\tassert.Contains(t, err.Error(), \"at most one component override\")\n2851: +\t\tassert.Contains(t, err.Error(), \"duplicate\")\n2852:  \t})\n2853:  \n2854:  \tt.Run(\"sfm_sets_container_env\", func(t *testing.T) {\n2855:  \t\tn := newSrosInitTestNode(\"sr-1\", nil)\n2856:  \t\tkindSpecificConfig.Of(n.Cfg).SFM = \"m-sfm6-7/12\"\n2857:  \n2858:  \t\trequire.NoError(t, n.Init(n.Cfg))\n2859:  \t\tassert.Equal(t, \"m-sfm6-7/12\", n.Cfg.Env[envNokiaSrosSFM])\n2860:  \t})\n2861:  \n2862: -\tt.Run(\"single_slot_integrated_rejects_card_type_override\", func(t *testing.T) {\n2863: -\t\tn := newSrosInitTestNode(\"ixr-e2\", []*Component{\n2864: -\t\t\t{Slot: slotAName, Type: \"imm2-qsfpdd+2-qsfp28+24-sfp28\"},\n2865: +\tt.Run(\"single_slot_integrated_allows_card_type_override\", func(t *testing.T) {\n2866: +\t\tn := newSrosInitTestNode(\"ixr-e2n\", []*Component{\n2867: +\t\t\t{Slot: slotAName, Type: \"cpm-ixr-e2n/imm4-sfp+4-sfp+\"},\n2868:  \t\t})\n2869:  \n2870: -\t\terr := n.Init(n.Cfg)\n2871: -\n2872: -\t\trequire.Error(t, err)\n2873: -\t\tassert.Contains(t, err.Error(), \"does not support component card-type override\")\n2874: +\t\trequire.NoError(t, n.Init(n.Cfg))\n2875: +\t\tassert.Equal(t, \"cpm-ixr-e2n/imm4-sfp+4-sfp+\", n.Cfg.Env[envNokiaSrosCard])\n2876: +\t\tassert.Empty(t, n.generateComponentConfig())\n2877:  \t})\n2878:  \n2879:  \tt.Run(\"integrated_rejects_invalid_slot\", func(t *testing.T) {\n2880:  \t\tn := newSrosInitTestNode(\"ixr-e2\", []*Component{\n2881:  \t\t\t{Slot: slotBName, Type: \"cpm-ixr-e2\"},\n2882: diff --git a/nodes/sros/template.go b/nodes/sros/template.go\n2883: index 38f1e4d..b538320 100644\n2884: --- a/nodes/sros/template.go\n2885: +++ b/nodes/sros/template.go\n2886: @@ -1,7 +1,28 @@\n2887:  package sros\n2888:  \n2889: +import (\n2890: +\t_ \"embed\"\n2891: +\t\"text/template\"\n2892: +\n2893: +\tclabutils \"github.com/srl-labs/containerlab/utils\"\n2894: +)\n2895: +\n2896: +var (\n2897: +\t//go:embed configs/sros_config_sros25.go.tpl\n2898: +\tcfgTplSROS25 string\n2899: +\n2900: +\t//go:embed configs/sros_config_classic.go.tpl\n2901: +\tcfgTplClassic string\n2902: +\n2903: +\t//go:embed configs/ixr/ixr_config_classic.go.tpl\n2904: +\tcfgTplClassicIxr string\n2905: +\n2906: +\t//go:embed configs/sar/sar_config_classic.go.tpl\n2907: +\tcfgTplClassicSar string\n2908: +)\n2909: +\n2910:  // srosTemplateData holds all data needed for template selection and execution.\n2911:  type srosTemplateData struct {\n2912:  \t// Template selection criteria\n2913:  \tNodeType          string\n2914:  \tConfigurationMode string\n2915: @@ -43,5 +64,36 @@ type tplIFace struct {\n2916:  \tSlot       string\n2917:  \tPort       string\n2918:  \tBreakoutNo string\n2919:  \tMtu        int\n2920:  }\n2921: +\n2922: +// getTemplateForVariant returns the template string and name for the given config variant.\n2923: +// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= \"26\").\n2924: +func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {\n2925: +\t// Model-driven (or mixed treated as classic below when family is classic)\n2926: +\tif v.Mode == ConfigModeModelDriven {\n2927: +\t\t// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= \"26\"\n2928: +\t\t// { return cfgTplSROS26, \"clab-sros-config-sros26\" }\n2929: +\t\treturn cfgTplSROS25, \"clab-sros-config-sros25\"\n2930: +\t}\n2931: +\t// Classic (or mixed)\n2932: +\ttmpl = cfgTplClassic\n2933: +\ttplName = \"clab-sros-config-classic\"\n2934: +\tswitch v.Family {\n2935: +\tcase ConfigFamilyIXR:\n2936: +\t\treturn cfgTplClassicIxr, \"clab-sros-config-classic-ixr\"\n2937: +\tcase ConfigFamilySAR:\n2938: +\t\treturn cfgTplClassicSar, \"clab-sros-config-classic-sar\"\n2939: +\tdefault:\n2940: +\t\treturn tmpl, tplName\n2941: +\t}\n2942: +}\n2943: +\n2944: +// selectConfigTemplate chooses the config template from the config variant (mode + family).\n2945: +func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {\n2946: +\tv := n.resolveConfigVariant()\n2947: +\ttmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)\n2948: +\treturn template.New(tplName).\n2949: +\t\tFuncs(clabutils.CreateFuncs()).\n2950: +\t\tParse(tmpl)\n2951: +}\n2952: diff --git a/nodes/sros/variant.go b/nodes/sros/variant.go\n2953: index fad585c..85bcac5 100644\n2954: --- a/nodes/sros/variant.go\n2955: +++ b/nodes/sros/variant.go\n2956: @@ -2,11 +2,21 @@\n2957:  // Licensed under the BSD 3-Clause License.\n2958:  // SPDX-License-Identifier: BSD-3-Clause\n2959:  \n2960:  package sros\n2961:  \n2962: -import \"fmt\"\n2963: +import (\n2964: +\t\"fmt\"\n2965: +\t\"regexp\"\n2966: +)\n2967: +\n2968: +var (\n2969: +\tsarRegexp   = regexp.MustCompile(`(?i)\\bsar-`)\n2970: +\tsarHmRegexp = regexp.MustCompile(`(?i)\\b(sar-hm|sar-hmc)\\b`)\n2971: +\n2972: +\tixrRegexp = regexp.MustCompile(`(?i)\\bixr-`)\n2973: +)\n2974:  \n2975:  // ConfigMode is the configuration mode (model-driven or classic).\n2976:  type ConfigMode string\n2977:  \n2978:  const (\n2979: @@ -141,5 +151,20 @@ func getSnippetSet(v ConfigVariant) snippetSet {\n2980:  \t\t\tgrpc = grpcConfigSARInsecure\n2981:  \t\t}\n2982:  \t}\n2983:  \treturn snippetSet{SystemConfig: sys, GRPCConfig: grpc}\n2984:  }\n2985: +\n2986: +// isIXRNode returns true if this is an IXR node type (case-insensitive).\n2987: +func (n *sros) isIXRNode() bool {\n2988: +\treturn ixrRegexp.MatchString(n.Cfg.NodeType)\n2989: +}\n2990: +\n2991: +// isSARNode returns true if this is a SAR node type (case-insensitive).\n2992: +func (n *sros) isSARNode() bool {\n2993: +\treturn sarRegexp.MatchString(n.Cfg.NodeType)\n2994: +}\n2995: +\n2996: +// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).\n2997: +func (n *sros) isSARHmNode() bool {\n2998: +\treturn sarHmRegexp.MatchString(n.Cfg.NodeType)\n2999: +}\n3000: diff --git a/schemas/clab.schema.json b/schemas/clab.schema.json\n3001: index 66679ac..0157106 100644\n3002: --- a/schemas/clab.schema.json\n3003: +++ b/schemas/clab.schema.json\n3004: @@ -939,10 +939,12 @@\n3005:                                              \"ixr-6\",\n3006:                                              \"ixr-e2c\",\n3007:                                              \"ixr-e2\",\n3008:                                              \"ixr-e2n\",\n3009:                                              \"ixr-e2n-s\",\n3010: +                                            \"ixr-e2sc\",\n3011: +                                            \"ixr-e3\",\n3012:                                              \"ixr-e3c\",\n3013:                                              \"ixr-e3x\",\n3014:                                              \"ixr-ec\",\n3015:                                              \"ixr-e\",\n3016:                                              \"ixr-r4\",\n3017: @@ -951,10 +953,11 @@\n3018:                                              \"ixr-r6\",\n3019:                                              \"ixr-s\",\n3020:                                              \"ixr-x3\",\n3021:                                              \"ixr-x\",\n3022:                                              \"sar-1\",\n3023: +                                            \"sar-10x\",\n3024:                                              \"sar-hm\",\n3025:                                              \"sar-hmc\",\n3026:                                              \"sar-hx\",\n3027:                                              \"sar-mx\",\n3028:                                              \"sr-1-24d\",\n3029: @@ -2009,11 +2012,14 @@\n3030:                  \"cpm-ixr-e-gnss/imm24-sfp++8-sfp28+2-qsfp28\",\n3031:                  \"cpm-ixr-e/imm14-10g-sfp++4-1g-tx\",\n3032:                  \"cpm-ixr-e/imm24-sfp++8-sfp28+2-qsfp28\",\n3033:                  \"cpm-ixr-e2\",\n3034:                  \"cpm-ixr-e2c\",\n3035: +                \"cpm-ixr-e2n-s/imm4-sfp+4-sfp+-s\",\n3036:                  \"cpm-ixr-e2n/imm4-sfp+4-sfp+\",\n3037: +                \"cpm-ixr-e2sc/imm16-sfp++4-sfp28\",\n3038: +                \"cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd\",\n3039:                  \"cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56\",\n3040:                  \"cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd\",\n3041:                  \"cpm-ixr-ec\",\n3042:                  \"cpm-ixr-s/imm48-sfp++6-qsfp28\",\n3043:                  \"cpm-ixr-x/imm32-qsfp28+4-qsfpdd\",\n3044: @@ -2077,10 +2083,11 @@\n3045:              \"type\": \"string\",\n3046:              \"description\": \"CPM card types for SR OS\",\n3047:              \"enum\": [\n3048:                  \"cpiom-ixr-r6\",\n3049:                  \"cpiom-ixr-r6d\",\n3050: +                \"cpiom-sar-x\",\n3051:                  \"cpm-1\",\n3052:                  \"cpm-1s\",\n3053:                  \"cpm-1se\",\n3054:                  \"cpm-1se/imm36-800g-qsfpdd\",\n3055:                  \"cpm-1x\",\n3056: @@ -2102,11 +2109,14 @@\n3057:                  \"cpm-ixr-e-gnss/imm24-sfp++8-sfp28+2-qsfp28\",\n3058:                  \"cpm-ixr-e/imm14-10g-sfp++4-1g-tx\",\n3059:                  \"cpm-ixr-e/imm24-sfp++8-sfp28+2-qsfp28\",\n3060:                  \"cpm-ixr-e2\",\n3061:                  \"cpm-ixr-e2c\",\n3062: +                \"cpm-ixr-e2n-s/imm4-sfp+4-sfp+-s\",\n3063:                  \"cpm-ixr-e2n/imm4-sfp+4-sfp+\",\n3064: +                \"cpm-ixr-e2sc/imm16-sfp++4-sfp28\",\n3065: +                \"cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd\",\n3066:                  \"cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56\",\n3067:                  \"cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd\",\n3068:                  \"cpm-ixr-ec\",\n3069:                  \"cpm-ixr-r4\",\n3070:                  \"cpm-ixr-s\",\n3071: @@ -2122,11 +2132,12 @@\n3072:                  \"cpm-v/iom-v\",\n3073:                  \"cpm-x20\",\n3074:                  \"cpm2-s\",\n3075:                  \"cpm2-x20\",\n3076:                  \"cpm5\",\n3077: -                \"iom-sar\"\n3078: +                \"iom-sar\",\n3079: +                \"iom-sar-1x\"\n3080:              ]\n3081:          },\n3082:          \"sros-mda-types\": {\n3083:              \"type\": \"string\",\n3084:              \"description\": \"MDA types for SR OS\",\n3085: @@ -2153,10 +2164,11 @@\n3086:                  \"m10-sfp++6-sfp\",\n3087:                  \"m12-sfp28+2-qsfp28\",\n3088:                  \"m14-10g-sfp++4-1g-tx\",\n3089:                  \"m18-25g-sfp28\",\n3090:                  \"m2-100g-qsfp28+16-10g-sfp+\",\n3091: +                \"m2-1g-sfp+2-10g-sfp+\",\n3092:                  \"m2-cfp2\",\n3093:                  \"m2-qsfpdd+2-qsfp28+24-sfp28\",\n3094:                  \"m20-10g-sfp+\",\n3095:                  \"m20-1g-csfp\",\n3096:                  \"m20-v\",\n3097: @@ -2166,11 +2178,13 @@\n3098:                  \"m32-qsfp28+4-qsfpdd\",\n3099:                  \"m36-100g-qsfp28\",\n3100:                  \"m36-qsfpdd\",\n3101:                  \"m4-100g-cfp4\",\n3102:                  \"m4-10g-sfp++1-100g-cfp2\",\n3103: +                \"m4-1g-rj+6-10g-sfp++2-25g-sfp28\",\n3104:                  \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n3105: +                \"m4-rs232-rj45+4-c3794-sfp\",\n3106:                  \"m40-10g-sfp\",\n3107:                  \"m40-10g-sfp-ptp\",\n3108:                  \"m40-200g-sfpdd+6-800g-qsfpdd-1\",\n3109:                  \"m46-10g-sfp+\",\n3110:                  \"m48-400g-qsfpdd-1\",\n3111: @@ -2181,10 +2195,11 @@\n3112:                  \"m5e2-100g-qsfp28+2-800g-qdd\",\n3113:                  \"m5e8-100g-sfp112+2-800g-qdd\",\n3114:                  \"m6-10g-sfp++1-100g-qsfp28\",\n3115:                  \"m6-10g-sfp++4-25g-sfp28\",\n3116:                  \"m6-qsfpdd+48-sfp56\",\n3117: +                \"m8-t1e1-rj48\",\n3118:                  \"m80-1g-csfp\",\n3119:                  \"m80-200g-sfpdd+12-400g-qsfpdd-1\",\n3120:                  \"m80-200g-sfpdd+12-800g-qsfpdd-1x\",\n3121:                  \"ma2-10gb-sfp+12-1gb-sfp\",\n3122:                  \"ma20-1gb-tx\",\n3123: diff --git a/tests/13-srsim/01-sros-to-linux.robot b/tests/13-srsim/01-sros-to-linux.robot\n3124: index c4d9cb2..8226dd7 100644\n3125: --- a/tests/13-srsim/01-sros-to-linux.robot\n3126: +++ b/tests/13-srsim/01-sros-to-linux.robot\n3127: @@ -1,9 +1,10 @@\n3128:  *** Settings ***\n3129:  Library             OperatingSystem\n3130:  Resource            ../ssh.robot\n3131:  Resource            ../common.robot\n3132: +Resource            ../srsim.robot\n3133:  \n3134:  Suite Teardown      Run Keyword    Cleanup\n3135:  \n3136:  \n3137:  *** Variables ***\n3138: @@ -21,15 +22,11 @@ Set key-path Variable\n3139:  Create SSH keypair - RSA\n3140:      ${rc}    ${output} =    Run And Return Rc And Output\n3141:      ...    ssh-keygen -t rsa -N \"\" -f ${key-path}-rsa\n3142:  \n3143:  Deploy ${lab-name} lab\n3144: -    Log    ${CURDIR}\n3145: -    ${rc}    ${output} =    Run And Return Rc And Output\n3146: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3147: -    Log    ${output}\n3148: -    Should Be Equal As Integers    ${rc}    0\n3149: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3150:  \n3151:  Ensure sros is reachable over ssh\n3152:      Login via SSH with username and password\n3153:      ...    address=clab-${lab-name}-sros\n3154:      ...    username=admin\n3155: @@ -102,7 +99,7 @@ Verify saving config with copy flag\n3156:      [Teardown]    Run    rm -rf ${copy_dst}\n3157:  \n3158:  \n3159:  *** Keywords ***\n3160:  Cleanup\n3161: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3162: +    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3163:      Run    rm -f ${key-path}*\n3164: diff --git a/tests/13-srsim/03-sros-dist-to-linux.robot b/tests/13-srsim/03-sros-dist-to-linux.robot\n3165: index b0c6369..a473880 100644\n3166: --- a/tests/13-srsim/03-sros-dist-to-linux.robot\n3167: +++ b/tests/13-srsim/03-sros-dist-to-linux.robot\n3168: @@ -1,35 +1,23 @@\n3169:  *** Settings ***\n3170:  Library             OperatingSystem\n3171:  Resource            ../ssh.robot\n3172:  Resource            ../common.robot\n3173: +Resource            ../srsim.robot\n3174:  \n3175: -Suite Teardown      Run Keyword    Cleanup\n3176: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3177:  \n3178:  \n3179:  *** Variables ***\n3180:  ${lab-name}         sr03\n3181:  ${lab-file-name}    03-srsim-dist.clab.yml\n3182:  ${runtime}          docker\n3183: -${key-name}         clab-test-key\n3184:  \n3185:  \n3186:  *** Test Cases ***\n3187: -Set key-path Variable\n3188: -    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}\n3189: -    Set Suite Variable    ${key-path}\n3190: -\n3191: -Create SSH keypair - RSA\n3192: -    ${rc}    ${output} =    Run And Return Rc And Output\n3193: -    ...    ssh-keygen -t rsa -N \"\" -f ${key-path}-rsa\n3194: -\n3195:  Deploy ${lab-name} lab\n3196: -    Log    ${CURDIR}\n3197: -    ${rc}    ${output} =    Run And Return Rc And Output\n3198: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3199: -    Log    ${output}\n3200: -    Should Be Equal As Integers    ${rc}    0\n3201: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3202:  \n3203:  Ensure sros is reachable over ssh\n3204:      Login via SSH with username and password\n3205:      ...    address=clab-${lab-name}-sros-a\n3206:      ...    username=admin\n3207: @@ -55,10 +43,5 @@ Do a gNOI cert get-certs\n3208:      Skip If    '${runtime}' != 'docker'\n3209:      ${rc}    ${output} =    Run And Return Rc And Output\n3210:      ...    sudo docker run --network host --rm --mount type=bind,source=${CURDIR}/clab-${lab-name}/.tls/ca,target=/tls ghcr.io/karimra/gnoic:0.2.0 cert get-certs --username admin --password 'NokiaSros1!' --tls-ca /tls/ca.pem --address clab-${lab-name}-sros-a\n3211:      Log    ${output}\n3212:      Should Contain    ${output}    sros-a.${lab-name}.io\n3213: -\n3214: -*** Keywords ***\n3215: -Cleanup\n3216: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3217: -    Run    rm -f ${key-path}*\n3218: diff --git a/tests/13-srsim/04-sros-classic.robot b/tests/13-srsim/04-sros-classic.robot\n3219: index efdf58f..16b5811 100644\n3220: --- a/tests/13-srsim/04-sros-classic.robot\n3221: +++ b/tests/13-srsim/04-sros-classic.robot\n3222: @@ -1,9 +1,10 @@\n3223:  *** Settings ***\n3224:  Library             OperatingSystem\n3225:  Resource            ../ssh.robot\n3226:  Resource            ../common.robot\n3227: +Resource            ../srsim.robot\n3228:  \n3229:  Suite Teardown      Run Keyword    Cleanup\n3230:  \n3231:  \n3232:  *** Variables ***\n3233: @@ -23,15 +24,11 @@ Set key-path Variable\n3234:  Create SSH keypair - ecdsa512\n3235:      ${rc}    ${output} =    Run And Return Rc And Output\n3236:      ...    ssh-keygen -t ecdsa -b 521 -N \"\" -f ${key-path}-ecdsa512\n3237:  \n3238:  Deploy ${lab-name} lab\n3239: -    Log    ${CURDIR}\n3240: -    ${rc}    ${output} =    Run And Return Rc And Output\n3241: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3242: -    Log    ${output}\n3243: -    Should Be Equal As Integers    ${rc}    0\n3244: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3245:  \n3246:  Ensure sros is reachable over ssh\n3247:      Login via SSH with username and password\n3248:      ...    address=clab-${lab-name}-srsim\n3249:      ...    username=admin\n3250: @@ -58,7 +55,7 @@ Check Mixed Config Mode on srsim\n3251:      Log    ${output}\n3252:      Should Contain    ${output}    mixed\n3253:  \n3254:  *** Keywords ***\n3255:  Cleanup\n3256: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3257: +    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3258:      Run    rm -f ${key-path}*\n3259: diff --git a/tests/13-srsim/05-sros-comp-to-linux.robot b/tests/13-srsim/05-sros-comp-to-linux.robot\n3260: index 4bb4aac..f7db14e 100644\n3261: --- a/tests/13-srsim/05-sros-comp-to-linux.robot\n3262: +++ b/tests/13-srsim/05-sros-comp-to-linux.robot\n3263: @@ -1,9 +1,10 @@\n3264:  *** Settings ***\n3265:  Library             OperatingSystem\n3266:  Resource            ../ssh.robot\n3267:  Resource            ../common.robot\n3268: +Resource            ../srsim.robot\n3269:  \n3270:  Suite Teardown      Run Keyword    Cleanup\n3271:  \n3272:  \n3273:  *** Variables ***\n3274: @@ -21,15 +22,11 @@ Set key-path Variable\n3275:  Create SSH keypair - RSA\n3276:      ${rc}    ${output} =    Run And Return Rc And Output\n3277:      ...    ssh-keygen -t rsa -N \"\" -f ${key-path}-rsa\n3278:  \n3279:  Deploy ${lab-name} lab\n3280: -    Log    ${CURDIR}\n3281: -    ${rc}    ${output} =    Run And Return Rc And Output\n3282: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3283: -    Log    ${output}\n3284: -    Should Be Equal As Integers    ${rc}    0\n3285: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3286:  \n3287:  Ensure sros is reachable over ssh\n3288:      Login via SSH with username and password\n3289:      ...    address=clab-${lab-name}-sros\n3290:      ...    username=admin\n3291: @@ -136,7 +133,7 @@ Ensure XIOM MDA x/1 is equipped and up on sr2s-01\n3292:      Should Contain    ${output}    in-service\n3293:  \n3294:  \n3295:  *** Keywords ***\n3296:  Cleanup\n3297: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3298: +    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3299:      Run    rm -f ${key-path}*\n3300: diff --git a/tests/13-srsim/06-srsim-sar.robot b/tests/13-srsim/06-srsim-sar.robot\n3301: index 0633c48..0ef2dfa 100644\n3302: --- a/tests/13-srsim/06-srsim-sar.robot\n3303: +++ b/tests/13-srsim/06-srsim-sar.robot\n3304: @@ -1,33 +1,25 @@\n3305:  *** Settings ***\n3306:  Library             OperatingSystem\n3307:  Resource            ../ssh.robot\n3308:  Resource            ../common.robot\n3309: +Resource            ../srsim.robot\n3310:  \n3311: -Suite Teardown      Run Keyword    Cleanup\n3312: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3313:  \n3314:  \n3315:  *** Variables ***\n3316:  ${lab-name}         sr06\n3317:  ${lab-file-name}    06-srsim-sar.clab.yml\n3318:  ${runtime}          docker\n3319: -${key-name}         clab-test-key\n3320:  ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n3321:  ${gnmic_flags}      --username admin --password NokiaSros1! --values-only\n3322:  \n3323:  \n3324:  *** Test Cases ***\n3325: -Set key-path Variable\n3326: -    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}\n3327: -    Set Suite Variable    ${key-path}\n3328: -\n3329:  Deploy ${lab-name} lab\n3330: -    Log    ${CURDIR}\n3331: -    ${rc}    ${output} =    Run And Return Rc And Output\n3332: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3333: -    Log    ${output}\n3334: -    Should Be Equal As Integers    ${rc}    0\n3335: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3336:  \n3337:  Ensure sros is reachable over ssh\n3338:      Login via SSH with username and password\n3339:      ...    address=clab-${lab-name}-sar3\n3340:      ...    username=admin\n3341: @@ -45,10 +37,5 @@ Check Config Mode on sar1\n3342:  Check Config Mode on sar2\n3343:      ${rc}    ${output} =    Run And Return Rc And Output\n3344:      ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --insecure --address clab-${lab-name}-sar2 get --path /state/system/management-interface/configuration-oper-mode\n3345:      Log    ${output}\n3346:      Should Contain    ${output}    model-driven\n3347: -\n3348: -*** Keywords ***\n3349: -Cleanup\n3350: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3351: -    Run    rm -f ${key-path}*\n3352: diff --git a/tests/13-srsim/07-srsim-with-mgmt-network.robot b/tests/13-srsim/07-srsim-with-mgmt-network.robot\n3353: index 5025036..ce0951f 100644\n3354: --- a/tests/13-srsim/07-srsim-with-mgmt-network.robot\n3355: +++ b/tests/13-srsim/07-srsim-with-mgmt-network.robot\n3356: @@ -1,31 +1,23 @@\n3357:  *** Settings ***\n3358:  Library             OperatingSystem\n3359:  Resource            ../ssh.robot\n3360:  Resource            ../common.robot\n3361: +Resource            ../srsim.robot\n3362:  \n3363: -Suite Teardown      Run Keyword    Cleanup\n3364: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3365:  \n3366:  \n3367:  *** Variables ***\n3368:  ${lab-name}         sr07\n3369:  ${lab-file-name}    07-srsim-mix.clab.yml\n3370:  ${runtime}          docker\n3371: -${key-name}         clab-test-key\n3372:  \n3373:  \n3374:  *** Test Cases ***\n3375: -Set key-path Variable\n3376: -    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}\n3377: -    Set Suite Variable    ${key-path}\n3378: -\n3379:  Deploy ${lab-name} lab\n3380: -    Log    ${CURDIR}\n3381: -    ${rc}    ${output} =    Run And Return Rc And Output\n3382: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3383: -    Log    ${output}\n3384: -    Should Be Equal As Integers    ${rc}    0\n3385: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3386:  \n3387:  Ensure sros is reachable over ssh\n3388:      Login via SSH with username and password\n3389:      ...    address=clab-${lab-name}-srsim10\n3390:      ...    username=admin\n3391: @@ -57,15 +49,10 @@ Do a gNMI GET using TLS\n3392:      Log    ${output}\n3393:      Should Be Equal As Integers    ${rc}    0\n3394:      Should Contain    ${output}    srsim10-a\n3395:  \n3396:  *** Keywords ***\n3397: -Cleanup\n3398: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3399: -    Run    rm -f ${key-path}*\n3400: -\n3401: -\n3402:  Do a gNOI ping to other node\n3403:      Skip If    '${runtime}' != 'docker'\n3404:      ${rc}    ${output} =    Run And Return Rc And Output\n3405:      ...    sudo docker run --network host --rm --mount type=bind,source=${CURDIR}/clab-${lab-name}/.tls/ca,target=/tls ghcr.io/karimra/gnoic:0.2.0 system ping --username admin --password 'NokiaSros1!' --tls-ca /tls/ca.pem --address clab-${lab-name}-srsim10 --destination 100.0.0.11 --ns Base --count 3\n3406:      Log    ${output}\n3407: diff --git a/tests/13-srsim/08-srsim-comp-cfg-test.robot b/tests/13-srsim/08-srsim-comp-cfg-test.robot\n3408: index d276341..c531df4 100644\n3409: --- a/tests/13-srsim/08-srsim-comp-cfg-test.robot\n3410: +++ b/tests/13-srsim/08-srsim-comp-cfg-test.robot\n3411: @@ -1,11 +1,12 @@\n3412:  *** Settings ***\n3413:  Library             OperatingSystem\n3414:  Resource            ../ssh.robot\n3415:  Resource            ../common.robot\n3416: +Resource            ../srsim.robot\n3417:  \n3418: -Suite Teardown      Run Keyword    Cleanup\n3419: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3420:  \n3421:  \n3422:  *** Variables ***\n3423:  ${lab-name}         comp-cfg-gen-test\n3424:  ${lab-file-name}    08-srsim-comp-cfg-test.clab.yml\n3425: @@ -14,15 +15,11 @@ ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n3426:  ${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n3427:  \n3428:  \n3429:  *** Test Cases ***\n3430:  Deploy ${lab-name} lab\n3431: -    Log    ${CURDIR}\n3432: -    ${rc}    ${output} =    Run And Return Rc And Output\n3433: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3434: -    Log    ${output}\n3435: -    Should Be Equal As Integers    ${rc}    0\n3436: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3437:  \n3438:  Wait for 45s\n3439:      Sleep    45s    Let everything fully provision & come up\n3440:  \n3441:  Check SR-1 card configuration\n3442: @@ -121,13 +118,10 @@ Check SR-2s-ncofg has unprovisioned card\n3443:      Log    ${output}\n3444:      Should Be Equal As Integers    ${rc}    0\n3445:      Should Contain    ${output}    unprovisioned\n3446:  \n3447:  *** Keywords ***\n3448: -Cleanup\n3449: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3450: -\n3451:  Check SR-2S MDA state\n3452:      ${rc}    ${output} =    Run And Return Rc And Output\n3453:      ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr2s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/hardware-data/oper-state\n3454:      Log    ${output}\n3455:      Should Be Equal As Integers    ${rc}    0\n3456: diff --git a/tests/13-srsim/09-srsim-pause-container.robot b/tests/13-srsim/09-srsim-pause-container.robot\n3457: index 0f96bd7..90f57c3 100644\n3458: --- a/tests/13-srsim/09-srsim-pause-container.robot\n3459: +++ b/tests/13-srsim/09-srsim-pause-container.robot\n3460: @@ -1,12 +1,13 @@\n3461:  *** Settings ***\n3462:  Library             OperatingSystem\n3463:  Library             Process\n3464:  Resource            ../ssh.robot\n3465:  Resource            ../common.robot\n3466: +Resource            ../srsim.robot\n3467:  \n3468: -Suite Teardown      Run Keyword    Cleanup\n3469: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3470:  \n3471:  \n3472:  *** Variables ***\n3473:  ${lab-name}         srsim-pause-ctr\n3474:  ${lab-file-name}    09-srsim-pause-container.clab.yml\n3475: @@ -15,15 +16,11 @@ ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n3476:  ${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n3477:  \n3478:  \n3479:  *** Test Cases ***\n3480:  Deploy ${lab-name} lab\n3481: -    Log    ${CURDIR}\n3482: -    ${rc}    ${output} =    Run And Return Rc And Output\n3483: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3484: -    Log    ${output}\n3485: -    Should Be Equal As Integers    ${rc}    0\n3486: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3487:  \n3488:  Wait for 45s\n3489:      Sleep    45s    Let everything fully provision & come up\n3490:  \n3491:  # IPv4\n3492: @@ -165,11 +162,5 @@ Check CPM SSH\n3493:          Should Contain    ${output}    TiMOS\n3494:          Should Match Regexp    ${output}    ${slot}:admin@[^\\\\r\\\\n]+#\n3495:      FINALLY\n3496:          SSHLibrary.Close All Connections\n3497:      END\n3498: -\n3499: -Cleanup\n3500: -    ${rc}    ${output} =    Run And Return Rc And Output\n3501: -    ...    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3502: -    Log    ${output}\n3503: -    Should Be Equal As Integers    ${rc}    0\n3504: diff --git a/tests/13-srsim/10-srsim-lifecycle.robot b/tests/13-srsim/10-srsim-lifecycle.robot\n3505: index c9085d9..0b24da2 100644\n3506: --- a/tests/13-srsim/10-srsim-lifecycle.robot\n3507: +++ b/tests/13-srsim/10-srsim-lifecycle.robot\n3508: @@ -1,25 +1,22 @@\n3509:  *** Settings ***\n3510:  Library             OperatingSystem\n3511:  Resource            ../common.robot\n3512: +Resource            ../srsim.robot\n3513:  \n3514: -Suite Teardown      Run Keyword    Cleanup\n3515: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3516:  \n3517:  \n3518:  *** Variables ***\n3519:  ${lab-name}         lifecycle-test-srsim\n3520:  ${lab-file-name}    10-srsim-lifecycle.clab.yml\n3521:  ${runtime}          docker\n3522:  \n3523:  \n3524:  *** Test Cases ***\n3525:  Deploy ${lab-name} lab\n3526: -    Log    ${CURDIR}\n3527: -    ${rc}    ${output} =    Run And Return Rc And Output\n3528: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3529: -    Log    ${output}\n3530: -    Should Be Equal As Integers    ${rc}    0\n3531: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3532:  \n3533:  Ensure client can ping integrated SR OS node\n3534:      Sleep    20s    give time for SR OS nodes to boot\n3535:      ${rc}    ${output} =    Run And Return Rc And Output\n3536:      ...    ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\\=client --cmd \"ping -c2 -W2 10.0.1.2\"\n3537: @@ -85,10 +82,5 @@ Verify ping to distributed SR OS recovers after start\n3538:      ${rc}    ${output} =    Run And Return Rc And Output\n3539:      ...    ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\\=client --cmd \"ping -c2 -W2 10.0.2.2\"\n3540:      Log    ${output}\n3541:      Should Be Equal As Integers    ${rc}    0\n3542:      Should Match Regexp    ${output}    2 packets transmitted, 2 (packets )?received, 0% packet loss\n3543: -\n3544: -\n3545: -*** Keywords ***\n3546: -Cleanup\n3547: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3548: diff --git a/tests/13-srsim/12-srsim-veth-stitch.robot b/tests/13-srsim/12-srsim-veth-stitch.robot\n3549: index fac9fe1..9f70b9f 100644\n3550: --- a/tests/13-srsim/12-srsim-veth-stitch.robot\n3551: +++ b/tests/13-srsim/12-srsim-veth-stitch.robot\n3552: @@ -1,11 +1,12 @@\n3553:  *** Settings ***\n3554:  Library             OperatingSystem\n3555:  Resource            ../ssh.robot\n3556:  Resource            ../common.robot\n3557: +Resource            ../srsim.robot\n3558:  \n3559: -Suite Teardown      Run Keyword    Cleanup\n3560: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3561:  \n3562:  \n3563:  *** Variables ***\n3564:  ${lab-name}         veth-stitch\n3565:  ${lab-file-name}    12-srsim-veth-stitch.clab.yml\n3566: @@ -14,15 +15,11 @@ ${sros-password}    NokiaSros1!\n3567:  ${peer-ip}          10.0.0.2\n3568:  \n3569:  \n3570:  *** Test Cases ***\n3571:  Deploy ${lab-name} lab\n3572: -    Log    ${CURDIR}\n3573: -    ${rc}    ${output} =    Run And Return Rc And Output\n3574: -    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n3575: -    Log    ${output}\n3576: -    Should Be Equal As Integers    ${rc}    0\n3577: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3578:  \n3579:  Ensure distributed sros can ping sros2 over the veth-stitch link\n3580:      Wait Until Keyword Succeeds    3 minutes    10 seconds    Ping succeeds    sros    ${peer-ip}\n3581:  \n3582:  Verify inspect interfaces returns the host-side stitch interfaces\n3583: @@ -87,13 +84,10 @@ Verify the stitch interfaces are removed on destroy\n3584:      Log    ${output}\n3585:      Should Not Contain    ${output}    clab-s-\n3586:  \n3587:  \n3588:  *** Keywords ***\n3589: -Cleanup\n3590: -    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n3591: -\n3592:  Ping over SSH\n3593:      [Arguments]    ${node}    ${dst}\n3594:      Login via SSH with username and password\n3595:      ...    address=clab-${lab-name}-${node}\n3596:      ...    username=admin\n3597: diff --git a/tests/13-srsim/13-srsim-integrated.clab.yml b/tests/13-srsim/13-srsim-integrated.clab.yml\n3598: new file mode 100644\n3599: index 0000000..a3f2ca3\n3600: --- /dev/null\n3601: +++ b/tests/13-srsim/13-srsim-integrated.clab.yml\n3602: @@ -0,0 +1,33 @@\n3603: +# yaml-language-server: $schema=../../schemas/clab.schema.json\n3604: +name: srsim-integrated\n3605: +\n3606: +topology:\n3607: +  kinds:\n3608: +    nokia_srsim:\n3609: +      license: /opt/nokia/sros/license.txt\n3610: +      image: registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\n3611: +\n3612: +  nodes:\n3613: +    ixr-e2n:\n3614: +      kind: nokia_srsim\n3615: +      type: ixr-e2n\n3616: +      components:\n3617: +        - type: cpm-ixr-e2n/imm4-sfp+4-sfp+\n3618: +\n3619: +    ixr-r6:\n3620: +      kind: nokia_srsim\n3621: +      type: ixr-r6\n3622: +      components:\n3623: +        - slot: A\n3624: +        - slot: B\n3625: +\n3626: +    sr-1s:\n3627: +      kind: nokia_srsim\n3628: +      type: sr-1s\n3629: +      components:\n3630: +        - xiom:\n3631: +            - slot: 1\n3632: +              type: iom-s-3.0t\n3633: +              mda:\n3634: +                - slot: 1\n3635: +                  type: ms18-100gb-qsfp28\n3636: diff --git a/tests/13-srsim/13-srsim-integrated.robot b/tests/13-srsim/13-srsim-integrated.robot\n3637: new file mode 100644\n3638: index 0000000..8f6b929\n3639: --- /dev/null\n3640: +++ b/tests/13-srsim/13-srsim-integrated.robot\n3641: @@ -0,0 +1,105 @@\n3642: +*** Settings ***\n3643: +Library             OperatingSystem\n3644: +Resource            ../ssh.robot\n3645: +Resource            ../common.robot\n3646: +Resource            ../srsim.robot\n3647: +\n3648: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3649: +\n3650: +\n3651: +*** Variables ***\n3652: +${lab-name}         srsim-integrated\n3653: +${lab-file-name}    13-srsim-integrated.clab.yml\n3654: +${runtime}          docker\n3655: +${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n3656: +${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n3657: +\n3658: +\n3659: +*** Test Cases ***\n3660: +Deploy ${lab-name} lab\n3661: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3662: +\n3663: +Wait for 45s\n3664: +    Sleep    45s    Let everything fully provision & come up\n3665: +\n3666: +Check IXR-E2N card override is passed to the container\n3667: +    ${rc}    ${output} =    Run And Return Rc And Output\n3668: +    ...    sudo ${runtime} inspect clab-${lab-name}-ixr-e2n --format '{{range .Config.Env}}{{println .}}{{end}}'\n3669: +    Log    ${output}\n3670: +    Should Be Equal As Integers    ${rc}    0\n3671: +    Should Contain    ${output}    NOKIA_SROS_CARD=cpm-ixr-e2n/imm4-sfp+4-sfp+\n3672: +\n3673: +Check IXR-E2N equipped card matches the component\n3674: +    ${rc}    ${output} =    Run And Return Rc And Output\n3675: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-e2n --path /state/card[slot-number=1]/equipped-type\n3676: +    Log    ${output}\n3677: +    Should Be Equal As Integers    ${rc}    0\n3678: +    Should Contain    ${output}    imm4-sfp+4-sfp+\n3679: +\n3680: +Check IXR-R6 standby CPM slot is set\n3681: +    ${rc}    ${output} =    Run And Return Rc And Output\n3682: +    ...    sudo ${runtime} inspect clab-${lab-name}-ixr-r6-b --format '{{range .Config.Env}}{{println .}}{{end}}'\n3683: +    Log    ${output}\n3684: +    Should Be Equal As Integers    ${rc}    0\n3685: +    Should Contain    ${output}    NOKIA_SROS_SLOT=B\n3686: +\n3687: +Check IXR-R6 card configuration\n3688: +    ${rc}    ${output} =    Run And Return Rc And Output\n3689: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /configure/card[slot-number=1]/card-type\n3690: +    Log    ${output}\n3691: +    Should Be Equal As Integers    ${rc}    0\n3692: +    Should Contain    ${output}    iom-ixr-r6\n3693: +\n3694: +Check IXR-R6 MDA configuration\n3695: +    ${rc}    ${output} =    Run And Return Rc And Output\n3696: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /configure/card[slot-number=1]/mda[mda-slot=1]/mda-type\n3697: +    Log    ${output}\n3698: +    Should Be Equal As Integers    ${rc}    0\n3699: +    Should Contain    ${output}    m6-10g-sfp++1-100g-qsfp28\n3700: +\n3701: +Ensure IXR-R6 CPM A is up\n3702: +    Wait Until Keyword Succeeds    2 minutes    10 seconds    Check IXR-R6 CPM state    A\n3703: +\n3704: +Ensure IXR-R6 CPM B is up\n3705: +    Wait Until Keyword Succeeds    3 minutes    10 seconds    Check IXR-R6 CPM state    B\n3706: +\n3707: +\n3708: +Check SR-1s equipped card\n3709: +    ${rc}    ${output} =    Run And Return Rc And Output\n3710: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/equipped-type\n3711: +    Log    ${output}\n3712: +    Should Be Equal As Integers    ${rc}    0\n3713: +    Should Contain    ${output}    xcm-1s\n3714: +\n3715: +Check SR-1s equipped XIOM\n3716: +    ${rc}    ${output} =    Run And Return Rc And Output\n3717: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/equipped-type\n3718: +    Log    ${output}\n3719: +    Should Be Equal As Integers    ${rc}    0\n3720: +    Should Contain    ${output}    iom-s-3.0t\n3721: +\n3722: +Check SR-1s equipped XIOM MDA\n3723: +    ${rc}    ${output} =    Run And Return Rc And Output\n3724: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/equipped-type\n3725: +    Log    ${output}\n3726: +    Should Be Equal As Integers    ${rc}    0\n3727: +    Should Contain    ${output}    ms18-100gb-qsfp28\n3728: +\n3729: +Ensure SR-1s XIOM MDA is up\n3730: +    Wait Until Keyword Succeeds    2 minutes    10 seconds    Check SR-1s XIOM MDA state\n3731: +\n3732: +*** Keywords ***\n3733: +Check IXR-R6 CPM state\n3734: +    [Arguments]    ${slot}\n3735: +    ${rc}    ${output} =    Run And Return Rc And Output\n3736: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /state/cpm[cpm-slot=${slot}]/hardware-data/oper-state\n3737: +    Log    ${output}\n3738: +    Should Be Equal As Integers    ${rc}    0\n3739: +    Should Contain    ${output}    in-service\n3740: +\n3741: +Check SR-1s XIOM MDA state\n3742: +    ${rc}    ${output} =    Run And Return Rc And Output\n3743: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/hardware-data/oper-state\n3744: +    Log    ${output}\n3745: +    Should Be Equal As Integers    ${rc}    0\n3746: +    Should Contain    ${output}    in-service\n3747: diff --git a/tests/13-srsim/14-srsim-new-chassis.clab.yml b/tests/13-srsim/14-srsim-new-chassis.clab.yml\n3748: new file mode 100644\n3749: index 0000000..f5f3bc2\n3750: --- /dev/null\n3751: +++ b/tests/13-srsim/14-srsim-new-chassis.clab.yml\n3752: @@ -0,0 +1,53 @@\n3753: +# yaml-language-server: $schema=../../schemas/clab.schema.json\n3754: +name: srsim-new-chassis\n3755: +\n3756: +topology:\n3757: +  kinds:\n3758: +    nokia_srsim:\n3759: +      license: /opt/nokia/sros/license.txt\n3760: +      image: registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\n3761: +\n3762: +  nodes:\n3763: +    ixr-e2sc:\n3764: +      kind: nokia_srsim\n3765: +      type: ixr-e2sc\n3766: +\n3767: +    ixr-e3:\n3768: +      kind: nokia_srsim\n3769: +      type: ixr-e3\n3770: +\n3771: +    sar-10x:\n3772: +      kind: nokia_srsim\n3773: +      type: sar-10x\n3774: +      components:\n3775: +        - slot: A\n3776: +          type: cpiom-sar-x\n3777: +          mda: &mdas\n3778: +            - slot: 1\n3779: +              type: m2-1g-sfp+2-10g-sfp+\n3780: +            - slot: 2\n3781: +              type: m8-t1e1-rj48\n3782: +            - slot: 3\n3783: +              type: m2-1g-sfp+2-10g-sfp+\n3784: +            - slot: 4\n3785: +              type: m4-rs232-rj45+4-c3794-sfp\n3786: +            - slot: 5\n3787: +              type: m8-t1e1-rj48\n3788: +            - slot: 6\n3789: +              type: m4-rs232-rj45+4-c3794-sfp\n3790: +            - slot: 7\n3791: +              type: m8-t1e1-rj48\n3792: +            - slot: 8\n3793: +              type: m4-rs232-rj45+4-c3794-sfp\n3794: +        - slot: B\n3795: +          type: cpiom-sar-x\n3796: +          mda: *mdas\n3797: +      startup-config: |\n3798: +        /configure card 1 mda 1 mda-type m2-1g-sfp+2-10g-sfp+ admin-state enable\n3799: +        /configure card 1 mda 2 mda-type m8-t1e1-rj48 admin-state enable\n3800: +        /configure card 1 mda 3 mda-type m2-1g-sfp+2-10g-sfp+ admin-state enable\n3801: +        /configure card 1 mda 4 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable\n3802: +        /configure card 1 mda 5 mda-type m8-t1e1-rj48 admin-state enable\n3803: +        /configure card 1 mda 6 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable\n3804: +        /configure card 1 mda 7 mda-type m8-t1e1-rj48 admin-state enable\n3805: +        /configure card 1 mda 8 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable\n3806: diff --git a/tests/13-srsim/14-srsim-new-chassis.robot b/tests/13-srsim/14-srsim-new-chassis.robot\n3807: new file mode 100644\n3808: index 0000000..0f1b08a\n3809: --- /dev/null\n3810: +++ b/tests/13-srsim/14-srsim-new-chassis.robot\n3811: @@ -0,0 +1,83 @@\n3812: +*** Settings ***\n3813: +Library             OperatingSystem\n3814: +Library             String\n3815: +Resource            ../common.robot\n3816: +Resource            ../srsim.robot\n3817: +\n3818: +Suite Setup         Skip If    '${26_10_TESTS}'.lower() != 'true'\n3819: +...                 SR-SIM 26.10 is required; enable with --variable 26_10_TESTS:true\n3820: +Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3821: +\n3822: +\n3823: +*** Variables ***\n3824: +${lab-name}         srsim-new-chassis\n3825: +${lab-file-name}    14-srsim-new-chassis.clab.yml\n3826: +${runtime}          docker\n3827: +${26_10_TESTS}      false\n3828: +${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n3829: +${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n3830: +\n3831: +\n3832: +*** Test Cases ***\n3833: +Deploy ${lab-name} lab\n3834: +    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n3835: +\n3836: +Check ixr-e2sc chassis\n3837: +    Check chassis    ixr-e2sc    ixr-e2sc\n3838: +\n3839: +Check ixr-e3 chassis\n3840: +    Check chassis    ixr-e3    ixr-e3\n3841: +\n3842: +Check sar-10x chassis\n3843: +    Check chassis    sar-10x-a    sar-10x\n3844: +    Check chassis    sar-10x-b    sar-10x\n3845: +\n3846: +Ensure new chassis containers stay running\n3847: +    Sleep    30s    Let the simulators get past initial startup\n3848: +    Check container is running    ixr-e2sc\n3849: +    Check container is running    ixr-e3\n3850: +    Check container is running    sar-10x-a\n3851: +    Check container is running    sar-10x-b\n3852: +\n3853: +Check sar-10x line cards are up\n3854: +    Wait Until Keyword Succeeds    3 minutes    15 seconds    SAR-10x line cards are up\n3855: +\n3856: +*** Keywords ***\n3857: +SAR-10x line cards are up\n3858: +    # Query card 1, MDAs 1/1..1/8, then card 2 in chassis order.\n3859: +    ${command} =    Catenate    SEPARATOR=${SPACE}\n3860: +    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags}\n3861: +    ...    --address clab-${lab-name}-sar-10x\n3862: +    ...    --path /state/card[slot-number=1]/hardware-data/oper-state\n3863: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=1]/hardware-data/oper-state\n3864: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=2]/hardware-data/oper-state\n3865: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=3]/hardware-data/oper-state\n3866: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=4]/hardware-data/oper-state\n3867: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=5]/hardware-data/oper-state\n3868: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=6]/hardware-data/oper-state\n3869: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=7]/hardware-data/oper-state\n3870: +    ...    --path /state/card[slot-number=1]/mda[mda-slot=8]/hardware-data/oper-state\n3871: +    ...    --path /state/card[slot-number=2]/hardware-data/oper-state\n3872: +    ${rc}    ${output} =    Run And Return Rc And Output    ${command}\n3873: +    Log    ${output}\n3874: +    Should Be Equal As Integers    ${rc}    0\n3875: +    ${up_states} =    Get Regexp Matches    ${output}    in-service\n3876: +    Length Should Be    ${up_states}    10\n3877: +    Should Not Contain    ${output}    null\n3878: +\n3879: +Check chassis\n3880: +    [Arguments]    ${node}    ${chassis}\n3881: +    ${rc}    ${output} =    Run And Return Rc And Output\n3882: +    ...    sudo ${runtime} inspect clab-${lab-name}-${node} --format '{{range .Config.Env}}{{println .}}{{end}}'\n3883: +    Log    ${output}\n3884: +    Should Be Equal As Integers    ${rc}    0\n3885: +    Should Contain    ${output}    NOKIA_SROS_CHASSIS=${chassis}\n3886: +\n3887: +Check container is running\n3888: +    [Arguments]    ${node}\n3889: +    ${rc}    ${output} =    Run And Return Rc And Output\n3890: +    ...    sudo ${runtime} inspect clab-${lab-name}-${node} --format '{{.State.Running}}'\n3891: +    Log    ${output}\n3892: +    Should Be Equal As Integers    ${rc}    0\n3893: +    ${state} =    Strip String    ${output}\n3894: +    Should Be Equal    ${state}    true\n3895: diff --git a/tests/srsim.robot b/tests/srsim.robot\n3896: new file mode 100644\n3897: index 0000000..6d7c7fc\n3898: --- /dev/null\n3899: +++ b/tests/srsim.robot\n3900: @@ -0,0 +1,20 @@\n3901: +*** Settings ***\n3902: +Library     OperatingSystem\n3903: +Resource    common.robot\n3904: +\n3905: +\n3906: +*** Keywords ***\n3907: +Deploy SR-SIM Lab\n3908: +    [Arguments]    ${topology}    ${runtime}\n3909: +    Log    ${topology}\n3910: +    ${rc}    ${output} =    Run And Return Rc And Output\n3911: +    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${topology}\n3912: +    Log    ${output}\n3913: +    Should Be Equal As Integers    ${rc}    0\n3914: +\n3915: +Destroy SR-SIM Lab\n3916: +    [Arguments]    ${topology}    ${runtime}\n3917: +    ${rc}    ${output} =    Run And Return Rc And Output\n3918: +    ...    ${CLAB_BIN} --runtime ${runtime} destroy -t ${topology} --cleanup\n3919: +    Log    ${output}\n3920: +    Should Be Equal As Integers    ${rc}    0\n3921: diff --git a/utils/sros_schema_gen.sh b/utils/sros_schema_gen.sh\n3922: index 868c9d9..c2cef5b 100755\n3923: --- a/utils/sros_schema_gen.sh\n3924: +++ b/utils/sros_schema_gen.sh\n3925: @@ -4,15 +4,18 @@\n3926:  \n3927:  CHASSIS_INFO_FILE=chassis_info.json\n3928:  SCHEMA=../schemas/clab.schema.json\n3929:  \n3930:  jq --indent 4 -s '\n3931: -  .[0] as $c | .[1] |\n3932: +  .[0] as $all |\n3933: +  .[1] |\n3934: +  ([.. | objects | select(.enum? and (.enum | index(\"ixr-e2n\"))) | .enum][0]) as $node_types |\n3935: +  ($all | with_entries(select((.key | ascii_downcase) as $key | $node_types | index($key)))) as $c |\n3936:    ($c | [.[].cpm // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cpms |\n3937:    ($c | [.[].iom // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cards |\n3938:    ($c | [.[].sfm // [] | .[]]) as $sfms |\n3939: -  ($c | [.[].mda // [] | .[] | select(. != null)]) as $mdas |\n3940: +  ($c | [.[].mda // [] | .[] | select(. != null)] + [.[].fixed_mdas // {} | .[]]) as $mdas |\n\n(Output capped at 50 KB. Showing lines 2548-3940. Use offset=3941 to continue.)\n</content>",
    "title": "source/diff.txt",
    "metadata": {
      "preview": "diff --git a/nodes/sros/sros_test.go b/nodes/sros/sros_test.go\nindex 29cace9..dd8aea6 100644\n--- a/nodes/sros/sros_test.go\n+++ b/nodes/sros/sros_test.go\n@@ -272,10 +272,16 @@ func Test_sros_generateComponentConfig(t *testing.T) {\n \t\t\tname:     \"integrated_ixr_e3x_default\",\n \t\t\tnodeType: \"ixr-e3x\",\n \t\t\tcardType: \"imm16-sfp112+15-sfp56+6-qsfpdd\",\n \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"}},\n \t\t},\n+\t\t{\n+\t\t\tname:     \"integrated_ixr_e2sc_default\",\n+\t\t\tnodeType: \"ixr-e2sc\",\n+\t\t\tcardType: \"imm16-sfp++4-sfp28\",\n+\t\t\tmdas:     MDAS{{Slot: 1, Type: \"m16-sfp++4-sfp28\"}},\n+\t\t},\n \t\t{\n \t\t\tname:     \"integrated_ixr_ec_default\",\n \t\t\tnodeType: \"ixr-ec\",\n \t\t\tcardType: \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/diff.txt",
        "text": "diff --git a/nodes/sros/sros_test.go b/nodes/sros/sros_test.go\nindex 29cace9..dd8aea6 100644\n--- a/nodes/sros/sros_test.go\n+++ b/nodes/sros/sros_test.go\n@@ -272,10 +272,16 @@ func Test_sros_generateComponentConfig(t *testing.T) {\n \t\t\tname:     \"integrated_ixr_e3x_default\",\n \t\t\tnodeType: \"ixr-e3x\",\n \t\t\tcardType: \"imm16-sfp112+15-sfp56+6-qsfpdd\",\n \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"}},\n \t\t},\n+\t\t{\n+\t\t\tname:     \"integrated_ixr_e2sc_default\",\n+\t\t\tnodeType: \"ixr-e2sc\",\n+\t\t\tcardType: \"imm16-sfp++4-sfp28\",\n+\t\t\tmdas:     MDAS{{Slot: 1, Type: \"m16-sfp++4-sfp28\"}},\n+\t\t},\n \t\t{\n \t\t\tname:     \"integrated_ixr_ec_default\",\n \t\t\tnodeType: \"ixr-ec\",\n \t\t\tcardType: \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n \t\t\tmdas:     MDAS{{Slot: 1, Type: \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\"}},\n@@ -311,40 +317,116 @@ func Test_sros_generateComponentConfig(t *testing.T) {\n \t\t\t\tassert.Equal(t, 4, strings.Count(cfg, \"power-module-type ps-a-dc-6000\"))\n \t\t\t}\n \t\t})\n \t}\n \n-\tt.Run(\"integrated_env_overrides_preserve_default_mda_slots\", func(t *testing.T) {\n+\tt.Run(\"integrated_component_mda_override_preserves_default_mda_slots\", func(t *testing.T) {\n+\t\tn := newSrosComponentConfigTestNode(\"sr-1\", nil, []*Component{\n+\t\t\t{MDA: MDAS{{Slot: 1, Type: \"custom-mda\"}}},\n+\t\t})\n+\n+\t\tcfg := n.generateComponentConfig()\n+\n+\t\tassert.Contains(t, cfg, \"/configure card 1 card-type iom-1 admin-state enable\")\n+\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type custom-mda admin-state enable\")\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfg,\n+\t\t\t\"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable\",\n+\t\t)\n+\t})\n+\n+\tt.Run(\"integrated_xiom_replaces_default_mdas\", func(t *testing.T) {\n+\t\tn := newSrosComponentConfigTestNode(\"sr-1s\", nil, []*Component{\n+\t\t\t{\n+\t\t\t\tXIOM: XIOMS{\n+\t\t\t\t\t{\n+\t\t\t\t\t\tSlot: 1,\n+\t\t\t\t\t\tType: \"iom-s-3.0t\",\n+\t\t\t\t\t\tMDA: MDAS{\n+\t\t\t\t\t\t\t{Slot: 1, Type: \"ms18-100gb-qsfp28\"},\n+\t\t\t\t\t\t\t{Slot: 2, Type: \"ms2-400gb-qsfpdd+2-100gb-qsfp28\"},\n+\t\t\t\t\t\t},\n+\t\t\t\t\t},\n+\t\t\t\t},\n+\t\t\t},\n+\t\t})\n+\n+\t\tcfg := n.generateComponentConfig()\n+\n+\t\tassert.Contains(t, cfg, \"/configure card 1 card-type xcm-1s admin-state enable\")\n+\t\tassert.Contains(t, cfg, \"/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\")\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfg,\n+\t\t\t\"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\",\n+\t\t)\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfg,\n+\t\t\t\"/configure card 1 xiom x1 mda 2 mda-type ms2-400gb-qsfpdd+2-100gb-qsfp28 admin-state enable\",\n+\t\t)\n+\t\tassert.NotContains(t, cfg, \"s36-100gb-qsfp28\")\n+\t})\n+\n+\tt.Run(\"integrated_env_mda_overrides_default_component_config\", func(t *testing.T) {\n \t\tn := newSrosComponentConfigTestNode(\n \t\t\t\"sr-1\",\n-\t\t\tmap[string]string{\n-\t\t\t\tenvNokiaSrosCard:       \"env-card\",\n-\t\t\t\tenvNokiaSrosMDA + \"_1\": \"env-mda\",\n-\t\t\t},\n+\t\t\tmap[string]string{envNokiaSrosMDA + \"_1\": \"env-mda\"},\n \t\t\tnil,\n \t\t)\n \n \t\tcfg := n.generateComponentConfig()\n \n-\t\tassert.Contains(t, cfg, \"/configure card 1 card-type env-card admin-state enable\")\n-\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type env-mda admin-state enable\")\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfg,\n+\t\t\t\"/configure card 1 mda 1 mda-type env-mda admin-state enable\",\n+\t\t)\n \t\tassert.Contains(\n \t\t\tt,\n \t\t\tcfg,\n \t\t\t\"/configure card 1 mda 2 mda-type me12-100gb-qsfp28 admin-state enable\",\n \t\t)\n+\t\tassert.NotContains(t, cfg, \"me6-100gb-qsfp28\")\n \t})\n \n-\tt.Run(\"integrated_env_override_adds_mda_slot\", func(t *testing.T) {\n+\tt.Run(\"integrated_env_mda_overrides_component_mda\", func(t *testing.T) {\n \t\tn := newSrosComponentConfigTestNode(\n-\t\t\t\"ixr-r6\",\n+\t\t\t\"sr-1\",\n+\t\t\tmap[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"},\n+\t\t\t[]*Component{{MDA: MDAS{{Slot: 1, Type: \"from-component\"}}}},\n+\t\t)\n+\n+\t\tcfg := n.generateComponentConfig()\n+\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfg,\n+\t\t\t\"/configure card 1 mda 1 mda-type from-env admin-state enable\",\n+\t\t)\n+\t\tassert.NotContains(t, cfg, \"from-component\")\n+\t})\n+\n+\tt.Run(\"integrated_card_override_skips_component_config\", func(t *testing.T) {\n+\t\tn := newSrosComponentConfigTestNode(\n+\t\t\t\"sr-1s\",\n \t\t\tmap[string]string{\n-\t\t\t\tenvNokiaSrosMDA + \"_3\": \"m20-1g-csfp\",\n+\t\t\t\tenvNokiaSrosCard:       \"cpm-1s\",\n+\t\t\t\tenvNokiaSrosMDA + \"_1\": \"env-mda\",\n \t\t\t},\n \t\t\tnil,\n \t\t)\n \n+\t\tassert.Empty(t, n.generateComponentConfig())\n+\t})\n+\n+\tt.Run(\"integrated_component_override_adds_mda_slot\", func(t *testing.T) {\n+\t\tn := newSrosComponentConfigTestNode(\"ixr-r6\", nil, []*Component{\n+\t\t\t{MDA: MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}}},\n+\t\t})\n+\n \t\tcfg := n.generateComponentConfig()\n \n \t\tassert.Contains(\n \t\t\tt,\n \t\t\tcfg,\n@@ -415,41 +497,174 @@ func Test_sros_integratedComponentOverrides(t *testing.T) {\n \t\trequire.NoError(t, err)\n \t\tassert.True(t, n.isStandaloneNode())\n \t\tassert.Equal(t, slotBName, n.Cfg.Env[envNokiaSrosSlot])\n \t\tassert.Equal(t, \"cpiom-ixr-r6\", n.Cfg.Env[envNokiaSrosCard])\n \t\tassert.Equal(t, \"m20-1g-csfp\", n.Cfg.Env[envNokiaSrosMDA+\"_3\"])\n+\n+\t\tassert.Empty(t, n.generateComponentConfig())\n+\t})\n+\n+\tt.Run(\"integrated_component_xiom_sets_env\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"sr-1s\", []*Component{\n+\t\t\t{\n+\t\t\t\tXIOM: XIOMS{\n+\t\t\t\t\t{\n+\t\t\t\t\t\tSlot: 1,\n+\t\t\t\t\t\tType: \"iom-s-3.0t\",\n+\t\t\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"ms18-100gb-qsfp28\"}},\n+\t\t\t\t\t},\n+\t\t\t\t},\n+\t\t\t},\n+\t\t})\n+\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\tassert.Equal(t, \"iom-s-3.0t\", n.Cfg.Env[envNokiaSrosXIOM+\"_X1\"])\n+\t\tassert.Equal(t, \"ms18-100gb-qsfp28\", n.Cfg.Env[envNokiaSrosMDA+\"_X1_1\"])\n+\n+\t\tcfg := n.generateComponentConfig()\n+\t\tassert.Contains(t, cfg, \"/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\")\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfg,\n+\t\t\t\"/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\",\n+\t\t)\n \t})\n \n \tt.Run(\"integrated_rejects_multiple_components\", func(t *testing.T) {\n+\t\tfor _, tc := range []struct {\n+\t\t\tnodeType   string\n+\t\t\tcomponents []*Component\n+\t\t}{\n+\t\t\t{\"sr-1\", []*Component{{Slot: slotAName}, {Slot: slotBName}}},\n+\t\t\t{\"ixr-r6\", []*Component{{Slot: slotAName}, {Slot: \"1\"}}},\n+\t\t\t{\"ixr-r6\", []*Component{{Slot: slotAName}, {}}},\n+\t\t} {\n+\t\t\tn := newSrosInitTestNode(tc.nodeType, tc.components)\n+\n+\t\t\terr := n.Init(n.Cfg)\n+\n+\t\t\trequire.Error(t, err, tc.nodeType)\n+\t\t\tassert.Contains(t, err.Error(), \"at most one component override\")\n+\t\t}\n+\t})\n+\n+\tt.Run(\"redundant_integrated_components_are_distributed\", func(t *testing.T) {\n \t\tn := newSrosInitTestNode(\"ixr-r6\", []*Component{\n-\t\t\t{Slot: slotAName, Type: \"cpiom-ixr-r6\"},\n-\t\t\t{Slot: slotBName, Type: \"cpiom-ixr-r6\"},\n+\t\t\t{Slot: slotAName, MDA: MDAS{{Slot: 3, Type: \"m20-1g-csfp\"}}},\n+\t\t\t{Slot: slotBName},\n \t\t})\n \n-\t\terr := n.Init(n.Cfg)\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\tassert.True(t, n.isDistributedBaseNode())\n+\t\trequire.Len(t, n.componentNodes, 2)\n+\n+\t\tcpmA := n.componentNodes[0].(*sros)\n+\t\tcpmB := n.componentNodes[1].(*sros)\n+\t\tassert.Equal(t, slotAName, cpmA.Config().Env[envNokiaSrosSlot])\n+\t\tassert.Equal(t, slotBName, cpmB.Config().Env[envNokiaSrosSlot])\n+\t\tassert.Equal(t, \"container:n1-netns\", cpmA.Config().NetworkMode)\n+\t\tassert.Equal(t, \"container:n1-netns\", cpmB.Config().NetworkMode)\n+\n+\t\tcfgA := cpmA.generateComponentConfig()\n+\t\tassert.Contains(t, cfgA, \"/configure card 1 card-type iom-ixr-r6 admin-state enable\")\n+\t\tassert.Contains(\n+\t\t\tt,\n+\t\t\tcfgA,\n+\t\t\t\"/configure card 1 mda 1 mda-type m6-10g-sfp++1-100g-qsfp28 admin-state enable\",\n+\t\t)\n+\t\tassert.Contains(t, cfgA, \"/configure card 1 mda 3 mda-type m20-1g-csfp admin-state enable\")\n+\n+\t\tcfgB := cpmB.generateComponentConfig()\n+\t\tassert.Contains(t, cfgB, \"/configure card 1 card-type iom-ixr-r6 admin-state enable\")\n+\t\tassert.NotContains(t, cfgB, \"m20-1g-csfp\")\n+\t})\n+\n+\tt.Run(\"lowercase_integrated_slots_resolve_to_cpm_a\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"ixr-r6\", []*Component{\n+\t\t\t{Slot: \"a\"},\n+\t\t\t{Slot: \"b\"},\n+\t\t})\n+\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\tslot, err := n.cpmSlot()\n+\t\trequire.NoError(t, err)\n+\t\tassert.Equal(t, slotAName, slot)\n+\t})\n+\n+\tt.Run(\"node_env_overrides_component_mda\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"sr-1\", []*Component{\n+\t\t\t{MDA: MDAS{{Slot: 1, Type: \"from-component\"}}},\n+\t\t})\n+\t\tn.Cfg.Env = map[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"}\n+\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\tassert.Equal(t, \"from-env\", n.Cfg.Env[envNokiaSrosMDA+\"_1\"])\n+\n+\t\tcfg := n.generateComponentConfig()\n+\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type from-env admin-state enable\")\n+\t\tassert.NotContains(t, cfg, \"from-component\")\n+\t})\n+\n+\tt.Run(\"node_env_overrides_sfm\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"sr-1\", nil)\n+\t\tkindSpecificConfig.Of(n.Cfg).SFM = \"from-sfm\"\n+\t\tn.Cfg.Env = map[string]string{envNokiaSrosSFM: \"from-env\"}\n+\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\tassert.Equal(t, \"from-env\", n.Cfg.Env[envNokiaSrosSFM])\n+\t})\n+\n+\tt.Run(\"distributed_node_env_overrides_component_mda\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n+\t\t\t{Slot: slotAName, Type: \"cpm-2s\"},\n+\t\t\t{\n+\t\t\t\tSlot: \"1\",\n+\t\t\t\tType: \"xcm-2s\",\n+\t\t\t\tMDA:  MDAS{{Slot: 1, Type: \"from-component\"}},\n+\t\t\t},\n+\t\t})\n+\t\tn.Cfg.Env = map[string]string{envNokiaSrosMDA + \"_1\": \"from-env\"}\n+\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\trequire.Len(t, n.componentNodes, 2)\n+\n+\t\tlinecard := n.componentNodes[1].(*sros)\n+\t\tassert.Equal(t, \"from-env\", linecard.Config().Env[envNokiaSrosMDA+\"_1\"])\n+\n+\t\tcfg := n.componentNodes[0].(*sros).generateComponentConfig()\n+\t\tassert.Contains(t, cfg, \"/configure card 1 mda 1 mda-type from-env admin-state enable\")\n+\t\tassert.NotContains(t, cfg, \"from-component\")\n+\t})\n+\n+\tt.Run(\"duplicate_component_slots_are_rejected_regardless_of_case\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"sr-2s\", []*Component{\n+\t\t\t{Slot: \"a\"},\n+\t\t\t{Slot: \"A\"},\n+\t\t})\n+\n+\t\terr := n.checkComponentSlotsConfig()\n \n \t\trequire.Error(t, err)\n-\t\tassert.Contains(t, err.Error(), \"at most one component override\")\n+\t\tassert.Contains(t, err.Error(), \"duplicate\")\n \t})\n \n \tt.Run(\"sfm_sets_container_env\", func(t *testing.T) {\n \t\tn := newSrosInitTestNode(\"sr-1\", nil)\n \t\tkindSpecificConfig.Of(n.Cfg).SFM = \"m-sfm6-7/12\"\n \n \t\trequire.NoError(t, n.Init(n.Cfg))\n \t\tassert.Equal(t, \"m-sfm6-7/12\", n.Cfg.Env[envNokiaSrosSFM])\n \t})\n \n-\tt.Run(\"single_slot_integrated_rejects_card_type_override\", func(t *testing.T) {\n-\t\tn := newSrosInitTestNode(\"ixr-e2\", []*Component{\n-\t\t\t{Slot: slotAName, Type: \"imm2-qsfpdd+2-qsfp28+24-sfp28\"},\n+\tt.Run(\"single_slot_integrated_allows_card_type_override\", func(t *testing.T) {\n+\t\tn := newSrosInitTestNode(\"ixr-e2n\", []*Component{\n+\t\t\t{Slot: slotAName, Type: \"cpm-ixr-e2n/imm4-sfp+4-sfp+\"},\n \t\t})\n \n-\t\terr := n.Init(n.Cfg)\n-\n-\t\trequire.Error(t, err)\n-\t\tassert.Contains(t, err.Error(), \"does not support component card-type override\")\n+\t\trequire.NoError(t, n.Init(n.Cfg))\n+\t\tassert.Equal(t, \"cpm-ixr-e2n/imm4-sfp+4-sfp+\", n.Cfg.Env[envNokiaSrosCard])\n+\t\tassert.Empty(t, n.generateComponentConfig())\n \t})\n \n \tt.Run(\"integrated_rejects_invalid_slot\", func(t *testing.T) {\n \t\tn := newSrosInitTestNode(\"ixr-e2\", []*Component{\n \t\t\t{Slot: slotBName, Type: \"cpm-ixr-e2\"},\ndiff --git a/nodes/sros/template.go b/nodes/sros/template.go\nindex 38f1e4d..b538320 100644\n--- a/nodes/sros/template.go\n+++ b/nodes/sros/template.go\n@@ -1,7 +1,28 @@\n package sros\n \n+import (\n+\t_ \"embed\"\n+\t\"text/template\"\n+\n+\tclabutils \"github.com/srl-labs/containerlab/utils\"\n+)\n+\n+var (\n+\t//go:embed configs/sros_config_sros25.go.tpl\n+\tcfgTplSROS25 string\n+\n+\t//go:embed configs/sros_config_classic.go.tpl\n+\tcfgTplClassic string\n+\n+\t//go:embed configs/ixr/ixr_config_classic.go.tpl\n+\tcfgTplClassicIxr string\n+\n+\t//go:embed configs/sar/sar_config_classic.go.tpl\n+\tcfgTplClassicSar string\n+)\n+\n // srosTemplateData holds all data needed for template selection and execution.\n type srosTemplateData struct {\n \t// Template selection criteria\n \tNodeType          string\n \tConfigurationMode string\n@@ -43,5 +64,36 @@ type tplIFace struct {\n \tSlot       string\n \tPort       string\n \tBreakoutNo string\n \tMtu        int\n }\n+\n+// getTemplateForVariant returns the template string and name for the given config variant.\n+// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= \"26\").\n+func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {\n+\t// Model-driven (or mixed treated as classic below when family is classic)\n+\tif v.Mode == ConfigModeModelDriven {\n+\t\t// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= \"26\"\n+\t\t// { return cfgTplSROS26, \"clab-sros-config-sros26\" }\n+\t\treturn cfgTplSROS25, \"clab-sros-config-sros25\"\n+\t}\n+\t// Classic (or mixed)\n+\ttmpl = cfgTplClassic\n+\ttplName = \"clab-sros-config-classic\"\n+\tswitch v.Family {\n+\tcase ConfigFamilyIXR:\n+\t\treturn cfgTplClassicIxr, \"clab-sros-config-classic-ixr\"\n+\tcase ConfigFamilySAR:\n+\t\treturn cfgTplClassicSar, \"clab-sros-config-classic-sar\"\n+\tdefault:\n+\t\treturn tmpl, tplName\n+\t}\n+}\n+\n+// selectConfigTemplate chooses the config template from the config variant (mode + family).\n+func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {\n+\tv := n.resolveConfigVariant()\n+\ttmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)\n+\treturn template.New(tplName).\n+\t\tFuncs(clabutils.CreateFuncs()).\n+\t\tParse(tmpl)\n+}\ndiff --git a/nodes/sros/variant.go b/nodes/sros/variant.go\nindex fad585c..85bcac5 100644\n--- a/nodes/sros/variant.go\n+++ b/nodes/sros/variant.go\n@@ -2,11 +2,21 @@\n // Licensed under the BSD 3-Clause License.\n // SPDX-License-Identifier: BSD-3-Clause\n \n package sros\n \n-import \"fmt\"\n+import (\n+\t\"fmt\"\n+\t\"regexp\"\n+)\n+\n+var (\n+\tsarRegexp   = regexp.MustCompile(`(?i)\\bsar-`)\n+\tsarHmRegexp = regexp.MustCompile(`(?i)\\b(sar-hm|sar-hmc)\\b`)\n+\n+\tixrRegexp = regexp.MustCompile(`(?i)\\bixr-`)\n+)\n \n // ConfigMode is the configuration mode (model-driven or classic).\n type ConfigMode string\n \n const (\n@@ -141,5 +151,20 @@ func getSnippetSet(v ConfigVariant) snippetSet {\n \t\t\tgrpc = grpcConfigSARInsecure\n \t\t}\n \t}\n \treturn snippetSet{SystemConfig: sys, GRPCConfig: grpc}\n }\n+\n+// isIXRNode returns true if this is an IXR node type (case-insensitive).\n+func (n *sros) isIXRNode() bool {\n+\treturn ixrRegexp.MatchString(n.Cfg.NodeType)\n+}\n+\n+// isSARNode returns true if this is a SAR node type (case-insensitive).\n+func (n *sros) isSARNode() bool {\n+\treturn sarRegexp.MatchString(n.Cfg.NodeType)\n+}\n+\n+// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).\n+func (n *sros) isSARHmNode() bool {\n+\treturn sarHmRegexp.MatchString(n.Cfg.NodeType)\n+}\ndiff --git a/schemas/clab.schema.json b/schemas/clab.schema.json\nindex 66679ac..0157106 100644\n--- a/schemas/clab.schema.json\n+++ b/schemas/clab.schema.json\n@@ -939,10 +939,12 @@\n                                             \"ixr-6\",\n                                             \"ixr-e2c\",\n                                             \"ixr-e2\",\n                                             \"ixr-e2n\",\n                                             \"ixr-e2n-s\",\n+                                            \"ixr-e2sc\",\n+                                            \"ixr-e3\",\n                                             \"ixr-e3c\",\n                                             \"ixr-e3x\",\n                                             \"ixr-ec\",\n                                             \"ixr-e\",\n                                             \"ixr-r4\",\n@@ -951,10 +953,11 @@\n                                             \"ixr-r6\",\n                                             \"ixr-s\",\n                                             \"ixr-x3\",\n                                             \"ixr-x\",\n                                             \"sar-1\",\n+                                            \"sar-10x\",\n                                             \"sar-hm\",\n                                             \"sar-hmc\",\n                                             \"sar-hx\",\n                                             \"sar-mx\",\n                                             \"sr-1-24d\",\n@@ -2009,11 +2012,14 @@\n                 \"cpm-ixr-e-gnss/imm24-sfp++8-sfp28+2-qsfp28\",\n                 \"cpm-ixr-e/imm14-10g-sfp++4-1g-tx\",\n                 \"cpm-ixr-e/imm24-sfp++8-sfp28+2-qsfp28\",\n                 \"cpm-ixr-e2\",\n                 \"cpm-ixr-e2c\",\n+                \"cpm-ixr-e2n-s/imm4-sfp+4-sfp+-s\",\n                 \"cpm-ixr-e2n/imm4-sfp+4-sfp+\",\n+                \"cpm-ixr-e2sc/imm16-sfp++4-sfp28\",\n+                \"cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd\",\n                 \"cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56\",\n                 \"cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd\",\n                 \"cpm-ixr-ec\",\n                 \"cpm-ixr-s/imm48-sfp++6-qsfp28\",\n                 \"cpm-ixr-x/imm32-qsfp28+4-qsfpdd\",\n@@ -2077,10 +2083,11 @@\n             \"type\": \"string\",\n             \"description\": \"CPM card types for SR OS\",\n             \"enum\": [\n                 \"cpiom-ixr-r6\",\n                 \"cpiom-ixr-r6d\",\n+                \"cpiom-sar-x\",\n                 \"cpm-1\",\n                 \"cpm-1s\",\n                 \"cpm-1se\",\n                 \"cpm-1se/imm36-800g-qsfpdd\",\n                 \"cpm-1x\",\n@@ -2102,11 +2109,14 @@\n                 \"cpm-ixr-e-gnss/imm24-sfp++8-sfp28+2-qsfp28\",\n                 \"cpm-ixr-e/imm14-10g-sfp++4-1g-tx\",\n                 \"cpm-ixr-e/imm24-sfp++8-sfp28+2-qsfp28\",\n                 \"cpm-ixr-e2\",\n                 \"cpm-ixr-e2c\",\n+                \"cpm-ixr-e2n-s/imm4-sfp+4-sfp+-s\",\n                 \"cpm-ixr-e2n/imm4-sfp+4-sfp+\",\n+                \"cpm-ixr-e2sc/imm16-sfp++4-sfp28\",\n+                \"cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd\",\n                 \"cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56\",\n                 \"cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd\",\n                 \"cpm-ixr-ec\",\n                 \"cpm-ixr-r4\",\n                 \"cpm-ixr-s\",\n@@ -2122,11 +2132,12 @@\n                 \"cpm-v/iom-v\",\n                 \"cpm-x20\",\n                 \"cpm2-s\",\n                 \"cpm2-x20\",\n                 \"cpm5\",\n-                \"iom-sar\"\n+                \"iom-sar\",\n+                \"iom-sar-1x\"\n             ]\n         },\n         \"sros-mda-types\": {\n             \"type\": \"string\",\n             \"description\": \"MDA types for SR OS\",\n@@ -2153,10 +2164,11 @@\n                 \"m10-sfp++6-sfp\",\n                 \"m12-sfp28+2-qsfp28\",\n                 \"m14-10g-sfp++4-1g-tx\",\n                 \"m18-25g-sfp28\",\n                 \"m2-100g-qsfp28+16-10g-sfp+\",\n+                \"m2-1g-sfp+2-10g-sfp+\",\n                 \"m2-cfp2\",\n                 \"m2-qsfpdd+2-qsfp28+24-sfp28\",\n                 \"m20-10g-sfp+\",\n                 \"m20-1g-csfp\",\n                 \"m20-v\",\n@@ -2166,11 +2178,13 @@\n                 \"m32-qsfp28+4-qsfpdd\",\n                 \"m36-100g-qsfp28\",\n                 \"m36-qsfpdd\",\n                 \"m4-100g-cfp4\",\n                 \"m4-10g-sfp++1-100g-cfp2\",\n+                \"m4-1g-rj+6-10g-sfp++2-25g-sfp28\",\n                 \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n+                \"m4-rs232-rj45+4-c3794-sfp\",\n                 \"m40-10g-sfp\",\n                 \"m40-10g-sfp-ptp\",\n                 \"m40-200g-sfpdd+6-800g-qsfpdd-1\",\n                 \"m46-10g-sfp+\",\n                 \"m48-400g-qsfpdd-1\",\n@@ -2181,10 +2195,11 @@\n                 \"m5e2-100g-qsfp28+2-800g-qdd\",\n                 \"m5e8-100g-sfp112+2-800g-qdd\",\n                 \"m6-10g-sfp++1-100g-qsfp28\",\n                 \"m6-10g-sfp++4-25g-sfp28\",\n                 \"m6-qsfpdd+48-sfp56\",\n+                \"m8-t1e1-rj48\",\n                 \"m80-1g-csfp\",\n                 \"m80-200g-sfpdd+12-400g-qsfpdd-1\",\n                 \"m80-200g-sfpdd+12-800g-qsfpdd-1x\",\n                 \"ma2-10gb-sfp+12-1gb-sfp\",\n                 \"ma20-1gb-tx\",\ndiff --git a/tests/13-srsim/01-sros-to-linux.robot b/tests/13-srsim/01-sros-to-linux.robot\nindex c4d9cb2..8226dd7 100644\n--- a/tests/13-srsim/01-sros-to-linux.robot\n+++ b/tests/13-srsim/01-sros-to-linux.robot\n@@ -1,9 +1,10 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n Suite Teardown      Run Keyword    Cleanup\n \n \n *** Variables ***\n@@ -21,15 +22,11 @@ Set key-path Variable\n Create SSH keypair - RSA\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    ssh-keygen -t rsa -N \"\" -f ${key-path}-rsa\n \n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-sros\n     ...    username=admin\n@@ -102,7 +99,7 @@ Verify saving config with copy flag\n     [Teardown]    Run    rm -rf ${copy_dst}\n \n \n *** Keywords ***\n Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n+    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n     Run    rm -f ${key-path}*\ndiff --git a/tests/13-srsim/03-sros-dist-to-linux.robot b/tests/13-srsim/03-sros-dist-to-linux.robot\nindex b0c6369..a473880 100644\n--- a/tests/13-srsim/03-sros-dist-to-linux.robot\n+++ b/tests/13-srsim/03-sros-dist-to-linux.robot\n@@ -1,35 +1,23 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         sr03\n ${lab-file-name}    03-srsim-dist.clab.yml\n ${runtime}          docker\n-${key-name}         clab-test-key\n \n \n *** Test Cases ***\n-Set key-path Variable\n-    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}\n-    Set Suite Variable    ${key-path}\n-\n-Create SSH keypair - RSA\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ssh-keygen -t rsa -N \"\" -f ${key-path}-rsa\n-\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-sros-a\n     ...    username=admin\n@@ -55,10 +43,5 @@ Do a gNOI cert get-certs\n     Skip If    '${runtime}' != 'docker'\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    sudo docker run --network host --rm --mount type=bind,source=${CURDIR}/clab-${lab-name}/.tls/ca,target=/tls ghcr.io/karimra/gnoic:0.2.0 cert get-certs --username admin --password 'NokiaSros1!' --tls-ca /tls/ca.pem --address clab-${lab-name}-sros-a\n     Log    ${output}\n     Should Contain    ${output}    sros-a.${lab-name}.io\n-\n-*** Keywords ***\n-Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n-    Run    rm -f ${key-path}*\ndiff --git a/tests/13-srsim/04-sros-classic.robot b/tests/13-srsim/04-sros-classic.robot\nindex efdf58f..16b5811 100644\n--- a/tests/13-srsim/04-sros-classic.robot\n+++ b/tests/13-srsim/04-sros-classic.robot\n@@ -1,9 +1,10 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n Suite Teardown      Run Keyword    Cleanup\n \n \n *** Variables ***\n@@ -23,15 +24,11 @@ Set key-path Variable\n Create SSH keypair - ecdsa512\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    ssh-keygen -t ecdsa -b 521 -N \"\" -f ${key-path}-ecdsa512\n \n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-srsim\n     ...    username=admin\n@@ -58,7 +55,7 @@ Check Mixed Config Mode on srsim\n     Log    ${output}\n     Should Contain    ${output}    mixed\n \n *** Keywords ***\n Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n+    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n     Run    rm -f ${key-path}*\ndiff --git a/tests/13-srsim/05-sros-comp-to-linux.robot b/tests/13-srsim/05-sros-comp-to-linux.robot\nindex 4bb4aac..f7db14e 100644\n--- a/tests/13-srsim/05-sros-comp-to-linux.robot\n+++ b/tests/13-srsim/05-sros-comp-to-linux.robot\n@@ -1,9 +1,10 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n Suite Teardown      Run Keyword    Cleanup\n \n \n *** Variables ***\n@@ -21,15 +22,11 @@ Set key-path Variable\n Create SSH keypair - RSA\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    ssh-keygen -t rsa -N \"\" -f ${key-path}-rsa\n \n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-sros\n     ...    username=admin\n@@ -136,7 +133,7 @@ Ensure XIOM MDA x/1 is equipped and up on sr2s-01\n     Should Contain    ${output}    in-service\n \n \n *** Keywords ***\n Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n+    Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n     Run    rm -f ${key-path}*\ndiff --git a/tests/13-srsim/06-srsim-sar.robot b/tests/13-srsim/06-srsim-sar.robot\nindex 0633c48..0ef2dfa 100644\n--- a/tests/13-srsim/06-srsim-sar.robot\n+++ b/tests/13-srsim/06-srsim-sar.robot\n@@ -1,33 +1,25 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         sr06\n ${lab-file-name}    06-srsim-sar.clab.yml\n ${runtime}          docker\n-${key-name}         clab-test-key\n ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n ${gnmic_flags}      --username admin --password NokiaSros1! --values-only\n \n \n *** Test Cases ***\n-Set key-path Variable\n-    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}\n-    Set Suite Variable    ${key-path}\n-\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-sar3\n     ...    username=admin\n@@ -45,10 +37,5 @@ Check Config Mode on sar1\n Check Config Mode on sar2\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --insecure --address clab-${lab-name}-sar2 get --path /state/system/management-interface/configuration-oper-mode\n     Log    ${output}\n     Should Contain    ${output}    model-driven\n-\n-*** Keywords ***\n-Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n-    Run    rm -f ${key-path}*\ndiff --git a/tests/13-srsim/07-srsim-with-mgmt-network.robot b/tests/13-srsim/07-srsim-with-mgmt-network.robot\nindex 5025036..ce0951f 100644\n--- a/tests/13-srsim/07-srsim-with-mgmt-network.robot\n+++ b/tests/13-srsim/07-srsim-with-mgmt-network.robot\n@@ -1,31 +1,23 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         sr07\n ${lab-file-name}    07-srsim-mix.clab.yml\n ${runtime}          docker\n-${key-name}         clab-test-key\n \n \n *** Test Cases ***\n-Set key-path Variable\n-    ${key-path} =    OperatingSystem.Normalize Path    ~/.ssh/${key-name}\n-    Set Suite Variable    ${key-path}\n-\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure sros is reachable over ssh\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-srsim10\n     ...    username=admin\n@@ -57,15 +49,10 @@ Do a gNMI GET using TLS\n     Log    ${output}\n     Should Be Equal As Integers    ${rc}    0\n     Should Contain    ${output}    srsim10-a\n \n *** Keywords ***\n-Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n-    Run    rm -f ${key-path}*\n-\n-\n Do a gNOI ping to other node\n     Skip If    '${runtime}' != 'docker'\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    sudo docker run --network host --rm --mount type=bind,source=${CURDIR}/clab-${lab-name}/.tls/ca,target=/tls ghcr.io/karimra/gnoic:0.2.0 system ping --username admin --password 'NokiaSros1!' --tls-ca /tls/ca.pem --address clab-${lab-name}-srsim10 --destination 100.0.0.11 --ns Base --count 3\n     Log    ${output}\ndiff --git a/tests/13-srsim/08-srsim-comp-cfg-test.robot b/tests/13-srsim/08-srsim-comp-cfg-test.robot\nindex d276341..c531df4 100644\n--- a/tests/13-srsim/08-srsim-comp-cfg-test.robot\n+++ b/tests/13-srsim/08-srsim-comp-cfg-test.robot\n@@ -1,11 +1,12 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         comp-cfg-gen-test\n ${lab-file-name}    08-srsim-comp-cfg-test.clab.yml\n@@ -14,15 +15,11 @@ ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n ${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n \n \n *** Test Cases ***\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Wait for 45s\n     Sleep    45s    Let everything fully provision & come up\n \n Check SR-1 card configuration\n@@ -121,13 +118,10 @@ Check SR-2s-ncofg has unprovisioned card\n     Log    ${output}\n     Should Be Equal As Integers    ${rc}    0\n     Should Contain    ${output}    unprovisioned\n \n *** Keywords ***\n-Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n-\n Check SR-2S MDA state\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr2s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/hardware-data/oper-state\n     Log    ${output}\n     Should Be Equal As Integers    ${rc}    0\ndiff --git a/tests/13-srsim/09-srsim-pause-container.robot b/tests/13-srsim/09-srsim-pause-container.robot\nindex 0f96bd7..90f57c3 100644\n--- a/tests/13-srsim/09-srsim-pause-container.robot\n+++ b/tests/13-srsim/09-srsim-pause-container.robot\n@@ -1,12 +1,13 @@\n *** Settings ***\n Library             OperatingSystem\n Library             Process\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         srsim-pause-ctr\n ${lab-file-name}    09-srsim-pause-container.clab.yml\n@@ -15,15 +16,11 @@ ${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n ${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n \n \n *** Test Cases ***\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Wait for 45s\n     Sleep    45s    Let everything fully provision & come up\n \n # IPv4\n@@ -165,11 +162,5 @@ Check CPM SSH\n         Should Contain    ${output}    TiMOS\n         Should Match Regexp    ${output}    ${slot}:admin@[^\\\\r\\\\n]+#\n     FINALLY\n         SSHLibrary.Close All Connections\n     END\n-\n-Cleanup\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\ndiff --git a/tests/13-srsim/10-srsim-lifecycle.robot b/tests/13-srsim/10-srsim-lifecycle.robot\nindex c9085d9..0b24da2 100644\n--- a/tests/13-srsim/10-srsim-lifecycle.robot\n+++ b/tests/13-srsim/10-srsim-lifecycle.robot\n@@ -1,25 +1,22 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         lifecycle-test-srsim\n ${lab-file-name}    10-srsim-lifecycle.clab.yml\n ${runtime}          docker\n \n \n *** Test Cases ***\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure client can ping integrated SR OS node\n     Sleep    20s    give time for SR OS nodes to boot\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\\=client --cmd \"ping -c2 -W2 10.0.1.2\"\n@@ -85,10 +82,5 @@ Verify ping to distributed SR OS recovers after start\n     ${rc}    ${output} =    Run And Return Rc And Output\n     ...    ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\\=client --cmd \"ping -c2 -W2 10.0.2.2\"\n     Log    ${output}\n     Should Be Equal As Integers    ${rc}    0\n     Should Match Regexp    ${output}    2 packets transmitted, 2 (packets )?received, 0% packet loss\n-\n-\n-*** Keywords ***\n-Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\ndiff --git a/tests/13-srsim/12-srsim-veth-stitch.robot b/tests/13-srsim/12-srsim-veth-stitch.robot\nindex fac9fe1..9f70b9f 100644\n--- a/tests/13-srsim/12-srsim-veth-stitch.robot\n+++ b/tests/13-srsim/12-srsim-veth-stitch.robot\n@@ -1,11 +1,12 @@\n *** Settings ***\n Library             OperatingSystem\n Resource            ../ssh.robot\n Resource            ../common.robot\n+Resource            ../srsim.robot\n \n-Suite Teardown      Run Keyword    Cleanup\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n \n *** Variables ***\n ${lab-name}         veth-stitch\n ${lab-file-name}    12-srsim-veth-stitch.clab.yml\n@@ -14,15 +15,11 @@ ${sros-password}    NokiaSros1!\n ${peer-ip}          10.0.0.2\n \n \n *** Test Cases ***\n Deploy ${lab-name} lab\n-    Log    ${CURDIR}\n-    ${rc}    ${output} =    Run And Return Rc And Output\n-    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}\n-    Log    ${output}\n-    Should Be Equal As Integers    ${rc}    0\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n \n Ensure distributed sros can ping sros2 over the veth-stitch link\n     Wait Until Keyword Succeeds    3 minutes    10 seconds    Ping succeeds    sros    ${peer-ip}\n \n Verify inspect interfaces returns the host-side stitch interfaces\n@@ -87,13 +84,10 @@ Verify the stitch interfaces are removed on destroy\n     Log    ${output}\n     Should Not Contain    ${output}    clab-s-\n \n \n *** Keywords ***\n-Cleanup\n-    Run    ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup\n-\n Ping over SSH\n     [Arguments]    ${node}    ${dst}\n     Login via SSH with username and password\n     ...    address=clab-${lab-name}-${node}\n     ...    username=admin\ndiff --git a/tests/13-srsim/13-srsim-integrated.clab.yml b/tests/13-srsim/13-srsim-integrated.clab.yml\nnew file mode 100644\nindex 0000000..a3f2ca3\n--- /dev/null\n+++ b/tests/13-srsim/13-srsim-integrated.clab.yml\n@@ -0,0 +1,33 @@\n+# yaml-language-server: $schema=../../schemas/clab.schema.json\n+name: srsim-integrated\n+\n+topology:\n+  kinds:\n+    nokia_srsim:\n+      license: /opt/nokia/sros/license.txt\n+      image: registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\n+\n+  nodes:\n+    ixr-e2n:\n+      kind: nokia_srsim\n+      type: ixr-e2n\n+      components:\n+        - type: cpm-ixr-e2n/imm4-sfp+4-sfp+\n+\n+    ixr-r6:\n+      kind: nokia_srsim\n+      type: ixr-r6\n+      components:\n+        - slot: A\n+        - slot: B\n+\n+    sr-1s:\n+      kind: nokia_srsim\n+      type: sr-1s\n+      components:\n+        - xiom:\n+            - slot: 1\n+              type: iom-s-3.0t\n+              mda:\n+                - slot: 1\n+                  type: ms18-100gb-qsfp28\ndiff --git a/tests/13-srsim/13-srsim-integrated.robot b/tests/13-srsim/13-srsim-integrated.robot\nnew file mode 100644\nindex 0000000..8f6b929\n--- /dev/null\n+++ b/tests/13-srsim/13-srsim-integrated.robot\n@@ -0,0 +1,105 @@\n+*** Settings ***\n+Library             OperatingSystem\n+Resource            ../ssh.robot\n+Resource            ../common.robot\n+Resource            ../srsim.robot\n+\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n+\n+\n+*** Variables ***\n+${lab-name}         srsim-integrated\n+${lab-file-name}    13-srsim-integrated.clab.yml\n+${runtime}          docker\n+${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n+${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n+\n+\n+*** Test Cases ***\n+Deploy ${lab-name} lab\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n+\n+Wait for 45s\n+    Sleep    45s    Let everything fully provision & come up\n+\n+Check IXR-E2N card override is passed to the container\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} inspect clab-${lab-name}-ixr-e2n --format '{{range .Config.Env}}{{println .}}{{end}}'\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    NOKIA_SROS_CARD=cpm-ixr-e2n/imm4-sfp+4-sfp+\n+\n+Check IXR-E2N equipped card matches the component\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-e2n --path /state/card[slot-number=1]/equipped-type\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    imm4-sfp+4-sfp+\n+\n+Check IXR-R6 standby CPM slot is set\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} inspect clab-${lab-name}-ixr-r6-b --format '{{range .Config.Env}}{{println .}}{{end}}'\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    NOKIA_SROS_SLOT=B\n+\n+Check IXR-R6 card configuration\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /configure/card[slot-number=1]/card-type\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    iom-ixr-r6\n+\n+Check IXR-R6 MDA configuration\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /configure/card[slot-number=1]/mda[mda-slot=1]/mda-type\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    m6-10g-sfp++1-100g-qsfp28\n+\n+Ensure IXR-R6 CPM A is up\n+    Wait Until Keyword Succeeds    2 minutes    10 seconds    Check IXR-R6 CPM state    A\n+\n+Ensure IXR-R6 CPM B is up\n+    Wait Until Keyword Succeeds    3 minutes    10 seconds    Check IXR-R6 CPM state    B\n+\n+\n+Check SR-1s equipped card\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/equipped-type\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    xcm-1s\n+\n+Check SR-1s equipped XIOM\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/equipped-type\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    iom-s-3.0t\n+\n+Check SR-1s equipped XIOM MDA\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/equipped-type\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    ms18-100gb-qsfp28\n+\n+Ensure SR-1s XIOM MDA is up\n+    Wait Until Keyword Succeeds    2 minutes    10 seconds    Check SR-1s XIOM MDA state\n+\n+*** Keywords ***\n+Check IXR-R6 CPM state\n+    [Arguments]    ${slot}\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-ixr-r6 --path /state/cpm[cpm-slot=${slot}]/hardware-data/oper-state\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    in-service\n+\n+Check SR-1s XIOM MDA state\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags} --address clab-${lab-name}-sr-1s --path /state/card[slot-number=1]/xiom[xiom-slot=x1]/mda[mda-slot=1]/hardware-data/oper-state\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    in-service\ndiff --git a/tests/13-srsim/14-srsim-new-chassis.clab.yml b/tests/13-srsim/14-srsim-new-chassis.clab.yml\nnew file mode 100644\nindex 0000000..f5f3bc2\n--- /dev/null\n+++ b/tests/13-srsim/14-srsim-new-chassis.clab.yml\n@@ -0,0 +1,53 @@\n+# yaml-language-server: $schema=../../schemas/clab.schema.json\n+name: srsim-new-chassis\n+\n+topology:\n+  kinds:\n+    nokia_srsim:\n+      license: /opt/nokia/sros/license.txt\n+      image: registry.srlinux.dev/pub/nokia_srsim:${SRSIM_IMAGE_TAG}\n+\n+  nodes:\n+    ixr-e2sc:\n+      kind: nokia_srsim\n+      type: ixr-e2sc\n+\n+    ixr-e3:\n+      kind: nokia_srsim\n+      type: ixr-e3\n+\n+    sar-10x:\n+      kind: nokia_srsim\n+      type: sar-10x\n+      components:\n+        - slot: A\n+          type: cpiom-sar-x\n+          mda: &mdas\n+            - slot: 1\n+              type: m2-1g-sfp+2-10g-sfp+\n+            - slot: 2\n+              type: m8-t1e1-rj48\n+            - slot: 3\n+              type: m2-1g-sfp+2-10g-sfp+\n+            - slot: 4\n+              type: m4-rs232-rj45+4-c3794-sfp\n+            - slot: 5\n+              type: m8-t1e1-rj48\n+            - slot: 6\n+              type: m4-rs232-rj45+4-c3794-sfp\n+            - slot: 7\n+              type: m8-t1e1-rj48\n+            - slot: 8\n+              type: m4-rs232-rj45+4-c3794-sfp\n+        - slot: B\n+          type: cpiom-sar-x\n+          mda: *mdas\n+      startup-config: |\n+        /configure card 1 mda 1 mda-type m2-1g-sfp+2-10g-sfp+ admin-state enable\n+        /configure card 1 mda 2 mda-type m8-t1e1-rj48 admin-state enable\n+        /configure card 1 mda 3 mda-type m2-1g-sfp+2-10g-sfp+ admin-state enable\n+        /configure card 1 mda 4 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable\n+        /configure card 1 mda 5 mda-type m8-t1e1-rj48 admin-state enable\n+        /configure card 1 mda 6 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable\n+        /configure card 1 mda 7 mda-type m8-t1e1-rj48 admin-state enable\n+        /configure card 1 mda 8 mda-type m4-rs232-rj45+4-c3794-sfp admin-state enable\ndiff --git a/tests/13-srsim/14-srsim-new-chassis.robot b/tests/13-srsim/14-srsim-new-chassis.robot\nnew file mode 100644\nindex 0000000..0f1b08a\n--- /dev/null\n+++ b/tests/13-srsim/14-srsim-new-chassis.robot\n@@ -0,0 +1,83 @@\n+*** Settings ***\n+Library             OperatingSystem\n+Library             String\n+Resource            ../common.robot\n+Resource            ../srsim.robot\n+\n+Suite Setup         Skip If    '${26_10_TESTS}'.lower() != 'true'\n+...                 SR-SIM 26.10 is required; enable with --variable 26_10_TESTS:true\n+Suite Teardown      Destroy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n+\n+\n+*** Variables ***\n+${lab-name}         srsim-new-chassis\n+${lab-file-name}    14-srsim-new-chassis.clab.yml\n+${runtime}          docker\n+${26_10_TESTS}      false\n+${gnmic_image}      ghcr.io/openconfig/gnmic:0.42.1\n+${gnmic_flags}      --username admin --password NokiaSros1! --values-only --insecure\n+\n+\n+*** Test Cases ***\n+Deploy ${lab-name} lab\n+    Deploy SR-SIM Lab    ${CURDIR}/${lab-file-name}    ${runtime}\n+\n+Check ixr-e2sc chassis\n+    Check chassis    ixr-e2sc    ixr-e2sc\n+\n+Check ixr-e3 chassis\n+    Check chassis    ixr-e3    ixr-e3\n+\n+Check sar-10x chassis\n+    Check chassis    sar-10x-a    sar-10x\n+    Check chassis    sar-10x-b    sar-10x\n+\n+Ensure new chassis containers stay running\n+    Sleep    30s    Let the simulators get past initial startup\n+    Check container is running    ixr-e2sc\n+    Check container is running    ixr-e3\n+    Check container is running    sar-10x-a\n+    Check container is running    sar-10x-b\n+\n+Check sar-10x line cards are up\n+    Wait Until Keyword Succeeds    3 minutes    15 seconds    SAR-10x line cards are up\n+\n+*** Keywords ***\n+SAR-10x line cards are up\n+    # Query card 1, MDAs 1/1..1/8, then card 2 in chassis order.\n+    ${command} =    Catenate    SEPARATOR=${SPACE}\n+    ...    sudo ${runtime} run --network host --rm ${gnmic_image} get ${gnmic_flags}\n+    ...    --address clab-${lab-name}-sar-10x\n+    ...    --path /state/card[slot-number=1]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=1]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=2]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=3]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=4]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=5]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=6]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=7]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=1]/mda[mda-slot=8]/hardware-data/oper-state\n+    ...    --path /state/card[slot-number=2]/hardware-data/oper-state\n+    ${rc}    ${output} =    Run And Return Rc And Output    ${command}\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    ${up_states} =    Get Regexp Matches    ${output}    in-service\n+    Length Should Be    ${up_states}    10\n+    Should Not Contain    ${output}    null\n+\n+Check chassis\n+    [Arguments]    ${node}    ${chassis}\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} inspect clab-${lab-name}-${node} --format '{{range .Config.Env}}{{println .}}{{end}}'\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    Should Contain    ${output}    NOKIA_SROS_CHASSIS=${chassis}\n+\n+Check container is running\n+    [Arguments]    ${node}\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    sudo ${runtime} inspect clab-${lab-name}-${node} --format '{{.State.Running}}'\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+    ${state} =    Strip String    ${output}\n+    Should Be Equal    ${state}    true\ndiff --git a/tests/srsim.robot b/tests/srsim.robot\nnew file mode 100644\nindex 0000000..6d7c7fc\n--- /dev/null\n+++ b/tests/srsim.robot\n@@ -0,0 +1,20 @@\n+*** Settings ***\n+Library     OperatingSystem\n+Resource    common.robot\n+\n+\n+*** Keywords ***\n+Deploy SR-SIM Lab\n+    [Arguments]    ${topology}    ${runtime}\n+    Log    ${topology}\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${topology}\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+\n+Destroy SR-SIM Lab\n+    [Arguments]    ${topology}    ${runtime}\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    ${CLAB_BIN} --runtime ${runtime} destroy -t ${topology} --cleanup\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\ndiff --git a/utils/sros_schema_gen.sh b/utils/sros_schema_gen.sh\nindex 868c9d9..c2cef5b 100755\n--- a/utils/sros_schema_gen.sh\n+++ b/utils/sros_schema_gen.sh\n@@ -4,15 +4,18 @@\n \n CHASSIS_INFO_FILE=chassis_info.json\n SCHEMA=../schemas/clab.schema.json\n \n jq --indent 4 -s '\n-  .[0] as $c | .[1] |\n+  .[0] as $all |\n+  .[1] |\n+  ([.. | objects | select(.enum? and (.enum | index(\"ixr-e2n\"))) | .enum][0]) as $node_types |\n+  ($all | with_entries(select((.key | ascii_downcase) as $key | $node_types | index($key)))) as $c |\n   ($c | [.[].cpm // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cpms |\n   ($c | [.[].iom // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cards |\n   ($c | [.[].sfm // [] | .[]]) as $sfms |\n-  ($c | [.[].mda // [] | .[] | select(. != null)]) as $mdas |\n+  ($c | [.[].mda // [] | .[] | select(. != null)] + [.[].fixed_mdas // {} | .[]]) as $mdas |",
        "lineStart": 2548,
        "lineEnd": 3940,
        "totalLines": 3941,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346648155,
      "end": 1792346648169
    }
  }
}
read · completed

Input

{
  "filePath": "/source/manifest.json"
}

Output

<path>/source/manifest.json</path>
<type>file</type>
<content>
1: {
2:   "version": 1,
3:   "head": "d44c69f72ab156474197f12b6fc1407b3f8a65c4",
4:   "base": "84cf630e6eedd662d9742fbcd6158a91372e3a56",
5:   "mergeBase": "84cf630e6eedd662d9742fbcd6158a91372e3a56",
6:   "changed": [
7:     {
8:       "status": "M",
9:       "path": ".github/workflows/srsim-tests.yml"
10:     },
11:     {
12:       "status": "M",
13:       "path": "docs/manual/kinds/sros.md"
14:     },
15:     {
16:       "status": "M",
17:       "path": "nodes/sros/README.md"
18:     },
19:     {
20:       "status": "M",
21:       "path": "nodes/sros/chassis_info.go"
22:     },
23:     {
24:       "status": "A",
25:       "path": "nodes/sros/chassis_info_test.go"
26:     },
27:     {
28:       "status": "M",
29:       "path": "nodes/sros/component.go"
30:     },
31:     {
32:       "status": "M",
33:       "path": "nodes/sros/component_config.go"
34:     },
35:     {
36:       "status": "M",
37:       "path": "nodes/sros/config.go"
38:     },
39:     {
40:       "status": "M",
41:       "path": "nodes/sros/netns.go"
42:     },
43:     {
44:       "status": "M",
45:       "path": "nodes/sros/power.go"
46:     },
47:     {
48:       "status": "M",
49:       "path": "nodes/sros/sros.go"
50:     },
51:     {
52:       "status": "M",
53:       "path": "nodes/sros/sros_test.go"
54:     },
55:     {
56:       "status": "M",
57:       "path": "nodes/sros/template.go"
58:     },
59:     {
60:       "status": "M",
61:       "path": "nodes/sros/variant.go"
62:     },
63:     {
64:       "status": "M",
65:       "path": "schemas/clab.schema.json"
66:     },
67:     {
68:       "status": "M",
69:       "path": "tests/13-srsim/01-sros-to-linux.robot"
70:     },
71:     {
72:       "status": "M",
73:       "path": "tests/13-srsim/03-sros-dist-to-linux.robot"
74:     },
75:     {
76:       "status": "M",
77:       "path": "tests/13-srsim/04-sros-classic.robot"
78:     },
79:     {
80:       "status": "M",
81:       "path": "tests/13-srsim/05-sros-comp-to-linux.robot"
82:     },
83:     {
84:       "status": "M",
85:       "path": "tests/13-srsim/06-srsim-sar.robot"
86:     },
87:     {
88:       "status": "M",
89:       "path": "tests/13-srsim/07-srsim-with-mgmt-network.robot"
90:     },
91:     {
92:       "status": "M",
93:       "path": "tests/13-srsim/08-srsim-comp-cfg-test.robot"
94:     },
95:     {
96:       "status": "M",
97:       "path": "tests/13-srsim/09-srsim-pause-container.robot"
98:     },
99:     {
100:       "status": "M",
101:       "path": "tests/13-srsim/10-srsim-lifecycle.robot"
102:     },
103:     {
104:       "status": "M",
105:       "path": "tests/13-srsim/12-srsim-veth-stitch.robot"
106:     },
107:     {
108:       "status": "A",
109:       "path": "tests/13-srsim/13-srsim-integrated.clab.yml"
110:     },
111:     {
112:       "status": "A",
113:       "path": "tests/13-srsim/13-srsim-integrated.robot"
114:     },
115:     {
116:       "status": "A",
117:       "path": "tests/13-srsim/14-srsim-new-chassis.clab.yml"
118:     },
119:     {
120:       "status": "A",
121:       "path": "tests/13-srsim/14-srsim-new-chassis.robot"
122:     },
123:     {
124:       "status": "A",
125:       "path": "tests/srsim.robot"
126:     },
127:     {
128:       "status": "M",
129:       "path": "utils/sros_schema_gen.sh"
130:     }
131:   ],
132:   "files": [
133:     {
134:       "revision": "head",
135:       "path": ".github/workflows/srsim-tests.yml",
136:       "bytes": 4465,
137:       "lines": 141
138:     },
139:     {
140:       "revision": "head",
141:       "path": "docs/manual/kinds/sros.md",
142:       "bytes": 36892,
143:       "lines": 906
144:     },
145:     {
146:       "revision": "head",
147:       "path": "nodes/sros/chassis_info_test.go",
148:       "bytes": 2578,
149:       "lines": 99
150:     },
151:     {
152:       "revision": "head",
153:       "path": "nodes/sros/chassis_info.go",
154:       "bytes": 5820,
155:       "lines": 222
156:     },
157:     {
158:       "revision": "head",
159:       "path": "nodes/sros/component_config.go",
160:       "bytes": 10029,
161:       "lines": 393
162:     },
163:     {
164:       "revision": "head",
165:       "path": "nodes/sros/component.go",
166:       "bytes": 7301,
167:       "lines": 309
168:     },
169:     {
170:       "revision": "head",
171:       "path": "nodes/sros/config.go",
172:       "bytes": 10055,
173:       "lines": 345
174:     },
175:     {
176:       "revision": "head",
177:       "path": "nodes/sros/netns.go",
178:       "bytes": 5099,
179:       "lines": 157
180:     },
181:     {
182:       "revision": "head",
183:       "path": "nodes/sros/power.go",
184:       "bytes": 1613,
185:       "lines": 95
186:     },
187:     {
188:       "revision": "head",
189:       "path": "nodes/sros/README.md",
190:       "bytes": 45346,
191:       "lines": 1582
192:     },
193:     {
194:       "revision": "head",
195:       "path": "nodes/sros/sros_test.go",
196:       "bytes": 42251,
197:       "lines": 1351
198:     },
199:     {
200:       "revision": "head",
201:       "path": "nodes/sros/sros.go",
202:       "bytes": 57207,
203:       "lines": 1910
204:     },
205:     {
206:       "revision": "head",
207:       "path": "nodes/sros/template.go",
208:       "bytes": 2661,
209:       "lines": 99
210:     },
211:     {
212:       "revision": "head",
213:       "path": "nodes/sros/variant.go",
214:       "bytes": 4674,
215:       "lines": 170
216:     },
217:     {
218:       "revision": "head",
219:       "path": "schemas/clab.schema.json",
220:       "bytes": 167017,
221:       "lines": 3969
222:     },
223:     {
224:       "revision": "head",
225:       "path": "tests/13-srsim/01-sros-to-linux.robot",
226:       "bytes": 4315,
227:       "lines": 105
228:     },
229:     {
230:       "revision": "head",
231:       "path": "tests/13-srsim/03-sros-dist-to-linux.robot",
232:       "bytes": 1876,
233:       "lines": 47
234:     },
235:     {
236:       "revision": "head",
237:       "path": "tests/13-srsim/04-sros-classic.robot",
238:       "bytes": 2147,
239:       "lines": 61
240:     },
241:     {
242:       "revision": "head",
243:       "path": "tests/13-srsim/05-sros-comp-to-linux.robot",
244:       "bytes": 6761,
245:       "lines": 139
246:     },
247:     {
248:       "revision": "head",
249:       "path": "tests/13-srsim/06-srsim-sar.robot",
250:       "bytes": 1499,
251:       "lines": 41
252:     },
253:     {
254:       "revision": "head",
255:       "path": "tests/13-srsim/07-srsim-with-mgmt-network.robot",
256:       "bytes": 2497,
257:       "lines": 60
258:     },
259:     {
260:       "revision": "head",
261:       "path": "tests/13-srsim/08-srsim-comp-cfg-test.robot",
262:       "bytes": 7029,
263:       "lines": 135
264:     },
265:     {
266:       "revision": "head",
267:       "path": "tests/13-srsim/09-srsim-pause-container.robot",
268:       "bytes": 7632,
269:       "lines": 166
270:     },
271:     {
272:       "revision": "head",
273:       "path": "tests/13-srsim/10-srsim-lifecycle.robot",
274:       "bytes": 4003,
275:       "lines": 86
276:     },
277:     {
278:       "revision": "head",
279:       "path": "tests/13-srsim/12-srsim-veth-stitch.robot",
280:       "bytes": 4048,
281:       "lines": 106
282:     },
283:     {
284:       "revision": "head",
285:       "path": "tests/13-srsim/13-srsim-integrated.clab.yml",
286:       "bytes": 702,
287:       "lines": 33
288:     },
289:     {
290:       "revision": "head",
291:       "path": "tests/13-srsim/13-srsim-integrated.robot",
292:       "bytes": 4891,
293:       "lines": 105
294:     },
295:     {
296:       "revision": "head",
297:       "path": "tests/13-srsim/14-srsim-new-chassis.clab.yml",
298:       "bytes": 1729,
299:       "lines": 53
300:     },
301:     {
302:       "revision": "head",
303:       "path": "tests/13-srsim/14-srsim-new-chassis.robot",
304:       "bytes": 3552,
305:       "lines": 83
306:     },
307:     {
308:       "revision": "head",
309:       "path": "tests/srsim.robot",
310:       "bytes": 631,
311:       "lines": 20
312:     },
313:     {
314:       "revision": "head",
315:       "path": "utils/sros_schema_gen.sh",
316:       "bytes": 1178,
317:       "lines": 26
318:     },
319:     {
320:       "revision": "head",
321:       "path": "docs/cmd/completion.md",
322:       "bytes": 2336,
323:       "lines": 95
324:     },
325:     {
326:       "revision": "head",
327:       "path": "docs/cmd/deploy.md",
328:       "bytes": 31381,
329:       "lines": 565
330:     },
331:     {
332:       "revision": "head",
333:       "path": "docs/cmd/destroy.md",
334:       "bytes": 3397,
335:       "lines": 98
336:     },
337:     {
338:       "revision": "head",
339:       "path": "docs/cmd/events.md",
340:       "bytes": 5990,
341:       "lines": 89
342:     },
343:     {
344:       "revision": "head",
345:       "path": "docs/cmd/exec.md",
346:       "bytes": 7316,
347:       "lines": 177
348:     },
349:     {
350:       "revision": "head",
351:       "path": "docs/cmd/generate.md",
352:       "bytes": 6005,
353:       "lines": 138
354:     },
355:     {
356:       "revision": "head",
357:       "path": "docs/cmd/graph.md",
358:       "bytes": 7858,
359:       "lines": 188
360:     },
361:     {
362:       "revision": "head",
363:       "path": "docs/cmd/inspect/index.md",
364:       "bytes": 10896,
365:       "lines": 179
366:     },
367:     {
368:       "revision": "head",
369:       "path": "docs/cmd/inspect/interfaces.md",
370:       "bytes": 11201,
371:       "lines": 197
372:     },
373:     {
374:       "revision": "head",
375:       "path": "docs/cmd/redeploy.md",
376:       "bytes": 6085,
377:       "lines": 150
378:     },
379:     {
380:       "revision": "head",
381:       "path": "docs/cmd/restart.md",
382:       "bytes": 1432,
383:       "lines": 64
384:     },
385:     {
386:       "revision": "head",
387:       "path": "docs/cmd/save.md",
388:       "bytes": 6445,
389:       "lines": 133
390:     },
391:     {
392:       "revision": "head",
393:       "path": "docs/cmd/start.md",
394:       "bytes": 2251,
395:       "lines": 76
396:     },
397:     {
398:       "revision": "head",
399:       "path": "docs/cmd/stop.md",
400:       "bytes": 1313,
401:       "lines": 62
402:     },
403:     {
404:       "revision": "head",
405:       "path": "docs/cmd/tools/api-server/start.md",
406:       "bytes": 5581,
407:       "lines": 165
408:     },
409:     {
410:       "revision": "head",
411:       "path": "docs/cmd/tools/api-server/status.md",
412:       "bytes": 4223,
413:       "lines": 105
414:     },
415:     {
416:       "revision": "head",
417:       "path": "docs/cmd/tools/api-server/stop.md",
418:       "bytes": 1836,
419:       "lines": 56
420:     },
421:     {
422:       "revision": "head",
423:       "path": "docs/cmd/tools/cert/ca/create.md",
424:       "bytes": 2206,
425:       "lines": 77
426:     },
427:     {
428:       "revision": "head",
429:       "path": "docs/cmd/tools/cert/sign.md",
430:       "bytes": 2428,
431:       "lines": 79
432:     },
433:     {
434:       "revision": "head",
435:       "path": "docs/cmd/tools/disable-tx-offload.md",
436:       "bytes": 982,
437:       "lines": 25
438:     },
439:     {
440:       "revision": "head",
441:       "path": "docs/cmd/tools/gotty/attach.md",
442:       "bytes": 1904,
443:       "lines": 67
444:     },
445:     {
446:       "revision": "head",
447:       "path": "docs/cmd/tools/gotty/detach.md",
448:       "bytes": 627,
449:       "lines": 29
450:     },
451:     {
452:       "revision": "head",
453:       "path": "docs/cmd/tools/gotty/list.md",
454:       "bytes": 1070,
455:       "lines": 46
456:     },
457:     {
458:       "revision": "head",
459:       "path": "docs/cmd/tools/gotty/reattach.md",
460:       "bytes": 955,
461:       "lines": 26
462:     },
463:     {
464:       "revision": "head",
465:       "path": "docs/cmd/tools/netem/reset.md",
466:       "bytes": 1635,
467:       "lines": 63
468:     },
469:     {
470:       "revision": "head",
471:       "path": "docs/cmd/tools/netem/set.md",
472:       "bytes": 3979,
473:       "lines": 114
474:     },
475:     {
476:       "revision": "head",
477:       "path": "docs/cmd/tools/netem/show.md",
478:       "bytes": 3651,
479:       "lines": 150
480:     },
481:     {
482:       "revision": "head",
483:       "path": "docs/cmd/tools/snapshot/save.md",
484:       "bytes": 1647,
485:       "lines": 75
486:     },
487:     {
488:       "revision": "head",
489:       "path": "docs/cmd/tools/sshx/attach.md",
490:       "bytes": 5194,
491:       "lines": 128
492:     },
493:     {
494:       "revision": "head",
495:       "path": "docs/cmd/tools/sshx/detach.md",
496:       "bytes": 1837,
497:       "lines": 46
498:     },
499:     {
500:       "revision": "head",
501:       "path": "docs/cmd/tools/sshx/list.md",
502:       "bytes": 3662,
503:       "lines": 77
504:     },
505:     {
506:       "revision": "head",
507:       "path": "docs/cmd/tools/sshx/reattach.md",
508:       "bytes": 4593,
509:       "lines": 101
510:     },
511:     {
512:       "revision": "head",
513:       "path": "docs/cmd/tools/veth/create.md",
514:       "bytes": 1890,
515:       "lines": 51
516:     },
517:     {
518:       "revision": "head",
519:       "path": "docs/cmd/tools/vxlan/create.md",
520:       "bytes": 3355,
521:       "lines": 73
522:     },
523:     {
524:       "revision": "head",
525:       "path": "docs/cmd/tools/vxlan/delete.md",
526:       "bytes": 1230,
527:       "lines": 31
528:     },
529:     {
530:       "revision": "head",
531:       "path": "docs/cmd/validate.md",
532:       "bytes": 1785,
533:       "lines": 51
534:     },
535:     {
536:       "revision": "head",
537:       "path": "docs/cmd/version/check.md",
538:       "bytes": 537,
539:       "lines": 21
540:     },
541:     {
542:       "revision": "head",
543:       "path": "docs/cmd/version/index.md",
544:       "bytes": 1011,
545:       "lines": 37
546:     },
547:     {
548:       "revision": "head",
549:       "path": "docs/CNAME",
550:       "bytes": 16,
551:       "lines": 1
552:     },
553:     {
554:       "revision": "head",
555:       "path": "docs/community.md",
556:       "bytes": 26611,
557:       "lines": 360
558:     },
559:     {
560:       "revision": "head",
561:       "path": "docs/htmltest-pr.yml",
562:       "bytes": 678,
563:       "lines": 14
564:     },
565:     {
566:       "revision": "head",
567:       "path": "docs/htmltest-w-github.yml",
568:       "bytes": 1679,
569:       "lines": 31
570:     },
571:     {
572:       "revision": "head",
573:       "path": "docs/htmltest.yml",
574:       "bytes": 2429,
575:       "lines": 49
576:     },
577:     {
578:       "revision": "head",
579:       "path": "docs/images/clabnew.svg",
580:       "bytes": 16299,
581:       "lines": 13
582:     },
583:     {
584:       "revision": "head",
585:       "path": "docs/images/coloured_wordmark.svg",
586:       "bytes": 8031,
587:       "lines": 91
588:     },
589:     {
590:       "revision": "head",
591:       "path": "docs/images/containerlab_dark_no_text.svg",
592:       "bytes": 3589,
593:       "lines": 8
594:     },
595:     {
596:       "revision": "head",
597:       "path": "docs/images/containerlab_export.svg",
598:       "bytes": 8893,
599:       "lines": 33
600:     },
601:     {
602:       "revision": "head",
603:       "path": "docs/images/containerlab_full_white_no_text.svg",
604:       "bytes": 3801,
605:       "lines": 8
606:     },
607:     {
608:       "revision": "head",
609:       "path": "docs/images/containerlab_white_no_text.svg",
610:       "bytes": 3293,
611:       "lines": 8
612:     },
613:     {
614:       "revision": "head",
615:       "path": "docs/images/containerlab-animated-wordmark.svg",
616:       "bytes": 70018,
617:       "lines": 52
618:     },
619:     {
620:       "revision": "head",
621:       "path": "docs/images/favicon.svg",
622:       "bytes": 16378,
623:       "lines": 20
624:     },
625:     {
626:       "revision": "head",
627:       "path": "docs/images/flask.svg",
628:       "bytes": 378,
629:       "lines": 1
630:     },
631:     {
632:       "revision": "head",
633:       "path": "docs/images/gui/browser-sandbox-placeholder.svg",
634:       "bytes": 2220,
635:       "lines": 25
636:     },
637:     {
638:       "revision": "head",
639:       "path": "docs/images/topoviewer-icons/client.svg",
640:       "bytes": 633,
641:       "lines": 1
642:     },
643:     {
644:       "revision": "head",
645:       "path": "docs/images/topoviewer-icons/controller.svg",
646:       "bytes": 768,
647:       "lines": 1
648:     },
649:     {
650:       "revision": "head",
651:       "path": "docs/images/topoviewer-icons/dcgw.svg",
652:       "bytes": 1015,
653:       "lines": 1
654:     },
655:     {
656:       "revision": "head",
657:       "path": "docs/images/topoviewer-icons/pon.svg",
658:       "bytes": 553,
659:       "lines": 1
660:     },
661:     {
662:       "revision": "head",
663:       "path": "docs/images/topoviewer-icons/rgw.svg",
664:       "bytes": 983,
665:       "lines": 1
666:     },
667:     {
668:       "revision": "head",
669:       "path": "docs/images/topoviewer-icons/router.svg",
670:       "bytes": 864,
671:       "lines": 1
672:     },
673:     {
674:       "revision": "head",
675:       "path": "docs/images/topoviewer-icons/server.svg",
676:       "bytes": 744,
677:       "lines": 1
678:     },
679:     {
680:       "revision": "head",
681:       "path": "docs/images/topoviewer-icons/spine.svg",
682:       "bytes": 940,
683:       "lines": 1
684:     },
685:     {
686:       "revision": "head",
687:       "path": "docs/images/topoviewer-icons/switch.svg",
688:       "bytes": 803,
689:       "lines": 1
690:     },
691:     {
692:       "revision": "head",
693:       "path": "docs/index.md",
694:       "bytes": 6778,
695:       "lines": 189
696:     },
697:     {
698:       "revision": "head",
699:       "path": "docs/install.md",
700:       "bytes": 17575,
701:       "lines": 505
702:     },
703:     {
704:       "revision": "head",
705:       "path": "docs/javascripts/instant-reinit.js",
706:       "bytes": 2040,
707:       "lines": 45
708:     },
709:     {
710:       "revision": "head",
711:       "path": "docs/lab-examples/asav01.md",
712:       "bytes": 4137,
713:       "lines": 90
714:     },
715:     {
716:       "revision": "head",
717:       "path": "docs/lab-examples/bgp-vpls-nok-jun.md",
718:       "bytes": 3374,
719:       "lines": 34
720:     },
721:     {
722:       "revision": "head",
723:       "path": "docs/lab-examples/cisco_iol.md",
724:       "bytes": 4368,
725:       "lines": 100
726:     },
727:     {
728:       "revision": "head",
729:       "path": "docs/lab-examples/cvx01.md",
730:       "bytes": 2989,
731:       "lines": 48
732:     },
733:     {
734:       "revision": "head",
735:       "path": "docs/lab-examples/cvx02.md",
736:       "bytes": 2990,
737:       "lines": 49
738:     },
739:     {
740:       "revision": "head",
741:       "path": "docs/lab-examples/ext-bridge.md",
742:       "bytes": 2042,
743:       "lines": 31
744:     },
745:     {
746:       "revision": "head",
747:       "path": "docs/lab-examples/f5bigipve01.md",
748:       "bytes": 4956,
749:       "lines": 118
750:     },
751:     {
752:       "revision": "head",
753:       "path": "docs/lab-examples/freebsd01.md",
754:       "bytes": 3571,
755:       "lines": 76
756:     },
757:     {
758:       "revision": "head",
759:       "path": "docs/lab-examples/frr01.md",
760:       "bytes": 2987,
761:       "lines": 64
762:     },
763:     {
764:       "revision": "head",
765:       "path": "docs/lab-examples/ftdv01.md",
766:       "bytes": 4108,
767:       "lines": 75
768:     },
769:     {
770:       "revision": "head",
771:       "path": "docs/lab-examples/generic_vm01.md",
772:       "bytes": 3201,
773:       "lines": 66
774:     },
775:     {
776:       "revision": "head",
777:       "path": "docs/lab-examples/ixiacone-srl.md",
778:       "bytes": 6827,
779:       "lines": 135
780:     },
781:     {
782:       "revision": "head",
783:       "path": "docs/lab-examples/lab-examples.md",
784:       "bytes": 4334,
785:       "lines": 80
786:     },
787:     {
788:       "revision": "head",
789:       "path": "docs/lab-examples/min-5clos.md",
790:       "bytes": 9340,
791:       "lines": 127
792:     },
793:     {
794:       "revision": "head",
795:       "path": "docs/lab-examples/min-clos.md",
796:       "bytes": 1970,
797:       "lines": 26
798:     },
799:     {
800:       "revision": "head",
801:       "path": "docs/lab-examples/multinode.md",
802:       "bytes": 14610,
803:       "lines": 264
804:     },
805:     {
806:       "revision": "head",
807:       "path": "docs/lab-examples/openbsd01.md",
808:       "bytes": 3615,
809:       "lines": 76
810:     },
811:     {
812:       "revision": "head",
813:       "path": "docs/lab-examples/ost-srl.md",
814:       "bytes": 6005,
815:       "lines": 114
816:     },
817:     {
818:       "revision": "head",
819:       "path": "docs/lab-examples/osvbng01.md",
820:       "bytes": 3109,
821:       "lines": 71
822:     },
823:     {
824:       "revision": "head",
825:       "path": "docs/lab-examples/peering-lab.md",
826:       "bytes": 23285,
827:       "lines": 391
828:     },
829:     {
830:       "revision": "head",
831:       "path": "docs/lab-examples/rare-freertr.md",
832:       "bytes": 1848,
833:       "lines": 31
834:     },
835:     {
836:       "revision": "head",
837:       "path": "docs/lab-examples/single-srl.md",
838:       "bytes": 2261,
839:       "lines": 32
840:     },
841:     {
842:       "revision": "head",
843:       "path": "docs/lab-examples/sr-sim.md",
844:       "bytes": 3766,
845:       "lines": 64
846:     },
847:     {
848:       "revision": "head",
849:       "path": "docs/lab-examples/srl-arcos.md",
850:       "bytes": 2871,
851:       "lines": 52
852:     },
853:     {
854:       "revision": "head",
855:       "path": "docs/lab-examples/srl-ceos.md",
856:       "bytes": 8462,
857:       "lines": 211
858:     },
859:     {
860:       "revision": "head",
861:       "path": "docs/lab-examples/srl-cjunosevolved.md",
862:       "bytes": 2674,
863:       "lines": 43
864:     },
865:     {
866:       "revision": "head",
867:       "path": "docs/lab-examples/srl-crpd.md",
868:       "bytes": 9443,
869:       "lines": 181
870:     },
871:     {
872:       "revision": "head",
873:       "path": "docs/lab-examples/srl-frr.md",
874:       "bytes": 3163,
875:       "lines": 33
876:     },
877:     {
878:       "revision": "head",
879:       "path": "docs/lab-examples/srl-sonic.md",
880:       "bytes": 9521,
881:       "lines": 193
882:     },
883:     {
884:       "revision": "head",
885:       "path": "docs/lab-examples/srl-vjunos-switch.md",
886:       "bytes": 1886,
887:       "lines": 24
888:     },
889:     {
890:       "revision": "head",
891:       "path": "docs/lab-examples/srl-vjunosevolved.md",
892:       "bytes": 1891,
893:       "lines": 24
894:     },
895:     {
896:       "revision": "head",
897:       "path": "docs/lab-examples/srl-xrd.md",
898:       "bytes": 2877,
899:       "lines": 49
900:     },
901:     {
902:       "revision": "head",
903:       "path": "docs/lab-examples/templated01.md",
904:       "bytes": 2516,
905:       "lines": 56
906:     },
907:     {
908:       "revision": "head",
909:       "path": "docs/lab-examples/templated02.md",
910:       "bytes": 2792,
911:       "lines": 68
912:     },
913:     {
914:       "revision": "head",
915:       "path": "docs/lab-examples/two-srls.md",
916:       "bytes": 3098,
917:       "lines": 47
918:     },
919:     {
920:       "revision": "head",
921:       "path": "docs/lab-examples/vr-sros.md",
922:       "bytes": 2506,
923:       "lines": 28
924:     },
925:     {
926:       "revision": "head",
927:       "path": "docs/lab-examples/vr-vmx.md",
928:       "bytes": 2523,
929:       "lines": 30
930:     },
931:     {
932:       "revision": "head",
933:       "path": "docs/lab-examples/vr-xrv.md",
934:       "bytes": 2419,
935:       "lines": 27
936:     },
937:     {
938:       "revision": "head",
939:       "path": "docs/lab-examples/vr-xrv9k.md",
940:       "bytes": 2441,
941:       "lines": 27
942:     },
943:     {
944:       "revision": "head",
945:       "path": "docs/lab-examples/vsrx01.md",
946:       "bytes": 4497,
947:       "lines": 90
948:     },
949:     {
950:       "revision": "head",
951:       "path": "docs/lab-examples/wan.md",
952:       "bytes": 1820,
953:       "lines": 24
954:     },
955:     {
956:       "revision": "head",
957:       "path": "docs/macos.md",
958:       "bytes": 17237,
959:       "lines": 251
960:     },
961:     {
962:       "revision": "head",
963:       "path": "docs/manual/api-server.md",
964:       "bytes": 7871,
965:       "lines": 223
966:     },
967:     {
968:       "revision": "head",
969:       "path": "docs/manual/cert.md",
970:       "bytes": 3472,
971:       "lines": 59
972:     },
973:     {
974:       "revision": "head",
975:       "path": "docs/manual/clabernetes/index.md",
976:       "bytes": 990,
977:       "lines": 18
978:     },
979:     {
980:       "revision": "head",
981:       "path": "docs/manual/clabernetes/runtime.md",
982:       "bytes": 34317,
983:       "lines": 888
984:     },
985:     {
986:       "revision": "head",
987:       "path": "docs/manual/codespaces.md",
988:       "bytes": 20644,
989:       "lines": 318
990:     },
991:     {
992:       "revision": "head",
993:       "path": "docs/manual/conf-artifacts.md",
994:       "bytes": 3196,
995:       "lines": 54
996:     },
997:     {
998:       "revision": "head",
999:       "path": "docs/manual/config-mgmt.md",
1000:       "bytes": 12920,
1001:       "lines": 311
1002:     },
1003:     {
1004:       "revision": "head",
1005:       "path": "docs/manual/dev/debug.md",
1006:       "bytes": 5255,
1007:       "lines": 133
1008:     },
1009:     {
1010:       "revision": "head",
1011:       "path": "docs/manual/dev/doc.md",
1012:       "bytes": 4366,
1013:       "lines": 55
1014:     },
1015:     {
1016:       "revision": "head",
1017:       "path": "docs/manual/dev/index.md",
1018:       "bytes": 1170,
1019:       "lines": 21
1020:     },
1021:     {
1022:       "revision": "head",
1023:       "path": "docs/manual/dev/test.md",
1024:       "bytes": 4069,
1025:       "lines": 100
1026:     },
1027:     {
1028:       "revision": "head",
1029:       "path": "docs/manual/gui/desktop.md",
1030:       "bytes": 5381,
1031:       "lines": 130
1032:     },
1033:     {
1034:       "revision": "head",
1035:       "path": "docs/manual/gui/index.md",
1036:       "bytes": 16398,
1037:       "lines": 314
1038:     },
1039:     {
1040:       "revision": "head",
1041:       "path": "docs/manual/gui/vsc-extension.md",
1042:       "bytes": 9060,
1043:       "lines": 202
1044:     },
1045:     {
1046:       "revision": "head",
1047:       "path": "docs/manual/gui/web.md",
1048:       "bytes": 6617,
1049:       "lines": 178
1050:     },
1051:     {
1052:       "revision": "head",
1053:       "path": "docs/manual/images.md",
1054:       "bytes": 5119,
1055:       "lines": 108
1056:     },
1057:     {
1058:       "revision": "head",
1059:       "path": "docs/manual/impairments.md",
1060:       "bytes": 881,
1061:       "lines": 20
1062:     },
1063:     {
1064:       "revision": "head",
1065:       "path": "docs/manual/inventory.md",
1066:       "bytes": 11726,
1067:       "lines": 398
1068:     },
1069:     {
1070:       "revision": "head",
1071:       "path": "docs/manual/kinds/6wind_vsr.md",
1072:       "bytes": 9464,
1073:       "lines": 208
1074:     },
1075:     {
1076:       "revision": "head",
1077:       "path": "docs/manual/kinds/arrcus_arcos.md",
1078:       "bytes": 4185,
1079:       "lines": 134
1080:     },
1081:     {
1082:       "revision": "head",
1083:       "path": "docs/manual/kinds/bridge.md",
1084:       "bytes": 5527,
1085:       "lines": 123
1086:     },
1087:     {
1088:       "revision": "head",
1089:       "path": "docs/manual/kinds/c8000.md",
1090:       "bytes": 5477,
1091:       "lines": 151
1092:     },
1093:     {
1094:       "revision": "head",
1095:       "path": "docs/manual/kinds/ceos.md",
1096:       "bytes": 22395,
1097:       "lines": 548
1098:     },
1099:     {
1100:       "revision": "head",
1101:       "path": "docs/manual/kinds/checkpoint_cloudguard.md",
1102:       "bytes": 2694,
1103:       "lines": 60
1104:     },
1105:     {
1106:       "revision": "head",
1107:       "path": "docs/manual/kinds/ciena_saos.md",
1108:       "bytes": 8268,
1109:       "lines": 244
1110:     },
1111:     {
1112:       "revision": "head",
1113:       "path": "docs/manual/kinds/cisco_asav.md",
1114:       "bytes": 4142,
1115:       "lines": 95
1116:     },
1117:     {
1118:       "revision": "head",
1119:       "path": "docs/manual/kinds/cisco_iol.md",
1120:       "bytes": 11889,
1121:       "lines": 269
1122:     },
1123:     {
1124:       "revision": "head",
1125:       "path": "docs/manual/kinds/cisco_sdwan.md",
1126:       "bytes": 6415,
1127:       "lines": 280
1128:     },
1129:     {
1130:       "revision": "head",
1131:       "path": "docs/manual/kinds/cisco_vios.md",
1132:       "bytes": 3734,
1133:       "lines": 95
1134:     },
1135:     {
1136:       "revision": "head",
1137:       "path": "docs/manual/kinds/cisco_xrd_vrouter.md",
1138:       "bytes": 5916,
1139:       "lines": 139
1140:     },
1141:     {
1142:       "revision": "head",
1143:       "path": "docs/manual/kinds/cjunosevolved.md",
1144:       "bytes": 7017,
1145:       "lines": 150
1146:     },
1147:     {
1148:       "revision": "head",
1149:       "path": "docs/manual/kinds/crpd.md",
1150:       "bytes": 8048,
1151:       "lines": 191
1152:     },
1153:     {
1154:       "revision": "head",
1155:       "path": "docs/manual/kinds/csrx.md",
1156:       "bytes": 6460,
1157:       "lines": 176
1158:     },
1159:     {
1160:       "revision": "head",
1161:       "path": "docs/manual/kinds/dell_sonic.md",
1162:       "bytes": 3154,
1163:       "lines": 95
1164:     },
1165:     {
1166:       "revision": "head",
1167:       "path": "docs/manual/kinds/ext-container.md",
1168:       "bytes": 2729,
1169:       "lines": 64
1170:     },
1171:     {
1172:       "revision": "head",
1173:       "path": "docs/manual/kinds/f5_bigipve.md",
1174:       "bytes": 8997,
1175:       "lines": 220
1176:     },
1177:     {
1178:       "revision": "head",
1179:       "path": "docs/manual/kinds/fdio_vpp.md",
1180:       "bytes": 10759,
1181:       "lines": 225
1182:     },
1183:     {
1184:       "revision": "head",
1185:       "path": "docs/manual/kinds/fortinet_fortigate.md",
1186:       "bytes": 3737,
1187:       "lines": 81
1188:     },
1189:     {
1190:       "revision": "head",
1191:       "path": "docs/manual/kinds/freebsd.md",
1192:       "bytes": 4052,
1193:       "lines": 95
1194:     },
1195:     {
1196:       "revision": "head",
1197:       "path": "docs/manual/kinds/frr.md",
1198:       "bytes": 7504,
1199:       "lines": 151
1200:     },
1201:     {
1202:       "revision": "head",
1203:       "path": "docs/manual/kinds/generic_vm.md",
1204:       "bytes": 3133,
1205:       "lines": 87
1206:     },
1207:     {
1208:       "revision": "head",
1209:       "path": "docs/manual/kinds/host.md",
1210:       "bytes": 1105,
1211:       "lines": 24
1212:     },
1213:     {
1214:       "revision": "head",
1215:       "path": "docs/manual/kinds/huawei_vrp.md",
1216:       "bytes": 4188,
1217:       "lines": 88
1218:     },
1219:     {
1220:       "revision": "head",
1221:       "path": "docs/manual/kinds/index.md",
1222:       "bytes": 8558,
1223:       "lines": 104
1224:     },
1225:     {
1226:       "revision": "head",
1227:       "path": "docs/manual/kinds/ipinfusion-ocnos.md",
1228:       "bytes": 2248,
1229:       "lines": 54
1230:     },
1231:     {
1232:       "revision": "head",
1233:       "path": "docs/manual/kinds/k8s-kind.md",
1234:       "bytes": 6322,
1235:       "lines": 141
1236:     },
1237:     {
1238:       "revision": "head",
1239:       "path": "docs/manual/kinds/keysight_ixia-c-one.md",
1240:       "bytes": 3228,
1241:       "lines": 68
1242:     },
1243:     {
1244:       "revision": "head",
1245:       "path": "docs/manual/kinds/linux.md",
1246:       "bytes": 2960,
1247:       "lines": 55
1248:     },
1249:     {
1250:       "revision": "head",
1251:       "path": "docs/manual/kinds/nvidia_cumulusvx.md",
1252:       "bytes": 4019,
1253:       "lines": 106
1254:     },
1255:     {
1256:       "revision": "head",
1257:       "path": "docs/manual/kinds/openbsd.md",
1258:       "bytes": 4034,
1259:       "lines": 95
1260:     },
1261:     {
1262:       "revision": "head",
1263:       "path": "docs/manual/kinds/openwrt.md",
1264:       "bytes": 1725,
1265:       "lines": 37
1266:     },
1267:     {
1268:       "revision": "head",
1269:       "path": "docs/manual/kinds/ostinato.md",
1270:       "bytes": 3594,
1271:       "lines": 95
1272:     },
1273:     {
1274:       "revision": "head",
1275:       "path": "docs/manual/kinds/ovs-bridge.md",
1276:       "bytes": 1997,
1277:       "lines": 53
1278:     },
1279:     {
1280:       "revision": "head",
1281:       "path": "docs/manual/kinds/plvision_sonic.md",
1282:       "bytes": 3542,
1283:       "lines": 84
1284:     },
1285:     {
1286:       "revision": "head",
1287:       "path": "docs/manual/kinds/rare-freertr.md",
1288:       "bytes": 6044,
1289:       "lines": 170
1290:     },
1291:     {
1292:       "revision": "head",
1293:       "path": "docs/manual/kinds/sonic-vm.md",
1294:       "bytes": 5902,
1295:       "lines": 145
1296:     },
1297:     {
1298:       "revision": "head",
1299:       "path": "docs/manual/kinds/sonic-vs.md",
1300:       "bytes": 3737,
1301:       "lines": 78
1302:     },
1303:     {
1304:       "revision": "head",
1305:       "path": "docs/manual/kinds/spirent_stc.md",
1306:       "bytes": 3762,
1307:       "lines": 116
1308:     },
1309:     {
1310:       "revision": "head",
1311:       "path": "docs/manual/kinds/srl.md",
1312:       "bytes": 25640,
1313:       "lines": 577
1314:     },
1315:     {
1316:       "revision": "head",
1317:       "path": "docs/manual/kinds/veesix_osvbng.md",
1318:       "bytes": 3889,
1319:       "lines": 124
1320:     },
1321:     {
1322:       "revision": "head",
1323:       "path": "docs/manual/kinds/vr-aoscx.md",
1324:       "bytes": 3329,
1325:       "lines": 73
1326:     },
1327:     {
1328:       "revision": "head",
1329:       "path": "docs/manual/kinds/vr-c8000v.md",
1330:       "bytes": 6882,
1331:       "lines": 188
1332:     },
1333:     {
1334:       "revision": "head",
1335:       "path": "docs/manual/kinds/vr-cat9kv.md",
1336:       "bytes": 6835,
1337:       "lines": 170
1338:     },
1339:     {
1340:       "revision": "head",
1341:       "path": "docs/manual/kinds/vr-csr.md",
1342:       "bytes": 4119,
1343:       "lines": 86
1344:     },
1345:     {
1346:       "revision": "head",
1347:       "path": "docs/manual/kinds/vr-ftdv.md",
1348:       "bytes": 3343,
1349:       "lines": 79
1350:     },
1351:     {
1352:       "revision": "head",
1353:       "path": "docs/manual/kinds/vr-ftosv.md",
1354:       "bytes": 3557,
1355:       "lines": 79
1356:     },
1357:     {
1358:       "revision": "head",
1359:       "path": "docs/manual/kinds/vr-n9kv.md",
1360:       "bytes": 4790,
1361:       "lines": 123
1362:     },
1363:     {
1364:       "revision": "head",
1365:       "path": "docs/manual/kinds/vr-pan.md",
1366:       "bytes": 3372,
1367:       "lines": 86
1368:     },
1369:     {
1370:       "revision": "head",
1371:       "path": "docs/manual/kinds/vr-ros.md",
1372:       "bytes": 3912,
1373:       "lines": 83
1374:     },
1375:     {
1376:       "revision": "head",
1377:       "path": "docs/manual/kinds/vr-sros.md",
1378:       "bytes": 22067,
1379:       "lines": 505
1380:     },
1381:     {
1382:       "revision": "head",
1383:       "path": "docs/manual/kinds/vr-veos.md",
1384:       "bytes": 4126,
1385:       "lines": 94
1386:     },
1387:     {
1388:       "revision": "head",
1389:       "path": "docs/manual/kinds/vr-vjunosevolved.md",
1390:       "bytes": 5141,
1391:       "lines": 107
1392:     },
1393:     {
1394:       "revision": "head",
1395:       "path": "docs/manual/kinds/vr-vjunosrouter.md",
1396:       "bytes": 5140,
1397:       "lines": 103
1398:     },
1399:     {
1400:       "revision": "head",
1401:       "path": "docs/manual/kinds/vr-vjunosswitch.md",
1402:       "bytes": 5110,
1403:       "lines": 108
1404:     },
1405:     {
1406:       "revision": "head",
1407:       "path": "docs/manual/kinds/vr-vmx.md",
1408:       "bytes": 5371,
1409:       "lines": 121
1410:     },
1411:     {
1412:       "revision": "head",
1413:       "path": "docs/manual/kinds/vr-vqfx.md",
1414:       "bytes": 4053,
1415:       "lines": 90
1416:     },
1417:     {
1418:       "revision": "head",
1419:       "path": "docs/manual/kinds/vr-vsrx.md",
1420:       "bytes": 4053,
1421:       "lines": 89
1422:     },
1423:     {
1424:       "revision": "head",
1425:       "path": "docs/manual/kinds/vr-xrv.md",
1426:       "bytes": 4029,
1427:       "lines": 100
1428:     },
1429:     {
1430:       "revision": "head",
1431:       "path": "docs/manual/kinds/vr-xrv9k.md",
1432:       "bytes": 5157,
1433:       "lines": 120
1434:     },
1435:     {
1436:       "revision": "head",
1437:       "path": "docs/manual/kinds/vyosnetworks_vyos.md",
1438:       "bytes": 6643,
1439:       "lines": 187
1440:     },
1441:     {
1442:       "revision": "head",
1443:       "path": "docs/manual/kinds/xrd.md",
1444:       "bytes": 7951,
1445:       "lines": 177
1446:     },
1447:     {
1448:       "revision": "head",
1449:       "path": "docs/manual/multi-node.md",
1450:       "bytes": 6089,
1451:       "lines": 72
1452:     },
1453:     {
1454:       "revision": "head",
1455:       "path": "docs/manual/network.md",
1456:       "bytes": 40210,
1457:       "lines": 835
1458:     },
1459:     {
1460:       "revision": "head",
1461:       "path": "docs/manual/node-filtering.md",
1462:       "bytes": 3517,
1463:       "lines": 66
1464:     },
1465:     {
1466:       "revision": "head",
1467:       "path": "docs/manual/nodes.md",
1468:       "bytes": 44445,
1469:       "lines": 1205
1470:     },
1471:     {
1472:       "revision": "head",
1473:       "path": "docs/manual/s3-usage-example.md",
1474:       "bytes": 1446,
1475:       "lines": 61
1476:     },
1477:     {
1478:       "revision": "head",
1479:       "path": "docs/manual/share-access.md",
1480:       "bytes": 8219,
1481:       "lines": 150
1482:     },
1483:     {
1484:       "revision": "head",
1485:       "path": "docs/manual/topo-def-file.md",
1486:       "bytes": 37253,
1487:       "lines": 903
1488:     },
1489:     {
1490:       "revision": "head",
1491:       "path": "docs/manual/vrnetlab.md",
1492:       "bytes": 30525,
1493:       "lines": 270
1494:     },
1495:     {
1496:       "revision": "head",
1497:       "path": "docs/manual/wireshark.md",
1498:       "bytes": 16256,
1499:       "lines": 326
1500:     },
1501:     {
1502:       "revision": "head",
1503:       "path": "docs/quickstart.md",
1504:       "bytes": 10387,
1505:       "lines": 207
1506:     },
1507:     {
1508:       "revision": "head",
1509:       "path": "docs/rn/0.11.0.md",
1510:       "bytes": 5330,
1511:       "lines": 71
1512:     },
1513:     {
1514:       "revision": "head",
1515:       "path": "docs/rn/0.12.0.md",
1516:       "bytes": 4928,
1517:       "lines": 75
1518:     },
1519:     {
1520:       "revision": "head",
1521:       "path": "docs/rn/0.13.0.md",
1522:       "bytes": 1772,
1523:       "lines": 30
1524:     },
1525:     {
1526:       "revision": "head",
1527:       "path": "docs/rn/0.14.0.md",
1528:       "bytes": 2612,
1529:       "lines": 35
1530:     },
1531:     {
1532:       "revision": "head",
1533:       "path": "docs/rn/0.14.1.md",
1534:       "bytes": 177,
1535:       "lines": 5
1536:     },
1537:     {
1538:       "revision": "head",
1539:       "path": "docs/rn/0.14.2.md",
1540:       "bytes": 301,
1541:       "lines": 5
1542:     },
1543:     {
1544:       "revision": "head",
1545:       "path": "docs/rn/0.14.3.md",
1546:       "bytes": 317,
1547:       "lines": 9
1548:     },
1549:     {
1550:       "revision": "head",
1551:       "path": "docs/rn/0.14.4.md",
1552:       "bytes": 286,
1553:       "lines": 9
1554:     },
1555:     {
1556:       "revision": "head",
1557:       "path": "docs/rn/0.15.md",
1558:       "bytes": 3827,
1559:       "lines": 69
1560:     },
1561:     {
1562:       "revision": "head",
1563:       "path": "docs/rn/0.16.md",
1564:       "bytes": 3480,
1565:       "lines": 65
1566:     },
1567:     {
1568:       "revision": "head",
1569:       "path": "docs/rn/0.17.md",
1570:       "bytes": 3356,
1571:       "lines": 41
1572:     },
1573:     {
1574:       "revision": "head",
1575:       "path": "docs/rn/0.18.md",
1576:       "bytes": 1527,
1577:       "lines": 34
1578:     },
1579:     {
1580:       "revision": "head",
1581:       "path": "docs/rn/0.19.md",
1582:       "bytes": 2470,
1583:       "lines": 48
1584:     },
1585:     {
1586:       "revision": "head",
1587:       "path": "docs/rn/0.20.md",
1588:       "bytes": 2146,
1589:       "lines": 33
1590:     },
1591:     {
1592:       "revision": "head",
1593:       "path": "docs/rn/0.21.md",
1594:       "bytes": 2459,
1595:       "lines": 48
1596:     },
1597:     {
1598:       "revision": "head",
1599:       "path": "docs/rn/0.22.md",
1600:       "bytes": 1806,
1601:       "lines": 27
1602:     },
1603:     {
1604:       "revision": "head",
1605:       "path": "docs/rn/0.23.md",
1606:       "bytes": 1835,
1607:       "lines": 35
1608:     },
1609:     {
1610:       "revision": "head",
1611:       "path": "docs/rn/0.24.md",
1612:       "bytes": 3490,
1613:       "lines": 51
1614:     },
1615:     {
1616:       "revision": "head",
1617:       "path": "docs/rn/0.25.md",
1618:       "bytes": 2105,
1619:       "lines": 37
1620:     },
1621:     {
1622:       "revision": "head",
1623:       "path": "docs/rn/0.26.md",
1624:       "bytes": 5078,
1625:       "lines": 88
1626:     },
1627:     {
1628:       "revision": "head",
1629:       "path": "docs/rn/0.27.md",
1630:       "bytes": 947,
1631:       "lines": 21
1632:     },
1633:     {
1634:       "revision": "head",
1635:       "path": "docs/rn/0.28.md",
1636:       "bytes": 1382,
1637:       "lines": 32
1638:     },
1639:     {
1640:       "revision": "head",
1641:       "path": "docs/rn/0.29.md",
1642:       "bytes": 750,
1643:       "lines": 13
1644:     },
1645:     {
1646:       "revision": "head",
1647:       "path": "docs/rn/0.30.md",
1648:       "bytes": 566,
1649:       "lines": 14
1650:     },
1651:     {
1652:       "revision": "head",
1653:       "path": "docs/rn/0.31.md",
1654:       "bytes": 1710,
1655:       "lines": 30
1656:     },
1657:     {
1658:       "revision": "head",
1659:       "path": "docs/rn/0.32.md",
1660:       "bytes": 2075,
1661:       "lines": 45
1662:     },
1663:     {
1664:       "revision": "head",
1665:       "path": "docs/rn/0.33.md",
1666:       "bytes": 893,
1667:       "lines": 22
1668:     },
1669:     {
1670:       "revision": "head",
1671:       "path": "docs/rn/0.34.md",
1672:       "bytes": 1019,
1673:       "lines": 23
1674:     },
1675:     {
1676:       "revision": "head",
1677:       "path": "docs/rn/0.35.md",
1678:       "bytes": 876,
1679:       "lines": 29
1680:     },
1681:     {
1682:       "revision": "head",
1683:       "path": "docs/rn/0.36.md",
1684:       "bytes": 868,
1685:       "lines": 23
1686:     },
1687:     {
1688:       "revision": "head",
1689:       "path": "docs/rn/0.37.md",
1690:       "bytes": 1990,
1691:       "lines": 38
1692:     },
1693:     {
1694:       "revision": "head",
1695:       "path": "docs/rn/0.38.md",
1696:       "bytes": 881,
1697:       "lines": 18
1698:     },
1699:     {
1700:       "revision": "head",
1701:       "path": "docs/rn/0.39.md",
1702:       "bytes": 3693,
1703:       "lines": 101
1704:     },
1705:     {
1706:       "revision": "head",
1707:       "path": "docs/rn/0.40.md",
1708:       "bytes": 732,
1709:       "lines": 15
1710:     },
1711:     {
1712:       "revision": "head",
1713:       "path": "docs/rn/0.41.md",
1714:       "bytes": 4520,
1715:       "lines": 88
1716:     },
1717:     {
1718:       "revision": "head",
1719:       "path": "docs/rn/0.42.md",
1720:       "bytes": 955,
1721:       "lines": 15
1722:     },
1723:     {
1724:       "revision": "head",
1725:       "path": "docs/rn/0.43.md",
1726:       "bytes": 3478,
1727:       "lines": 90
1728:     },
1729:     {
1730:       "revision": "head",
1731:       "path": "docs/rn/0.44.md",
1732:       "bytes": 2213,
1733:       "lines": 54
1734:     },
1735:     {
1736:       "revision": "head",
1737:       "path": "docs/rn/0.45.md",
1738:       "bytes": 1807,
1739:       "lines": 32
1740:     },
1741:     {
1742:       "revision": "head",
1743:       "path": "docs/rn/0.46.md",
1744:       "bytes": 3260,
1745:       "lines": 98
1746:     },
1747:     {
1748:       "revision": "head",
1749:       "path": "docs/rn/0.47.md",
1750:       "bytes": 2333,
1751:       "lines": 46
1752:     },
1753:     {
1754:       "revision": "head",
1755:       "path": "docs/rn/0.48.md",
1756:       "bytes": 4072,
1757:       "lines": 75
1758:     },
1759:     {
1760:       "revision": "head",
1761:       "path": "docs/rn/0.49.md",
1762:       "bytes": 1541,
1763:       "lines": 30
1764:     },
1765:     {
1766:       "revision": "head",
1767:       "path": "docs/rn/0.50.md",
1768:       "bytes": 3606,
1769:       "lines": 54
1770:     },
1771:     {
1772:       "revision": "head",
1773:       "path": "docs/rn/0.51.md",
1774:       "bytes": 2871,
1775:       "lines": 68
1776:     },
1777:     {
1778:       "revision": "head",
1779:       "path": "docs/rn/0.52.md",
1780:       "bytes": 3179,
1781:       "lines": 65
1782:     },
1783:     {
1784:       "revision": "head",
1785:       "path": "docs/rn/0.53.md",
1786:       "bytes": 1282,
1787:       "lines": 27
1788:     },
1789:     {
1790:       "revision": "head",
1791:       "path": "docs/rn/0.54.md",
1792:       "bytes": 942,
1793:       "lines": 26
1794:     },
1795:     {
1796:       "revision": "head",
1797:       "path": "docs/rn/0.55.md",
1798:       "bytes": 3026,
1799:       "lines": 77
1800:     },
1801:     {
1802:       "revision": "head",
1803:       "path": "docs/rn/0.56.md",
1804:       "bytes": 2575,
1805:       "lines": 46
1806:     },
1807:     {
1808:       "revision": "head",
1809:       "path": "docs/rn/0.57.md",
1810:       "bytes": 2466,
1811:       "lines": 56
1812:     },
1813:     {
1814:       "revision": "head",
1815:       "path": "docs/rn/0.58.md",
1816:       "bytes": 1868,
1817:       "lines": 30
1818:     },
1819:     {
1820:       "revision": "head",
1821:       "path": "docs/rn/0.59.md",
1822:       "bytes": 1494,
1823:       "lines": 34
1824:     },
1825:     {
1826:       "revision": "head",
1827:       "path": "docs/rn/0.60.md",
1828:       "bytes": 10022,
1829:       "lines": 135
1830:     },
1831:     {
1832:       "revision": "head",
1833:       "path": "docs/rn/0.61.md",
1834:       "bytes": 2588,
1835:       "lines": 45
1836:     },
1837:     {
1838:       "revision": "head",
1839:       "path": "docs/rn/0.62.md",
1840:       "bytes": 2915,
1841:       "lines": 54
1842:     },
1843:     {
1844:       "revision": "head",
1845:       "path": "docs/rn/0.63.md",
1846:       "bytes": 2182,
1847:       "lines": 46
1848:     },
1849:     {
1850:       "revision": "head",
1851:       "path": "docs/rn/0.64.md",
1852:       "bytes": 5000,
1853:       "lines": 45
1854:     },
1855:     {
1856:       "revision": "head",
1857:       "path": "docs/rn/0.65.md",
1858:       "bytes": 1622,
1859:       "lines": 41
1860:     },
1861:     {
1862:       "revision": "head",
1863:       "path": "docs/rn/0.66.md",
1864:       "bytes": 897,
1865:       "lines": 21
1866:     },
1867:     {
1868:       "revision": "head",
1869:       "path": "docs/rn/0.67.md",
1870:       "bytes": 1394,
1871:       "lines": 23
1872:     },
1873:     {
1874:       "revision": "head",
1875:       "path": "docs/rn/0.68.md",
1876:       "bytes": 2604,
1877:       "lines": 40
1878:     },
1879:     {
1880:       "revision": "head",
1881:       "path": "docs/rn/0.69.md",
1882:       "bytes": 5732,
1883:       "lines": 117
1884:     },
1885:     {
1886:       "revision": "head",
1887:       "path": "docs/rn/0.70.md",
1888:       "bytes": 3389,
1889:       "lines": 64
1890:     },
1891:     {
1892:       "revision": "head",
1893:       "path": "docs/rn/0.71.md",
1894:       "bytes": 5144,
1895:       "lines": 120
1896:     },
1897:     {
1898:       "revision": "head",
1899:       "path": "docs/rn/0.72.md",
1900:       "bytes": 3663,
1901:       "lines": 62
1902:     },
1903:     {
1904:       "revision": "head",
1905:       "path": "docs/rn/0.73.md",
1906:       "bytes": 6239,
1907:       "lines": 96
1908:     },
1909:     {
1910:       "revision": "head",
1911:       "path": "docs/rn/0.74.md",
1912:       "bytes": 6031,
1913:       "lines": 94
1914:     },
1915:     {
1916:       "revision": "head",
1917:       "path": "docs/rn/0.75.md",
1918:       "bytes": 5768,
1919:       "lines": 78
1920:     },
1921:     {
1922:       "revision": "head",
1923:       "path": "docs/rn/0.76.md",
1924:       "bytes": 4557,
1925:       "lines": 69
1926:     },
1927:     {
1928:       "revision": "head",
1929:       "path": "docs/rn/0.77.md",
1930:       "bytes": 3761,
1931:       "lines": 71
1932:     },
1933:     {
1934:       "revision": "head",
1935:       "path": "docs/rn/0.78.md",
1936:       "bytes": 5580,
1937:       "lines": 118
1938:     },
1939:     {
1940:       "revision": "head",
1941:       "path": "docs/rn/0.79.md",
1942:       "bytes": 3853,
1943:       "lines": 96
1944:     },
1945:     {
1946:       "revision": "head",
1947:       "path": "docs/rn/0.80.md",
1948:       "bytes": 15226,
1949:       "lines": 280
1950:     },
1951:     {
1952:       "revision": "head",
1953:       "path": "docs/rn/0.81.md",
1954:       "bytes": 5387,
1955:       "lines": 98
1956:     },
1957:     {
1958:       "revision": "head",
1959:       "path": "docs/stylesheets/extra.css",
1960:       "bytes": 19354,
1961:       "lines": 750
1962:     },
1963:     {
1964:       "revision": "head",
1965:       "path": "docs/windows.md",
1966:       "bytes": 10218,
1967:       "lines": 225
1968:     },
1969:     {
1970:       "revision": "head",
1971:       "path": ".cursor/rules/git-mutations.mdc",
1972:       "bytes": 403,
1973:       "lines": 10
1974:     },
1975:     {
1976:       "revision": "head",
1977:       "path": ".cursor/rules/karpathy-guidelines.mdc",
1978:       "bytes": 2643,
1979:       "lines": 75
1980:     },
1981:     {
1982:       "revision": "head",
1983:       "path": ".cursor/rules/ponytail.mdc",
1984:       "bytes": 2620,
1985:       "lines": 36
1986:     },
1987:     {
1988:       "revision": "head",
1989:       "path": ".cursor/rules/release-note-review.mdc",
1990:       "bytes": 472,
1991:       "lines": 12
1992:     },
1993:     {
1994:       "revision": "head",
1995:       "path": ".cursor/skills/refresh-nix-vendor-hash/SKILL.md",
1996:       "bytes": 2916,
1997:       "lines": 89
1998:     },
1999:     {
2000:       "revision": "head",

(Showing lines 1-2000 of 15645. Use offset=2001 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502f6e830015BHQ56v97tbC3p",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502f69070017hU0PHIctAauDc",
  "callID": "call_c2328d3ed47a47eca2767d9d",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/manifest.json"
    },
    "output": "<path>/source/manifest.json</path>\n<type>file</type>\n<content>\n1: {\n2:   \"version\": 1,\n3:   \"head\": \"d44c69f72ab156474197f12b6fc1407b3f8a65c4\",\n4:   \"base\": \"84cf630e6eedd662d9742fbcd6158a91372e3a56\",\n5:   \"mergeBase\": \"84cf630e6eedd662d9742fbcd6158a91372e3a56\",\n6:   \"changed\": [\n7:     {\n8:       \"status\": \"M\",\n9:       \"path\": \".github/workflows/srsim-tests.yml\"\n10:     },\n11:     {\n12:       \"status\": \"M\",\n13:       \"path\": \"docs/manual/kinds/sros.md\"\n14:     },\n15:     {\n16:       \"status\": \"M\",\n17:       \"path\": \"nodes/sros/README.md\"\n18:     },\n19:     {\n20:       \"status\": \"M\",\n21:       \"path\": \"nodes/sros/chassis_info.go\"\n22:     },\n23:     {\n24:       \"status\": \"A\",\n25:       \"path\": \"nodes/sros/chassis_info_test.go\"\n26:     },\n27:     {\n28:       \"status\": \"M\",\n29:       \"path\": \"nodes/sros/component.go\"\n30:     },\n31:     {\n32:       \"status\": \"M\",\n33:       \"path\": \"nodes/sros/component_config.go\"\n34:     },\n35:     {\n36:       \"status\": \"M\",\n37:       \"path\": \"nodes/sros/config.go\"\n38:     },\n39:     {\n40:       \"status\": \"M\",\n41:       \"path\": \"nodes/sros/netns.go\"\n42:     },\n43:     {\n44:       \"status\": \"M\",\n45:       \"path\": \"nodes/sros/power.go\"\n46:     },\n47:     {\n48:       \"status\": \"M\",\n49:       \"path\": \"nodes/sros/sros.go\"\n50:     },\n51:     {\n52:       \"status\": \"M\",\n53:       \"path\": \"nodes/sros/sros_test.go\"\n54:     },\n55:     {\n56:       \"status\": \"M\",\n57:       \"path\": \"nodes/sros/template.go\"\n58:     },\n59:     {\n60:       \"status\": \"M\",\n61:       \"path\": \"nodes/sros/variant.go\"\n62:     },\n63:     {\n64:       \"status\": \"M\",\n65:       \"path\": \"schemas/clab.schema.json\"\n66:     },\n67:     {\n68:       \"status\": \"M\",\n69:       \"path\": \"tests/13-srsim/01-sros-to-linux.robot\"\n70:     },\n71:     {\n72:       \"status\": \"M\",\n73:       \"path\": \"tests/13-srsim/03-sros-dist-to-linux.robot\"\n74:     },\n75:     {\n76:       \"status\": \"M\",\n77:       \"path\": \"tests/13-srsim/04-sros-classic.robot\"\n78:     },\n79:     {\n80:       \"status\": \"M\",\n81:       \"path\": \"tests/13-srsim/05-sros-comp-to-linux.robot\"\n82:     },\n83:     {\n84:       \"status\": \"M\",\n85:       \"path\": \"tests/13-srsim/06-srsim-sar.robot\"\n86:     },\n87:     {\n88:       \"status\": \"M\",\n89:       \"path\": \"tests/13-srsim/07-srsim-with-mgmt-network.robot\"\n90:     },\n91:     {\n92:       \"status\": \"M\",\n93:       \"path\": \"tests/13-srsim/08-srsim-comp-cfg-test.robot\"\n94:     },\n95:     {\n96:       \"status\": \"M\",\n97:       \"path\": \"tests/13-srsim/09-srsim-pause-container.robot\"\n98:     },\n99:     {\n100:       \"status\": \"M\",\n101:       \"path\": \"tests/13-srsim/10-srsim-lifecycle.robot\"\n102:     },\n103:     {\n104:       \"status\": \"M\",\n105:       \"path\": \"tests/13-srsim/12-srsim-veth-stitch.robot\"\n106:     },\n107:     {\n108:       \"status\": \"A\",\n109:       \"path\": \"tests/13-srsim/13-srsim-integrated.clab.yml\"\n110:     },\n111:     {\n112:       \"status\": \"A\",\n113:       \"path\": \"tests/13-srsim/13-srsim-integrated.robot\"\n114:     },\n115:     {\n116:       \"status\": \"A\",\n117:       \"path\": \"tests/13-srsim/14-srsim-new-chassis.clab.yml\"\n118:     },\n119:     {\n120:       \"status\": \"A\",\n121:       \"path\": \"tests/13-srsim/14-srsim-new-chassis.robot\"\n122:     },\n123:     {\n124:       \"status\": \"A\",\n125:       \"path\": \"tests/srsim.robot\"\n126:     },\n127:     {\n128:       \"status\": \"M\",\n129:       \"path\": \"utils/sros_schema_gen.sh\"\n130:     }\n131:   ],\n132:   \"files\": [\n133:     {\n134:       \"revision\": \"head\",\n135:       \"path\": \".github/workflows/srsim-tests.yml\",\n136:       \"bytes\": 4465,\n137:       \"lines\": 141\n138:     },\n139:     {\n140:       \"revision\": \"head\",\n141:       \"path\": \"docs/manual/kinds/sros.md\",\n142:       \"bytes\": 36892,\n143:       \"lines\": 906\n144:     },\n145:     {\n146:       \"revision\": \"head\",\n147:       \"path\": \"nodes/sros/chassis_info_test.go\",\n148:       \"bytes\": 2578,\n149:       \"lines\": 99\n150:     },\n151:     {\n152:       \"revision\": \"head\",\n153:       \"path\": \"nodes/sros/chassis_info.go\",\n154:       \"bytes\": 5820,\n155:       \"lines\": 222\n156:     },\n157:     {\n158:       \"revision\": \"head\",\n159:       \"path\": \"nodes/sros/component_config.go\",\n160:       \"bytes\": 10029,\n161:       \"lines\": 393\n162:     },\n163:     {\n164:       \"revision\": \"head\",\n165:       \"path\": \"nodes/sros/component.go\",\n166:       \"bytes\": 7301,\n167:       \"lines\": 309\n168:     },\n169:     {\n170:       \"revision\": \"head\",\n171:       \"path\": \"nodes/sros/config.go\",\n172:       \"bytes\": 10055,\n173:       \"lines\": 345\n174:     },\n175:     {\n176:       \"revision\": \"head\",\n177:       \"path\": \"nodes/sros/netns.go\",\n178:       \"bytes\": 5099,\n179:       \"lines\": 157\n180:     },\n181:     {\n182:       \"revision\": \"head\",\n183:       \"path\": \"nodes/sros/power.go\",\n184:       \"bytes\": 1613,\n185:       \"lines\": 95\n186:     },\n187:     {\n188:       \"revision\": \"head\",\n189:       \"path\": \"nodes/sros/README.md\",\n190:       \"bytes\": 45346,\n191:       \"lines\": 1582\n192:     },\n193:     {\n194:       \"revision\": \"head\",\n195:       \"path\": \"nodes/sros/sros_test.go\",\n196:       \"bytes\": 42251,\n197:       \"lines\": 1351\n198:     },\n199:     {\n200:       \"revision\": \"head\",\n201:       \"path\": \"nodes/sros/sros.go\",\n202:       \"bytes\": 57207,\n203:       \"lines\": 1910\n204:     },\n205:     {\n206:       \"revision\": \"head\",\n207:       \"path\": \"nodes/sros/template.go\",\n208:       \"bytes\": 2661,\n209:       \"lines\": 99\n210:     },\n211:     {\n212:       \"revision\": \"head\",\n213:       \"path\": \"nodes/sros/variant.go\",\n214:       \"bytes\": 4674,\n215:       \"lines\": 170\n216:     },\n217:     {\n218:       \"revision\": \"head\",\n219:       \"path\": \"schemas/clab.schema.json\",\n220:       \"bytes\": 167017,\n221:       \"lines\": 3969\n222:     },\n223:     {\n224:       \"revision\": \"head\",\n225:       \"path\": \"tests/13-srsim/01-sros-to-linux.robot\",\n226:       \"bytes\": 4315,\n227:       \"lines\": 105\n228:     },\n229:     {\n230:       \"revision\": \"head\",\n231:       \"path\": \"tests/13-srsim/03-sros-dist-to-linux.robot\",\n232:       \"bytes\": 1876,\n233:       \"lines\": 47\n234:     },\n235:     {\n236:       \"revision\": \"head\",\n237:       \"path\": \"tests/13-srsim/04-sros-classic.robot\",\n238:       \"bytes\": 2147,\n239:       \"lines\": 61\n240:     },\n241:     {\n242:       \"revision\": \"head\",\n243:       \"path\": \"tests/13-srsim/05-sros-comp-to-linux.robot\",\n244:       \"bytes\": 6761,\n245:       \"lines\": 139\n246:     },\n247:     {\n248:       \"revision\": \"head\",\n249:       \"path\": \"tests/13-srsim/06-srsim-sar.robot\",\n250:       \"bytes\": 1499,\n251:       \"lines\": 41\n252:     },\n253:     {\n254:       \"revision\": \"head\",\n255:       \"path\": \"tests/13-srsim/07-srsim-with-mgmt-network.robot\",\n256:       \"bytes\": 2497,\n257:       \"lines\": 60\n258:     },\n259:     {\n260:       \"revision\": \"head\",\n261:       \"path\": \"tests/13-srsim/08-srsim-comp-cfg-test.robot\",\n262:       \"bytes\": 7029,\n263:       \"lines\": 135\n264:     },\n265:     {\n266:       \"revision\": \"head\",\n267:       \"path\": \"tests/13-srsim/09-srsim-pause-container.robot\",\n268:       \"bytes\": 7632,\n269:       \"lines\": 166\n270:     },\n271:     {\n272:       \"revision\": \"head\",\n273:       \"path\": \"tests/13-srsim/10-srsim-lifecycle.robot\",\n274:       \"bytes\": 4003,\n275:       \"lines\": 86\n276:     },\n277:     {\n278:       \"revision\": \"head\",\n279:       \"path\": \"tests/13-srsim/12-srsim-veth-stitch.robot\",\n280:       \"bytes\": 4048,\n281:       \"lines\": 106\n282:     },\n283:     {\n284:       \"revision\": \"head\",\n285:       \"path\": \"tests/13-srsim/13-srsim-integrated.clab.yml\",\n286:       \"bytes\": 702,\n287:       \"lines\": 33\n288:     },\n289:     {\n290:       \"revision\": \"head\",\n291:       \"path\": \"tests/13-srsim/13-srsim-integrated.robot\",\n292:       \"bytes\": 4891,\n293:       \"lines\": 105\n294:     },\n295:     {\n296:       \"revision\": \"head\",\n297:       \"path\": \"tests/13-srsim/14-srsim-new-chassis.clab.yml\",\n298:       \"bytes\": 1729,\n299:       \"lines\": 53\n300:     },\n301:     {\n302:       \"revision\": \"head\",\n303:       \"path\": \"tests/13-srsim/14-srsim-new-chassis.robot\",\n304:       \"bytes\": 3552,\n305:       \"lines\": 83\n306:     },\n307:     {\n308:       \"revision\": \"head\",\n309:       \"path\": \"tests/srsim.robot\",\n310:       \"bytes\": 631,\n311:       \"lines\": 20\n312:     },\n313:     {\n314:       \"revision\": \"head\",\n315:       \"path\": \"utils/sros_schema_gen.sh\",\n316:       \"bytes\": 1178,\n317:       \"lines\": 26\n318:     },\n319:     {\n320:       \"revision\": \"head\",\n321:       \"path\": \"docs/cmd/completion.md\",\n322:       \"bytes\": 2336,\n323:       \"lines\": 95\n324:     },\n325:     {\n326:       \"revision\": \"head\",\n327:       \"path\": \"docs/cmd/deploy.md\",\n328:       \"bytes\": 31381,\n329:       \"lines\": 565\n330:     },\n331:     {\n332:       \"revision\": \"head\",\n333:       \"path\": \"docs/cmd/destroy.md\",\n334:       \"bytes\": 3397,\n335:       \"lines\": 98\n336:     },\n337:     {\n338:       \"revision\": \"head\",\n339:       \"path\": \"docs/cmd/events.md\",\n340:       \"bytes\": 5990,\n341:       \"lines\": 89\n342:     },\n343:     {\n344:       \"revision\": \"head\",\n345:       \"path\": \"docs/cmd/exec.md\",\n346:       \"bytes\": 7316,\n347:       \"lines\": 177\n348:     },\n349:     {\n350:       \"revision\": \"head\",\n351:       \"path\": \"docs/cmd/generate.md\",\n352:       \"bytes\": 6005,\n353:       \"lines\": 138\n354:     },\n355:     {\n356:       \"revision\": \"head\",\n357:       \"path\": \"docs/cmd/graph.md\",\n358:       \"bytes\": 7858,\n359:       \"lines\": 188\n360:     },\n361:     {\n362:       \"revision\": \"head\",\n363:       \"path\": \"docs/cmd/inspect/index.md\",\n364:       \"bytes\": 10896,\n365:       \"lines\": 179\n366:     },\n367:     {\n368:       \"revision\": \"head\",\n369:       \"path\": \"docs/cmd/inspect/interfaces.md\",\n370:       \"bytes\": 11201,\n371:       \"lines\": 197\n372:     },\n373:     {\n374:       \"revision\": \"head\",\n375:       \"path\": \"docs/cmd/redeploy.md\",\n376:       \"bytes\": 6085,\n377:       \"lines\": 150\n378:     },\n379:     {\n380:       \"revision\": \"head\",\n381:       \"path\": \"docs/cmd/restart.md\",\n382:       \"bytes\": 1432,\n383:       \"lines\": 64\n384:     },\n385:     {\n386:       \"revision\": \"head\",\n387:       \"path\": \"docs/cmd/save.md\",\n388:       \"bytes\": 6445,\n389:       \"lines\": 133\n390:     },\n391:     {\n392:       \"revision\": \"head\",\n393:       \"path\": \"docs/cmd/start.md\",\n394:       \"bytes\": 2251,\n395:       \"lines\": 76\n396:     },\n397:     {\n398:       \"revision\": \"head\",\n399:       \"path\": \"docs/cmd/stop.md\",\n400:       \"bytes\": 1313,\n401:       \"lines\": 62\n402:     },\n403:     {\n404:       \"revision\": \"head\",\n405:       \"path\": \"docs/cmd/tools/api-server/start.md\",\n406:       \"bytes\": 5581,\n407:       \"lines\": 165\n408:     },\n409:     {\n410:       \"revision\": \"head\",\n411:       \"path\": \"docs/cmd/tools/api-server/status.md\",\n412:       \"bytes\": 4223,\n413:       \"lines\": 105\n414:     },\n415:     {\n416:       \"revision\": \"head\",\n417:       \"path\": \"docs/cmd/tools/api-server/stop.md\",\n418:       \"bytes\": 1836,\n419:       \"lines\": 56\n420:     },\n421:     {\n422:       \"revision\": \"head\",\n423:       \"path\": \"docs/cmd/tools/cert/ca/create.md\",\n424:       \"bytes\": 2206,\n425:       \"lines\": 77\n426:     },\n427:     {\n428:       \"revision\": \"head\",\n429:       \"path\": \"docs/cmd/tools/cert/sign.md\",\n430:       \"bytes\": 2428,\n431:       \"lines\": 79\n432:     },\n433:     {\n434:       \"revision\": \"head\",\n435:       \"path\": \"docs/cmd/tools/disable-tx-offload.md\",\n436:       \"bytes\": 982,\n437:       \"lines\": 25\n438:     },\n439:     {\n440:       \"revision\": \"head\",\n441:       \"path\": \"docs/cmd/tools/gotty/attach.md\",\n442:       \"bytes\": 1904,\n443:       \"lines\": 67\n444:     },\n445:     {\n446:       \"revision\": \"head\",\n447:       \"path\": \"docs/cmd/tools/gotty/detach.md\",\n448:       \"bytes\": 627,\n449:       \"lines\": 29\n450:     },\n451:     {\n452:       \"revision\": \"head\",\n453:       \"path\": \"docs/cmd/tools/gotty/list.md\",\n454:       \"bytes\": 1070,\n455:       \"lines\": 46\n456:     },\n457:     {\n458:       \"revision\": \"head\",\n459:       \"path\": \"docs/cmd/tools/gotty/reattach.md\",\n460:       \"bytes\": 955,\n461:       \"lines\": 26\n462:     },\n463:     {\n464:       \"revision\": \"head\",\n465:       \"path\": \"docs/cmd/tools/netem/reset.md\",\n466:       \"bytes\": 1635,\n467:       \"lines\": 63\n468:     },\n469:     {\n470:       \"revision\": \"head\",\n471:       \"path\": \"docs/cmd/tools/netem/set.md\",\n472:       \"bytes\": 3979,\n473:       \"lines\": 114\n474:     },\n475:     {\n476:       \"revision\": \"head\",\n477:       \"path\": \"docs/cmd/tools/netem/show.md\",\n478:       \"bytes\": 3651,\n479:       \"lines\": 150\n480:     },\n481:     {\n482:       \"revision\": \"head\",\n483:       \"path\": \"docs/cmd/tools/snapshot/save.md\",\n484:       \"bytes\": 1647,\n485:       \"lines\": 75\n486:     },\n487:     {\n488:       \"revision\": \"head\",\n489:       \"path\": \"docs/cmd/tools/sshx/attach.md\",\n490:       \"bytes\": 5194,\n491:       \"lines\": 128\n492:     },\n493:     {\n494:       \"revision\": \"head\",\n495:       \"path\": \"docs/cmd/tools/sshx/detach.md\",\n496:       \"bytes\": 1837,\n497:       \"lines\": 46\n498:     },\n499:     {\n500:       \"revision\": \"head\",\n501:       \"path\": \"docs/cmd/tools/sshx/list.md\",\n502:       \"bytes\": 3662,\n503:       \"lines\": 77\n504:     },\n505:     {\n506:       \"revision\": \"head\",\n507:       \"path\": \"docs/cmd/tools/sshx/reattach.md\",\n508:       \"bytes\": 4593,\n509:       \"lines\": 101\n510:     },\n511:     {\n512:       \"revision\": \"head\",\n513:       \"path\": \"docs/cmd/tools/veth/create.md\",\n514:       \"bytes\": 1890,\n515:       \"lines\": 51\n516:     },\n517:     {\n518:       \"revision\": \"head\",\n519:       \"path\": \"docs/cmd/tools/vxlan/create.md\",\n520:       \"bytes\": 3355,\n521:       \"lines\": 73\n522:     },\n523:     {\n524:       \"revision\": \"head\",\n525:       \"path\": \"docs/cmd/tools/vxlan/delete.md\",\n526:       \"bytes\": 1230,\n527:       \"lines\": 31\n528:     },\n529:     {\n530:       \"revision\": \"head\",\n531:       \"path\": \"docs/cmd/validate.md\",\n532:       \"bytes\": 1785,\n533:       \"lines\": 51\n534:     },\n535:     {\n536:       \"revision\": \"head\",\n537:       \"path\": \"docs/cmd/version/check.md\",\n538:       \"bytes\": 537,\n539:       \"lines\": 21\n540:     },\n541:     {\n542:       \"revision\": \"head\",\n543:       \"path\": \"docs/cmd/version/index.md\",\n544:       \"bytes\": 1011,\n545:       \"lines\": 37\n546:     },\n547:     {\n548:       \"revision\": \"head\",\n549:       \"path\": \"docs/CNAME\",\n550:       \"bytes\": 16,\n551:       \"lines\": 1\n552:     },\n553:     {\n554:       \"revision\": \"head\",\n555:       \"path\": \"docs/community.md\",\n556:       \"bytes\": 26611,\n557:       \"lines\": 360\n558:     },\n559:     {\n560:       \"revision\": \"head\",\n561:       \"path\": \"docs/htmltest-pr.yml\",\n562:       \"bytes\": 678,\n563:       \"lines\": 14\n564:     },\n565:     {\n566:       \"revision\": \"head\",\n567:       \"path\": \"docs/htmltest-w-github.yml\",\n568:       \"bytes\": 1679,\n569:       \"lines\": 31\n570:     },\n571:     {\n572:       \"revision\": \"head\",\n573:       \"path\": \"docs/htmltest.yml\",\n574:       \"bytes\": 2429,\n575:       \"lines\": 49\n576:     },\n577:     {\n578:       \"revision\": \"head\",\n579:       \"path\": \"docs/images/clabnew.svg\",\n580:       \"bytes\": 16299,\n581:       \"lines\": 13\n582:     },\n583:     {\n584:       \"revision\": \"head\",\n585:       \"path\": \"docs/images/coloured_wordmark.svg\",\n586:       \"bytes\": 8031,\n587:       \"lines\": 91\n588:     },\n589:     {\n590:       \"revision\": \"head\",\n591:       \"path\": \"docs/images/containerlab_dark_no_text.svg\",\n592:       \"bytes\": 3589,\n593:       \"lines\": 8\n594:     },\n595:     {\n596:       \"revision\": \"head\",\n597:       \"path\": \"docs/images/containerlab_export.svg\",\n598:       \"bytes\": 8893,\n599:       \"lines\": 33\n600:     },\n601:     {\n602:       \"revision\": \"head\",\n603:       \"path\": \"docs/images/containerlab_full_white_no_text.svg\",\n604:       \"bytes\": 3801,\n605:       \"lines\": 8\n606:     },\n607:     {\n608:       \"revision\": \"head\",\n609:       \"path\": \"docs/images/containerlab_white_no_text.svg\",\n610:       \"bytes\": 3293,\n611:       \"lines\": 8\n612:     },\n613:     {\n614:       \"revision\": \"head\",\n615:       \"path\": \"docs/images/containerlab-animated-wordmark.svg\",\n616:       \"bytes\": 70018,\n617:       \"lines\": 52\n618:     },\n619:     {\n620:       \"revision\": \"head\",\n621:       \"path\": \"docs/images/favicon.svg\",\n622:       \"bytes\": 16378,\n623:       \"lines\": 20\n624:     },\n625:     {\n626:       \"revision\": \"head\",\n627:       \"path\": \"docs/images/flask.svg\",\n628:       \"bytes\": 378,\n629:       \"lines\": 1\n630:     },\n631:     {\n632:       \"revision\": \"head\",\n633:       \"path\": \"docs/images/gui/browser-sandbox-placeholder.svg\",\n634:       \"bytes\": 2220,\n635:       \"lines\": 25\n636:     },\n637:     {\n638:       \"revision\": \"head\",\n639:       \"path\": \"docs/images/topoviewer-icons/client.svg\",\n640:       \"bytes\": 633,\n641:       \"lines\": 1\n642:     },\n643:     {\n644:       \"revision\": \"head\",\n645:       \"path\": \"docs/images/topoviewer-icons/controller.svg\",\n646:       \"bytes\": 768,\n647:       \"lines\": 1\n648:     },\n649:     {\n650:       \"revision\": \"head\",\n651:       \"path\": \"docs/images/topoviewer-icons/dcgw.svg\",\n652:       \"bytes\": 1015,\n653:       \"lines\": 1\n654:     },\n655:     {\n656:       \"revision\": \"head\",\n657:       \"path\": \"docs/images/topoviewer-icons/pon.svg\",\n658:       \"bytes\": 553,\n659:       \"lines\": 1\n660:     },\n661:     {\n662:       \"revision\": \"head\",\n663:       \"path\": \"docs/images/topoviewer-icons/rgw.svg\",\n664:       \"bytes\": 983,\n665:       \"lines\": 1\n666:     },\n667:     {\n668:       \"revision\": \"head\",\n669:       \"path\": \"docs/images/topoviewer-icons/router.svg\",\n670:       \"bytes\": 864,\n671:       \"lines\": 1\n672:     },\n673:     {\n674:       \"revision\": \"head\",\n675:       \"path\": \"docs/images/topoviewer-icons/server.svg\",\n676:       \"bytes\": 744,\n677:       \"lines\": 1\n678:     },\n679:     {\n680:       \"revision\": \"head\",\n681:       \"path\": \"docs/images/topoviewer-icons/spine.svg\",\n682:       \"bytes\": 940,\n683:       \"lines\": 1\n684:     },\n685:     {\n686:       \"revision\": \"head\",\n687:       \"path\": \"docs/images/topoviewer-icons/switch.svg\",\n688:       \"bytes\": 803,\n689:       \"lines\": 1\n690:     },\n691:     {\n692:       \"revision\": \"head\",\n693:       \"path\": \"docs/index.md\",\n694:       \"bytes\": 6778,\n695:       \"lines\": 189\n696:     },\n697:     {\n698:       \"revision\": \"head\",\n699:       \"path\": \"docs/install.md\",\n700:       \"bytes\": 17575,\n701:       \"lines\": 505\n702:     },\n703:     {\n704:       \"revision\": \"head\",\n705:       \"path\": \"docs/javascripts/instant-reinit.js\",\n706:       \"bytes\": 2040,\n707:       \"lines\": 45\n708:     },\n709:     {\n710:       \"revision\": \"head\",\n711:       \"path\": \"docs/lab-examples/asav01.md\",\n712:       \"bytes\": 4137,\n713:       \"lines\": 90\n714:     },\n715:     {\n716:       \"revision\": \"head\",\n717:       \"path\": \"docs/lab-examples/bgp-vpls-nok-jun.md\",\n718:       \"bytes\": 3374,\n719:       \"lines\": 34\n720:     },\n721:     {\n722:       \"revision\": \"head\",\n723:       \"path\": \"docs/lab-examples/cisco_iol.md\",\n724:       \"bytes\": 4368,\n725:       \"lines\": 100\n726:     },\n727:     {\n728:       \"revision\": \"head\",\n729:       \"path\": \"docs/lab-examples/cvx01.md\",\n730:       \"bytes\": 2989,\n731:       \"lines\": 48\n732:     },\n733:     {\n734:       \"revision\": \"head\",\n735:       \"path\": \"docs/lab-examples/cvx02.md\",\n736:       \"bytes\": 2990,\n737:       \"lines\": 49\n738:     },\n739:     {\n740:       \"revision\": \"head\",\n741:       \"path\": \"docs/lab-examples/ext-bridge.md\",\n742:       \"bytes\": 2042,\n743:       \"lines\": 31\n744:     },\n745:     {\n746:       \"revision\": \"head\",\n747:       \"path\": \"docs/lab-examples/f5bigipve01.md\",\n748:       \"bytes\": 4956,\n749:       \"lines\": 118\n750:     },\n751:     {\n752:       \"revision\": \"head\",\n753:       \"path\": \"docs/lab-examples/freebsd01.md\",\n754:       \"bytes\": 3571,\n755:       \"lines\": 76\n756:     },\n757:     {\n758:       \"revision\": \"head\",\n759:       \"path\": \"docs/lab-examples/frr01.md\",\n760:       \"bytes\": 2987,\n761:       \"lines\": 64\n762:     },\n763:     {\n764:       \"revision\": \"head\",\n765:       \"path\": \"docs/lab-examples/ftdv01.md\",\n766:       \"bytes\": 4108,\n767:       \"lines\": 75\n768:     },\n769:     {\n770:       \"revision\": \"head\",\n771:       \"path\": \"docs/lab-examples/generic_vm01.md\",\n772:       \"bytes\": 3201,\n773:       \"lines\": 66\n774:     },\n775:     {\n776:       \"revision\": \"head\",\n777:       \"path\": \"docs/lab-examples/ixiacone-srl.md\",\n778:       \"bytes\": 6827,\n779:       \"lines\": 135\n780:     },\n781:     {\n782:       \"revision\": \"head\",\n783:       \"path\": \"docs/lab-examples/lab-examples.md\",\n784:       \"bytes\": 4334,\n785:       \"lines\": 80\n786:     },\n787:     {\n788:       \"revision\": \"head\",\n789:       \"path\": \"docs/lab-examples/min-5clos.md\",\n790:       \"bytes\": 9340,\n791:       \"lines\": 127\n792:     },\n793:     {\n794:       \"revision\": \"head\",\n795:       \"path\": \"docs/lab-examples/min-clos.md\",\n796:       \"bytes\": 1970,\n797:       \"lines\": 26\n798:     },\n799:     {\n800:       \"revision\": \"head\",\n801:       \"path\": \"docs/lab-examples/multinode.md\",\n802:       \"bytes\": 14610,\n803:       \"lines\": 264\n804:     },\n805:     {\n806:       \"revision\": \"head\",\n807:       \"path\": \"docs/lab-examples/openbsd01.md\",\n808:       \"bytes\": 3615,\n809:       \"lines\": 76\n810:     },\n811:     {\n812:       \"revision\": \"head\",\n813:       \"path\": \"docs/lab-examples/ost-srl.md\",\n814:       \"bytes\": 6005,\n815:       \"lines\": 114\n816:     },\n817:     {\n818:       \"revision\": \"head\",\n819:       \"path\": \"docs/lab-examples/osvbng01.md\",\n820:       \"bytes\": 3109,\n821:       \"lines\": 71\n822:     },\n823:     {\n824:       \"revision\": \"head\",\n825:       \"path\": \"docs/lab-examples/peering-lab.md\",\n826:       \"bytes\": 23285,\n827:       \"lines\": 391\n828:     },\n829:     {\n830:       \"revision\": \"head\",\n831:       \"path\": \"docs/lab-examples/rare-freertr.md\",\n832:       \"bytes\": 1848,\n833:       \"lines\": 31\n834:     },\n835:     {\n836:       \"revision\": \"head\",\n837:       \"path\": \"docs/lab-examples/single-srl.md\",\n838:       \"bytes\": 2261,\n839:       \"lines\": 32\n840:     },\n841:     {\n842:       \"revision\": \"head\",\n843:       \"path\": \"docs/lab-examples/sr-sim.md\",\n844:       \"bytes\": 3766,\n845:       \"lines\": 64\n846:     },\n847:     {\n848:       \"revision\": \"head\",\n849:       \"path\": \"docs/lab-examples/srl-arcos.md\",\n850:       \"bytes\": 2871,\n851:       \"lines\": 52\n852:     },\n853:     {\n854:       \"revision\": \"head\",\n855:       \"path\": \"docs/lab-examples/srl-ceos.md\",\n856:       \"bytes\": 8462,\n857:       \"lines\": 211\n858:     },\n859:     {\n860:       \"revision\": \"head\",\n861:       \"path\": \"docs/lab-examples/srl-cjunosevolved.md\",\n862:       \"bytes\": 2674,\n863:       \"lines\": 43\n864:     },\n865:     {\n866:       \"revision\": \"head\",\n867:       \"path\": \"docs/lab-examples/srl-crpd.md\",\n868:       \"bytes\": 9443,\n869:       \"lines\": 181\n870:     },\n871:     {\n872:       \"revision\": \"head\",\n873:       \"path\": \"docs/lab-examples/srl-frr.md\",\n874:       \"bytes\": 3163,\n875:       \"lines\": 33\n876:     },\n877:     {\n878:       \"revision\": \"head\",\n879:       \"path\": \"docs/lab-examples/srl-sonic.md\",\n880:       \"bytes\": 9521,\n881:       \"lines\": 193\n882:     },\n883:     {\n884:       \"revision\": \"head\",\n885:       \"path\": \"docs/lab-examples/srl-vjunos-switch.md\",\n886:       \"bytes\": 1886,\n887:       \"lines\": 24\n888:     },\n889:     {\n890:       \"revision\": \"head\",\n891:       \"path\": \"docs/lab-examples/srl-vjunosevolved.md\",\n892:       \"bytes\": 1891,\n893:       \"lines\": 24\n894:     },\n895:     {\n896:       \"revision\": \"head\",\n897:       \"path\": \"docs/lab-examples/srl-xrd.md\",\n898:       \"bytes\": 2877,\n899:       \"lines\": 49\n900:     },\n901:     {\n902:       \"revision\": \"head\",\n903:       \"path\": \"docs/lab-examples/templated01.md\",\n904:       \"bytes\": 2516,\n905:       \"lines\": 56\n906:     },\n907:     {\n908:       \"revision\": \"head\",\n909:       \"path\": \"docs/lab-examples/templated02.md\",\n910:       \"bytes\": 2792,\n911:       \"lines\": 68\n912:     },\n913:     {\n914:       \"revision\": \"head\",\n915:       \"path\": \"docs/lab-examples/two-srls.md\",\n916:       \"bytes\": 3098,\n917:       \"lines\": 47\n918:     },\n919:     {\n920:       \"revision\": \"head\",\n921:       \"path\": \"docs/lab-examples/vr-sros.md\",\n922:       \"bytes\": 2506,\n923:       \"lines\": 28\n924:     },\n925:     {\n926:       \"revision\": \"head\",\n927:       \"path\": \"docs/lab-examples/vr-vmx.md\",\n928:       \"bytes\": 2523,\n929:       \"lines\": 30\n930:     },\n931:     {\n932:       \"revision\": \"head\",\n933:       \"path\": \"docs/lab-examples/vr-xrv.md\",\n934:       \"bytes\": 2419,\n935:       \"lines\": 27\n936:     },\n937:     {\n938:       \"revision\": \"head\",\n939:       \"path\": \"docs/lab-examples/vr-xrv9k.md\",\n940:       \"bytes\": 2441,\n941:       \"lines\": 27\n942:     },\n943:     {\n944:       \"revision\": \"head\",\n945:       \"path\": \"docs/lab-examples/vsrx01.md\",\n946:       \"bytes\": 4497,\n947:       \"lines\": 90\n948:     },\n949:     {\n950:       \"revision\": \"head\",\n951:       \"path\": \"docs/lab-examples/wan.md\",\n952:       \"bytes\": 1820,\n953:       \"lines\": 24\n954:     },\n955:     {\n956:       \"revision\": \"head\",\n957:       \"path\": \"docs/macos.md\",\n958:       \"bytes\": 17237,\n959:       \"lines\": 251\n960:     },\n961:     {\n962:       \"revision\": \"head\",\n963:       \"path\": \"docs/manual/api-server.md\",\n964:       \"bytes\": 7871,\n965:       \"lines\": 223\n966:     },\n967:     {\n968:       \"revision\": \"head\",\n969:       \"path\": \"docs/manual/cert.md\",\n970:       \"bytes\": 3472,\n971:       \"lines\": 59\n972:     },\n973:     {\n974:       \"revision\": \"head\",\n975:       \"path\": \"docs/manual/clabernetes/index.md\",\n976:       \"bytes\": 990,\n977:       \"lines\": 18\n978:     },\n979:     {\n980:       \"revision\": \"head\",\n981:       \"path\": \"docs/manual/clabernetes/runtime.md\",\n982:       \"bytes\": 34317,\n983:       \"lines\": 888\n984:     },\n985:     {\n986:       \"revision\": \"head\",\n987:       \"path\": \"docs/manual/codespaces.md\",\n988:       \"bytes\": 20644,\n989:       \"lines\": 318\n990:     },\n991:     {\n992:       \"revision\": \"head\",\n993:       \"path\": \"docs/manual/conf-artifacts.md\",\n994:       \"bytes\": 3196,\n995:       \"lines\": 54\n996:     },\n997:     {\n998:       \"revision\": \"head\",\n999:       \"path\": \"docs/manual/config-mgmt.md\",\n1000:       \"bytes\": 12920,\n1001:       \"lines\": 311\n1002:     },\n1003:     {\n1004:       \"revision\": \"head\",\n1005:       \"path\": \"docs/manual/dev/debug.md\",\n1006:       \"bytes\": 5255,\n1007:       \"lines\": 133\n1008:     },\n1009:     {\n1010:       \"revision\": \"head\",\n1011:       \"path\": \"docs/manual/dev/doc.md\",\n1012:       \"bytes\": 4366,\n1013:       \"lines\": 55\n1014:     },\n1015:     {\n1016:       \"revision\": \"head\",\n1017:       \"path\": \"docs/manual/dev/index.md\",\n1018:       \"bytes\": 1170,\n1019:       \"lines\": 21\n1020:     },\n1021:     {\n1022:       \"revision\": \"head\",\n1023:       \"path\": \"docs/manual/dev/test.md\",\n1024:       \"bytes\": 4069,\n1025:       \"lines\": 100\n1026:     },\n1027:     {\n1028:       \"revision\": \"head\",\n1029:       \"path\": \"docs/manual/gui/desktop.md\",\n1030:       \"bytes\": 5381,\n1031:       \"lines\": 130\n1032:     },\n1033:     {\n1034:       \"revision\": \"head\",\n1035:       \"path\": \"docs/manual/gui/index.md\",\n1036:       \"bytes\": 16398,\n1037:       \"lines\": 314\n1038:     },\n1039:     {\n1040:       \"revision\": \"head\",\n1041:       \"path\": \"docs/manual/gui/vsc-extension.md\",\n1042:       \"bytes\": 9060,\n1043:       \"lines\": 202\n1044:     },\n1045:     {\n1046:       \"revision\": \"head\",\n1047:       \"path\": \"docs/manual/gui/web.md\",\n1048:       \"bytes\": 6617,\n1049:       \"lines\": 178\n1050:     },\n1051:     {\n1052:       \"revision\": \"head\",\n1053:       \"path\": \"docs/manual/images.md\",\n1054:       \"bytes\": 5119,\n1055:       \"lines\": 108\n1056:     },\n1057:     {\n1058:       \"revision\": \"head\",\n1059:       \"path\": \"docs/manual/impairments.md\",\n1060:       \"bytes\": 881,\n1061:       \"lines\": 20\n1062:     },\n1063:     {\n1064:       \"revision\": \"head\",\n1065:       \"path\": \"docs/manual/inventory.md\",\n1066:       \"bytes\": 11726,\n1067:       \"lines\": 398\n1068:     },\n1069:     {\n1070:       \"revision\": \"head\",\n1071:       \"path\": \"docs/manual/kinds/6wind_vsr.md\",\n1072:       \"bytes\": 9464,\n1073:       \"lines\": 208\n1074:     },\n1075:     {\n1076:       \"revision\": \"head\",\n1077:       \"path\": \"docs/manual/kinds/arrcus_arcos.md\",\n1078:       \"bytes\": 4185,\n1079:       \"lines\": 134\n1080:     },\n1081:     {\n1082:       \"revision\": \"head\",\n1083:       \"path\": \"docs/manual/kinds/bridge.md\",\n1084:       \"bytes\": 5527,\n1085:       \"lines\": 123\n1086:     },\n1087:     {\n1088:       \"revision\": \"head\",\n1089:       \"path\": \"docs/manual/kinds/c8000.md\",\n1090:       \"bytes\": 5477,\n1091:       \"lines\": 151\n1092:     },\n1093:     {\n1094:       \"revision\": \"head\",\n1095:       \"path\": \"docs/manual/kinds/ceos.md\",\n1096:       \"bytes\": 22395,\n1097:       \"lines\": 548\n1098:     },\n1099:     {\n1100:       \"revision\": \"head\",\n1101:       \"path\": \"docs/manual/kinds/checkpoint_cloudguard.md\",\n1102:       \"bytes\": 2694,\n1103:       \"lines\": 60\n1104:     },\n1105:     {\n1106:       \"revision\": \"head\",\n1107:       \"path\": \"docs/manual/kinds/ciena_saos.md\",\n1108:       \"bytes\": 8268,\n1109:       \"lines\": 244\n1110:     },\n1111:     {\n1112:       \"revision\": \"head\",\n1113:       \"path\": \"docs/manual/kinds/cisco_asav.md\",\n1114:       \"bytes\": 4142,\n1115:       \"lines\": 95\n1116:     },\n1117:     {\n1118:       \"revision\": \"head\",\n1119:       \"path\": \"docs/manual/kinds/cisco_iol.md\",\n1120:       \"bytes\": 11889,\n1121:       \"lines\": 269\n1122:     },\n1123:     {\n1124:       \"revision\": \"head\",\n1125:       \"path\": \"docs/manual/kinds/cisco_sdwan.md\",\n1126:       \"bytes\": 6415,\n1127:       \"lines\": 280\n1128:     },\n1129:     {\n1130:       \"revision\": \"head\",\n1131:       \"path\": \"docs/manual/kinds/cisco_vios.md\",\n1132:       \"bytes\": 3734,\n1133:       \"lines\": 95\n1134:     },\n1135:     {\n1136:       \"revision\": \"head\",\n1137:       \"path\": \"docs/manual/kinds/cisco_xrd_vrouter.md\",\n1138:       \"bytes\": 5916,\n1139:       \"lines\": 139\n1140:     },\n1141:     {\n1142:       \"revision\": \"head\",\n1143:       \"path\": \"docs/manual/kinds/cjunosevolved.md\",\n1144:       \"bytes\": 7017,\n1145:       \"lines\": 150\n1146:     },\n1147:     {\n1148:       \"revision\": \"head\",\n1149:       \"path\": \"docs/manual/kinds/crpd.md\",\n1150:       \"bytes\": 8048,\n1151:       \"lines\": 191\n1152:     },\n1153:     {\n1154:       \"revision\": \"head\",\n1155:       \"path\": \"docs/manual/kinds/csrx.md\",\n1156:       \"bytes\": 6460,\n1157:       \"lines\": 176\n1158:     },\n1159:     {\n1160:       \"revision\": \"head\",\n1161:       \"path\": \"docs/manual/kinds/dell_sonic.md\",\n1162:       \"bytes\": 3154,\n1163:       \"lines\": 95\n1164:     },\n1165:     {\n1166:       \"revision\": \"head\",\n1167:       \"path\": \"docs/manual/kinds/ext-container.md\",\n1168:       \"bytes\": 2729,\n1169:       \"lines\": 64\n1170:     },\n1171:     {\n1172:       \"revision\": \"head\",\n1173:       \"path\": \"docs/manual/kinds/f5_bigipve.md\",\n1174:       \"bytes\": 8997,\n1175:       \"lines\": 220\n1176:     },\n1177:     {\n1178:       \"revision\": \"head\",\n1179:       \"path\": \"docs/manual/kinds/fdio_vpp.md\",\n1180:       \"bytes\": 10759,\n1181:       \"lines\": 225\n1182:     },\n1183:     {\n1184:       \"revision\": \"head\",\n1185:       \"path\": \"docs/manual/kinds/fortinet_fortigate.md\",\n1186:       \"bytes\": 3737,\n1187:       \"lines\": 81\n1188:     },\n1189:     {\n1190:       \"revision\": \"head\",\n1191:       \"path\": \"docs/manual/kinds/freebsd.md\",\n1192:       \"bytes\": 4052,\n1193:       \"lines\": 95\n1194:     },\n1195:     {\n1196:       \"revision\": \"head\",\n1197:       \"path\": \"docs/manual/kinds/frr.md\",\n1198:       \"bytes\": 7504,\n1199:       \"lines\": 151\n1200:     },\n1201:     {\n1202:       \"revision\": \"head\",\n1203:       \"path\": \"docs/manual/kinds/generic_vm.md\",\n1204:       \"bytes\": 3133,\n1205:       \"lines\": 87\n1206:     },\n1207:     {\n1208:       \"revision\": \"head\",\n1209:       \"path\": \"docs/manual/kinds/host.md\",\n1210:       \"bytes\": 1105,\n1211:       \"lines\": 24\n1212:     },\n1213:     {\n1214:       \"revision\": \"head\",\n1215:       \"path\": \"docs/manual/kinds/huawei_vrp.md\",\n1216:       \"bytes\": 4188,\n1217:       \"lines\": 88\n1218:     },\n1219:     {\n1220:       \"revision\": \"head\",\n1221:       \"path\": \"docs/manual/kinds/index.md\",\n1222:       \"bytes\": 8558,\n1223:       \"lines\": 104\n1224:     },\n1225:     {\n1226:       \"revision\": \"head\",\n1227:       \"path\": \"docs/manual/kinds/ipinfusion-ocnos.md\",\n1228:       \"bytes\": 2248,\n1229:       \"lines\": 54\n1230:     },\n1231:     {\n1232:       \"revision\": \"head\",\n1233:       \"path\": \"docs/manual/kinds/k8s-kind.md\",\n1234:       \"bytes\": 6322,\n1235:       \"lines\": 141\n1236:     },\n1237:     {\n1238:       \"revision\": \"head\",\n1239:       \"path\": \"docs/manual/kinds/keysight_ixia-c-one.md\",\n1240:       \"bytes\": 3228,\n1241:       \"lines\": 68\n1242:     },\n1243:     {\n1244:       \"revision\": \"head\",\n1245:       \"path\": \"docs/manual/kinds/linux.md\",\n1246:       \"bytes\": 2960,\n1247:       \"lines\": 55\n1248:     },\n1249:     {\n1250:       \"revision\": \"head\",\n1251:       \"path\": \"docs/manual/kinds/nvidia_cumulusvx.md\",\n1252:       \"bytes\": 4019,\n1253:       \"lines\": 106\n1254:     },\n1255:     {\n1256:       \"revision\": \"head\",\n1257:       \"path\": \"docs/manual/kinds/openbsd.md\",\n1258:       \"bytes\": 4034,\n1259:       \"lines\": 95\n1260:     },\n1261:     {\n1262:       \"revision\": \"head\",\n1263:       \"path\": \"docs/manual/kinds/openwrt.md\",\n1264:       \"bytes\": 1725,\n1265:       \"lines\": 37\n1266:     },\n1267:     {\n1268:       \"revision\": \"head\",\n1269:       \"path\": \"docs/manual/kinds/ostinato.md\",\n1270:       \"bytes\": 3594,\n1271:       \"lines\": 95\n1272:     },\n1273:     {\n1274:       \"revision\": \"head\",\n1275:       \"path\": \"docs/manual/kinds/ovs-bridge.md\",\n1276:       \"bytes\": 1997,\n1277:       \"lines\": 53\n1278:     },\n1279:     {\n1280:       \"revision\": \"head\",\n1281:       \"path\": \"docs/manual/kinds/plvision_sonic.md\",\n1282:       \"bytes\": 3542,\n1283:       \"lines\": 84\n1284:     },\n1285:     {\n1286:       \"revision\": \"head\",\n1287:       \"path\": \"docs/manual/kinds/rare-freertr.md\",\n1288:       \"bytes\": 6044,\n1289:       \"lines\": 170\n1290:     },\n1291:     {\n1292:       \"revision\": \"head\",\n1293:       \"path\": \"docs/manual/kinds/sonic-vm.md\",\n1294:       \"bytes\": 5902,\n1295:       \"lines\": 145\n1296:     },\n1297:     {\n1298:       \"revision\": \"head\",\n1299:       \"path\": \"docs/manual/kinds/sonic-vs.md\",\n1300:       \"bytes\": 3737,\n1301:       \"lines\": 78\n1302:     },\n1303:     {\n1304:       \"revision\": \"head\",\n1305:       \"path\": \"docs/manual/kinds/spirent_stc.md\",\n1306:       \"bytes\": 3762,\n1307:       \"lines\": 116\n1308:     },\n1309:     {\n1310:       \"revision\": \"head\",\n1311:       \"path\": \"docs/manual/kinds/srl.md\",\n1312:       \"bytes\": 25640,\n1313:       \"lines\": 577\n1314:     },\n1315:     {\n1316:       \"revision\": \"head\",\n1317:       \"path\": \"docs/manual/kinds/veesix_osvbng.md\",\n1318:       \"bytes\": 3889,\n1319:       \"lines\": 124\n1320:     },\n1321:     {\n1322:       \"revision\": \"head\",\n1323:       \"path\": \"docs/manual/kinds/vr-aoscx.md\",\n1324:       \"bytes\": 3329,\n1325:       \"lines\": 73\n1326:     },\n1327:     {\n1328:       \"revision\": \"head\",\n1329:       \"path\": \"docs/manual/kinds/vr-c8000v.md\",\n1330:       \"bytes\": 6882,\n1331:       \"lines\": 188\n1332:     },\n1333:     {\n1334:       \"revision\": \"head\",\n1335:       \"path\": \"docs/manual/kinds/vr-cat9kv.md\",\n1336:       \"bytes\": 6835,\n1337:       \"lines\": 170\n1338:     },\n1339:     {\n1340:       \"revision\": \"head\",\n1341:       \"path\": \"docs/manual/kinds/vr-csr.md\",\n1342:       \"bytes\": 4119,\n1343:       \"lines\": 86\n1344:     },\n1345:     {\n1346:       \"revision\": \"head\",\n1347:       \"path\": \"docs/manual/kinds/vr-ftdv.md\",\n1348:       \"bytes\": 3343,\n1349:       \"lines\": 79\n1350:     },\n1351:     {\n1352:       \"revision\": \"head\",\n1353:       \"path\": \"docs/manual/kinds/vr-ftosv.md\",\n1354:       \"bytes\": 3557,\n1355:       \"lines\": 79\n1356:     },\n1357:     {\n1358:       \"revision\": \"head\",\n1359:       \"path\": \"docs/manual/kinds/vr-n9kv.md\",\n1360:       \"bytes\": 4790,\n1361:       \"lines\": 123\n1362:     },\n1363:     {\n1364:       \"revision\": \"head\",\n1365:       \"path\": \"docs/manual/kinds/vr-pan.md\",\n1366:       \"bytes\": 3372,\n1367:       \"lines\": 86\n1368:     },\n1369:     {\n1370:       \"revision\": \"head\",\n1371:       \"path\": \"docs/manual/kinds/vr-ros.md\",\n1372:       \"bytes\": 3912,\n1373:       \"lines\": 83\n1374:     },\n1375:     {\n1376:       \"revision\": \"head\",\n1377:       \"path\": \"docs/manual/kinds/vr-sros.md\",\n1378:       \"bytes\": 22067,\n1379:       \"lines\": 505\n1380:     },\n1381:     {\n1382:       \"revision\": \"head\",\n1383:       \"path\": \"docs/manual/kinds/vr-veos.md\",\n1384:       \"bytes\": 4126,\n1385:       \"lines\": 94\n1386:     },\n1387:     {\n1388:       \"revision\": \"head\",\n1389:       \"path\": \"docs/manual/kinds/vr-vjunosevolved.md\",\n1390:       \"bytes\": 5141,\n1391:       \"lines\": 107\n1392:     },\n1393:     {\n1394:       \"revision\": \"head\",\n1395:       \"path\": \"docs/manual/kinds/vr-vjunosrouter.md\",\n1396:       \"bytes\": 5140,\n1397:       \"lines\": 103\n1398:     },\n1399:     {\n1400:       \"revision\": \"head\",\n1401:       \"path\": \"docs/manual/kinds/vr-vjunosswitch.md\",\n1402:       \"bytes\": 5110,\n1403:       \"lines\": 108\n1404:     },\n1405:     {\n1406:       \"revision\": \"head\",\n1407:       \"path\": \"docs/manual/kinds/vr-vmx.md\",\n1408:       \"bytes\": 5371,\n1409:       \"lines\": 121\n1410:     },\n1411:     {\n1412:       \"revision\": \"head\",\n1413:       \"path\": \"docs/manual/kinds/vr-vqfx.md\",\n1414:       \"bytes\": 4053,\n1415:       \"lines\": 90\n1416:     },\n1417:     {\n1418:       \"revision\": \"head\",\n1419:       \"path\": \"docs/manual/kinds/vr-vsrx.md\",\n1420:       \"bytes\": 4053,\n1421:       \"lines\": 89\n1422:     },\n1423:     {\n1424:       \"revision\": \"head\",\n1425:       \"path\": \"docs/manual/kinds/vr-xrv.md\",\n1426:       \"bytes\": 4029,\n1427:       \"lines\": 100\n1428:     },\n1429:     {\n1430:       \"revision\": \"head\",\n1431:       \"path\": \"docs/manual/kinds/vr-xrv9k.md\",\n1432:       \"bytes\": 5157,\n1433:       \"lines\": 120\n1434:     },\n1435:     {\n1436:       \"revision\": \"head\",\n1437:       \"path\": \"docs/manual/kinds/vyosnetworks_vyos.md\",\n1438:       \"bytes\": 6643,\n1439:       \"lines\": 187\n1440:     },\n1441:     {\n1442:       \"revision\": \"head\",\n1443:       \"path\": \"docs/manual/kinds/xrd.md\",\n1444:       \"bytes\": 7951,\n1445:       \"lines\": 177\n1446:     },\n1447:     {\n1448:       \"revision\": \"head\",\n1449:       \"path\": \"docs/manual/multi-node.md\",\n1450:       \"bytes\": 6089,\n1451:       \"lines\": 72\n1452:     },\n1453:     {\n1454:       \"revision\": \"head\",\n1455:       \"path\": \"docs/manual/network.md\",\n1456:       \"bytes\": 40210,\n1457:       \"lines\": 835\n1458:     },\n1459:     {\n1460:       \"revision\": \"head\",\n1461:       \"path\": \"docs/manual/node-filtering.md\",\n1462:       \"bytes\": 3517,\n1463:       \"lines\": 66\n1464:     },\n1465:     {\n1466:       \"revision\": \"head\",\n1467:       \"path\": \"docs/manual/nodes.md\",\n1468:       \"bytes\": 44445,\n1469:       \"lines\": 1205\n1470:     },\n1471:     {\n1472:       \"revision\": \"head\",\n1473:       \"path\": \"docs/manual/s3-usage-example.md\",\n1474:       \"bytes\": 1446,\n1475:       \"lines\": 61\n1476:     },\n1477:     {\n1478:       \"revision\": \"head\",\n1479:       \"path\": \"docs/manual/share-access.md\",\n1480:       \"bytes\": 8219,\n1481:       \"lines\": 150\n1482:     },\n1483:     {\n1484:       \"revision\": \"head\",\n1485:       \"path\": \"docs/manual/topo-def-file.md\",\n1486:       \"bytes\": 37253,\n1487:       \"lines\": 903\n1488:     },\n1489:     {\n1490:       \"revision\": \"head\",\n1491:       \"path\": \"docs/manual/vrnetlab.md\",\n1492:       \"bytes\": 30525,\n1493:       \"lines\": 270\n1494:     },\n1495:     {\n1496:       \"revision\": \"head\",\n1497:       \"path\": \"docs/manual/wireshark.md\",\n1498:       \"bytes\": 16256,\n1499:       \"lines\": 326\n1500:     },\n1501:     {\n1502:       \"revision\": \"head\",\n1503:       \"path\": \"docs/quickstart.md\",\n1504:       \"bytes\": 10387,\n1505:       \"lines\": 207\n1506:     },\n1507:     {\n1508:       \"revision\": \"head\",\n1509:       \"path\": \"docs/rn/0.11.0.md\",\n1510:       \"bytes\": 5330,\n1511:       \"lines\": 71\n1512:     },\n1513:     {\n1514:       \"revision\": \"head\",\n1515:       \"path\": \"docs/rn/0.12.0.md\",\n1516:       \"bytes\": 4928,\n1517:       \"lines\": 75\n1518:     },\n1519:     {\n1520:       \"revision\": \"head\",\n1521:       \"path\": \"docs/rn/0.13.0.md\",\n1522:       \"bytes\": 1772,\n1523:       \"lines\": 30\n1524:     },\n1525:     {\n1526:       \"revision\": \"head\",\n1527:       \"path\": \"docs/rn/0.14.0.md\",\n1528:       \"bytes\": 2612,\n1529:       \"lines\": 35\n1530:     },\n1531:     {\n1532:       \"revision\": \"head\",\n1533:       \"path\": \"docs/rn/0.14.1.md\",\n1534:       \"bytes\": 177,\n1535:       \"lines\": 5\n1536:     },\n1537:     {\n1538:       \"revision\": \"head\",\n1539:       \"path\": \"docs/rn/0.14.2.md\",\n1540:       \"bytes\": 301,\n1541:       \"lines\": 5\n1542:     },\n1543:     {\n1544:       \"revision\": \"head\",\n1545:       \"path\": \"docs/rn/0.14.3.md\",\n1546:       \"bytes\": 317,\n1547:       \"lines\": 9\n1548:     },\n1549:     {\n1550:       \"revision\": \"head\",\n1551:       \"path\": \"docs/rn/0.14.4.md\",\n1552:       \"bytes\": 286,\n1553:       \"lines\": 9\n1554:     },\n1555:     {\n1556:       \"revision\": \"head\",\n1557:       \"path\": \"docs/rn/0.15.md\",\n1558:       \"bytes\": 3827,\n1559:       \"lines\": 69\n1560:     },\n1561:     {\n1562:       \"revision\": \"head\",\n1563:       \"path\": \"docs/rn/0.16.md\",\n1564:       \"bytes\": 3480,\n1565:       \"lines\": 65\n1566:     },\n1567:     {\n1568:       \"revision\": \"head\",\n1569:       \"path\": \"docs/rn/0.17.md\",\n1570:       \"bytes\": 3356,\n1571:       \"lines\": 41\n1572:     },\n1573:     {\n1574:       \"revision\": \"head\",\n1575:       \"path\": \"docs/rn/0.18.md\",\n1576:       \"bytes\": 1527,\n1577:       \"lines\": 34\n1578:     },\n1579:     {\n1580:       \"revision\": \"head\",\n1581:       \"path\": \"docs/rn/0.19.md\",\n1582:       \"bytes\": 2470,\n1583:       \"lines\": 48\n1584:     },\n1585:     {\n1586:       \"revision\": \"head\",\n1587:       \"path\": \"docs/rn/0.20.md\",\n1588:       \"bytes\": 2146,\n1589:       \"lines\": 33\n1590:     },\n1591:     {\n1592:       \"revision\": \"head\",\n1593:       \"path\": \"docs/rn/0.21.md\",\n1594:       \"bytes\": 2459,\n1595:       \"lines\": 48\n1596:     },\n1597:     {\n1598:       \"revision\": \"head\",\n1599:       \"path\": \"docs/rn/0.22.md\",\n1600:       \"bytes\": 1806,\n1601:       \"lines\": 27\n1602:     },\n1603:     {\n1604:       \"revision\": \"head\",\n1605:       \"path\": \"docs/rn/0.23.md\",\n1606:       \"bytes\": 1835,\n1607:       \"lines\": 35\n1608:     },\n1609:     {\n1610:       \"revision\": \"head\",\n1611:       \"path\": \"docs/rn/0.24.md\",\n1612:       \"bytes\": 3490,\n1613:       \"lines\": 51\n1614:     },\n1615:     {\n1616:       \"revision\": \"head\",\n1617:       \"path\": \"docs/rn/0.25.md\",\n1618:       \"bytes\": 2105,\n1619:       \"lines\": 37\n1620:     },\n1621:     {\n1622:       \"revision\": \"head\",\n1623:       \"path\": \"docs/rn/0.26.md\",\n1624:       \"bytes\": 5078,\n1625:       \"lines\": 88\n1626:     },\n1627:     {\n1628:       \"revision\": \"head\",\n1629:       \"path\": \"docs/rn/0.27.md\",\n1630:       \"bytes\": 947,\n1631:       \"lines\": 21\n1632:     },\n1633:     {\n1634:       \"revision\": \"head\",\n1635:       \"path\": \"docs/rn/0.28.md\",\n1636:       \"bytes\": 1382,\n1637:       \"lines\": 32\n1638:     },\n1639:     {\n1640:       \"revision\": \"head\",\n1641:       \"path\": \"docs/rn/0.29.md\",\n1642:       \"bytes\": 750,\n1643:       \"lines\": 13\n1644:     },\n1645:     {\n1646:       \"revision\": \"head\",\n1647:       \"path\": \"docs/rn/0.30.md\",\n1648:       \"bytes\": 566,\n1649:       \"lines\": 14\n1650:     },\n1651:     {\n1652:       \"revision\": \"head\",\n1653:       \"path\": \"docs/rn/0.31.md\",\n1654:       \"bytes\": 1710,\n1655:       \"lines\": 30\n1656:     },\n1657:     {\n1658:       \"revision\": \"head\",\n1659:       \"path\": \"docs/rn/0.32.md\",\n1660:       \"bytes\": 2075,\n1661:       \"lines\": 45\n1662:     },\n1663:     {\n1664:       \"revision\": \"head\",\n1665:       \"path\": \"docs/rn/0.33.md\",\n1666:       \"bytes\": 893,\n1667:       \"lines\": 22\n1668:     },\n1669:     {\n1670:       \"revision\": \"head\",\n1671:       \"path\": \"docs/rn/0.34.md\",\n1672:       \"bytes\": 1019,\n1673:       \"lines\": 23\n1674:     },\n1675:     {\n1676:       \"revision\": \"head\",\n1677:       \"path\": \"docs/rn/0.35.md\",\n1678:       \"bytes\": 876,\n1679:       \"lines\": 29\n1680:     },\n1681:     {\n1682:       \"revision\": \"head\",\n1683:       \"path\": \"docs/rn/0.36.md\",\n1684:       \"bytes\": 868,\n1685:       \"lines\": 23\n1686:     },\n1687:     {\n1688:       \"revision\": \"head\",\n1689:       \"path\": \"docs/rn/0.37.md\",\n1690:       \"bytes\": 1990,\n1691:       \"lines\": 38\n1692:     },\n1693:     {\n1694:       \"revision\": \"head\",\n1695:       \"path\": \"docs/rn/0.38.md\",\n1696:       \"bytes\": 881,\n1697:       \"lines\": 18\n1698:     },\n1699:     {\n1700:       \"revision\": \"head\",\n1701:       \"path\": \"docs/rn/0.39.md\",\n1702:       \"bytes\": 3693,\n1703:       \"lines\": 101\n1704:     },\n1705:     {\n1706:       \"revision\": \"head\",\n1707:       \"path\": \"docs/rn/0.40.md\",\n1708:       \"bytes\": 732,\n1709:       \"lines\": 15\n1710:     },\n1711:     {\n1712:       \"revision\": \"head\",\n1713:       \"path\": \"docs/rn/0.41.md\",\n1714:       \"bytes\": 4520,\n1715:       \"lines\": 88\n1716:     },\n1717:     {\n1718:       \"revision\": \"head\",\n1719:       \"path\": \"docs/rn/0.42.md\",\n1720:       \"bytes\": 955,\n1721:       \"lines\": 15\n1722:     },\n1723:     {\n1724:       \"revision\": \"head\",\n1725:       \"path\": \"docs/rn/0.43.md\",\n1726:       \"bytes\": 3478,\n1727:       \"lines\": 90\n1728:     },\n1729:     {\n1730:       \"revision\": \"head\",\n1731:       \"path\": \"docs/rn/0.44.md\",\n1732:       \"bytes\": 2213,\n1733:       \"lines\": 54\n1734:     },\n1735:     {\n1736:       \"revision\": \"head\",\n1737:       \"path\": \"docs/rn/0.45.md\",\n1738:       \"bytes\": 1807,\n1739:       \"lines\": 32\n1740:     },\n1741:     {\n1742:       \"revision\": \"head\",\n1743:       \"path\": \"docs/rn/0.46.md\",\n1744:       \"bytes\": 3260,\n1745:       \"lines\": 98\n1746:     },\n1747:     {\n1748:       \"revision\": \"head\",\n1749:       \"path\": \"docs/rn/0.47.md\",\n1750:       \"bytes\": 2333,\n1751:       \"lines\": 46\n1752:     },\n1753:     {\n1754:       \"revision\": \"head\",\n1755:       \"path\": \"docs/rn/0.48.md\",\n1756:       \"bytes\": 4072,\n1757:       \"lines\": 75\n1758:     },\n1759:     {\n1760:       \"revision\": \"head\",\n1761:       \"path\": \"docs/rn/0.49.md\",\n1762:       \"bytes\": 1541,\n1763:       \"lines\": 30\n1764:     },\n1765:     {\n1766:       \"revision\": \"head\",\n1767:       \"path\": \"docs/rn/0.50.md\",\n1768:       \"bytes\": 3606,\n1769:       \"lines\": 54\n1770:     },\n1771:     {\n1772:       \"revision\": \"head\",\n1773:       \"path\": \"docs/rn/0.51.md\",\n1774:       \"bytes\": 2871,\n1775:       \"lines\": 68\n1776:     },\n1777:     {\n1778:       \"revision\": \"head\",\n1779:       \"path\": \"docs/rn/0.52.md\",\n1780:       \"bytes\": 3179,\n1781:       \"lines\": 65\n1782:     },\n1783:     {\n1784:       \"revision\": \"head\",\n1785:       \"path\": \"docs/rn/0.53.md\",\n1786:       \"bytes\": 1282,\n1787:       \"lines\": 27\n1788:     },\n1789:     {\n1790:       \"revision\": \"head\",\n1791:       \"path\": \"docs/rn/0.54.md\",\n1792:       \"bytes\": 942,\n1793:       \"lines\": 26\n1794:     },\n1795:     {\n1796:       \"revision\": \"head\",\n1797:       \"path\": \"docs/rn/0.55.md\",\n1798:       \"bytes\": 3026,\n1799:       \"lines\": 77\n1800:     },\n1801:     {\n1802:       \"revision\": \"head\",\n1803:       \"path\": \"docs/rn/0.56.md\",\n1804:       \"bytes\": 2575,\n1805:       \"lines\": 46\n1806:     },\n1807:     {\n1808:       \"revision\": \"head\",\n1809:       \"path\": \"docs/rn/0.57.md\",\n1810:       \"bytes\": 2466,\n1811:       \"lines\": 56\n1812:     },\n1813:     {\n1814:       \"revision\": \"head\",\n1815:       \"path\": \"docs/rn/0.58.md\",\n1816:       \"bytes\": 1868,\n1817:       \"lines\": 30\n1818:     },\n1819:     {\n1820:       \"revision\": \"head\",\n1821:       \"path\": \"docs/rn/0.59.md\",\n1822:       \"bytes\": 1494,\n1823:       \"lines\": 34\n1824:     },\n1825:     {\n1826:       \"revision\": \"head\",\n1827:       \"path\": \"docs/rn/0.60.md\",\n1828:       \"bytes\": 10022,\n1829:       \"lines\": 135\n1830:     },\n1831:     {\n1832:       \"revision\": \"head\",\n1833:       \"path\": \"docs/rn/0.61.md\",\n1834:       \"bytes\": 2588,\n1835:       \"lines\": 45\n1836:     },\n1837:     {\n1838:       \"revision\": \"head\",\n1839:       \"path\": \"docs/rn/0.62.md\",\n1840:       \"bytes\": 2915,\n1841:       \"lines\": 54\n1842:     },\n1843:     {\n1844:       \"revision\": \"head\",\n1845:       \"path\": \"docs/rn/0.63.md\",\n1846:       \"bytes\": 2182,\n1847:       \"lines\": 46\n1848:     },\n1849:     {\n1850:       \"revision\": \"head\",\n1851:       \"path\": \"docs/rn/0.64.md\",\n1852:       \"bytes\": 5000,\n1853:       \"lines\": 45\n1854:     },\n1855:     {\n1856:       \"revision\": \"head\",\n1857:       \"path\": \"docs/rn/0.65.md\",\n1858:       \"bytes\": 1622,\n1859:       \"lines\": 41\n1860:     },\n1861:     {\n1862:       \"revision\": \"head\",\n1863:       \"path\": \"docs/rn/0.66.md\",\n1864:       \"bytes\": 897,\n1865:       \"lines\": 21\n1866:     },\n1867:     {\n1868:       \"revision\": \"head\",\n1869:       \"path\": \"docs/rn/0.67.md\",\n1870:       \"bytes\": 1394,\n1871:       \"lines\": 23\n1872:     },\n1873:     {\n1874:       \"revision\": \"head\",\n1875:       \"path\": \"docs/rn/0.68.md\",\n1876:       \"bytes\": 2604,\n1877:       \"lines\": 40\n1878:     },\n1879:     {\n1880:       \"revision\": \"head\",\n1881:       \"path\": \"docs/rn/0.69.md\",\n1882:       \"bytes\": 5732,\n1883:       \"lines\": 117\n1884:     },\n1885:     {\n1886:       \"revision\": \"head\",\n1887:       \"path\": \"docs/rn/0.70.md\",\n1888:       \"bytes\": 3389,\n1889:       \"lines\": 64\n1890:     },\n1891:     {\n1892:       \"revision\": \"head\",\n1893:       \"path\": \"docs/rn/0.71.md\",\n1894:       \"bytes\": 5144,\n1895:       \"lines\": 120\n1896:     },\n1897:     {\n1898:       \"revision\": \"head\",\n1899:       \"path\": \"docs/rn/0.72.md\",\n1900:       \"bytes\": 3663,\n1901:       \"lines\": 62\n1902:     },\n1903:     {\n1904:       \"revision\": \"head\",\n1905:       \"path\": \"docs/rn/0.73.md\",\n1906:       \"bytes\": 6239,\n1907:       \"lines\": 96\n1908:     },\n1909:     {\n1910:       \"revision\": \"head\",\n1911:       \"path\": \"docs/rn/0.74.md\",\n1912:       \"bytes\": 6031,\n1913:       \"lines\": 94\n1914:     },\n1915:     {\n1916:       \"revision\": \"head\",\n1917:       \"path\": \"docs/rn/0.75.md\",\n1918:       \"bytes\": 5768,\n1919:       \"lines\": 78\n1920:     },\n1921:     {\n1922:       \"revision\": \"head\",\n1923:       \"path\": \"docs/rn/0.76.md\",\n1924:       \"bytes\": 4557,\n1925:       \"lines\": 69\n1926:     },\n1927:     {\n1928:       \"revision\": \"head\",\n1929:       \"path\": \"docs/rn/0.77.md\",\n1930:       \"bytes\": 3761,\n1931:       \"lines\": 71\n1932:     },\n1933:     {\n1934:       \"revision\": \"head\",\n1935:       \"path\": \"docs/rn/0.78.md\",\n1936:       \"bytes\": 5580,\n1937:       \"lines\": 118\n1938:     },\n1939:     {\n1940:       \"revision\": \"head\",\n1941:       \"path\": \"docs/rn/0.79.md\",\n1942:       \"bytes\": 3853,\n1943:       \"lines\": 96\n1944:     },\n1945:     {\n1946:       \"revision\": \"head\",\n1947:       \"path\": \"docs/rn/0.80.md\",\n1948:       \"bytes\": 15226,\n1949:       \"lines\": 280\n1950:     },\n1951:     {\n1952:       \"revision\": \"head\",\n1953:       \"path\": \"docs/rn/0.81.md\",\n1954:       \"bytes\": 5387,\n1955:       \"lines\": 98\n1956:     },\n1957:     {\n1958:       \"revision\": \"head\",\n1959:       \"path\": \"docs/stylesheets/extra.css\",\n1960:       \"bytes\": 19354,\n1961:       \"lines\": 750\n1962:     },\n1963:     {\n1964:       \"revision\": \"head\",\n1965:       \"path\": \"docs/windows.md\",\n1966:       \"bytes\": 10218,\n1967:       \"lines\": 225\n1968:     },\n1969:     {\n1970:       \"revision\": \"head\",\n1971:       \"path\": \".cursor/rules/git-mutations.mdc\",\n1972:       \"bytes\": 403,\n1973:       \"lines\": 10\n1974:     },\n1975:     {\n1976:       \"revision\": \"head\",\n1977:       \"path\": \".cursor/rules/karpathy-guidelines.mdc\",\n1978:       \"bytes\": 2643,\n1979:       \"lines\": 75\n1980:     },\n1981:     {\n1982:       \"revision\": \"head\",\n1983:       \"path\": \".cursor/rules/ponytail.mdc\",\n1984:       \"bytes\": 2620,\n1985:       \"lines\": 36\n1986:     },\n1987:     {\n1988:       \"revision\": \"head\",\n1989:       \"path\": \".cursor/rules/release-note-review.mdc\",\n1990:       \"bytes\": 472,\n1991:       \"lines\": 12\n1992:     },\n1993:     {\n1994:       \"revision\": \"head\",\n1995:       \"path\": \".cursor/skills/refresh-nix-vendor-hash/SKILL.md\",\n1996:       \"bytes\": 2916,\n1997:       \"lines\": 89\n1998:     },\n1999:     {\n2000:       \"revision\": \"head\",\n\n(Showing lines 1-2000 of 15645. Use offset=2001 to continue.)\n</content>",
    "title": "source/manifest.json",
    "metadata": {
      "preview": "{\n  \"version\": 1,\n  \"head\": \"d44c69f72ab156474197f12b6fc1407b3f8a65c4\",\n  \"base\": \"84cf630e6eedd662d9742fbcd6158a91372e3a56\",\n  \"mergeBase\": \"84cf630e6eedd662d9742fbcd6158a91372e3a56\",\n  \"changed\": [\n    {\n      \"status\": \"M\",\n      \"path\": \".github/workflows/srsim-tests.yml\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"docs/manual/kinds/sros.md\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/README.md\"\n    },\n    {\n      \"status\": \"M\",",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/manifest.json",
        "text": "{\n  \"version\": 1,\n  \"head\": \"d44c69f72ab156474197f12b6fc1407b3f8a65c4\",\n  \"base\": \"84cf630e6eedd662d9742fbcd6158a91372e3a56\",\n  \"mergeBase\": \"84cf630e6eedd662d9742fbcd6158a91372e3a56\",\n  \"changed\": [\n    {\n      \"status\": \"M\",\n      \"path\": \".github/workflows/srsim-tests.yml\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"docs/manual/kinds/sros.md\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/README.md\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/chassis_info.go\"\n    },\n    {\n      \"status\": \"A\",\n      \"path\": \"nodes/sros/chassis_info_test.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/component.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/component_config.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/config.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/netns.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/power.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/sros.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/sros_test.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/template.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"nodes/sros/variant.go\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"schemas/clab.schema.json\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/01-sros-to-linux.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/03-sros-dist-to-linux.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/04-sros-classic.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/05-sros-comp-to-linux.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/06-srsim-sar.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/07-srsim-with-mgmt-network.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/08-srsim-comp-cfg-test.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/09-srsim-pause-container.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/10-srsim-lifecycle.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"tests/13-srsim/12-srsim-veth-stitch.robot\"\n    },\n    {\n      \"status\": \"A\",\n      \"path\": \"tests/13-srsim/13-srsim-integrated.clab.yml\"\n    },\n    {\n      \"status\": \"A\",\n      \"path\": \"tests/13-srsim/13-srsim-integrated.robot\"\n    },\n    {\n      \"status\": \"A\",\n      \"path\": \"tests/13-srsim/14-srsim-new-chassis.clab.yml\"\n    },\n    {\n      \"status\": \"A\",\n      \"path\": \"tests/13-srsim/14-srsim-new-chassis.robot\"\n    },\n    {\n      \"status\": \"A\",\n      \"path\": \"tests/srsim.robot\"\n    },\n    {\n      \"status\": \"M\",\n      \"path\": \"utils/sros_schema_gen.sh\"\n    }\n  ],\n  \"files\": [\n    {\n      \"revision\": \"head\",\n      \"path\": \".github/workflows/srsim-tests.yml\",\n      \"bytes\": 4465,\n      \"lines\": 141\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/sros.md\",\n      \"bytes\": 36892,\n      \"lines\": 906\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/chassis_info_test.go\",\n      \"bytes\": 2578,\n      \"lines\": 99\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/chassis_info.go\",\n      \"bytes\": 5820,\n      \"lines\": 222\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/component_config.go\",\n      \"bytes\": 10029,\n      \"lines\": 393\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/component.go\",\n      \"bytes\": 7301,\n      \"lines\": 309\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/config.go\",\n      \"bytes\": 10055,\n      \"lines\": 345\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/netns.go\",\n      \"bytes\": 5099,\n      \"lines\": 157\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/power.go\",\n      \"bytes\": 1613,\n      \"lines\": 95\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/README.md\",\n      \"bytes\": 45346,\n      \"lines\": 1582\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/sros_test.go\",\n      \"bytes\": 42251,\n      \"lines\": 1351\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/sros.go\",\n      \"bytes\": 57207,\n      \"lines\": 1910\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/template.go\",\n      \"bytes\": 2661,\n      \"lines\": 99\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"nodes/sros/variant.go\",\n      \"bytes\": 4674,\n      \"lines\": 170\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"schemas/clab.schema.json\",\n      \"bytes\": 167017,\n      \"lines\": 3969\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/01-sros-to-linux.robot\",\n      \"bytes\": 4315,\n      \"lines\": 105\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/03-sros-dist-to-linux.robot\",\n      \"bytes\": 1876,\n      \"lines\": 47\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/04-sros-classic.robot\",\n      \"bytes\": 2147,\n      \"lines\": 61\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/05-sros-comp-to-linux.robot\",\n      \"bytes\": 6761,\n      \"lines\": 139\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/06-srsim-sar.robot\",\n      \"bytes\": 1499,\n      \"lines\": 41\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/07-srsim-with-mgmt-network.robot\",\n      \"bytes\": 2497,\n      \"lines\": 60\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/08-srsim-comp-cfg-test.robot\",\n      \"bytes\": 7029,\n      \"lines\": 135\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/09-srsim-pause-container.robot\",\n      \"bytes\": 7632,\n      \"lines\": 166\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/10-srsim-lifecycle.robot\",\n      \"bytes\": 4003,\n      \"lines\": 86\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/12-srsim-veth-stitch.robot\",\n      \"bytes\": 4048,\n      \"lines\": 106\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/13-srsim-integrated.clab.yml\",\n      \"bytes\": 702,\n      \"lines\": 33\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/13-srsim-integrated.robot\",\n      \"bytes\": 4891,\n      \"lines\": 105\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/14-srsim-new-chassis.clab.yml\",\n      \"bytes\": 1729,\n      \"lines\": 53\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/13-srsim/14-srsim-new-chassis.robot\",\n      \"bytes\": 3552,\n      \"lines\": 83\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"tests/srsim.robot\",\n      \"bytes\": 631,\n      \"lines\": 20\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"utils/sros_schema_gen.sh\",\n      \"bytes\": 1178,\n      \"lines\": 26\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/completion.md\",\n      \"bytes\": 2336,\n      \"lines\": 95\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/deploy.md\",\n      \"bytes\": 31381,\n      \"lines\": 565\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/destroy.md\",\n      \"bytes\": 3397,\n      \"lines\": 98\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/events.md\",\n      \"bytes\": 5990,\n      \"lines\": 89\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/exec.md\",\n      \"bytes\": 7316,\n      \"lines\": 177\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/generate.md\",\n      \"bytes\": 6005,\n      \"lines\": 138\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/graph.md\",\n      \"bytes\": 7858,\n      \"lines\": 188\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/inspect/index.md\",\n      \"bytes\": 10896,\n      \"lines\": 179\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/inspect/interfaces.md\",\n      \"bytes\": 11201,\n      \"lines\": 197\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/redeploy.md\",\n      \"bytes\": 6085,\n      \"lines\": 150\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/restart.md\",\n      \"bytes\": 1432,\n      \"lines\": 64\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/save.md\",\n      \"bytes\": 6445,\n      \"lines\": 133\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/start.md\",\n      \"bytes\": 2251,\n      \"lines\": 76\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/stop.md\",\n      \"bytes\": 1313,\n      \"lines\": 62\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/api-server/start.md\",\n      \"bytes\": 5581,\n      \"lines\": 165\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/api-server/status.md\",\n      \"bytes\": 4223,\n      \"lines\": 105\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/api-server/stop.md\",\n      \"bytes\": 1836,\n      \"lines\": 56\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/cert/ca/create.md\",\n      \"bytes\": 2206,\n      \"lines\": 77\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/cert/sign.md\",\n      \"bytes\": 2428,\n      \"lines\": 79\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/disable-tx-offload.md\",\n      \"bytes\": 982,\n      \"lines\": 25\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/gotty/attach.md\",\n      \"bytes\": 1904,\n      \"lines\": 67\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/gotty/detach.md\",\n      \"bytes\": 627,\n      \"lines\": 29\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/gotty/list.md\",\n      \"bytes\": 1070,\n      \"lines\": 46\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/gotty/reattach.md\",\n      \"bytes\": 955,\n      \"lines\": 26\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/netem/reset.md\",\n      \"bytes\": 1635,\n      \"lines\": 63\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/netem/set.md\",\n      \"bytes\": 3979,\n      \"lines\": 114\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/netem/show.md\",\n      \"bytes\": 3651,\n      \"lines\": 150\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/snapshot/save.md\",\n      \"bytes\": 1647,\n      \"lines\": 75\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/sshx/attach.md\",\n      \"bytes\": 5194,\n      \"lines\": 128\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/sshx/detach.md\",\n      \"bytes\": 1837,\n      \"lines\": 46\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/sshx/list.md\",\n      \"bytes\": 3662,\n      \"lines\": 77\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/sshx/reattach.md\",\n      \"bytes\": 4593,\n      \"lines\": 101\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/veth/create.md\",\n      \"bytes\": 1890,\n      \"lines\": 51\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/vxlan/create.md\",\n      \"bytes\": 3355,\n      \"lines\": 73\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/tools/vxlan/delete.md\",\n      \"bytes\": 1230,\n      \"lines\": 31\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/validate.md\",\n      \"bytes\": 1785,\n      \"lines\": 51\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/version/check.md\",\n      \"bytes\": 537,\n      \"lines\": 21\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/cmd/version/index.md\",\n      \"bytes\": 1011,\n      \"lines\": 37\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/CNAME\",\n      \"bytes\": 16,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/community.md\",\n      \"bytes\": 26611,\n      \"lines\": 360\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/htmltest-pr.yml\",\n      \"bytes\": 678,\n      \"lines\": 14\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/htmltest-w-github.yml\",\n      \"bytes\": 1679,\n      \"lines\": 31\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/htmltest.yml\",\n      \"bytes\": 2429,\n      \"lines\": 49\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/clabnew.svg\",\n      \"bytes\": 16299,\n      \"lines\": 13\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/coloured_wordmark.svg\",\n      \"bytes\": 8031,\n      \"lines\": 91\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/containerlab_dark_no_text.svg\",\n      \"bytes\": 3589,\n      \"lines\": 8\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/containerlab_export.svg\",\n      \"bytes\": 8893,\n      \"lines\": 33\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/containerlab_full_white_no_text.svg\",\n      \"bytes\": 3801,\n      \"lines\": 8\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/containerlab_white_no_text.svg\",\n      \"bytes\": 3293,\n      \"lines\": 8\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/containerlab-animated-wordmark.svg\",\n      \"bytes\": 70018,\n      \"lines\": 52\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/favicon.svg\",\n      \"bytes\": 16378,\n      \"lines\": 20\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/flask.svg\",\n      \"bytes\": 378,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/gui/browser-sandbox-placeholder.svg\",\n      \"bytes\": 2220,\n      \"lines\": 25\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/topoviewer-icons/client.svg\",\n      \"bytes\": 633,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/topoviewer-icons/controller.svg\",\n      \"bytes\": 768,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/topoviewer-icons/dcgw.svg\",\n      \"bytes\": 1015,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/topoviewer-icons/pon.svg\",\n      \"bytes\": 553,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/topoviewer-icons/rgw.svg\",\n      \"bytes\": 983,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/topoviewer-icons/router.svg\",\n      \"bytes\": 864,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/topoviewer-icons/server.svg\",\n      \"bytes\": 744,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/topoviewer-icons/spine.svg\",\n      \"bytes\": 940,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/images/topoviewer-icons/switch.svg\",\n      \"bytes\": 803,\n      \"lines\": 1\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/index.md\",\n      \"bytes\": 6778,\n      \"lines\": 189\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/install.md\",\n      \"bytes\": 17575,\n      \"lines\": 505\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/javascripts/instant-reinit.js\",\n      \"bytes\": 2040,\n      \"lines\": 45\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/asav01.md\",\n      \"bytes\": 4137,\n      \"lines\": 90\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/bgp-vpls-nok-jun.md\",\n      \"bytes\": 3374,\n      \"lines\": 34\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/cisco_iol.md\",\n      \"bytes\": 4368,\n      \"lines\": 100\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/cvx01.md\",\n      \"bytes\": 2989,\n      \"lines\": 48\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/cvx02.md\",\n      \"bytes\": 2990,\n      \"lines\": 49\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/ext-bridge.md\",\n      \"bytes\": 2042,\n      \"lines\": 31\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/f5bigipve01.md\",\n      \"bytes\": 4956,\n      \"lines\": 118\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/freebsd01.md\",\n      \"bytes\": 3571,\n      \"lines\": 76\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/frr01.md\",\n      \"bytes\": 2987,\n      \"lines\": 64\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/ftdv01.md\",\n      \"bytes\": 4108,\n      \"lines\": 75\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/generic_vm01.md\",\n      \"bytes\": 3201,\n      \"lines\": 66\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/ixiacone-srl.md\",\n      \"bytes\": 6827,\n      \"lines\": 135\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/lab-examples.md\",\n      \"bytes\": 4334,\n      \"lines\": 80\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/min-5clos.md\",\n      \"bytes\": 9340,\n      \"lines\": 127\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/min-clos.md\",\n      \"bytes\": 1970,\n      \"lines\": 26\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/multinode.md\",\n      \"bytes\": 14610,\n      \"lines\": 264\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/openbsd01.md\",\n      \"bytes\": 3615,\n      \"lines\": 76\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/ost-srl.md\",\n      \"bytes\": 6005,\n      \"lines\": 114\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/osvbng01.md\",\n      \"bytes\": 3109,\n      \"lines\": 71\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/peering-lab.md\",\n      \"bytes\": 23285,\n      \"lines\": 391\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/rare-freertr.md\",\n      \"bytes\": 1848,\n      \"lines\": 31\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/single-srl.md\",\n      \"bytes\": 2261,\n      \"lines\": 32\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/sr-sim.md\",\n      \"bytes\": 3766,\n      \"lines\": 64\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/srl-arcos.md\",\n      \"bytes\": 2871,\n      \"lines\": 52\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/srl-ceos.md\",\n      \"bytes\": 8462,\n      \"lines\": 211\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/srl-cjunosevolved.md\",\n      \"bytes\": 2674,\n      \"lines\": 43\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/srl-crpd.md\",\n      \"bytes\": 9443,\n      \"lines\": 181\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/srl-frr.md\",\n      \"bytes\": 3163,\n      \"lines\": 33\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/srl-sonic.md\",\n      \"bytes\": 9521,\n      \"lines\": 193\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/srl-vjunos-switch.md\",\n      \"bytes\": 1886,\n      \"lines\": 24\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/srl-vjunosevolved.md\",\n      \"bytes\": 1891,\n      \"lines\": 24\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/srl-xrd.md\",\n      \"bytes\": 2877,\n      \"lines\": 49\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/templated01.md\",\n      \"bytes\": 2516,\n      \"lines\": 56\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/templated02.md\",\n      \"bytes\": 2792,\n      \"lines\": 68\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/two-srls.md\",\n      \"bytes\": 3098,\n      \"lines\": 47\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/vr-sros.md\",\n      \"bytes\": 2506,\n      \"lines\": 28\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/vr-vmx.md\",\n      \"bytes\": 2523,\n      \"lines\": 30\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/vr-xrv.md\",\n      \"bytes\": 2419,\n      \"lines\": 27\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/vr-xrv9k.md\",\n      \"bytes\": 2441,\n      \"lines\": 27\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/vsrx01.md\",\n      \"bytes\": 4497,\n      \"lines\": 90\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/lab-examples/wan.md\",\n      \"bytes\": 1820,\n      \"lines\": 24\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/macos.md\",\n      \"bytes\": 17237,\n      \"lines\": 251\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/api-server.md\",\n      \"bytes\": 7871,\n      \"lines\": 223\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/cert.md\",\n      \"bytes\": 3472,\n      \"lines\": 59\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/clabernetes/index.md\",\n      \"bytes\": 990,\n      \"lines\": 18\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/clabernetes/runtime.md\",\n      \"bytes\": 34317,\n      \"lines\": 888\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/codespaces.md\",\n      \"bytes\": 20644,\n      \"lines\": 318\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/conf-artifacts.md\",\n      \"bytes\": 3196,\n      \"lines\": 54\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/config-mgmt.md\",\n      \"bytes\": 12920,\n      \"lines\": 311\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/dev/debug.md\",\n      \"bytes\": 5255,\n      \"lines\": 133\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/dev/doc.md\",\n      \"bytes\": 4366,\n      \"lines\": 55\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/dev/index.md\",\n      \"bytes\": 1170,\n      \"lines\": 21\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/dev/test.md\",\n      \"bytes\": 4069,\n      \"lines\": 100\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/gui/desktop.md\",\n      \"bytes\": 5381,\n      \"lines\": 130\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/gui/index.md\",\n      \"bytes\": 16398,\n      \"lines\": 314\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/gui/vsc-extension.md\",\n      \"bytes\": 9060,\n      \"lines\": 202\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/gui/web.md\",\n      \"bytes\": 6617,\n      \"lines\": 178\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/images.md\",\n      \"bytes\": 5119,\n      \"lines\": 108\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/impairments.md\",\n      \"bytes\": 881,\n      \"lines\": 20\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/inventory.md\",\n      \"bytes\": 11726,\n      \"lines\": 398\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/6wind_vsr.md\",\n      \"bytes\": 9464,\n      \"lines\": 208\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/arrcus_arcos.md\",\n      \"bytes\": 4185,\n      \"lines\": 134\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/bridge.md\",\n      \"bytes\": 5527,\n      \"lines\": 123\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/c8000.md\",\n      \"bytes\": 5477,\n      \"lines\": 151\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/ceos.md\",\n      \"bytes\": 22395,\n      \"lines\": 548\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/checkpoint_cloudguard.md\",\n      \"bytes\": 2694,\n      \"lines\": 60\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/ciena_saos.md\",\n      \"bytes\": 8268,\n      \"lines\": 244\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/cisco_asav.md\",\n      \"bytes\": 4142,\n      \"lines\": 95\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/cisco_iol.md\",\n      \"bytes\": 11889,\n      \"lines\": 269\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/cisco_sdwan.md\",\n      \"bytes\": 6415,\n      \"lines\": 280\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/cisco_vios.md\",\n      \"bytes\": 3734,\n      \"lines\": 95\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/cisco_xrd_vrouter.md\",\n      \"bytes\": 5916,\n      \"lines\": 139\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/cjunosevolved.md\",\n      \"bytes\": 7017,\n      \"lines\": 150\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/crpd.md\",\n      \"bytes\": 8048,\n      \"lines\": 191\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/csrx.md\",\n      \"bytes\": 6460,\n      \"lines\": 176\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/dell_sonic.md\",\n      \"bytes\": 3154,\n      \"lines\": 95\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/ext-container.md\",\n      \"bytes\": 2729,\n      \"lines\": 64\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/f5_bigipve.md\",\n      \"bytes\": 8997,\n      \"lines\": 220\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/fdio_vpp.md\",\n      \"bytes\": 10759,\n      \"lines\": 225\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/fortinet_fortigate.md\",\n      \"bytes\": 3737,\n      \"lines\": 81\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/freebsd.md\",\n      \"bytes\": 4052,\n      \"lines\": 95\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/frr.md\",\n      \"bytes\": 7504,\n      \"lines\": 151\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/generic_vm.md\",\n      \"bytes\": 3133,\n      \"lines\": 87\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/host.md\",\n      \"bytes\": 1105,\n      \"lines\": 24\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/huawei_vrp.md\",\n      \"bytes\": 4188,\n      \"lines\": 88\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/index.md\",\n      \"bytes\": 8558,\n      \"lines\": 104\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/ipinfusion-ocnos.md\",\n      \"bytes\": 2248,\n      \"lines\": 54\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/k8s-kind.md\",\n      \"bytes\": 6322,\n      \"lines\": 141\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/keysight_ixia-c-one.md\",\n      \"bytes\": 3228,\n      \"lines\": 68\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/linux.md\",\n      \"bytes\": 2960,\n      \"lines\": 55\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/nvidia_cumulusvx.md\",\n      \"bytes\": 4019,\n      \"lines\": 106\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/openbsd.md\",\n      \"bytes\": 4034,\n      \"lines\": 95\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/openwrt.md\",\n      \"bytes\": 1725,\n      \"lines\": 37\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/ostinato.md\",\n      \"bytes\": 3594,\n      \"lines\": 95\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/ovs-bridge.md\",\n      \"bytes\": 1997,\n      \"lines\": 53\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/plvision_sonic.md\",\n      \"bytes\": 3542,\n      \"lines\": 84\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/rare-freertr.md\",\n      \"bytes\": 6044,\n      \"lines\": 170\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/sonic-vm.md\",\n      \"bytes\": 5902,\n      \"lines\": 145\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/sonic-vs.md\",\n      \"bytes\": 3737,\n      \"lines\": 78\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/spirent_stc.md\",\n      \"bytes\": 3762,\n      \"lines\": 116\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/srl.md\",\n      \"bytes\": 25640,\n      \"lines\": 577\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/veesix_osvbng.md\",\n      \"bytes\": 3889,\n      \"lines\": 124\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-aoscx.md\",\n      \"bytes\": 3329,\n      \"lines\": 73\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-c8000v.md\",\n      \"bytes\": 6882,\n      \"lines\": 188\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-cat9kv.md\",\n      \"bytes\": 6835,\n      \"lines\": 170\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-csr.md\",\n      \"bytes\": 4119,\n      \"lines\": 86\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-ftdv.md\",\n      \"bytes\": 3343,\n      \"lines\": 79\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-ftosv.md\",\n      \"bytes\": 3557,\n      \"lines\": 79\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-n9kv.md\",\n      \"bytes\": 4790,\n      \"lines\": 123\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-pan.md\",\n      \"bytes\": 3372,\n      \"lines\": 86\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-ros.md\",\n      \"bytes\": 3912,\n      \"lines\": 83\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-sros.md\",\n      \"bytes\": 22067,\n      \"lines\": 505\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-veos.md\",\n      \"bytes\": 4126,\n      \"lines\": 94\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-vjunosevolved.md\",\n      \"bytes\": 5141,\n      \"lines\": 107\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-vjunosrouter.md\",\n      \"bytes\": 5140,\n      \"lines\": 103\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-vjunosswitch.md\",\n      \"bytes\": 5110,\n      \"lines\": 108\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-vmx.md\",\n      \"bytes\": 5371,\n      \"lines\": 121\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-vqfx.md\",\n      \"bytes\": 4053,\n      \"lines\": 90\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-vsrx.md\",\n      \"bytes\": 4053,\n      \"lines\": 89\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-xrv.md\",\n      \"bytes\": 4029,\n      \"lines\": 100\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vr-xrv9k.md\",\n      \"bytes\": 5157,\n      \"lines\": 120\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/vyosnetworks_vyos.md\",\n      \"bytes\": 6643,\n      \"lines\": 187\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/kinds/xrd.md\",\n      \"bytes\": 7951,\n      \"lines\": 177\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/multi-node.md\",\n      \"bytes\": 6089,\n      \"lines\": 72\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/network.md\",\n      \"bytes\": 40210,\n      \"lines\": 835\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/node-filtering.md\",\n      \"bytes\": 3517,\n      \"lines\": 66\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/nodes.md\",\n      \"bytes\": 44445,\n      \"lines\": 1205\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/s3-usage-example.md\",\n      \"bytes\": 1446,\n      \"lines\": 61\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/share-access.md\",\n      \"bytes\": 8219,\n      \"lines\": 150\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/topo-def-file.md\",\n      \"bytes\": 37253,\n      \"lines\": 903\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/vrnetlab.md\",\n      \"bytes\": 30525,\n      \"lines\": 270\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/manual/wireshark.md\",\n      \"bytes\": 16256,\n      \"lines\": 326\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/quickstart.md\",\n      \"bytes\": 10387,\n      \"lines\": 207\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.11.0.md\",\n      \"bytes\": 5330,\n      \"lines\": 71\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.12.0.md\",\n      \"bytes\": 4928,\n      \"lines\": 75\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.13.0.md\",\n      \"bytes\": 1772,\n      \"lines\": 30\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.14.0.md\",\n      \"bytes\": 2612,\n      \"lines\": 35\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.14.1.md\",\n      \"bytes\": 177,\n      \"lines\": 5\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.14.2.md\",\n      \"bytes\": 301,\n      \"lines\": 5\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.14.3.md\",\n      \"bytes\": 317,\n      \"lines\": 9\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.14.4.md\",\n      \"bytes\": 286,\n      \"lines\": 9\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.15.md\",\n      \"bytes\": 3827,\n      \"lines\": 69\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.16.md\",\n      \"bytes\": 3480,\n      \"lines\": 65\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.17.md\",\n      \"bytes\": 3356,\n      \"lines\": 41\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.18.md\",\n      \"bytes\": 1527,\n      \"lines\": 34\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.19.md\",\n      \"bytes\": 2470,\n      \"lines\": 48\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.20.md\",\n      \"bytes\": 2146,\n      \"lines\": 33\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.21.md\",\n      \"bytes\": 2459,\n      \"lines\": 48\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.22.md\",\n      \"bytes\": 1806,\n      \"lines\": 27\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.23.md\",\n      \"bytes\": 1835,\n      \"lines\": 35\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.24.md\",\n      \"bytes\": 3490,\n      \"lines\": 51\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.25.md\",\n      \"bytes\": 2105,\n      \"lines\": 37\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.26.md\",\n      \"bytes\": 5078,\n      \"lines\": 88\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.27.md\",\n      \"bytes\": 947,\n      \"lines\": 21\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.28.md\",\n      \"bytes\": 1382,\n      \"lines\": 32\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.29.md\",\n      \"bytes\": 750,\n      \"lines\": 13\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.30.md\",\n      \"bytes\": 566,\n      \"lines\": 14\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.31.md\",\n      \"bytes\": 1710,\n      \"lines\": 30\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.32.md\",\n      \"bytes\": 2075,\n      \"lines\": 45\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.33.md\",\n      \"bytes\": 893,\n      \"lines\": 22\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.34.md\",\n      \"bytes\": 1019,\n      \"lines\": 23\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.35.md\",\n      \"bytes\": 876,\n      \"lines\": 29\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.36.md\",\n      \"bytes\": 868,\n      \"lines\": 23\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.37.md\",\n      \"bytes\": 1990,\n      \"lines\": 38\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.38.md\",\n      \"bytes\": 881,\n      \"lines\": 18\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.39.md\",\n      \"bytes\": 3693,\n      \"lines\": 101\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.40.md\",\n      \"bytes\": 732,\n      \"lines\": 15\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.41.md\",\n      \"bytes\": 4520,\n      \"lines\": 88\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.42.md\",\n      \"bytes\": 955,\n      \"lines\": 15\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.43.md\",\n      \"bytes\": 3478,\n      \"lines\": 90\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.44.md\",\n      \"bytes\": 2213,\n      \"lines\": 54\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.45.md\",\n      \"bytes\": 1807,\n      \"lines\": 32\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.46.md\",\n      \"bytes\": 3260,\n      \"lines\": 98\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.47.md\",\n      \"bytes\": 2333,\n      \"lines\": 46\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.48.md\",\n      \"bytes\": 4072,\n      \"lines\": 75\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.49.md\",\n      \"bytes\": 1541,\n      \"lines\": 30\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.50.md\",\n      \"bytes\": 3606,\n      \"lines\": 54\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.51.md\",\n      \"bytes\": 2871,\n      \"lines\": 68\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.52.md\",\n      \"bytes\": 3179,\n      \"lines\": 65\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.53.md\",\n      \"bytes\": 1282,\n      \"lines\": 27\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.54.md\",\n      \"bytes\": 942,\n      \"lines\": 26\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.55.md\",\n      \"bytes\": 3026,\n      \"lines\": 77\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.56.md\",\n      \"bytes\": 2575,\n      \"lines\": 46\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.57.md\",\n      \"bytes\": 2466,\n      \"lines\": 56\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.58.md\",\n      \"bytes\": 1868,\n      \"lines\": 30\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.59.md\",\n      \"bytes\": 1494,\n      \"lines\": 34\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.60.md\",\n      \"bytes\": 10022,\n      \"lines\": 135\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.61.md\",\n      \"bytes\": 2588,\n      \"lines\": 45\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.62.md\",\n      \"bytes\": 2915,\n      \"lines\": 54\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.63.md\",\n      \"bytes\": 2182,\n      \"lines\": 46\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.64.md\",\n      \"bytes\": 5000,\n      \"lines\": 45\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.65.md\",\n      \"bytes\": 1622,\n      \"lines\": 41\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.66.md\",\n      \"bytes\": 897,\n      \"lines\": 21\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.67.md\",\n      \"bytes\": 1394,\n      \"lines\": 23\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.68.md\",\n      \"bytes\": 2604,\n      \"lines\": 40\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.69.md\",\n      \"bytes\": 5732,\n      \"lines\": 117\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.70.md\",\n      \"bytes\": 3389,\n      \"lines\": 64\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.71.md\",\n      \"bytes\": 5144,\n      \"lines\": 120\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.72.md\",\n      \"bytes\": 3663,\n      \"lines\": 62\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.73.md\",\n      \"bytes\": 6239,\n      \"lines\": 96\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.74.md\",\n      \"bytes\": 6031,\n      \"lines\": 94\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.75.md\",\n      \"bytes\": 5768,\n      \"lines\": 78\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.76.md\",\n      \"bytes\": 4557,\n      \"lines\": 69\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.77.md\",\n      \"bytes\": 3761,\n      \"lines\": 71\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.78.md\",\n      \"bytes\": 5580,\n      \"lines\": 118\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.79.md\",\n      \"bytes\": 3853,\n      \"lines\": 96\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.80.md\",\n      \"bytes\": 15226,\n      \"lines\": 280\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/rn/0.81.md\",\n      \"bytes\": 5387,\n      \"lines\": 98\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/stylesheets/extra.css\",\n      \"bytes\": 19354,\n      \"lines\": 750\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \"docs/windows.md\",\n      \"bytes\": 10218,\n      \"lines\": 225\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \".cursor/rules/git-mutations.mdc\",\n      \"bytes\": 403,\n      \"lines\": 10\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \".cursor/rules/karpathy-guidelines.mdc\",\n      \"bytes\": 2643,\n      \"lines\": 75\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \".cursor/rules/ponytail.mdc\",\n      \"bytes\": 2620,\n      \"lines\": 36\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \".cursor/rules/release-note-review.mdc\",\n      \"bytes\": 472,\n      \"lines\": 12\n    },\n    {\n      \"revision\": \"head\",\n      \"path\": \".cursor/skills/refresh-nix-vendor-hash/SKILL.md\",\n      \"bytes\": 2916,\n      \"lines\": 89\n    },\n    {\n      \"revision\": \"head\",",
        "lineStart": 1,
        "lineEnd": 2000,
        "totalLines": 15645,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346648199,
      "end": 1792346648252
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502f6ec1001rO35e7dfrprY6g",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502f69070017hU0PHIctAauDc",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 5737,
    "input": 5678,
    "output": 40,
    "reasoning": 19,
    "cache": {
      "read": 0,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502f69070017hU0PHIctAauDc",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346646791,
    "completed": 1792346648263
  },
  "parentID": "msg_1502f68f300142aYYM85hGexse",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 5737,
    "input": 5678,
    "output": 40,
    "reasoning": 19,
    "cache": {
      "read": 0,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 26
step-start
{
  "type": "step-start",
  "id": "prt_1502f7b86001NSyWblT1JHx8lW",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502f6ed20012wjmJePhaOJviv"
}
Reasoning
I've now read diff lines 2548-3940. Remaining diff: from 3941 to end. The diff was ~how long? Earlier we noted ~3547+ lines, but actually it's longer — we're at 3940 and still in sros_schema_gen.sh hunk. Let me read the remainder from 3941.

Also note manifest lists 31 changed paths (matches). The manifest "files" list includes many unrelated docs files (that's the full head file listing, not changed files).

Read diff.txt from 3941 to end.
I've finished the sros_test.go, schema, robot-test, and new-lab hunks. Let me read the remainder of the diff (the `sros_schema_gen.sh` hunk tail and anything after it).
read · completed

Input

{
  "filePath": "/source/diff.txt",
  "limit": 1400,
  "offset": 3941
}

Output

<path>/source/diff.txt</path>
<type>file</type>
<content>
3941:    ($c | [.[].xiom // [] | .[]]) as $xioms |
3942:  
3943:    .definitions["sros-cpm-types"].enum |= (. + $cpms | unique | sort) |
3944:    .definitions["sros-card-types"].enum |= (. + $cards | unique | sort) |
3945:    .definitions["sros-sfm-types"].enum |= (. + $sfms | unique | sort) |

(End of file - total 3945 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502f8169001YUmrRf0Z3P2Ias",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502f6ed20012wjmJePhaOJviv",
  "callID": "call_94650f5c9a8c4eaeb6626227",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/diff.txt",
      "limit": 1400,
      "offset": 3941
    },
    "output": "<path>/source/diff.txt</path>\n<type>file</type>\n<content>\n3941:    ($c | [.[].xiom // [] | .[]]) as $xioms |\n3942:  \n3943:    .definitions[\"sros-cpm-types\"].enum |= (. + $cpms | unique | sort) |\n3944:    .definitions[\"sros-card-types\"].enum |= (. + $cards | unique | sort) |\n3945:    .definitions[\"sros-sfm-types\"].enum |= (. + $sfms | unique | sort) |\n\n(End of file - total 3945 lines)\n</content>",
    "title": "source/diff.txt",
    "metadata": {
      "preview": "   ($c | [.[].xiom // [] | .[]]) as $xioms |\n \n   .definitions[\"sros-cpm-types\"].enum |= (. + $cpms | unique | sort) |\n   .definitions[\"sros-card-types\"].enum |= (. + $cards | unique | sort) |\n   .definitions[\"sros-sfm-types\"].enum |= (. + $sfms | unique | sort) |",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/diff.txt",
        "text": "   ($c | [.[].xiom // [] | .[]]) as $xioms |\n \n   .definitions[\"sros-cpm-types\"].enum |= (. + $cpms | unique | sort) |\n   .definitions[\"sros-card-types\"].enum |= (. + $cards | unique | sort) |\n   .definitions[\"sros-sfm-types\"].enum |= (. + $sfms | unique | sort) |",
        "lineStart": 3941,
        "lineEnd": 3945,
        "totalLines": 3945,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346653037,
      "end": 1792346653050
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502f818d001TfdPxiULNX4ZMu",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502f6ed20012wjmJePhaOJviv",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 47689,
    "input": 44674,
    "output": 74,
    "reasoning": 125,
    "cache": {
      "read": 2816,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502f6ed20012wjmJePhaOJviv",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346648274,
    "completed": 1792346653073
  },
  "parentID": "msg_1502f68f300142aYYM85hGexse",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 47689,
    "input": 44674,
    "output": 74,
    "reasoning": 125,
    "cache": {
      "read": 2816,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 27
step-start
{
  "type": "step-start",
  "id": "prt_1502f8926001gzpO3GFRZsa5RO",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502f8199001mYbsJMmihu9cms"
}
Reasoning
The diff ends at 3945. So the sros_schema_gen.sh hunk is complete (the diff ends mid-jq script? Let's check: the hunk shows lines ending with `.definitions["sros-sfm-types"].enum |= (. + $sfms | unique | sort) |` — that's line 3945 end of file. The hunk header said `@@ -4,15 +4,18 @@` so the +18 lines includes more lines presumably. But the diff file ends here — meaning the diff output was truncated at generation time, OR the hunk actually continues but the diff.txt is the complete diff and it just ends. Wait, the hunk header says the new file spans to line ~21 (4+18-1=21) but head file sros_schema_gen.sh has 26 lines. The diff might have more lines but diff.txt ends at 3945. Hmm, that suggests diff.txt is truncated mid-hunk. That's possible — the diff provider may have capped it. Actually manifest says sros_schema_gen.sh has 26 lines in head. The diff hunk @@ -4,15 +4,18 @@ covers new lines 4-21. Remaining new lines 22-26 are unchanged context that wouldn't be in the hunk... Actually a hunk includes trailing context; if the hunk ends at line 21 of new file and file has 26 lines, the last context lines (22-26) would appear in the hunk. But diff.txt ends abruptly at 3945 with `|` — no trailing context shown. This suggests diff.txt is truncated at the end (capped at some size, e.g., 50KB per read? No, we read it). Hmm, the diff might just be truncated at the source. But wait — the hunk's final shown line is `.definitions["sros-sfm-types"].enum |= (. + $sfms | unique | sort) |`. Let me check the head file itself to see if the diff is complete.

Actually, it doesn't matter hugely: the missing tail is probably the mda-types enum update line. The key change: `$mdas` now includes `fixed_mdas` values, and presumably `.definitions["sros-mda-types"].enum |= ...` line follows. Let me read the head file `utils/sros_schema_gen.sh` to see the full new script.

Also, note the jq change: `$c` is now built by filtering the full chassis_info.json entries to those whose keys are in the node_types enum. Previously `.[0] as $c` took the entire chassis_info.json. Now it filters to known node types. That's a behavioral change in schema generation. Interesting: it filters to entries whose key is in the sros node types enum list. This could silently drop new chassis types if not added to the schema enum — but the schema enum is also generated from the same script... wait no: the node_types enum is extracted FROM the schema itself (`.[1]` is the schema? Actually `.[1]` — with `-s` slurp, `.[0]` is chassis_info.json, `.[1]` is the schema. So `$node_types` = the enum from schema containing "ixr-e2n". Then $c filters chassis info entries to those already in the schema's node-type enum. Hmm, that means new chassis types (like sar-10x, ixr-e3, ixr-e2sc) must have been added to the schema enum first (they were — in the schema diff above). OK.

Wait, but why filter at all? Previously all entries in chassis_info.json contributed cpm/card/sfm/mda enums. Now only entries whose key is a known node type. This might be to exclude non-node-type keys in chassis_info.json? Whatever — it's a generator script change.

One subtle issue: `with_entries(select((.key | ascii_downcase) as $key | $node_types | index($key)))` — if the schema enum has entries like "sr-1" etc. Fine.

But there's a potential problem: `$node_types` is `([.. | objects | select(.enum? and (.enum | index("ixr-e2n"))) | .enum][0])` — takes the FIRST object in the schema containing an enum with "ixr-e2n". That's presumably the node-type enum for nokia_srsim (or sros). But there might be multiple enums containing "ixr-e2n" — e.g., the sros node-types enum (vr-sros kind?) also includes ixr types? Actually the enum at line 939-953 area of schema (definitions for sros node types). If vr-sros kinds also list ixr-e2n... the first match in document order is used. Fine for generation.

Hmm wait — actually one important check: does `.[1]` refer to the schema? The script: `jq --indent 4 -s '...' $CHASSIS_INFO_FILE $SCHEMA` presumably (args not shown in hunk). Yes.

Now, is there an issue with the filter: chassis_info.json entries with keys not in the node-type enum will no longer contribute their cpm/card/mda types to the schema enums. If a chassis type exists in chassis_info.json but isn't a valid node type... e.g., aliases? The `chassisInfo.entry()` supports aliases (head notes mention alias support). If chassis_info.json has alias entries (e.g., "ixr-e2n-s" alias?) those keys might not be in schema enum, so their components wouldn't be added to schema enums. But if the alias maps to same components as canonical entries, no loss. Can't verify fully without chassis_info.json content — it's not in the repo (it's downloaded? CHASSIS_INFO_FILE=chassis_info.json in utils dir; maybe gitignored/generated). Coverage note.

Also `fixed_mdas` added to $mdas — new field in chassis_info.json.

Now let me verify remaining things:

1. Read `utils/sros_schema_gen.sh` head fully (26 lines) to see full script.
2. Check docs changes: docs/manual/kinds/sros.md diff hunk — I haven't seen the docs hunks! Wait, the diff should have included docs/manual/kinds/sros.md and nodes/sros/README.md hunks. Did I see them? In segments 1-1200 and 1201-2500 I saw workflow, and various Go files. Hmm — did the diff include docs hunks? The manifest lists them as changed. The diff is ordered alphabetically: .github/workflows/srsim-tests.yml, docs/manual/kinds/sros.md, nodes/sros/*, schemas, tests, utils. I saw workflow hunks in 1-1200; then presumably docs hunks; then nodes/sros. I should verify I actually saw the docs hunk. From my earlier summary, I don't recall reading docs/manual/kinds/sros.md hunks. Let me grep the diff for "diff --git" lines to enumerate all file hunks and their line numbers.

3. Also verify the schema diff hunk coverage: hunks at 3004 (node types), 3017 (cpm-ixr-e2n-s etc. — two hunks: sros-mda? Actually 3029 is another hunk "cpm-types"), 3044 (sros-cpm-types enum), 3056 (another cpm enum — vr-sros?), 3085 (mda types), 3111 (mda types continued). Fine.

4. New test files use `${26_10_TESTS}` variable — Robot variable names can't start with digit? Actually Robot Framework supports `${26_10_TESTS}`? Variable names must be valid identifiers; `${26_10_TESTS}` — Robot allows numbers? Robot Framework variables can contain digits; a name starting with a digit is allowed? In Robot, variable syntax is ${name} where name can be almost any text. It should work. Skip If usage fine.

Also 14-srsim-new-chassis.robot has Suite Setup Skip If ... with two-line continuation `... SR-SIM 26.10 is required; enable with --variable 26_10_TESTS:true`. Fine.

Note: in 14-srsim-new-chassis.robot, `Check chassis    sar-10x-a` — node names derived from node key `sar-10x` with two components (slot A and B) → component nodes named `sar-10x-a`/`sar-10x-b`? Wait, distributed base node sar-10x spawns component nodes with long names; the actual containers would be named like `clab-srsim-new-chassis-sar-10x-a`? The clab node names for CPM components are typically `sar-10x-a`? Hmm, in distributed mode the base node creates component containers named `<nodename>-a`? Actually in containerlab sros, for distributed nodes, component containers get longname suffixes like `-a1`? Not sure. In 03-sros-dist-to-linux.robot, address is `clab-${lab-name}-sros-a`. So CPM A container is named `sros-a`. So for sar-10x, containers `sar-10x-a` and `sar-10x-b` plausibly. OK.

But note: sar-10x has components slot A and B (CPMs) — but the test queries `/state/card[slot-number=1]` and `mda-slot=1..8` on node `clab-${lab-name}-sar-10x` (no -a suffix). Which container runs the config engine? For distributed, the base node `sar-10x` — does a container named `sar-10x` exist? In distributed mode, base node container... In 03-sros-dist test, they ssh to `clab-sr03-sros-a`, not `sros`. And 13-srsim-integrated tests gnmic against `clab-...-ixr-r6` (integrated redundant → but that's integrated with A+B components creating two component containers `ixr-r6-a`, `ixr-r6-b`? Hmm wait, ixr-r6 with components slot A/B — the test "redundant_integrated_components_are_distributed" says isDistributedBaseNode true. And 13-srsim-integrated.robot queries `clab-${lab-name}-ixr-r6` for /state/cpm[cpm-slot=A]. Hmm — the gnmic query targets `clab-...-ixr-r6` — is there a container named `ixr-r6` in distributed mode? Maybe yes: the netns base? Actually in srsim distributed mode, the base node may still be a real container? The earlier analysis said base node returns early in PreDeploy without files — but does it still create a container? I recall from sros.go that distributed base node doesn't start its own container (netns shared). Hmm, but the test queries gnmic address clab-srsim-integrated-ixr-r6 — that implies a container exists with that name (or DNS alias). Uncertain; can't verify without reading sros.go PreDeploy fully. This is runtime behavior — tests will reveal. I noted earlier "base node's PreDeploy sets preDeployParams then returns early (no files) for distributed base". Whether base container exists is a runtime question. The test presumably was run by the author. Skip.

Now key remaining checks:

A. Verify I saw the docs hunk (docs/manual/kinds/sros.md and nodes/sros/README.md). Let me grep diff.txt for "^diff --git".

B. Read head `utils/sros_schema_gen.sh` full.

C. Verify the end of diff wasn't truncated: check whether the sros_schema_gen.sh hunk includes the mda-types line. If diff.txt ends at `sros-sfm-types` line and the file hunk is complete per git format (would include trailing context lines of the script — the script continues with mda-types and xiom lines which ARE context shown at 3941... wait 3941-3945 are part of the hunk: those lines are context lines (no +/-). Actually lines 3941-3945 have no +/- prefix shown, they're context. The hunk `@@ -4,15 +4,18 @@`: old file lines 4-18, new lines 4-21. New file has 26 lines; context after line 21 would normally be included (up to 3 lines) — but lines shown at 3941-3945 are 5 context lines... Hmm, hard to reconcile exactly. Actually wait — maybe diff.txt is genuinely truncated (the provider may cap diff size). The manifest "changed" list shows all 31 paths, and the diff includes all of them (I should verify docs hunks appear). Let me grep.

Let me do: grep -n "diff --git" diff.txt, and read utils/sros_schema_gen.sh.
The diff ends at line 3945 — I need to confirm it wasn't truncated (the `sros_schema_gen.sh` hunk header suggests more lines) and enumerate all file hunks to make sure I've seen the docs and README hunks.
grep · completed

Input

{
  "pattern": "^diff --git",
  "path": "/source/diff.txt"
}

Output

Found 31 matches
/source/diff.txt:
  Line 1: diff --git a/.github/workflows/srsim-tests.yml b/.github/workflows/srsim-tests.yml

  Line 84: diff --git a/docs/manual/kinds/sros.md b/docs/manual/kinds/sros.md

  Line 130: diff --git a/nodes/sros/README.md b/nodes/sros/README.md

  Line 312: diff --git a/nodes/sros/chassis_info.go b/nodes/sros/chassis_info.go

  Line 538: diff --git a/nodes/sros/chassis_info_test.go b/nodes/sros/chassis_info_test.go

  Line 643: diff --git a/nodes/sros/component.go b/nodes/sros/component.go

  Line 852: diff --git a/nodes/sros/component_config.go b/nodes/sros/component_config.go

  Line 1128: diff --git a/nodes/sros/config.go b/nodes/sros/config.go

  Line 1471: diff --git a/nodes/sros/netns.go b/nodes/sros/netns.go

  Line 1568: diff --git a/nodes/sros/power.go b/nodes/sros/power.go

  Line 1588: diff --git a/nodes/sros/sros.go b/nodes/sros/sros.go

  Line 2548: diff --git a/nodes/sros/sros_test.go b/nodes/sros/sros_test.go

  Line 2882: diff --git a/nodes/sros/template.go b/nodes/sros/template.go

  Line 2952: diff --git a/nodes/sros/variant.go b/nodes/sros/variant.go

  Line 3000: diff --git a/schemas/clab.schema.json b/schemas/clab.schema.json

  Line 3123: diff --git a/tests/13-srsim/01-sros-to-linux.robot b/tests/13-srsim/01-sros-to-linux.robot

  Line 3164: diff --git a/tests/13-srsim/03-sros-dist-to-linux.robot b/tests/13-srsim/03-sros-dist-to-linux.robot

  Line 3218: diff --git a/tests/13-srsim/04-sros-classic.robot b/tests/13-srsim/04-sros-classic.robot

  Line 3259: diff --git a/tests/13-srsim/05-sros-comp-to-linux.robot b/tests/13-srsim/05-sros-comp-to-linux.robot

  Line 3300: diff --git a/tests/13-srsim/06-srsim-sar.robot b/tests/13-srsim/06-srsim-sar.robot

  Line 3352: diff --git a/tests/13-srsim/07-srsim-with-mgmt-network.robot b/tests/13-srsim/07-srsim-with-mgmt-network.robot

  Line 3407: diff --git a/tests/13-srsim/08-srsim-comp-cfg-test.robot b/tests/13-srsim/08-srsim-comp-cfg-test.robot

  Line 3456: diff --git a/tests/13-srsim/09-srsim-pause-container.robot b/tests/13-srsim/09-srsim-pause-container.robot

  Line 3504: diff --git a/tests/13-srsim/10-srsim-lifecycle.robot b/tests/13-srsim/10-srsim-lifecycle.robot

  Line 3548: diff --git a/tests/13-srsim/12-srsim-veth-stitch.robot b/tests/13-srsim/12-srsim-veth-stitch.robot

  Line 3597: diff --git a/tests/13-srsim/13-srsim-integrated.clab.yml b/tests/13-srsim/13-srsim-integrated.clab.yml

  Line 3636: diff --git a/tests/13-srsim/13-srsim-integrated.robot b/tests/13-srsim/13-srsim-integrated.robot

  Line 3747: diff --git a/tests/13-srsim/14-srsim-new-chassis.clab.yml b/tests/13-srsim/14-srsim-new-chassis.clab.yml

  Line 3806: diff --git a/tests/13-srsim/14-srsim-new-chassis.robot b/tests/13-srsim/14-srsim-new-chassis.robot

  Line 3895: diff --git a/tests/srsim.robot b/tests/srsim.robot

  Line 3921: diff --git a/utils/sros_schema_gen.sh b/utils/sros_schema_gen.sh
Tool metadata
{
  "type": "tool",
  "id": "prt_1502fe82f0015Z6YqM0bsGb2ET",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502f8199001mYbsJMmihu9cms",
  "callID": "call_3165f5475eee4a629d5f9cb1",
  "tool": "grep",
  "state": {
    "status": "completed",
    "input": {
      "pattern": "^diff --git",
      "path": "/source/diff.txt"
    },
    "output": "Found 31 matches\n/source/diff.txt:\n  Line 1: diff --git a/.github/workflows/srsim-tests.yml b/.github/workflows/srsim-tests.yml\n\n  Line 84: diff --git a/docs/manual/kinds/sros.md b/docs/manual/kinds/sros.md\n\n  Line 130: diff --git a/nodes/sros/README.md b/nodes/sros/README.md\n\n  Line 312: diff --git a/nodes/sros/chassis_info.go b/nodes/sros/chassis_info.go\n\n  Line 538: diff --git a/nodes/sros/chassis_info_test.go b/nodes/sros/chassis_info_test.go\n\n  Line 643: diff --git a/nodes/sros/component.go b/nodes/sros/component.go\n\n  Line 852: diff --git a/nodes/sros/component_config.go b/nodes/sros/component_config.go\n\n  Line 1128: diff --git a/nodes/sros/config.go b/nodes/sros/config.go\n\n  Line 1471: diff --git a/nodes/sros/netns.go b/nodes/sros/netns.go\n\n  Line 1568: diff --git a/nodes/sros/power.go b/nodes/sros/power.go\n\n  Line 1588: diff --git a/nodes/sros/sros.go b/nodes/sros/sros.go\n\n  Line 2548: diff --git a/nodes/sros/sros_test.go b/nodes/sros/sros_test.go\n\n  Line 2882: diff --git a/nodes/sros/template.go b/nodes/sros/template.go\n\n  Line 2952: diff --git a/nodes/sros/variant.go b/nodes/sros/variant.go\n\n  Line 3000: diff --git a/schemas/clab.schema.json b/schemas/clab.schema.json\n\n  Line 3123: diff --git a/tests/13-srsim/01-sros-to-linux.robot b/tests/13-srsim/01-sros-to-linux.robot\n\n  Line 3164: diff --git a/tests/13-srsim/03-sros-dist-to-linux.robot b/tests/13-srsim/03-sros-dist-to-linux.robot\n\n  Line 3218: diff --git a/tests/13-srsim/04-sros-classic.robot b/tests/13-srsim/04-sros-classic.robot\n\n  Line 3259: diff --git a/tests/13-srsim/05-sros-comp-to-linux.robot b/tests/13-srsim/05-sros-comp-to-linux.robot\n\n  Line 3300: diff --git a/tests/13-srsim/06-srsim-sar.robot b/tests/13-srsim/06-srsim-sar.robot\n\n  Line 3352: diff --git a/tests/13-srsim/07-srsim-with-mgmt-network.robot b/tests/13-srsim/07-srsim-with-mgmt-network.robot\n\n  Line 3407: diff --git a/tests/13-srsim/08-srsim-comp-cfg-test.robot b/tests/13-srsim/08-srsim-comp-cfg-test.robot\n\n  Line 3456: diff --git a/tests/13-srsim/09-srsim-pause-container.robot b/tests/13-srsim/09-srsim-pause-container.robot\n\n  Line 3504: diff --git a/tests/13-srsim/10-srsim-lifecycle.robot b/tests/13-srsim/10-srsim-lifecycle.robot\n\n  Line 3548: diff --git a/tests/13-srsim/12-srsim-veth-stitch.robot b/tests/13-srsim/12-srsim-veth-stitch.robot\n\n  Line 3597: diff --git a/tests/13-srsim/13-srsim-integrated.clab.yml b/tests/13-srsim/13-srsim-integrated.clab.yml\n\n  Line 3636: diff --git a/tests/13-srsim/13-srsim-integrated.robot b/tests/13-srsim/13-srsim-integrated.robot\n\n  Line 3747: diff --git a/tests/13-srsim/14-srsim-new-chassis.clab.yml b/tests/13-srsim/14-srsim-new-chassis.clab.yml\n\n  Line 3806: diff --git a/tests/13-srsim/14-srsim-new-chassis.robot b/tests/13-srsim/14-srsim-new-chassis.robot\n\n  Line 3895: diff --git a/tests/srsim.robot b/tests/srsim.robot\n\n  Line 3921: diff --git a/utils/sros_schema_gen.sh b/utils/sros_schema_gen.sh\n",
    "title": "^diff --git",
    "metadata": {
      "matches": 31,
      "truncated": false
    },
    "time": {
      "start": 1792346679349,
      "end": 1792346679388
    }
  }
}
read · error

Input

{
  "filePath": "/source/utils/sros_schema_gen.sh"
}

Output

File not found: /source/utils/sros_schema_gen.sh
Tool metadata
{
  "type": "tool",
  "id": "prt_1502fe8760014BqTn3fyFNhpWh",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502f8199001mYbsJMmihu9cms",
  "callID": "call_27055b10adcb41dcbc3cc6f2",
  "tool": "read",
  "state": {
    "status": "error",
    "input": {
      "filePath": "/source/utils/sros_schema_gen.sh"
    },
    "error": "File not found: /source/utils/sros_schema_gen.sh",
    "time": {
      "start": 1792346679419,
      "end": 1792346679433
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502fe88c0019xGPS1xoOuye40",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502f8199001mYbsJMmihu9cms",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 50698,
    "input": 219,
    "output": 90,
    "reasoning": 2773,
    "cache": {
      "read": 47616,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502f8199001mYbsJMmihu9cms",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346653081,
    "completed": 1792346679441
  },
  "parentID": "msg_1502f68f300142aYYM85hGexse",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 50698,
    "input": 219,
    "output": 90,
    "reasoning": 2773,
    "cache": {
      "read": 47616,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 28
step-start
{
  "type": "step-start",
  "id": "prt_1502ff16e0019PTl6ohMTnfLrr",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502fe89e0018QFygyY8f4Z4qk"
}
Reasoning
All 31 file hunks are present in diff.txt (31 `diff --git` matches = 31 changed paths). The diff is complete, not truncated.

The head file tree apparently doesn't contain all files individually — I can only read files that exist under /source. Let me check what's in /source to see available head files. The manifest lists many head files; maybe the snapshot only includes changed files plus some context. `utils/sros_schema_gen.sh` not found — so maybe the files directory only includes certain files. Let me glob /source/utils.
All 31 changed paths have hunks in `diff.txt`, so the diff is complete. The standalone head file for `utils/sros_schema_gen.sh` isn't in the snapshot, so I'll rely on the diff hunk. Let me check which head files are available and re-examine the remaining hunks I haven't fully verified: the docs hunks (lines 84–311) and the `sros_schema_gen.sh` tail in context.
glob · completed

Input

{
  "path": "/source",
  "pattern": "**/*"
}

Output

/source/standards/karpathy-guidelines.mdc
/source/standards/ponytail.mdc
/source/standards.json
/source/diff.txt
/source/head/schemas/clab.schema.json
/source/head/schemas/schema_test.go
/source/head/internal/mermaid/graph.go
/source/head/internal/slices/slices.go
/source/head/macros/main.py
/source/head/mkdocs.yml
/source/head/types/mgmt.go
/source/head/types/volume_test.go
/source/head/types/license_policy_value.go
/source/head/types/bind_test.go
/source/head/types/hostentry.go
/source/head/types/hostentry_test.go
/source/head/types/host_requirements.go
/source/head/types/types.go
/source/head/types/stages.go
/source/head/types/stages_test.go
/source/head/types/topo_paths.go
/source/head/types/bind.go
/source/head/types/settings.go
/source/head/types/topology_test.go
/source/head/types/topology.go
/source/head/types/topo_diff_test.go
/source/head/types/node_definition.go
/source/head/types/ipam.go
/source/head/types/topo_diff.go
/source/head/types/tailscale_ports_test.go
/source/head/types/node_definition_test.go
/source/head/types/volume.go
/source/head/types/ipversion.go
/source/head/types/mgmt_networks_test.go
/source/head/types/test_data/config.cfg
/source/head/types/test_data/lic1.key
/source/head/types/tailscale_ports.go
/source/head/types/ssh_config.go
/source/head/types/mgmt_test.go
/source/head/cmd/viper_test.go
/source/head/cmd/context.go
/source/head/cmd/tools_api_stop.go
/source/head/cmd/tools_vxlan.go
/source/head/cmd/version_test.go
/source/head/cmd/tools.go
/source/head/cmd/generate.go
/source/head/cmd/redeploy.go
/source/head/cmd/stop.go
/source/head/cmd/deploy_emit_test.go
/source/head/cmd/inspect.go
/source/head/cmd/tools_sshx.go
/source/head/cmd/events.go
/source/head/cmd/exec.go
/source/head/cmd/deploy_test.go
/source/head/cmd/graph.go
/source/head/cmd/inspect_interfaces.go
/source/head/cmd/tools_api_status.go
/source/head/cmd/tools_api.go
/source/head/cmd/tools_veth.go
/source/head/cmd/root_test.go
/source/head/cmd/version_manager.go
/source/head/cmd/completion.go
/source/head/cmd/redeploy_test.go
/source/head/cmd/assets/logo.txt
/source/head/cmd/generate_test.go
/source/head/cmd/validate.go
/source/head/cmd/viper.go
/source/head/cmd/save.go
/source/head/cmd/context_test.go
/source/head/cmd/tools_netem_test.go
/source/head/cmd/tools_veth_test.go
/source/head/cmd/root.go
/source/head/cmd/topo_select.go
/source/head/cmd/tools_snapshot.go
/source/head/cmd/destroy.go
/source/head/cmd/tools_disableTxOffload.go
/source/head/cmd/tools_netem.go
/source/head/cmd/deploy.go
/source/head/cmd/start.go
/source/head/cmd/tools_gotty.go
/source/head/cmd/version.go
/source/head/cmd/restart.go
/source/head/cmd/options.go
/source/head/cmd/tools_cert.go
/source/head/cmd/tools_api_start.go
/source/head/docs/macos.md
/source/head/docs/install.md
/source/head/docs/javascripts/instant-reinit.js
/source/head/docs/rn/0.72.md
/source/head/docs/rn/0.37.md
/source/head/docs/rn/0.62.md
/source/head/docs/rn/0.69.md
/source/head/docs/rn/0.26.md
/source/head/docs/rn/0.47.md
/source/head/docs/rn/0.11.0.md
/source/head/docs/rn/0.48.md
/source/head/docs/rn/0.35.md
/source/head/docs/rn/0.13.0.md
/source/head/docs/rn/0.31.md
/source/head/docs/rn/0.57.md

(Results are truncated: showing first 100 results. Consider using a more specific path or pattern.)
Tool metadata
{
  "type": "tool",
  "id": "prt_1502ff9a60011q4HU6RMqa53Pa",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502fe89e0018QFygyY8f4Z4qk",
  "callID": "call_e979fab902584f459afb0e0b",
  "tool": "glob",
  "state": {
    "status": "completed",
    "input": {
      "path": "/source",
      "pattern": "**/*"
    },
    "output": "/source/standards/karpathy-guidelines.mdc\n/source/standards/ponytail.mdc\n/source/standards.json\n/source/diff.txt\n/source/head/schemas/clab.schema.json\n/source/head/schemas/schema_test.go\n/source/head/internal/mermaid/graph.go\n/source/head/internal/slices/slices.go\n/source/head/macros/main.py\n/source/head/mkdocs.yml\n/source/head/types/mgmt.go\n/source/head/types/volume_test.go\n/source/head/types/license_policy_value.go\n/source/head/types/bind_test.go\n/source/head/types/hostentry.go\n/source/head/types/hostentry_test.go\n/source/head/types/host_requirements.go\n/source/head/types/types.go\n/source/head/types/stages.go\n/source/head/types/stages_test.go\n/source/head/types/topo_paths.go\n/source/head/types/bind.go\n/source/head/types/settings.go\n/source/head/types/topology_test.go\n/source/head/types/topology.go\n/source/head/types/topo_diff_test.go\n/source/head/types/node_definition.go\n/source/head/types/ipam.go\n/source/head/types/topo_diff.go\n/source/head/types/tailscale_ports_test.go\n/source/head/types/node_definition_test.go\n/source/head/types/volume.go\n/source/head/types/ipversion.go\n/source/head/types/mgmt_networks_test.go\n/source/head/types/test_data/config.cfg\n/source/head/types/test_data/lic1.key\n/source/head/types/tailscale_ports.go\n/source/head/types/ssh_config.go\n/source/head/types/mgmt_test.go\n/source/head/cmd/viper_test.go\n/source/head/cmd/context.go\n/source/head/cmd/tools_api_stop.go\n/source/head/cmd/tools_vxlan.go\n/source/head/cmd/version_test.go\n/source/head/cmd/tools.go\n/source/head/cmd/generate.go\n/source/head/cmd/redeploy.go\n/source/head/cmd/stop.go\n/source/head/cmd/deploy_emit_test.go\n/source/head/cmd/inspect.go\n/source/head/cmd/tools_sshx.go\n/source/head/cmd/events.go\n/source/head/cmd/exec.go\n/source/head/cmd/deploy_test.go\n/source/head/cmd/graph.go\n/source/head/cmd/inspect_interfaces.go\n/source/head/cmd/tools_api_status.go\n/source/head/cmd/tools_api.go\n/source/head/cmd/tools_veth.go\n/source/head/cmd/root_test.go\n/source/head/cmd/version_manager.go\n/source/head/cmd/completion.go\n/source/head/cmd/redeploy_test.go\n/source/head/cmd/assets/logo.txt\n/source/head/cmd/generate_test.go\n/source/head/cmd/validate.go\n/source/head/cmd/viper.go\n/source/head/cmd/save.go\n/source/head/cmd/context_test.go\n/source/head/cmd/tools_netem_test.go\n/source/head/cmd/tools_veth_test.go\n/source/head/cmd/root.go\n/source/head/cmd/topo_select.go\n/source/head/cmd/tools_snapshot.go\n/source/head/cmd/destroy.go\n/source/head/cmd/tools_disableTxOffload.go\n/source/head/cmd/tools_netem.go\n/source/head/cmd/deploy.go\n/source/head/cmd/start.go\n/source/head/cmd/tools_gotty.go\n/source/head/cmd/version.go\n/source/head/cmd/restart.go\n/source/head/cmd/options.go\n/source/head/cmd/tools_cert.go\n/source/head/cmd/tools_api_start.go\n/source/head/docs/macos.md\n/source/head/docs/install.md\n/source/head/docs/javascripts/instant-reinit.js\n/source/head/docs/rn/0.72.md\n/source/head/docs/rn/0.37.md\n/source/head/docs/rn/0.62.md\n/source/head/docs/rn/0.69.md\n/source/head/docs/rn/0.26.md\n/source/head/docs/rn/0.47.md\n/source/head/docs/rn/0.11.0.md\n/source/head/docs/rn/0.48.md\n/source/head/docs/rn/0.35.md\n/source/head/docs/rn/0.13.0.md\n/source/head/docs/rn/0.31.md\n/source/head/docs/rn/0.57.md\n\n(Results are truncated: showing first 100 results. Consider using a more specific path or pattern.)",
    "title": "source",
    "metadata": {
      "count": 100,
      "truncated": true
    },
    "time": {
      "start": 1792346683819,
      "end": 1792346683837
    }
  }
}
read · completed

Input

{
  "filePath": "/source/diff.txt",
  "limit": 230,
  "offset": 84
}

Output

<path>/source/diff.txt</path>
<type>file</type>
<content>
84: diff --git a/docs/manual/kinds/sros.md b/docs/manual/kinds/sros.md
85: index 633972e..7c0f2e1 100644
86: --- a/docs/manual/kinds/sros.md
87: +++ b/docs/manual/kinds/sros.md
88: @@ -239,13 +239,19 @@ topology:
89:          NOKIA_SROS_MDA_1: me12-100gb-qsfp28 # override default MDA type in slot 1
90:  ```
91:  
92:  ///
93:  
94: -For known SR/IXR integrated nodes, containerlab's default model-driven configuration also provisions the default card and MDA configuration. The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`. If the hardware is overridden with `components` or SR-SIM environment variables, the generated SR OS card/MDA configuration follows those overrides.
95: +For known SR and IXR integrated types, containerlab generates model-driven configuration for the default card and MDA(s).
96:  
97: -Integrated nodes accept at most one `components` entry because they still run as a single container. The component slot can be omitted or set to `A`; `ixr-r6` also accepts a single `B` slot override.
98: +The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e2sc`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`.
99: +
100: +An integrated node other than `ixr-r6` runs as one container and accepts one `components` entry. The slot can be omitted or set to `A`. `ixr-r6` accepts slots `A` and `B`. Two `ixr-r6` entries, one for `A` and one for `B`, run as a dual-CPIOM node with one container per CPM. Integrated nodes do not accept numeric line-card slots.
101: +
102: +A `components` entry with `type` sets `NOKIA_SROS_CARD`. Containerlab then skips generated card and MDA configuration, because those defaults belong to the built-in card. Set `type` when the integrated card itself must change, for example `cpm-ixr-e2n/imm4-sfp+4-sfp+`.
103: +
104: +Node `env` overrides `components`: `type`, `xiom`, `mda`, per-component `env`, and the `sfm` key. When both set the same variable to different values, the environment variable wins and containerlab logs a warning naming that variable. `NOKIA_SROS_MDA_*` and `NOKIA_SROS_XIOM_*` are written into the generated configuration. `NOKIA_SROS_CARD` skips that generation, the same as a component `type`. On a distributed node, `NOKIA_SROS_SLOT` does not replace each component's slot.
105:  
106:  ### Distributed
107:  
108:  When the emulated platform is chassis-based, like SR-7, SR-14s, etc., the SR-SIM node must be defined in a distributed mode in the topology file.
109:  
110: @@ -385,16 +391,18 @@ topology:
111:  When a distributed SR-SIM node is defined using `components`, we need to take into account the following:
112:  
113:  1. Component containers are attached to an internal namespace pause container.
114:  2. When changing a MDA or card type from its default value, the configuration for card, SFM and MDA must be also defined.
115:  3. Links can be added referring to the node name. The same [interface naming](#interface-naming) convention holds for all SR-SIM nodes.
116: -4. Environment variable based configuration on per-component, or node-level will override the configuration set in `type`, `xiom` and `mda` fields.
117: +4. Environment variable based configuration on per-component, or node-level will override the configuration set in `type`, `xiom` and `mda` fields. Node-level `env` wins over both. When the values differ, containerlab logs a warning naming the environment variable that was kept.
118:  
119:  ##### Configuration for components
120:  
121:  When using the `components` structure in the node definition for a distributed node, containerlab will also generate the SR OS configuration for the installed components in the chassis, as well as relevant power supply configuration[^6] to ensure the installed components come up without requiring a user to manually provide the configuration. The same generated configuration mechanism is used for the built-in SR/IXR integrated defaults.
122:  
123: +At deploy time, containerlab reads `chassis_info.json` from the selected SR-SIM image and compares the effective `components` configuration with the hardware types listed for that chassis. Unsupported card slots and card, SFM, XIOM, or MDA types produce warnings but do not stop deployment. This is a best-effort check: compatibility that is not represented in `chassis_info.json`, such as the MDA types supported by a specific XIOM, is not validated.
124: +
125:  /// details | Disabling generated SR OS configuration for `components`
126:      type: tip
127:  You can disable this config generation behavior by setting the `gen-component-config: false` [kind-specific config key](../nodes.md#kind-specific-config) on the node, or on the base node for a distributed chassis.
128:  
129:  ```yaml hl_lines="6"
130: diff --git a/nodes/sros/README.md b/nodes/sros/README.md
131: index 3fbdee2..435bf6d 100644
132: --- a/nodes/sros/README.md
133: +++ b/nodes/sros/README.md
134: @@ -37,11 +37,23 @@ The SR OS node kind supports deploying Nokia's SR OS network operating system in
135:  - **`sros_test.go`**: Unit tests
136:    - Node type helper method tests
137:    - Edge case validation
138:    - Version parsing tests
139:  
140: -- During PreDeploy, `chassis_info.json` is read from the node image (`/opt/nokia/chassis_info.json`) and written under the node's lab directory (`n.Cfg.LabDir`) with the same filename.
141: +- **`component.go`**: Component model, slot checks, and environment precedence
142: +- **`component_config.go`**: Generated card, SFM, XIOM, and MDA configuration, including integrated defaults
143: +- **`chassis_info.go`**: Parses `chassis_info.json` and returns advisory compatibility warnings
144: +
145: +### Chassis info and component checks
146: +
147: +During PreDeploy, `createSROSFiles` reads `/opt/nokia/chassis_info.json` from the node image and writes it to `n.Cfg.LabDir/chassis_info.json`, prefixed with the license header. Failure to read the file is logged and does not stop deployment.
148: +
149: +The same file is then compared with the effective component configuration. Aliases such as `SAR-Mx` to `SAR-Hx` are followed. Unsupported slots, CPM/IOM types, SFM, XIOM, direct MDAs, and fixed-hardware mismatches produce warnings only. MDAs nested under an XIOM are not checked, because the file does not say which MDA types a given XIOM accepts.
150: +
151: +### Environment precedence
152: +
153: +Node `env` overrides per-component `env`, which overrides `type`, `xiom`, `mda`, and `sfm`. When a node environment variable replaces a different component value, containerlab logs that the component value will not be used and names the variable. `NOKIA_SROS_SLOT` still comes from each component in a distributed node, because one node-level slot cannot identify every card.
154:  
155:  ## Architecture
156:  
157:  ### Node Type Detection
158:  
159: @@ -346,29 +358,16 @@ componentConfig := ""
160:  if !isFullConfigFile(n.Cfg.StartupConfig) {
161:      componentConfig = n.generateComponentConfig()
162:  }
163:  ```
164:  
165: -For distributed SR OS deployments with multiple CPMs and linecards, this generates:
166: -- Slot-specific configuration
167: -- Card type definitions
168: -- MDA (Media Dependent Adapter) configurations
169: -- Fabric connectivity
170: +For integrated nodes and distributed line cards, this appends flat MD-CLI lines. CPM slots `A` and `B` are not provisioned as cards. `NOKIA_SROS_CARD`, or a component `type` on an integrated node, skips this generation because the built-in MDA defaults belong to the default card.
171:  
172: -Example generated component config:
173:  ```
174: -/configure {
175: -    card 1 {
176: -        card-type iom-e
177: -        mda 1 {
178: -            mda-type me12-100gb-qsfp28
179: -        }
180: -    }
181: -    card A {
182: -        card-type cpm-ixr
183: -    }
184: -}
185: +/configure card 1 card-type iom-1 admin-state enable
186: +/configure card 1 mda 1 mda-type me6-100gb-qsfp28 admin-state enable
187: +/configure sfm 1 sfm-type sfm-2s admin-state enable
188:  ```
189:  
190:  #### Phase 3: Node-Type Specific Configuration (`applyNodeTypeSpecificConfig`)
191:  
192:  This phase customizes the template data based on the node's platform type and security settings.
193: @@ -1047,83 +1046,22 @@ Each platform type has tailored configurations embedded in the `configs/` direct
194:  **SAR Classic Mode:**
195:  - **No gRPC configuration embedded**
196:  - SAR in classic mode doesn't support gRPC
197:  - Uses only CLI/NETCONF for management
198:  
199: -### Distributed SR OS Configuration
200: -
201: -For distributed deployments with multiple components (CPMs and line cards), additional configuration is generated.
202: -
203: -#### Component Configuration Generation
204: -
205: -```go
206: -func (n *sros) generateComponentConfig() string
207: -```
208: -
209: -**Generated Configuration Structure:**
210: -
211: -```
212: -/configure {
213: -    {{- range .Components }}
214: -    card {{ .Slot }} {
215: -        card-type {{ .Type }}
216: -        {{- if .MDAs }}
217: -        {{- range .MDAs }}
218: -        mda {{ .Slot }} {
219: -            mda-type {{ .Type }}
220: -        }
221: -        {{- end }}
222: -        {{- end }}
223: -    }
224: -    {{- end }}
225: -    
226: -    {{- if .FabricConfig }}
227: -    fabric {
228: -        {{ .FabricConfig }}
229: -    }
230: -    {{- end }}
231: -}
232: -```
233: +### Component configuration
234:  
235: -**Example Distributed Topology:**
236: +`generateComponentConfig` runs for integrated nodes and for the CPM of a distributed node, unless the user supplied a full startup config, selected classic mode, or set `gen-component-config: false`.
237:  
238: -```yaml
239: -nodes:
240: -  chassis1:
241: -    kind: nokia_srsim
242: -    components:
243: -      - slot: A
244: -        type: cpm-ixr
245: -      - slot: B
246: -        type: cpm-ixr
247: -      - slot: 1
248: -        type: iom-ixr
249: -        mda:
250: -          - slot: 1
251: -            type: m20-1gb-sfp-b
252: -```
253: +Known integrated types (`sr-1`, `sr-1s`, `ixr-r6`, and the `ixr-e*` pizza boxes) get built-in card and MDA lines. One `components` entry is accepted, with the slot omitted or set to `A`. `ixr-r6` also accepts `B`, and two entries (`A` and `B`) deploy a dual-CPIOM node. A component `type` sets `NOKIA_SROS_CARD` and skips generated card and MDA lines.
254:  
255: -**Generated Component Config:**
256: +Distributed line cards produce one line per card, SFM, XIOM, and direct MDA. The values are the effective ones after environment precedence, so `NOKIA_SROS_MDA_*` and `NOKIA_SROS_XIOM_*` change the generated lines.
257:  
258:  ```
259: -/configure {
260: -    card A {
261: -        card-type cpm-ixr
262: -    }
263: -    card B {
264: -        card-type cpm-ixr
265: -    }
266: -    card 1 {
267: -        card-type iom-ixr
268: -        mda 1 {
269: -            mda-type m20-1gb-sfp-b
270: -        }
271: -    }
272: -    fabric {
273: -        multiplane-mode enabled
274: -    }
275: -}
276: +/configure card 1 card-type xcm-2s admin-state enable
277: +/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable
278: +/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable
279:  ```
280:  
281:  ### Security and Certificate Management
282:  
283:  When `certificate.issue: true` is set, the system generates and injects TLS certificates.
284: @@ -1538,14 +1476,14 @@ docker ps | grep chassis1
285:  # Verify slot assignments
286:  ssh admin@clab-mylab-chassis1-cpm-a "show card state"
287:  ```
288:  
289:  **Common Causes:**
290: -- Component slots not properly defined
291: -- CPM slot names must be "A" or "B" (uppercase)
292: +- Component slots are duplicated, including slots that differ only by case
293:  - Line card slots must be numeric
294: -- Environment variables not set on components
295: +- The component type or MDA is not listed for that chassis in the image's `chassis_info.json` (this is logged as a warning and does not stop deployment)
296: +- A node-level environment variable overrides the component value; the log names the variable that was kept
297:  
298:  ## Performance Considerations
299:  
300:  ### Template Execution Performance
301:  
302: @@ -1638,7 +1576,7 @@ BSD 3-Clause License - See LICENSE file for details
303:  
304:  **Maintainers:**
305:  - Nokia Containerlab Team
306:  - Community Contributors
307:  
308: -**Last Updated:** 2025-11-15
309: -**SR OS Versions Supported:**  25.7+, 26.x (planned)
310: +**Last Updated:** 2026-10-14
311: +**SR OS Versions Supported:**  25.7+, 26.x
312: diff --git a/nodes/sros/chassis_info.go b/nodes/sros/chassis_info.go
313: index ace213b..fe5b7f8 100644

(Showing lines 84-313 of 3945. Use offset=314 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1502ffa030017Emhn8HHOxZdT8",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502fe89e0018QFygyY8f4Z4qk",
  "callID": "call_a929140325514432a44fc74f",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/diff.txt",
      "limit": 230,
      "offset": 84
    },
    "output": "<path>/source/diff.txt</path>\n<type>file</type>\n<content>\n84: diff --git a/docs/manual/kinds/sros.md b/docs/manual/kinds/sros.md\n85: index 633972e..7c0f2e1 100644\n86: --- a/docs/manual/kinds/sros.md\n87: +++ b/docs/manual/kinds/sros.md\n88: @@ -239,13 +239,19 @@ topology:\n89:          NOKIA_SROS_MDA_1: me12-100gb-qsfp28 # override default MDA type in slot 1\n90:  ```\n91:  \n92:  ///\n93:  \n94: -For known SR/IXR integrated nodes, containerlab's default model-driven configuration also provisions the default card and MDA configuration. The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`. If the hardware is overridden with `components` or SR-SIM environment variables, the generated SR OS card/MDA configuration follows those overrides.\n95: +For known SR and IXR integrated types, containerlab generates model-driven configuration for the default card and MDA(s).\n96:  \n97: -Integrated nodes accept at most one `components` entry because they still run as a single container. The component slot can be omitted or set to `A`; `ixr-r6` also accepts a single `B` slot override.\n98: +The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e2sc`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`.\n99: +\n100: +An integrated node other than `ixr-r6` runs as one container and accepts one `components` entry. The slot can be omitted or set to `A`. `ixr-r6` accepts slots `A` and `B`. Two `ixr-r6` entries, one for `A` and one for `B`, run as a dual-CPIOM node with one container per CPM. Integrated nodes do not accept numeric line-card slots.\n101: +\n102: +A `components` entry with `type` sets `NOKIA_SROS_CARD`. Containerlab then skips generated card and MDA configuration, because those defaults belong to the built-in card. Set `type` when the integrated card itself must change, for example `cpm-ixr-e2n/imm4-sfp+4-sfp+`.\n103: +\n104: +Node `env` overrides `components`: `type`, `xiom`, `mda`, per-component `env`, and the `sfm` key. When both set the same variable to different values, the environment variable wins and containerlab logs a warning naming that variable. `NOKIA_SROS_MDA_*` and `NOKIA_SROS_XIOM_*` are written into the generated configuration. `NOKIA_SROS_CARD` skips that generation, the same as a component `type`. On a distributed node, `NOKIA_SROS_SLOT` does not replace each component's slot.\n105:  \n106:  ### Distributed\n107:  \n108:  When the emulated platform is chassis-based, like SR-7, SR-14s, etc., the SR-SIM node must be defined in a distributed mode in the topology file.\n109:  \n110: @@ -385,16 +391,18 @@ topology:\n111:  When a distributed SR-SIM node is defined using `components`, we need to take into account the following:\n112:  \n113:  1. Component containers are attached to an internal namespace pause container.\n114:  2. When changing a MDA or card type from its default value, the configuration for card, SFM and MDA must be also defined.\n115:  3. Links can be added referring to the node name. The same [interface naming](#interface-naming) convention holds for all SR-SIM nodes.\n116: -4. Environment variable based configuration on per-component, or node-level will override the configuration set in `type`, `xiom` and `mda` fields.\n117: +4. Environment variable based configuration on per-component, or node-level will override the configuration set in `type`, `xiom` and `mda` fields. Node-level `env` wins over both. When the values differ, containerlab logs a warning naming the environment variable that was kept.\n118:  \n119:  ##### Configuration for components\n120:  \n121:  When using the `components` structure in the node definition for a distributed node, containerlab will also generate the SR OS configuration for the installed components in the chassis, as well as relevant power supply configuration[^6] to ensure the installed components come up without requiring a user to manually provide the configuration. The same generated configuration mechanism is used for the built-in SR/IXR integrated defaults.\n122:  \n123: +At deploy time, containerlab reads `chassis_info.json` from the selected SR-SIM image and compares the effective `components` configuration with the hardware types listed for that chassis. Unsupported card slots and card, SFM, XIOM, or MDA types produce warnings but do not stop deployment. This is a best-effort check: compatibility that is not represented in `chassis_info.json`, such as the MDA types supported by a specific XIOM, is not validated.\n124: +\n125:  /// details | Disabling generated SR OS configuration for `components`\n126:      type: tip\n127:  You can disable this config generation behavior by setting the `gen-component-config: false` [kind-specific config key](../nodes.md#kind-specific-config) on the node, or on the base node for a distributed chassis.\n128:  \n129:  ```yaml hl_lines=\"6\"\n130: diff --git a/nodes/sros/README.md b/nodes/sros/README.md\n131: index 3fbdee2..435bf6d 100644\n132: --- a/nodes/sros/README.md\n133: +++ b/nodes/sros/README.md\n134: @@ -37,11 +37,23 @@ The SR OS node kind supports deploying Nokia's SR OS network operating system in\n135:  - **`sros_test.go`**: Unit tests\n136:    - Node type helper method tests\n137:    - Edge case validation\n138:    - Version parsing tests\n139:  \n140: -- During PreDeploy, `chassis_info.json` is read from the node image (`/opt/nokia/chassis_info.json`) and written under the node's lab directory (`n.Cfg.LabDir`) with the same filename.\n141: +- **`component.go`**: Component model, slot checks, and environment precedence\n142: +- **`component_config.go`**: Generated card, SFM, XIOM, and MDA configuration, including integrated defaults\n143: +- **`chassis_info.go`**: Parses `chassis_info.json` and returns advisory compatibility warnings\n144: +\n145: +### Chassis info and component checks\n146: +\n147: +During PreDeploy, `createSROSFiles` reads `/opt/nokia/chassis_info.json` from the node image and writes it to `n.Cfg.LabDir/chassis_info.json`, prefixed with the license header. Failure to read the file is logged and does not stop deployment.\n148: +\n149: +The same file is then compared with the effective component configuration. Aliases such as `SAR-Mx` to `SAR-Hx` are followed. Unsupported slots, CPM/IOM types, SFM, XIOM, direct MDAs, and fixed-hardware mismatches produce warnings only. MDAs nested under an XIOM are not checked, because the file does not say which MDA types a given XIOM accepts.\n150: +\n151: +### Environment precedence\n152: +\n153: +Node `env` overrides per-component `env`, which overrides `type`, `xiom`, `mda`, and `sfm`. When a node environment variable replaces a different component value, containerlab logs that the component value will not be used and names the variable. `NOKIA_SROS_SLOT` still comes from each component in a distributed node, because one node-level slot cannot identify every card.\n154:  \n155:  ## Architecture\n156:  \n157:  ### Node Type Detection\n158:  \n159: @@ -346,29 +358,16 @@ componentConfig := \"\"\n160:  if !isFullConfigFile(n.Cfg.StartupConfig) {\n161:      componentConfig = n.generateComponentConfig()\n162:  }\n163:  ```\n164:  \n165: -For distributed SR OS deployments with multiple CPMs and linecards, this generates:\n166: -- Slot-specific configuration\n167: -- Card type definitions\n168: -- MDA (Media Dependent Adapter) configurations\n169: -- Fabric connectivity\n170: +For integrated nodes and distributed line cards, this appends flat MD-CLI lines. CPM slots `A` and `B` are not provisioned as cards. `NOKIA_SROS_CARD`, or a component `type` on an integrated node, skips this generation because the built-in MDA defaults belong to the default card.\n171:  \n172: -Example generated component config:\n173:  ```\n174: -/configure {\n175: -    card 1 {\n176: -        card-type iom-e\n177: -        mda 1 {\n178: -            mda-type me12-100gb-qsfp28\n179: -        }\n180: -    }\n181: -    card A {\n182: -        card-type cpm-ixr\n183: -    }\n184: -}\n185: +/configure card 1 card-type iom-1 admin-state enable\n186: +/configure card 1 mda 1 mda-type me6-100gb-qsfp28 admin-state enable\n187: +/configure sfm 1 sfm-type sfm-2s admin-state enable\n188:  ```\n189:  \n190:  #### Phase 3: Node-Type Specific Configuration (`applyNodeTypeSpecificConfig`)\n191:  \n192:  This phase customizes the template data based on the node's platform type and security settings.\n193: @@ -1047,83 +1046,22 @@ Each platform type has tailored configurations embedded in the `configs/` direct\n194:  **SAR Classic Mode:**\n195:  - **No gRPC configuration embedded**\n196:  - SAR in classic mode doesn't support gRPC\n197:  - Uses only CLI/NETCONF for management\n198:  \n199: -### Distributed SR OS Configuration\n200: -\n201: -For distributed deployments with multiple components (CPMs and line cards), additional configuration is generated.\n202: -\n203: -#### Component Configuration Generation\n204: -\n205: -```go\n206: -func (n *sros) generateComponentConfig() string\n207: -```\n208: -\n209: -**Generated Configuration Structure:**\n210: -\n211: -```\n212: -/configure {\n213: -    {{- range .Components }}\n214: -    card {{ .Slot }} {\n215: -        card-type {{ .Type }}\n216: -        {{- if .MDAs }}\n217: -        {{- range .MDAs }}\n218: -        mda {{ .Slot }} {\n219: -            mda-type {{ .Type }}\n220: -        }\n221: -        {{- end }}\n222: -        {{- end }}\n223: -    }\n224: -    {{- end }}\n225: -    \n226: -    {{- if .FabricConfig }}\n227: -    fabric {\n228: -        {{ .FabricConfig }}\n229: -    }\n230: -    {{- end }}\n231: -}\n232: -```\n233: +### Component configuration\n234:  \n235: -**Example Distributed Topology:**\n236: +`generateComponentConfig` runs for integrated nodes and for the CPM of a distributed node, unless the user supplied a full startup config, selected classic mode, or set `gen-component-config: false`.\n237:  \n238: -```yaml\n239: -nodes:\n240: -  chassis1:\n241: -    kind: nokia_srsim\n242: -    components:\n243: -      - slot: A\n244: -        type: cpm-ixr\n245: -      - slot: B\n246: -        type: cpm-ixr\n247: -      - slot: 1\n248: -        type: iom-ixr\n249: -        mda:\n250: -          - slot: 1\n251: -            type: m20-1gb-sfp-b\n252: -```\n253: +Known integrated types (`sr-1`, `sr-1s`, `ixr-r6`, and the `ixr-e*` pizza boxes) get built-in card and MDA lines. One `components` entry is accepted, with the slot omitted or set to `A`. `ixr-r6` also accepts `B`, and two entries (`A` and `B`) deploy a dual-CPIOM node. A component `type` sets `NOKIA_SROS_CARD` and skips generated card and MDA lines.\n254:  \n255: -**Generated Component Config:**\n256: +Distributed line cards produce one line per card, SFM, XIOM, and direct MDA. The values are the effective ones after environment precedence, so `NOKIA_SROS_MDA_*` and `NOKIA_SROS_XIOM_*` change the generated lines.\n257:  \n258:  ```\n259: -/configure {\n260: -    card A {\n261: -        card-type cpm-ixr\n262: -    }\n263: -    card B {\n264: -        card-type cpm-ixr\n265: -    }\n266: -    card 1 {\n267: -        card-type iom-ixr\n268: -        mda 1 {\n269: -            mda-type m20-1gb-sfp-b\n270: -        }\n271: -    }\n272: -    fabric {\n273: -        multiplane-mode enabled\n274: -    }\n275: -}\n276: +/configure card 1 card-type xcm-2s admin-state enable\n277: +/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\n278: +/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\n279:  ```\n280:  \n281:  ### Security and Certificate Management\n282:  \n283:  When `certificate.issue: true` is set, the system generates and injects TLS certificates.\n284: @@ -1538,14 +1476,14 @@ docker ps | grep chassis1\n285:  # Verify slot assignments\n286:  ssh admin@clab-mylab-chassis1-cpm-a \"show card state\"\n287:  ```\n288:  \n289:  **Common Causes:**\n290: -- Component slots not properly defined\n291: -- CPM slot names must be \"A\" or \"B\" (uppercase)\n292: +- Component slots are duplicated, including slots that differ only by case\n293:  - Line card slots must be numeric\n294: -- Environment variables not set on components\n295: +- The component type or MDA is not listed for that chassis in the image's `chassis_info.json` (this is logged as a warning and does not stop deployment)\n296: +- A node-level environment variable overrides the component value; the log names the variable that was kept\n297:  \n298:  ## Performance Considerations\n299:  \n300:  ### Template Execution Performance\n301:  \n302: @@ -1638,7 +1576,7 @@ BSD 3-Clause License - See LICENSE file for details\n303:  \n304:  **Maintainers:**\n305:  - Nokia Containerlab Team\n306:  - Community Contributors\n307:  \n308: -**Last Updated:** 2025-11-15\n309: -**SR OS Versions Supported:**  25.7+, 26.x (planned)\n310: +**Last Updated:** 2026-10-14\n311: +**SR OS Versions Supported:**  25.7+, 26.x\n312: diff --git a/nodes/sros/chassis_info.go b/nodes/sros/chassis_info.go\n313: index ace213b..fe5b7f8 100644\n\n(Showing lines 84-313 of 3945. Use offset=314 to continue.)\n</content>",
    "title": "source/diff.txt",
    "metadata": {
      "preview": "diff --git a/docs/manual/kinds/sros.md b/docs/manual/kinds/sros.md\nindex 633972e..7c0f2e1 100644\n--- a/docs/manual/kinds/sros.md\n+++ b/docs/manual/kinds/sros.md\n@@ -239,13 +239,19 @@ topology:\n         NOKIA_SROS_MDA_1: me12-100gb-qsfp28 # override default MDA type in slot 1\n ```\n \n ///\n \n-For known SR/IXR integrated nodes, containerlab's default model-driven configuration also provisions the default card and MDA configuration. The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`. If the hardware is overridden with `components` or SR-SIM environment variables, the generated SR OS card/MDA configuration follows those overrides.\n+For known SR and IXR integrated types, containerlab generates model-driven configuration for the default card and MDA(s).\n \n-Integrated nodes accept at most one `components` entry because they still run as a single container. The component slot can be omitted or set to `A`; `ixr-r6` also accepts a single `B` slot override.\n+The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e2sc`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`.\n+\n+An integrated node other than `ixr-r6` runs as one container and accepts one `components` entry. The slot can be omitted or set to `A`. `ixr-r6` accepts slots `A` and `B`. Two `ixr-r6` entries, one for `A` and one for `B`, run as a dual-CPIOM node with one container per CPM. Integrated nodes do not accept numeric line-card slots.\n+\n+A `components` entry with `type` sets `NOKIA_SROS_CARD`. Containerlab then skips generated card and MDA configuration, because those defaults belong to the built-in card. Set `type` when the integrated card itself must change, for example `cpm-ixr-e2n/imm4-sfp+4-sfp+`.\n+",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/diff.txt",
        "text": "diff --git a/docs/manual/kinds/sros.md b/docs/manual/kinds/sros.md\nindex 633972e..7c0f2e1 100644\n--- a/docs/manual/kinds/sros.md\n+++ b/docs/manual/kinds/sros.md\n@@ -239,13 +239,19 @@ topology:\n         NOKIA_SROS_MDA_1: me12-100gb-qsfp28 # override default MDA type in slot 1\n ```\n \n ///\n \n-For known SR/IXR integrated nodes, containerlab's default model-driven configuration also provisions the default card and MDA configuration. The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`. If the hardware is overridden with `components` or SR-SIM environment variables, the generated SR OS card/MDA configuration follows those overrides.\n+For known SR and IXR integrated types, containerlab generates model-driven configuration for the default card and MDA(s).\n \n-Integrated nodes accept at most one `components` entry because they still run as a single container. The component slot can be omitted or set to `A`; `ixr-r6` also accepts a single `B` slot override.\n+The built-in defaults cover `sr-1`, `sr-1s`, `ixr-r6`, `ixr-e2`, `ixr-e2c`, `ixr-e2n`, `ixr-e2n-s`, `ixr-e2sc`, `ixr-e3c`, `ixr-e3x` and `ixr-ec`.\n+\n+An integrated node other than `ixr-r6` runs as one container and accepts one `components` entry. The slot can be omitted or set to `A`. `ixr-r6` accepts slots `A` and `B`. Two `ixr-r6` entries, one for `A` and one for `B`, run as a dual-CPIOM node with one container per CPM. Integrated nodes do not accept numeric line-card slots.\n+\n+A `components` entry with `type` sets `NOKIA_SROS_CARD`. Containerlab then skips generated card and MDA configuration, because those defaults belong to the built-in card. Set `type` when the integrated card itself must change, for example `cpm-ixr-e2n/imm4-sfp+4-sfp+`.\n+\n+Node `env` overrides `components`: `type`, `xiom`, `mda`, per-component `env`, and the `sfm` key. When both set the same variable to different values, the environment variable wins and containerlab logs a warning naming that variable. `NOKIA_SROS_MDA_*` and `NOKIA_SROS_XIOM_*` are written into the generated configuration. `NOKIA_SROS_CARD` skips that generation, the same as a component `type`. On a distributed node, `NOKIA_SROS_SLOT` does not replace each component's slot.\n \n ### Distributed\n \n When the emulated platform is chassis-based, like SR-7, SR-14s, etc., the SR-SIM node must be defined in a distributed mode in the topology file.\n \n@@ -385,16 +391,18 @@ topology:\n When a distributed SR-SIM node is defined using `components`, we need to take into account the following:\n \n 1. Component containers are attached to an internal namespace pause container.\n 2. When changing a MDA or card type from its default value, the configuration for card, SFM and MDA must be also defined.\n 3. Links can be added referring to the node name. The same [interface naming](#interface-naming) convention holds for all SR-SIM nodes.\n-4. Environment variable based configuration on per-component, or node-level will override the configuration set in `type`, `xiom` and `mda` fields.\n+4. Environment variable based configuration on per-component, or node-level will override the configuration set in `type`, `xiom` and `mda` fields. Node-level `env` wins over both. When the values differ, containerlab logs a warning naming the environment variable that was kept.\n \n ##### Configuration for components\n \n When using the `components` structure in the node definition for a distributed node, containerlab will also generate the SR OS configuration for the installed components in the chassis, as well as relevant power supply configuration[^6] to ensure the installed components come up without requiring a user to manually provide the configuration. The same generated configuration mechanism is used for the built-in SR/IXR integrated defaults.\n \n+At deploy time, containerlab reads `chassis_info.json` from the selected SR-SIM image and compares the effective `components` configuration with the hardware types listed for that chassis. Unsupported card slots and card, SFM, XIOM, or MDA types produce warnings but do not stop deployment. This is a best-effort check: compatibility that is not represented in `chassis_info.json`, such as the MDA types supported by a specific XIOM, is not validated.\n+\n /// details | Disabling generated SR OS configuration for `components`\n     type: tip\n You can disable this config generation behavior by setting the `gen-component-config: false` [kind-specific config key](../nodes.md#kind-specific-config) on the node, or on the base node for a distributed chassis.\n \n ```yaml hl_lines=\"6\"\ndiff --git a/nodes/sros/README.md b/nodes/sros/README.md\nindex 3fbdee2..435bf6d 100644\n--- a/nodes/sros/README.md\n+++ b/nodes/sros/README.md\n@@ -37,11 +37,23 @@ The SR OS node kind supports deploying Nokia's SR OS network operating system in\n - **`sros_test.go`**: Unit tests\n   - Node type helper method tests\n   - Edge case validation\n   - Version parsing tests\n \n-- During PreDeploy, `chassis_info.json` is read from the node image (`/opt/nokia/chassis_info.json`) and written under the node's lab directory (`n.Cfg.LabDir`) with the same filename.\n+- **`component.go`**: Component model, slot checks, and environment precedence\n+- **`component_config.go`**: Generated card, SFM, XIOM, and MDA configuration, including integrated defaults\n+- **`chassis_info.go`**: Parses `chassis_info.json` and returns advisory compatibility warnings\n+\n+### Chassis info and component checks\n+\n+During PreDeploy, `createSROSFiles` reads `/opt/nokia/chassis_info.json` from the node image and writes it to `n.Cfg.LabDir/chassis_info.json`, prefixed with the license header. Failure to read the file is logged and does not stop deployment.\n+\n+The same file is then compared with the effective component configuration. Aliases such as `SAR-Mx` to `SAR-Hx` are followed. Unsupported slots, CPM/IOM types, SFM, XIOM, direct MDAs, and fixed-hardware mismatches produce warnings only. MDAs nested under an XIOM are not checked, because the file does not say which MDA types a given XIOM accepts.\n+\n+### Environment precedence\n+\n+Node `env` overrides per-component `env`, which overrides `type`, `xiom`, `mda`, and `sfm`. When a node environment variable replaces a different component value, containerlab logs that the component value will not be used and names the variable. `NOKIA_SROS_SLOT` still comes from each component in a distributed node, because one node-level slot cannot identify every card.\n \n ## Architecture\n \n ### Node Type Detection\n \n@@ -346,29 +358,16 @@ componentConfig := \"\"\n if !isFullConfigFile(n.Cfg.StartupConfig) {\n     componentConfig = n.generateComponentConfig()\n }\n ```\n \n-For distributed SR OS deployments with multiple CPMs and linecards, this generates:\n-- Slot-specific configuration\n-- Card type definitions\n-- MDA (Media Dependent Adapter) configurations\n-- Fabric connectivity\n+For integrated nodes and distributed line cards, this appends flat MD-CLI lines. CPM slots `A` and `B` are not provisioned as cards. `NOKIA_SROS_CARD`, or a component `type` on an integrated node, skips this generation because the built-in MDA defaults belong to the default card.\n \n-Example generated component config:\n ```\n-/configure {\n-    card 1 {\n-        card-type iom-e\n-        mda 1 {\n-            mda-type me12-100gb-qsfp28\n-        }\n-    }\n-    card A {\n-        card-type cpm-ixr\n-    }\n-}\n+/configure card 1 card-type iom-1 admin-state enable\n+/configure card 1 mda 1 mda-type me6-100gb-qsfp28 admin-state enable\n+/configure sfm 1 sfm-type sfm-2s admin-state enable\n ```\n \n #### Phase 3: Node-Type Specific Configuration (`applyNodeTypeSpecificConfig`)\n \n This phase customizes the template data based on the node's platform type and security settings.\n@@ -1047,83 +1046,22 @@ Each platform type has tailored configurations embedded in the `configs/` direct\n **SAR Classic Mode:**\n - **No gRPC configuration embedded**\n - SAR in classic mode doesn't support gRPC\n - Uses only CLI/NETCONF for management\n \n-### Distributed SR OS Configuration\n-\n-For distributed deployments with multiple components (CPMs and line cards), additional configuration is generated.\n-\n-#### Component Configuration Generation\n-\n-```go\n-func (n *sros) generateComponentConfig() string\n-```\n-\n-**Generated Configuration Structure:**\n-\n-```\n-/configure {\n-    {{- range .Components }}\n-    card {{ .Slot }} {\n-        card-type {{ .Type }}\n-        {{- if .MDAs }}\n-        {{- range .MDAs }}\n-        mda {{ .Slot }} {\n-            mda-type {{ .Type }}\n-        }\n-        {{- end }}\n-        {{- end }}\n-    }\n-    {{- end }}\n-    \n-    {{- if .FabricConfig }}\n-    fabric {\n-        {{ .FabricConfig }}\n-    }\n-    {{- end }}\n-}\n-```\n+### Component configuration\n \n-**Example Distributed Topology:**\n+`generateComponentConfig` runs for integrated nodes and for the CPM of a distributed node, unless the user supplied a full startup config, selected classic mode, or set `gen-component-config: false`.\n \n-```yaml\n-nodes:\n-  chassis1:\n-    kind: nokia_srsim\n-    components:\n-      - slot: A\n-        type: cpm-ixr\n-      - slot: B\n-        type: cpm-ixr\n-      - slot: 1\n-        type: iom-ixr\n-        mda:\n-          - slot: 1\n-            type: m20-1gb-sfp-b\n-```\n+Known integrated types (`sr-1`, `sr-1s`, `ixr-r6`, and the `ixr-e*` pizza boxes) get built-in card and MDA lines. One `components` entry is accepted, with the slot omitted or set to `A`. `ixr-r6` also accepts `B`, and two entries (`A` and `B`) deploy a dual-CPIOM node. A component `type` sets `NOKIA_SROS_CARD` and skips generated card and MDA lines.\n \n-**Generated Component Config:**\n+Distributed line cards produce one line per card, SFM, XIOM, and direct MDA. The values are the effective ones after environment precedence, so `NOKIA_SROS_MDA_*` and `NOKIA_SROS_XIOM_*` change the generated lines.\n \n ```\n-/configure {\n-    card A {\n-        card-type cpm-ixr\n-    }\n-    card B {\n-        card-type cpm-ixr\n-    }\n-    card 1 {\n-        card-type iom-ixr\n-        mda 1 {\n-            mda-type m20-1gb-sfp-b\n-        }\n-    }\n-    fabric {\n-        multiplane-mode enabled\n-    }\n-}\n+/configure card 1 card-type xcm-2s admin-state enable\n+/configure card 1 xiom x1 xiom-type iom-s-3.0t admin-state enable\n+/configure card 1 xiom x1 mda 1 mda-type ms18-100gb-qsfp28 admin-state enable\n ```\n \n ### Security and Certificate Management\n \n When `certificate.issue: true` is set, the system generates and injects TLS certificates.\n@@ -1538,14 +1476,14 @@ docker ps | grep chassis1\n # Verify slot assignments\n ssh admin@clab-mylab-chassis1-cpm-a \"show card state\"\n ```\n \n **Common Causes:**\n-- Component slots not properly defined\n-- CPM slot names must be \"A\" or \"B\" (uppercase)\n+- Component slots are duplicated, including slots that differ only by case\n - Line card slots must be numeric\n-- Environment variables not set on components\n+- The component type or MDA is not listed for that chassis in the image's `chassis_info.json` (this is logged as a warning and does not stop deployment)\n+- A node-level environment variable overrides the component value; the log names the variable that was kept\n \n ## Performance Considerations\n \n ### Template Execution Performance\n \n@@ -1638,7 +1576,7 @@ BSD 3-Clause License - See LICENSE file for details\n \n **Maintainers:**\n - Nokia Containerlab Team\n - Community Contributors\n \n-**Last Updated:** 2025-11-15\n-**SR OS Versions Supported:**  25.7+, 26.x (planned)\n+**Last Updated:** 2026-10-14\n+**SR OS Versions Supported:**  25.7+, 26.x\ndiff --git a/nodes/sros/chassis_info.go b/nodes/sros/chassis_info.go\nindex ace213b..fe5b7f8 100644",
        "lineStart": 84,
        "lineEnd": 313,
        "totalLines": 3945,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346683912,
      "end": 1792346683926
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1502ffa19001r3NyXsZawivLNq",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502fe89e0018QFygyY8f4Z4qk",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 52010,
    "input": 4141,
    "output": 136,
    "reasoning": 117,
    "cache": {
      "read": 47616,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502fe89e0018QFygyY8f4Z4qk",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346679454,
    "completed": 1792346683933
  },
  "parentID": "msg_1502f68f300142aYYM85hGexse",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 52010,
    "input": 4141,
    "output": 136,
    "reasoning": 117,
    "cache": {
      "read": 47616,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 29
step-start
{
  "type": "step-start",
  "id": "prt_150300215001Qee13LZWB1URNx",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502ffa27001cBH8ObbZe31Q5K"
}
Reasoning
Good. Docs hunks are now read (lines 84-311 cover both docs hunks). Now I have the complete diff seen: lines 1-3945.

Wait — I should double-check the sros_schema_gen.sh hunk completeness. The hunk was `@@ -4,15 +4,18 @@`. New file is 26 lines. Lines 4-21 new. The diff showed:
- context: CHASSIS_INFO_FILE, SCHEMA, blank
- changed jq script lines
- context: `$c | [.[].xiom ...` etc, and `.definitions["sros-cpm-types"]...`, `.definitions["sros-card-types"]...`, `.definitions["sros-sfm-types"]...`

The hunk ends there. But the actual file has 26 lines; the hunk header says +4,18 → new lines 4-21. Since the file ends at line 26 and hunk ends at new line 21, there should be trailing context lines (22-26) in the hunk... unless the diff tool only included 3 lines of trailing context and the diff.txt shown at 3941-3945 are those last lines. Let me count: hunk new span lines 4-21 = 18 lines. Context-before (lines 4-6: CHASSIS_INFO_FILE, SCHEMA, blank) = 3 lines. Changed lines: 3 removed (from old: `.[0] as $c | .[1] |` etc.) and 7 added... Let me count from the diff text:

Removed (-):
1. `  .[0] as $c | .[1] |`
2. `  ($c | [.[].mda // [] | .[] | select(. != null)]) as $mdas |`

Added (+):
1. `  .[0] as $all |`
2. `  .[1] |`
3. `  ([.. | objects | select(.enum? and (.enum | index("ixr-e2n"))) | .enum][0]) as $node_types |`
4. `  ($all | with_entries(select((.key | ascii_downcase) as $key | $node_types | index($key)))) as $c |`
5. `  ($c | [.[].mda // [] | .[] | select(. != null)] + [.[].fixed_mdas // {} | .[]]) as $mdas |`

That's 2 removed + 5 added. New hunk: 3 (context before) + 13 (unchanged body lines) + 5 added + remaining context lines. 3+5 = 8; 18-8 = 10 lines of unchanged body + trailing context shown at 3941-3945 = 5 lines. So unchanged middle = 5? The middle context lines shown in diff at 3936-3941 ($cpms, $cards, $sfms, then $xioms) — actually shown: `($c | [.[].cpm...` , `($c | [.[].iom...`, `($c | [.[].sfm...`, then at 3941 `$xioms`... wait 3941 was `$c | [.[].xiom...`? Line 3941 shows `($c | [.[].xiom // [] | .[]]) as $xioms |`. So middle context = 4 lines. Then trailing = 4 lines (the .definitions lines at 3943-3945). 3+4+5+4 = 16, not 18. Hmm, off by 2. Whatever — the diff might be missing the very last 2 lines (`.definitions["sros-mda-types"]...` and maybe xiom line) OR the read output was capped. Actually the read output at the end said "End of file - total 3945 lines" — no truncation message. But wait, the first read of this range said "(Output capped at 50 KB. Showing lines 2548-3940...)" — that was the earlier read capped at 50KB. The second read (offset 3941) showed lines 3941-3945 and said "End of file - total 3945 lines". So diff.txt genuinely ends at 3945, mid-hunk. That means diff.txt itself was truncated at the source (the diff for sros_schema_gen.sh is cut off). Hmm, or the diff was truncated at some byte budget. Either way, I have the full head file? No — /source/utils/sros_schema_gen.sh doesn't exist; /source/head/utils/... let me check with glob for head/utils.

Actually the glob output was truncated at 100 results. Let me glob /source/head/utils/*.

Also, remaining verification tasks:
1. Check `chassis_info.go` head file completely (I read it before but truncated at line 57). It's 222 lines.
2. Check `component.go` (309 lines), `component_config.go` (393), `config.go` (345), `netns.go` (157), `power.go` (95), `template.go` (99), `variant.go` (170) — I read truncated versions before. To be thorough for correctness findings, I should read the complete versions of key files: chassis_info.go, component.go, component_config.go, config.go, and sros.go regions relevant to Init/PreDeploy/component creation. sros.go is 1910 lines — I read start + 1700-1753 earlier plus diff hunks 1588-2547.

Given budget, focus on the most valuable reads: head/sros package files (they exist under /source/head/nodes/sros/ presumably). Let me glob that dir.
The docs hunks are now covered. Let me enumerate the head snapshot's `nodes/sros` and `utils` files, and finish reading the `sros_schema_gen.sh` hunk context to determine whether the diff tail was truncated.
glob · completed

Input

{
  "path": "/source/head/nodes/sros",
  "pattern": "*"
}

Output

/source/head/nodes/sros/ssh_test.go
/source/head/nodes/sros/chassis_info.go
/source/head/nodes/sros/configs/sros_config_sros25.go.tpl
/source/head/nodes/sros/configs/10_snmpv2.cfg
/source/head/nodes/sros/configs/ixr/ixr_config_classic.go.tpl
/source/head/nodes/sros/configs/ixr/12_grpc.cfg
/source/head/nodes/sros/configs/ixr/12_grpc_insecure.cfg
/source/head/nodes/sros/configs/ixr/14_system.cfg
/source/head/nodes/sros/configs/12_grpc.cfg
/source/head/nodes/sros/configs/11_logging.cfg
/source/head/nodes/sros/configs/15_ssh.cfg
/source/head/nodes/sros/configs/12_grpc_insecure.cfg
/source/head/nodes/sros/configs/sar/12_grpc.cfg
/source/head/nodes/sros/configs/sar/sar_config_classic.go.tpl
/source/head/nodes/sros/configs/sar/12_grpc_insecure.cfg
/source/head/nodes/sros/configs/sar/14_system.cfg
/source/head/nodes/sros/configs/14_system.cfg
/source/head/nodes/sros/configs/13_netconf.cfg
/source/head/nodes/sros/configs/sros_config_classic.go.tpl
/source/head/nodes/sros/variant.go
/source/head/nodes/sros/version_test.go
/source/head/nodes/sros/netns.go
/source/head/nodes/sros/sros.go
/source/head/nodes/sros/README.md
/source/head/nodes/sros/component_test.go
/source/head/nodes/sros/config.go
/source/head/nodes/sros/banner.go
/source/head/nodes/sros/template.go
/source/head/nodes/sros/macaddr.go
/source/head/nodes/sros/configs_embed.go
/source/head/nodes/sros/component_config.go
/source/head/nodes/sros/sros_test.go
/source/head/nodes/sros/prompt_test.go
/source/head/nodes/sros/chassis_info_test.go
/source/head/nodes/sros/ssh.go
/source/head/nodes/sros/test_data/rsa_key
/source/head/nodes/sros/component.go
/source/head/nodes/sros/version.go
/source/head/nodes/sros/prompt.go
/source/head/nodes/sros/power.go
Tool metadata
{
  "type": "tool",
  "id": "prt_150302a23001b7O2MQy6rjL5K4",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502ffa27001cBH8ObbZe31Q5K",
  "callID": "call_de95104673154a7787f41eba",
  "tool": "glob",
  "state": {
    "status": "completed",
    "input": {
      "path": "/source/head/nodes/sros",
      "pattern": "*"
    },
    "output": "/source/head/nodes/sros/ssh_test.go\n/source/head/nodes/sros/chassis_info.go\n/source/head/nodes/sros/configs/sros_config_sros25.go.tpl\n/source/head/nodes/sros/configs/10_snmpv2.cfg\n/source/head/nodes/sros/configs/ixr/ixr_config_classic.go.tpl\n/source/head/nodes/sros/configs/ixr/12_grpc.cfg\n/source/head/nodes/sros/configs/ixr/12_grpc_insecure.cfg\n/source/head/nodes/sros/configs/ixr/14_system.cfg\n/source/head/nodes/sros/configs/12_grpc.cfg\n/source/head/nodes/sros/configs/11_logging.cfg\n/source/head/nodes/sros/configs/15_ssh.cfg\n/source/head/nodes/sros/configs/12_grpc_insecure.cfg\n/source/head/nodes/sros/configs/sar/12_grpc.cfg\n/source/head/nodes/sros/configs/sar/sar_config_classic.go.tpl\n/source/head/nodes/sros/configs/sar/12_grpc_insecure.cfg\n/source/head/nodes/sros/configs/sar/14_system.cfg\n/source/head/nodes/sros/configs/14_system.cfg\n/source/head/nodes/sros/configs/13_netconf.cfg\n/source/head/nodes/sros/configs/sros_config_classic.go.tpl\n/source/head/nodes/sros/variant.go\n/source/head/nodes/sros/version_test.go\n/source/head/nodes/sros/netns.go\n/source/head/nodes/sros/sros.go\n/source/head/nodes/sros/README.md\n/source/head/nodes/sros/component_test.go\n/source/head/nodes/sros/config.go\n/source/head/nodes/sros/banner.go\n/source/head/nodes/sros/template.go\n/source/head/nodes/sros/macaddr.go\n/source/head/nodes/sros/configs_embed.go\n/source/head/nodes/sros/component_config.go\n/source/head/nodes/sros/sros_test.go\n/source/head/nodes/sros/prompt_test.go\n/source/head/nodes/sros/chassis_info_test.go\n/source/head/nodes/sros/ssh.go\n/source/head/nodes/sros/test_data/rsa_key\n/source/head/nodes/sros/component.go\n/source/head/nodes/sros/version.go\n/source/head/nodes/sros/prompt.go\n/source/head/nodes/sros/power.go",
    "title": "source/head/nodes/sros",
    "metadata": {
      "count": 40,
      "truncated": false
    },
    "time": {
      "start": 1792346696232,
      "end": 1792346696242
    }
  }
}
glob · completed

Input

{
  "path": "/source/head/utils",
  "pattern": "*"
}

Output

/source/head/utils/ssh_test.go
/source/head/utils/containers.go
/source/head/utils/if-wait.sh
/source/head/utils/containers_test.go
/source/head/utils/progress/progress.go
/source/head/utils/progress/model.go
/source/head/utils/keys_test.go
/source/head/utils/regexp.go
/source/head/utils/resolve_test.go
/source/head/utils/strings.go
/source/head/utils/owner_test.go
/source/head/utils/netlink.go
/source/head/utils/env_test.go
/source/head/utils/file_test.go
/source/head/utils/networkcli.go
/source/head/utils/process.go
/source/head/utils/owner.go
/source/head/utils/events.go
/source/head/utils/regexp_test.go
/source/head/utils/ip.go
/source/head/utils/sudo.go
/source/head/utils/template.go
/source/head/utils/macvlan.go
/source/head/utils/if-wait.go
/source/head/utils/file.go
/source/head/utils/ipam/ip_allocator_test.go
/source/head/utils/ipam/dad_test.go
/source/head/utils/ipam/ip_allocator.go
/source/head/utils/ipam/dad.go
/source/head/utils/env.go
/source/head/utils/userauth.go
/source/head/utils/password.go
/source/head/utils/sros_schema_gen.sh
/source/head/utils/netlink_test.go
/source/head/utils/keys.go
/source/head/utils/ethtool.go
/source/head/utils/selector/selector.go
/source/head/utils/ip_test.go
/source/head/utils/diff.go
/source/head/utils/firacode-download.ps1
/source/head/utils/ssh.go
/source/head/utils/kernel_module.go
/source/head/utils/test_data/keys1.txt
/source/head/utils/test_data/keys
/source/head/utils/resolve.go
/source/head/utils/kernel_module_test.go
/source/head/utils/template_test.go
/source/head/utils/quick-setup.sh
/source/head/utils/postinstall.sh
Tool metadata
{
  "type": "tool",
  "id": "prt_150302a59001TVfUYbUPlhdajH",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502ffa27001cBH8ObbZe31Q5K",
  "callID": "call_29a80484dc9e4f7faee16b2a",
  "tool": "glob",
  "state": {
    "status": "completed",
    "input": {
      "path": "/source/head/utils",
      "pattern": "*"
    },
    "output": "/source/head/utils/ssh_test.go\n/source/head/utils/containers.go\n/source/head/utils/if-wait.sh\n/source/head/utils/containers_test.go\n/source/head/utils/progress/progress.go\n/source/head/utils/progress/model.go\n/source/head/utils/keys_test.go\n/source/head/utils/regexp.go\n/source/head/utils/resolve_test.go\n/source/head/utils/strings.go\n/source/head/utils/owner_test.go\n/source/head/utils/netlink.go\n/source/head/utils/env_test.go\n/source/head/utils/file_test.go\n/source/head/utils/networkcli.go\n/source/head/utils/process.go\n/source/head/utils/owner.go\n/source/head/utils/events.go\n/source/head/utils/regexp_test.go\n/source/head/utils/ip.go\n/source/head/utils/sudo.go\n/source/head/utils/template.go\n/source/head/utils/macvlan.go\n/source/head/utils/if-wait.go\n/source/head/utils/file.go\n/source/head/utils/ipam/ip_allocator_test.go\n/source/head/utils/ipam/dad_test.go\n/source/head/utils/ipam/ip_allocator.go\n/source/head/utils/ipam/dad.go\n/source/head/utils/env.go\n/source/head/utils/userauth.go\n/source/head/utils/password.go\n/source/head/utils/sros_schema_gen.sh\n/source/head/utils/netlink_test.go\n/source/head/utils/keys.go\n/source/head/utils/ethtool.go\n/source/head/utils/selector/selector.go\n/source/head/utils/ip_test.go\n/source/head/utils/diff.go\n/source/head/utils/firacode-download.ps1\n/source/head/utils/ssh.go\n/source/head/utils/kernel_module.go\n/source/head/utils/test_data/keys1.txt\n/source/head/utils/test_data/keys\n/source/head/utils/resolve.go\n/source/head/utils/kernel_module_test.go\n/source/head/utils/template_test.go\n/source/head/utils/quick-setup.sh\n/source/head/utils/postinstall.sh",
    "title": "source/head/utils",
    "metadata": {
      "count": 49,
      "truncated": false
    },
    "time": {
      "start": 1792346696286,
      "end": 1792346696302
    }
  }
}
read · completed

Input

{
  "filePath": "/source/diff.txt",
  "limit": 50,
  "offset": 3895
}

Output

<path>/source/diff.txt</path>
<type>file</type>
<content>
3895: diff --git a/tests/srsim.robot b/tests/srsim.robot
3896: new file mode 100644
3897: index 0000000..6d7c7fc
3898: --- /dev/null
3899: +++ b/tests/srsim.robot
3900: @@ -0,0 +1,20 @@
3901: +*** Settings ***
3902: +Library     OperatingSystem
3903: +Resource    common.robot
3904: +
3905: +
3906: +*** Keywords ***
3907: +Deploy SR-SIM Lab
3908: +    [Arguments]    ${topology}    ${runtime}
3909: +    Log    ${topology}
3910: +    ${rc}    ${output} =    Run And Return Rc And Output
3911: +    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${topology}
3912: +    Log    ${output}
3913: +    Should Be Equal As Integers    ${rc}    0
3914: +
3915: +Destroy SR-SIM Lab
3916: +    [Arguments]    ${topology}    ${runtime}
3917: +    ${rc}    ${output} =    Run And Return Rc And Output
3918: +    ...    ${CLAB_BIN} --runtime ${runtime} destroy -t ${topology} --cleanup
3919: +    Log    ${output}
3920: +    Should Be Equal As Integers    ${rc}    0
3921: diff --git a/utils/sros_schema_gen.sh b/utils/sros_schema_gen.sh
3922: index 868c9d9..c2cef5b 100755
3923: --- a/utils/sros_schema_gen.sh
3924: +++ b/utils/sros_schema_gen.sh
3925: @@ -4,15 +4,18 @@
3926:  
3927:  CHASSIS_INFO_FILE=chassis_info.json
3928:  SCHEMA=../schemas/clab.schema.json
3929:  
3930:  jq --indent 4 -s '
3931: -  .[0] as $c | .[1] |
3932: +  .[0] as $all |
3933: +  .[1] |
3934: +  ([.. | objects | select(.enum? and (.enum | index("ixr-e2n"))) | .enum][0]) as $node_types |
3935: +  ($all | with_entries(select((.key | ascii_downcase) as $key | $node_types | index($key)))) as $c |
3936:    ($c | [.[].cpm // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cpms |
3937:    ($c | [.[].iom // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cards |
3938:    ($c | [.[].sfm // [] | .[]]) as $sfms |
3939: -  ($c | [.[].mda // [] | .[] | select(. != null)]) as $mdas |
3940: +  ($c | [.[].mda // [] | .[] | select(. != null)] + [.[].fixed_mdas // {} | .[]]) as $mdas |
3941:    ($c | [.[].xiom // [] | .[]]) as $xioms |
3942:  
3943:    .definitions["sros-cpm-types"].enum |= (. + $cpms | unique | sort) |
3944:    .definitions["sros-card-types"].enum |= (. + $cards | unique | sort) |

(Showing lines 3895-3944 of 3945. Use offset=3945 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_150302b1b001qRMekX6T73Y78W",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502ffa27001cBH8ObbZe31Q5K",
  "callID": "call_8824d70ce87246af813aae06",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/diff.txt",
      "limit": 50,
      "offset": 3895
    },
    "output": "<path>/source/diff.txt</path>\n<type>file</type>\n<content>\n3895: diff --git a/tests/srsim.robot b/tests/srsim.robot\n3896: new file mode 100644\n3897: index 0000000..6d7c7fc\n3898: --- /dev/null\n3899: +++ b/tests/srsim.robot\n3900: @@ -0,0 +1,20 @@\n3901: +*** Settings ***\n3902: +Library     OperatingSystem\n3903: +Resource    common.robot\n3904: +\n3905: +\n3906: +*** Keywords ***\n3907: +Deploy SR-SIM Lab\n3908: +    [Arguments]    ${topology}    ${runtime}\n3909: +    Log    ${topology}\n3910: +    ${rc}    ${output} =    Run And Return Rc And Output\n3911: +    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${topology}\n3912: +    Log    ${output}\n3913: +    Should Be Equal As Integers    ${rc}    0\n3914: +\n3915: +Destroy SR-SIM Lab\n3916: +    [Arguments]    ${topology}    ${runtime}\n3917: +    ${rc}    ${output} =    Run And Return Rc And Output\n3918: +    ...    ${CLAB_BIN} --runtime ${runtime} destroy -t ${topology} --cleanup\n3919: +    Log    ${output}\n3920: +    Should Be Equal As Integers    ${rc}    0\n3921: diff --git a/utils/sros_schema_gen.sh b/utils/sros_schema_gen.sh\n3922: index 868c9d9..c2cef5b 100755\n3923: --- a/utils/sros_schema_gen.sh\n3924: +++ b/utils/sros_schema_gen.sh\n3925: @@ -4,15 +4,18 @@\n3926:  \n3927:  CHASSIS_INFO_FILE=chassis_info.json\n3928:  SCHEMA=../schemas/clab.schema.json\n3929:  \n3930:  jq --indent 4 -s '\n3931: -  .[0] as $c | .[1] |\n3932: +  .[0] as $all |\n3933: +  .[1] |\n3934: +  ([.. | objects | select(.enum? and (.enum | index(\"ixr-e2n\"))) | .enum][0]) as $node_types |\n3935: +  ($all | with_entries(select((.key | ascii_downcase) as $key | $node_types | index($key)))) as $c |\n3936:    ($c | [.[].cpm // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cpms |\n3937:    ($c | [.[].iom // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cards |\n3938:    ($c | [.[].sfm // [] | .[]]) as $sfms |\n3939: -  ($c | [.[].mda // [] | .[] | select(. != null)]) as $mdas |\n3940: +  ($c | [.[].mda // [] | .[] | select(. != null)] + [.[].fixed_mdas // {} | .[]]) as $mdas |\n3941:    ($c | [.[].xiom // [] | .[]]) as $xioms |\n3942:  \n3943:    .definitions[\"sros-cpm-types\"].enum |= (. + $cpms | unique | sort) |\n3944:    .definitions[\"sros-card-types\"].enum |= (. + $cards | unique | sort) |\n\n(Showing lines 3895-3944 of 3945. Use offset=3945 to continue.)\n</content>",
    "title": "source/diff.txt",
    "metadata": {
      "preview": "diff --git a/tests/srsim.robot b/tests/srsim.robot\nnew file mode 100644\nindex 0000000..6d7c7fc\n--- /dev/null\n+++ b/tests/srsim.robot\n@@ -0,0 +1,20 @@\n+*** Settings ***\n+Library     OperatingSystem\n+Resource    common.robot\n+\n+\n+*** Keywords ***\n+Deploy SR-SIM Lab\n+    [Arguments]    ${topology}    ${runtime}\n+    Log    ${topology}\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${topology}\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/diff.txt",
        "text": "diff --git a/tests/srsim.robot b/tests/srsim.robot\nnew file mode 100644\nindex 0000000..6d7c7fc\n--- /dev/null\n+++ b/tests/srsim.robot\n@@ -0,0 +1,20 @@\n+*** Settings ***\n+Library     OperatingSystem\n+Resource    common.robot\n+\n+\n+*** Keywords ***\n+Deploy SR-SIM Lab\n+    [Arguments]    ${topology}    ${runtime}\n+    Log    ${topology}\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    ${CLAB_BIN} --runtime ${runtime} deploy -t ${topology}\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\n+\n+Destroy SR-SIM Lab\n+    [Arguments]    ${topology}    ${runtime}\n+    ${rc}    ${output} =    Run And Return Rc And Output\n+    ...    ${CLAB_BIN} --runtime ${runtime} destroy -t ${topology} --cleanup\n+    Log    ${output}\n+    Should Be Equal As Integers    ${rc}    0\ndiff --git a/utils/sros_schema_gen.sh b/utils/sros_schema_gen.sh\nindex 868c9d9..c2cef5b 100755\n--- a/utils/sros_schema_gen.sh\n+++ b/utils/sros_schema_gen.sh\n@@ -4,15 +4,18 @@\n \n CHASSIS_INFO_FILE=chassis_info.json\n SCHEMA=../schemas/clab.schema.json\n \n jq --indent 4 -s '\n-  .[0] as $c | .[1] |\n+  .[0] as $all |\n+  .[1] |\n+  ([.. | objects | select(.enum? and (.enum | index(\"ixr-e2n\"))) | .enum][0]) as $node_types |\n+  ($all | with_entries(select((.key | ascii_downcase) as $key | $node_types | index($key)))) as $c |\n   ($c | [.[].cpm // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cpms |\n   ($c | [.[].iom // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cards |\n   ($c | [.[].sfm // [] | .[]]) as $sfms |\n-  ($c | [.[].mda // [] | .[] | select(. != null)]) as $mdas |\n+  ($c | [.[].mda // [] | .[] | select(. != null)] + [.[].fixed_mdas // {} | .[]]) as $mdas |\n   ($c | [.[].xiom // [] | .[]]) as $xioms |\n \n   .definitions[\"sros-cpm-types\"].enum |= (. + $cpms | unique | sort) |\n   .definitions[\"sros-card-types\"].enum |= (. + $cards | unique | sort) |",
        "lineStart": 3895,
        "lineEnd": 3944,
        "totalLines": 3945,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346696482,
      "end": 1792346696516
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_150302b47001sV05NpPmpLdvr1",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1502ffa27001cBH8ObbZe31Q5K",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 57948,
    "input": 4621,
    "output": 113,
    "reasoning": 1246,
    "cache": {
      "read": 51968,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1502ffa27001cBH8ObbZe31Q5K",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346683943,
    "completed": 1792346696524
  },
  "parentID": "msg_1502f68f300142aYYM85hGexse",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 57948,
    "input": 4621,
    "output": 113,
    "reasoning": 1246,
    "cache": {
      "read": 51968,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 30
step-start
{
  "type": "step-start",
  "id": "prt_15030344b0019HJ71R5mA7nMEF",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150302b55001SzF0Y5mto636c3"
}
Reasoning
The diff.txt ends at line 3945 — truncated mid-hunk for `utils/sros_schema_gen.sh`. But the head file exists at `/source/head/utils/sros_schema_gen.sh`. Let me read it to see the complete script.

Also let me now read the complete head files for the key new/changed sros files to verify correctness claims:
- `/source/head/utils/sros_schema_gen.sh` (26 lines)
- `/source/head/nodes/sros/chassis_info.go` (222)
- `/source/head/nodes/sros/component.go` (309)
- `/source/head/nodes/sros/component_config.go` (393)
The diff is truncated at the very end of the `sros_schema_gen.sh` hunk, but the head file exists in the snapshot. Let me read it plus the complete `chassis_info.go`, `component.go`, and `component_config.go` head files, which I previously only saw partially.
read · completed

Input

{
  "filePath": "/source/head/utils/sros_schema_gen.sh"
}

Output

<path>/source/head/utils/sros_schema_gen.sh</path>
<type>file</type>
<content>
1: #!/bin/bash
2: 
3: # first extract chassis info file from srsim then use the script to update the schema enums.
4: 
5: CHASSIS_INFO_FILE=chassis_info.json
6: SCHEMA=../schemas/clab.schema.json
7: 
8: jq --indent 4 -s '
9:   .[0] as $all |
10:   .[1] |
11:   ([.. | objects | select(.enum? and (.enum | index("ixr-e2n"))) | .enum][0]) as $node_types |
12:   ($all | with_entries(select((.key | ascii_downcase) as $key | $node_types | index($key)))) as $c |
13:   ($c | [.[].cpm // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cpms |
14:   ($c | [.[].iom // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cards |
15:   ($c | [.[].sfm // [] | .[]]) as $sfms |
16:   ($c | [.[].mda // [] | .[] | select(. != null)] + [.[].fixed_mdas // {} | .[]]) as $mdas |
17:   ($c | [.[].xiom // [] | .[]]) as $xioms |
18: 
19:   .definitions["sros-cpm-types"].enum |= (. + $cpms | unique | sort) |
20:   .definitions["sros-card-types"].enum |= (. + $cards | unique | sort) |
21:   .definitions["sros-sfm-types"].enum |= (. + $sfms | unique | sort) |
22:   .definitions["sros-mda-types"].enum |= (. + $mdas | unique | sort) |
23:   .definitions["sros-xiom-types"].enum |= (. + $xioms | unique | sort)
24: ' "$CHASSIS_INFO_FILE" "$SCHEMA" > "$SCHEMA.tmp"
25: 
26: mv "$SCHEMA.tmp" "$SCHEMA"

(End of file - total 26 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_15030398c001kyP88Titw7Tc4M",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150302b55001SzF0Y5mto636c3",
  "callID": "call_b872ba1ea4ed42cf88c64d3f",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/utils/sros_schema_gen.sh"
    },
    "output": "<path>/source/head/utils/sros_schema_gen.sh</path>\n<type>file</type>\n<content>\n1: #!/bin/bash\n2: \n3: # first extract chassis info file from srsim then use the script to update the schema enums.\n4: \n5: CHASSIS_INFO_FILE=chassis_info.json\n6: SCHEMA=../schemas/clab.schema.json\n7: \n8: jq --indent 4 -s '\n9:   .[0] as $all |\n10:   .[1] |\n11:   ([.. | objects | select(.enum? and (.enum | index(\"ixr-e2n\"))) | .enum][0]) as $node_types |\n12:   ($all | with_entries(select((.key | ascii_downcase) as $key | $node_types | index($key)))) as $c |\n13:   ($c | [.[].cpm // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cpms |\n14:   ($c | [.[].iom // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cards |\n15:   ($c | [.[].sfm // [] | .[]]) as $sfms |\n16:   ($c | [.[].mda // [] | .[] | select(. != null)] + [.[].fixed_mdas // {} | .[]]) as $mdas |\n17:   ($c | [.[].xiom // [] | .[]]) as $xioms |\n18: \n19:   .definitions[\"sros-cpm-types\"].enum |= (. + $cpms | unique | sort) |\n20:   .definitions[\"sros-card-types\"].enum |= (. + $cards | unique | sort) |\n21:   .definitions[\"sros-sfm-types\"].enum |= (. + $sfms | unique | sort) |\n22:   .definitions[\"sros-mda-types\"].enum |= (. + $mdas | unique | sort) |\n23:   .definitions[\"sros-xiom-types\"].enum |= (. + $xioms | unique | sort)\n24: ' \"$CHASSIS_INFO_FILE\" \"$SCHEMA\" > \"$SCHEMA.tmp\"\n25: \n26: mv \"$SCHEMA.tmp\" \"$SCHEMA\"\n\n(End of file - total 26 lines)\n</content>",
    "title": "source/head/utils/sros_schema_gen.sh",
    "metadata": {
      "preview": "#!/bin/bash\n\n# first extract chassis info file from srsim then use the script to update the schema enums.\n\nCHASSIS_INFO_FILE=chassis_info.json\nSCHEMA=../schemas/clab.schema.json\n\njq --indent 4 -s '\n  .[0] as $all |\n  .[1] |\n  ([.. | objects | select(.enum? and (.enum | index(\"ixr-e2n\"))) | .enum][0]) as $node_types |\n  ($all | with_entries(select((.key | ascii_downcase) as $key | $node_types | index($key)))) as $c |\n  ($c | [.[].cpm // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cpms |\n  ($c | [.[].iom // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cards |\n  ($c | [.[].sfm // [] | .[]]) as $sfms |\n  ($c | [.[].mda // [] | .[] | select(. != null)] + [.[].fixed_mdas // {} | .[]]) as $mdas |\n  ($c | [.[].xiom // [] | .[]]) as $xioms |\n\n  .definitions[\"sros-cpm-types\"].enum |= (. + $cpms | unique | sort) |\n  .definitions[\"sros-card-types\"].enum |= (. + $cards | unique | sort) |",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/utils/sros_schema_gen.sh",
        "text": "#!/bin/bash\n\n# first extract chassis info file from srsim then use the script to update the schema enums.\n\nCHASSIS_INFO_FILE=chassis_info.json\nSCHEMA=../schemas/clab.schema.json\n\njq --indent 4 -s '\n  .[0] as $all |\n  .[1] |\n  ([.. | objects | select(.enum? and (.enum | index(\"ixr-e2n\"))) | .enum][0]) as $node_types |\n  ($all | with_entries(select((.key | ascii_downcase) as $key | $node_types | index($key)))) as $c |\n  ($c | [.[].cpm // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cpms |\n  ($c | [.[].iom // [] | .[]] + [.[].fixed_hw_cfg // empty]) as $cards |\n  ($c | [.[].sfm // [] | .[]]) as $sfms |\n  ($c | [.[].mda // [] | .[] | select(. != null)] + [.[].fixed_mdas // {} | .[]]) as $mdas |\n  ($c | [.[].xiom // [] | .[]]) as $xioms |\n\n  .definitions[\"sros-cpm-types\"].enum |= (. + $cpms | unique | sort) |\n  .definitions[\"sros-card-types\"].enum |= (. + $cards | unique | sort) |\n  .definitions[\"sros-sfm-types\"].enum |= (. + $sfms | unique | sort) |\n  .definitions[\"sros-mda-types\"].enum |= (. + $mdas | unique | sort) |\n  .definitions[\"sros-xiom-types\"].enum |= (. + $xioms | unique | sort)\n' \"$CHASSIS_INFO_FILE\" \"$SCHEMA\" > \"$SCHEMA.tmp\"\n\nmv \"$SCHEMA.tmp\" \"$SCHEMA\"",
        "lineStart": 1,
        "lineEnd": 26,
        "totalLines": 26,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346700176,
      "end": 1792346700181
    }
  }
}
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/chassis_info.go"
}

Output

<path>/source/head/nodes/sros/chassis_info.go</path>
<type>file</type>
<content>
1: // Copyright 2025 Nokia
2: // Licensed under the BSD 3-Clause License.
3: // SPDX-License-Identifier: BSD-3-Clause
4: 
5: package sros
6: 
7: import (
8: 	"encoding/json"
9: 	"fmt"
10: 	"slices"
11: 	"strconv"
12: 	"strings"
13: )
14: 
15: // DefaultChassisInfoPath is the path to chassis_info.json inside SROS/SR SIM container images.
16: const DefaultChassisInfoPath = "/opt/nokia/chassis_info.json"
17: 
18: // chassisInfoFileLicense is prepended to the chassis_info.json file written to LabDir.
19: const chassisInfoFileLicense = "// Copyright 2026 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\n"
20: 
21: type chassisInfoEntry struct {
22: 	Alias      string            `json:"alias"`
23: 	CPM        []string          `json:"cpm"`
24: 	IOM        []string          `json:"iom"`
25: 	IOMSlots   int               `json:"iom_slots"`
26: 	MDA        []*string         `json:"mda"`
27: 	FixedMDAs  map[string]string `json:"fixed_mdas"`
28: 	SFM        []string          `json:"sfm"`
29: 	XIOM       []string          `json:"xiom"`
30: 	FixedHWCfg string            `json:"fixed_hw_cfg"`
31: 	Integrated bool              `json:"integrated"`
32: 	Redundant  bool              `json:"redundant"`
33: }
34: 
35: type chassisInfo map[string]chassisInfoEntry
36: 
37: func parseChassisInfo(content []byte) (chassisInfo, error) {
38: 	var info chassisInfo
39: 	if err := json.Unmarshal(content, &info); err != nil {
40: 		return nil, fmt.Errorf("parse chassis_info.json: %w", err)
41: 	}
42: 	return info, nil
43: }
44: 
45: func (i chassisInfo) entry(nodeType string) (chassisInfoEntry, bool) {
46: 	key := ""
47: 	for candidate := range i {
48: 		if strings.EqualFold(candidate, strings.TrimSpace(nodeType)) {
49: 			key = candidate
50: 			break
51: 		}
52: 	}
53: 	if key == "" {
54: 		return chassisInfoEntry{}, false
55: 	}
56: 
57: 	seen := map[string]struct{}{}
58: 	for {
59: 		if _, ok := seen[key]; ok {
60: 			return chassisInfoEntry{}, false
61: 		}
62: 		seen[key] = struct{}{}
63: 
64: 		entry := i[key]
65: 		if entry.Alias == "" {
66: 			return entry, true
67: 		}
68: 
69: 		key = ""
70: 		for candidate := range i {
71: 			if strings.EqualFold(candidate, entry.Alias) {
72: 				key = candidate
73: 				break
74: 			}
75: 		}
76: 		if key == "" {
77: 			return chassisInfoEntry{}, false
78: 		}
79: 	}
80: }
81: 
82: // componentWarnings returns best-effort validation warnings. It deliberately skips checks
83: // that chassis_info.json cannot express, such as which MDA types belong under a specific XIOM.
84: func (i chassisInfo) componentWarnings(nodeType, sfm string, components []*Component) []string {
85: 	entry, ok := i.entry(nodeType)
86: 	if !ok {
87: 		return []string{
88: 			fmt.Sprintf(
89: 				"chassis type %q is not present in chassis_info.json; component compatibility was not checked",
90: 				nodeType,
91: 			),
92: 		}
93: 	}
94: 
95: 	var warnings []string
96: 	if sfm != "" && len(entry.SFM) > 0 && !slices.Contains(entry.SFM, sfm) {
97: 		warnings = append(warnings, fmt.Sprintf(
98: 			"SFM type %q is not listed for chassis type %q",
99: 			sfm,
100: 			nodeType,
101: 		))
102: 	}
103: 
104: 	for _, component := range components {
105: 		if component == nil {
106: 			continue
107: 		}
108: 		slot := strings.ToUpper(strings.TrimSpace(component.Slot))
109: 		if slot == "" {
110: 			slot = slotAName
111: 		}
112: 
113: 		switch {
114: 		case slot == slotAName || slot == slotBName:
115: 			if slot == slotBName && !entry.Redundant {
116: 				warnings = append(warnings, fmt.Sprintf(
117: 					"component slot %s is not listed as supported for chassis type %q",
118: 					slot,
119: 					nodeType,
120: 				))
121: 			}
122: 			if component.Type != "" &&
123: 				entry.FixedHWCfg != "" &&
124: 				component.Type != entry.FixedHWCfg {
125: 				warnings = append(warnings, fmt.Sprintf(
126: 					"component type %q in slot %s does not match fixed hardware %q for chassis type %q",
127: 					component.Type,
128: 					slot,
129: 					entry.FixedHWCfg,
130: 					nodeType,
131: 				))
132: 			} else if component.Type != "" &&
133: 				entry.FixedHWCfg == "" &&
134: 				len(entry.CPM) > 0 &&
135: 				!slices.Contains(entry.CPM, component.Type) {
136: 				warnings = append(warnings, fmt.Sprintf(
137: 					"component type %q in slot %s is not listed for chassis type %q",
138: 					component.Type,
139: 					slot,
140: 					nodeType,
141: 				))
142: 			}
143: 		default:
144: 			numericSlot, err := strconv.Atoi(slot)
145: 			if err == nil {
146: 				if entry.IOMSlots > 0 && numericSlot > entry.IOMSlots {
147: 					warnings = append(warnings, fmt.Sprintf(
148: 						"component slot %s exceeds the %d IOM slots listed for chassis type %q",
149: 						slot,
150: 						entry.IOMSlots,
151: 						nodeType,
152: 					))
153: 				}
154: 				if component.Type != "" &&
155: 					len(entry.IOM) > 0 &&
156: 					!slices.Contains(entry.IOM, component.Type) {
157: 					warnings = append(warnings, fmt.Sprintf(
158: 						"component type %q in slot %s is not listed for chassis type %q",
159: 						component.Type,
160: 						slot,
161: 						nodeType,
162: 					))
163: 				}
164: 			}
165: 		}
166: 
167: 		for _, xiom := range component.XIOM {
168: 			if xiom.Type != "" &&
169: 				len(entry.XIOM) > 0 &&
170: 				!slices.Contains(entry.XIOM, xiom.Type) {
171: 				warnings = append(warnings, fmt.Sprintf(
172: 					"XIOM type %q in component slot %s is not listed for chassis type %q",
173: 					xiom.Type,
174: 					slot,
175: 					nodeType,
176: 				))
177: 			}
178: 		}
179: 
180: 		if entry.Integrated || (slot != slotAName && slot != slotBName) {
181: 			warnings = append(warnings, validateMDAs(nodeType, entry, component.MDA)...)
182: 		}
183: 	}
184: 
185: 	return warnings
186: }
187: 
188: func validateMDAs(nodeType string, entry chassisInfoEntry, mdas MDAS) []string {
189: 	var warnings []string
190: 	for _, mda := range mdas {
191: 		if fixed, exists := entry.FixedMDAs[strconv.Itoa(mda.Slot)]; exists {
192: 			if mda.Type != fixed {
193: 				warnings = append(warnings, fmt.Sprintf(
194: 					"MDA type %q in slot %d does not match fixed MDA %q for chassis type %q",
195: 					mda.Type,
196: 					mda.Slot,
197: 					fixed,
198: 					nodeType,
199: 				))
200: 			}
201: 			continue
202: 		}
203: 		if mda.Type != "" && !containsChassisType(entry.MDA, mda.Type) {
204: 			warnings = append(warnings, fmt.Sprintf(
205: 				"MDA type %q in slot %d is not listed for chassis type %q",
206: 				mda.Type,
207: 				mda.Slot,
208: 				nodeType,
209: 			))
210: 		}
211: 	}
212: 	return warnings
213: }
214: 
215: func containsChassisType(types []*string, value string) bool {
216: 	for _, typ := range types {
217: 		if typ != nil && *typ == value {
218: 			return true
219: 		}
220: 	}
221: 	return false
222: }

(End of file - total 222 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1503039ce00160xUq1I9TRFmSE",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150302b55001SzF0Y5mto636c3",
  "callID": "call_83a11ef70a884632ba336b03",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/chassis_info.go"
    },
    "output": "<path>/source/head/nodes/sros/chassis_info.go</path>\n<type>file</type>\n<content>\n1: // Copyright 2025 Nokia\n2: // Licensed under the BSD 3-Clause License.\n3: // SPDX-License-Identifier: BSD-3-Clause\n4: \n5: package sros\n6: \n7: import (\n8: \t\"encoding/json\"\n9: \t\"fmt\"\n10: \t\"slices\"\n11: \t\"strconv\"\n12: \t\"strings\"\n13: )\n14: \n15: // DefaultChassisInfoPath is the path to chassis_info.json inside SROS/SR SIM container images.\n16: const DefaultChassisInfoPath = \"/opt/nokia/chassis_info.json\"\n17: \n18: // chassisInfoFileLicense is prepended to the chassis_info.json file written to LabDir.\n19: const chassisInfoFileLicense = \"// Copyright 2026 Nokia\\n// Licensed under the BSD 3-Clause License.\\n// SPDX-License-Identifier: BSD-3-Clause\\n\\n\"\n20: \n21: type chassisInfoEntry struct {\n22: \tAlias      string            `json:\"alias\"`\n23: \tCPM        []string          `json:\"cpm\"`\n24: \tIOM        []string          `json:\"iom\"`\n25: \tIOMSlots   int               `json:\"iom_slots\"`\n26: \tMDA        []*string         `json:\"mda\"`\n27: \tFixedMDAs  map[string]string `json:\"fixed_mdas\"`\n28: \tSFM        []string          `json:\"sfm\"`\n29: \tXIOM       []string          `json:\"xiom\"`\n30: \tFixedHWCfg string            `json:\"fixed_hw_cfg\"`\n31: \tIntegrated bool              `json:\"integrated\"`\n32: \tRedundant  bool              `json:\"redundant\"`\n33: }\n34: \n35: type chassisInfo map[string]chassisInfoEntry\n36: \n37: func parseChassisInfo(content []byte) (chassisInfo, error) {\n38: \tvar info chassisInfo\n39: \tif err := json.Unmarshal(content, &info); err != nil {\n40: \t\treturn nil, fmt.Errorf(\"parse chassis_info.json: %w\", err)\n41: \t}\n42: \treturn info, nil\n43: }\n44: \n45: func (i chassisInfo) entry(nodeType string) (chassisInfoEntry, bool) {\n46: \tkey := \"\"\n47: \tfor candidate := range i {\n48: \t\tif strings.EqualFold(candidate, strings.TrimSpace(nodeType)) {\n49: \t\t\tkey = candidate\n50: \t\t\tbreak\n51: \t\t}\n52: \t}\n53: \tif key == \"\" {\n54: \t\treturn chassisInfoEntry{}, false\n55: \t}\n56: \n57: \tseen := map[string]struct{}{}\n58: \tfor {\n59: \t\tif _, ok := seen[key]; ok {\n60: \t\t\treturn chassisInfoEntry{}, false\n61: \t\t}\n62: \t\tseen[key] = struct{}{}\n63: \n64: \t\tentry := i[key]\n65: \t\tif entry.Alias == \"\" {\n66: \t\t\treturn entry, true\n67: \t\t}\n68: \n69: \t\tkey = \"\"\n70: \t\tfor candidate := range i {\n71: \t\t\tif strings.EqualFold(candidate, entry.Alias) {\n72: \t\t\t\tkey = candidate\n73: \t\t\t\tbreak\n74: \t\t\t}\n75: \t\t}\n76: \t\tif key == \"\" {\n77: \t\t\treturn chassisInfoEntry{}, false\n78: \t\t}\n79: \t}\n80: }\n81: \n82: // componentWarnings returns best-effort validation warnings. It deliberately skips checks\n83: // that chassis_info.json cannot express, such as which MDA types belong under a specific XIOM.\n84: func (i chassisInfo) componentWarnings(nodeType, sfm string, components []*Component) []string {\n85: \tentry, ok := i.entry(nodeType)\n86: \tif !ok {\n87: \t\treturn []string{\n88: \t\t\tfmt.Sprintf(\n89: \t\t\t\t\"chassis type %q is not present in chassis_info.json; component compatibility was not checked\",\n90: \t\t\t\tnodeType,\n91: \t\t\t),\n92: \t\t}\n93: \t}\n94: \n95: \tvar warnings []string\n96: \tif sfm != \"\" && len(entry.SFM) > 0 && !slices.Contains(entry.SFM, sfm) {\n97: \t\twarnings = append(warnings, fmt.Sprintf(\n98: \t\t\t\"SFM type %q is not listed for chassis type %q\",\n99: \t\t\tsfm,\n100: \t\t\tnodeType,\n101: \t\t))\n102: \t}\n103: \n104: \tfor _, component := range components {\n105: \t\tif component == nil {\n106: \t\t\tcontinue\n107: \t\t}\n108: \t\tslot := strings.ToUpper(strings.TrimSpace(component.Slot))\n109: \t\tif slot == \"\" {\n110: \t\t\tslot = slotAName\n111: \t\t}\n112: \n113: \t\tswitch {\n114: \t\tcase slot == slotAName || slot == slotBName:\n115: \t\t\tif slot == slotBName && !entry.Redundant {\n116: \t\t\t\twarnings = append(warnings, fmt.Sprintf(\n117: \t\t\t\t\t\"component slot %s is not listed as supported for chassis type %q\",\n118: \t\t\t\t\tslot,\n119: \t\t\t\t\tnodeType,\n120: \t\t\t\t))\n121: \t\t\t}\n122: \t\t\tif component.Type != \"\" &&\n123: \t\t\t\tentry.FixedHWCfg != \"\" &&\n124: \t\t\t\tcomponent.Type != entry.FixedHWCfg {\n125: \t\t\t\twarnings = append(warnings, fmt.Sprintf(\n126: \t\t\t\t\t\"component type %q in slot %s does not match fixed hardware %q for chassis type %q\",\n127: \t\t\t\t\tcomponent.Type,\n128: \t\t\t\t\tslot,\n129: \t\t\t\t\tentry.FixedHWCfg,\n130: \t\t\t\t\tnodeType,\n131: \t\t\t\t))\n132: \t\t\t} else if component.Type != \"\" &&\n133: \t\t\t\tentry.FixedHWCfg == \"\" &&\n134: \t\t\t\tlen(entry.CPM) > 0 &&\n135: \t\t\t\t!slices.Contains(entry.CPM, component.Type) {\n136: \t\t\t\twarnings = append(warnings, fmt.Sprintf(\n137: \t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n138: \t\t\t\t\tcomponent.Type,\n139: \t\t\t\t\tslot,\n140: \t\t\t\t\tnodeType,\n141: \t\t\t\t))\n142: \t\t\t}\n143: \t\tdefault:\n144: \t\t\tnumericSlot, err := strconv.Atoi(slot)\n145: \t\t\tif err == nil {\n146: \t\t\t\tif entry.IOMSlots > 0 && numericSlot > entry.IOMSlots {\n147: \t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n148: \t\t\t\t\t\t\"component slot %s exceeds the %d IOM slots listed for chassis type %q\",\n149: \t\t\t\t\t\tslot,\n150: \t\t\t\t\t\tentry.IOMSlots,\n151: \t\t\t\t\t\tnodeType,\n152: \t\t\t\t\t))\n153: \t\t\t\t}\n154: \t\t\t\tif component.Type != \"\" &&\n155: \t\t\t\t\tlen(entry.IOM) > 0 &&\n156: \t\t\t\t\t!slices.Contains(entry.IOM, component.Type) {\n157: \t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n158: \t\t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n159: \t\t\t\t\t\tcomponent.Type,\n160: \t\t\t\t\t\tslot,\n161: \t\t\t\t\t\tnodeType,\n162: \t\t\t\t\t))\n163: \t\t\t\t}\n164: \t\t\t}\n165: \t\t}\n166: \n167: \t\tfor _, xiom := range component.XIOM {\n168: \t\t\tif xiom.Type != \"\" &&\n169: \t\t\t\tlen(entry.XIOM) > 0 &&\n170: \t\t\t\t!slices.Contains(entry.XIOM, xiom.Type) {\n171: \t\t\t\twarnings = append(warnings, fmt.Sprintf(\n172: \t\t\t\t\t\"XIOM type %q in component slot %s is not listed for chassis type %q\",\n173: \t\t\t\t\txiom.Type,\n174: \t\t\t\t\tslot,\n175: \t\t\t\t\tnodeType,\n176: \t\t\t\t))\n177: \t\t\t}\n178: \t\t}\n179: \n180: \t\tif entry.Integrated || (slot != slotAName && slot != slotBName) {\n181: \t\t\twarnings = append(warnings, validateMDAs(nodeType, entry, component.MDA)...)\n182: \t\t}\n183: \t}\n184: \n185: \treturn warnings\n186: }\n187: \n188: func validateMDAs(nodeType string, entry chassisInfoEntry, mdas MDAS) []string {\n189: \tvar warnings []string\n190: \tfor _, mda := range mdas {\n191: \t\tif fixed, exists := entry.FixedMDAs[strconv.Itoa(mda.Slot)]; exists {\n192: \t\t\tif mda.Type != fixed {\n193: \t\t\t\twarnings = append(warnings, fmt.Sprintf(\n194: \t\t\t\t\t\"MDA type %q in slot %d does not match fixed MDA %q for chassis type %q\",\n195: \t\t\t\t\tmda.Type,\n196: \t\t\t\t\tmda.Slot,\n197: \t\t\t\t\tfixed,\n198: \t\t\t\t\tnodeType,\n199: \t\t\t\t))\n200: \t\t\t}\n201: \t\t\tcontinue\n202: \t\t}\n203: \t\tif mda.Type != \"\" && !containsChassisType(entry.MDA, mda.Type) {\n204: \t\t\twarnings = append(warnings, fmt.Sprintf(\n205: \t\t\t\t\"MDA type %q in slot %d is not listed for chassis type %q\",\n206: \t\t\t\tmda.Type,\n207: \t\t\t\tmda.Slot,\n208: \t\t\t\tnodeType,\n209: \t\t\t))\n210: \t\t}\n211: \t}\n212: \treturn warnings\n213: }\n214: \n215: func containsChassisType(types []*string, value string) bool {\n216: \tfor _, typ := range types {\n217: \t\tif typ != nil && *typ == value {\n218: \t\t\treturn true\n219: \t\t}\n220: \t}\n221: \treturn false\n222: }\n\n(End of file - total 222 lines)\n</content>",
    "title": "source/head/nodes/sros/chassis_info.go",
    "metadata": {
      "preview": "// Copyright 2025 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\npackage sros\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"slices\"\n\t\"strconv\"\n\t\"strings\"\n)\n\n// DefaultChassisInfoPath is the path to chassis_info.json inside SROS/SR SIM container images.\nconst DefaultChassisInfoPath = \"/opt/nokia/chassis_info.json\"\n\n// chassisInfoFileLicense is prepended to the chassis_info.json file written to LabDir.\nconst chassisInfoFileLicense = \"// Copyright 2026 Nokia\\n// Licensed under the BSD 3-Clause License.\\n// SPDX-License-Identifier: BSD-3-Clause\\n\\n\"\n",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/chassis_info.go",
        "text": "// Copyright 2025 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\npackage sros\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"slices\"\n\t\"strconv\"\n\t\"strings\"\n)\n\n// DefaultChassisInfoPath is the path to chassis_info.json inside SROS/SR SIM container images.\nconst DefaultChassisInfoPath = \"/opt/nokia/chassis_info.json\"\n\n// chassisInfoFileLicense is prepended to the chassis_info.json file written to LabDir.\nconst chassisInfoFileLicense = \"// Copyright 2026 Nokia\\n// Licensed under the BSD 3-Clause License.\\n// SPDX-License-Identifier: BSD-3-Clause\\n\\n\"\n\ntype chassisInfoEntry struct {\n\tAlias      string            `json:\"alias\"`\n\tCPM        []string          `json:\"cpm\"`\n\tIOM        []string          `json:\"iom\"`\n\tIOMSlots   int               `json:\"iom_slots\"`\n\tMDA        []*string         `json:\"mda\"`\n\tFixedMDAs  map[string]string `json:\"fixed_mdas\"`\n\tSFM        []string          `json:\"sfm\"`\n\tXIOM       []string          `json:\"xiom\"`\n\tFixedHWCfg string            `json:\"fixed_hw_cfg\"`\n\tIntegrated bool              `json:\"integrated\"`\n\tRedundant  bool              `json:\"redundant\"`\n}\n\ntype chassisInfo map[string]chassisInfoEntry\n\nfunc parseChassisInfo(content []byte) (chassisInfo, error) {\n\tvar info chassisInfo\n\tif err := json.Unmarshal(content, &info); err != nil {\n\t\treturn nil, fmt.Errorf(\"parse chassis_info.json: %w\", err)\n\t}\n\treturn info, nil\n}\n\nfunc (i chassisInfo) entry(nodeType string) (chassisInfoEntry, bool) {\n\tkey := \"\"\n\tfor candidate := range i {\n\t\tif strings.EqualFold(candidate, strings.TrimSpace(nodeType)) {\n\t\t\tkey = candidate\n\t\t\tbreak\n\t\t}\n\t}\n\tif key == \"\" {\n\t\treturn chassisInfoEntry{}, false\n\t}\n\n\tseen := map[string]struct{}{}\n\tfor {\n\t\tif _, ok := seen[key]; ok {\n\t\t\treturn chassisInfoEntry{}, false\n\t\t}\n\t\tseen[key] = struct{}{}\n\n\t\tentry := i[key]\n\t\tif entry.Alias == \"\" {\n\t\t\treturn entry, true\n\t\t}\n\n\t\tkey = \"\"\n\t\tfor candidate := range i {\n\t\t\tif strings.EqualFold(candidate, entry.Alias) {\n\t\t\t\tkey = candidate\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif key == \"\" {\n\t\t\treturn chassisInfoEntry{}, false\n\t\t}\n\t}\n}\n\n// componentWarnings returns best-effort validation warnings. It deliberately skips checks\n// that chassis_info.json cannot express, such as which MDA types belong under a specific XIOM.\nfunc (i chassisInfo) componentWarnings(nodeType, sfm string, components []*Component) []string {\n\tentry, ok := i.entry(nodeType)\n\tif !ok {\n\t\treturn []string{\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"chassis type %q is not present in chassis_info.json; component compatibility was not checked\",\n\t\t\t\tnodeType,\n\t\t\t),\n\t\t}\n\t}\n\n\tvar warnings []string\n\tif sfm != \"\" && len(entry.SFM) > 0 && !slices.Contains(entry.SFM, sfm) {\n\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\"SFM type %q is not listed for chassis type %q\",\n\t\t\tsfm,\n\t\t\tnodeType,\n\t\t))\n\t}\n\n\tfor _, component := range components {\n\t\tif component == nil {\n\t\t\tcontinue\n\t\t}\n\t\tslot := strings.ToUpper(strings.TrimSpace(component.Slot))\n\t\tif slot == \"\" {\n\t\t\tslot = slotAName\n\t\t}\n\n\t\tswitch {\n\t\tcase slot == slotAName || slot == slotBName:\n\t\t\tif slot == slotBName && !entry.Redundant {\n\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\"component slot %s is not listed as supported for chassis type %q\",\n\t\t\t\t\tslot,\n\t\t\t\t\tnodeType,\n\t\t\t\t))\n\t\t\t}\n\t\t\tif component.Type != \"\" &&\n\t\t\t\tentry.FixedHWCfg != \"\" &&\n\t\t\t\tcomponent.Type != entry.FixedHWCfg {\n\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\"component type %q in slot %s does not match fixed hardware %q for chassis type %q\",\n\t\t\t\t\tcomponent.Type,\n\t\t\t\t\tslot,\n\t\t\t\t\tentry.FixedHWCfg,\n\t\t\t\t\tnodeType,\n\t\t\t\t))\n\t\t\t} else if component.Type != \"\" &&\n\t\t\t\tentry.FixedHWCfg == \"\" &&\n\t\t\t\tlen(entry.CPM) > 0 &&\n\t\t\t\t!slices.Contains(entry.CPM, component.Type) {\n\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n\t\t\t\t\tcomponent.Type,\n\t\t\t\t\tslot,\n\t\t\t\t\tnodeType,\n\t\t\t\t))\n\t\t\t}\n\t\tdefault:\n\t\t\tnumericSlot, err := strconv.Atoi(slot)\n\t\t\tif err == nil {\n\t\t\t\tif entry.IOMSlots > 0 && numericSlot > entry.IOMSlots {\n\t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\t\"component slot %s exceeds the %d IOM slots listed for chassis type %q\",\n\t\t\t\t\t\tslot,\n\t\t\t\t\t\tentry.IOMSlots,\n\t\t\t\t\t\tnodeType,\n\t\t\t\t\t))\n\t\t\t\t}\n\t\t\t\tif component.Type != \"\" &&\n\t\t\t\t\tlen(entry.IOM) > 0 &&\n\t\t\t\t\t!slices.Contains(entry.IOM, component.Type) {\n\t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n\t\t\t\t\t\tcomponent.Type,\n\t\t\t\t\t\tslot,\n\t\t\t\t\t\tnodeType,\n\t\t\t\t\t))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor _, xiom := range component.XIOM {\n\t\t\tif xiom.Type != \"\" &&\n\t\t\t\tlen(entry.XIOM) > 0 &&\n\t\t\t\t!slices.Contains(entry.XIOM, xiom.Type) {\n\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\"XIOM type %q in component slot %s is not listed for chassis type %q\",\n\t\t\t\t\txiom.Type,\n\t\t\t\t\tslot,\n\t\t\t\t\tnodeType,\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\n\t\tif entry.Integrated || (slot != slotAName && slot != slotBName) {\n\t\t\twarnings = append(warnings, validateMDAs(nodeType, entry, component.MDA)...)\n\t\t}\n\t}\n\n\treturn warnings\n}\n\nfunc validateMDAs(nodeType string, entry chassisInfoEntry, mdas MDAS) []string {\n\tvar warnings []string\n\tfor _, mda := range mdas {\n\t\tif fixed, exists := entry.FixedMDAs[strconv.Itoa(mda.Slot)]; exists {\n\t\t\tif mda.Type != fixed {\n\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\"MDA type %q in slot %d does not match fixed MDA %q for chassis type %q\",\n\t\t\t\t\tmda.Type,\n\t\t\t\t\tmda.Slot,\n\t\t\t\t\tfixed,\n\t\t\t\t\tnodeType,\n\t\t\t\t))\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif mda.Type != \"\" && !containsChassisType(entry.MDA, mda.Type) {\n\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\"MDA type %q in slot %d is not listed for chassis type %q\",\n\t\t\t\tmda.Type,\n\t\t\t\tmda.Slot,\n\t\t\t\tnodeType,\n\t\t\t))\n\t\t}\n\t}\n\treturn warnings\n}\n\nfunc containsChassisType(types []*string, value string) bool {\n\tfor _, typ := range types {\n\t\tif typ != nil && *typ == value {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}",
        "lineStart": 1,
        "lineEnd": 222,
        "totalLines": 222,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346700242,
      "end": 1792346700246
    }
  }
}
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/component.go"
}

Output

<path>/source/head/nodes/sros/component.go</path>
<type>file</type>
<content>
1: package sros
2: 
3: import (
4: 	"fmt"
5: 	"maps"
6: 	"slices"
7: 	"strconv"
8: 	"strings"
9: 
10: 	"github.com/charmbracelet/log"
11: )
12: 
13: // Component is an SR-SIM card: a CPM (slot A or B) or a line card.
14: type Component struct {
15: 	Slot string            `yaml:"slot,omitempty" json:"slot,omitempty"`
16: 	Type string            `yaml:"type,omitempty" json:"type,omitempty"`
17: 	Env  map[string]string `yaml:"env,omitempty" json:"env,omitempty"`
18: 	XIOM XIOMS             `yaml:"xiom,omitempty" json:"xiom,omitempty"`
19: 	MDA  MDAS              `yaml:"mda,omitempty" json:"mda,omitempty"`
20: }
21: 
22: func componentsBySlot(components []*Component) map[string]Component {
23: 	m := make(map[string]Component, len(components))
24: 
25: 	for i, c := range components {
26: 		if c == nil {
27: 			continue
28: 		}
29: 
30: 		norm := *c
31: 		norm.Slot = strings.ToUpper(strings.TrimSpace(c.Slot))
32: 
33: 		key := norm.Slot
34: 		if key == "" {
35: 			key = fmt.Sprintf("#%d", i)
36: 		}
37: 
38: 		m[key] = norm
39: 	}
40: 
41: 	return m
42: }
43: 
44: type XIOM struct {
45: 	Slot int    `yaml:"slot,omitempty" json:"slot,omitempty"`
46: 	Type string `yaml:"type,omitempty" json:"type,omitempty"`
47: 	MDA  MDAS   `yaml:"mda,omitempty" json:"mda,omitempty"`
48: }
49: 
50: type XIOMS []XIOM
51: 
52: type MDA struct {
53: 	Slot int    `yaml:"slot,omitempty" json:"slot,omitempty"`
54: 	Type string `yaml:"type,omitempty" json:"type,omitempty"`
55: }
56: 
57: type MDAS []MDA
58: 
59: func (l *MDAS) UnmarshalYAML(unmarshal func(any) error) error {
60: 	var entries []MDA
61: 	if err := unmarshal(&entries); err != nil {
62: 		return err
63: 	}
64: 
65: 	if len(entries) == 0 {
66: 		*l = nil
67: 		return nil
68: 	}
69: 
70: 	slots := map[int]struct{}{}
71: 
72: 	for _, e := range entries {
73: 		if e.Type == "" || e.Slot <= 0 {
74: 			return fmt.Errorf(
75: 				"invalid mda entry. slot and type are required, got slot %d, type %q",
76: 				e.Slot,
77: 				e.Type,
78: 			)
79: 		}
80: 
81: 		if _, exists := slots[e.Slot]; exists {
82: 			return fmt.Errorf("invalid mda entry. duplicate slot %d", e.Slot)
83: 		}
84: 
85: 		slots[e.Slot] = struct{}{}
86: 	}
87: 
88: 	*l = MDAS(entries)
89: 
90: 	return nil
91: }
92: 
93: func (l *XIOMS) UnmarshalYAML(unmarshal func(any) error) error {
94: 	var entries []XIOM
95: 
96: 	if err := unmarshal(&entries); err != nil {
97: 		return err
98: 	}
99: 
100: 	if len(entries) == 0 {
101: 		*l = nil
102: 		return nil
103: 	}
104: 
105: 	slots := map[int]struct{}{}
106: 
107: 	for _, e := range entries {
108: 		if e.Type == "" || e.Slot <= 0 {
109: 			return fmt.Errorf(
110: 				"invalid xiom entry. slot and type are required, got slot %d, type %q",
111: 				e.Slot,
112: 				e.Type,
113: 			)
114: 		}
115: 
116: 		if _, exists := slots[e.Slot]; exists {
117: 			return fmt.Errorf("invalid xiom entry. duplicate slot %d", e.Slot)
118: 		}
119: 
120: 		slots[e.Slot] = struct{}{}
121: 	}
122: 
123: 	*l = XIOMS(entries)
124: 
125: 	return nil
126: }
127: 
128: func setComponentEnvVars(env map[string]string, c *Component) {
129: 	if c.Type != "" {
130: 		env[envNokiaSrosCard] = c.Type
131: 	}
132: 
133: 	for _, x := range c.XIOM {
134: 		key := fmt.Sprintf("%s_X%d", envNokiaSrosXIOM, x.Slot)
135: 		env[key] = x.Type
136: 		// add the nested MDA
137: 		for _, m := range x.MDA {
138: 			key := fmt.Sprintf("%s_X%d_%d", envNokiaSrosMDA, x.Slot, m.Slot)
139: 			env[key] = m.Type
140: 		}
141: 	}
142: 
143: 	for _, m := range c.MDA {
144: 		key := fmt.Sprintf("%s_%d", envNokiaSrosMDA, m.Slot)
145: 		env[key] = m.Type
146: 	}
147: }
148: 
149: func (n *sros) checkComponentSlotsConfig() error {
150: 	// check Slots are unique
151: 	componentNames := map[string]struct{}{}
152: 	for _, component := range n.kindSpecificCfg().Components {
153: 		// convert slot to upper
154: 		slot := strings.ToUpper(component.Slot)
155: 		// check if slot exists
156: 		_, exists := componentNames[slot]
157: 		if exists {
158: 			return fmt.Errorf(
159: 				"node %s slot %s duplicate definition",
160: 				n.GetShortName(),
161: 				component.Slot,
162: 			)
163: 		}
164: 		// add to component names map
165: 		componentNames[slot] = struct{}{}
166: 
167: 	}
168: 	return nil
169: }
170: 
171: // componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,
172: // and per-component env. Per-component env overrides the typed fields.
173: func componentDerivedEnv(c *Component) map[string]string {
174: 	derived := map[string]string{}
175: 	if c == nil {
176: 		return derived
177: 	}
178: 	setComponentEnvVars(derived, c)
179: 	maps.Copy(derived, c.Env)
180: 	return derived
181: }
182: 
183: // warnUserEnvOverrides logs when a node env var replaces a component-derived value.
184: func warnUserEnvOverrides(node string, derived, userEnv map[string]string) {
185: 	for key, componentValue := range derived {
186: 		envValue, userSet := userEnv[key]
187: 		if !userSet || componentValue == envValue {
188: 			continue
189: 		}
190: 		log.Warn(
191: 			fmt.Sprintf(
192: 				"component value %q will not be used because environment variable %s is set",
193: 				componentValue,
194: 				key,
195: 			),
196: 			"node", node,
197: 			"env", key,
198: 			"component-value", componentValue,
199: 			"env-value", envValue,
200: 		)
201: 	}
202: }
203: 
204: // keepUserEnv copies component-derived keys into dst unless the user already set that key.
205: // A user value wins, and a differing component value is logged.
206: func keepUserEnv(node string, dst, derived, userEnv map[string]string) {
207: 	warnUserEnvOverrides(node, derived, userEnv)
208: 	for key, componentValue := range derived {
209: 		if envValue, userSet := userEnv[key]; userSet {
210: 			dst[key] = envValue
211: 			continue
212: 		}
213: 		dst[key] = componentValue
214: 	}
215: }
216: 
217: // cloneComponent returns a deep copy of c suitable for env overrides during config generation.
218: func cloneComponent(c *Component) *Component {
219: 	if c == nil {
220: 		return &Component{}
221: 	}
222: 	out := *c
223: 	out.Env = maps.Clone(c.Env)
224: 	out.MDA = slices.Clone(c.MDA)
225: 	if len(c.XIOM) > 0 {
226: 		out.XIOM = make(XIOMS, len(c.XIOM))
227: 		for i, xiom := range c.XIOM {
228: 			xiom.MDA = slices.Clone(xiom.MDA)
229: 			out.XIOM[i] = xiom
230: 		}
231: 	}
232: 	return &out
233: }
234: 
235: // applyHardwareEnv overlays SR-SIM card, XIOM, and MDA environment variables onto c.
236: // NOKIA_SROS_SLOT is left unchanged; it identifies the container rather than provisioned hardware.
237: func applyHardwareEnv(c *Component, env map[string]string) {
238: 	if c == nil || len(env) == 0 {
239: 		return
240: 	}
241: 	if card := env[envNokiaSrosCard]; card != "" {
242: 		c.Type = card
243: 	}
244: 	for key, val := range env {
245: 		if val == "" {
246: 			continue
247: 		}
248: 		switch {
249: 		case strings.HasPrefix(key, envNokiaSrosMDA+"_X"):
250: 			rest := strings.TrimPrefix(key, envNokiaSrosMDA+"_X")
251: 			xiomStr, mdaStr, ok := strings.Cut(rest, "_")
252: 			if !ok {
253: 				continue
254: 			}
255: 			xiomSlot, errX := strconv.Atoi(xiomStr)
256: 			mdaSlot, errM := strconv.Atoi(mdaStr)
257: 			if errX != nil || errM != nil || xiomSlot <= 0 || mdaSlot <= 0 {
258: 				continue
259: 			}
260: 			upsertXiomMDA(c, xiomSlot, mdaSlot, val)
261: 		case strings.HasPrefix(key, envNokiaSrosMDA+"_"):
262: 			slot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosMDA+"_"))
263: 			if err != nil || slot <= 0 {
264: 				continue
265: 			}
266: 			c.MDA = upsertMDA(c.MDA, slot, val)
267: 		case strings.HasPrefix(key, envNokiaSrosXIOM+"_X"):
268: 			slot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosXIOM+"_X"))
269: 			if err != nil || slot <= 0 {
270: 				continue
271: 			}
272: 			upsertXiomType(c, slot, val)
273: 		}
274: 	}
275: }
276: 
277: func upsertMDA(mdas MDAS, slot int, typ string) MDAS {
278: 	for i := range mdas {
279: 		if mdas[i].Slot == slot {
280: 			mdas[i].Type = typ
281: 			return mdas
282: 		}
283: 	}
284: 	return append(mdas, MDA{Slot: slot, Type: typ})
285: }
286: 
287: func upsertXiomType(c *Component, slot int, typ string) {
288: 	for i := range c.XIOM {
289: 		if c.XIOM[i].Slot == slot {
290: 			c.XIOM[i].Type = typ
291: 			return
292: 		}
293: 	}
294: 	c.XIOM = append(c.XIOM, XIOM{Slot: slot, Type: typ})
295: }
296: 
297: func upsertXiomMDA(c *Component, xiomSlot, mdaSlot int, typ string) {
298: 	for i := range c.XIOM {
299: 		if c.XIOM[i].Slot != xiomSlot {
300: 			continue
301: 		}
302: 		c.XIOM[i].MDA = upsertMDA(c.XIOM[i].MDA, mdaSlot, typ)
303: 		return
304: 	}
305: 	c.XIOM = append(c.XIOM, XIOM{
306: 		Slot: xiomSlot,
307: 		MDA:  MDAS{{Slot: mdaSlot, Type: typ}},
308: 	})
309: }

(End of file - total 309 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_150303a190013xTOUUTf0Ycarv",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150302b55001SzF0Y5mto636c3",
  "callID": "call_8a8a506a80d44a499c3d5843",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/component.go"
    },
    "output": "<path>/source/head/nodes/sros/component.go</path>\n<type>file</type>\n<content>\n1: package sros\n2: \n3: import (\n4: \t\"fmt\"\n5: \t\"maps\"\n6: \t\"slices\"\n7: \t\"strconv\"\n8: \t\"strings\"\n9: \n10: \t\"github.com/charmbracelet/log\"\n11: )\n12: \n13: // Component is an SR-SIM card: a CPM (slot A or B) or a line card.\n14: type Component struct {\n15: \tSlot string            `yaml:\"slot,omitempty\" json:\"slot,omitempty\"`\n16: \tType string            `yaml:\"type,omitempty\" json:\"type,omitempty\"`\n17: \tEnv  map[string]string `yaml:\"env,omitempty\" json:\"env,omitempty\"`\n18: \tXIOM XIOMS             `yaml:\"xiom,omitempty\" json:\"xiom,omitempty\"`\n19: \tMDA  MDAS              `yaml:\"mda,omitempty\" json:\"mda,omitempty\"`\n20: }\n21: \n22: func componentsBySlot(components []*Component) map[string]Component {\n23: \tm := make(map[string]Component, len(components))\n24: \n25: \tfor i, c := range components {\n26: \t\tif c == nil {\n27: \t\t\tcontinue\n28: \t\t}\n29: \n30: \t\tnorm := *c\n31: \t\tnorm.Slot = strings.ToUpper(strings.TrimSpace(c.Slot))\n32: \n33: \t\tkey := norm.Slot\n34: \t\tif key == \"\" {\n35: \t\t\tkey = fmt.Sprintf(\"#%d\", i)\n36: \t\t}\n37: \n38: \t\tm[key] = norm\n39: \t}\n40: \n41: \treturn m\n42: }\n43: \n44: type XIOM struct {\n45: \tSlot int    `yaml:\"slot,omitempty\" json:\"slot,omitempty\"`\n46: \tType string `yaml:\"type,omitempty\" json:\"type,omitempty\"`\n47: \tMDA  MDAS   `yaml:\"mda,omitempty\" json:\"mda,omitempty\"`\n48: }\n49: \n50: type XIOMS []XIOM\n51: \n52: type MDA struct {\n53: \tSlot int    `yaml:\"slot,omitempty\" json:\"slot,omitempty\"`\n54: \tType string `yaml:\"type,omitempty\" json:\"type,omitempty\"`\n55: }\n56: \n57: type MDAS []MDA\n58: \n59: func (l *MDAS) UnmarshalYAML(unmarshal func(any) error) error {\n60: \tvar entries []MDA\n61: \tif err := unmarshal(&entries); err != nil {\n62: \t\treturn err\n63: \t}\n64: \n65: \tif len(entries) == 0 {\n66: \t\t*l = nil\n67: \t\treturn nil\n68: \t}\n69: \n70: \tslots := map[int]struct{}{}\n71: \n72: \tfor _, e := range entries {\n73: \t\tif e.Type == \"\" || e.Slot <= 0 {\n74: \t\t\treturn fmt.Errorf(\n75: \t\t\t\t\"invalid mda entry. slot and type are required, got slot %d, type %q\",\n76: \t\t\t\te.Slot,\n77: \t\t\t\te.Type,\n78: \t\t\t)\n79: \t\t}\n80: \n81: \t\tif _, exists := slots[e.Slot]; exists {\n82: \t\t\treturn fmt.Errorf(\"invalid mda entry. duplicate slot %d\", e.Slot)\n83: \t\t}\n84: \n85: \t\tslots[e.Slot] = struct{}{}\n86: \t}\n87: \n88: \t*l = MDAS(entries)\n89: \n90: \treturn nil\n91: }\n92: \n93: func (l *XIOMS) UnmarshalYAML(unmarshal func(any) error) error {\n94: \tvar entries []XIOM\n95: \n96: \tif err := unmarshal(&entries); err != nil {\n97: \t\treturn err\n98: \t}\n99: \n100: \tif len(entries) == 0 {\n101: \t\t*l = nil\n102: \t\treturn nil\n103: \t}\n104: \n105: \tslots := map[int]struct{}{}\n106: \n107: \tfor _, e := range entries {\n108: \t\tif e.Type == \"\" || e.Slot <= 0 {\n109: \t\t\treturn fmt.Errorf(\n110: \t\t\t\t\"invalid xiom entry. slot and type are required, got slot %d, type %q\",\n111: \t\t\t\te.Slot,\n112: \t\t\t\te.Type,\n113: \t\t\t)\n114: \t\t}\n115: \n116: \t\tif _, exists := slots[e.Slot]; exists {\n117: \t\t\treturn fmt.Errorf(\"invalid xiom entry. duplicate slot %d\", e.Slot)\n118: \t\t}\n119: \n120: \t\tslots[e.Slot] = struct{}{}\n121: \t}\n122: \n123: \t*l = XIOMS(entries)\n124: \n125: \treturn nil\n126: }\n127: \n128: func setComponentEnvVars(env map[string]string, c *Component) {\n129: \tif c.Type != \"\" {\n130: \t\tenv[envNokiaSrosCard] = c.Type\n131: \t}\n132: \n133: \tfor _, x := range c.XIOM {\n134: \t\tkey := fmt.Sprintf(\"%s_X%d\", envNokiaSrosXIOM, x.Slot)\n135: \t\tenv[key] = x.Type\n136: \t\t// add the nested MDA\n137: \t\tfor _, m := range x.MDA {\n138: \t\t\tkey := fmt.Sprintf(\"%s_X%d_%d\", envNokiaSrosMDA, x.Slot, m.Slot)\n139: \t\t\tenv[key] = m.Type\n140: \t\t}\n141: \t}\n142: \n143: \tfor _, m := range c.MDA {\n144: \t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n145: \t\tenv[key] = m.Type\n146: \t}\n147: }\n148: \n149: func (n *sros) checkComponentSlotsConfig() error {\n150: \t// check Slots are unique\n151: \tcomponentNames := map[string]struct{}{}\n152: \tfor _, component := range n.kindSpecificCfg().Components {\n153: \t\t// convert slot to upper\n154: \t\tslot := strings.ToUpper(component.Slot)\n155: \t\t// check if slot exists\n156: \t\t_, exists := componentNames[slot]\n157: \t\tif exists {\n158: \t\t\treturn fmt.Errorf(\n159: \t\t\t\t\"node %s slot %s duplicate definition\",\n160: \t\t\t\tn.GetShortName(),\n161: \t\t\t\tcomponent.Slot,\n162: \t\t\t)\n163: \t\t}\n164: \t\t// add to component names map\n165: \t\tcomponentNames[slot] = struct{}{}\n166: \n167: \t}\n168: \treturn nil\n169: }\n170: \n171: // componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,\n172: // and per-component env. Per-component env overrides the typed fields.\n173: func componentDerivedEnv(c *Component) map[string]string {\n174: \tderived := map[string]string{}\n175: \tif c == nil {\n176: \t\treturn derived\n177: \t}\n178: \tsetComponentEnvVars(derived, c)\n179: \tmaps.Copy(derived, c.Env)\n180: \treturn derived\n181: }\n182: \n183: // warnUserEnvOverrides logs when a node env var replaces a component-derived value.\n184: func warnUserEnvOverrides(node string, derived, userEnv map[string]string) {\n185: \tfor key, componentValue := range derived {\n186: \t\tenvValue, userSet := userEnv[key]\n187: \t\tif !userSet || componentValue == envValue {\n188: \t\t\tcontinue\n189: \t\t}\n190: \t\tlog.Warn(\n191: \t\t\tfmt.Sprintf(\n192: \t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n193: \t\t\t\tcomponentValue,\n194: \t\t\t\tkey,\n195: \t\t\t),\n196: \t\t\t\"node\", node,\n197: \t\t\t\"env\", key,\n198: \t\t\t\"component-value\", componentValue,\n199: \t\t\t\"env-value\", envValue,\n200: \t\t)\n201: \t}\n202: }\n203: \n204: // keepUserEnv copies component-derived keys into dst unless the user already set that key.\n205: // A user value wins, and a differing component value is logged.\n206: func keepUserEnv(node string, dst, derived, userEnv map[string]string) {\n207: \twarnUserEnvOverrides(node, derived, userEnv)\n208: \tfor key, componentValue := range derived {\n209: \t\tif envValue, userSet := userEnv[key]; userSet {\n210: \t\t\tdst[key] = envValue\n211: \t\t\tcontinue\n212: \t\t}\n213: \t\tdst[key] = componentValue\n214: \t}\n215: }\n216: \n217: // cloneComponent returns a deep copy of c suitable for env overrides during config generation.\n218: func cloneComponent(c *Component) *Component {\n219: \tif c == nil {\n220: \t\treturn &Component{}\n221: \t}\n222: \tout := *c\n223: \tout.Env = maps.Clone(c.Env)\n224: \tout.MDA = slices.Clone(c.MDA)\n225: \tif len(c.XIOM) > 0 {\n226: \t\tout.XIOM = make(XIOMS, len(c.XIOM))\n227: \t\tfor i, xiom := range c.XIOM {\n228: \t\t\txiom.MDA = slices.Clone(xiom.MDA)\n229: \t\t\tout.XIOM[i] = xiom\n230: \t\t}\n231: \t}\n232: \treturn &out\n233: }\n234: \n235: // applyHardwareEnv overlays SR-SIM card, XIOM, and MDA environment variables onto c.\n236: // NOKIA_SROS_SLOT is left unchanged; it identifies the container rather than provisioned hardware.\n237: func applyHardwareEnv(c *Component, env map[string]string) {\n238: \tif c == nil || len(env) == 0 {\n239: \t\treturn\n240: \t}\n241: \tif card := env[envNokiaSrosCard]; card != \"\" {\n242: \t\tc.Type = card\n243: \t}\n244: \tfor key, val := range env {\n245: \t\tif val == \"\" {\n246: \t\t\tcontinue\n247: \t\t}\n248: \t\tswitch {\n249: \t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_X\"):\n250: \t\t\trest := strings.TrimPrefix(key, envNokiaSrosMDA+\"_X\")\n251: \t\t\txiomStr, mdaStr, ok := strings.Cut(rest, \"_\")\n252: \t\t\tif !ok {\n253: \t\t\t\tcontinue\n254: \t\t\t}\n255: \t\t\txiomSlot, errX := strconv.Atoi(xiomStr)\n256: \t\t\tmdaSlot, errM := strconv.Atoi(mdaStr)\n257: \t\t\tif errX != nil || errM != nil || xiomSlot <= 0 || mdaSlot <= 0 {\n258: \t\t\t\tcontinue\n259: \t\t\t}\n260: \t\t\tupsertXiomMDA(c, xiomSlot, mdaSlot, val)\n261: \t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_\"):\n262: \t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosMDA+\"_\"))\n263: \t\t\tif err != nil || slot <= 0 {\n264: \t\t\t\tcontinue\n265: \t\t\t}\n266: \t\t\tc.MDA = upsertMDA(c.MDA, slot, val)\n267: \t\tcase strings.HasPrefix(key, envNokiaSrosXIOM+\"_X\"):\n268: \t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosXIOM+\"_X\"))\n269: \t\t\tif err != nil || slot <= 0 {\n270: \t\t\t\tcontinue\n271: \t\t\t}\n272: \t\t\tupsertXiomType(c, slot, val)\n273: \t\t}\n274: \t}\n275: }\n276: \n277: func upsertMDA(mdas MDAS, slot int, typ string) MDAS {\n278: \tfor i := range mdas {\n279: \t\tif mdas[i].Slot == slot {\n280: \t\t\tmdas[i].Type = typ\n281: \t\t\treturn mdas\n282: \t\t}\n283: \t}\n284: \treturn append(mdas, MDA{Slot: slot, Type: typ})\n285: }\n286: \n287: func upsertXiomType(c *Component, slot int, typ string) {\n288: \tfor i := range c.XIOM {\n289: \t\tif c.XIOM[i].Slot == slot {\n290: \t\t\tc.XIOM[i].Type = typ\n291: \t\t\treturn\n292: \t\t}\n293: \t}\n294: \tc.XIOM = append(c.XIOM, XIOM{Slot: slot, Type: typ})\n295: }\n296: \n297: func upsertXiomMDA(c *Component, xiomSlot, mdaSlot int, typ string) {\n298: \tfor i := range c.XIOM {\n299: \t\tif c.XIOM[i].Slot != xiomSlot {\n300: \t\t\tcontinue\n301: \t\t}\n302: \t\tc.XIOM[i].MDA = upsertMDA(c.XIOM[i].MDA, mdaSlot, typ)\n303: \t\treturn\n304: \t}\n305: \tc.XIOM = append(c.XIOM, XIOM{\n306: \t\tSlot: xiomSlot,\n307: \t\tMDA:  MDAS{{Slot: mdaSlot, Type: typ}},\n308: \t})\n309: }\n\n(End of file - total 309 lines)\n</content>",
    "title": "source/head/nodes/sros/component.go",
    "metadata": {
      "preview": "package sros\n\nimport (\n\t\"fmt\"\n\t\"maps\"\n\t\"slices\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/charmbracelet/log\"\n)\n\n// Component is an SR-SIM card: a CPM (slot A or B) or a line card.\ntype Component struct {\n\tSlot string            `yaml:\"slot,omitempty\" json:\"slot,omitempty\"`\n\tType string            `yaml:\"type,omitempty\" json:\"type,omitempty\"`\n\tEnv  map[string]string `yaml:\"env,omitempty\" json:\"env,omitempty\"`\n\tXIOM XIOMS             `yaml:\"xiom,omitempty\" json:\"xiom,omitempty\"`\n\tMDA  MDAS              `yaml:\"mda,omitempty\" json:\"mda,omitempty\"`\n}",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/component.go",
        "text": "package sros\n\nimport (\n\t\"fmt\"\n\t\"maps\"\n\t\"slices\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/charmbracelet/log\"\n)\n\n// Component is an SR-SIM card: a CPM (slot A or B) or a line card.\ntype Component struct {\n\tSlot string            `yaml:\"slot,omitempty\" json:\"slot,omitempty\"`\n\tType string            `yaml:\"type,omitempty\" json:\"type,omitempty\"`\n\tEnv  map[string]string `yaml:\"env,omitempty\" json:\"env,omitempty\"`\n\tXIOM XIOMS             `yaml:\"xiom,omitempty\" json:\"xiom,omitempty\"`\n\tMDA  MDAS              `yaml:\"mda,omitempty\" json:\"mda,omitempty\"`\n}\n\nfunc componentsBySlot(components []*Component) map[string]Component {\n\tm := make(map[string]Component, len(components))\n\n\tfor i, c := range components {\n\t\tif c == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tnorm := *c\n\t\tnorm.Slot = strings.ToUpper(strings.TrimSpace(c.Slot))\n\n\t\tkey := norm.Slot\n\t\tif key == \"\" {\n\t\t\tkey = fmt.Sprintf(\"#%d\", i)\n\t\t}\n\n\t\tm[key] = norm\n\t}\n\n\treturn m\n}\n\ntype XIOM struct {\n\tSlot int    `yaml:\"slot,omitempty\" json:\"slot,omitempty\"`\n\tType string `yaml:\"type,omitempty\" json:\"type,omitempty\"`\n\tMDA  MDAS   `yaml:\"mda,omitempty\" json:\"mda,omitempty\"`\n}\n\ntype XIOMS []XIOM\n\ntype MDA struct {\n\tSlot int    `yaml:\"slot,omitempty\" json:\"slot,omitempty\"`\n\tType string `yaml:\"type,omitempty\" json:\"type,omitempty\"`\n}\n\ntype MDAS []MDA\n\nfunc (l *MDAS) UnmarshalYAML(unmarshal func(any) error) error {\n\tvar entries []MDA\n\tif err := unmarshal(&entries); err != nil {\n\t\treturn err\n\t}\n\n\tif len(entries) == 0 {\n\t\t*l = nil\n\t\treturn nil\n\t}\n\n\tslots := map[int]struct{}{}\n\n\tfor _, e := range entries {\n\t\tif e.Type == \"\" || e.Slot <= 0 {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"invalid mda entry. slot and type are required, got slot %d, type %q\",\n\t\t\t\te.Slot,\n\t\t\t\te.Type,\n\t\t\t)\n\t\t}\n\n\t\tif _, exists := slots[e.Slot]; exists {\n\t\t\treturn fmt.Errorf(\"invalid mda entry. duplicate slot %d\", e.Slot)\n\t\t}\n\n\t\tslots[e.Slot] = struct{}{}\n\t}\n\n\t*l = MDAS(entries)\n\n\treturn nil\n}\n\nfunc (l *XIOMS) UnmarshalYAML(unmarshal func(any) error) error {\n\tvar entries []XIOM\n\n\tif err := unmarshal(&entries); err != nil {\n\t\treturn err\n\t}\n\n\tif len(entries) == 0 {\n\t\t*l = nil\n\t\treturn nil\n\t}\n\n\tslots := map[int]struct{}{}\n\n\tfor _, e := range entries {\n\t\tif e.Type == \"\" || e.Slot <= 0 {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"invalid xiom entry. slot and type are required, got slot %d, type %q\",\n\t\t\t\te.Slot,\n\t\t\t\te.Type,\n\t\t\t)\n\t\t}\n\n\t\tif _, exists := slots[e.Slot]; exists {\n\t\t\treturn fmt.Errorf(\"invalid xiom entry. duplicate slot %d\", e.Slot)\n\t\t}\n\n\t\tslots[e.Slot] = struct{}{}\n\t}\n\n\t*l = XIOMS(entries)\n\n\treturn nil\n}\n\nfunc setComponentEnvVars(env map[string]string, c *Component) {\n\tif c.Type != \"\" {\n\t\tenv[envNokiaSrosCard] = c.Type\n\t}\n\n\tfor _, x := range c.XIOM {\n\t\tkey := fmt.Sprintf(\"%s_X%d\", envNokiaSrosXIOM, x.Slot)\n\t\tenv[key] = x.Type\n\t\t// add the nested MDA\n\t\tfor _, m := range x.MDA {\n\t\t\tkey := fmt.Sprintf(\"%s_X%d_%d\", envNokiaSrosMDA, x.Slot, m.Slot)\n\t\t\tenv[key] = m.Type\n\t\t}\n\t}\n\n\tfor _, m := range c.MDA {\n\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n\t\tenv[key] = m.Type\n\t}\n}\n\nfunc (n *sros) checkComponentSlotsConfig() error {\n\t// check Slots are unique\n\tcomponentNames := map[string]struct{}{}\n\tfor _, component := range n.kindSpecificCfg().Components {\n\t\t// convert slot to upper\n\t\tslot := strings.ToUpper(component.Slot)\n\t\t// check if slot exists\n\t\t_, exists := componentNames[slot]\n\t\tif exists {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"node %s slot %s duplicate definition\",\n\t\t\t\tn.GetShortName(),\n\t\t\t\tcomponent.Slot,\n\t\t\t)\n\t\t}\n\t\t// add to component names map\n\t\tcomponentNames[slot] = struct{}{}\n\n\t}\n\treturn nil\n}\n\n// componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,\n// and per-component env. Per-component env overrides the typed fields.\nfunc componentDerivedEnv(c *Component) map[string]string {\n\tderived := map[string]string{}\n\tif c == nil {\n\t\treturn derived\n\t}\n\tsetComponentEnvVars(derived, c)\n\tmaps.Copy(derived, c.Env)\n\treturn derived\n}\n\n// warnUserEnvOverrides logs when a node env var replaces a component-derived value.\nfunc warnUserEnvOverrides(node string, derived, userEnv map[string]string) {\n\tfor key, componentValue := range derived {\n\t\tenvValue, userSet := userEnv[key]\n\t\tif !userSet || componentValue == envValue {\n\t\t\tcontinue\n\t\t}\n\t\tlog.Warn(\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n\t\t\t\tcomponentValue,\n\t\t\t\tkey,\n\t\t\t),\n\t\t\t\"node\", node,\n\t\t\t\"env\", key,\n\t\t\t\"component-value\", componentValue,\n\t\t\t\"env-value\", envValue,\n\t\t)\n\t}\n}\n\n// keepUserEnv copies component-derived keys into dst unless the user already set that key.\n// A user value wins, and a differing component value is logged.\nfunc keepUserEnv(node string, dst, derived, userEnv map[string]string) {\n\twarnUserEnvOverrides(node, derived, userEnv)\n\tfor key, componentValue := range derived {\n\t\tif envValue, userSet := userEnv[key]; userSet {\n\t\t\tdst[key] = envValue\n\t\t\tcontinue\n\t\t}\n\t\tdst[key] = componentValue\n\t}\n}\n\n// cloneComponent returns a deep copy of c suitable for env overrides during config generation.\nfunc cloneComponent(c *Component) *Component {\n\tif c == nil {\n\t\treturn &Component{}\n\t}\n\tout := *c\n\tout.Env = maps.Clone(c.Env)\n\tout.MDA = slices.Clone(c.MDA)\n\tif len(c.XIOM) > 0 {\n\t\tout.XIOM = make(XIOMS, len(c.XIOM))\n\t\tfor i, xiom := range c.XIOM {\n\t\t\txiom.MDA = slices.Clone(xiom.MDA)\n\t\t\tout.XIOM[i] = xiom\n\t\t}\n\t}\n\treturn &out\n}\n\n// applyHardwareEnv overlays SR-SIM card, XIOM, and MDA environment variables onto c.\n// NOKIA_SROS_SLOT is left unchanged; it identifies the container rather than provisioned hardware.\nfunc applyHardwareEnv(c *Component, env map[string]string) {\n\tif c == nil || len(env) == 0 {\n\t\treturn\n\t}\n\tif card := env[envNokiaSrosCard]; card != \"\" {\n\t\tc.Type = card\n\t}\n\tfor key, val := range env {\n\t\tif val == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tswitch {\n\t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_X\"):\n\t\t\trest := strings.TrimPrefix(key, envNokiaSrosMDA+\"_X\")\n\t\t\txiomStr, mdaStr, ok := strings.Cut(rest, \"_\")\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\txiomSlot, errX := strconv.Atoi(xiomStr)\n\t\t\tmdaSlot, errM := strconv.Atoi(mdaStr)\n\t\t\tif errX != nil || errM != nil || xiomSlot <= 0 || mdaSlot <= 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tupsertXiomMDA(c, xiomSlot, mdaSlot, val)\n\t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_\"):\n\t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosMDA+\"_\"))\n\t\t\tif err != nil || slot <= 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tc.MDA = upsertMDA(c.MDA, slot, val)\n\t\tcase strings.HasPrefix(key, envNokiaSrosXIOM+\"_X\"):\n\t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosXIOM+\"_X\"))\n\t\t\tif err != nil || slot <= 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tupsertXiomType(c, slot, val)\n\t\t}\n\t}\n}\n\nfunc upsertMDA(mdas MDAS, slot int, typ string) MDAS {\n\tfor i := range mdas {\n\t\tif mdas[i].Slot == slot {\n\t\t\tmdas[i].Type = typ\n\t\t\treturn mdas\n\t\t}\n\t}\n\treturn append(mdas, MDA{Slot: slot, Type: typ})\n}\n\nfunc upsertXiomType(c *Component, slot int, typ string) {\n\tfor i := range c.XIOM {\n\t\tif c.XIOM[i].Slot == slot {\n\t\t\tc.XIOM[i].Type = typ\n\t\t\treturn\n\t\t}\n\t}\n\tc.XIOM = append(c.XIOM, XIOM{Slot: slot, Type: typ})\n}\n\nfunc upsertXiomMDA(c *Component, xiomSlot, mdaSlot int, typ string) {\n\tfor i := range c.XIOM {\n\t\tif c.XIOM[i].Slot != xiomSlot {\n\t\t\tcontinue\n\t\t}\n\t\tc.XIOM[i].MDA = upsertMDA(c.XIOM[i].MDA, mdaSlot, typ)\n\t\treturn\n\t}\n\tc.XIOM = append(c.XIOM, XIOM{\n\t\tSlot: xiomSlot,\n\t\tMDA:  MDAS{{Slot: mdaSlot, Type: typ}},\n\t})\n}",
        "lineStart": 1,
        "lineEnd": 309,
        "totalLines": 309,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346700317,
      "end": 1792346700324
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_150303a26001zuHYO8w9OZa2Tw",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150302b55001SzF0Y5mto636c3",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 59994,
    "input": 1889,
    "output": 113,
    "reasoning": 136,
    "cache": {
      "read": 57856,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_150302b55001SzF0Y5mto636c3",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346696533,
    "completed": 1792346700329
  },
  "parentID": "msg_1502f68f300142aYYM85hGexse",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 59994,
    "input": 1889,
    "output": 113,
    "reasoning": 136,
    "cache": {
      "read": 57856,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 31
step-start
{
  "type": "step-start",
  "id": "prt_1503048b000108Td4G19ppV1be",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150303a32001dtsE1QnYTYJ6Bu"
}
Reasoning
Now I have complete views of `chassis_info.go` and `component.go`. Observations:

1. `chassis_info.go` `componentWarnings`: for integrated nodes with `slot == slotAName || slot == slotBName`, the code checks `slot == slotBName && !entry.Redundant` → warning. But for slot B on integrated non-redundant... fine. For CPM slot A with `component.Type != ""` and `entry.FixedHWCfg == ""` and `len(entry.CPM) > 0` → warns if not in CPM list. OK.

Note: the first branch checks only `component.Type` against `entry.FixedHWCfg` (for slot A/B when FixedHWCfg set). For an integrated chassis with FixedHWCfg (like sr-1 with fixed iom-1?), hmm.

One subtle thing: for `entry.Integrated` chassis, MDA validation is applied for slot A and B components too (condition `entry.Integrated || ...`). Good.

2. `checkComponentSlotsConfig` still lacks TrimSpace (pre-existing pattern; duplicate-with-space issue remains). The test "duplicate_component_slots_are_rejected_regardless_of_case" covers case-insensitivity but not whitespace. componentsBySlot does TrimSpace; checkComponentSlotsConfig does not. So `{Slot: "a"}` and `{Slot: " a"}`: checkComponentSlotsConfig uppercases without trimming → "A" vs " A" → no duplicate error; but componentsBySlot would treat both as "A" with the later one overwriting the earlier. Where is componentsBySlot used? In Init (setupComponents?). Need to check how componentsBySlot is consumed in sros.go Init. If duplicates collapse silently in map but checkComponentSlotsConfig doesn't catch whitespace variants, the second component silently wins. Minor edge case. Pre-existing? checkComponentSlotsConfig is in component.go — was it modified in the diff? The diff hunk for component.go (lines 643-851) — I read it earlier (per prior summary). Let me check whether checkComponentSlotsConfig changed in this PR. From prior summary: "checkComponentSlotsConfig doesn't TrimSpace before ToUpper (duplicate ' a' vs 'A' undetected) — moved code, pre-existing, likely not a PR finding." Hmm, was it moved from sros.go? If the diff moved it, I should check the base version. Let me grep the diff for checkComponentSlotsConfig.

3. The `warnUserEnvOverrides` duplication for SFM: in sros.go Init there was inline SFM warning; I noted duplication. Let me verify in the diff/sros.go.

Next steps: read component_config.go (393 lines) fully, and read the diff hunks for component.go and sros.go again to confirm what changed (I read them before but let me confirm key details). Also check sros.go Init for the SFM warning duplication and how componentsBySlot is used.

Let me read component_config.go fully and grep diff for checkComponentSlotsConfig / componentsBySlot / warnUserEnvOverrides.
Now let me read the full `component_config.go` and check how the moved functions appear in the diff (to distinguish newly-introduced code from moved/pre-existing code).
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/component_config.go"
}

Output

<path>/source/head/nodes/sros/component_config.go</path>
<type>file</type>
<content>
1: // Copyright 2025 Nokia
2: // Licensed under the BSD 3-Clause License.
3: // SPDX-License-Identifier: BSD-3-Clause
4: 
5: package sros
6: 
7: import (
8: 	"fmt"
9: 	"maps"
10: 	"slices"
11: 	"strings"
12: 
13: 	"github.com/charmbracelet/log"
14: )
15: 
16: const integratedSrosCardSlot = "1"
17: 
18: type integratedSrosDefaultComponent struct {
19: 	cardType     string
20: 	mdas         MDAS
21: 	allowedSlots []string
22: }
23: 
24: var integratedSrosDefaultComponents = map[string]integratedSrosDefaultComponent{
25: 	"sr-1": {
26: 		cardType:     "iom-1",
27: 		allowedSlots: []string{slotAName},
28: 		mdas: MDAS{
29: 			{Slot: 1, Type: "me6-100gb-qsfp28"},
30: 			{Slot: 2, Type: "me12-100gb-qsfp28"},
31: 		},
32: 	},
33: 	"sr-1s": {
34: 		cardType:     "xcm-1s",
35: 		allowedSlots: []string{slotAName},
36: 		mdas: MDAS{
37: 			{Slot: 1, Type: "s36-100gb-qsfp28"},
38: 		},
39: 	},
40: 	"ixr-r6": {
41: 		cardType:     "iom-ixr-r6",
42: 		allowedSlots: []string{slotAName, slotBName},
43: 		mdas: MDAS{
44: 			{Slot: 1, Type: "m6-10g-sfp++1-100g-qsfp28"},
45: 		},
46: 	},
47: 	"ixr-e2": {
48: 		cardType:     "imm2-qsfpdd+2-qsfp28+24-sfp28",
49: 		allowedSlots: []string{slotAName},
50: 		mdas: MDAS{
51: 			{Slot: 1, Type: "m2-qsfpdd+2-qsfp28+24-sfp28"},
52: 		},
53: 	},
54: 	"ixr-e2c": {
55: 		cardType:     "imm12-sfp28+2-qsfp28",
56: 		allowedSlots: []string{slotAName},
57: 		mdas: MDAS{
58: 			{Slot: 1, Type: "m12-sfp28+2-qsfp28"},
59: 		},
60: 	},
61: 	"ixr-e2n": {
62: 		cardType:     "imm4-sfp+4-sfp+",
63: 		allowedSlots: []string{slotAName},
64: 		mdas: MDAS{
65: 			{Slot: 1, Type: "m4-sfp+4-sfp+"},
66: 		},
67: 	},
68: 	"ixr-e2n-s": {
69: 		cardType:     "imm4-sfp+4-sfp+-s",
70: 		allowedSlots: []string{slotAName},
71: 		mdas: MDAS{
72: 			{Slot: 1, Type: "m4-sfp+4-sfp+-s"},
73: 		},
74: 	},
75: 	"ixr-e3c": {
76: 		cardType:     "imm4-qsfp28+16-sfp28+8-sfp56",
77: 		allowedSlots: []string{slotAName},
78: 		mdas: MDAS{
79: 			{Slot: 1, Type: "m4-qsfp28+16-sfp28+8-sfp56"},
80: 		},
81: 	},
82: 	"ixr-e3x": {
83: 		cardType:     "imm16-sfp112+15-sfp56+6-qsfpdd",
84: 		allowedSlots: []string{slotAName},
85: 		mdas: MDAS{
86: 			{Slot: 1, Type: "m16-sfp112+15-sfp56+6-qsfpdd"},
87: 		},
88: 	},
89: 	"ixr-e2sc": {
90: 		cardType:     "imm16-sfp++4-sfp28",
91: 		allowedSlots: []string{slotAName},
92: 		mdas: MDAS{
93: 			{Slot: 1, Type: "m16-sfp++4-sfp28"},
94: 		},
95: 	},
96: 	"ixr-ec": {
97: 		cardType:     "imm4-1g-tx+20-1g-sfp+6-10g-sfp+",
98: 		allowedSlots: []string{slotAName},
99: 		mdas: MDAS{
100: 			{Slot: 1, Type: "m4-1g-tx+20-1g-sfp+6-10g-sfp+"},
101: 		},
102: 	},
103: }
104: 
105: // componentCfgLine represents one SR OS config line for a component (card, sfm, xiom, mda).
106: // Adding a new component type = add a Kind and a case in String().
107: type componentCfgLine struct {
108: 	Kind     string // "card", "sfm", "xiom", "xiomMda", "mda"
109: 	Slot     string
110: 	Type     string
111: 	XiomSlot int
112: 	MdaSlot  int
113: }
114: 
115: // String returns the SR OS CLI config line for this component.
116: func (l componentCfgLine) String() string {
117: 	switch l.Kind {
118: 	case "card":
119: 		return fmt.Sprintf("/configure card %s card-type %s admin-state enable\n", l.Slot, l.Type)
120: 	case "sfm":
121: 		return fmt.Sprintf("/configure sfm %s sfm-type %s admin-state enable\n", l.Slot, l.Type)
122: 	case "xiom":
123: 		return fmt.Sprintf("/configure card %s xiom x%d xiom-type %s admin-state enable\n",
124: 			l.Slot, l.XiomSlot, l.Type)
125: 	case "xiomMda":
126: 		return fmt.Sprintf("/configure card %s xiom x%d mda %d mda-type %s admin-state enable\n",
127: 			l.Slot, l.XiomSlot, l.MdaSlot, l.Type)
128: 	case "mda":
129: 		return fmt.Sprintf("/configure card %s mda %d mda-type %s admin-state enable\n",
130: 			l.Slot, l.MdaSlot, l.Type)
131: 	default:
132: 		return ""
133: 	}
134: }
135: 
136: // buildComponentCfgLines turns root components into a slice of config lines (card, sfm, xiom,
137: // xiomMda, mda).
138: // CPM slots (A, B) are skipped. Components without Type are skipped (caller may log).
139: func buildComponentCfgLines(components []*Component, sfm string) []componentCfgLine {
140: 	var lines []componentCfgLine
141: 	for _, component := range components {
142: 		slot := strings.ToUpper(strings.TrimSpace(component.Slot))
143: 		if slot == slotAName || slot == slotBName {
144: 			continue
145: 		}
146: 		if component.Type == "" {
147: 			continue
148: 		}
149: 		lines = append(lines, componentCfgLine{Kind: "card", Slot: slot, Type: component.Type})
150: 		if sfm != "" {
151: 			lines = append(lines, componentCfgLine{Kind: "sfm", Slot: slot, Type: sfm})
152: 		}
153: 		for _, xiom := range component.XIOM {
154: 			if xiom.Type != "" {
155: 				lines = append(
156: 					lines,
157: 					componentCfgLine{
158: 						Kind:     "xiom",
159: 						Slot:     slot,
160: 						Type:     xiom.Type,
161: 						XiomSlot: xiom.Slot,
162: 					},
163: 				)
164: 			}
165: 			for _, mda := range xiom.MDA {
166: 				if mda.Type != "" {
167: 					lines = append(lines, componentCfgLine{
168: 						Kind: "xiomMda", Slot: slot, Type: mda.Type,
169: 						XiomSlot: xiom.Slot, MdaSlot: mda.Slot,
170: 					})
171: 				}
172: 			}
173: 		}
174: 		for _, mda := range component.MDA {
175: 			if mda.Type != "" {
176: 				lines = append(
177: 					lines,
178: 					componentCfgLine{Kind: "mda", Slot: slot, Type: mda.Type, MdaSlot: mda.Slot},
179: 				)
180: 			}
181: 		}
182: 	}
183: 	return lines
184: }
185: 
186: func buildIntegratedComponentCfgLines(nodeType string, override *Component) []componentCfgLine {
187: 	component, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]
188: 	if !ok {
189: 		return nil
190: 	}
191: 	if override == nil {
192: 		override = &Component{}
193: 	}
194: 
195: 	defaultMdas := component.mdas
196: 
197: 	if len(override.XIOM) > 0 {
198: 		defaultMdas = nil
199: 	}
200: 
201: 	card := &Component{
202: 		Slot: integratedSrosCardSlot,
203: 		Type: component.cardType,
204: 		XIOM: override.XIOM,
205: 		MDA:  mergeIntegratedMdas(defaultMdas, override.MDA),
206: 	}
207: 
208: 	return buildComponentCfgLines([]*Component{card}, "")
209: }
210: 
211: func mergeIntegratedMdas(defaults, overrides MDAS) MDAS {
212: 	bySlot := map[int]string{}
213: 	for _, mda := range slices.Concat(defaults, overrides) {
214: 		if mda.Slot > 0 && mda.Type != "" {
215: 			bySlot[mda.Slot] = mda.Type
216: 		}
217: 	}
218: 
219: 	slots := slices.Sorted(maps.Keys(bySlot))
220: 	mdas := make(MDAS, 0, len(slots))
221: 	for _, slot := range slots {
222: 		mdas = append(mdas, MDA{Slot: slot, Type: bySlot[slot]})
223: 	}
224: 	return mdas
225: }
226: 
227: func canonicalSrosNodeType(nodeType string) string {
228: 	return strings.ToLower(strings.TrimSpace(nodeType))
229: }
230: 
231: func integratedSrosDefault(nodeType string) (integratedSrosDefaultComponent, bool) {
232: 	component, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]
233: 	return component, ok
234: }
235: 
236: func isIntegratedSrosNodeType(nodeType string) bool {
237: 	_, ok := integratedSrosDefault(nodeType)
238: 	return ok
239: }
240: 
241: func integratedSrosAllowedSlots(nodeType string) []string {
242: 	component, ok := integratedSrosDefault(nodeType)
243: 	if !ok || len(component.allowedSlots) == 0 {
244: 		return []string{slotAName}
245: 	}
246: 	return component.allowedSlots
247: }
248: 
249: func isRedundantIntegratedSrosComponents(nodeType string, components []*Component) bool {
250: 	if !isIntegratedSrosNodeType(nodeType) || len(components) < 2 {
251: 		return false
252: 	}
253: 	for _, c := range components {
254: 		if strings.TrimSpace(c.Slot) == "" || !integratedSrosSlotAllowed(nodeType, c.Slot) {
255: 			return false
256: 		}
257: 	}
258: 	return true
259: }
260: 
261: func integratedSrosSlotAllowed(nodeType, slot string) bool {
262: 	slot = strings.ToUpper(strings.TrimSpace(slot))
263: 	if slot == "" {
264: 		slot = standaloneSlotName
265: 	}
266: 	return slices.Contains(integratedSrosAllowedSlots(nodeType), slot)
267: }
268: 
269: func (n *sros) generateComponentConfig() string {
270: 	if !n.kindSpecificCfg().GenComponentConfig {
271: 		return ""
272: 	}
273: 	if n.isConfigClassic() {
274: 		return ""
275: 	}
276: 
277: 	if isIntegratedSrosNodeType(n.Cfg.NodeType) {
278: 		return n.generateIntegratedComponentConfig()
279: 	}
280: 
281: 	components := n.rootComponents
282: 	if len(components) == 0 {
283: 		return ""
284: 	}
285: 
286: 	for _, c := range components {
287: 		slot := strings.ToUpper(strings.TrimSpace(c.Slot))
288: 		if slot == slotAName || slot == slotBName {
289: 			continue
290: 		}
291: 		if c.Type == "" {
292: 			log.Warn(
293: 				"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.",
294: 				"node",
295: 				n.Cfg.ShortName,
296: 				"slot",
297: 				slot,
298: 			)
299: 		}
300: 	}
301: 
302: 	lines := buildComponentCfgLines(n.componentsForConfig(components), n.componentSFM())
303: 	return n.componentConfigFromLines(lines)
304: }
305: 
306: // hardwareEnv is the topology env, which overrides component type, XIOM, and MDA.
307: // Nodes that have not been through Init expose that env on Cfg.Env.
308: func (n *sros) hardwareEnv() map[string]string {
309: 	if n.userEnv != nil {
310: 		return n.userEnv
311: 	}
312: 	return n.Cfg.Env
313: }
314: 
315: // componentSFM is the SFM used in generated config. NOKIA_SROS_SFM overrides the sfm key.
316: func (n *sros) componentSFM() string {
317: 	if sfm := n.hardwareEnv()[envNokiaSrosSFM]; sfm != "" {
318: 		return sfm
319: 	}
320: 	return n.kindSpecificCfg().SFM
321: }
322: 
323: // componentForConfig clones c and applies per-component env, then node env.
324: func (n *sros) componentForConfig(c *Component) *Component {
325: 	out := cloneComponent(c)
326: 	applyHardwareEnv(out, out.Env)
327: 	applyHardwareEnv(out, n.hardwareEnv())
328: 	return out
329: }
330: 
331: func (n *sros) componentsForConfig(components []*Component) []*Component {
332: 	out := make([]*Component, len(components))
333: 	for i, c := range components {
334: 		out[i] = n.componentForConfig(c)
335: 	}
336: 	return out
337: }
338: 
339: func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {
340: 	powerConfig := n.generatePowerConfig()
341: 	if len(lines) == 0 && powerConfig == "" {
342: 		return ""
343: 	}
344: 
345: 	var config strings.Builder
346: 	for _, l := range lines {
347: 		config.WriteString(l.String())
348: 	}
349: 	config.WriteString(powerConfig)
350: 	return config.String()
351: }
352: 
353: func (n *sros) generateIntegratedComponentConfig() string {
354: 	card := strings.TrimSpace(n.Cfg.Env[envNokiaSrosCard])
355: 	if card != "" {
356: 		log.Info(
357: 			"Card type override set on integrated chassis type, skipping component SR OS config generation",
358: 			"node",
359: 			n.Cfg.ShortName,
360: 			"type",
361: 			n.Cfg.NodeType,
362: 			"card",
363: 			card,
364: 		)
365: 		return ""
366: 	}
367: 
368: 	lines := buildIntegratedComponentCfgLines(
369: 		n.Cfg.NodeType,
370: 		n.componentForConfig(n.integratedComponentOverride()),
371: 	)
372: 	return n.componentConfigFromLines(lines)
373: }
374: 
375: // integratedComponentOverride returns the component that overrides the integrated defaults:
376: // the single component of a standalone node, or the component matching the slot of a
377: // redundant CPM node.
378: func (n *sros) integratedComponentOverride() *Component {
379: 	if n.rootCtrName == "" {
380: 		if len(n.kindSpecificCfg().Components) == 1 {
381: 			return n.kindSpecificCfg().Components[0]
382: 		}
383: 		return nil
384: 	}
385: 
386: 	slot := n.Cfg.Env[envNokiaSrosSlot]
387: 	for _, c := range n.rootComponents {
388: 		if strings.EqualFold(strings.TrimSpace(c.Slot), slot) {
389: 			return c
390: 		}
391: 	}
392: 	return nil
393: }

(End of file - total 393 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1503061ce0012wsfgfXe41H5aw",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150303a32001dtsE1QnYTYJ6Bu",
  "callID": "call_036b1efb9b80438e89df6b91",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/component_config.go"
    },
    "output": "<path>/source/head/nodes/sros/component_config.go</path>\n<type>file</type>\n<content>\n1: // Copyright 2025 Nokia\n2: // Licensed under the BSD 3-Clause License.\n3: // SPDX-License-Identifier: BSD-3-Clause\n4: \n5: package sros\n6: \n7: import (\n8: \t\"fmt\"\n9: \t\"maps\"\n10: \t\"slices\"\n11: \t\"strings\"\n12: \n13: \t\"github.com/charmbracelet/log\"\n14: )\n15: \n16: const integratedSrosCardSlot = \"1\"\n17: \n18: type integratedSrosDefaultComponent struct {\n19: \tcardType     string\n20: \tmdas         MDAS\n21: \tallowedSlots []string\n22: }\n23: \n24: var integratedSrosDefaultComponents = map[string]integratedSrosDefaultComponent{\n25: \t\"sr-1\": {\n26: \t\tcardType:     \"iom-1\",\n27: \t\tallowedSlots: []string{slotAName},\n28: \t\tmdas: MDAS{\n29: \t\t\t{Slot: 1, Type: \"me6-100gb-qsfp28\"},\n30: \t\t\t{Slot: 2, Type: \"me12-100gb-qsfp28\"},\n31: \t\t},\n32: \t},\n33: \t\"sr-1s\": {\n34: \t\tcardType:     \"xcm-1s\",\n35: \t\tallowedSlots: []string{slotAName},\n36: \t\tmdas: MDAS{\n37: \t\t\t{Slot: 1, Type: \"s36-100gb-qsfp28\"},\n38: \t\t},\n39: \t},\n40: \t\"ixr-r6\": {\n41: \t\tcardType:     \"iom-ixr-r6\",\n42: \t\tallowedSlots: []string{slotAName, slotBName},\n43: \t\tmdas: MDAS{\n44: \t\t\t{Slot: 1, Type: \"m6-10g-sfp++1-100g-qsfp28\"},\n45: \t\t},\n46: \t},\n47: \t\"ixr-e2\": {\n48: \t\tcardType:     \"imm2-qsfpdd+2-qsfp28+24-sfp28\",\n49: \t\tallowedSlots: []string{slotAName},\n50: \t\tmdas: MDAS{\n51: \t\t\t{Slot: 1, Type: \"m2-qsfpdd+2-qsfp28+24-sfp28\"},\n52: \t\t},\n53: \t},\n54: \t\"ixr-e2c\": {\n55: \t\tcardType:     \"imm12-sfp28+2-qsfp28\",\n56: \t\tallowedSlots: []string{slotAName},\n57: \t\tmdas: MDAS{\n58: \t\t\t{Slot: 1, Type: \"m12-sfp28+2-qsfp28\"},\n59: \t\t},\n60: \t},\n61: \t\"ixr-e2n\": {\n62: \t\tcardType:     \"imm4-sfp+4-sfp+\",\n63: \t\tallowedSlots: []string{slotAName},\n64: \t\tmdas: MDAS{\n65: \t\t\t{Slot: 1, Type: \"m4-sfp+4-sfp+\"},\n66: \t\t},\n67: \t},\n68: \t\"ixr-e2n-s\": {\n69: \t\tcardType:     \"imm4-sfp+4-sfp+-s\",\n70: \t\tallowedSlots: []string{slotAName},\n71: \t\tmdas: MDAS{\n72: \t\t\t{Slot: 1, Type: \"m4-sfp+4-sfp+-s\"},\n73: \t\t},\n74: \t},\n75: \t\"ixr-e3c\": {\n76: \t\tcardType:     \"imm4-qsfp28+16-sfp28+8-sfp56\",\n77: \t\tallowedSlots: []string{slotAName},\n78: \t\tmdas: MDAS{\n79: \t\t\t{Slot: 1, Type: \"m4-qsfp28+16-sfp28+8-sfp56\"},\n80: \t\t},\n81: \t},\n82: \t\"ixr-e3x\": {\n83: \t\tcardType:     \"imm16-sfp112+15-sfp56+6-qsfpdd\",\n84: \t\tallowedSlots: []string{slotAName},\n85: \t\tmdas: MDAS{\n86: \t\t\t{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"},\n87: \t\t},\n88: \t},\n89: \t\"ixr-e2sc\": {\n90: \t\tcardType:     \"imm16-sfp++4-sfp28\",\n91: \t\tallowedSlots: []string{slotAName},\n92: \t\tmdas: MDAS{\n93: \t\t\t{Slot: 1, Type: \"m16-sfp++4-sfp28\"},\n94: \t\t},\n95: \t},\n96: \t\"ixr-ec\": {\n97: \t\tcardType:     \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n98: \t\tallowedSlots: []string{slotAName},\n99: \t\tmdas: MDAS{\n100: \t\t\t{Slot: 1, Type: \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\"},\n101: \t\t},\n102: \t},\n103: }\n104: \n105: // componentCfgLine represents one SR OS config line for a component (card, sfm, xiom, mda).\n106: // Adding a new component type = add a Kind and a case in String().\n107: type componentCfgLine struct {\n108: \tKind     string // \"card\", \"sfm\", \"xiom\", \"xiomMda\", \"mda\"\n109: \tSlot     string\n110: \tType     string\n111: \tXiomSlot int\n112: \tMdaSlot  int\n113: }\n114: \n115: // String returns the SR OS CLI config line for this component.\n116: func (l componentCfgLine) String() string {\n117: \tswitch l.Kind {\n118: \tcase \"card\":\n119: \t\treturn fmt.Sprintf(\"/configure card %s card-type %s admin-state enable\\n\", l.Slot, l.Type)\n120: \tcase \"sfm\":\n121: \t\treturn fmt.Sprintf(\"/configure sfm %s sfm-type %s admin-state enable\\n\", l.Slot, l.Type)\n122: \tcase \"xiom\":\n123: \t\treturn fmt.Sprintf(\"/configure card %s xiom x%d xiom-type %s admin-state enable\\n\",\n124: \t\t\tl.Slot, l.XiomSlot, l.Type)\n125: \tcase \"xiomMda\":\n126: \t\treturn fmt.Sprintf(\"/configure card %s xiom x%d mda %d mda-type %s admin-state enable\\n\",\n127: \t\t\tl.Slot, l.XiomSlot, l.MdaSlot, l.Type)\n128: \tcase \"mda\":\n129: \t\treturn fmt.Sprintf(\"/configure card %s mda %d mda-type %s admin-state enable\\n\",\n130: \t\t\tl.Slot, l.MdaSlot, l.Type)\n131: \tdefault:\n132: \t\treturn \"\"\n133: \t}\n134: }\n135: \n136: // buildComponentCfgLines turns root components into a slice of config lines (card, sfm, xiom,\n137: // xiomMda, mda).\n138: // CPM slots (A, B) are skipped. Components without Type are skipped (caller may log).\n139: func buildComponentCfgLines(components []*Component, sfm string) []componentCfgLine {\n140: \tvar lines []componentCfgLine\n141: \tfor _, component := range components {\n142: \t\tslot := strings.ToUpper(strings.TrimSpace(component.Slot))\n143: \t\tif slot == slotAName || slot == slotBName {\n144: \t\t\tcontinue\n145: \t\t}\n146: \t\tif component.Type == \"\" {\n147: \t\t\tcontinue\n148: \t\t}\n149: \t\tlines = append(lines, componentCfgLine{Kind: \"card\", Slot: slot, Type: component.Type})\n150: \t\tif sfm != \"\" {\n151: \t\t\tlines = append(lines, componentCfgLine{Kind: \"sfm\", Slot: slot, Type: sfm})\n152: \t\t}\n153: \t\tfor _, xiom := range component.XIOM {\n154: \t\t\tif xiom.Type != \"\" {\n155: \t\t\t\tlines = append(\n156: \t\t\t\t\tlines,\n157: \t\t\t\t\tcomponentCfgLine{\n158: \t\t\t\t\t\tKind:     \"xiom\",\n159: \t\t\t\t\t\tSlot:     slot,\n160: \t\t\t\t\t\tType:     xiom.Type,\n161: \t\t\t\t\t\tXiomSlot: xiom.Slot,\n162: \t\t\t\t\t},\n163: \t\t\t\t)\n164: \t\t\t}\n165: \t\t\tfor _, mda := range xiom.MDA {\n166: \t\t\t\tif mda.Type != \"\" {\n167: \t\t\t\t\tlines = append(lines, componentCfgLine{\n168: \t\t\t\t\t\tKind: \"xiomMda\", Slot: slot, Type: mda.Type,\n169: \t\t\t\t\t\tXiomSlot: xiom.Slot, MdaSlot: mda.Slot,\n170: \t\t\t\t\t})\n171: \t\t\t\t}\n172: \t\t\t}\n173: \t\t}\n174: \t\tfor _, mda := range component.MDA {\n175: \t\t\tif mda.Type != \"\" {\n176: \t\t\t\tlines = append(\n177: \t\t\t\t\tlines,\n178: \t\t\t\t\tcomponentCfgLine{Kind: \"mda\", Slot: slot, Type: mda.Type, MdaSlot: mda.Slot},\n179: \t\t\t\t)\n180: \t\t\t}\n181: \t\t}\n182: \t}\n183: \treturn lines\n184: }\n185: \n186: func buildIntegratedComponentCfgLines(nodeType string, override *Component) []componentCfgLine {\n187: \tcomponent, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]\n188: \tif !ok {\n189: \t\treturn nil\n190: \t}\n191: \tif override == nil {\n192: \t\toverride = &Component{}\n193: \t}\n194: \n195: \tdefaultMdas := component.mdas\n196: \n197: \tif len(override.XIOM) > 0 {\n198: \t\tdefaultMdas = nil\n199: \t}\n200: \n201: \tcard := &Component{\n202: \t\tSlot: integratedSrosCardSlot,\n203: \t\tType: component.cardType,\n204: \t\tXIOM: override.XIOM,\n205: \t\tMDA:  mergeIntegratedMdas(defaultMdas, override.MDA),\n206: \t}\n207: \n208: \treturn buildComponentCfgLines([]*Component{card}, \"\")\n209: }\n210: \n211: func mergeIntegratedMdas(defaults, overrides MDAS) MDAS {\n212: \tbySlot := map[int]string{}\n213: \tfor _, mda := range slices.Concat(defaults, overrides) {\n214: \t\tif mda.Slot > 0 && mda.Type != \"\" {\n215: \t\t\tbySlot[mda.Slot] = mda.Type\n216: \t\t}\n217: \t}\n218: \n219: \tslots := slices.Sorted(maps.Keys(bySlot))\n220: \tmdas := make(MDAS, 0, len(slots))\n221: \tfor _, slot := range slots {\n222: \t\tmdas = append(mdas, MDA{Slot: slot, Type: bySlot[slot]})\n223: \t}\n224: \treturn mdas\n225: }\n226: \n227: func canonicalSrosNodeType(nodeType string) string {\n228: \treturn strings.ToLower(strings.TrimSpace(nodeType))\n229: }\n230: \n231: func integratedSrosDefault(nodeType string) (integratedSrosDefaultComponent, bool) {\n232: \tcomponent, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]\n233: \treturn component, ok\n234: }\n235: \n236: func isIntegratedSrosNodeType(nodeType string) bool {\n237: \t_, ok := integratedSrosDefault(nodeType)\n238: \treturn ok\n239: }\n240: \n241: func integratedSrosAllowedSlots(nodeType string) []string {\n242: \tcomponent, ok := integratedSrosDefault(nodeType)\n243: \tif !ok || len(component.allowedSlots) == 0 {\n244: \t\treturn []string{slotAName}\n245: \t}\n246: \treturn component.allowedSlots\n247: }\n248: \n249: func isRedundantIntegratedSrosComponents(nodeType string, components []*Component) bool {\n250: \tif !isIntegratedSrosNodeType(nodeType) || len(components) < 2 {\n251: \t\treturn false\n252: \t}\n253: \tfor _, c := range components {\n254: \t\tif strings.TrimSpace(c.Slot) == \"\" || !integratedSrosSlotAllowed(nodeType, c.Slot) {\n255: \t\t\treturn false\n256: \t\t}\n257: \t}\n258: \treturn true\n259: }\n260: \n261: func integratedSrosSlotAllowed(nodeType, slot string) bool {\n262: \tslot = strings.ToUpper(strings.TrimSpace(slot))\n263: \tif slot == \"\" {\n264: \t\tslot = standaloneSlotName\n265: \t}\n266: \treturn slices.Contains(integratedSrosAllowedSlots(nodeType), slot)\n267: }\n268: \n269: func (n *sros) generateComponentConfig() string {\n270: \tif !n.kindSpecificCfg().GenComponentConfig {\n271: \t\treturn \"\"\n272: \t}\n273: \tif n.isConfigClassic() {\n274: \t\treturn \"\"\n275: \t}\n276: \n277: \tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n278: \t\treturn n.generateIntegratedComponentConfig()\n279: \t}\n280: \n281: \tcomponents := n.rootComponents\n282: \tif len(components) == 0 {\n283: \t\treturn \"\"\n284: \t}\n285: \n286: \tfor _, c := range components {\n287: \t\tslot := strings.ToUpper(strings.TrimSpace(c.Slot))\n288: \t\tif slot == slotAName || slot == slotBName {\n289: \t\t\tcontinue\n290: \t\t}\n291: \t\tif c.Type == \"\" {\n292: \t\t\tlog.Warn(\n293: \t\t\t\t\"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.\",\n294: \t\t\t\t\"node\",\n295: \t\t\t\tn.Cfg.ShortName,\n296: \t\t\t\t\"slot\",\n297: \t\t\t\tslot,\n298: \t\t\t)\n299: \t\t}\n300: \t}\n301: \n302: \tlines := buildComponentCfgLines(n.componentsForConfig(components), n.componentSFM())\n303: \treturn n.componentConfigFromLines(lines)\n304: }\n305: \n306: // hardwareEnv is the topology env, which overrides component type, XIOM, and MDA.\n307: // Nodes that have not been through Init expose that env on Cfg.Env.\n308: func (n *sros) hardwareEnv() map[string]string {\n309: \tif n.userEnv != nil {\n310: \t\treturn n.userEnv\n311: \t}\n312: \treturn n.Cfg.Env\n313: }\n314: \n315: // componentSFM is the SFM used in generated config. NOKIA_SROS_SFM overrides the sfm key.\n316: func (n *sros) componentSFM() string {\n317: \tif sfm := n.hardwareEnv()[envNokiaSrosSFM]; sfm != \"\" {\n318: \t\treturn sfm\n319: \t}\n320: \treturn n.kindSpecificCfg().SFM\n321: }\n322: \n323: // componentForConfig clones c and applies per-component env, then node env.\n324: func (n *sros) componentForConfig(c *Component) *Component {\n325: \tout := cloneComponent(c)\n326: \tapplyHardwareEnv(out, out.Env)\n327: \tapplyHardwareEnv(out, n.hardwareEnv())\n328: \treturn out\n329: }\n330: \n331: func (n *sros) componentsForConfig(components []*Component) []*Component {\n332: \tout := make([]*Component, len(components))\n333: \tfor i, c := range components {\n334: \t\tout[i] = n.componentForConfig(c)\n335: \t}\n336: \treturn out\n337: }\n338: \n339: func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {\n340: \tpowerConfig := n.generatePowerConfig()\n341: \tif len(lines) == 0 && powerConfig == \"\" {\n342: \t\treturn \"\"\n343: \t}\n344: \n345: \tvar config strings.Builder\n346: \tfor _, l := range lines {\n347: \t\tconfig.WriteString(l.String())\n348: \t}\n349: \tconfig.WriteString(powerConfig)\n350: \treturn config.String()\n351: }\n352: \n353: func (n *sros) generateIntegratedComponentConfig() string {\n354: \tcard := strings.TrimSpace(n.Cfg.Env[envNokiaSrosCard])\n355: \tif card != \"\" {\n356: \t\tlog.Info(\n357: \t\t\t\"Card type override set on integrated chassis type, skipping component SR OS config generation\",\n358: \t\t\t\"node\",\n359: \t\t\tn.Cfg.ShortName,\n360: \t\t\t\"type\",\n361: \t\t\tn.Cfg.NodeType,\n362: \t\t\t\"card\",\n363: \t\t\tcard,\n364: \t\t)\n365: \t\treturn \"\"\n366: \t}\n367: \n368: \tlines := buildIntegratedComponentCfgLines(\n369: \t\tn.Cfg.NodeType,\n370: \t\tn.componentForConfig(n.integratedComponentOverride()),\n371: \t)\n372: \treturn n.componentConfigFromLines(lines)\n373: }\n374: \n375: // integratedComponentOverride returns the component that overrides the integrated defaults:\n376: // the single component of a standalone node, or the component matching the slot of a\n377: // redundant CPM node.\n378: func (n *sros) integratedComponentOverride() *Component {\n379: \tif n.rootCtrName == \"\" {\n380: \t\tif len(n.kindSpecificCfg().Components) == 1 {\n381: \t\t\treturn n.kindSpecificCfg().Components[0]\n382: \t\t}\n383: \t\treturn nil\n384: \t}\n385: \n386: \tslot := n.Cfg.Env[envNokiaSrosSlot]\n387: \tfor _, c := range n.rootComponents {\n388: \t\tif strings.EqualFold(strings.TrimSpace(c.Slot), slot) {\n389: \t\t\treturn c\n390: \t\t}\n391: \t}\n392: \treturn nil\n393: }\n\n(End of file - total 393 lines)\n</content>",
    "title": "source/head/nodes/sros/component_config.go",
    "metadata": {
      "preview": "// Copyright 2025 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\npackage sros\n\nimport (\n\t\"fmt\"\n\t\"maps\"\n\t\"slices\"\n\t\"strings\"\n\n\t\"github.com/charmbracelet/log\"\n)\n\nconst integratedSrosCardSlot = \"1\"\n\ntype integratedSrosDefaultComponent struct {\n\tcardType     string\n\tmdas         MDAS",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/component_config.go",
        "text": "// Copyright 2025 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\npackage sros\n\nimport (\n\t\"fmt\"\n\t\"maps\"\n\t\"slices\"\n\t\"strings\"\n\n\t\"github.com/charmbracelet/log\"\n)\n\nconst integratedSrosCardSlot = \"1\"\n\ntype integratedSrosDefaultComponent struct {\n\tcardType     string\n\tmdas         MDAS\n\tallowedSlots []string\n}\n\nvar integratedSrosDefaultComponents = map[string]integratedSrosDefaultComponent{\n\t\"sr-1\": {\n\t\tcardType:     \"iom-1\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"me6-100gb-qsfp28\"},\n\t\t\t{Slot: 2, Type: \"me12-100gb-qsfp28\"},\n\t\t},\n\t},\n\t\"sr-1s\": {\n\t\tcardType:     \"xcm-1s\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"s36-100gb-qsfp28\"},\n\t\t},\n\t},\n\t\"ixr-r6\": {\n\t\tcardType:     \"iom-ixr-r6\",\n\t\tallowedSlots: []string{slotAName, slotBName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m6-10g-sfp++1-100g-qsfp28\"},\n\t\t},\n\t},\n\t\"ixr-e2\": {\n\t\tcardType:     \"imm2-qsfpdd+2-qsfp28+24-sfp28\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m2-qsfpdd+2-qsfp28+24-sfp28\"},\n\t\t},\n\t},\n\t\"ixr-e2c\": {\n\t\tcardType:     \"imm12-sfp28+2-qsfp28\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m12-sfp28+2-qsfp28\"},\n\t\t},\n\t},\n\t\"ixr-e2n\": {\n\t\tcardType:     \"imm4-sfp+4-sfp+\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m4-sfp+4-sfp+\"},\n\t\t},\n\t},\n\t\"ixr-e2n-s\": {\n\t\tcardType:     \"imm4-sfp+4-sfp+-s\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m4-sfp+4-sfp+-s\"},\n\t\t},\n\t},\n\t\"ixr-e3c\": {\n\t\tcardType:     \"imm4-qsfp28+16-sfp28+8-sfp56\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m4-qsfp28+16-sfp28+8-sfp56\"},\n\t\t},\n\t},\n\t\"ixr-e3x\": {\n\t\tcardType:     \"imm16-sfp112+15-sfp56+6-qsfpdd\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"},\n\t\t},\n\t},\n\t\"ixr-e2sc\": {\n\t\tcardType:     \"imm16-sfp++4-sfp28\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m16-sfp++4-sfp28\"},\n\t\t},\n\t},\n\t\"ixr-ec\": {\n\t\tcardType:     \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\"},\n\t\t},\n\t},\n}\n\n// componentCfgLine represents one SR OS config line for a component (card, sfm, xiom, mda).\n// Adding a new component type = add a Kind and a case in String().\ntype componentCfgLine struct {\n\tKind     string // \"card\", \"sfm\", \"xiom\", \"xiomMda\", \"mda\"\n\tSlot     string\n\tType     string\n\tXiomSlot int\n\tMdaSlot  int\n}\n\n// String returns the SR OS CLI config line for this component.\nfunc (l componentCfgLine) String() string {\n\tswitch l.Kind {\n\tcase \"card\":\n\t\treturn fmt.Sprintf(\"/configure card %s card-type %s admin-state enable\\n\", l.Slot, l.Type)\n\tcase \"sfm\":\n\t\treturn fmt.Sprintf(\"/configure sfm %s sfm-type %s admin-state enable\\n\", l.Slot, l.Type)\n\tcase \"xiom\":\n\t\treturn fmt.Sprintf(\"/configure card %s xiom x%d xiom-type %s admin-state enable\\n\",\n\t\t\tl.Slot, l.XiomSlot, l.Type)\n\tcase \"xiomMda\":\n\t\treturn fmt.Sprintf(\"/configure card %s xiom x%d mda %d mda-type %s admin-state enable\\n\",\n\t\t\tl.Slot, l.XiomSlot, l.MdaSlot, l.Type)\n\tcase \"mda\":\n\t\treturn fmt.Sprintf(\"/configure card %s mda %d mda-type %s admin-state enable\\n\",\n\t\t\tl.Slot, l.MdaSlot, l.Type)\n\tdefault:\n\t\treturn \"\"\n\t}\n}\n\n// buildComponentCfgLines turns root components into a slice of config lines (card, sfm, xiom,\n// xiomMda, mda).\n// CPM slots (A, B) are skipped. Components without Type are skipped (caller may log).\nfunc buildComponentCfgLines(components []*Component, sfm string) []componentCfgLine {\n\tvar lines []componentCfgLine\n\tfor _, component := range components {\n\t\tslot := strings.ToUpper(strings.TrimSpace(component.Slot))\n\t\tif slot == slotAName || slot == slotBName {\n\t\t\tcontinue\n\t\t}\n\t\tif component.Type == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tlines = append(lines, componentCfgLine{Kind: \"card\", Slot: slot, Type: component.Type})\n\t\tif sfm != \"\" {\n\t\t\tlines = append(lines, componentCfgLine{Kind: \"sfm\", Slot: slot, Type: sfm})\n\t\t}\n\t\tfor _, xiom := range component.XIOM {\n\t\t\tif xiom.Type != \"\" {\n\t\t\t\tlines = append(\n\t\t\t\t\tlines,\n\t\t\t\t\tcomponentCfgLine{\n\t\t\t\t\t\tKind:     \"xiom\",\n\t\t\t\t\t\tSlot:     slot,\n\t\t\t\t\t\tType:     xiom.Type,\n\t\t\t\t\t\tXiomSlot: xiom.Slot,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t}\n\t\t\tfor _, mda := range xiom.MDA {\n\t\t\t\tif mda.Type != \"\" {\n\t\t\t\t\tlines = append(lines, componentCfgLine{\n\t\t\t\t\t\tKind: \"xiomMda\", Slot: slot, Type: mda.Type,\n\t\t\t\t\t\tXiomSlot: xiom.Slot, MdaSlot: mda.Slot,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor _, mda := range component.MDA {\n\t\t\tif mda.Type != \"\" {\n\t\t\t\tlines = append(\n\t\t\t\t\tlines,\n\t\t\t\t\tcomponentCfgLine{Kind: \"mda\", Slot: slot, Type: mda.Type, MdaSlot: mda.Slot},\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\treturn lines\n}\n\nfunc buildIntegratedComponentCfgLines(nodeType string, override *Component) []componentCfgLine {\n\tcomponent, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]\n\tif !ok {\n\t\treturn nil\n\t}\n\tif override == nil {\n\t\toverride = &Component{}\n\t}\n\n\tdefaultMdas := component.mdas\n\n\tif len(override.XIOM) > 0 {\n\t\tdefaultMdas = nil\n\t}\n\n\tcard := &Component{\n\t\tSlot: integratedSrosCardSlot,\n\t\tType: component.cardType,\n\t\tXIOM: override.XIOM,\n\t\tMDA:  mergeIntegratedMdas(defaultMdas, override.MDA),\n\t}\n\n\treturn buildComponentCfgLines([]*Component{card}, \"\")\n}\n\nfunc mergeIntegratedMdas(defaults, overrides MDAS) MDAS {\n\tbySlot := map[int]string{}\n\tfor _, mda := range slices.Concat(defaults, overrides) {\n\t\tif mda.Slot > 0 && mda.Type != \"\" {\n\t\t\tbySlot[mda.Slot] = mda.Type\n\t\t}\n\t}\n\n\tslots := slices.Sorted(maps.Keys(bySlot))\n\tmdas := make(MDAS, 0, len(slots))\n\tfor _, slot := range slots {\n\t\tmdas = append(mdas, MDA{Slot: slot, Type: bySlot[slot]})\n\t}\n\treturn mdas\n}\n\nfunc canonicalSrosNodeType(nodeType string) string {\n\treturn strings.ToLower(strings.TrimSpace(nodeType))\n}\n\nfunc integratedSrosDefault(nodeType string) (integratedSrosDefaultComponent, bool) {\n\tcomponent, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]\n\treturn component, ok\n}\n\nfunc isIntegratedSrosNodeType(nodeType string) bool {\n\t_, ok := integratedSrosDefault(nodeType)\n\treturn ok\n}\n\nfunc integratedSrosAllowedSlots(nodeType string) []string {\n\tcomponent, ok := integratedSrosDefault(nodeType)\n\tif !ok || len(component.allowedSlots) == 0 {\n\t\treturn []string{slotAName}\n\t}\n\treturn component.allowedSlots\n}\n\nfunc isRedundantIntegratedSrosComponents(nodeType string, components []*Component) bool {\n\tif !isIntegratedSrosNodeType(nodeType) || len(components) < 2 {\n\t\treturn false\n\t}\n\tfor _, c := range components {\n\t\tif strings.TrimSpace(c.Slot) == \"\" || !integratedSrosSlotAllowed(nodeType, c.Slot) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\nfunc integratedSrosSlotAllowed(nodeType, slot string) bool {\n\tslot = strings.ToUpper(strings.TrimSpace(slot))\n\tif slot == \"\" {\n\t\tslot = standaloneSlotName\n\t}\n\treturn slices.Contains(integratedSrosAllowedSlots(nodeType), slot)\n}\n\nfunc (n *sros) generateComponentConfig() string {\n\tif !n.kindSpecificCfg().GenComponentConfig {\n\t\treturn \"\"\n\t}\n\tif n.isConfigClassic() {\n\t\treturn \"\"\n\t}\n\n\tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n\t\treturn n.generateIntegratedComponentConfig()\n\t}\n\n\tcomponents := n.rootComponents\n\tif len(components) == 0 {\n\t\treturn \"\"\n\t}\n\n\tfor _, c := range components {\n\t\tslot := strings.ToUpper(strings.TrimSpace(c.Slot))\n\t\tif slot == slotAName || slot == slotBName {\n\t\t\tcontinue\n\t\t}\n\t\tif c.Type == \"\" {\n\t\t\tlog.Warn(\n\t\t\t\t\"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.\",\n\t\t\t\t\"node\",\n\t\t\t\tn.Cfg.ShortName,\n\t\t\t\t\"slot\",\n\t\t\t\tslot,\n\t\t\t)\n\t\t}\n\t}\n\n\tlines := buildComponentCfgLines(n.componentsForConfig(components), n.componentSFM())\n\treturn n.componentConfigFromLines(lines)\n}\n\n// hardwareEnv is the topology env, which overrides component type, XIOM, and MDA.\n// Nodes that have not been through Init expose that env on Cfg.Env.\nfunc (n *sros) hardwareEnv() map[string]string {\n\tif n.userEnv != nil {\n\t\treturn n.userEnv\n\t}\n\treturn n.Cfg.Env\n}\n\n// componentSFM is the SFM used in generated config. NOKIA_SROS_SFM overrides the sfm key.\nfunc (n *sros) componentSFM() string {\n\tif sfm := n.hardwareEnv()[envNokiaSrosSFM]; sfm != \"\" {\n\t\treturn sfm\n\t}\n\treturn n.kindSpecificCfg().SFM\n}\n\n// componentForConfig clones c and applies per-component env, then node env.\nfunc (n *sros) componentForConfig(c *Component) *Component {\n\tout := cloneComponent(c)\n\tapplyHardwareEnv(out, out.Env)\n\tapplyHardwareEnv(out, n.hardwareEnv())\n\treturn out\n}\n\nfunc (n *sros) componentsForConfig(components []*Component) []*Component {\n\tout := make([]*Component, len(components))\n\tfor i, c := range components {\n\t\tout[i] = n.componentForConfig(c)\n\t}\n\treturn out\n}\n\nfunc (n *sros) componentConfigFromLines(lines []componentCfgLine) string {\n\tpowerConfig := n.generatePowerConfig()\n\tif len(lines) == 0 && powerConfig == \"\" {\n\t\treturn \"\"\n\t}\n\n\tvar config strings.Builder\n\tfor _, l := range lines {\n\t\tconfig.WriteString(l.String())\n\t}\n\tconfig.WriteString(powerConfig)\n\treturn config.String()\n}\n\nfunc (n *sros) generateIntegratedComponentConfig() string {\n\tcard := strings.TrimSpace(n.Cfg.Env[envNokiaSrosCard])\n\tif card != \"\" {\n\t\tlog.Info(\n\t\t\t\"Card type override set on integrated chassis type, skipping component SR OS config generation\",\n\t\t\t\"node\",\n\t\t\tn.Cfg.ShortName,\n\t\t\t\"type\",\n\t\t\tn.Cfg.NodeType,\n\t\t\t\"card\",\n\t\t\tcard,\n\t\t)\n\t\treturn \"\"\n\t}\n\n\tlines := buildIntegratedComponentCfgLines(\n\t\tn.Cfg.NodeType,\n\t\tn.componentForConfig(n.integratedComponentOverride()),\n\t)\n\treturn n.componentConfigFromLines(lines)\n}\n\n// integratedComponentOverride returns the component that overrides the integrated defaults:\n// the single component of a standalone node, or the component matching the slot of a\n// redundant CPM node.\nfunc (n *sros) integratedComponentOverride() *Component {\n\tif n.rootCtrName == \"\" {\n\t\tif len(n.kindSpecificCfg().Components) == 1 {\n\t\t\treturn n.kindSpecificCfg().Components[0]\n\t\t}\n\t\treturn nil\n\t}\n\n\tslot := n.Cfg.Env[envNokiaSrosSlot]\n\tfor _, c := range n.rootComponents {\n\t\tif strings.EqualFold(strings.TrimSpace(c.Slot), slot) {\n\t\t\treturn c\n\t\t}\n\t}\n\treturn nil\n}",
        "lineStart": 1,
        "lineEnd": 393,
        "totalLines": 393,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346710484,
      "end": 1792346710493
    }
  }
}
grep · completed

Input

{
  "path": "/source/diff.txt",
  "pattern": "checkComponentSlotsConfig|componentsBySlot|warnUserEnvOverrides|keepUserEnv"
}

Output

Found 28 matches
/source/diff.txt:
  Line 691: +func (n *sros) checkComponentSlotsConfig() error {

  Line 725: +// warnUserEnvOverrides logs when a node env var replaces a component-derived value.

  Line 726: +func warnUserEnvOverrides(node string, derived, userEnv map[string]string) {

  Line 746: +// keepUserEnv copies component-derived keys into dst unless the user already set that key.

  Line 748: +func keepUserEnv(node string, dst, derived, userEnv map[string]string) {

  Line 749: +	warnUserEnvOverrides(node, derived, userEnv)

  Line 1742: +		warnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)

  Line 1850: +		keepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)

  Line 1966: -// checkComponentSlotsConfig check the sros component slot config for validity.

  Line 1967: -func (n *sros) checkComponentSlotsConfig() error {

  Line 2847: +		err := n.checkComponentSlotsConfig()


/source/base/nodes/sros/sros.go:
  Line 209: 		reflect.DeepEqual(componentsBySlot(c.Components), componentsBySlot(o.Components))

  Line 1046: // checkComponentSlotsConfig check the sros component slot config for validity.

  Line 1047: func (n *sros) checkComponentSlotsConfig() error {

  Line 1077: 	err = n.checkComponentSlotsConfig()


/source/base/nodes/sros/component.go:
  Line 17: func componentsBySlot(components []*Component) map[string]Component {


/source/head/nodes/sros/sros.go:
  Line 184: 		reflect.DeepEqual(componentsBySlot(c.Components), componentsBySlot(o.Components))

  Line 328: 		warnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)

  Line 668: 		keepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)

  Line 990: 	err = n.checkComponentSlotsConfig()


/source/head/nodes/sros/sros_test.go:
  Line 644: 		err := n.checkComponentSlotsConfig()


/source/head/nodes/sros/component.go:
  Line 22: func componentsBySlot(components []*Component) map[string]Component {

  Line 149: func (n *sros) checkComponentSlotsConfig() error {

  Line 183: // warnUserEnvOverrides logs when a node env var replaces a component-derived value.

  Line 184: func warnUserEnvOverrides(node string, derived, userEnv map[string]string) {

  Line 204: // keepUserEnv copies component-derived keys into dst unless the user already set that key.

  Line 206: func keepUserEnv(node string, dst, derived, userEnv map[string]string) {

  Line 207: 	warnUserEnvOverrides(node, derived, userEnv)
Tool metadata
{
  "type": "tool",
  "id": "prt_150306271001XUISjZ6y0JQR33",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150303a32001dtsE1QnYTYJ6Bu",
  "callID": "call_a35fd590837f45448ab6e4af",
  "tool": "grep",
  "state": {
    "status": "completed",
    "input": {
      "path": "/source/diff.txt",
      "pattern": "checkComponentSlotsConfig|componentsBySlot|warnUserEnvOverrides|keepUserEnv"
    },
    "output": "Found 28 matches\n/source/diff.txt:\n  Line 691: +func (n *sros) checkComponentSlotsConfig() error {\n\n  Line 725: +// warnUserEnvOverrides logs when a node env var replaces a component-derived value.\n\n  Line 726: +func warnUserEnvOverrides(node string, derived, userEnv map[string]string) {\n\n  Line 746: +// keepUserEnv copies component-derived keys into dst unless the user already set that key.\n\n  Line 748: +func keepUserEnv(node string, dst, derived, userEnv map[string]string) {\n\n  Line 749: +\twarnUserEnvOverrides(node, derived, userEnv)\n\n  Line 1742: +\t\twarnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)\n\n  Line 1850: +\t\tkeepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)\n\n  Line 1966: -// checkComponentSlotsConfig check the sros component slot config for validity.\n\n  Line 1967: -func (n *sros) checkComponentSlotsConfig() error {\n\n  Line 2847: +\t\terr := n.checkComponentSlotsConfig()\n\n\n/source/base/nodes/sros/sros.go:\n  Line 209: \t\treflect.DeepEqual(componentsBySlot(c.Components), componentsBySlot(o.Components))\n\n  Line 1046: // checkComponentSlotsConfig check the sros component slot config for validity.\n\n  Line 1047: func (n *sros) checkComponentSlotsConfig() error {\n\n  Line 1077: \terr = n.checkComponentSlotsConfig()\n\n\n/source/base/nodes/sros/component.go:\n  Line 17: func componentsBySlot(components []*Component) map[string]Component {\n\n\n/source/head/nodes/sros/sros.go:\n  Line 184: \t\treflect.DeepEqual(componentsBySlot(c.Components), componentsBySlot(o.Components))\n\n  Line 328: \t\twarnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)\n\n  Line 668: \t\tkeepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)\n\n  Line 990: \terr = n.checkComponentSlotsConfig()\n\n\n/source/head/nodes/sros/sros_test.go:\n  Line 644: \t\terr := n.checkComponentSlotsConfig()\n\n\n/source/head/nodes/sros/component.go:\n  Line 22: func componentsBySlot(components []*Component) map[string]Component {\n\n  Line 149: func (n *sros) checkComponentSlotsConfig() error {\n\n  Line 183: // warnUserEnvOverrides logs when a node env var replaces a component-derived value.\n\n  Line 184: func warnUserEnvOverrides(node string, derived, userEnv map[string]string) {\n\n  Line 204: // keepUserEnv copies component-derived keys into dst unless the user already set that key.\n\n  Line 206: func keepUserEnv(node string, dst, derived, userEnv map[string]string) {\n\n  Line 207: \twarnUserEnvOverrides(node, derived, userEnv)\n",
    "title": "checkComponentSlotsConfig|componentsBySlot|warnUserEnvOverrides|keepUserEnv",
    "metadata": {
      "matches": 28,
      "truncated": false
    },
    "time": {
      "start": 1792346710646,
      "end": 1792346710692
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1503062a7001a9ZaUSVSqOML5w",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150303a32001dtsE1QnYTYJ6Bu",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 66491,
    "input": 5850,
    "output": 86,
    "reasoning": 651,
    "cache": {
      "read": 59904,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_150303a32001dtsE1QnYTYJ6Bu",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346700338,
    "completed": 1792346710700
  },
  "parentID": "msg_1502f68f300142aYYM85hGexse",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 66491,
    "input": 5850,
    "output": 86,
    "reasoning": 651,
    "cache": {
      "read": 59904,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 32
step-start
{
  "type": "step-start",
  "id": "prt_150306c11001QWBZXsytqqu8Ln",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1503062b70016nw0gwV8q9FWy0"
}
Reasoning
Confirmed: `checkComponentSlotsConfig` was moved from `sros.go` (base lines 1046-1047) into `component.go` — the TrimSpace omission is pre-existing (moved code), though the new test asserts case-insensitive duplicate rejection. Not a PR-introduced defect; could mention as coverage note or P4? It's pre-existing behavior; the new test documents the case behavior. I'll leave it out or as a note.

Now, key remaining verification: sros.go Init region — the SFM warning inline duplication (line 328 area) and env merging. Let me read sros.go lines ~250-420 and ~600-720 and ~900-1050 in head.
`checkComponentSlotsConfig` was moved from `sros.go` (pre-existing logic), so its whitespace quirk isn't PR-introduced. Now let me examine the `sros.go` Init region where env merging and SFM handling occur, to verify the warning behavior described in the docs.
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/sros.go",
  "limit": 180,
  "offset": 255
}

Output

<path>/source/head/nodes/sros/sros.go</path>
<type>file</type>
<content>
255: 		o(n)
256: 	}
257: 
258: 	// if user was not initialized to a value, use root
259: 	if n.Cfg.User == "" {
260: 		n.Cfg.User = "0:0"
261: 	}
262: 
263: 	// Snapshot topology env before component and SFM flags are applied.
264: 	// Component nodes set userEnv from the base node before Init.
265: 	envAlreadyResolved := n.userEnv != nil
266: 	if !envAlreadyResolved {
267: 		if n.Cfg.Env == nil {
268: 			n.userEnv = map[string]string{}
269: 		} else {
270: 			n.userEnv = maps.Clone(n.Cfg.Env)
271: 		}
272: 	}
273: 	if n.Cfg.Env == nil {
274: 		n.Cfg.Env = map[string]string{}
275: 	}
276: 
277: 	// Distributed cards inherit SFM from the base node env. Applying it again
278: 	// would warn once per card when the user also set NOKIA_SROS_SFM.
279: 	if sfm := n.kindSpecificCfg().SFM; sfm != "" && !envAlreadyResolved {
280: 		if envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {
281: 			if envSFM != sfm {
282: 				log.Warn(
283: 					fmt.Sprintf(
284: 						"component value %q will not be used because environment variable %s is set",
285: 						sfm,
286: 						envNokiaSrosSFM,
287: 					),
288: 					"node", n.Cfg.ShortName,
289: 					"env", envNokiaSrosSFM,
290: 					"component-value", sfm,
291: 					"env-value", envSFM,
292: 				)
293: 			}
294: 		} else {
295: 			n.Cfg.Env[envNokiaSrosSFM] = sfm
296: 		}
297: 	}
298: 
299: 	maps.Copy(n.Cfg.Sysctls, srosSysctl)
300: 
301: 	// make sure we always have uppercase slot definition
302: 	for _, c := range n.kindSpecificCfg().Components {
303: 		c.Slot = strings.ToUpper(c.Slot)
304: 	}
305: 	// Merge Environment
306: 	if n.Cfg.NodeType == "" {
307: 		n.Cfg.NodeType = SrosDefaultType
308: 	}
309: 	srosEnv[envNokiaSrosChassis] = n.Cfg.NodeType // Override NodeType var with existing env
310: 
311: 	mac := genMac(n.Cfg)
312: 	srosEnv[envNokiaSrosSystemBaseMac] = mac
313: 	// Ensure n.Cfg.Certificate.Issue is not nil
314: 	if n.Cfg.Certificate.Issue == nil {
315: 		n.Cfg.Certificate.Issue = new(false)
316: 	}
317: 	if n.isStandaloneNode() {
318: 		log.Debugf(
319: 			"%q is standalone node. %v",
320: 			n.Cfg.ShortName,
321: 			len(n.kindSpecificCfg().Components),
322: 		)
323: 
324: 		vars, err := n.setupStandaloneComponents()
325: 		if err != nil {
326: 			return err
327: 		}
328: 		warnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)
329: 
330: 		// n.Cfg.Env overrides component vars, overrides default srosEnv
331: 		n.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)
332: 		log.Debug("Merged env file", "env", fmt.Sprintf("%+v", n.Cfg.Env), "node", n.Cfg.ShortName)
333: 	} else {
334: 		log.Debugf(
335: 			"%q is distributed node. %v",
336: 			n.Cfg.ShortName,
337: 			len(n.kindSpecificCfg().Components),
338: 		)
339: 
340: 		n.Cfg.Env = clabutils.MergeStringMaps(srosEnv, n.Cfg.Env)
341: 		log.Debug("Merged env file", "env", fmt.Sprintf("%+v", n.Cfg.Env), "node", n.Cfg.ShortName)
342: 
343: 		err := n.setupComponentNodes()
344: 		if err != nil {
345: 			return err
346: 		}
347: 	}
348: 
349: 	return nil
350: }
351: 
352: // integrated -> pull component info from slot A components.
353: func (n *sros) setupStandaloneComponents() (map[string]string, error) {
354: 	vars := map[string]string{}
355: 
356: 	if len(n.kindSpecificCfg().Components) == 0 {
357: 		return nil, nil
358: 	}
359: 	if len(n.kindSpecificCfg().Components) > 1 {
360: 		return nil, fmt.Errorf(
361: 			"expected at most one component override for standalone SR-SIM node %q, "+
362: 				"or one component per slot %s for redundant type %q",
363: 			n.Cfg.ShortName,
364: 			strings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), "/"),
365: 			n.Cfg.NodeType,
366: 		)
367: 	}
368: 
369: 	slotA := n.kindSpecificCfg().Components[0]
370: 
371: 	slotName := strings.ToUpper(strings.TrimSpace(slotA.Slot))
372: 	// single undefined slot is implicitly set to A
373: 	if slotName == "" {
374: 		slotName = standaloneSlotName
375: 	}
376: 
377: 	if !integratedSrosSlotAllowed(n.Cfg.NodeType, slotName) {
378: 		return nil, fmt.Errorf(
379: 			"expected no slot, or slot %s for components of standalone SR-SIM node %q",
380: 			strings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), "/"),
381: 			n.Cfg.ShortName,
382: 		)
383: 	}
384: 	vars[envNokiaSrosSlot] = slotName
385: 
386: 	setComponentEnvVars(vars, slotA)
387: 
388: 	maps.Copy(vars, slotA.Env)
389: 
390: 	return vars, nil
391: }
392: 
393: // Pre Deploy func for SR-SIM kind.
394: func (n *sros) PreDeploy(ctx context.Context, params *clabnodes.PreDeployParams) error {
395: 	log.Debug("Running pre-deploy")
396: 
397: 	if err := n.verifyNokiaSrsimImage(ctx); err != nil {
398: 		return err
399: 	}
400: 
401: 	// store the preDeployParams
402: 	n.preDeployParams = params
403: 
404: 	n.InterfaceHelp = InterfaceHelp
405: 
406: 	// store provided pubkeys
407: 	n.sshPubKeys = params.SSHPubKeys
408: 
409: 	// Create files/dir structure for standalone nodes or distributed CPM nodes
410: 	if n.isStandaloneNode() || (n.isDistributedCardNode() && n.isCPM("")) {
411: 		// generate the certificate
412: 		if *n.Cfg.Certificate.Issue {
413: 			n.Cfg.Certificate.SANs = append(n.Cfg.Certificate.SANs, n.baseShortName, n.baseLongName)
414: 			certificate, err := n.LoadOrGenerateCertificate(params.Cert, params.TopologyName)
415: 			if err != nil {
416: 				return err
417: 			}
418: 
419: 			// set the certificate data
420: 			n.Config().TLSCert = string(certificate.Cert)
421: 			n.Config().TLSKey = string(certificate.Key)
422: 		}
423: 		clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),
424: 			clabconstants.PermissionsOpen)
425: 		slot := n.Cfg.Env[envNokiaSrosSlot]
426: 		if slot == "" {
427: 			return fmt.Errorf("fail to init node because Env var %q is set to %q",
428: 				envNokiaSrosSlot, n.Cfg.Env[envNokiaSrosSlot])
429: 		}
430: 		// add the config specific mounts
431: 		cf1Path := filepath.Join(n.Cfg.LabDir, slot, configCf1)
432: 		cf2Path := filepath.Join(n.Cfg.LabDir, slot, configCf2)
433: 		cf3Path := filepath.Join(n.Cfg.LabDir, slot, configCf3)
434: 		n.Cfg.Binds = append(n.Cfg.Binds,

(Showing lines 255-434 of 1910. Use offset=435 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_1503073d8001zfxs3ZhgsKa8fF",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1503062b70016nw0gwV8q9FWy0",
  "callID": "call_7b4ef52502094a10b352d86a",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/sros.go",
      "limit": 180,
      "offset": 255
    },
    "output": "<path>/source/head/nodes/sros/sros.go</path>\n<type>file</type>\n<content>\n255: \t\to(n)\n256: \t}\n257: \n258: \t// if user was not initialized to a value, use root\n259: \tif n.Cfg.User == \"\" {\n260: \t\tn.Cfg.User = \"0:0\"\n261: \t}\n262: \n263: \t// Snapshot topology env before component and SFM flags are applied.\n264: \t// Component nodes set userEnv from the base node before Init.\n265: \tenvAlreadyResolved := n.userEnv != nil\n266: \tif !envAlreadyResolved {\n267: \t\tif n.Cfg.Env == nil {\n268: \t\t\tn.userEnv = map[string]string{}\n269: \t\t} else {\n270: \t\t\tn.userEnv = maps.Clone(n.Cfg.Env)\n271: \t\t}\n272: \t}\n273: \tif n.Cfg.Env == nil {\n274: \t\tn.Cfg.Env = map[string]string{}\n275: \t}\n276: \n277: \t// Distributed cards inherit SFM from the base node env. Applying it again\n278: \t// would warn once per card when the user also set NOKIA_SROS_SFM.\n279: \tif sfm := n.kindSpecificCfg().SFM; sfm != \"\" && !envAlreadyResolved {\n280: \t\tif envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {\n281: \t\t\tif envSFM != sfm {\n282: \t\t\t\tlog.Warn(\n283: \t\t\t\t\tfmt.Sprintf(\n284: \t\t\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n285: \t\t\t\t\t\tsfm,\n286: \t\t\t\t\t\tenvNokiaSrosSFM,\n287: \t\t\t\t\t),\n288: \t\t\t\t\t\"node\", n.Cfg.ShortName,\n289: \t\t\t\t\t\"env\", envNokiaSrosSFM,\n290: \t\t\t\t\t\"component-value\", sfm,\n291: \t\t\t\t\t\"env-value\", envSFM,\n292: \t\t\t\t)\n293: \t\t\t}\n294: \t\t} else {\n295: \t\t\tn.Cfg.Env[envNokiaSrosSFM] = sfm\n296: \t\t}\n297: \t}\n298: \n299: \tmaps.Copy(n.Cfg.Sysctls, srosSysctl)\n300: \n301: \t// make sure we always have uppercase slot definition\n302: \tfor _, c := range n.kindSpecificCfg().Components {\n303: \t\tc.Slot = strings.ToUpper(c.Slot)\n304: \t}\n305: \t// Merge Environment\n306: \tif n.Cfg.NodeType == \"\" {\n307: \t\tn.Cfg.NodeType = SrosDefaultType\n308: \t}\n309: \tsrosEnv[envNokiaSrosChassis] = n.Cfg.NodeType // Override NodeType var with existing env\n310: \n311: \tmac := genMac(n.Cfg)\n312: \tsrosEnv[envNokiaSrosSystemBaseMac] = mac\n313: \t// Ensure n.Cfg.Certificate.Issue is not nil\n314: \tif n.Cfg.Certificate.Issue == nil {\n315: \t\tn.Cfg.Certificate.Issue = new(false)\n316: \t}\n317: \tif n.isStandaloneNode() {\n318: \t\tlog.Debugf(\n319: \t\t\t\"%q is standalone node. %v\",\n320: \t\t\tn.Cfg.ShortName,\n321: \t\t\tlen(n.kindSpecificCfg().Components),\n322: \t\t)\n323: \n324: \t\tvars, err := n.setupStandaloneComponents()\n325: \t\tif err != nil {\n326: \t\t\treturn err\n327: \t\t}\n328: \t\twarnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)\n329: \n330: \t\t// n.Cfg.Env overrides component vars, overrides default srosEnv\n331: \t\tn.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)\n332: \t\tlog.Debug(\"Merged env file\", \"env\", fmt.Sprintf(\"%+v\", n.Cfg.Env), \"node\", n.Cfg.ShortName)\n333: \t} else {\n334: \t\tlog.Debugf(\n335: \t\t\t\"%q is distributed node. %v\",\n336: \t\t\tn.Cfg.ShortName,\n337: \t\t\tlen(n.kindSpecificCfg().Components),\n338: \t\t)\n339: \n340: \t\tn.Cfg.Env = clabutils.MergeStringMaps(srosEnv, n.Cfg.Env)\n341: \t\tlog.Debug(\"Merged env file\", \"env\", fmt.Sprintf(\"%+v\", n.Cfg.Env), \"node\", n.Cfg.ShortName)\n342: \n343: \t\terr := n.setupComponentNodes()\n344: \t\tif err != nil {\n345: \t\t\treturn err\n346: \t\t}\n347: \t}\n348: \n349: \treturn nil\n350: }\n351: \n352: // integrated -> pull component info from slot A components.\n353: func (n *sros) setupStandaloneComponents() (map[string]string, error) {\n354: \tvars := map[string]string{}\n355: \n356: \tif len(n.kindSpecificCfg().Components) == 0 {\n357: \t\treturn nil, nil\n358: \t}\n359: \tif len(n.kindSpecificCfg().Components) > 1 {\n360: \t\treturn nil, fmt.Errorf(\n361: \t\t\t\"expected at most one component override for standalone SR-SIM node %q, \"+\n362: \t\t\t\t\"or one component per slot %s for redundant type %q\",\n363: \t\t\tn.Cfg.ShortName,\n364: \t\t\tstrings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), \"/\"),\n365: \t\t\tn.Cfg.NodeType,\n366: \t\t)\n367: \t}\n368: \n369: \tslotA := n.kindSpecificCfg().Components[0]\n370: \n371: \tslotName := strings.ToUpper(strings.TrimSpace(slotA.Slot))\n372: \t// single undefined slot is implicitly set to A\n373: \tif slotName == \"\" {\n374: \t\tslotName = standaloneSlotName\n375: \t}\n376: \n377: \tif !integratedSrosSlotAllowed(n.Cfg.NodeType, slotName) {\n378: \t\treturn nil, fmt.Errorf(\n379: \t\t\t\"expected no slot, or slot %s for components of standalone SR-SIM node %q\",\n380: \t\t\tstrings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), \"/\"),\n381: \t\t\tn.Cfg.ShortName,\n382: \t\t)\n383: \t}\n384: \tvars[envNokiaSrosSlot] = slotName\n385: \n386: \tsetComponentEnvVars(vars, slotA)\n387: \n388: \tmaps.Copy(vars, slotA.Env)\n389: \n390: \treturn vars, nil\n391: }\n392: \n393: // Pre Deploy func for SR-SIM kind.\n394: func (n *sros) PreDeploy(ctx context.Context, params *clabnodes.PreDeployParams) error {\n395: \tlog.Debug(\"Running pre-deploy\")\n396: \n397: \tif err := n.verifyNokiaSrsimImage(ctx); err != nil {\n398: \t\treturn err\n399: \t}\n400: \n401: \t// store the preDeployParams\n402: \tn.preDeployParams = params\n403: \n404: \tn.InterfaceHelp = InterfaceHelp\n405: \n406: \t// store provided pubkeys\n407: \tn.sshPubKeys = params.SSHPubKeys\n408: \n409: \t// Create files/dir structure for standalone nodes or distributed CPM nodes\n410: \tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.isCPM(\"\")) {\n411: \t\t// generate the certificate\n412: \t\tif *n.Cfg.Certificate.Issue {\n413: \t\t\tn.Cfg.Certificate.SANs = append(n.Cfg.Certificate.SANs, n.baseShortName, n.baseLongName)\n414: \t\t\tcertificate, err := n.LoadOrGenerateCertificate(params.Cert, params.TopologyName)\n415: \t\t\tif err != nil {\n416: \t\t\t\treturn err\n417: \t\t\t}\n418: \n419: \t\t\t// set the certificate data\n420: \t\t\tn.Config().TLSCert = string(certificate.Cert)\n421: \t\t\tn.Config().TLSKey = string(certificate.Key)\n422: \t\t}\n423: \t\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),\n424: \t\t\tclabconstants.PermissionsOpen)\n425: \t\tslot := n.Cfg.Env[envNokiaSrosSlot]\n426: \t\tif slot == \"\" {\n427: \t\t\treturn fmt.Errorf(\"fail to init node because Env var %q is set to %q\",\n428: \t\t\t\tenvNokiaSrosSlot, n.Cfg.Env[envNokiaSrosSlot])\n429: \t\t}\n430: \t\t// add the config specific mounts\n431: \t\tcf1Path := filepath.Join(n.Cfg.LabDir, slot, configCf1)\n432: \t\tcf2Path := filepath.Join(n.Cfg.LabDir, slot, configCf2)\n433: \t\tcf3Path := filepath.Join(n.Cfg.LabDir, slot, configCf3)\n434: \t\tn.Cfg.Binds = append(n.Cfg.Binds,\n\n(Showing lines 255-434 of 1910. Use offset=435 to continue.)\n</content>",
    "title": "source/head/nodes/sros/sros.go",
    "metadata": {
      "preview": "\t\to(n)\n\t}\n\n\t// if user was not initialized to a value, use root\n\tif n.Cfg.User == \"\" {\n\t\tn.Cfg.User = \"0:0\"\n\t}\n\n\t// Snapshot topology env before component and SFM flags are applied.\n\t// Component nodes set userEnv from the base node before Init.\n\tenvAlreadyResolved := n.userEnv != nil\n\tif !envAlreadyResolved {\n\t\tif n.Cfg.Env == nil {\n\t\t\tn.userEnv = map[string]string{}\n\t\t} else {\n\t\t\tn.userEnv = maps.Clone(n.Cfg.Env)\n\t\t}\n\t}\n\tif n.Cfg.Env == nil {\n\t\tn.Cfg.Env = map[string]string{}",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/sros.go",
        "text": "\t\to(n)\n\t}\n\n\t// if user was not initialized to a value, use root\n\tif n.Cfg.User == \"\" {\n\t\tn.Cfg.User = \"0:0\"\n\t}\n\n\t// Snapshot topology env before component and SFM flags are applied.\n\t// Component nodes set userEnv from the base node before Init.\n\tenvAlreadyResolved := n.userEnv != nil\n\tif !envAlreadyResolved {\n\t\tif n.Cfg.Env == nil {\n\t\t\tn.userEnv = map[string]string{}\n\t\t} else {\n\t\t\tn.userEnv = maps.Clone(n.Cfg.Env)\n\t\t}\n\t}\n\tif n.Cfg.Env == nil {\n\t\tn.Cfg.Env = map[string]string{}\n\t}\n\n\t// Distributed cards inherit SFM from the base node env. Applying it again\n\t// would warn once per card when the user also set NOKIA_SROS_SFM.\n\tif sfm := n.kindSpecificCfg().SFM; sfm != \"\" && !envAlreadyResolved {\n\t\tif envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {\n\t\t\tif envSFM != sfm {\n\t\t\t\tlog.Warn(\n\t\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n\t\t\t\t\t\tsfm,\n\t\t\t\t\t\tenvNokiaSrosSFM,\n\t\t\t\t\t),\n\t\t\t\t\t\"node\", n.Cfg.ShortName,\n\t\t\t\t\t\"env\", envNokiaSrosSFM,\n\t\t\t\t\t\"component-value\", sfm,\n\t\t\t\t\t\"env-value\", envSFM,\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\tn.Cfg.Env[envNokiaSrosSFM] = sfm\n\t\t}\n\t}\n\n\tmaps.Copy(n.Cfg.Sysctls, srosSysctl)\n\n\t// make sure we always have uppercase slot definition\n\tfor _, c := range n.kindSpecificCfg().Components {\n\t\tc.Slot = strings.ToUpper(c.Slot)\n\t}\n\t// Merge Environment\n\tif n.Cfg.NodeType == \"\" {\n\t\tn.Cfg.NodeType = SrosDefaultType\n\t}\n\tsrosEnv[envNokiaSrosChassis] = n.Cfg.NodeType // Override NodeType var with existing env\n\n\tmac := genMac(n.Cfg)\n\tsrosEnv[envNokiaSrosSystemBaseMac] = mac\n\t// Ensure n.Cfg.Certificate.Issue is not nil\n\tif n.Cfg.Certificate.Issue == nil {\n\t\tn.Cfg.Certificate.Issue = new(false)\n\t}\n\tif n.isStandaloneNode() {\n\t\tlog.Debugf(\n\t\t\t\"%q is standalone node. %v\",\n\t\t\tn.Cfg.ShortName,\n\t\t\tlen(n.kindSpecificCfg().Components),\n\t\t)\n\n\t\tvars, err := n.setupStandaloneComponents()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\twarnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)\n\n\t\t// n.Cfg.Env overrides component vars, overrides default srosEnv\n\t\tn.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)\n\t\tlog.Debug(\"Merged env file\", \"env\", fmt.Sprintf(\"%+v\", n.Cfg.Env), \"node\", n.Cfg.ShortName)\n\t} else {\n\t\tlog.Debugf(\n\t\t\t\"%q is distributed node. %v\",\n\t\t\tn.Cfg.ShortName,\n\t\t\tlen(n.kindSpecificCfg().Components),\n\t\t)\n\n\t\tn.Cfg.Env = clabutils.MergeStringMaps(srosEnv, n.Cfg.Env)\n\t\tlog.Debug(\"Merged env file\", \"env\", fmt.Sprintf(\"%+v\", n.Cfg.Env), \"node\", n.Cfg.ShortName)\n\n\t\terr := n.setupComponentNodes()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// integrated -> pull component info from slot A components.\nfunc (n *sros) setupStandaloneComponents() (map[string]string, error) {\n\tvars := map[string]string{}\n\n\tif len(n.kindSpecificCfg().Components) == 0 {\n\t\treturn nil, nil\n\t}\n\tif len(n.kindSpecificCfg().Components) > 1 {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"expected at most one component override for standalone SR-SIM node %q, \"+\n\t\t\t\t\"or one component per slot %s for redundant type %q\",\n\t\t\tn.Cfg.ShortName,\n\t\t\tstrings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), \"/\"),\n\t\t\tn.Cfg.NodeType,\n\t\t)\n\t}\n\n\tslotA := n.kindSpecificCfg().Components[0]\n\n\tslotName := strings.ToUpper(strings.TrimSpace(slotA.Slot))\n\t// single undefined slot is implicitly set to A\n\tif slotName == \"\" {\n\t\tslotName = standaloneSlotName\n\t}\n\n\tif !integratedSrosSlotAllowed(n.Cfg.NodeType, slotName) {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"expected no slot, or slot %s for components of standalone SR-SIM node %q\",\n\t\t\tstrings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), \"/\"),\n\t\t\tn.Cfg.ShortName,\n\t\t)\n\t}\n\tvars[envNokiaSrosSlot] = slotName\n\n\tsetComponentEnvVars(vars, slotA)\n\n\tmaps.Copy(vars, slotA.Env)\n\n\treturn vars, nil\n}\n\n// Pre Deploy func for SR-SIM kind.\nfunc (n *sros) PreDeploy(ctx context.Context, params *clabnodes.PreDeployParams) error {\n\tlog.Debug(\"Running pre-deploy\")\n\n\tif err := n.verifyNokiaSrsimImage(ctx); err != nil {\n\t\treturn err\n\t}\n\n\t// store the preDeployParams\n\tn.preDeployParams = params\n\n\tn.InterfaceHelp = InterfaceHelp\n\n\t// store provided pubkeys\n\tn.sshPubKeys = params.SSHPubKeys\n\n\t// Create files/dir structure for standalone nodes or distributed CPM nodes\n\tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.isCPM(\"\")) {\n\t\t// generate the certificate\n\t\tif *n.Cfg.Certificate.Issue {\n\t\t\tn.Cfg.Certificate.SANs = append(n.Cfg.Certificate.SANs, n.baseShortName, n.baseLongName)\n\t\t\tcertificate, err := n.LoadOrGenerateCertificate(params.Cert, params.TopologyName)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// set the certificate data\n\t\t\tn.Config().TLSCert = string(certificate.Cert)\n\t\t\tn.Config().TLSKey = string(certificate.Key)\n\t\t}\n\t\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),\n\t\t\tclabconstants.PermissionsOpen)\n\t\tslot := n.Cfg.Env[envNokiaSrosSlot]\n\t\tif slot == \"\" {\n\t\t\treturn fmt.Errorf(\"fail to init node because Env var %q is set to %q\",\n\t\t\t\tenvNokiaSrosSlot, n.Cfg.Env[envNokiaSrosSlot])\n\t\t}\n\t\t// add the config specific mounts\n\t\tcf1Path := filepath.Join(n.Cfg.LabDir, slot, configCf1)\n\t\tcf2Path := filepath.Join(n.Cfg.LabDir, slot, configCf2)\n\t\tcf3Path := filepath.Join(n.Cfg.LabDir, slot, configCf3)\n\t\tn.Cfg.Binds = append(n.Cfg.Binds,",
        "lineStart": 255,
        "lineEnd": 434,
        "totalLines": 1910,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346715119,
      "end": 1792346715148
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_15030740f001cZTqY0NPRifjeD",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_1503062b70016nw0gwV8q9FWy0",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 71639,
    "input": 5095,
    "output": 91,
    "reasoning": 149,
    "cache": {
      "read": 66304,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_1503062b70016nw0gwV8q9FWy0",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346710711,
    "completed": 1792346715154
  },
  "parentID": "msg_1502f68f300142aYYM85hGexse",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 71639,
    "input": 5095,
    "output": 91,
    "reasoning": 149,
    "cache": {
      "read": 66304,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 33
step-start
{
  "type": "step-start",
  "id": "prt_150307d31001iGPCreyGMPVUf7",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15030741c0016laGe170oUCAMo"
}
Reasoning
I've now seen the Init env merge. A few things to verify:

1. The `srosEnv` package-level map: `srosEnv[envNokiaSrosChassis] = n.Cfg.NodeType` (line 309) and `srosEnv[envNokiaSrosSystemBaseMac] = mac` (line 312) — mutating a package-level map per node. This is pre-existing (present in base too? let me check base sros.go around these lines). The comment "Override NodeType var with existing env" suggests it's pre-existing. This is a data race if nodes Init concurrently (containerlab deploys nodes concurrently? Actually node Init is done serially during parsing? Deploy does `Init` for all nodes possibly concurrently). This is pre-existing though. Not a PR finding unless PR worsened it. Let me check base.

2. The SFM warning duplication: lines 279-297 inline warn (uses same message format as `warnUserEnvOverrides`). The comment explains: distributed cards inherit SFM from base env; applying warn again would warn once per card. So the inline duplication is deliberate; but the message duplication itself could have been factored... it's minor P4; maybe worth mentioning as optional improvement: extract the log.Warn into a helper shared with `warnUserEnvOverrides`. Actually `warnUserEnvOverrides(node, derived, userEnv)` could handle SFM if it were passed {envNokiaSrosSFM: sfm} as derived. Indeed the inline code duplicates exactly what warnUserEnvOverrides does for one key. A small refactor: `warnUserEnvOverrides(n.Cfg.ShortName, map[string]string{envNokiaSrosSFM: sfm}, n.userEnv)`. That's a legit P4 simplification. But wait — there's a subtle difference: warnUserEnvOverrides skips when componentValue == envValue... same logic. Yes identical semantics. Minor P4.

3. `setupStandaloneComponents` returns vars; `warnUserEnvOverrides` called with vars; then `n.Cfg.Env = MergeStringMaps(srosEnv, vars, n.Cfg.Env)`. Note: `n.Cfg.Env` at this point already contains user env (userEnv snapshot was cloned before). MergeStringMaps with later maps winning → user env wins over vars. Consistent with docs.

4. In the distributed branch, `n.Cfg.Env = MergeStringMaps(srosEnv, n.Cfg.Env)` — base node keeps user env. Then setupComponentNodes creates component nodes with keepUserEnv for each component (line 668).

Now check line 668 region and setupComponentNodes. Also check `isIntegratedSrosNodeType` usage in Init for integrated redundant: setupStandaloneComponents requires len(components) <= 1 unless redundant type... wait — for ixr-r6 with two components (A and B), `len(components) > 1` → error "expected at most one component override... or one component per slot for redundant type". But the code returns error unconditionally when >1! Let me re-read: lines 356-367: if 0 → return nil,nil; if >1 → return error. But the error message mentions "or one component per slot %s for redundant type %q". So how does the redundant ixr-r6 case with 2 components succeed? Test "redundant_integrated_components_are_distributed" expects Init to succeed with 2 components. Hmm — so where is the redundant path handled? Maybe Init checks `isRedundantIntegratedSrosComponents` before calling setupStandaloneComponents and routes to the distributed branch instead. Let me look at `isStandaloneNode()` (line 317 condition) — it must return false for redundant integrated components. Let me read sros.go isStandaloneNode and related helper methods. Let me search.
The Init path looks consistent, but I need to verify how redundant integrated components (`ixr-r6` with slots `A`+`B`) are routed — `setupStandaloneComponents` errors on >1 components, so `isStandaloneNode()` must route them to the distributed branch. Let me inspect the node-classification helpers.
grep · completed

Input

{
  "path": "/source/head/nodes/sros/sros.go",
  "pattern": "func \\(n \\*sros\\) is|isRedundantIntegrated|isDistributedBaseNode|isDistributedCardNode"
}

Output

Found 33 matches
/source/head/nodes/sros/variant.go:
  Line 158: func (n *sros) isIXRNode() bool {

  Line 163: func (n *sros) isSARNode() bool {

  Line 168: func (n *sros) isSARHmNode() bool {


/source/head/nodes/sros/netns.go:
  Line 131: 	if n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == "") {

  Line 133: 	} else if n.isDistributedCardNode() {

  Line 144: 	if n.isDistributedBaseNode() {


/source/head/nodes/sros/sros.go:
  Line 410: 	if n.isStandaloneNode() || (n.isDistributedCardNode() && n.isCPM("")) {

  Line 605: 	if n.isStandaloneNode() || n.isDistributedCardNode() {

  Line 626: 	if !n.isDistributedBaseNode() {

  Line 810: // isDistributedCardNode returns true if this node is a card (linecard/IOM)

  Line 813: func (n *sros) isDistributedCardNode() bool {

  Line 818: // isDistributedBaseNode returns true if this is the base node of a distributed

  Line 820: func (n *sros) isDistributedBaseNode() bool {

  Line 822: 		return isRedundantIntegratedSrosComponents(n.Cfg.NodeType, n.kindSpecificCfg().Components)

  Line 828: func (n *sros) isStandaloneNode() bool {

  Line 829: 	return !n.isDistributedBaseNode() && !n.isDistributedCardNode()

  Line 893: 	if n.isDistributedBaseNode() {

  Line 1138: func (n *sros) isCPM(cpm string) bool {

  Line 1161: 	if n.isStandaloneNode() || n.isDistributedCardNode() {

  Line 1215: 	if n.isDistributedBaseNode() && n.cpmContainerName != "" {

  Line 1370: 	case n.isDistributedBaseNode():

  Line 1378: 	case n.isDistributedCardNode():

  Line 1579: 	if n.isDistributedBaseNode() {

  Line 1629: 	if n.isDistributedBaseNode() {

  Line 1687: 	if n.isDistributedBaseNode() && n.cpmContainerName != "" {

  Line 1771: 	if n.isStandaloneNode() || n.isDistributedCardNode() {

  Line 1820: 	if n.isStandaloneNode() || n.isDistributedCardNode() {

  Line 1845: 	if n.isStandaloneNode() || n.isDistributedCardNode() {

  Line 1902: 	if !n.isDistributedBaseNode() {


/source/head/nodes/sros/README.md:
  Line 1227:    func (n *sros) isDMSNode() bool {


/source/head/nodes/sros/config.go:
  Line 335: func (n *sros) isConfigClassic() bool {


/source/head/nodes/sros/component_config.go:
  Line 249: func isRedundantIntegratedSrosComponents(nodeType string, components []*Component) bool {


/source/head/nodes/sros/sros_test.go:
  Line 557: 		assert.True(t, n.isDistributedBaseNode())
Tool metadata
{
  "type": "tool",
  "id": "prt_15030a0f3001ZWDIu1h8vJ94Nz",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15030741c0016laGe170oUCAMo",
  "callID": "call_c22c176a825443478315296f",
  "tool": "grep",
  "state": {
    "status": "completed",
    "input": {
      "path": "/source/head/nodes/sros/sros.go",
      "pattern": "func \\(n \\*sros\\) is|isRedundantIntegrated|isDistributedBaseNode|isDistributedCardNode"
    },
    "output": "Found 33 matches\n/source/head/nodes/sros/variant.go:\n  Line 158: func (n *sros) isIXRNode() bool {\n\n  Line 163: func (n *sros) isSARNode() bool {\n\n  Line 168: func (n *sros) isSARHmNode() bool {\n\n\n/source/head/nodes/sros/netns.go:\n  Line 131: \tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == \"\") {\n\n  Line 133: \t} else if n.isDistributedCardNode() {\n\n  Line 144: \tif n.isDistributedBaseNode() {\n\n\n/source/head/nodes/sros/sros.go:\n  Line 410: \tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.isCPM(\"\")) {\n\n  Line 605: \tif n.isStandaloneNode() || n.isDistributedCardNode() {\n\n  Line 626: \tif !n.isDistributedBaseNode() {\n\n  Line 810: // isDistributedCardNode returns true if this node is a card (linecard/IOM)\n\n  Line 813: func (n *sros) isDistributedCardNode() bool {\n\n  Line 818: // isDistributedBaseNode returns true if this is the base node of a distributed\n\n  Line 820: func (n *sros) isDistributedBaseNode() bool {\n\n  Line 822: \t\treturn isRedundantIntegratedSrosComponents(n.Cfg.NodeType, n.kindSpecificCfg().Components)\n\n  Line 828: func (n *sros) isStandaloneNode() bool {\n\n  Line 829: \treturn !n.isDistributedBaseNode() && !n.isDistributedCardNode()\n\n  Line 893: \tif n.isDistributedBaseNode() {\n\n  Line 1138: func (n *sros) isCPM(cpm string) bool {\n\n  Line 1161: \tif n.isStandaloneNode() || n.isDistributedCardNode() {\n\n  Line 1215: \tif n.isDistributedBaseNode() && n.cpmContainerName != \"\" {\n\n  Line 1370: \tcase n.isDistributedBaseNode():\n\n  Line 1378: \tcase n.isDistributedCardNode():\n\n  Line 1579: \tif n.isDistributedBaseNode() {\n\n  Line 1629: \tif n.isDistributedBaseNode() {\n\n  Line 1687: \tif n.isDistributedBaseNode() && n.cpmContainerName != \"\" {\n\n  Line 1771: \tif n.isStandaloneNode() || n.isDistributedCardNode() {\n\n  Line 1820: \tif n.isStandaloneNode() || n.isDistributedCardNode() {\n\n  Line 1845: \tif n.isStandaloneNode() || n.isDistributedCardNode() {\n\n  Line 1902: \tif !n.isDistributedBaseNode() {\n\n\n/source/head/nodes/sros/README.md:\n  Line 1227:    func (n *sros) isDMSNode() bool {\n\n\n/source/head/nodes/sros/config.go:\n  Line 335: func (n *sros) isConfigClassic() bool {\n\n\n/source/head/nodes/sros/component_config.go:\n  Line 249: func isRedundantIntegratedSrosComponents(nodeType string, components []*Component) bool {\n\n\n/source/head/nodes/sros/sros_test.go:\n  Line 557: \t\tassert.True(t, n.isDistributedBaseNode())\n",
    "title": "func \\(n \\*sros\\) is|isRedundantIntegrated|isDistributedBaseNode|isDistributedCardNode",
    "metadata": {
      "matches": 33,
      "truncated": false
    },
    "time": {
      "start": 1792346726647,
      "end": 1792346726660
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_15030a106001YWhDEYszSM5QLj",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15030741c0016laGe170oUCAMo",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 74779,
    "input": 2427,
    "output": 119,
    "reasoning": 809,
    "cache": {
      "read": 71424,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_15030741c0016laGe170oUCAMo",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346715164,
    "completed": 1792346726665
  },
  "parentID": "msg_1502f68f300142aYYM85hGexse",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 74779,
    "input": 2427,
    "output": 119,
    "reasoning": 809,
    "cache": {
      "read": 71424,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 34
step-start
{
  "type": "step-start",
  "id": "prt_15030aa06001ScCIXmbTMlr1ci",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15030a116001kgq3ssW91tl7Q8"
}
Reasoning
Good — `isDistributedBaseNode()` returns `isRedundantIntegratedSrosComponents(...)` for a base node, so `isStandaloneNode()` is false for the redundant integrated case, and Init routes to the distributed branch. Consistent.

Now let me check remaining verification areas:

1. The diff hunks for component.go (643-851) and config.go (1128-1470) and netns.go (1471-1567) and power.go (1568-1587) — I read these earlier per prior summary. Let me re-verify the power.go hunk (small) and netns.go hunk quickly, plus the sros.go diff hunk portions I haven't seen (lines 1588-2547 — I previously saw most; per prior summary I read 1201-2500 and 2501-2548). Good.

2. Check the schema head file for the node-type enum changes (hunk at 3004) — verify `ixr-e3` and `sar-10x`, `ixr-e2sc` were added to the right enum. Let me grep the head schema for sar-10x.

3. Check docs for the new node types' documentation (docs/manual/kinds/sros.md) — e.g., whether the new chassis types (ixr-e2sc, ixr-e3, sar-10x) and new components keys are documented. The docs hunks only mentioned warnings/precedence. New node types are auto-listed? The schema enum was updated via the generator script — fine.

4. Potential issue: `sar-10x` — is it handled by classic template etc.? The test lab uses integrated config? sar-10x with components A/B (CPMs) + startup-config. isIntegratedSrosNodeType("sar-10x") → false (not in integratedSrosDefaultComponents) → distributed base node? isDistributedBaseNode checks isRedundantIntegratedSrosComponents which requires isIntegratedSrosNodeType → false. So how does sar-10x with 2 components (slot A, B) work? It would be classified via... checkComponentSlotsConfig? Let's think: for a non-integrated node type with components slot A/B — is that standalone or distributed? isDistributedCardNode presumably checks slot numeric / CPM detection. Base node with components A and B: isDistributedCardNode returns true only if node is a card node (numeric slot in its own env?). Let me read isDistributedCardNode/isCPM and how distributed classification works. This matters: sar-10x is a SAR chassis with CPMs A/B, distributed mode. In base version, how were distributed nodes with CPM A/B classified? There's presumably logic detecting distributed mode via components. Let me read sros.go 780-1000.
Let me verify the node classification logic (`isDistributedCardNode`, `isCPM`) and the Init-time component setup for a distributed chassis like the new `sar-10x` (CPMs in slots A/B, not in the integrated defaults map).
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/sros.go",
  "limit": 260,
  "offset": 800
}

Output

<path>/source/head/nodes/sros/sros.go</path>
<type>file</type>
<content>
800: 			env[envSrosIPv6Active] = fmt.Sprintf("%s/%d", ips.IPv6, ips.IPv6pLen)
801: 			if ips.IPv6Gw != "" {
802: 				env[envSrosStaticRoutePrefix+"2"] = "::/0@" + ips.IPv6Gw
803: 			}
804: 		}
805: 	}
806: }
807: 
808: // isDistributedCard checks if the slot variable is set, hence it is an instance (slot) of a
809: // distributed setup.
810: // isDistributedCardNode returns true if this node is a card (linecard/IOM)
811: // in a distributed SR-SIM deployment. A distributed card has a slot assignment
812: // but no components of its own.
813: func (n *sros) isDistributedCardNode() bool {
814: 	_, exists := n.Cfg.Env[envNokiaSrosSlot]
815: 	return exists && len(n.kindSpecificCfg().Components) == 0
816: }
817: 
818: // isDistributedBaseNode returns true if this is the base node of a distributed
819: // SR-SIM deployment. The base node orchestrates multiple component nodes.
820: func (n *sros) isDistributedBaseNode() bool {
821: 	if isIntegratedSrosNodeType(n.Cfg.NodeType) {
822: 		return isRedundantIntegratedSrosComponents(n.Cfg.NodeType, n.kindSpecificCfg().Components)
823: 	}
824: 	return len(n.kindSpecificCfg().Components) > 1
825: }
826: 
827: // isStandaloneNode returns true if this is a standalone (non-distributed) SR-SIM node.
828: func (n *sros) isStandaloneNode() bool {
829: 	return !n.isDistributedBaseNode() && !n.isDistributedCardNode()
830: }
831: 
832: // calcComponentName appends the line card suffix to the given node name.
833: func (n *sros) calcComponentName(name, slot string) string {
834: 	if n.renameDone {
835: 		return name
836: 	}
837: 	return fmt.Sprintf("%s-%s", name, strings.ToLower(slot))
838: }
839: 
840: // calcComponentFqdn computes the FQDN for a given slot.
841: func (n *sros) calcComponentFqdn(slot string) string {
842: 	if n.renameDone {
843: 		return n.Cfg.Fqdn
844: 	}
845: 	fqdnDotIndex := strings.Index(n.Cfg.Fqdn, ".")
846: 	if fqdnDotIndex < 0 {
847: 		return fmt.Sprintf("%s-%s", n.Cfg.Fqdn, strings.ToLower(slot))
848: 	}
849: 	result := fmt.Sprintf(
850: 		"%s-%s%s",
851: 		n.Cfg.Fqdn[:fqdnDotIndex],
852: 		strings.ToLower(slot),
853: 		n.Cfg.Fqdn[fqdnDotIndex:],
854: 	)
855: 	return result
856: }
857: 
858: // cpmNode returns a CPM Node (used in Distributed mode).
859: func (n *sros) cpmNode() (clabnodes.Node, error) {
860: 	defaultSlot, err := n.cpmSlot()
861: 	if err != nil {
862: 		return nil, err
863: 	}
864: 	defaultSlot = strings.ToLower(defaultSlot)
865: 	for _, cn := range n.componentNodes {
866: 		if cn.GetShortName()[len(cn.GetShortName())-1:] == defaultSlot {
867: 			return cn, nil
868: 		}
869: 	}
870: 	return nil, fmt.Errorf("node %s: node for slot %s not found", n.GetShortName(), defaultSlot)
871: }
872: 
873: // cpmSlot returns the Slot of the preferred CPM Node (used when Distributed mode).
874: // It prefers slot A if present, otherwise returns slot B.
875: func (n *sros) cpmSlot() (string, error) {
876: 	// Prefer slot A, fall back to slot B. Slots are accepted in either case.
877: 	for _, comp := range n.kindSpecificCfg().Components {
878: 		if strings.EqualFold(comp.Slot, slotAName) {
879: 			return slotAName, nil
880: 		}
881: 	}
882: 	for _, comp := range n.kindSpecificCfg().Components {
883: 		if strings.EqualFold(comp.Slot, slotBName) {
884: 			return slotBName, nil
885: 		}
886: 	}
887: 	return "", fmt.Errorf("node %s: unable to determine default slot", n.GetShortName())
888: }
889: 
890: // Deploy deploys the SR-SIM kind.
891: func (n *sros) Deploy(ctx context.Context, deployParams *clabnodes.DeployParams) error {
892: 	// if it is a chassis with multiple cards (i.e. components)
893: 	if n.isDistributedBaseNode() {
894: 		err := n.deployFabric(ctx, deployParams)
895: 		if err != nil {
896: 			return err
897: 		}
898: 
899: 		// Update the nodes state
900: 		n.SetState(clabnodesstate.Deployed)
901: 		return nil
902: 	}
903: 
904: 	// if it is a regular node
905: 	err := n.DefaultNode.Deploy(ctx, deployParams)
906: 	if err != nil {
907: 		return err
908: 	}
909: 
910: 	return nil
911: }
912: 
913: // Ready returns when the node boot sequence reached the stage when it is ready to accept config
914: // commands
915: // returns an error if not ready by the expiry of the timer readyTimeout.
916: func (n *sros) Ready(ctx context.Context) error {
917: 	ctx, cancel := context.WithTimeout(ctx, readyTimeout)
918: 	defer cancel()
919: 	var err error
920: 	readyCmds := []string{readyCmdCpm, readyCmdBoth, readyCmdIom}
921: 	readyCmdsStrings := []string{"CPM", "BOTH", "IOM"}
922: 	log.Debug("Waiting for SR OS node to boot...", "node", n.Cfg.ShortName)
923: 	for {
924: 		select {
925: 		case <-ctx.Done():
926: 			return fmt.Errorf(
927: 				"timed out waiting for SR OS node %s to boot: %v",
928: 				n.Cfg.ShortName,
929: 				err,
930: 			)
931: 		default:
932: 			// check if cpm is running
933: 			for k, cmd := range readyCmds {
934: 				cmd, _ := clabexec.NewExecCmdFromString(cmd)
935: 				execResult, err := n.RunExec(ctx, cmd)
936: 				if err != nil || (execResult != nil && execResult.GetReturnCode() != 0) {
937: 					logMsg := fmt.Sprintf(
938: 						"status check %s failed on %s retrying",
939: 						readyCmdsStrings[k],
940: 						n.Cfg.ShortName,
941: 					)
942: 					if err != nil {
943: 						logMsg += fmt.Sprintf(" error: %v", err)
944: 					}
945: 					if execResult != nil && execResult.GetReturnCode() != 0 {
946: 						logMsg += fmt.Sprintf(
947: 							", output:%s",
948: 							strings.ReplaceAll(execResult.String(), "\n", "; "),
949: 						)
950: 					}
951: 					log.Debug(logMsg)
952: 				}
953: 				if execResult != nil && execResult.GetReturnCode() == 0 {
954: 					log.Debug("SR OS is ready to be configured", "node", n.Cfg.ShortName)
955: 					return nil
956: 				}
957: 				time.Sleep(retryTimer)
958: 			}
959: 		}
960: 	}
961: }
962: 
963: // checkKernelVersion emits a warning if the present kernel version is lower than the required one.
964: func (*sros) checkKernelVersion() error {
965: 	// retrieve running kernel version
966: 	kv, err := clabutils.GetKernelVersion()
967: 	if err != nil {
968: 		return err
969: 	}
970: 
971: 	// do the comparison
972: 	if !kv.GreaterOrEqual(requiredKernelVersion) {
973: 		log.Warnf(
974: 			"Nokia SR OS requires a kernel version greater than %s. Detected kernel version: %s. Not all features might function properly!",
975: 			requiredKernelVersion,
976: 			kv,
977: 		)
978: 	}
979: 	return nil
980: }
981: 
982: func (n *sros) CheckDeploymentConditions(ctx context.Context) error {
983: 	// perform the sros specific kernel version check
984: 	err := n.checkKernelVersion()
985: 	if err != nil {
986: 		return err
987: 	}
988: 
989: 	// check the sros component slot config for validaity
990: 	err = n.checkComponentSlotsConfig()
991: 	if err != nil {
992: 		return err
993: 	}
994: 
995: 	return n.DefaultNode.CheckDeploymentConditions(ctx)
996: }
997: 
998: // Func that creates the Dirs used for the kind SR-SIM and sets/merges the default Env vars.
999: func (n *sros) createSROSFiles(ctx context.Context) error {
1000: 	log.Debug("Creating directory structure for SR OS container", "node", n.Cfg.ShortName)
1001: 
1002: 	var err error
1003: 
1004: 	if n.Cfg.License != "" && (n.isCPM("") || n.isStandaloneNode()) {
1005: 		// copy license file to node specific directory in lab
1006: 		licPath := filepath.Join(n.Cfg.LabDir, "license.key")
1007: 		if err := clabutils.CopyFile(context.Background(), n.Cfg.License, licPath,
1008: 			clabconstants.PermissionsFileDefault); err != nil {
1009: 			return fmt.Errorf(
1010: 				"license copying src %s -> dst %s failed: %v",
1011: 				n.Cfg.License,
1012: 				licPath,
1013: 				err,
1014: 			)
1015: 		}
1016: 		log.Debug("SR OS license copied", "src", n.Cfg.License, "dst", licPath)
1017: 	}
1018: 	clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),
1019: 		clabconstants.PermissionsOpen)
1020: 	clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], "config"),
1021: 		clabconstants.PermissionsOpen)
1022: 	clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf1),
1023: 		clabconstants.PermissionsOpen)
1024: 	clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf2),
1025: 		clabconstants.PermissionsOpen)
1026: 	clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),
1027: 		clabconstants.PermissionsOpen)
1028: 	if err := n.writeChassisInfoToLabDir(ctx); err != nil {
1029: 		log.Debug("Didn't write chassis_info.json to lab dir. Docker version is likely too new.",
1030: 			"node", n.Cfg.ShortName, "path", n.Cfg.LabDir, "error", err)
1031: 	}
1032: 	if n.isCPM(slotAName) || n.isStandaloneNode() {
1033: 		err = n.createSROSCertificates()
1034: 	}
1035: 	if err != nil {
1036: 		return err
1037: 	}
1038: 	// Skip config if node is not CPM
1039: 	if n.isCPM("") || n.isStandaloneNode() {
1040: 		err = n.createSROSConfigFiles()
1041: 		if err != nil {
1042: 			return err
1043: 		}
1044: 	}
1045: 	return nil
1046: }
1047: 
1048: // writeChassisInfoToLabDir fetches /opt/nokia/chassis_info.json from the node image
1049: // (via graph driver, same as srosVersionFromImage) and writes it under n.Cfg.LabDir
1050: // with the same filename (chassis_info.json).
1051: func (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {
1052: 	imageInspect, err := n.Runtime.InspectImage(ctx, n.Cfg.Image)
1053: 	if err != nil {
1054: 		return fmt.Errorf("inspect image: %w", err)
1055: 	}
1056: 	content, err := ReadFileFromImageInspect(imageInspect, DefaultChassisInfoPath)
1057: 	if err != nil {
1058: 		return err
1059: 	}

(Showing lines 800-1059 of 1910. Use offset=1060 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_15030bfd9001yb5jgI40Evs23a",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15030a116001kgq3ssW91tl7Q8",
  "callID": "call_05cd96f55dd74e6885644310",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/sros.go",
      "limit": 260,
      "offset": 800
    },
    "output": "<path>/source/head/nodes/sros/sros.go</path>\n<type>file</type>\n<content>\n800: \t\t\tenv[envSrosIPv6Active] = fmt.Sprintf(\"%s/%d\", ips.IPv6, ips.IPv6pLen)\n801: \t\t\tif ips.IPv6Gw != \"\" {\n802: \t\t\t\tenv[envSrosStaticRoutePrefix+\"2\"] = \"::/0@\" + ips.IPv6Gw\n803: \t\t\t}\n804: \t\t}\n805: \t}\n806: }\n807: \n808: // isDistributedCard checks if the slot variable is set, hence it is an instance (slot) of a\n809: // distributed setup.\n810: // isDistributedCardNode returns true if this node is a card (linecard/IOM)\n811: // in a distributed SR-SIM deployment. A distributed card has a slot assignment\n812: // but no components of its own.\n813: func (n *sros) isDistributedCardNode() bool {\n814: \t_, exists := n.Cfg.Env[envNokiaSrosSlot]\n815: \treturn exists && len(n.kindSpecificCfg().Components) == 0\n816: }\n817: \n818: // isDistributedBaseNode returns true if this is the base node of a distributed\n819: // SR-SIM deployment. The base node orchestrates multiple component nodes.\n820: func (n *sros) isDistributedBaseNode() bool {\n821: \tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n822: \t\treturn isRedundantIntegratedSrosComponents(n.Cfg.NodeType, n.kindSpecificCfg().Components)\n823: \t}\n824: \treturn len(n.kindSpecificCfg().Components) > 1\n825: }\n826: \n827: // isStandaloneNode returns true if this is a standalone (non-distributed) SR-SIM node.\n828: func (n *sros) isStandaloneNode() bool {\n829: \treturn !n.isDistributedBaseNode() && !n.isDistributedCardNode()\n830: }\n831: \n832: // calcComponentName appends the line card suffix to the given node name.\n833: func (n *sros) calcComponentName(name, slot string) string {\n834: \tif n.renameDone {\n835: \t\treturn name\n836: \t}\n837: \treturn fmt.Sprintf(\"%s-%s\", name, strings.ToLower(slot))\n838: }\n839: \n840: // calcComponentFqdn computes the FQDN for a given slot.\n841: func (n *sros) calcComponentFqdn(slot string) string {\n842: \tif n.renameDone {\n843: \t\treturn n.Cfg.Fqdn\n844: \t}\n845: \tfqdnDotIndex := strings.Index(n.Cfg.Fqdn, \".\")\n846: \tif fqdnDotIndex < 0 {\n847: \t\treturn fmt.Sprintf(\"%s-%s\", n.Cfg.Fqdn, strings.ToLower(slot))\n848: \t}\n849: \tresult := fmt.Sprintf(\n850: \t\t\"%s-%s%s\",\n851: \t\tn.Cfg.Fqdn[:fqdnDotIndex],\n852: \t\tstrings.ToLower(slot),\n853: \t\tn.Cfg.Fqdn[fqdnDotIndex:],\n854: \t)\n855: \treturn result\n856: }\n857: \n858: // cpmNode returns a CPM Node (used in Distributed mode).\n859: func (n *sros) cpmNode() (clabnodes.Node, error) {\n860: \tdefaultSlot, err := n.cpmSlot()\n861: \tif err != nil {\n862: \t\treturn nil, err\n863: \t}\n864: \tdefaultSlot = strings.ToLower(defaultSlot)\n865: \tfor _, cn := range n.componentNodes {\n866: \t\tif cn.GetShortName()[len(cn.GetShortName())-1:] == defaultSlot {\n867: \t\t\treturn cn, nil\n868: \t\t}\n869: \t}\n870: \treturn nil, fmt.Errorf(\"node %s: node for slot %s not found\", n.GetShortName(), defaultSlot)\n871: }\n872: \n873: // cpmSlot returns the Slot of the preferred CPM Node (used when Distributed mode).\n874: // It prefers slot A if present, otherwise returns slot B.\n875: func (n *sros) cpmSlot() (string, error) {\n876: \t// Prefer slot A, fall back to slot B. Slots are accepted in either case.\n877: \tfor _, comp := range n.kindSpecificCfg().Components {\n878: \t\tif strings.EqualFold(comp.Slot, slotAName) {\n879: \t\t\treturn slotAName, nil\n880: \t\t}\n881: \t}\n882: \tfor _, comp := range n.kindSpecificCfg().Components {\n883: \t\tif strings.EqualFold(comp.Slot, slotBName) {\n884: \t\t\treturn slotBName, nil\n885: \t\t}\n886: \t}\n887: \treturn \"\", fmt.Errorf(\"node %s: unable to determine default slot\", n.GetShortName())\n888: }\n889: \n890: // Deploy deploys the SR-SIM kind.\n891: func (n *sros) Deploy(ctx context.Context, deployParams *clabnodes.DeployParams) error {\n892: \t// if it is a chassis with multiple cards (i.e. components)\n893: \tif n.isDistributedBaseNode() {\n894: \t\terr := n.deployFabric(ctx, deployParams)\n895: \t\tif err != nil {\n896: \t\t\treturn err\n897: \t\t}\n898: \n899: \t\t// Update the nodes state\n900: \t\tn.SetState(clabnodesstate.Deployed)\n901: \t\treturn nil\n902: \t}\n903: \n904: \t// if it is a regular node\n905: \terr := n.DefaultNode.Deploy(ctx, deployParams)\n906: \tif err != nil {\n907: \t\treturn err\n908: \t}\n909: \n910: \treturn nil\n911: }\n912: \n913: // Ready returns when the node boot sequence reached the stage when it is ready to accept config\n914: // commands\n915: // returns an error if not ready by the expiry of the timer readyTimeout.\n916: func (n *sros) Ready(ctx context.Context) error {\n917: \tctx, cancel := context.WithTimeout(ctx, readyTimeout)\n918: \tdefer cancel()\n919: \tvar err error\n920: \treadyCmds := []string{readyCmdCpm, readyCmdBoth, readyCmdIom}\n921: \treadyCmdsStrings := []string{\"CPM\", \"BOTH\", \"IOM\"}\n922: \tlog.Debug(\"Waiting for SR OS node to boot...\", \"node\", n.Cfg.ShortName)\n923: \tfor {\n924: \t\tselect {\n925: \t\tcase <-ctx.Done():\n926: \t\t\treturn fmt.Errorf(\n927: \t\t\t\t\"timed out waiting for SR OS node %s to boot: %v\",\n928: \t\t\t\tn.Cfg.ShortName,\n929: \t\t\t\terr,\n930: \t\t\t)\n931: \t\tdefault:\n932: \t\t\t// check if cpm is running\n933: \t\t\tfor k, cmd := range readyCmds {\n934: \t\t\t\tcmd, _ := clabexec.NewExecCmdFromString(cmd)\n935: \t\t\t\texecResult, err := n.RunExec(ctx, cmd)\n936: \t\t\t\tif err != nil || (execResult != nil && execResult.GetReturnCode() != 0) {\n937: \t\t\t\t\tlogMsg := fmt.Sprintf(\n938: \t\t\t\t\t\t\"status check %s failed on %s retrying\",\n939: \t\t\t\t\t\treadyCmdsStrings[k],\n940: \t\t\t\t\t\tn.Cfg.ShortName,\n941: \t\t\t\t\t)\n942: \t\t\t\t\tif err != nil {\n943: \t\t\t\t\t\tlogMsg += fmt.Sprintf(\" error: %v\", err)\n944: \t\t\t\t\t}\n945: \t\t\t\t\tif execResult != nil && execResult.GetReturnCode() != 0 {\n946: \t\t\t\t\t\tlogMsg += fmt.Sprintf(\n947: \t\t\t\t\t\t\t\", output:%s\",\n948: \t\t\t\t\t\t\tstrings.ReplaceAll(execResult.String(), \"\\n\", \"; \"),\n949: \t\t\t\t\t\t)\n950: \t\t\t\t\t}\n951: \t\t\t\t\tlog.Debug(logMsg)\n952: \t\t\t\t}\n953: \t\t\t\tif execResult != nil && execResult.GetReturnCode() == 0 {\n954: \t\t\t\t\tlog.Debug(\"SR OS is ready to be configured\", \"node\", n.Cfg.ShortName)\n955: \t\t\t\t\treturn nil\n956: \t\t\t\t}\n957: \t\t\t\ttime.Sleep(retryTimer)\n958: \t\t\t}\n959: \t\t}\n960: \t}\n961: }\n962: \n963: // checkKernelVersion emits a warning if the present kernel version is lower than the required one.\n964: func (*sros) checkKernelVersion() error {\n965: \t// retrieve running kernel version\n966: \tkv, err := clabutils.GetKernelVersion()\n967: \tif err != nil {\n968: \t\treturn err\n969: \t}\n970: \n971: \t// do the comparison\n972: \tif !kv.GreaterOrEqual(requiredKernelVersion) {\n973: \t\tlog.Warnf(\n974: \t\t\t\"Nokia SR OS requires a kernel version greater than %s. Detected kernel version: %s. Not all features might function properly!\",\n975: \t\t\trequiredKernelVersion,\n976: \t\t\tkv,\n977: \t\t)\n978: \t}\n979: \treturn nil\n980: }\n981: \n982: func (n *sros) CheckDeploymentConditions(ctx context.Context) error {\n983: \t// perform the sros specific kernel version check\n984: \terr := n.checkKernelVersion()\n985: \tif err != nil {\n986: \t\treturn err\n987: \t}\n988: \n989: \t// check the sros component slot config for validaity\n990: \terr = n.checkComponentSlotsConfig()\n991: \tif err != nil {\n992: \t\treturn err\n993: \t}\n994: \n995: \treturn n.DefaultNode.CheckDeploymentConditions(ctx)\n996: }\n997: \n998: // Func that creates the Dirs used for the kind SR-SIM and sets/merges the default Env vars.\n999: func (n *sros) createSROSFiles(ctx context.Context) error {\n1000: \tlog.Debug(\"Creating directory structure for SR OS container\", \"node\", n.Cfg.ShortName)\n1001: \n1002: \tvar err error\n1003: \n1004: \tif n.Cfg.License != \"\" && (n.isCPM(\"\") || n.isStandaloneNode()) {\n1005: \t\t// copy license file to node specific directory in lab\n1006: \t\tlicPath := filepath.Join(n.Cfg.LabDir, \"license.key\")\n1007: \t\tif err := clabutils.CopyFile(context.Background(), n.Cfg.License, licPath,\n1008: \t\t\tclabconstants.PermissionsFileDefault); err != nil {\n1009: \t\t\treturn fmt.Errorf(\n1010: \t\t\t\t\"license copying src %s -> dst %s failed: %v\",\n1011: \t\t\t\tn.Cfg.License,\n1012: \t\t\t\tlicPath,\n1013: \t\t\t\terr,\n1014: \t\t\t)\n1015: \t\t}\n1016: \t\tlog.Debug(\"SR OS license copied\", \"src\", n.Cfg.License, \"dst\", licPath)\n1017: \t}\n1018: \tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),\n1019: \t\tclabconstants.PermissionsOpen)\n1020: \tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], \"config\"),\n1021: \t\tclabconstants.PermissionsOpen)\n1022: \tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf1),\n1023: \t\tclabconstants.PermissionsOpen)\n1024: \tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf2),\n1025: \t\tclabconstants.PermissionsOpen)\n1026: \tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),\n1027: \t\tclabconstants.PermissionsOpen)\n1028: \tif err := n.writeChassisInfoToLabDir(ctx); err != nil {\n1029: \t\tlog.Debug(\"Didn't write chassis_info.json to lab dir. Docker version is likely too new.\",\n1030: \t\t\t\"node\", n.Cfg.ShortName, \"path\", n.Cfg.LabDir, \"error\", err)\n1031: \t}\n1032: \tif n.isCPM(slotAName) || n.isStandaloneNode() {\n1033: \t\terr = n.createSROSCertificates()\n1034: \t}\n1035: \tif err != nil {\n1036: \t\treturn err\n1037: \t}\n1038: \t// Skip config if node is not CPM\n1039: \tif n.isCPM(\"\") || n.isStandaloneNode() {\n1040: \t\terr = n.createSROSConfigFiles()\n1041: \t\tif err != nil {\n1042: \t\t\treturn err\n1043: \t\t}\n1044: \t}\n1045: \treturn nil\n1046: }\n1047: \n1048: // writeChassisInfoToLabDir fetches /opt/nokia/chassis_info.json from the node image\n1049: // (via graph driver, same as srosVersionFromImage) and writes it under n.Cfg.LabDir\n1050: // with the same filename (chassis_info.json).\n1051: func (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {\n1052: \timageInspect, err := n.Runtime.InspectImage(ctx, n.Cfg.Image)\n1053: \tif err != nil {\n1054: \t\treturn fmt.Errorf(\"inspect image: %w\", err)\n1055: \t}\n1056: \tcontent, err := ReadFileFromImageInspect(imageInspect, DefaultChassisInfoPath)\n1057: \tif err != nil {\n1058: \t\treturn err\n1059: \t}\n\n(Showing lines 800-1059 of 1910. Use offset=1060 to continue.)\n</content>",
    "title": "source/head/nodes/sros/sros.go",
    "metadata": {
      "preview": "\t\t\tenv[envSrosIPv6Active] = fmt.Sprintf(\"%s/%d\", ips.IPv6, ips.IPv6pLen)\n\t\t\tif ips.IPv6Gw != \"\" {\n\t\t\t\tenv[envSrosStaticRoutePrefix+\"2\"] = \"::/0@\" + ips.IPv6Gw\n\t\t\t}\n\t\t}\n\t}\n}\n\n// isDistributedCard checks if the slot variable is set, hence it is an instance (slot) of a\n// distributed setup.\n// isDistributedCardNode returns true if this node is a card (linecard/IOM)\n// in a distributed SR-SIM deployment. A distributed card has a slot assignment\n// but no components of its own.\nfunc (n *sros) isDistributedCardNode() bool {\n\t_, exists := n.Cfg.Env[envNokiaSrosSlot]\n\treturn exists && len(n.kindSpecificCfg().Components) == 0\n}\n\n// isDistributedBaseNode returns true if this is the base node of a distributed\n// SR-SIM deployment. The base node orchestrates multiple component nodes.",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/sros.go",
        "text": "\t\t\tenv[envSrosIPv6Active] = fmt.Sprintf(\"%s/%d\", ips.IPv6, ips.IPv6pLen)\n\t\t\tif ips.IPv6Gw != \"\" {\n\t\t\t\tenv[envSrosStaticRoutePrefix+\"2\"] = \"::/0@\" + ips.IPv6Gw\n\t\t\t}\n\t\t}\n\t}\n}\n\n// isDistributedCard checks if the slot variable is set, hence it is an instance (slot) of a\n// distributed setup.\n// isDistributedCardNode returns true if this node is a card (linecard/IOM)\n// in a distributed SR-SIM deployment. A distributed card has a slot assignment\n// but no components of its own.\nfunc (n *sros) isDistributedCardNode() bool {\n\t_, exists := n.Cfg.Env[envNokiaSrosSlot]\n\treturn exists && len(n.kindSpecificCfg().Components) == 0\n}\n\n// isDistributedBaseNode returns true if this is the base node of a distributed\n// SR-SIM deployment. The base node orchestrates multiple component nodes.\nfunc (n *sros) isDistributedBaseNode() bool {\n\tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n\t\treturn isRedundantIntegratedSrosComponents(n.Cfg.NodeType, n.kindSpecificCfg().Components)\n\t}\n\treturn len(n.kindSpecificCfg().Components) > 1\n}\n\n// isStandaloneNode returns true if this is a standalone (non-distributed) SR-SIM node.\nfunc (n *sros) isStandaloneNode() bool {\n\treturn !n.isDistributedBaseNode() && !n.isDistributedCardNode()\n}\n\n// calcComponentName appends the line card suffix to the given node name.\nfunc (n *sros) calcComponentName(name, slot string) string {\n\tif n.renameDone {\n\t\treturn name\n\t}\n\treturn fmt.Sprintf(\"%s-%s\", name, strings.ToLower(slot))\n}\n\n// calcComponentFqdn computes the FQDN for a given slot.\nfunc (n *sros) calcComponentFqdn(slot string) string {\n\tif n.renameDone {\n\t\treturn n.Cfg.Fqdn\n\t}\n\tfqdnDotIndex := strings.Index(n.Cfg.Fqdn, \".\")\n\tif fqdnDotIndex < 0 {\n\t\treturn fmt.Sprintf(\"%s-%s\", n.Cfg.Fqdn, strings.ToLower(slot))\n\t}\n\tresult := fmt.Sprintf(\n\t\t\"%s-%s%s\",\n\t\tn.Cfg.Fqdn[:fqdnDotIndex],\n\t\tstrings.ToLower(slot),\n\t\tn.Cfg.Fqdn[fqdnDotIndex:],\n\t)\n\treturn result\n}\n\n// cpmNode returns a CPM Node (used in Distributed mode).\nfunc (n *sros) cpmNode() (clabnodes.Node, error) {\n\tdefaultSlot, err := n.cpmSlot()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefaultSlot = strings.ToLower(defaultSlot)\n\tfor _, cn := range n.componentNodes {\n\t\tif cn.GetShortName()[len(cn.GetShortName())-1:] == defaultSlot {\n\t\t\treturn cn, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"node %s: node for slot %s not found\", n.GetShortName(), defaultSlot)\n}\n\n// cpmSlot returns the Slot of the preferred CPM Node (used when Distributed mode).\n// It prefers slot A if present, otherwise returns slot B.\nfunc (n *sros) cpmSlot() (string, error) {\n\t// Prefer slot A, fall back to slot B. Slots are accepted in either case.\n\tfor _, comp := range n.kindSpecificCfg().Components {\n\t\tif strings.EqualFold(comp.Slot, slotAName) {\n\t\t\treturn slotAName, nil\n\t\t}\n\t}\n\tfor _, comp := range n.kindSpecificCfg().Components {\n\t\tif strings.EqualFold(comp.Slot, slotBName) {\n\t\t\treturn slotBName, nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"node %s: unable to determine default slot\", n.GetShortName())\n}\n\n// Deploy deploys the SR-SIM kind.\nfunc (n *sros) Deploy(ctx context.Context, deployParams *clabnodes.DeployParams) error {\n\t// if it is a chassis with multiple cards (i.e. components)\n\tif n.isDistributedBaseNode() {\n\t\terr := n.deployFabric(ctx, deployParams)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Update the nodes state\n\t\tn.SetState(clabnodesstate.Deployed)\n\t\treturn nil\n\t}\n\n\t// if it is a regular node\n\terr := n.DefaultNode.Deploy(ctx, deployParams)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\n// Ready returns when the node boot sequence reached the stage when it is ready to accept config\n// commands\n// returns an error if not ready by the expiry of the timer readyTimeout.\nfunc (n *sros) Ready(ctx context.Context) error {\n\tctx, cancel := context.WithTimeout(ctx, readyTimeout)\n\tdefer cancel()\n\tvar err error\n\treadyCmds := []string{readyCmdCpm, readyCmdBoth, readyCmdIom}\n\treadyCmdsStrings := []string{\"CPM\", \"BOTH\", \"IOM\"}\n\tlog.Debug(\"Waiting for SR OS node to boot...\", \"node\", n.Cfg.ShortName)\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"timed out waiting for SR OS node %s to boot: %v\",\n\t\t\t\tn.Cfg.ShortName,\n\t\t\t\terr,\n\t\t\t)\n\t\tdefault:\n\t\t\t// check if cpm is running\n\t\t\tfor k, cmd := range readyCmds {\n\t\t\t\tcmd, _ := clabexec.NewExecCmdFromString(cmd)\n\t\t\t\texecResult, err := n.RunExec(ctx, cmd)\n\t\t\t\tif err != nil || (execResult != nil && execResult.GetReturnCode() != 0) {\n\t\t\t\t\tlogMsg := fmt.Sprintf(\n\t\t\t\t\t\t\"status check %s failed on %s retrying\",\n\t\t\t\t\t\treadyCmdsStrings[k],\n\t\t\t\t\t\tn.Cfg.ShortName,\n\t\t\t\t\t)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlogMsg += fmt.Sprintf(\" error: %v\", err)\n\t\t\t\t\t}\n\t\t\t\t\tif execResult != nil && execResult.GetReturnCode() != 0 {\n\t\t\t\t\t\tlogMsg += fmt.Sprintf(\n\t\t\t\t\t\t\t\", output:%s\",\n\t\t\t\t\t\t\tstrings.ReplaceAll(execResult.String(), \"\\n\", \"; \"),\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tlog.Debug(logMsg)\n\t\t\t\t}\n\t\t\t\tif execResult != nil && execResult.GetReturnCode() == 0 {\n\t\t\t\t\tlog.Debug(\"SR OS is ready to be configured\", \"node\", n.Cfg.ShortName)\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\ttime.Sleep(retryTimer)\n\t\t\t}\n\t\t}\n\t}\n}\n\n// checkKernelVersion emits a warning if the present kernel version is lower than the required one.\nfunc (*sros) checkKernelVersion() error {\n\t// retrieve running kernel version\n\tkv, err := clabutils.GetKernelVersion()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// do the comparison\n\tif !kv.GreaterOrEqual(requiredKernelVersion) {\n\t\tlog.Warnf(\n\t\t\t\"Nokia SR OS requires a kernel version greater than %s. Detected kernel version: %s. Not all features might function properly!\",\n\t\t\trequiredKernelVersion,\n\t\t\tkv,\n\t\t)\n\t}\n\treturn nil\n}\n\nfunc (n *sros) CheckDeploymentConditions(ctx context.Context) error {\n\t// perform the sros specific kernel version check\n\terr := n.checkKernelVersion()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// check the sros component slot config for validaity\n\terr = n.checkComponentSlotsConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn n.DefaultNode.CheckDeploymentConditions(ctx)\n}\n\n// Func that creates the Dirs used for the kind SR-SIM and sets/merges the default Env vars.\nfunc (n *sros) createSROSFiles(ctx context.Context) error {\n\tlog.Debug(\"Creating directory structure for SR OS container\", \"node\", n.Cfg.ShortName)\n\n\tvar err error\n\n\tif n.Cfg.License != \"\" && (n.isCPM(\"\") || n.isStandaloneNode()) {\n\t\t// copy license file to node specific directory in lab\n\t\tlicPath := filepath.Join(n.Cfg.LabDir, \"license.key\")\n\t\tif err := clabutils.CopyFile(context.Background(), n.Cfg.License, licPath,\n\t\t\tclabconstants.PermissionsFileDefault); err != nil {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"license copying src %s -> dst %s failed: %v\",\n\t\t\t\tn.Cfg.License,\n\t\t\t\tlicPath,\n\t\t\t\terr,\n\t\t\t)\n\t\t}\n\t\tlog.Debug(\"SR OS license copied\", \"src\", n.Cfg.License, \"dst\", licPath)\n\t}\n\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),\n\t\tclabconstants.PermissionsOpen)\n\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], \"config\"),\n\t\tclabconstants.PermissionsOpen)\n\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf1),\n\t\tclabconstants.PermissionsOpen)\n\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf2),\n\t\tclabconstants.PermissionsOpen)\n\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),\n\t\tclabconstants.PermissionsOpen)\n\tif err := n.writeChassisInfoToLabDir(ctx); err != nil {\n\t\tlog.Debug(\"Didn't write chassis_info.json to lab dir. Docker version is likely too new.\",\n\t\t\t\"node\", n.Cfg.ShortName, \"path\", n.Cfg.LabDir, \"error\", err)\n\t}\n\tif n.isCPM(slotAName) || n.isStandaloneNode() {\n\t\terr = n.createSROSCertificates()\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Skip config if node is not CPM\n\tif n.isCPM(\"\") || n.isStandaloneNode() {\n\t\terr = n.createSROSConfigFiles()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// writeChassisInfoToLabDir fetches /opt/nokia/chassis_info.json from the node image\n// (via graph driver, same as srosVersionFromImage) and writes it under n.Cfg.LabDir\n// with the same filename (chassis_info.json).\nfunc (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {\n\timageInspect, err := n.Runtime.InspectImage(ctx, n.Cfg.Image)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"inspect image: %w\", err)\n\t}\n\tcontent, err := ReadFileFromImageInspect(imageInspect, DefaultChassisInfoPath)\n\tif err != nil {\n\t\treturn err\n\t}",
        "lineStart": 800,
        "lineEnd": 1059,
        "totalLines": 1910,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346734558,
      "end": 1792346734571
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_15030bfee001ae0nbuJE6o5B96",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15030a116001kgq3ssW91tl7Q8",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 76240,
    "input": 804,
    "output": 83,
    "reasoning": 601,
    "cache": {
      "read": 74752,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_15030a116001kgq3ssW91tl7Q8",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346726678,
    "completed": 1792346734580
  },
  "parentID": "msg_1502f68f300142aYYM85hGexse",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 76240,
    "input": 804,
    "output": 83,
    "reasoning": 601,
    "cache": {
      "read": 74752,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 35
step-start
{
  "type": "step-start",
  "id": "prt_15030c877001buj1xwngA0keB8",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15030c0020015g2EZ0bcwZEBeP"
}
Reasoning
This is important. Line 1004: `if n.Cfg.License != "" && (n.isCPM("") || n.isStandaloneNode())` — was this changed? Also line 1032: `if n.isCPM(slotAName) || n.isStandaloneNode()` — hmm wait, for distributed CPM slot B, `isCPM(slotAName)` — createSROSCertificates only for CPM A or standalone. But PreDeploy line 410: `n.isStandaloneNode() || (n.isDistributedCardNode() && n.isCPM(""))`. Let me check the diff to see which of these changed in this PR. From the diff (lines 1588-2547 for sros.go), I recall changes to checkComponentSlotsConfig location, PreDeploy handling, etc. Let me grep the diff for `isCPM` and `isStandaloneNode` changes.

Also note line 1039: `if n.isCPM("") || n.isStandaloneNode()` — createSROSConfigFiles runs for CPMs (both A and B in distributed) and standalone. For integrated redundant (ixr-r6 dual CPM), component nodes are CPM A and B — each generates config? The test `redundant_integrated_components_are_distributed` shows cfgA contains card config and cfgB contains card config too — both CPMs get component config (buildIntegratedComponentCfgLines for the slot's override component). Good.

Let me grep diff for changed lines containing "isCPM" / "isStandaloneNode" / "isDistributedCardNode".
Let me check which of these node-classification call sites changed in the diff, and view the PreDeploy diff hunk in `sros.go`.
grep · completed

Input

{
  "path": "/source/diff.txt",
  "pattern": "^[+-].*(isCPM|isStandaloneNode|isDistributedCardNode|isDistributedBaseNode)"
}

Output

Found 10 matches
/source/diff.txt:
  Line 1415: +		if clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM("") {

  Line 1541: +	if n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == "") {

  Line 1543: +	} else if n.isDistributedCardNode() {

  Line 1554: +	if n.isDistributedBaseNode() {

  Line 1805: -	if n.isDistributedBaseNode() {

  Line 1924: -	if n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == "") {

  Line 1926: -	} else if n.isDistributedCardNode() {

  Line 2009: +	if !n.isStandaloneNode() && !n.isCPM(slotAName) {

  Line 2310: -		if clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM("") {

  Line 2760: +		assert.True(t, n.isDistributedBaseNode())
Tool metadata
{
  "type": "tool",
  "id": "prt_15030d407001qCJPpNH4BrewUt",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15030c0020015g2EZ0bcwZEBeP",
  "callID": "call_2b59f67bc0ae4a01bec0ae9e",
  "tool": "grep",
  "state": {
    "status": "completed",
    "input": {
      "path": "/source/diff.txt",
      "pattern": "^[+-].*(isCPM|isStandaloneNode|isDistributedCardNode|isDistributedBaseNode)"
    },
    "output": "Found 10 matches\n/source/diff.txt:\n  Line 1415: +\t\tif clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM(\"\") {\n\n  Line 1541: +\tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == \"\") {\n\n  Line 1543: +\t} else if n.isDistributedCardNode() {\n\n  Line 1554: +\tif n.isDistributedBaseNode() {\n\n  Line 1805: -\tif n.isDistributedBaseNode() {\n\n  Line 1924: -\tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == \"\") {\n\n  Line 1926: -\t} else if n.isDistributedCardNode() {\n\n  Line 2009: +\tif !n.isStandaloneNode() && !n.isCPM(slotAName) {\n\n  Line 2310: -\t\tif clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM(\"\") {\n\n  Line 2760: +\t\tassert.True(t, n.isDistributedBaseNode())\n",
    "title": "^[+-].*(isCPM|isStandaloneNode|isDistributedCardNode|isDistributedBaseNode)",
    "metadata": {
      "matches": 10,
      "truncated": false
    },
    "time": {
      "start": 1792346739723,
      "end": 1792346739765
    }
  }
}
read · completed

Input

{
  "filePath": "/source/diff.txt",
  "limit": 160,
  "offset": 1590
}

Output

<path>/source/diff.txt</path>
<type>file</type>
<content>
1590: --- a/nodes/sros/sros.go
1591: +++ b/nodes/sros/sros.go
1592: @@ -6,11 +6,10 @@ package sros
1593:  
1594:  import (
1595:  	"bufio"
1596:  	"bytes"
1597:  	"context"
1598: -	_ "embed"
1599:  	"errors"
1600:  	"fmt"
1601:  	"io"
1602:  	"maps"
1603:  	"net"
1604: @@ -20,19 +19,16 @@ import (
1605:  	"reflect"
1606:  	"regexp"
1607:  	"slices"
1608:  	"strconv"
1609:  	"strings"
1610: -	"text/template"
1611:  	"time"
1612:  
1613: -	"github.com/beevik/etree"
1614:  	"github.com/brunoga/deep"
1615:  	"github.com/charmbracelet/log"
1616:  	"github.com/scrapli/scrapligo/driver/netconf"
1617:  	"github.com/scrapli/scrapligo/driver/opoptions"
1618: -	"github.com/vishvananda/netns"
1619:  
1620:  	"github.com/scrapli/scrapligo/response"
1621:  
1622:  	clabconstants "github.com/srl-labs/containerlab/constants"
1623:  	clabexec "github.com/srl-labs/containerlab/exec"
1624: @@ -82,32 +78,16 @@ const (
1625:  	envNokiaSrosMDA           = "NOKIA_SROS_MDA"
1626:  	envSrosIPv4Active         = "NOKIA_SROS_ADDRESS_IPV4_ACTIVE"
1627:  	envSrosIPv6Active         = "NOKIA_SROS_ADDRESS_IPV6_ACTIVE"
1628:  	envSrosStaticRoutePrefix  = "NOKIA_SROS_STATIC_ROUTE_"
1629:  
1630: -	defaultSrosPowerType       = "dc"
1631: -	defaultSrosPowerModuleType = "ps-a-dc-6000"
1632: -
1633:  	srosMinorError     = "MINOR:"
1634:  	srosCriticalError  = "CRITICAL:"
1635:  	srosRejectedCfgMsg = "Configuration load failed - using default configuration"
1636:  )
1637:  
1638:  var (
1639: -
1640: -	//go:embed configs/sros_config_sros25.go.tpl
1641: -	cfgTplSROS25 string
1642: -
1643: -	//go:embed configs/sros_config_classic.go.tpl
1644: -	cfgTplClassic string
1645: -
1646: -	//go:embed configs/ixr/ixr_config_classic.go.tpl
1647: -	cfgTplClassicIxr string
1648: -
1649: -	//go:embed configs/sar/sar_config_classic.go.tpl
1650: -	cfgTplClassicSar string
1651: -
1652:  	kindNames  = []string{"nokia_srsim"}
1653:  	srosSysctl = map[string]string{
1654:  		"net.ipv4.ip_forward":                "0",
1655:  		"net.ipv6.conf.all.disable_ipv6":     "0",
1656:  		"net.ipv6.conf.default.disable_ipv6": "0",
1657: @@ -160,15 +140,10 @@ var (
1658:        e1-2-3       -> card 1, mda 2, port 3
1659:        e1-2-c3-4    -> card 1, mda 2, connector 3, port 4
1660:        e1-x2-3-4    -> card 1, xiom 2, mda 3, port 4
1661:        e1-x2-3-c4-5 -> card 1, xiom 2, mda 3, connector 4, port 5
1662:  	  eth[0-9], for management interfaces of CPM-A/CPM-B or for fabric interfaces`
1663: -	// Auxiliary regexps for IXR/SAR detection.
1664: -	sarRegexp   = regexp.MustCompile(`(?i)\bsar-`)
1665: -	sarHmRegexp = regexp.MustCompile(`(?i)\b(sar-hm|sar-hmc)\b`)
1666: -
1667: -	ixrRegexp = regexp.MustCompile(`(?i)\bixr-`)
1668:  )
1669:  
1670:  // Register registers the node in the NodeRegistry.
1671:  func Register(r *clabnodes.NodeRegistry) {
1672:  	generateNodeAttributes := clabnodes.NewGenerateNodeAttributes(generateable, generateIfFormat)
1673: @@ -241,10 +216,14 @@ type sros struct {
1674:  	// rootCtrName is the container that owns the netns.
1675:  	//  - for components based: the internal netns container.
1676:  	//  - for network mode based: parsed from network-mode.
1677:  	rootCtrName string
1678:  
1679: +	// userEnv is the env map from the topology, before component fields are merged in.
1680: +	// Node env overrides component type, XIOM, MDA, SFM, and per-component env.
1681: +	userEnv map[string]string
1682: +
1683:  	preDeployParams *clabnodes.PreDeployParams
1684:  
1685:  	netnsNode clabnodes.Node
1686:  }
1687:  
1688: @@ -279,16 +258,44 @@ func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) err
1689:  	// if user was not initialized to a value, use root
1690:  	if n.Cfg.User == "" {
1691:  		n.Cfg.User = "0:0"
1692:  	}
1693:  
1694: -	if sfm := n.kindSpecificCfg().SFM; sfm != "" {
1695: +	// Snapshot topology env before component and SFM flags are applied.
1696: +	// Component nodes set userEnv from the base node before Init.
1697: +	envAlreadyResolved := n.userEnv != nil
1698: +	if !envAlreadyResolved {
1699:  		if n.Cfg.Env == nil {
1700: -			n.Cfg.Env = map[string]string{}
1701: +			n.userEnv = map[string]string{}
1702: +		} else {
1703: +			n.userEnv = maps.Clone(n.Cfg.Env)
1704:  		}
1705: +	}
1706: +	if n.Cfg.Env == nil {
1707: +		n.Cfg.Env = map[string]string{}
1708: +	}
1709:  
1710: -		n.Cfg.Env[envNokiaSrosSFM] = sfm
1711: +	// Distributed cards inherit SFM from the base node env. Applying it again
1712: +	// would warn once per card when the user also set NOKIA_SROS_SFM.
1713: +	if sfm := n.kindSpecificCfg().SFM; sfm != "" && !envAlreadyResolved {
1714: +		if envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {
1715: +			if envSFM != sfm {
1716: +				log.Warn(
1717: +					fmt.Sprintf(
1718: +						"component value %q will not be used because environment variable %s is set",
1719: +						sfm,
1720: +						envNokiaSrosSFM,
1721: +					),
1722: +					"node", n.Cfg.ShortName,
1723: +					"env", envNokiaSrosSFM,
1724: +					"component-value", sfm,
1725: +					"env-value", envSFM,
1726: +				)
1727: +			}
1728: +		} else {
1729: +			n.Cfg.Env[envNokiaSrosSFM] = sfm
1730: +		}
1731:  	}
1732:  
1733:  	maps.Copy(n.Cfg.Sysctls, srosSysctl)
1734:  
1735:  	// make sure we always have uppercase slot definition
1736: @@ -316,10 +323,11 @@ func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) err
1737:  
1738:  		vars, err := n.setupStandaloneComponents()
1739:  		if err != nil {
1740:  			return err
1741:  		}
1742: +		warnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)
1743:  
1744:  		// n.Cfg.Env overrides component vars, overrides default srosEnv
1745:  		n.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)
1746:  		log.Debug("Merged env file", "env", fmt.Sprintf("%+v", n.Cfg.Env), "node", n.Cfg.ShortName)
1747:  	} else {
1748: @@ -348,12 +356,15 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {
1749:  	if len(n.kindSpecificCfg().Components) == 0 {

(Showing lines 1590-1749 of 3945. Use offset=1750 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_15030d47d001uruv2gETB6Wj7j",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15030c0020015g2EZ0bcwZEBeP",
  "callID": "call_98131aa8a3674528b0474da0",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/diff.txt",
      "limit": 160,
      "offset": 1590
    },
    "output": "<path>/source/diff.txt</path>\n<type>file</type>\n<content>\n1590: --- a/nodes/sros/sros.go\n1591: +++ b/nodes/sros/sros.go\n1592: @@ -6,11 +6,10 @@ package sros\n1593:  \n1594:  import (\n1595:  \t\"bufio\"\n1596:  \t\"bytes\"\n1597:  \t\"context\"\n1598: -\t_ \"embed\"\n1599:  \t\"errors\"\n1600:  \t\"fmt\"\n1601:  \t\"io\"\n1602:  \t\"maps\"\n1603:  \t\"net\"\n1604: @@ -20,19 +19,16 @@ import (\n1605:  \t\"reflect\"\n1606:  \t\"regexp\"\n1607:  \t\"slices\"\n1608:  \t\"strconv\"\n1609:  \t\"strings\"\n1610: -\t\"text/template\"\n1611:  \t\"time\"\n1612:  \n1613: -\t\"github.com/beevik/etree\"\n1614:  \t\"github.com/brunoga/deep\"\n1615:  \t\"github.com/charmbracelet/log\"\n1616:  \t\"github.com/scrapli/scrapligo/driver/netconf\"\n1617:  \t\"github.com/scrapli/scrapligo/driver/opoptions\"\n1618: -\t\"github.com/vishvananda/netns\"\n1619:  \n1620:  \t\"github.com/scrapli/scrapligo/response\"\n1621:  \n1622:  \tclabconstants \"github.com/srl-labs/containerlab/constants\"\n1623:  \tclabexec \"github.com/srl-labs/containerlab/exec\"\n1624: @@ -82,32 +78,16 @@ const (\n1625:  \tenvNokiaSrosMDA           = \"NOKIA_SROS_MDA\"\n1626:  \tenvSrosIPv4Active         = \"NOKIA_SROS_ADDRESS_IPV4_ACTIVE\"\n1627:  \tenvSrosIPv6Active         = \"NOKIA_SROS_ADDRESS_IPV6_ACTIVE\"\n1628:  \tenvSrosStaticRoutePrefix  = \"NOKIA_SROS_STATIC_ROUTE_\"\n1629:  \n1630: -\tdefaultSrosPowerType       = \"dc\"\n1631: -\tdefaultSrosPowerModuleType = \"ps-a-dc-6000\"\n1632: -\n1633:  \tsrosMinorError     = \"MINOR:\"\n1634:  \tsrosCriticalError  = \"CRITICAL:\"\n1635:  \tsrosRejectedCfgMsg = \"Configuration load failed - using default configuration\"\n1636:  )\n1637:  \n1638:  var (\n1639: -\n1640: -\t//go:embed configs/sros_config_sros25.go.tpl\n1641: -\tcfgTplSROS25 string\n1642: -\n1643: -\t//go:embed configs/sros_config_classic.go.tpl\n1644: -\tcfgTplClassic string\n1645: -\n1646: -\t//go:embed configs/ixr/ixr_config_classic.go.tpl\n1647: -\tcfgTplClassicIxr string\n1648: -\n1649: -\t//go:embed configs/sar/sar_config_classic.go.tpl\n1650: -\tcfgTplClassicSar string\n1651: -\n1652:  \tkindNames  = []string{\"nokia_srsim\"}\n1653:  \tsrosSysctl = map[string]string{\n1654:  \t\t\"net.ipv4.ip_forward\":                \"0\",\n1655:  \t\t\"net.ipv6.conf.all.disable_ipv6\":     \"0\",\n1656:  \t\t\"net.ipv6.conf.default.disable_ipv6\": \"0\",\n1657: @@ -160,15 +140,10 @@ var (\n1658:        e1-2-3       -> card 1, mda 2, port 3\n1659:        e1-2-c3-4    -> card 1, mda 2, connector 3, port 4\n1660:        e1-x2-3-4    -> card 1, xiom 2, mda 3, port 4\n1661:        e1-x2-3-c4-5 -> card 1, xiom 2, mda 3, connector 4, port 5\n1662:  \t  eth[0-9], for management interfaces of CPM-A/CPM-B or for fabric interfaces`\n1663: -\t// Auxiliary regexps for IXR/SAR detection.\n1664: -\tsarRegexp   = regexp.MustCompile(`(?i)\\bsar-`)\n1665: -\tsarHmRegexp = regexp.MustCompile(`(?i)\\b(sar-hm|sar-hmc)\\b`)\n1666: -\n1667: -\tixrRegexp = regexp.MustCompile(`(?i)\\bixr-`)\n1668:  )\n1669:  \n1670:  // Register registers the node in the NodeRegistry.\n1671:  func Register(r *clabnodes.NodeRegistry) {\n1672:  \tgenerateNodeAttributes := clabnodes.NewGenerateNodeAttributes(generateable, generateIfFormat)\n1673: @@ -241,10 +216,14 @@ type sros struct {\n1674:  \t// rootCtrName is the container that owns the netns.\n1675:  \t//  - for components based: the internal netns container.\n1676:  \t//  - for network mode based: parsed from network-mode.\n1677:  \trootCtrName string\n1678:  \n1679: +\t// userEnv is the env map from the topology, before component fields are merged in.\n1680: +\t// Node env overrides component type, XIOM, MDA, SFM, and per-component env.\n1681: +\tuserEnv map[string]string\n1682: +\n1683:  \tpreDeployParams *clabnodes.PreDeployParams\n1684:  \n1685:  \tnetnsNode clabnodes.Node\n1686:  }\n1687:  \n1688: @@ -279,16 +258,44 @@ func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) err\n1689:  \t// if user was not initialized to a value, use root\n1690:  \tif n.Cfg.User == \"\" {\n1691:  \t\tn.Cfg.User = \"0:0\"\n1692:  \t}\n1693:  \n1694: -\tif sfm := n.kindSpecificCfg().SFM; sfm != \"\" {\n1695: +\t// Snapshot topology env before component and SFM flags are applied.\n1696: +\t// Component nodes set userEnv from the base node before Init.\n1697: +\tenvAlreadyResolved := n.userEnv != nil\n1698: +\tif !envAlreadyResolved {\n1699:  \t\tif n.Cfg.Env == nil {\n1700: -\t\t\tn.Cfg.Env = map[string]string{}\n1701: +\t\t\tn.userEnv = map[string]string{}\n1702: +\t\t} else {\n1703: +\t\t\tn.userEnv = maps.Clone(n.Cfg.Env)\n1704:  \t\t}\n1705: +\t}\n1706: +\tif n.Cfg.Env == nil {\n1707: +\t\tn.Cfg.Env = map[string]string{}\n1708: +\t}\n1709:  \n1710: -\t\tn.Cfg.Env[envNokiaSrosSFM] = sfm\n1711: +\t// Distributed cards inherit SFM from the base node env. Applying it again\n1712: +\t// would warn once per card when the user also set NOKIA_SROS_SFM.\n1713: +\tif sfm := n.kindSpecificCfg().SFM; sfm != \"\" && !envAlreadyResolved {\n1714: +\t\tif envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {\n1715: +\t\t\tif envSFM != sfm {\n1716: +\t\t\t\tlog.Warn(\n1717: +\t\t\t\t\tfmt.Sprintf(\n1718: +\t\t\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n1719: +\t\t\t\t\t\tsfm,\n1720: +\t\t\t\t\t\tenvNokiaSrosSFM,\n1721: +\t\t\t\t\t),\n1722: +\t\t\t\t\t\"node\", n.Cfg.ShortName,\n1723: +\t\t\t\t\t\"env\", envNokiaSrosSFM,\n1724: +\t\t\t\t\t\"component-value\", sfm,\n1725: +\t\t\t\t\t\"env-value\", envSFM,\n1726: +\t\t\t\t)\n1727: +\t\t\t}\n1728: +\t\t} else {\n1729: +\t\t\tn.Cfg.Env[envNokiaSrosSFM] = sfm\n1730: +\t\t}\n1731:  \t}\n1732:  \n1733:  \tmaps.Copy(n.Cfg.Sysctls, srosSysctl)\n1734:  \n1735:  \t// make sure we always have uppercase slot definition\n1736: @@ -316,10 +323,11 @@ func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) err\n1737:  \n1738:  \t\tvars, err := n.setupStandaloneComponents()\n1739:  \t\tif err != nil {\n1740:  \t\t\treturn err\n1741:  \t\t}\n1742: +\t\twarnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)\n1743:  \n1744:  \t\t// n.Cfg.Env overrides component vars, overrides default srosEnv\n1745:  \t\tn.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)\n1746:  \t\tlog.Debug(\"Merged env file\", \"env\", fmt.Sprintf(\"%+v\", n.Cfg.Env), \"node\", n.Cfg.ShortName)\n1747:  \t} else {\n1748: @@ -348,12 +356,15 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {\n1749:  \tif len(n.kindSpecificCfg().Components) == 0 {\n\n(Showing lines 1590-1749 of 3945. Use offset=1750 to continue.)\n</content>",
    "title": "source/diff.txt",
    "metadata": {
      "preview": "--- a/nodes/sros/sros.go\n+++ b/nodes/sros/sros.go\n@@ -6,11 +6,10 @@ package sros\n \n import (\n \t\"bufio\"\n \t\"bytes\"\n \t\"context\"\n-\t_ \"embed\"\n \t\"errors\"\n \t\"fmt\"\n \t\"io\"\n \t\"maps\"\n \t\"net\"\n@@ -20,19 +19,16 @@ import (\n \t\"reflect\"\n \t\"regexp\"\n \t\"slices\"\n \t\"strconv\"\n \t\"strings\"",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/diff.txt",
        "text": "--- a/nodes/sros/sros.go\n+++ b/nodes/sros/sros.go\n@@ -6,11 +6,10 @@ package sros\n \n import (\n \t\"bufio\"\n \t\"bytes\"\n \t\"context\"\n-\t_ \"embed\"\n \t\"errors\"\n \t\"fmt\"\n \t\"io\"\n \t\"maps\"\n \t\"net\"\n@@ -20,19 +19,16 @@ import (\n \t\"reflect\"\n \t\"regexp\"\n \t\"slices\"\n \t\"strconv\"\n \t\"strings\"\n-\t\"text/template\"\n \t\"time\"\n \n-\t\"github.com/beevik/etree\"\n \t\"github.com/brunoga/deep\"\n \t\"github.com/charmbracelet/log\"\n \t\"github.com/scrapli/scrapligo/driver/netconf\"\n \t\"github.com/scrapli/scrapligo/driver/opoptions\"\n-\t\"github.com/vishvananda/netns\"\n \n \t\"github.com/scrapli/scrapligo/response\"\n \n \tclabconstants \"github.com/srl-labs/containerlab/constants\"\n \tclabexec \"github.com/srl-labs/containerlab/exec\"\n@@ -82,32 +78,16 @@ const (\n \tenvNokiaSrosMDA           = \"NOKIA_SROS_MDA\"\n \tenvSrosIPv4Active         = \"NOKIA_SROS_ADDRESS_IPV4_ACTIVE\"\n \tenvSrosIPv6Active         = \"NOKIA_SROS_ADDRESS_IPV6_ACTIVE\"\n \tenvSrosStaticRoutePrefix  = \"NOKIA_SROS_STATIC_ROUTE_\"\n \n-\tdefaultSrosPowerType       = \"dc\"\n-\tdefaultSrosPowerModuleType = \"ps-a-dc-6000\"\n-\n \tsrosMinorError     = \"MINOR:\"\n \tsrosCriticalError  = \"CRITICAL:\"\n \tsrosRejectedCfgMsg = \"Configuration load failed - using default configuration\"\n )\n \n var (\n-\n-\t//go:embed configs/sros_config_sros25.go.tpl\n-\tcfgTplSROS25 string\n-\n-\t//go:embed configs/sros_config_classic.go.tpl\n-\tcfgTplClassic string\n-\n-\t//go:embed configs/ixr/ixr_config_classic.go.tpl\n-\tcfgTplClassicIxr string\n-\n-\t//go:embed configs/sar/sar_config_classic.go.tpl\n-\tcfgTplClassicSar string\n-\n \tkindNames  = []string{\"nokia_srsim\"}\n \tsrosSysctl = map[string]string{\n \t\t\"net.ipv4.ip_forward\":                \"0\",\n \t\t\"net.ipv6.conf.all.disable_ipv6\":     \"0\",\n \t\t\"net.ipv6.conf.default.disable_ipv6\": \"0\",\n@@ -160,15 +140,10 @@ var (\n       e1-2-3       -> card 1, mda 2, port 3\n       e1-2-c3-4    -> card 1, mda 2, connector 3, port 4\n       e1-x2-3-4    -> card 1, xiom 2, mda 3, port 4\n       e1-x2-3-c4-5 -> card 1, xiom 2, mda 3, connector 4, port 5\n \t  eth[0-9], for management interfaces of CPM-A/CPM-B or for fabric interfaces`\n-\t// Auxiliary regexps for IXR/SAR detection.\n-\tsarRegexp   = regexp.MustCompile(`(?i)\\bsar-`)\n-\tsarHmRegexp = regexp.MustCompile(`(?i)\\b(sar-hm|sar-hmc)\\b`)\n-\n-\tixrRegexp = regexp.MustCompile(`(?i)\\bixr-`)\n )\n \n // Register registers the node in the NodeRegistry.\n func Register(r *clabnodes.NodeRegistry) {\n \tgenerateNodeAttributes := clabnodes.NewGenerateNodeAttributes(generateable, generateIfFormat)\n@@ -241,10 +216,14 @@ type sros struct {\n \t// rootCtrName is the container that owns the netns.\n \t//  - for components based: the internal netns container.\n \t//  - for network mode based: parsed from network-mode.\n \trootCtrName string\n \n+\t// userEnv is the env map from the topology, before component fields are merged in.\n+\t// Node env overrides component type, XIOM, MDA, SFM, and per-component env.\n+\tuserEnv map[string]string\n+\n \tpreDeployParams *clabnodes.PreDeployParams\n \n \tnetnsNode clabnodes.Node\n }\n \n@@ -279,16 +258,44 @@ func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) err\n \t// if user was not initialized to a value, use root\n \tif n.Cfg.User == \"\" {\n \t\tn.Cfg.User = \"0:0\"\n \t}\n \n-\tif sfm := n.kindSpecificCfg().SFM; sfm != \"\" {\n+\t// Snapshot topology env before component and SFM flags are applied.\n+\t// Component nodes set userEnv from the base node before Init.\n+\tenvAlreadyResolved := n.userEnv != nil\n+\tif !envAlreadyResolved {\n \t\tif n.Cfg.Env == nil {\n-\t\t\tn.Cfg.Env = map[string]string{}\n+\t\t\tn.userEnv = map[string]string{}\n+\t\t} else {\n+\t\t\tn.userEnv = maps.Clone(n.Cfg.Env)\n \t\t}\n+\t}\n+\tif n.Cfg.Env == nil {\n+\t\tn.Cfg.Env = map[string]string{}\n+\t}\n \n-\t\tn.Cfg.Env[envNokiaSrosSFM] = sfm\n+\t// Distributed cards inherit SFM from the base node env. Applying it again\n+\t// would warn once per card when the user also set NOKIA_SROS_SFM.\n+\tif sfm := n.kindSpecificCfg().SFM; sfm != \"\" && !envAlreadyResolved {\n+\t\tif envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {\n+\t\t\tif envSFM != sfm {\n+\t\t\t\tlog.Warn(\n+\t\t\t\t\tfmt.Sprintf(\n+\t\t\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n+\t\t\t\t\t\tsfm,\n+\t\t\t\t\t\tenvNokiaSrosSFM,\n+\t\t\t\t\t),\n+\t\t\t\t\t\"node\", n.Cfg.ShortName,\n+\t\t\t\t\t\"env\", envNokiaSrosSFM,\n+\t\t\t\t\t\"component-value\", sfm,\n+\t\t\t\t\t\"env-value\", envSFM,\n+\t\t\t\t)\n+\t\t\t}\n+\t\t} else {\n+\t\t\tn.Cfg.Env[envNokiaSrosSFM] = sfm\n+\t\t}\n \t}\n \n \tmaps.Copy(n.Cfg.Sysctls, srosSysctl)\n \n \t// make sure we always have uppercase slot definition\n@@ -316,10 +323,11 @@ func (n *sros) Init(cfg *clabtypes.NodeConfig, opts ...clabnodes.NodeOption) err\n \n \t\tvars, err := n.setupStandaloneComponents()\n \t\tif err != nil {\n \t\t\treturn err\n \t\t}\n+\t\twarnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)\n \n \t\t// n.Cfg.Env overrides component vars, overrides default srosEnv\n \t\tn.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)\n \t\tlog.Debug(\"Merged env file\", \"env\", fmt.Sprintf(\"%+v\", n.Cfg.Env), \"node\", n.Cfg.ShortName)\n \t} else {\n@@ -348,12 +356,15 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {\n \tif len(n.kindSpecificCfg().Components) == 0 {",
        "lineStart": 1590,
        "lineEnd": 1749,
        "totalLines": 3945,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346739841,
      "end": 1792346739857
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_15030d495001EKhSwpiWRoQGuR",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15030c0020015g2EZ0bcwZEBeP",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 79984,
    "input": 3513,
    "output": 98,
    "reasoning": 341,
    "cache": {
      "read": 76032,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_15030c0020015g2EZ0bcwZEBeP",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346734594,
    "completed": 1792346739866
  },
  "parentID": "msg_1502f68f300142aYYM85hGexse",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 79984,
    "input": 3513,
    "output": 98,
    "reasoning": 341,
    "cache": {
      "read": 76032,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 36
step-start
{
  "type": "step-start",
  "id": "prt_15030dcf5001wJL4ur3oqM15Fb",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15030d4a8001tXCn7rfV2C8Nea"
}
Reasoning
I'm re-reading diff hunks for sros.go. I previously read 1201-2500 and 2501-2548. Wait, no — the earlier session summary said I read diff lines 1-1200, 1201-2500, 2501-~2548. So sros.go diff hunks (1588-2547) were read. I'm now at 1750-2500 again — but that's fine, I've read them before. Actually the current read (offset 1590-1749) overlaps. Let me continue reading 1750-2547 to refresh the key parts of the sros.go diff (PreDeploy changes, createSROSFiles changes, generateComponentConfig removal etc.).
read · completed

Input

{
  "filePath": "/source/diff.txt",
  "limit": 800,
  "offset": 1750
}

Output

<path>/source/diff.txt</path>
<type>file</type>
<content>
1750:  		return nil, nil
1751:  	}
1752:  	if len(n.kindSpecificCfg().Components) > 1 {
1753:  		return nil, fmt.Errorf(
1754: -			"expected at most one component override for standalone SR-SIM node %q",
1755: +			"expected at most one component override for standalone SR-SIM node %q, "+
1756: +				"or one component per slot %s for redundant type %q",
1757:  			n.Cfg.ShortName,
1758: +			strings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), "/"),
1759: +			n.Cfg.NodeType,
1760:  		)
1761:  	}
1762:  
1763:  	slotA := n.kindSpecificCfg().Components[0]
1764:  
1765: @@ -370,27 +381,11 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {
1766:  			n.Cfg.ShortName,
1767:  		)
1768:  	}
1769:  	vars[envNokiaSrosSlot] = slotName
1770:  
1771: -	if slotA.Type != "" {
1772: -		if isSingleSlotIntegratedSrosNodeType(n.Cfg.NodeType) {
1773: -			return nil, fmt.Errorf(
1774: -				"node %q type %q is integrated and does not support component card-type override",
1775: -				n.Cfg.ShortName,
1776: -				n.Cfg.NodeType,
1777: -			)
1778: -		}
1779: -		vars[envNokiaSrosCard] = slotA.Type
1780: -	}
1781: -
1782: -	if len(slotA.MDA) > 0 {
1783: -		for _, m := range slotA.MDA {
1784: -			key := fmt.Sprintf("%s_%d", envNokiaSrosMDA, m.Slot)
1785: -			vars[key] = m.Type
1786: -		}
1787: -	}
1788: +	setComponentEnvVars(vars, slotA)
1789:  
1790:  	maps.Copy(vars, slotA.Env)
1791:  
1792:  	return vars, nil
1793:  }
1794: @@ -625,39 +620,10 @@ func (n *sros) Delete(ctx context.Context) error {
1795:  	errs = append(errs, n.DefaultNode.Delete(ctx), n.netnsNode.Delete(ctx))
1796:  
1797:  	return errors.Join(errs...)
1798:  }
1799:  
1800: -// DeleteNetnsSymlink deletes the symlink file created for the container netns.
1801: -func (n *sros) DeleteNetnsSymlink() error {
1802: -	var errs []error
1803: -
1804: -	// if it is the base node, then we need to delete the symlink for all the components.
1805: -	if n.isDistributedBaseNode() {
1806: -		for _, componentNode := range n.componentNodes {
1807: -			errs = append(errs, componentNode.DeleteNetnsSymlink())
1808: -		}
1809: -		if n.netnsNode != nil {
1810: -			errs = append(errs, n.netnsNode.DeleteNetnsSymlink())
1811: -		}
1812: -		errs = append(errs, clabutils.DeleteNetnsSymlink(n.Cfg.LongName))
1813: -	}
1814: -
1815: -	errs = append(errs, n.DefaultNode.DeleteNetnsSymlink(), n.cleanupParkingNetNS())
1816: -
1817: -	return errors.Join(errs...)
1818: -}
1819: -
1820: -func (n *sros) cleanupParkingNetNS() error {
1821: -	name := clabutils.ParkingNetnsName(n.Cfg.LongName)
1822: -	if _, err := clabutils.GetNamedNetNS(name); err != nil {
1823: -		return nil
1824: -	}
1825: -
1826: -	return netns.DeleteNamed(name)
1827: -}
1828: -
1829:  func (n *sros) setupComponentNodes() error {
1830:  	if !n.isDistributedBaseNode() {
1831:  		return nil
1832:  	}
1833:  
1834: @@ -693,17 +659,16 @@ func (n *sros) setupComponentNodes() error {
1835:  		componentConfig.Fqdn = n.calcComponentFqdn(c.Slot)
1836:  		componentConfig.DNS = nil
1837:  		componentConfig.PortBindings = nil
1838:  		componentConfig.PortSet = nil
1839:  
1840: -		// add the component env to the componentConfig env
1841: -		for k, v := range c.Env {
1842: -			componentConfig.Env[k] = v
1843: +		// Component fields fill env keys the user did not set. Node env wins.
1844: +		if componentConfig.Env == nil {
1845: +			componentConfig.Env = map[string]string{}
1846:  		}
1847: -
1848: -		// set component environment variables
1849: -		n.setComponentEnvVars(componentConfig, c)
1850: +		keepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)
1851: +		// Slot identifies this container. A node-level NOKIA_SROS_SLOT cannot apply to every card.
1852:  		componentConfig.Env[envNokiaSrosSlot] = c.Slot
1853:  
1854:  		// adjust label based env vars
1855:  		componentConfig.Env["CLAB_LABEL_"+clabutils.ToEnvKey(clabconstants.NodeName)] = componentConfig.ShortName
1856:  		componentConfig.Env["CLAB_LABEL_"+clabutils.ToEnvKey(clabconstants.LongName)] = componentConfig.LongName
1857: @@ -716,10 +681,14 @@ func (n *sros) setupComponentNodes() error {
1858:  		componentConfig.Labels[clabconstants.NodeName] = componentConfig.ShortName
1859:  		componentConfig.Labels[clabconstants.LongName] = componentConfig.LongName
1860:  		componentConfig.Labels[clabconstants.RootNodeName] = n.Cfg.ShortName
1861:  		componentConfig.Labels[clabconstants.RootNodeLongName] = n.Cfg.LongName
1862:  
1863: +		// Preserve the topology env. Init must not snapshot the merged component env,
1864: +		// or config generation would treat component flags as user overrides.
1865: +		srosNode.userEnv = maps.Clone(n.userEnv)
1866: +
1867:  		// init the component
1868:  		err = componentNode.Init(componentConfig)
1869:  		if err != nil {
1870:  			return err
1871:  		}
1872: @@ -737,32 +706,10 @@ func (n *sros) setupComponentNodes() error {
1873:  		n.componentNodes = append(n.componentNodes, componentNode)
1874:  	}
1875:  	return nil
1876:  }
1877:  
1878: -// setComponentEnvVars sets environment variables for a component.
1879: -func (n *sros) setComponentEnvVars(componentConfig *clabtypes.NodeConfig, c *Component) {
1880: -	if c.Type != "" {
1881: -		componentConfig.Env[envNokiaSrosCard] = c.Type
1882: -	}
1883: -
1884: -	for _, x := range c.XIOM {
1885: -		key := fmt.Sprintf("%s_X%d", envNokiaSrosXIOM, x.Slot)
1886: -		componentConfig.Env[key] = x.Type
1887: -		// add the nested MDA
1888: -		for _, m := range x.MDA {
1889: -			key := fmt.Sprintf("%s_X%d_%d", envNokiaSrosMDA, x.Slot, m.Slot)
1890: -			componentConfig.Env[key] = m.Type
1891: -		}
1892: -	}
1893: -
1894: -	for _, m := range c.MDA {
1895: -		key := fmt.Sprintf("%s_%d", envNokiaSrosMDA, m.Slot)
1896: -		componentConfig.Env[key] = m.Type
1897: -	}
1898: -}
1899: -
1900:  // deployFabric deploys the distributed SR-SIM when the `components` key is present.
1901:  func (n *sros) deployFabric(ctx context.Context, deployParams *clabnodes.DeployParams) error {
1902:  	netnsConfig := n.netnsNode.Config()
1903:  
1904:  	netnsConfig.MgmtIPv4Address = n.Cfg.MgmtIPv4Address
1905: @@ -870,30 +817,20 @@ func (n *sros) isDistributedCardNode() bool {
1906:  
1907:  // isDistributedBaseNode returns true if this is the base node of a distributed
1908:  // SR-SIM deployment. The base node orchestrates multiple component nodes.
1909:  func (n *sros) isDistributedBaseNode() bool {
1910:  	if isIntegratedSrosNodeType(n.Cfg.NodeType) {
1911: -		return false
1912: +		return isRedundantIntegratedSrosComponents(n.Cfg.NodeType, n.kindSpecificCfg().Components)
1913:  	}
1914:  	return len(n.kindSpecificCfg().Components) > 1
1915:  }
1916:  
1917:  // isStandaloneNode returns true if this is a standalone (non-distributed) SR-SIM node.
1918:  func (n *sros) isStandaloneNode() bool {
1919:  	return !n.isDistributedBaseNode() && !n.isDistributedCardNode()
1920:  }
1921:  
1922: -// GetNSPath retrieves the Namespace Path.
1923: -func (n *sros) GetNSPath(ctx context.Context) (string, error) {
1924: -	if n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == "") {
1925: -		return n.DefaultNode.GetNSPath(ctx)
1926: -	} else if n.isDistributedCardNode() {
1927: -		return n.Runtime.GetNSPath(ctx, n.rootCtrName)
1928: -	}
1929: -	return n.netnsNode.GetNSPath(ctx)
1930: -}
1931: -
1932:  // calcComponentName appends the line card suffix to the given node name.
1933:  func (n *sros) calcComponentName(name, slot string) string {
1934:  	if n.renameDone {
1935:  		return name
1936:  	}
1937: @@ -934,19 +871,18 @@ func (n *sros) cpmNode() (clabnodes.Node, error) {
1938:  }
1939:  
1940:  // cpmSlot returns the Slot of the preferred CPM Node (used when Distributed mode).
1941:  // It prefers slot A if present, otherwise returns slot B.
1942:  func (n *sros) cpmSlot() (string, error) {
1943: -	// Prefer slot A, fall back to slot B
1944: +	// Prefer slot A, fall back to slot B. Slots are accepted in either case.
1945:  	for _, comp := range n.kindSpecificCfg().Components {
1946: -		if comp.Slot == slotAName {
1947: +		if strings.EqualFold(comp.Slot, slotAName) {
1948:  			return slotAName, nil
1949:  		}
1950:  	}
1951: -	// Check for slot B as fallback
1952:  	for _, comp := range n.kindSpecificCfg().Components {
1953: -		if comp.Slot == slotBName {
1954: +		if strings.EqualFold(comp.Slot, slotBName) {
1955:  			return slotBName, nil
1956:  		}
1957:  	}
1958:  	return "", fmt.Errorf("node %s: unable to determine default slot", n.GetShortName())
1959:  }
1960: @@ -1041,33 +977,10 @@ func (*sros) checkKernelVersion() error {
1961:  		)
1962:  	}
1963:  	return nil
1964:  }
1965:  
1966: -// checkComponentSlotsConfig check the sros component slot config for validity.
1967: -func (n *sros) checkComponentSlotsConfig() error {
1968: -	// check Slots are unique
1969: -	componentNames := map[string]struct{}{}
1970: -	for _, component := range n.kindSpecificCfg().Components {
1971: -		// convert slot to upper
1972: -		slot := strings.ToUpper(component.Slot)
1973: -		// check if slot exists
1974: -		_, exists := componentNames[slot]
1975: -		if exists {
1976: -			return fmt.Errorf(
1977: -				"node %s slot %s duplicate definition",
1978: -				n.GetShortName(),
1979: -				component.Slot,
1980: -			)
1981: -		}
1982: -		// add to component names map
1983: -		componentNames[component.Slot] = struct{}{}
1984: -
1985: -	}
1986: -	return nil
1987: -}
1988: -
1989:  func (n *sros) CheckDeploymentConditions(ctx context.Context) error {
1990:  	// perform the sros specific kernel version check
1991:  	err := n.checkKernelVersion()
1992:  	if err != nil {
1993:  		return err
1994: @@ -1148,13 +1061,53 @@ func (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {
1995:  	licensed := append([]byte(chassisInfoFileLicense), content...)
1996:  	if err := os.WriteFile(dstPath, licensed, clabconstants.PermissionsFileDefault); err != nil {
1997:  		return fmt.Errorf("write %s: %w", dstPath, err)
1998:  	}
1999:  	log.Debug("Wrote chassis_info.json to lab dir", "node", n.Cfg.ShortName, "path", dstPath)
2000: +	n.warnUnsupportedComponents(content)
2001:  	return nil
2002:  }
2003:  
2004: +// warnUnsupportedComponents validates the effective component configuration against the
2005: +// chassis_info.json extracted from this exact image. Validation is advisory and never blocks
2006: +// deploy.
2007: +func (n *sros) warnUnsupportedComponents(content []byte) {
2008: +	// A distributed node validates once, from CPM A, to avoid duplicate warnings from CPM B.
2009: +	if !n.isStandaloneNode() && !n.isCPM(slotAName) {
2010: +		return
2011: +	}
2012: +
2013: +	info, err := parseChassisInfo(content)
2014: +	if err != nil {
2015: +		log.Warn("Could not validate SR-SIM components against chassis_info.json",
2016: +			"node", n.Cfg.ShortName, "error", err)
2017: +		return
2018: +	}
2019: +
2020: +	components := n.rootComponents
2021: +	if len(components) == 0 {
2022: +		components = n.kindSpecificCfg().Components
2023: +	}
2024: +
2025: +	effective := n.componentsForConfig(components)
2026: +	if len(effective) == 0 {
2027: +		// Environment variables can configure integrated hardware without a components entry.
2028: +		effective = []*Component{n.componentForConfig(nil)}
2029: +	}
2030: +
2031: +	nodeType := n.Cfg.NodeType
2032: +	if chassis := strings.TrimSpace(n.Cfg.Env[envNokiaSrosChassis]); chassis != "" {
2033: +		nodeType = chassis
2034: +	}
2035: +	for _, warning := range info.componentWarnings(nodeType, n.componentSFM(), effective) {
2036: +		log.Warn("SR-SIM component configuration may not be supported",
2037: +			"node", n.Cfg.ShortName,
2038: +			"chassis", nodeType,
2039: +			"warning", warning)
2040: +	}
2041: +}
2042: +
2043:  // Func that Places the Certificates in the right place and format.
2044:  func (n *sros) createSROSCertificates() error {
2045:  	if *n.Cfg.Certificate.Issue {
2046:  		clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),
2047:  			clabconstants.PermissionsOpen)
2048: @@ -1170,88 +1123,10 @@ func (n *sros) createSROSCertificates() error {
2049:  		}
2050:  	}
2051:  	return nil
2052:  }
2053:  
2054: -// createSROSConfigFiles handles config generation for the SR-SIM kind.
2055: -// Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).
2056: -func (n *sros) createSROSConfigFiles() error {
2057: -	// Get version from image before generating config
2058: -	if n.swVersion == nil {
2059: -		ctx := context.Background()
2060: -		version, err := n.srosVersionFromImage(ctx)
2061: -		if err != nil {
2062: -			n.swVersion = n.parseVersionString(srosDefaultVersion)
2063: -			log.Warn("Failed to get SR OS version from image",
2064: -				"node", n.Cfg.ShortName, "version", n.swVersion, "error", err)
2065: -		} else {
2066: -			n.swVersion = version
2067: -			log.Info("Retrieved SR OS version from image",
2068: -				"node", n.Cfg.ShortName,
2069: -				"version", fmt.Sprintf("%s.%s.%s", version.Major, version.Minor, version.Build))
2070: -		}
2071: -	}
2072: -
2073: -	// Path pointing to the target config file under configCf3 dir
2074: -	cf3CfgFile := filepath.Join(
2075: -		n.Cfg.LabDir,
2076: -		n.Cfg.Env[envNokiaSrosSlot],
2077: -		configCf3,
2078: -		startupCfgName,
2079: -	)
2080: -	isPartial := clabutils.IsPartialConfigFile(n.Cfg.StartupConfig)
2081: -
2082: -	// generate config and use that to boot node
2083: -	log.Debug("Reading startup-config", "node", n.Cfg.ShortName, "startup-config",
2084: -		n.Cfg.StartupConfig, "isPartial", isPartial)
2085: -
2086: -	startupConfig, err := n.buildStartupConfig(isPartial)
2087: -	if err != nil {
2088: -		return err
2089: -	}
2090: -
2091: -	if startupConfig == "" {
2092: -		log.Debug(
2093: -			"startup config is empty, skipping startup config file generation",
2094: -			"node",
2095: -			n.Cfg.ShortName,
2096: -		)
2097: -		return nil
2098: -	}
2099: -
2100: -	return n.GenerateConfig(cf3CfgFile, startupConfig)
2101: -}
2102: -
2103: -// buildStartupConfig returns the full startup config string: either from user file (full config)
2104: -// or from default + partial config generation. It does not return a template; the name is
2105: -// historical.
2106: -func (n *sros) buildStartupConfig(isPartial bool) (string, error) {
2107: -	// User provides full startup config
2108: -	if n.Cfg.StartupConfig != "" && !isPartial {
2109: -		c, err := os.ReadFile(n.Cfg.StartupConfig)
2110: -		if err != nil {
2111: -			return "", err
2112: -		}
2113: -
2114: -		cBuf, err := clabutils.SubstituteEnvsAndTemplate(bytes.NewReader(c), n.Cfg)
2115: -		if err != nil {
2116: -			return "", err
2117: -		}
2118: -		return cBuf.String(), nil
2119: -	}
2120: -
2121: -	// Generate default config and optionally add partial config
2122: -	if err := n.addDefaultConfig(); err != nil {
2123: -		return "", err
2124: -	}
2125: -	if err := n.addPartialConfig(); err != nil {
2126: -		return "", err
2127: -	}
2128: -
2129: -	return string(n.startupCliCfg), nil
2130: -}
2131: -
2132:  // SlotIsInteger checks if the slot string represents a valid integer.
2133:  func SlotIsInteger(s string) bool {
2134:  	_, err := strconv.Atoi(s)
2135:  	return err == nil
2136:  }
2137: @@ -1279,221 +1154,10 @@ func (n *sros) isCPM(cpm string) bool {
2138:  	}
2139:  
2140:  	return true
2141:  }
2142:  
2143: -// prepareConfigTemplateData prepares all data needed for template selection and execution.
2144: -// Service configs are filled from a single table-driven result: variant → getFullSnippetSet(v).
2145: -func (n *sros) prepareConfigTemplateData() (*srosTemplateData, error) {
2146: -	b, err := n.banner()
2147: -	if err != nil {
2148: -		return nil, err
2149: -	}
2150: -
2151: -	componentConfig := ""
2152: -	if !isFullConfigFile(n.Cfg.StartupConfig) {
2153: -		componentConfig = n.generateComponentConfig()
2154: -	} else {
2155: -		log.Debugf(
2156: -			"SR-SIM node %q has non-partial startup-config defined, skipping component config gen",
2157: -			n.Cfg.LongName,
2158: -		)
2159: -	}
2160: -
2161: -	v := n.resolveConfigVariant()
2162: -	snippets := getFullSnippetSet(v)
2163: -	configMode := string(v.Mode)
2164: -	if v.ForceClassic {
2165: -		log.Warn(
2166: -			"SAR-Hm nodes only support classic configuration mode. Overriding configuration mode to 'classic'",
2167: -			"node",
2168: -			n.Cfg.LongName,
2169: -			"node-type",
2170: -			strings.ToLower(n.Cfg.NodeType),
2171: -		)
2172: -		configMode = string(ConfigModeClassic)
2173: -		n.kindSpecificCfg().ConfigMode = ConfigModeClassic
2174: -	}
2175: -
2176: -	tplData := &srosTemplateData{
2177: -		// Selection criteria
2178: -		NodeType:          strings.ToLower(n.Cfg.NodeType),
2179: -		ConfigurationMode: configMode,
2180: -		SwVersion:         n.swVersion,
2181: -		IsSecureGrpc:      *n.Cfg.Certificate.Issue,
2182: -
2183: -		// Node data
2184: -		Name:            n.Cfg.ShortName,
2185: -		TLSKey:          n.Cfg.TLSKey,
2186: -		TLSCert:         n.Cfg.TLSCert,
2187: -		TLSAnchor:       n.Cfg.TLSAnchor,
2188: -		Banner:          b,
2189: -		IFaces:          map[string]tplIFace{},
2190: -		MgmtMTU:         0,
2191: -		MgmtIPMTU:       n.Runtime.Mgmt().MTU,
2192: -		ComponentConfig: componentConfig,
2193: -
2194: -		// Service configs from variant (single source of truth)
2195: -		SystemConfig:  snippets.SystemConfig,
2196: -		GRPCConfig:    snippets.GRPCConfig,
2197: -		SNMPConfig:    snippets.SNMPConfig,
2198: -		NetconfConfig: snippets.NetconfConfig,
2199: -		LoggingConfig: snippets.LoggingConfig,
2200: -		SSHConfig:     snippets.SSHConfig,
2201: -	}
2202: -
2203: -	if n.Config().DNS != nil {
2204: -		tplData.DNSServers = append(tplData.DNSServers, n.Config().DNS.Servers...)
2205: -	}
2206: -
2207: -	n.prepareSSHPubKeys(tplData)
2208: -
2209: -	n.setVersionSpecificParams(tplData)
2210: -
2211: -	return tplData, nil
2212: -}
2213: -
2214: -// isIXRNode returns true if this is an IXR node type (case-insensitive).
2215: -func (n *sros) isIXRNode() bool {
2216: -	return ixrRegexp.MatchString(n.Cfg.NodeType)
2217: -}
2218: -
2219: -// isSARNode returns true if this is a SAR node type (case-insensitive).
2220: -func (n *sros) isSARNode() bool {
2221: -	return sarRegexp.MatchString(n.Cfg.NodeType)
2222: -}
2223: -
2224: -// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).
2225: -func (n *sros) isSARHmNode() bool {
2226: -	return sarHmRegexp.MatchString(n.Cfg.NodeType)
2227: -}
2228: -
2229: -// getTemplateForVariant returns the template string and name for the given config variant.
2230: -// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= "26").
2231: -func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {
2232: -	// Model-driven (or mixed treated as classic below when family is classic)
2233: -	if v.Mode == ConfigModeModelDriven {
2234: -		// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= "26"
2235: -		// { return cfgTplSROS26, "clab-sros-config-sros26" }
2236: -		return cfgTplSROS25, "clab-sros-config-sros25"
2237: -	}
2238: -	// Classic (or mixed)
2239: -	tmpl = cfgTplClassic
2240: -	tplName = "clab-sros-config-classic"
2241: -	switch v.Family {
2242: -	case ConfigFamilyIXR:
2243: -		return cfgTplClassicIxr, "clab-sros-config-classic-ixr"
2244: -	case ConfigFamilySAR:
2245: -		return cfgTplClassicSar, "clab-sros-config-classic-sar"
2246: -	default:
2247: -		return tmpl, tplName
2248: -	}
2249: -}
2250: -
2251: -// selectConfigTemplate chooses the config template from the config variant (mode + family).
2252: -func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {
2253: -	v := n.resolveConfigVariant()
2254: -	tmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)
2255: -	return template.New(tplName).
2256: -		Funcs(clabutils.CreateFuncs()).
2257: -		Parse(tmpl)
2258: -}
2259: -
2260: -// addDefaultConfig adds sros default configuration such as tls certs, gnmi/json-rpc, login-banner,
2261: -// ssh keys.
2262: -func (n *sros) addDefaultConfig() error {
2263: -	// Prepare all template data
2264: -	tplData, err := n.prepareConfigTemplateData()
2265: -	if err != nil {
2266: -		return err
2267: -	}
2268: -
2269: -	// Select appropriate template
2270: -	srosCfgTpl, err := n.selectConfigTemplate(tplData)
2271: -	if err != nil {
2272: -		return fmt.Errorf("failed to select config template: %w", err)
2273: -	}
2274: -	log.Debug("Prepare SR OS config template", "template", srosCfgTpl.Name(),
2275: -		"node", n.Cfg.LongName,
2276: -		"configuration-mode", tplData.ConfigurationMode,
2277: -		"node-type", tplData.NodeType,
2278: -		"secure-grpc", tplData.IsSecureGrpc,
2279: -		"sw-version", tplData.SwVersion)
2280: -
2281: -	// Execute template
2282: -	buf := new(bytes.Buffer)
2283: -	err = srosCfgTpl.Execute(buf, tplData)
2284: -	if err != nil {
2285: -		return err
2286: -	}
2287: -
2288: -	if buf.Len() == 0 {
2289: -		log.Warn(
2290: -			"Buffer empty, template parsing error",
2291: -			"node", n.Cfg.ShortName,
2292: -			"template", srosCfgTpl.Name(),
2293: -		)
2294: -	} else {
2295: -		log.Debug("Additional default config parsed",
2296: -			"node", n.Cfg.ShortName,
2297: -			"template", srosCfgTpl.Name())
2298: -		n.startupCliCfg = append(n.startupCliCfg, buf.String()...)
2299: -	}
2300: -
2301: -	return nil
2302: -}
2303: -
2304: -// applyPartialConfig applies partial configuration to the SR OS.
2305: -func (n *sros) addPartialConfig() error {
2306: -	if n.Cfg.StartupConfig != "" {
2307: -		// b holds the configuration to be applied to the node
2308: -		b := &bytes.Buffer{}
2309: -		// apply partial configs if partial config is used
2310: -		if clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM("") {
2311: -			log.Info("Adding configuration",
2312: -				"node", n.Cfg.LongName,
2313: -				"type", "partial",
2314: -				"source", n.Cfg.StartupConfig)
2315: -
2316: -			r, err := os.Open(n.Cfg.StartupConfig)
2317: -			if err != nil {
2318: -				return err
2319: -			}
2320: -
2321: -			defer r.Close() // skipcq: GO-S2307
2322: -
2323: -			_, err = io.Copy(b, r)
2324: -			if err != nil {
2325: -				return err
2326: -			}
2327: -
2328: -			configContent, err := clabutils.SubstituteEnvsAndTemplate(b, n.Cfg)
2329: -			if err != nil {
2330: -				return err
2331: -			}
2332: -			if configContent.Len() == 0 {
2333: -				log.Warn(
2334: -					"Buffer empty, PARTIAL config template parsing error",
2335: -					"node",
2336: -					n.Cfg.ShortName,
2337: -				)
2338: -			} else {
2339: -				log.Debug("Additional PARTIAL config parsed", "node",
2340: -					n.Cfg.ShortName, "partial-config", configContent.String())
2341: -				n.startupCliCfg = append(n.startupCliCfg, configContent.String()...)
2342: -			}
2343: -		} else {
2344: -			log.Warn(
2345: -				"Passed startup-config option, but it will not have any effect",
2346: -				"node",
2347: -				n.Cfg.ShortName,
2348: -			)
2349: -		}
2350: -	}
2351: -	return nil
2352: -}
2353: -
2354:  func (n *sros) GetContainers(ctx context.Context) ([]clabruntime.GenericContainer, error) {
2355:  	// if not a distributed setup call regular GetContainers
2356:  	if n.isStandaloneNode() || n.isDistributedCardNode() {
2357:  		return n.DefaultNode.GetContainers(ctx)
2358:  	}
2359: @@ -1761,63 +1425,10 @@ func (n *sros) saveConfigWithAddr(ctx context.Context, addr string) error {
2360:  	)
2361:  
2362:  	return nil
2363:  }
2364:  
2365: -// BuildPKIImportXML.
2366: -func buildPKIImportXML(inputURL, outputFile, importType string) string {
2367: -	action := etree.NewElement("action")
2368: -	action.CreateAttr("xmlns", "urn:ietf:params:xml:ns:yang:1")
2369: -
2370: -	admin := action.CreateElement("admin")
2371: -	admin.CreateAttr("xmlns", "urn:nokia.com:sros:ns:yang:sr:oper-admin")
2372: -
2373: -	importElem := admin.CreateElement("system").
2374: -		CreateElement("security").
2375: -		CreateElement("pki").
2376: -		CreateElement("import")
2377: -
2378: -	// Add import parameters
2379: -	importElem.CreateElement("input-url").SetText(inputURL)
2380: -	importElem.CreateElement("output-file").SetText(outputFile)
2381: -	importElem.CreateElement("type").SetText(importType)
2382: -	importElem.CreateElement("format").SetText("pem")
2383: -	var buf bytes.Buffer
2384: -	action.WriteTo(&buf, &etree.WriteSettings{
2385: -		CanonicalText:    false,
2386: -		CanonicalAttrVal: false,
2387: -	})
2388: -	return buf.String()
2389: -}
2390: -
2391: -// BuildTLSProfileXML builds the TLS profile configuration XML.
2392: -func buildTLSProfileXML() string {
2393: -	config := etree.NewElement("config")
2394: -	configure := config.CreateElement("configure")
2395: -	configure.CreateAttr("xmlns", "urn:nokia.com:sros:ns:yang:sr:conf")
2396: -	configure.CreateAttr("xmlns:nc", "urn:ietf:params:xml:ns:netconf:base:1.0")
2397: -
2398: -	certProfile := configure.CreateElement("system").
2399: -		CreateElement("security").
2400: -		CreateElement("tls").
2401: -		CreateElement("cert-profile")
2402: -
2403: -	// Set operation attribute
2404: -	certProfile.CreateAttr("nc:operation", "merge")
2405: -
2406: -	// Add profile configuration
2407: -	certProfile.CreateElement("cert-profile-name").SetText(tlsCertProfileName)
2408: -	certProfile.CreateElement("admin-state").SetText("enable")
2409: -
2410: -	var buf bytes.Buffer
2411: -	config.WriteTo(&buf, &etree.WriteSettings{
2412: -		CanonicalText:    false,
2413: -		CanonicalAttrVal: false,
2414: -	})
2415: -	return buf.String()
2416: -}
2417: -
2418:  // TLS bootstrap via NETCONF to enable secure gRPC.
2419:  func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {
2420:  	// Always import PKI key and cert:
2421:  	// 	 import "cf3:\node.key" in PEM format as "cf3:\system-pki\node.key" (encrypted DER)
2422:  	//   import "cf3:\node.crt" in PEM format as "cf3:\system-pki\node.crt" (encrypted DER)
2423: @@ -1867,23 +1478,10 @@ func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {
2424:  		}
2425:  	}
2426:  	return err
2427:  }
2428:  
2429: -// isConfigClassic reports whether the node is in classic or mixed configuration mode.
2430: -func (n *sros) isConfigClassic() bool {
2431: -	mode := n.kindSpecificCfg().ConfigMode
2432: -	return mode == ConfigModeClassic || mode == ConfigModeMixed
2433: -}
2434: -
2435: -// isFullConfigFile returns true if the config file doesn't contain .partial substring
2436: -// and the config file is NOT nil (ie. startup config IS defined).
2437: -// it is intended that the 'c' arg is n.Cfg.StartupConfig.
2438: -func isFullConfigFile(c string) bool {
2439: -	return c != "" && !clabutils.IsPartialConfigFile(c)
2440: -}
2441: -
2442:  func (n *sros) IsHealthy(_ context.Context) (bool, error) {
2443:  	if !n.isCPM("") {
2444:  		return true, fmt.Errorf("node %q is not a CPM, healthcheck has no effect", n.Cfg.LongName)
2445:  	}
2446:  	// non-partial user startup config might not have any netconf config
2447: @@ -2082,67 +1680,10 @@ func (n *sros) MgmtIPAddr() (string, error) {
2448:  		"no management IP address (IPv4 or IPv6) configured for node %q",
2449:  		n.Cfg.LongName,
2450:  	)
2451:  }
2452:  
2453: -// generateComponentConfig generates SR OS configuration for explicitly defined distributed
2454: -// components or known integrated SR-SIM defaults. Power config is appended when supported.
2455: -func (n *sros) generateComponentConfig() string {
2456: -	if !n.kindSpecificCfg().GenComponentConfig {
2457: -		return ""
2458: -	}
2459: -	if n.isConfigClassic() {
2460: -		return ""
2461: -	}
2462: -
2463: -	components := n.rootComponents
2464: -	if len(components) == 0 {
2465: -		if len(n.kindSpecificCfg().Components) > 1 || n.rootCtrName != "" {
2466: -			return ""
2467: -		}
2468: -
2469: -		lines := buildIntegratedComponentCfgLines(n.Cfg.NodeType, n.Cfg.Env)
2470: -		if len(lines) == 0 {
2471: -			return ""
2472: -		}
2473: -		return n.componentConfigFromLines(lines)
2474: -	}
2475: -
2476: -	for _, c := range components {
2477: -		slot := strings.ToUpper(strings.TrimSpace(c.Slot))
2478: -		if slot == slotAName || slot == slotBName {
2479: -			continue
2480: -		}
2481: -		if c.Type == "" {
2482: -			log.Warn(
2483: -				"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.",
2484: -				"node",
2485: -				n.Cfg.ShortName,
2486: -				"slot",
2487: -				slot,
2488: -			)
2489: -		}
2490: -	}
2491: -
2492: -	lines := buildComponentCfgLines(components, n.kindSpecificCfg().SFM)
2493: -	return n.componentConfigFromLines(lines)
2494: -}
2495: -
2496: -func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {
2497: -	powerConfig := n.generatePowerConfig()
2498: -	if len(lines) == 0 && powerConfig == "" {
2499: -		return ""
2500: -	}
2501: -
2502: -	var config strings.Builder
2503: -	for _, l := range lines {
2504: -		config.WriteString(l.String())
2505: -	}
2506: -	config.WriteString(powerConfig)
2507: -	return config.String()
2508: -}
2509: -
2510:  // override to fetch CPM to avoid renaming the base node to CPM A.
2511:  func (n *sros) GetContainerName() string {
2512:  	if n.isDistributedBaseNode() && n.cpmContainerName != "" {
2513:  		return n.cpmContainerName
2514:  	}
2515: @@ -2365,32 +1906,5 @@ func (n *sros) RestoreEndpoints(ctx context.Context) error {
2516:  	if err != nil {
2517:  		return err
2518:  	}
2519:  	return clabutils.LinkContainerNS(nsPath, n.Cfg.LongName)
2520:  }
2521: -
2522: -func (n *sros) ensureNetnsRunning(ctx context.Context) error {
2523: -	switch status := n.netnsNode.GetContainerStatus(ctx); status {
2524: -	case clabruntime.Running:
2525: -		// The namespace holder intentionally survives regular node lifecycle operations.
2526: -	case clabruntime.Created, clabruntime.Stopped:
2527: -		if err := n.netnsNode.Start(ctx); err != nil {
2528: -			return fmt.Errorf("node %q network namespace container start error: %w",
2529: -				n.Cfg.ShortName, err)
2530: -		}
2531: -	case clabruntime.Paused:
2532: -		if err := n.Runtime.UnpauseContainer(ctx, n.netnsNode.Config().LongName); err != nil {
2533: -			return fmt.Errorf("node %q network namespace container unpause error: %w",
2534: -				n.Cfg.ShortName, err)
2535: -		}
2536: -	case clabruntime.NotFound:
2537: -		return fmt.Errorf(
2538: -			"node %q network namespace container %q not found; recreate the node",
2539: -			n.Cfg.ShortName, n.netnsNode.Config().LongName,
2540: -		)
2541: -	default:
2542: -		return fmt.Errorf("node %q network namespace container %q is %s",
2543: -			n.Cfg.ShortName, n.netnsNode.Config().LongName, status)
2544: -	}
2545: -
2546: -	return nil
2547: -}
2548: diff --git a/nodes/sros/sros_test.go b/nodes/sros/sros_test.go
2549: index 29cace9..dd8aea6 100644

(Showing lines 1750-2549 of 3945. Use offset=2550 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_15030e2d30011beb2Yk1jOFs9Y",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15030d4a8001tXCn7rfV2C8Nea",
  "callID": "call_05cc46526cb643fbb3e92a42",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/diff.txt",
      "limit": 800,
      "offset": 1750
    },
    "output": "<path>/source/diff.txt</path>\n<type>file</type>\n<content>\n1750:  \t\treturn nil, nil\n1751:  \t}\n1752:  \tif len(n.kindSpecificCfg().Components) > 1 {\n1753:  \t\treturn nil, fmt.Errorf(\n1754: -\t\t\t\"expected at most one component override for standalone SR-SIM node %q\",\n1755: +\t\t\t\"expected at most one component override for standalone SR-SIM node %q, \"+\n1756: +\t\t\t\t\"or one component per slot %s for redundant type %q\",\n1757:  \t\t\tn.Cfg.ShortName,\n1758: +\t\t\tstrings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), \"/\"),\n1759: +\t\t\tn.Cfg.NodeType,\n1760:  \t\t)\n1761:  \t}\n1762:  \n1763:  \tslotA := n.kindSpecificCfg().Components[0]\n1764:  \n1765: @@ -370,27 +381,11 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {\n1766:  \t\t\tn.Cfg.ShortName,\n1767:  \t\t)\n1768:  \t}\n1769:  \tvars[envNokiaSrosSlot] = slotName\n1770:  \n1771: -\tif slotA.Type != \"\" {\n1772: -\t\tif isSingleSlotIntegratedSrosNodeType(n.Cfg.NodeType) {\n1773: -\t\t\treturn nil, fmt.Errorf(\n1774: -\t\t\t\t\"node %q type %q is integrated and does not support component card-type override\",\n1775: -\t\t\t\tn.Cfg.ShortName,\n1776: -\t\t\t\tn.Cfg.NodeType,\n1777: -\t\t\t)\n1778: -\t\t}\n1779: -\t\tvars[envNokiaSrosCard] = slotA.Type\n1780: -\t}\n1781: -\n1782: -\tif len(slotA.MDA) > 0 {\n1783: -\t\tfor _, m := range slotA.MDA {\n1784: -\t\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n1785: -\t\t\tvars[key] = m.Type\n1786: -\t\t}\n1787: -\t}\n1788: +\tsetComponentEnvVars(vars, slotA)\n1789:  \n1790:  \tmaps.Copy(vars, slotA.Env)\n1791:  \n1792:  \treturn vars, nil\n1793:  }\n1794: @@ -625,39 +620,10 @@ func (n *sros) Delete(ctx context.Context) error {\n1795:  \terrs = append(errs, n.DefaultNode.Delete(ctx), n.netnsNode.Delete(ctx))\n1796:  \n1797:  \treturn errors.Join(errs...)\n1798:  }\n1799:  \n1800: -// DeleteNetnsSymlink deletes the symlink file created for the container netns.\n1801: -func (n *sros) DeleteNetnsSymlink() error {\n1802: -\tvar errs []error\n1803: -\n1804: -\t// if it is the base node, then we need to delete the symlink for all the components.\n1805: -\tif n.isDistributedBaseNode() {\n1806: -\t\tfor _, componentNode := range n.componentNodes {\n1807: -\t\t\terrs = append(errs, componentNode.DeleteNetnsSymlink())\n1808: -\t\t}\n1809: -\t\tif n.netnsNode != nil {\n1810: -\t\t\terrs = append(errs, n.netnsNode.DeleteNetnsSymlink())\n1811: -\t\t}\n1812: -\t\terrs = append(errs, clabutils.DeleteNetnsSymlink(n.Cfg.LongName))\n1813: -\t}\n1814: -\n1815: -\terrs = append(errs, n.DefaultNode.DeleteNetnsSymlink(), n.cleanupParkingNetNS())\n1816: -\n1817: -\treturn errors.Join(errs...)\n1818: -}\n1819: -\n1820: -func (n *sros) cleanupParkingNetNS() error {\n1821: -\tname := clabutils.ParkingNetnsName(n.Cfg.LongName)\n1822: -\tif _, err := clabutils.GetNamedNetNS(name); err != nil {\n1823: -\t\treturn nil\n1824: -\t}\n1825: -\n1826: -\treturn netns.DeleteNamed(name)\n1827: -}\n1828: -\n1829:  func (n *sros) setupComponentNodes() error {\n1830:  \tif !n.isDistributedBaseNode() {\n1831:  \t\treturn nil\n1832:  \t}\n1833:  \n1834: @@ -693,17 +659,16 @@ func (n *sros) setupComponentNodes() error {\n1835:  \t\tcomponentConfig.Fqdn = n.calcComponentFqdn(c.Slot)\n1836:  \t\tcomponentConfig.DNS = nil\n1837:  \t\tcomponentConfig.PortBindings = nil\n1838:  \t\tcomponentConfig.PortSet = nil\n1839:  \n1840: -\t\t// add the component env to the componentConfig env\n1841: -\t\tfor k, v := range c.Env {\n1842: -\t\t\tcomponentConfig.Env[k] = v\n1843: +\t\t// Component fields fill env keys the user did not set. Node env wins.\n1844: +\t\tif componentConfig.Env == nil {\n1845: +\t\t\tcomponentConfig.Env = map[string]string{}\n1846:  \t\t}\n1847: -\n1848: -\t\t// set component environment variables\n1849: -\t\tn.setComponentEnvVars(componentConfig, c)\n1850: +\t\tkeepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)\n1851: +\t\t// Slot identifies this container. A node-level NOKIA_SROS_SLOT cannot apply to every card.\n1852:  \t\tcomponentConfig.Env[envNokiaSrosSlot] = c.Slot\n1853:  \n1854:  \t\t// adjust label based env vars\n1855:  \t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.NodeName)] = componentConfig.ShortName\n1856:  \t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.LongName)] = componentConfig.LongName\n1857: @@ -716,10 +681,14 @@ func (n *sros) setupComponentNodes() error {\n1858:  \t\tcomponentConfig.Labels[clabconstants.NodeName] = componentConfig.ShortName\n1859:  \t\tcomponentConfig.Labels[clabconstants.LongName] = componentConfig.LongName\n1860:  \t\tcomponentConfig.Labels[clabconstants.RootNodeName] = n.Cfg.ShortName\n1861:  \t\tcomponentConfig.Labels[clabconstants.RootNodeLongName] = n.Cfg.LongName\n1862:  \n1863: +\t\t// Preserve the topology env. Init must not snapshot the merged component env,\n1864: +\t\t// or config generation would treat component flags as user overrides.\n1865: +\t\tsrosNode.userEnv = maps.Clone(n.userEnv)\n1866: +\n1867:  \t\t// init the component\n1868:  \t\terr = componentNode.Init(componentConfig)\n1869:  \t\tif err != nil {\n1870:  \t\t\treturn err\n1871:  \t\t}\n1872: @@ -737,32 +706,10 @@ func (n *sros) setupComponentNodes() error {\n1873:  \t\tn.componentNodes = append(n.componentNodes, componentNode)\n1874:  \t}\n1875:  \treturn nil\n1876:  }\n1877:  \n1878: -// setComponentEnvVars sets environment variables for a component.\n1879: -func (n *sros) setComponentEnvVars(componentConfig *clabtypes.NodeConfig, c *Component) {\n1880: -\tif c.Type != \"\" {\n1881: -\t\tcomponentConfig.Env[envNokiaSrosCard] = c.Type\n1882: -\t}\n1883: -\n1884: -\tfor _, x := range c.XIOM {\n1885: -\t\tkey := fmt.Sprintf(\"%s_X%d\", envNokiaSrosXIOM, x.Slot)\n1886: -\t\tcomponentConfig.Env[key] = x.Type\n1887: -\t\t// add the nested MDA\n1888: -\t\tfor _, m := range x.MDA {\n1889: -\t\t\tkey := fmt.Sprintf(\"%s_X%d_%d\", envNokiaSrosMDA, x.Slot, m.Slot)\n1890: -\t\t\tcomponentConfig.Env[key] = m.Type\n1891: -\t\t}\n1892: -\t}\n1893: -\n1894: -\tfor _, m := range c.MDA {\n1895: -\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n1896: -\t\tcomponentConfig.Env[key] = m.Type\n1897: -\t}\n1898: -}\n1899: -\n1900:  // deployFabric deploys the distributed SR-SIM when the `components` key is present.\n1901:  func (n *sros) deployFabric(ctx context.Context, deployParams *clabnodes.DeployParams) error {\n1902:  \tnetnsConfig := n.netnsNode.Config()\n1903:  \n1904:  \tnetnsConfig.MgmtIPv4Address = n.Cfg.MgmtIPv4Address\n1905: @@ -870,30 +817,20 @@ func (n *sros) isDistributedCardNode() bool {\n1906:  \n1907:  // isDistributedBaseNode returns true if this is the base node of a distributed\n1908:  // SR-SIM deployment. The base node orchestrates multiple component nodes.\n1909:  func (n *sros) isDistributedBaseNode() bool {\n1910:  \tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n1911: -\t\treturn false\n1912: +\t\treturn isRedundantIntegratedSrosComponents(n.Cfg.NodeType, n.kindSpecificCfg().Components)\n1913:  \t}\n1914:  \treturn len(n.kindSpecificCfg().Components) > 1\n1915:  }\n1916:  \n1917:  // isStandaloneNode returns true if this is a standalone (non-distributed) SR-SIM node.\n1918:  func (n *sros) isStandaloneNode() bool {\n1919:  \treturn !n.isDistributedBaseNode() && !n.isDistributedCardNode()\n1920:  }\n1921:  \n1922: -// GetNSPath retrieves the Namespace Path.\n1923: -func (n *sros) GetNSPath(ctx context.Context) (string, error) {\n1924: -\tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == \"\") {\n1925: -\t\treturn n.DefaultNode.GetNSPath(ctx)\n1926: -\t} else if n.isDistributedCardNode() {\n1927: -\t\treturn n.Runtime.GetNSPath(ctx, n.rootCtrName)\n1928: -\t}\n1929: -\treturn n.netnsNode.GetNSPath(ctx)\n1930: -}\n1931: -\n1932:  // calcComponentName appends the line card suffix to the given node name.\n1933:  func (n *sros) calcComponentName(name, slot string) string {\n1934:  \tif n.renameDone {\n1935:  \t\treturn name\n1936:  \t}\n1937: @@ -934,19 +871,18 @@ func (n *sros) cpmNode() (clabnodes.Node, error) {\n1938:  }\n1939:  \n1940:  // cpmSlot returns the Slot of the preferred CPM Node (used when Distributed mode).\n1941:  // It prefers slot A if present, otherwise returns slot B.\n1942:  func (n *sros) cpmSlot() (string, error) {\n1943: -\t// Prefer slot A, fall back to slot B\n1944: +\t// Prefer slot A, fall back to slot B. Slots are accepted in either case.\n1945:  \tfor _, comp := range n.kindSpecificCfg().Components {\n1946: -\t\tif comp.Slot == slotAName {\n1947: +\t\tif strings.EqualFold(comp.Slot, slotAName) {\n1948:  \t\t\treturn slotAName, nil\n1949:  \t\t}\n1950:  \t}\n1951: -\t// Check for slot B as fallback\n1952:  \tfor _, comp := range n.kindSpecificCfg().Components {\n1953: -\t\tif comp.Slot == slotBName {\n1954: +\t\tif strings.EqualFold(comp.Slot, slotBName) {\n1955:  \t\t\treturn slotBName, nil\n1956:  \t\t}\n1957:  \t}\n1958:  \treturn \"\", fmt.Errorf(\"node %s: unable to determine default slot\", n.GetShortName())\n1959:  }\n1960: @@ -1041,33 +977,10 @@ func (*sros) checkKernelVersion() error {\n1961:  \t\t)\n1962:  \t}\n1963:  \treturn nil\n1964:  }\n1965:  \n1966: -// checkComponentSlotsConfig check the sros component slot config for validity.\n1967: -func (n *sros) checkComponentSlotsConfig() error {\n1968: -\t// check Slots are unique\n1969: -\tcomponentNames := map[string]struct{}{}\n1970: -\tfor _, component := range n.kindSpecificCfg().Components {\n1971: -\t\t// convert slot to upper\n1972: -\t\tslot := strings.ToUpper(component.Slot)\n1973: -\t\t// check if slot exists\n1974: -\t\t_, exists := componentNames[slot]\n1975: -\t\tif exists {\n1976: -\t\t\treturn fmt.Errorf(\n1977: -\t\t\t\t\"node %s slot %s duplicate definition\",\n1978: -\t\t\t\tn.GetShortName(),\n1979: -\t\t\t\tcomponent.Slot,\n1980: -\t\t\t)\n1981: -\t\t}\n1982: -\t\t// add to component names map\n1983: -\t\tcomponentNames[component.Slot] = struct{}{}\n1984: -\n1985: -\t}\n1986: -\treturn nil\n1987: -}\n1988: -\n1989:  func (n *sros) CheckDeploymentConditions(ctx context.Context) error {\n1990:  \t// perform the sros specific kernel version check\n1991:  \terr := n.checkKernelVersion()\n1992:  \tif err != nil {\n1993:  \t\treturn err\n1994: @@ -1148,13 +1061,53 @@ func (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {\n1995:  \tlicensed := append([]byte(chassisInfoFileLicense), content...)\n1996:  \tif err := os.WriteFile(dstPath, licensed, clabconstants.PermissionsFileDefault); err != nil {\n1997:  \t\treturn fmt.Errorf(\"write %s: %w\", dstPath, err)\n1998:  \t}\n1999:  \tlog.Debug(\"Wrote chassis_info.json to lab dir\", \"node\", n.Cfg.ShortName, \"path\", dstPath)\n2000: +\tn.warnUnsupportedComponents(content)\n2001:  \treturn nil\n2002:  }\n2003:  \n2004: +// warnUnsupportedComponents validates the effective component configuration against the\n2005: +// chassis_info.json extracted from this exact image. Validation is advisory and never blocks\n2006: +// deploy.\n2007: +func (n *sros) warnUnsupportedComponents(content []byte) {\n2008: +\t// A distributed node validates once, from CPM A, to avoid duplicate warnings from CPM B.\n2009: +\tif !n.isStandaloneNode() && !n.isCPM(slotAName) {\n2010: +\t\treturn\n2011: +\t}\n2012: +\n2013: +\tinfo, err := parseChassisInfo(content)\n2014: +\tif err != nil {\n2015: +\t\tlog.Warn(\"Could not validate SR-SIM components against chassis_info.json\",\n2016: +\t\t\t\"node\", n.Cfg.ShortName, \"error\", err)\n2017: +\t\treturn\n2018: +\t}\n2019: +\n2020: +\tcomponents := n.rootComponents\n2021: +\tif len(components) == 0 {\n2022: +\t\tcomponents = n.kindSpecificCfg().Components\n2023: +\t}\n2024: +\n2025: +\teffective := n.componentsForConfig(components)\n2026: +\tif len(effective) == 0 {\n2027: +\t\t// Environment variables can configure integrated hardware without a components entry.\n2028: +\t\teffective = []*Component{n.componentForConfig(nil)}\n2029: +\t}\n2030: +\n2031: +\tnodeType := n.Cfg.NodeType\n2032: +\tif chassis := strings.TrimSpace(n.Cfg.Env[envNokiaSrosChassis]); chassis != \"\" {\n2033: +\t\tnodeType = chassis\n2034: +\t}\n2035: +\tfor _, warning := range info.componentWarnings(nodeType, n.componentSFM(), effective) {\n2036: +\t\tlog.Warn(\"SR-SIM component configuration may not be supported\",\n2037: +\t\t\t\"node\", n.Cfg.ShortName,\n2038: +\t\t\t\"chassis\", nodeType,\n2039: +\t\t\t\"warning\", warning)\n2040: +\t}\n2041: +}\n2042: +\n2043:  // Func that Places the Certificates in the right place and format.\n2044:  func (n *sros) createSROSCertificates() error {\n2045:  \tif *n.Cfg.Certificate.Issue {\n2046:  \t\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),\n2047:  \t\t\tclabconstants.PermissionsOpen)\n2048: @@ -1170,88 +1123,10 @@ func (n *sros) createSROSCertificates() error {\n2049:  \t\t}\n2050:  \t}\n2051:  \treturn nil\n2052:  }\n2053:  \n2054: -// createSROSConfigFiles handles config generation for the SR-SIM kind.\n2055: -// Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).\n2056: -func (n *sros) createSROSConfigFiles() error {\n2057: -\t// Get version from image before generating config\n2058: -\tif n.swVersion == nil {\n2059: -\t\tctx := context.Background()\n2060: -\t\tversion, err := n.srosVersionFromImage(ctx)\n2061: -\t\tif err != nil {\n2062: -\t\t\tn.swVersion = n.parseVersionString(srosDefaultVersion)\n2063: -\t\t\tlog.Warn(\"Failed to get SR OS version from image\",\n2064: -\t\t\t\t\"node\", n.Cfg.ShortName, \"version\", n.swVersion, \"error\", err)\n2065: -\t\t} else {\n2066: -\t\t\tn.swVersion = version\n2067: -\t\t\tlog.Info(\"Retrieved SR OS version from image\",\n2068: -\t\t\t\t\"node\", n.Cfg.ShortName,\n2069: -\t\t\t\t\"version\", fmt.Sprintf(\"%s.%s.%s\", version.Major, version.Minor, version.Build))\n2070: -\t\t}\n2071: -\t}\n2072: -\n2073: -\t// Path pointing to the target config file under configCf3 dir\n2074: -\tcf3CfgFile := filepath.Join(\n2075: -\t\tn.Cfg.LabDir,\n2076: -\t\tn.Cfg.Env[envNokiaSrosSlot],\n2077: -\t\tconfigCf3,\n2078: -\t\tstartupCfgName,\n2079: -\t)\n2080: -\tisPartial := clabutils.IsPartialConfigFile(n.Cfg.StartupConfig)\n2081: -\n2082: -\t// generate config and use that to boot node\n2083: -\tlog.Debug(\"Reading startup-config\", \"node\", n.Cfg.ShortName, \"startup-config\",\n2084: -\t\tn.Cfg.StartupConfig, \"isPartial\", isPartial)\n2085: -\n2086: -\tstartupConfig, err := n.buildStartupConfig(isPartial)\n2087: -\tif err != nil {\n2088: -\t\treturn err\n2089: -\t}\n2090: -\n2091: -\tif startupConfig == \"\" {\n2092: -\t\tlog.Debug(\n2093: -\t\t\t\"startup config is empty, skipping startup config file generation\",\n2094: -\t\t\t\"node\",\n2095: -\t\t\tn.Cfg.ShortName,\n2096: -\t\t)\n2097: -\t\treturn nil\n2098: -\t}\n2099: -\n2100: -\treturn n.GenerateConfig(cf3CfgFile, startupConfig)\n2101: -}\n2102: -\n2103: -// buildStartupConfig returns the full startup config string: either from user file (full config)\n2104: -// or from default + partial config generation. It does not return a template; the name is\n2105: -// historical.\n2106: -func (n *sros) buildStartupConfig(isPartial bool) (string, error) {\n2107: -\t// User provides full startup config\n2108: -\tif n.Cfg.StartupConfig != \"\" && !isPartial {\n2109: -\t\tc, err := os.ReadFile(n.Cfg.StartupConfig)\n2110: -\t\tif err != nil {\n2111: -\t\t\treturn \"\", err\n2112: -\t\t}\n2113: -\n2114: -\t\tcBuf, err := clabutils.SubstituteEnvsAndTemplate(bytes.NewReader(c), n.Cfg)\n2115: -\t\tif err != nil {\n2116: -\t\t\treturn \"\", err\n2117: -\t\t}\n2118: -\t\treturn cBuf.String(), nil\n2119: -\t}\n2120: -\n2121: -\t// Generate default config and optionally add partial config\n2122: -\tif err := n.addDefaultConfig(); err != nil {\n2123: -\t\treturn \"\", err\n2124: -\t}\n2125: -\tif err := n.addPartialConfig(); err != nil {\n2126: -\t\treturn \"\", err\n2127: -\t}\n2128: -\n2129: -\treturn string(n.startupCliCfg), nil\n2130: -}\n2131: -\n2132:  // SlotIsInteger checks if the slot string represents a valid integer.\n2133:  func SlotIsInteger(s string) bool {\n2134:  \t_, err := strconv.Atoi(s)\n2135:  \treturn err == nil\n2136:  }\n2137: @@ -1279,221 +1154,10 @@ func (n *sros) isCPM(cpm string) bool {\n2138:  \t}\n2139:  \n2140:  \treturn true\n2141:  }\n2142:  \n2143: -// prepareConfigTemplateData prepares all data needed for template selection and execution.\n2144: -// Service configs are filled from a single table-driven result: variant → getFullSnippetSet(v).\n2145: -func (n *sros) prepareConfigTemplateData() (*srosTemplateData, error) {\n2146: -\tb, err := n.banner()\n2147: -\tif err != nil {\n2148: -\t\treturn nil, err\n2149: -\t}\n2150: -\n2151: -\tcomponentConfig := \"\"\n2152: -\tif !isFullConfigFile(n.Cfg.StartupConfig) {\n2153: -\t\tcomponentConfig = n.generateComponentConfig()\n2154: -\t} else {\n2155: -\t\tlog.Debugf(\n2156: -\t\t\t\"SR-SIM node %q has non-partial startup-config defined, skipping component config gen\",\n2157: -\t\t\tn.Cfg.LongName,\n2158: -\t\t)\n2159: -\t}\n2160: -\n2161: -\tv := n.resolveConfigVariant()\n2162: -\tsnippets := getFullSnippetSet(v)\n2163: -\tconfigMode := string(v.Mode)\n2164: -\tif v.ForceClassic {\n2165: -\t\tlog.Warn(\n2166: -\t\t\t\"SAR-Hm nodes only support classic configuration mode. Overriding configuration mode to 'classic'\",\n2167: -\t\t\t\"node\",\n2168: -\t\t\tn.Cfg.LongName,\n2169: -\t\t\t\"node-type\",\n2170: -\t\t\tstrings.ToLower(n.Cfg.NodeType),\n2171: -\t\t)\n2172: -\t\tconfigMode = string(ConfigModeClassic)\n2173: -\t\tn.kindSpecificCfg().ConfigMode = ConfigModeClassic\n2174: -\t}\n2175: -\n2176: -\ttplData := &srosTemplateData{\n2177: -\t\t// Selection criteria\n2178: -\t\tNodeType:          strings.ToLower(n.Cfg.NodeType),\n2179: -\t\tConfigurationMode: configMode,\n2180: -\t\tSwVersion:         n.swVersion,\n2181: -\t\tIsSecureGrpc:      *n.Cfg.Certificate.Issue,\n2182: -\n2183: -\t\t// Node data\n2184: -\t\tName:            n.Cfg.ShortName,\n2185: -\t\tTLSKey:          n.Cfg.TLSKey,\n2186: -\t\tTLSCert:         n.Cfg.TLSCert,\n2187: -\t\tTLSAnchor:       n.Cfg.TLSAnchor,\n2188: -\t\tBanner:          b,\n2189: -\t\tIFaces:          map[string]tplIFace{},\n2190: -\t\tMgmtMTU:         0,\n2191: -\t\tMgmtIPMTU:       n.Runtime.Mgmt().MTU,\n2192: -\t\tComponentConfig: componentConfig,\n2193: -\n2194: -\t\t// Service configs from variant (single source of truth)\n2195: -\t\tSystemConfig:  snippets.SystemConfig,\n2196: -\t\tGRPCConfig:    snippets.GRPCConfig,\n2197: -\t\tSNMPConfig:    snippets.SNMPConfig,\n2198: -\t\tNetconfConfig: snippets.NetconfConfig,\n2199: -\t\tLoggingConfig: snippets.LoggingConfig,\n2200: -\t\tSSHConfig:     snippets.SSHConfig,\n2201: -\t}\n2202: -\n2203: -\tif n.Config().DNS != nil {\n2204: -\t\ttplData.DNSServers = append(tplData.DNSServers, n.Config().DNS.Servers...)\n2205: -\t}\n2206: -\n2207: -\tn.prepareSSHPubKeys(tplData)\n2208: -\n2209: -\tn.setVersionSpecificParams(tplData)\n2210: -\n2211: -\treturn tplData, nil\n2212: -}\n2213: -\n2214: -// isIXRNode returns true if this is an IXR node type (case-insensitive).\n2215: -func (n *sros) isIXRNode() bool {\n2216: -\treturn ixrRegexp.MatchString(n.Cfg.NodeType)\n2217: -}\n2218: -\n2219: -// isSARNode returns true if this is a SAR node type (case-insensitive).\n2220: -func (n *sros) isSARNode() bool {\n2221: -\treturn sarRegexp.MatchString(n.Cfg.NodeType)\n2222: -}\n2223: -\n2224: -// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).\n2225: -func (n *sros) isSARHmNode() bool {\n2226: -\treturn sarHmRegexp.MatchString(n.Cfg.NodeType)\n2227: -}\n2228: -\n2229: -// getTemplateForVariant returns the template string and name for the given config variant.\n2230: -// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= \"26\").\n2231: -func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {\n2232: -\t// Model-driven (or mixed treated as classic below when family is classic)\n2233: -\tif v.Mode == ConfigModeModelDriven {\n2234: -\t\t// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= \"26\"\n2235: -\t\t// { return cfgTplSROS26, \"clab-sros-config-sros26\" }\n2236: -\t\treturn cfgTplSROS25, \"clab-sros-config-sros25\"\n2237: -\t}\n2238: -\t// Classic (or mixed)\n2239: -\ttmpl = cfgTplClassic\n2240: -\ttplName = \"clab-sros-config-classic\"\n2241: -\tswitch v.Family {\n2242: -\tcase ConfigFamilyIXR:\n2243: -\t\treturn cfgTplClassicIxr, \"clab-sros-config-classic-ixr\"\n2244: -\tcase ConfigFamilySAR:\n2245: -\t\treturn cfgTplClassicSar, \"clab-sros-config-classic-sar\"\n2246: -\tdefault:\n2247: -\t\treturn tmpl, tplName\n2248: -\t}\n2249: -}\n2250: -\n2251: -// selectConfigTemplate chooses the config template from the config variant (mode + family).\n2252: -func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {\n2253: -\tv := n.resolveConfigVariant()\n2254: -\ttmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)\n2255: -\treturn template.New(tplName).\n2256: -\t\tFuncs(clabutils.CreateFuncs()).\n2257: -\t\tParse(tmpl)\n2258: -}\n2259: -\n2260: -// addDefaultConfig adds sros default configuration such as tls certs, gnmi/json-rpc, login-banner,\n2261: -// ssh keys.\n2262: -func (n *sros) addDefaultConfig() error {\n2263: -\t// Prepare all template data\n2264: -\ttplData, err := n.prepareConfigTemplateData()\n2265: -\tif err != nil {\n2266: -\t\treturn err\n2267: -\t}\n2268: -\n2269: -\t// Select appropriate template\n2270: -\tsrosCfgTpl, err := n.selectConfigTemplate(tplData)\n2271: -\tif err != nil {\n2272: -\t\treturn fmt.Errorf(\"failed to select config template: %w\", err)\n2273: -\t}\n2274: -\tlog.Debug(\"Prepare SR OS config template\", \"template\", srosCfgTpl.Name(),\n2275: -\t\t\"node\", n.Cfg.LongName,\n2276: -\t\t\"configuration-mode\", tplData.ConfigurationMode,\n2277: -\t\t\"node-type\", tplData.NodeType,\n2278: -\t\t\"secure-grpc\", tplData.IsSecureGrpc,\n2279: -\t\t\"sw-version\", tplData.SwVersion)\n2280: -\n2281: -\t// Execute template\n2282: -\tbuf := new(bytes.Buffer)\n2283: -\terr = srosCfgTpl.Execute(buf, tplData)\n2284: -\tif err != nil {\n2285: -\t\treturn err\n2286: -\t}\n2287: -\n2288: -\tif buf.Len() == 0 {\n2289: -\t\tlog.Warn(\n2290: -\t\t\t\"Buffer empty, template parsing error\",\n2291: -\t\t\t\"node\", n.Cfg.ShortName,\n2292: -\t\t\t\"template\", srosCfgTpl.Name(),\n2293: -\t\t)\n2294: -\t} else {\n2295: -\t\tlog.Debug(\"Additional default config parsed\",\n2296: -\t\t\t\"node\", n.Cfg.ShortName,\n2297: -\t\t\t\"template\", srosCfgTpl.Name())\n2298: -\t\tn.startupCliCfg = append(n.startupCliCfg, buf.String()...)\n2299: -\t}\n2300: -\n2301: -\treturn nil\n2302: -}\n2303: -\n2304: -// applyPartialConfig applies partial configuration to the SR OS.\n2305: -func (n *sros) addPartialConfig() error {\n2306: -\tif n.Cfg.StartupConfig != \"\" {\n2307: -\t\t// b holds the configuration to be applied to the node\n2308: -\t\tb := &bytes.Buffer{}\n2309: -\t\t// apply partial configs if partial config is used\n2310: -\t\tif clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM(\"\") {\n2311: -\t\t\tlog.Info(\"Adding configuration\",\n2312: -\t\t\t\t\"node\", n.Cfg.LongName,\n2313: -\t\t\t\t\"type\", \"partial\",\n2314: -\t\t\t\t\"source\", n.Cfg.StartupConfig)\n2315: -\n2316: -\t\t\tr, err := os.Open(n.Cfg.StartupConfig)\n2317: -\t\t\tif err != nil {\n2318: -\t\t\t\treturn err\n2319: -\t\t\t}\n2320: -\n2321: -\t\t\tdefer r.Close() // skipcq: GO-S2307\n2322: -\n2323: -\t\t\t_, err = io.Copy(b, r)\n2324: -\t\t\tif err != nil {\n2325: -\t\t\t\treturn err\n2326: -\t\t\t}\n2327: -\n2328: -\t\t\tconfigContent, err := clabutils.SubstituteEnvsAndTemplate(b, n.Cfg)\n2329: -\t\t\tif err != nil {\n2330: -\t\t\t\treturn err\n2331: -\t\t\t}\n2332: -\t\t\tif configContent.Len() == 0 {\n2333: -\t\t\t\tlog.Warn(\n2334: -\t\t\t\t\t\"Buffer empty, PARTIAL config template parsing error\",\n2335: -\t\t\t\t\t\"node\",\n2336: -\t\t\t\t\tn.Cfg.ShortName,\n2337: -\t\t\t\t)\n2338: -\t\t\t} else {\n2339: -\t\t\t\tlog.Debug(\"Additional PARTIAL config parsed\", \"node\",\n2340: -\t\t\t\t\tn.Cfg.ShortName, \"partial-config\", configContent.String())\n2341: -\t\t\t\tn.startupCliCfg = append(n.startupCliCfg, configContent.String()...)\n2342: -\t\t\t}\n2343: -\t\t} else {\n2344: -\t\t\tlog.Warn(\n2345: -\t\t\t\t\"Passed startup-config option, but it will not have any effect\",\n2346: -\t\t\t\t\"node\",\n2347: -\t\t\t\tn.Cfg.ShortName,\n2348: -\t\t\t)\n2349: -\t\t}\n2350: -\t}\n2351: -\treturn nil\n2352: -}\n2353: -\n2354:  func (n *sros) GetContainers(ctx context.Context) ([]clabruntime.GenericContainer, error) {\n2355:  \t// if not a distributed setup call regular GetContainers\n2356:  \tif n.isStandaloneNode() || n.isDistributedCardNode() {\n2357:  \t\treturn n.DefaultNode.GetContainers(ctx)\n2358:  \t}\n2359: @@ -1761,63 +1425,10 @@ func (n *sros) saveConfigWithAddr(ctx context.Context, addr string) error {\n2360:  \t)\n2361:  \n2362:  \treturn nil\n2363:  }\n2364:  \n2365: -// BuildPKIImportXML.\n2366: -func buildPKIImportXML(inputURL, outputFile, importType string) string {\n2367: -\taction := etree.NewElement(\"action\")\n2368: -\taction.CreateAttr(\"xmlns\", \"urn:ietf:params:xml:ns:yang:1\")\n2369: -\n2370: -\tadmin := action.CreateElement(\"admin\")\n2371: -\tadmin.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:oper-admin\")\n2372: -\n2373: -\timportElem := admin.CreateElement(\"system\").\n2374: -\t\tCreateElement(\"security\").\n2375: -\t\tCreateElement(\"pki\").\n2376: -\t\tCreateElement(\"import\")\n2377: -\n2378: -\t// Add import parameters\n2379: -\timportElem.CreateElement(\"input-url\").SetText(inputURL)\n2380: -\timportElem.CreateElement(\"output-file\").SetText(outputFile)\n2381: -\timportElem.CreateElement(\"type\").SetText(importType)\n2382: -\timportElem.CreateElement(\"format\").SetText(\"pem\")\n2383: -\tvar buf bytes.Buffer\n2384: -\taction.WriteTo(&buf, &etree.WriteSettings{\n2385: -\t\tCanonicalText:    false,\n2386: -\t\tCanonicalAttrVal: false,\n2387: -\t})\n2388: -\treturn buf.String()\n2389: -}\n2390: -\n2391: -// BuildTLSProfileXML builds the TLS profile configuration XML.\n2392: -func buildTLSProfileXML() string {\n2393: -\tconfig := etree.NewElement(\"config\")\n2394: -\tconfigure := config.CreateElement(\"configure\")\n2395: -\tconfigure.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:conf\")\n2396: -\tconfigure.CreateAttr(\"xmlns:nc\", \"urn:ietf:params:xml:ns:netconf:base:1.0\")\n2397: -\n2398: -\tcertProfile := configure.CreateElement(\"system\").\n2399: -\t\tCreateElement(\"security\").\n2400: -\t\tCreateElement(\"tls\").\n2401: -\t\tCreateElement(\"cert-profile\")\n2402: -\n2403: -\t// Set operation attribute\n2404: -\tcertProfile.CreateAttr(\"nc:operation\", \"merge\")\n2405: -\n2406: -\t// Add profile configuration\n2407: -\tcertProfile.CreateElement(\"cert-profile-name\").SetText(tlsCertProfileName)\n2408: -\tcertProfile.CreateElement(\"admin-state\").SetText(\"enable\")\n2409: -\n2410: -\tvar buf bytes.Buffer\n2411: -\tconfig.WriteTo(&buf, &etree.WriteSettings{\n2412: -\t\tCanonicalText:    false,\n2413: -\t\tCanonicalAttrVal: false,\n2414: -\t})\n2415: -\treturn buf.String()\n2416: -}\n2417: -\n2418:  // TLS bootstrap via NETCONF to enable secure gRPC.\n2419:  func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {\n2420:  \t// Always import PKI key and cert:\n2421:  \t// \t import \"cf3:\\node.key\" in PEM format as \"cf3:\\system-pki\\node.key\" (encrypted DER)\n2422:  \t//   import \"cf3:\\node.crt\" in PEM format as \"cf3:\\system-pki\\node.crt\" (encrypted DER)\n2423: @@ -1867,23 +1478,10 @@ func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {\n2424:  \t\t}\n2425:  \t}\n2426:  \treturn err\n2427:  }\n2428:  \n2429: -// isConfigClassic reports whether the node is in classic or mixed configuration mode.\n2430: -func (n *sros) isConfigClassic() bool {\n2431: -\tmode := n.kindSpecificCfg().ConfigMode\n2432: -\treturn mode == ConfigModeClassic || mode == ConfigModeMixed\n2433: -}\n2434: -\n2435: -// isFullConfigFile returns true if the config file doesn't contain .partial substring\n2436: -// and the config file is NOT nil (ie. startup config IS defined).\n2437: -// it is intended that the 'c' arg is n.Cfg.StartupConfig.\n2438: -func isFullConfigFile(c string) bool {\n2439: -\treturn c != \"\" && !clabutils.IsPartialConfigFile(c)\n2440: -}\n2441: -\n2442:  func (n *sros) IsHealthy(_ context.Context) (bool, error) {\n2443:  \tif !n.isCPM(\"\") {\n2444:  \t\treturn true, fmt.Errorf(\"node %q is not a CPM, healthcheck has no effect\", n.Cfg.LongName)\n2445:  \t}\n2446:  \t// non-partial user startup config might not have any netconf config\n2447: @@ -2082,67 +1680,10 @@ func (n *sros) MgmtIPAddr() (string, error) {\n2448:  \t\t\"no management IP address (IPv4 or IPv6) configured for node %q\",\n2449:  \t\tn.Cfg.LongName,\n2450:  \t)\n2451:  }\n2452:  \n2453: -// generateComponentConfig generates SR OS configuration for explicitly defined distributed\n2454: -// components or known integrated SR-SIM defaults. Power config is appended when supported.\n2455: -func (n *sros) generateComponentConfig() string {\n2456: -\tif !n.kindSpecificCfg().GenComponentConfig {\n2457: -\t\treturn \"\"\n2458: -\t}\n2459: -\tif n.isConfigClassic() {\n2460: -\t\treturn \"\"\n2461: -\t}\n2462: -\n2463: -\tcomponents := n.rootComponents\n2464: -\tif len(components) == 0 {\n2465: -\t\tif len(n.kindSpecificCfg().Components) > 1 || n.rootCtrName != \"\" {\n2466: -\t\t\treturn \"\"\n2467: -\t\t}\n2468: -\n2469: -\t\tlines := buildIntegratedComponentCfgLines(n.Cfg.NodeType, n.Cfg.Env)\n2470: -\t\tif len(lines) == 0 {\n2471: -\t\t\treturn \"\"\n2472: -\t\t}\n2473: -\t\treturn n.componentConfigFromLines(lines)\n2474: -\t}\n2475: -\n2476: -\tfor _, c := range components {\n2477: -\t\tslot := strings.ToUpper(strings.TrimSpace(c.Slot))\n2478: -\t\tif slot == slotAName || slot == slotBName {\n2479: -\t\t\tcontinue\n2480: -\t\t}\n2481: -\t\tif c.Type == \"\" {\n2482: -\t\t\tlog.Warn(\n2483: -\t\t\t\t\"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.\",\n2484: -\t\t\t\t\"node\",\n2485: -\t\t\t\tn.Cfg.ShortName,\n2486: -\t\t\t\t\"slot\",\n2487: -\t\t\t\tslot,\n2488: -\t\t\t)\n2489: -\t\t}\n2490: -\t}\n2491: -\n2492: -\tlines := buildComponentCfgLines(components, n.kindSpecificCfg().SFM)\n2493: -\treturn n.componentConfigFromLines(lines)\n2494: -}\n2495: -\n2496: -func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {\n2497: -\tpowerConfig := n.generatePowerConfig()\n2498: -\tif len(lines) == 0 && powerConfig == \"\" {\n2499: -\t\treturn \"\"\n2500: -\t}\n2501: -\n2502: -\tvar config strings.Builder\n2503: -\tfor _, l := range lines {\n2504: -\t\tconfig.WriteString(l.String())\n2505: -\t}\n2506: -\tconfig.WriteString(powerConfig)\n2507: -\treturn config.String()\n2508: -}\n2509: -\n2510:  // override to fetch CPM to avoid renaming the base node to CPM A.\n2511:  func (n *sros) GetContainerName() string {\n2512:  \tif n.isDistributedBaseNode() && n.cpmContainerName != \"\" {\n2513:  \t\treturn n.cpmContainerName\n2514:  \t}\n2515: @@ -2365,32 +1906,5 @@ func (n *sros) RestoreEndpoints(ctx context.Context) error {\n2516:  \tif err != nil {\n2517:  \t\treturn err\n2518:  \t}\n2519:  \treturn clabutils.LinkContainerNS(nsPath, n.Cfg.LongName)\n2520:  }\n2521: -\n2522: -func (n *sros) ensureNetnsRunning(ctx context.Context) error {\n2523: -\tswitch status := n.netnsNode.GetContainerStatus(ctx); status {\n2524: -\tcase clabruntime.Running:\n2525: -\t\t// The namespace holder intentionally survives regular node lifecycle operations.\n2526: -\tcase clabruntime.Created, clabruntime.Stopped:\n2527: -\t\tif err := n.netnsNode.Start(ctx); err != nil {\n2528: -\t\t\treturn fmt.Errorf(\"node %q network namespace container start error: %w\",\n2529: -\t\t\t\tn.Cfg.ShortName, err)\n2530: -\t\t}\n2531: -\tcase clabruntime.Paused:\n2532: -\t\tif err := n.Runtime.UnpauseContainer(ctx, n.netnsNode.Config().LongName); err != nil {\n2533: -\t\t\treturn fmt.Errorf(\"node %q network namespace container unpause error: %w\",\n2534: -\t\t\t\tn.Cfg.ShortName, err)\n2535: -\t\t}\n2536: -\tcase clabruntime.NotFound:\n2537: -\t\treturn fmt.Errorf(\n2538: -\t\t\t\"node %q network namespace container %q not found; recreate the node\",\n2539: -\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName,\n2540: -\t\t)\n2541: -\tdefault:\n2542: -\t\treturn fmt.Errorf(\"node %q network namespace container %q is %s\",\n2543: -\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName, status)\n2544: -\t}\n2545: -\n2546: -\treturn nil\n2547: -}\n2548: diff --git a/nodes/sros/sros_test.go b/nodes/sros/sros_test.go\n2549: index 29cace9..dd8aea6 100644\n\n(Showing lines 1750-2549 of 3945. Use offset=2550 to continue.)\n</content>",
    "title": "source/diff.txt",
    "metadata": {
      "preview": " \t\treturn nil, nil\n \t}\n \tif len(n.kindSpecificCfg().Components) > 1 {\n \t\treturn nil, fmt.Errorf(\n-\t\t\t\"expected at most one component override for standalone SR-SIM node %q\",\n+\t\t\t\"expected at most one component override for standalone SR-SIM node %q, \"+\n+\t\t\t\t\"or one component per slot %s for redundant type %q\",\n \t\t\tn.Cfg.ShortName,\n+\t\t\tstrings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), \"/\"),\n+\t\t\tn.Cfg.NodeType,\n \t\t)\n \t}\n \n \tslotA := n.kindSpecificCfg().Components[0]\n \n@@ -370,27 +381,11 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {\n \t\t\tn.Cfg.ShortName,\n \t\t)\n \t}\n \tvars[envNokiaSrosSlot] = slotName",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/diff.txt",
        "text": " \t\treturn nil, nil\n \t}\n \tif len(n.kindSpecificCfg().Components) > 1 {\n \t\treturn nil, fmt.Errorf(\n-\t\t\t\"expected at most one component override for standalone SR-SIM node %q\",\n+\t\t\t\"expected at most one component override for standalone SR-SIM node %q, \"+\n+\t\t\t\t\"or one component per slot %s for redundant type %q\",\n \t\t\tn.Cfg.ShortName,\n+\t\t\tstrings.Join(integratedSrosAllowedSlots(n.Cfg.NodeType), \"/\"),\n+\t\t\tn.Cfg.NodeType,\n \t\t)\n \t}\n \n \tslotA := n.kindSpecificCfg().Components[0]\n \n@@ -370,27 +381,11 @@ func (n *sros) setupStandaloneComponents() (map[string]string, error) {\n \t\t\tn.Cfg.ShortName,\n \t\t)\n \t}\n \tvars[envNokiaSrosSlot] = slotName\n \n-\tif slotA.Type != \"\" {\n-\t\tif isSingleSlotIntegratedSrosNodeType(n.Cfg.NodeType) {\n-\t\t\treturn nil, fmt.Errorf(\n-\t\t\t\t\"node %q type %q is integrated and does not support component card-type override\",\n-\t\t\t\tn.Cfg.ShortName,\n-\t\t\t\tn.Cfg.NodeType,\n-\t\t\t)\n-\t\t}\n-\t\tvars[envNokiaSrosCard] = slotA.Type\n-\t}\n-\n-\tif len(slotA.MDA) > 0 {\n-\t\tfor _, m := range slotA.MDA {\n-\t\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n-\t\t\tvars[key] = m.Type\n-\t\t}\n-\t}\n+\tsetComponentEnvVars(vars, slotA)\n \n \tmaps.Copy(vars, slotA.Env)\n \n \treturn vars, nil\n }\n@@ -625,39 +620,10 @@ func (n *sros) Delete(ctx context.Context) error {\n \terrs = append(errs, n.DefaultNode.Delete(ctx), n.netnsNode.Delete(ctx))\n \n \treturn errors.Join(errs...)\n }\n \n-// DeleteNetnsSymlink deletes the symlink file created for the container netns.\n-func (n *sros) DeleteNetnsSymlink() error {\n-\tvar errs []error\n-\n-\t// if it is the base node, then we need to delete the symlink for all the components.\n-\tif n.isDistributedBaseNode() {\n-\t\tfor _, componentNode := range n.componentNodes {\n-\t\t\terrs = append(errs, componentNode.DeleteNetnsSymlink())\n-\t\t}\n-\t\tif n.netnsNode != nil {\n-\t\t\terrs = append(errs, n.netnsNode.DeleteNetnsSymlink())\n-\t\t}\n-\t\terrs = append(errs, clabutils.DeleteNetnsSymlink(n.Cfg.LongName))\n-\t}\n-\n-\terrs = append(errs, n.DefaultNode.DeleteNetnsSymlink(), n.cleanupParkingNetNS())\n-\n-\treturn errors.Join(errs...)\n-}\n-\n-func (n *sros) cleanupParkingNetNS() error {\n-\tname := clabutils.ParkingNetnsName(n.Cfg.LongName)\n-\tif _, err := clabutils.GetNamedNetNS(name); err != nil {\n-\t\treturn nil\n-\t}\n-\n-\treturn netns.DeleteNamed(name)\n-}\n-\n func (n *sros) setupComponentNodes() error {\n \tif !n.isDistributedBaseNode() {\n \t\treturn nil\n \t}\n \n@@ -693,17 +659,16 @@ func (n *sros) setupComponentNodes() error {\n \t\tcomponentConfig.Fqdn = n.calcComponentFqdn(c.Slot)\n \t\tcomponentConfig.DNS = nil\n \t\tcomponentConfig.PortBindings = nil\n \t\tcomponentConfig.PortSet = nil\n \n-\t\t// add the component env to the componentConfig env\n-\t\tfor k, v := range c.Env {\n-\t\t\tcomponentConfig.Env[k] = v\n+\t\t// Component fields fill env keys the user did not set. Node env wins.\n+\t\tif componentConfig.Env == nil {\n+\t\t\tcomponentConfig.Env = map[string]string{}\n \t\t}\n-\n-\t\t// set component environment variables\n-\t\tn.setComponentEnvVars(componentConfig, c)\n+\t\tkeepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)\n+\t\t// Slot identifies this container. A node-level NOKIA_SROS_SLOT cannot apply to every card.\n \t\tcomponentConfig.Env[envNokiaSrosSlot] = c.Slot\n \n \t\t// adjust label based env vars\n \t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.NodeName)] = componentConfig.ShortName\n \t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.LongName)] = componentConfig.LongName\n@@ -716,10 +681,14 @@ func (n *sros) setupComponentNodes() error {\n \t\tcomponentConfig.Labels[clabconstants.NodeName] = componentConfig.ShortName\n \t\tcomponentConfig.Labels[clabconstants.LongName] = componentConfig.LongName\n \t\tcomponentConfig.Labels[clabconstants.RootNodeName] = n.Cfg.ShortName\n \t\tcomponentConfig.Labels[clabconstants.RootNodeLongName] = n.Cfg.LongName\n \n+\t\t// Preserve the topology env. Init must not snapshot the merged component env,\n+\t\t// or config generation would treat component flags as user overrides.\n+\t\tsrosNode.userEnv = maps.Clone(n.userEnv)\n+\n \t\t// init the component\n \t\terr = componentNode.Init(componentConfig)\n \t\tif err != nil {\n \t\t\treturn err\n \t\t}\n@@ -737,32 +706,10 @@ func (n *sros) setupComponentNodes() error {\n \t\tn.componentNodes = append(n.componentNodes, componentNode)\n \t}\n \treturn nil\n }\n \n-// setComponentEnvVars sets environment variables for a component.\n-func (n *sros) setComponentEnvVars(componentConfig *clabtypes.NodeConfig, c *Component) {\n-\tif c.Type != \"\" {\n-\t\tcomponentConfig.Env[envNokiaSrosCard] = c.Type\n-\t}\n-\n-\tfor _, x := range c.XIOM {\n-\t\tkey := fmt.Sprintf(\"%s_X%d\", envNokiaSrosXIOM, x.Slot)\n-\t\tcomponentConfig.Env[key] = x.Type\n-\t\t// add the nested MDA\n-\t\tfor _, m := range x.MDA {\n-\t\t\tkey := fmt.Sprintf(\"%s_X%d_%d\", envNokiaSrosMDA, x.Slot, m.Slot)\n-\t\t\tcomponentConfig.Env[key] = m.Type\n-\t\t}\n-\t}\n-\n-\tfor _, m := range c.MDA {\n-\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n-\t\tcomponentConfig.Env[key] = m.Type\n-\t}\n-}\n-\n // deployFabric deploys the distributed SR-SIM when the `components` key is present.\n func (n *sros) deployFabric(ctx context.Context, deployParams *clabnodes.DeployParams) error {\n \tnetnsConfig := n.netnsNode.Config()\n \n \tnetnsConfig.MgmtIPv4Address = n.Cfg.MgmtIPv4Address\n@@ -870,30 +817,20 @@ func (n *sros) isDistributedCardNode() bool {\n \n // isDistributedBaseNode returns true if this is the base node of a distributed\n // SR-SIM deployment. The base node orchestrates multiple component nodes.\n func (n *sros) isDistributedBaseNode() bool {\n \tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n-\t\treturn false\n+\t\treturn isRedundantIntegratedSrosComponents(n.Cfg.NodeType, n.kindSpecificCfg().Components)\n \t}\n \treturn len(n.kindSpecificCfg().Components) > 1\n }\n \n // isStandaloneNode returns true if this is a standalone (non-distributed) SR-SIM node.\n func (n *sros) isStandaloneNode() bool {\n \treturn !n.isDistributedBaseNode() && !n.isDistributedCardNode()\n }\n \n-// GetNSPath retrieves the Namespace Path.\n-func (n *sros) GetNSPath(ctx context.Context) (string, error) {\n-\tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.rootCtrName == \"\") {\n-\t\treturn n.DefaultNode.GetNSPath(ctx)\n-\t} else if n.isDistributedCardNode() {\n-\t\treturn n.Runtime.GetNSPath(ctx, n.rootCtrName)\n-\t}\n-\treturn n.netnsNode.GetNSPath(ctx)\n-}\n-\n // calcComponentName appends the line card suffix to the given node name.\n func (n *sros) calcComponentName(name, slot string) string {\n \tif n.renameDone {\n \t\treturn name\n \t}\n@@ -934,19 +871,18 @@ func (n *sros) cpmNode() (clabnodes.Node, error) {\n }\n \n // cpmSlot returns the Slot of the preferred CPM Node (used when Distributed mode).\n // It prefers slot A if present, otherwise returns slot B.\n func (n *sros) cpmSlot() (string, error) {\n-\t// Prefer slot A, fall back to slot B\n+\t// Prefer slot A, fall back to slot B. Slots are accepted in either case.\n \tfor _, comp := range n.kindSpecificCfg().Components {\n-\t\tif comp.Slot == slotAName {\n+\t\tif strings.EqualFold(comp.Slot, slotAName) {\n \t\t\treturn slotAName, nil\n \t\t}\n \t}\n-\t// Check for slot B as fallback\n \tfor _, comp := range n.kindSpecificCfg().Components {\n-\t\tif comp.Slot == slotBName {\n+\t\tif strings.EqualFold(comp.Slot, slotBName) {\n \t\t\treturn slotBName, nil\n \t\t}\n \t}\n \treturn \"\", fmt.Errorf(\"node %s: unable to determine default slot\", n.GetShortName())\n }\n@@ -1041,33 +977,10 @@ func (*sros) checkKernelVersion() error {\n \t\t)\n \t}\n \treturn nil\n }\n \n-// checkComponentSlotsConfig check the sros component slot config for validity.\n-func (n *sros) checkComponentSlotsConfig() error {\n-\t// check Slots are unique\n-\tcomponentNames := map[string]struct{}{}\n-\tfor _, component := range n.kindSpecificCfg().Components {\n-\t\t// convert slot to upper\n-\t\tslot := strings.ToUpper(component.Slot)\n-\t\t// check if slot exists\n-\t\t_, exists := componentNames[slot]\n-\t\tif exists {\n-\t\t\treturn fmt.Errorf(\n-\t\t\t\t\"node %s slot %s duplicate definition\",\n-\t\t\t\tn.GetShortName(),\n-\t\t\t\tcomponent.Slot,\n-\t\t\t)\n-\t\t}\n-\t\t// add to component names map\n-\t\tcomponentNames[component.Slot] = struct{}{}\n-\n-\t}\n-\treturn nil\n-}\n-\n func (n *sros) CheckDeploymentConditions(ctx context.Context) error {\n \t// perform the sros specific kernel version check\n \terr := n.checkKernelVersion()\n \tif err != nil {\n \t\treturn err\n@@ -1148,13 +1061,53 @@ func (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {\n \tlicensed := append([]byte(chassisInfoFileLicense), content...)\n \tif err := os.WriteFile(dstPath, licensed, clabconstants.PermissionsFileDefault); err != nil {\n \t\treturn fmt.Errorf(\"write %s: %w\", dstPath, err)\n \t}\n \tlog.Debug(\"Wrote chassis_info.json to lab dir\", \"node\", n.Cfg.ShortName, \"path\", dstPath)\n+\tn.warnUnsupportedComponents(content)\n \treturn nil\n }\n \n+// warnUnsupportedComponents validates the effective component configuration against the\n+// chassis_info.json extracted from this exact image. Validation is advisory and never blocks\n+// deploy.\n+func (n *sros) warnUnsupportedComponents(content []byte) {\n+\t// A distributed node validates once, from CPM A, to avoid duplicate warnings from CPM B.\n+\tif !n.isStandaloneNode() && !n.isCPM(slotAName) {\n+\t\treturn\n+\t}\n+\n+\tinfo, err := parseChassisInfo(content)\n+\tif err != nil {\n+\t\tlog.Warn(\"Could not validate SR-SIM components against chassis_info.json\",\n+\t\t\t\"node\", n.Cfg.ShortName, \"error\", err)\n+\t\treturn\n+\t}\n+\n+\tcomponents := n.rootComponents\n+\tif len(components) == 0 {\n+\t\tcomponents = n.kindSpecificCfg().Components\n+\t}\n+\n+\teffective := n.componentsForConfig(components)\n+\tif len(effective) == 0 {\n+\t\t// Environment variables can configure integrated hardware without a components entry.\n+\t\teffective = []*Component{n.componentForConfig(nil)}\n+\t}\n+\n+\tnodeType := n.Cfg.NodeType\n+\tif chassis := strings.TrimSpace(n.Cfg.Env[envNokiaSrosChassis]); chassis != \"\" {\n+\t\tnodeType = chassis\n+\t}\n+\tfor _, warning := range info.componentWarnings(nodeType, n.componentSFM(), effective) {\n+\t\tlog.Warn(\"SR-SIM component configuration may not be supported\",\n+\t\t\t\"node\", n.Cfg.ShortName,\n+\t\t\t\"chassis\", nodeType,\n+\t\t\t\"warning\", warning)\n+\t}\n+}\n+\n // Func that Places the Certificates in the right place and format.\n func (n *sros) createSROSCertificates() error {\n \tif *n.Cfg.Certificate.Issue {\n \t\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),\n \t\t\tclabconstants.PermissionsOpen)\n@@ -1170,88 +1123,10 @@ func (n *sros) createSROSCertificates() error {\n \t\t}\n \t}\n \treturn nil\n }\n \n-// createSROSConfigFiles handles config generation for the SR-SIM kind.\n-// Flow: version detection → buildStartupConfig (default + partial) → GenerateConfig(dst, config).\n-func (n *sros) createSROSConfigFiles() error {\n-\t// Get version from image before generating config\n-\tif n.swVersion == nil {\n-\t\tctx := context.Background()\n-\t\tversion, err := n.srosVersionFromImage(ctx)\n-\t\tif err != nil {\n-\t\t\tn.swVersion = n.parseVersionString(srosDefaultVersion)\n-\t\t\tlog.Warn(\"Failed to get SR OS version from image\",\n-\t\t\t\t\"node\", n.Cfg.ShortName, \"version\", n.swVersion, \"error\", err)\n-\t\t} else {\n-\t\t\tn.swVersion = version\n-\t\t\tlog.Info(\"Retrieved SR OS version from image\",\n-\t\t\t\t\"node\", n.Cfg.ShortName,\n-\t\t\t\t\"version\", fmt.Sprintf(\"%s.%s.%s\", version.Major, version.Minor, version.Build))\n-\t\t}\n-\t}\n-\n-\t// Path pointing to the target config file under configCf3 dir\n-\tcf3CfgFile := filepath.Join(\n-\t\tn.Cfg.LabDir,\n-\t\tn.Cfg.Env[envNokiaSrosSlot],\n-\t\tconfigCf3,\n-\t\tstartupCfgName,\n-\t)\n-\tisPartial := clabutils.IsPartialConfigFile(n.Cfg.StartupConfig)\n-\n-\t// generate config and use that to boot node\n-\tlog.Debug(\"Reading startup-config\", \"node\", n.Cfg.ShortName, \"startup-config\",\n-\t\tn.Cfg.StartupConfig, \"isPartial\", isPartial)\n-\n-\tstartupConfig, err := n.buildStartupConfig(isPartial)\n-\tif err != nil {\n-\t\treturn err\n-\t}\n-\n-\tif startupConfig == \"\" {\n-\t\tlog.Debug(\n-\t\t\t\"startup config is empty, skipping startup config file generation\",\n-\t\t\t\"node\",\n-\t\t\tn.Cfg.ShortName,\n-\t\t)\n-\t\treturn nil\n-\t}\n-\n-\treturn n.GenerateConfig(cf3CfgFile, startupConfig)\n-}\n-\n-// buildStartupConfig returns the full startup config string: either from user file (full config)\n-// or from default + partial config generation. It does not return a template; the name is\n-// historical.\n-func (n *sros) buildStartupConfig(isPartial bool) (string, error) {\n-\t// User provides full startup config\n-\tif n.Cfg.StartupConfig != \"\" && !isPartial {\n-\t\tc, err := os.ReadFile(n.Cfg.StartupConfig)\n-\t\tif err != nil {\n-\t\t\treturn \"\", err\n-\t\t}\n-\n-\t\tcBuf, err := clabutils.SubstituteEnvsAndTemplate(bytes.NewReader(c), n.Cfg)\n-\t\tif err != nil {\n-\t\t\treturn \"\", err\n-\t\t}\n-\t\treturn cBuf.String(), nil\n-\t}\n-\n-\t// Generate default config and optionally add partial config\n-\tif err := n.addDefaultConfig(); err != nil {\n-\t\treturn \"\", err\n-\t}\n-\tif err := n.addPartialConfig(); err != nil {\n-\t\treturn \"\", err\n-\t}\n-\n-\treturn string(n.startupCliCfg), nil\n-}\n-\n // SlotIsInteger checks if the slot string represents a valid integer.\n func SlotIsInteger(s string) bool {\n \t_, err := strconv.Atoi(s)\n \treturn err == nil\n }\n@@ -1279,221 +1154,10 @@ func (n *sros) isCPM(cpm string) bool {\n \t}\n \n \treturn true\n }\n \n-// prepareConfigTemplateData prepares all data needed for template selection and execution.\n-// Service configs are filled from a single table-driven result: variant → getFullSnippetSet(v).\n-func (n *sros) prepareConfigTemplateData() (*srosTemplateData, error) {\n-\tb, err := n.banner()\n-\tif err != nil {\n-\t\treturn nil, err\n-\t}\n-\n-\tcomponentConfig := \"\"\n-\tif !isFullConfigFile(n.Cfg.StartupConfig) {\n-\t\tcomponentConfig = n.generateComponentConfig()\n-\t} else {\n-\t\tlog.Debugf(\n-\t\t\t\"SR-SIM node %q has non-partial startup-config defined, skipping component config gen\",\n-\t\t\tn.Cfg.LongName,\n-\t\t)\n-\t}\n-\n-\tv := n.resolveConfigVariant()\n-\tsnippets := getFullSnippetSet(v)\n-\tconfigMode := string(v.Mode)\n-\tif v.ForceClassic {\n-\t\tlog.Warn(\n-\t\t\t\"SAR-Hm nodes only support classic configuration mode. Overriding configuration mode to 'classic'\",\n-\t\t\t\"node\",\n-\t\t\tn.Cfg.LongName,\n-\t\t\t\"node-type\",\n-\t\t\tstrings.ToLower(n.Cfg.NodeType),\n-\t\t)\n-\t\tconfigMode = string(ConfigModeClassic)\n-\t\tn.kindSpecificCfg().ConfigMode = ConfigModeClassic\n-\t}\n-\n-\ttplData := &srosTemplateData{\n-\t\t// Selection criteria\n-\t\tNodeType:          strings.ToLower(n.Cfg.NodeType),\n-\t\tConfigurationMode: configMode,\n-\t\tSwVersion:         n.swVersion,\n-\t\tIsSecureGrpc:      *n.Cfg.Certificate.Issue,\n-\n-\t\t// Node data\n-\t\tName:            n.Cfg.ShortName,\n-\t\tTLSKey:          n.Cfg.TLSKey,\n-\t\tTLSCert:         n.Cfg.TLSCert,\n-\t\tTLSAnchor:       n.Cfg.TLSAnchor,\n-\t\tBanner:          b,\n-\t\tIFaces:          map[string]tplIFace{},\n-\t\tMgmtMTU:         0,\n-\t\tMgmtIPMTU:       n.Runtime.Mgmt().MTU,\n-\t\tComponentConfig: componentConfig,\n-\n-\t\t// Service configs from variant (single source of truth)\n-\t\tSystemConfig:  snippets.SystemConfig,\n-\t\tGRPCConfig:    snippets.GRPCConfig,\n-\t\tSNMPConfig:    snippets.SNMPConfig,\n-\t\tNetconfConfig: snippets.NetconfConfig,\n-\t\tLoggingConfig: snippets.LoggingConfig,\n-\t\tSSHConfig:     snippets.SSHConfig,\n-\t}\n-\n-\tif n.Config().DNS != nil {\n-\t\ttplData.DNSServers = append(tplData.DNSServers, n.Config().DNS.Servers...)\n-\t}\n-\n-\tn.prepareSSHPubKeys(tplData)\n-\n-\tn.setVersionSpecificParams(tplData)\n-\n-\treturn tplData, nil\n-}\n-\n-// isIXRNode returns true if this is an IXR node type (case-insensitive).\n-func (n *sros) isIXRNode() bool {\n-\treturn ixrRegexp.MatchString(n.Cfg.NodeType)\n-}\n-\n-// isSARNode returns true if this is a SAR node type (case-insensitive).\n-func (n *sros) isSARNode() bool {\n-\treturn sarRegexp.MatchString(n.Cfg.NodeType)\n-}\n-\n-// isSARHmNode returns true if this is a SAR-Hm or SAR-Hmc node type (case-insensitive).\n-func (n *sros) isSARHmNode() bool {\n-\treturn sarHmRegexp.MatchString(n.Cfg.NodeType)\n-}\n-\n-// getTemplateForVariant returns the template string and name for the given config variant.\n-// swVersion is for future SR OS 26+ template selection (e.g. cfgTplSROS26 when Major >= \"26\").\n-func getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion) (tmpl string, tplName string) {\n-\t// Model-driven (or mixed treated as classic below when family is classic)\n-\tif v.Mode == ConfigModeModelDriven {\n-\t\t// Placeholder for version-specific template: if swVersion != nil && swVersion.Major >= \"26\"\n-\t\t// { return cfgTplSROS26, \"clab-sros-config-sros26\" }\n-\t\treturn cfgTplSROS25, \"clab-sros-config-sros25\"\n-\t}\n-\t// Classic (or mixed)\n-\ttmpl = cfgTplClassic\n-\ttplName = \"clab-sros-config-classic\"\n-\tswitch v.Family {\n-\tcase ConfigFamilyIXR:\n-\t\treturn cfgTplClassicIxr, \"clab-sros-config-classic-ixr\"\n-\tcase ConfigFamilySAR:\n-\t\treturn cfgTplClassicSar, \"clab-sros-config-classic-sar\"\n-\tdefault:\n-\t\treturn tmpl, tplName\n-\t}\n-}\n-\n-// selectConfigTemplate chooses the config template from the config variant (mode + family).\n-func (n *sros) selectConfigTemplate(tplData *srosTemplateData) (*template.Template, error) {\n-\tv := n.resolveConfigVariant()\n-\ttmpl, tplName := getTemplateForVariant(v, tplData.SwVersion)\n-\treturn template.New(tplName).\n-\t\tFuncs(clabutils.CreateFuncs()).\n-\t\tParse(tmpl)\n-}\n-\n-// addDefaultConfig adds sros default configuration such as tls certs, gnmi/json-rpc, login-banner,\n-// ssh keys.\n-func (n *sros) addDefaultConfig() error {\n-\t// Prepare all template data\n-\ttplData, err := n.prepareConfigTemplateData()\n-\tif err != nil {\n-\t\treturn err\n-\t}\n-\n-\t// Select appropriate template\n-\tsrosCfgTpl, err := n.selectConfigTemplate(tplData)\n-\tif err != nil {\n-\t\treturn fmt.Errorf(\"failed to select config template: %w\", err)\n-\t}\n-\tlog.Debug(\"Prepare SR OS config template\", \"template\", srosCfgTpl.Name(),\n-\t\t\"node\", n.Cfg.LongName,\n-\t\t\"configuration-mode\", tplData.ConfigurationMode,\n-\t\t\"node-type\", tplData.NodeType,\n-\t\t\"secure-grpc\", tplData.IsSecureGrpc,\n-\t\t\"sw-version\", tplData.SwVersion)\n-\n-\t// Execute template\n-\tbuf := new(bytes.Buffer)\n-\terr = srosCfgTpl.Execute(buf, tplData)\n-\tif err != nil {\n-\t\treturn err\n-\t}\n-\n-\tif buf.Len() == 0 {\n-\t\tlog.Warn(\n-\t\t\t\"Buffer empty, template parsing error\",\n-\t\t\t\"node\", n.Cfg.ShortName,\n-\t\t\t\"template\", srosCfgTpl.Name(),\n-\t\t)\n-\t} else {\n-\t\tlog.Debug(\"Additional default config parsed\",\n-\t\t\t\"node\", n.Cfg.ShortName,\n-\t\t\t\"template\", srosCfgTpl.Name())\n-\t\tn.startupCliCfg = append(n.startupCliCfg, buf.String()...)\n-\t}\n-\n-\treturn nil\n-}\n-\n-// applyPartialConfig applies partial configuration to the SR OS.\n-func (n *sros) addPartialConfig() error {\n-\tif n.Cfg.StartupConfig != \"\" {\n-\t\t// b holds the configuration to be applied to the node\n-\t\tb := &bytes.Buffer{}\n-\t\t// apply partial configs if partial config is used\n-\t\tif clabutils.IsPartialConfigFile(n.Cfg.StartupConfig) && n.isCPM(\"\") {\n-\t\t\tlog.Info(\"Adding configuration\",\n-\t\t\t\t\"node\", n.Cfg.LongName,\n-\t\t\t\t\"type\", \"partial\",\n-\t\t\t\t\"source\", n.Cfg.StartupConfig)\n-\n-\t\t\tr, err := os.Open(n.Cfg.StartupConfig)\n-\t\t\tif err != nil {\n-\t\t\t\treturn err\n-\t\t\t}\n-\n-\t\t\tdefer r.Close() // skipcq: GO-S2307\n-\n-\t\t\t_, err = io.Copy(b, r)\n-\t\t\tif err != nil {\n-\t\t\t\treturn err\n-\t\t\t}\n-\n-\t\t\tconfigContent, err := clabutils.SubstituteEnvsAndTemplate(b, n.Cfg)\n-\t\t\tif err != nil {\n-\t\t\t\treturn err\n-\t\t\t}\n-\t\t\tif configContent.Len() == 0 {\n-\t\t\t\tlog.Warn(\n-\t\t\t\t\t\"Buffer empty, PARTIAL config template parsing error\",\n-\t\t\t\t\t\"node\",\n-\t\t\t\t\tn.Cfg.ShortName,\n-\t\t\t\t)\n-\t\t\t} else {\n-\t\t\t\tlog.Debug(\"Additional PARTIAL config parsed\", \"node\",\n-\t\t\t\t\tn.Cfg.ShortName, \"partial-config\", configContent.String())\n-\t\t\t\tn.startupCliCfg = append(n.startupCliCfg, configContent.String()...)\n-\t\t\t}\n-\t\t} else {\n-\t\t\tlog.Warn(\n-\t\t\t\t\"Passed startup-config option, but it will not have any effect\",\n-\t\t\t\t\"node\",\n-\t\t\t\tn.Cfg.ShortName,\n-\t\t\t)\n-\t\t}\n-\t}\n-\treturn nil\n-}\n-\n func (n *sros) GetContainers(ctx context.Context) ([]clabruntime.GenericContainer, error) {\n \t// if not a distributed setup call regular GetContainers\n \tif n.isStandaloneNode() || n.isDistributedCardNode() {\n \t\treturn n.DefaultNode.GetContainers(ctx)\n \t}\n@@ -1761,63 +1425,10 @@ func (n *sros) saveConfigWithAddr(ctx context.Context, addr string) error {\n \t)\n \n \treturn nil\n }\n \n-// BuildPKIImportXML.\n-func buildPKIImportXML(inputURL, outputFile, importType string) string {\n-\taction := etree.NewElement(\"action\")\n-\taction.CreateAttr(\"xmlns\", \"urn:ietf:params:xml:ns:yang:1\")\n-\n-\tadmin := action.CreateElement(\"admin\")\n-\tadmin.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:oper-admin\")\n-\n-\timportElem := admin.CreateElement(\"system\").\n-\t\tCreateElement(\"security\").\n-\t\tCreateElement(\"pki\").\n-\t\tCreateElement(\"import\")\n-\n-\t// Add import parameters\n-\timportElem.CreateElement(\"input-url\").SetText(inputURL)\n-\timportElem.CreateElement(\"output-file\").SetText(outputFile)\n-\timportElem.CreateElement(\"type\").SetText(importType)\n-\timportElem.CreateElement(\"format\").SetText(\"pem\")\n-\tvar buf bytes.Buffer\n-\taction.WriteTo(&buf, &etree.WriteSettings{\n-\t\tCanonicalText:    false,\n-\t\tCanonicalAttrVal: false,\n-\t})\n-\treturn buf.String()\n-}\n-\n-// BuildTLSProfileXML builds the TLS profile configuration XML.\n-func buildTLSProfileXML() string {\n-\tconfig := etree.NewElement(\"config\")\n-\tconfigure := config.CreateElement(\"configure\")\n-\tconfigure.CreateAttr(\"xmlns\", \"urn:nokia.com:sros:ns:yang:sr:conf\")\n-\tconfigure.CreateAttr(\"xmlns:nc\", \"urn:ietf:params:xml:ns:netconf:base:1.0\")\n-\n-\tcertProfile := configure.CreateElement(\"system\").\n-\t\tCreateElement(\"security\").\n-\t\tCreateElement(\"tls\").\n-\t\tCreateElement(\"cert-profile\")\n-\n-\t// Set operation attribute\n-\tcertProfile.CreateAttr(\"nc:operation\", \"merge\")\n-\n-\t// Add profile configuration\n-\tcertProfile.CreateElement(\"cert-profile-name\").SetText(tlsCertProfileName)\n-\tcertProfile.CreateElement(\"admin-state\").SetText(\"enable\")\n-\n-\tvar buf bytes.Buffer\n-\tconfig.WriteTo(&buf, &etree.WriteSettings{\n-\t\tCanonicalText:    false,\n-\t\tCanonicalAttrVal: false,\n-\t})\n-\treturn buf.String()\n-}\n-\n // TLS bootstrap via NETCONF to enable secure gRPC.\n func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {\n \t// Always import PKI key and cert:\n \t// \t import \"cf3:\\node.key\" in PEM format as \"cf3:\\system-pki\\node.key\" (encrypted DER)\n \t//   import \"cf3:\\node.crt\" in PEM format as \"cf3:\\system-pki\\node.crt\" (encrypted DER)\n@@ -1867,23 +1478,10 @@ func (n *sros) tlsCertBootstrap(ctx context.Context, addr string) error {\n \t\t}\n \t}\n \treturn err\n }\n \n-// isConfigClassic reports whether the node is in classic or mixed configuration mode.\n-func (n *sros) isConfigClassic() bool {\n-\tmode := n.kindSpecificCfg().ConfigMode\n-\treturn mode == ConfigModeClassic || mode == ConfigModeMixed\n-}\n-\n-// isFullConfigFile returns true if the config file doesn't contain .partial substring\n-// and the config file is NOT nil (ie. startup config IS defined).\n-// it is intended that the 'c' arg is n.Cfg.StartupConfig.\n-func isFullConfigFile(c string) bool {\n-\treturn c != \"\" && !clabutils.IsPartialConfigFile(c)\n-}\n-\n func (n *sros) IsHealthy(_ context.Context) (bool, error) {\n \tif !n.isCPM(\"\") {\n \t\treturn true, fmt.Errorf(\"node %q is not a CPM, healthcheck has no effect\", n.Cfg.LongName)\n \t}\n \t// non-partial user startup config might not have any netconf config\n@@ -2082,67 +1680,10 @@ func (n *sros) MgmtIPAddr() (string, error) {\n \t\t\"no management IP address (IPv4 or IPv6) configured for node %q\",\n \t\tn.Cfg.LongName,\n \t)\n }\n \n-// generateComponentConfig generates SR OS configuration for explicitly defined distributed\n-// components or known integrated SR-SIM defaults. Power config is appended when supported.\n-func (n *sros) generateComponentConfig() string {\n-\tif !n.kindSpecificCfg().GenComponentConfig {\n-\t\treturn \"\"\n-\t}\n-\tif n.isConfigClassic() {\n-\t\treturn \"\"\n-\t}\n-\n-\tcomponents := n.rootComponents\n-\tif len(components) == 0 {\n-\t\tif len(n.kindSpecificCfg().Components) > 1 || n.rootCtrName != \"\" {\n-\t\t\treturn \"\"\n-\t\t}\n-\n-\t\tlines := buildIntegratedComponentCfgLines(n.Cfg.NodeType, n.Cfg.Env)\n-\t\tif len(lines) == 0 {\n-\t\t\treturn \"\"\n-\t\t}\n-\t\treturn n.componentConfigFromLines(lines)\n-\t}\n-\n-\tfor _, c := range components {\n-\t\tslot := strings.ToUpper(strings.TrimSpace(c.Slot))\n-\t\tif slot == slotAName || slot == slotBName {\n-\t\t\tcontinue\n-\t\t}\n-\t\tif c.Type == \"\" {\n-\t\t\tlog.Warn(\n-\t\t\t\t\"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.\",\n-\t\t\t\t\"node\",\n-\t\t\t\tn.Cfg.ShortName,\n-\t\t\t\t\"slot\",\n-\t\t\t\tslot,\n-\t\t\t)\n-\t\t}\n-\t}\n-\n-\tlines := buildComponentCfgLines(components, n.kindSpecificCfg().SFM)\n-\treturn n.componentConfigFromLines(lines)\n-}\n-\n-func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {\n-\tpowerConfig := n.generatePowerConfig()\n-\tif len(lines) == 0 && powerConfig == \"\" {\n-\t\treturn \"\"\n-\t}\n-\n-\tvar config strings.Builder\n-\tfor _, l := range lines {\n-\t\tconfig.WriteString(l.String())\n-\t}\n-\tconfig.WriteString(powerConfig)\n-\treturn config.String()\n-}\n-\n // override to fetch CPM to avoid renaming the base node to CPM A.\n func (n *sros) GetContainerName() string {\n \tif n.isDistributedBaseNode() && n.cpmContainerName != \"\" {\n \t\treturn n.cpmContainerName\n \t}\n@@ -2365,32 +1906,5 @@ func (n *sros) RestoreEndpoints(ctx context.Context) error {\n \tif err != nil {\n \t\treturn err\n \t}\n \treturn clabutils.LinkContainerNS(nsPath, n.Cfg.LongName)\n }\n-\n-func (n *sros) ensureNetnsRunning(ctx context.Context) error {\n-\tswitch status := n.netnsNode.GetContainerStatus(ctx); status {\n-\tcase clabruntime.Running:\n-\t\t// The namespace holder intentionally survives regular node lifecycle operations.\n-\tcase clabruntime.Created, clabruntime.Stopped:\n-\t\tif err := n.netnsNode.Start(ctx); err != nil {\n-\t\t\treturn fmt.Errorf(\"node %q network namespace container start error: %w\",\n-\t\t\t\tn.Cfg.ShortName, err)\n-\t\t}\n-\tcase clabruntime.Paused:\n-\t\tif err := n.Runtime.UnpauseContainer(ctx, n.netnsNode.Config().LongName); err != nil {\n-\t\t\treturn fmt.Errorf(\"node %q network namespace container unpause error: %w\",\n-\t\t\t\tn.Cfg.ShortName, err)\n-\t\t}\n-\tcase clabruntime.NotFound:\n-\t\treturn fmt.Errorf(\n-\t\t\t\"node %q network namespace container %q not found; recreate the node\",\n-\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName,\n-\t\t)\n-\tdefault:\n-\t\treturn fmt.Errorf(\"node %q network namespace container %q is %s\",\n-\t\t\tn.Cfg.ShortName, n.netnsNode.Config().LongName, status)\n-\t}\n-\n-\treturn nil\n-}\ndiff --git a/nodes/sros/sros_test.go b/nodes/sros/sros_test.go\nindex 29cace9..dd8aea6 100644",
        "lineStart": 1750,
        "lineEnd": 2549,
        "totalLines": 3945,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346743512,
      "end": 1792346743527
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_15030e2eb001lU5AOuPcHVO3SL",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15030d4a8001tXCn7rfV2C8Nea",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 82648,
    "input": 2588,
    "output": 26,
    "reasoning": 162,
    "cache": {
      "read": 79872,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_15030d4a8001tXCn7rfV2C8Nea",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346739880,
    "completed": 1792346743535
  },
  "parentID": "msg_1502f68f300142aYYM85hGexse",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 82648,
    "input": 2588,
    "output": 26,
    "reasoning": 162,
    "cache": {
      "read": 79872,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 37
step-start
{
  "type": "step-start",
  "id": "prt_15030ed300012PgDJ7OtzQ9bZs",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15030e2f8001rPQmYU8usSu7Xr"
}
Reasoning
I've now re-read the sros.go diff hunks thoroughly. Key moved-out items confirmed. Now the important remaining checks:

1. `warnUnsupportedComponents` — `n.componentForConfig(nil)` when `components` empty: `componentForConfig` clones nil → `cloneComponent(nil)` returns `&Component{}` — good, so it applies env overrides onto an empty component. But wait: for an integrated node configured via env vars only (`NOKIA_SROS_MDA_1`), `n.componentForConfig(nil)` produces component with MDA from env. But for the integrated node, `componentWarnings` checks MDA against `entry.MDA` — but not the card type from env (`NOKIA_SROS_CARD`)? componentWarnings only checks component.Type for slot A/B against FixedHWCfg or CPM list. For sr-1 (integrated, FixedHWCfg probably set to "iom-1"), an env `NOKIA_SROS_CARD=iom-2` would produce component.Type="iom-2" != FixedHWCfg → warning. Good.

But here's a subtlety: for the standalone integrated node WITHOUT components, `effective = []*Component{n.componentForConfig(nil)}` — Slot is "" → normalized to slotAName in componentWarnings. Fine.

However — for a distributed base node (CPM A of e.g. sr-7s), `components = n.rootComponents` (non-empty) — fine.

But hmm: for a distributed base node, `warnUnsupportedComponents` runs on CPM A only (line 2009 guard: `!n.isStandaloneNode() && !n.isCPM(slotAName)` return). For CPM A, `n.rootComponents` — is rootComponents set for component nodes? Yes, component nodes get rootComponents from base. And `n.componentForConfig(components)` applies node env — the CPM component node's userEnv is the base node's userEnv (copied at line 1865 in diff: `srosNode.userEnv = maps.Clone(n.userEnv)`). Good.

One more check: `warnUnsupportedComponents` is called from `writeChassisInfoToLabDir` after writing. But `writeChassisInfoToLabDir` is called in `createSROSFiles`, which is only invoked for standalone and CPM nodes (line 410 in PreDeploy: `n.isStandaloneNode() || (n.isDistributedCardNode() && n.isCPM(""))`). Wait, CPM A in distributed: PreDeploy condition `isStandaloneNode() || (isDistributedCardNode() && isCPM(""))`. isCPM("") returns true if slot matches A or B presumably. Let me verify isCPM semantics: line 1138 head: `func (n *sros) isCPM(cpm string) bool` — need to see. It probably returns true if node slot is A or B (or matching the arg). So CPM A and B both run PreDeploy → writeChassisInfoToLabDir runs on both, but warnUnsupportedComponents guards to CPM A only (or standalone). Good.

But wait — for distributed line cards: PreDeploy runs `isDistributedCardNode() && isCPM("")`? isCPM("") for a line card (slot 1) returns false presumably. Then who calls createSROSFiles for line cards? Line 605: `if n.isStandaloneNode() || n.isDistributedCardNode()` — that's probably in PostStart or another location. Let me check where createSROSFiles is called. Actually for line cards, config generation happens (buildComponentCfgLines) — from the README: "generateComponentConfig runs for integrated nodes and for the CPM of a distributed node". Hmm, but line cards DO get component config generated (card/MDA lines) — that's the "distributed line cards produce one line per card..." doc. So line cards DO call createSROSConfigFiles. So createSROSFiles must be called for line cards too — probably in PostStart or after they join netns. Let me grep for createSROSFiles call sites.

2. `n.componentSFM()` uses hardwareEnv → userEnv; for component nodes userEnv = base userEnv clone. OK.

3. Check the base `isDistributedBaseNode` change: base returned false for integrated types; now returns redundant check. This changes behavior: an integrated node with 2 components (A+B) is now distributed base. Fine.

4. Verify `verifyNokiaSrsimImage` unchanged-ish; skip.

5. The `power.go` diff hunk (1568-1587) — small; previously read.

6. `netns.go` diff (1471-1567) — read earlier; new netns config builds labels etc.

7. Check `componentForConfig(nil)` path: `cloneComponent(nil)` → `&Component{}`; `applyHardwareEnv(out, out.Env)` (out.Env nil → no-op); `applyHardwareEnv(out, n.hardwareEnv())`. Fine.

8. Now check `warnUserEnvOverrides` vs docs claim: "Node env overrides components: type, xiom, mda, per-component env, and the sfm key. When both set the same variable to different values, the environment variable wins and containerlab logs a warning naming that variable."

In `setupStandaloneComponents`, vars includes component type/XIOM/MDA and component env (component env overrides type fields). warnUserEnvOverrides(vars, n.userEnv) — compares each var key with user env. Good.

But note: in the standalone path, `n.Cfg.Env = MergeStringMaps(srosEnv, vars, n.Cfg.Env)` — `n.Cfg.Env` here still contains user env because userEnv was cloned from Cfg.Env BEFORE... wait, userEnv is a clone of Cfg.Env (maps.Clone) — so Cfg.Env itself is unchanged at that point. MergeStringMaps(srosEnv, vars, n.Cfg.Env): later maps win. So user env (in Cfg.Env) wins over vars and srosEnv. But srosEnv contains envNokiaSrosChassis and envNokiaSrosSystemBaseMac which were SET on the package-level srosEnv map — wait, srosEnv is a package-level var that gets mutated with per-node values (NodeType, mac). MergeStringMaps(srosEnv, vars, n.Cfg.Env) — srosEnv is first, so it has lowest precedence. Fine.

But there's a pre-existing race: package-level `srosEnv` map mutated per node (`srosEnv[envNokiaSrosChassis] = n.Cfg.NodeType; srosEnv[envNokiaSrosSystemBaseMac] = mac`). If node Init runs concurrently (containerlab may initialize nodes in parallel? I believe node Init is serial during topology load; but deploy might parallelize). Pre-existing anyway. Let me check base had the same pattern — base line? The diff didn't show changes to those lines (they're context). So pre-existing; not a finding.

9. `srosVersionFromImage` — version detection moved? createSROSConfigFiles moved to config.go with version detection retained (per prior summary). Fine.

10. One thing to check in config.go: `getTemplateForVariant(v, tplData.SwVersion)` — swVersion unused except comment. `selectConfigTemplate` ignores... it uses tplData.SwVersion. Fine.

11. Check the `n.setupStandaloneComponents` single-slot integrated override behavior change: previously (base) `isSingleSlotIntegratedSrosNodeType` → error when Type set. Now allowed: sets NOKIA_SROS_CARD and generateIntegratedComponentConfig skips generation. But wait — this is a behavior change: previously, a component type on an integrated single-slot node was an error; now it silently skips config generation. Docs updated to describe this. OK.

But now consider: for `ixr-r6` single component `{Slot: slotAName, Type: "cpiom-ixr-r6"}` (as in the old test) — now: setupStandaloneComponents sets vars[envNokiaSrosCard]="cpiom-ixr-r6", slot=A. isStandaloneNode → true (single component). generateIntegratedComponentConfig → card set → skip generation, return "". The test asserts `assert.Empty(t, n.generateComponentConfig())`. Good.

12. Now — the double-slot redundant integrated: ixr-r6 with A+B → distributed base → component nodes; each component node's env has NOKIA_SROS_CARD unset (unless type set) → each CPM component node runs generateIntegratedComponentConfig → generates card 1 iom-ixr-r6 config. Matches test cfgA/cfgB.

But wait — integratedComponentOverride for a component node: `n.rootCtrName != ""` → slot := n.Cfg.Env[envNokiaSrosSlot] ("A" or "B"), find rootComponents entry with EqualFold slot → component for that slot. Good.

13. Check `isCPM`: let me read it (line 1138 head). And find where createSROSFiles is invoked for line cards. Let me grep.
Let me check `isCPM` semantics and where `createSROSFiles` is invoked (to confirm line cards still get config generation).
grep · completed

Input

{
  "path": "/source/head/nodes/sros",
  "pattern": "createSROSFiles|func \\(n \\*sros\\) isCPM"
}

Output

Found 4 matches
/source/head/nodes/sros/sros.go:
  Line 447: 		return n.createSROSFiles(ctx)

  Line 999: func (n *sros) createSROSFiles(ctx context.Context) error {

  Line 1138: func (n *sros) isCPM(cpm string) bool {


/source/head/nodes/sros/README.md:
  Line 48: During PreDeploy, `createSROSFiles` reads `/opt/nokia/chassis_info.json` from the node image and writes it to `n.Cfg.LabDir/chassis_info.json`, prefixed with the license header. Failure to read the file is logged and does not stop deployment.
Tool metadata
{
  "type": "tool",
  "id": "prt_150312a44001oqICJICqg6nzDR",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15030e2f8001rPQmYU8usSu7Xr",
  "callID": "call_84b912ee1d1640a7ab348132",
  "tool": "grep",
  "state": {
    "status": "completed",
    "input": {
      "path": "/source/head/nodes/sros",
      "pattern": "createSROSFiles|func \\(n \\*sros\\) isCPM"
    },
    "output": "Found 4 matches\n/source/head/nodes/sros/sros.go:\n  Line 447: \t\treturn n.createSROSFiles(ctx)\n\n  Line 999: func (n *sros) createSROSFiles(ctx context.Context) error {\n\n  Line 1138: func (n *sros) isCPM(cpm string) bool {\n\n\n/source/head/nodes/sros/README.md:\n  Line 48: During PreDeploy, `createSROSFiles` reads `/opt/nokia/chassis_info.json` from the node image and writes it to `n.Cfg.LabDir/chassis_info.json`, prefixed with the license header. Failure to read the file is logged and does not stop deployment.\n",
    "title": "createSROSFiles|func \\(n \\*sros\\) isCPM",
    "metadata": {
      "matches": 4,
      "truncated": false
    },
    "time": {
      "start": 1792346761802,
      "end": 1792346761815
    }
  }
}
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/sros.go",
  "limit": 60,
  "offset": 1105
}

Output

<path>/source/head/nodes/sros/sros.go</path>
<type>file</type>
<content>
1105: 			"warning", warning)
1106: 	}
1107: }
1108: 
1109: // Func that Places the Certificates in the right place and format.
1110: func (n *sros) createSROSCertificates() error {
1111: 	if *n.Cfg.Certificate.Issue {
1112: 		clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),
1113: 			clabconstants.PermissionsOpen)
1114: 		keyPath := filepath.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3, tlsKeyFile)
1115: 		if err := clabutils.CreateFile(keyPath, n.Config().TLSKey); err != nil {
1116: 			return err
1117: 		}
1118: 
1119: 		certPath := filepath.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3, tlsCertFile)
1120: 		err := clabutils.CreateFile(certPath, n.Config().TLSCert)
1121: 		if err != nil {
1122: 			return err
1123: 		}
1124: 	}
1125: 	return nil
1126: }
1127: 
1128: // SlotIsInteger checks if the slot string represents a valid integer.
1129: func SlotIsInteger(s string) bool {
1130: 	_, err := strconv.Atoi(s)
1131: 	return err == nil
1132: }
1133: 
1134: // Check if a container is a CPM.
1135: // isCPM checks if a container is a CPM (Control Processing Module).
1136: // Returns false if the slot is a linecard (integer slot).
1137: // If a specific CPM name is provided, returns false if this is a different CPM.
1138: func (n *sros) isCPM(cpm string) bool {
1139: 	slot, exists := n.Cfg.Env[envNokiaSrosSlot]
1140: 	if !exists {
1141: 		// No slot specified - this is a CPM
1142: 		return true
1143: 	}
1144: 
1145: 	// If slot is an integer, it's a linecard, not a CPM
1146: 	if SlotIsInteger(slot) {
1147: 		return false
1148: 	}
1149: 
1150: 	// Slot is non-integer (CPM slot). If a specific CPM was requested,
1151: 	// check if this is that CPM
1152: 	if cpm != "" && !strings.EqualFold(slot, cpm) {
1153: 		return false
1154: 	}
1155: 
1156: 	return true
1157: }
1158: 
1159: func (n *sros) GetContainers(ctx context.Context) ([]clabruntime.GenericContainer, error) {
1160: 	// if not a distributed setup call regular GetContainers
1161: 	if n.isStandaloneNode() || n.isDistributedCardNode() {
1162: 		return n.DefaultNode.GetContainers(ctx)
1163: 	}
1164: 

(Showing lines 1105-1164 of 1910. Use offset=1165 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_150312ae7001euAs8x3hkLBkU3",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15030e2f8001rPQmYU8usSu7Xr",
  "callID": "call_319285aee12443b692cf0949",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/sros.go",
      "limit": 60,
      "offset": 1105
    },
    "output": "<path>/source/head/nodes/sros/sros.go</path>\n<type>file</type>\n<content>\n1105: \t\t\t\"warning\", warning)\n1106: \t}\n1107: }\n1108: \n1109: // Func that Places the Certificates in the right place and format.\n1110: func (n *sros) createSROSCertificates() error {\n1111: \tif *n.Cfg.Certificate.Issue {\n1112: \t\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),\n1113: \t\t\tclabconstants.PermissionsOpen)\n1114: \t\tkeyPath := filepath.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3, tlsKeyFile)\n1115: \t\tif err := clabutils.CreateFile(keyPath, n.Config().TLSKey); err != nil {\n1116: \t\t\treturn err\n1117: \t\t}\n1118: \n1119: \t\tcertPath := filepath.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3, tlsCertFile)\n1120: \t\terr := clabutils.CreateFile(certPath, n.Config().TLSCert)\n1121: \t\tif err != nil {\n1122: \t\t\treturn err\n1123: \t\t}\n1124: \t}\n1125: \treturn nil\n1126: }\n1127: \n1128: // SlotIsInteger checks if the slot string represents a valid integer.\n1129: func SlotIsInteger(s string) bool {\n1130: \t_, err := strconv.Atoi(s)\n1131: \treturn err == nil\n1132: }\n1133: \n1134: // Check if a container is a CPM.\n1135: // isCPM checks if a container is a CPM (Control Processing Module).\n1136: // Returns false if the slot is a linecard (integer slot).\n1137: // If a specific CPM name is provided, returns false if this is a different CPM.\n1138: func (n *sros) isCPM(cpm string) bool {\n1139: \tslot, exists := n.Cfg.Env[envNokiaSrosSlot]\n1140: \tif !exists {\n1141: \t\t// No slot specified - this is a CPM\n1142: \t\treturn true\n1143: \t}\n1144: \n1145: \t// If slot is an integer, it's a linecard, not a CPM\n1146: \tif SlotIsInteger(slot) {\n1147: \t\treturn false\n1148: \t}\n1149: \n1150: \t// Slot is non-integer (CPM slot). If a specific CPM was requested,\n1151: \t// check if this is that CPM\n1152: \tif cpm != \"\" && !strings.EqualFold(slot, cpm) {\n1153: \t\treturn false\n1154: \t}\n1155: \n1156: \treturn true\n1157: }\n1158: \n1159: func (n *sros) GetContainers(ctx context.Context) ([]clabruntime.GenericContainer, error) {\n1160: \t// if not a distributed setup call regular GetContainers\n1161: \tif n.isStandaloneNode() || n.isDistributedCardNode() {\n1162: \t\treturn n.DefaultNode.GetContainers(ctx)\n1163: \t}\n1164: \n\n(Showing lines 1105-1164 of 1910. Use offset=1165 to continue.)\n</content>",
    "title": "source/head/nodes/sros/sros.go",
    "metadata": {
      "preview": "\t\t\t\"warning\", warning)\n\t}\n}\n\n// Func that Places the Certificates in the right place and format.\nfunc (n *sros) createSROSCertificates() error {\n\tif *n.Cfg.Certificate.Issue {\n\t\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),\n\t\t\tclabconstants.PermissionsOpen)\n\t\tkeyPath := filepath.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3, tlsKeyFile)\n\t\tif err := clabutils.CreateFile(keyPath, n.Config().TLSKey); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tcertPath := filepath.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3, tlsCertFile)\n\t\terr := clabutils.CreateFile(certPath, n.Config().TLSCert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/sros.go",
        "text": "\t\t\t\"warning\", warning)\n\t}\n}\n\n// Func that Places the Certificates in the right place and format.\nfunc (n *sros) createSROSCertificates() error {\n\tif *n.Cfg.Certificate.Issue {\n\t\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),\n\t\t\tclabconstants.PermissionsOpen)\n\t\tkeyPath := filepath.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3, tlsKeyFile)\n\t\tif err := clabutils.CreateFile(keyPath, n.Config().TLSKey); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tcertPath := filepath.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3, tlsCertFile)\n\t\terr := clabutils.CreateFile(certPath, n.Config().TLSCert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// SlotIsInteger checks if the slot string represents a valid integer.\nfunc SlotIsInteger(s string) bool {\n\t_, err := strconv.Atoi(s)\n\treturn err == nil\n}\n\n// Check if a container is a CPM.\n// isCPM checks if a container is a CPM (Control Processing Module).\n// Returns false if the slot is a linecard (integer slot).\n// If a specific CPM name is provided, returns false if this is a different CPM.\nfunc (n *sros) isCPM(cpm string) bool {\n\tslot, exists := n.Cfg.Env[envNokiaSrosSlot]\n\tif !exists {\n\t\t// No slot specified - this is a CPM\n\t\treturn true\n\t}\n\n\t// If slot is an integer, it's a linecard, not a CPM\n\tif SlotIsInteger(slot) {\n\t\treturn false\n\t}\n\n\t// Slot is non-integer (CPM slot). If a specific CPM was requested,\n\t// check if this is that CPM\n\tif cpm != \"\" && !strings.EqualFold(slot, cpm) {\n\t\treturn false\n\t}\n\n\treturn true\n}\n\nfunc (n *sros) GetContainers(ctx context.Context) ([]clabruntime.GenericContainer, error) {\n\t// if not a distributed setup call regular GetContainers\n\tif n.isStandaloneNode() || n.isDistributedCardNode() {\n\t\treturn n.DefaultNode.GetContainers(ctx)\n\t}\n",
        "lineStart": 1105,
        "lineEnd": 1164,
        "totalLines": 1910,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346761965,
      "end": 1792346761982
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_150312b02001ADNxieT2JW8iVX",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15030e2f8001rPQmYU8usSu7Xr",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 95168,
    "input": 10695,
    "output": 95,
    "reasoning": 1946,
    "cache": {
      "read": 82432,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_15030e2f8001rPQmYU8usSu7Xr",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346743544,
    "completed": 1792346761990
  },
  "parentID": "msg_1502f68f300142aYYM85hGexse",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 95168,
    "input": 10695,
    "output": 95,
    "reasoning": 1946,
    "cache": {
      "read": 82432,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
User · 38
compaction
{
  "type": "compaction",
  "id": "prt_150312b09001lQ39I686A4Y8V6",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150312b08001ahr6wR8Fh3qA3c",
  "auto": true,
  "overflow": false,
  "tail_start_id": "msg_15030c0020015g2EZ0bcwZEBeP"
}
Message metadata
{
  "role": "user",
  "id": "msg_150312b08001ahr6wR8Fh3qA3c",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346761992
  },
  "summary": {
    "diffs": []
  },
  "agent": "tofarev",
  "model": {
    "providerID": "tofarev",
    "modelID": "zai-org/GLM-5.3-Flash"
  }
}
Assistant · 39
step-start
{
  "type": "step-start",
  "id": "prt_15031337d001h1d4cEnCpOXV0H",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150312b1f001kOmsjyLVrSK4Er"
}
Reasoning
Let me combine the prior summary with the new conversation progress. The conversation continued: read diff 2548-3940, 3941-3945 (EOF), manifest verified, grep of diff --git (31 matches, all file hunks present, diff truncated at end of sros_schema_gen.sh hunk — actually hunk complete per head file), docs hunk read (84-311), head/utils/sros_schema_gen.sh read fully (26 lines), head/nodes/sros files exist, globbed /source/head dirs, read chassis_info.go (truncated at 57), component.go (truncated), component_config.go (truncated at ~77), sros.go 255-435ish and 800-1060, grep for checkComponentSlotsConfig etc. — confirmed moved code. Docs hunks read: new components `type` behavior (NOKIA_SROS_CARD skips generated config), env overrides components.

Updated facts:
- diff.txt has 31 `diff --git` matches — all changed paths have hunks; diff.txt ends at line 3945, truncated mid-hunk of utils/sros_schema_gen.sh but head file read complete (26 lines).
- Files under /source/head are available: /source/head/utils/sros_schema_gen.sh (previously thought only /source paths; head snapshot path prefix is /source/head/).
- Full manifest verified: 31 changed paths (listed through sros_schema_gen.sh etc.).
- New robot tests: tests/13-srsim/14-srsim-new-chassis.robot (new), tests/srsim.robot (new shared resource at tests/ root, not 13-srsim).
- sros_schema_gen.sh: jq now filters chassis_info entries to node-type enum, adds fixed_mdas to mda enums.
- isDistributedBaseNode: integrated → isRedundantIntegratedSrosComponents; else len(components) > 1. isDistributedCardNode: envNokiaSrosSlot set and no components.
- sar-10x with components A/B: not integrated → isDistributedBaseNode true (len>1). Works.

Next moves: read remaining head files/diff hunks not yet fully seen (schema hunks 3000-3122, robot test diffs 3123-3894, README hunks 130-311, chassis_info_test.go 538-642, component.go diff 643-851, config.go diff 1128-1470, netns 1471-1567, power 1568-1587, sros.go 1588-2547, sros_test.go 2548-2881, template 2882-2951, variant 2952-2999), assemble final review.

Actually prior summary says diff lines 1-1200, 1201-2500, 2501-2548 were read, plus 2548-3940, 3941-3945, 84-311, 3895-3945. But in this conversation, the assistant states it "finished the sros_test.go, schema, robot-test, and new-lab hunks" — so those were read. And docs hunks read at 84-311. Some segments (3456-3894, i.e., test diffs 09-13 and new labs) may not have been fully seen? The assistant said it finished the robot-test and new-lab hunks. The grep output truncated at line 3456 for diff list. The prior summary claimed reading 1-2500, and this conversation read 2548-3945 plus 84-311. So basically the entire diff is now read (1-3945), except possibly lines 2548-2881 (sros_test.go) were read as part of the first chunk in this conversation (2548-3940). Yes.

So diff fully read. Remaining: assemble final review; maybe verify a few head files (chassis_info.go rest beyond line 57, component.go rest, component_config.go rest — but those were read in prior session per prior summary... prior summary said truncated reads; but content captured in prior summary facts). The conversation this time read chassis_info.go again truncated at 57, component.go truncated, component_config.go truncated at ~77.

Remaining active work: finalize findings and output the trusted result schema with limitation. Also possibly check sros.go line 668 region / setupComponentNodes (keepUserEnv), and the SFM inline warn duplication (noted as P4).

Write the summary now.
## Objective
- Perform a source-only read-only code review of the PR snapshot at `/source` (containerlab repo), covering all 31 changed paths, callers/tests/docs/schema, and return the trusted result schema with disclosed limitation that tests were not executed.

## Important Details
- Head: `d44c69f72ab156474197f12b6fc1407b3f8a65c4`; base/mergeBase: `84cf630e6eedd662d9742fbcd6158a91372e3a56`.
- Permalink roots: head=`https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/`, base=`https://github.com/srl-labs/containerlab/blob/84cf630e6eedd662d9742fbcd6158a91372e3a56/`.
- Tooling constraint: plain `read("/source")` is denied; must read explicit file paths. Head snapshot lives under `/source/head/...` (e.g. `/source/head/utils/sros_schema_gen.sh`, `/source/head/nodes/sros/*`). `utils/sros_schema_gen.sh` is NOT at `/source/utils/...` — must use `/source/head/` prefix.
- Standards applied (from `standards.json`): `.cursor/rules/karpathy-guidelines.mdc` (surgical changes) and `.cursor/rules/ponytail.mdc` (simplest solution, shortest diff).
- PR theme: major refactor of `nodes/sros` — code moved out of `sros.go` into new/split files (`chassis_info.go`, `component.go`, `component_config.go`, `config.go`, `netns.go`, `power.go`, `template.go`, `variant.go`), new chassis_info-driven component validation with warnings, SR-SIM components model (CPM/line-card/XIOM/MDA), integrated vs distributed node handling, new chassis types (`ixr-e2sc`, `ixr-e3`, `sar-10x`), and CI test-matrix sharding.
- **Diff is now fully read (lines 1–3945)**: 31 `diff --git` hunks confirmed present via grep — all 31 manifest paths covered. diff.txt ends at line 3945 (mid-hunk of `utils/sros_schema_gen.sh`), but the complete head file was read separately, so no information is missing.
- Manifest (31 paths, verified): M `.github/workflows/srsim-tests.yml`, M `docs/manual/kinds/sros.md`, M `nodes/sros/README.md`, M `nodes/sros/chassis_info.go`, A `nodes/sros/chassis_info_test.go`, M `nodes/sros/{component.go,component_config.go,config.go,netns.go,power.go,sros.go,sros_test.go,template.go,variant.go}`, M `schemas/clab.schema.json`, M `tests/13-srsim/{01,03,04,05,06,07,08}-*.robot` + new robot files/tests, A `tests/srsim.robot` (shared resource lives at `tests/srsim.robot`, NOT in 13-srsim), M `utils/sros_schema_gen.sh`.
- Key new facts verified this session:
  - `sros_schema_gen.sh` (26 lines, complete): jq now builds `$node_types` by finding the first schema enum containing `ixr-e2n`, filters chassis_info.json entries to those keys (`with_entries`), and adds `fixed_mdas` map values to the `$mdas` set; updates enums for `sros-cpm-types`, `sros-card-types`, `sros-sfm-types`, `sros-mda-types`, `sros-xiom-types`.
  - `docs/manual/kinds/sros.md` hunk (diff lines 84–130): docs rewritten — integrated nodes accept one `components` entry (ixr-r6 accepts A and B; two ixr-r6 entries = dual-CPIOM distributed); a components `type` sets `NOKIA_SROS_CARD` and makes containerlab skip generated card/MDA config; node `env` overrides `components`.
  - Node classification (head `sros.go` ~800–830): `isDistributedCardNode()` = `envNokiaSrosSlot` set AND zero components; `isDistributedBaseNode()` = for integrated types `isRedundantIntegratedSrosComponents(...)` else `len(components) > 1`; `isStandaloneNode()` = neither. This routes redundant ixr-r6 (A+B) to the distributed branch even though `setupStandaloneComponents` errors on >1 components — consistent with the "redundant_integrated_components_are_distributed" test. Non-integrated `sar-10x` with 2 components (A/B CPMs) classifies as distributed base via `len(components) > 1`.
  - `checkComponentSlotsConfig` was MOVED from base `sros.go` (~1046) to `component.go` — its lack of TrimSpace before ToUpper is pre-existing, not PR-introduced.
  - Init (head `sros.go` ~255–320): snapshots `userEnv` before component/SFM flags; `envAlreadyResolved` guard prevents SFM warn per component card; SFM warn inline (lines 279–297) duplicates `warnUserEnvOverrides` semantics for one key (potential P4 refactor: pass `{envNokiaSrosSFM: sfm}` to the helper); `srosEnv` package-level map mutation per node is pre-existing.
  - `keepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)` called at head `sros.go:668` for component nodes; `warnUserEnvOverrides` at line 328.
- Candidate findings so far (not finalized): package-level `srosEnv` map mutation (pre-existing, potential race); `warnUserEnvOverrides` inline duplication for SFM (P4); `checkComponentSlotsConfig` whitespace edge (pre-existing); distributed-base container existence question for gnmic queries (`clab-<lab>-sar-10x` targeted in new-chassis robot test) — runtime behavior, presumed working per author.
- Workflow change: CI matrix now 5 named shards (basic/lifecycle/components/provisioning/apply); `SRSIM_IMAGE_TAG: 26.7.R1`; removed "Sanitize test-suite name" step.
- Robot tests refactored to shared `Resource ../srsim.robot` with `Deploy SR-SIM Lab` / `Destroy SR-SIM Lab` keywords (verified: `Run And Return Rc And Output    ${CLAB_BIN} --runtime ${runtime} deploy|destroy -t ${topology} [--cleanup]`); new `tests/13-srsim/14-srsim-new-chassis.robot` gated by `Skip If` on `26_10_TESTS` variable.

## Work State
### Completed
- Read standards (`standards.json`, karpathy-guidelines.mdc, ponytail.mdc); learned read-tool constraints and `/source/head/` path convention.
- Read manifest.json completely — 31 changed paths confirmed, all with hunks in diff.txt (verified by `grep -n "^diff --git"` = 31 matches at lines 1, 84, 130, 312, 538, 643, 852, 1128, 1471, 1568, 1588, 2548, 2882, 2952, 3000, 3123, 3164, 3218, 3259, 3300, 3352, 3407, 3456, …, 3895).
- Read diff.txt end-to-end: lines 1–1200, 1201–2500, 2501–3940 (in this session: 2548–3940, 3941–3945, 84–311, 3895–3945). All sros_test.go, schema, docs, README, robot-test, new-lab (`14-srsim-new-chassis.robot`, `tests/srsim.robot`), and `utils/sros_schema_gen.sh` hunks seen.
- Read complete head `/source/head/utils/sros_schema_gen.sh` (26 lines).
- Read head files: `nodes/sros/{chassis_info.go (truncated ~57), component.go (truncated ~75), component_config.go (truncated ~77), config.go, netns.go, power.go, template.go, variant.go, sros.go (start, 255–435, 800–1060, 1700+), chassis_info_test.go, sros_test.go}`; `chassis_info.go` facts: `DefaultChassisInfoPath="/opt/nokia/chassis_info.json"`, `chassisInfoEntry{Alias,CPM,IOM,IOMSlots,MDA,FixedMDAs,SFM,XIOM,FixedHWCfg,Integrated,Redundant}`, `entry()` case-insensitive + alias match, `componentWarnings`.
- Verified routing of redundant integrated components to distributed branch (`isDistributedBaseNode`/`isStandaloneNode`/`isRedundantIntegratedSrosComponents`).
- Verified env precedence: user env merged last via `MergeStringMaps(srosEnv, vars, n.Cfg.Env)`; component nodes get user env via `keepUserEnv`.
- Traced PreDeploy/Init flows for integrated vs distributed nodes; CI workflow and robot refactor details captured.
- Confirmed `checkComponentSlotsConfig` move (pre-existing logic) via diff grep (base `sros.go:1046`).

### Active
- Finalize the review findings list (candidate P2/P3/P4s noted above) and assemble the final structured review per the trusted result schema, disclosing that tests were not executed.
- Optional remaining spot-checks: head `sros.go` region ~600–720 (`setupComponentNodes`/distributed component creation context around line 668) and ~410/605 CPM-related branches; remainder of `chassis_info.go` (lines 57–222) and `component.go` (75–309) full bodies if deeper verification is needed; README hunks (diff lines 130–311) were read (docs + README hunks both within 84–311).

### Blocked
- None blocking; only output truncation requiring offset reads (worked around) and directory-read denial (worked around with explicit paths).

## Next Move
1. Read remaining head-file regions if needed for final verification: `/source/head/nodes/sros/sros.go` lines ~600–720 (`setupComponentNodes`, `componentDerivedEnv`) and lines 57–222 of `chassis_info.go` / 75–309 of `component.go` full bodies.
2. Assemble and return the final structured review per trusted result schema: findings list (with file/line permalinks to head/base roots), strengths, and the disclosed limitation that tests were not executed.

## Relevant Files
- `/source/diff.txt`: full PR diff — now fully read (1–3945); all 31 hunks present.
- `/source/manifest.json`: authoritative 31-path changed list — verified complete.
- `/source/head/nodes/sros/{chassis_info.go,component.go,component_config.go,config.go,netns.go,power.go,template.go,variant.go,sros.go,chassis_info_test.go,sros_test.go}`: core Go changes — head files read (some partially truncated: chassis_info.go ≤57, component.go ≤75, component_config.go ≤77, sros.go partial ranges).
- `/source/head/utils/sros_schema_gen.sh`: complete (26 lines) — schema enum generation changes verified.
- `/source/head/schemas/clab.schema.json`: schema enum additions (ixr-e3, sar-10x, ixr-e2sc, mda/xiom types) — hunks read in diff; head file available for spot-checks.
- `/source/head/nodes/sros/README.md`, `/source/head/docs/manual/kinds/sros.md`: docs hunks read from diff (lines 84–311); head files available.
- `.github/workflows/srsim-tests.yml`, `tests/13-srsim/*.robot`, `tests/srsim.robot` (new shared resource at `tests/` root), `tests/13-srsim/14-srsim-new-chassis.robot` (new): CI/robot changes — hunks read from diff.
- `/source/standards.json`, `/source/standards/{karpathy-guidelines.mdc,ponytail.mdc}`: review standards applied.
- GitHub permalinks (head/base roots in Important Details) for citing file versions in the final review.
step-finish
{
  "type": "step-finish",
  "id": "prt_150318b63001TTPKj0GhKqc84a",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150312b1f001kOmsjyLVrSK4Er",
  "reason": "stop",
  "cost": 0,
  "tokens": {
    "total": 25304,
    "input": 21534,
    "output": 2782,
    "reasoning": 988,
    "cache": {
      "read": 0,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_150312b1f001kOmsjyLVrSK4Er",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346762015,
    "completed": 1792346786664
  },
  "parentID": "msg_150312b08001ahr6wR8Fh3qA3c",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "compaction",
  "agent": "compaction",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "summary": true,
  "cost": 0,
  "tokens": {
    "total": 25304,
    "input": 21534,
    "output": 2782,
    "reasoning": 988,
    "cache": {
      "read": 0,
      "write": 0
    }
  },
  "finish": "stop"
}
User · 40
Continue if you have next steps, or stop and ask for clarification if you are unsure how to proceed.
Message metadata
{
  "role": "user",
  "id": "msg_150318b6b001z1GyFDwe1Oii29",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346786667
  },
  "summary": {
    "diffs": []
  },
  "agent": "tofarev",
  "model": {
    "providerID": "tofarev",
    "modelID": "zai-org/GLM-5.3-Flash"
  }
}
Assistant · 41
step-start
{
  "type": "step-start",
  "id": "prt_1503195f4001yT7T8qvkdKiFGG",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150318b78001jXqUxQiJwJejqb"
}
Reasoning
Let me check sros.go around line 440 (where createSROSFiles is called) to see which node types run it.
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/sros.go",
  "limit": 60,
  "offset": 420
}

Output

<path>/source/head/nodes/sros/sros.go</path>
<type>file</type>
<content>
420: 			n.Config().TLSCert = string(certificate.Cert)
421: 			n.Config().TLSKey = string(certificate.Key)
422: 		}
423: 		clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),
424: 			clabconstants.PermissionsOpen)
425: 		slot := n.Cfg.Env[envNokiaSrosSlot]
426: 		if slot == "" {
427: 			return fmt.Errorf("fail to init node because Env var %q is set to %q",
428: 				envNokiaSrosSlot, n.Cfg.Env[envNokiaSrosSlot])
429: 		}
430: 		// add the config specific mounts
431: 		cf1Path := filepath.Join(n.Cfg.LabDir, slot, configCf1)
432: 		cf2Path := filepath.Join(n.Cfg.LabDir, slot, configCf2)
433: 		cf3Path := filepath.Join(n.Cfg.LabDir, slot, configCf3)
434: 		n.Cfg.Binds = append(n.Cfg.Binds,
435: 			fmt.Sprint(cf1Path, ":", cf1Dir, "/:rw"),
436: 			fmt.Sprint(cf2Path, ":", cf2Dir, "/:rw"),
437: 			fmt.Sprint(cf3Path, ":", cf3Dir, "/:rw"),
438: 		)
439: 
440: 		if n.Cfg.License != "" && (n.isCPM("") || n.isStandaloneNode()) {
441: 			// we mount a fixed path node.Labdir/license.key as the license referenced in topo file
442: 			// will be copied to that path
443: 			n.Cfg.Binds = append(n.Cfg.Binds, fmt.Sprint(
444: 				filepath.Join(n.Cfg.LabDir, "license.key"), ":", licDir, "/license.txt:ro"))
445: 		}
446: 
447: 		return n.createSROSFiles(ctx)
448: 	}
449: 	return nil
450: }
451: 
452: func (n *sros) DeployEndpoints(ctx context.Context) error {
453: 	if err := n.DefaultNode.DeployEndpoints(ctx); err != nil {
454: 		return err
455: 	}
456: 
457: 	return n.PostDeployEndpoints(ctx)
458: }
459: 
460: // PostDeployEndpoints runs SR-SIM endpoint fixups after dataplane links exist.
461: func (n *sros) PostDeployEndpoints(ctx context.Context) error {
462: 	if n.Runtime.Mgmt().Driver == clabtypes.MgmtDriverMacvlan {
463: 		return nil
464: 	}
465: 	// Disable TX checksum offload on the host NS veth for the mgmt interface.
466: 	var peerIfIndex int
467: 	err := n.ExecFunction(ctx, clabutils.VethPeerIndex("eth0", &peerIfIndex))
468: 	if err != nil {
469: 		log.Warn("Failed to get veth peer index for SR-SIM mgmt interface",
470: 			"node", n.Cfg.ShortName,
471: 			"error", err)
472: 		return nil
473: 	}
474: 
475: 	if err := clabutils.DisableTxOffloadByIndex(peerIfIndex); err != nil {
476: 		log.Warn("Failed to disable TX checksum offload on SR-SIM mgmt host veth",
477: 			"node", n.Cfg.ShortName,
478: 			"error", err)
479: 	}

(Showing lines 420-479 of 1910. Use offset=480 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_150319770001fWA2jAJMiSMZPF",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150318b78001jXqUxQiJwJejqb",
  "callID": "call_1b1d02d9401d4344b0bb19e1",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/sros.go",
      "limit": 60,
      "offset": 420
    },
    "output": "<path>/source/head/nodes/sros/sros.go</path>\n<type>file</type>\n<content>\n420: \t\t\tn.Config().TLSCert = string(certificate.Cert)\n421: \t\t\tn.Config().TLSKey = string(certificate.Key)\n422: \t\t}\n423: \t\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),\n424: \t\t\tclabconstants.PermissionsOpen)\n425: \t\tslot := n.Cfg.Env[envNokiaSrosSlot]\n426: \t\tif slot == \"\" {\n427: \t\t\treturn fmt.Errorf(\"fail to init node because Env var %q is set to %q\",\n428: \t\t\t\tenvNokiaSrosSlot, n.Cfg.Env[envNokiaSrosSlot])\n429: \t\t}\n430: \t\t// add the config specific mounts\n431: \t\tcf1Path := filepath.Join(n.Cfg.LabDir, slot, configCf1)\n432: \t\tcf2Path := filepath.Join(n.Cfg.LabDir, slot, configCf2)\n433: \t\tcf3Path := filepath.Join(n.Cfg.LabDir, slot, configCf3)\n434: \t\tn.Cfg.Binds = append(n.Cfg.Binds,\n435: \t\t\tfmt.Sprint(cf1Path, \":\", cf1Dir, \"/:rw\"),\n436: \t\t\tfmt.Sprint(cf2Path, \":\", cf2Dir, \"/:rw\"),\n437: \t\t\tfmt.Sprint(cf3Path, \":\", cf3Dir, \"/:rw\"),\n438: \t\t)\n439: \n440: \t\tif n.Cfg.License != \"\" && (n.isCPM(\"\") || n.isStandaloneNode()) {\n441: \t\t\t// we mount a fixed path node.Labdir/license.key as the license referenced in topo file\n442: \t\t\t// will be copied to that path\n443: \t\t\tn.Cfg.Binds = append(n.Cfg.Binds, fmt.Sprint(\n444: \t\t\t\tfilepath.Join(n.Cfg.LabDir, \"license.key\"), \":\", licDir, \"/license.txt:ro\"))\n445: \t\t}\n446: \n447: \t\treturn n.createSROSFiles(ctx)\n448: \t}\n449: \treturn nil\n450: }\n451: \n452: func (n *sros) DeployEndpoints(ctx context.Context) error {\n453: \tif err := n.DefaultNode.DeployEndpoints(ctx); err != nil {\n454: \t\treturn err\n455: \t}\n456: \n457: \treturn n.PostDeployEndpoints(ctx)\n458: }\n459: \n460: // PostDeployEndpoints runs SR-SIM endpoint fixups after dataplane links exist.\n461: func (n *sros) PostDeployEndpoints(ctx context.Context) error {\n462: \tif n.Runtime.Mgmt().Driver == clabtypes.MgmtDriverMacvlan {\n463: \t\treturn nil\n464: \t}\n465: \t// Disable TX checksum offload on the host NS veth for the mgmt interface.\n466: \tvar peerIfIndex int\n467: \terr := n.ExecFunction(ctx, clabutils.VethPeerIndex(\"eth0\", &peerIfIndex))\n468: \tif err != nil {\n469: \t\tlog.Warn(\"Failed to get veth peer index for SR-SIM mgmt interface\",\n470: \t\t\t\"node\", n.Cfg.ShortName,\n471: \t\t\t\"error\", err)\n472: \t\treturn nil\n473: \t}\n474: \n475: \tif err := clabutils.DisableTxOffloadByIndex(peerIfIndex); err != nil {\n476: \t\tlog.Warn(\"Failed to disable TX checksum offload on SR-SIM mgmt host veth\",\n477: \t\t\t\"node\", n.Cfg.ShortName,\n478: \t\t\t\"error\", err)\n479: \t}\n\n(Showing lines 420-479 of 1910. Use offset=480 to continue.)\n</content>",
    "title": "source/head/nodes/sros/sros.go",
    "metadata": {
      "preview": "\t\t\tn.Config().TLSCert = string(certificate.Cert)\n\t\t\tn.Config().TLSKey = string(certificate.Key)\n\t\t}\n\t\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),\n\t\t\tclabconstants.PermissionsOpen)\n\t\tslot := n.Cfg.Env[envNokiaSrosSlot]\n\t\tif slot == \"\" {\n\t\t\treturn fmt.Errorf(\"fail to init node because Env var %q is set to %q\",\n\t\t\t\tenvNokiaSrosSlot, n.Cfg.Env[envNokiaSrosSlot])\n\t\t}\n\t\t// add the config specific mounts\n\t\tcf1Path := filepath.Join(n.Cfg.LabDir, slot, configCf1)\n\t\tcf2Path := filepath.Join(n.Cfg.LabDir, slot, configCf2)\n\t\tcf3Path := filepath.Join(n.Cfg.LabDir, slot, configCf3)\n\t\tn.Cfg.Binds = append(n.Cfg.Binds,\n\t\t\tfmt.Sprint(cf1Path, \":\", cf1Dir, \"/:rw\"),\n\t\t\tfmt.Sprint(cf2Path, \":\", cf2Dir, \"/:rw\"),\n\t\t\tfmt.Sprint(cf3Path, \":\", cf3Dir, \"/:rw\"),\n\t\t)\n",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/sros.go",
        "text": "\t\t\tn.Config().TLSCert = string(certificate.Cert)\n\t\t\tn.Config().TLSKey = string(certificate.Key)\n\t\t}\n\t\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),\n\t\t\tclabconstants.PermissionsOpen)\n\t\tslot := n.Cfg.Env[envNokiaSrosSlot]\n\t\tif slot == \"\" {\n\t\t\treturn fmt.Errorf(\"fail to init node because Env var %q is set to %q\",\n\t\t\t\tenvNokiaSrosSlot, n.Cfg.Env[envNokiaSrosSlot])\n\t\t}\n\t\t// add the config specific mounts\n\t\tcf1Path := filepath.Join(n.Cfg.LabDir, slot, configCf1)\n\t\tcf2Path := filepath.Join(n.Cfg.LabDir, slot, configCf2)\n\t\tcf3Path := filepath.Join(n.Cfg.LabDir, slot, configCf3)\n\t\tn.Cfg.Binds = append(n.Cfg.Binds,\n\t\t\tfmt.Sprint(cf1Path, \":\", cf1Dir, \"/:rw\"),\n\t\t\tfmt.Sprint(cf2Path, \":\", cf2Dir, \"/:rw\"),\n\t\t\tfmt.Sprint(cf3Path, \":\", cf3Dir, \"/:rw\"),\n\t\t)\n\n\t\tif n.Cfg.License != \"\" && (n.isCPM(\"\") || n.isStandaloneNode()) {\n\t\t\t// we mount a fixed path node.Labdir/license.key as the license referenced in topo file\n\t\t\t// will be copied to that path\n\t\t\tn.Cfg.Binds = append(n.Cfg.Binds, fmt.Sprint(\n\t\t\t\tfilepath.Join(n.Cfg.LabDir, \"license.key\"), \":\", licDir, \"/license.txt:ro\"))\n\t\t}\n\n\t\treturn n.createSROSFiles(ctx)\n\t}\n\treturn nil\n}\n\nfunc (n *sros) DeployEndpoints(ctx context.Context) error {\n\tif err := n.DefaultNode.DeployEndpoints(ctx); err != nil {\n\t\treturn err\n\t}\n\n\treturn n.PostDeployEndpoints(ctx)\n}\n\n// PostDeployEndpoints runs SR-SIM endpoint fixups after dataplane links exist.\nfunc (n *sros) PostDeployEndpoints(ctx context.Context) error {\n\tif n.Runtime.Mgmt().Driver == clabtypes.MgmtDriverMacvlan {\n\t\treturn nil\n\t}\n\t// Disable TX checksum offload on the host NS veth for the mgmt interface.\n\tvar peerIfIndex int\n\terr := n.ExecFunction(ctx, clabutils.VethPeerIndex(\"eth0\", &peerIfIndex))\n\tif err != nil {\n\t\tlog.Warn(\"Failed to get veth peer index for SR-SIM mgmt interface\",\n\t\t\t\"node\", n.Cfg.ShortName,\n\t\t\t\"error\", err)\n\t\treturn nil\n\t}\n\n\tif err := clabutils.DisableTxOffloadByIndex(peerIfIndex); err != nil {\n\t\tlog.Warn(\"Failed to disable TX checksum offload on SR-SIM mgmt host veth\",\n\t\t\t\"node\", n.Cfg.ShortName,\n\t\t\t\"error\", err)\n\t}",
        "lineStart": 420,
        "lineEnd": 479,
        "totalLines": 1910,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346789750,
      "end": 1792346789765
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_150319788001ndv9yozJsMiKoe",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150318b78001jXqUxQiJwJejqb",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 23388,
    "input": 23329,
    "output": 30,
    "reasoning": 29,
    "cache": {
      "read": 0,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_150318b78001jXqUxQiJwJejqb",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346786681,
    "completed": 1792346789772
  },
  "parentID": "msg_150318b6b001z1GyFDwe1Oii29",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 23388,
    "input": 23329,
    "output": 30,
    "reasoning": 29,
    "cache": {
      "read": 0,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 42
step-start
{
  "type": "step-start",
  "id": "prt_150319eff001wZv2Jx4dM3wYba",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150319796001jtXIUQWszDFNSK"
}
Reasoning
So `PreDeploy` → `createSROSFiles(ctx)` unconditionally for ALL sros nodes (including line cards). Good — line cards also get config generation.

Now `createSROSFiles` (line 999) — let me check it calls writeChassisInfoToLabDir, createSROSCertificates, createSROSConfigFiles. Line cards: writeChassisInfoToLabDir writes file and calls warnUnsupportedComponents — for line cards, `isStandaloneNode()` false, `isCPM(slotAName)` false → early return. Good.

Note `IsHealthy` (line 1142 in the earlier read was actually different; in this head line numbering IsHealthy at ~1611). Fine.

Now I have all the material I need. Remaining candidate findings to finalize:

1. **P2/P3 — `warnUserEnvOverrides` doesn't include per-component env?** Let me recheck: `setupComponentNodes` calls `keepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)`. componentConfig.Env initially contains component's own `c.Env` (user-set per-component env) — copied before. keepUserEnv logs a warning when userEnv (node env) overrides a key present in componentConfig.Env (per-component env) — yes, that's the per-component env warning. And componentDerivedEnv(c) provides defaults. Good, matches docs.

2. **SFM warn duplication (P4)**: In Init, the SFM branch (lines 279-297 head) inlines a warning that duplicates `warnUserEnvOverrides` semantics for one key. Could be simplified by adding `{envNokiaSrosSFM: sfm}` as derived env passed to warnUserEnvOverrides. But warnUserEnvOverrides takes (nodeName, derived map, userEnv) and warns on collisions where derived value != user value. Actually the inline SFM warn does exactly: if userEnv has key and differs → warn. And warnUserEnvOverrides does the same. But there's a subtlety: the SFM env is applied via n.Cfg.Env[envNokiaSrosSFM] = sfm (when not set by user), and this happens for BOTH standalone and distributed-card and distributed-base nodes, while warnUserEnvOverrides is only called in the standalone path. So the inline SFM warn is needed for distributed paths. A refactor could call warnUserEnvOverrides with the SFM derived var in all paths, but the current code is functionally correct. This is a P4 optional improvement — but is it worth reporting? It's duplication that could confuse maintenance. Ponytail says keep focused; the duplication is 4 lines. I'll include as P4.

3. **`componentForConfig(nil)` when env-only config**: `cloneComponent(nil)` — need to verify it returns non-nil empty component. Let me check component.go cloneComponent. If it does `if c == nil { return &Component{} }` fine.

4. **Bug check — `warnUnsupportedComponents` nodeType from env `envNokiaSrosChassis`**: `n.Cfg.Env[envNokiaSrosChassis]` — for component nodes, is envNokiaSrosChassis set in their env? srosEnv includes NOKIA_SROS_CHASSIS? Let me check: srosEnv defined with envNokiaSrosChassis? Earlier in sros.go, srosEnv map includes `envNokiaSrosChassis: n.Cfg.NodeType`? Actually I recall `NOKIA_SROS_CHASSIS` is in srosEnv. Yes, from prior reading: srosEnv map has envNokiaSrosChassis set to n.Cfg.NodeType (lowercase?). Let me verify. In base sros.go there was:

```go
srosEnv = map[string]string{
    envNokiaSrosChassis: strings.ToLower(n.Cfg.NodeType),
    envNokiaSrosSystemBaseMac: mac,
}
```

Hmm, that was a method `n.srosEnv()`? Actually package-level `srosEnv` map mutated in Init? Let me check head sros.go around Init lines 300-323. Earlier I read 255-435: there was something like:

```go
srosEnv[envNokiaSrosChassis] = strings.ToLower(n.Cfg.NodeType)
```

Let me verify this exists and how it interacts. Also `warnUnsupportedComponents` reads `n.Cfg.Env[envNokiaSrosChassis]` as nodeType override — for a component node, Cfg.Env includes merged srosEnv from the BASE node (component inherits base env? Actually component nodes get env from componentConfig which was built from base node config; the base sets srosEnv with chassis = base NodeType; the component Init then merges its own srosEnv with componentConfig.Env? Component Init: envAlreadyResolved=true (userEnv != nil), so it skips the SFM apply; then for the component node, kindSpecificCfg().Components — hmm, componentConfig has Components field? The base clones its own kind config for component nodes (componentConfig.KindSpecificCfg = ...). If components were copied into componentConfig, then component Init would call setupStandaloneComponents again — no wait, for component node isDistributedBaseNode() must be false. The base strips components? Let me check setupComponentNodes: componentConfig built via cloneComponent? There's `srosKindConfig, err := n.getComponentKindConfig(...)` or similar. I recall componentConfig.Components is set to the single component? If component node had Components=[A] only, isDistributedBaseNode → len>1 false; isDistributedCardNode → envNokiaSrosSlot set && len(components)==0 → false (len=1); so component node is standalone → its Init calls setupStandaloneComponents → generates vars from its component → merged. And userEnv snapshot skipped (envAlreadyResolved=true since srosNode.userEnv = clone of n.userEnv set before Init). Good — that's the comment at diff line 1857-1866.

So for component node, in Init, `warnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)` — n.userEnv = base userEnv (which includes node-level env like NOKIA_SROS_CARD if user set it at node level). vars for the component include card type from component.Type, MDA etc. So node-level env overrides component fields with warnings. 

And `n.Cfg.Env[envNokiaSrosChassis]` for the component node = base node type (from base env, since componentConfig.Env includes CLAB_LABEL etc. and srosEnv chassis?). Actually component env inherits base's merged env minus some keys? In setupComponentNodes, componentConfig.Env starts as clone of n.Cfg.Env? Let me recall the diff: componentConfig.Env — the diff at 1840-1852 shows "add the component env to the componentConfig env" replaced by keepUserEnv. The preceding context: componentConfig probably cloned from base Cfg with Env = clone of base env. So component node's Env contains NOKIA_SROS_CHASSIS = base node type. Good, so warnUnsupportedComponents on CPM A uses correct chassis.

5. **Potential issue: `n.componentSFM()`** — let me verify it exists in head (used in warnUnsupportedComponents). grep.

6. **The `getComponentKindConfig` for component nodes** — need to check whether Components list on component node is emptied (to avoid recursion) — I recall `componentConfig.Components` is nil'ed or set to only that component. Let me check component.go / sros.go setupComponentNodes full body.

Let me do targeted reads to close these loops:
- grep `componentSFM` in head/nodes/sros.
- read setupComponentNodes full body (head sros.go ~626-740).
- check srosEnv chassis assignment (head sros.go ~300-330).
Let me close the remaining verification loops: `componentSFM`, the full `setupComponentNodes` body (how component kind config is derived), and the `srosEnv` chassis assignment.
grep · completed

Input

{
  "path": "/source/head/nodes/sros",
  "pattern": "componentSFM|getComponentKindConfig|srosEnv\\["
}

Output

Found 6 matches
/source/head/nodes/sros/sros.go:
  Line 309: 	srosEnv[envNokiaSrosChassis] = n.Cfg.NodeType // Override NodeType var with existing env

  Line 312: 	srosEnv[envNokiaSrosSystemBaseMac] = mac

  Line 1101: 	for _, warning := range info.componentWarnings(nodeType, n.componentSFM(), effective) {


/source/head/nodes/sros/component_config.go:
  Line 302: 	lines := buildComponentCfgLines(n.componentsForConfig(components), n.componentSFM())

  Line 315: // componentSFM is the SFM used in generated config. NOKIA_SROS_SFM overrides the sfm key.

  Line 316: func (n *sros) componentSFM() string {
Tool metadata
{
  "type": "tool",
  "id": "prt_15031dd2f00166xiiqRJQRvZnr",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150319796001jtXIUQWszDFNSK",
  "callID": "call_9b6a50feee9f447a828d3bb3",
  "tool": "grep",
  "state": {
    "status": "completed",
    "input": {
      "path": "/source/head/nodes/sros",
      "pattern": "componentSFM|getComponentKindConfig|srosEnv\\["
    },
    "output": "Found 6 matches\n/source/head/nodes/sros/sros.go:\n  Line 309: \tsrosEnv[envNokiaSrosChassis] = n.Cfg.NodeType // Override NodeType var with existing env\n\n  Line 312: \tsrosEnv[envNokiaSrosSystemBaseMac] = mac\n\n  Line 1101: \tfor _, warning := range info.componentWarnings(nodeType, n.componentSFM(), effective) {\n\n\n/source/head/nodes/sros/component_config.go:\n  Line 302: \tlines := buildComponentCfgLines(n.componentsForConfig(components), n.componentSFM())\n\n  Line 315: // componentSFM is the SFM used in generated config. NOKIA_SROS_SFM overrides the sfm key.\n\n  Line 316: func (n *sros) componentSFM() string {\n",
    "title": "componentSFM|getComponentKindConfig|srosEnv\\[",
    "metadata": {
      "matches": 6,
      "truncated": false
    },
    "time": {
      "start": 1792346807605,
      "end": 1792346807616
    }
  }
}
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/sros.go",
  "limit": 130,
  "offset": 625
}

Output

<path>/source/head/nodes/sros/sros.go</path>
<type>file</type>
<content>
625: func (n *sros) setupComponentNodes() error {
626: 	if !n.isDistributedBaseNode() {
627: 		return nil
628: 	}
629: 
630: 	n.netnsNode = new(namespaceNode)
631: 	if err := n.netnsNode.Init(
632: 		n.newNetnsConfig(),
633: 		clabnodes.WithRuntime(n.GetRuntime()),
634: 	); err != nil {
635: 		return err
636: 	}
637: 	rootCtrName := n.netnsNode.Config().LongName
638: 
639: 	// loop through the components, creating them
640: 	for _, c := range n.kindSpecificCfg().Components {
641: 		// instantiate a new nokia_srsim instance
642: 		srosNode := new(sros)
643: 		componentNode := clabnodes.Node(srosNode)
644: 
645: 		// copy the original node's NodeConfig to the component
646: 		componentConfig, err := deep.Copy(n.Cfg)
647: 		if err != nil {
648: 			return fmt.Errorf("failed to deep copy node config for component: %w", err)
649: 		}
650: 
651: 		// component nodes join to the nents pause container
652: 		componentConfig.NetworkMode = fmt.Sprintf("container:%s", n.netnsNode.GetShortName())
653: 
654: 		// adjust the config values from the original node
655: 		componentConfig.ShortName = n.calcComponentName(componentConfig.ShortName, c.Slot)
656: 		componentConfig.LongName = n.calcComponentName(componentConfig.LongName, c.Slot)
657: 		componentConfig.NodeType = n.Cfg.NodeType
658: 		kindSpecificConfig.Of(componentConfig).Components = nil
659: 		componentConfig.Fqdn = n.calcComponentFqdn(c.Slot)
660: 		componentConfig.DNS = nil
661: 		componentConfig.PortBindings = nil
662: 		componentConfig.PortSet = nil
663: 
664: 		// Component fields fill env keys the user did not set. Node env wins.
665: 		if componentConfig.Env == nil {
666: 			componentConfig.Env = map[string]string{}
667: 		}
668: 		keepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)
669: 		// Slot identifies this container. A node-level NOKIA_SROS_SLOT cannot apply to every card.
670: 		componentConfig.Env[envNokiaSrosSlot] = c.Slot
671: 
672: 		// adjust label based env vars
673: 		componentConfig.Env["CLAB_LABEL_"+clabutils.ToEnvKey(clabconstants.NodeName)] = componentConfig.ShortName
674: 		componentConfig.Env["CLAB_LABEL_"+clabutils.ToEnvKey(clabconstants.LongName)] = componentConfig.LongName
675: 
676: 		if componentConfig.Labels == nil {
677: 			componentConfig.Labels = map[string]string{}
678: 		}
679: 
680: 		// adjust labels
681: 		componentConfig.Labels[clabconstants.NodeName] = componentConfig.ShortName
682: 		componentConfig.Labels[clabconstants.LongName] = componentConfig.LongName
683: 		componentConfig.Labels[clabconstants.RootNodeName] = n.Cfg.ShortName
684: 		componentConfig.Labels[clabconstants.RootNodeLongName] = n.Cfg.LongName
685: 
686: 		// Preserve the topology env. Init must not snapshot the merged component env,
687: 		// or config generation would treat component flags as user overrides.
688: 		srosNode.userEnv = maps.Clone(n.userEnv)
689: 
690: 		// init the component
691: 		err = componentNode.Init(componentConfig)
692: 		if err != nil {
693: 			return err
694: 		}
695: 		// set the runtime by copying it from the general node
696: 		componentNode.WithRuntime(n.GetRuntime())
697: 
698: 		// store root components for cpms, for config gen
699: 		srosNode.rootComponents = n.kindSpecificCfg().Components
700: 		// store base node name
701: 		srosNode.baseShortName = n.Cfg.ShortName
702: 		srosNode.baseLongName = n.Cfg.LongName
703: 		srosNode.rootCtrName = rootCtrName
704: 
705: 		// store the node in the componentNodes
706: 		n.componentNodes = append(n.componentNodes, componentNode)
707: 	}
708: 	return nil
709: }
710: 
711: // deployFabric deploys the distributed SR-SIM when the `components` key is present.
712: func (n *sros) deployFabric(ctx context.Context, deployParams *clabnodes.DeployParams) error {
713: 	netnsConfig := n.netnsNode.Config()
714: 
715: 	netnsConfig.MgmtIPv4Address = n.Cfg.MgmtIPv4Address
716: 	netnsConfig.MgmtIPv4AddressAuto = n.Cfg.MgmtIPv4AddressAuto
717: 	netnsConfig.MgmtIPv4PrefixLength = n.Cfg.MgmtIPv4PrefixLength
718: 	netnsConfig.MgmtIPv4Gateway = n.Cfg.MgmtIPv4Gateway
719: 	netnsConfig.MgmtIPv6Address = n.Cfg.MgmtIPv6Address
720: 	netnsConfig.MgmtIPv6AddressAuto = n.Cfg.MgmtIPv6AddressAuto
721: 	netnsConfig.MgmtIPv6PrefixLength = n.Cfg.MgmtIPv6PrefixLength
722: 	netnsConfig.MgmtIPv6Gateway = n.Cfg.MgmtIPv6Gateway
723: 
724: 	if err := n.netnsNode.Deploy(ctx, deployParams); err != nil {
725: 		return fmt.Errorf("deploy network namespace node %q: %w", n.netnsNode.GetShortName(), err)
726: 	}
727: 
728: 	ips, err := n.distNodeMgmtIPs()
729: 	if err != nil {
730: 		return err
731: 	}
732: 
733: 	n.setComponentMgmtEnv(ips)
734: 
735: 	// loop through the components, creating them
736: 	for _, c := range n.componentNodes {
737: 		if err := c.PreDeploy(ctx, n.preDeployParams); err != nil {
738: 			return fmt.Errorf("pre-deploy for component node %q: %w", c.GetShortName(), err)
739: 		}
740: 		// deploy the component
741: 		err := c.Deploy(ctx, deployParams)
742: 		if err != nil {
743: 			return err
744: 		}
745: 	}
746: 
747: 	cpmSlot, err := n.cpmSlot()
748: 	if err != nil {
749: 		return err
750: 	}
751: 	// store the CPM container name
752: 	n.cpmContainerName = n.calcComponentName(n.Cfg.LongName, cpmSlot)
753: 	n.renameDone = true
754: 

(Showing lines 625-754 of 1910. Use offset=755 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_15031ddc400114vXBxmLR7NMAS",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150319796001jtXIUQWszDFNSK",
  "callID": "call_731e94061e1241afa74de023",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/sros.go",
      "limit": 130,
      "offset": 625
    },
    "output": "<path>/source/head/nodes/sros/sros.go</path>\n<type>file</type>\n<content>\n625: func (n *sros) setupComponentNodes() error {\n626: \tif !n.isDistributedBaseNode() {\n627: \t\treturn nil\n628: \t}\n629: \n630: \tn.netnsNode = new(namespaceNode)\n631: \tif err := n.netnsNode.Init(\n632: \t\tn.newNetnsConfig(),\n633: \t\tclabnodes.WithRuntime(n.GetRuntime()),\n634: \t); err != nil {\n635: \t\treturn err\n636: \t}\n637: \trootCtrName := n.netnsNode.Config().LongName\n638: \n639: \t// loop through the components, creating them\n640: \tfor _, c := range n.kindSpecificCfg().Components {\n641: \t\t// instantiate a new nokia_srsim instance\n642: \t\tsrosNode := new(sros)\n643: \t\tcomponentNode := clabnodes.Node(srosNode)\n644: \n645: \t\t// copy the original node's NodeConfig to the component\n646: \t\tcomponentConfig, err := deep.Copy(n.Cfg)\n647: \t\tif err != nil {\n648: \t\t\treturn fmt.Errorf(\"failed to deep copy node config for component: %w\", err)\n649: \t\t}\n650: \n651: \t\t// component nodes join to the nents pause container\n652: \t\tcomponentConfig.NetworkMode = fmt.Sprintf(\"container:%s\", n.netnsNode.GetShortName())\n653: \n654: \t\t// adjust the config values from the original node\n655: \t\tcomponentConfig.ShortName = n.calcComponentName(componentConfig.ShortName, c.Slot)\n656: \t\tcomponentConfig.LongName = n.calcComponentName(componentConfig.LongName, c.Slot)\n657: \t\tcomponentConfig.NodeType = n.Cfg.NodeType\n658: \t\tkindSpecificConfig.Of(componentConfig).Components = nil\n659: \t\tcomponentConfig.Fqdn = n.calcComponentFqdn(c.Slot)\n660: \t\tcomponentConfig.DNS = nil\n661: \t\tcomponentConfig.PortBindings = nil\n662: \t\tcomponentConfig.PortSet = nil\n663: \n664: \t\t// Component fields fill env keys the user did not set. Node env wins.\n665: \t\tif componentConfig.Env == nil {\n666: \t\t\tcomponentConfig.Env = map[string]string{}\n667: \t\t}\n668: \t\tkeepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)\n669: \t\t// Slot identifies this container. A node-level NOKIA_SROS_SLOT cannot apply to every card.\n670: \t\tcomponentConfig.Env[envNokiaSrosSlot] = c.Slot\n671: \n672: \t\t// adjust label based env vars\n673: \t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.NodeName)] = componentConfig.ShortName\n674: \t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.LongName)] = componentConfig.LongName\n675: \n676: \t\tif componentConfig.Labels == nil {\n677: \t\t\tcomponentConfig.Labels = map[string]string{}\n678: \t\t}\n679: \n680: \t\t// adjust labels\n681: \t\tcomponentConfig.Labels[clabconstants.NodeName] = componentConfig.ShortName\n682: \t\tcomponentConfig.Labels[clabconstants.LongName] = componentConfig.LongName\n683: \t\tcomponentConfig.Labels[clabconstants.RootNodeName] = n.Cfg.ShortName\n684: \t\tcomponentConfig.Labels[clabconstants.RootNodeLongName] = n.Cfg.LongName\n685: \n686: \t\t// Preserve the topology env. Init must not snapshot the merged component env,\n687: \t\t// or config generation would treat component flags as user overrides.\n688: \t\tsrosNode.userEnv = maps.Clone(n.userEnv)\n689: \n690: \t\t// init the component\n691: \t\terr = componentNode.Init(componentConfig)\n692: \t\tif err != nil {\n693: \t\t\treturn err\n694: \t\t}\n695: \t\t// set the runtime by copying it from the general node\n696: \t\tcomponentNode.WithRuntime(n.GetRuntime())\n697: \n698: \t\t// store root components for cpms, for config gen\n699: \t\tsrosNode.rootComponents = n.kindSpecificCfg().Components\n700: \t\t// store base node name\n701: \t\tsrosNode.baseShortName = n.Cfg.ShortName\n702: \t\tsrosNode.baseLongName = n.Cfg.LongName\n703: \t\tsrosNode.rootCtrName = rootCtrName\n704: \n705: \t\t// store the node in the componentNodes\n706: \t\tn.componentNodes = append(n.componentNodes, componentNode)\n707: \t}\n708: \treturn nil\n709: }\n710: \n711: // deployFabric deploys the distributed SR-SIM when the `components` key is present.\n712: func (n *sros) deployFabric(ctx context.Context, deployParams *clabnodes.DeployParams) error {\n713: \tnetnsConfig := n.netnsNode.Config()\n714: \n715: \tnetnsConfig.MgmtIPv4Address = n.Cfg.MgmtIPv4Address\n716: \tnetnsConfig.MgmtIPv4AddressAuto = n.Cfg.MgmtIPv4AddressAuto\n717: \tnetnsConfig.MgmtIPv4PrefixLength = n.Cfg.MgmtIPv4PrefixLength\n718: \tnetnsConfig.MgmtIPv4Gateway = n.Cfg.MgmtIPv4Gateway\n719: \tnetnsConfig.MgmtIPv6Address = n.Cfg.MgmtIPv6Address\n720: \tnetnsConfig.MgmtIPv6AddressAuto = n.Cfg.MgmtIPv6AddressAuto\n721: \tnetnsConfig.MgmtIPv6PrefixLength = n.Cfg.MgmtIPv6PrefixLength\n722: \tnetnsConfig.MgmtIPv6Gateway = n.Cfg.MgmtIPv6Gateway\n723: \n724: \tif err := n.netnsNode.Deploy(ctx, deployParams); err != nil {\n725: \t\treturn fmt.Errorf(\"deploy network namespace node %q: %w\", n.netnsNode.GetShortName(), err)\n726: \t}\n727: \n728: \tips, err := n.distNodeMgmtIPs()\n729: \tif err != nil {\n730: \t\treturn err\n731: \t}\n732: \n733: \tn.setComponentMgmtEnv(ips)\n734: \n735: \t// loop through the components, creating them\n736: \tfor _, c := range n.componentNodes {\n737: \t\tif err := c.PreDeploy(ctx, n.preDeployParams); err != nil {\n738: \t\t\treturn fmt.Errorf(\"pre-deploy for component node %q: %w\", c.GetShortName(), err)\n739: \t\t}\n740: \t\t// deploy the component\n741: \t\terr := c.Deploy(ctx, deployParams)\n742: \t\tif err != nil {\n743: \t\t\treturn err\n744: \t\t}\n745: \t}\n746: \n747: \tcpmSlot, err := n.cpmSlot()\n748: \tif err != nil {\n749: \t\treturn err\n750: \t}\n751: \t// store the CPM container name\n752: \tn.cpmContainerName = n.calcComponentName(n.Cfg.LongName, cpmSlot)\n753: \tn.renameDone = true\n754: \n\n(Showing lines 625-754 of 1910. Use offset=755 to continue.)\n</content>",
    "title": "source/head/nodes/sros/sros.go",
    "metadata": {
      "preview": "func (n *sros) setupComponentNodes() error {\n\tif !n.isDistributedBaseNode() {\n\t\treturn nil\n\t}\n\n\tn.netnsNode = new(namespaceNode)\n\tif err := n.netnsNode.Init(\n\t\tn.newNetnsConfig(),\n\t\tclabnodes.WithRuntime(n.GetRuntime()),\n\t); err != nil {\n\t\treturn err\n\t}\n\trootCtrName := n.netnsNode.Config().LongName\n\n\t// loop through the components, creating them\n\tfor _, c := range n.kindSpecificCfg().Components {\n\t\t// instantiate a new nokia_srsim instance\n\t\tsrosNode := new(sros)\n\t\tcomponentNode := clabnodes.Node(srosNode)\n",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/sros.go",
        "text": "func (n *sros) setupComponentNodes() error {\n\tif !n.isDistributedBaseNode() {\n\t\treturn nil\n\t}\n\n\tn.netnsNode = new(namespaceNode)\n\tif err := n.netnsNode.Init(\n\t\tn.newNetnsConfig(),\n\t\tclabnodes.WithRuntime(n.GetRuntime()),\n\t); err != nil {\n\t\treturn err\n\t}\n\trootCtrName := n.netnsNode.Config().LongName\n\n\t// loop through the components, creating them\n\tfor _, c := range n.kindSpecificCfg().Components {\n\t\t// instantiate a new nokia_srsim instance\n\t\tsrosNode := new(sros)\n\t\tcomponentNode := clabnodes.Node(srosNode)\n\n\t\t// copy the original node's NodeConfig to the component\n\t\tcomponentConfig, err := deep.Copy(n.Cfg)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to deep copy node config for component: %w\", err)\n\t\t}\n\n\t\t// component nodes join to the nents pause container\n\t\tcomponentConfig.NetworkMode = fmt.Sprintf(\"container:%s\", n.netnsNode.GetShortName())\n\n\t\t// adjust the config values from the original node\n\t\tcomponentConfig.ShortName = n.calcComponentName(componentConfig.ShortName, c.Slot)\n\t\tcomponentConfig.LongName = n.calcComponentName(componentConfig.LongName, c.Slot)\n\t\tcomponentConfig.NodeType = n.Cfg.NodeType\n\t\tkindSpecificConfig.Of(componentConfig).Components = nil\n\t\tcomponentConfig.Fqdn = n.calcComponentFqdn(c.Slot)\n\t\tcomponentConfig.DNS = nil\n\t\tcomponentConfig.PortBindings = nil\n\t\tcomponentConfig.PortSet = nil\n\n\t\t// Component fields fill env keys the user did not set. Node env wins.\n\t\tif componentConfig.Env == nil {\n\t\t\tcomponentConfig.Env = map[string]string{}\n\t\t}\n\t\tkeepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)\n\t\t// Slot identifies this container. A node-level NOKIA_SROS_SLOT cannot apply to every card.\n\t\tcomponentConfig.Env[envNokiaSrosSlot] = c.Slot\n\n\t\t// adjust label based env vars\n\t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.NodeName)] = componentConfig.ShortName\n\t\tcomponentConfig.Env[\"CLAB_LABEL_\"+clabutils.ToEnvKey(clabconstants.LongName)] = componentConfig.LongName\n\n\t\tif componentConfig.Labels == nil {\n\t\t\tcomponentConfig.Labels = map[string]string{}\n\t\t}\n\n\t\t// adjust labels\n\t\tcomponentConfig.Labels[clabconstants.NodeName] = componentConfig.ShortName\n\t\tcomponentConfig.Labels[clabconstants.LongName] = componentConfig.LongName\n\t\tcomponentConfig.Labels[clabconstants.RootNodeName] = n.Cfg.ShortName\n\t\tcomponentConfig.Labels[clabconstants.RootNodeLongName] = n.Cfg.LongName\n\n\t\t// Preserve the topology env. Init must not snapshot the merged component env,\n\t\t// or config generation would treat component flags as user overrides.\n\t\tsrosNode.userEnv = maps.Clone(n.userEnv)\n\n\t\t// init the component\n\t\terr = componentNode.Init(componentConfig)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// set the runtime by copying it from the general node\n\t\tcomponentNode.WithRuntime(n.GetRuntime())\n\n\t\t// store root components for cpms, for config gen\n\t\tsrosNode.rootComponents = n.kindSpecificCfg().Components\n\t\t// store base node name\n\t\tsrosNode.baseShortName = n.Cfg.ShortName\n\t\tsrosNode.baseLongName = n.Cfg.LongName\n\t\tsrosNode.rootCtrName = rootCtrName\n\n\t\t// store the node in the componentNodes\n\t\tn.componentNodes = append(n.componentNodes, componentNode)\n\t}\n\treturn nil\n}\n\n// deployFabric deploys the distributed SR-SIM when the `components` key is present.\nfunc (n *sros) deployFabric(ctx context.Context, deployParams *clabnodes.DeployParams) error {\n\tnetnsConfig := n.netnsNode.Config()\n\n\tnetnsConfig.MgmtIPv4Address = n.Cfg.MgmtIPv4Address\n\tnetnsConfig.MgmtIPv4AddressAuto = n.Cfg.MgmtIPv4AddressAuto\n\tnetnsConfig.MgmtIPv4PrefixLength = n.Cfg.MgmtIPv4PrefixLength\n\tnetnsConfig.MgmtIPv4Gateway = n.Cfg.MgmtIPv4Gateway\n\tnetnsConfig.MgmtIPv6Address = n.Cfg.MgmtIPv6Address\n\tnetnsConfig.MgmtIPv6AddressAuto = n.Cfg.MgmtIPv6AddressAuto\n\tnetnsConfig.MgmtIPv6PrefixLength = n.Cfg.MgmtIPv6PrefixLength\n\tnetnsConfig.MgmtIPv6Gateway = n.Cfg.MgmtIPv6Gateway\n\n\tif err := n.netnsNode.Deploy(ctx, deployParams); err != nil {\n\t\treturn fmt.Errorf(\"deploy network namespace node %q: %w\", n.netnsNode.GetShortName(), err)\n\t}\n\n\tips, err := n.distNodeMgmtIPs()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tn.setComponentMgmtEnv(ips)\n\n\t// loop through the components, creating them\n\tfor _, c := range n.componentNodes {\n\t\tif err := c.PreDeploy(ctx, n.preDeployParams); err != nil {\n\t\t\treturn fmt.Errorf(\"pre-deploy for component node %q: %w\", c.GetShortName(), err)\n\t\t}\n\t\t// deploy the component\n\t\terr := c.Deploy(ctx, deployParams)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tcpmSlot, err := n.cpmSlot()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// store the CPM container name\n\tn.cpmContainerName = n.calcComponentName(n.Cfg.LongName, cpmSlot)\n\tn.renameDone = true\n",
        "lineStart": 625,
        "lineEnd": 754,
        "totalLines": 1910,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346807753,
      "end": 1792346807766
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_15031ddd80018H8AneYSK6QQJw",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150319796001jtXIUQWszDFNSK",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 26067,
    "input": 987,
    "output": 102,
    "reasoning": 1682,
    "cache": {
      "read": 23296,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_150319796001jtXIUQWszDFNSK",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346789782,
    "completed": 1792346807772
  },
  "parentID": "msg_150318b6b001z1GyFDwe1Oii29",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 26067,
    "input": 987,
    "output": 102,
    "reasoning": 1682,
    "cache": {
      "read": 23296,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 43
step-start
{
  "type": "step-start",
  "id": "prt_15031e5e3001mpghrvBFGRQMXr",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15031dde7001u0P1KrRAXsPEf7"
}
Reasoning
Key observations from `setupComponentNodes`:

1. `kindSpecificConfig.Of(componentConfig).Components = nil` — component nodes get no components of their own, so `isDistributedCardNode()` = envNokiaSrosSlot set && len(components)==0 → TRUE for every component node (both CPM A and line cards). So component nodes are classified as distributed card nodes. Then `warnUnsupportedComponents` guard: `!n.isStandaloneNode() && !n.isCPM(slotAName)` — for CPM A component: isCPM(slotAName) → slot A → true → proceeds. Good.

2. `componentConfig.Env` is a deep copy of the base node's `n.Cfg.Env` — wait, `deep.Copy(n.Cfg)` copies Cfg.Env too, which at base Init time is `n.Cfg.Env` — BUT the base node's Init has already merged `srosEnv, vars, n.Cfg.Env`? No wait — order matters. `setupComponentNodes` is called when? In PreDeploy? Let me check: setupComponentNodes is called from... grep. If it's called after base Init (which merges env into n.Cfg.Env), then componentConfig.Env = base merged env (includes NOKIA_SROS_CHASSIS=base nodetype, NOKIA_SROS_SLOT=base slot which is ""?). For base integrated node with no components entry... but setupComponentNodes only runs for distributed base. For a distributed base (e.g., sr-1s with components 1,2,A,B), base Init: len(components)>1 → isDistributedBaseNode → setupStandaloneComponents not called (that path is under `if n.isStandaloneNode()`?). Let me check Init flow lines 300-330: line 305-311 sets srosEnv[envNokiaSrosChassis]=NodeType, mac. Then around line 315-323: `if n.isStandaloneNode() { vars := setupStandaloneComponents... } else { ... }` — the else branch probably sets envNokiaSrosSlot="" or deletes it? Base node env: the base Cfg.Env may contain user env plus srosEnv chassis/mac. Then component deep-copies Env — includes NOKIA_SROS_CHASSIS (base node type) — good for warnUnsupportedComponents.

3. Now `keepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)` — componentConfig.Env already contains base's merged env (which includes srosEnv chassis/mac and user env). componentDerivedEnv(c) has defaults like card type, MDA_1, etc. keepUserEnv presumably: for each key in derived, if userEnv has that key → warn if different, and skip setting; else if componentConfig.Env has key (user-set component env?) hmm — componentConfig.Env here contains the base env clone. For a component node, does base env contain NOKIA_SROS_CARD? Base env contains merged env: srosEnv(chassis, mac) + user env. If user set NOKIA_SROS_CARD at node level, it's in componentConfig.Env AND userEnv → keepUserEnv warns. If not set by user but derived has a value → set into componentConfig.Env.

But wait — component's OWN `c.Env` (per-component env from topology) is NOT merged in the new code! The old code did `for k, v := range c.Env { componentConfig.Env[k] = v }`. The new code passes `componentDerivedEnv(c)` — does componentDerivedEnv include c.Env? The doc says "Per-component env still applies unless the node env overrides it." Let me check componentDerivedEnv — likely in component.go: builds map with card/xiom/mda keys plus c.Env? Let me verify by reading component.go's componentDerivedEnv.

Also need to check `keepUserEnv` implementation — where is it? Probably in component.go or component_config.go. Let me read component.go fully now (I only read first 75 lines before).
`componentConfig.Env` is a deep copy of the base env, and per-component env is now handled via `componentDerivedEnv`. Let me verify `componentDerivedEnv` includes the component's own `c.Env` and check `keepUserEnv`.
grep · completed

Input

{
  "path": "/source/head/nodes/sros",
  "pattern": "func componentDerivedEnv|func keepUserEnv|func warnUserEnvOverrides"
}

Output

Found 3 matches
/source/head/nodes/sros/component.go:
  Line 173: func componentDerivedEnv(c *Component) map[string]string {

  Line 184: func warnUserEnvOverrides(node string, derived, userEnv map[string]string) {

  Line 206: func keepUserEnv(node string, dst, derived, userEnv map[string]string) {
Tool metadata
{
  "type": "tool",
  "id": "prt_150320470001jd9GH7TQ23vxov",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15031dde7001u0P1KrRAXsPEf7",
  "callID": "call_3d532dc1cde74be1b9719572",
  "tool": "grep",
  "state": {
    "status": "completed",
    "input": {
      "path": "/source/head/nodes/sros",
      "pattern": "func componentDerivedEnv|func keepUserEnv|func warnUserEnvOverrides"
    },
    "output": "Found 3 matches\n/source/head/nodes/sros/component.go:\n  Line 173: func componentDerivedEnv(c *Component) map[string]string {\n\n  Line 184: func warnUserEnvOverrides(node string, derived, userEnv map[string]string) {\n\n  Line 206: func keepUserEnv(node string, dst, derived, userEnv map[string]string) {\n",
    "title": "func componentDerivedEnv|func keepUserEnv|func warnUserEnvOverrides",
    "metadata": {
      "matches": 3,
      "truncated": false
    },
    "time": {
      "start": 1792346817654,
      "end": 1792346817673
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_15032048b001RStM2uGEP8319w",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15031dde7001u0P1KrRAXsPEf7",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 28940,
    "input": 2149,
    "output": 86,
    "reasoning": 849,
    "cache": {
      "read": 25856,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_15031dde7001u0P1KrRAXsPEf7",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346807783,
    "completed": 1792346817679
  },
  "parentID": "msg_150318b6b001z1GyFDwe1Oii29",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 28940,
    "input": 2149,
    "output": 86,
    "reasoning": 849,
    "cache": {
      "read": 25856,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 44
step-start
{
  "type": "step-start",
  "id": "prt_150320c1a001T9RpM3inlykS2D",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15032049a001SgeOLZUYf0tHJn"
}
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/component.go",
  "limit": 140,
  "offset": 160
}

Output

<path>/source/head/nodes/sros/component.go</path>
<type>file</type>
<content>
160: 				n.GetShortName(),
161: 				component.Slot,
162: 			)
163: 		}
164: 		// add to component names map
165: 		componentNames[slot] = struct{}{}
166: 
167: 	}
168: 	return nil
169: }
170: 
171: // componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,
172: // and per-component env. Per-component env overrides the typed fields.
173: func componentDerivedEnv(c *Component) map[string]string {
174: 	derived := map[string]string{}
175: 	if c == nil {
176: 		return derived
177: 	}
178: 	setComponentEnvVars(derived, c)
179: 	maps.Copy(derived, c.Env)
180: 	return derived
181: }
182: 
183: // warnUserEnvOverrides logs when a node env var replaces a component-derived value.
184: func warnUserEnvOverrides(node string, derived, userEnv map[string]string) {
185: 	for key, componentValue := range derived {
186: 		envValue, userSet := userEnv[key]
187: 		if !userSet || componentValue == envValue {
188: 			continue
189: 		}
190: 		log.Warn(
191: 			fmt.Sprintf(
192: 				"component value %q will not be used because environment variable %s is set",
193: 				componentValue,
194: 				key,
195: 			),
196: 			"node", node,
197: 			"env", key,
198: 			"component-value", componentValue,
199: 			"env-value", envValue,
200: 		)
201: 	}
202: }
203: 
204: // keepUserEnv copies component-derived keys into dst unless the user already set that key.
205: // A user value wins, and a differing component value is logged.
206: func keepUserEnv(node string, dst, derived, userEnv map[string]string) {
207: 	warnUserEnvOverrides(node, derived, userEnv)
208: 	for key, componentValue := range derived {
209: 		if envValue, userSet := userEnv[key]; userSet {
210: 			dst[key] = envValue
211: 			continue
212: 		}
213: 		dst[key] = componentValue
214: 	}
215: }
216: 
217: // cloneComponent returns a deep copy of c suitable for env overrides during config generation.
218: func cloneComponent(c *Component) *Component {
219: 	if c == nil {
220: 		return &Component{}
221: 	}
222: 	out := *c
223: 	out.Env = maps.Clone(c.Env)
224: 	out.MDA = slices.Clone(c.MDA)
225: 	if len(c.XIOM) > 0 {
226: 		out.XIOM = make(XIOMS, len(c.XIOM))
227: 		for i, xiom := range c.XIOM {
228: 			xiom.MDA = slices.Clone(xiom.MDA)
229: 			out.XIOM[i] = xiom
230: 		}
231: 	}
232: 	return &out
233: }
234: 
235: // applyHardwareEnv overlays SR-SIM card, XIOM, and MDA environment variables onto c.
236: // NOKIA_SROS_SLOT is left unchanged; it identifies the container rather than provisioned hardware.
237: func applyHardwareEnv(c *Component, env map[string]string) {
238: 	if c == nil || len(env) == 0 {
239: 		return
240: 	}
241: 	if card := env[envNokiaSrosCard]; card != "" {
242: 		c.Type = card
243: 	}
244: 	for key, val := range env {
245: 		if val == "" {
246: 			continue
247: 		}
248: 		switch {
249: 		case strings.HasPrefix(key, envNokiaSrosMDA+"_X"):
250: 			rest := strings.TrimPrefix(key, envNokiaSrosMDA+"_X")
251: 			xiomStr, mdaStr, ok := strings.Cut(rest, "_")
252: 			if !ok {
253: 				continue
254: 			}
255: 			xiomSlot, errX := strconv.Atoi(xiomStr)
256: 			mdaSlot, errM := strconv.Atoi(mdaStr)
257: 			if errX != nil || errM != nil || xiomSlot <= 0 || mdaSlot <= 0 {
258: 				continue
259: 			}
260: 			upsertXiomMDA(c, xiomSlot, mdaSlot, val)
261: 		case strings.HasPrefix(key, envNokiaSrosMDA+"_"):
262: 			slot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosMDA+"_"))
263: 			if err != nil || slot <= 0 {
264: 				continue
265: 			}
266: 			c.MDA = upsertMDA(c.MDA, slot, val)
267: 		case strings.HasPrefix(key, envNokiaSrosXIOM+"_X"):
268: 			slot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosXIOM+"_X"))
269: 			if err != nil || slot <= 0 {
270: 				continue
271: 			}
272: 			upsertXiomType(c, slot, val)
273: 		}
274: 	}
275: }
276: 
277: func upsertMDA(mdas MDAS, slot int, typ string) MDAS {
278: 	for i := range mdas {
279: 		if mdas[i].Slot == slot {
280: 			mdas[i].Type = typ
281: 			return mdas
282: 		}
283: 	}
284: 	return append(mdas, MDA{Slot: slot, Type: typ})
285: }
286: 
287: func upsertXiomType(c *Component, slot int, typ string) {
288: 	for i := range c.XIOM {
289: 		if c.XIOM[i].Slot == slot {
290: 			c.XIOM[i].Type = typ
291: 			return
292: 		}
293: 	}
294: 	c.XIOM = append(c.XIOM, XIOM{Slot: slot, Type: typ})
295: }
296: 
297: func upsertXiomMDA(c *Component, xiomSlot, mdaSlot int, typ string) {
298: 	for i := range c.XIOM {
299: 		if c.XIOM[i].Slot != xiomSlot {

(Showing lines 160-299 of 309. Use offset=300 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_150320c9c001itnWbLrriya8pK",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15032049a001SgeOLZUYf0tHJn",
  "callID": "call_e81f97c7943f4115a73d074a",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/component.go",
      "limit": 140,
      "offset": 160
    },
    "output": "<path>/source/head/nodes/sros/component.go</path>\n<type>file</type>\n<content>\n160: \t\t\t\tn.GetShortName(),\n161: \t\t\t\tcomponent.Slot,\n162: \t\t\t)\n163: \t\t}\n164: \t\t// add to component names map\n165: \t\tcomponentNames[slot] = struct{}{}\n166: \n167: \t}\n168: \treturn nil\n169: }\n170: \n171: // componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,\n172: // and per-component env. Per-component env overrides the typed fields.\n173: func componentDerivedEnv(c *Component) map[string]string {\n174: \tderived := map[string]string{}\n175: \tif c == nil {\n176: \t\treturn derived\n177: \t}\n178: \tsetComponentEnvVars(derived, c)\n179: \tmaps.Copy(derived, c.Env)\n180: \treturn derived\n181: }\n182: \n183: // warnUserEnvOverrides logs when a node env var replaces a component-derived value.\n184: func warnUserEnvOverrides(node string, derived, userEnv map[string]string) {\n185: \tfor key, componentValue := range derived {\n186: \t\tenvValue, userSet := userEnv[key]\n187: \t\tif !userSet || componentValue == envValue {\n188: \t\t\tcontinue\n189: \t\t}\n190: \t\tlog.Warn(\n191: \t\t\tfmt.Sprintf(\n192: \t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n193: \t\t\t\tcomponentValue,\n194: \t\t\t\tkey,\n195: \t\t\t),\n196: \t\t\t\"node\", node,\n197: \t\t\t\"env\", key,\n198: \t\t\t\"component-value\", componentValue,\n199: \t\t\t\"env-value\", envValue,\n200: \t\t)\n201: \t}\n202: }\n203: \n204: // keepUserEnv copies component-derived keys into dst unless the user already set that key.\n205: // A user value wins, and a differing component value is logged.\n206: func keepUserEnv(node string, dst, derived, userEnv map[string]string) {\n207: \twarnUserEnvOverrides(node, derived, userEnv)\n208: \tfor key, componentValue := range derived {\n209: \t\tif envValue, userSet := userEnv[key]; userSet {\n210: \t\t\tdst[key] = envValue\n211: \t\t\tcontinue\n212: \t\t}\n213: \t\tdst[key] = componentValue\n214: \t}\n215: }\n216: \n217: // cloneComponent returns a deep copy of c suitable for env overrides during config generation.\n218: func cloneComponent(c *Component) *Component {\n219: \tif c == nil {\n220: \t\treturn &Component{}\n221: \t}\n222: \tout := *c\n223: \tout.Env = maps.Clone(c.Env)\n224: \tout.MDA = slices.Clone(c.MDA)\n225: \tif len(c.XIOM) > 0 {\n226: \t\tout.XIOM = make(XIOMS, len(c.XIOM))\n227: \t\tfor i, xiom := range c.XIOM {\n228: \t\t\txiom.MDA = slices.Clone(xiom.MDA)\n229: \t\t\tout.XIOM[i] = xiom\n230: \t\t}\n231: \t}\n232: \treturn &out\n233: }\n234: \n235: // applyHardwareEnv overlays SR-SIM card, XIOM, and MDA environment variables onto c.\n236: // NOKIA_SROS_SLOT is left unchanged; it identifies the container rather than provisioned hardware.\n237: func applyHardwareEnv(c *Component, env map[string]string) {\n238: \tif c == nil || len(env) == 0 {\n239: \t\treturn\n240: \t}\n241: \tif card := env[envNokiaSrosCard]; card != \"\" {\n242: \t\tc.Type = card\n243: \t}\n244: \tfor key, val := range env {\n245: \t\tif val == \"\" {\n246: \t\t\tcontinue\n247: \t\t}\n248: \t\tswitch {\n249: \t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_X\"):\n250: \t\t\trest := strings.TrimPrefix(key, envNokiaSrosMDA+\"_X\")\n251: \t\t\txiomStr, mdaStr, ok := strings.Cut(rest, \"_\")\n252: \t\t\tif !ok {\n253: \t\t\t\tcontinue\n254: \t\t\t}\n255: \t\t\txiomSlot, errX := strconv.Atoi(xiomStr)\n256: \t\t\tmdaSlot, errM := strconv.Atoi(mdaStr)\n257: \t\t\tif errX != nil || errM != nil || xiomSlot <= 0 || mdaSlot <= 0 {\n258: \t\t\t\tcontinue\n259: \t\t\t}\n260: \t\t\tupsertXiomMDA(c, xiomSlot, mdaSlot, val)\n261: \t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_\"):\n262: \t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosMDA+\"_\"))\n263: \t\t\tif err != nil || slot <= 0 {\n264: \t\t\t\tcontinue\n265: \t\t\t}\n266: \t\t\tc.MDA = upsertMDA(c.MDA, slot, val)\n267: \t\tcase strings.HasPrefix(key, envNokiaSrosXIOM+\"_X\"):\n268: \t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosXIOM+\"_X\"))\n269: \t\t\tif err != nil || slot <= 0 {\n270: \t\t\t\tcontinue\n271: \t\t\t}\n272: \t\t\tupsertXiomType(c, slot, val)\n273: \t\t}\n274: \t}\n275: }\n276: \n277: func upsertMDA(mdas MDAS, slot int, typ string) MDAS {\n278: \tfor i := range mdas {\n279: \t\tif mdas[i].Slot == slot {\n280: \t\t\tmdas[i].Type = typ\n281: \t\t\treturn mdas\n282: \t\t}\n283: \t}\n284: \treturn append(mdas, MDA{Slot: slot, Type: typ})\n285: }\n286: \n287: func upsertXiomType(c *Component, slot int, typ string) {\n288: \tfor i := range c.XIOM {\n289: \t\tif c.XIOM[i].Slot == slot {\n290: \t\t\tc.XIOM[i].Type = typ\n291: \t\t\treturn\n292: \t\t}\n293: \t}\n294: \tc.XIOM = append(c.XIOM, XIOM{Slot: slot, Type: typ})\n295: }\n296: \n297: func upsertXiomMDA(c *Component, xiomSlot, mdaSlot int, typ string) {\n298: \tfor i := range c.XIOM {\n299: \t\tif c.XIOM[i].Slot != xiomSlot {\n\n(Showing lines 160-299 of 309. Use offset=300 to continue.)\n</content>",
    "title": "source/head/nodes/sros/component.go",
    "metadata": {
      "preview": "\t\t\t\tn.GetShortName(),\n\t\t\t\tcomponent.Slot,\n\t\t\t)\n\t\t}\n\t\t// add to component names map\n\t\tcomponentNames[slot] = struct{}{}\n\n\t}\n\treturn nil\n}\n\n// componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,\n// and per-component env. Per-component env overrides the typed fields.\nfunc componentDerivedEnv(c *Component) map[string]string {\n\tderived := map[string]string{}\n\tif c == nil {\n\t\treturn derived\n\t}\n\tsetComponentEnvVars(derived, c)\n\tmaps.Copy(derived, c.Env)",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/component.go",
        "text": "\t\t\t\tn.GetShortName(),\n\t\t\t\tcomponent.Slot,\n\t\t\t)\n\t\t}\n\t\t// add to component names map\n\t\tcomponentNames[slot] = struct{}{}\n\n\t}\n\treturn nil\n}\n\n// componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,\n// and per-component env. Per-component env overrides the typed fields.\nfunc componentDerivedEnv(c *Component) map[string]string {\n\tderived := map[string]string{}\n\tif c == nil {\n\t\treturn derived\n\t}\n\tsetComponentEnvVars(derived, c)\n\tmaps.Copy(derived, c.Env)\n\treturn derived\n}\n\n// warnUserEnvOverrides logs when a node env var replaces a component-derived value.\nfunc warnUserEnvOverrides(node string, derived, userEnv map[string]string) {\n\tfor key, componentValue := range derived {\n\t\tenvValue, userSet := userEnv[key]\n\t\tif !userSet || componentValue == envValue {\n\t\t\tcontinue\n\t\t}\n\t\tlog.Warn(\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n\t\t\t\tcomponentValue,\n\t\t\t\tkey,\n\t\t\t),\n\t\t\t\"node\", node,\n\t\t\t\"env\", key,\n\t\t\t\"component-value\", componentValue,\n\t\t\t\"env-value\", envValue,\n\t\t)\n\t}\n}\n\n// keepUserEnv copies component-derived keys into dst unless the user already set that key.\n// A user value wins, and a differing component value is logged.\nfunc keepUserEnv(node string, dst, derived, userEnv map[string]string) {\n\twarnUserEnvOverrides(node, derived, userEnv)\n\tfor key, componentValue := range derived {\n\t\tif envValue, userSet := userEnv[key]; userSet {\n\t\t\tdst[key] = envValue\n\t\t\tcontinue\n\t\t}\n\t\tdst[key] = componentValue\n\t}\n}\n\n// cloneComponent returns a deep copy of c suitable for env overrides during config generation.\nfunc cloneComponent(c *Component) *Component {\n\tif c == nil {\n\t\treturn &Component{}\n\t}\n\tout := *c\n\tout.Env = maps.Clone(c.Env)\n\tout.MDA = slices.Clone(c.MDA)\n\tif len(c.XIOM) > 0 {\n\t\tout.XIOM = make(XIOMS, len(c.XIOM))\n\t\tfor i, xiom := range c.XIOM {\n\t\t\txiom.MDA = slices.Clone(xiom.MDA)\n\t\t\tout.XIOM[i] = xiom\n\t\t}\n\t}\n\treturn &out\n}\n\n// applyHardwareEnv overlays SR-SIM card, XIOM, and MDA environment variables onto c.\n// NOKIA_SROS_SLOT is left unchanged; it identifies the container rather than provisioned hardware.\nfunc applyHardwareEnv(c *Component, env map[string]string) {\n\tif c == nil || len(env) == 0 {\n\t\treturn\n\t}\n\tif card := env[envNokiaSrosCard]; card != \"\" {\n\t\tc.Type = card\n\t}\n\tfor key, val := range env {\n\t\tif val == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tswitch {\n\t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_X\"):\n\t\t\trest := strings.TrimPrefix(key, envNokiaSrosMDA+\"_X\")\n\t\t\txiomStr, mdaStr, ok := strings.Cut(rest, \"_\")\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\txiomSlot, errX := strconv.Atoi(xiomStr)\n\t\t\tmdaSlot, errM := strconv.Atoi(mdaStr)\n\t\t\tif errX != nil || errM != nil || xiomSlot <= 0 || mdaSlot <= 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tupsertXiomMDA(c, xiomSlot, mdaSlot, val)\n\t\tcase strings.HasPrefix(key, envNokiaSrosMDA+\"_\"):\n\t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosMDA+\"_\"))\n\t\t\tif err != nil || slot <= 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tc.MDA = upsertMDA(c.MDA, slot, val)\n\t\tcase strings.HasPrefix(key, envNokiaSrosXIOM+\"_X\"):\n\t\t\tslot, err := strconv.Atoi(strings.TrimPrefix(key, envNokiaSrosXIOM+\"_X\"))\n\t\t\tif err != nil || slot <= 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tupsertXiomType(c, slot, val)\n\t\t}\n\t}\n}\n\nfunc upsertMDA(mdas MDAS, slot int, typ string) MDAS {\n\tfor i := range mdas {\n\t\tif mdas[i].Slot == slot {\n\t\t\tmdas[i].Type = typ\n\t\t\treturn mdas\n\t\t}\n\t}\n\treturn append(mdas, MDA{Slot: slot, Type: typ})\n}\n\nfunc upsertXiomType(c *Component, slot int, typ string) {\n\tfor i := range c.XIOM {\n\t\tif c.XIOM[i].Slot == slot {\n\t\t\tc.XIOM[i].Type = typ\n\t\t\treturn\n\t\t}\n\t}\n\tc.XIOM = append(c.XIOM, XIOM{Slot: slot, Type: typ})\n}\n\nfunc upsertXiomMDA(c *Component, xiomSlot, mdaSlot int, typ string) {\n\tfor i := range c.XIOM {\n\t\tif c.XIOM[i].Slot != xiomSlot {",
        "lineStart": 160,
        "lineEnd": 299,
        "totalLines": 309,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346819745,
      "end": 1792346819753
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_150320cab001YTrK4iodfNhY1M",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15032049a001SgeOLZUYf0tHJn",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 29050,
    "input": 92,
    "output": 29,
    "reasoning": 1,
    "cache": {
      "read": 28928,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_15032049a001SgeOLZUYf0tHJn",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346817690,
    "completed": 1792346819759
  },
  "parentID": "msg_150318b6b001z1GyFDwe1Oii29",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 29050,
    "input": 92,
    "output": 29,
    "reasoning": 1,
    "cache": {
      "read": 28928,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 45
step-start
{
  "type": "step-start",
  "id": "prt_150321839001ACd8eKqHUjPhar",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150320cb9001bDcZrOOMFAhHva"
}
Reasoning
`componentDerivedEnv` includes `c.Env` (per-component env) — good, per-component env semantics preserved. `keepUserEnv` copies derived into dst with user-env priority — good.

Now, `warnUserEnvOverrides(node, derived, userEnv)` — note it warns for every derived key that differs from user env. But there's a subtle behavior: `componentDerivedEnv(c)` is derived from the component type fields, and c.Env is merged INTO derived (component env overrides typed fields). If node env AND component env both set the same key to different values, warn shows the component-env value ("component value %q") vs node env value. Fine.

One more subtlety in `keepUserEnv`: `dst[key] = envValue` when userSet — this is a no-op for keys already in dst (componentConfig.Env already contains base env which includes user env), but for the standalone path `keepUserEnv` isn't used; `warnUserEnvOverrides` is used with vars then merge. Fine.

Edge: in `keepUserEnv`, when userSet, it writes envValue into dst even if dst already had it — fine, same value.

Now — one potential real issue: **`warnUserEnvOverrides` warns for every derived key differing from user env, including keys derived from `c.Env` that the user set at node level. That matches docs. OK.

Another: In `keepUserEnv`, derived includes ALL component env keys including arbitrary custom env keys the user set per component. If user set the same key at node level, keepUserEnv overrides with node value + warns. Good.

Now, one more check on `applyHardwareEnv`: `if card := env[envNokiaSrosCard]; card != ""` — but then the loop also processes keys with prefix envNokiaSrosMDA+"_" — note the order of switch cases: `MDA_X` before `MDA_` — correct since X prefix is more specific. But wait: `envNokiaSrosMDA + "_X"` = "NOKIA_SROS_MDA_X" and envNokiaSrosXIOM = "NOKIA_SROS_XIOM". Fine.

Edge: What about the env key `NOKIA_SROS_MDA_X1` (xiom mda without slot separator)? Handled by Cut failing → continue. Good.

Now — check `applyHardwareEnv` ignores envNokiaSrosSlot (documented). Good.

Now the remaining verification: `componentsForConfig`, `componentForConfig` in component_config.go, and `generateIntegratedComponentConfig`. Also `verifyIntegratedComponentType`? And check `componentWarnings` signature/behavior in chassis_info.go (lines 57-222 I haven't fully read). Let me read chassis_info.go fully and component_config.go fully. These are the core of the new validation logic.
`componentDerivedEnv` correctly folds in per-component env. Now let me read the full `chassis_info.go` and `component_config.go` — the core of the new validation and config-generation logic.
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/chassis_info.go"
}

Output

<path>/source/head/nodes/sros/chassis_info.go</path>
<type>file</type>
<content>
1: // Copyright 2025 Nokia
2: // Licensed under the BSD 3-Clause License.
3: // SPDX-License-Identifier: BSD-3-Clause
4: 
5: package sros
6: 
7: import (
8: 	"encoding/json"
9: 	"fmt"
10: 	"slices"
11: 	"strconv"
12: 	"strings"
13: )
14: 
15: // DefaultChassisInfoPath is the path to chassis_info.json inside SROS/SR SIM container images.
16: const DefaultChassisInfoPath = "/opt/nokia/chassis_info.json"
17: 
18: // chassisInfoFileLicense is prepended to the chassis_info.json file written to LabDir.
19: const chassisInfoFileLicense = "// Copyright 2026 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\n"
20: 
21: type chassisInfoEntry struct {
22: 	Alias      string            `json:"alias"`
23: 	CPM        []string          `json:"cpm"`
24: 	IOM        []string          `json:"iom"`
25: 	IOMSlots   int               `json:"iom_slots"`
26: 	MDA        []*string         `json:"mda"`
27: 	FixedMDAs  map[string]string `json:"fixed_mdas"`
28: 	SFM        []string          `json:"sfm"`
29: 	XIOM       []string          `json:"xiom"`
30: 	FixedHWCfg string            `json:"fixed_hw_cfg"`
31: 	Integrated bool              `json:"integrated"`
32: 	Redundant  bool              `json:"redundant"`
33: }
34: 
35: type chassisInfo map[string]chassisInfoEntry
36: 
37: func parseChassisInfo(content []byte) (chassisInfo, error) {
38: 	var info chassisInfo
39: 	if err := json.Unmarshal(content, &info); err != nil {
40: 		return nil, fmt.Errorf("parse chassis_info.json: %w", err)
41: 	}
42: 	return info, nil
43: }
44: 
45: func (i chassisInfo) entry(nodeType string) (chassisInfoEntry, bool) {
46: 	key := ""
47: 	for candidate := range i {
48: 		if strings.EqualFold(candidate, strings.TrimSpace(nodeType)) {
49: 			key = candidate
50: 			break
51: 		}
52: 	}
53: 	if key == "" {
54: 		return chassisInfoEntry{}, false
55: 	}
56: 
57: 	seen := map[string]struct{}{}
58: 	for {
59: 		if _, ok := seen[key]; ok {
60: 			return chassisInfoEntry{}, false
61: 		}
62: 		seen[key] = struct{}{}
63: 
64: 		entry := i[key]
65: 		if entry.Alias == "" {
66: 			return entry, true
67: 		}
68: 
69: 		key = ""
70: 		for candidate := range i {
71: 			if strings.EqualFold(candidate, entry.Alias) {
72: 				key = candidate
73: 				break
74: 			}
75: 		}
76: 		if key == "" {
77: 			return chassisInfoEntry{}, false
78: 		}
79: 	}
80: }
81: 
82: // componentWarnings returns best-effort validation warnings. It deliberately skips checks
83: // that chassis_info.json cannot express, such as which MDA types belong under a specific XIOM.
84: func (i chassisInfo) componentWarnings(nodeType, sfm string, components []*Component) []string {
85: 	entry, ok := i.entry(nodeType)
86: 	if !ok {
87: 		return []string{
88: 			fmt.Sprintf(
89: 				"chassis type %q is not present in chassis_info.json; component compatibility was not checked",
90: 				nodeType,
91: 			),
92: 		}
93: 	}
94: 
95: 	var warnings []string
96: 	if sfm != "" && len(entry.SFM) > 0 && !slices.Contains(entry.SFM, sfm) {
97: 		warnings = append(warnings, fmt.Sprintf(
98: 			"SFM type %q is not listed for chassis type %q",
99: 			sfm,
100: 			nodeType,
101: 		))
102: 	}
103: 
104: 	for _, component := range components {
105: 		if component == nil {
106: 			continue
107: 		}
108: 		slot := strings.ToUpper(strings.TrimSpace(component.Slot))
109: 		if slot == "" {
110: 			slot = slotAName
111: 		}
112: 
113: 		switch {
114: 		case slot == slotAName || slot == slotBName:
115: 			if slot == slotBName && !entry.Redundant {
116: 				warnings = append(warnings, fmt.Sprintf(
117: 					"component slot %s is not listed as supported for chassis type %q",
118: 					slot,
119: 					nodeType,
120: 				))
121: 			}
122: 			if component.Type != "" &&
123: 				entry.FixedHWCfg != "" &&
124: 				component.Type != entry.FixedHWCfg {
125: 				warnings = append(warnings, fmt.Sprintf(
126: 					"component type %q in slot %s does not match fixed hardware %q for chassis type %q",
127: 					component.Type,
128: 					slot,
129: 					entry.FixedHWCfg,
130: 					nodeType,
131: 				))
132: 			} else if component.Type != "" &&
133: 				entry.FixedHWCfg == "" &&
134: 				len(entry.CPM) > 0 &&
135: 				!slices.Contains(entry.CPM, component.Type) {
136: 				warnings = append(warnings, fmt.Sprintf(
137: 					"component type %q in slot %s is not listed for chassis type %q",
138: 					component.Type,
139: 					slot,
140: 					nodeType,
141: 				))
142: 			}
143: 		default:
144: 			numericSlot, err := strconv.Atoi(slot)
145: 			if err == nil {
146: 				if entry.IOMSlots > 0 && numericSlot > entry.IOMSlots {
147: 					warnings = append(warnings, fmt.Sprintf(
148: 						"component slot %s exceeds the %d IOM slots listed for chassis type %q",
149: 						slot,
150: 						entry.IOMSlots,
151: 						nodeType,
152: 					))
153: 				}
154: 				if component.Type != "" &&
155: 					len(entry.IOM) > 0 &&
156: 					!slices.Contains(entry.IOM, component.Type) {
157: 					warnings = append(warnings, fmt.Sprintf(
158: 						"component type %q in slot %s is not listed for chassis type %q",
159: 						component.Type,
160: 						slot,
161: 						nodeType,
162: 					))
163: 				}
164: 			}
165: 		}
166: 
167: 		for _, xiom := range component.XIOM {
168: 			if xiom.Type != "" &&
169: 				len(entry.XIOM) > 0 &&
170: 				!slices.Contains(entry.XIOM, xiom.Type) {
171: 				warnings = append(warnings, fmt.Sprintf(
172: 					"XIOM type %q in component slot %s is not listed for chassis type %q",
173: 					xiom.Type,
174: 					slot,
175: 					nodeType,
176: 				))
177: 			}
178: 		}
179: 
180: 		if entry.Integrated || (slot != slotAName && slot != slotBName) {
181: 			warnings = append(warnings, validateMDAs(nodeType, entry, component.MDA)...)
182: 		}
183: 	}
184: 
185: 	return warnings
186: }
187: 
188: func validateMDAs(nodeType string, entry chassisInfoEntry, mdas MDAS) []string {
189: 	var warnings []string
190: 	for _, mda := range mdas {
191: 		if fixed, exists := entry.FixedMDAs[strconv.Itoa(mda.Slot)]; exists {
192: 			if mda.Type != fixed {
193: 				warnings = append(warnings, fmt.Sprintf(
194: 					"MDA type %q in slot %d does not match fixed MDA %q for chassis type %q",
195: 					mda.Type,
196: 					mda.Slot,
197: 					fixed,
198: 					nodeType,
199: 				))
200: 			}
201: 			continue
202: 		}
203: 		if mda.Type != "" && !containsChassisType(entry.MDA, mda.Type) {
204: 			warnings = append(warnings, fmt.Sprintf(
205: 				"MDA type %q in slot %d is not listed for chassis type %q",
206: 				mda.Type,
207: 				mda.Slot,
208: 				nodeType,
209: 			))
210: 		}
211: 	}
212: 	return warnings
213: }
214: 
215: func containsChassisType(types []*string, value string) bool {
216: 	for _, typ := range types {
217: 		if typ != nil && *typ == value {
218: 			return true
219: 		}
220: 	}
221: 	return false
222: }

(End of file - total 222 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_150322c36001yMARHNvqmVG1AQ",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150320cb9001bDcZrOOMFAhHva",
  "callID": "call_2d3d45681b0945f6a21fa598",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/chassis_info.go"
    },
    "output": "<path>/source/head/nodes/sros/chassis_info.go</path>\n<type>file</type>\n<content>\n1: // Copyright 2025 Nokia\n2: // Licensed under the BSD 3-Clause License.\n3: // SPDX-License-Identifier: BSD-3-Clause\n4: \n5: package sros\n6: \n7: import (\n8: \t\"encoding/json\"\n9: \t\"fmt\"\n10: \t\"slices\"\n11: \t\"strconv\"\n12: \t\"strings\"\n13: )\n14: \n15: // DefaultChassisInfoPath is the path to chassis_info.json inside SROS/SR SIM container images.\n16: const DefaultChassisInfoPath = \"/opt/nokia/chassis_info.json\"\n17: \n18: // chassisInfoFileLicense is prepended to the chassis_info.json file written to LabDir.\n19: const chassisInfoFileLicense = \"// Copyright 2026 Nokia\\n// Licensed under the BSD 3-Clause License.\\n// SPDX-License-Identifier: BSD-3-Clause\\n\\n\"\n20: \n21: type chassisInfoEntry struct {\n22: \tAlias      string            `json:\"alias\"`\n23: \tCPM        []string          `json:\"cpm\"`\n24: \tIOM        []string          `json:\"iom\"`\n25: \tIOMSlots   int               `json:\"iom_slots\"`\n26: \tMDA        []*string         `json:\"mda\"`\n27: \tFixedMDAs  map[string]string `json:\"fixed_mdas\"`\n28: \tSFM        []string          `json:\"sfm\"`\n29: \tXIOM       []string          `json:\"xiom\"`\n30: \tFixedHWCfg string            `json:\"fixed_hw_cfg\"`\n31: \tIntegrated bool              `json:\"integrated\"`\n32: \tRedundant  bool              `json:\"redundant\"`\n33: }\n34: \n35: type chassisInfo map[string]chassisInfoEntry\n36: \n37: func parseChassisInfo(content []byte) (chassisInfo, error) {\n38: \tvar info chassisInfo\n39: \tif err := json.Unmarshal(content, &info); err != nil {\n40: \t\treturn nil, fmt.Errorf(\"parse chassis_info.json: %w\", err)\n41: \t}\n42: \treturn info, nil\n43: }\n44: \n45: func (i chassisInfo) entry(nodeType string) (chassisInfoEntry, bool) {\n46: \tkey := \"\"\n47: \tfor candidate := range i {\n48: \t\tif strings.EqualFold(candidate, strings.TrimSpace(nodeType)) {\n49: \t\t\tkey = candidate\n50: \t\t\tbreak\n51: \t\t}\n52: \t}\n53: \tif key == \"\" {\n54: \t\treturn chassisInfoEntry{}, false\n55: \t}\n56: \n57: \tseen := map[string]struct{}{}\n58: \tfor {\n59: \t\tif _, ok := seen[key]; ok {\n60: \t\t\treturn chassisInfoEntry{}, false\n61: \t\t}\n62: \t\tseen[key] = struct{}{}\n63: \n64: \t\tentry := i[key]\n65: \t\tif entry.Alias == \"\" {\n66: \t\t\treturn entry, true\n67: \t\t}\n68: \n69: \t\tkey = \"\"\n70: \t\tfor candidate := range i {\n71: \t\t\tif strings.EqualFold(candidate, entry.Alias) {\n72: \t\t\t\tkey = candidate\n73: \t\t\t\tbreak\n74: \t\t\t}\n75: \t\t}\n76: \t\tif key == \"\" {\n77: \t\t\treturn chassisInfoEntry{}, false\n78: \t\t}\n79: \t}\n80: }\n81: \n82: // componentWarnings returns best-effort validation warnings. It deliberately skips checks\n83: // that chassis_info.json cannot express, such as which MDA types belong under a specific XIOM.\n84: func (i chassisInfo) componentWarnings(nodeType, sfm string, components []*Component) []string {\n85: \tentry, ok := i.entry(nodeType)\n86: \tif !ok {\n87: \t\treturn []string{\n88: \t\t\tfmt.Sprintf(\n89: \t\t\t\t\"chassis type %q is not present in chassis_info.json; component compatibility was not checked\",\n90: \t\t\t\tnodeType,\n91: \t\t\t),\n92: \t\t}\n93: \t}\n94: \n95: \tvar warnings []string\n96: \tif sfm != \"\" && len(entry.SFM) > 0 && !slices.Contains(entry.SFM, sfm) {\n97: \t\twarnings = append(warnings, fmt.Sprintf(\n98: \t\t\t\"SFM type %q is not listed for chassis type %q\",\n99: \t\t\tsfm,\n100: \t\t\tnodeType,\n101: \t\t))\n102: \t}\n103: \n104: \tfor _, component := range components {\n105: \t\tif component == nil {\n106: \t\t\tcontinue\n107: \t\t}\n108: \t\tslot := strings.ToUpper(strings.TrimSpace(component.Slot))\n109: \t\tif slot == \"\" {\n110: \t\t\tslot = slotAName\n111: \t\t}\n112: \n113: \t\tswitch {\n114: \t\tcase slot == slotAName || slot == slotBName:\n115: \t\t\tif slot == slotBName && !entry.Redundant {\n116: \t\t\t\twarnings = append(warnings, fmt.Sprintf(\n117: \t\t\t\t\t\"component slot %s is not listed as supported for chassis type %q\",\n118: \t\t\t\t\tslot,\n119: \t\t\t\t\tnodeType,\n120: \t\t\t\t))\n121: \t\t\t}\n122: \t\t\tif component.Type != \"\" &&\n123: \t\t\t\tentry.FixedHWCfg != \"\" &&\n124: \t\t\t\tcomponent.Type != entry.FixedHWCfg {\n125: \t\t\t\twarnings = append(warnings, fmt.Sprintf(\n126: \t\t\t\t\t\"component type %q in slot %s does not match fixed hardware %q for chassis type %q\",\n127: \t\t\t\t\tcomponent.Type,\n128: \t\t\t\t\tslot,\n129: \t\t\t\t\tentry.FixedHWCfg,\n130: \t\t\t\t\tnodeType,\n131: \t\t\t\t))\n132: \t\t\t} else if component.Type != \"\" &&\n133: \t\t\t\tentry.FixedHWCfg == \"\" &&\n134: \t\t\t\tlen(entry.CPM) > 0 &&\n135: \t\t\t\t!slices.Contains(entry.CPM, component.Type) {\n136: \t\t\t\twarnings = append(warnings, fmt.Sprintf(\n137: \t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n138: \t\t\t\t\tcomponent.Type,\n139: \t\t\t\t\tslot,\n140: \t\t\t\t\tnodeType,\n141: \t\t\t\t))\n142: \t\t\t}\n143: \t\tdefault:\n144: \t\t\tnumericSlot, err := strconv.Atoi(slot)\n145: \t\t\tif err == nil {\n146: \t\t\t\tif entry.IOMSlots > 0 && numericSlot > entry.IOMSlots {\n147: \t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n148: \t\t\t\t\t\t\"component slot %s exceeds the %d IOM slots listed for chassis type %q\",\n149: \t\t\t\t\t\tslot,\n150: \t\t\t\t\t\tentry.IOMSlots,\n151: \t\t\t\t\t\tnodeType,\n152: \t\t\t\t\t))\n153: \t\t\t\t}\n154: \t\t\t\tif component.Type != \"\" &&\n155: \t\t\t\t\tlen(entry.IOM) > 0 &&\n156: \t\t\t\t\t!slices.Contains(entry.IOM, component.Type) {\n157: \t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n158: \t\t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n159: \t\t\t\t\t\tcomponent.Type,\n160: \t\t\t\t\t\tslot,\n161: \t\t\t\t\t\tnodeType,\n162: \t\t\t\t\t))\n163: \t\t\t\t}\n164: \t\t\t}\n165: \t\t}\n166: \n167: \t\tfor _, xiom := range component.XIOM {\n168: \t\t\tif xiom.Type != \"\" &&\n169: \t\t\t\tlen(entry.XIOM) > 0 &&\n170: \t\t\t\t!slices.Contains(entry.XIOM, xiom.Type) {\n171: \t\t\t\twarnings = append(warnings, fmt.Sprintf(\n172: \t\t\t\t\t\"XIOM type %q in component slot %s is not listed for chassis type %q\",\n173: \t\t\t\t\txiom.Type,\n174: \t\t\t\t\tslot,\n175: \t\t\t\t\tnodeType,\n176: \t\t\t\t))\n177: \t\t\t}\n178: \t\t}\n179: \n180: \t\tif entry.Integrated || (slot != slotAName && slot != slotBName) {\n181: \t\t\twarnings = append(warnings, validateMDAs(nodeType, entry, component.MDA)...)\n182: \t\t}\n183: \t}\n184: \n185: \treturn warnings\n186: }\n187: \n188: func validateMDAs(nodeType string, entry chassisInfoEntry, mdas MDAS) []string {\n189: \tvar warnings []string\n190: \tfor _, mda := range mdas {\n191: \t\tif fixed, exists := entry.FixedMDAs[strconv.Itoa(mda.Slot)]; exists {\n192: \t\t\tif mda.Type != fixed {\n193: \t\t\t\twarnings = append(warnings, fmt.Sprintf(\n194: \t\t\t\t\t\"MDA type %q in slot %d does not match fixed MDA %q for chassis type %q\",\n195: \t\t\t\t\tmda.Type,\n196: \t\t\t\t\tmda.Slot,\n197: \t\t\t\t\tfixed,\n198: \t\t\t\t\tnodeType,\n199: \t\t\t\t))\n200: \t\t\t}\n201: \t\t\tcontinue\n202: \t\t}\n203: \t\tif mda.Type != \"\" && !containsChassisType(entry.MDA, mda.Type) {\n204: \t\t\twarnings = append(warnings, fmt.Sprintf(\n205: \t\t\t\t\"MDA type %q in slot %d is not listed for chassis type %q\",\n206: \t\t\t\tmda.Type,\n207: \t\t\t\tmda.Slot,\n208: \t\t\t\tnodeType,\n209: \t\t\t))\n210: \t\t}\n211: \t}\n212: \treturn warnings\n213: }\n214: \n215: func containsChassisType(types []*string, value string) bool {\n216: \tfor _, typ := range types {\n217: \t\tif typ != nil && *typ == value {\n218: \t\t\treturn true\n219: \t\t}\n220: \t}\n221: \treturn false\n222: }\n\n(End of file - total 222 lines)\n</content>",
    "title": "source/head/nodes/sros/chassis_info.go",
    "metadata": {
      "preview": "// Copyright 2025 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\npackage sros\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"slices\"\n\t\"strconv\"\n\t\"strings\"\n)\n\n// DefaultChassisInfoPath is the path to chassis_info.json inside SROS/SR SIM container images.\nconst DefaultChassisInfoPath = \"/opt/nokia/chassis_info.json\"\n\n// chassisInfoFileLicense is prepended to the chassis_info.json file written to LabDir.\nconst chassisInfoFileLicense = \"// Copyright 2026 Nokia\\n// Licensed under the BSD 3-Clause License.\\n// SPDX-License-Identifier: BSD-3-Clause\\n\\n\"\n",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/chassis_info.go",
        "text": "// Copyright 2025 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\npackage sros\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"slices\"\n\t\"strconv\"\n\t\"strings\"\n)\n\n// DefaultChassisInfoPath is the path to chassis_info.json inside SROS/SR SIM container images.\nconst DefaultChassisInfoPath = \"/opt/nokia/chassis_info.json\"\n\n// chassisInfoFileLicense is prepended to the chassis_info.json file written to LabDir.\nconst chassisInfoFileLicense = \"// Copyright 2026 Nokia\\n// Licensed under the BSD 3-Clause License.\\n// SPDX-License-Identifier: BSD-3-Clause\\n\\n\"\n\ntype chassisInfoEntry struct {\n\tAlias      string            `json:\"alias\"`\n\tCPM        []string          `json:\"cpm\"`\n\tIOM        []string          `json:\"iom\"`\n\tIOMSlots   int               `json:\"iom_slots\"`\n\tMDA        []*string         `json:\"mda\"`\n\tFixedMDAs  map[string]string `json:\"fixed_mdas\"`\n\tSFM        []string          `json:\"sfm\"`\n\tXIOM       []string          `json:\"xiom\"`\n\tFixedHWCfg string            `json:\"fixed_hw_cfg\"`\n\tIntegrated bool              `json:\"integrated\"`\n\tRedundant  bool              `json:\"redundant\"`\n}\n\ntype chassisInfo map[string]chassisInfoEntry\n\nfunc parseChassisInfo(content []byte) (chassisInfo, error) {\n\tvar info chassisInfo\n\tif err := json.Unmarshal(content, &info); err != nil {\n\t\treturn nil, fmt.Errorf(\"parse chassis_info.json: %w\", err)\n\t}\n\treturn info, nil\n}\n\nfunc (i chassisInfo) entry(nodeType string) (chassisInfoEntry, bool) {\n\tkey := \"\"\n\tfor candidate := range i {\n\t\tif strings.EqualFold(candidate, strings.TrimSpace(nodeType)) {\n\t\t\tkey = candidate\n\t\t\tbreak\n\t\t}\n\t}\n\tif key == \"\" {\n\t\treturn chassisInfoEntry{}, false\n\t}\n\n\tseen := map[string]struct{}{}\n\tfor {\n\t\tif _, ok := seen[key]; ok {\n\t\t\treturn chassisInfoEntry{}, false\n\t\t}\n\t\tseen[key] = struct{}{}\n\n\t\tentry := i[key]\n\t\tif entry.Alias == \"\" {\n\t\t\treturn entry, true\n\t\t}\n\n\t\tkey = \"\"\n\t\tfor candidate := range i {\n\t\t\tif strings.EqualFold(candidate, entry.Alias) {\n\t\t\t\tkey = candidate\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif key == \"\" {\n\t\t\treturn chassisInfoEntry{}, false\n\t\t}\n\t}\n}\n\n// componentWarnings returns best-effort validation warnings. It deliberately skips checks\n// that chassis_info.json cannot express, such as which MDA types belong under a specific XIOM.\nfunc (i chassisInfo) componentWarnings(nodeType, sfm string, components []*Component) []string {\n\tentry, ok := i.entry(nodeType)\n\tif !ok {\n\t\treturn []string{\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"chassis type %q is not present in chassis_info.json; component compatibility was not checked\",\n\t\t\t\tnodeType,\n\t\t\t),\n\t\t}\n\t}\n\n\tvar warnings []string\n\tif sfm != \"\" && len(entry.SFM) > 0 && !slices.Contains(entry.SFM, sfm) {\n\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\"SFM type %q is not listed for chassis type %q\",\n\t\t\tsfm,\n\t\t\tnodeType,\n\t\t))\n\t}\n\n\tfor _, component := range components {\n\t\tif component == nil {\n\t\t\tcontinue\n\t\t}\n\t\tslot := strings.ToUpper(strings.TrimSpace(component.Slot))\n\t\tif slot == \"\" {\n\t\t\tslot = slotAName\n\t\t}\n\n\t\tswitch {\n\t\tcase slot == slotAName || slot == slotBName:\n\t\t\tif slot == slotBName && !entry.Redundant {\n\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\"component slot %s is not listed as supported for chassis type %q\",\n\t\t\t\t\tslot,\n\t\t\t\t\tnodeType,\n\t\t\t\t))\n\t\t\t}\n\t\t\tif component.Type != \"\" &&\n\t\t\t\tentry.FixedHWCfg != \"\" &&\n\t\t\t\tcomponent.Type != entry.FixedHWCfg {\n\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\"component type %q in slot %s does not match fixed hardware %q for chassis type %q\",\n\t\t\t\t\tcomponent.Type,\n\t\t\t\t\tslot,\n\t\t\t\t\tentry.FixedHWCfg,\n\t\t\t\t\tnodeType,\n\t\t\t\t))\n\t\t\t} else if component.Type != \"\" &&\n\t\t\t\tentry.FixedHWCfg == \"\" &&\n\t\t\t\tlen(entry.CPM) > 0 &&\n\t\t\t\t!slices.Contains(entry.CPM, component.Type) {\n\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n\t\t\t\t\tcomponent.Type,\n\t\t\t\t\tslot,\n\t\t\t\t\tnodeType,\n\t\t\t\t))\n\t\t\t}\n\t\tdefault:\n\t\t\tnumericSlot, err := strconv.Atoi(slot)\n\t\t\tif err == nil {\n\t\t\t\tif entry.IOMSlots > 0 && numericSlot > entry.IOMSlots {\n\t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\t\"component slot %s exceeds the %d IOM slots listed for chassis type %q\",\n\t\t\t\t\t\tslot,\n\t\t\t\t\t\tentry.IOMSlots,\n\t\t\t\t\t\tnodeType,\n\t\t\t\t\t))\n\t\t\t\t}\n\t\t\t\tif component.Type != \"\" &&\n\t\t\t\t\tlen(entry.IOM) > 0 &&\n\t\t\t\t\t!slices.Contains(entry.IOM, component.Type) {\n\t\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\t\"component type %q in slot %s is not listed for chassis type %q\",\n\t\t\t\t\t\tcomponent.Type,\n\t\t\t\t\t\tslot,\n\t\t\t\t\t\tnodeType,\n\t\t\t\t\t))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor _, xiom := range component.XIOM {\n\t\t\tif xiom.Type != \"\" &&\n\t\t\t\tlen(entry.XIOM) > 0 &&\n\t\t\t\t!slices.Contains(entry.XIOM, xiom.Type) {\n\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\"XIOM type %q in component slot %s is not listed for chassis type %q\",\n\t\t\t\t\txiom.Type,\n\t\t\t\t\tslot,\n\t\t\t\t\tnodeType,\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\n\t\tif entry.Integrated || (slot != slotAName && slot != slotBName) {\n\t\t\twarnings = append(warnings, validateMDAs(nodeType, entry, component.MDA)...)\n\t\t}\n\t}\n\n\treturn warnings\n}\n\nfunc validateMDAs(nodeType string, entry chassisInfoEntry, mdas MDAS) []string {\n\tvar warnings []string\n\tfor _, mda := range mdas {\n\t\tif fixed, exists := entry.FixedMDAs[strconv.Itoa(mda.Slot)]; exists {\n\t\t\tif mda.Type != fixed {\n\t\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\t\"MDA type %q in slot %d does not match fixed MDA %q for chassis type %q\",\n\t\t\t\t\tmda.Type,\n\t\t\t\t\tmda.Slot,\n\t\t\t\t\tfixed,\n\t\t\t\t\tnodeType,\n\t\t\t\t))\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif mda.Type != \"\" && !containsChassisType(entry.MDA, mda.Type) {\n\t\t\twarnings = append(warnings, fmt.Sprintf(\n\t\t\t\t\"MDA type %q in slot %d is not listed for chassis type %q\",\n\t\t\t\tmda.Type,\n\t\t\t\tmda.Slot,\n\t\t\t\tnodeType,\n\t\t\t))\n\t\t}\n\t}\n\treturn warnings\n}\n\nfunc containsChassisType(types []*string, value string) bool {\n\tfor _, typ := range types {\n\t\tif typ != nil && *typ == value {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}",
        "lineStart": 1,
        "lineEnd": 222,
        "totalLines": 222,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346827835,
      "end": 1792346827842
    }
  }
}
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/component_config.go"
}

Output

<path>/source/head/nodes/sros/component_config.go</path>
<type>file</type>
<content>
1: // Copyright 2025 Nokia
2: // Licensed under the BSD 3-Clause License.
3: // SPDX-License-Identifier: BSD-3-Clause
4: 
5: package sros
6: 
7: import (
8: 	"fmt"
9: 	"maps"
10: 	"slices"
11: 	"strings"
12: 
13: 	"github.com/charmbracelet/log"
14: )
15: 
16: const integratedSrosCardSlot = "1"
17: 
18: type integratedSrosDefaultComponent struct {
19: 	cardType     string
20: 	mdas         MDAS
21: 	allowedSlots []string
22: }
23: 
24: var integratedSrosDefaultComponents = map[string]integratedSrosDefaultComponent{
25: 	"sr-1": {
26: 		cardType:     "iom-1",
27: 		allowedSlots: []string{slotAName},
28: 		mdas: MDAS{
29: 			{Slot: 1, Type: "me6-100gb-qsfp28"},
30: 			{Slot: 2, Type: "me12-100gb-qsfp28"},
31: 		},
32: 	},
33: 	"sr-1s": {
34: 		cardType:     "xcm-1s",
35: 		allowedSlots: []string{slotAName},
36: 		mdas: MDAS{
37: 			{Slot: 1, Type: "s36-100gb-qsfp28"},
38: 		},
39: 	},
40: 	"ixr-r6": {
41: 		cardType:     "iom-ixr-r6",
42: 		allowedSlots: []string{slotAName, slotBName},
43: 		mdas: MDAS{
44: 			{Slot: 1, Type: "m6-10g-sfp++1-100g-qsfp28"},
45: 		},
46: 	},
47: 	"ixr-e2": {
48: 		cardType:     "imm2-qsfpdd+2-qsfp28+24-sfp28",
49: 		allowedSlots: []string{slotAName},
50: 		mdas: MDAS{
51: 			{Slot: 1, Type: "m2-qsfpdd+2-qsfp28+24-sfp28"},
52: 		},
53: 	},
54: 	"ixr-e2c": {
55: 		cardType:     "imm12-sfp28+2-qsfp28",
56: 		allowedSlots: []string{slotAName},
57: 		mdas: MDAS{
58: 			{Slot: 1, Type: "m12-sfp28+2-qsfp28"},
59: 		},
60: 	},
61: 	"ixr-e2n": {
62: 		cardType:     "imm4-sfp+4-sfp+",
63: 		allowedSlots: []string{slotAName},
64: 		mdas: MDAS{
65: 			{Slot: 1, Type: "m4-sfp+4-sfp+"},
66: 		},
67: 	},
68: 	"ixr-e2n-s": {
69: 		cardType:     "imm4-sfp+4-sfp+-s",
70: 		allowedSlots: []string{slotAName},
71: 		mdas: MDAS{
72: 			{Slot: 1, Type: "m4-sfp+4-sfp+-s"},
73: 		},
74: 	},
75: 	"ixr-e3c": {
76: 		cardType:     "imm4-qsfp28+16-sfp28+8-sfp56",
77: 		allowedSlots: []string{slotAName},
78: 		mdas: MDAS{
79: 			{Slot: 1, Type: "m4-qsfp28+16-sfp28+8-sfp56"},
80: 		},
81: 	},
82: 	"ixr-e3x": {
83: 		cardType:     "imm16-sfp112+15-sfp56+6-qsfpdd",
84: 		allowedSlots: []string{slotAName},
85: 		mdas: MDAS{
86: 			{Slot: 1, Type: "m16-sfp112+15-sfp56+6-qsfpdd"},
87: 		},
88: 	},
89: 	"ixr-e2sc": {
90: 		cardType:     "imm16-sfp++4-sfp28",
91: 		allowedSlots: []string{slotAName},
92: 		mdas: MDAS{
93: 			{Slot: 1, Type: "m16-sfp++4-sfp28"},
94: 		},
95: 	},
96: 	"ixr-ec": {
97: 		cardType:     "imm4-1g-tx+20-1g-sfp+6-10g-sfp+",
98: 		allowedSlots: []string{slotAName},
99: 		mdas: MDAS{
100: 			{Slot: 1, Type: "m4-1g-tx+20-1g-sfp+6-10g-sfp+"},
101: 		},
102: 	},
103: }
104: 
105: // componentCfgLine represents one SR OS config line for a component (card, sfm, xiom, mda).
106: // Adding a new component type = add a Kind and a case in String().
107: type componentCfgLine struct {
108: 	Kind     string // "card", "sfm", "xiom", "xiomMda", "mda"
109: 	Slot     string
110: 	Type     string
111: 	XiomSlot int
112: 	MdaSlot  int
113: }
114: 
115: // String returns the SR OS CLI config line for this component.
116: func (l componentCfgLine) String() string {
117: 	switch l.Kind {
118: 	case "card":
119: 		return fmt.Sprintf("/configure card %s card-type %s admin-state enable\n", l.Slot, l.Type)
120: 	case "sfm":
121: 		return fmt.Sprintf("/configure sfm %s sfm-type %s admin-state enable\n", l.Slot, l.Type)
122: 	case "xiom":
123: 		return fmt.Sprintf("/configure card %s xiom x%d xiom-type %s admin-state enable\n",
124: 			l.Slot, l.XiomSlot, l.Type)
125: 	case "xiomMda":
126: 		return fmt.Sprintf("/configure card %s xiom x%d mda %d mda-type %s admin-state enable\n",
127: 			l.Slot, l.XiomSlot, l.MdaSlot, l.Type)
128: 	case "mda":
129: 		return fmt.Sprintf("/configure card %s mda %d mda-type %s admin-state enable\n",
130: 			l.Slot, l.MdaSlot, l.Type)
131: 	default:
132: 		return ""
133: 	}
134: }
135: 
136: // buildComponentCfgLines turns root components into a slice of config lines (card, sfm, xiom,
137: // xiomMda, mda).
138: // CPM slots (A, B) are skipped. Components without Type are skipped (caller may log).
139: func buildComponentCfgLines(components []*Component, sfm string) []componentCfgLine {
140: 	var lines []componentCfgLine
141: 	for _, component := range components {
142: 		slot := strings.ToUpper(strings.TrimSpace(component.Slot))
143: 		if slot == slotAName || slot == slotBName {
144: 			continue
145: 		}
146: 		if component.Type == "" {
147: 			continue
148: 		}
149: 		lines = append(lines, componentCfgLine{Kind: "card", Slot: slot, Type: component.Type})
150: 		if sfm != "" {
151: 			lines = append(lines, componentCfgLine{Kind: "sfm", Slot: slot, Type: sfm})
152: 		}
153: 		for _, xiom := range component.XIOM {
154: 			if xiom.Type != "" {
155: 				lines = append(
156: 					lines,
157: 					componentCfgLine{
158: 						Kind:     "xiom",
159: 						Slot:     slot,
160: 						Type:     xiom.Type,
161: 						XiomSlot: xiom.Slot,
162: 					},
163: 				)
164: 			}
165: 			for _, mda := range xiom.MDA {
166: 				if mda.Type != "" {
167: 					lines = append(lines, componentCfgLine{
168: 						Kind: "xiomMda", Slot: slot, Type: mda.Type,
169: 						XiomSlot: xiom.Slot, MdaSlot: mda.Slot,
170: 					})
171: 				}
172: 			}
173: 		}
174: 		for _, mda := range component.MDA {
175: 			if mda.Type != "" {
176: 				lines = append(
177: 					lines,
178: 					componentCfgLine{Kind: "mda", Slot: slot, Type: mda.Type, MdaSlot: mda.Slot},
179: 				)
180: 			}
181: 		}
182: 	}
183: 	return lines
184: }
185: 
186: func buildIntegratedComponentCfgLines(nodeType string, override *Component) []componentCfgLine {
187: 	component, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]
188: 	if !ok {
189: 		return nil
190: 	}
191: 	if override == nil {
192: 		override = &Component{}
193: 	}
194: 
195: 	defaultMdas := component.mdas
196: 
197: 	if len(override.XIOM) > 0 {
198: 		defaultMdas = nil
199: 	}
200: 
201: 	card := &Component{
202: 		Slot: integratedSrosCardSlot,
203: 		Type: component.cardType,
204: 		XIOM: override.XIOM,
205: 		MDA:  mergeIntegratedMdas(defaultMdas, override.MDA),
206: 	}
207: 
208: 	return buildComponentCfgLines([]*Component{card}, "")
209: }
210: 
211: func mergeIntegratedMdas(defaults, overrides MDAS) MDAS {
212: 	bySlot := map[int]string{}
213: 	for _, mda := range slices.Concat(defaults, overrides) {
214: 		if mda.Slot > 0 && mda.Type != "" {
215: 			bySlot[mda.Slot] = mda.Type
216: 		}
217: 	}
218: 
219: 	slots := slices.Sorted(maps.Keys(bySlot))
220: 	mdas := make(MDAS, 0, len(slots))
221: 	for _, slot := range slots {
222: 		mdas = append(mdas, MDA{Slot: slot, Type: bySlot[slot]})
223: 	}
224: 	return mdas
225: }
226: 
227: func canonicalSrosNodeType(nodeType string) string {
228: 	return strings.ToLower(strings.TrimSpace(nodeType))
229: }
230: 
231: func integratedSrosDefault(nodeType string) (integratedSrosDefaultComponent, bool) {
232: 	component, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]
233: 	return component, ok
234: }
235: 
236: func isIntegratedSrosNodeType(nodeType string) bool {
237: 	_, ok := integratedSrosDefault(nodeType)
238: 	return ok
239: }
240: 
241: func integratedSrosAllowedSlots(nodeType string) []string {
242: 	component, ok := integratedSrosDefault(nodeType)
243: 	if !ok || len(component.allowedSlots) == 0 {
244: 		return []string{slotAName}
245: 	}
246: 	return component.allowedSlots
247: }
248: 
249: func isRedundantIntegratedSrosComponents(nodeType string, components []*Component) bool {
250: 	if !isIntegratedSrosNodeType(nodeType) || len(components) < 2 {
251: 		return false
252: 	}
253: 	for _, c := range components {
254: 		if strings.TrimSpace(c.Slot) == "" || !integratedSrosSlotAllowed(nodeType, c.Slot) {
255: 			return false
256: 		}
257: 	}
258: 	return true
259: }
260: 
261: func integratedSrosSlotAllowed(nodeType, slot string) bool {
262: 	slot = strings.ToUpper(strings.TrimSpace(slot))
263: 	if slot == "" {
264: 		slot = standaloneSlotName
265: 	}
266: 	return slices.Contains(integratedSrosAllowedSlots(nodeType), slot)
267: }
268: 
269: func (n *sros) generateComponentConfig() string {
270: 	if !n.kindSpecificCfg().GenComponentConfig {
271: 		return ""
272: 	}
273: 	if n.isConfigClassic() {
274: 		return ""
275: 	}
276: 
277: 	if isIntegratedSrosNodeType(n.Cfg.NodeType) {
278: 		return n.generateIntegratedComponentConfig()
279: 	}
280: 
281: 	components := n.rootComponents
282: 	if len(components) == 0 {
283: 		return ""
284: 	}
285: 
286: 	for _, c := range components {
287: 		slot := strings.ToUpper(strings.TrimSpace(c.Slot))
288: 		if slot == slotAName || slot == slotBName {
289: 			continue
290: 		}
291: 		if c.Type == "" {
292: 			log.Warn(
293: 				"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.",
294: 				"node",
295: 				n.Cfg.ShortName,
296: 				"slot",
297: 				slot,
298: 			)
299: 		}
300: 	}
301: 
302: 	lines := buildComponentCfgLines(n.componentsForConfig(components), n.componentSFM())
303: 	return n.componentConfigFromLines(lines)
304: }
305: 
306: // hardwareEnv is the topology env, which overrides component type, XIOM, and MDA.
307: // Nodes that have not been through Init expose that env on Cfg.Env.
308: func (n *sros) hardwareEnv() map[string]string {
309: 	if n.userEnv != nil {
310: 		return n.userEnv
311: 	}
312: 	return n.Cfg.Env
313: }
314: 
315: // componentSFM is the SFM used in generated config. NOKIA_SROS_SFM overrides the sfm key.
316: func (n *sros) componentSFM() string {
317: 	if sfm := n.hardwareEnv()[envNokiaSrosSFM]; sfm != "" {
318: 		return sfm
319: 	}
320: 	return n.kindSpecificCfg().SFM
321: }
322: 
323: // componentForConfig clones c and applies per-component env, then node env.
324: func (n *sros) componentForConfig(c *Component) *Component {
325: 	out := cloneComponent(c)
326: 	applyHardwareEnv(out, out.Env)
327: 	applyHardwareEnv(out, n.hardwareEnv())
328: 	return out
329: }
330: 
331: func (n *sros) componentsForConfig(components []*Component) []*Component {
332: 	out := make([]*Component, len(components))
333: 	for i, c := range components {
334: 		out[i] = n.componentForConfig(c)
335: 	}
336: 	return out
337: }
338: 
339: func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {
340: 	powerConfig := n.generatePowerConfig()
341: 	if len(lines) == 0 && powerConfig == "" {
342: 		return ""
343: 	}
344: 
345: 	var config strings.Builder
346: 	for _, l := range lines {
347: 		config.WriteString(l.String())
348: 	}
349: 	config.WriteString(powerConfig)
350: 	return config.String()
351: }
352: 
353: func (n *sros) generateIntegratedComponentConfig() string {
354: 	card := strings.TrimSpace(n.Cfg.Env[envNokiaSrosCard])
355: 	if card != "" {
356: 		log.Info(
357: 			"Card type override set on integrated chassis type, skipping component SR OS config generation",
358: 			"node",
359: 			n.Cfg.ShortName,
360: 			"type",
361: 			n.Cfg.NodeType,
362: 			"card",
363: 			card,
364: 		)
365: 		return ""
366: 	}
367: 
368: 	lines := buildIntegratedComponentCfgLines(
369: 		n.Cfg.NodeType,
370: 		n.componentForConfig(n.integratedComponentOverride()),
371: 	)
372: 	return n.componentConfigFromLines(lines)
373: }
374: 
375: // integratedComponentOverride returns the component that overrides the integrated defaults:
376: // the single component of a standalone node, or the component matching the slot of a
377: // redundant CPM node.
378: func (n *sros) integratedComponentOverride() *Component {
379: 	if n.rootCtrName == "" {
380: 		if len(n.kindSpecificCfg().Components) == 1 {
381: 			return n.kindSpecificCfg().Components[0]
382: 		}
383: 		return nil
384: 	}
385: 
386: 	slot := n.Cfg.Env[envNokiaSrosSlot]
387: 	for _, c := range n.rootComponents {
388: 		if strings.EqualFold(strings.TrimSpace(c.Slot), slot) {
389: 			return c
390: 		}
391: 	}
392: 	return nil
393: }

(End of file - total 393 lines)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_150322c77001Cy5YexAnsN2XCg",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150320cb9001bDcZrOOMFAhHva",
  "callID": "call_6a897561c29f4f2da63d5bf9",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/component_config.go"
    },
    "output": "<path>/source/head/nodes/sros/component_config.go</path>\n<type>file</type>\n<content>\n1: // Copyright 2025 Nokia\n2: // Licensed under the BSD 3-Clause License.\n3: // SPDX-License-Identifier: BSD-3-Clause\n4: \n5: package sros\n6: \n7: import (\n8: \t\"fmt\"\n9: \t\"maps\"\n10: \t\"slices\"\n11: \t\"strings\"\n12: \n13: \t\"github.com/charmbracelet/log\"\n14: )\n15: \n16: const integratedSrosCardSlot = \"1\"\n17: \n18: type integratedSrosDefaultComponent struct {\n19: \tcardType     string\n20: \tmdas         MDAS\n21: \tallowedSlots []string\n22: }\n23: \n24: var integratedSrosDefaultComponents = map[string]integratedSrosDefaultComponent{\n25: \t\"sr-1\": {\n26: \t\tcardType:     \"iom-1\",\n27: \t\tallowedSlots: []string{slotAName},\n28: \t\tmdas: MDAS{\n29: \t\t\t{Slot: 1, Type: \"me6-100gb-qsfp28\"},\n30: \t\t\t{Slot: 2, Type: \"me12-100gb-qsfp28\"},\n31: \t\t},\n32: \t},\n33: \t\"sr-1s\": {\n34: \t\tcardType:     \"xcm-1s\",\n35: \t\tallowedSlots: []string{slotAName},\n36: \t\tmdas: MDAS{\n37: \t\t\t{Slot: 1, Type: \"s36-100gb-qsfp28\"},\n38: \t\t},\n39: \t},\n40: \t\"ixr-r6\": {\n41: \t\tcardType:     \"iom-ixr-r6\",\n42: \t\tallowedSlots: []string{slotAName, slotBName},\n43: \t\tmdas: MDAS{\n44: \t\t\t{Slot: 1, Type: \"m6-10g-sfp++1-100g-qsfp28\"},\n45: \t\t},\n46: \t},\n47: \t\"ixr-e2\": {\n48: \t\tcardType:     \"imm2-qsfpdd+2-qsfp28+24-sfp28\",\n49: \t\tallowedSlots: []string{slotAName},\n50: \t\tmdas: MDAS{\n51: \t\t\t{Slot: 1, Type: \"m2-qsfpdd+2-qsfp28+24-sfp28\"},\n52: \t\t},\n53: \t},\n54: \t\"ixr-e2c\": {\n55: \t\tcardType:     \"imm12-sfp28+2-qsfp28\",\n56: \t\tallowedSlots: []string{slotAName},\n57: \t\tmdas: MDAS{\n58: \t\t\t{Slot: 1, Type: \"m12-sfp28+2-qsfp28\"},\n59: \t\t},\n60: \t},\n61: \t\"ixr-e2n\": {\n62: \t\tcardType:     \"imm4-sfp+4-sfp+\",\n63: \t\tallowedSlots: []string{slotAName},\n64: \t\tmdas: MDAS{\n65: \t\t\t{Slot: 1, Type: \"m4-sfp+4-sfp+\"},\n66: \t\t},\n67: \t},\n68: \t\"ixr-e2n-s\": {\n69: \t\tcardType:     \"imm4-sfp+4-sfp+-s\",\n70: \t\tallowedSlots: []string{slotAName},\n71: \t\tmdas: MDAS{\n72: \t\t\t{Slot: 1, Type: \"m4-sfp+4-sfp+-s\"},\n73: \t\t},\n74: \t},\n75: \t\"ixr-e3c\": {\n76: \t\tcardType:     \"imm4-qsfp28+16-sfp28+8-sfp56\",\n77: \t\tallowedSlots: []string{slotAName},\n78: \t\tmdas: MDAS{\n79: \t\t\t{Slot: 1, Type: \"m4-qsfp28+16-sfp28+8-sfp56\"},\n80: \t\t},\n81: \t},\n82: \t\"ixr-e3x\": {\n83: \t\tcardType:     \"imm16-sfp112+15-sfp56+6-qsfpdd\",\n84: \t\tallowedSlots: []string{slotAName},\n85: \t\tmdas: MDAS{\n86: \t\t\t{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"},\n87: \t\t},\n88: \t},\n89: \t\"ixr-e2sc\": {\n90: \t\tcardType:     \"imm16-sfp++4-sfp28\",\n91: \t\tallowedSlots: []string{slotAName},\n92: \t\tmdas: MDAS{\n93: \t\t\t{Slot: 1, Type: \"m16-sfp++4-sfp28\"},\n94: \t\t},\n95: \t},\n96: \t\"ixr-ec\": {\n97: \t\tcardType:     \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n98: \t\tallowedSlots: []string{slotAName},\n99: \t\tmdas: MDAS{\n100: \t\t\t{Slot: 1, Type: \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\"},\n101: \t\t},\n102: \t},\n103: }\n104: \n105: // componentCfgLine represents one SR OS config line for a component (card, sfm, xiom, mda).\n106: // Adding a new component type = add a Kind and a case in String().\n107: type componentCfgLine struct {\n108: \tKind     string // \"card\", \"sfm\", \"xiom\", \"xiomMda\", \"mda\"\n109: \tSlot     string\n110: \tType     string\n111: \tXiomSlot int\n112: \tMdaSlot  int\n113: }\n114: \n115: // String returns the SR OS CLI config line for this component.\n116: func (l componentCfgLine) String() string {\n117: \tswitch l.Kind {\n118: \tcase \"card\":\n119: \t\treturn fmt.Sprintf(\"/configure card %s card-type %s admin-state enable\\n\", l.Slot, l.Type)\n120: \tcase \"sfm\":\n121: \t\treturn fmt.Sprintf(\"/configure sfm %s sfm-type %s admin-state enable\\n\", l.Slot, l.Type)\n122: \tcase \"xiom\":\n123: \t\treturn fmt.Sprintf(\"/configure card %s xiom x%d xiom-type %s admin-state enable\\n\",\n124: \t\t\tl.Slot, l.XiomSlot, l.Type)\n125: \tcase \"xiomMda\":\n126: \t\treturn fmt.Sprintf(\"/configure card %s xiom x%d mda %d mda-type %s admin-state enable\\n\",\n127: \t\t\tl.Slot, l.XiomSlot, l.MdaSlot, l.Type)\n128: \tcase \"mda\":\n129: \t\treturn fmt.Sprintf(\"/configure card %s mda %d mda-type %s admin-state enable\\n\",\n130: \t\t\tl.Slot, l.MdaSlot, l.Type)\n131: \tdefault:\n132: \t\treturn \"\"\n133: \t}\n134: }\n135: \n136: // buildComponentCfgLines turns root components into a slice of config lines (card, sfm, xiom,\n137: // xiomMda, mda).\n138: // CPM slots (A, B) are skipped. Components without Type are skipped (caller may log).\n139: func buildComponentCfgLines(components []*Component, sfm string) []componentCfgLine {\n140: \tvar lines []componentCfgLine\n141: \tfor _, component := range components {\n142: \t\tslot := strings.ToUpper(strings.TrimSpace(component.Slot))\n143: \t\tif slot == slotAName || slot == slotBName {\n144: \t\t\tcontinue\n145: \t\t}\n146: \t\tif component.Type == \"\" {\n147: \t\t\tcontinue\n148: \t\t}\n149: \t\tlines = append(lines, componentCfgLine{Kind: \"card\", Slot: slot, Type: component.Type})\n150: \t\tif sfm != \"\" {\n151: \t\t\tlines = append(lines, componentCfgLine{Kind: \"sfm\", Slot: slot, Type: sfm})\n152: \t\t}\n153: \t\tfor _, xiom := range component.XIOM {\n154: \t\t\tif xiom.Type != \"\" {\n155: \t\t\t\tlines = append(\n156: \t\t\t\t\tlines,\n157: \t\t\t\t\tcomponentCfgLine{\n158: \t\t\t\t\t\tKind:     \"xiom\",\n159: \t\t\t\t\t\tSlot:     slot,\n160: \t\t\t\t\t\tType:     xiom.Type,\n161: \t\t\t\t\t\tXiomSlot: xiom.Slot,\n162: \t\t\t\t\t},\n163: \t\t\t\t)\n164: \t\t\t}\n165: \t\t\tfor _, mda := range xiom.MDA {\n166: \t\t\t\tif mda.Type != \"\" {\n167: \t\t\t\t\tlines = append(lines, componentCfgLine{\n168: \t\t\t\t\t\tKind: \"xiomMda\", Slot: slot, Type: mda.Type,\n169: \t\t\t\t\t\tXiomSlot: xiom.Slot, MdaSlot: mda.Slot,\n170: \t\t\t\t\t})\n171: \t\t\t\t}\n172: \t\t\t}\n173: \t\t}\n174: \t\tfor _, mda := range component.MDA {\n175: \t\t\tif mda.Type != \"\" {\n176: \t\t\t\tlines = append(\n177: \t\t\t\t\tlines,\n178: \t\t\t\t\tcomponentCfgLine{Kind: \"mda\", Slot: slot, Type: mda.Type, MdaSlot: mda.Slot},\n179: \t\t\t\t)\n180: \t\t\t}\n181: \t\t}\n182: \t}\n183: \treturn lines\n184: }\n185: \n186: func buildIntegratedComponentCfgLines(nodeType string, override *Component) []componentCfgLine {\n187: \tcomponent, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]\n188: \tif !ok {\n189: \t\treturn nil\n190: \t}\n191: \tif override == nil {\n192: \t\toverride = &Component{}\n193: \t}\n194: \n195: \tdefaultMdas := component.mdas\n196: \n197: \tif len(override.XIOM) > 0 {\n198: \t\tdefaultMdas = nil\n199: \t}\n200: \n201: \tcard := &Component{\n202: \t\tSlot: integratedSrosCardSlot,\n203: \t\tType: component.cardType,\n204: \t\tXIOM: override.XIOM,\n205: \t\tMDA:  mergeIntegratedMdas(defaultMdas, override.MDA),\n206: \t}\n207: \n208: \treturn buildComponentCfgLines([]*Component{card}, \"\")\n209: }\n210: \n211: func mergeIntegratedMdas(defaults, overrides MDAS) MDAS {\n212: \tbySlot := map[int]string{}\n213: \tfor _, mda := range slices.Concat(defaults, overrides) {\n214: \t\tif mda.Slot > 0 && mda.Type != \"\" {\n215: \t\t\tbySlot[mda.Slot] = mda.Type\n216: \t\t}\n217: \t}\n218: \n219: \tslots := slices.Sorted(maps.Keys(bySlot))\n220: \tmdas := make(MDAS, 0, len(slots))\n221: \tfor _, slot := range slots {\n222: \t\tmdas = append(mdas, MDA{Slot: slot, Type: bySlot[slot]})\n223: \t}\n224: \treturn mdas\n225: }\n226: \n227: func canonicalSrosNodeType(nodeType string) string {\n228: \treturn strings.ToLower(strings.TrimSpace(nodeType))\n229: }\n230: \n231: func integratedSrosDefault(nodeType string) (integratedSrosDefaultComponent, bool) {\n232: \tcomponent, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]\n233: \treturn component, ok\n234: }\n235: \n236: func isIntegratedSrosNodeType(nodeType string) bool {\n237: \t_, ok := integratedSrosDefault(nodeType)\n238: \treturn ok\n239: }\n240: \n241: func integratedSrosAllowedSlots(nodeType string) []string {\n242: \tcomponent, ok := integratedSrosDefault(nodeType)\n243: \tif !ok || len(component.allowedSlots) == 0 {\n244: \t\treturn []string{slotAName}\n245: \t}\n246: \treturn component.allowedSlots\n247: }\n248: \n249: func isRedundantIntegratedSrosComponents(nodeType string, components []*Component) bool {\n250: \tif !isIntegratedSrosNodeType(nodeType) || len(components) < 2 {\n251: \t\treturn false\n252: \t}\n253: \tfor _, c := range components {\n254: \t\tif strings.TrimSpace(c.Slot) == \"\" || !integratedSrosSlotAllowed(nodeType, c.Slot) {\n255: \t\t\treturn false\n256: \t\t}\n257: \t}\n258: \treturn true\n259: }\n260: \n261: func integratedSrosSlotAllowed(nodeType, slot string) bool {\n262: \tslot = strings.ToUpper(strings.TrimSpace(slot))\n263: \tif slot == \"\" {\n264: \t\tslot = standaloneSlotName\n265: \t}\n266: \treturn slices.Contains(integratedSrosAllowedSlots(nodeType), slot)\n267: }\n268: \n269: func (n *sros) generateComponentConfig() string {\n270: \tif !n.kindSpecificCfg().GenComponentConfig {\n271: \t\treturn \"\"\n272: \t}\n273: \tif n.isConfigClassic() {\n274: \t\treturn \"\"\n275: \t}\n276: \n277: \tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n278: \t\treturn n.generateIntegratedComponentConfig()\n279: \t}\n280: \n281: \tcomponents := n.rootComponents\n282: \tif len(components) == 0 {\n283: \t\treturn \"\"\n284: \t}\n285: \n286: \tfor _, c := range components {\n287: \t\tslot := strings.ToUpper(strings.TrimSpace(c.Slot))\n288: \t\tif slot == slotAName || slot == slotBName {\n289: \t\t\tcontinue\n290: \t\t}\n291: \t\tif c.Type == \"\" {\n292: \t\t\tlog.Warn(\n293: \t\t\t\t\"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.\",\n294: \t\t\t\t\"node\",\n295: \t\t\t\tn.Cfg.ShortName,\n296: \t\t\t\t\"slot\",\n297: \t\t\t\tslot,\n298: \t\t\t)\n299: \t\t}\n300: \t}\n301: \n302: \tlines := buildComponentCfgLines(n.componentsForConfig(components), n.componentSFM())\n303: \treturn n.componentConfigFromLines(lines)\n304: }\n305: \n306: // hardwareEnv is the topology env, which overrides component type, XIOM, and MDA.\n307: // Nodes that have not been through Init expose that env on Cfg.Env.\n308: func (n *sros) hardwareEnv() map[string]string {\n309: \tif n.userEnv != nil {\n310: \t\treturn n.userEnv\n311: \t}\n312: \treturn n.Cfg.Env\n313: }\n314: \n315: // componentSFM is the SFM used in generated config. NOKIA_SROS_SFM overrides the sfm key.\n316: func (n *sros) componentSFM() string {\n317: \tif sfm := n.hardwareEnv()[envNokiaSrosSFM]; sfm != \"\" {\n318: \t\treturn sfm\n319: \t}\n320: \treturn n.kindSpecificCfg().SFM\n321: }\n322: \n323: // componentForConfig clones c and applies per-component env, then node env.\n324: func (n *sros) componentForConfig(c *Component) *Component {\n325: \tout := cloneComponent(c)\n326: \tapplyHardwareEnv(out, out.Env)\n327: \tapplyHardwareEnv(out, n.hardwareEnv())\n328: \treturn out\n329: }\n330: \n331: func (n *sros) componentsForConfig(components []*Component) []*Component {\n332: \tout := make([]*Component, len(components))\n333: \tfor i, c := range components {\n334: \t\tout[i] = n.componentForConfig(c)\n335: \t}\n336: \treturn out\n337: }\n338: \n339: func (n *sros) componentConfigFromLines(lines []componentCfgLine) string {\n340: \tpowerConfig := n.generatePowerConfig()\n341: \tif len(lines) == 0 && powerConfig == \"\" {\n342: \t\treturn \"\"\n343: \t}\n344: \n345: \tvar config strings.Builder\n346: \tfor _, l := range lines {\n347: \t\tconfig.WriteString(l.String())\n348: \t}\n349: \tconfig.WriteString(powerConfig)\n350: \treturn config.String()\n351: }\n352: \n353: func (n *sros) generateIntegratedComponentConfig() string {\n354: \tcard := strings.TrimSpace(n.Cfg.Env[envNokiaSrosCard])\n355: \tif card != \"\" {\n356: \t\tlog.Info(\n357: \t\t\t\"Card type override set on integrated chassis type, skipping component SR OS config generation\",\n358: \t\t\t\"node\",\n359: \t\t\tn.Cfg.ShortName,\n360: \t\t\t\"type\",\n361: \t\t\tn.Cfg.NodeType,\n362: \t\t\t\"card\",\n363: \t\t\tcard,\n364: \t\t)\n365: \t\treturn \"\"\n366: \t}\n367: \n368: \tlines := buildIntegratedComponentCfgLines(\n369: \t\tn.Cfg.NodeType,\n370: \t\tn.componentForConfig(n.integratedComponentOverride()),\n371: \t)\n372: \treturn n.componentConfigFromLines(lines)\n373: }\n374: \n375: // integratedComponentOverride returns the component that overrides the integrated defaults:\n376: // the single component of a standalone node, or the component matching the slot of a\n377: // redundant CPM node.\n378: func (n *sros) integratedComponentOverride() *Component {\n379: \tif n.rootCtrName == \"\" {\n380: \t\tif len(n.kindSpecificCfg().Components) == 1 {\n381: \t\t\treturn n.kindSpecificCfg().Components[0]\n382: \t\t}\n383: \t\treturn nil\n384: \t}\n385: \n386: \tslot := n.Cfg.Env[envNokiaSrosSlot]\n387: \tfor _, c := range n.rootComponents {\n388: \t\tif strings.EqualFold(strings.TrimSpace(c.Slot), slot) {\n389: \t\t\treturn c\n390: \t\t}\n391: \t}\n392: \treturn nil\n393: }\n\n(End of file - total 393 lines)\n</content>",
    "title": "source/head/nodes/sros/component_config.go",
    "metadata": {
      "preview": "// Copyright 2025 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\npackage sros\n\nimport (\n\t\"fmt\"\n\t\"maps\"\n\t\"slices\"\n\t\"strings\"\n\n\t\"github.com/charmbracelet/log\"\n)\n\nconst integratedSrosCardSlot = \"1\"\n\ntype integratedSrosDefaultComponent struct {\n\tcardType     string\n\tmdas         MDAS",
      "truncated": false,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/component_config.go",
        "text": "// Copyright 2025 Nokia\n// Licensed under the BSD 3-Clause License.\n// SPDX-License-Identifier: BSD-3-Clause\n\npackage sros\n\nimport (\n\t\"fmt\"\n\t\"maps\"\n\t\"slices\"\n\t\"strings\"\n\n\t\"github.com/charmbracelet/log\"\n)\n\nconst integratedSrosCardSlot = \"1\"\n\ntype integratedSrosDefaultComponent struct {\n\tcardType     string\n\tmdas         MDAS\n\tallowedSlots []string\n}\n\nvar integratedSrosDefaultComponents = map[string]integratedSrosDefaultComponent{\n\t\"sr-1\": {\n\t\tcardType:     \"iom-1\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"me6-100gb-qsfp28\"},\n\t\t\t{Slot: 2, Type: \"me12-100gb-qsfp28\"},\n\t\t},\n\t},\n\t\"sr-1s\": {\n\t\tcardType:     \"xcm-1s\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"s36-100gb-qsfp28\"},\n\t\t},\n\t},\n\t\"ixr-r6\": {\n\t\tcardType:     \"iom-ixr-r6\",\n\t\tallowedSlots: []string{slotAName, slotBName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m6-10g-sfp++1-100g-qsfp28\"},\n\t\t},\n\t},\n\t\"ixr-e2\": {\n\t\tcardType:     \"imm2-qsfpdd+2-qsfp28+24-sfp28\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m2-qsfpdd+2-qsfp28+24-sfp28\"},\n\t\t},\n\t},\n\t\"ixr-e2c\": {\n\t\tcardType:     \"imm12-sfp28+2-qsfp28\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m12-sfp28+2-qsfp28\"},\n\t\t},\n\t},\n\t\"ixr-e2n\": {\n\t\tcardType:     \"imm4-sfp+4-sfp+\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m4-sfp+4-sfp+\"},\n\t\t},\n\t},\n\t\"ixr-e2n-s\": {\n\t\tcardType:     \"imm4-sfp+4-sfp+-s\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m4-sfp+4-sfp+-s\"},\n\t\t},\n\t},\n\t\"ixr-e3c\": {\n\t\tcardType:     \"imm4-qsfp28+16-sfp28+8-sfp56\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m4-qsfp28+16-sfp28+8-sfp56\"},\n\t\t},\n\t},\n\t\"ixr-e3x\": {\n\t\tcardType:     \"imm16-sfp112+15-sfp56+6-qsfpdd\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m16-sfp112+15-sfp56+6-qsfpdd\"},\n\t\t},\n\t},\n\t\"ixr-e2sc\": {\n\t\tcardType:     \"imm16-sfp++4-sfp28\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m16-sfp++4-sfp28\"},\n\t\t},\n\t},\n\t\"ixr-ec\": {\n\t\tcardType:     \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n\t\tallowedSlots: []string{slotAName},\n\t\tmdas: MDAS{\n\t\t\t{Slot: 1, Type: \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\"},\n\t\t},\n\t},\n}\n\n// componentCfgLine represents one SR OS config line for a component (card, sfm, xiom, mda).\n// Adding a new component type = add a Kind and a case in String().\ntype componentCfgLine struct {\n\tKind     string // \"card\", \"sfm\", \"xiom\", \"xiomMda\", \"mda\"\n\tSlot     string\n\tType     string\n\tXiomSlot int\n\tMdaSlot  int\n}\n\n// String returns the SR OS CLI config line for this component.\nfunc (l componentCfgLine) String() string {\n\tswitch l.Kind {\n\tcase \"card\":\n\t\treturn fmt.Sprintf(\"/configure card %s card-type %s admin-state enable\\n\", l.Slot, l.Type)\n\tcase \"sfm\":\n\t\treturn fmt.Sprintf(\"/configure sfm %s sfm-type %s admin-state enable\\n\", l.Slot, l.Type)\n\tcase \"xiom\":\n\t\treturn fmt.Sprintf(\"/configure card %s xiom x%d xiom-type %s admin-state enable\\n\",\n\t\t\tl.Slot, l.XiomSlot, l.Type)\n\tcase \"xiomMda\":\n\t\treturn fmt.Sprintf(\"/configure card %s xiom x%d mda %d mda-type %s admin-state enable\\n\",\n\t\t\tl.Slot, l.XiomSlot, l.MdaSlot, l.Type)\n\tcase \"mda\":\n\t\treturn fmt.Sprintf(\"/configure card %s mda %d mda-type %s admin-state enable\\n\",\n\t\t\tl.Slot, l.MdaSlot, l.Type)\n\tdefault:\n\t\treturn \"\"\n\t}\n}\n\n// buildComponentCfgLines turns root components into a slice of config lines (card, sfm, xiom,\n// xiomMda, mda).\n// CPM slots (A, B) are skipped. Components without Type are skipped (caller may log).\nfunc buildComponentCfgLines(components []*Component, sfm string) []componentCfgLine {\n\tvar lines []componentCfgLine\n\tfor _, component := range components {\n\t\tslot := strings.ToUpper(strings.TrimSpace(component.Slot))\n\t\tif slot == slotAName || slot == slotBName {\n\t\t\tcontinue\n\t\t}\n\t\tif component.Type == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tlines = append(lines, componentCfgLine{Kind: \"card\", Slot: slot, Type: component.Type})\n\t\tif sfm != \"\" {\n\t\t\tlines = append(lines, componentCfgLine{Kind: \"sfm\", Slot: slot, Type: sfm})\n\t\t}\n\t\tfor _, xiom := range component.XIOM {\n\t\t\tif xiom.Type != \"\" {\n\t\t\t\tlines = append(\n\t\t\t\t\tlines,\n\t\t\t\t\tcomponentCfgLine{\n\t\t\t\t\t\tKind:     \"xiom\",\n\t\t\t\t\t\tSlot:     slot,\n\t\t\t\t\t\tType:     xiom.Type,\n\t\t\t\t\t\tXiomSlot: xiom.Slot,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t}\n\t\t\tfor _, mda := range xiom.MDA {\n\t\t\t\tif mda.Type != \"\" {\n\t\t\t\t\tlines = append(lines, componentCfgLine{\n\t\t\t\t\t\tKind: \"xiomMda\", Slot: slot, Type: mda.Type,\n\t\t\t\t\t\tXiomSlot: xiom.Slot, MdaSlot: mda.Slot,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor _, mda := range component.MDA {\n\t\t\tif mda.Type != \"\" {\n\t\t\t\tlines = append(\n\t\t\t\t\tlines,\n\t\t\t\t\tcomponentCfgLine{Kind: \"mda\", Slot: slot, Type: mda.Type, MdaSlot: mda.Slot},\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\treturn lines\n}\n\nfunc buildIntegratedComponentCfgLines(nodeType string, override *Component) []componentCfgLine {\n\tcomponent, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]\n\tif !ok {\n\t\treturn nil\n\t}\n\tif override == nil {\n\t\toverride = &Component{}\n\t}\n\n\tdefaultMdas := component.mdas\n\n\tif len(override.XIOM) > 0 {\n\t\tdefaultMdas = nil\n\t}\n\n\tcard := &Component{\n\t\tSlot: integratedSrosCardSlot,\n\t\tType: component.cardType,\n\t\tXIOM: override.XIOM,\n\t\tMDA:  mergeIntegratedMdas(defaultMdas, override.MDA),\n\t}\n\n\treturn buildComponentCfgLines([]*Component{card}, \"\")\n}\n\nfunc mergeIntegratedMdas(defaults, overrides MDAS) MDAS {\n\tbySlot := map[int]string{}\n\tfor _, mda := range slices.Concat(defaults, overrides) {\n\t\tif mda.Slot > 0 && mda.Type != \"\" {\n\t\t\tbySlot[mda.Slot] = mda.Type\n\t\t}\n\t}\n\n\tslots := slices.Sorted(maps.Keys(bySlot))\n\tmdas := make(MDAS, 0, len(slots))\n\tfor _, slot := range slots {\n\t\tmdas = append(mdas, MDA{Slot: slot, Type: bySlot[slot]})\n\t}\n\treturn mdas\n}\n\nfunc canonicalSrosNodeType(nodeType string) string {\n\treturn strings.ToLower(strings.TrimSpace(nodeType))\n}\n\nfunc integratedSrosDefault(nodeType string) (integratedSrosDefaultComponent, bool) {\n\tcomponent, ok := integratedSrosDefaultComponents[canonicalSrosNodeType(nodeType)]\n\treturn component, ok\n}\n\nfunc isIntegratedSrosNodeType(nodeType string) bool {\n\t_, ok := integratedSrosDefault(nodeType)\n\treturn ok\n}\n\nfunc integratedSrosAllowedSlots(nodeType string) []string {\n\tcomponent, ok := integratedSrosDefault(nodeType)\n\tif !ok || len(component.allowedSlots) == 0 {\n\t\treturn []string{slotAName}\n\t}\n\treturn component.allowedSlots\n}\n\nfunc isRedundantIntegratedSrosComponents(nodeType string, components []*Component) bool {\n\tif !isIntegratedSrosNodeType(nodeType) || len(components) < 2 {\n\t\treturn false\n\t}\n\tfor _, c := range components {\n\t\tif strings.TrimSpace(c.Slot) == \"\" || !integratedSrosSlotAllowed(nodeType, c.Slot) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\nfunc integratedSrosSlotAllowed(nodeType, slot string) bool {\n\tslot = strings.ToUpper(strings.TrimSpace(slot))\n\tif slot == \"\" {\n\t\tslot = standaloneSlotName\n\t}\n\treturn slices.Contains(integratedSrosAllowedSlots(nodeType), slot)\n}\n\nfunc (n *sros) generateComponentConfig() string {\n\tif !n.kindSpecificCfg().GenComponentConfig {\n\t\treturn \"\"\n\t}\n\tif n.isConfigClassic() {\n\t\treturn \"\"\n\t}\n\n\tif isIntegratedSrosNodeType(n.Cfg.NodeType) {\n\t\treturn n.generateIntegratedComponentConfig()\n\t}\n\n\tcomponents := n.rootComponents\n\tif len(components) == 0 {\n\t\treturn \"\"\n\t}\n\n\tfor _, c := range components {\n\t\tslot := strings.ToUpper(strings.TrimSpace(c.Slot))\n\t\tif slot == slotAName || slot == slotBName {\n\t\t\tcontinue\n\t\t}\n\t\tif c.Type == \"\" {\n\t\t\tlog.Warn(\n\t\t\t\t\"SR-SIM node has no type set for component in slot, skipping component SR OS config generation.\",\n\t\t\t\t\"node\",\n\t\t\t\tn.Cfg.ShortName,\n\t\t\t\t\"slot\",\n\t\t\t\tslot,\n\t\t\t)\n\t\t}\n\t}\n\n\tlines := buildComponentCfgLines(n.componentsForConfig(components), n.componentSFM())\n\treturn n.componentConfigFromLines(lines)\n}\n\n// hardwareEnv is the topology env, which overrides component type, XIOM, and MDA.\n// Nodes that have not been through Init expose that env on Cfg.Env.\nfunc (n *sros) hardwareEnv() map[string]string {\n\tif n.userEnv != nil {\n\t\treturn n.userEnv\n\t}\n\treturn n.Cfg.Env\n}\n\n// componentSFM is the SFM used in generated config. NOKIA_SROS_SFM overrides the sfm key.\nfunc (n *sros) componentSFM() string {\n\tif sfm := n.hardwareEnv()[envNokiaSrosSFM]; sfm != \"\" {\n\t\treturn sfm\n\t}\n\treturn n.kindSpecificCfg().SFM\n}\n\n// componentForConfig clones c and applies per-component env, then node env.\nfunc (n *sros) componentForConfig(c *Component) *Component {\n\tout := cloneComponent(c)\n\tapplyHardwareEnv(out, out.Env)\n\tapplyHardwareEnv(out, n.hardwareEnv())\n\treturn out\n}\n\nfunc (n *sros) componentsForConfig(components []*Component) []*Component {\n\tout := make([]*Component, len(components))\n\tfor i, c := range components {\n\t\tout[i] = n.componentForConfig(c)\n\t}\n\treturn out\n}\n\nfunc (n *sros) componentConfigFromLines(lines []componentCfgLine) string {\n\tpowerConfig := n.generatePowerConfig()\n\tif len(lines) == 0 && powerConfig == \"\" {\n\t\treturn \"\"\n\t}\n\n\tvar config strings.Builder\n\tfor _, l := range lines {\n\t\tconfig.WriteString(l.String())\n\t}\n\tconfig.WriteString(powerConfig)\n\treturn config.String()\n}\n\nfunc (n *sros) generateIntegratedComponentConfig() string {\n\tcard := strings.TrimSpace(n.Cfg.Env[envNokiaSrosCard])\n\tif card != \"\" {\n\t\tlog.Info(\n\t\t\t\"Card type override set on integrated chassis type, skipping component SR OS config generation\",\n\t\t\t\"node\",\n\t\t\tn.Cfg.ShortName,\n\t\t\t\"type\",\n\t\t\tn.Cfg.NodeType,\n\t\t\t\"card\",\n\t\t\tcard,\n\t\t)\n\t\treturn \"\"\n\t}\n\n\tlines := buildIntegratedComponentCfgLines(\n\t\tn.Cfg.NodeType,\n\t\tn.componentForConfig(n.integratedComponentOverride()),\n\t)\n\treturn n.componentConfigFromLines(lines)\n}\n\n// integratedComponentOverride returns the component that overrides the integrated defaults:\n// the single component of a standalone node, or the component matching the slot of a\n// redundant CPM node.\nfunc (n *sros) integratedComponentOverride() *Component {\n\tif n.rootCtrName == \"\" {\n\t\tif len(n.kindSpecificCfg().Components) == 1 {\n\t\t\treturn n.kindSpecificCfg().Components[0]\n\t\t}\n\t\treturn nil\n\t}\n\n\tslot := n.Cfg.Env[envNokiaSrosSlot]\n\tfor _, c := range n.rootComponents {\n\t\tif strings.EqualFold(strings.TrimSpace(c.Slot), slot) {\n\t\t\treturn c\n\t\t}\n\t}\n\treturn nil\n}",
        "lineStart": 1,
        "lineEnd": 393,
        "totalLines": 393,
        "truncated": false
      }
    },
    "time": {
      "start": 1792346827899,
      "end": 1792346827908
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_150322c87001bN11K6FJMvrpzN",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150320cb9001bDcZrOOMFAhHva",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 31297,
    "input": 30620,
    "output": 78,
    "reasoning": 599,
    "cache": {
      "read": 0,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_150320cb9001bDcZrOOMFAhHva",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346819769,
    "completed": 1792346827915
  },
  "parentID": "msg_150318b6b001z1GyFDwe1Oii29",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 31297,
    "input": 30620,
    "output": 78,
    "reasoning": 599,
    "cache": {
      "read": 0,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 46
step-start
{
  "type": "step-start",
  "id": "prt_150323567001uZmdqGwpt3cCmJ",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150322c97001uj2W43347p13ml"
}
Reasoning
Now I have a very complete picture. Let me analyze for findings carefully.

**Analysis of `componentWarnings` (chassis_info.go):**

Line 180: `if entry.Integrated || (slot != slotAName && slot != slotBName)` — MDAs are validated for integrated entries or non-CPM slots. For a distributed base node (e.g. `sr-7s` non-integrated) with CPM slots A/B and MDA entries on CPM component — MDAs on CPM slots are not validated. That matches hardware semantics (MDAs live on line cards/IOMs). OK.

Wait, but there's a subtlety at line 180: for the redundant integrated case (ixr-r6 with A and B components, entry.Integrated=true), each CPM component's MDAs are validated. In the test `redundant_integrated_components_are_distributed`, component A has MDA {Slot 1, m6-10g...} → validated against entry.MDA. OK.

**Potential issue 1 — `validateMDAs` and `FixedMDAs` interaction with env-configured MDAs.** Fine.

**Potential issue 2 — `componentWarnings` for line-card components with MDA under a non-integrated entry**: for line card slot 2 on sr-7s, MDAs validated against entry.MDA (the chassis-level MDA list). Reasonable.

**Potential issue 3 — `warnUnsupportedComponents` nodeType: `n.Cfg.Env[envNokiaSrosChassis]`.** srosEnv sets `srosEnv[envNokiaSrosChassis] = n.Cfg.NodeType` (line 309, package-level map mutation). For the standalone node, Cfg.Env merged contains chassis = NodeType. So nodeType := Cfg.Env[envNokiaSrosChassis] equals lowercased? No — it's NodeType as-is (e.g. "ixr-e2"). `chassisInfo.entry` does case-insensitive match, fine. But note: the override `nodeType = chassis` only differs from `n.Cfg.NodeType` if... they're the same by construction (srosEnv set from NodeType). Unless a user explicitly sets NOKIA_SROS_CHASSIS env to something different — then MergeStringMaps order: `srosEnv, vars, n.Cfg.Env` — user env last wins. So user can override NOKIA_SROS_CHASSIS, and the validation then checks against the user-specified chassis. That's intentional ("chassis env override"). Hmm wait — is that intentional? srosEnv[envNokiaSrosChassis] is set to NodeType; user can override. The warning path uses it. Reasonable.

**Package-level `srosEnv` mutation race** — pre-existing (lines 309/312 in base too). Not a finding.

**Potential issue 4 — `entry()` alias loop map iteration order nondeterminism:** if multiple keys match EqualFold... map iteration order is random; but keys differing only in case shouldn't co-exist in well-formed chassis_info.json. Not a real issue.

**Potential issue 5 — alias cycle detection returns "not present" warning on cycle:** acceptable best-effort.

**Potential issue 6 — `warnUnsupportedComponents` uses `n.componentForConfig(nil)` when effective empty.** For a standalone non-integrated node (e.g., sr-7s without components): effective = component from env only (card from NOKIA_SROS_CARD env). If no card env, component.Type = "" → no warnings. Fine.

But wait — for a standalone integrated node (sr-1 with no components), `effective = []*Component{n.componentForConfig(nil)}` — componentWarnings then checks the synthesized component (slot A) against entry.FixedHWCfg. For sr-1: FixedHWCfg = "iom-1"? If env NOKIA_SROS_CARD=iom-2, warning issued. But note generateIntegratedComponentConfig SKIPS config generation when card override is set (log.Info + return ""). So for sr-1 + NOKIA_SROS_CARD=iom-2, no card config is generated, but the warning machinery validates the override. OK.

Hmm, but actually for sr-1 with env card override, `generateIntegratedComponentConfig` returns "" — meaning no card/MDA config at all is generated (previously the default config was generated when no components). Is that a behavior regression? Old behavior (base): `generateComponentConfig` — base version: for integrated with no components → `buildIntegratedComponentCfgLines(...)` → default config. With env NOKIA_SROS_CARD set (standalone single-slot): base code errored in setupStandaloneComponents if isSingleSlotIntegratedSrosNodeType. Hmm — for sr-1 the env override path: base `isSingleSlotIntegratedSrosNodeType(nodeType)` — which node types were "single slot integrated"? Let me check base version of isSingleSlotIntegratedSrosNodeType. From the removed diff code (line 1771-1778): error "is integrated and does not support component card-type override". And base `generateComponentConfig` used `buildIntegratedComponentCfgLines(n.Cfg.NodeType, n.Cfg.Env)` — passing ENV, and buildIntegratedComponentCfgLines(base) probably read env overrides. The head version: skip generation entirely when NOKIA_SROS_CARD set on integrated chassis. So behavior change: previously env override produced modified config; now it produces NO component config (the card is presumably configured by the image itself via NOKIA_SROS_CARD env since the SR-SIM image auto-configures based on env?). This matches the docs statement: "a components `type` sets NOKIA_SROS_CARD and makes containerlab skip generated card/MDA config". OK, intentional.

**Potential issue 7 — `buildComponentCfgLines` emits SFM line for every line card slot:** `if sfm != "" { lines = append(..., Kind: "sfm", Slot: slot...) }`. For multiple line cards, each gets `/configure sfm <slot> sfm-type X admin-state enable`. Is that correct SR OS syntax — SFMs are separate chassis slots, not per line-card slot. Hmm. In base code, buildComponentCfgLines existed already (moved). Let me check whether base had the same sfm emission — yes, buildComponentCfgLines is moved from base sros.go (component_config.go is new file but logic moved). Actually wait — component_config.go is a NEW file (A in manifest). Was buildComponentCfgLines previously in sros.go? The diff for component_config.go (lines 312-537) is all additions. Let me check if buildComponentCfgLines was removed from sros.go in the diff — the sros.go diff hunks I read show removals of generateComponentConfig, componentConfigFromLines, prepareConfigTemplateData etc. buildComponentCfgLines wasn't shown as removed from sros.go in the hunks I read (1588-2547). Hmm, maybe it was in another removed hunk. The removals in sros.go: DeleteNetnsSymlink, setComponentEnvVars, GetNSPath, checkComponentSlotsConfig, createSROSConfigFiles, buildStartupConfig, prepareConfigTemplateData, isIXRNode/isSARNode/isSARHmNode, getTemplateForVariant, selectConfigTemplate, addDefaultConfig, addPartialConfig, buildPKIImportXML, buildTLSProfileXML, isConfigClassic, isFullConfigFile, generateComponentConfig, componentConfigFromLines, ensureNetnsProgramming... So buildComponentCfgLines must have already existed somewhere — in component.go base? component.go base version — diff hunk 643-851 showed additions to component.go (Component struct etc.). Base component.go existed (M). So buildComponentCfgLines likely already in base component.go — moved to component_config.go. Since component_config.go is a new file with all-added lines, and component.go diff may show removals of buildComponentCfgLines. I read component.go diff 643-851 earlier? Per prior summary I read the component.go hunk. I don't remember exactly. This is refactoring; not a new-behavior concern unless semantics changed. The SFM-per-linecard emission is pre-existing logic moved. Not a finding.

**Now the key new-code issues to weigh:**

A. **`warnUserEnvOverrides` and SFM inline duplication (P4).** The Init SFM branch inlines exactly the same warn logic as warnUserEnvOverrides for one key. Could be `warnUserEnvOverrides(n.Cfg.ShortName, map[string]string{envNokiaSrosSFM: sfm}, n.userEnv)` — but only when sfm != "". Actually simpler: keep. P4 optional.

Hmm, but wait — there's an inconsistency: in Init, the SFM warn fires when `userEnv[envNokiaSrosSFM]` differs from kindSpecificCfg().SFM. But `componentSFM()` already gives priority to env. The inline warn duplicates. Also the log message says "component value %q will not be used because environment variable %s is set" — fine.

But notice: the SFM branch sets `n.Cfg.Env[envNokiaSrosSFM] = sfm` only when user didn't set it. But it does this BEFORE the standalone merge `MergeStringMaps(srosEnv, vars, n.Cfg.Env)` — so Cfg.Env now contains SFM value; then MergeStringMaps merges again with Cfg.Env — SFM from kindSpecificCfg lands in final env. OK.

However — for standalone nodes, if the user set NOKIA_SROS_SFM at node level to a different value, warn fires from the inline branch. And ALSO `warnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)` at line 327 — vars comes from setupStandaloneComponents which does NOT include SFM (setComponentEnvVars sets card/xiom/mda only; component env c.Env could include SFM). So no double warning unless component env also sets SFM. OK.

B. **`componentsForConfig` allocation**: `make([]*Component, len(components))` fine.

C. **`applyHardwareEnv(out, out.Env)`** — applies per-component env overrides onto the cloned component; then node env. Precedence: per-component env, then node env. But what about `c.Env` values that aren't hardware keys — they stay in out.Env harmlessly. OK.

D. **Bug candidate — `componentForConfig` in `generateIntegratedComponentConfig` double-application.** `n.componentForConfig(n.integratedComponentOverride())` — integratedComponentOverride returns the topology component; componentForConfig applies out.Env (component env) and hardwareEnv (node env). Fine.

But hold on: for the redundant integrated CPM component node, `n.Cfg.Env[envNokiaSrosCard]` — component node env includes NOKIA_SROS_CARD if user set it at node level OR if the component has Type set (keepUserEnv sets card from component.Type derived env). Wait! For ixr-r6 with components A (type cpiom-ixr-r6, as in test): component node env gets NOKIA_SROS_CARD=cpiom-ixr-r6 (from componentDerivedEnv → setComponentEnvVars sets envNokiaSrosCard). Then component node Init → isStandaloneNode? Component node: Components=nil (line 658), envNokiaSrosSlot set → isDistributedCardNode() true → standalone false. generateComponentConfig → isIntegratedSrosNodeType("ixr-r6") → generateIntegratedComponentConfig → card := Cfg.Env[envNokiaSrosCard] = "cpiom-ixr-r6" ≠ "" → log.Info "Card type override set on integrated chassis type, skipping component SR OS config generation" → return "".

Hmm! So for the redundant integrated case, when components have explicit `type`, each CPM component node SKIPS integrated config generation (because NOKIA_SROS_CARD is set), even though the test `redundant_integrated_components_are_distributed` expects cfgA to contain card config. In the test, components are `{Slot: A}, {Slot: B}` with no Type — so no NOKIA_SROS_CARD is derived → card == "" → integrated config generated per CPM. OK consistent.

But what about the docs claim: "a components `type` sets `NOKIA_SROS_CARD` and makes containerlab skip generated card/MDA config". Consistent.

E. **Now the SFM env on component nodes:** The base node Init sets `n.Cfg.Env[envNokiaSrosSFM] = sfm` when user didn't set SFM. Then component deep copy includes that SFM env. Component node Init: envAlreadyResolved=true → skips SFM apply. Component env contains SFM → config gen uses componentSFM() → hardwareEnv = userEnv (cloned base userEnv, which does NOT contain SFM unless user set it) → falls back to kindSpecificCfg().SFM. OK.

Hmm wait — but there's an issue: the base node's `n.Cfg.Env[envNokiaSrosSFM]` gets set BEFORE setupComponentNodes deep-copies Cfg.Env? Order: Init (sets SFM env in Cfg.Env) → ... when is setupComponentNodes called? Let me check: grep setupComponentNodes call site. If it's called in PreDeploy (after Init), the component env will contain the base's NOKIA_SROS_SFM. Then in component Init, `if sfm := n.kindSpecificCfg().SFM; sfm != "" && !envAlreadyResolved` — skipped. Good.

But there's a subtle wrinkle: the base Cfg.Env contains NOKIA_SROS_SFM set from kind config; for the component node, kindSpecificCfg().SFM — componentConfig deep copy includes KindSpecificCfg? kindSpecificConfig.Of(componentConfig) — the base's kind config with Components=nil. SFM field preserved. Fine.

F. **`warnUserEnvOverrides` in component Init path**: component node Init → isStandaloneNode false → skip the standalone branch entirely (warnUserEnvOverrides at 327 only in standalone branch). For component nodes, keepUserEnv was already called in setupComponentNodes with warnings. But note: component node Init ALSO merges `srosEnv, vars, n.Cfg.Env`? No — that's in the standalone branch. In the else branch (non-standalone), what happens? From the earlier diff at 1747: `} else {` ... need to see. Presumably sets envNokiaSrosSlot to "" or leaves. Not critical.

G. **Now a REAL potential issue: `n.Cfg.Env` in Init standalone branch after userEnv snapshot.** `n.userEnv = maps.Clone(n.Cfg.Env)` then later `n.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)`. Fine.

H. **`warnUnsupportedComponents` for distributed base**: For a non-integrated distributed base node (sr-7s + components), which node runs warnUnsupportedComponents? The BASE node's PreDeploy: base is not standalone; base slot env — base Init for distributed: what's envNokiaSrosSlot on base? Probably deleted/empty. isCPM(slotAName): slot not exists → return true! (isCPM with no slot env returns true). So base node passes the guard `!n.isStandaloneNode() && !n.isCPM(slotAName)` → isCPM(slotAName) true → proceeds. Then components = rootComponents (base has rootComponents? `n.rootComponents` — set where? For base node, rootComponents... hmm. In setupComponentNodes, only srosNode (component) gets rootComponents. Does the BASE node get rootComponents set? grep rootComponents assignments: `srosNode.rootComponents = n.kindSpecificCfg().Components` (component). For base, `n.rootComponents` presumably set in Init for distributed base? Let me check: in generateComponentConfig head (line 281): `components := n.rootComponents; if len(components)==0 return ""` — for base non-integrated distributed node, generateComponentConfig returns "" — because config is generated per component node. And for CPM component nodes, rootComponents set. OK.

But warnUnsupportedComponents on the base: `components := n.rootComponents; if len==0 { components = kindSpecificCfg().Components }` — so base uses its own components list. Then effective = componentsForConfig(components) → all components incl. line cards → validates all. Good, warnings appear once per lab for distributed (from base node). And the guard: base node isCPM(slotAName)=true (no slot). But ALSO each CPM component node (A) runs warnUnsupportedComponents with rootComponents → duplicate warnings? Guard: `!n.isStandaloneNode() && !n.isCPM(slotAName)` → for CPM A component: isCPM(slotAName) true → proceeds → warns AGAIN (base warned once, CPM A warns again). Hmm — so for a distributed node with components, warnings appear twice: once from base node, once from CPM A component node. Is that true? Base node runs createSROSFiles? Base PreDeploy → createSROSFiles? Let me check base PreDeploy flow: line 447 `return n.createSROSFiles(ctx)` — in PreDeploy, gated by `if` something. Line 415-448: within PreDeploy there's a condition — line 440 license, 447 createSROSFiles. Let me look at the beginning of PreDeploy to see the gating condition. Earlier I saw at line 410: `n.isStandaloneNode() || (n.isDistributedCardNode() && n.isCPM(""))` — that was from prior summary about PreDeploy. Let me verify by reading sros.go 395-450.

Actually from prior summary: "PreDeploy line 410: `n.isStandaloneNode() || (n.isDistributedCardNode() && n.isCPM(""))`". But the code I just read at 420-448 shows the PreDeploy body (binds, license, createSROSFiles) — need the enclosing if. Let me read 395-420.

If base distributed node does NOT call createSROSFiles, then writeChassisInfoToLabDir (which contains the warn call) never runs for base → no duplicate. writeChassisInfoToLabDir is called within createSROSFiles presumably. So only CPM A warns for distributed. Let me verify: grep writeChassisInfoToLabDir call sites.

Let me also double check the standalone node with components==0: warnUnsupportedComponents → isStandaloneNode true → proceeds → effective = componentForConfig(nil) → validates env-configured hardware. Good.

I. **One more potential issue — `n.Cfg.Env[envNokiaSrosChassis]` for the chassis override in warnUnsupportedComponents**: `chassis := strings.TrimSpace(n.Cfg.Env[envNokiaSrosChassis])` — for base distributed node (if it runs), chassis = base NodeType. For CPM component node, chassis env inherited from base = base NodeType. Good.

J. **`IsHealthy` for component nodes** — moved, fine.

K. **Now check `verifyNokiaSrsimImage` / CheckDeploymentConditions changes** — previously read; skip.

L. **Potential issue with `keepUserEnv` in `setupComponentNodes`:** `componentConfig.Env` is a deep copy of base `n.Cfg.Env`, which for a distributed base INCLUDES `NOKIA_SROS_SLOT` (if user set slot at node level for distributed? envNokiaSrosSlot for base — Init uppercases `n.Cfg.Env[envNokiaSrosSlot]` "make sure we always have uppercase slot definition" — that's for card nodes). The comment at line 669-670: "Slot identifies this container. A node-level NOKIA_SROS_SLOT cannot apply to every card." → slot forced to c.Slot AFTER keepUserEnv. Good.

M. **The `keepUserEnv` dst pollution:** `keepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)` — derived includes envNokiaSrosCard when component.Type != "". But for a distributed base, the components list includes CPM A/B entries with Type "" typically, and line cards with types. For CPM A component node, derived env has no card → fine.

N. **Now — a REAL issue candidate: duplicate `MDA` env key naming for xiom mdas.** setComponentEnvVars (moved): keys `NOKIA_SROS_MDA_X<xiom>_<mda>` and `NOKIA_SROS_MDA_<slot>`. And applyHardwareEnv parses `NOKIA_SROS_MDA_X` prefix. Consistent.

O. **`upsertXiomMDA`** — fine.

P. **Check `sros_test.go` additions** — read earlier. Tests cover classification, warnings, template data, component config gen. Good coverage.

Q. **Docs/README**: docs/manual/kinds/sros.md updated with new components model; README updated. Schema: clab.schema.json got new enum values (ixr-e3, sar-10x, ixr-e2sc, cpm/iom/mda/xiom types incl. xiom types?). The schema diff hunk 3000-3119: I read it earlier — added node type enums and mda types + xiom enum? Prior summary says "new chassis types (ixr-e2sc, ixr-e3, sar-10x)". Also `sros_schema_gen.sh` regenerates. Fine.

R. **Robot tests**: new shared resource + shards. Fine.

S. **Now potential P3: `integratedSrosSlotAllowed` uses `standaloneSlotName`** — what is standaloneSlotName? Probably "" or "A"? If slot == "" → standaloneSlotName. Let me check its value. grep.

T. **`isRedundantIntegratedSrosComponents` requires ALL components' slots allowed** — for ixr-r6 allowedSlots A/B; two components A and B → redundant → distributed base. One component A → not redundant → standalone. What if user gives components A and C (invalid slot for ixr-r6)? isRedundantIntegrated... returns false → len(components)>1 → for integrated type... isDistributedBaseNode: isIntegratedSrosNodeType → return isRedundant... = false. isDistributedCardNode: slot env set && len(components)==0 → false (len=2). isStandaloneNode → true → setupStandaloneComponents errors (>1 components for ixr-r6? The error message: "expected at most one component override for standalone SR-SIM node %q, or one component per slot %s for redundant type %q" — good error.

Hmm wait, but what about `integratedSrosAllowedSlots` for ixr-r6 = [A, B]; components A+B → redundant. What about ixr-e2 (allowedSlots=[A]) with components A+A? checkComponentSlotsConfig catches duplicate slots (moved to component.go line ~150: "node %s slot %s duplicate definition"). Where is checkComponentSlotsConfig called? In CheckDeploymentConditions presumably. But note the duplicate check uses `componentNames[component.Slot]` (raw, not uppercased) for insertion while checking uppercased key — pre-existing bug (inserts raw slot, checks upper). If user provides "a" and "A": ToUpper both → "A" exists → error caught. If "a" and "a": ToUpper("a")="A" not in map (map has "a") → no error; then components "a","a" both → isRedundant... integratedSrosSlotAllowed("a") → ToUpper → A allowed → redundant=true → distributed base with two components both slot "a" → calcComponentName both named same? componentConfig.ShortName = calcComponentName(base, "a") → suffix "-a" both → duplicate container names! Hmm wait — but slot "a" — calcComponentName probably uppercases? Let me check calcComponentName. Also this duplicate-slot-check insertion bug is pre-existing (moved unchanged from base). Let me verify base version: base sros.go line ~1046 had same code with `componentNames[component.Slot] = struct{}{}` insertion and ToUpper check. Yes — from the diff removal (lines 1966-1987): check `_, exists := componentNames[slot]` (uppercased) then `componentNames[component.Slot] = struct{}{}` (raw). Pre-existing bug, moved verbatim into component.go. It's pre-existing → not introduced by this PR; per instructions "focus on issues introduced or materially worsened by this PR". A moved bug isn't introduced. I could mention as P4? The rule says focus on issues introduced or materially worsened. Moving code doesn't worsen it. But it's now in a new file being reviewed... I'll mention briefly as P4 (optional) — actually, better: it IS pre-existing; flagging as P4 "while moving, consider fixing" is legitimate actionable improvement. Hmm, but I should be careful not to inflate. It's a genuine latent bug: two components with same lower-case slot bypass the duplicate check → duplicate container names. That's a real correctness edge case, pre-existing. I'll include as P4 with note it's pre-existing but surfaced by the move.

Wait — actually let me double check calcComponentName to assess impact: `calcComponentName(name, slot)` — from base: appends suffix? Let me check head. If it uppercases the slot for naming, then "a" → name suffix "-A"? Even so, two components with identical slot "a" produce identical names → duplicate. But would the deploy even get there? isRedundantIntegratedSrosComponents requires ALL slots allowed (A/B) — "a"→A allowed for ixr-r6 → redundant → distributed base. For non-integrated (sr-7s) with components "1","1": duplicate check missed (both raw "1" in map after first insertion? No wait: first component: slot=ToUpper("1")="1", exists? map empty → no; insert componentNames["1"]. Second component: slot="1", exists → YES → error. Ah right — for same-case duplicates the check works. Only mixed-case duplicates ("a" then "A"): first: slot="A", not exists, insert componentNames["a"]. Second: slot="A", exists in map? map has "a" only → no exists → insert componentNames["A"]. So mixed-case duplicates pass the check. Then downstream: e.g. non-integrated with slots "a" and "A" → buildComponentCfgLines ToUpper → both slot A → two card lines for same slot; setupComponentNodes → calcComponentName with slot "a" and "A" → names differ? calcComponentName(name, slot) — let me check: probably `fmt.Sprintf("%s-%s", name, strings.ToLower(slot))`? If lowercase → "-a" and "-a" identical → duplicate container names → deploy failure. Mixed-case duplicate slots is a weird user input; error message would be better. Pre-existing. P4.

U. **Now check `componentSFM` vs docs**: "SFM type from kind config or env". Fine.

V. **Check `n.integratedComponentOverride()` for component CPM nodes when rootComponents slot match**: `strings.EqualFold(strings.TrimSpace(c.Slot), slot)` — slot is Cfg.Env[envNokiaSrosSlot] = c.Slot raw (line 670 sets raw c.Slot, e.g. "a" lowercase). EqualFold handles. Good.

W. **Potential issue: `generateIntegratedComponentConfig` reads `n.Cfg.Env[envNokiaSrosCard]`** — for component CPM nodes with component type set, skip. For standalone integrated node with env card override — skip. But for standalone integrated node with NO components but env NOKIA_SROS_CARD set by... user. Skip generation. OK per docs.

X. **Now, importantly — check `config.go` `createSROSConfigFiles`** and whether `generateComponentConfig` is called for distributed base (rootComponents empty → "" → fine) and for line cards (rootComponents set, slot non-CPM → buildComponentCfgLines over rootComponents filtered to ALL non-CPM components — WAIT. For a LINE CARD component node (slot 2), generateComponentConfig iterates rootComponents and generates config for ALL non-CPM components (slots 1..N), not just slot 2! So each line card container generates the full component config for all cards? Then buildStartupConfig for line card includes card 1..N config? Hmm — but each card container mounts its own cf3 dir (LabDir/slot/). If every line card generates config for ALL cards, then card 2's startup config would include card 1's config lines — is that intended? In SR-SIM, each line card container boots a full SR OS instance managing its own card... Actually in SR-SIM distributed mode, each line card container runs an SR OS instance that configures its own card only. Generating all cards' config on every line card would conflict. Let me check base behavior: base generateComponentConfig: `if len(n.kindSpecificCfg().Components) > 1 || n.rootCtrName != "" { return "" }` — wait base returned "" when rootCtrName != "" (i.e., component nodes) unless rootComponents non-empty path. Base:

```go
components := n.rootComponents
if len(components) == 0 {
    if len(n.kindSpecificCfg().Components) > 1 || n.rootCtrName != "" {
        return ""
    }
    lines := buildIntegratedComponentCfgLines(...)
    ...
}
for _, c := range components { ... }
lines := buildComponentCfgLines(components, ...)
```

Hmm base had the same structure: rootComponents non-empty → build for all non-CPM components. So same as head. Pre-existing behavior — each line card generates config for all cards? That seems odd but is pre-existing. Actually wait — maybe that's intentional: in SR-SIM, CPM configures all cards; line card containers... hmm. Not my concern — pre-existing.

Hmm, actually wait. Let me reconsider: for line card component node, `generateComponentConfig` uses `n.componentsForConfig(components)` where components = rootComponents (base's full list). So yes, all cards. Pre-existing (base did the same). OK.

Y. **`IsHealthy` for component nodes** — moved, fine.

Z. **Check `verifyNokiaSrsimImage` / CheckDeploymentConditions changes** — previously read; skip.

Now let me verify the PreDeploy gating and writeChassisInfoToLabDir call sites to close loop H.
Let me verify the `PreDeploy` gating and `writeChassisInfoToLabDir` call sites, plus `standaloneSlotName` and `calcComponentName` semantics.
grep · completed

Input

{
  "path": "/source/head/nodes/sros",
  "pattern": "writeChassisInfoToLabDir|standaloneSlotName =|func \\(n \\*sros\\) PreDeploy"
}

Output

Found 5 matches
/source/head/nodes/sros/sros.go:
  Line 57: 	standaloneSlotName = slotAName

  Line 394: func (n *sros) PreDeploy(ctx context.Context, params *clabnodes.PreDeployParams) error {

  Line 1028: 	if err := n.writeChassisInfoToLabDir(ctx); err != nil {

  Line 1048: // writeChassisInfoToLabDir fetches /opt/nokia/chassis_info.json from the node image

  Line 1051: func (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {
Tool metadata
{
  "type": "tool",
  "id": "prt_150330ebc0018gOjhG4gVXihHs",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150322c97001uj2W43347p13ml",
  "callID": "call_9850ee4ecfa742049e55d014",
  "tool": "grep",
  "state": {
    "status": "completed",
    "input": {
      "path": "/source/head/nodes/sros",
      "pattern": "writeChassisInfoToLabDir|standaloneSlotName =|func \\(n \\*sros\\) PreDeploy"
    },
    "output": "Found 5 matches\n/source/head/nodes/sros/sros.go:\n  Line 57: \tstandaloneSlotName = slotAName\n\n  Line 394: func (n *sros) PreDeploy(ctx context.Context, params *clabnodes.PreDeployParams) error {\n\n  Line 1028: \tif err := n.writeChassisInfoToLabDir(ctx); err != nil {\n\n  Line 1048: // writeChassisInfoToLabDir fetches /opt/nokia/chassis_info.json from the node image\n\n  Line 1051: func (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {\n",
    "title": "writeChassisInfoToLabDir|standaloneSlotName =|func \\(n \\*sros\\) PreDeploy",
    "metadata": {
      "matches": 5,
      "truncated": false
    },
    "time": {
      "start": 1792346885826,
      "end": 1792346885837
    }
  }
}
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/sros.go",
  "limit": 35,
  "offset": 385
}

Output

<path>/source/head/nodes/sros/sros.go</path>
<type>file</type>
<content>
385: 
386: 	setComponentEnvVars(vars, slotA)
387: 
388: 	maps.Copy(vars, slotA.Env)
389: 
390: 	return vars, nil
391: }
392: 
393: // Pre Deploy func for SR-SIM kind.
394: func (n *sros) PreDeploy(ctx context.Context, params *clabnodes.PreDeployParams) error {
395: 	log.Debug("Running pre-deploy")
396: 
397: 	if err := n.verifyNokiaSrsimImage(ctx); err != nil {
398: 		return err
399: 	}
400: 
401: 	// store the preDeployParams
402: 	n.preDeployParams = params
403: 
404: 	n.InterfaceHelp = InterfaceHelp
405: 
406: 	// store provided pubkeys
407: 	n.sshPubKeys = params.SSHPubKeys
408: 
409: 	// Create files/dir structure for standalone nodes or distributed CPM nodes
410: 	if n.isStandaloneNode() || (n.isDistributedCardNode() && n.isCPM("")) {
411: 		// generate the certificate
412: 		if *n.Cfg.Certificate.Issue {
413: 			n.Cfg.Certificate.SANs = append(n.Cfg.Certificate.SANs, n.baseShortName, n.baseLongName)
414: 			certificate, err := n.LoadOrGenerateCertificate(params.Cert, params.TopologyName)
415: 			if err != nil {
416: 				return err
417: 			}
418: 
419: 			// set the certificate data

(Showing lines 385-419 of 1910. Use offset=420 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_150330f46001h6y9GezzFJN7s1",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150322c97001uj2W43347p13ml",
  "callID": "call_2948f8a5d7884ac4b9fb2934",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/sros.go",
      "limit": 35,
      "offset": 385
    },
    "output": "<path>/source/head/nodes/sros/sros.go</path>\n<type>file</type>\n<content>\n385: \n386: \tsetComponentEnvVars(vars, slotA)\n387: \n388: \tmaps.Copy(vars, slotA.Env)\n389: \n390: \treturn vars, nil\n391: }\n392: \n393: // Pre Deploy func for SR-SIM kind.\n394: func (n *sros) PreDeploy(ctx context.Context, params *clabnodes.PreDeployParams) error {\n395: \tlog.Debug(\"Running pre-deploy\")\n396: \n397: \tif err := n.verifyNokiaSrsimImage(ctx); err != nil {\n398: \t\treturn err\n399: \t}\n400: \n401: \t// store the preDeployParams\n402: \tn.preDeployParams = params\n403: \n404: \tn.InterfaceHelp = InterfaceHelp\n405: \n406: \t// store provided pubkeys\n407: \tn.sshPubKeys = params.SSHPubKeys\n408: \n409: \t// Create files/dir structure for standalone nodes or distributed CPM nodes\n410: \tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.isCPM(\"\")) {\n411: \t\t// generate the certificate\n412: \t\tif *n.Cfg.Certificate.Issue {\n413: \t\t\tn.Cfg.Certificate.SANs = append(n.Cfg.Certificate.SANs, n.baseShortName, n.baseLongName)\n414: \t\t\tcertificate, err := n.LoadOrGenerateCertificate(params.Cert, params.TopologyName)\n415: \t\t\tif err != nil {\n416: \t\t\t\treturn err\n417: \t\t\t}\n418: \n419: \t\t\t// set the certificate data\n\n(Showing lines 385-419 of 1910. Use offset=420 to continue.)\n</content>",
    "title": "source/head/nodes/sros/sros.go",
    "metadata": {
      "preview": "\n\tsetComponentEnvVars(vars, slotA)\n\n\tmaps.Copy(vars, slotA.Env)\n\n\treturn vars, nil\n}\n\n// Pre Deploy func for SR-SIM kind.\nfunc (n *sros) PreDeploy(ctx context.Context, params *clabnodes.PreDeployParams) error {\n\tlog.Debug(\"Running pre-deploy\")\n\n\tif err := n.verifyNokiaSrsimImage(ctx); err != nil {\n\t\treturn err\n\t}\n\n\t// store the preDeployParams\n\tn.preDeployParams = params\n\n\tn.InterfaceHelp = InterfaceHelp",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/sros.go",
        "text": "\n\tsetComponentEnvVars(vars, slotA)\n\n\tmaps.Copy(vars, slotA.Env)\n\n\treturn vars, nil\n}\n\n// Pre Deploy func for SR-SIM kind.\nfunc (n *sros) PreDeploy(ctx context.Context, params *clabnodes.PreDeployParams) error {\n\tlog.Debug(\"Running pre-deploy\")\n\n\tif err := n.verifyNokiaSrsimImage(ctx); err != nil {\n\t\treturn err\n\t}\n\n\t// store the preDeployParams\n\tn.preDeployParams = params\n\n\tn.InterfaceHelp = InterfaceHelp\n\n\t// store provided pubkeys\n\tn.sshPubKeys = params.SSHPubKeys\n\n\t// Create files/dir structure for standalone nodes or distributed CPM nodes\n\tif n.isStandaloneNode() || (n.isDistributedCardNode() && n.isCPM(\"\")) {\n\t\t// generate the certificate\n\t\tif *n.Cfg.Certificate.Issue {\n\t\t\tn.Cfg.Certificate.SANs = append(n.Cfg.Certificate.SANs, n.baseShortName, n.baseLongName)\n\t\t\tcertificate, err := n.LoadOrGenerateCertificate(params.Cert, params.TopologyName)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// set the certificate data",
        "lineStart": 385,
        "lineEnd": 419,
        "totalLines": 1910,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346885963,
      "end": 1792346885977
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_150330f5c001JAraYK0lOp1Rpa",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150322c97001uj2W43347p13ml",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 44436,
    "input": 8781,
    "output": 111,
    "reasoning": 6616,
    "cache": {
      "read": 28928,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_150322c97001uj2W43347p13ml",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346827927,
    "completed": 1792346885985
  },
  "parentID": "msg_150318b6b001z1GyFDwe1Oii29",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 44436,
    "input": 8781,
    "output": 111,
    "reasoning": 6616,
    "cache": {
      "read": 28928,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 47
step-start
{
  "type": "step-start",
  "id": "prt_1503316aa001JzblxEfWopiGjw",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150330f71001z0oJV0z6D4QS8S"
}
Reasoning
Confirmed: `PreDeploy` → `createSROSFiles` only for standalone or distributed CPM cards. Distributed base node does NOT run createSROSFiles → `writeChassisInfoToLabDir`/`warnUnsupportedComponents` never runs on the base; only on standalone nodes and CPM component nodes. So for distributed (non-integrated) nodes, warnings come from CPM A only. And line cards: isDistributedCardNode() && isCPM("") false → no PreDeploy file creation. Good, no duplicate warnings.

Hmm wait — but there's now a subtle gap: for the redundant integrated node (ixr-r6 A+B), the component CPM nodes are `isDistributedCardNode() && isCPM("")` → both A and B run PreDeploy → createSROSFiles → writeChassisInfoToLabDir → warnUnsupportedComponents: guard `!n.isStandaloneNode() && !n.isCPM(slotAName)` → B returns early, A warns. Good.

Also: for the distributed base node (non-integrated), the base itself never writes chassis_info.json — fine, component CPM A does (rootComponents set). Good.

But wait: for a distributed base (sr-7s with components), CPM A component node — `components := n.rootComponents` non-empty → effective = componentsForConfig(rootComponents) → validates all. Good.

Now `standaloneSlotName = slotAName` — so integratedSrosSlotAllowed("") → A. Fine.

Now let me also double-check `createSROSFiles` body (line 999-1047) to see the full flow and error handling.
`PreDeploy` gating confirmed — only standalone nodes and distributed CPM cards run `createSROSFiles`, so warnings fire once (CPM A only). Let me read `createSROSFiles` and `writeChassisInfoToLabDir` bodies to finish.
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/sros.go",
  "limit": 90,
  "offset": 995
}

Output

<path>/source/head/nodes/sros/sros.go</path>
<type>file</type>
<content>
995: 	return n.DefaultNode.CheckDeploymentConditions(ctx)
996: }
997: 
998: // Func that creates the Dirs used for the kind SR-SIM and sets/merges the default Env vars.
999: func (n *sros) createSROSFiles(ctx context.Context) error {
1000: 	log.Debug("Creating directory structure for SR OS container", "node", n.Cfg.ShortName)
1001: 
1002: 	var err error
1003: 
1004: 	if n.Cfg.License != "" && (n.isCPM("") || n.isStandaloneNode()) {
1005: 		// copy license file to node specific directory in lab
1006: 		licPath := filepath.Join(n.Cfg.LabDir, "license.key")
1007: 		if err := clabutils.CopyFile(context.Background(), n.Cfg.License, licPath,
1008: 			clabconstants.PermissionsFileDefault); err != nil {
1009: 			return fmt.Errorf(
1010: 				"license copying src %s -> dst %s failed: %v",
1011: 				n.Cfg.License,
1012: 				licPath,
1013: 				err,
1014: 			)
1015: 		}
1016: 		log.Debug("SR OS license copied", "src", n.Cfg.License, "dst", licPath)
1017: 	}
1018: 	clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),
1019: 		clabconstants.PermissionsOpen)
1020: 	clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], "config"),
1021: 		clabconstants.PermissionsOpen)
1022: 	clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf1),
1023: 		clabconstants.PermissionsOpen)
1024: 	clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf2),
1025: 		clabconstants.PermissionsOpen)
1026: 	clabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),
1027: 		clabconstants.PermissionsOpen)
1028: 	if err := n.writeChassisInfoToLabDir(ctx); err != nil {
1029: 		log.Debug("Didn't write chassis_info.json to lab dir. Docker version is likely too new.",
1030: 			"node", n.Cfg.ShortName, "path", n.Cfg.LabDir, "error", err)
1031: 	}
1032: 	if n.isCPM(slotAName) || n.isStandaloneNode() {
1033: 		err = n.createSROSCertificates()
1034: 	}
1035: 	if err != nil {
1036: 		return err
1037: 	}
1038: 	// Skip config if node is not CPM
1039: 	if n.isCPM("") || n.isStandaloneNode() {
1040: 		err = n.createSROSConfigFiles()
1041: 		if err != nil {
1042: 			return err
1043: 		}
1044: 	}
1045: 	return nil
1046: }
1047: 
1048: // writeChassisInfoToLabDir fetches /opt/nokia/chassis_info.json from the node image
1049: // (via graph driver, same as srosVersionFromImage) and writes it under n.Cfg.LabDir
1050: // with the same filename (chassis_info.json).
1051: func (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {
1052: 	imageInspect, err := n.Runtime.InspectImage(ctx, n.Cfg.Image)
1053: 	if err != nil {
1054: 		return fmt.Errorf("inspect image: %w", err)
1055: 	}
1056: 	content, err := ReadFileFromImageInspect(imageInspect, DefaultChassisInfoPath)
1057: 	if err != nil {
1058: 		return err
1059: 	}
1060: 	dstPath := filepath.Join(n.Cfg.LabDir, filepath.Base(DefaultChassisInfoPath))
1061: 	licensed := append([]byte(chassisInfoFileLicense), content...)
1062: 	if err := os.WriteFile(dstPath, licensed, clabconstants.PermissionsFileDefault); err != nil {
1063: 		return fmt.Errorf("write %s: %w", dstPath, err)
1064: 	}
1065: 	log.Debug("Wrote chassis_info.json to lab dir", "node", n.Cfg.ShortName, "path", dstPath)
1066: 	n.warnUnsupportedComponents(content)
1067: 	return nil
1068: }
1069: 
1070: // warnUnsupportedComponents validates the effective component configuration against the
1071: // chassis_info.json extracted from this exact image. Validation is advisory and never blocks
1072: // deploy.
1073: func (n *sros) warnUnsupportedComponents(content []byte) {
1074: 	// A distributed node validates once, from CPM A, to avoid duplicate warnings from CPM B.
1075: 	if !n.isStandaloneNode() && !n.isCPM(slotAName) {
1076: 		return
1077: 	}
1078: 
1079: 	info, err := parseChassisInfo(content)
1080: 	if err != nil {
1081: 		log.Warn("Could not validate SR-SIM components against chassis_info.json",
1082: 			"node", n.Cfg.ShortName, "error", err)
1083: 		return
1084: 	}

(Showing lines 995-1084 of 1910. Use offset=1085 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_15033234e001pQTYPV2CqmW5kw",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150330f71001z0oJV0z6D4QS8S",
  "callID": "call_3d63ab4352fa4e27894fcbfc",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/sros.go",
      "limit": 90,
      "offset": 995
    },
    "output": "<path>/source/head/nodes/sros/sros.go</path>\n<type>file</type>\n<content>\n995: \treturn n.DefaultNode.CheckDeploymentConditions(ctx)\n996: }\n997: \n998: // Func that creates the Dirs used for the kind SR-SIM and sets/merges the default Env vars.\n999: func (n *sros) createSROSFiles(ctx context.Context) error {\n1000: \tlog.Debug(\"Creating directory structure for SR OS container\", \"node\", n.Cfg.ShortName)\n1001: \n1002: \tvar err error\n1003: \n1004: \tif n.Cfg.License != \"\" && (n.isCPM(\"\") || n.isStandaloneNode()) {\n1005: \t\t// copy license file to node specific directory in lab\n1006: \t\tlicPath := filepath.Join(n.Cfg.LabDir, \"license.key\")\n1007: \t\tif err := clabutils.CopyFile(context.Background(), n.Cfg.License, licPath,\n1008: \t\t\tclabconstants.PermissionsFileDefault); err != nil {\n1009: \t\t\treturn fmt.Errorf(\n1010: \t\t\t\t\"license copying src %s -> dst %s failed: %v\",\n1011: \t\t\t\tn.Cfg.License,\n1012: \t\t\t\tlicPath,\n1013: \t\t\t\terr,\n1014: \t\t\t)\n1015: \t\t}\n1016: \t\tlog.Debug(\"SR OS license copied\", \"src\", n.Cfg.License, \"dst\", licPath)\n1017: \t}\n1018: \tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),\n1019: \t\tclabconstants.PermissionsOpen)\n1020: \tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], \"config\"),\n1021: \t\tclabconstants.PermissionsOpen)\n1022: \tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf1),\n1023: \t\tclabconstants.PermissionsOpen)\n1024: \tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf2),\n1025: \t\tclabconstants.PermissionsOpen)\n1026: \tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),\n1027: \t\tclabconstants.PermissionsOpen)\n1028: \tif err := n.writeChassisInfoToLabDir(ctx); err != nil {\n1029: \t\tlog.Debug(\"Didn't write chassis_info.json to lab dir. Docker version is likely too new.\",\n1030: \t\t\t\"node\", n.Cfg.ShortName, \"path\", n.Cfg.LabDir, \"error\", err)\n1031: \t}\n1032: \tif n.isCPM(slotAName) || n.isStandaloneNode() {\n1033: \t\terr = n.createSROSCertificates()\n1034: \t}\n1035: \tif err != nil {\n1036: \t\treturn err\n1037: \t}\n1038: \t// Skip config if node is not CPM\n1039: \tif n.isCPM(\"\") || n.isStandaloneNode() {\n1040: \t\terr = n.createSROSConfigFiles()\n1041: \t\tif err != nil {\n1042: \t\t\treturn err\n1043: \t\t}\n1044: \t}\n1045: \treturn nil\n1046: }\n1047: \n1048: // writeChassisInfoToLabDir fetches /opt/nokia/chassis_info.json from the node image\n1049: // (via graph driver, same as srosVersionFromImage) and writes it under n.Cfg.LabDir\n1050: // with the same filename (chassis_info.json).\n1051: func (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {\n1052: \timageInspect, err := n.Runtime.InspectImage(ctx, n.Cfg.Image)\n1053: \tif err != nil {\n1054: \t\treturn fmt.Errorf(\"inspect image: %w\", err)\n1055: \t}\n1056: \tcontent, err := ReadFileFromImageInspect(imageInspect, DefaultChassisInfoPath)\n1057: \tif err != nil {\n1058: \t\treturn err\n1059: \t}\n1060: \tdstPath := filepath.Join(n.Cfg.LabDir, filepath.Base(DefaultChassisInfoPath))\n1061: \tlicensed := append([]byte(chassisInfoFileLicense), content...)\n1062: \tif err := os.WriteFile(dstPath, licensed, clabconstants.PermissionsFileDefault); err != nil {\n1063: \t\treturn fmt.Errorf(\"write %s: %w\", dstPath, err)\n1064: \t}\n1065: \tlog.Debug(\"Wrote chassis_info.json to lab dir\", \"node\", n.Cfg.ShortName, \"path\", dstPath)\n1066: \tn.warnUnsupportedComponents(content)\n1067: \treturn nil\n1068: }\n1069: \n1070: // warnUnsupportedComponents validates the effective component configuration against the\n1071: // chassis_info.json extracted from this exact image. Validation is advisory and never blocks\n1072: // deploy.\n1073: func (n *sros) warnUnsupportedComponents(content []byte) {\n1074: \t// A distributed node validates once, from CPM A, to avoid duplicate warnings from CPM B.\n1075: \tif !n.isStandaloneNode() && !n.isCPM(slotAName) {\n1076: \t\treturn\n1077: \t}\n1078: \n1079: \tinfo, err := parseChassisInfo(content)\n1080: \tif err != nil {\n1081: \t\tlog.Warn(\"Could not validate SR-SIM components against chassis_info.json\",\n1082: \t\t\t\"node\", n.Cfg.ShortName, \"error\", err)\n1083: \t\treturn\n1084: \t}\n\n(Showing lines 995-1084 of 1910. Use offset=1085 to continue.)\n</content>",
    "title": "source/head/nodes/sros/sros.go",
    "metadata": {
      "preview": "\treturn n.DefaultNode.CheckDeploymentConditions(ctx)\n}\n\n// Func that creates the Dirs used for the kind SR-SIM and sets/merges the default Env vars.\nfunc (n *sros) createSROSFiles(ctx context.Context) error {\n\tlog.Debug(\"Creating directory structure for SR OS container\", \"node\", n.Cfg.ShortName)\n\n\tvar err error\n\n\tif n.Cfg.License != \"\" && (n.isCPM(\"\") || n.isStandaloneNode()) {\n\t\t// copy license file to node specific directory in lab\n\t\tlicPath := filepath.Join(n.Cfg.LabDir, \"license.key\")\n\t\tif err := clabutils.CopyFile(context.Background(), n.Cfg.License, licPath,\n\t\t\tclabconstants.PermissionsFileDefault); err != nil {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"license copying src %s -> dst %s failed: %v\",\n\t\t\t\tn.Cfg.License,\n\t\t\t\tlicPath,\n\t\t\t\terr,\n\t\t\t)",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/sros.go",
        "text": "\treturn n.DefaultNode.CheckDeploymentConditions(ctx)\n}\n\n// Func that creates the Dirs used for the kind SR-SIM and sets/merges the default Env vars.\nfunc (n *sros) createSROSFiles(ctx context.Context) error {\n\tlog.Debug(\"Creating directory structure for SR OS container\", \"node\", n.Cfg.ShortName)\n\n\tvar err error\n\n\tif n.Cfg.License != \"\" && (n.isCPM(\"\") || n.isStandaloneNode()) {\n\t\t// copy license file to node specific directory in lab\n\t\tlicPath := filepath.Join(n.Cfg.LabDir, \"license.key\")\n\t\tif err := clabutils.CopyFile(context.Background(), n.Cfg.License, licPath,\n\t\t\tclabconstants.PermissionsFileDefault); err != nil {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"license copying src %s -> dst %s failed: %v\",\n\t\t\t\tn.Cfg.License,\n\t\t\t\tlicPath,\n\t\t\t\terr,\n\t\t\t)\n\t\t}\n\t\tlog.Debug(\"SR OS license copied\", \"src\", n.Cfg.License, \"dst\", licPath)\n\t}\n\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot]),\n\t\tclabconstants.PermissionsOpen)\n\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], \"config\"),\n\t\tclabconstants.PermissionsOpen)\n\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf1),\n\t\tclabconstants.PermissionsOpen)\n\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf2),\n\t\tclabconstants.PermissionsOpen)\n\tclabutils.CreateDirectory(path.Join(n.Cfg.LabDir, n.Cfg.Env[envNokiaSrosSlot], configCf3),\n\t\tclabconstants.PermissionsOpen)\n\tif err := n.writeChassisInfoToLabDir(ctx); err != nil {\n\t\tlog.Debug(\"Didn't write chassis_info.json to lab dir. Docker version is likely too new.\",\n\t\t\t\"node\", n.Cfg.ShortName, \"path\", n.Cfg.LabDir, \"error\", err)\n\t}\n\tif n.isCPM(slotAName) || n.isStandaloneNode() {\n\t\terr = n.createSROSCertificates()\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Skip config if node is not CPM\n\tif n.isCPM(\"\") || n.isStandaloneNode() {\n\t\terr = n.createSROSConfigFiles()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\n// writeChassisInfoToLabDir fetches /opt/nokia/chassis_info.json from the node image\n// (via graph driver, same as srosVersionFromImage) and writes it under n.Cfg.LabDir\n// with the same filename (chassis_info.json).\nfunc (n *sros) writeChassisInfoToLabDir(ctx context.Context) error {\n\timageInspect, err := n.Runtime.InspectImage(ctx, n.Cfg.Image)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"inspect image: %w\", err)\n\t}\n\tcontent, err := ReadFileFromImageInspect(imageInspect, DefaultChassisInfoPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdstPath := filepath.Join(n.Cfg.LabDir, filepath.Base(DefaultChassisInfoPath))\n\tlicensed := append([]byte(chassisInfoFileLicense), content...)\n\tif err := os.WriteFile(dstPath, licensed, clabconstants.PermissionsFileDefault); err != nil {\n\t\treturn fmt.Errorf(\"write %s: %w\", dstPath, err)\n\t}\n\tlog.Debug(\"Wrote chassis_info.json to lab dir\", \"node\", n.Cfg.ShortName, \"path\", dstPath)\n\tn.warnUnsupportedComponents(content)\n\treturn nil\n}\n\n// warnUnsupportedComponents validates the effective component configuration against the\n// chassis_info.json extracted from this exact image. Validation is advisory and never blocks\n// deploy.\nfunc (n *sros) warnUnsupportedComponents(content []byte) {\n\t// A distributed node validates once, from CPM A, to avoid duplicate warnings from CPM B.\n\tif !n.isStandaloneNode() && !n.isCPM(slotAName) {\n\t\treturn\n\t}\n\n\tinfo, err := parseChassisInfo(content)\n\tif err != nil {\n\t\tlog.Warn(\"Could not validate SR-SIM components against chassis_info.json\",\n\t\t\t\"node\", n.Cfg.ShortName, \"error\", err)\n\t\treturn\n\t}",
        "lineStart": 995,
        "lineEnd": 1084,
        "totalLines": 1910,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346891092,
      "end": 1792346891111
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_15033236a001tnupLgVfO670xZ",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150330f71001z0oJV0z6D4QS8S",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 45446,
    "input": 728,
    "output": 86,
    "reasoning": 344,
    "cache": {
      "read": 44288,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_150330f71001z0oJV0z6D4QS8S",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346886001,
    "completed": 1792346891118
  },
  "parentID": "msg_150318b6b001z1GyFDwe1Oii29",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 45446,
    "input": 728,
    "output": 86,
    "reasoning": 344,
    "cache": {
      "read": 44288,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 48
step-start
{
  "type": "step-start",
  "id": "prt_150332ba6001x96jbopgHOM5HK",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15033237d001k7RDZL8V6GQ5wz"
}
Reasoning
All main flows verified. Now let me consolidate the findings.

Recap of candidate findings and their final assessment:

**1. Mixed-case duplicate component slots bypass the duplicate-slot check (P4, pre-existing, moved verbatim).**
`checkComponentSlotsConfig` in `component.go` (lines ~145-168): checks `componentNames[slot]` (uppercased) but inserts `componentNames[component.Slot]` (raw). Two components with slots `a` and `A` pass validation; downstream, both normalize to slot A → duplicate config lines and, for distributed nodes, identical component container names. Pre-existing bug (moved from `sros.go` unchanged), so P4 optional fix while touching the file. Verify base had identical code — yes (diff lines 1966-1987 removed the identical body). Also `calcComponentName` — let me quickly confirm name collision. calcComponentName(name, slot) probably does `fmt.Sprintf("%s-%s", name, strings.ToLower(slot))` or keeps slot as-is. Either way "a" vs "A" → both normalize to A in buildComponentCfgLines. For setupComponentNodes, slots "a" and "A" → component names "<name>-a" vs "<name>-A"? If calcComponentName preserves case, container names differ but config lines duplicate for slot A. If lowercased, identical names. Let me check calcComponentName quickly.

**2. Inline SFM warning duplicates `warnUserEnvOverrides` (P4).**
`sros.go` Init lines 273-297 (head): the SFM branch inlines the same warn-message shape as `warnUserEnvOverrides`. Could be reduced by passing a derived map `{envNokiaSrosSFM: sfm}` to `warnUserEnvOverrides`. Minor maintainability. P4.

Actually — wait. Is it exactly duplicated semantics? warnUserEnvOverrides(node, derived, userEnv) warns for keys where userEnv has a differing value. The inline block: if userEnv has SFM and differs → warn; else if not set → set Cfg.Env. So yes, identical warning semantics for one key. The inline version additionally sets the env. A cleaner form: derive map, warn, then set if absent. P4.

**3. Anything P2/P3?** Let me think harder about actual defects in new code:

- `componentWarnings` line 96: `if sfm != "" && len(entry.SFM) > 0 && !slices.Contains(entry.SFM, sfm)` — SFM validated even for CPM-slot components without SFM... fine.

- `warnUnsupportedComponents`: `components = n.rootComponents; if len(components)==0 { components = kindSpecificCfg().Components }`. For a CPM component node of a distributed node, rootComponents set → fine. For standalone: kindSpecificCfg().Components. For redundant integrated CPM A: rootComponents set (the A+B list) → effective includes both A and B → slot B validated against entry.Redundant (ixr-r6 Redundant=true presumably) → no warning. But hold on: for ixr-r6 redundant, componentsForConfig applies per-component env; each component may have its own MDA. Fine.

Hmm — but for the redundant integrated CPM A node: `n.componentForConfig(components)` applies `n.hardwareEnv()` (userEnv of the component node = base userEnv). If the user set NOKIA_SROS_MDA_2 at node level, it applies to BOTH components A and B (each gets MDA 2 override). The warn for that: warnUnsupportedComponents doesn't warn — but keepUserEnv already warned during setupComponentNodes if node env overrode derived component keys... derived env for component A doesn't include MDA_2 unless component A declared it. If user sets NOKIA_SROS_MDA_2 at node level with no component declaring it, it's applied to every component silently (no warning) — same as env-only semantics for standalone. Consistent with docs ("node env overrides components"). Fine.

- **Potential issue: `warnUnsupportedComponents` for standalone node uses `n.componentSFM()`** — includes kindSpecificCfg().SFM fallback; componentWarnings checks entry.SFM list. Good.

- **`buildIntegratedComponentCfgLines` ignores `override.Type`** — for integrated nodes, the card type comes from the defaults table; override.Type is ignored (card override → skip generation). But if a user sets component Type on an integrated single-slot node (now allowed), NOKIA_SROS_CARD is set → generation skipped entirely → default card/mda config NOT generated. Per docs, intended.

- **`isRedundantIntegratedSrosComponents` doesn't check component count == exactly 2** — components A+B+C for ixr-r6: allowedSlots A/B → C fails → not redundant → not distributed base → isDistributedCardNode false (components non-empty) → standalone → setupStandaloneComponents: len>1 → error listing allowed slots A/B. Good.

- **ixr-r6 components A+A (duplicate, mixed case "a","A")**: checkComponentSlotsConfig passes (bug above) → isRedundant → distributed base → two components both slot A → calcComponentName: need to check. Let me read calcComponentName.

- **`componentConfigFromLines` with power config**: moved, fine.

- **Schema**: clab.schema.json — new node types and mda types added; do the new enum values include `xiom` types? The script generates sros-xiom-types enum. Does the schema previously have sros-xiom-types? Let me spot-check the head schema for "sros-xiom-types" and the new node types (ixr-e3, sar-10x, ixr-e2sc). Also `Components` schema — does it have a `type` field? Presumably yes already. Let me grep the schema quickly.

- **Docs**: updated. New `26_10_TESTS` gate in robot tests — is that var set in CI workflow? The workflow change (lines 1-83 of diff) — I read it earlier: shards SRSIM_TEST_SUITE etc. Does the workflow set `26_10_TESTS`? If the new-chassis test requires `26_10_TESTS=26.10` and CI doesn't set it, the new tests would be skipped in CI. Let me check the workflow diff for 26_10_TESTS. This is a real potential coverage gap. Let me grep diff for 26_10_TESTS.

- **`sros_schema_gen.sh`**: uses `first(...; select(type == "array" and index("ixr-e2n")))` — jq 1.6 supports `first(...)`? `first(expr)` is a jq builtin since 1.5? `first(f)` is defined as `def first(f): label $out | f, ., break $out;` — yes, standard since jq 1.5. Fine.

- **`keepUserEnv` when userSet but dst already has same value**: writes same value — fine.

- **One more: `hardwareEnv()` fallback `n.Cfg.Env`** for nodes not through Init — comment explains. For the base node, userEnv is set in Init always (unless envAlreadyResolved). For component nodes, userEnv = base clone. OK.

- **`componentForConfig` applies `out.Env` (component env) then `hardwareEnv()`** — but for a component node, `n.Cfg.Env` was already merged with component-derived env during Init (else branch? component node Init: envAlreadyResolved=true, so SFM skip; then standalone branch not taken (isDistributedCardNode) → else branch — what does else branch do? Let me check Init lines 315-335 head. If else branch merges srosEnv into Cfg.Env only, fine.) For config gen on component nodes, hardwareEnv() = userEnv (correct precedence).

Hmm wait — for the component node, `applyHardwareEnv(out, n.hardwareEnv())` uses userEnv — the NODE-level (base) env. But the component node's own `n.Cfg.Env` includes both base env and component-derived env. Using userEnv (base user env) for config gen means node env wins over component env — correct precedence per docs.

- **What about `NOKIA_SROS_SLOT` in applyHardwareEnv?** Explicitly skipped. Good.

Now, the SFM inline-duplication P4 and the pre-existing duplicate-slot P4. Let me also double check the docs statement "a components type sets NOKIA_SROS_CARD" — actually per setComponentEnvVars, component.Type sets envNokiaSrosCard. Yes.

Let me now check:
1. calcComponentName (for duplicate slot impact).
2. CI workflow for 26_10_TESTS.
3. Schema head enums for new types (ixr-e2sc, ixr-e3, sar-10x) and xiom enum presence.
Let me verify `calcComponentName`, check whether CI sets `26_10_TESTS` for the new test file, and spot-check the head schema enums.
grep · completed

Input

{
  "path": "/source/head/nodes/sros/sros.go",
  "pattern": "func \\(n \\*sros\\) calcComponentName"
}

Output

Found 1 matches
/source/head/nodes/sros/sros.go:
  Line 833: func (n *sros) calcComponentName(name, slot string) string {
Tool metadata
{
  "type": "tool",
  "id": "prt_150336f33001Gvbg59r2YddpL0",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15033237d001k7RDZL8V6GQ5wz",
  "callID": "call_f3f0781026eb4e2197357059",
  "tool": "grep",
  "state": {
    "status": "completed",
    "input": {
      "path": "/source/head/nodes/sros/sros.go",
      "pattern": "func \\(n \\*sros\\) calcComponentName"
    },
    "output": "Found 1 matches\n/source/head/nodes/sros/sros.go:\n  Line 833: func (n *sros) calcComponentName(name, slot string) string {\n",
    "title": "func \\(n \\*sros\\) calcComponentName",
    "metadata": {
      "matches": 1,
      "truncated": false
    },
    "time": {
      "start": 1792346910521,
      "end": 1792346910534
    }
  }
}
grep · completed

Input

{
  "path": "/source/diff.txt",
  "pattern": "26_10_TESTS"
}

Output

Found 6 matches
/source/diff.txt:
  Line 3818: +Suite Setup         Skip If    '${26_10_TESTS}'.lower() != 'true'

  Line 3819: +...                 SR-SIM 26.10 is required; enable with --variable 26_10_TESTS:true

  Line 3827: +${26_10_TESTS}      false


/source/head/tests/13-srsim/14-srsim-new-chassis.robot:
  Line 7: Suite Setup         Skip If    '${26_10_TESTS}'.lower() != 'true'

  Line 8: ...                 SR-SIM 26.10 is required; enable with --variable 26_10_TESTS:true

  Line 16: ${26_10_TESTS}      false
Tool metadata
{
  "type": "tool",
  "id": "prt_150336f9f001tlc535ARZru5k6",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15033237d001k7RDZL8V6GQ5wz",
  "callID": "call_2e5ce2f990674b0c809360c7",
  "tool": "grep",
  "state": {
    "status": "completed",
    "input": {
      "path": "/source/diff.txt",
      "pattern": "26_10_TESTS"
    },
    "output": "Found 6 matches\n/source/diff.txt:\n  Line 3818: +Suite Setup         Skip If    '${26_10_TESTS}'.lower() != 'true'\n\n  Line 3819: +...                 SR-SIM 26.10 is required; enable with --variable 26_10_TESTS:true\n\n  Line 3827: +${26_10_TESTS}      false\n\n\n/source/head/tests/13-srsim/14-srsim-new-chassis.robot:\n  Line 7: Suite Setup         Skip If    '${26_10_TESTS}'.lower() != 'true'\n\n  Line 8: ...                 SR-SIM 26.10 is required; enable with --variable 26_10_TESTS:true\n\n  Line 16: ${26_10_TESTS}      false\n",
    "title": "26_10_TESTS",
    "metadata": {
      "matches": 6,
      "truncated": false
    },
    "time": {
      "start": 1792346910628,
      "end": 1792346910659
    }
  }
}
grep · completed

Input

{
  "path": "/source/head/schemas/clab.schema.json",
  "pattern": "sar-10x|ixr-e3|sros-xiom-types"
}

Output

Found 12 matches
/source/head/schemas/clab.schema.json:
  Line 945:                                             "ixr-e3",

  Line 946:                                             "ixr-e3c",

  Line 947:                                             "ixr-e3x",

  Line 958:                                             "sar-10x",

  Line 2020:                 "cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd",

  Line 2021:                 "cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56",

  Line 2022:                 "cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd",

  Line 2117:                 "cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd",

  Line 2118:                 "cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56",

  Line 2119:                 "cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd",

  Line 2252:         "sros-xiom-types": {

  Line 2342:                                 "$ref": "#/definitions/sros-xiom-types"
Tool metadata
{
  "type": "tool",
  "id": "prt_15033700e001KizqHk6kcW1S9m",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15033237d001k7RDZL8V6GQ5wz",
  "callID": "call_ba21c3d12dcf4b128d39ff74",
  "tool": "grep",
  "state": {
    "status": "completed",
    "input": {
      "path": "/source/head/schemas/clab.schema.json",
      "pattern": "sar-10x|ixr-e3|sros-xiom-types"
    },
    "output": "Found 12 matches\n/source/head/schemas/clab.schema.json:\n  Line 945:                                             \"ixr-e3\",\n\n  Line 946:                                             \"ixr-e3c\",\n\n  Line 947:                                             \"ixr-e3x\",\n\n  Line 958:                                             \"sar-10x\",\n\n  Line 2020:                 \"cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd\",\n\n  Line 2021:                 \"cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56\",\n\n  Line 2022:                 \"cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd\",\n\n  Line 2117:                 \"cpm-ixr-e3/imm8-sfp112+18-sfp28+2-qsfpdd\",\n\n  Line 2118:                 \"cpm-ixr-e3c/imm4-qsfp28+16-sfp28+8-sfp56\",\n\n  Line 2119:                 \"cpm-ixr-e3x/imm16-sfp112+15-sfp56+6-qsfpdd\",\n\n  Line 2252:         \"sros-xiom-types\": {\n\n  Line 2342:                                 \"$ref\": \"#/definitions/sros-xiom-types\"\n",
    "title": "sar-10x|ixr-e3|sros-xiom-types",
    "metadata": {
      "matches": 12,
      "truncated": false
    },
    "time": {
      "start": 1792346910739,
      "end": 1792346910750
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_150337021001YxeTB1RriT8XI8",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15033237d001k7RDZL8V6GQ5wz",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 48809,
    "input": 1481,
    "output": 123,
    "reasoning": 1893,
    "cache": {
      "read": 45312,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_15033237d001k7RDZL8V6GQ5wz",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346891133,
    "completed": 1792346910758
  },
  "parentID": "msg_150318b6b001z1GyFDwe1Oii29",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 48809,
    "input": 1481,
    "output": 123,
    "reasoning": 1893,
    "cache": {
      "read": 45312,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 49
step-start
{
  "type": "step-start",
  "id": "prt_1503378eb001UxOJAaR615Y2DK",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150337032001LiBerPTQC6INt5"
}
Reasoning
Findings on these:

1. `26_10_TESTS` — the new robot test file `14-srsim-new-chassis.robot` skips unless `26_10_TESTS:true`. The CI workflow diff (lines 1-83): does it pass `--variable 26_10_TESTS:true` for a shard? Let me check the workflow head file. If CI never enables it, the new-chassis tests only run manually. That's a coverage note, not necessarily a defect (gated tests for unreleased image are reasonable). But if the workflow has a shard intended to run them and doesn't set the variable, tests silently skip. Let me check the head workflow.

2. Schema: ixr-e3, sar-10x in node-type enum; sros-xiom-types defined and referenced. Good. ixr-e2sc? Line 945-958 area — grep showed ixr-e3, sar-10x but not ixr-e2sc in output... The grep matched 12 lines; ixr-e2sc might be elsewhere. Let me check quickly. Also need `cpm-ixr-e2sc/...` in card types? Not necessarily. Let me grep ixr-e2sc in head schema.

3. calcComponentName at 833 — read it.
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/sros.go",
  "limit": 20,
  "offset": 833
}

Output

<path>/source/head/nodes/sros/sros.go</path>
<type>file</type>
<content>
833: func (n *sros) calcComponentName(name, slot string) string {
834: 	if n.renameDone {
835: 		return name
836: 	}
837: 	return fmt.Sprintf("%s-%s", name, strings.ToLower(slot))
838: }
839: 
840: // calcComponentFqdn computes the FQDN for a given slot.
841: func (n *sros) calcComponentFqdn(slot string) string {
842: 	if n.renameDone {
843: 		return n.Cfg.Fqdn
844: 	}
845: 	fqdnDotIndex := strings.Index(n.Cfg.Fqdn, ".")
846: 	if fqdnDotIndex < 0 {
847: 		return fmt.Sprintf("%s-%s", n.Cfg.Fqdn, strings.ToLower(slot))
848: 	}
849: 	result := fmt.Sprintf(
850: 		"%s-%s%s",
851: 		n.Cfg.Fqdn[:fqdnDotIndex],
852: 		strings.ToLower(slot),

(Showing lines 833-852 of 1910. Use offset=853 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_150338275001jT3rDTAvLU82bU",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150337032001LiBerPTQC6INt5",
  "callID": "call_7a30d310b47a42159235a70b",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/sros.go",
      "limit": 20,
      "offset": 833
    },
    "output": "<path>/source/head/nodes/sros/sros.go</path>\n<type>file</type>\n<content>\n833: func (n *sros) calcComponentName(name, slot string) string {\n834: \tif n.renameDone {\n835: \t\treturn name\n836: \t}\n837: \treturn fmt.Sprintf(\"%s-%s\", name, strings.ToLower(slot))\n838: }\n839: \n840: // calcComponentFqdn computes the FQDN for a given slot.\n841: func (n *sros) calcComponentFqdn(slot string) string {\n842: \tif n.renameDone {\n843: \t\treturn n.Cfg.Fqdn\n844: \t}\n845: \tfqdnDotIndex := strings.Index(n.Cfg.Fqdn, \".\")\n846: \tif fqdnDotIndex < 0 {\n847: \t\treturn fmt.Sprintf(\"%s-%s\", n.Cfg.Fqdn, strings.ToLower(slot))\n848: \t}\n849: \tresult := fmt.Sprintf(\n850: \t\t\"%s-%s%s\",\n851: \t\tn.Cfg.Fqdn[:fqdnDotIndex],\n852: \t\tstrings.ToLower(slot),\n\n(Showing lines 833-852 of 1910. Use offset=853 to continue.)\n</content>",
    "title": "source/head/nodes/sros/sros.go",
    "metadata": {
      "preview": "func (n *sros) calcComponentName(name, slot string) string {\n\tif n.renameDone {\n\t\treturn name\n\t}\n\treturn fmt.Sprintf(\"%s-%s\", name, strings.ToLower(slot))\n}\n\n// calcComponentFqdn computes the FQDN for a given slot.\nfunc (n *sros) calcComponentFqdn(slot string) string {\n\tif n.renameDone {\n\t\treturn n.Cfg.Fqdn\n\t}\n\tfqdnDotIndex := strings.Index(n.Cfg.Fqdn, \".\")\n\tif fqdnDotIndex < 0 {\n\t\treturn fmt.Sprintf(\"%s-%s\", n.Cfg.Fqdn, strings.ToLower(slot))\n\t}\n\tresult := fmt.Sprintf(\n\t\t\"%s-%s%s\",\n\t\tn.Cfg.Fqdn[:fqdnDotIndex],\n\t\tstrings.ToLower(slot),",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/sros.go",
        "text": "func (n *sros) calcComponentName(name, slot string) string {\n\tif n.renameDone {\n\t\treturn name\n\t}\n\treturn fmt.Sprintf(\"%s-%s\", name, strings.ToLower(slot))\n}\n\n// calcComponentFqdn computes the FQDN for a given slot.\nfunc (n *sros) calcComponentFqdn(slot string) string {\n\tif n.renameDone {\n\t\treturn n.Cfg.Fqdn\n\t}\n\tfqdnDotIndex := strings.Index(n.Cfg.Fqdn, \".\")\n\tif fqdnDotIndex < 0 {\n\t\treturn fmt.Sprintf(\"%s-%s\", n.Cfg.Fqdn, strings.ToLower(slot))\n\t}\n\tresult := fmt.Sprintf(\n\t\t\"%s-%s%s\",\n\t\tn.Cfg.Fqdn[:fqdnDotIndex],\n\t\tstrings.ToLower(slot),",
        "lineStart": 833,
        "lineEnd": 852,
        "totalLines": 1910,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346915450,
      "end": 1792346915461
    }
  }
}
grep · completed

Input

{
  "path": "/source/head/schemas/clab.schema.json",
  "pattern": "ixr-e2sc|cpm-sar|sar-10x"
}

Output

Found 9 matches
/source/head/schemas/clab.schema.json:
  Line 944:                                             "ixr-e2sc",

  Line 958:                                             "sar-10x",

  Line 2019:                 "cpm-ixr-e2sc/imm16-sfp++4-sfp28",

  Line 2027:                 "cpm-sar-hm",

  Line 2028:                 "cpm-sar-hmc",

  Line 2116:                 "cpm-ixr-e2sc/imm16-sfp++4-sfp28",

  Line 2128:                 "cpm-sar",

  Line 2129:                 "cpm-sar-hm",

  Line 2130:                 "cpm-sar-hmc",
Tool metadata
{
  "type": "tool",
  "id": "prt_1503382f9001VslYbsewg0KReS",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150337032001LiBerPTQC6INt5",
  "callID": "call_451fb8609e4a4820b2c69270",
  "tool": "grep",
  "state": {
    "status": "completed",
    "input": {
      "path": "/source/head/schemas/clab.schema.json",
      "pattern": "ixr-e2sc|cpm-sar|sar-10x"
    },
    "output": "Found 9 matches\n/source/head/schemas/clab.schema.json:\n  Line 944:                                             \"ixr-e2sc\",\n\n  Line 958:                                             \"sar-10x\",\n\n  Line 2019:                 \"cpm-ixr-e2sc/imm16-sfp++4-sfp28\",\n\n  Line 2027:                 \"cpm-sar-hm\",\n\n  Line 2028:                 \"cpm-sar-hmc\",\n\n  Line 2116:                 \"cpm-ixr-e2sc/imm16-sfp++4-sfp28\",\n\n  Line 2128:                 \"cpm-sar\",\n\n  Line 2129:                 \"cpm-sar-hm\",\n\n  Line 2130:                 \"cpm-sar-hmc\",\n",
    "title": "ixr-e2sc|cpm-sar|sar-10x",
    "metadata": {
      "matches": 9,
      "truncated": false
    },
    "time": {
      "start": 1792346915582,
      "end": 1792346915591
    }
  }
}
grep · completed

Input

{
  "path": "/source/head/.github/workflows/srsim-tests.yml",
  "pattern": "26_10_TESTS|robot|shard|matrix|suite"
}

Output

Found 100 matches (more matches available)
/source/head/.github/workflows/cicd.yml:
  Line 110:       matrix:

  Line 119:       runner: ${{ matrix.runner }}

  Line 120:       arch: ${{ matrix.arch }}


/source/head/.github/workflows/frr-tests.yml:
  Line 21:       matrix:

  Line 22:         test-suite:

  Line 23:           - "01*.robot"

  Line 62:       - name: Sanitize test-suite name

  Line 63:         run: echo "TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')" >> $GITHUB_ENV

  Line 67:           bash ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/14-basic-frr/${{ matrix.test-suite }}


/source/head/.github/workflows/srsim-tests.yml:
  Line 45:       matrix:

  Line 47:           - shard: basic

  Line 48:             test_suites: "01-sros-to-linux.robot 07-srsim-with-mgmt-network.robot 12-srsim-veth-stitch.robot"

  Line 49:           - shard: lifecycle

  Line 50:             test_suites: "04-sros-classic.robot 06-srsim-sar.robot 10-srsim-lifecycle.robot"

  Line 51:           - shard: components

  Line 52:             test_suites: "05-sros-comp-to-linux.robot 09-srsim-pause-container.robot 14-srsim-new-chassis.robot"

  Line 53:           - shard: provisioning

  Line 54:             test_suites: "03-sros-dist-to-linux.robot 08-srsim-comp-cfg-test.robot 13-srsim-integrated.robot"

  Line 55:           - shard: apply

  Line 56:             test_suites: "11-srsim-apply.robot"

  Line 98:       - name: Set shard name

  Line 99:         run: echo "TEST_SUITE=${{ matrix.shard }}" >> "$GITHUB_ENV"

  Line 122:           for test_suite in ${{ matrix.test_suites }}; do

  Line 123:             ./tests/rf-run.sh ${{ inputs.runtime }} "./tests/13-srsim/${test_suite}"


/source/head/.github/workflows/download-tests.yml:
  Line 20:       matrix:

  Line 21:         test-suite:

  Line 22:           - "*.robot"

  Line 61:       - name: Sanitize test-suite name

  Line 62:         run: echo "TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')" >> $GITHUB_ENV

  Line 66:           bash ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/09-download/${{ matrix.test-suite }}


/source/head/.github/workflows/sros-tests.yml:
  Line 21:       matrix:

  Line 22:         test-suite:

  Line 23:           - "01*.robot"

  Line 61:       - name: Sanitize test-suite name

  Line 62:         run: echo "TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')" >> $GITHUB_ENV

  Line 66:           bash ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/07-sros/${{ matrix.test-suite }}


/source/head/.github/workflows/kind-tests.yml:
  Line 20:       matrix:

  Line 21:         test-suite:

  Line 22:           - "01*.robot"

  Line 69:           bash ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/05-k8s-kind/${{ matrix.test-suite }}

  Line 71:       - name: Sanitize test-suite name

  Line 72:         run: echo "TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')" >> $GITHUB_ENV


/source/head/.github/workflows/build-devcontainer.yml:
  Line 32:     runs-on: ${{ matrix.runner }}

  Line 34:       matrix:

  Line 117:           TAGS=$(echo '${{ steps.meta.outputs.tags }}' | awk -F: '{print $2}' | sed "s/$/\-${{ matrix.arch-suffix }}/" | paste -sd "," -)

  Line 126:           imageName: ghcr.io/${{ github.repository }}/devcontainer${{ matrix.image-suffix }}

  Line 129:           platform: ${{ matrix.platform }}

  Line 130:           configFile: ${{ matrix.devContFile }}

  Line 136:       matrix:

  Line 178:             IMAGE_BASE="ghcr.io/${{ github.repository }}/devcontainer${{ matrix.variant.image-suffix }}"


/source/head/.github/workflows/cumulus-tests.yml:
  Line 22:       matrix:

  Line 23:         test-suite:

  Line 24:           - "01*.robot"

  Line 72:       - name: Sanitize test-suite name

  Line 73:         run: echo "TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')" >> $GITHUB_ENV

  Line 77:           bash ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/15-cumulus/${{ matrix.test-suite }}


/source/head/.github/workflows/fdio_vpp-tests.yml:
  Line 20:       matrix:

  Line 21:         test-suite:

  Line 22:           - "01*.robot"

  Line 60:       - name: Sanitize test-suite name

  Line 61:         run: echo "TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')" >> $GITHUB_ENV

  Line 68:           bash ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/11-fdio-vpp/${{ matrix.test-suite }}


/source/head/.github/workflows/build-binaries.yml:
  Line 97:       matrix:

  Line 110:       runner: ${{ matrix.runner }}

  Line 111:       arch: ${{ matrix.arch }}


/source/head/.github/workflows/srlinux-tests.yml:
  Line 20:       matrix:

  Line 21:         test-suite:

  Line 22:           - "01*.robot"

  Line 23:           - "03*.robot"

  Line 69:       - name: Sanitize test-suite name

  Line 70:         run: echo "TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')" >> $GITHUB_ENV

  Line 74:           bash ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/02-basic-srl/${{ matrix.test-suite }}


/source/head/.github/workflows/smoke-tests.yml:
  Line 25:       matrix:

  Line 26:         test-suite:

  Line 27:           - "01*.robot"

  Line 28:           - "02*.robot"

  Line 29:           - "03*.robot"

  Line 30:           - "04*.robot"

  Line 31:           - "06*.robot"

  Line 32:           - "08*.robot"

  Line 33:           - "09*.robot"

  Line 34:           - "10*.robot"

  Line 35:           - "11*.robot"

  Line 36:           - "12*.robot"

  Line 37:           - "13*.robot"

  Line 38:           - "14*.robot"

  Line 39:           - "15*.robot"

  Line 40:           - "17*.robot"

  Line 41:           - "18*.robot"

  Line 42:           - "19*.robot"

  Line 43:           - "20*.robot"

  Line 44:           - "21*.robot"

  Line 45:           - "22*.robot"

  Line 46:           - "23*.robot"

  Line 47:           - "24*.robot"

  Line 48:           - "25*.robot"

  Line 49:           - "26*.robot"

  Line 50:           - "27*.robot"

  Line 51:           - "28*.robot"

  Line 52:           - "29*.robot"


(Results truncated. Consider using a more specific path or pattern.)
Tool metadata
{
  "type": "tool",
  "id": "prt_1503383df0015H0c2i1bHypiS2",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150337032001LiBerPTQC6INt5",
  "callID": "call_29f04f1975344470adf1e3a2",
  "tool": "grep",
  "state": {
    "status": "completed",
    "input": {
      "path": "/source/head/.github/workflows/srsim-tests.yml",
      "pattern": "26_10_TESTS|robot|shard|matrix|suite"
    },
    "output": "Found 100 matches (more matches available)\n/source/head/.github/workflows/cicd.yml:\n  Line 110:       matrix:\n\n  Line 119:       runner: ${{ matrix.runner }}\n\n  Line 120:       arch: ${{ matrix.arch }}\n\n\n/source/head/.github/workflows/frr-tests.yml:\n  Line 21:       matrix:\n\n  Line 22:         test-suite:\n\n  Line 23:           - \"01*.robot\"\n\n  Line 62:       - name: Sanitize test-suite name\n\n  Line 63:         run: echo \"TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')\" >> $GITHUB_ENV\n\n  Line 67:           bash ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/14-basic-frr/${{ matrix.test-suite }}\n\n\n/source/head/.github/workflows/srsim-tests.yml:\n  Line 45:       matrix:\n\n  Line 47:           - shard: basic\n\n  Line 48:             test_suites: \"01-sros-to-linux.robot 07-srsim-with-mgmt-network.robot 12-srsim-veth-stitch.robot\"\n\n  Line 49:           - shard: lifecycle\n\n  Line 50:             test_suites: \"04-sros-classic.robot 06-srsim-sar.robot 10-srsim-lifecycle.robot\"\n\n  Line 51:           - shard: components\n\n  Line 52:             test_suites: \"05-sros-comp-to-linux.robot 09-srsim-pause-container.robot 14-srsim-new-chassis.robot\"\n\n  Line 53:           - shard: provisioning\n\n  Line 54:             test_suites: \"03-sros-dist-to-linux.robot 08-srsim-comp-cfg-test.robot 13-srsim-integrated.robot\"\n\n  Line 55:           - shard: apply\n\n  Line 56:             test_suites: \"11-srsim-apply.robot\"\n\n  Line 98:       - name: Set shard name\n\n  Line 99:         run: echo \"TEST_SUITE=${{ matrix.shard }}\" >> \"$GITHUB_ENV\"\n\n  Line 122:           for test_suite in ${{ matrix.test_suites }}; do\n\n  Line 123:             ./tests/rf-run.sh ${{ inputs.runtime }} \"./tests/13-srsim/${test_suite}\"\n\n\n/source/head/.github/workflows/download-tests.yml:\n  Line 20:       matrix:\n\n  Line 21:         test-suite:\n\n  Line 22:           - \"*.robot\"\n\n  Line 61:       - name: Sanitize test-suite name\n\n  Line 62:         run: echo \"TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')\" >> $GITHUB_ENV\n\n  Line 66:           bash ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/09-download/${{ matrix.test-suite }}\n\n\n/source/head/.github/workflows/sros-tests.yml:\n  Line 21:       matrix:\n\n  Line 22:         test-suite:\n\n  Line 23:           - \"01*.robot\"\n\n  Line 61:       - name: Sanitize test-suite name\n\n  Line 62:         run: echo \"TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')\" >> $GITHUB_ENV\n\n  Line 66:           bash ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/07-sros/${{ matrix.test-suite }}\n\n\n/source/head/.github/workflows/kind-tests.yml:\n  Line 20:       matrix:\n\n  Line 21:         test-suite:\n\n  Line 22:           - \"01*.robot\"\n\n  Line 69:           bash ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/05-k8s-kind/${{ matrix.test-suite }}\n\n  Line 71:       - name: Sanitize test-suite name\n\n  Line 72:         run: echo \"TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')\" >> $GITHUB_ENV\n\n\n/source/head/.github/workflows/build-devcontainer.yml:\n  Line 32:     runs-on: ${{ matrix.runner }}\n\n  Line 34:       matrix:\n\n  Line 117:           TAGS=$(echo '${{ steps.meta.outputs.tags }}' | awk -F: '{print $2}' | sed \"s/$/\\-${{ matrix.arch-suffix }}/\" | paste -sd \",\" -)\n\n  Line 126:           imageName: ghcr.io/${{ github.repository }}/devcontainer${{ matrix.image-suffix }}\n\n  Line 129:           platform: ${{ matrix.platform }}\n\n  Line 130:           configFile: ${{ matrix.devContFile }}\n\n  Line 136:       matrix:\n\n  Line 178:             IMAGE_BASE=\"ghcr.io/${{ github.repository }}/devcontainer${{ matrix.variant.image-suffix }}\"\n\n\n/source/head/.github/workflows/cumulus-tests.yml:\n  Line 22:       matrix:\n\n  Line 23:         test-suite:\n\n  Line 24:           - \"01*.robot\"\n\n  Line 72:       - name: Sanitize test-suite name\n\n  Line 73:         run: echo \"TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')\" >> $GITHUB_ENV\n\n  Line 77:           bash ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/15-cumulus/${{ matrix.test-suite }}\n\n\n/source/head/.github/workflows/fdio_vpp-tests.yml:\n  Line 20:       matrix:\n\n  Line 21:         test-suite:\n\n  Line 22:           - \"01*.robot\"\n\n  Line 60:       - name: Sanitize test-suite name\n\n  Line 61:         run: echo \"TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')\" >> $GITHUB_ENV\n\n  Line 68:           bash ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/11-fdio-vpp/${{ matrix.test-suite }}\n\n\n/source/head/.github/workflows/build-binaries.yml:\n  Line 97:       matrix:\n\n  Line 110:       runner: ${{ matrix.runner }}\n\n  Line 111:       arch: ${{ matrix.arch }}\n\n\n/source/head/.github/workflows/srlinux-tests.yml:\n  Line 20:       matrix:\n\n  Line 21:         test-suite:\n\n  Line 22:           - \"01*.robot\"\n\n  Line 23:           - \"03*.robot\"\n\n  Line 69:       - name: Sanitize test-suite name\n\n  Line 70:         run: echo \"TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')\" >> $GITHUB_ENV\n\n  Line 74:           bash ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/02-basic-srl/${{ matrix.test-suite }}\n\n\n/source/head/.github/workflows/smoke-tests.yml:\n  Line 25:       matrix:\n\n  Line 26:         test-suite:\n\n  Line 27:           - \"01*.robot\"\n\n  Line 28:           - \"02*.robot\"\n\n  Line 29:           - \"03*.robot\"\n\n  Line 30:           - \"04*.robot\"\n\n  Line 31:           - \"06*.robot\"\n\n  Line 32:           - \"08*.robot\"\n\n  Line 33:           - \"09*.robot\"\n\n  Line 34:           - \"10*.robot\"\n\n  Line 35:           - \"11*.robot\"\n\n  Line 36:           - \"12*.robot\"\n\n  Line 37:           - \"13*.robot\"\n\n  Line 38:           - \"14*.robot\"\n\n  Line 39:           - \"15*.robot\"\n\n  Line 40:           - \"17*.robot\"\n\n  Line 41:           - \"18*.robot\"\n\n  Line 42:           - \"19*.robot\"\n\n  Line 43:           - \"20*.robot\"\n\n  Line 44:           - \"21*.robot\"\n\n  Line 45:           - \"22*.robot\"\n\n  Line 46:           - \"23*.robot\"\n\n  Line 47:           - \"24*.robot\"\n\n  Line 48:           - \"25*.robot\"\n\n  Line 49:           - \"26*.robot\"\n\n  Line 50:           - \"27*.robot\"\n\n  Line 51:           - \"28*.robot\"\n\n  Line 52:           - \"29*.robot\"\n\n\n(Results truncated. Consider using a more specific path or pattern.)",
    "title": "26_10_TESTS|robot|shard|matrix|suite",
    "metadata": {
      "matches": 100,
      "truncated": true
    },
    "time": {
      "start": 1792346915813,
      "end": 1792346915827
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_1503383f5001mbTVDe7EIoSozQ",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150337032001LiBerPTQC6INt5",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 49703,
    "input": 687,
    "output": 104,
    "reasoning": 272,
    "cache": {
      "read": 48640,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_150337032001LiBerPTQC6INt5",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346910770,
    "completed": 1792346915833
  },
  "parentID": "msg_150318b6b001z1GyFDwe1Oii29",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 49703,
    "input": 687,
    "output": 104,
    "reasoning": 272,
    "cache": {
      "read": 48640,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 50
step-start
{
  "type": "step-start",
  "id": "prt_150338d68001XP10NBtEpLktwf",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150338404001EcysP8FW1mHzTq"
}
Reasoning
Key finding: the CI workflow's `components` shard includes `14-srsim-new-chassis.robot`, but nothing sets `26_10_TESTS:true` — the grep for `26_10_TESTS` in the workflow returned no matches (only robot file matches). Let me double-check by grepping the workflow file itself for `26_10_TESTS` (the grep pattern included it but matched only other patterns; the result shows no `26_10_TESTS` line in srsim-tests.yml). So in CI the new-chassis suite will always be skipped. Is that intentional (image 26.10 not yet released; SRSIM_IMAGE_TAG=26.7.R1)? Likely intentional gating, but the shard lists it and it will silently skip. This is a coverage note rather than a defect — or a P4: "CI shard lists 14-srsim-new-chassis.robot which always skips because no runner sets 26_10_TESTS". It's actionable: either add a variable to the workflow call or note it. I'd call it P4 (or coverage note). Given "Return only supported, useful findings", a P4 is fine.

Also confirm: does rf-run.sh accept `--variable`? The suite reads env or robot variable. `Skip If '${26_10_TESTS}'.lower() != 'true'` — robot variable default false. CI doesn't set it. So the new suite never runs in CI. Coverage note + P4.

Now calcComponentName: `fmt.Sprintf("%s-%s", name, strings.ToLower(slot))` — for mixed-case duplicate slots "a" and "A" → both "-a" → identical ShortName/LongName → duplicate containers. Confirms the impact of the pre-existing duplicate-slot-check bug. Pre-existing though (the check was moved verbatim). P4.

Now, is there anything genuinely P2/P3 introduced?

Let me reconsider the Init userEnv snapshot logic for a subtle regression:

```go
envAlreadyResolved := n.userEnv != nil
if !envAlreadyResolved {
    if n.Cfg.Env == nil {
        n.userEnv = map[string]string{}
    } else {
        n.userEnv = maps.Clone(n.Cfg.Env)
    }
}
if n.Cfg.Env == nil {
    n.Cfg.Env = map[string]string{}
}
```

Wait — in the first branch, `n.userEnv = map[string]string{}` when Cfg.Env is nil; then `n.Cfg.Env = map[string]string{}`. Fine.

But consider: a node whose `Init` is called TWICE? Not typical.

Consider the standalone path where Cfg.Env already contains envNokiaSrosSlot (card node). Standalone node = slot env NOT set OR components set. Hmm: isStandaloneNode for a node with NOKIA_SROS_SLOT set and components set? isDistributedCardNode = slot set && len(components)==0 → false. isDistributedBaseNode → integrated? For sr-1 with slot set and one component: isIntegrated → isRedundant (needs 2) → false; non-integrated: len>1 false → not distributed base → standalone. So a node can have slot env AND components → standalone. Then setupStandaloneComponents sets vars[envNokiaSrosSlot] = slotName (overriding node slot env — with warn? warnUserEnvOverrides(vars, userEnv) — if user set NOKIA_SROS_SLOT at node env, warn shows "component value A will not be used because environment variable NOKIA_SROS_SLOT is set"? Actually vars[NOKIA_SROS_SLOT]=slotName (from components entry), userEnv[NOKIA_SROS_SLOT]=user value → warn if differ. Hmm — is warning about SLOT appropriate? The slot env on a standalone node... edge case; the merge puts user env last so user value wins. Reasonable semantics.

Now — **the SFM inline warn + env for the standalone node: order**. In Init, SFM env is set into Cfg.Env BEFORE the standalone merge `MergeStringMaps(srosEnv, vars, n.Cfg.Env)` — Cfg.Env contains SFM; merge: later maps win → Cfg.Env SFM retained. Good.

**Another check — `warnUserEnvOverrides` for standalone is called with `vars` which includes NOKIA_SROS_SLOT.** If user set node-level NOKIA_SROS_SLOT and also components entry with different slot → warn. Fine.

**Now check `config.go` createSROSConfigFiles version detection is retained** — yes, moved.

**Check `template.go`**: getTemplateForVariant with swVersion unused param? `getTemplateForVariant(v ConfigVariant, swVersion *SrosVersion)` — swVersion used in comment only. Pre-existing? Base had the same function with the same comment. Moved. Fine.

**Check `netns.go`** — newNetnsConfig builds the pause container config. Previously inline in sros.go. Moved.

**Check `variant.go`** — ConfigVariant etc. Moved.

**Check `power.go`** — generatePowerConfig moved.

**One more potential issue — `componentWarnings` for line-card slot with `IOMSlots == 0`:** if entry.IOMSlots == 0, slot range check skipped. Fine.

**Now `docs` claim check: "ixr-r6 accepts A and B" — integratedSrosAllowedSlots(ixr-r6) = [A, B]. Docs consistent.

**Docs claim: "two ixr-r6 entries = dual-CPIOM distributed"** — matches isRedundantIntegratedSrosComponents.

**Schema check**: does schema's `components` allow `type` field? Presumably pre-existing. And are there new required constraints? The schema hunk added enum values only (from script). And new `fixed_mdas` in chassis_info is a script-side thing (not schema). Fine.

**Now — one thing I want to verify: the `warnUserEnvOverrides` call in the standalone Init path uses `vars`, but `vars` also includes component `c.Env` keys (maps.Copy(vars, slotA.Env) at line 388).** So node env vs component env warnings fire. Good.

**Potential missed issue: `keepUserEnv` writes user env value into `dst` for keys user set — but `dst` (componentConfig.Env) already contains those (deep copy of base env). Redundant but harmless.

**Now consider a REAL new-code bug candidate: In `setupComponentNodes`, `componentConfig.Env` is a deep copy of the base node's `n.Cfg.Env`. When is `setupComponentNodes` called relative to base `Init`?** If called BEFORE base Init (i.e., during topology load Init phase), base Cfg.Env wouldn't yet contain srosEnv chassis/mac — then component env lacks NOKIA_SROS_CHASSIS → `warnUnsupportedComponents` uses `n.Cfg.NodeType` fallback (line: nodeType := n.Cfg.NodeType; if chassis env set → override). Since Cfg.NodeType == base NodeType (line 657), still correct. And srosEnv chassis... base sets it in Init; component nodes' Init also sets srosEnv[envNokiaSrosChassis] = component NodeType — same value. OK regardless of order.

But wait — actually where is setupComponentNodes called? grep: likely in CheckDeploymentConditions or Init. Let me check quickly — it matters for whether `n.userEnv` is non-nil when setupComponentNodes runs (line 688 uses n.userEnv). If setupComponentNodes ran before base Init, userEnv would be nil → component userEnv = clone of nil → nil → hardwareEnv falls back to Cfg.Env (which contains merged component env!) → wrong precedence in config gen (component env treated as user env). Let me check the call site.

From earlier reading, I believe setupComponentNodes is called from `Init` (after userEnv snapshot) — the comment at line 686-687 says "Preserve the topology env. Init must not snapshot the merged component env" implying Init calls setupComponentNodes after snapshotting userEnv. Let me verify with grep.
Let me confirm where `setupComponentNodes` is called (to validate the `userEnv` ordering assumption).
grep · completed

Input

{
  "path": "/source/head/nodes/sros/sros.go",
  "pattern": "setupComponentNodes\\(\\)|n\\.userEnv"
}

Output

Found 11 matches
/source/head/nodes/sros/sros.go:
  Line 265: 	envAlreadyResolved := n.userEnv != nil

  Line 268: 			n.userEnv = map[string]string{}

  Line 270: 			n.userEnv = maps.Clone(n.Cfg.Env)

  Line 280: 		if envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {

  Line 328: 		warnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)

  Line 343: 		err := n.setupComponentNodes()

  Line 625: func (n *sros) setupComponentNodes() error {

  Line 668: 		keepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)

  Line 688: 		srosNode.userEnv = maps.Clone(n.userEnv)


/source/head/nodes/sros/component_config.go:
  Line 309: 	if n.userEnv != nil {

  Line 310: 		return n.userEnv
Tool metadata
{
  "type": "tool",
  "id": "prt_15033cac3001c3GZ6DQCMdP5Ya",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150338404001EcysP8FW1mHzTq",
  "callID": "call_854e9e338d5f44a9a8cb0eee",
  "tool": "grep",
  "state": {
    "status": "completed",
    "input": {
      "path": "/source/head/nodes/sros/sros.go",
      "pattern": "setupComponentNodes\\(\\)|n\\.userEnv"
    },
    "output": "Found 11 matches\n/source/head/nodes/sros/sros.go:\n  Line 265: \tenvAlreadyResolved := n.userEnv != nil\n\n  Line 268: \t\t\tn.userEnv = map[string]string{}\n\n  Line 270: \t\t\tn.userEnv = maps.Clone(n.Cfg.Env)\n\n  Line 280: \t\tif envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {\n\n  Line 328: \t\twarnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)\n\n  Line 343: \t\terr := n.setupComponentNodes()\n\n  Line 625: func (n *sros) setupComponentNodes() error {\n\n  Line 668: \t\tkeepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)\n\n  Line 688: \t\tsrosNode.userEnv = maps.Clone(n.userEnv)\n\n\n/source/head/nodes/sros/component_config.go:\n  Line 309: \tif n.userEnv != nil {\n\n  Line 310: \t\treturn n.userEnv\n",
    "title": "setupComponentNodes\\(\\)|n\\.userEnv",
    "metadata": {
      "matches": 11,
      "truncated": false
    },
    "time": {
      "start": 1792346933961,
      "end": 1792346933973
    }
  }
}
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/sros.go",
  "limit": 45,
  "offset": 300
}

Output

<path>/source/head/nodes/sros/sros.go</path>
<type>file</type>
<content>
300: 
301: 	// make sure we always have uppercase slot definition
302: 	for _, c := range n.kindSpecificCfg().Components {
303: 		c.Slot = strings.ToUpper(c.Slot)
304: 	}
305: 	// Merge Environment
306: 	if n.Cfg.NodeType == "" {
307: 		n.Cfg.NodeType = SrosDefaultType
308: 	}
309: 	srosEnv[envNokiaSrosChassis] = n.Cfg.NodeType // Override NodeType var with existing env
310: 
311: 	mac := genMac(n.Cfg)
312: 	srosEnv[envNokiaSrosSystemBaseMac] = mac
313: 	// Ensure n.Cfg.Certificate.Issue is not nil
314: 	if n.Cfg.Certificate.Issue == nil {
315: 		n.Cfg.Certificate.Issue = new(false)
316: 	}
317: 	if n.isStandaloneNode() {
318: 		log.Debugf(
319: 			"%q is standalone node. %v",
320: 			n.Cfg.ShortName,
321: 			len(n.kindSpecificCfg().Components),
322: 		)
323: 
324: 		vars, err := n.setupStandaloneComponents()
325: 		if err != nil {
326: 			return err
327: 		}
328: 		warnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)
329: 
330: 		// n.Cfg.Env overrides component vars, overrides default srosEnv
331: 		n.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)
332: 		log.Debug("Merged env file", "env", fmt.Sprintf("%+v", n.Cfg.Env), "node", n.Cfg.ShortName)
333: 	} else {
334: 		log.Debugf(
335: 			"%q is distributed node. %v",
336: 			n.Cfg.ShortName,
337: 			len(n.kindSpecificCfg().Components),
338: 		)
339: 
340: 		n.Cfg.Env = clabutils.MergeStringMaps(srosEnv, n.Cfg.Env)
341: 		log.Debug("Merged env file", "env", fmt.Sprintf("%+v", n.Cfg.Env), "node", n.Cfg.ShortName)
342: 
343: 		err := n.setupComponentNodes()
344: 		if err != nil {

(Showing lines 300-344 of 1910. Use offset=345 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_15033cb1c001A7tg7m9WYJTCqF",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150338404001EcysP8FW1mHzTq",
  "callID": "call_fb5ec616c414423ab9a106f2",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/sros.go",
      "limit": 45,
      "offset": 300
    },
    "output": "<path>/source/head/nodes/sros/sros.go</path>\n<type>file</type>\n<content>\n300: \n301: \t// make sure we always have uppercase slot definition\n302: \tfor _, c := range n.kindSpecificCfg().Components {\n303: \t\tc.Slot = strings.ToUpper(c.Slot)\n304: \t}\n305: \t// Merge Environment\n306: \tif n.Cfg.NodeType == \"\" {\n307: \t\tn.Cfg.NodeType = SrosDefaultType\n308: \t}\n309: \tsrosEnv[envNokiaSrosChassis] = n.Cfg.NodeType // Override NodeType var with existing env\n310: \n311: \tmac := genMac(n.Cfg)\n312: \tsrosEnv[envNokiaSrosSystemBaseMac] = mac\n313: \t// Ensure n.Cfg.Certificate.Issue is not nil\n314: \tif n.Cfg.Certificate.Issue == nil {\n315: \t\tn.Cfg.Certificate.Issue = new(false)\n316: \t}\n317: \tif n.isStandaloneNode() {\n318: \t\tlog.Debugf(\n319: \t\t\t\"%q is standalone node. %v\",\n320: \t\t\tn.Cfg.ShortName,\n321: \t\t\tlen(n.kindSpecificCfg().Components),\n322: \t\t)\n323: \n324: \t\tvars, err := n.setupStandaloneComponents()\n325: \t\tif err != nil {\n326: \t\t\treturn err\n327: \t\t}\n328: \t\twarnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)\n329: \n330: \t\t// n.Cfg.Env overrides component vars, overrides default srosEnv\n331: \t\tn.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)\n332: \t\tlog.Debug(\"Merged env file\", \"env\", fmt.Sprintf(\"%+v\", n.Cfg.Env), \"node\", n.Cfg.ShortName)\n333: \t} else {\n334: \t\tlog.Debugf(\n335: \t\t\t\"%q is distributed node. %v\",\n336: \t\t\tn.Cfg.ShortName,\n337: \t\t\tlen(n.kindSpecificCfg().Components),\n338: \t\t)\n339: \n340: \t\tn.Cfg.Env = clabutils.MergeStringMaps(srosEnv, n.Cfg.Env)\n341: \t\tlog.Debug(\"Merged env file\", \"env\", fmt.Sprintf(\"%+v\", n.Cfg.Env), \"node\", n.Cfg.ShortName)\n342: \n343: \t\terr := n.setupComponentNodes()\n344: \t\tif err != nil {\n\n(Showing lines 300-344 of 1910. Use offset=345 to continue.)\n</content>",
    "title": "source/head/nodes/sros/sros.go",
    "metadata": {
      "preview": "\n\t// make sure we always have uppercase slot definition\n\tfor _, c := range n.kindSpecificCfg().Components {\n\t\tc.Slot = strings.ToUpper(c.Slot)\n\t}\n\t// Merge Environment\n\tif n.Cfg.NodeType == \"\" {\n\t\tn.Cfg.NodeType = SrosDefaultType\n\t}\n\tsrosEnv[envNokiaSrosChassis] = n.Cfg.NodeType // Override NodeType var with existing env\n\n\tmac := genMac(n.Cfg)\n\tsrosEnv[envNokiaSrosSystemBaseMac] = mac\n\t// Ensure n.Cfg.Certificate.Issue is not nil\n\tif n.Cfg.Certificate.Issue == nil {\n\t\tn.Cfg.Certificate.Issue = new(false)\n\t}\n\tif n.isStandaloneNode() {\n\t\tlog.Debugf(\n\t\t\t\"%q is standalone node. %v\",",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/sros.go",
        "text": "\n\t// make sure we always have uppercase slot definition\n\tfor _, c := range n.kindSpecificCfg().Components {\n\t\tc.Slot = strings.ToUpper(c.Slot)\n\t}\n\t// Merge Environment\n\tif n.Cfg.NodeType == \"\" {\n\t\tn.Cfg.NodeType = SrosDefaultType\n\t}\n\tsrosEnv[envNokiaSrosChassis] = n.Cfg.NodeType // Override NodeType var with existing env\n\n\tmac := genMac(n.Cfg)\n\tsrosEnv[envNokiaSrosSystemBaseMac] = mac\n\t// Ensure n.Cfg.Certificate.Issue is not nil\n\tif n.Cfg.Certificate.Issue == nil {\n\t\tn.Cfg.Certificate.Issue = new(false)\n\t}\n\tif n.isStandaloneNode() {\n\t\tlog.Debugf(\n\t\t\t\"%q is standalone node. %v\",\n\t\t\tn.Cfg.ShortName,\n\t\t\tlen(n.kindSpecificCfg().Components),\n\t\t)\n\n\t\tvars, err := n.setupStandaloneComponents()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\twarnUserEnvOverrides(n.Cfg.ShortName, vars, n.userEnv)\n\n\t\t// n.Cfg.Env overrides component vars, overrides default srosEnv\n\t\tn.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)\n\t\tlog.Debug(\"Merged env file\", \"env\", fmt.Sprintf(\"%+v\", n.Cfg.Env), \"node\", n.Cfg.ShortName)\n\t} else {\n\t\tlog.Debugf(\n\t\t\t\"%q is distributed node. %v\",\n\t\t\tn.Cfg.ShortName,\n\t\t\tlen(n.kindSpecificCfg().Components),\n\t\t)\n\n\t\tn.Cfg.Env = clabutils.MergeStringMaps(srosEnv, n.Cfg.Env)\n\t\tlog.Debug(\"Merged env file\", \"env\", fmt.Sprintf(\"%+v\", n.Cfg.Env), \"node\", n.Cfg.ShortName)\n\n\t\terr := n.setupComponentNodes()\n\t\tif err != nil {",
        "lineStart": 300,
        "lineEnd": 344,
        "totalLines": 1910,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346934049,
      "end": 1792346934059
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_15033cb3f00131MsZbQpIJ5aKZ",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150338404001EcysP8FW1mHzTq",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 53770,
    "input": 2307,
    "output": 84,
    "reasoning": 1715,
    "cache": {
      "read": 49664,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_150338404001EcysP8FW1mHzTq",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346915845,
    "completed": 1792346934083
  },
  "parentID": "msg_150318b6b001z1GyFDwe1Oii29",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 53770,
    "input": 2307,
    "output": 84,
    "reasoning": 1715,
    "cache": {
      "read": 49664,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 51
step-start
{
  "type": "step-start",
  "id": "prt_15033d40c001ClEdEKbPHGg3Af",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15033cb4e001LhD8dpnT5MWc7D"
}
Reasoning
`setupComponentNodes` is called from `Init` at line 343, after the `userEnv` snapshot (line 265-270) — ordering is correct: `n.userEnv` is non-nil when line 668/688 run. Good.

Also note: line 302-304 uppercases component slots in-place in Init. This mutates the kind config's components slice — pre-existing pattern (base did the same? The diff line 1735-1736 shows "make sure we always have uppercase slot definition" as context, pre-existing). But note the uppercasing happens AFTER `isRedundantIntegratedSrosComponents` is not needed since slots already uppercase by then? Wait — Init uppercases slots at line 302, but `isDistributedBaseNode()` may be called BEFORE Init uppercasing? Init order: line 265 userEnv snapshot → line 273-297 SFM → line 301-304 uppercase slots → line 317 isStandaloneNode. isStandaloneNode → isDistributedBaseNode → isRedundantIntegratedSrosComponents (slots already uppercased). But `setupComponentNodes` (line 343) → isDistributedBaseNode again — slots still uppercase. And in tests or PreDeploy (after Init), slots uppercase. However — `isRedundantIntegratedSrosComponents` uses `strings.TrimSpace(c.Slot)` WITHOUT ToUpper before `integratedSrosSlotAllowed` — but integratedSrosSlotAllowed does ToUpper(TrimSpace). Wait line 254: `strings.TrimSpace(c.Slot) == ""` (empty check) then `integratedSrosSlotAllowed(nodeType, c.Slot)` which uppercases. OK.

But isDistributedBaseNode can be invoked on a base node where Init hasn't uppercased slots? E.g., called from GetShortName before Init? Unlikely. Fine.

One more consideration — line 309: package-level `srosEnv` mutation: `srosEnv[envNokiaSrosChassis] = n.Cfg.NodeType`. For component nodes' Init, this overwrites with component NodeType — same value. Pre-existing.

Now — check the "warn on node env overriding NOKIA_SROS_CHASSIS/MAC"? Not applicable.

Now the last big item to verify: **does the CI workflow pass `26_10_TESTS`?** Grep found no match in srsim-tests.yml. Let me look at the workflow diff more carefully (lines 1-83 of diff.txt) — I read it earlier. The workflow is a reusable workflow (workflow_call) with inputs; maybe the caller (cicd.yml) passes variables? The srsim-tests.yml inputs — does it have an inputs section allowing extra robot variables? Line 122-123: `./tests/rf-run.sh ${{ inputs.runtime }} "./tests/13-srsim/${test_suite}"` — no extra variables. Does rf-run.sh read env var 26_10_TESTS? No — it's a robot variable, not env. Actually `Skip If '${26_10_TESTS}'.lower() != 'true'` — robot variable, could be set via env? No, robot variables come from --variable flag or variable files, not env (unless ${26_10_TESTS%{...}}). So unless someone invokes with --variable 26_10_TESTS:true, the suite skips. The workflow includes it in the components shard → it will always skip in CI.

Is this a defect? The PR adds the suite and schedules it in CI but doesn't enable the gate → dead CI coverage. Options: (a) intentional because 26.10 image isn't public yet (SRSIM_IMAGE_TAG=26.7.R1); (b) oversight. Either way, worth flagging as P3/P4: the shard runs a suite that always skips; suggest adding a workflow input (e.g., `26_10_TESTS` robot variable) or removing it from the shard until the image is available. I'd call it P4 (optional improvement / coverage note) since skipping is graceful and likely intentional for an unreleased image. Hmm — but if intentional, listing it in the shard is harmless. I'll flag as P4 with both readings.

Also the workflow removed the "Sanitize test-suite name" step and uses `TEST_SUITE=${{ matrix.shard }}` — fine.

Now, are there any P2/P3 findings I'm confident about? Let me do one final sweep of things I haven't fully verified:

1. `config.go` — full file (createSROSConfigFiles, prepareConfigTemplateData moved). I read it earlier per summary. It matched the removed code. OK.

2. `sros_test.go` new tests — read earlier; they cover classification, warnings, env precedence. Good.

3. `chassis_info_test.go` — read earlier (truncated at 57 but I saw most). It tests entry alias resolution and componentWarnings.

4. Robot refactor: `tests/srsim.robot` shared resource at tests/ root — other suites updated to use it. Fine.

5. README: updated with chassis_info flow and warnings (line 48 seen).

6. One more possible issue: **`warnUnsupportedComponents` is called even when `writeChassisInfoToLabDir` fails?** No — only on success path. If ReadFileFromImageInspect fails (older images without chassis_info.json), no validation and no warning that validation was skipped — only Debug log. Acceptable (advisory).

7. **Duplicate warnings for redundant integrated**: CPM A component warns once. Base node (distributed base) doesn't run createSROSFiles. Good.

8. **`n.componentSFM()` for CPM component node uses userEnv — but the component node's kindSpecificCfg().SFM comes from base kind config. And base Cfg.Env SFM (set in Init) is in component env but NOT in componentSFM's lookup (hardwareEnv = userEnv only).** So SFM resolution for component nodes: userEnv (user-set) or kind config SFM. The base's Cfg.Env[NOKIA_SROS_SFM] (set from kind config when user didn't set) is not consulted — but it equals kindSpecificCfg().SFM, same result. Fine.

9. **Now — a potential real P3: `componentSFM()` vs the SFM env set on the base.** For the standalone node, `hardwareEnv()` = userEnv; if user did NOT set SFM and kind config has SFM, componentSFM → kind SFM. Consistent with base env value. OK.

10. **Check `checkComponentSlotsConfig` invocation still happens** — grep earlier showed it's called in CheckDeploymentConditions (component.go? or sros.go). It was moved to component.go. Fine.

11. **Docs statement: "Node env overrides component type, XIOM, MDA, SFM, and per-component env"** — matches implementation.

12. **One more edge: `applyHardwareEnv` — `envNokiaSrosMDA+"_X"` prefix check happens BEFORE `envNokiaSrosMDA+"_"` — correct.

13. **`buildComponentCfgLines` for a CPM component node emits lines for ALL non-CPM root components** — pre-existing.

14. Hmm — one NEW behavioral consideration: **For the redundant integrated node (ixr-r6 A+B), each CPM component node generates integrated config (card 1 iom-ixr-r6 + mda).** But the base node itself (rootCtrName == ""? base's rootCtrName — for base, rootCtrName is "" unless network-mode). Base is distributed base → not standalone → its createSROSFiles never runs → no config generated on base. Only component CPMs. Good.

15. **What about `generatePowerConfig` for integrated nodes?** componentConfigFromLines appends power config — for integrated standalone, lines from defaults + power. Moved logic. Fine.

Now, decide final findings:

- **P4**: `checkComponentSlotsConfig` mixed-case duplicate slots bypass (pre-existing, moved into `component.go`); concrete impact with calcComponentName producing duplicate component container names for slots `a`/`A`; fix while moving: insert uppercased slot.
- **P4**: SFM inline warning in `Init` duplicates `warnUserEnvOverrides` logic (could pass a one-key derived map).
- **P4**: CI components shard lists `14-srsim-new-chassis.robot` but no runner sets `26_10_TESTS`, so the new suite always skips in CI; add a workflow input/robot variable or exclude the suite until the 26.10 image is generally available.

Wait — for the third one, let me double check the workflow diff (lines 1-83) to see if there's an input for extra robot variables. Let me quickly view the head workflow file top section. Also check whether rf-run.sh forwards env vars — the robot variable could be set via env? Actually Robot Framework does support environment-variable-based variables with syntax %{...}, not ${...}. So no.

Hmm, actually, wait: could `26_10_TESTS` be set in rf-run.sh or conftest? Let me grep tests dir for 26_10_TESTS quickly. If rf-run.sh doesn't set it, conclusion holds.

Also, one more potential finding I should double check — **the `IsPartialConfigFile` + `n.isCPM("")` guard at line 1415 in config.go (moved)**: "if IsPartialConfigFile && n.isCPM('')" — for partial config on line cards: log.Warn "startup-config will not have any effect". Pre-existing.

Let me also double-check there's no missing `SaveConfig`/healthcheck change... The diff hunks I read covered everything.

Also should check: **`components` schema property `type` docs vs schema**: schema has components.type presumably already (base). Not changed.

One more thing: **the schema `mda` types enum — does it include the new MDA types used in integratedSrosDefaultComponents (e.g. `m4-1g-tx+20-1g-sfp+6-10g-sfp+`)?** These are defaults used in generated config, not user input validation necessarily (components[].mda.type references sros-mda-types enum). If schema lacks some types used by defaults, user topo with those types would fail schema validation. The script adds FixedMDAs values to mda enum — integrated defaults' MDAs presumably come from chassis_info FixedMDAs. The script runs from chassis_info.json of the image, so enums should cover. Spot check one: `m4-1g-tx+20-1g-sfp+6-10g-sfp+` in schema. Quick grep.

Let me run these two greps and then finalize.
Let me verify two last details: whether anything in the tests directory sets `26_10_TESTS`, and whether the schema MDA enum covers the integrated defaults.
grep · completed

Input

{
  "path": "/source/head/tests",
  "pattern": "26_10_TESTS"
}

Output

Found 3 matches
/source/head/tests/13-srsim/14-srsim-new-chassis.robot:
  Line 7: Suite Setup         Skip If    '${26_10_TESTS}'.lower() != 'true'

  Line 8: ...                 SR-SIM 26.10 is required; enable with --variable 26_10_TESTS:true

  Line 16: ${26_10_TESTS}      false
Tool metadata
{
  "type": "tool",
  "id": "prt_150342c2e001PG5NNSbohwCGGZ",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15033cb4e001LhD8dpnT5MWc7D",
  "callID": "call_669a32d92b874300aab3f590",
  "tool": "grep",
  "state": {
    "status": "completed",
    "input": {
      "path": "/source/head/tests",
      "pattern": "26_10_TESTS"
    },
    "output": "Found 3 matches\n/source/head/tests/13-srsim/14-srsim-new-chassis.robot:\n  Line 7: Suite Setup         Skip If    '${26_10_TESTS}'.lower() != 'true'\n\n  Line 8: ...                 SR-SIM 26.10 is required; enable with --variable 26_10_TESTS:true\n\n  Line 16: ${26_10_TESTS}      false\n",
    "title": "26_10_TESTS",
    "metadata": {
      "matches": 3,
      "truncated": false
    },
    "time": {
      "start": 1792346958906,
      "end": 1792346958926
    }
  }
}
grep · completed

Input

{
  "path": "/source/head/schemas/clab.schema.json",
  "pattern": "m4-1g-tx\\+20-1g-sfp\\+6-10g-sfp\\+|m6-10g-sfp\\+\\+1-100g-qsfp28|imm16-sfp\\+\\+4-sfp28"
}

Output

Found 5 matches
/source/head/schemas/clab.schema.json:
  Line 2019:                 "cpm-ixr-e2sc/imm16-sfp++4-sfp28",

  Line 2047:                 "imm4-1g-tx+20-1g-sfp+6-10g-sfp+",

  Line 2116:                 "cpm-ixr-e2sc/imm16-sfp++4-sfp28",

  Line 2184:                 "m4-1g-tx+20-1g-sfp+6-10g-sfp+",

  Line 2197:                 "m6-10g-sfp++1-100g-qsfp28",
Tool metadata
{
  "type": "tool",
  "id": "prt_150342d58001eZe8gwmkQuwbfi",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15033cb4e001LhD8dpnT5MWc7D",
  "callID": "call_ae9cc54b47914a259a788613",
  "tool": "grep",
  "state": {
    "status": "completed",
    "input": {
      "path": "/source/head/schemas/clab.schema.json",
      "pattern": "m4-1g-tx\\+20-1g-sfp\\+6-10g-sfp\\+|m6-10g-sfp\\+\\+1-100g-qsfp28|imm16-sfp\\+\\+4-sfp28"
    },
    "output": "Found 5 matches\n/source/head/schemas/clab.schema.json:\n  Line 2019:                 \"cpm-ixr-e2sc/imm16-sfp++4-sfp28\",\n\n  Line 2047:                 \"imm4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n\n  Line 2116:                 \"cpm-ixr-e2sc/imm16-sfp++4-sfp28\",\n\n  Line 2184:                 \"m4-1g-tx+20-1g-sfp+6-10g-sfp+\",\n\n  Line 2197:                 \"m6-10g-sfp++1-100g-qsfp28\",\n",
    "title": "m4-1g-tx\\+20-1g-sfp\\+6-10g-sfp\\+|m6-10g-sfp\\+\\+1-100g-qsfp28|imm16-sfp\\+\\+4-sfp28",
    "metadata": {
      "matches": 5,
      "truncated": false
    },
    "time": {
      "start": 1792346959198,
      "end": 1792346959211
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_150342d6d001of6iyZqNSakDNf",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_15033cb4e001LhD8dpnT5MWc7D",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 57042,
    "input": 855,
    "output": 130,
    "reasoning": 2297,
    "cache": {
      "read": 53760,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_15033cb4e001LhD8dpnT5MWc7D",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346934094,
    "completed": 1792346959218
  },
  "parentID": "msg_150318b6b001z1GyFDwe1Oii29",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 57042,
    "input": 855,
    "output": 130,
    "reasoning": 2297,
    "cache": {
      "read": 53760,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 52
step-start
{
  "type": "step-start",
  "id": "prt_1503436b10011lvf0iISgZOMqb",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150342d7f00147DfnsXHGI9aB7"
}
Reasoning
Confirmed:
- `26_10_TESTS` is only set inside the new robot file (default false) — nothing in CI or rf-run.sh enables it. So the new-chassis suite always skips in the `components` shard.
- Schema enums cover the integrated default MDA types.

I have completed the review. Final findings:

1. **P4** — CI `components` shard includes `14-srsim-new-chassis.robot`, but no runner sets `26_10_TESTS`, so the suite always skips in CI. Location: `.github/workflows/srsim-tests.yml` line 52 (head). Suggest adding a workflow input/robot variable (e.g. pass `--variable 26_10_TESTS:true` for a dedicated shard or job) or removing the suite from the shard until the 26.10 image is generally available; either way, make the gating discoverable.

2. **P4** — `checkComponentSlotsConfig` mixed-case duplicate-slot gap (pre-existing, moved verbatim from `sros.go` into `component.go`). Insert the uppercased slot into `componentNames` so slots `a` and `A` are rejected; downstream `calcComponentName` would otherwise produce two components with identical names (`-a`), and `buildComponentCfgLines` would emit duplicate slot-A card config.

3. **P4** — Inline SFM override warning in `Init` (`sros.go` ~273-297) duplicates the `warnUserEnvOverrides` message/logic for a single key; could be `warnUserEnvOverrides(n.Cfg.ShortName, map[string]string{envNokiaSrosSFM: sfm}, n.userEnv)` followed by the env set when absent.

Are any of these P3? The CI one: the suite silently skipping in CI is a real coverage gap for new code paths (new chassis types untested in CI). But since it's guarded by an unreleased image (SRSIM_IMAGE_TAG=26.7.R1), likely intentional. P4.

The duplicate-slot one: pre-existing; per instructions, focus on issues introduced or materially worsened. Moving the code is part of the refactor; fixing while moving is reasonable. P4.

The SFM duplication: P4 maintainability.

Nothing P0-P3 found. All new logic verified: classification, env precedence, warnings once per lab, schema enums, docs.

Coverage notes: complete; tests not executed (static review only); runtime behaviors (container naming, netns, image inspection) inferred from code; robot suite gating verified statically.

Now write the final Markdown review + JSON. Permalinks: head root https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/, base root https://github.com/srl-labs/containerlab/blob/84cf630e6eedd662d9742fbcd6158a91372e3a56/.

Locations:
- Finding 1: head `.github/workflows/srsim-tests.yml` — need exact line numbers. Grep showed lines 45-56 (matrix), with `14-srsim-new-chassis.robot` at line 52. start 51 end 52.
- Finding 2: head `nodes/sros/component.go` — checkComponentSlotsConfig region. I read component.go lines 160-168 which shows the tail of the function; the function starts around line 141. The grep earlier showed "component.go:164: // add to component names map" and line 165 insertion `componentNames[slot] = struct{}{}`... wait line 165 in my read shows `componentNames[slot] = struct{}{}`? Let me re-check: in the read of component.go lines 160-168: line 164 comment "// add to component names map", line 165 `componentNames[slot] = struct{}{}`. Hmm — line 165 shows `componentNames[slot]` — is that the uppercased `slot` variable? Wait, looking at the read output:

```
160: n.GetShortName(),
161: component.Slot,
162: )
163: }
164: // add to component names map
165: componentNames[slot] = struct{}{}
```

Line 165 is `componentNames[slot]` — the UPPERCASED slot! That contradicts the base code which inserted `componentNames[component.Slot]`. So the PR FIXED the insertion bug while moving! Let me verify by reading component.go lines 135-170 again. From the read: lines 160-168. Line 165: `componentNames[slot] = struct{}{}`. The base version inserted `componentNames[component.Slot]` (raw). So the head version uses `componentNames[slot]` where `slot` is the ToUpper'd variable — the bug is FIXED in this PR. Great — so finding 2 is void. Let me confirm by reading component.go 135-170.
One more verification — the moved `checkComponentSlotsConfig` may have actually fixed the insertion bug. Let me read the full function in `component.go`.
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/component.go",
  "limit": 40,
  "offset": 135
}

Output

<path>/source/head/nodes/sros/component.go</path>
<type>file</type>
<content>
135: 		env[key] = x.Type
136: 		// add the nested MDA
137: 		for _, m := range x.MDA {
138: 			key := fmt.Sprintf("%s_X%d_%d", envNokiaSrosMDA, x.Slot, m.Slot)
139: 			env[key] = m.Type
140: 		}
141: 	}
142: 
143: 	for _, m := range c.MDA {
144: 		key := fmt.Sprintf("%s_%d", envNokiaSrosMDA, m.Slot)
145: 		env[key] = m.Type
146: 	}
147: }
148: 
149: func (n *sros) checkComponentSlotsConfig() error {
150: 	// check Slots are unique
151: 	componentNames := map[string]struct{}{}
152: 	for _, component := range n.kindSpecificCfg().Components {
153: 		// convert slot to upper
154: 		slot := strings.ToUpper(component.Slot)
155: 		// check if slot exists
156: 		_, exists := componentNames[slot]
157: 		if exists {
158: 			return fmt.Errorf(
159: 				"node %s slot %s duplicate definition",
160: 				n.GetShortName(),
161: 				component.Slot,
162: 			)
163: 		}
164: 		// add to component names map
165: 		componentNames[slot] = struct{}{}
166: 
167: 	}
168: 	return nil
169: }
170: 
171: // componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,
172: // and per-component env. Per-component env overrides the typed fields.
173: func componentDerivedEnv(c *Component) map[string]string {
174: 	derived := map[string]string{}

(Showing lines 135-174 of 309. Use offset=175 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_150345af300104e7PiiuiEB3NP",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150342d7f00147DfnsXHGI9aB7",
  "callID": "call_d14151e7ba84468180f2e35f",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/component.go",
      "limit": 40,
      "offset": 135
    },
    "output": "<path>/source/head/nodes/sros/component.go</path>\n<type>file</type>\n<content>\n135: \t\tenv[key] = x.Type\n136: \t\t// add the nested MDA\n137: \t\tfor _, m := range x.MDA {\n138: \t\t\tkey := fmt.Sprintf(\"%s_X%d_%d\", envNokiaSrosMDA, x.Slot, m.Slot)\n139: \t\t\tenv[key] = m.Type\n140: \t\t}\n141: \t}\n142: \n143: \tfor _, m := range c.MDA {\n144: \t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n145: \t\tenv[key] = m.Type\n146: \t}\n147: }\n148: \n149: func (n *sros) checkComponentSlotsConfig() error {\n150: \t// check Slots are unique\n151: \tcomponentNames := map[string]struct{}{}\n152: \tfor _, component := range n.kindSpecificCfg().Components {\n153: \t\t// convert slot to upper\n154: \t\tslot := strings.ToUpper(component.Slot)\n155: \t\t// check if slot exists\n156: \t\t_, exists := componentNames[slot]\n157: \t\tif exists {\n158: \t\t\treturn fmt.Errorf(\n159: \t\t\t\t\"node %s slot %s duplicate definition\",\n160: \t\t\t\tn.GetShortName(),\n161: \t\t\t\tcomponent.Slot,\n162: \t\t\t)\n163: \t\t}\n164: \t\t// add to component names map\n165: \t\tcomponentNames[slot] = struct{}{}\n166: \n167: \t}\n168: \treturn nil\n169: }\n170: \n171: // componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,\n172: // and per-component env. Per-component env overrides the typed fields.\n173: func componentDerivedEnv(c *Component) map[string]string {\n174: \tderived := map[string]string{}\n\n(Showing lines 135-174 of 309. Use offset=175 to continue.)\n</content>",
    "title": "source/head/nodes/sros/component.go",
    "metadata": {
      "preview": "\t\tenv[key] = x.Type\n\t\t// add the nested MDA\n\t\tfor _, m := range x.MDA {\n\t\t\tkey := fmt.Sprintf(\"%s_X%d_%d\", envNokiaSrosMDA, x.Slot, m.Slot)\n\t\t\tenv[key] = m.Type\n\t\t}\n\t}\n\n\tfor _, m := range c.MDA {\n\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n\t\tenv[key] = m.Type\n\t}\n}\n\nfunc (n *sros) checkComponentSlotsConfig() error {\n\t// check Slots are unique\n\tcomponentNames := map[string]struct{}{}\n\tfor _, component := range n.kindSpecificCfg().Components {\n\t\t// convert slot to upper\n\t\tslot := strings.ToUpper(component.Slot)",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/component.go",
        "text": "\t\tenv[key] = x.Type\n\t\t// add the nested MDA\n\t\tfor _, m := range x.MDA {\n\t\t\tkey := fmt.Sprintf(\"%s_X%d_%d\", envNokiaSrosMDA, x.Slot, m.Slot)\n\t\t\tenv[key] = m.Type\n\t\t}\n\t}\n\n\tfor _, m := range c.MDA {\n\t\tkey := fmt.Sprintf(\"%s_%d\", envNokiaSrosMDA, m.Slot)\n\t\tenv[key] = m.Type\n\t}\n}\n\nfunc (n *sros) checkComponentSlotsConfig() error {\n\t// check Slots are unique\n\tcomponentNames := map[string]struct{}{}\n\tfor _, component := range n.kindSpecificCfg().Components {\n\t\t// convert slot to upper\n\t\tslot := strings.ToUpper(component.Slot)\n\t\t// check if slot exists\n\t\t_, exists := componentNames[slot]\n\t\tif exists {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"node %s slot %s duplicate definition\",\n\t\t\t\tn.GetShortName(),\n\t\t\t\tcomponent.Slot,\n\t\t\t)\n\t\t}\n\t\t// add to component names map\n\t\tcomponentNames[slot] = struct{}{}\n\n\t}\n\treturn nil\n}\n\n// componentDerivedEnv is the environment a component would set from its type, XIOM, MDA,\n// and per-component env. Per-component env overrides the typed fields.\nfunc componentDerivedEnv(c *Component) map[string]string {\n\tderived := map[string]string{}",
        "lineStart": 135,
        "lineEnd": 174,
        "totalLines": 309,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346970871,
      "end": 1792346970879
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_150345b01001BS8O3TjmcNz375",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150342d7f00147DfnsXHGI9aB7",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 58405,
    "input": 460,
    "output": 60,
    "reasoning": 1053,
    "cache": {
      "read": 56832,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_150342d7f00147DfnsXHGI9aB7",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346959231,
    "completed": 1792346970884
  },
  "parentID": "msg_150318b6b001z1GyFDwe1Oii29",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 58405,
    "input": 460,
    "output": 60,
    "reasoning": 1053,
    "cache": {
      "read": 56832,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 53
step-start
{
  "type": "step-start",
  "id": "prt_15034640b0011RhN7i5NvjWyIY",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150345b15001J6y8OyYBckLufC"
}
Reasoning
Confirmed: the moved `checkComponentSlotsConfig` in the head inserts the uppercased `slot` (line 165: `componentNames[slot]`), which FIXES the base bug (`componentNames[component.Slot]`). Let me quickly double check the base version to be sure the base had the bug. From the diff removal (lines 1966-1987 of diff.txt):

```
-		// add to component names map
-		componentNames[component.Slot] = struct{}{}
```

Yes, base inserted raw. Head inserts uppercased. So the PR fixed it — good, no finding.

Final findings:
1. P4 — CI components shard lists `14-srsim-new-chassis.robot` but nothing sets `26_10_TESTS`, so the new suite always skips in CI.
2. P4 — SFM inline warning in `Init` duplicates `warnUserEnvOverrides` semantics for a single key.

Both P4. Nothing P0-P3.

Let me double check finding 2's exact head line numbers in sros.go: Init SFM branch. From diff context: head lines ~273-297. Let me read sros.go 255-300 to get exact lines.
read · completed

Input

{
  "filePath": "/source/head/nodes/sros/sros.go",
  "limit": 45,
  "offset": 258
}

Output

<path>/source/head/nodes/sros/sros.go</path>
<type>file</type>
<content>
258: 	// if user was not initialized to a value, use root
259: 	if n.Cfg.User == "" {
260: 		n.Cfg.User = "0:0"
261: 	}
262: 
263: 	// Snapshot topology env before component and SFM flags are applied.
264: 	// Component nodes set userEnv from the base node before Init.
265: 	envAlreadyResolved := n.userEnv != nil
266: 	if !envAlreadyResolved {
267: 		if n.Cfg.Env == nil {
268: 			n.userEnv = map[string]string{}
269: 		} else {
270: 			n.userEnv = maps.Clone(n.Cfg.Env)
271: 		}
272: 	}
273: 	if n.Cfg.Env == nil {
274: 		n.Cfg.Env = map[string]string{}
275: 	}
276: 
277: 	// Distributed cards inherit SFM from the base node env. Applying it again
278: 	// would warn once per card when the user also set NOKIA_SROS_SFM.
279: 	if sfm := n.kindSpecificCfg().SFM; sfm != "" && !envAlreadyResolved {
280: 		if envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {
281: 			if envSFM != sfm {
282: 				log.Warn(
283: 					fmt.Sprintf(
284: 						"component value %q will not be used because environment variable %s is set",
285: 						sfm,
286: 						envNokiaSrosSFM,
287: 					),
288: 					"node", n.Cfg.ShortName,
289: 					"env", envNokiaSrosSFM,
290: 					"component-value", sfm,
291: 					"env-value", envSFM,
292: 				)
293: 			}
294: 		} else {
295: 			n.Cfg.Env[envNokiaSrosSFM] = sfm
296: 		}
297: 	}
298: 
299: 	maps.Copy(n.Cfg.Sysctls, srosSysctl)
300: 
301: 	// make sure we always have uppercase slot definition
302: 	for _, c := range n.kindSpecificCfg().Components {

(Showing lines 258-302 of 1910. Use offset=303 to continue.)
</content>
Tool metadata
{
  "type": "tool",
  "id": "prt_150346c6e001x1IktMXYGWgk4E",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150345b15001J6y8OyYBckLufC",
  "callID": "call_71dc0bcd925d4fbf9f2a4dc0",
  "tool": "read",
  "state": {
    "status": "completed",
    "input": {
      "filePath": "/source/head/nodes/sros/sros.go",
      "limit": 45,
      "offset": 258
    },
    "output": "<path>/source/head/nodes/sros/sros.go</path>\n<type>file</type>\n<content>\n258: \t// if user was not initialized to a value, use root\n259: \tif n.Cfg.User == \"\" {\n260: \t\tn.Cfg.User = \"0:0\"\n261: \t}\n262: \n263: \t// Snapshot topology env before component and SFM flags are applied.\n264: \t// Component nodes set userEnv from the base node before Init.\n265: \tenvAlreadyResolved := n.userEnv != nil\n266: \tif !envAlreadyResolved {\n267: \t\tif n.Cfg.Env == nil {\n268: \t\t\tn.userEnv = map[string]string{}\n269: \t\t} else {\n270: \t\t\tn.userEnv = maps.Clone(n.Cfg.Env)\n271: \t\t}\n272: \t}\n273: \tif n.Cfg.Env == nil {\n274: \t\tn.Cfg.Env = map[string]string{}\n275: \t}\n276: \n277: \t// Distributed cards inherit SFM from the base node env. Applying it again\n278: \t// would warn once per card when the user also set NOKIA_SROS_SFM.\n279: \tif sfm := n.kindSpecificCfg().SFM; sfm != \"\" && !envAlreadyResolved {\n280: \t\tif envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {\n281: \t\t\tif envSFM != sfm {\n282: \t\t\t\tlog.Warn(\n283: \t\t\t\t\tfmt.Sprintf(\n284: \t\t\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n285: \t\t\t\t\t\tsfm,\n286: \t\t\t\t\t\tenvNokiaSrosSFM,\n287: \t\t\t\t\t),\n288: \t\t\t\t\t\"node\", n.Cfg.ShortName,\n289: \t\t\t\t\t\"env\", envNokiaSrosSFM,\n290: \t\t\t\t\t\"component-value\", sfm,\n291: \t\t\t\t\t\"env-value\", envSFM,\n292: \t\t\t\t)\n293: \t\t\t}\n294: \t\t} else {\n295: \t\t\tn.Cfg.Env[envNokiaSrosSFM] = sfm\n296: \t\t}\n297: \t}\n298: \n299: \tmaps.Copy(n.Cfg.Sysctls, srosSysctl)\n300: \n301: \t// make sure we always have uppercase slot definition\n302: \tfor _, c := range n.kindSpecificCfg().Components {\n\n(Showing lines 258-302 of 1910. Use offset=303 to continue.)\n</content>",
    "title": "source/head/nodes/sros/sros.go",
    "metadata": {
      "preview": "\t// if user was not initialized to a value, use root\n\tif n.Cfg.User == \"\" {\n\t\tn.Cfg.User = \"0:0\"\n\t}\n\n\t// Snapshot topology env before component and SFM flags are applied.\n\t// Component nodes set userEnv from the base node before Init.\n\tenvAlreadyResolved := n.userEnv != nil\n\tif !envAlreadyResolved {\n\t\tif n.Cfg.Env == nil {\n\t\t\tn.userEnv = map[string]string{}\n\t\t} else {\n\t\t\tn.userEnv = maps.Clone(n.Cfg.Env)\n\t\t}\n\t}\n\tif n.Cfg.Env == nil {\n\t\tn.Cfg.Env = map[string]string{}\n\t}\n\n\t// Distributed cards inherit SFM from the base node env. Applying it again",
      "truncated": true,
      "loaded": [],
      "display": {
        "type": "file",
        "path": "/source/head/nodes/sros/sros.go",
        "text": "\t// if user was not initialized to a value, use root\n\tif n.Cfg.User == \"\" {\n\t\tn.Cfg.User = \"0:0\"\n\t}\n\n\t// Snapshot topology env before component and SFM flags are applied.\n\t// Component nodes set userEnv from the base node before Init.\n\tenvAlreadyResolved := n.userEnv != nil\n\tif !envAlreadyResolved {\n\t\tif n.Cfg.Env == nil {\n\t\t\tn.userEnv = map[string]string{}\n\t\t} else {\n\t\t\tn.userEnv = maps.Clone(n.Cfg.Env)\n\t\t}\n\t}\n\tif n.Cfg.Env == nil {\n\t\tn.Cfg.Env = map[string]string{}\n\t}\n\n\t// Distributed cards inherit SFM from the base node env. Applying it again\n\t// would warn once per card when the user also set NOKIA_SROS_SFM.\n\tif sfm := n.kindSpecificCfg().SFM; sfm != \"\" && !envAlreadyResolved {\n\t\tif envSFM, ok := n.userEnv[envNokiaSrosSFM]; ok {\n\t\t\tif envSFM != sfm {\n\t\t\t\tlog.Warn(\n\t\t\t\t\tfmt.Sprintf(\n\t\t\t\t\t\t\"component value %q will not be used because environment variable %s is set\",\n\t\t\t\t\t\tsfm,\n\t\t\t\t\t\tenvNokiaSrosSFM,\n\t\t\t\t\t),\n\t\t\t\t\t\"node\", n.Cfg.ShortName,\n\t\t\t\t\t\"env\", envNokiaSrosSFM,\n\t\t\t\t\t\"component-value\", sfm,\n\t\t\t\t\t\"env-value\", envSFM,\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\tn.Cfg.Env[envNokiaSrosSFM] = sfm\n\t\t}\n\t}\n\n\tmaps.Copy(n.Cfg.Sysctls, srosSysctl)\n\n\t// make sure we always have uppercase slot definition\n\tfor _, c := range n.kindSpecificCfg().Components {",
        "lineStart": 258,
        "lineEnd": 302,
        "totalLines": 1910,
        "truncated": true
      }
    },
    "time": {
      "start": 1792346975346,
      "end": 1792346975355
    }
  }
}
step-finish
{
  "type": "step-finish",
  "id": "prt_150346c7d001nu37C9NGQRg0f1",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150345b15001J6y8OyYBckLufC",
  "reason": "tool-calls",
  "cost": 0,
  "tokens": {
    "total": 59136,
    "input": 481,
    "output": 31,
    "reasoning": 256,
    "cache": {
      "read": 58368,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_150345b15001J6y8OyYBckLufC",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346970901,
    "completed": 1792346975360
  },
  "parentID": "msg_150318b6b001z1GyFDwe1Oii29",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 59136,
    "input": 481,
    "output": 31,
    "reasoning": 256,
    "cache": {
      "read": 58368,
      "write": 0
    }
  },
  "finish": "tool-calls"
}
Assistant · 54
step-start
{
  "type": "step-start",
  "id": "prt_150347a09001mKQJYA2O8ZozDi",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150346c8d001FeqnMLn7ulSYvI"
}
Reasoning
All verifications complete. Final review with two P4 findings.

Findings:

**P4-1: New `14-srsim-new-chassis.robot` suite is scheduled in CI but can never run there.**
- Location: head `.github/workflows/srsim-tests.yml` (shard list, `components` shard at lines 51-52).
- Problem: The suite gates itself on `${26_10_TESTS}` (default `false` in the robot file), and neither `srsim-tests.yml` nor `rf-run.sh` sets it. So the `components` shard always skips the new chassis tests.
- Impact: The new-chassis paths (`ixr-e2sc`, `ixr-e3`, `sar-10x` classification, integrated/distributed routing, warnings) get no CI coverage; failures would only surface manually.
- Suggestion: Add a workflow input (e.g. `extra_robot_vars` or a dedicated `26_10` shard passing `--variable 26_10_TESTS:true`), or exclude the suite from the shard until the 26.10 image is generally available so the shard listing reflects reality.

**P4-2: SFM override warning in `Init` duplicates `warnUserEnvOverrides` for one key.**
- Location: head `nodes/sros/sros.go` lines 277-297.
- Problem: The inline block reproduces exactly the warn semantics of `warnUserEnvOverrides` (warn when the user env value differs) for the single `NOKIA_SROS_SFM` key.
- Impact: Two copies of the same message format/log fields to keep in sync.
- Suggestion: `warnUserEnvOverrides(n.Cfg.ShortName, map[string]string{envNokiaSrosSFM: sfm}, n.userEnv)` then set `n.Cfg.Env[envNokiaSrosSFM] = sfm` when absent (the helper already checks `userSet`).

Coverage notes: full static review of all 31 changed paths plus head/base comparison; verified classification routing, env precedence, single-warning behavior, schema enum coverage for new types and integrated MDA defaults, docs/README updates, moved-code equivalence. Tests were not executed (read-only review); runtime behaviors (container creation, netns join, image inspection) are inferred from code and robot expectations. Noted that the moved `checkComponentSlotsConfig` fixed the base insertion bug (now stores the uppercased slot).

Now write the Markdown review and the JSON.
All verification is complete. Here is the final review.

---

# PR Review: SR-SIM components model refactor, chassis_info validation, new chassis types, CI sharding

**Head:** `d44c69f` · **Base:** `84cf630` · Scope: 31 changed paths (13 files under `nodes/sros/`, schema generator + `clab.schema.json`, docs/README, CI workflow, robot tests).

## Summary

This PR is primarily a well-executed refactor of `nodes/sros`: template/config/power/netns/variant logic moves out of the oversized `sros.go` into focused files, and a new `chassis_info.go`-driven advisory validation layer is added. I verified the load-bearing behavior changes end-to-end:

- **Classification routing** is coherent: `isDistributedBaseNode` now returns true for integrated types with redundant components (`ixr-r6` A+B), while `setupStandaloneComponents` still errors for the same input on a standalone path; component nodes strip their `Components` (`kindSpecificConfig.Of(componentConfig).Components = nil`) so they classify as distributed cards and cannot recurse.
- **Env precedence** is consistent with the documented model: `userEnv` is snapshotted before component/SFM flags are applied (`sros.go:263-275`), component nodes inherit it (`sros.go:688`), and `keepUserEnv`/`warnUserEnvOverrides`/`applyHardwareEnv` implement "node env wins over per-component env wins over derived types" with warnings. `componentDerivedEnv` correctly folds in per-component `c.Env`.
- **Warnings fire once per lab**: `PreDeploy` → `createSROSFiles` runs only for standalone nodes and distributed CPM cards (`sros.go:410`), and `warnUnsupportedComponents` guards to CPM A (`sros.go:1073-1077`), so neither CPM B nor line cards duplicate warnings.
- **The moved `checkComponentSlotsConfig` actually fixes a base bug**: base inserted the raw slot into the dedup map while checking the uppercased slot; the head version (`component.go:165`) inserts the uppercased slot, so mixed-case duplicates (`a`/`A`) are now rejected.
- **Schema and docs align**: new node types (`ixr-e2sc`, `ixr-e3`, `sar-10x`) and MDA types are present in `clab.schema.json` enums (generated via the updated `sros_schema_gen.sh`, which now derives enums from the chassis table and adds `fixed_mdas` values), and the integrated-default MDA types used by `integratedSrosDefaultComponents` all appear in the schema. `docs/manual/kinds/sros.md` and `nodes/sros/README.md` describe the new components model, the card-override skip behavior, and env override semantics accurately.

No P0–P3 defects were found. Two P4 improvements follow.

## Findings

| Priority | Count |
|----------|-------|
| P0 | 0 |
| P1 | 0 |
| P2 | 0 |
| P3 | 0 |
| P4 | 2 |

### P4 — New `14-srsim-new-chassis.robot` suite is scheduled in CI but always skips there

**Location:** [`.github/workflows/srsim-tests.yml` L51-L52](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/.github/workflows/srsim-tests.yml#L51-L52) and [`tests/13-srsim/14-srsim-new-chassis.robot` L7-L16](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/tests/13-srsim/14-srsim-new-chassis.robot#L7-L16)

**Problem:** The new chassis suite gates itself with `Skip If '${26_10_TESTS}'.lower() != 'true'` and defaults the variable to `false`. Nothing in the repository sets it: `srsim-tests.yml` invokes `./tests/rf-run.sh ${{ inputs.runtime }} ./tests/13-srsim/${test_suite}` with no `--variable` flag and no input that could carry one, yet the `components` shard lists `14-srsim-new-chassis.robot`.

**Trigger:** Every CI run of the `components` shard.

**Impact:** The new-chassis code paths (`ixr-e2sc`, `ixr-e3`, `sar-10x` classification, integrated/distributed routing, component warnings) receive no automated CI coverage; regressions would only surface through manual runs with `--variable 26_10_TESTS:true`. The shard listing overstates actual coverage.

**Suggestion:** Either add a workflow input (or a dedicated shard) that passes `--variable 26_10_TESTS:true` once the 26.10 image is generally available, or remove the suite from the `components` shard until then so the shard reflects reality. If the skip is intentionally permanent until the image ships, a comment in the workflow would make that explicit.

### P4 — SFM override warning in `Init` duplicates `warnUserEnvOverrides` for one key

**Location:** [`nodes/sros/sros.go` L277-L297](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/nodes/sros/sros.go#L277-L297)

**Problem:** The inline block reproduces exactly the semantics of `warnUserEnvOverrides` (`component.go:184-202`) — warn when the user env value exists and differs — for the single `NOKIA_SROS_SFM` key, including the identical message format and log fields. `warnUserEnvOverrides` exists precisely for this pattern and is already used two call sites later.

**Trigger:** Any node whose kind config sets `SFM` while the user also sets `NOKIA_SROS_SFM` to a different value.

**Impact:** Two copies of the same warning text/log-field contract to keep in sync; future changes to the message must be made in both places.

**Suggestion:** Replace the inline warn with `warnUserEnvOverrides(n.Cfg.ShortName, map[string]string{envNokiaSrosSFM: sfm}, n.userEnv)` and keep the `n.Cfg.Env[envNokiaSrosSFM] = sfm` assignment gated on the key being absent (the helper already computes `userSet`). This is a small local simplification, not a structural change.

## Coverage Notes

- **Complete static review.** All 31 changed paths were read from `diff.txt` in full; head files were cross-checked where the diff was ambiguous (including the complete `utils/sros_schema_gen.sh`, `chassis_info.go`, `component_config.go`, and `component.go`). Tests were **not executed**; all behavioral conclusions are from source inspection and the robot test expectations, not from runs.
- Verified: classification routing for standalone/integrated/redundant/distributed cases; `userEnv` snapshot ordering relative to `setupComponentNodes` (called from `Init` at `sros.go:343`, after the snapshot — correct); single-warning behavior across CPM A/B and line cards; per-component env preservation via `componentDerivedEnv`; schema enum coverage for the new chassis types and integrated-default MDA types; docs/README consistency with the implementation.
- Runtime-dependent behaviors (container creation, netns join, image inspection returning `chassis_info.json`, gnmic queries against distributed-base container names) are inferred from code and test expectations, not verified in a live environment.
- The base `checkComponentSlotsConfig` insertion bug (raw-slot insert vs uppercased check) was fixed as part of the move; no finding was raised for it.
- The package-level `srosEnv` map mutation (`sros.go:309,312`) and SFM-per-line-card config emission are pre-existing patterns carried over unchanged and were not flagged.

```json
{
  "version": 1,
  "findings": [
    {
      "priority": "P4",
      "title": "CI `components` shard schedules `14-srsim-new-chassis.robot`, which always skips because no runner sets `26_10_TESTS`",
      "location": {
        "revision": "head",
        "path": ".github/workflows/srsim-tests.yml",
        "start": 51,
        "end": 52
      },
      "problem": "The new chassis suite gates itself with `Skip If '${26_10_TESTS}'.lower() != 'true'` and defaults the variable to `false` in `tests/13-srsim/14-srsim-new-chassis.robot`. Nothing in the repository sets it: `srsim-tests.yml` invokes `./tests/rf-run.sh ${{ inputs.runtime }} ./tests/13-srsim/${test_suite}` with no `--variable` flag and no input that could carry one, yet the `components` shard lists `14-srsim-new-chassis.robot`.",
      "trigger": "Every CI run of the `components` shard.",
      "impact": "The new-chassis code paths (`ixr-e2sc`, `ixr-e3`, `sar-10x` classification, integrated/distributed routing, component warnings) receive no automated CI coverage, and the shard listing overstates actual coverage. Regressions would only surface through manual runs with `--variable 26_10_TESTS:true`.",
      "suggestion": "Either add a workflow input (or a dedicated shard) that passes `--variable 26_10_TESTS:true` once the 26.10 image is generally available, or remove the suite from the `components` shard until then. If the skip is intentionally permanent until the image ships, a comment in the workflow would make that explicit."
    },
    {
      "priority": "P4",
      "title": "Inline SFM override warning in `Init` duplicates `warnUserEnvOverrides` for the `NOKIA_SROS_SFM` key",
      "location": {
        "revision": "head",
        "path": "nodes/sros/sros.go",
        "start": 277,
        "end": 297
      },
      "problem": "The inline block in `Init` reproduces exactly the semantics of `warnUserEnvOverrides` (`component.go:184-202`) — warn when the user env value exists and differs — for the single `NOKIA_SROS_SFM` key, including the identical message format and log fields.",
      "trigger": "Any node whose kind config sets `SFM` while the user also sets the `NOKIA_SROS_SFM` environment variable to a different value.",
      "impact": "Two copies of the same warning text and log-field contract must be kept in sync; a future message change must be applied in both places, which is easy to miss during maintenance.",
      "suggestion": "Replace the inline warn with `warnUserEnvOverrides(n.Cfg.ShortName, map[string]string{envNokiaSrosSFM: sfm}, n.userEnv)` and keep the `n.Cfg.Env[envNokiaSrosSFM] = sfm` assignment gated on the key being absent (the helper already computes `userSet`). This is a small local simplification, not a structural change."
    }
  ],
  "coverage": {
    "complete": true,
    "notes": [
      "Static review only; tests were not executed. All 31 changed paths were read from diff.txt in full, and head files were cross-checked where the diff was ambiguous (including the complete utils/sros_schema_gen.sh, chassis_info.go, component_config.go, and component.go).",
      "Verified: classification routing (standalone/integrated/redundant/distributed), userEnv snapshot ordering relative to setupComponentNodes (called from Init at sros.go:343, after the snapshot), single-warning behavior across CPM A/B and line cards via the PreDeploy gating, per-component env preservation in componentDerivedEnv, and schema enum coverage for the new chassis types and integrated-default MDA types.",
      "Runtime-dependent behaviors (container creation, netns join, image inspection returning chassis_info.json, gnmic queries against distributed-base container names) are inferred from code and robot test expectations, not verified in a live environment.",
      "The base checkComponentSlotsConfig insertion bug (raw-slot insert vs uppercased check) was fixed as part of the move; no finding was raised for it.",
      "The package-level srosEnv map mutation (sros.go:309,312) and SFM-per-line-card config emission are pre-existing patterns carried over unchanged and were not flagged."
    ]
  }
}
```
step-finish
{
  "type": "step-finish",
  "id": "prt_15034cacf001sSVa4ZE27JWr6S",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "messageID": "msg_150346c8d001FeqnMLn7ulSYvI",
  "reason": "stop",
  "cost": 0,
  "tokens": {
    "total": 63007,
    "input": 589,
    "output": 2759,
    "reasoning": 523,
    "cache": {
      "read": 59136,
      "write": 0
    }
  }
}
Message metadata
{
  "role": "assistant",
  "id": "msg_150346c8d001FeqnMLn7ulSYvI",
  "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
  "time": {
    "created": 1792346975373,
    "completed": 1792346999509
  },
  "parentID": "msg_150318b6b001z1GyFDwe1Oii29",
  "modelID": "zai-org/GLM-5.3-Flash",
  "providerID": "tofarev",
  "mode": "tofarev",
  "agent": "tofarev",
  "path": {
    "cwd": "/tmp/tofarev-review-aUhh0x",
    "root": "/"
  },
  "cost": 0,
  "tokens": {
    "total": 63007,
    "input": 589,
    "output": 2759,
    "reasoning": 523,
    "cache": {
      "read": 59136,
      "write": 0
    }
  },
  "finish": "stop"
}