rpc

package
v1.9.0-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2018 License: Apache-2.0 Imports: 38 Imported by: 0

README

RPC plugin

The RPC plugin defines services required for resync, put or delete events via gRPC. Services are defined in model

Data persistence

RPC plugin support data persistence - all resynced, created or deleted data can be mirrored to desired database. Note: data are not read during resync.

To define persistence database, config file can be used and attached via flag:

-vpp-grpc-config=<path>

The config file contains one filed which defines persistence database:

persistence-db: bolt

Only one database can be defined at a time. Database plugin has to be loaded via appropriate config file as well.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultPlugin = *NewPlugin()

DefaultPlugin is default instance of Plugin

Functions

This section is empty.

Types

type ChangeVppSvc

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

ChangeVppSvc forwards GRPC request to the localclient.

func (*ChangeVppSvc) Del

func (svc *ChangeVppSvc) Del(ctx context.Context, data *rpc.DataRequest) (*rpc.DelResponse, error)

Del removes configuration data present in data request from the VPP/linux

func (*ChangeVppSvc) Put

func (svc *ChangeVppSvc) Put(ctx context.Context, data *rpc.DataRequest) (*rpc.PutResponse, error)

Put adds configuration data present in data request to the VPP/Linux

type Config

type Config struct {
	Broker string `json:"persistence-db"`
}

Config groups configurations fields.

type Deps

type Deps struct {
	infra.PluginDeps
	GRPCServer   grpc.Server
	Brokers      map[string]keyval.KvProtoPlugin
	ServiceLabel servicelabel.ReaderAPI
	GoVppmux     govppmux.TraceAPI
	VPP          vpp.API
	Linux        linux.API
}

Deps - dependencies of Plugin

type GetVppSvc

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

GetVppSvc uses VPP/Linux plugin handlers to read VPP configuration

func (*GetVppSvc) DumpARPs

func (svc *GetVppSvc) DumpARPs(ctx context.Context, request *rpc.DumpRequest) (*rpc.ARPsResponse, error)

DumpARPs reads VPP ARPs and returns them as an *ARPsResponse. If reading ends up with error, only error is send back in response

func (*GetVppSvc) DumpAcls

func (svc *GetVppSvc) DumpAcls(ctx context.Context, request *rpc.DumpRequest) (*rpc.AclResponse, error)

DumpAcls reads IP/MACIP access lists and returns them as an *AclResponse. If reading ends up with error, only error is send back in response

func (*GetVppSvc) DumpBDs

func (svc *GetVppSvc) DumpBDs(ctx context.Context, request *rpc.DumpRequest) (*rpc.BDResponse, error)

DumpBDs reads bridge domains and returns them as an *BDResponse. If reading ends up with error, only error is send back in response

func (*GetVppSvc) DumpFIBs

func (svc *GetVppSvc) DumpFIBs(ctx context.Context, request *rpc.DumpRequest) (*rpc.FibResponse, error)

DumpFIBs reads FIBs and returns them as an *FibResponse. If reading ends up with error, only error is send back in response

func (*GetVppSvc) DumpIPSecSAs

func (svc *GetVppSvc) DumpIPSecSAs(ctx context.Context, request *rpc.DumpRequest) (*rpc.IPSecSAResponse, error)

DumpIPSecSAs reads IPSec SA and returns them as an *IPSecSAResponse. If reading ends up with error, only error is send back in response

func (*GetVppSvc) DumpIPSecSPDs

func (svc *GetVppSvc) DumpIPSecSPDs(ctx context.Context, request *rpc.DumpRequest) (*rpc.IPSecSPDResponse, error)

DumpIPSecSPDs reads IPSec SPD and returns them as an *IPSecSPDResponse. If reading ends up with error, only error is send back in response

func (*GetVppSvc) DumpIPSecTunnels

func (svc *GetVppSvc) DumpIPSecTunnels(ctx context.Context, request *rpc.DumpRequest) (*rpc.IPSecTunnelResponse, error)

DumpIPSecTunnels reads IPSec tunnels and returns them as an *IPSecTunnelResponse. If reading ends up with error, only error is send back in response

func (*GetVppSvc) DumpInterfaces

func (svc *GetVppSvc) DumpInterfaces(ctx context.Context, request *rpc.DumpRequest) (*rpc.InterfaceResponse, error)

DumpInterfaces reads interfaces and returns them as an *InterfaceResponse. If reading ends up with error, only error is send back in response

func (*GetVppSvc) DumpLinuxARPs

func (svc *GetVppSvc) DumpLinuxARPs(ctx context.Context, request *rpc.DumpRequest) (*rpc.LinuxARPsResponse, error)

DumpLinuxARPs reads linux ARPs and returns them as an *LinuxARPsResponse. If reading ends up with error, only error is send back in response

func (*GetVppSvc) DumpLinuxInterfaces

func (svc *GetVppSvc) DumpLinuxInterfaces(ctx context.Context, request *rpc.DumpRequest) (*rpc.LinuxInterfaceResponse, error)

DumpLinuxInterfaces reads linux interfaces and returns them as an *LinuxInterfaceResponse. If reading ends up with error, only error is send back in response

func (*GetVppSvc) DumpLinuxRoutes

func (svc *GetVppSvc) DumpLinuxRoutes(ctx context.Context, request *rpc.DumpRequest) (*rpc.LinuxRoutesResponse, error)

DumpLinuxRoutes reads linux routes and returns them as an *LinuxRoutesResponse. If reading ends up with error, only error is send back in response

func (*GetVppSvc) DumpPunt

func (svc *GetVppSvc) DumpPunt(ctx context.Context, request *rpc.DumpRequest) (*rpc.PuntResponse, error)

DumpPunt reads VPP Punt socket registrations and returns them as an *PuntResponse.

func (*GetVppSvc) DumpRoutes

func (svc *GetVppSvc) DumpRoutes(ctx context.Context, request *rpc.DumpRequest) (*rpc.RoutesResponse, error)

DumpRoutes reads VPP routes and returns them as an *RoutesResponse. If reading ends up with error, only error is send back in response

func (*GetVppSvc) DumpXConnects

func (svc *GetVppSvc) DumpXConnects(ctx context.Context, request *rpc.DumpRequest) (*rpc.XcResponse, error)

DumpXConnects reads cross connects and returns them as an *XcResponse. If reading ends up with error, only error is send back in response

type NotificationSvc

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

NotificationSvc forwards GRPC messages to external servers.

func (*NotificationSvc) Get

Get returns all required VPP notifications (or those available in the buffer) in the same order as they were received

type Option

type Option func(*Plugin)

Option is a function that acts on a Plugin to inject Dependencies or configuration

func UseDeps

func UseDeps(cb func(*Deps)) Option

UseDeps returns Option that can inject custom dependencies.

type Plugin

type Plugin struct {
	Deps
	// contains filtered or unexported fields
}

Plugin registers VPP GRPC services in *grpc.Server.

func NewPlugin

func NewPlugin(opts ...Option) *Plugin

NewPlugin creates a new Plugin with the provides Options

func (*Plugin) Close

func (p *Plugin) Close() error

Close does nothing.

func (*Plugin) Init

func (p *Plugin) Init() (err error)

Init sets plugin child loggers for changeVppSvc & resyncVppSvc.

type ResyncVppSvc

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

ResyncVppSvc forwards GRPC request to the localclient.

func (*ResyncVppSvc) Resync

func (svc *ResyncVppSvc) Resync(ctx context.Context, data *rpc.DataRequest) (*rpc.ResyncResponse, error)

Resync creates a resync request which adds data tp the VPP/linux

Jump to

Keyboard shortcuts

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