nsmd

package
v0.0.0-...-e58ac12 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: Apache-2.0 Imports: 42 Imported by: 11

Documentation

Overview

Copyright (c) 2019 Cisco Systems, Inc.

SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	// ForwarderRegistrarSocketBaseDir defines the location of NSM forwarder registrar listen socket
	ForwarderRegistrarSocketBaseDir = "/var/lib/networkservicemesh"
	// ForwarderRegistrarSocket defines the name of NSM forwarder registrar socket
	ForwarderRegistrarSocket = "nsm.forwarder-registrar.io.sock"
)
View Source
const (
	NsmdDeleteLocalRegistry = "NSMD_LOCAL_REGISTRY_DELETE"
	ForwarderTimeout        = 1 * time.Hour
	NSEAliveTimeout         = 1 * time.Second
)
View Source
const (
	// NSETrackingIntervalDefault - default registry notification interval that NSE is still alive
	NSETrackingIntervalDefault = 2 * time.Minute
	// NSETrackingIntervalSecondsEnv - environment variable contains registry notification interval that NSE is still alive in seconds
	NSETrackingIntervalSecondsEnv = utils.EnvVar("NSE_TRACKING_INTERVAL")
)
View Source
const (
	// ServerSock defines the path of NSM client socket
	ServerSock = "/var/lib/networkservicemesh/nsm.io.sock"
	// NsmDevicePluginEnv is the name of the env variable to configure enabled device plugin name
	NsmDevicePluginEnv = "NSM_DEVICE_PLUGIN"

	// PublicAPIAddressEnv sets nsmd public API address
	PublicAPIAddressEnv utils.EnvVar = "NSMD_PUBLIC_API"
)

Variables

This section is empty.

Functions

func GetLocalIPAddress

func GetLocalIPAddress() string

func NewApiRegistry

func NewApiRegistry() serviceregistry.ApiRegistry

func NewCustomListener

func NewCustomListener(socket string) (*customListener, error)

func NewNetworkServiceServer

func NewNetworkServiceServer(model model.Model, ws *Workspace,
	nsmManager nsm.NetworkServiceManager) networkservice.NetworkServiceServer

NewNetworkServiceServer - construct a local network service chain

func NewServiceRegistry

func NewServiceRegistry() serviceregistry.ServiceRegistry

func NewServiceRegistryAt

func NewServiceRegistryAt(nsmAddress string) serviceregistry.ServiceRegistry

func NewWorkspaceProvider

func NewWorkspaceProvider(rootDir string) serviceregistry.WorkspaceLocationProvider

func RequestWorkspace

func RequestWorkspace(ctx context.Context, serviceRegistry serviceregistry.ServiceRegistry, id string) (*nsmdapi.ClientConnectionReply, error)

RequestWorkspace - request a workspace

Types

type EndpointManager

type EndpointManager interface {
	DeleteEndpointWithBrokenConnection(ctx context.Context, endpoint *model.Endpoint) error
}

EndpointManager is an interface to delete endpoints with broken connection

type ForwarderRegistrarServer

type ForwarderRegistrarServer struct {
	// contains filtered or unexported fields
}

ForwarderRegistrarServer - NSMgr registration service

func StartForwarderRegistrarServer

func StartForwarderRegistrarServer(ctx context.Context, model model.Model) (*ForwarderRegistrarServer, error)

StartForwarderRegistrarServer - registers and starts gRPC server which is listening for Network Service Forwarder Registrar requests.

func (*ForwarderRegistrarServer) RequestForwarderRegistration

RequestForwarderRegistration - request forwarder to be registered.

func (*ForwarderRegistrarServer) RequestForwarderUnRegistration

RequestForwarderUnRegistration - request forwarder to be unregistered

func (*ForwarderRegistrarServer) RequestLiveness

RequestLiveness is a stream initiated by NSM to inform the forwarder that NSM is still alive and no re-registration is required. Detection a failure on this "channel" will mean that NSM is gone and the forwarder needs to start re-registration logic.

func (*ForwarderRegistrarServer) Stop

func (r *ForwarderRegistrarServer) Stop()

Stop - stop forwarder registration socket.

type NSERegistryServer

type NSERegistryServer interface {
	registry.NetworkServiceRegistryServer
	RegisterNSEWithClient(ctx context.Context, request *registry.NSERegistration, client registry.NetworkServiceRegistryClient) (*registry.NSERegistration, error)
}

func NewRegistryServer

func NewRegistryServer(nsm *nsmServer, workspace *Workspace) NSERegistryServer

type NSMServer

type NSMServer interface {
	Stop()
	StartForwarderRegistratorServer(ctx context.Context) error
	StartAPIServerAt(ctx context.Context, sock net.Listener, probes probes.Probes)

	XconManager() *services.ClientConnectionManager
	Manager() nsm.NetworkServiceManager

	nsm.MonitorManager
	EndpointManager
}

func StartNSMServer

func StartNSMServer(ctx context.Context, model model.Model, manager nsm.NetworkServiceManager, apiRegistry serviceregistry.ApiRegistry) (NSMServer, error)

StartNSMServer registers and starts gRPC server which is listening for Network Service requests.

type NsmMonitorCrossConnectClient

type NsmMonitorCrossConnectClient struct {
	model.ListenerImpl
	// contains filtered or unexported fields
}

func NewMonitorCrossConnectClient

func NewMonitorCrossConnectClient(model model.Model, monitorManager nsm.MonitorManager, xconManager *services.ClientConnectionManager,
	endpointManager EndpointManager) *NsmMonitorCrossConnectClient

NewMonitorCrossConnectClient creates a new NsmMonitorCrossConnectClient

func (*NsmMonitorCrossConnectClient) ClientConnectionAdded

func (client *NsmMonitorCrossConnectClient) ClientConnectionAdded(ctx context.Context, clientConnection *model.ClientConnection)

ClientConnectionAdded - handle connection added

func (*NsmMonitorCrossConnectClient) ClientConnectionDeleted

func (client *NsmMonitorCrossConnectClient) ClientConnectionDeleted(ctx context.Context, clientConnection *model.ClientConnection)

ClientConnectionDeleted - handle client connection deleted

func (*NsmMonitorCrossConnectClient) ClientConnectionUpdated

func (client *NsmMonitorCrossConnectClient) ClientConnectionUpdated(ctx context.Context, old, new *model.ClientConnection)

ClientConnectionUpdated - implements method from Listener

func (*NsmMonitorCrossConnectClient) EndpointAdded

func (client *NsmMonitorCrossConnectClient) EndpointAdded(ctx context.Context, endpoint *model.Endpoint)

EndpointAdded implements method from Listener

func (*NsmMonitorCrossConnectClient) EndpointDeleted

func (client *NsmMonitorCrossConnectClient) EndpointDeleted(_ context.Context, endpoint *model.Endpoint)

EndpointDeleted implements method from Listener

func (*NsmMonitorCrossConnectClient) ForwarderAdded

func (client *NsmMonitorCrossConnectClient) ForwarderAdded(_ context.Context, dp *model.Forwarder)

ForwarderAdded implements method from Listener

func (*NsmMonitorCrossConnectClient) ForwarderDeleted

func (client *NsmMonitorCrossConnectClient) ForwarderDeleted(_ context.Context, dp *model.Forwarder)

ForwarderDeleted implements method from Listener

type RemotePeerDescriptor

type RemotePeerDescriptor interface {
	sync.Locker
	AddConnection(connection *model.ClientConnection)
	RemoveConnection(connection *model.ClientConnection)
	Cancel()
	Context() context.Context
	Reset()
	IsCanceled() bool
	HasConnection() bool
	RemoteNsm() *registry.NetworkServiceManager
}

RemotePeerDescriptor represents network service manager remote peer

func NewRemotePeerDescriptor

func NewRemotePeerDescriptor(conn *model.ClientConnection) RemotePeerDescriptor

NewRemotePeerDescriptor represents network service manager remote peer

type Workspace

type Workspace struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewWorkSpace

func NewWorkSpace(ctx context.Context, nsm *nsmServer, name string, restore bool) (*Workspace, error)

NewWorkSpace - constructs a new workspace.

func (*Workspace) ClientDirectory

func (w *Workspace) ClientDirectory() string

func (*Workspace) Close

func (w *Workspace) Close()

func (*Workspace) HostDirectory

func (w *Workspace) HostDirectory() string

func (*Workspace) MonitorConnectionServer

func (w *Workspace) MonitorConnectionServer() connectionMonitor.MonitorServer

MonitorConnectionServer returns workspace.monitorConnectionServer

func (*Workspace) Name

func (w *Workspace) Name() string

func (*Workspace) NsmClientSocket

func (w *Workspace) NsmClientSocket() string

func (*Workspace) NsmDirectory

func (w *Workspace) NsmDirectory() string

func (*Workspace) NsmServerSocket

func (w *Workspace) NsmServerSocket() string

type WorkspaceState

type WorkspaceState int
const (
	NEW WorkspaceState = iota + 1
	RUNNING
	CLOSED
)

Jump to

Keyboard shortcuts

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