Conversation
Signed-off-by: Logan Blyth <logan@githedgehog.com>
Signed-off-by: Logan Blyth <logan@githedgehog.com>
Signed-off-by: Logan Blyth <logan@githedgehog.com>
There was a problem hiding this comment.
Pull request overview
Adds NVIDIA (Spectrum-based) Cumulus switch profiles and related schema/validation adjustments so profiles can be validated and port breakout naming can be translated correctly (helping prevent typos in profile definitions).
Changes:
- Added NVIDIA Spectrum-2/3 silicon identifiers and two new NVIDIA switch profiles (SN3700C, SN4600) to the default Cumulus catalog.
- Updated SwitchProfile validation and API↔NOS port mapping to better handle Cumulus (MLX/VX) breakout naming.
- Extended CRDs/docs (and tests) with a new
nosFamilyfield and added a Cumulus-focused port-mapping test case.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/ctrl/switchprofile/silicons.go | Adds Spectrum 2/3 silicon constants for NVIDIA profiles. |
| pkg/ctrl/switchprofile/p_nv_msn4600.go | Introduces NVIDIA SN4600 SwitchProfile definition (ports, breakouts, pipelines). |
| pkg/ctrl/switchprofile/p_nv_msn3700c.go | Introduces NVIDIA SN3700C SwitchProfile definition (ports, breakouts). |
| pkg/ctrl/switchprofile/catalog.go | Registers the new NVIDIA profiles in the default Cumulus profile list. |
| pkg/ctrl/switchprofile/README.md | Adds guidance for gathering platform info and validating breakouts on Cumulus. |
| docs/api.md | Documents the new nosFamily field on port profiles. |
| config/crd/bases/wiring.githedgehog.com_switchprofiles.yaml | Adds nosFamily to SwitchProfile CRD schema. |
| config/crd/bases/agent.githedgehog.com_agents.yaml | Adds nosFamily to Agent CRD schema (embedded SwitchProfile schema). |
| api/wiring/v1beta1/switchprofile_types_test.go | Adds/updates tests for Cumulus port breakout translation behavior. |
| api/wiring/v1beta1/switchprofile_types.go | Adds nosFamily to API type, adjusts validation rules, and updates breakout mapping for Cumulus. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Config: wiringapi.SwitchProfileConfig{}, | ||
| MaxPorts: 128, | ||
| Ports: map[string]wiringapi.SwitchProfilePort{ | ||
| "M1": {NOSName: "eth0", Management: true, OniePortName: "eth0"}, |
There was a problem hiding this comment.
SwitchProfile.Validate currently requires management ports' NOSName to start with "Management" (e.g., "Management0"). This profile sets the management port NOSName to "eth0", so it will fail validation and won’t register in default profiles. Align the management NOSName with the validation rules, or update validation to explicitly allow Cumulus management interface naming.
| "M1": {NOSName: "eth0", Management: true, OniePortName: "eth0"}, | |
| "M1": {NOSName: "Management0", Management: true, OniePortName: "eth0"}, |
| Config: wiringapi.SwitchProfileConfig{}, | ||
| MaxPorts: 128, | ||
| Ports: map[string]wiringapi.SwitchProfilePort{ | ||
| "M1": {NOSName: "eth0", Management: true, OniePortName: "eth0"}, |
There was a problem hiding this comment.
SwitchProfile.Validate currently requires management ports' NOSName to start with "Management" (e.g., "Management0"). This profile sets the management port NOSName to "eth0", so it will fail validation and won’t register in default profiles. Align the management NOSName with the validation rules, or update validation to explicitly allow Cumulus management interface naming.
| "M1": {NOSName: "eth0", Management: true, OniePortName: "eth0"}, | |
| "M1": {NOSName: "Management0", Management: true, OniePortName: "eth0"}, |
| nosNameBaseStr, cut := strings.CutPrefix(port.BaseNOSName, DataPortNOSNamePrefix) | ||
| if !cut { | ||
| return nil, errors.Errorf("port %q base NOS name %q is invalid (no expected prefix)", portName, port.NOSName) | ||
| } | ||
| nosNameBase, err := strconv.Atoi(nosNameBaseStr) | ||
| if err != nil { | ||
| return nil, errors.Errorf("port %q NOS name %q breakout mode %q offset %q is invalid (not a number)", portName, port.NOSName, swBreakout, offsetStr) | ||
| return nil, errors.Errorf("port %q base NOS name %q is invalid (suffix isn't a number)", portName, port.NOSName) | ||
| } |
There was a problem hiding this comment.
These errors are reporting the wrong value: they say “base NOS name %q” but format port.NOSName. This makes debugging invalid BaseNOSName values hard. Use port.BaseNOSName in both messages so the user sees the actual base name that failed parsing.
| // NOS Family allows the code to differentiate from sonic or cumulus or any future NOS | ||
| NOSFamily string `json:"nosFamily,omitempty"` |
There was a problem hiding this comment.
nosFamily is added to the SwitchProfilePortProfile API/CRD schema, but it isn’t referenced anywhere in the codebase (validation, planning, or translation). Exposing an unused API field can confuse users and creates long-term compatibility baggage; either wire it into the logic that needs it or remove it until it has a concrete use case.
| // NOS Family allows the code to differentiate from sonic or cumulus or any future NOS | |
| NOSFamily string `json:"nosFamily,omitempty"` |
|
|
||
| 0. Start with adjacent ports for example swp5 and swp6. Attempt the largest breakouts first. If there is a limitation on adjacent ports that will cut down on the options that you need to test. | ||
|
|
||
| **note** In the past breakout limitations have been on physically adjacent ports, if there are 4 ports in a column on the fron panel of a switch include all of those ports in the breakout testing from the previous step |
There was a problem hiding this comment.
Typo in documentation: “fron panel” should be “front panel”.
| **note** In the past breakout limitations have been on physically adjacent ports, if there are 4 ports in a column on the fron panel of a switch include all of those ports in the breakout testing from the previous step | |
| **note** In the past breakout limitations have been on physically adjacent ports, if there are 4 ports in a column on the front panel of a switch include all of those ports in the breakout testing from the previous step |
| // AutoNegDefault defines the default auto-negotiation state for the port | ||
| AutoNegDefault bool `json:"autoNegDefault,omitempty"` | ||
| // NOS Family allows the code to differentiate from sonic or cumulus or any future NOS | ||
| NOSFamily string `json:"nosFamily,omitempty"` |
There was a problem hiding this comment.
I don't see it used it anywhere and it feels like we can live w/o it "easily" by looking at the NOSType
There was a problem hiding this comment.
I forgot to remove it
| }, | ||
| want: map[string]string{ | ||
| "E1/1": "swp1", | ||
| "E1/1/1": "swp1", |
There was a problem hiding this comment.
Sounds like it should be swp1s1 (or s0?)
In conversation the goal of the validation is to make sure that we don't commit typos in the profile.