nsm

package
v0.0.0-...-d5eb696 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GlobalNotifAgentLabel is an agent label used by default by all the agents with the NSM plugin to publish notifications.
	// In an unlikely case of sharing the same KVDB across multiple K8s clusters, use different label for each cluster
	// (to prevent from collisions).
	GlobalNotifAgentLabel = "global"

	// NotificationKeyPrefix is a prefix for keys of all notifications published by the NSM plugin via KVDB.
	NotificationKeyPrefix = "notification/nsm/"

	// EndpointNotificationKeyPrefix is a prefix for keys of all endpoint-related notifications published by the NSM
	// plugin via KVDB.
	EndpointNotificationKeyPrefix = NotificationKeyPrefix + "endpoint/"
)

notifications

View Source
const (
	// InvalidKeyPart is used in key for parts which are invalid
	InvalidKeyPart = "<invalid>"
)
View Source
const ModuleName = "cnf.nsm"

Variables

View Source
var ConnectionInterfaceType_name = map[int32]string{
	0: "DEFAULT_INTERFACE",
	1: "KERNEL_INTERFACE",
	3: "MEM_INTERFACE",
}
View Source
var ConnectionInterfaceType_value = map[string]int32{
	"DEFAULT_INTERFACE": 0,
	"KERNEL_INTERFACE":  1,
	"MEM_INTERFACE":     3,
}
View Source
var ModelNSMClient = models.Register(
	&NetworkServiceClient{},
	models.Spec{
		Module:  ModuleName,
		Version: "v1",
		Type:    "client",
	},
)
View Source
var ModelNSMEndpoint = models.Register(
	&NetworkServiceEndpoint{},
	models.Spec{
		Module:  ModuleName,
		Version: "v1",
		Type:    "endpoint",
	},
	models.WithNameTemplate(
		"{{.NetworkService}}",
	),
)

Functions

func ClientKey

func ClientKey() string

func EndpointKey

func EndpointKey() string

func EndpointNotificationKey

func EndpointNotificationKey(ns, labelKey, labelValue string) string

func ParseEndpointNotificationKey

func ParseEndpointNotificationKey(key string) (ns, labelKey, labelValue string, ok bool)

ParseEndpointNotificationKey parses network service name and the endpoint advertised label from a key used for a notification about a created endpoint.

Types

type ConnectionInterfaceType

type ConnectionInterfaceType int32

Corresponds to "MechanismType" from NSM terminology.

const (
	ConnectionInterfaceType_DEFAULT_INTERFACE ConnectionInterfaceType = 0
	ConnectionInterfaceType_KERNEL_INTERFACE  ConnectionInterfaceType = 1
	ConnectionInterfaceType_MEM_INTERFACE     ConnectionInterfaceType = 3
)

func (ConnectionInterfaceType) EnumDescriptor

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

func (ConnectionInterfaceType) String

func (x ConnectionInterfaceType) String() string

type ConnectionLabel

type ConnectionLabel struct {
	Key                  string   `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value                string   `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Labels assigned to a connection either from the client or from the endpoint side.

func (*ConnectionLabel) Descriptor

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

func (*ConnectionLabel) GetKey

func (m *ConnectionLabel) GetKey() string

func (*ConnectionLabel) GetValue

func (m *ConnectionLabel) GetValue() string

func (*ConnectionLabel) ProtoMessage

func (*ConnectionLabel) ProtoMessage()

func (*ConnectionLabel) Reset

func (m *ConnectionLabel) Reset()

func (*ConnectionLabel) String

func (m *ConnectionLabel) String() string

func (*ConnectionLabel) XXX_DiscardUnknown

func (m *ConnectionLabel) XXX_DiscardUnknown()

func (*ConnectionLabel) XXX_Marshal

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

func (*ConnectionLabel) XXX_Merge

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

func (*ConnectionLabel) XXX_Size

func (m *ConnectionLabel) XXX_Size() int

func (*ConnectionLabel) XXX_Unmarshal

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

type NetworkServiceClient

type NetworkServiceClient struct {
	// Name of the client (not part of the NSM protocol, used only for identification within the Ligato CNF-Agent).
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Name of the network service to connect the client into.
	NetworkService string `protobuf:"bytes,2,opt,name=network_service,json=networkService,proto3" json:"network_service,omitempty"`
	// Labels to be sent with the NS connection request.
	OutgoingLabels []*ConnectionLabel `protobuf:"bytes,3,rep,name=outgoing_labels,json=outgoingLabels,proto3" json:"outgoing_labels,omitempty"`
	// Name assigned to the interface created for the connection.
	InterfaceName string `protobuf:"bytes,4,opt,name=interface_name,json=interfaceName,proto3" json:"interface_name,omitempty"`
	// Type of the interface created for the connection.
	InterfaceType ConnectionInterfaceType `` /* 135-byte string literal not displayed */
	// List of IP addresses (with prefixes) attached to the interface created for the connection.
	IpAddresses []string `protobuf:"bytes,6,rep,name=ip_addresses,json=ipAddresses,proto3" json:"ip_addresses,omitempty"`
	// MAC address to assign to the connection interface. Leave empty to automatically generate.
	PhysAddress          string   `protobuf:"bytes,7,opt,name=phys_address,json=physAddress,proto3" json:"phys_address,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Client connected to a selected Network Service.

func (*NetworkServiceClient) Descriptor

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

func (*NetworkServiceClient) GetInterfaceName

func (m *NetworkServiceClient) GetInterfaceName() string

func (*NetworkServiceClient) GetInterfaceType

func (m *NetworkServiceClient) GetInterfaceType() ConnectionInterfaceType

func (*NetworkServiceClient) GetIpAddresses

func (m *NetworkServiceClient) GetIpAddresses() []string

func (*NetworkServiceClient) GetName

func (m *NetworkServiceClient) GetName() string

func (*NetworkServiceClient) GetNetworkService

func (m *NetworkServiceClient) GetNetworkService() string

func (*NetworkServiceClient) GetOutgoingLabels

func (m *NetworkServiceClient) GetOutgoingLabels() []*ConnectionLabel

func (*NetworkServiceClient) GetPhysAddress

func (m *NetworkServiceClient) GetPhysAddress() string

func (*NetworkServiceClient) ProtoMessage

func (*NetworkServiceClient) ProtoMessage()

func (*NetworkServiceClient) Reset

func (m *NetworkServiceClient) Reset()

func (*NetworkServiceClient) String

func (m *NetworkServiceClient) String() string

func (*NetworkServiceClient) XXX_DiscardUnknown

func (m *NetworkServiceClient) XXX_DiscardUnknown()

func (*NetworkServiceClient) XXX_Marshal

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

func (*NetworkServiceClient) XXX_Merge

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

func (*NetworkServiceClient) XXX_Size

func (m *NetworkServiceClient) XXX_Size() int

func (*NetworkServiceClient) XXX_Unmarshal

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

type NetworkServiceEndpoint

type NetworkServiceEndpoint struct {
	// Name of the network service where the endpoint is announced.
	// At most once endpoint is possible to register for a given network service. This limitation is imposed
	// by the design of NSM - all requests for connection with an endpoint goes through the same link (unix socket)
	// and there is not enough information inside request contexts to be able to dissect them between multiple endpoints.
	NetworkService string `protobuf:"bytes,2,opt,name=network_service,json=networkService,proto3" json:"network_service,omitempty"`
	// Labels advertised by this endpoint.
	AdvertisedLabels []*ConnectionLabel `protobuf:"bytes,3,rep,name=advertised_labels,json=advertisedLabels,proto3" json:"advertised_labels,omitempty"`
	// If enabled, only single client is expected to connect. Further connection requests will be declined.
	SingleClient bool `protobuf:"varint,4,opt,name=single_client,json=singleClient,proto3" json:"single_client,omitempty"`
	// Prefix of the name assigned to interface created for every connection.
	// The interface name suffix will be either taken from the client's outgoing label if interface_name_suffix_from_label
	// is defined, or the first unused unsigned integer (i.e. starting with 0) will be appended.
	// For example, with interface_name_prefix="nsm" and interface_name_suffix_from_label undefined, interfaces
	// created for connected clients will be "nsm0", "nsm1", etc.
	InterfaceNamePrefix string `protobuf:"bytes,5,opt,name=interface_name_prefix,json=interfaceNamePrefix,proto3" json:"interface_name_prefix,omitempty"`
	// By default, interface names are suffixed with integer indexes, starting from 0 (i.e. <prefix>0, <prefix>1, etc.)
	// The disadvantage of this approach is that associations between interface names and opposing clients will depend
	// on the order in which the clients are being (dis)connected, which in most cases is not deterministic.
	// As an alternative, it is possible to use value of a client's outgoing label with the given key.
	// For example, if client is defined with outgoing label "app"="nat" and interface_name_prefix="conn-", then
	// if interface_name_suffix_from_label="app" the resulting interface name will be "conn-nat".
	// If client doesn't define outgoing label with such key, the connection request will be declined.
	InterfaceNameSuffixFromLabel string `` /* 151-byte string literal not displayed */
	// Type of the interface created for the connection.
	InterfaceType ConnectionInterfaceType `` /* 135-byte string literal not displayed */
	// List of IP addresses (with prefixes) attached to the interface created for the connection.
	// Supported only with single connected client (single_client=true).
	IpAddresses []string `protobuf:"bytes,8,rep,name=ip_addresses,json=ipAddresses,proto3" json:"ip_addresses,omitempty"`
	// MAC address to assign to the connection interface. Leave empty to automatically generate.
	// Supported only with single connected client (single_client=true).
	PhysAddress          string   `protobuf:"bytes,9,opt,name=phys_address,json=physAddress,proto3" json:"phys_address,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Endpoint advertised within the selected Network Service.

func (*NetworkServiceEndpoint) Descriptor

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

func (*NetworkServiceEndpoint) GetAdvertisedLabels

func (m *NetworkServiceEndpoint) GetAdvertisedLabels() []*ConnectionLabel

func (*NetworkServiceEndpoint) GetInterfaceNamePrefix

func (m *NetworkServiceEndpoint) GetInterfaceNamePrefix() string

func (*NetworkServiceEndpoint) GetInterfaceNameSuffixFromLabel

func (m *NetworkServiceEndpoint) GetInterfaceNameSuffixFromLabel() string

func (*NetworkServiceEndpoint) GetInterfaceType

func (m *NetworkServiceEndpoint) GetInterfaceType() ConnectionInterfaceType

func (*NetworkServiceEndpoint) GetIpAddresses

func (m *NetworkServiceEndpoint) GetIpAddresses() []string

func (*NetworkServiceEndpoint) GetNetworkService

func (m *NetworkServiceEndpoint) GetNetworkService() string

func (*NetworkServiceEndpoint) GetPhysAddress

func (m *NetworkServiceEndpoint) GetPhysAddress() string

func (*NetworkServiceEndpoint) GetSingleClient

func (m *NetworkServiceEndpoint) GetSingleClient() bool

func (*NetworkServiceEndpoint) ProtoMessage

func (*NetworkServiceEndpoint) ProtoMessage()

func (*NetworkServiceEndpoint) Reset

func (m *NetworkServiceEndpoint) Reset()

func (*NetworkServiceEndpoint) String

func (m *NetworkServiceEndpoint) String() string

func (*NetworkServiceEndpoint) XXX_DiscardUnknown

func (m *NetworkServiceEndpoint) XXX_DiscardUnknown()

func (*NetworkServiceEndpoint) XXX_Marshal

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

func (*NetworkServiceEndpoint) XXX_Merge

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

func (*NetworkServiceEndpoint) XXX_Size

func (m *NetworkServiceEndpoint) XXX_Size() int

func (*NetworkServiceEndpoint) XXX_Unmarshal

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

Jump to

Keyboard shortcuts

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