shcd

package
v1.32.5 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Prefixes added in v1.20.0

func Prefixes(topology []ID) []string

Prefixes return all application node prefixes for a given topology

Types

type HMNComponent

type HMNComponent struct {
	Source              string `json:"Source"`
	SourceRack          string `json:"SourceRack"`
	SourceLocation      string `json:"SourceLocation"`
	SourceParent        string `json:"SourceParent,omitempty"`
	SourceSubLocation   string `json:"SourceSubLocation,omitempty"`
	DestinationRack     string `json:"DestinationRack,omitempty"`
	DestinationLocation string `json:"DestinationLocation,omitempty"`
	DestinationPort     string `json:"DestinationPort,omitempty"`
}

HMNComponent is an individual component in the HMNConnections slice

type HMNConnections

type HMNConnections []HMNComponent

HMNConnections type is the go equivalent structure of hmn_connections.json

type ID

type ID struct {
	Architecture string   `json:"architecture"`
	CommonName   string   `json:"common_name"`
	ID           int      `json:"id"`
	Location     Location `json:"location"`
	Model        string   `json:"model"`
	Ports        []Port   `json:"ports"`
	Type         string   `json:"type"`
	Vendor       string   `json:"vendor"`
}

The ID type represents all of the information needed for each entry in the array

func FilterByType

func FilterByType(topology []ID, idType string) []ID

FilterByType loop over the topology and return all items found in a give type.

func (ID) GenerateNCNRoleSubrole

func (id ID) GenerateNCNRoleSubrole() (r string, sr string)

GenerateNCNRoleSubrole generates the appropriate role and subrole based on the ncn-* name

func (ID) GenerateSourceName added in v1.20.0

func (id ID) GenerateSourceName() string

GenerateSourceName crafts and prints the switch types that hmn_connections.json expects

func (ID) GenerateSwitchType

func (id ID) GenerateSwitchType() (st string)

GenerateSwitchType crafts and prints the switch types that switch_metadata.csv expects

func (ID) GenerateXname

func (id ID) GenerateXname() (xn string)

GenerateXname crafts and prints the xname of a give ID type in the SHCD

type Location

type Location struct {
	Elevation   string `json:"elevation"`
	Rack        string `json:"rack"`
	Parent      string `json:parent,omitempty`
	SubLocation string `json:sub_location,omitempty`
}

The Location type defines where the server physically exists in the datacenter.

type NCNMetadata

type NCNMetadata []NcnMacs

NCNMetadata type is the go equivalent structure of ncn_metadata.csv

type NcnMacs

type NcnMacs struct {
	Xname        string
	Role         string
	Subrole      string
	BmcMac       string
	BootstrapMac string
	Bond0Mac0    string
	Bond0Mac1    string
}

NcnMacs is a row in ncn_metadata.csv

type Port

type Port struct {
	DestNodeID int    `json:"destination_node_id"`
	DestPort   int    `json:"destination_port"`
	DestSlot   string `json:"destination_slot"`
	Port       int    `json:"port"`
	Slot       string `json:"slot"`
	Speed      int    `json:"speed"`
}

The Port type defines where things are plugged in

type Shcd

type Shcd struct {
	Architecture string `json:"architecture"`
	CanuVersion  string `json:"canu_version"`
	ShcdFile     string `json:"shcd_file"`
	UpdatedAt    string `json:"updated_at"`
	Topology     []ID   `json:"topology"`
}

The Shcd type represents the entire machine-readable SHCD inside a go struct

func NewShcd

func NewShcd(shcdFilePath string) (*Shcd, error)

NewShcd functions reads the shcd file, parses and and returns a new Shcd object with the json file data filled into the struct.

func ParseSHCD

func ParseSHCD(f []byte) (Shcd, error)

ParseSHCD accepts a machine-readable SHCD and produces an Shcd object, which can be used throughout csi It is the golang and csi equivalent of the shcd.json file generated by canu

func (*Shcd) DestCommonName added in v1.27.5

func (s *Shcd) DestCommonName(p Port) (dn string)

DestCommonName returns the name object that is the destination of a specific port

func (*Shcd) DestElevation added in v1.27.5

func (s *Shcd) DestElevation(p Port) (de string)

DestElevation returns the elevation object that is the destination of a specific port

func (*Shcd) DestID added in v1.27.5

func (s *Shcd) DestID(p Port) (id ID)

DestID returns the id object that is the destination of a specific port

func (*Shcd) DestRack added in v1.27.5

func (s *Shcd) DestRack(p Port) string

DestRack returns the rack object that is the destination of a specific port

func (*Shcd) DestSlot added in v1.27.5

func (s *Shcd) DestSlot(p Port) (ds string)

DestSlot returns the slot object that is the destination of a specific port

type Switch

type Switch struct {
	Xname string
	Type  string
	Brand string
	Model string
}

Switch is a row in switch_metadata.csv

type SwitchMetadata

type SwitchMetadata []Switch

SwitchMetadata type is the go equivalent structure of switch_metadata.csv

Jump to

Keyboard shortcuts

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