models

package
v0.0.0-...-3e46740 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArpEntry

type ArpEntry struct {
	// SwitchPort Name of the switch port interface
	SwitchPort string

	// MacAddresses List of mac addresses seen on the switch port
	MacAddresses []MacAddress
}

type HardwareInfo

type HardwareInfo struct {
	Hostname string
	Vendor   string
	Model    string

	FirmwareVersion string
	Serial          string
}

type Interface

type Interface struct {
	Name        string
	Description string
	Type        InterfaceType
	Enabled     bool

	MTU   uint32 // in bytes
	Speed uint32 // in Kbit/s

	Mode       InterfaceMode
	MacAddress MacAddress

	UntaggedVLAN *int32
	TaggedVLANs  []int32

	LagInterfaces []string
	IPAddresses   []string

	Management bool
}

func (*Interface) Differs

func (i *Interface) Differs(u *UpdateInterface) bool

Differs returns true if the interface differs from the update interface. Every field will be checked for differences, except for the name.

type InterfaceMode

type InterfaceMode string
const (
	InterfaceModeAccess InterfaceMode = "access"
	InterfaceModeTrunk  InterfaceMode = "trunk"
)

type InterfaceType

type InterfaceType string

InterfaceType possible values are virtual, lag, 100base-tx, 1000base-t, 2.5gbase-t, 5gbase-t, 10gbase-t 10gbase-cx4, 1000base-x-gbic, 1000base-x-sfp, 10gbase-x-sfpp, 10gbase-x-xfp, 10gbase-x-xenpak, 10gbase-x-x2, 25gbase-x-sfp28, 50gbase-x-sfp56, 40gbase-x-qsfpp, 50gbase-x-sfp28, 100gbase-x-cfp, 100gbase-x-cfp2, 200gbase-x-cfp2, 100gbase-x-cfp4, 100gbase-x-cpak, 100gbase-x-qsfp28, 200gbase-x-qsfp56, 400gbase-x-qsfpdd, 400gbase-x-osfp, ieee802.11a, ieee802.11g, ieee802.11n, ieee802.11ac, ieee802.11ad, ieee802.11ax, gsm, cdma, lte, sonet-oc3, sonet-oc12, sonet-oc48, sonet-oc192, sonet-oc768, sonet-oc1920, sonet-oc3840, 1gfc-sfp, 2gfc-sfp, 4gfc-sfp, 8gfc-sfpp, 16gfc-sfpp, 32gfc-sfp28, 64gfc-qsfpp, 128gfc-sfp28, infiniband-sdr, infiniband-ddr, infiniband-qdr, infiniband-fdr10, infiniband-fdr, infiniband-edr, infiniband-hdr, infiniband-ndr, infiniband-xdr, t1, e1, t3, e3, cisco-stackwise, cisco-stackwise-plus, cisco-flexstack, cisco-flexstack-plus, juniper-vcp, extreme-summitstack, extreme-summitstack-128, extreme-summitstack-256, extreme-summitstack-512, other

const (
	InterfaceTypeVirtual     InterfaceType = "virtual"
	InterfaceTypeLAG         InterfaceType = "lag"
	InterfaceType1GE         InterfaceType = "1000base-t"
	InterfaceType10GE        InterfaceType = "10gbase-t"
	InterfaceType10GSFPPlus  InterfaceType = "10gbase-x-sfpp"
	InterfaceType40QGSFPPlus InterfaceType = "40gbase-x-qsfpp"
)

func (InterfaceType) Valid

func (t InterfaceType) Valid() bool

Valid returns true if the interface type is valid. This is used for validation of the interface type in the API. The SFP+ interface types are not valid.

type LLDPNeighbor

type LLDPNeighbor struct {
	LocalInterface string
	RemoteHostname string
}

type MacAddress

type MacAddress string

MacAddress is a custom type for MAC addresses. It implements the Stringer interface, so it can be used as a string. It also implements the Valid() method, which checks if the MAC address is valid.

func (MacAddress) String

func (m MacAddress) String() string

String returns the MAC address as a string. First, we try to parse the MAC address, and if that fails, we return the original string.

func (MacAddress) Valid

func (m MacAddress) Valid() bool

Valid checks if the MAC address is a valid MAC address.

type UpdateInterface

type UpdateInterface struct {
	Name string

	Description *string
	Enabled     *bool

	MTU *uint32

	UntaggedVLAN *int32
	TaggedVLANs  []int32
}

func (*UpdateInterface) Disabled

func (u *UpdateInterface) Disabled() bool

Disabled returns true if the interface should be disabled. This is the case if the Enabled field is set to false. If the Enabled field is nil, the interface should be .

func (*UpdateInterface) Fill

func (u *UpdateInterface) Fill(i *Interface)

func (*UpdateInterface) Template

func (u *UpdateInterface) Template(template string) (bytes.Buffer, error)

Template returns the a templated buffer for the interface, given by the template string. The template string should be a valid Go template. The template will be executed with the UpdateInterface as the data.

Jump to

Keyboard shortcuts

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