Skip to content

Support multiple line cards on modular SR Linux chassis - #50

Open
bstoll wants to merge 2 commits into
srl-labs:mainfrom
bstoll:multi-linecard
Open

bstoll wants to merge 2 commits into
srl-labs:mainfrom
bstoll:multi-linecard

Conversation

@bstoll

@bstoll bstoll commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Modular SR Linux chassis are always emulated with a single line card, because every variant template in srlinux-variants defines slot 1 only. This adds an optional spec.components field to the Srlinux CRD, so KNE (or any client) can ask for a chassis with several line cards:

apiVersion: kne.srlinux.dev/v1
kind: Srlinux
metadata:
  name: r1
spec:
  model: ixr10e
  components:
    - slot: 1                    # no type: copies the model template's line card
    - slot: 2
      type: imm60-100g-qsfp28    # explicit IMM type

When components is set, the controller renders a per-node <name>-topology ConfigMap from the model's entry in srlinux-variants, replaces its slot_configuration with one entry per component, and mounts that ConfigMap instead of the shared variant key. Without components, the pod spec and topology are unchanged.

  • A component without type copies the template's lowest-slot line card.
  • A component with type takes its card and MDA IDs from a small IMM catalog (controllers/imm.go). The IDs come from the containerlab SR Linux topology templates. The first typed component sets the chassis cpm_card_type.
  • The ConfigMap is owned by the Srlinux CR, so it is deleted together with it.

Validation is done in the CRD schema rather than in controller code, so bad specs are rejected when they are created:

  • components[].type is an enum matching the catalog. A unit test fails if the enum and the catalog drift apart.
  • components is a list-map keyed by slot (no duplicate slots), and slot >= 1.
  • A CEL rule only allows components on the modular models and checks each slot against the chassis: slots 1-4 on ixr6 and ixr6e, 1-8 on ixr10 and ixr10e. Models outside the rule's map, and nodes without a model, reject any component. SR Linux fails to start with a slot outside the chassis or with extra slots on a fixed form factor model.
  • components has maxItems: 128. The CEL rule iterates over components, and without a bound its estimated cost exceeds the API server's budget.

Docs: docs/line-cards.md, linked from the README.

A companion change to openconfig/kne will set spec.components, either from explicit vendor data or from slots referenced by interface names (eX-Y -> slot X).

Testing

Unit tests (controllers/topology_test.go):

  • Rendering with derived, explicit and mixed line cards, out-of-order template slots, and CPM selection.
  • Error handling for malformed templates.
  • Rendering every embedded variant.
  • Reconcile wiring: the volume points at the per-node ConfigMap, the owner reference is set, a stale ConfigMap is updated, and nodes without components still use the shared variants key.
  • Rendering when the just-created srlinux-variants ConfigMap is not yet visible through the client cache.
  • The CRD enum matches the catalog.

envtest (tests/integration/components_test.go): a real API server rejects duplicate slots, slot 0, unknown types, slots outside the chassis (ixr6e slot 5, ixr10 slot 9), components on a fixed model, and components without a model; valid specs, including the last slot (ixr6 slot 4, ixr10e slot 8), are accepted.

Boot matrix: a licensed SR Linux image was started with hand-written topology files.

  • Every catalog card comes up on the ixr6e/ixr10e chassis types (reported as 7250 IXR-6e-gen2cp / 7250 IXR-10e-gen2cp). Mixed card generations and mixed CPMs also come up.
  • The last slot of each modular chassis comes up (ixr6/ixr6e slot 4, ixr10/ixr10e slot 8). One slot past it (5 / 9) makes SR Linux abort at startup with SRL_INVALID_SLOT_NUM for hw_slot N and the pod crash loops. An extra slot on fixed models (ixrd3, ixrd2l) also crashes SR Linux. The CEL rule rejects all of these at create time.
  • ixr10 comes up with two untyped line cards.

End-to-end with KNE on kind, using the controller image built from this branch and a licensed SR Linux image:

Node Spec show platform linecard Linked ports after admin-state enable
r1 ixr10e [{slot: 1}, {slot: 2}] (derived from e1-x/e2-x interfaces) 1: imm36-400g-qsfpdd up, 2: imm36-400g-qsfpdd up e1-1, e2-1, e2-3 up 400G
r2 ixr10e imm36-400g-qsfpdd in slot 1, imm60-100g-qsfp28 in slot 2 1: imm36-400g-qsfpdd up, 2: imm60-100g-qsfp28 up e1-1 up 400G; e2-1, e2-2 up 100G
r3 ixr6e imm3-36-800g-qsfpdd in slot 1, imm2-36-400g-sync-qsfpdd in slot 3 1: imm3-36-800g-qsfpdd up, 3: imm2-36-400g-sync-qsfpdd up e1-1 up 800G; e3-1 up 400G

Rendered ConfigMap for r2:

# ixr10e
chassis_configuration:
  "chassis_type": 4
  "base_mac": 02:__RANDMAC__:00:00:00
  "cpm_card_type": 184
slot_configuration:
  1:
    "card_type": 182
    "mda_type": 199
  2:
    "card_type": 183
    "mda_type": 219

Other checks on the same cluster:

  • No regression: nodes without components (ixrd2l, and ixr10e with only e1-x interfaces) still mount srlinux-variants with key = model, no -topology ConfigMap is created, and they become ready.
  • Garbage collection: deleting a Srlinux CR deletes its -topology ConfigMap.
  • Slot limits through KNE: nodes using the last slot (ixr6 slots 1 and 4, ixr6e slot 4, ixr10 slot 8, ixr10e slots 1 and 8) become ready with no restarts.
  • Rejection through KNE: a fixed ixrd3 node with components in vendor data, ixr10e with slot 9 and ixr6e with slot 5 fail at create time:
    Srlinux.kne.srlinux.dev "r1" is invalid: spec: Invalid value: components are only supported on models ixr6 and ixr6e (slots 1-4) and ixr10 and ixr10e (slots 1-8)
    
  • Rejection with raw CRs (kubectl apply --dry-run=server):
    spec.components[1]: Duplicate value: {"slot":1}
    spec.components[0].slot: Invalid value: 0: spec.components[0].slot in body should be greater than or equal to 1
    spec.components[0].type: Unsupported value: "imm99-bogus": supported values: "imm2-36-400g-sync-qsfpdd", ...
    

Modular SR Linux chassis are always emulated with a single line card because
every variant template defines slot 1 only.

Add an optional spec.components list of {slot, type}. When set, the
controller renders a per-node <name>-topology config map from the model's
srlinux-variants template with slot_configuration replaced by the
components, and mounts it instead of the shared variant key. Without
components the pod spec and template are unchanged.

- A component without a type copies the template's lowest-slot line card.
- A typed component uses the IMM catalog (controllers/imm.go), with card,
  MDA and CPM type IDs from containerlab's SR Linux topology templates. The
  first typed component sets the chassis CPM card type.

Validation is done by the CRD schema:
- components[].type is an enum matching the catalog; a unit test fails if
  they drift apart.
- components is a list map keyed by slot, rejecting duplicate slots, and
  slot must be >= 1.
- A CEL rule only allows components on the modular models ixr6, ixr10,
  ixr6e and ixr10e. Fixed form factor models fail to boot with extra slots.
A component in a slot the chassis does not have makes SR Linux abort at
startup (SRL_INVALID_SLOT_NUM for hw_slot N), so the pod crash loops
instead of the create failing.

Replace the CEL rule that limits components to the modular models with
one that also checks each slot against the model's number of line card
slots: 4 on ixr6 and ixr6e, 8 on ixr10 and ixr10e. Models outside the map,
and nodes without a model, still reject any component.

The rule iterates over components, so components gets maxItems: 128 to
keep the rule's estimated cost within the API server budget.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant