shcd

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 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"`
	DestinationLocation string `json:"DestinationLocation"`
	DestinationPort     string `json:"DestinationPort"`
}

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

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"`
}

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

type Switch

type Switch struct {
	Xname string
	Type  string
	Brand 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