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
- func GetLocalIPAddress() string
- func NewApiRegistry() serviceregistry.ApiRegistry
- func NewCustomListener(socket string) (*customListener, error)
- func NewDefaultWorkspaceProvider() serviceregistry.WorkspaceLocationProvider
- func NewNetworkServiceDiscoveryServer(serviceRegistry serviceregistry.ServiceRegistry) registry.NetworkServiceDiscoveryServer
- func NewNetworkServiceServer(model model.Model, ws *Workspace, nsmManager nsm.NetworkServiceManager) networkservice.NetworkServiceServer
- func NewServiceRegistry() serviceregistry.ServiceRegistry
- func NewServiceRegistryAt(nsmAddress string) serviceregistry.ServiceRegistry
- func NewWorkspaceProvider(rootDir string) serviceregistry.WorkspaceLocationProvider
- func RequestWorkspace(ctx context.Context, serviceRegistry serviceregistry.ServiceRegistry, ...) (*nsmdapi.ClientConnectionReply, error)
- type EndpointManager
- type ForwarderRegistrarServer
- func (r *ForwarderRegistrarServer) RequestForwarderRegistration(ctx context.Context, req *forwarderregistrarapi.ForwarderRegistrationRequest) (*forwarderregistrarapi.ForwarderRegistrationReply, error)
- func (r *ForwarderRegistrarServer) RequestForwarderUnRegistration(ctx context.Context, req *forwarderregistrarapi.ForwarderUnRegistrationRequest) (*forwarderregistrarapi.ForwarderUnRegistrationReply, error)
- func (r *ForwarderRegistrarServer) RequestLiveness(liveness forwarderregistrarapi.ForwarderRegistration_RequestLivenessServer) error
- func (r *ForwarderRegistrarServer) Stop()
- type NSERegistryServer
- type NSMServer
- type NsmMonitorCrossConnectClient
- func (client *NsmMonitorCrossConnectClient) ClientConnectionAdded(ctx context.Context, clientConnection *model.ClientConnection)
- func (client *NsmMonitorCrossConnectClient) ClientConnectionDeleted(ctx context.Context, clientConnection *model.ClientConnection)
- func (client *NsmMonitorCrossConnectClient) ClientConnectionUpdated(ctx context.Context, old, new *model.ClientConnection)
- func (client *NsmMonitorCrossConnectClient) EndpointAdded(ctx context.Context, endpoint *model.Endpoint)
- func (client *NsmMonitorCrossConnectClient) EndpointDeleted(_ context.Context, endpoint *model.Endpoint)
- func (client *NsmMonitorCrossConnectClient) ForwarderAdded(_ context.Context, dp *model.Forwarder)
- func (client *NsmMonitorCrossConnectClient) ForwarderDeleted(_ context.Context, dp *model.Forwarder)
- type RemotePeerDescriptor
- type Workspace
- func (w *Workspace) ClientDirectory() string
- func (w *Workspace) Close()
- func (w *Workspace) HostDirectory() string
- func (w *Workspace) MonitorConnectionServer() connectionMonitor.MonitorServer
- func (w *Workspace) Name() string
- func (w *Workspace) NsmClientSocket() string
- func (w *Workspace) NsmDirectory() string
- func (w *Workspace) NsmServerSocket() string
- type WorkspaceState
Constants ¶
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" )
const ( NsmdDeleteLocalRegistry = "NSMD_LOCAL_REGISTRY_DELETE" ForwarderTimeout = 1 * time.Hour NSEAliveTimeout = 1 * time.Second )
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") )
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" )
Variables ¶
This section is empty.
Functions ¶
func GetLocalIPAddress ¶
func GetLocalIPAddress() string
func NewApiRegistry ¶
func NewApiRegistry() serviceregistry.ApiRegistry
func NewCustomListener ¶
func NewDefaultWorkspaceProvider ¶
func NewDefaultWorkspaceProvider() serviceregistry.WorkspaceLocationProvider
func NewNetworkServiceDiscoveryServer ¶
func NewNetworkServiceDiscoveryServer(serviceRegistry serviceregistry.ServiceRegistry) registry.NetworkServiceDiscoveryServer
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 ¶
func (r *ForwarderRegistrarServer) RequestForwarderRegistration(ctx context.Context, req *forwarderregistrarapi.ForwarderRegistrationRequest) (*forwarderregistrarapi.ForwarderRegistrationReply, error)
RequestForwarderRegistration - request forwarder to be registered.
func (*ForwarderRegistrarServer) RequestForwarderUnRegistration ¶
func (r *ForwarderRegistrarServer) RequestForwarderUnRegistration(ctx context.Context, req *forwarderregistrarapi.ForwarderUnRegistrationRequest) (*forwarderregistrarapi.ForwarderUnRegistrationReply, error)
RequestForwarderUnRegistration - request forwarder to be unregistered
func (*ForwarderRegistrarServer) RequestLiveness ¶
func (r *ForwarderRegistrarServer) RequestLiveness(liveness forwarderregistrarapi.ForwarderRegistration_RequestLivenessServer) error
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 ¶
func NewWorkSpace ¶
func NewWorkSpace(ctx context.Context, nsm *nsmServer, name string, restore bool) (*Workspace, error)
NewWorkSpace - constructs a new workspace.
func (*Workspace) ClientDirectory ¶
func (*Workspace) HostDirectory ¶
func (*Workspace) MonitorConnectionServer ¶
func (w *Workspace) MonitorConnectionServer() connectionMonitor.MonitorServer
MonitorConnectionServer returns workspace.monitorConnectionServer
func (*Workspace) NsmClientSocket ¶
func (*Workspace) NsmDirectory ¶
func (*Workspace) NsmServerSocket ¶
type WorkspaceState ¶
type WorkspaceState int
const ( NEW WorkspaceState = iota + 1 RUNNING CLOSED )