linux_interfaces

package
v3.3.0-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: Apache-2.0 Imports: 10 Imported by: 19

Documentation

Index

Constants

View Source
const (

	// InterfaceHostNameKeyPrefix is the common prefix of all keys representing
	// existing Linux interfaces in the default namespace (referenced by host names).
	InterfaceHostNameKeyPrefix = "linux/interface/host-name/"

	// InterfaceStateKeyPrefix is used as a common prefix for keys derived from
	// interfaces to represent the interface admin state (up/down).
	InterfaceStateKeyPrefix = "linux/interface/state/"
)
View Source
const (
	// InvalidKeyPart is used in key for parts which are invalid
	InvalidKeyPart = "<invalid>"
)
View Source
const ModuleName = "linux.interfaces"

ModuleName is the module name used for models.

Variables

View Source
var (
	Interface_Type_name = map[int32]string{
		0: "UNDEFINED",
		1: "VETH",
		2: "TAP_TO_VPP",
		3: "LOOPBACK",
		4: "EXISTING",
		5: "VRF_DEVICE",
	}
	Interface_Type_value = map[string]int32{
		"UNDEFINED":  0,
		"VETH":       1,
		"TAP_TO_VPP": 2,
		"LOOPBACK":   3,
		"EXISTING":   4,
		"VRF_DEVICE": 5,
	}
)

Enum value maps for Interface_Type.

View Source
var (
	VethLink_ChecksumOffloading_name = map[int32]string{
		0: "CHKSM_OFFLOAD_DEFAULT",
		1: "CHKSM_OFFLOAD_ENABLED",
		2: "CHKSM_OFFLOAD_DISABLED",
	}
	VethLink_ChecksumOffloading_value = map[string]int32{
		"CHKSM_OFFLOAD_DEFAULT":  0,
		"CHKSM_OFFLOAD_ENABLED":  1,
		"CHKSM_OFFLOAD_DISABLED": 2,
	}
)

Enum value maps for VethLink_ChecksumOffloading.

View Source
var File_ligato_linux_interfaces_interface_proto protoreflect.FileDescriptor
View Source
var (
	ModelInterface = models.Register(&Interface{}, models.Spec{
		Module:  ModuleName,
		Version: "v2",
		Type:    "interface",
	})
)

Functions

func InterfaceAddressKey

func InterfaceAddressKey(iface, address, vrf string, source netalloc.IPAddressSource) string

InterfaceAddressKey returns key representing IP address assigned to Linux interface. With undefined vrf the returned key can be also used as a key prefix, matching derived interface address key regardless of the VRF to which it belongs.

func InterfaceAddressPrefix

func InterfaceAddressPrefix(iface string) string

InterfaceAddressPrefix returns longest-common prefix of keys representing assigned IP addresses to a specific Linux interface.

func InterfaceHostNameKey

func InterfaceHostNameKey(hostName string) string

InterfaceHostNameKey returns key representing Linux interface host name.

func InterfaceKey

func InterfaceKey(name string) string

InterfaceKey returns the key used in ETCD to store configuration of a particular Linux interface.

func InterfaceStateKey

func InterfaceStateKey(ifName string, ifIsUp bool) string

InterfaceStateKey returns key representing admin state of a Linux interface.

func InterfaceVrfKey added in v3.2.0

func InterfaceVrfKey(iface, vrf string) string

InterfaceVrfKey returns key representing assignment of a Linux interface into a VRF.

func ParseInterfaceAddressKey

func ParseInterfaceAddressKey(key string) (iface, address, vrf string, source netalloc.IPAddressSource, invalidKey, isAddrKey bool)

ParseInterfaceAddressKey parses interface address from key derived from interface by InterfaceAddressKey().

func ParseInterfaceStateKey

func ParseInterfaceStateKey(key string) (ifName string, ifIsUp bool, isStateKey bool)

ParseInterfaceStateKey parses interface name and state from key derived from interface by InterfaceStateKey().

func ParseInterfaceVrfKey added in v3.2.0

func ParseInterfaceVrfKey(key string) (iface, vrf string, invalidKey, isVrfKey bool)

ParseInterfaceVrfKey parses interface VRF from key derived from interface by InterfaceVrfKey().

Types

type Interface

type Interface struct {

	// Name is mandatory field representing logical name for the interface.
	// It must be unique across all configured interfaces.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Type represents the type of interface and It must match with actual Link.
	Type Interface_Type `protobuf:"varint,2,opt,name=type,proto3,enum=ligato.linux.interfaces.Interface_Type" json:"type,omitempty"`
	// Namespace is a reference to a Linux network namespace where the interface
	// should be put into.
	Namespace *namespace.NetNamespace `protobuf:"bytes,3,opt,name=namespace,proto3" json:"namespace,omitempty"`
	// Name of the interface in the host OS. If not set, the host name will be
	// the same as the interface logical name.
	HostIfName string `protobuf:"bytes,4,opt,name=host_if_name,json=hostIfName,proto3" json:"host_if_name,omitempty"`
	// Enabled controls if the interface should be UP.
	Enabled bool `protobuf:"varint,5,opt,name=enabled,proto3" json:"enabled,omitempty"`
	// IPAddresses define list of IP addresses for the interface and must be
	// defined in the following format: <ipAddress>/<ipPrefix>.
	// Interface IP address can be also allocated via netalloc plugin and
	// referenced here, see: api/models/netalloc/netalloc.proto
	IpAddresses []string `protobuf:"bytes,6,rep,name=ip_addresses,json=ipAddresses,proto3" json:"ip_addresses,omitempty"`
	// PhysAddress represents physical address (MAC) of the interface.
	// Random address will be assigned if left empty.
	// Not used (and not supported) by VRF devices.
	PhysAddress string `protobuf:"bytes,7,opt,name=phys_address,json=physAddress,proto3" json:"phys_address,omitempty"`
	// MTU is the maximum transmission unit value.
	Mtu uint32 `protobuf:"varint,8,opt,name=mtu,proto3" json:"mtu,omitempty"`
	// Types that are assignable to Link:
	//	*Interface_Veth
	//	*Interface_Tap
	//	*Interface_VrfDev
	Link isInterface_Link `protobuf_oneof:"link"`
	// Configure/Resync link only. IP/MAC addresses are expected to be configured
	// externally - i.e. by a different agent or manually via CLI.
	LinkOnly bool `protobuf:"varint,9,opt,name=link_only,json=linkOnly,proto3" json:"link_only,omitempty"`
	// Reference to the logical name of a VRF_DEVICE interface.
	// If defined, this interface will be enslaved to the VRF device and will thus become
	// part of the VRF (L3-level separation) that the device represents.
	// Interfaces enslaved to the same VRF_DEVICE master interface therefore
	// comprise single VRF with a separate routing table.
	VrfMasterInterface string `protobuf:"bytes,10,opt,name=vrf_master_interface,json=vrfMasterInterface,proto3" json:"vrf_master_interface,omitempty"`
	// contains filtered or unexported fields
}

func (*Interface) Descriptor deprecated

func (*Interface) Descriptor() ([]byte, []int)

Deprecated: Use Interface.ProtoReflect.Descriptor instead.

func (*Interface) GetEnabled

func (x *Interface) GetEnabled() bool

func (*Interface) GetHostIfName

func (x *Interface) GetHostIfName() string

func (*Interface) GetIpAddresses

func (x *Interface) GetIpAddresses() []string
func (m *Interface) GetLink() isInterface_Link

func (*Interface) GetLinkOnly

func (x *Interface) GetLinkOnly() bool

func (*Interface) GetMtu

func (x *Interface) GetMtu() uint32

func (*Interface) GetName

func (x *Interface) GetName() string

func (*Interface) GetNamespace

func (x *Interface) GetNamespace() *namespace.NetNamespace

func (*Interface) GetPhysAddress

func (x *Interface) GetPhysAddress() string

func (*Interface) GetTap

func (x *Interface) GetTap() *TapLink

func (*Interface) GetType

func (x *Interface) GetType() Interface_Type

func (*Interface) GetVeth

func (x *Interface) GetVeth() *VethLink

func (*Interface) GetVrfDev added in v3.2.0

func (x *Interface) GetVrfDev() *VrfDevLink

func (*Interface) GetVrfMasterInterface added in v3.2.0

func (x *Interface) GetVrfMasterInterface() string

func (*Interface) MarshalJSON

func (m *Interface) MarshalJSON() ([]byte, error)

MarshalJSON ensures that field of type 'oneOf' is correctly marshaled by using protobuf json marshaller

func (*Interface) ProtoMessage

func (*Interface) ProtoMessage()

func (*Interface) ProtoReflect added in v3.2.0

func (x *Interface) ProtoReflect() protoreflect.Message

func (*Interface) Reset

func (x *Interface) Reset()

func (*Interface) String

func (x *Interface) String() string

func (*Interface) UnmarshalJSON

func (m *Interface) UnmarshalJSON(data []byte) error

UnmarshalJSON ensures that field of type 'oneOf' is correctly unmarshaled

type Interface_Tap

type Interface_Tap struct {
	// TAP_TO_VPP-specific configuration
	Tap *TapLink `protobuf:"bytes,21,opt,name=tap,proto3,oneof"`
}

type Interface_Type

type Interface_Type int32
const (
	Interface_UNDEFINED  Interface_Type = 0
	Interface_VETH       Interface_Type = 1
	Interface_TAP_TO_VPP Interface_Type = 2 // TAP created by VPP to have the Linux-side further configured
	Interface_LOOPBACK   Interface_Type = 3
	Interface_EXISTING   Interface_Type = 4
	// In Linux, VRF is implemented as yet another type of netdevice (i.e. listed with `ip link show`).
	// Network interfaces are then assigned to VRF simply by enslaving them to the VRF device.
	// For more information, visit: https://www.kernel.org/doc/Documentation/networking/vrf.txt
	Interface_VRF_DEVICE Interface_Type = 5
)

func (Interface_Type) Descriptor added in v3.2.0

func (Interface_Type) Enum added in v3.2.0

func (x Interface_Type) Enum() *Interface_Type

func (Interface_Type) EnumDescriptor deprecated

func (Interface_Type) EnumDescriptor() ([]byte, []int)

Deprecated: Use Interface_Type.Descriptor instead.

func (Interface_Type) Number added in v3.2.0

func (Interface_Type) String

func (x Interface_Type) String() string

func (Interface_Type) Type added in v3.2.0

type Interface_Veth

type Interface_Veth struct {
	// VETH-specific configuration
	Veth *VethLink `protobuf:"bytes,20,opt,name=veth,proto3,oneof"`
}

type Interface_VrfDev added in v3.2.0

type Interface_VrfDev struct {
	// VRF_DEVICE-specific configuration
	VrfDev *VrfDevLink `protobuf:"bytes,22,opt,name=vrf_dev,json=vrfDev,proto3,oneof"`
}
type TapLink struct {

	// Logical name of the VPP TAP interface (mandatory for TAP_TO_VPP)
	VppTapIfName string `protobuf:"bytes,1,opt,name=vpp_tap_if_name,json=vppTapIfName,proto3" json:"vpp_tap_if_name,omitempty"`
	// contains filtered or unexported fields
}

func (*TapLink) Descriptor deprecated

func (*TapLink) Descriptor() ([]byte, []int)

Deprecated: Use TapLink.ProtoReflect.Descriptor instead.

func (*TapLink) GetVppTapIfName

func (x *TapLink) GetVppTapIfName() string

func (*TapLink) ProtoMessage

func (*TapLink) ProtoMessage()

func (*TapLink) ProtoReflect added in v3.2.0

func (x *TapLink) ProtoReflect() protoreflect.Message

func (*TapLink) Reset

func (x *TapLink) Reset()

func (*TapLink) String

func (x *TapLink) String() string
type VethLink struct {

	// Name of the VETH peer, i.e. other end of the linux veth (mandatory for VETH)
	PeerIfName string `protobuf:"bytes,1,opt,name=peer_if_name,json=peerIfName,proto3" json:"peer_if_name,omitempty"`
	// Checksum offloading - Rx side (enabled by default)
	RxChecksumOffloading VethLink_ChecksumOffloading `` /* 181-byte string literal not displayed */
	// Checksum offloading - Tx side (enabled by default)
	TxChecksumOffloading VethLink_ChecksumOffloading `` /* 181-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*VethLink) Descriptor deprecated

func (*VethLink) Descriptor() ([]byte, []int)

Deprecated: Use VethLink.ProtoReflect.Descriptor instead.

func (*VethLink) GetPeerIfName

func (x *VethLink) GetPeerIfName() string

func (*VethLink) GetRxChecksumOffloading

func (x *VethLink) GetRxChecksumOffloading() VethLink_ChecksumOffloading

func (*VethLink) GetTxChecksumOffloading

func (x *VethLink) GetTxChecksumOffloading() VethLink_ChecksumOffloading

func (*VethLink) ProtoMessage

func (*VethLink) ProtoMessage()

func (*VethLink) ProtoReflect added in v3.2.0

func (x *VethLink) ProtoReflect() protoreflect.Message

func (*VethLink) Reset

func (x *VethLink) Reset()

func (*VethLink) String

func (x *VethLink) String() string
type VethLink_ChecksumOffloading int32
const (
	VethLink_CHKSM_OFFLOAD_DEFAULT  VethLink_ChecksumOffloading = 0
	VethLink_CHKSM_OFFLOAD_ENABLED  VethLink_ChecksumOffloading = 1
	VethLink_CHKSM_OFFLOAD_DISABLED VethLink_ChecksumOffloading = 2
)
func (VethLink_ChecksumOffloading) EnumDescriptor() ([]byte, []int)

Deprecated: Use VethLink_ChecksumOffloading.Descriptor instead.

type VrfDevLink struct {

	// Routing table associated with the VRF.
	// Table ID is an 8-bit unsigned integer value. Please note that 253, 254 and 255 are reserved values
	// for special routing tables (main, default, local).
	// Multiple VRFs inside the same network namespace should each use a different routing table.
	// For more information, visit: http://linux-ip.net/html/routing-tables.html
	RoutingTable uint32 `protobuf:"varint,1,opt,name=routing_table,json=routingTable,proto3" json:"routing_table,omitempty"`
	// contains filtered or unexported fields
}

func (*VrfDevLink) Descriptor deprecated added in v3.2.0

func (*VrfDevLink) Descriptor() ([]byte, []int)

Deprecated: Use VrfDevLink.ProtoReflect.Descriptor instead.

func (*VrfDevLink) GetRoutingTable added in v3.2.0

func (x *VrfDevLink) GetRoutingTable() uint32

func (*VrfDevLink) ProtoMessage added in v3.2.0

func (*VrfDevLink) ProtoMessage()

func (*VrfDevLink) ProtoReflect added in v3.2.0

func (x *VrfDevLink) ProtoReflect() protoreflect.Message

func (*VrfDevLink) Reset added in v3.2.0

func (x *VrfDevLink) Reset()

func (*VrfDevLink) String added in v3.2.0

func (x *VrfDevLink) String() string

Jump to

Keyboard shortcuts

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