sls

package
v1.36.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMTLVlan is the default MTL Bootstrap Vlan - zero (0) represents untagged.
	DefaultMTLVlan = 0
	// DefaultHMNString is the Default HMN String (bond0.hmn0)
	DefaultHMNString = "10.254.0.0/17"
	// DefaultHMNVlan is the default HMN Bootstrap Vlan
	DefaultHMNVlan = 4
	// DefaultHMNMTNString is the default HMN Network for Mountain Cabinets with Grouped Configuration
	DefaultHMNMTNString = "10.104.0.0/17"
	// DefaultHMNRVRString is the default HMN Network for River Cabinets with Grouped Configuration
	DefaultHMNRVRString = "10.107.0.0/17"
	// DefaultNMNString is the Default NMN String (bond0.nmn0)
	DefaultNMNString = "10.252.0.0/17"
	// DefaultNMNVlan is the default NMN Bootstrap Vlan
	DefaultNMNVlan = 2
	// DefaultMacVlanVlan is the default MacVlan Bootstrap Vlan
	DefaultMacVlanVlan = 2
	// DefaultNMNMTNString is the default NMN Network for Mountain Cabinets with Grouped Configuration
	DefaultNMNMTNString = "10.100.0.0/17"
	// DefaultNMNRVRString is the default NMN Network for River Cabinets with Grouped Configuration
	DefaultNMNRVRString = "10.106.0.0/17"
	// DefaultNMNLBString is the default LoadBalancer CIDR for the NMN
	DefaultNMNLBString = "10.92.100.0/24"
	// DefaultHMNLBString is the default LoadBalancer CIDR for the HMN
	DefaultHMNLBString = "10.94.100.0/24"
	// DefaultMacVlanString is the default Macvlan cidr (shares vlan with NMN)
	DefaultMacVlanString = "10.252.124.0/23"
	// DefaultHSNString is the Default HSN String
	DefaultHSNString = "10.253.0.0/16"
	// DefaultCMNString is the Default CMN String (bond0.cmn0)
	DefaultCMNString = "10.103.6.0/24"
	// DefaultCMNVlan is the default CMN Bootstrap Vlan
	DefaultCMNVlan = 7
	// DefaultCANString is the Default CAN String (bond0.can0)
	DefaultCANString = "10.102.11.0/24"
	// DefaultCANVlan is the default CAN Bootstrap Vlan
	DefaultCANVlan = 6
	// DefaultCHNString is the Default CHN String
	DefaultCHNString = "10.104.7.0/24"
	// DefaultCHNVlan is the default CHN Bootstrap Vlan
	DefaultCHNVlan = 5
	// DefaultMTLString is the Default MTL String (bond0 interface)
	DefaultMTLString = "10.1.1.0/16"
)

Variables

View Source
var (
	// DefaultMountainChassisList contains the default list of liquid cooled chassis for a TODO MODEL cabinet
	DefaultMountainChassisList = []int{
		0,
		1,
		2,
		3,
		4,
		5,
		6,
		7,
	}
	// DefaultHillChassisList contains the default list of liquid cooled chassis for a TODO MODEL cabinet
	DefaultHillChassisList = []int{
		1,
		3,
	}
	// DefaultRiverChassisList contains the default list of air cooled chassis for standard 19 inch rack
	DefaultRiverChassisList = []int{0}
)
View Source
var DefaultBICAN = networking.IPV4Network{
	FullName:           "SystemDefaultRoute points the network name of the default route",
	CIDR:               "0.0.0.0/0",
	Name:               "BICAN",
	VlanRange:          []int16{0},
	MTU:                9000,
	NetType:            "ethernet",
	Comment:            "",
	SystemDefaultRoute: "",
}

DefaultBICAN is the default structure for templating the initial BICAN toggle - CMN

View Source
var DefaultCAN = networking.IPV4Network{
	FullName:     "Customer Access Network",
	CIDR:         DefaultCANString,
	Name:         "CAN",
	VlanRange:    []int16{DefaultCANVlan},
	MTU:          9000,
	NetType:      "ethernet",
	Comment:      "",
	ParentDevice: "bond0",
}

DefaultCAN is the default structure for templating initial CAN configuration

View Source
var DefaultCHN = networking.IPV4Network{
	FullName:     "Customer High-Speed Network",
	CIDR:         DefaultCHNString,
	Name:         "CHN",
	VlanRange:    []int16{DefaultCHNVlan},
	MTU:          9000,
	NetType:      "ethernet",
	Comment:      "",
	ParentDevice: "bond0",
}

DefaultCHN is the default structure for templating initial CHN configuration

View Source
var DefaultCMN = networking.IPV4Network{
	FullName:     "Customer Management Network",
	CIDR:         DefaultCMNString,
	Name:         "CMN",
	VlanRange:    []int16{DefaultCMNVlan},
	MTU:          9000,
	NetType:      "ethernet",
	Comment:      "",
	ParentDevice: "bond0",
}

DefaultCMN is the default structure for templating initial CMN configuration

View Source
var DefaultCabinetMask = net.CIDRMask(
	22,
	32,
)

DefaultCabinetMask is the default subnet mask for each cabinet

View Source
var DefaultHMN = networking.IPV4Network{
	FullName:     "Hardware Management Network",
	CIDR:         DefaultHMNString,
	Name:         "HMN",
	VlanRange:    []int16{DefaultHMNVlan},
	MTU:          9000,
	NetType:      "ethernet",
	Comment:      "",
	ParentDevice: "bond0",
}

DefaultHMN is the default structure for templating initial HMN configuration

View Source
var DefaultHSN = networking.IPV4Network{
	FullName: "High Speed Network",
	CIDR:     DefaultHSNString,
	Name:     "HSN",
	VlanRange: []int16{
		613,
		868,
	},
	MTU:     9000,
	NetType: "slingshot10",
	Comment: "",
}

DefaultHSN is the default structure for templating initial HSN configuration

View Source
var DefaultLoadBalancerHMN = networking.IPV4Network{
	FullName: "Hardware Management Network LoadBalancers",
	CIDR:     DefaultHMNLBString,
	Name:     "HMNLB",
	MTU:      9000,
	NetType:  "ethernet",
	Comment:  "",
}

DefaultLoadBalancerHMN is a thing we need

View Source
var DefaultLoadBalancerNMN = networking.IPV4Network{
	FullName: "Node Management Network LoadBalancers",
	CIDR:     DefaultNMNLBString,
	Name:     "NMNLB",
	MTU:      9000,
	NetType:  "ethernet",
	Comment:  "",
}

DefaultLoadBalancerNMN is a thing we need

View Source
var DefaultMTL = networking.IPV4Network{
	FullName:     "Provisioning Network (untagged)",
	CIDR:         DefaultMTLString,
	Name:         "MTL",
	VlanRange:    []int16{DefaultMTLVlan},
	MTU:          9000,
	NetType:      "ethernet",
	Comment:      "This network is only valid for the NCNs",
	ParentDevice: "bond0",
}

DefaultMTL is the default structure for templating initial MTL configuration

View Source
var DefaultNMN = networking.IPV4Network{
	FullName:     "Node Management Network",
	CIDR:         DefaultNMNString,
	Name:         "NMN",
	VlanRange:    []int16{DefaultNMNVlan},
	MTU:          9000,
	NetType:      "ethernet",
	Comment:      "",
	ParentDevice: "bond0",
}

DefaultNMN is the default structure for templating initial NMN configuration

View Source
var DefaultNetworkingHardwareMask = net.CIDRMask(
	24,
	32,
)

DefaultNetworkingHardwareMask is the default subnet mask for a subnet that contains all networking hardware

Functions

func BuildCSMNetworks

func BuildCSMNetworks(
	internalNetConfigs map[string]NetworkLayoutConfiguration,
	internalCabinetDetails []sls.CabinetGroupDetail,
	switches []*networking.ManagementSwitch,
) (map[string]*networking.IPV4Network, error)

BuildCSMNetworks creates an array of IPv4 Networks based on the supplied system configuration

func ConvertIPV4NetworksToSLS

func ConvertIPV4NetworksToSLS(networks *[]networking.IPV4Network) map[string]slsCommon.Network

ConvertIPV4NetworksToSLS converts IPV4 network definitions to a compatible format for SLS.

func ConvertManagementSwitchToSLS

func ConvertManagementSwitchToSLS(s *networking.ManagementSwitch) (slsCommon.GenericHardware, error)

ConvertManagementSwitchToSLS converts a management switch to a format compatible with SLS.

func ExtractSwitchesfromReservations

func ExtractSwitchesfromReservations(subnet *networking.IPV4Subnet) ([]networking.ManagementSwitch, error)

ExtractSwitchesfromReservations extracts all the switches from a IP network.

func GenCabinetMap

func GenCabinetMap(
	cd []sls.CabinetGroupDetail, shastaNetworks map[string]*networking.IPV4Network,
) map[slsCommon.CabinetType]map[string]CabinetTemplate

GenCabinetMap creates a map of cabinets.

func GenerateSLSState

func GenerateSLSState(inputState GeneratorInputState, hmnRows []shcdParser.HMNRow) slsCommon.SLSState

GenerateSLSState generates new SLSState object from an input state and hmn-connections file.

func NewCommand

func NewCommand() *cobra.Command

NewCommand represents the sls command.

Types

type CabinetTemplate

type CabinetTemplate struct {
	Xname           xnames.Cabinet
	Model           string
	Class           slsCommon.CabinetType
	CabinetNetworks map[string]map[string]slsCommon.CabinetNetworks

	LiquidCooledChassisList []int
	AirCooledChassisList    []int
}

CabinetTemplate Should this be merged with Cabinet detail?

type GeneratorApplicationNodeConfig

type GeneratorApplicationNodeConfig struct {
	Prefixes          []string          `yaml:"prefixes"`
	PrefixHSMSubroles map[string]string `yaml:"prefix_hsm_subroles"`

	Aliases map[string][]string `yaml:"aliases"`
}

GeneratorApplicationNodeConfig is given to the SLS config generator to control the application node generation in SLS

func (*GeneratorApplicationNodeConfig) Normalize

func (applicationNodeConfig *GeneratorApplicationNodeConfig) Normalize() error

Normalize the values of the GeneratorApplicationNodeConfig structure

func (*GeneratorApplicationNodeConfig) Validate

func (applicationNodeConfig *GeneratorApplicationNodeConfig) Validate() error

Validate GeneratorApplicationNodeConfig contents

type GeneratorInputState

type GeneratorInputState struct {
	ApplicationNodeConfig GeneratorApplicationNodeConfig `json:"ApplicationNodeConfig"`

	ManagementSwitches  map[string]slsCommon.GenericHardware `json:"ManagementSwitches"` // SLS Type: comptype_mgmt_switch
	RiverCabinets       map[string]CabinetTemplate           `json:"RiverCabinets"`      // SLS Type: comptype_cabinet
	HillCabinets        map[string]CabinetTemplate           `json:"HillCabinets"`       // SLS Type: comptype_cabinet
	MountainCabinets    map[string]CabinetTemplate           `json:"MountainCabinets"`   // SLS Type: comptype_cabinet
	MountainStartingNid int                                  `json:"MountainStartingNid"`

	Networks map[string]slsCommon.Network `json:"Networks"`
}

GeneratorInputState is given to the SLS config generator in order to generate the SLS config file

type NetworkLayoutConfiguration

type NetworkLayoutConfiguration struct {
	Template                        networking.IPV4Network
	ReservationHostnames            []string
	IncludeBootstrapDHCP            bool
	DesiredBootstrapDHCPMask        net.IPMask
	IncludeNetworkingHardwareSubnet bool
	SuperNetHack                    bool
	AdditionalNetworkingSpace       int
	NetworkingHardwareNetmask       net.IPMask
	BaseVlan                        int16
	SubdivideByCabinet              bool
	GroupNetworksByCabinetType      bool
	IncludeUAISubnet                bool
	CabinetDetails                  []sls.CabinetGroupDetail
	CabinetCIDR                     net.IPMask
	ManagementSwitches              []*networking.ManagementSwitch
}

NetworkLayoutConfiguration is the internal configuration structure for shasta networks

func GenDefaultBICANConfig

func GenDefaultBICANConfig(systemDefaultRoute string) NetworkLayoutConfiguration

GenDefaultBICANConfig returns the set of defaults for mapping the BICAN toggle

func GenDefaultCANConfig

func GenDefaultCANConfig() NetworkLayoutConfiguration

GenDefaultCANConfig returns the set of defaults for mapping the CAN

func GenDefaultCHNConfig

func GenDefaultCHNConfig() NetworkLayoutConfiguration

GenDefaultCHNConfig returns the set of defaults for mapping the CHN

func GenDefaultCMNConfig

func GenDefaultCMNConfig(ncns int, switches int) NetworkLayoutConfiguration

GenDefaultCMNConfig returns the set of defaults for mapping the CMN

func GenDefaultHMNConfig

func GenDefaultHMNConfig() NetworkLayoutConfiguration

GenDefaultHMNConfig is the set of defaults for mapping the HMN

func GenDefaultHSNConfig

func GenDefaultHSNConfig() NetworkLayoutConfiguration

GenDefaultHSNConfig returns the set of defaults for mapping the HSN

func GenDefaultMTLConfig

func GenDefaultMTLConfig() NetworkLayoutConfiguration

GenDefaultMTLConfig returns the set of defaults for mapping the MTL

func GenDefaultNMNConfig

func GenDefaultNMNConfig() NetworkLayoutConfiguration

GenDefaultNMNConfig returns the set of defaults for mapping the NMN

type StateGenerator

type StateGenerator struct {
	// contains filtered or unexported fields
}

StateGenerator is a utility that can take an GeneratorInputState to create a valid SLSState

func NewStateGenerator

func NewStateGenerator(logger *zap.Logger, inputState GeneratorInputState, hmnRows []shcdParser.HMNRow) StateGenerator

NewStateGenerator create a new instances of the state generator

func (*StateGenerator) GenerateSLSState

func (g *StateGenerator) GenerateSLSState() slsCommon.SLSState

GenerateSLSState will generate the SLSState

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL