{
  "version": 1,
  "repository": "srl-labs/containerlab",
  "head": "d44c69f72ab156474197f12b6fc1407b3f8a65c4",
  "updatedAt": "2026-10-18T18:09:59.648Z",
  "state": "completed",
  "info": {
    "id": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
    "title": "ToFaRev review",
    "slug": "playful-knight",
    "projectID": "global",
    "directory": "/tmp/tofarev-review-aUhh0x",
    "path": "tmp/tofarev-review-aUhh0x",
    "summary": {
      "additions": 0,
      "deletions": 0,
      "files": 0
    },
    "cost": 0,
    "tokens": {
      "input": 630321,
      "output": 12411,
      "reasoning": 31581,
      "cache": {
        "read": 1620736,
        "write": 0
      }
    },
    "agent": "tofarev",
    "model": {
      "id": "zai-org/GLM-5.3-Flash",
      "providerID": "tofarev",
      "variant": "default"
    },
    "version": "1.19.3",
    "time": {
      "created": 1792346522430,
      "updated": 1792346999539
    }
  },
  "messages": [
    {
      "info": {
        "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"
        }
      },
      "parts": [
        {
          "type": "text",
          "id": "prt_1502d8a6d001J6z736fLGD4KdL",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502d8a66001F2b7xDf6faLOHN",
          "text": "Review the read-only PR snapshot at /source.\nRead 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.\nHead: d44c69f72ab156474197f12b6fc1407b3f8a65c4. Comparison base: 84cf630e6eedd662d9742fbcd6158a91372e3a56. Target base: 84cf630e6eedd662d9742fbcd6158a91372e3a56.\nGitHub permalink roots: head=https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/; base=https://github.com/srl-labs/containerlab/blob/84cf630e6eedd662d9742fbcd6158a91372e3a56/.\nSnapshot incomplete: false. The full inventory and omission details are in manifest.json; consult it when needed. "
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502d9930001isDXuBckgK4Oru",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502d8d39001ueMeRrKSWMmkMd"
        },
        {
          "type": "reasoning",
          "id": "prt_1502d9938001JZURa6CFNnOdev",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502d8d39001ueMeRrKSWMmkMd",
          "text": "Let me start by exploring the snapshot structure and reading the standards.",
          "time": {
            "start": 1792346528056,
            "end": 1792346528194
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502d9d4d0014lAErKscuE6mcU",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502d9a31001syzcYf80k0jjc3"
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502da6e4001RUOsnrLkp4uMeN",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502d9e6b001O6WVSMYXb5D2sX"
        },
        {
          "type": "reasoning",
          "id": "prt_1502da6e6001U0n0utew64ADiT",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502d9e6b001O6WVSMYXb5D2sX",
          "text": "The manifest is long. I have the changed paths list (31). Now let me read the diff.",
          "time": {
            "start": 1792346531558,
            "end": 1792346531707
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502db242001i8SaIwZ2tYjtNn",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502da7a9001g13xnqsXX4pQRr"
        },
        {
          "type": "reasoning",
          "id": "prt_1502db24400154Z1Fajcqqsw5B",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502da7a9001g13xnqsXX4pQRr",
          "text": "The diff is large. Let me continue reading from line 1614.",
          "time": {
            "start": 1792346534468,
            "end": 1792346534642
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502dbe1f001Tf9eKFtUPY2fiY",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502db31e001gHWujWsTb5hCpw"
        },
        {
          "type": "reasoning",
          "id": "prt_1502dbe21001IuIdh1ozI6qliA",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502db31e001gHWujWsTb5hCpw",
          "text": "Continue reading the diff.",
          "time": {
            "start": 1792346537505,
            "end": 1792346537602
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502df6ba001K51PVYfgfbNuBP",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502dbe9f001ek5Hgev3SCmtk8"
        },
        {
          "type": "reasoning",
          "id": "prt_1502df6bc001uaJcCUbsPyJjc3",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502dbe9f001ek5Hgev3SCmtk8",
          "text": "Now let me read the head files for the changed Go files to check for issues. Key files to examine carefully:\n\n1. `nodes/sros/chassis_info.go` — new validation logic.\n2. `nodes/sros/component.go` — env override logic.\n3. `nodes/sros/component_config.go` — integrated config generation.\n4. `nodes/sros/config.go` — config generation moved from sros.go.\n5. `nodes/sros/netns.go` — moved code.\n6. `nodes/sros/sros.go` — big changes.\n7. Schema changes.\n\nLet me read head files.",
          "time": {
            "start": 1792346551996,
            "end": 1792346552661
          }
        },
        {
          "type": "text",
          "id": "prt_1502df958001A5zcxksd4bnkgQ",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502dbe9f001ek5Hgev3SCmtk8",
          "text": "Now let me read the head source files in detail.",
          "time": {
            "start": 1792346552664,
            "end": 1792346552848
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502e0588001SmZ1Is76uENiVs",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502dfa1f0013gFa7ej4MGIfaF"
        },
        {
          "type": "reasoning",
          "id": "prt_1502e058a0016KiCkAGVcBIE3T",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502dfa1f0013gFa7ej4MGIfaF",
          "text": "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.\n\nWait — 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.\n\nAnother: `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.\n\nNow read component_config.go, config.go, netns.go, power.go, variant.go, template.go, sros.go (head).",
          "time": {
            "start": 1792346555786,
            "end": 1792346557744
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
        }
      },
      "parts": [
        {
          "type": "compaction",
          "id": "prt_1502e0d48001QYTvzwEUG5McqF",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502e0d47001j5ACV2tj1J23hI",
          "auto": true,
          "overflow": false,
          "tail_start_id": "msg_1502dbe9f001ek5Hgev3SCmtk8"
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502e12cf001e1rHr6Lom7SfEc",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502e0d5c001zGtvE22hHJMPos"
        },
        {
          "type": "reasoning",
          "id": "prt_1502e12d1001MmL1Q3D7Kp3dOo",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502e0d5c001zGtvE22hHJMPos",
          "text": "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.\n\nList 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).\n\nDiff 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.\n\nRules: read of /source root denied; use explicit file paths like /source/standards.json. Reading *.env requires ask — not relevant.",
          "time": {
            "start": 1792346559185,
            "end": 1792346561771
          }
        },
        {
          "type": "text",
          "id": "prt_1502e1cec001dX37WzHa0d6DCr",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502e0d5c001zGtvE22hHJMPos",
          "text": "## Objective\n- 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.\n\n## Important Details\n- Head: `d44c69f72ab156474197f12b6fc1407b3f8a65c4`; base/mergeBase: `84cf630e6eedd662d9742fbcd6158a91372e3a56` (target base identical).\n- Snapshot incomplete: false; full inventory in `/source/manifest.json`.\n- Permalink roots: head=`https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/`, base=`https://github.com/srl-labs/containerlab/blob/84cf630e6eedd662d9742fbcd6158a91372e3a56/`.\n- 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.\n- 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).\n- 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).\n- Key diff themes seen so far:\n  - `.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.\n  - `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).\n  - 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}`).\n\n## Work State\n### Completed\n- Read `/source/standards.json`, `/source/standards/karpathy-guidelines.mdc`, `/source/standards/ponytail.mdc`.\n- Read `/source/manifest.json` (partially; changed-path list captured above, tail truncated).\n- Read `/source/diff.txt` segments: lines ~1–49 (workflow hunk), 1614–~1660 (sros.go hunks), 3151–~3198 (tests/13-srsim/01 & 03 hunks).\n- Learned read of directory `/source` is denied; explicit file reads work.\n\n### Active\n- Mid-way through reading `/source/diff.txt` (31 paths, large file) with offsets; not yet finished.\n- Full manifest tail not yet captured (remaining changed paths beyond `tests/13-srsim/04-sros-classic.robot`).\n- Head/base file inspection for changed Go files, schema, docs, README, and new test resource (`srsim.robot`) not started.\n- No review verdict assembled yet; trusted result schema not yet returned.\n\n### Blocked\n- None blocking; only truncated-output offsets and the directory-read denial (worked around with explicit paths).\n\n## Next Move\n1. 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.\n2. 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.\n\n## Relevant Files\n- `/source/standards.json`, `/source/standards/karpathy-guidelines.mdc`, `/source/standards/ponytail.mdc`: review standards to apply.\n- `/source/manifest.json`: authoritative list of all 31 changed paths and statuses (tail still unread).\n- `/source/diff.txt`: full PR diff, partially read (segments at start, 1614, 3151).\n- `.github/workflows/srsim-tests.yml`: CI matrix sharding changes to verify.\n- `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.\n- `schemas/clab.schema.json`, `docs/manual/kinds/sros.md`, `nodes/sros/README.md`: schema/docs consistency to check.\n- `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.\n- GitHub permalinks above for citing base/head file versions in the final review.",
          "time": {
            "start": 1792346561773,
            "end": 1792346571165
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
        }
      },
      "parts": [
        {
          "type": "text",
          "id": "prt_1502e41ac001bu3ehr2BUEeD98",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502e41aa001XEn2l1GdfLHjHR",
          "text": "Continue if you have next steps, or stop and ask for clarification if you are unsure how to proceed.",
          "synthetic": true,
          "time": {
            "start": 1792346571180,
            "end": 1792346571180
          },
          "metadata": {
            "compaction_continue": true
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502e4e5b001jut4NrF5xZ2u52",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502e41b4001UmFGYE2sTMN9pk"
        },
        {
          "type": "reasoning",
          "id": "prt_1502e4e5e001RhzjEqQb9PLq7H",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502e41b4001UmFGYE2sTMN9pk",
          "text": "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.",
          "time": {
            "start": 1792346574430,
            "end": 1792346574636
          }
        },
        {
          "type": "text",
          "id": "prt_1502e4f2e00150TZtV750Bvkm8",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502e41b4001UmFGYE2sTMN9pk",
          "text": "Continuing the review — reading the remaining head source files.",
          "time": {
            "start": 1792346574638,
            "end": 1792346574791
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502e567e001cuJxY95m2p7dEx",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502e4fde001N94er0X5VXLsDq"
        },
        {
          "type": "reasoning",
          "id": "prt_1502e5681001QsFTHfdNhqyntu",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502e4fde001N94er0X5VXLsDq",
          "text": "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.\n\nAlso `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.\n\nLet me read power.go and sros.go (head).",
          "time": {
            "start": 1792346576513,
            "end": 1792346578732
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502e6583001s0f3PJWIpP5C1y",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502e5f42001e10roJstImV7H5"
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502e73d6001CQBgPyiwAzJNYr",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502e65e1001OgTBP5VcFf5FbI"
        },
        {
          "type": "reasoning",
          "id": "prt_1502e73d80016MpveMtjfyeOn7",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502e65e1001OgTBP5VcFf5FbI",
          "text": "Let me continue reading sros.go from line 1700, then template.go, variant.go, chassis_info_test.go, sros_test.go, schema, docs, README.",
          "time": {
            "start": 1792346584024,
            "end": 1792346584195
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502e7d6d001NHK12EsP06ofz8",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502e74d500149rk6g1A9t7MNG"
        },
        {
          "type": "reasoning",
          "id": "prt_1502e7d6f0018jpIGjYhzabDEU",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502e74d500149rk6g1A9t7MNG",
          "text": "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.\n\nWait: 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.\n\nBut 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.\n\nNow template.go.",
          "time": {
            "start": 1792346586479,
            "end": 1792346589636
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502e91d2001uLXwLTtxxcOjXE",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502e89f6001yZyZ9L3yksryNy"
        },
        {
          "type": "reasoning",
          "id": "prt_1502e91d50014JIu4H37WFpqmT",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502e89f6001yZyZ9L3yksryNy",
          "text": "Now read the tests: chassis_info_test.go and sros_test.go.",
          "time": {
            "start": 1792346591701,
            "end": 1792346591850
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502ea1c0001gdM6jnFl8Yq006",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502e928b001Djua5Ij7UHMAJo"
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502ead97001SF6xbjTo4UBsW1",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502ea218001TxfPGVQVV0MLpz"
        },
        {
          "type": "reasoning",
          "id": "prt_1502ead99001GUFHEKj5neTOG4",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502ea218001TxfPGVQVV0MLpz",
          "text": "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.\n\nPotential 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.\n\nAlso `n.Cfg.Env = clabutils.MergeStringMaps(srosEnv, vars, n.Cfg.Env)` — srosEnv is shared. Pre-existing presumably.\n\nPotential 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.\n\nWait — 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.\n\nLet 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.",
          "time": {
            "start": 1792346598809,
            "end": 1792346604310
          }
        },
        {
          "type": "text",
          "id": "prt_1502ec318001uPT8tkpKtyq7qq",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502ea218001TxfPGVQVV0MLpz",
          "text": "Now let me read the diff systematically to understand what changed versus what was moved.",
          "time": {
            "start": 1792346604312,
            "end": 1792346604592
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502ecf3e001PU3bPGAFwIbIUQ",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502ec44d001escZDwyW8y5PXF"
        },
        {
          "type": "reasoning",
          "id": "prt_1502ecf410012lK3Hcm5Qxrld6",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502ec44d001escZDwyW8y5PXF",
          "text": "Let me continue reading the diff from line 1201.",
          "time": {
            "start": 1792346607425,
            "end": 1792346607603
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502ef89d001aST6NBLqP9SrwQ",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502ed01c001YCpcFvJ3o9WYH6"
        },
        {
          "type": "reasoning",
          "id": "prt_1502ef89f001FM7x2DFb6K57i4",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502ed01c001YCpcFvJ3o9WYH6",
          "text": "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.\n\nOne 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.\n\nNow `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.\n\nBut 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.\n\nNow, `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.\n\nNow potential bug: `generateIntegratedComponentConfig` checks `n.Cfg.Env[envNokiaSrosCard]` but for distributed linecard component nodes of a NON-integrated type... not applicable.\n\nBut 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.\n\nHowever `componentSFM` uses `hardwareEnv()` which prefers userEnv. Fine.\n\nNow, 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.\n\nAnother: `applyHardwareEnv` — per-component env also includes non-hardware keys; fine.\n\nNow, `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.\n\nWait, 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.\n\nNow 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.\n\nNow: srosEnv mutation — package-level map mutated per node Init. Pre-existing.\n\nNow the diff so far. Let me continue reading from 2501.",
          "time": {
            "start": 1792346618015,
            "end": 1792346628394
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
        }
      },
      "parts": [
        {
          "type": "compaction",
          "id": "prt_1502f2159001ah3jS46nB5bnib",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502f2158001O67Rj9uC9d2IPd",
          "auto": true,
          "overflow": false
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502f2959001s4qnw58H4KlWQc",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502f216f001OjleXo6mnSylCp"
        },
        {
          "type": "reasoning",
          "id": "prt_1502f295b001n3REn7wFYF6lfG",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502f216f001OjleXo6mnSylCp",
          "text": "Combine the prior summary with the new conversation progress. The conversation shows deep reading of head files and diff segments. Update completed/active accordingly.",
          "time": {
            "start": 1792346630491,
            "end": 1792346630804
          }
        },
        {
          "type": "text",
          "id": "prt_1502f2a96001JS5oq6sf0DY7iE",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502f216f001OjleXo6mnSylCp",
          "text": "## Objective\n- 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.\n\n## Important Details\n- Head: `d44c69f72ab156474197f12b6fc1407b3f8a65c4`; base/mergeBase: `84cf630e6eedd662d9742fbcd6158a91372e3a56`.\n- Permalink roots: head=`https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/`, base=`https://github.com/srl-labs/containerlab/blob/84cf630e6eedd662d9742fbcd6158a91372e3a56/`.\n- Tooling constraint: plain `read(\"/source\")` is denied; must read explicit file paths. Large files need offset/limit reads (diff.txt read in chunks).\n- Standards applied (from `standards.json`): `.cursor/rules/karpathy-guidelines.mdc` (surgical changes) and `.cursor/rules/ponytail.mdc` (simplest solution, shortest diff).\n- 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.\n- Key head-file facts learned:\n  - `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).\n  - `component.go`: `Component{Slot,Type,Env,XIOM,MDA}`, `componentsBySlot` (uppercase/trim, `#N` fallback key), `MDAS.UnmarshalYAML` validates slot>0 and type non-empty.\n  - `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`.\n  - `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).\n  - `netns.go`: `namespaceNode` wrapper, `newNetnsConfig` builds `srsim-netns` labels (`NodeName`, `LongName`, `NodeType`, `InternalNode`, `RootNodeName`, `RootNodeLongName`).\n  - `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`.\n  - `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\".\n  - `variant.go`: `ConfigMode` (model-driven/classic/mixed) with strict UnmarshalYAML, `ConfigFamily` (sr/ixr/sar), `ConfigVariant{Mode,Family,SecureGrpc,ForceClassic}` (ForceClassic for SAR-Hm).\n  - `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).\n  - `sros_test.go`: `TestSrosLinkApplyMode`, `TestCheckPortWithRetry`, mocknodes/mockruntime usage.\n  - `chassis_info_test.go`: TestChassisInfoComponentWarnings (supported config empty; 5 warnings with SFM type/component type/exceeds/MDA type; fixed MDA mismatch case).\n- Candidate findings noted (not yet finalized):\n  - `checkComponentSlotsConfig` doesn't TrimSpace before ToUpper (duplicate \" a\" vs \"A\" undetected) — moved code, pre-existing, likely not a PR finding.\n  - 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.\n  - 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.\n  - `warnUserEnvOverrides` duplicated inline in `Init` for SFM vs helper — minor.\n  - 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.\n  - 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).\n- 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.\n- 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.\n- 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).\n\n## Work State\n### Completed\n- Read standards (`standards.json`, karpathy-guidelines.mdc, ponytail.mdc) and learned read-tool constraints.\n- Read manifest.json (changed-path list captured in prior summary; tail possibly still truncated).\n- 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).\n- 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).\n- Resolved env-override consistency question (`Cfg.Env` vs `userEnv`) and traced PreDeploy flow for integrated/distributed nodes (documented above in Important Details).\n- Collected candidate findings (pre-existing/global map race, TrimSpace in slot dedup, warnUserEnvOverrides duplication) with base-version checks showing most are moved/pre-existing.\n\n### Active\n- Finish reading diff.txt from line ~2548 to EOF (remaining hunks: sros_test.go, schema, docs, README, robot tests, possibly srsim.robot resource).\n- Verify the full 31-path manifest tail (paths beyond `tests/13-srsim/04-sros-classic.robot`).\n- 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.\n- Assemble final review verdict and return trusted result schema, disclosing that tests were not executed.\n\n### Blocked\n- None blocking; only output truncation requiring offset reads and directory-read denial (worked around with explicit paths).\n\n## Next Move\n1. 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.\n2. 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.\n3. Produce the final structured review per trusted result schema with disclosed limitation that tests were not executed.\n\n## Relevant Files\n- `/source/manifest.json`: authoritative list of all 31 changed paths and statuses (tail verification pending).\n- `/source/diff.txt`: full PR diff; read up to line ~2548; remaining tail (sros_test.go, schema, docs, README, tests) pending.\n- `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).\n- `nodes/sros/{chassis_info_test.go,sros_test.go}`: tests read (truncated portions unseen).\n- `schemas/clab.schema.json`: schema consistency check pending.\n- `docs/manual/kinds/sros.md`, `nodes/sros/README.md`: docs consistency check pending.\n- `.github/workflows/srsim-tests.yml`: CI matrix sharding changes (hunk read; verify rest of file hunk in diff).\n- `tests/13-srsim/*.robot` and likely-new `tests/13-srsim/srsim.robot`: test refactor to `Destroy SR-SIM Lab` keyword; diffs pending.\n- `/source/standards.json`, `/source/standards/{karpathy-guidelines.mdc,ponytail.mdc}`: review standards applied.\n- GitHub permalinks (head/base roots above) for citing file versions in the final review.",
          "time": {
            "start": 1792346630806,
            "end": 1792346646752
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
        }
      },
      "parts": [
        {
          "type": "text",
          "id": "prt_1502f68f7001GjzIbGV2HRMvgx",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502f68f300142aYYM85hGexse",
          "text": "Continue if you have next steps, or stop and ask for clarification if you are unsure how to proceed.",
          "synthetic": true,
          "time": {
            "start": 1792346646775,
            "end": 1792346646775
          },
          "metadata": {
            "compaction_continue": true
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502f6d8f001IJ1kTe2SOQjyXj",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502f69070017hU0PHIctAauDc"
        },
        {
          "type": "reasoning",
          "id": "prt_1502f6d92001HAH4STHpP6TJTc",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502f69070017hU0PHIctAauDc",
          "text": "Continue: read diff.txt from offset 2548, and verify manifest.json tail.",
          "time": {
            "start": 1792346647954,
            "end": 1792346648148
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502f7b86001NSyWblT1JHx8lW",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502f6ed20012wjmJePhaOJviv"
        },
        {
          "type": "reasoning",
          "id": "prt_1502f7b88001nkpsEatL9zqMqo",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502f6ed20012wjmJePhaOJviv",
          "text": "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.\n\nAlso 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).\n\nRead diff.txt from 3941 to end.",
          "time": {
            "start": 1792346651528,
            "end": 1792346652559
          }
        },
        {
          "type": "text",
          "id": "prt_1502f7f93001bOtxoVvW0IYz5Z",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502f6ed20012wjmJePhaOJviv",
          "text": "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).",
          "time": {
            "start": 1792346652563,
            "end": 1792346653067
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502f8926001gzpO3GFRZsa5RO",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502f8199001mYbsJMmihu9cms"
        },
        {
          "type": "reasoning",
          "id": "prt_1502f8928001caC0zMbroS0Ae5",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502f8199001mYbsJMmihu9cms",
          "text": "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.\n\nActually, 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.\n\nAlso, 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.\n\nWait, 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.\n\nOne 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.\n\nBut 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.\n\nHmm 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.\n\nNow, 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.\n\nAlso `fixed_mdas` added to $mdas — new field in chassis_info.json.\n\nNow let me verify remaining things:\n\n1. Read `utils/sros_schema_gen.sh` head fully (26 lines) to see full script.\n2. 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.\n\n3. 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.\n\n4. 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.\n\nAlso 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.\n\nNote: 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.\n\nBut 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.\n\nNow key remaining checks:\n\nA. Verify I saw the docs hunk (docs/manual/kinds/sros.md and nodes/sros/README.md). Let me grep diff.txt for \"^diff --git\".\n\nB. Read head `utils/sros_schema_gen.sh` full.\n\nC. 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.\n\nLet me do: grep -n \"diff --git\" diff.txt, and read utils/sros_schema_gen.sh.",
          "time": {
            "start": 1792346655016,
            "end": 1792346679002
          }
        },
        {
          "type": "text",
          "id": "prt_1502fe6dd001j3bZ66YixJtoAV",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502f8199001mYbsJMmihu9cms",
          "text": "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.",
          "time": {
            "start": 1792346679005,
            "end": 1792346679422
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1502ff16e0019PTl6ohMTnfLrr",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502fe89e0018QFygyY8f4Z4qk"
        },
        {
          "type": "reasoning",
          "id": "prt_1502ff171001f0rJtZsz8hdYdY",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502fe89e0018QFygyY8f4Z4qk",
          "text": "All 31 file hunks are present in diff.txt (31 `diff --git` matches = 31 changed paths). The diff is complete, not truncated.\n\nThe 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.",
          "time": {
            "start": 1792346681713,
            "end": 1792346683105
          }
        },
        {
          "type": "text",
          "id": "prt_1502ff6e3001kwqVjWI1UTCj55",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502fe89e0018QFygyY8f4Z4qk",
          "text": "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.",
          "time": {
            "start": 1792346683107,
            "end": 1792346683915
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_150300215001Qee13LZWB1URNx",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502ffa27001cBH8ObbZe31Q5K"
        },
        {
          "type": "reasoning",
          "id": "prt_150300218001f7Bx9lhWiRpXsj",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502ffa27001cBH8ObbZe31Q5K",
          "text": "Good. Docs hunks are now read (lines 84-311 cover both docs hunks). Now I have the complete diff seen: lines 1-3945.\n\nWait — 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:\n- context: CHASSIS_INFO_FILE, SCHEMA, blank\n- changed jq script lines\n- context: `$c | [.[].xiom ...` etc, and `.definitions[\"sros-cpm-types\"]...`, `.definitions[\"sros-card-types\"]...`, `.definitions[\"sros-sfm-types\"]...`\n\nThe 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:\n\nRemoved (-):\n1. `  .[0] as $c | .[1] |`\n2. `  ($c | [.[].mda // [] | .[] | select(. != null)]) as $mdas |`\n\nAdded (+):\n1. `  .[0] as $all |`\n2. `  .[1] |`\n3. `  ([.. | objects | select(.enum? and (.enum | index(\"ixr-e2n\"))) | .enum][0]) as $node_types |`\n4. `  ($all | with_entries(select((.key | ascii_downcase) as $key | $node_types | index($key)))) as $c |`\n5. `  ($c | [.[].mda // [] | .[] | select(. != null)] + [.[].fixed_mdas // {} | .[]]) as $mdas |`\n\nThat'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.\n\nActually the glob output was truncated at 100 results. Let me glob /source/head/utils/*.\n\nAlso, remaining verification tasks:\n1. Check `chassis_info.go` head file completely (I read it before but truncated at line 57). It's 222 lines.\n2. 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.\n\nGiven budget, focus on the most valuable reads: head/sros package files (they exist under /source/head/nodes/sros/ presumably). Let me glob that dir.",
          "time": {
            "start": 1792346685976,
            "end": 1792346695797
          }
        },
        {
          "type": "text",
          "id": "prt_1503028780018vFSxjAPklUsub",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1502ffa27001cBH8ObbZe31Q5K",
          "text": "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.",
          "time": {
            "start": 1792346695800,
            "end": 1792346696485
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_15030344b0019HJ71R5mA7nMEF",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150302b55001SzF0Y5mto636c3"
        },
        {
          "type": "reasoning",
          "id": "prt_15030344d001EL3Co1iuScDf9I",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150302b55001SzF0Y5mto636c3",
          "text": "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.\n\nAlso let me now read the complete head files for the key new/changed sros files to verify correctness claims:\n- `/source/head/utils/sros_schema_gen.sh` (26 lines)\n- `/source/head/nodes/sros/chassis_info.go` (222)\n- `/source/head/nodes/sros/component.go` (309)\n- `/source/head/nodes/sros/component_config.go` (393)",
          "time": {
            "start": 1792346698829,
            "end": 1792346699691
          }
        },
        {
          "type": "text",
          "id": "prt_1503037ad0011zK5Lr6l3tyMmw",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150302b55001SzF0Y5mto636c3",
          "text": "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.",
          "time": {
            "start": 1792346699693,
            "end": 1792346700319
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1503048b000108Td4G19ppV1be",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150303a32001dtsE1QnYTYJ6Bu"
        },
        {
          "type": "reasoning",
          "id": "prt_1503048b1001Mh9ubXZjz0u0N1",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150303a32001dtsE1QnYTYJ6Bu",
          "text": "Now I have complete views of `chassis_info.go` and `component.go`. Observations:\n\n1. `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.\n\nNote: 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.\n\nOne subtle thing: for `entry.Integrated` chassis, MDA validation is applied for slot A and B components too (condition `entry.Integrated || ...`). Good.\n\n2. `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.\n\n3. 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.\n\nNext 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.\n\nLet me read component_config.go fully and grep diff for checkComponentSlotsConfig / componentsBySlot / warnUserEnvOverrides.",
          "time": {
            "start": 1792346704049,
            "end": 1792346710094
          }
        },
        {
          "type": "text",
          "id": "prt_150306051001fBXQmFZmqOj2Ic",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150303a32001dtsE1QnYTYJ6Bu",
          "text": "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).",
          "time": {
            "start": 1792346710097,
            "end": 1792346710649
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_150306c11001QWBZXsytqqu8Ln",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1503062b70016nw0gwV8q9FWy0"
        },
        {
          "type": "reasoning",
          "id": "prt_150306c12001QOStu5qWTASwur",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1503062b70016nw0gwV8q9FWy0",
          "text": "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.\n\nNow, 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.",
          "time": {
            "start": 1792346713106,
            "end": 1792346714445
          }
        },
        {
          "type": "text",
          "id": "prt_1503071500016jJVKabWmEgRhw",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_1503062b70016nw0gwV8q9FWy0",
          "text": "`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.",
          "time": {
            "start": 1792346714448,
            "end": 1792346715121
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_150307d31001iGPCreyGMPVUf7",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15030741c0016laGe170oUCAMo"
        },
        {
          "type": "reasoning",
          "id": "prt_150307d33001LszPFbTEGJPiOT",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15030741c0016laGe170oUCAMo",
          "text": "I've now seen the Init env merge. A few things to verify:\n\n1. 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.\n\n2. 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.\n\n3. `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.\n\n4. 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).\n\nNow 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.",
          "time": {
            "start": 1792346717491,
            "end": 1792346724811
          }
        },
        {
          "type": "text",
          "id": "prt_1503099cd001QANk9sAoBqIIXJ",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15030741c0016laGe170oUCAMo",
          "text": "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.",
          "time": {
            "start": 1792346724813,
            "end": 1792346726649
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_15030aa06001ScCIXmbTMlr1ci",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15030a116001kgq3ssW91tl7Q8"
        },
        {
          "type": "reasoning",
          "id": "prt_15030aa09001KyqaZjVAPDcMUK",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15030a116001kgq3ssW91tl7Q8",
          "text": "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.\n\nNow let me check remaining verification areas:\n\n1. 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.\n\n2. 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.\n\n3. 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.\n\n4. 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.",
          "time": {
            "start": 1792346728969,
            "end": 1792346733952
          }
        },
        {
          "type": "text",
          "id": "prt_15030bd82001xnz4ONOVJAK5lO",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15030a116001kgq3ssW91tl7Q8",
          "text": "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).",
          "time": {
            "start": 1792346733954,
            "end": 1792346734560
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_15030c877001buj1xwngA0keB8",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15030c0020015g2EZ0bcwZEBeP"
        },
        {
          "type": "reasoning",
          "id": "prt_15030c8790019PepNIGYdrSY6S",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15030c0020015g2EZ0bcwZEBeP",
          "text": "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.\n\nAlso 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.\n\nLet me grep diff for changed lines containing \"isCPM\" / \"isStandaloneNode\" / \"isDistributedCardNode\".",
          "time": {
            "start": 1792346736761,
            "end": 1792346739236
          }
        },
        {
          "type": "text",
          "id": "prt_15030d226001q289S6XI1h4kNO",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15030c0020015g2EZ0bcwZEBeP",
          "text": "Let me check which of these node-classification call sites changed in the diff, and view the PreDeploy diff hunk in `sros.go`.",
          "time": {
            "start": 1792346739239,
            "end": 1792346739844
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_15030dcf5001wJL4ur3oqM15Fb",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15030d4a8001tXCn7rfV2C8Nea"
        },
        {
          "type": "reasoning",
          "id": "prt_15030dcf7001kIMB2PWsfWun9I",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15030d4a8001tXCn7rfV2C8Nea",
          "text": "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.).",
          "time": {
            "start": 1792346742007,
            "end": 1792346743504
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_15030ed300012PgDJ7OtzQ9bZs",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15030e2f8001rPQmYU8usSu7Xr"
        },
        {
          "type": "reasoning",
          "id": "prt_15030ed33001NOZe76DSew6BD8",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15030e2f8001rPQmYU8usSu7Xr",
          "text": "I've now re-read the sros.go diff hunks thoroughly. Key moved-out items confirmed. Now the important remaining checks:\n\n1. `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.\n\nBut here's a subtlety: for the standalone integrated node WITHOUT components, `effective = []*Component{n.componentForConfig(nil)}` — Slot is \"\" → normalized to slotAName in componentWarnings. Fine.\n\nHowever — for a distributed base node (CPM A of e.g. sr-7s), `components = n.rootComponents` (non-empty) — fine.\n\nBut 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.\n\nOne 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.\n\nBut 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.\n\n2. `n.componentSFM()` uses hardwareEnv → userEnv; for component nodes userEnv = base userEnv clone. OK.\n\n3. 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.\n\n4. Verify `verifyNokiaSrsimImage` unchanged-ish; skip.\n\n5. The `power.go` diff hunk (1568-1587) — small; previously read.\n\n6. `netns.go` diff (1471-1567) — read earlier; new netns config builds labels etc.\n\n7. Check `componentForConfig(nil)` path: `cloneComponent(nil)` → `&Component{}`; `applyHardwareEnv(out, out.Env)` (out.Env nil → no-op); `applyHardwareEnv(out, n.hardwareEnv())`. Fine.\n\n8. 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.\"\n\nIn `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.\n\nBut 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.\n\nBut 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.\n\n9. `srosVersionFromImage` — version detection moved? createSROSConfigFiles moved to config.go with version detection retained (per prior summary). Fine.\n\n10. One thing to check in config.go: `getTemplateForVariant(v, tplData.SwVersion)` — swVersion unused except comment. `selectConfigTemplate` ignores... it uses tplData.SwVersion. Fine.\n\n11. 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.\n\nBut 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.\n\n12. 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.\n\nBut 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.\n\n13. Check `isCPM`: let me read it (line 1138 head). And find where createSROSFiles is invoked for line cards. Let me grep.",
          "time": {
            "start": 1792346746163,
            "end": 1792346761311
          }
        },
        {
          "type": "text",
          "id": "prt_150312862001B0M0XtgfN22XIL",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15030e2f8001rPQmYU8usSu7Xr",
          "text": "Let me check `isCPM` semantics and where `createSROSFiles` is invoked (to confirm line cards still get config generation).",
          "time": {
            "start": 1792346761314,
            "end": 1792346761968
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
        }
      },
      "parts": [
        {
          "type": "compaction",
          "id": "prt_150312b09001lQ39I686A4Y8V6",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150312b08001ahr6wR8Fh3qA3c",
          "auto": true,
          "overflow": false,
          "tail_start_id": "msg_15030c0020015g2EZ0bcwZEBeP"
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_15031337d001h1d4cEnCpOXV0H",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150312b1f001kOmsjyLVrSK4Er"
        },
        {
          "type": "reasoning",
          "id": "prt_15031337f001hFg5cfV8wugm1r",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150312b1f001kOmsjyLVrSK4Er",
          "text": "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.\n\nUpdated facts:\n- 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).\n- 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/).\n- Full manifest verified: 31 changed paths (listed through sros_schema_gen.sh etc.).\n- New robot tests: tests/13-srsim/14-srsim-new-chassis.robot (new), tests/srsim.robot (new shared resource at tests/ root, not 13-srsim).\n- sros_schema_gen.sh: jq now filters chassis_info entries to node-type enum, adds fixed_mdas to mda enums.\n- isDistributedBaseNode: integrated → isRedundantIntegratedSrosComponents; else len(components) > 1. isDistributedCardNode: envNokiaSrosSlot set and no components.\n- sar-10x with components A/B: not integrated → isDistributedBaseNode true (len>1). Works.\n\nNext 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.\n\nActually 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.\n\nSo 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.\n\nRemaining 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).\n\nWrite the summary now.",
          "time": {
            "start": 1792346764159,
            "end": 1792346771448
          }
        },
        {
          "type": "text",
          "id": "prt_150314ffb00152bjrtA0a11l5X",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150312b1f001kOmsjyLVrSK4Er",
          "text": "## Objective\n- 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.\n\n## Important Details\n- Head: `d44c69f72ab156474197f12b6fc1407b3f8a65c4`; base/mergeBase: `84cf630e6eedd662d9742fbcd6158a91372e3a56`.\n- Permalink roots: head=`https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/`, base=`https://github.com/srl-labs/containerlab/blob/84cf630e6eedd662d9742fbcd6158a91372e3a56/`.\n- 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.\n- Standards applied (from `standards.json`): `.cursor/rules/karpathy-guidelines.mdc` (surgical changes) and `.cursor/rules/ponytail.mdc` (simplest solution, shortest diff).\n- 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.\n- **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.\n- 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`.\n- Key new facts verified this session:\n  - `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`.\n  - `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`.\n  - 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`.\n  - `checkComponentSlotsConfig` was MOVED from base `sros.go` (~1046) to `component.go` — its lack of TrimSpace before ToUpper is pre-existing, not PR-introduced.\n  - 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.\n  - `keepUserEnv(n.Cfg.ShortName, componentConfig.Env, componentDerivedEnv(c), n.userEnv)` called at head `sros.go:668` for component nodes; `warnUserEnvOverrides` at line 328.\n- 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.\n- 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.\n- 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.\n\n## Work State\n### Completed\n- Read standards (`standards.json`, karpathy-guidelines.mdc, ponytail.mdc); learned read-tool constraints and `/source/head/` path convention.\n- 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).\n- 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.\n- Read complete head `/source/head/utils/sros_schema_gen.sh` (26 lines).\n- 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`.\n- Verified routing of redundant integrated components to distributed branch (`isDistributedBaseNode`/`isStandaloneNode`/`isRedundantIntegratedSrosComponents`).\n- Verified env precedence: user env merged last via `MergeStringMaps(srosEnv, vars, n.Cfg.Env)`; component nodes get user env via `keepUserEnv`.\n- Traced PreDeploy/Init flows for integrated vs distributed nodes; CI workflow and robot refactor details captured.\n- Confirmed `checkComponentSlotsConfig` move (pre-existing logic) via diff grep (base `sros.go:1046`).\n\n### Active\n- 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.\n- 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).\n\n### Blocked\n- None blocking; only output truncation requiring offset reads (worked around) and directory-read denial (worked around with explicit paths).\n\n## Next Move\n1. 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.\n2. 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.\n\n## Relevant Files\n- `/source/diff.txt`: full PR diff — now fully read (1–3945); all 31 hunks present.\n- `/source/manifest.json`: authoritative 31-path changed list — verified complete.\n- `/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).\n- `/source/head/utils/sros_schema_gen.sh`: complete (26 lines) — schema enum generation changes verified.\n- `/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.\n- `/source/head/nodes/sros/README.md`, `/source/head/docs/manual/kinds/sros.md`: docs hunks read from diff (lines 84–311); head files available.\n- `.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.\n- `/source/standards.json`, `/source/standards/{karpathy-guidelines.mdc,ponytail.mdc}`: review standards applied.\n- GitHub permalinks (head/base roots in Important Details) for citing file versions in the final review.",
          "time": {
            "start": 1792346771451,
            "end": 1792346786654
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
        }
      },
      "parts": [
        {
          "type": "text",
          "id": "prt_150318b6c001ZsKO4gZs0fPLJp",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150318b6b001z1GyFDwe1Oii29",
          "text": "Continue if you have next steps, or stop and ask for clarification if you are unsure how to proceed.",
          "synthetic": true,
          "time": {
            "start": 1792346786668,
            "end": 1792346786668
          },
          "metadata": {
            "compaction_continue": true
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1503195f4001yT7T8qvkdKiFGG",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150318b78001jXqUxQiJwJejqb"
        },
        {
          "type": "reasoning",
          "id": "prt_1503195f7001j1538Kd6nKxktl",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150318b78001jXqUxQiJwJejqb",
          "text": "Let me check sros.go around line 440 (where createSROSFiles is called) to see which node types run it.",
          "time": {
            "start": 1792346789367,
            "end": 1792346789742
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_150319eff001wZv2Jx4dM3wYba",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150319796001jtXIUQWszDFNSK"
        },
        {
          "type": "reasoning",
          "id": "prt_150319f01001zbuiEoCR7YR4gp",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150319796001jtXIUQWszDFNSK",
          "text": "So `PreDeploy` → `createSROSFiles(ctx)` unconditionally for ALL sros nodes (including line cards). Good — line cards also get config generation.\n\nNow `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.\n\nNote `IsHealthy` (line 1142 in the earlier read was actually different; in this head line numbering IsHealthy at ~1611). Fine.\n\nNow I have all the material I need. Remaining candidate findings to finalize:\n\n1. **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.\n\n2. **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.\n\n3. **`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.\n\n4. **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:\n\n```go\nsrosEnv = map[string]string{\n    envNokiaSrosChassis: strings.ToLower(n.Cfg.NodeType),\n    envNokiaSrosSystemBaseMac: mac,\n}\n```\n\nHmm, 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:\n\n```go\nsrosEnv[envNokiaSrosChassis] = strings.ToLower(n.Cfg.NodeType)\n```\n\nLet 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.\n\nSo 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. \n\nAnd `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.\n\n5. **Potential issue: `n.componentSFM()`** — let me verify it exists in head (used in warnUnsupportedComponents). grep.\n\n6. **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.\n\nLet me do targeted reads to close these loops:\n- grep `componentSFM` in head/nodes/sros.\n- read setupComponentNodes full body (head sros.go ~626-740).\n- check srosEnv chassis assignment (head sros.go ~300-330).",
          "time": {
            "start": 1792346791681,
            "end": 1792346807006
          }
        },
        {
          "type": "text",
          "id": "prt_15031dae20012nb7A1gtndmu5F",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150319796001jtXIUQWszDFNSK",
          "text": "Let me close the remaining verification loops: `componentSFM`, the full `setupComponentNodes` body (how component kind config is derived), and the `srosEnv` chassis assignment.",
          "time": {
            "start": 1792346807010,
            "end": 1792346807756
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_15031e5e3001mpghrvBFGRQMXr",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15031dde7001u0P1KrRAXsPEf7"
        },
        {
          "type": "reasoning",
          "id": "prt_15031e5e5001SMc9OITD0iCCIa",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15031dde7001u0P1KrRAXsPEf7",
          "text": "Key observations from `setupComponentNodes`:\n\n1. `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.\n\n2. `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.\n\n3. 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.\n\nBut 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.\n\nAlso 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).",
          "time": {
            "start": 1792346809829,
            "end": 1792346817190
          }
        },
        {
          "type": "text",
          "id": "prt_1503202a8001JPM0QY1pAITktB",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15031dde7001u0P1KrRAXsPEf7",
          "text": "`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`.",
          "time": {
            "start": 1792346817192,
            "end": 1792346817657
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_150320c1a001T9RpM3inlykS2D",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15032049a001SgeOLZUYf0tHJn"
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_150321839001ACd8eKqHUjPhar",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150320cb9001bDcZrOOMFAhHva"
        },
        {
          "type": "reasoning",
          "id": "prt_15032183b001r6y1XK1krZPZGO",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150320cb9001bDcZrOOMFAhHva",
          "text": "`componentDerivedEnv` includes `c.Env` (per-component env) — good, per-component env semantics preserved. `keepUserEnv` copies derived into dst with user-env priority — good.\n\nNow, `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.\n\nOne 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.\n\nEdge: in `keepUserEnv`, when userSet, it writes envValue into dst even if dst already had it — fine, same value.\n\nNow — 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.\n\nAnother: 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.\n\nNow, 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.\n\nEdge: What about the env key `NOKIA_SROS_MDA_X1` (xiom mda without slot separator)? Handled by Cut failing → continue. Good.\n\nNow — check `applyHardwareEnv` ignores envNokiaSrosSlot (documented). Good.\n\nNow 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.",
          "time": {
            "start": 1792346822715,
            "end": 1792346827498
          }
        },
        {
          "type": "text",
          "id": "prt_150322aed0013wXA5oBnWQuyji",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150320cb9001bDcZrOOMFAhHva",
          "text": "`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.",
          "time": {
            "start": 1792346827501,
            "end": 1792346827901
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_150323567001uZmdqGwpt3cCmJ",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150322c97001uj2W43347p13ml"
        },
        {
          "type": "reasoning",
          "id": "prt_1503235690014Wy6Pi6SEMu1I7",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150322c97001uj2W43347p13ml",
          "text": "Now I have a very complete picture. Let me analyze for findings carefully.\n\n**Analysis of `componentWarnings` (chassis_info.go):**\n\nLine 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.\n\nWait, 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.\n\n**Potential issue 1 — `validateMDAs` and `FixedMDAs` interaction with env-configured MDAs.** Fine.\n\n**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.\n\n**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.\n\n**Package-level `srosEnv` mutation race** — pre-existing (lines 309/312 in base too). Not a finding.\n\n**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.\n\n**Potential issue 5 — alias cycle detection returns \"not present\" warning on cycle:** acceptable best-effort.\n\n**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.\n\nBut 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.\n\nHmm, 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.\n\n**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.\n\n**Now the key new-code issues to weigh:**\n\nA. **`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.\n\nHmm, 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.\n\nBut 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.\n\nHowever — 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.\n\nB. **`componentsForConfig` allocation**: `make([]*Component, len(components))` fine.\n\nC. **`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.\n\nD. **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.\n\nBut 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 \"\".\n\nHmm! 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.\n\nBut what about the docs claim: \"a components `type` sets `NOKIA_SROS_CARD` and makes containerlab skip generated card/MDA config\". Consistent.\n\nE. **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.\n\nHmm 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.\n\nBut 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.\n\nF. **`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.\n\nG. **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.\n\nH. **`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.\n\nBut 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.\n\nActually 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.\n\nIf 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.\n\nLet me also double check the standalone node with components==0: warnUnsupportedComponents → isStandaloneNode true → proceeds → effective = componentForConfig(nil) → validates env-configured hardware. Good.\n\nI. **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.\n\nJ. **`IsHealthy` for component nodes** — moved, fine.\n\nK. **Now check `verifyNokiaSrsimImage` / CheckDeploymentConditions changes** — previously read; skip.\n\nL. **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.\n\nM. **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\nN. **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.\n\nO. **`upsertXiomMDA`** — fine.\n\nP. **Check `sros_test.go` additions** — read earlier. Tests cover classification, warnings, template data, component config gen. Good coverage.\n\nQ. **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.\n\nR. **Robot tests**: new shared resource + shards. Fine.\n\nS. **Now potential P3: `integratedSrosSlotAllowed` uses `standaloneSlotName`** — what is standaloneSlotName? Probably \"\" or \"A\"? If slot == \"\" → standaloneSlotName. Let me check its value. grep.\n\nT. **`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.\n\nHmm 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.\n\nWait — 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.\n\nU. **Now check `componentSFM` vs docs**: \"SFM type from kind config or env\". Fine.\n\nV. **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.\n\nW. **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.\n\nX. **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:\n\n```go\ncomponents := n.rootComponents\nif len(components) == 0 {\n    if len(n.kindSpecificCfg().Components) > 1 || n.rootCtrName != \"\" {\n        return \"\"\n    }\n    lines := buildIntegratedComponentCfgLines(...)\n    ...\n}\nfor _, c := range components { ... }\nlines := buildComponentCfgLines(components, ...)\n```\n\nHmm 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.\n\nHmm, 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.\n\nY. **`IsHealthy` for component nodes** — moved, fine.\n\nZ. **Check `verifyNokiaSrsimImage` / CheckDeploymentConditions changes** — previously read; skip.\n\nNow let me verify the PreDeploy gating and writeChassisInfoToLabDir call sites to close loop H.",
          "time": {
            "start": 1792346830185,
            "end": 1792346885533
          }
        },
        {
          "type": "text",
          "id": "prt_150330da1001mEjnthqzEKwzjX",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150322c97001uj2W43347p13ml",
          "text": "Let me verify the `PreDeploy` gating and `writeChassisInfoToLabDir` call sites, plus `standaloneSlotName` and `calcComponentName` semantics.",
          "time": {
            "start": 1792346885537,
            "end": 1792346885967
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1503316aa001JzblxEfWopiGjw",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150330f71001z0oJV0z6D4QS8S"
        },
        {
          "type": "reasoning",
          "id": "prt_1503316ac001oh6dbzwHVZCujW",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150330f71001z0oJV0z6D4QS8S",
          "text": "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.\n\nHmm 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.\n\nAlso: for the distributed base node (non-integrated), the base itself never writes chassis_info.json — fine, component CPM A does (rootComponents set). Good.\n\nBut wait: for a distributed base (sr-7s with components), CPM A component node — `components := n.rootComponents` non-empty → effective = componentsForConfig(rootComponents) → validates all. Good.\n\nNow `standaloneSlotName = slotAName` — so integratedSrosSlotAllowed(\"\") → A. Fine.\n\nNow let me also double-check `createSROSFiles` body (line 999-1047) to see the full flow and error handling.",
          "time": {
            "start": 1792346887852,
            "end": 1792346890474
          }
        },
        {
          "type": "text",
          "id": "prt_1503320ec001fTh28Rm76NjrOw",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150330f71001z0oJV0z6D4QS8S",
          "text": "`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.",
          "time": {
            "start": 1792346890476,
            "end": 1792346891095
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_150332ba6001x96jbopgHOM5HK",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15033237d001k7RDZL8V6GQ5wz"
        },
        {
          "type": "reasoning",
          "id": "prt_150332ba80012om4Wfs0iHLwWk",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15033237d001k7RDZL8V6GQ5wz",
          "text": "All main flows verified. Now let me consolidate the findings.\n\nRecap of candidate findings and their final assessment:\n\n**1. Mixed-case duplicate component slots bypass the duplicate-slot check (P4, pre-existing, moved verbatim).**\n`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.\n\n**2. Inline SFM warning duplicates `warnUserEnvOverrides` (P4).**\n`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.\n\nActually — 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.\n\n**3. Anything P2/P3?** Let me think harder about actual defects in new code:\n\n- `componentWarnings` line 96: `if sfm != \"\" && len(entry.SFM) > 0 && !slices.Contains(entry.SFM, sfm)` — SFM validated even for CPM-slot components without SFM... fine.\n\n- `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.\n\nHmm — 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.\n\n- **Potential issue: `warnUnsupportedComponents` for standalone node uses `n.componentSFM()`** — includes kindSpecificCfg().SFM fallback; componentWarnings checks entry.SFM list. Good.\n\n- **`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.\n\n- **`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.\n\n- **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.\n\n- **`componentConfigFromLines` with power config**: moved, fine.\n\n- **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.\n\n- **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.\n\n- **`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.\n\n- **`keepUserEnv` when userSet but dst already has same value**: writes same value — fine.\n\n- **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.\n\n- **`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).\n\nHmm 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.\n\n- **What about `NOKIA_SROS_SLOT` in applyHardwareEnv?** Explicitly skipped. Good.\n\nNow, 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.\n\nLet me now check:\n1. calcComponentName (for duplicate slot impact).\n2. CI workflow for 26_10_TESTS.\n3. Schema head enums for new types (ixr-e2sc, ixr-e3, sar-10x) and xiom enum presence.",
          "time": {
            "start": 1792346893224,
            "end": 1792346910206
          }
        },
        {
          "type": "text",
          "id": "prt_150336e02001X3lDBtI2N8POHA",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15033237d001k7RDZL8V6GQ5wz",
          "text": "Let me verify `calcComponentName`, check whether CI sets `26_10_TESTS` for the new test file, and spot-check the head schema enums.",
          "time": {
            "start": 1792346910210,
            "end": 1792346910741
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1503378eb001UxOJAaR615Y2DK",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150337032001LiBerPTQC6INt5"
        },
        {
          "type": "reasoning",
          "id": "prt_1503378ee0017B3H2v7AL7X8gC",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150337032001LiBerPTQC6INt5",
          "text": "Findings on these:\n\n1. `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.\n\n2. 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.\n\n3. calcComponentName at 833 — read it.",
          "time": {
            "start": 1792346913006,
            "end": 1792346915442
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_150338d68001XP10NBtEpLktwf",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150338404001EcysP8FW1mHzTq"
        },
        {
          "type": "reasoning",
          "id": "prt_150338d6a001oEGbuWTRfiQcho",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150338404001EcysP8FW1mHzTq",
          "text": "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.\n\nAlso 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.\n\nNow 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.\n\nNow, is there anything genuinely P2/P3 introduced?\n\nLet me reconsider the Init userEnv snapshot logic for a subtle regression:\n\n```go\nenvAlreadyResolved := n.userEnv != nil\nif !envAlreadyResolved {\n    if n.Cfg.Env == nil {\n        n.userEnv = map[string]string{}\n    } else {\n        n.userEnv = maps.Clone(n.Cfg.Env)\n    }\n}\nif n.Cfg.Env == nil {\n    n.Cfg.Env = map[string]string{}\n}\n```\n\nWait — in the first branch, `n.userEnv = map[string]string{}` when Cfg.Env is nil; then `n.Cfg.Env = map[string]string{}`. Fine.\n\nBut consider: a node whose `Init` is called TWICE? Not typical.\n\nConsider 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.\n\nNow — **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.\n\n**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.\n\n**Now check `config.go` createSROSConfigFiles version detection is retained** — yes, moved.\n\n**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.\n\n**Check `netns.go`** — newNetnsConfig builds the pause container config. Previously inline in sros.go. Moved.\n\n**Check `variant.go`** — ConfigVariant etc. Moved.\n\n**Check `power.go`** — generatePowerConfig moved.\n\n**One more potential issue — `componentWarnings` for line-card slot with `IOMSlots == 0`:** if entry.IOMSlots == 0, slot range check skipped. Fine.\n\n**Now `docs` claim check: \"ixr-r6 accepts A and B\" — integratedSrosAllowedSlots(ixr-r6) = [A, B]. Docs consistent.\n\n**Docs claim: \"two ixr-r6 entries = dual-CPIOM distributed\"** — matches isRedundantIntegratedSrosComponents.\n\n**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.\n\n**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.\n\n**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.\n\n**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.\n\nBut 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.\n\nFrom 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.",
          "time": {
            "start": 1792346918250,
            "end": 1792346933660
          }
        },
        {
          "type": "text",
          "id": "prt_15033c99f001os06sBE97JImhI",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150338404001EcysP8FW1mHzTq",
          "text": "Let me confirm where `setupComponentNodes` is called (to validate the `userEnv` ordering assumption).",
          "time": {
            "start": 1792346933663,
            "end": 1792346934076
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_15033d40c001ClEdEKbPHGg3Af",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15033cb4e001LhD8dpnT5MWc7D"
        },
        {
          "type": "reasoning",
          "id": "prt_15033d40e0010hDA3PK4V8gW5Z",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15033cb4e001LhD8dpnT5MWc7D",
          "text": "`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.\n\nAlso 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.\n\nBut isDistributedBaseNode can be invoked on a base node where Init hasn't uppercased slots? E.g., called from GetShortName before Init? Unlikely. Fine.\n\nOne 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.\n\nNow — check the \"warn on node env overriding NOKIA_SROS_CHASSIS/MAC\"? Not applicable.\n\nNow 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.\n\nIs 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.\n\nAlso the workflow removed the \"Sanitize test-suite name\" step and uses `TEST_SUITE=${{ matrix.shard }}` — fine.\n\nNow, are there any P2/P3 findings I'm confident about? Let me do one final sweep of things I haven't fully verified:\n\n1. `config.go` — full file (createSROSConfigFiles, prepareConfigTemplateData moved). I read it earlier per summary. It matched the removed code. OK.\n\n2. `sros_test.go` new tests — read earlier; they cover classification, warnings, env precedence. Good.\n\n3. `chassis_info_test.go` — read earlier (truncated at 57 but I saw most). It tests entry alias resolution and componentWarnings.\n\n4. Robot refactor: `tests/srsim.robot` shared resource at tests/ root — other suites updated to use it. Fine.\n\n5. README: updated with chassis_info flow and warnings (line 48 seen).\n\n6. 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).\n\n7. **Duplicate warnings for redundant integrated**: CPM A component warns once. Base node (distributed base) doesn't run createSROSFiles. Good.\n\n8. **`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.\n\n9. **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.\n\n10. **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.\n\n11. **Docs statement: \"Node env overrides component type, XIOM, MDA, SFM, and per-component env\"** — matches implementation.\n\n12. **One more edge: `applyHardwareEnv` — `envNokiaSrosMDA+\"_X\"` prefix check happens BEFORE `envNokiaSrosMDA+\"_\"` — correct.\n\n13. **`buildComponentCfgLines` for a CPM component node emits lines for ALL non-CPM root components** — pre-existing.\n\n14. 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.\n\n15. **What about `generatePowerConfig` for integrated nodes?** componentConfigFromLines appends power config — for integrated standalone, lines from defaults + power. Moved logic. Fine.\n\nNow, decide final findings:\n\n- **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.\n- **P4**: SFM inline warning in `Init` duplicates `warnUserEnvOverrides` logic (could pass a one-key derived map).\n- **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.\n\nWait — 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.\n\nHmm, 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.\n\nAlso, 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.\n\nLet me also double-check there's no missing `SaveConfig`/healthcheck change... The diff hunks I read covered everything.\n\nAlso should check: **`components` schema property `type` docs vs schema**: schema has components.type presumably already (base). Not changed.\n\nOne 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.\n\nLet me run these two greps and then finalize.",
          "time": {
            "start": 1792346936334,
            "end": 1792346958531
          }
        },
        {
          "type": "text",
          "id": "prt_150342ac6001h7PG26TWsdoJg6",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_15033cb4e001LhD8dpnT5MWc7D",
          "text": "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.",
          "time": {
            "start": 1792346958534,
            "end": 1792346959201
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_1503436b10011lvf0iISgZOMqb",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150342d7f00147DfnsXHGI9aB7"
        },
        {
          "type": "reasoning",
          "id": "prt_1503436b3001rGTBKKPXTi7Ztm",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150342d7f00147DfnsXHGI9aB7",
          "text": "Confirmed:\n- `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.\n- Schema enums cover the integrated default MDA types.\n\nI have completed the review. Final findings:\n\n1. **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.\n\n2. **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.\n\n3. **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.\n\nAre 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.\n\nThe 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.\n\nThe SFM duplication: P4 maintainability.\n\nNothing P0-P3 found. All new logic verified: classification, env precedence, warnings once per lab, schema enums, docs.\n\nCoverage notes: complete; tests not executed (static review only); runtime behaviors (container naming, netns, image inspection) inferred from code; robot suite gating verified statically.\n\nNow 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/.\n\nLocations:\n- 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.\n- 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:\n\n```\n160: n.GetShortName(),\n161: component.Slot,\n162: )\n163: }\n164: // add to component names map\n165: componentNames[slot] = struct{}{}\n```\n\nLine 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.",
          "time": {
            "start": 1792346961587,
            "end": 1792346970428
          }
        },
        {
          "type": "text",
          "id": "prt_15034593e0014LGoxAKVgMsUAw",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150342d7f00147DfnsXHGI9aB7",
          "text": "One more verification — the moved `checkComponentSlotsConfig` may have actually fixed the insertion bug. Let me read the full function in `component.go`.",
          "time": {
            "start": 1792346970430,
            "end": 1792346970873
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_15034640b0011RhN7i5NvjWyIY",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150345b15001J6y8OyYBckLufC"
        },
        {
          "type": "reasoning",
          "id": "prt_15034640e0011VWt4Kj9hsUptr",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150345b15001J6y8OyYBckLufC",
          "text": "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):\n\n```\n-\t\t// add to component names map\n-\t\tcomponentNames[component.Slot] = struct{}{}\n```\n\nYes, base inserted raw. Head inserts uppercased. So the PR fixed it — good, no finding.\n\nFinal findings:\n1. P4 — CI components shard lists `14-srsim-new-chassis.robot` but nothing sets `26_10_TESTS`, so the new suite always skips in CI.\n2. P4 — SFM inline warning in `Init` duplicates `warnUserEnvOverrides` semantics for a single key.\n\nBoth P4. Nothing P0-P3.\n\nLet 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.",
          "time": {
            "start": 1792346973198,
            "end": 1792346975339
          }
        },
        {
          "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
            }
          }
        },
        {
          "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
            }
          }
        }
      ]
    },
    {
      "info": {
        "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"
      },
      "parts": [
        {
          "type": "step-start",
          "id": "prt_150347a09001mKQJYA2O8ZozDi",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150346c8d001FeqnMLn7ulSYvI"
        },
        {
          "type": "reasoning",
          "id": "prt_150347a0a001hTBgZPesEETFrk",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150346c8d001FeqnMLn7ulSYvI",
          "text": "All verifications complete. Final review with two P4 findings.\n\nFindings:\n\n**P4-1: New `14-srsim-new-chassis.robot` suite is scheduled in CI but can never run there.**\n- Location: head `.github/workflows/srsim-tests.yml` (shard list, `components` shard at lines 51-52).\n- 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.\n- 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.\n- 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.\n\n**P4-2: SFM override warning in `Init` duplicates `warnUserEnvOverrides` for one key.**\n- Location: head `nodes/sros/sros.go` lines 277-297.\n- 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.\n- Impact: Two copies of the same message format/log fields to keep in sync.\n- 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`).\n\nCoverage 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).\n\nNow write the Markdown review and the JSON.",
          "time": {
            "start": 1792346978826,
            "end": 1792346982797
          }
        },
        {
          "type": "text",
          "id": "prt_150348990001iyoa423VgdZ9Lu",
          "sessionID": "ses_eafd27cc1ffeQYNILSKvQRUwlY",
          "messageID": "msg_150346c8d001FeqnMLn7ulSYvI",
          "text": "All verification is complete. Here is the final review.\n\n---\n\n# PR Review: SR-SIM components model refactor, chassis_info validation, new chassis types, CI sharding\n\n**Head:** `d44c69f` · **Base:** `84cf630` · Scope: 31 changed paths (13 files under `nodes/sros/`, schema generator + `clab.schema.json`, docs/README, CI workflow, robot tests).\n\n## Summary\n\nThis 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:\n\n- **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.\n- **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`.\n- **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.\n- **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.\n- **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.\n\nNo P0–P3 defects were found. Two P4 improvements follow.\n\n## Findings\n\n| Priority | Count |\n|----------|-------|\n| P0 | 0 |\n| P1 | 0 |\n| P2 | 0 |\n| P3 | 0 |\n| P4 | 2 |\n\n### P4 — New `14-srsim-new-chassis.robot` suite is scheduled in CI but always skips there\n\n**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)\n\n**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`.\n\n**Trigger:** Every CI run of the `components` shard.\n\n**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.\n\n**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.\n\n### P4 — SFM override warning in `Init` duplicates `warnUserEnvOverrides` for one key\n\n**Location:** [`nodes/sros/sros.go` L277-L297](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/nodes/sros/sros.go#L277-L297)\n\n**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.\n\n**Trigger:** Any node whose kind config sets `SFM` while the user also sets `NOKIA_SROS_SFM` to a different value.\n\n**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.\n\n**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.\n\n## Coverage Notes\n\n- **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.\n- 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.\n- 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.\n- The base `checkComponentSlotsConfig` insertion bug (raw-slot insert vs uppercased check) was fixed as part of the move; no finding was raised for it.\n- 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.\n\n```json\n{\n  \"version\": 1,\n  \"findings\": [\n    {\n      \"priority\": \"P4\",\n      \"title\": \"CI `components` shard schedules `14-srsim-new-chassis.robot`, which always skips because no runner sets `26_10_TESTS`\",\n      \"location\": {\n        \"revision\": \"head\",\n        \"path\": \".github/workflows/srsim-tests.yml\",\n        \"start\": 51,\n        \"end\": 52\n      },\n      \"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`.\",\n      \"trigger\": \"Every CI run of the `components` shard.\",\n      \"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`.\",\n      \"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.\"\n    },\n    {\n      \"priority\": \"P4\",\n      \"title\": \"Inline SFM override warning in `Init` duplicates `warnUserEnvOverrides` for the `NOKIA_SROS_SFM` key\",\n      \"location\": {\n        \"revision\": \"head\",\n        \"path\": \"nodes/sros/sros.go\",\n        \"start\": 277,\n        \"end\": 297\n      },\n      \"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.\",\n      \"trigger\": \"Any node whose kind config sets `SFM` while the user also sets the `NOKIA_SROS_SFM` environment variable to a different value.\",\n      \"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.\",\n      \"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.\"\n    }\n  ],\n  \"coverage\": {\n    \"complete\": true,\n    \"notes\": [\n      \"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).\",\n      \"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.\",\n      \"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.\",\n      \"The base checkComponentSlotsConfig insertion bug (raw-slot insert vs uppercased check) was fixed as part of the move; no finding was raised for it.\",\n      \"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.\"\n    ]\n  }\n}\n```",
          "time": {
            "start": 1792346982800,
            "end": 1792346999499
          }
        },
        {
          "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
            }
          }
        }
      ]
    }
  ],
  "report": "# ToFaRev review\n\nReview complete within the supplied scope.\n\nSource inspection only; PR code, tests, and benchmarks were not executed.\n\n| Finding | Location |\n| --- | --- |\n| **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) |\n| **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) |\n\n## 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`\n\n**Location:** [.github/workflows/srsim-tests.yml:51-52](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/.github/workflows/srsim-tests.yml#L51-L52)\n\n**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&#58; [`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).\n\n**Trigger:** Every CI run of the `components` shard.\n\n**Impact:** The new-chassis code paths &#40;`ixr-e2sc`, `ixr-e3`, `sar-10x` classification, integrated/distributed routing, component warnings&#41; 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`.\n\n**Suggested correction:** Either add a workflow input &#40;or a dedicated shard&#41; 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.\n\n\n## P4 - Inline `SFM` override warning in `Init` duplicates `warnUserEnvOverrides` for the `NOKIA_SROS_SFM` key\n\n**Location:** [nodes/sros/sros.go:277-297](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/nodes/sros/sros.go#L277-L297)\n\n**Problem:** The inline block in `Init` reproduces exactly the semantics of `warnUserEnvOverrides` &#40;[`component.go:184-202`](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/nodes/sros/component.go#L184-L202)&#41; — warn when the user env value exists and differs — for the single `NOKIA_SROS_SFM` key, including the identical message format and log fields.\n\n**Trigger:** Any node whose kind config sets `SFM` while the user also sets the `NOKIA_SROS_SFM` environment variable to a different value.\n\n**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.\n\n**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 &#40;the helper already computes `userSet`&#41;. This is a small local simplification, not a structural change.\n\n\n## Coverage\n\n- 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 &#40;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)&#41;.\n- Verified&#58; classification routing &#40;standalone/integrated/redundant/distributed&#41;, `userEnv` snapshot ordering relative to `setupComponentNodes` &#40;called from `Init` at [`sros.go`](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/nodes/sros/sros.go#L1-L1)&#58;343, after the snapshot&#41;, 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.\n- Runtime-dependent behaviors &#40;container creation, netns join, image inspection returning `chassis_info.json`, gnmic queries against distributed-base container names&#41; are inferred from code and robot test expectations, not verified in a live environment.\n- The base `checkComponentSlotsConfig` insertion bug &#40;raw-slot insert vs uppercased check&#41; was fixed as part of the move; no finding was raised for it.\n- The package-level `srosEnv` map mutation &#40;[`sros.go`](https://github.com/srl-labs/containerlab/blob/d44c69f72ab156474197f12b6fc1407b3f8a65c4/nodes/sros/sros.go#L1-L1)&#58;309,312&#41; and SFM-per-line-card config emission are pre-existing patterns carried over unchanged and were not flagged.\n\n---\nPowered 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>\n\n```json\n{\n  \"version\": 1,\n  \"findings\": [\n    {\n      \"priority\": \"P4\",\n      \"title\": \"CI `components` shard schedules `14-srsim-new-chassis.robot`, which always skips because no runner sets `26_10_TESTS`\",\n      \"location\": {\n        \"revision\": \"head\",\n        \"path\": \".github/workflows/srsim-tests.yml\",\n        \"start\": 51,\n        \"end\": 52\n      },\n      \"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`.\",\n      \"trigger\": \"Every CI run of the `components` shard.\",\n      \"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`.\",\n      \"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.\"\n    },\n    {\n      \"priority\": \"P4\",\n      \"title\": \"Inline `SFM` override warning in `Init` duplicates `warnUserEnvOverrides` for the `NOKIA_SROS_SFM` key\",\n      \"location\": {\n        \"revision\": \"head\",\n        \"path\": \"nodes/sros/sros.go\",\n        \"start\": 277,\n        \"end\": 297\n      },\n      \"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.\",\n      \"trigger\": \"Any node whose kind config sets `SFM` while the user also sets the `NOKIA_SROS_SFM` environment variable to a different value.\",\n      \"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.\",\n      \"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.\"\n    }\n  ],\n  \"coverage\": {\n    \"complete\": true,\n    \"notes\": [\n      \"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`).\",\n      \"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.\",\n      \"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.\",\n      \"The base `checkComponentSlotsConfig` insertion bug (raw-slot insert vs uppercased check) was fixed as part of the move; no finding was raised for it.\",\n      \"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.\"\n    ]\n  }\n}\n```"
}
