csi

package
v1.30.4 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: MIT Imports: 29 Imported by: 3

Documentation

Index

Constants

View Source
const (
	CabinetKindRiver    = "river"
	CabinetKindHill     = "hill"
	CabinetKindMountain = "mountain"
	CabinetKindEX2000   = "EX2000"
	CabinetKindEX2500   = "EX2500"
	CabinetKindEX3000   = "EX3000"
	CabinetKindEX4000   = "EX4000"
)

Enumerations of CabinetKinds for valid cabinet types.

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"
)
View Source
const SubrolePlaceHolder = "~fixme~"

SubrolePlaceHolder is the placeholder used to indicate that a prefix has no subrole mapping in ApplicationNodeConfig.

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 DefaultApplicationNodePrefixes = []string{
	"uan",
	"gn",
	"ln",
}

DefaultApplicationNodePrefixes is the list of default Application node prefixes, for source column in the hmn_connections.json

View Source
var DefaultApplicationNodeSubroles = map[string]string{
	"uan": "UAN",
	"ln":  "UAN",
	"gn":  "Gateway",
}

DefaultApplicationNodeSubroles is the default prefix<->subrole mapping for application node subroles, these can be overridden via ApplicationNodeConfig

View Source
var DefaultBICAN = 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 = IPV4Network{
	FullName:  "Customer Access Network",
	CIDR:      DefaultCANString,
	Name:      "CAN",
	VlanRange: []int16{DefaultCANVlan},
	MTU:       9000,
	NetType:   "ethernet",
	Comment:   "",
}

DefaultCAN is the default structure for templating initial CAN configuration

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

DefaultCHN is the default structure for templating initial CHN configuration

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

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 DefaultHSN = 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 = 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 = 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 = 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",
}

DefaultMTL is the default structure for templating initial MTL configuration

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

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

View Source
var DefaultUAISubnetReservations = map[string][]string{
	"uai_nmn_blackhole": {"uai-nmn-blackhole"},
	"slurmctld_service": {"slurmctld-service", "slurmctld-service-nmn"},
	"slurmdbd_service":  {"slurmdbd-service", "slurmdbd-service-nmn"},
	"pbs_service":       {"pbs-service", "pbs-service-nmn"},
	"pbs_comm_service":  {"pbs-comm-service", "pbs-comm-service-nmn"},
}

DefaultUAISubnetReservations is the map of dns names and aliases

View Source
var InstallerDefaults = SystemConfig{
	SystemName:  "sn-2024",
	SiteDomain:  "dev.cray.com",
	NtpServers:  []string{"ncn-m001"},
	NtpPeers:    []string{"ncn-m001", "ncn-m002", "ncn-m003", "ncn-w001", "ncn-w002", "ncn-w003", "ncn-s001", "ncn-s002", "ncn-s003"},
	NtpTimezone: "UTC",
	RpmRegistry: "https://packages.nmn/repository/shasta-master",
	V2Registry:  "https://registry.nmn/",
	Install: InstallConfig{
		NCN:                 "ncn-m001",
		NCNBondMembers:      "p1p1,p1p2",
		SiteNIC:             "em1",
		SitePrefix:          "/20",
		CephCephfsImage:     "dtr.dev.cray.com/cray/cray-cephfs-provisioner:0.1.0-nautilus-1.3",
		CephRBDImage:        "dtr.dev.cray.com/cray/cray-rbd-provisioner:0.1.0-nautilus-1.3",
		ChartRepo:           "http://helmrepo.dev.cray.com:8080",
		DockerImageRegistry: "dtr.dev.cray.com",
	},
}

InstallerDefaults holds all of our defaults

View Source
var PinnedMetalLBReservations = map[string]PinnedReservation{
	"istio-ingressgateway":       {71, strings.Split("api-gw-service api-gw-service-nmn.local packages registry spire.local api_gw_service registry.local packages packages.local spire", " ")},
	"istio-ingressgateway-local": {81, []string{"api-gw-service.local"}},
	"rsyslog-aggregator":         {72, []string{"rsyslog-agg-service"}},
	"cray-tftp":                  {60, []string{"tftp-service"}},
	"unbound":                    {225, []string{"unbound"}},
	"docker-registry":            {73, []string{"docker_registry_service"}},
}

PinnedMetalLBReservations is the map of dns names and aliases with the required final octet of th ip address *** This structure is only necessary to pin ip addresses as we shift from 1.3 to 1.4 *** *** *** *** To anyone editing this code in the future, PLEASE DON'T MAKE IT BETTER *** *** *** *** *** *** This code is written to be thrown away with a fully dynamic ip addressing scheme *** *** ***

ValidCabinetTypes is the list of strings that enumerate valid cabinet types

View Source
var ValidNetNames = []string{"BICAN", "CAN", "CHN", "CMN", "HMN", "HMN_MTN", "HMN_RVR", "MTL", "NMN", "NMN_MTN", "NMN_RVR"}

ValidNetNames is the list of strings that enumerate valid main network names

Functions

func BuildCSMNetworks

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

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

func CabinetForXname

func CabinetForXname(xname string) (string, error)

CabinetForXname extracts the cabinet identifier from an xname

func ExecuteCommandC added in v1.8.0

func ExecuteCommandC(root *cobra.Command, args []string) (c *cobra.Command, output string, err error)

ExecuteCommandC runs a cobra command

func GenerateInstanceID

func GenerateInstanceID() string

GenerateInstanceID creates an instance-id fit for use in the instance metadata

func GenerateSLSState

func GenerateSLSState(inputState SLSGeneratorInputState, hmnRows []shcd_parser.HMNRow) sls_common.SLSState

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

func GetSLSCabinets

func GetSLSCabinets(state sls_common.SLSState, class sls_common.CabinetType) []sls_common.GenericHardware

GetSLSCabinets will get all of the cabinets from SLS of the specified class

func IPNetfromCIDRString

func IPNetfromCIDRString(mynet string) *net.IPNet

IPNetfromCIDRString converts from a string to an net.IPNet struct

func IsManagementSwitchTypeValid

func IsManagementSwitchTypeValid(mst ManagementSwitchType) bool

IsManagementSwitchTypeValid validates the given ManagementSwitchType

func ParseSLSFile

func ParseSLSFile(path string) (sls_common.SLSState, error)

ParseSLSFile takes a path and returns an SLSState struct for parsing

func ParseSLSfromURL

func ParseSLSfromURL(url string) (sls_common.SLSState, error)

ParseSLSfromURL takes a url (likely the sls dumpstate url) and returns a useful struct

Types

type BootstrapSwitchMetadata

type BootstrapSwitchMetadata struct {
	Xname string `json:"xname" csv:"Switch Xname"`
	Type  string `json:"type" csv:"Type"`
}

BootstrapSwitchMetadata is a type that matches the switch_metadata.csv file as Switch Xname, Type The type can be CDU, Spine, Leaf, or LeafBMC

type CabinetDetail

type CabinetDetail struct {
	ID           int           `mapstructure:"id" yaml:"id" valid:"numeric"`
	ChassisCount *ChassisCount `mapstructure:"chassis-count" yaml:"chassis-count" valid:"-"` // This field is only respected for EX2500 cabinets with variable chassis counts
	NMNSubnet    string        `mapstructure:"nmn-subnet" yaml:"nmn-subnet" valid:"-"`
	NMNVlanID    int16         `mapstructure:"nmn-vlan" yaml:"nmn-vlan" valid:"numeric"`
	HMNSubnet    string        `mapstructure:"hmn-subnet" yaml:"hmn-subnet" valid:"-"`
	HMNVlanID    int16         `mapstructure:"hmn-vlan" yaml:"hmn-vlan" valid:"numeric"`
}

CabinetDetail stores information about individual cabinets

type CabinetDetailFile

type CabinetDetailFile struct {
	Cabinets []CabinetGroupDetail `yaml:"cabinets"`
}

CabinetDetailFile is a struct that matches the syntax of the configuration file for non-sequential cabinet ids

func LoadCabinetDetailFile

func LoadCabinetDetailFile(path string) (CabinetDetailFile, error)

LoadCabinetDetailFile loads the cabinet details from the filesystem

func (*CabinetDetailFile) CabinetTypes

func (cdf *CabinetDetailFile) CabinetTypes() []CabinetKind

CabinetTypes returns a list of cabinet types from the file

type CabinetFilterFunc added in v1.21.0

type CabinetFilterFunc func(CabinetGroupDetail, CabinetDetail) bool

CabinetFilterFunc is a function type that functions can implement to define rules if a cabinet with its its CabinetGroupDetail and CabinetDetail should be filtered out or not.

func AndCabinetFilter added in v1.21.0

func AndCabinetFilter(cabinetFilters ...CabinetFilterFunc) CabinetFilterFunc

AndCabinetFilter allows for multiple cabinets filters to be chained together, and all must pass.

func CabinetAirCooledChassisCountFilter added in v1.21.0

func CabinetAirCooledChassisCountFilter(airCooledChassisCount int) CabinetFilterFunc

CabinetAirCooledChassisCountFilter returns true when a CabinetDetail has a matching number of air-cooled chassis in a ChassisCount structure.

func CabinetClassFilter added in v1.21.0

func CabinetClassFilter(expectedClass sls_common.CabinetType) CabinetFilterFunc

CabinetClassFilter returns true when a CabinetGroupDetail is of the specified kind. For example, CabinetClassFilter(sls_common.ClassRiver) would match for river cabinets.

func CabinetKindFilter added in v1.21.0

func CabinetKindFilter(kind CabinetKind) CabinetFilterFunc

CabinetKindFilter returns true when a CabinetGroupDetail is of the specified kind. For example, CabinetKindSelector(CabinetKindRiver) would match for river cabinets.

func CabinetLiquidCooledChassisCountFilter added in v1.21.0

func CabinetLiquidCooledChassisCountFilter(liquidCooledChassisCount int) CabinetFilterFunc

CabinetLiquidCooledChassisCountFilter returns true when a CabinetDetail has a matching number of liquid-cooled chassis in a ChassisCount structure.

func OrCabinetFilter added in v1.21.0

func OrCabinetFilter(cabinetFilters ...CabinetFilterFunc) CabinetFilterFunc

OrCabinetFilter allows for multiple cabinets filters to be chained together, and all must pass.

type CabinetGroupDetail

type CabinetGroupDetail struct {
	Kind            CabinetKind     `mapstructure:"cabinet-type" yaml:"type" valid:"-"`
	Cabinets        int             `mapstructure:"number" yaml:"total_number" valid:"-"`
	StartingCabinet int             `mapstructure:"starting-cabinet" yaml:"starting_id" valid:"-"`
	CabinetDetails  []CabinetDetail `mapstructure:"cabinets" yaml:"cabinets" valid:"-"`
}

CabinetGroupDetail stores information that can only come from Manufacturing

func (*CabinetGroupDetail) CabinetIDs

func (cgd *CabinetGroupDetail) CabinetIDs() []int

CabinetIDs returns the list of all cabinet ids

func (*CabinetGroupDetail) GetCabinetDetails added in v1.21.0

func (cgd *CabinetGroupDetail) GetCabinetDetails() map[int]CabinetDetail

GetCabinetDetails will retrieve all cabinets that have cabinet specific overrides present

func (*CabinetGroupDetail) Length

func (cgd *CabinetGroupDetail) Length() int

Length returns the expected number of cabinets from the total_number passed in or the length of the cabinet_ids array

func (*CabinetGroupDetail) PopulateIds

func (cgd *CabinetGroupDetail) PopulateIds()

PopulateIds fills out the cabinet ids by doing simple math

type CabinetKind added in v1.21.0

type CabinetKind string

CabinetKind is the type of the cabinet. This can either be a generic identifier like river, hill, or mountain. It can also be a cabinet model number like EX2000, EX25000, EX3000, or EX4000.

func (CabinetKind) Class added in v1.21.0

func (ck CabinetKind) Class() (sls_common.CabinetType, error)

Class will determine the SLS cabinet class of this Cabinet group

func (CabinetKind) IsModel added in v1.21.0

func (ck CabinetKind) IsModel() bool

IsModel will return true if this cabinet type is the actual model of the cabinet.

type ChassisCount added in v1.21.0

type ChassisCount struct {
	LiquidCooled int `mapstructure:"liquid-cooled" yaml:"liquid-cooled" valid:"numeric"`
	AirCooled    int `mapstructure:"air-cooled" yaml:"air-cooled" valid:"numeric"`
}

ChassisCount stores optional information about the chassis composition of the cabinet

type IPReservation

type IPReservation struct {
	IPAddress net.IP   `yaml:"ip_address"`
	Name      string   `yaml:"name"`
	Comment   string   `yaml:"comment"`
	Aliases   []string `yaml:"aliases"`
}

IPReservation is a type for managing IP Reservations

func (*IPReservation) AddReservationAlias

func (iReserv *IPReservation) AddReservationAlias(alias string)

AddReservationAlias adds an alias to a reservation if it doesn't already exist

type IPV4Network

type IPV4Network struct {
	FullName           string                 `yaml:"full_name"`
	CIDR               string                 `yaml:"cidr"`
	Subnets            []*IPV4Subnet          `yaml:"subnets"`
	Name               string                 `yaml:"name"`
	VlanRange          []int16                `yaml:"vlan_range"`
	MTU                int16                  `yaml:"mtu"`
	NetType            sls_common.NetworkType `yaml:"type"`
	Comment            string                 `yaml:"comment"`
	PeerASN            int                    `yaml:"peer-asn"`
	MyASN              int                    `yaml:"my-asn"`
	SystemDefaultRoute string                 `yaml:"system_default_route"`
}

IPV4Network is a type for managing IPv4 Networks

func ExtractSLSNetworks

func ExtractSLSNetworks(sls *sls_common.SLSState) ([]IPV4Network, error)

ExtractSLSNetworks converts from the SLS version of Network Definitions to a list of IPV4Networks

func GenDefaultHMN

func GenDefaultHMN() IPV4Network

GenDefaultHMN returns the default structure for templating initial HMN configuration

func GenDefaultNMN

func GenDefaultNMN() IPV4Network

GenDefaultNMN returns the default structure for templating initial NMN configuration

func (*IPV4Network) AddBiggestSubnet

func (iNet *IPV4Network) AddBiggestSubnet(mask net.IPMask, name string, vlanID int16) (*IPV4Subnet, error)

AddBiggestSubnet allocates the largest subnet possible within the requested network and mask

func (*IPV4Network) AddSubnet

func (iNet *IPV4Network) AddSubnet(mask net.IPMask, name string, vlanID int16) (*IPV4Subnet, error)

AddSubnet allocates a new subnet

func (*IPV4Network) AddSubnetbyCIDR

func (iNet *IPV4Network) AddSubnetbyCIDR(desiredNet net.IPNet, name string, vlanID int16) (*IPV4Subnet, error)

AddSubnetbyCIDR allocates a new subnet

func (IPV4Network) AllocatedSubnets

func (iNet IPV4Network) AllocatedSubnets() []net.IPNet

AllocatedSubnets returns a list of the allocated subnets

func (IPV4Network) AllocatedVlans

func (iNet IPV4Network) AllocatedVlans() []int16

AllocatedVlans returns a list of all allocated vlan ids

func (*IPV4Network) GenSubnets

func (iNet *IPV4Network) GenSubnets(cabinetDetails []CabinetGroupDetail, mask net.IPMask, cabinetFilter CabinetFilterFunc) error

GenSubnets subdivides a network into a set of subnets

func (*IPV4Network) LookUpSubnet

func (iNet *IPV4Network) LookUpSubnet(name string) (*IPV4Subnet, error)

LookUpSubnet returns a subnet by name

func (IPV4Network) SubnetbyName

func (iNet IPV4Network) SubnetbyName(name string) IPV4Subnet

SubnetbyName Return a copy of the subnet by name or a blank subnet if it doesn't exists

type IPV4Subnet

type IPV4Subnet struct {
	FullName         string          `yaml:"full_name" form:"full_name" mapstructure:"full_name"`
	CIDR             net.IPNet       `yaml:"cidr"`
	IPReservations   []IPReservation `yaml:"ip_reservations"`
	Name             string          `yaml:"name" form:"name" mapstructure:"name"`
	NetName          string          `yaml:"net-name"`
	VlanID           int16           `yaml:"vlan_id" form:"vlan_id" mapstructure:"vlan_id"`
	Comment          string          `yaml:"comment"`
	Gateway          net.IP          `yaml:"gateway"`
	PITServer        net.IP          `yaml:"_"`
	DNSServer        net.IP          `yaml:"dns_server"`
	DHCPStart        net.IP          `yaml:"iprange-start"`
	DHCPEnd          net.IP          `yaml:"iprange-end"`
	ReservationStart net.IP          `yaml:"reservation-start"`
	ReservationEnd   net.IP          `yaml:"reservation-end"`
	MetalLBPoolName  string          `yaml:"metallb-pool-name"`
}

IPV4Subnet is a type for managing IPv4 Subnets

func (*IPV4Subnet) AddReservation

func (iSubnet *IPV4Subnet) AddReservation(name, comment string) *IPReservation

AddReservation adds a new IP reservation to the subnet

func (*IPV4Subnet) AddReservationWithIP

func (iSubnet *IPV4Subnet) AddReservationWithIP(name, addr, comment string) (*IPReservation, error)

AddReservationWithIP adds a reservation with a specific ip address

func (*IPV4Subnet) AddReservationWithPin

func (iSubnet *IPV4Subnet) AddReservationWithPin(name, comment string, pin uint8) *IPReservation

AddReservationWithPin adds a new IPv4 reservation to the subnet with the last octet pinned

func (*IPV4Subnet) LookupReservation

func (iSubnet *IPV4Subnet) LookupReservation(resName string) IPReservation

LookupReservation searches the subnet for an IPReservation that matches the name provided

func (*IPV4Subnet) ReservationsByName

func (iSubnet *IPV4Subnet) ReservationsByName() map[string]IPReservation

ReservationsByName presents the IPReservations in a map by name

func (*IPV4Subnet) ReserveEdgeSwitchIPs added in v1.16.16

func (iSubnet *IPV4Subnet) ReserveEdgeSwitchIPs(edges []string)

ReserveEdgeSwitchIPs reserves (n) IP addresses for edge switches

func (*IPV4Subnet) ReserveNetMgmtIPs

func (iSubnet *IPV4Subnet) ReserveNetMgmtIPs(spines []string, leafs []string, leafbmcs []string, cdus []string)

ReserveNetMgmtIPs reserves (n) IP addresses for management networking equipment

func (*IPV4Subnet) ReservedIPs

func (iSubnet *IPV4Subnet) ReservedIPs() []net.IP

ReservedIPs returns a list of IPs already reserved within the subnet

func (*IPV4Subnet) TotalIPAddresses

func (iSubnet *IPV4Subnet) TotalIPAddresses() int

TotalIPAddresses returns the number of ip addresses in a subnet see UsableHostAddresses

func (*IPV4Subnet) UpdateDHCPRange

func (iSubnet *IPV4Subnet) UpdateDHCPRange(applySupernetHack bool)

UpdateDHCPRange resets the DHCPStart to exclude all IPReservations

func (*IPV4Subnet) UsableHostAddresses

func (iSubnet *IPV4Subnet) UsableHostAddresses() int

UsableHostAddresses returns the number of usable ip addresses in a subnet

type InstallConfig

type InstallConfig struct {
	NCN                 string `desc:"Hostname of the node to be used for installation"`
	NCNBondMembers      string `desc:"Comma separated list of Linux device names to set up the bond on the installation node"`
	SiteIP              net.IP `desc:"IP address for the site connection of the installer node"  valid:"ipv4 notnull"`
	SitePrefix          string `desc:"Subnet Prefix for the site connection"`
	SiteDNS             net.IP `desc:"IP address for the site dns server" valid:"ipv4"`
	SiteGW              net.IP `desc:"Gateway IP address for the site connection of the installer node" valid:"ipv4"`
	SiteNIC             string `desc:"Linux Interface Identifier for the NIC connected to the site network" flag:",required" valid:"stringlength(2|20)"`
	CephCephfsImage     string `desc:"The container image for the cephfs provisioner" valid:"url"`
	CephRBDImage        string `desc:"The container image for the ceph rbd provisioner" valid:"url"`
	ChartRepo           string `desc:"Upstream chart repo for use during the install" valid:"url"`
	DockerImageRegistry string `desc:"Upstream docker registry for use during the install" valid:"url"`
}

InstallConfig stores information about the site for the installer to use

type LogicalNCN

type LogicalNCN struct {
	Role             string         `yaml:"role" json:"role" csv:"NCN Role"`
	Subrole          string         `yaml:"subrole" json:"subrole" csv:"NCN Subrole"`
	BmcMac           string         `yaml:"bmc-mac" json:"bmc-mac" csv:"BMC MAC"`
	BmcPort          string         `yaml:"bmc-port" json:"bmc-port" csv:"BMC Switch Port"`
	NmnMac           string         `yaml:"nmn-mac" json:"nmn-mac" csv:"NMN MAC"`
	NmnPort          string         `yaml:"nmn-port" json:"nmn-port" csv:"NMN Switch Port"`
	NmnIP            string         `yaml:"nmn-ip" json:"nmn-ip" csv:"-"`
	HmnIP            string         `yaml:"hmn-ip" json:"hmn-ip" csv:"-"`
	MtlIP            string         `yaml:"mtl-ip" json:"mtl-ip" csv:"-"`
	CmnIP            string         `yaml:"cmn-ip" json:"cmn-ip" csv:"-"`
	CanIP            string         `yaml:"can-ip" json:"can-ip" csv:"-"`
	Xname            string         `yaml:"xname" json:"xname" csv:"NCN xname"`
	Hostname         string         `yaml:"hostname" json:"hostname" csv:"-"`
	InstanceID       string         `yaml:"instance-id" json:"instance-id" csv:"-"` // should be unique for the life of the image
	Region           string         `yaml:"region" json:"region" csv:"-"`
	AvailabilityZone string         `yaml:"availability-zone" json:"availability-zone" csv:"-"`
	ShastaRole       string         `yaml:"shasta-role" json:"shasta-role" csv:"-"` // map to HSM Subrole
	Aliases          []string       `yaml:"aliases" json:"aliases" csv:"-"`
	Networks         []NCNNetwork   `yaml:"networks" json:"networks" csv:"-"`
	Interfaces       []NCNInterface `yaml:"interfaces" json:"interfaces" csv:"-"`
	BmcIP            string         `yaml:"bmc-ip" json:"bmc-ip" csv:"-"`
	Bond0Mac0        string         `yaml:"bond0-mac0" json:"bond0-mac0" csv:"-"`
	Bond0Mac1        string         `yaml:"bond0-mac1" json:"bond0-mac1" csv:"-"`
	Cabinet          string         `yaml:"cabinet" json:"cabinet" csv:"-"` // Use to establish availability zone
}

LogicalNCN is the main struct for NCNs It replaces the deprecated BootstrapNCNMetadata and still matches the ncn_metadata.csv file as NCN xname,NCN Role,NCN Subrole,BMC MAC,BMC Switch Port,NMN MAC,NMN Switch Port

func ExtractSLSNCNs

func ExtractSLSNCNs(sls *sls_common.SLSState) ([]LogicalNCN, error)

ExtractSLSNCNs pulls the port information for the BMCs of all Management Nodes

func ReadNodeCSV

func ReadNodeCSV(filename string) ([]*LogicalNCN, error)

ReadNodeCSV parses a CSV file into a list of NCN_bootstrap nodes for use by the installer

func (LogicalNCN) GetHostname

func (lncn LogicalNCN) GetHostname() string

GetHostname returns an explicit hostname if possible, otherwise the Xname, otherwise an empty string

func (*LogicalNCN) GetIP

func (lncn *LogicalNCN) GetIP(netName string) net.IP

GetIP takes in a netname and returns an IP address for that netname

func (*LogicalNCN) Normalize

func (lncn *LogicalNCN) Normalize() error

Normalize the values of a LogicalNCN

func (*LogicalNCN) Validate

func (lncn *LogicalNCN) Validate() error

Validate is a validator that checks for a minimum set of info

type LogicalUAN

type LogicalUAN struct {
	Xname    string   `yaml:"xname" json:"xname" csv:"NCN xname"`
	Hostname string   `yaml:"hostname" json:"hostname" csv:"-"`
	Role     string   `yaml:"role" json:"role" csv:"NCN Role"`
	Subrole  string   `yaml:"subrole" json:"subrole" csv:"NCN Subrole"`
	CanIP    net.IP   `yaml:"bmc-ip" json:"bmc-ip" csv:"-"`
	Aliases  []string `yaml:"aliases" json:"aliases" csv:"-"`
}

LogicalUAN is like LogicalNCN, but for UANs

func ExtractUANs

func ExtractUANs(sls *sls_common.SLSState) ([]LogicalUAN, error)

ExtractUANs pulls the information needed to assign CAN addresses to the UAN xnames

type ManagementSwitch

type ManagementSwitch struct {
	Xname               string                `json:"xname" mapstructure:"xname" csv:"Switch Xname"` // Required for SLS
	Name                string                `json:"name" mapstructure:"name" csv:"-"`              // Required for SLS to update DNS
	Brand               ManagementSwitchBrand `json:"brand" mapstructure:"brand" csv:"Brand"`
	Model               string                `json:"model" mapstructure:"model" csv:"Model"`
	Os                  string                `json:"operating-system" mapstructure:"operating-system" csv:"-"`
	Firmware            string                `json:"firmware" mapstructure:"firmware" csv:"-"`
	SwitchType          ManagementSwitchType  `json:"type" mapstructure:"type" csv:"Type"` //"CDU/LeafBMC/Spine/Leaf/Edge"
	ManagementInterface net.IP                `json:"ip" mapstructure:"ip" csv:"-"`        // SNMP/REST interface IP (not a distinct BMC)  // Required for SLS
}

ManagementSwitch is a type for managing Management switches

func ExtractSLSSwitches

func ExtractSLSSwitches(sls *sls_common.SLSState) ([]ManagementSwitch, error)

ExtractSLSSwitches reads the SLSState object and finds any switches

func ReadSwitchCSV

func ReadSwitchCSV(filename string) ([]*ManagementSwitch, error)

ReadSwitchCSV parses a CSV file into a list of ManagementSwitch structs

func (*ManagementSwitch) Normalize

func (mySwitch *ManagementSwitch) Normalize() error

Normalize the values of a Management switch

func (*ManagementSwitch) Validate

func (mySwitch *ManagementSwitch) Validate() error

Validate ManagementSwitch contents

type ManagementSwitchBrand

type ManagementSwitchBrand string

ManagementSwitchBrand known list of Management switch brands

const ManagementSwitchBrandArista ManagementSwitchBrand = "Arista"

ManagementSwitchBrandArista for Arista Edge switches

const ManagementSwitchBrandAruba ManagementSwitchBrand = "Aruba"

ManagementSwitchBrandAruba for Aruba Management switches

const ManagementSwitchBrandCisco ManagementSwitchBrand = "Cisco"

ManagementSwitchBrandCisco for Cisco Edge switches

const ManagementSwitchBrandDell ManagementSwitchBrand = "Dell"

ManagementSwitchBrandDell for Dell Management switches

const ManagementSwitchBrandJuniper ManagementSwitchBrand = "Juniper"

ManagementSwitchBrandJuniper for Juniper Edge switches

const ManagementSwitchBrandMellanox ManagementSwitchBrand = "Mellanox"

ManagementSwitchBrandMellanox for Mellanox Management switches

func (ManagementSwitchBrand) String

func (msb ManagementSwitchBrand) String() string

type ManagementSwitchType

type ManagementSwitchType string

ManagementSwitchType the type of management switch CDU/LeafBMC/Spine/Leaf/Edge

const ManagementSwitchTypeCDU ManagementSwitchType = "CDU"

ManagementSwitchTypeCDU is the type for CDU Management switches

const ManagementSwitchTypeEdge ManagementSwitchType = "Edge"

ManagementSwitchTypeEdge is the type for Edge Management switches

const ManagementSwitchTypeLeaf ManagementSwitchType = "Leaf"

ManagementSwitchTypeLeaf is the type for Leaf Management switches

const ManagementSwitchTypeLeafBMC ManagementSwitchType = "LeafBMC"

ManagementSwitchTypeLeafBMC is the type for Leaf Management switches

const ManagementSwitchTypeSpine ManagementSwitchType = "Spine"

ManagementSwitchTypeSpine is the type for Spine Management switches

func (ManagementSwitchType) String

func (mst ManagementSwitchType) String() string

type NCNInterface

type NCNInterface struct {
	InterfaceType string `json:"product" csv:"product"`
	PCIAddress    string `json:"pci-address" csv:"bus info"`
	DeviceName    string `json:"device-name" csv:"logical name"`
	MacAddress    string `json:"mac-address" csv:"serial"`
	IPAddress     string `json:"ip-address" csv:"_"`
	Usage         string `json:"usage" csv:"-"`
}

NCNInterface holds information for all MAC addresses in all NCNs. CSV definitions are the lshw fields

type NCNNetwork

type NCNNetwork struct {
	NetworkName   string `json:"network-name"`
	FullName      string `json:"full-name"`
	IPAddress     string `json:"ip-address"`
	InterfaceName string `json:"net-device"`
	InterfaceMac  string `json:"mac-address"`
	Vlan          int    `json:"vlan"`
	CIDR          string `json:"cidr"`
	Mask          string `json:"mask"`
}

NCNNetwork holds information about networks in the NCN context

type NetworkLayoutConfiguration

type NetworkLayoutConfiguration struct {
	Template                        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                  []CabinetGroupDetail
	CabinetCIDR                     net.IPMask
	ManagementSwitches              []*ManagementSwitch
}

NetworkLayoutConfiguration is the internal configuration structure for shasta networks

func GenDefaultBICANConfig added in v1.9.13

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 added in v1.9.12

func GenDefaultCHNConfig() NetworkLayoutConfiguration

GenDefaultCHNConfig returns the set of defaults for mapping the CHN

func GenDefaultCMNConfig added in v1.8.0

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

func (*NetworkLayoutConfiguration) IsValid

func (nlc *NetworkLayoutConfiguration) IsValid() (bool, error)

IsValid provides feedback about any problems with the configuration

type NewBootstrapNCNMetadata

type NewBootstrapNCNMetadata struct {
	Xname        string `json:"xname" csv:"Xname"`
	Role         string `json:"role" csv:"Role"`
	Subrole      string `json:"subrole" csv:"Subrole"`
	BmcMac       string `json:"bmc-mac" csv:"BMC MAC"`
	BootstrapMac string `json:"bootstrap-mac" csv:"Bootstrap MAC"`
	Bond0Mac0    string `json:"bond0-mac0" csv:"Bond0 MAC0"`
	Bond0Mac1    string `json:"bond0-mac1" csv:"Bond0 MAC1"`
}

NewBootstrapNCNMetadata is a type that matches the updated ncn_metadata.csv file as Xname,Role,Subrole,BMC MAC,Bootstrap MAC,Bond0 MAC0,Bond0 Mac1 It is probable that on many machines bootstrap mac will be the same as one of the bond macs Do not be alarmed.

type PinnedReservation

type PinnedReservation struct {
	IPByte  uint8
	Aliases []string
}

PinnedReservation is a simple struct to work with our abomination of a PinnedMetalLBReservations

type SLSCabinetTemplate added in v1.21.0

type SLSCabinetTemplate struct {
	Xname           xnames.Cabinet
	Model           string
	Class           sls_common.CabinetType
	CabinetNetworks map[string]map[string]sls_common.CabinetNetworks

	LiquidCooledChassisList []int
	AirCooledChassisList    []int
}

SLSCabinetTemplate Should this be merged with Cabinet detail?

type SLSGeneratorApplicationNodeConfig

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

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

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

func (*SLSGeneratorApplicationNodeConfig) Normalize

func (applicationNodeConfig *SLSGeneratorApplicationNodeConfig) Normalize() error

Normalize the values of the SLSGeneratorApplicationNodeConfig structure

func (*SLSGeneratorApplicationNodeConfig) Validate

func (applicationNodeConfig *SLSGeneratorApplicationNodeConfig) Validate() error

Validate SLSGeneratorApplicationNodeConfig contents

type SLSGeneratorInputState

type SLSGeneratorInputState struct {
	ApplicationNodeConfig SLSGeneratorApplicationNodeConfig `json:"ApplicationNodeConfig"`

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

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

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

type SLSStateGenerator

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

SLSStateGenerator is a utility that can take an SLSGeneratorInputState to create a valid SLSState

func NewSLSStateGenerator

func NewSLSStateGenerator(logger *zap.Logger, inputState SLSGeneratorInputState, hmnRows []shcd_parser.HMNRow) SLSStateGenerator

NewSLSStateGenerator create a new instances of the state generator

func (*SLSStateGenerator) GenerateSLSState

func (g *SLSStateGenerator) GenerateSLSState() sls_common.SLSState

GenerateSLSState will generate the SLSState

type SystemConfig

type SystemConfig struct {
	SystemName      string `form:"system-name" mapstructure:"system-name"`
	SiteDomain      string `form:"site-domain" mapstructure:"site-domain"`
	Install         InstallConfig
	Cabinets        int16    `form:"cabinets" mapstructure:"cabinets"`
	StartingCabinet int16    `form:"starting-cabinet" mapstructure:"starting-cabinet"`
	StartingNID     int      `form:"starting-NID" mapstructure:"starting-NID"`
	NtpPools        []string `form:"ntp-pools" mapstructure:"ntp-pools"`
	NtpServers      []string `form:"ntp-servers" mapstructure:"ntp-servers"`
	NtpPeers        []string `form:"ntp-peers" mapstructure:"ntp-peers"`
	NtpAllow        []string `form:"ntp-allow" mapstructure:"ntp-allow"`
	NtpTimezone     string   `form:"ntp-timezone" mapstructure:"ntp-timezone"`
	IPV4Resolvers   []string `form:"ipv4-resolvers" mapstructure:"ipv4-resolvers"`
	V2Registry      string   `form:"v2-registry" mapstructure:"v2-registry"`
	RpmRegistry     string   `form:"rpm-repository" mapstructure:"rpm-repository"`
	NMNCidr         string   `form:"nmn-cidr" mapstructure:"nmn-cidr"`
	HMNCidr         string   `form:"hmn-cidr" mapstructure:"hmn-cidr"`
	CMNCidr         string   `form:"cmn-cidr" mapstructure:"cmn-cidr"`
	CANCidr         string   `form:"can-cidr" mapstructure:"can-cidr"`
	MTLCidr         string   `form:"mtl-cidr" mapstructure:"mtl-cidr"`
	HSNCidr         string   `form:"hsn-cidr" mapstructure:"hsn-cidr"`
}

SystemConfig stores the overall set of system configuration parameters

Jump to

Keyboard shortcuts

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