Repository navigation
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Modular SR Linux chassis are always emulated with a single line card, because every variant template in
srlinux-variantsdefines slot 1 only. This adds an optionalspec.componentsfield to theSrlinuxCRD, so KNE (or any client) can ask for a chassis with several line cards:When
componentsis set, the controller renders a per-node<name>-topologyConfigMap from the model's entry insrlinux-variants, replaces itsslot_configurationwith one entry per component, and mounts that ConfigMap instead of the shared variant key. Withoutcomponents, the pod spec and topology are unchanged.typecopies the template's lowest-slot line card.typetakes 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 chassiscpm_card_type.SrlinuxCR, 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[].typeis an enum matching the catalog. A unit test fails if the enum and the catalog drift apart.componentsis a list-map keyed byslot(no duplicate slots), andslot >= 1.componentson the modular models and checks each slot against the chassis: slots 1-4 onixr6andixr6e, 1-8 onixr10andixr10e. 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.componentshasmaxItems: 128. The CEL rule iterates overcomponents, 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):srlinux-variantsConfigMap is not yet visible through the client cache.envtest (
tests/integration/components_test.go): a real API server rejects duplicate slots, slot 0, unknown types, slots outside the chassis (ixr6eslot 5,ixr10slot 9), components on a fixed model, and components without a model; valid specs, including the last slot (ixr6slot 4,ixr10eslot 8), are accepted.Boot matrix: a licensed SR Linux image was started with hand-written topology files.
ixr6e/ixr10echassis types (reported as7250 IXR-6e-gen2cp/7250 IXR-10e-gen2cp). Mixed card generations and mixed CPMs also come up.ixr6/ixr6eslot 4,ixr10/ixr10eslot 8). One slot past it (5 / 9) makes SR Linux abort at startup withSRL_INVALID_SLOT_NUM for hw_slot Nand 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.ixr10comes 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:
show platform linecardadmin-state enableixr10e[{slot: 1}, {slot: 2}](derived frome1-x/e2-xinterfaces)imm36-400g-qsfpddup, 2:imm36-400g-qsfpddupixr10eimm36-400g-qsfpddin slot 1,imm60-100g-qsfp28in slot 2imm36-400g-qsfpddup, 2:imm60-100g-qsfp28upixr6eimm3-36-800g-qsfpddin slot 1,imm2-36-400g-sync-qsfpddin slot 3imm3-36-800g-qsfpddup, 3:imm2-36-400g-sync-qsfpddupRendered ConfigMap for r2:
Other checks on the same cluster:
ixrd2l, andixr10ewith onlye1-xinterfaces) still mountsrlinux-variantswith key = model, no-topologyConfigMap is created, and they become ready.SrlinuxCR deletes its-topologyConfigMap.ixr6slots 1 and 4,ixr6eslot 4,ixr10slot 8,ixr10eslots 1 and 8) become ready with no restarts.ixrd3node with components in vendor data,ixr10ewith slot 9 andixr6ewith slot 5 fail at create time:kubectl apply --dry-run=server):