config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PEER_NAME = "ucnf/peerName"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Command  *Command
	Client   *Client
	DPConfig *vpp.ConfigData
}

Action is a struct to describe exec.Command, a Client initiation or a Forwarder configuration

func (*Action) Cleanup

func (a *Action) Cleanup() error

Cleanup the action

func (*Action) Process

func (a *Action) Process(ctx context.Context, backend UniversalCNFBackend, nsmclient *client.NsmClient) error

Process executes the actions as defined

type Client

type Client struct {
	Name   string
	Labels map[string]string
	Routes []string
	IfName string
}

Client is a struct to describe a NS Client setup

func (*Client) Process

func (c *Client) Process(ctx context.Context,
	backend UniversalCNFBackend, dpconfig interface{}, nsmclient *client.NsmClient) error

type Command

type Command struct {
	Name string
	Args []string
}

Command is a struct to describe exec.Command call arguments

type CompositeEndpointAddons

type CompositeEndpointAddons interface {
	AddCompositeEndpoints(*common.NSConfiguration, *nseconfig.Endpoint) *[]networkservice.NetworkServiceServer
}

type Endpoint

type Endpoint struct {
	Name    string
	Labels  map[string]string
	IfName  string
	Ipam    *IPAM
	Action  *Action
	NseName string
}

Endpoint is a struct to describe a NS Endpoint setup and the related VPP config changes

type IPAM

type IPAM struct {
	PrefixPool string
	Routes     []string
}

IPAM holds the configuration of the IP address management

type IpamService

type IpamService interface {
	AllocateSubnet(ucnfEndpoint *nseconfig.Endpoint) (string, error)
}

func NewIpamService

func NewIpamService(ctx context.Context, addr string) (IpamService, error)

type IpamServiceImpl

type IpamServiceImpl struct {
	IpamAllocator     ipprovider.AllocatorClient
	RegisteredSubnets chan *ipprovider.Subnet
}

func (*IpamServiceImpl) AllocateSubnet

func (i *IpamServiceImpl) AllocateSubnet(ucnfEndpoint *nseconfig.Endpoint) (string, error)

func (*IpamServiceImpl) Cleanup

func (i *IpamServiceImpl) Cleanup(subnets map[string]*ipprovider.Subnet) error

func (*IpamServiceImpl) Renew

func (i *IpamServiceImpl) Renew(ctx context.Context, errorHandler func(err error)) error

type ProcessEndpoints

type ProcessEndpoints struct {
	Endpoints []*SingleEndpoint
}

ProcessEndpoints keeps the state of the running network service endpoints

func NewProcessEndpoints

func NewProcessEndpoints(backend UniversalCNFBackend, endpoints []*nseconfig.Endpoint, nsconfig *common.NSConfiguration, ceAddons CompositeEndpointAddons, ctx context.Context) *ProcessEndpoints

NewProcessEndpoints returns a new ProcessInitCommands struct

func (*ProcessEndpoints) Cleanup

func (pe *ProcessEndpoints) Cleanup()

Cleanup - cleans up before exit

func (*ProcessEndpoints) Process

func (pe *ProcessEndpoints) Process() error

Process iterates over the init commands and applies them

type ProcessInitActions

type ProcessInitActions struct {
	InitActions []*SingleAction
}

ProcessInitActions keeps the state of the initial setup

func NewProcessInitActions

func NewProcessInitActions(backend UniversalCNFBackend, initactions []*Action,
	nsConfig *common.NSConfiguration) *ProcessInitActions

NewProcessInitActions returns a new ProcessInitCommands struct

func (*ProcessInitActions) Cleanup

func (pia *ProcessInitActions) Cleanup()

Cleanup - cleans up before exit

func (*ProcessInitActions) Process

func (pia *ProcessInitActions) Process(ctx context.Context, backend UniversalCNFBackend) error

Process iterates over the init commands and applies them

type SingleAction

type SingleAction struct {
	Action *Action
	// contains filtered or unexported fields
}

SingleClient is a single client instance combining the CNF configuration and the NS Client

type SingleEndpoint

type SingleEndpoint struct {
	NSConfiguration *common.NSConfiguration
	NSComposite     networkservice.NetworkServiceServer
	Endpoint        *nseconfig.Endpoint
	Cleanup         func()
}

SingleEndpoint keeps the state of a single endpoint instance

type UniversalCNFBackend

type UniversalCNFBackend interface {
	NewDPConfig() *vpp.ConfigData
	NewUniversalCNFBackend() error
	ProcessClient(dpconfig interface{}, ifName string, conn *connection.Connection) error
	ProcessEndpoint(dpconfig interface{}, serviceName, ifName string, conn *connection.Connection) error
	ProcessDPConfig(dpconfig interface{}, update bool) error
}

type UniversalCNFConfig

type UniversalCNFConfig struct {
	InitActions []*Action
	Endpoints   []*Endpoint
	// contains filtered or unexported fields
}

UniversalCNFConfig hold the CNF configuration

func NewUniversalCNFConfig

func NewUniversalCNFConfig(backend UniversalCNFBackend) (*UniversalCNFConfig, error)

NewUniversalCNFConfig creates an empty CNF configuration

func (*UniversalCNFConfig) Dump

func (c *UniversalCNFConfig) Dump()

Dump dumps the current state of the CNF config using spew

func (*UniversalCNFConfig) GetBackend

func (c *UniversalCNFConfig) GetBackend() UniversalCNFBackend

func (*UniversalCNFConfig) InitConfig

func (c *UniversalCNFConfig) InitConfig(configpath string) error

InitConfig init CNF config from a specified path (or default)

func (*UniversalCNFConfig) InitConfigFromRawYaml

func (c *UniversalCNFConfig) InitConfigFromRawYaml(rawyaml []byte) error

InitConfigFromRawYaml init CNF config from a byte slice

type UniversalCNFEndpoint

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

UniversalCNFEndpoint is a Universal CNF Endpoint composite implementation

func NewUniversalCNFEndpoint

func NewUniversalCNFEndpoint(backend UniversalCNFBackend, e *nseconfig.Endpoint) *UniversalCNFEndpoint

NewUniversalCNFEndpoint creates a MonitorEndpoint

func (*UniversalCNFEndpoint) Close

func (uce *UniversalCNFEndpoint) Close(ctx context.Context, connection *connection.Connection) (*empty.Empty, error)

Close implements the close handler

func (*UniversalCNFEndpoint) Name

func (uce *UniversalCNFEndpoint) Name() string

Name returns the composite name

func (*UniversalCNFEndpoint) Request

Request implements the request handler

Jump to

Keyboard shortcuts

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