diff --git a/docs/profiles.md b/docs/profiles.md index 7724f6bd..cca52c48 100644 --- a/docs/profiles.md +++ b/docs/profiles.md @@ -107,6 +107,59 @@ Label column is a port label on a physical switch. | E1/33 | 33 | Direct | | 10G | 1G, 10G | +## Celestica DS4101 + +Profile Name (to use in switch.spec.profile): **celestica-ds4101** + +**Supported features:** + +- Subinterfaces: false +- VXLAN: false +- ACLs: true + +**Available Ports:** + +Label column is a port label on a physical switch. + +| Port | Label | Type | Group | Default | Supported | +|------|-------|------|-------|---------|-----------| +| M1 | | Management | | | | +| E1/1 | 1 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/2 | 2 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/3 | 3 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/4 | 4 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/5 | 5 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/6 | 6 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/7 | 7 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/8 | 8 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/9 | 9 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/10 | 10 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/11 | 11 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/12 | 12 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/13 | 13 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/14 | 14 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/15 | 15 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/16 | 16 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/17 | 17 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/18 | 18 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/19 | 19 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/20 | 20 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/21 | 21 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/22 | 22 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/23 | 23 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/24 | 24 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/25 | 25 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/26 | 26 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/27 | 27 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/28 | 28 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/29 | 29 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/30 | 30 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/31 | 31 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/32 | 32 | Breakout | | 2x400G | 1x100G, 1x200G, 1x400G, 2x100G, 2x200G, 2x400G, 2x40G, 4x100G, 4x200G, 4x50G, 8x100G, 8x10G, 8x25G, 8x50G | +| E1/33 | M1 | Direct | | 10G | 1G, 10G | +| E1/34 | M2 | Direct | | 10G | 1G, 10G | + + ## Dell S5232F-ON Profile Name (to use in switch.spec.profile): **dell-s5232f-on** diff --git a/pkg/boot/nosinstall/build.go b/pkg/boot/nosinstall/build.go index f9d48e62..d5886ca1 100644 --- a/pkg/boot/nosinstall/build.go +++ b/pkg/boot/nosinstall/build.go @@ -31,6 +31,7 @@ const ( AgentConfigName = "agent-config.yaml" AgentKubeConfigName = "agent-kubeconfig" AgentUnitName = "hedgehog-agent.service" + CopyUnitName = "cel-To-cls.service" AgentUnitContent = ` [Unit] Description=Hedgehog Fabric Agent @@ -42,6 +43,21 @@ ExecStart=/opt/hedgehog/bin/agent start Restart=always RestartSec=5 +[Install] +WantedBy=multi-user.target +` + CopyUnitContent = ` +[Unit] +Description=CLS to CEL workaround +After=local-fs.target + +[Service] +Type=oneshot +User=root +ConditionPathExists=!/usr/share/sonic/device/x86_64-cls_ds4101-r0 +ExecStart=/usr/bin/cp -R /usr/share/sonic/device/x86_64-cel_ds4101-r0/. /usr/share/sonic/device/x86_64-cls_ds4101-r0/ +RemainAfterExit=yes + [Install] WantedBy=multi-user.target ` @@ -81,6 +97,9 @@ func (b *Builder) Build(w io.Writer) error { if err := addFileFromData(tw, AgentUnitName, []byte(AgentUnitContent)); err != nil { return fmt.Errorf("adding agent systemd unit: %w", err) } + if err := addFileFromData(tw, CopyUnitName, []byte(CopyUnitContent)); err != nil { + return fmt.Errorf("adding copy systemd unit: %w", err) + } if err := tw.Close(); err != nil { return fmt.Errorf("closing tar writer: %w", err) diff --git a/pkg/boot/nosinstall/run.go b/pkg/boot/nosinstall/run.go index ee9623bd..8ca499d6 100644 --- a/pkg/boot/nosinstall/run.go +++ b/pkg/boot/nosinstall/run.go @@ -186,7 +186,7 @@ func Run(ctx context.Context, env Env, dryRun bool) (funcErr error) { //nolint:n return fmt.Errorf("running NOS installer: %w", err) } - if err := installAgent(ctx, tmp); err != nil { + if err := installAgent(ctx, tmp, env.Platform); err != nil { return fmt.Errorf("installing agent: %w", err) } @@ -379,7 +379,7 @@ func mountSONiCPartition(origCtx context.Context) (string, func(), error) { }, nil } -func installAgent(ctx context.Context, tmp string) error { +func installAgent(ctx context.Context, tmp string, platform string) error { sonicRoot, unmountSONiC, err := mountSONiCPartition(ctx) if err != nil { return fmt.Errorf("mounting SONiC partition: %w", err) @@ -442,6 +442,22 @@ func installAgent(ctx context.Context, tmp string) error { return fmt.Errorf("symlinking agent systemd unit: %w", err) } + if platform == "x86_64-cls_ds4101-r0" { + slog.Info("Installing WorkAroud systemd unit") + systemdPath := filepath.Join(sonicRoot, "/etc/systemd/system") + if err := installFile(tmp, systemdPath, CopyUnitName, 0o644); err != nil { + return fmt.Errorf("installing agent systemd unit: %w", err) + } + + wantsPath := filepath.Join(sonicRoot, "/etc/systemd/system/multi-user.target.wants") + if err := os.MkdirAll(wantsPath, 0o755); err != nil { + return fmt.Errorf("creating systemd wants dir: %w", err) + } + if err := os.Symlink(filepath.Join(systemdPath, CopyUnitName), filepath.Join(wantsPath, CopyUnitName)); err != nil { + return fmt.Errorf("symlinking agent systemd unit: %w", err) + } + } + return nil } diff --git a/pkg/ctrl/switchprofile/catalog.go b/pkg/ctrl/switchprofile/catalog.go index 2c2e65c3..b193eb7a 100644 --- a/pkg/ctrl/switchprofile/catalog.go +++ b/pkg/ctrl/switchprofile/catalog.go @@ -34,6 +34,7 @@ var defaultSwitchProfiles = []wiringapi.SwitchProfile{ DellZ9332FON, CelesticaDS3000, CelesticaDS4000, + CelesticaDS4101, EdgecoreDCS203, EdgecoreDCS204, EdgecoreDCS501, diff --git a/pkg/ctrl/switchprofile/profile_celestica_ds4101.go b/pkg/ctrl/switchprofile/profile_celestica_ds4101.go new file mode 100644 index 00000000..4dc8ad3c --- /dev/null +++ b/pkg/ctrl/switchprofile/profile_celestica_ds4101.go @@ -0,0 +1,104 @@ +// Copyright 2023 Hedgehog +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package switchprofile + +import ( + "go.githedgehog.com/fabric/api/meta" + wiringapi "go.githedgehog.com/fabric/api/wiring/v1beta1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +var CelesticaDS4101 = wiringapi.SwitchProfile{ + ObjectMeta: metav1.ObjectMeta{ + Name: "celestica-ds4101", + }, + Spec: wiringapi.SwitchProfileSpec{ + DisplayName: "Celestica DS4101", + Features: wiringapi.SwitchProfileFeatures{ + Subinterfaces: false, + VXLAN: false, + ACLs: true, + }, + NOSType: meta.NOSTypeSONiCBCMBase, + Platform: "x86_64-cel_ds4101-r0", + Config: wiringapi.SwitchProfileConfig{}, + Ports: map[string]wiringapi.SwitchProfilePort{ + "M1": {NOSName: "Management0", Management: true, OniePortName: "eth0"}, + "E1/1": {NOSName: "1/1", BaseNOSName: "Ethernet0", Label: "1", Profile: "OSFP-2x400G"}, + "E1/2": {NOSName: "1/2", BaseNOSName: "Ethernet8", Label: "2", Profile: "OSFP-2x400G"}, + "E1/3": {NOSName: "1/3", BaseNOSName: "Ethernet16", Label: "3", Profile: "OSFP-2x400G"}, + "E1/4": {NOSName: "1/4", BaseNOSName: "Ethernet24", Label: "4", Profile: "OSFP-2x400G"}, + "E1/5": {NOSName: "1/5", BaseNOSName: "Ethernet32", Label: "5", Profile: "OSFP-2x400G"}, + "E1/6": {NOSName: "1/6", BaseNOSName: "Ethernet40", Label: "6", Profile: "OSFP-2x400G"}, + "E1/7": {NOSName: "1/7", BaseNOSName: "Ethernet48", Label: "7", Profile: "OSFP-2x400G"}, + "E1/8": {NOSName: "1/8", BaseNOSName: "Ethernet56", Label: "8", Profile: "OSFP-2x400G"}, + "E1/9": {NOSName: "1/9", BaseNOSName: "Ethernet64", Label: "9", Profile: "OSFP-2x400G"}, + "E1/10": {NOSName: "1/10", BaseNOSName: "Ethernet72", Label: "10", Profile: "OSFP-2x400G"}, + "E1/11": {NOSName: "1/11", BaseNOSName: "Ethernet80", Label: "11", Profile: "OSFP-2x400G"}, + "E1/12": {NOSName: "1/12", BaseNOSName: "Ethernet88", Label: "12", Profile: "OSFP-2x400G"}, + "E1/13": {NOSName: "1/13", BaseNOSName: "Ethernet96", Label: "13", Profile: "OSFP-2x400G"}, + "E1/14": {NOSName: "1/14", BaseNOSName: "Ethernet104", Label: "14", Profile: "OSFP-2x400G"}, + "E1/15": {NOSName: "1/15", BaseNOSName: "Ethernet112", Label: "15", Profile: "OSFP-2x400G"}, + "E1/16": {NOSName: "1/16", BaseNOSName: "Ethernet120", Label: "16", Profile: "OSFP-2x400G"}, + "E1/17": {NOSName: "1/17", BaseNOSName: "Ethernet128", Label: "17", Profile: "OSFP-2x400G"}, + "E1/18": {NOSName: "1/18", BaseNOSName: "Ethernet136", Label: "18", Profile: "OSFP-2x400G"}, + "E1/19": {NOSName: "1/19", BaseNOSName: "Ethernet144", Label: "19", Profile: "OSFP-2x400G"}, + "E1/20": {NOSName: "1/20", BaseNOSName: "Ethernet152", Label: "20", Profile: "OSFP-2x400G"}, + "E1/21": {NOSName: "1/21", BaseNOSName: "Ethernet160", Label: "21", Profile: "OSFP-2x400G"}, + "E1/22": {NOSName: "1/22", BaseNOSName: "Ethernet168", Label: "22", Profile: "OSFP-2x400G"}, + "E1/23": {NOSName: "1/23", BaseNOSName: "Ethernet176", Label: "23", Profile: "OSFP-2x400G"}, + "E1/24": {NOSName: "1/24", BaseNOSName: "Ethernet184", Label: "24", Profile: "OSFP-2x400G"}, + "E1/25": {NOSName: "1/25", BaseNOSName: "Ethernet192", Label: "25", Profile: "OSFP-2x400G"}, + "E1/26": {NOSName: "1/26", BaseNOSName: "Ethernet200", Label: "26", Profile: "OSFP-2x400G"}, + "E1/27": {NOSName: "1/27", BaseNOSName: "Ethernet208", Label: "27", Profile: "OSFP-2x400G"}, + "E1/28": {NOSName: "1/28", BaseNOSName: "Ethernet216", Label: "28", Profile: "OSFP-2x400G"}, + "E1/29": {NOSName: "1/29", BaseNOSName: "Ethernet224", Label: "29", Profile: "OSFP-2x400G"}, + "E1/30": {NOSName: "1/30", BaseNOSName: "Ethernet232", Label: "30", Profile: "OSFP-2x400G"}, + "E1/31": {NOSName: "1/31", BaseNOSName: "Ethernet240", Label: "31", Profile: "OSFP-2x400G"}, + "E1/32": {NOSName: "1/32", BaseNOSName: "Ethernet248", Label: "32", Profile: "OSFP-2x400G"}, // 32x OSFP-2x400G + "E1/33": {NOSName: "Ethernet256", Label: "M1", Profile: "SFP28-10G"}, // 1x SFP28-10G + "E1/34": {NOSName: "Ethernet257", Label: "M2", Profile: "SFP28-10G"}, // 1x SFP28-10G + }, + PortProfiles: map[string]wiringapi.SwitchProfilePortProfile{ + "SFP28-10G": { + Speed: &wiringapi.SwitchProfilePortProfileSpeed{ + Default: "10G", + Supported: []string{"1G", "10G"}, + }, + }, + "OSFP-2x400G": { + Breakout: &wiringapi.SwitchProfilePortProfileBreakout{ + Default: "2x400G", + Supported: map[string]wiringapi.SwitchProfilePortProfileBreakoutMode{ + "1x100G": {Offsets: []string{"0"}}, + "1x200G": {Offsets: []string{"0"}}, + "1x400G": {Offsets: []string{"0"}}, + "2x40G": {Offsets: []string{"0", "4"}}, + "2x100G": {Offsets: []string{"0", "4"}}, + "2x200G": {Offsets: []string{"0", "4"}}, + "2x400G": {Offsets: []string{"0", "4"}}, + "4x50G": {Offsets: []string{"0", "2", "4", "6"}}, + "4x100G": {Offsets: []string{"0", "2", "4", "6"}}, + "4x200G": {Offsets: []string{"0", "2", "4", "6"}}, + "8x10G": {Offsets: []string{"0", "1", "2", "3", "4", "5", "6", "7"}}, + "8x25G": {Offsets: []string{"0", "1", "2", "3", "4", "5", "6", "7"}}, + "8x50G": {Offsets: []string{"0", "1", "2", "3", "4", "5", "6", "7"}}, + "8x100G": {Offsets: []string{"0", "1", "2", "3", "4", "5", "6", "7"}}, + }, + }, + }, + }, + }, +}