interfacestore

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ContainerInterface is used to mark current interface is for container
	ContainerInterface InterfaceType = iota
	// GatewayInterface is used to mark current interface is for host gateway
	GatewayInterface
	// TunnelInterface is used to mark current interface is for tunnel port
	TunnelInterface
	// UplinkInterface is used to mark current interface is for uplink port
	UplinkInterface
	// HostInterface is used to mark current interface is for host
	HostInterface
	// TrafficControlInterface is used to mark current interface is for traffic control port
	TrafficControlInterface
	// IPSecTunnelInterface is used to mark current interface is for IPSec tunnel port
	IPSecTunnelInterface

	AntreaInterfaceTypeKey = "antrea-type"
	AntreaGateway          = "gateway"
	AntreaContainer        = "container"
	AntreaTunnel           = "tunnel"
	AntreaUplink           = "uplink"
	AntreaHost             = "host"
	AntreaTrafficControl   = "traffic-control"
	AntreaIPsecTunnel      = "ipsec-tunnel"
	AntreaUnset            = ""
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerInterfaceConfig

type ContainerInterfaceConfig struct {
	ContainerID  string
	PodName      string
	PodNamespace string
}

type InterfaceConfig

type InterfaceConfig struct {
	Type InterfaceType
	// Unique name of the interface, also used for the OVS port name.
	InterfaceName string
	IPs           []net.IP
	MAC           net.HardwareAddr
	// VLAN ID of the interface
	VLANID uint16
	*OVSPortConfig
	*ContainerInterfaceConfig
	*TunnelInterfaceConfig
}

func NewContainerInterface

func NewContainerInterface(
	interfaceName string,
	containerID string,
	podName string,
	podNamespace string,
	mac net.HardwareAddr,
	ips []net.IP,
	vlanID uint16) *InterfaceConfig

NewContainerInterface creates InterfaceConfig for a Pod.

func NewGatewayInterface

func NewGatewayInterface(gatewayName string, gatewayMAC net.HardwareAddr) *InterfaceConfig

NewGatewayInterface creates InterfaceConfig for the host gateway interface.

func NewHostInterface added in v1.5.0

func NewHostInterface(hostInterfaceName string) *InterfaceConfig

func NewIPSecTunnelInterface

func NewIPSecTunnelInterface(interfaceName string, tunnelType ovsconfig.TunnelType, nodeName string, nodeIP net.IP, psk, remoteName string) *InterfaceConfig

NewIPSecTunnelInterface creates InterfaceConfig for the IPsec tunnel to the Node.

func NewTrafficControlInterface added in v1.7.0

func NewTrafficControlInterface(interfaceName string, ovsPortConfig *OVSPortConfig) *InterfaceConfig

func NewTunnelInterface

func NewTunnelInterface(tunnelName string, tunnelType ovsconfig.TunnelType, localIP net.IP, csum bool) *InterfaceConfig

NewTunnelInterface creates InterfaceConfig for the default tunnel port interface.

func NewUplinkInterface

func NewUplinkInterface(uplinkName string) *InterfaceConfig

NewUplinkInterface creates InterfaceConfig for the uplink interface.

func (*InterfaceConfig) GetIPv4Addr

func (c *InterfaceConfig) GetIPv4Addr() net.IP

TODO: remove this method after IPv4/IPv6 dual-stack is supported completely.

func (*InterfaceConfig) GetIPv6Addr

func (c *InterfaceConfig) GetIPv6Addr() net.IP

type InterfaceStore

type InterfaceStore interface {
	Initialize(interfaces []*InterfaceConfig)
	AddInterface(interfaceConfig *InterfaceConfig)
	ListInterfaces() []*InterfaceConfig
	DeleteInterface(interfaceConfig *InterfaceConfig)
	GetInterface(interfaceKey string) (*InterfaceConfig, bool)
	GetInterfaceByName(interfaceName string) (*InterfaceConfig, bool)
	GetContainerInterface(containerID string) (*InterfaceConfig, bool)
	GetInterfacesByEntity(name string, namespace string) []*InterfaceConfig
	GetContainerInterfacesByPod(podName string, podNamespace string) []*InterfaceConfig
	GetInterfaceByIP(interfaceIP string) (*InterfaceConfig, bool)
	GetNodeTunnelInterface(nodeName string) (*InterfaceConfig, bool)
	GetInterfaceByOFPort(ofPort uint32) (*InterfaceConfig, bool)
	GetContainerInterfaceNum() int
	GetInterfacesByType(interfaceType InterfaceType) []*InterfaceConfig
	Len() int
	GetInterfaceKeysByType(interfaceType InterfaceType) []string
}

InterfaceStore is a service interface to create local interfaces for container, host gateway, and tunnel port. Support add/delete/get operations

func NewInterfaceStore

func NewInterfaceStore() InterfaceStore

type InterfaceType

type InterfaceType uint8

func (InterfaceType) String

func (t InterfaceType) String() string

type OVSPortConfig

type OVSPortConfig struct {
	PortUUID string
	OFPort   int32
}

type TunnelInterfaceConfig

type TunnelInterfaceConfig struct {
	Type ovsconfig.TunnelType
	// Name of the remote Node.
	NodeName string
	// IP address of the local Node.
	LocalIP net.IP
	// IP address of the remote Node.
	RemoteIP net.IP
	// Destination port of the remote Node.
	DestinationPort int32
	// CommonName of the remote Name for certificate based authentication.
	RemoteName string
	// Pre-shard key for authentication.
	PSK string
	// Whether options:csum is set for this tunnel interface.
	// If true, encapsulation header UDP checksums will be computed on outgoing packets.
	Csum bool
}

Directories

Path Synopsis
Package testing is a generated GoMock package.
Package testing is a generated GoMock package.

Jump to

Keyboard shortcuts

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