Documentation
¶
Index ¶
- Constants
- Variables
- func HairpinInterfaceSelector(ifaceName string) string
- func NotificationKey(cnfName, itemKey, puntLabel string) string
- func NotificationKeyPrefix(cnfName, itemKeyOrPrefix string) string
- func PuntSelector(puntKey string) string
- func SpanInterfaceSelector(ifaceName string) string
- func VppInterfaceSelector(ifaceName string) string
- func VrfSelector(vrf uint32) string
- type AFUnixLink
- type Config
- type Deps
- type InterconnectLink
- type InterconnectManager
- type InterconnectReq
- type InterfaceLink
- type NetNsRegistry
- type Option
- type Plugin
- func (p *Plugin) AddPunt(cnfMsLabel, key string, puntReq *pb.PuntRequest) error
- func (p *Plugin) Close() error
- func (p *Plugin) DelPunt(cnfMsLabel, key, label string) error
- func (p *Plugin) GetAllCNFPunts(cnfMsLabel string) (punts []*pb.PuntMetadata)
- func (p *Plugin) GetLinuxVrfName(vrf uint32) string
- func (p *Plugin) GetPuntDependencies(cnfMsLabel string, punt *pb.PuntRequest) (deps []kvs.Dependency)
- func (p *Plugin) GetPuntMetadata(cnfMsLabel, key, label string) *pb.PuntMetadata
- func (p *Plugin) Init() (err error)
- func (p *Plugin) UpdatePuntState(_ context.Context, req *pb.UpdatePuntStateReq) (resp *pb.UpdatePuntStateResp, err error)
- type PuntHandler
- func NewAbxPuntHandler(ifPlugin ifplugin.API) PuntHandler
- func NewDhcpProxyPuntHandler() PuntHandler
- func NewHairpinPuntHandler() PuntHandler
- func NewHairpinXConnPuntHandler() PuntHandler
- func NewIsisxPuntHandler() PuntHandler
- func NewSocketPuntHandler() PuntHandler
- func NewSpanPuntHandler() PuntHandler
- type PuntManagerAPI
- type PuntManagerNamingAPI
Constants ¶
const InternalConfigLabelKey = "io.ligato.from-client"
These constants specify label for Internal StoneWork configuration (that is configuration not configured by the user or SW-Modules).
const InternalConfigLabelValue = "stonework"
const (
NotifDescriptorName = "punt-notification"
)
const ( // PluginName is the name of the Punting Manager Plugin. // Config file name is `PluginName + ".conf"` PluginName = "puntmgr" )
Variables ¶
var DefaultPlugin = *NewPlugin()
DefaultPlugin is a default instance of the Punting Manager.
Functions ¶
func HairpinInterfaceSelector ¶
HairpinInterfaceSelector is used only by Hairpin to ensure that no two hairpin punt requests would try to create hairpin interface of the same name.
func NotificationKey ¶
NotificationKey returns key of the SB notification which is sent when the given punt is fully created (i.e. metadata are generated and configuration is applied).
func NotificationKeyPrefix ¶
NotificationKeyPrefix return prefix of NotificationKey where punt-label and potentially some suffix from itemKey are trimmed.
func PuntSelector ¶
PuntSelector is used only by socketPunt to ensure that no two punt requests attempt to configure the same punt rule.
func SpanInterfaceSelector ¶
SpanInterfaceSelector is used only by spanPunt because SPAN can be combined with other punt types without conflicts.
func VppInterfaceSelector ¶
VppInterfaceSelector selects (all/some) packets received or sent through a given VPP interface. It can be used by punts that need to reserve entire interface and cannot share it with other punt types (that use this same selector). The same interface can be punted multiple times only within the same punt type if it supports multiplexing like it is the case with ABX.
func VrfSelector ¶
VrfSelector ensures that there is at most one DHCP proxy configured for a given VRF.
Types ¶
type AFUnixLink ¶
type AFUnixLink struct {
// contains filtered or unexported fields
}
AF-UNIX socket between VPP and a CNF.
type Config ¶
type Config struct { // InterconnectAllocCIDR defines network from which /30 subnets are allocated for use by VPP<->CNF interconnects. InterconnectAllocCIDR string `json:"interconnect-alloc-cidr"` }
Config file for PuntMgr plugin.
type Deps ¶
type Deps struct { infra.PluginDeps ServiceLabel servicelabel.ReaderAPI GRPCServer grpc.Server CnfRegistry cnfreg_plugin.CnfRegistryAPI IfPlugin ifplugin.API NsPlugin nsplugin.API CfgClient client.GenericClient KVScheduler kvs.KVScheduler }
Deps is a set of dependencies of the Punt Manager plugin
type InterconnectLink ¶
type InterconnectLink interface {
// contains filtered or unexported methods
}
InterconnectLink is one of the:
- AF-UNIX socket
- pair of interfaces (memif or TAP)
and each type has type-specific parameters.
type InterconnectManager ¶
type InterconnectManager interface { // Add new VPP<->CNF/Linux interconnects needed for a given punt. // localTxn = configuration items to configure on this side (StoneWork / Standalone CNF) // remoteTxn = configuration items to configure on the side of the StoneWork module AddInterconnects(localTxn, remoteTxn client.ChangeRequest, puntId puntID, reqs []InterconnectReq, icType pb.PuntRequest_InterconnectType, enableGso bool, withMultiplex bool) (interconnects []*pb.PuntMetadata_Interconnect, err error) // Delete all VPP<->CNF/Linux interconnects created for a given punt. DelInterconnects(localTxn, remoteTxn client.ChangeRequest, puntId puntID) (err error) // GetLinuxVrfName returns the name used for Linux VRF device corresponding to the given VPP VRF. // Method is "static" in the sense that it can be called anytime, regardless of the internal state of the Manager. GetLinuxVrfName(vrf uint32) string }
InterconnectManager manages creation/deletion and sharing of VPP<->CNF/Linux interconnects.
func NewInterconnectManager ¶
type InterconnectReq ¶
type InterconnectReq struct {
// contains filtered or unexported fields
}
Request to build a VPP<->CNF interconnect.
type InterfaceLink ¶
type InterfaceLink struct {
// contains filtered or unexported fields
}
Interface-based interconnect (either with memif or TAP).
type NetNsRegistry ¶
type NetNsRegistry interface { // Get ID representing network namespace referenced by a given microservice label. // Network namespace used by multiple microservices will have the same ID regardless of which ms label // is used to query it. GetNetNsID(msLabel string) (int, error) // Each learned network namespace is used by one or more microservices. Label of one of these // microservices is designated to represent the namespace. GetNetNsLabel(id int) (msLabel string, err error) }
NetNsRegistry keeps track of all network namespaces used by CNFs.
func NewNetNsRegistry ¶
func NewNetNsRegistry(nsPlugin nsplugin.API, serviceLabel servicelabel.ReaderAPI) NetNsRegistry
type Option ¶
type Option func(plugin *Plugin)
Option is a function that can be used in NewPlugin allowing plugin customization
type Plugin ¶
type Plugin struct { pb.UnimplementedPuntManagerServer sync.Mutex Deps // contains filtered or unexported fields }
Punt icManager plugins allows for multiple ligato plugins and even distributed agents to request packet punting between VPP and the same or distinct Linux network namespace(s). Unless there is a conflict between punt requests, the manager will ensure that common configuration items are shared and properly updated (e.g. ABX rules, TAP connection, etc.). The manager supports different kinds of packet punting approaches for L2 or L3 source VPP interfaces, with memifs, TAPs or AF-UNIX sockets used to deliver packets to the Linux network stack / user-space application. The plugin can be used by:
- STANDALONE CNF (even for a single punt it is a good practise to use the plugin),
- StoneWork to orchestrate punt between the all-in-one VPP and every SW-Module,
- and by a SW-Module to learn the metadata about a created punt configuration.
func (*Plugin) AddPunt ¶
func (p *Plugin) AddPunt(cnfMsLabel, key string, puntReq *pb.PuntRequest) error
AddPunt is used by StoneWork or standalone CNF to configure punt between VPP and the CNF. If cnfMsLabel is empty then microservice label of this CNF is assumed (returned by ServiceLabel plugin).
func (*Plugin) DelPunt ¶
DelPunt is used by StoneWork or standalone CNF to un-configure punt between VPP and the CNF. If cnfMsLabel is empty then microservice label of this CNF is assumed (returned by ServiceLabel plugin).
func (*Plugin) GetAllCNFPunts ¶
func (p *Plugin) GetAllCNFPunts(cnfMsLabel string) (punts []*pb.PuntMetadata)
GetAllCNFPunts returns metadata of all punts created for the given CNF. If cnfMsLabel is empty then microservice label of this CNF is assumed (returned by ServiceLabel plugin).
func (*Plugin) GetLinuxVrfName ¶
GetLinuxVrfName returns the name used for Linux VRF device corresponding to the given VPP VRF. Method is "static" in the sense that it can be called anytime, regardless of the internal state of the plugin.
func (*Plugin) GetPuntDependencies ¶
func (p *Plugin) GetPuntDependencies(cnfMsLabel string, punt *pb.PuntRequest) (deps []kvs.Dependency)
GetPuntDependencies returns dependencies that have to be satisfied before the punt can be added.
func (*Plugin) GetPuntMetadata ¶
func (p *Plugin) GetPuntMetadata(cnfMsLabel, key, label string) *pb.PuntMetadata
GetPuntMetadata returns metadata about configured packet punting between VPP and the CNF. If cnfMsLabel is empty then microservice label of this CNF is assumed (returned by ServiceLabel plugin).
func (*Plugin) Init ¶
Init initializes internal attributes and in the case of STONEWORK_MODULE also starts gRPC server for RegisterCreatedPunt and UnregisterDeletedPunt methods.
func (*Plugin) UpdatePuntState ¶
func (p *Plugin) UpdatePuntState(_ context.Context, req *pb.UpdatePuntStateReq) (resp *pb.UpdatePuntStateResp, err error)
UpdatePuntState is called by Punt Manager of StoneWork to notify SW-Module about state change of a punt.
type PuntHandler ¶
type PuntHandler interface { // GetInterconnectReqs returns definitions of all interconnects which are required between VPP and CNF // for this punt request. GetInterconnectReqs(punt *pb.PuntRequest) []InterconnectReq // GetPuntDependencies returns dependencies that have to be satisfied before the punt can be added. GetPuntDependencies(punt *pb.PuntRequest) (deps []kvs.Dependency) // CanMultiplex enables interconnection multiplexing for this punting. It could be enabled in certain cases: // 1. two or more punts of this type can coexist even if they have the same vpp selector // 2. one or more punts of this type can coexist with other type of punts on the same (TAP-only) // interconnection if they all have the same vpp selector and cnf selector. // The TAP-backed interconnection is shared for multiple multiplexing punts with the same cnf selector // (same network namespace) and vpp selector. CanMultiplex() bool // ConfigurePunt prepares txn to (un)configures VPP-side of the punt. ConfigurePunt(txn client.ChangeRequest, puntId puntID, puntReq *pb.PuntRequest, interconnects []*pb.PuntMetadata_Interconnect, remove bool) error }
PuntHandler should be implemented one for each punt type.
func NewAbxPuntHandler ¶
func NewAbxPuntHandler(ifPlugin ifplugin.API) PuntHandler
func NewDhcpProxyPuntHandler ¶
func NewDhcpProxyPuntHandler() PuntHandler
func NewHairpinPuntHandler ¶
func NewHairpinPuntHandler() PuntHandler
func NewHairpinXConnPuntHandler ¶
func NewHairpinXConnPuntHandler() PuntHandler
func NewIsisxPuntHandler ¶
func NewIsisxPuntHandler() PuntHandler
func NewSocketPuntHandler ¶
func NewSocketPuntHandler() PuntHandler
func NewSpanPuntHandler ¶
func NewSpanPuntHandler() PuntHandler
type PuntManagerAPI ¶
type PuntManagerAPI interface { // GetPuntMetadata returns metadata about configured packet punt between VPP and the CNF. // If cnfMsLabel is empty then microservice label of this CNF is assumed (returned by ServiceLabel plugin). GetPuntMetadata(cnfMsLabel, key, label string) *pb.PuntMetadata // GetAllCNFPunts returns metadata of all punts created for the given CNF. // If cnfMsLabel is empty then microservice label of this CNF is assumed (returned by ServiceLabel plugin). GetAllCNFPunts(cnfMsLabel string) []*pb.PuntMetadata // AddPunt is used by StoneWork or standalone CNF to configure punt between VPP and the CNF. // If cnfMsLabel is empty then microservice label of this CNF is assumed (returned by ServiceLabel plugin). AddPunt(cnfMsLabel, key string, punt *pb.PuntRequest) error // DelPunt is used by StoneWork or standalone CNF to un-configure punt between VPP and the CNF. // If cnfMsLabel is empty then microservice label of this CNF is assumed (returned by ServiceLabel plugin). DelPunt(cnfMsLabel, key string, label string) error // GetPuntDependencies returns dependencies that have to be satisfied before the punt can be added. GetPuntDependencies(cnfMsLabel string, punt *pb.PuntRequest) (deps []kvs.Dependency) }
Punt Manager API.
type PuntManagerNamingAPI ¶
type PuntManagerNamingAPI interface { // GetLinuxVrfName returns the name used for Linux VRF device corresponding to the given VPP VRF. // Method is "static" in the sense that it can be called anytime, regardless of the internal state of the plugin. // Deprecated: use Punt metadata that can be obtained using GetPuntMetadata(). GetLinuxVrfName(vrf uint32) string }
API to obtain names of configuration items generated for punts. Deprecated: use Punt metadata that can be obtained using GetPuntMetadata().