network

package
v0.13.6 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LLDPTxInterval is set to 10 seconds in /etc/lldpd.d/tx-interval.conf on each leaf.
	LLDPTxInterval = 15 * time.Second

	// LLDPTxIntervalTimeout is set to double of tx-interval of lldpd on the switch side.
	// This ensures we get all lldp pdu`s.
	// We add 2 seconds to be on the save side.
	LLDPTxIntervalTimeout = (2 * LLDPTxInterval) + 2
)
View Source
const MTU = 9000

We expect to have storage and MTU of 9000 supports efficient transmission. In our clos topology MTU 9000 (non vxlan)/9216 (vxlan) is status quo.

Variables

This section is empty.

Functions

func Interfaces

func Interfaces() []string

Interfaces return a list of all known interfaces.

func InternalIP

func InternalIP() string

InternalIP returns the first ipv4 ip of an eth* interface.

func NtpDate

func NtpDate(log *slog.Logger, ntpServers []string)

NtpDate set the system time to the time coming from a ntp source

Types

type Ethtool

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

Ethtool to query/set ethernet interfaces

func NewEthtool

func NewEthtool(log *slog.Logger) *Ethtool

NewEthtool create a new Ethtool with the default command

func (*Ethtool) Run

func (e *Ethtool) Run(args ...string) (string, error)

Run execute ethtool

type Host

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

Host collects lldp neighbor information's.

type LLDPClient

type LLDPClient struct {
	Host *Host
	// contains filtered or unexported fields
}

LLDPClient act as a small wrapper about low level lldp primitives.

func NewLLDPClient

func NewLLDPClient(log *slog.Logger, interfaces []string, minimumInterfaces, minimumNeighbors int, timeout time.Duration) *LLDPClient

NewLLDPClient create a lldp client.

func (*LLDPClient) Start

func (l *LLDPClient) Start()

Start starts lldpd for neighbor discovery.

type Network

type Network struct {
	IPAddress   string
	Started     time.Time
	MachineUUID string
	LLDPClient  *LLDPClient
	Eth0Mac     string // this mac is used to calculate the IPMI Port offset in the metal-lab environment.
	Log         *slog.Logger
}

Network provides networking operations.

func (*Network) Neighbors

func (n *Network) Neighbors(name string) (neighbors []*v1.MachineNic, err error)

Neighbors of a interface, detected via ip neighbor detection

func (*Network) UpAllInterfaces

func (n *Network) UpAllInterfaces() error

UpAllInterfaces set all available eth* interfaces up to ensure they do ipv6 link local autoconfiguration and therefore neighbor discovery, which is required to make all local mac's visible on the switch side.

Jump to

Keyboard shortcuts

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