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 ¶
- func ClientConnection(ctx context.Context) *connection.Connection
- func Init(thing interface{}, initContext *InitContext) error
- func Log(ctx context.Context) logrus.FieldLogger
- func MonitorServer(ctx context.Context) connectionMonitor.MonitorServer
- func NewAddDNSConfigs(dnsConfigs ...*connectioncontext.DNSConfig) networkservice.NetworkServiceServer
- func NewAddDnsConfigDstIp(searchDomains ...string) networkservice.NetworkServiceServer
- func NewCompositeEndpoint(endpoints ...networkservice.NetworkServiceServer) networkservice.NetworkServiceServer
- func Next(ctx context.Context) networkservice.NetworkServiceServer
- func WithClientConnection(parent context.Context, connection *connection.Connection) context.Context
- func WithMonitorServer(parent context.Context, monitorServer connectionMonitor.MonitorServer) context.Context
- type ClientEndpoint
- type CompositeEndpoint
- func (bce *CompositeEndpoint) Close(ctx context.Context, connection *connection.Connection) (*empty.Empty, error)
- func (bce *CompositeEndpoint) Init(initContext *InitContext) error
- func (bce *CompositeEndpoint) Request(ctx context.Context, request *networkservice.NetworkServiceRequest) (*connection.Connection, error)
- type ConnectionEndpoint
- type ConnectionMutator
- type CustomFuncEndpoint
- type InitContext
- type Initable
- type IpamEndpoint
- type MonitorEndpoint
- func (mce *MonitorEndpoint) Close(ctx context.Context, connection *connection.Connection) (*empty.Empty, error)
- func (mce *MonitorEndpoint) Init(context *InitContext) error
- func (mce *MonitorEndpoint) Name() string
- func (mce *MonitorEndpoint) Request(ctx context.Context, request *networkservice.NetworkServiceRequest) (*connection.Connection, error)
- type NsmEndpoint
- type RoutesConfiguration
- type RoutesEndpoint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientConnection ¶
func ClientConnection(ctx context.Context) *connection.Connection
ClientConnection -
Returns a ClientConnection from: ctx context.Context If any is present, otherwise nil
func Init ¶
func Init(thing interface{}, initContext *InitContext) error
Init - initialize the thing if its initable, otherwise just fall through silently
func MonitorServer ¶
func MonitorServer(ctx context.Context) connectionMonitor.MonitorServer
MonitorServer -
Returns a MonitorServer from: ctx context.Context If any is present, otherwise nil
func NewAddDNSConfigs ¶
func NewAddDNSConfigs(dnsConfigs ...*connectioncontext.DNSConfig) networkservice.NetworkServiceServer
func NewAddDnsConfigDstIp ¶
func NewAddDnsConfigDstIp(searchDomains ...string) networkservice.NetworkServiceServer
func NewCompositeEndpoint ¶
func NewCompositeEndpoint(endpoints ...networkservice.NetworkServiceServer) networkservice.NetworkServiceServer
NewCompositeEndpoint creates a new composed endpoint
func Next ¶
func Next(ctx context.Context) networkservice.NetworkServiceServer
Next -
Returns the Next networkservice.NetworkServiceServer to be called in the chain from the context.Context
func WithClientConnection ¶
func WithClientConnection(parent context.Context, connection *connection.Connection) context.Context
WithClientConnection -
Wraps 'parent' in a new Context that has the ClientConnection provided in: connection *connection.Connection using Context.Value(...) and returns the result. Note: any previously existing ClientConnection will be overwritten. Recommended use: in any Request or Close call that creates a ClientConnection, call: ctx = WithClientConnection(ctx) to ensure that the ctx has a ClientConnection In any Request or Close call that consumes a ClientConnection, call: connectionMap := ClientConnection(ctx) to retrieve the ClientConnection from the context.Context
func WithMonitorServer ¶
func WithMonitorServer(parent context.Context, monitorServer connectionMonitor.MonitorServer) context.Context
WithMonitorServer -
Wraps 'parent' in a new Context that has the local connection Monitor using Context.Value(...) and returns the result. Note: any previously existing MonitorServer will be overwritten.
Types ¶
type ClientEndpoint ¶
type ClientEndpoint struct {
// contains filtered or unexported fields
}
ClientEndpoint - opens a Client connection to another Network Service
func NewClientEndpoint ¶
func NewClientEndpoint(configuration *common.NSConfiguration) *ClientEndpoint
NewClientEndpoint creates a ClientEndpoint
func (*ClientEndpoint) Close ¶
func (cce *ClientEndpoint) Close(ctx context.Context, connection *connection.Connection) (*empty.Empty, error)
Close implements the close handler Consumes from ctx context.Context:
Next
func (*ClientEndpoint) Name ¶
func (cce *ClientEndpoint) Name() string
Name returns the composite name
func (*ClientEndpoint) Request ¶
func (cce *ClientEndpoint) Request(ctx context.Context, request *networkservice.NetworkServiceRequest) (*connection.Connection, error)
Request implements the request handler Consumes from ctx context.Context:
Next
type CompositeEndpoint ¶
type CompositeEndpoint struct {
// contains filtered or unexported fields
}
CompositeEndpoint is the base service composition struct
func (*CompositeEndpoint) Close ¶
func (bce *CompositeEndpoint) Close(ctx context.Context, connection *connection.Connection) (*empty.Empty, error)
Close implements a dummy close handler
func (*CompositeEndpoint) Init ¶
func (bce *CompositeEndpoint) Init(initContext *InitContext) error
Init initializes all the subcomponents of the composite
func (*CompositeEndpoint) Request ¶
func (bce *CompositeEndpoint) Request(ctx context.Context, request *networkservice.NetworkServiceRequest) (*connection.Connection, error)
Request implements a dummy request handler
type ConnectionEndpoint ¶
type ConnectionEndpoint struct {
// contains filtered or unexported fields
}
ConnectionEndpoint makes basic Mechanism selection for the incoming connection
func NewConnectionEndpoint ¶
func NewConnectionEndpoint(configuration *common.NSConfiguration) *ConnectionEndpoint
NewConnectionEndpoint creates a ConnectionEndpoint
func (*ConnectionEndpoint) Close ¶
func (cce *ConnectionEndpoint) Close(ctx context.Context, connection *connection.Connection) (*empty.Empty, error)
Close implements the close handler Consumes from ctx context.Context:
Next
func (*ConnectionEndpoint) Name ¶
func (cce *ConnectionEndpoint) Name() string
Name returns the composite name
func (*ConnectionEndpoint) Request ¶
func (cce *ConnectionEndpoint) Request(ctx context.Context, request *networkservice.NetworkServiceRequest) (*connection.Connection, error)
Request implements the request handler Consumes from ctx context.Context:
Next
type ConnectionMutator ¶
type ConnectionMutator func(context.Context, *connection.Connection) error
ConnectionMutator is function that accepts connection and modify it
func CreatePodNameMutator ¶
func CreatePodNameMutator() ConnectionMutator
func CreateRouteMutator ¶
func CreateRouteMutator(routes []string) ConnectionMutator
CreateRouteMutator - Creates an instance of ConnectionMutator with routes mutating
type CustomFuncEndpoint ¶
type CustomFuncEndpoint struct {
// contains filtered or unexported fields
}
CustomFuncEndpoint is endpoint that apply passed ConnectionMutator to connection that accepts from next endpoint
func NewCustomFuncEndpoint ¶
func NewCustomFuncEndpoint(name string, mutator ConnectionMutator) *CustomFuncEndpoint
NewCustomFuncEndpoint create CustomFuncEndpoint
func (*CustomFuncEndpoint) Close ¶
func (cf *CustomFuncEndpoint) Close(ctx context.Context, connection *connection.Connection) (*empty.Empty, error)
Close implements Close method from NetworkServiceServer Consumes from ctx context.Context:
Next
func (*CustomFuncEndpoint) Name ¶
func (cf *CustomFuncEndpoint) Name() string
Name returns the composite name
func (*CustomFuncEndpoint) Request ¶
func (cf *CustomFuncEndpoint) Request(ctx context.Context, request *networkservice.NetworkServiceRequest) (*connection.Connection, error)
Request implements Request method from NetworkServiceServer Consumes from ctx context.Context:
Next
type InitContext ¶
InitContext is the context passed to the Init function of the endpoint
type Initable ¶
type Initable interface {
Init(*InitContext) error
}
Initable - things can be initted
type IpamEndpoint ¶
type IpamEndpoint struct {
PrefixPool prefix_pool.PrefixPool
}
IpamEndpoint - provides Ipam functionality
func NewIpamEndpoint ¶
func NewIpamEndpoint(configuration *common.NSConfiguration) *IpamEndpoint
NewIpamEndpoint creates a IpamEndpoint
func (*IpamEndpoint) Close ¶
func (ice *IpamEndpoint) Close(ctx context.Context, connection *connection.Connection) (*empty.Empty, error)
Close implements the close handler Consumes from ctx context.Context:
Next
func (*IpamEndpoint) Request ¶
func (ice *IpamEndpoint) Request(ctx context.Context, request *networkservice.NetworkServiceRequest) (*connection.Connection, error)
Request implements the request handler Consumes from ctx context.Context:
Next
type MonitorEndpoint ¶
type MonitorEndpoint struct {
// contains filtered or unexported fields
}
MonitorEndpoint is a monitoring composite
func NewMonitorEndpoint ¶
func NewMonitorEndpoint(configuration *common.NSConfiguration) *MonitorEndpoint
NewMonitorEndpoint creates a MonitorEndpoint
func (*MonitorEndpoint) Close ¶
func (mce *MonitorEndpoint) Close(ctx context.Context, connection *connection.Connection) (*empty.Empty, error)
Close implements the close handler Request implements the request handler Consumes from ctx context.Context:
ConnectionMonitor Next
func (*MonitorEndpoint) Init ¶
func (mce *MonitorEndpoint) Init(context *InitContext) error
Init will be called upon NSM Endpoint instantiation with the proper context
func (*MonitorEndpoint) Name ¶
func (mce *MonitorEndpoint) Name() string
Name returns the composite name
func (*MonitorEndpoint) Request ¶
func (mce *MonitorEndpoint) Request(ctx context.Context, request *networkservice.NetworkServiceRequest) (*connection.Connection, error)
Request implements the request handler Consumes from ctx context.Context:
ConnectionMonitor Next
type NsmEndpoint ¶
NsmEndpoint provides the grpc mechanics for an NsmEndpoint
func NewNSMEndpoint ¶
func NewNSMEndpoint(ctx context.Context, configuration *common.NSConfiguration, service networkservice.NetworkServiceServer) (NsmEndpoint, error)
NewNSMEndpoint creates a new NSM endpoint
type RoutesConfiguration ¶
type RoutesConfiguration []string
RoutesConfiguration is a list of prefixes for routes
type RoutesEndpoint ¶
type RoutesEndpoint struct {
// contains filtered or unexported fields
}
RoutesEndpoint -
Adds routes to the ConnectionContext for the Request
func NewRoutesEndpoint ¶
func NewRoutesEndpoint(prefixes []string) *RoutesEndpoint
NewRoutesEndpoint creates New RoutesEndpoint
func (*RoutesEndpoint) Close ¶
func (r *RoutesEndpoint) Close(ctx context.Context, conn *connection.Connection) (*empty.Empty, error)
Close handler
Consumes from ctx context.Context: Next
func (*RoutesEndpoint) Name ¶
func (r *RoutesEndpoint) Name() string
Name returns the composite name
func (*RoutesEndpoint) Request ¶
func (r *RoutesEndpoint) Request(ctx context.Context, request *networkservice.NetworkServiceRequest) (*connection.Connection, error)
Request handler
Consumes from ctx context.Context: Next