Documentation
¶
Index ¶
- Constants
- Variables
- func AddrsFrom(prefixes ...netip.Prefix) iter.Seq[netip.Prefix]
- func Build(ctx context.Context, workDir, cacheDir string, opts BuildOpts) error
- func CheckStaleVMs(ctx context.Context, kill bool) ([]int32, error)
- func CollectN[E any](n int, seq iter.Seq[E]) []E
- func DoSwitchPower(ctx context.Context, workDir, cacheDir string, opts SwitchPowerOpts) error
- func DoSwitchReinstall(ctx context.Context, workDir, cacheDir string, opts SwitchReinstallOpts) error
- func DoVLABSSH(ctx context.Context, workDir, cacheDir, name string, args []string) error
- func DoVLABSerial(ctx context.Context, workDir, cacheDir, name string, args []string) error
- func DoVLABSerialLog(ctx context.Context, workDir, cacheDir, name string, args []string) error
- func DoVLABSetupPeerings(ctx context.Context, workDir, cacheDir string, opts SetupPeeringsOpts) error
- func DoVLABSetupVPCs(ctx context.Context, workDir, cacheDir string, opts SetupVPCsOpts) error
- func DoVLABTestConnectivity(ctx context.Context, workDir, cacheDir string, opts TestConnectivityOpts) error
- func Init(ctx context.Context, c InitConfig) error
- func PreparePassthrough(_ context.Context, devs []string) error
- func PrepareTaps(_ context.Context, count int) error
- func SubPrefixesFrom(bits int, prefixes ...netip.Prefix) iter.Seq[netip.Prefix]
- func VLABGenerate(ctx context.Context, workDir, cacheDir string, builder VLABBuilder, ...) error
- func VLABUp(ctx context.Context, workDir, cacheDir string, opts VLABUpOpts) error
- func VLANsFrom(ranges ...meta.VLANRange) iter.Seq[uint16]
- func Validate(ctx context.Context, workDir, cacheDir string, hMode HydrateMode) error
- func Versions(ctx context.Context, workDir, cacheDir string, hMode HydrateMode) error
- type BuildOpts
- type Config
- func (c *Config) PrepareVLAB(ctx context.Context, opts VLABUpOpts) (*VLAB, error)
- func (c *Config) SetupPeerings(ctx context.Context, vlab *VLAB, opts SetupPeeringsOpts) error
- func (c *Config) SetupVPCs(ctx context.Context, vlab *VLAB, opts SetupVPCsOpts) error
- func (c *Config) TestConnectivity(ctx context.Context, vlab *VLAB, opts TestConnectivityOpts) error
- func (c *Config) VLABAccess(ctx context.Context, vlab *VLAB, t VLABAccessType, name string, ...) error
- func (c *Config) VLABRun(ctx context.Context, vlab *VLAB, opts VLABRunOpts) error
- func (c *Config) VLABSwitchPower(ctx context.Context, opts SwitchPowerOpts) error
- func (c *Config) VLABSwitchReinstall(ctx context.Context, opts SwitchReinstallOpts) error
- type HydrateMode
- type HydrationStatus
- type InitConfig
- type OnReady
- type RegistryConfig
- type SetupPeeringsOpts
- type SetupVPCsOpts
- type SwitchPowerOpts
- type SwitchReinstallMode
- type SwitchReinstallOpts
- type TestConnectivityOpts
- type VLAB
- type VLABAccessInfo
- type VLABAccessType
- type VLABBuilder
- type VLABConfig
- type VLABRunOpts
- type VLABUpOpts
- type VM
- type VMConfig
- type VMSize
- type VMSizes
- type VMType
Constants ¶
View Source
const ( RegistryConfigFile = ".registry.yaml" FabConfigFile = "fab.yaml" IncludeDir = "include" ResultDir = "result" DefaultRepo = "ghcr.io" DefaultPrefix = "githedgehog" YAMLExt = ".yaml" )
View Source
const ( ServerNamePrefix = "server-" VSIPerfSpeed = 1 )
View Source
const ( VLABDir = "vlab" VLABConfigFile = "config.yaml" VLABSSHKeyFile = "sshkey" VLABVMsDir = "vms" VLABSwitchMACTmpl = "0c:20:12:ff:%02x:00" VLABMACTmpl = "0c:20:12:fe:%02x:%02x" HHFabCfgPrefix = ".hhfab.githedgehog.com" HHFabCfgType = "type" + HHFabCfgPrefix HHFabCfgTypeHW = "hw" HHFabCfgLinkPrefix = "link" + HHFabCfgPrefix + "/" HHFabCfgPCIPrefix = "pci@" )
View Source
const ( VLABPCIBridgePrefix = "pcibr" VLABNICsPerPCIBridge = 32 VLABPCIBridges = 2 VLABMaxNICs = VLABNICsPerPCIBridge * VLABPCIBridges VLABBaseSSHPort = 22000 VLABBaseDirectPort = 22100 VLABTapPrefix = "hhtap" VLABBridge = "hhbr" VLABUUIDPrefix = "77924ab4-a93b-41d4-928e-" VLABUUIDTmpl = VLABUUIDPrefix + "%012d" )
View Source
const ( NICTypeSep = ":" NICTypeNoop = "noop" NICTypeUsernet = "usernet" NICTypeManagement = "management" NICTypeDirect = "direct" NICTypePassthrough = "passthrough" )
View Source
const ( VLABOSImageFile = "os.img" VLABEFICodeFile = "efi_code.fd" VLABEFIVarsFile = "efi_vars.fd" VLABUSBImageFile = "usb.img" VLABISOImageFile = "usb.iso" VLABSerialLog = "serial.log" VLABSerialSock = "serial.sock" VLABMonSock = "mon.sock" VLABQMPSock = "qmp.sock" VLABCmdSudo = "sudo" VLABCmdQemuImg = "qemu-img" VLABCmdQemuSystem = "qemu-system-x86_64" VLABCmdSocat = "socat" VLABCmdSSH = "ssh" VLABCmdLess = "less" VLABCmdExpect = "expect" VLABIgnition = "ignition.json" VLABKubeConfig = "kubeconfig" VLABEnvPDUUsername = "HHFAB_VLAB_PDU_USERNAME" VLABEnvPDUPassword = "HHFAB_VLAB_PDU_PASSWORD" //nolint:gosec )
View Source
const (
DefaultVLABGeneratedFile = "vlab.generated.yaml"
)
Variables ¶
View Source
var ( ErrExist = fmt.Errorf("already exists") ErrNotExist = fmt.Errorf("does not exist") ErrNotDir = fmt.Errorf("not a directory") )
View Source
var ( ErrConsole = errors.New("Connection to console failed") ErrLogin = errors.New("Login to switch failed") ErrInstall = errors.New("OS Install failed") ErrHHFab = errors.New("hhfab vlab serial failed") ErrUnknown = errors.New("Unknown expect error") )
View Source
var AllOnReady = []OnReady{ OnReadyExit, OnReadySetupVPCs, OnReadySwitchReinstall, OnReadyTestConnectivity, }
View Source
var DefaultSizes = VMSizes{ Control: VMSize{CPU: 6, RAM: 6144, Disk: 100}, Switch: VMSize{CPU: 4, RAM: 5120, Disk: 50}, Server: VMSize{CPU: 2, RAM: 768, Disk: 10}, }
View Source
var ErrExit = fmt.Errorf("exit")
View Source
var HydrateModes = []HydrateMode{ HydrateModeNever, HydrateModeIfNotPresent, HydrateModeOverride, }
View Source
var NICTypes = []string{ NICTypeNoop, NICTypeUsernet, NICTypeManagement, NICTypeDirect, NICTypePassthrough, }
View Source
var ReinstallModes = []SwitchReinstallMode{ ReinstallModeReboot, ReinstallModeHardReset, }
View Source
var SSHQuietFlags = []string{
"-o", "GlobalKnownHostsFile=/dev/null",
"-o", "UserKnownHostsFile=/dev/null",
"-o", "StrictHostKeyChecking=no",
"-o", "LogLevel=ERROR",
}
View Source
var VLABCmds = []string{ VLABCmdSudo, VLABCmdQemuImg, VLABCmdQemuSystem, VLABCmdSocat, VLABCmdSSH, VLABCmdLess, }
View Source
var VMTypes = []VMType{ VMTypeControl, VMTypeSwitch, VMTypeServer, }
Functions ¶
func DoSwitchPower ¶ added in v0.33.0
func DoSwitchPower(ctx context.Context, workDir, cacheDir string, opts SwitchPowerOpts) error
func DoSwitchReinstall ¶ added in v0.33.0
func DoSwitchReinstall(ctx context.Context, workDir, cacheDir string, opts SwitchReinstallOpts) error
func DoVLABSerial ¶
func DoVLABSerialLog ¶
func DoVLABSetupPeerings ¶
func DoVLABSetupPeerings(ctx context.Context, workDir, cacheDir string, opts SetupPeeringsOpts) error
func DoVLABSetupVPCs ¶
func DoVLABSetupVPCs(ctx context.Context, workDir, cacheDir string, opts SetupVPCsOpts) error
func DoVLABTestConnectivity ¶
func DoVLABTestConnectivity(ctx context.Context, workDir, cacheDir string, opts TestConnectivityOpts) error
func SubPrefixesFrom ¶
func VLABGenerate ¶
Types ¶
type BuildOpts ¶
type BuildOpts struct { HydrateMode HydrateMode BuildMode recipe.BuildMode }
type Config ¶
type Config struct { WorkDir string CacheDir string RegistryConfig Fab fabapi.Fabricator Controls []fabapi.ControlNode Wiring client.Reader }
func (*Config) PrepareVLAB ¶
func (*Config) SetupPeerings ¶
func (*Config) TestConnectivity ¶
func (*Config) VLABAccess ¶
func (*Config) VLABSwitchPower ¶ added in v0.33.0
func (c *Config) VLABSwitchPower(ctx context.Context, opts SwitchPowerOpts) error
func (*Config) VLABSwitchReinstall ¶ added in v0.33.0
func (c *Config) VLABSwitchReinstall(ctx context.Context, opts SwitchReinstallOpts) error
type HydrateMode ¶
type HydrateMode string
const ( HydrateModeNever HydrateMode = "never" HydrateModeIfNotPresent HydrateMode = "if-not-present" HydrateModeOverride HydrateMode = "override" )
type HydrationStatus ¶
type HydrationStatus string
const ( HydrationStatusNone HydrationStatus = "none" HydrationStatusPartial HydrationStatus = "partial" HydrationStatusFull HydrationStatus = "full" )
type InitConfig ¶
type RegistryConfig ¶
type SetupPeeringsOpts ¶
type SetupVPCsOpts ¶
type SwitchPowerOpts ¶ added in v0.33.0
type SwitchReinstallMode ¶ added in v0.33.0
type SwitchReinstallMode string
const ( ReinstallModeReboot SwitchReinstallMode = "reboot" ReinstallModeHardReset SwitchReinstallMode = "hard-reset" )
type SwitchReinstallOpts ¶ added in v0.33.0
type SwitchReinstallOpts struct { Switches []string // All switches if empty Mode SwitchReinstallMode // "reboot" or "hard-reset" SwitchUsername string // Username for switch access (reboot mode only ) SwitchPassword string // Password for switch access (reboot mode only) PDUUsername string // (hard-reset mode only) PDUPassword string // (hard-reset mode only) WaitReady bool // Wait for the switch to be ready }
type TestConnectivityOpts ¶
type VLABAccessInfo ¶
type VLABAccessType ¶
type VLABAccessType string
const ( VLABAccessSSH VLABAccessType = "ssh" VLABAccessSerial VLABAccessType = "serial" VLABAccessSerialLog VLABAccessType = "serial log" )
type VLABBuilder ¶
type VLABBuilder struct { SpinesCount uint8 // number of spines to generate FabricLinksCount uint8 // number of links for each spine <> leaf pair MCLAGLeafsCount uint8 // number of MCLAG server-leafs to generate ESLAGLeafGroups string // eslag leaf groups - comma separated list of number of ESLAG switches in each group, should be 2-4 per group, e.g. 2,4,2 for 3 groups with 2, 4 and 2 switches OrphanLeafsCount uint8 // number of non-MCLAG server-leafs to generate MCLAGSessionLinks uint8 // number of MCLAG session links to generate MCLAGPeerLinks uint8 // number of MCLAG peer links to generate VPCLoopbacks uint8 // number of VPC loopbacks to generate per leaf switch MCLAGServers uint8 // number of MCLAG servers to generate for MCLAG switches ESLAGServers uint8 // number of ESLAG servers to generate for ESLAG switches UnbundledServers uint8 // number of unbundled servers to generate for switches (only for one of the first switch in the redundancy group or orphan switch) BundledServers uint8 // number of bundled servers to generate for switches (only for one of the second switch in the redundancy group or orphan switch) NoSwitches bool // do not generate any switches // contains filtered or unexported fields }
func (*VLABBuilder) Build ¶
func (b *VLABBuilder) Build(ctx context.Context, l *apiutil.Loader, fabricMode meta.FabricMode) error
type VLABConfig ¶
type VLABRunOpts ¶
type VLABUpOpts ¶
type VLABUpOpts struct { HydrateMode HydrateMode NoCreate bool ReCreate bool BuildMode recipe.BuildMode VLABRunOpts }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.