netalloc

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: 8 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// ModuleName is the module name used for models of the netalloc plugin.
	ModuleName = "netalloc"

	// AllocRefPrefix is a prefix added in front of references to allocated objects.
	AllocRefPrefix = "alloc:"

	// AllocRefGWSuffix is a suffix added at the back of the reference when address
	// of the default gateway is requested (instead of interface IP address).
	AllocRefGWSuffix = "/GW"
)

Variables

View Source
var (
	IPAddressForm_name = map[int32]string{
		0: "UNDEFINED_FORM",
		1: "ADDR_ONLY",
		2: "ADDR_WITH_MASK",
		3: "ADDR_NET",
		4: "SINGLE_ADDR_NET",
	}
	IPAddressForm_value = map[string]int32{
		"UNDEFINED_FORM":  0,
		"ADDR_ONLY":       1,
		"ADDR_WITH_MASK":  2,
		"ADDR_NET":        3,
		"SINGLE_ADDR_NET": 4,
	}
)

Enum value maps for IPAddressForm.

View Source
var (
	IPAddressSource_name = map[int32]string{
		0: "UNDEFINED_SOURCE",
		1: "STATIC",
		2: "FROM_DHCP",
		3: "ALLOC_REF",
	}
	IPAddressSource_value = map[string]int32{
		"UNDEFINED_SOURCE": 0,
		"STATIC":           1,
		"FROM_DHCP":        2,
		"ALLOC_REF":        3,
	}
)

Enum value maps for IPAddressSource.

View Source
var File_ligato_netalloc_netalloc_proto protoreflect.FileDescriptor
View Source
var (
	ModelIPAllocation = models.Register(&IPAllocation{}, models.Spec{
		Module:  ModuleName,
		Version: "v1",
		Type:    "ip",
	}, models.WithNameTemplate(
		"network/{{.NetworkName}}/interface/{{.InterfaceName}}",
	))
)

Functions

func NeighGwKey

func NeighGwKey(network, iface string) string

NeighGwKey returns a derived key used to represent IP allocation where GW is a neighbour of the interface (addresses are from the same IP network).

Types

type ConfigData

type ConfigData struct {
	IpAddresses []*IPAllocation `protobuf:"bytes,10,rep,name=ip_addresses,json=ipAddresses,proto3" json:"ip_addresses,omitempty"`
	// contains filtered or unexported fields
}

ConfigData wraps all configuration items exported by netalloc. TBD: MACs, VXLAN VNIs, memif IDs, etc.

func (*ConfigData) Descriptor deprecated

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

Deprecated: Use ConfigData.ProtoReflect.Descriptor instead.

func (*ConfigData) GetIpAddresses

func (x *ConfigData) GetIpAddresses() []*IPAllocation

func (*ConfigData) ProtoMessage

func (*ConfigData) ProtoMessage()

func (*ConfigData) ProtoReflect added in v3.2.0

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

func (*ConfigData) Reset

func (x *ConfigData) Reset()

func (*ConfigData) String

func (x *ConfigData) String() string

type IPAddressForm

type IPAddressForm int32

IPAddressForm can be used in descriptors whose models reference allocated IP addresses, to ask for a specific form in which the address should applied.

const (
	IPAddressForm_UNDEFINED_FORM IPAddressForm = 0
	// ADDR_ONLY = apply address without mask, e.g. 192.168.2.5
	IPAddressForm_ADDR_ONLY IPAddressForm = 1
	// ADDR_WITH_MASK = apply address including the mask of the network,
	// e.g. 192.168.2.5/24
	IPAddressForm_ADDR_WITH_MASK IPAddressForm = 2
	// ADDR_NET = apply network implied by the address,
	// e.g. for 192.168.2.10/24 apply 192.168.2.0/24
	IPAddressForm_ADDR_NET IPAddressForm = 3
	// SINGLE_ADDR_NET = apply address with an all-ones mask (i.e. /32 for IPv4,
	// /128 for IPv6)
	IPAddressForm_SINGLE_ADDR_NET IPAddressForm = 4
)

func (IPAddressForm) Descriptor added in v3.2.0

func (IPAddressForm) Enum added in v3.2.0

func (x IPAddressForm) Enum() *IPAddressForm

func (IPAddressForm) EnumDescriptor deprecated

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

Deprecated: Use IPAddressForm.Descriptor instead.

func (IPAddressForm) Number added in v3.2.0

func (IPAddressForm) String

func (x IPAddressForm) String() string

func (IPAddressForm) Type added in v3.2.0

type IPAddressSource

type IPAddressSource int32

IPAddressSource can be used to remember the source of an IP address. (e.g. to distinguish allocated IP addresses from statically defined ones)

const (
	IPAddressSource_UNDEFINED_SOURCE IPAddressSource = 0
	// STATIC is IP address statically assigned in the NB configuration.
	IPAddressSource_STATIC IPAddressSource = 1
	// FROM_DHCP is set when IP address is obtained from DHCP.
	IPAddressSource_FROM_DHCP IPAddressSource = 2
	// ALLOC_REF is a reference inside NB configuration to an allocated
	// IP address.
	IPAddressSource_ALLOC_REF IPAddressSource = 3
)

func (IPAddressSource) Descriptor added in v3.2.0

func (IPAddressSource) Enum added in v3.2.0

func (x IPAddressSource) Enum() *IPAddressSource

func (IPAddressSource) EnumDescriptor deprecated

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

Deprecated: Use IPAddressSource.Descriptor instead.

func (IPAddressSource) Number added in v3.2.0

func (IPAddressSource) String

func (x IPAddressSource) String() string

func (IPAddressSource) Type added in v3.2.0

type IPAllocMetadata

type IPAllocMetadata struct {
	IfaceAddr *net.IPNet
	GwAddr    *net.IPNet
}

IPAllocMetadata stores allocated IP address already parsed from string.

type IPAllocation

type IPAllocation struct {

	// NetworkName is some label assigned to the network where the IP address
	// was assigned to the given interface.
	// In theory, interface can have multiple IP adresses or there can be multiple
	// address allocators and the network name allows to separate them.
	// The network name is not allowed to contain forward slashes.
	NetworkName string `protobuf:"bytes,1,opt,name=network_name,json=networkName,proto3" json:"network_name,omitempty"`
	// InterfaceName is the logical VPP or Linux interface name for which the
	// address is allocated.
	InterfaceName string `protobuf:"bytes,2,opt,name=interface_name,json=interfaceName,proto3" json:"interface_name,omitempty"`
	// Address is an IP addres allocated to the interface inside the given
	// network.
	// If the address is specified without a mask, the all-ones mask (/32 for
	// IPv4, /128 for IPv6) will be assumed.
	Address string `protobuf:"bytes,4,opt,name=address,proto3" json:"address,omitempty"`
	// Gw is the address of the default gateway assigned to the interface in
	// the given network.
	// If the address is specified without a mask, then either:
	//  a) the mask of the <address> is used provided that GW IP falls into the
	//     same network IP range, or
	//  b) the all-ones mask is used otherwise
	Gw string `protobuf:"bytes,5,opt,name=gw,proto3" json:"gw,omitempty"`
	// contains filtered or unexported fields
}

IPAllocation represents a single allocated IP address.

To reference allocated address, instead of entering specific IP address for interface/route/ARP/..., use one of the following string templates prefixed with netalloc keyword "alloc" followed by colon:

a) reference IP address allocated for an interface:
      "alloc:<network_name>/<interface_name>"
b) when interface is given (e.g. when asked for IP from interface model),
   interface_name can be omitted:
      "alloc:<network_name>"
c) reference default gateway IP address assigned to an interface:
      "alloc:<network_name>/<interface_name>/GW"
d) when asking for GW IP for interface which is given, interface_name
   can be omitted:
      "alloc:<network_name>/GW"

func (*IPAllocation) Descriptor deprecated

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

Deprecated: Use IPAllocation.ProtoReflect.Descriptor instead.

func (*IPAllocation) GetAddress

func (x *IPAllocation) GetAddress() string

func (*IPAllocation) GetGw

func (x *IPAllocation) GetGw() string

func (*IPAllocation) GetInterfaceName

func (x *IPAllocation) GetInterfaceName() string

func (*IPAllocation) GetNetworkName

func (x *IPAllocation) GetNetworkName() string

func (*IPAllocation) ProtoMessage

func (*IPAllocation) ProtoMessage()

func (*IPAllocation) ProtoReflect added in v3.2.0

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

func (*IPAllocation) Reset

func (x *IPAllocation) Reset()

func (*IPAllocation) String

func (x *IPAllocation) String() string

Jump to

Keyboard shortcuts

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