Skip to content

Commit

Permalink
Add ESLAG related Fabric config
Browse files Browse the repository at this point in the history
  • Loading branch information
Frostman committed Jan 26, 2024
1 parent 2250928 commit 594a0b3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/manager/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ type Fabric struct {
VPCLoopbackSubnet string `json:"vpcLoopbackSubnet,omitempty"`
FabricMTU uint16 `json:"fabricMTU,omitempty"`
ServerFacingMTUOffset uint16 `json:"serverFacingMTUOffset,omitempty"`
ESLAGMACBase string `json:"eslagMACBase,omitempty"`
ESLAGESIPrefix string `json:"eslagESIPrefix,omitempty"`

reservedSubnets []*net.IPNet
}
Expand Down Expand Up @@ -175,6 +177,24 @@ func Load(basedir string) (*Fabric, error) {
return nil, errors.Errorf("config: dhcp must be one of %v", DHCPModes)
}

if cfg.FabricMode == FabricModeSpineLeaf {
if cfg.ESLAGMACBase == "" {
return nil, errors.Errorf("config: eslagMACBase is required")
}
if mac, err := net.ParseMAC(cfg.ESLAGMACBase); err != nil {
return nil, errors.Errorf("config: eslagMACBase should be a valid MAC address")
} else if len(mac) != 6 {
return nil, errors.Errorf("config: eslagMACBase should be a valid 48 bit MAC address")
}

if cfg.ESLAGESIPrefix == "" {
return nil, errors.Errorf("config: eslagESIPrefix is required")
}
if len(cfg.ESLAGESIPrefix) != 12 {
return nil, errors.Errorf("config: eslagESIPrefix should be a valid 12 hex long prefix, e.g. 00:f2:00:00:")
}
}

// TODO validate format of all fields

slog.Debug("Loaded config", "data", spew.Sdump(cfg))
Expand Down

0 comments on commit 594a0b3

Please sign in to comment.