linux_interfaces

package
v2.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

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",
}
View Source
var Interface_Type_value = map[string]int32{
	"UNDEFINED":  0,
	"VETH":       1,
	"TAP_TO_VPP": 2,
	"LOOPBACK":   3,
	"EXISTING":   4,
}
View Source
var (
	ModelInterface = models.Register(&Interface{}, models.Spec{
		Module:  ModuleName,
		Version: "v2",
		Type:    "interface",
	})
)
View Source
var VethLink_ChecksumOffloading_name = map[int32]string{
	0: "CHKSM_OFFLOAD_DEFAULT",
	1: "CHKSM_OFFLOAD_ENABLED",
	2: "CHKSM_OFFLOAD_DISABLED",
}
View Source
var VethLink_ChecksumOffloading_value = map[string]int32{
	"CHKSM_OFFLOAD_DEFAULT":  0,
	"CHKSM_OFFLOAD_ENABLED":  1,
	"CHKSM_OFFLOAD_DISABLED": 2,
}

Functions

func InterfaceAddressKey

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

InterfaceAddressKey returns key representing IP address assigned to Linux interface.

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 ParseInterfaceAddressKey

func ParseInterfaceAddressKey(key string) (iface, address 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().

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=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.
	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 valid to be assigned to Link:
	//	*Interface_Veth
	//	*Interface_Tap
	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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Interface) Descriptor

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

func (*Interface) GetEnabled

func (m *Interface) GetEnabled() bool

func (*Interface) GetHostIfName

func (m *Interface) GetHostIfName() string

func (*Interface) GetIpAddresses

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

func (*Interface) GetLinkOnly

func (m *Interface) GetLinkOnly() bool

func (*Interface) GetMtu

func (m *Interface) GetMtu() uint32

func (*Interface) GetName

func (m *Interface) GetName() string

func (*Interface) GetNamespace

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

func (*Interface) GetPhysAddress

func (m *Interface) GetPhysAddress() string

func (*Interface) GetTap

func (m *Interface) GetTap() *TapLink

func (*Interface) GetType

func (m *Interface) GetType() Interface_Type

func (*Interface) GetVeth

func (m *Interface) GetVeth() *VethLink

func (*Interface) MarshalJSON

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

MarshalJSON ensures that field of type 'oneOf' is correctly marshaled by using gogo lib marshaller

func (*Interface) ProtoMessage

func (*Interface) ProtoMessage()

func (*Interface) Reset

func (m *Interface) Reset()

func (*Interface) String

func (m *Interface) String() string

func (*Interface) UnmarshalJSON

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

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

func (*Interface) XXX_DiscardUnknown

func (m *Interface) XXX_DiscardUnknown()

func (*Interface) XXX_Marshal

func (m *Interface) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Interface) XXX_Merge

func (m *Interface) XXX_Merge(src proto.Message)

func (*Interface) XXX_MessageName

func (*Interface) XXX_MessageName() string

func (*Interface) XXX_OneofFuncs

func (*Interface) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

func (*Interface) XXX_Size

func (m *Interface) XXX_Size() int

func (*Interface) XXX_Unmarshal

func (m *Interface) XXX_Unmarshal(b []byte) error

type Interface_Tap

type Interface_Tap struct {
	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
	Interface_LOOPBACK   Interface_Type = 3
	Interface_EXISTING   Interface_Type = 4
)

func (Interface_Type) EnumDescriptor

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

func (Interface_Type) String

func (x Interface_Type) String() string

type Interface_Veth

type Interface_Veth struct {
	Veth *VethLink `protobuf:"bytes,20,opt,name=veth,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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*TapLink) Descriptor

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

func (*TapLink) GetVppTapIfName

func (m *TapLink) GetVppTapIfName() string

func (*TapLink) ProtoMessage

func (*TapLink) ProtoMessage()

func (*TapLink) Reset

func (m *TapLink) Reset()

func (*TapLink) String

func (m *TapLink) String() string

func (*TapLink) XXX_DiscardUnknown

func (m *TapLink) XXX_DiscardUnknown()

func (*TapLink) XXX_Marshal

func (m *TapLink) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TapLink) XXX_Merge

func (m *TapLink) XXX_Merge(src proto.Message)

func (*TapLink) XXX_MessageName

func (*TapLink) XXX_MessageName() string

func (*TapLink) XXX_Size

func (m *TapLink) XXX_Size() int

func (*TapLink) XXX_Unmarshal

func (m *TapLink) XXX_Unmarshal(b []byte) error
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 `` /* 174-byte string literal not displayed */
	// Checksum offloading - Tx side (enabled by default)
	TxChecksumOffloading VethLink_ChecksumOffloading `` /* 174-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}                    `json:"-"`
	XXX_unrecognized     []byte                      `json:"-"`
	XXX_sizecache        int32                       `json:"-"`
}

func (*VethLink) Descriptor

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

func (*VethLink) GetPeerIfName

func (m *VethLink) GetPeerIfName() string

func (*VethLink) GetRxChecksumOffloading

func (m *VethLink) GetRxChecksumOffloading() VethLink_ChecksumOffloading

func (*VethLink) GetTxChecksumOffloading

func (m *VethLink) GetTxChecksumOffloading() VethLink_ChecksumOffloading

func (*VethLink) ProtoMessage

func (*VethLink) ProtoMessage()

func (*VethLink) Reset

func (m *VethLink) Reset()

func (*VethLink) String

func (m *VethLink) String() string

func (*VethLink) XXX_DiscardUnknown

func (m *VethLink) XXX_DiscardUnknown()

func (*VethLink) XXX_Marshal

func (m *VethLink) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*VethLink) XXX_Merge

func (m *VethLink) XXX_Merge(src proto.Message)

func (*VethLink) XXX_MessageName

func (*VethLink) XXX_MessageName() string

func (*VethLink) XXX_Size

func (m *VethLink) XXX_Size() int

func (*VethLink) XXX_Unmarshal

func (m *VethLink) XXX_Unmarshal(b []byte) error
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)

Jump to

Keyboard shortcuts

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