Documentation ¶
Overview ¶
Package ifplugin implements the Interface plugin that handles management of VPP interfaces.
Index ¶
- Constants
- func AuthKeyIdentifier(id uint32) string
- func GetIDMappingIdentifier(mapping *nat.Nat44DNat_DNatConfig_IdentityMapping) string
- func GetStMappingIdentifier(mapping *nat.Nat44DNat_DNatConfig_StaticMapping) string
- func StnIdentifier(iface string) string
- type AFPacketConfigurator
- func (c *AFPacketConfigurator) ConfigureAfPacketInterface(afpacket *intf.Interfaces_Interface) (swIndex uint32, pending bool, err error)
- func (c *AFPacketConfigurator) DeleteAfPacketInterface(afpacket *intf.Interfaces_Interface, ifIdx uint32) (err error)
- func (c *AFPacketConfigurator) GetAfPacketStatusByHost(hostIf string) (exists, pending bool, ifData *intf.Interfaces_Interface)
- func (c *AFPacketConfigurator) GetAfPacketStatusByName(name string) (exists, pending bool, ifData *intf.Interfaces_Interface)
- func (c *AFPacketConfigurator) GetHostInterfacesEntry(hostIf string) bool
- func (c *AFPacketConfigurator) Init(logger logging.Logger, ifHandler vppcalls.IfVppAPI, linux interface{}, ...) (err error)
- func (c *AFPacketConfigurator) IsPendingAfPacket(iface *intf.Interfaces_Interface) (pending bool)
- func (c *AFPacketConfigurator) ModifyAfPacketInterface(newConfig *intf.Interfaces_Interface, oldConfig *intf.Interfaces_Interface) (recreate bool, err error)
- func (c *AFPacketConfigurator) ResolveCreatedLinuxInterface(ifName, hostIfName string, ifIdx uint32) (*intf.Interfaces_Interface, error)
- func (c *AFPacketConfigurator) ResolveDeletedLinuxInterface(ifName, hostIfName string, ifIdx uint32) error
- type AfPacketConfig
- type BFDConfigurator
- func (c *BFDConfigurator) Close() error
- func (c *BFDConfigurator) ConfigureBfdAuthKey(bfdAuthKey *bfd.SingleHopBFD_Key) error
- func (c *BFDConfigurator) ConfigureBfdEchoFunction(bfdInput *bfd.SingleHopBFD_EchoFunction) error
- func (c *BFDConfigurator) ConfigureBfdSession(bfdInput *bfd.SingleHopBFD_Session) error
- func (c *BFDConfigurator) DeleteBfdAuthKey(bfdInput *bfd.SingleHopBFD_Key) error
- func (c *BFDConfigurator) DeleteBfdEchoFunction(bfdInput *bfd.SingleHopBFD_EchoFunction) error
- func (c *BFDConfigurator) DeleteBfdSession(bfdInput *bfd.SingleHopBFD_Session) error
- func (c *BFDConfigurator) GetBfdEchoFunctionIndexes() idxvpp.NameToIdxRW
- func (c *BFDConfigurator) GetBfdKeyIndexes() idxvpp.NameToIdxRW
- func (c *BFDConfigurator) GetBfdSessionIndexes() idxvpp.NameToIdxRW
- func (c *BFDConfigurator) Init(logger logging.PluginLogger, goVppMux govppmux.API, ...) (err error)
- func (c *BFDConfigurator) LogError(err error) error
- func (c *BFDConfigurator) ModifyBfdAuthKey(oldInput *bfd.SingleHopBFD_Key, newInput *bfd.SingleHopBFD_Key) error
- func (c *BFDConfigurator) ModifyBfdEchoFunction(oldInput *bfd.SingleHopBFD_EchoFunction, ...) error
- func (c *BFDConfigurator) ModifyBfdSession(oldBfdInput *bfd.SingleHopBFD_Session, newBfdInput *bfd.SingleHopBFD_Session) error
- func (c *BFDConfigurator) ResyncAuthKey(nbKeys []*bfd.SingleHopBFD_Key) error
- func (c *BFDConfigurator) ResyncEchoFunction(echoFunctions []*bfd.SingleHopBFD_EchoFunction) error
- func (c *BFDConfigurator) ResyncSession(nbSessions []*bfd.SingleHopBFD_Session) error
- type InterfaceConfigurator
- func (c *InterfaceConfigurator) Close() error
- func (c *InterfaceConfigurator) ConfigureVPPInterface(iface *intf.Interfaces_Interface) (err error)
- func (c *InterfaceConfigurator) DeleteVPPInterface(iface *intf.Interfaces_Interface) error
- func (c *InterfaceConfigurator) GetDHCPIndexes() ifaceidx.DhcpIndexRW
- func (c *InterfaceConfigurator) GetSwIfIndexes() ifaceidx.SwIfIndexRW
- func (c *InterfaceConfigurator) Init(logger logging.PluginLogger, goVppMux govppmux.API, linux interface{}, ...) (err error)
- func (c *InterfaceConfigurator) IsMulticastVxLanIfCached(ifName string) bool
- func (c *InterfaceConfigurator) IsSocketFilenameCached(filename string) bool
- func (c *InterfaceConfigurator) IsUnnumberedIfCached(ifName string) bool
- func (c *InterfaceConfigurator) LogError(err error) error
- func (c *InterfaceConfigurator) ModifyVPPInterface(newConfig *intf.Interfaces_Interface, oldConfig *intf.Interfaces_Interface) error
- func (c *InterfaceConfigurator) ResolveCreatedLinuxInterface(ifName, hostIfName string, ifIdx uint32) error
- func (c *InterfaceConfigurator) ResolveDeletedLinuxInterface(ifName, hostIfName string, ifIdx uint32) error
- func (c *InterfaceConfigurator) Resync(nbIfs []*intf.Interfaces_Interface) error
- func (c *InterfaceConfigurator) VerifyVPPConfigPresence(nbIfaces []*intf.Interfaces_Interface) bool
- type InterfaceStateUpdater
- type NatConfigurator
- func (c *NatConfigurator) Close() error
- func (c *NatConfigurator) ConfigureDNat(dNat *nat.Nat44DNat_DNatConfig) error
- func (c *NatConfigurator) ConfigureSNat(sNat *nat.Nat44SNat_SNatConfig) error
- func (c *NatConfigurator) DeleteDNat(dNat *nat.Nat44DNat_DNatConfig) error
- func (c *NatConfigurator) DeleteNatGlobalConfig(config *nat.Nat44Global) (err error)
- func (c *NatConfigurator) DeleteSNat(sNat *nat.Nat44SNat_SNatConfig) error
- func (c *NatConfigurator) DumpNatDNat() (*nat.Nat44DNat, error)
- func (c *NatConfigurator) DumpNatGlobal() (*nat.Nat44Global, error)
- func (c *NatConfigurator) GetGlobalNat() *nat.Nat44Global
- func (c *NatConfigurator) Init(logger logging.PluginLogger, goVppMux govppmux.API, ...) (err error)
- func (c *NatConfigurator) IsDNatLabelIDMappingRegistered(id string) bool
- func (c *NatConfigurator) IsDNatLabelRegistered(label string) bool
- func (c *NatConfigurator) IsDNatLabelStMappingRegistered(id string) bool
- func (c *NatConfigurator) IsInNotDisabledIfCache(ifName string) bool
- func (c *NatConfigurator) IsInNotEnabledIfCache(ifName string) bool
- func (c *NatConfigurator) LogError(err error) error
- func (c *NatConfigurator) ModifyDNat(oldDNat, newDNat *nat.Nat44DNat_DNatConfig) error
- func (c *NatConfigurator) ModifyNatGlobalConfig(oldConfig, newConfig *nat.Nat44Global) (err error)
- func (c *NatConfigurator) ModifySNat(oldSNat, newSNat *nat.Nat44SNat_SNatConfig) error
- func (c *NatConfigurator) ResolveCreatedInterface(ifName string, ifIdx uint32) error
- func (c *NatConfigurator) ResolveDeletedInterface(ifName string, ifIdx uint32) error
- func (c *NatConfigurator) ResyncDNat(nbDNatConfig []*nat.Nat44DNat_DNatConfig) error
- func (c *NatConfigurator) ResyncNatGlobal(nbGlobal *nat.Nat44Global) error
- func (c *NatConfigurator) ResyncSNat(sNatConf []*nat.Nat44SNat_SNatConfig) error
- func (c *NatConfigurator) SetNatGlobalConfig(config *nat.Nat44Global) error
- type StnConfigurator
- func (c *StnConfigurator) Add(rule *modelStn.STN_Rule) error
- func (c *StnConfigurator) Close() error
- func (c *StnConfigurator) Delete(rule *modelStn.STN_Rule) error
- func (c *StnConfigurator) Dump() (*vppcalls.StnDetails, error)
- func (c *StnConfigurator) IndexExistsFor(name string) bool
- func (c *StnConfigurator) Init(logger logging.PluginLogger, goVppMux govppmux.API, ...) (err error)
- func (c *StnConfigurator) LogError(err error) error
- func (c *StnConfigurator) Modify(ruleOld *modelStn.STN_Rule, ruleNew *modelStn.STN_Rule) error
- func (c *StnConfigurator) ResolveCreatedInterface(interfaceName string) error
- func (c *StnConfigurator) ResolveDeletedInterface(interfaceName string) error
- func (c *StnConfigurator) Resync(nbStnRules []*stn.STN_Rule) error
- func (c *StnConfigurator) UnstoredIndexExistsFor(name string) bool
Constants ¶
const ( Drop counterType = 0 Punt = 1 IPv4 = 2 IPv6 = 3 RxNoBuf = 4 RxMiss = 5 RxError = 6 TxError = 7 MPLS = 8 )
constants as defined in the vnet_interface_counter_type_t enum in 'vnet/interface.h'
const ( Rx combinedCounterType = 0 Tx = 1 )
constants as defined in the vnet_interface_counter_type_t enum in 'vnet/interface.h'
Variables ¶
This section is empty.
Functions ¶
func AuthKeyIdentifier ¶
AuthKeyIdentifier generates common identifier for authentication key
func GetIDMappingIdentifier ¶ added in v1.8.1
func GetIDMappingIdentifier(mapping *nat.Nat44DNat_DNatConfig_IdentityMapping) string
GetIDMappingIdentifier returns unique ID of the mapping
func GetStMappingIdentifier ¶
func GetStMappingIdentifier(mapping *nat.Nat44DNat_DNatConfig_StaticMapping) string
GetStMappingIdentifier returns unique ID of the mapping
func StnIdentifier ¶
StnIdentifier creates unique identifier which serves as a name in name to index mapping
Types ¶
type AFPacketConfigurator ¶
type AFPacketConfigurator struct {
// contains filtered or unexported fields
}
AFPacketConfigurator is used by InterfaceConfigurator to execute afpacket-specific management operations. Most importantly it needs to ensure that Afpacket interface is create AFTER the associated host interface.
func (*AFPacketConfigurator) ConfigureAfPacketInterface ¶
func (c *AFPacketConfigurator) ConfigureAfPacketInterface(afpacket *intf.Interfaces_Interface) (swIndex uint32, pending bool, err error)
ConfigureAfPacketInterface creates a new Afpacket interface or marks it as pending if the target host interface doesn't exist yet.
func (*AFPacketConfigurator) DeleteAfPacketInterface ¶
func (c *AFPacketConfigurator) DeleteAfPacketInterface(afpacket *intf.Interfaces_Interface, ifIdx uint32) (err error)
DeleteAfPacketInterface removes Afpacket interface from VPP and from the cache.
func (*AFPacketConfigurator) GetAfPacketStatusByHost ¶
func (c *AFPacketConfigurator) GetAfPacketStatusByHost(hostIf string) (exists, pending bool, ifData *intf.Interfaces_Interface)
GetAfPacketStatusByHost looks for cached interface by host interface and returns its state and data
func (*AFPacketConfigurator) GetAfPacketStatusByName ¶
func (c *AFPacketConfigurator) GetAfPacketStatusByName(name string) (exists, pending bool, ifData *intf.Interfaces_Interface)
GetAfPacketStatusByName looks for cached interface by its name and returns its state and data
func (*AFPacketConfigurator) GetHostInterfacesEntry ¶
func (c *AFPacketConfigurator) GetHostInterfacesEntry(hostIf string) bool
GetHostInterfacesEntry looks for cached host interface and returns true if exists
func (*AFPacketConfigurator) Init ¶
func (c *AFPacketConfigurator) Init(logger logging.Logger, ifHandler vppcalls.IfVppAPI, linux interface{}, indexes ifaceidx.SwIfIndexRW) (err error)
Init members of AFPacketConfigurator.
func (*AFPacketConfigurator) IsPendingAfPacket ¶
func (c *AFPacketConfigurator) IsPendingAfPacket(iface *intf.Interfaces_Interface) (pending bool)
IsPendingAfPacket returns true if the given config belongs to pending Afpacket interface.
func (*AFPacketConfigurator) ModifyAfPacketInterface ¶
func (c *AFPacketConfigurator) ModifyAfPacketInterface(newConfig *intf.Interfaces_Interface, oldConfig *intf.Interfaces_Interface) (recreate bool, err error)
ModifyAfPacketInterface updates the cache with afpacket configurations and tells InterfaceConfigurator if the interface needs to be recreated for the changes to be applied.
func (*AFPacketConfigurator) ResolveCreatedLinuxInterface ¶
func (c *AFPacketConfigurator) ResolveCreatedLinuxInterface(ifName, hostIfName string, ifIdx uint32) (*intf.Interfaces_Interface, error)
ResolveCreatedLinuxInterface reacts to a newly created Linux interface.
func (*AFPacketConfigurator) ResolveDeletedLinuxInterface ¶
func (c *AFPacketConfigurator) ResolveDeletedLinuxInterface(ifName, hostIfName string, ifIdx uint32) error
ResolveDeletedLinuxInterface reacts to a removed Linux interface.
type AfPacketConfig ¶
type AfPacketConfig struct {
// contains filtered or unexported fields
}
AfPacketConfig wraps the proto formatted configuration of an Afpacket interface together with a flag that tells if the interface is waiting for a host interface to get created.
type BFDConfigurator ¶
type BFDConfigurator struct {
// contains filtered or unexported fields
}
BFDConfigurator runs in the background in its own goroutine where it watches for any changes in the configuration of BFDs as modelled by the proto file "../model/bfd/bfd.proto" and stored in ETCD under the key "/vnf-agent/{agent-label}/vpp/config/v1/bfd/". Updates received from the northbound API are compared with the VPP run-time configuration and differences are applied through the VPP binary API.
func (*BFDConfigurator) ConfigureBfdAuthKey ¶
func (c *BFDConfigurator) ConfigureBfdAuthKey(bfdAuthKey *bfd.SingleHopBFD_Key) error
ConfigureBfdAuthKey crates new authentication key which can be used for BFD session
func (*BFDConfigurator) ConfigureBfdEchoFunction ¶
func (c *BFDConfigurator) ConfigureBfdEchoFunction(bfdInput *bfd.SingleHopBFD_EchoFunction) error
ConfigureBfdEchoFunction is used to setup BFD Echo function on existing interface
func (*BFDConfigurator) ConfigureBfdSession ¶
func (c *BFDConfigurator) ConfigureBfdSession(bfdInput *bfd.SingleHopBFD_Session) error
ConfigureBfdSession configures bfd session (including authentication if exists). Provided interface has to contain ip address defined in BFD as source
func (*BFDConfigurator) DeleteBfdAuthKey ¶
func (c *BFDConfigurator) DeleteBfdAuthKey(bfdInput *bfd.SingleHopBFD_Key) error
DeleteBfdAuthKey removes BFD authentication key but only if it is not used in any BFD session
func (*BFDConfigurator) DeleteBfdEchoFunction ¶
func (c *BFDConfigurator) DeleteBfdEchoFunction(bfdInput *bfd.SingleHopBFD_EchoFunction) error
DeleteBfdEchoFunction removes BFD echo function
func (*BFDConfigurator) DeleteBfdSession ¶
func (c *BFDConfigurator) DeleteBfdSession(bfdInput *bfd.SingleHopBFD_Session) error
DeleteBfdSession removes BFD session
func (*BFDConfigurator) GetBfdEchoFunctionIndexes ¶
func (c *BFDConfigurator) GetBfdEchoFunctionIndexes() idxvpp.NameToIdxRW
GetBfdEchoFunctionIndexes gives access to BFD echo function indexes
func (*BFDConfigurator) GetBfdKeyIndexes ¶
func (c *BFDConfigurator) GetBfdKeyIndexes() idxvpp.NameToIdxRW
GetBfdKeyIndexes gives access to BFD key indexes
func (*BFDConfigurator) GetBfdSessionIndexes ¶
func (c *BFDConfigurator) GetBfdSessionIndexes() idxvpp.NameToIdxRW
GetBfdSessionIndexes gives access to BFD session indexes
func (*BFDConfigurator) Init ¶
func (c *BFDConfigurator) Init(logger logging.PluginLogger, goVppMux govppmux.API, swIfIndexes ifaceidx.SwIfIndex) (err error)
Init members and channels
func (*BFDConfigurator) LogError ¶ added in v1.8.1
func (c *BFDConfigurator) LogError(err error) error
LogError prints error if not nil, including stack trace. The same value is also returned, so it can be easily propagated further
func (*BFDConfigurator) ModifyBfdAuthKey ¶
func (c *BFDConfigurator) ModifyBfdAuthKey(oldInput *bfd.SingleHopBFD_Key, newInput *bfd.SingleHopBFD_Key) error
ModifyBfdAuthKey modifies auth key fields. Key which is assigned to one or more BFD session cannot be modified
func (*BFDConfigurator) ModifyBfdEchoFunction ¶
func (c *BFDConfigurator) ModifyBfdEchoFunction(oldInput *bfd.SingleHopBFD_EchoFunction, newInput *bfd.SingleHopBFD_EchoFunction) error
ModifyBfdEchoFunction handles echo function changes
func (*BFDConfigurator) ModifyBfdSession ¶
func (c *BFDConfigurator) ModifyBfdSession(oldBfdInput *bfd.SingleHopBFD_Session, newBfdInput *bfd.SingleHopBFD_Session) error
ModifyBfdSession modifies BFD session fields. Source and destination IP address for old and new config has to be the same. Authentication is NOT changed here, BFD modify bin api call does not support that
func (*BFDConfigurator) ResyncAuthKey ¶
func (c *BFDConfigurator) ResyncAuthKey(nbKeys []*bfd.SingleHopBFD_Key) error
ResyncAuthKey writes BFD keys to the empty VPP
func (*BFDConfigurator) ResyncEchoFunction ¶
func (c *BFDConfigurator) ResyncEchoFunction(echoFunctions []*bfd.SingleHopBFD_EchoFunction) error
ResyncEchoFunction writes BFD echo function to the empty VPP
func (*BFDConfigurator) ResyncSession ¶
func (c *BFDConfigurator) ResyncSession(nbSessions []*bfd.SingleHopBFD_Session) error
ResyncSession writes BFD sessions to the empty VPP
type InterfaceConfigurator ¶
type InterfaceConfigurator struct { // Notification channels NotifChan chan govppapi.Message // to publish SwInterfaceDetails to interface_state.go DhcpChan chan govppapi.Message // channel to receive DHCP notifications // contains filtered or unexported fields }
InterfaceConfigurator runs in the background in its own goroutine where it watches for any changes in the configuration of interfaces as modelled by the proto file "../model/interfaces/interfaces.proto" and stored in ETCD under the key "/vnf-agent/{vnf-agent}/vpp/config/v1interface". Updates received from the northbound API are compared with the VPP run-time configuration and differences are applied through the VPP binary API.
func (*InterfaceConfigurator) Close ¶
func (c *InterfaceConfigurator) Close() error
Close GOVPP channel
func (*InterfaceConfigurator) ConfigureVPPInterface ¶
func (c *InterfaceConfigurator) ConfigureVPPInterface(iface *intf.Interfaces_Interface) (err error)
ConfigureVPPInterface reacts to a new northbound VPP interface config by creating and configuring the interface in the VPP network stack through the VPP binary API.
func (*InterfaceConfigurator) DeleteVPPInterface ¶
func (c *InterfaceConfigurator) DeleteVPPInterface(iface *intf.Interfaces_Interface) error
DeleteVPPInterface reacts to a removed NB configuration of a VPP interface. It results in the interface being removed from VPP.
func (*InterfaceConfigurator) GetDHCPIndexes ¶
func (c *InterfaceConfigurator) GetDHCPIndexes() ifaceidx.DhcpIndexRW
GetDHCPIndexes exposes DHCP name-to-index mapping
func (*InterfaceConfigurator) GetSwIfIndexes ¶
func (c *InterfaceConfigurator) GetSwIfIndexes() ifaceidx.SwIfIndexRW
GetSwIfIndexes exposes interface name-to-index mapping
func (*InterfaceConfigurator) Init ¶
func (c *InterfaceConfigurator) Init(logger logging.PluginLogger, goVppMux govppmux.API, linux interface{}, notifChan chan govppapi.Message, defaultMtu uint32) (err error)
Init members (channels...) and start go routines
func (*InterfaceConfigurator) IsMulticastVxLanIfCached ¶
func (c *InterfaceConfigurator) IsMulticastVxLanIfCached(ifName string) bool
IsMulticastVxLanIfCached returns true if provided interface is cached as VxLAN with missing multicast interface
func (*InterfaceConfigurator) IsSocketFilenameCached ¶
func (c *InterfaceConfigurator) IsSocketFilenameCached(filename string) bool
IsSocketFilenameCached returns true if provided filename is presented in the cache
func (*InterfaceConfigurator) IsUnnumberedIfCached ¶
func (c *InterfaceConfigurator) IsUnnumberedIfCached(ifName string) bool
IsUnnumberedIfCached returns true if provided interface is cached as unconfigurabel unnubered interface
func (*InterfaceConfigurator) LogError ¶ added in v1.8.1
func (c *InterfaceConfigurator) LogError(err error) error
LogError prints error if not nil, including stack trace. The same value is also returned, so it can be easily propagated further
func (*InterfaceConfigurator) ModifyVPPInterface ¶
func (c *InterfaceConfigurator) ModifyVPPInterface(newConfig *intf.Interfaces_Interface, oldConfig *intf.Interfaces_Interface) error
ModifyVPPInterface applies changes in the NB configuration of a VPP interface into the running VPP through the VPP binary API.
func (*InterfaceConfigurator) ResolveCreatedLinuxInterface ¶
func (c *InterfaceConfigurator) ResolveCreatedLinuxInterface(ifName, hostIfName string, ifIdx uint32) error
ResolveCreatedLinuxInterface reacts to a newly created Linux interface.
func (*InterfaceConfigurator) ResolveDeletedLinuxInterface ¶
func (c *InterfaceConfigurator) ResolveDeletedLinuxInterface(ifName, hostIfName string, ifIdx uint32) error
ResolveDeletedLinuxInterface reacts to a removed Linux interface.
func (*InterfaceConfigurator) Resync ¶
func (c *InterfaceConfigurator) Resync(nbIfs []*intf.Interfaces_Interface) error
Resync writes interfaces to the VPP. VPP interfaces are usually configured with tag, which corresponds with interface name (exceptions are physical devices, but their name is always equal to vpp internal name). Resync consists of following steps:
- Dump all VPP interfaces
- Every VPP interface looks for NB counterpart using tag (name). If found, it is calculated whether modification is needed. Otherwise, the interface is only registered. If interface does not contain tag, it is stored for now and resolved later. Tagged interfaces without NB config are removed.
- Untagged interfaces are correlated heuristically (mac address, ip addresses). If correlation is found, interface is modified if needed and registered.
- All remaining NB interfaces are configured
func (*InterfaceConfigurator) VerifyVPPConfigPresence ¶
func (c *InterfaceConfigurator) VerifyVPPConfigPresence(nbIfaces []*intf.Interfaces_Interface) bool
VerifyVPPConfigPresence dumps VPP interface configuration on the vpp. If there are any interfaces configured (except the local0), it returns false (do not interrupt the resto of the resync), otherwise returns true
type InterfaceStateUpdater ¶
type InterfaceStateUpdater struct {
// contains filtered or unexported fields
}
InterfaceStateUpdater holds state data of all VPP interfaces.
func (*InterfaceStateUpdater) AfterInit ¶
func (c *InterfaceStateUpdater) AfterInit() error
AfterInit subscribes for watching VPP notifications on previously initialized channel
func (*InterfaceStateUpdater) Close ¶
func (c *InterfaceStateUpdater) Close() error
Close unsubscribes from interface state notifications from VPP & GOVPP channel
func (*InterfaceStateUpdater) Init ¶
func (c *InterfaceStateUpdater) Init(ctx context.Context, logger logging.PluginLogger, goVppMux govppmux.API, swIfIndexes ifaceidx.SwIfIndex, notifChan chan govppapi.Message, publishIfState func(notification *intf.InterfaceNotification)) (err error)
Init members (channels, maps...) and start go routines
func (*InterfaceStateUpdater) LogError ¶ added in v1.8.1
func (c *InterfaceStateUpdater) LogError(err error) error
LogError prints error if not nil, including stack trace. The same value is also returned, so it can be easily propagated further
type NatConfigurator ¶
type NatConfigurator struct {
// contains filtered or unexported fields
}
NatConfigurator runs in the background in its own goroutine where it watches for any changes in the configuration of NAT address pools and static entries with or without a load ballance, as modelled by the proto file "../common/model/nat/nat.proto" and stored in ETCD under the keys:
- "/vnf-agent/{agent-label}/vpp/config/v1/nat/{vrf}/addrpool/" for NAT address pool
- "/vnf-agent/{agent-label}/vpp/config/v1/nat/{vrf}/static/" for NAT static mapping
- "/vnf-agent/{agent-label}/vpp/config/v1/nat/{vrf}/staticlb/" for NAT static mapping with load balancer
Updates received from the northbound API are compared with the VPP run-time configuration and differences are applied through the VPP binary API.
func (*NatConfigurator) ConfigureDNat ¶
func (c *NatConfigurator) ConfigureDNat(dNat *nat.Nat44DNat_DNatConfig) error
ConfigureDNat configures new DNAT setup
func (*NatConfigurator) ConfigureSNat ¶
func (c *NatConfigurator) ConfigureSNat(sNat *nat.Nat44SNat_SNatConfig) error
ConfigureSNat configures new SNAT setup
func (*NatConfigurator) DeleteDNat ¶
func (c *NatConfigurator) DeleteDNat(dNat *nat.Nat44DNat_DNatConfig) error
DeleteDNat removes existing DNAT setup
func (*NatConfigurator) DeleteNatGlobalConfig ¶
func (c *NatConfigurator) DeleteNatGlobalConfig(config *nat.Nat44Global) (err error)
DeleteNatGlobalConfig removes common setup for all NAT use cases
func (*NatConfigurator) DeleteSNat ¶
func (c *NatConfigurator) DeleteSNat(sNat *nat.Nat44SNat_SNatConfig) error
DeleteSNat removes existing SNAT setup
func (*NatConfigurator) DumpNatDNat ¶
func (c *NatConfigurator) DumpNatDNat() (*nat.Nat44DNat, error)
DumpNatDNat returns the current NAT44 DNAT config
func (*NatConfigurator) DumpNatGlobal ¶
func (c *NatConfigurator) DumpNatGlobal() (*nat.Nat44Global, error)
DumpNatGlobal returns the current NAT44 global config
func (*NatConfigurator) GetGlobalNat ¶
func (c *NatConfigurator) GetGlobalNat() *nat.Nat44Global
GetGlobalNat makes current global nat accessible
func (*NatConfigurator) Init ¶
func (c *NatConfigurator) Init(logger logging.PluginLogger, goVppMux govppmux.API, ifIndexes ifaceidx.SwIfIndex) (err error)
Init NAT configurator
func (*NatConfigurator) IsDNatLabelIDMappingRegistered ¶ added in v1.8.1
func (c *NatConfigurator) IsDNatLabelIDMappingRegistered(id string) bool
IsDNatLabelIDMappingRegistered checks if DNAT identity mapping with provided id is registered
func (*NatConfigurator) IsDNatLabelRegistered ¶
func (c *NatConfigurator) IsDNatLabelRegistered(label string) bool
IsDNatLabelRegistered checks if interface is present in 'notDisabledIfs' cache
func (*NatConfigurator) IsDNatLabelStMappingRegistered ¶
func (c *NatConfigurator) IsDNatLabelStMappingRegistered(id string) bool
IsDNatLabelStMappingRegistered checks if DNAT static mapping with provided id is registered
func (*NatConfigurator) IsInNotDisabledIfCache ¶
func (c *NatConfigurator) IsInNotDisabledIfCache(ifName string) bool
IsInNotDisabledIfCache checks if interface is present in 'notDisabledIfs' cache
func (*NatConfigurator) IsInNotEnabledIfCache ¶
func (c *NatConfigurator) IsInNotEnabledIfCache(ifName string) bool
IsInNotEnabledIfCache checks if interface is present in 'notEnabledIfs' cache
func (*NatConfigurator) LogError ¶ added in v1.8.1
func (c *NatConfigurator) LogError(err error) error
LogError prints error if not nil, including stack trace. The same value is also returned, so it can be easily propagated further
func (*NatConfigurator) ModifyDNat ¶
func (c *NatConfigurator) ModifyDNat(oldDNat, newDNat *nat.Nat44DNat_DNatConfig) error
ModifyDNat modifies existing DNAT setup
func (*NatConfigurator) ModifyNatGlobalConfig ¶
func (c *NatConfigurator) ModifyNatGlobalConfig(oldConfig, newConfig *nat.Nat44Global) (err error)
ModifyNatGlobalConfig modifies common setup for all NAT use cases
func (*NatConfigurator) ModifySNat ¶
func (c *NatConfigurator) ModifySNat(oldSNat, newSNat *nat.Nat44SNat_SNatConfig) error
ModifySNat modifies existing SNAT setup
func (*NatConfigurator) ResolveCreatedInterface ¶
func (c *NatConfigurator) ResolveCreatedInterface(ifName string, ifIdx uint32) error
ResolveCreatedInterface looks for cache of interfaces which should be enabled or disabled for NAT
func (*NatConfigurator) ResolveDeletedInterface ¶
func (c *NatConfigurator) ResolveDeletedInterface(ifName string, ifIdx uint32) error
ResolveDeletedInterface handles removed interface from NAT perspective
func (*NatConfigurator) ResyncDNat ¶
func (c *NatConfigurator) ResyncDNat(nbDNatConfig []*nat.Nat44DNat_DNatConfig) error
ResyncDNat writes NAT static mapping config to the the empty VPP
func (*NatConfigurator) ResyncNatGlobal ¶
func (c *NatConfigurator) ResyncNatGlobal(nbGlobal *nat.Nat44Global) error
ResyncNatGlobal writes NAT address pool config to the the empty VPP
func (*NatConfigurator) ResyncSNat ¶
func (c *NatConfigurator) ResyncSNat(sNatConf []*nat.Nat44SNat_SNatConfig) error
ResyncSNat writes NAT static mapping config to the the empty VPP
func (*NatConfigurator) SetNatGlobalConfig ¶
func (c *NatConfigurator) SetNatGlobalConfig(config *nat.Nat44Global) error
SetNatGlobalConfig configures common setup for all NAT use cases
type StnConfigurator ¶
type StnConfigurator struct {
// contains filtered or unexported fields
}
StnConfigurator runs in the background in its own goroutine where it watches for any changes in the configuration of interfaces as modelled by the proto file "../model/stn/stn.proto" and stored in ETCD under the key "vpp/config/v1/stn/rules/".
func (*StnConfigurator) Add ¶
func (c *StnConfigurator) Add(rule *modelStn.STN_Rule) error
Add create a new STN rule.
func (*StnConfigurator) Delete ¶
func (c *StnConfigurator) Delete(rule *modelStn.STN_Rule) error
Delete removes STN rule.
func (*StnConfigurator) Dump ¶
func (c *StnConfigurator) Dump() (*vppcalls.StnDetails, error)
Dump STN rules configured on the VPP
func (*StnConfigurator) IndexExistsFor ¶
func (c *StnConfigurator) IndexExistsFor(name string) bool
IndexExistsFor returns true if there is and mapping entry for provided name
func (*StnConfigurator) Init ¶
func (c *StnConfigurator) Init(logger logging.PluginLogger, goVppMux govppmux.API, ifIndexes ifaceidx.SwIfIndex) (err error)
Init initializes STN configurator
func (*StnConfigurator) LogError ¶ added in v1.8.1
func (c *StnConfigurator) LogError(err error) error
LogError prints error if not nil, including stack trace. The same value is also returned, so it can be easily propagated further
func (*StnConfigurator) ResolveCreatedInterface ¶
func (c *StnConfigurator) ResolveCreatedInterface(interfaceName string) error
ResolveCreatedInterface will check rules and if there is one waiting for interfaces it will be written into VPP.
func (*StnConfigurator) ResolveDeletedInterface ¶
func (c *StnConfigurator) ResolveDeletedInterface(interfaceName string) error
ResolveDeletedInterface resolves when interface is deleted. If there exist a rule for this interface the rule will be deleted also.
func (*StnConfigurator) Resync ¶
func (c *StnConfigurator) Resync(nbStnRules []*stn.STN_Rule) error
Resync writes stn rule to the the empty VPP
func (*StnConfigurator) UnstoredIndexExistsFor ¶
func (c *StnConfigurator) UnstoredIndexExistsFor(name string) bool
UnstoredIndexExistsFor returns true if there is and mapping entry for provided name
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package ifaceidx implements name-to-index mapping registry and cache for VPP interfaces.
|
Package ifaceidx implements name-to-index mapping registry and cache for VPP interfaces. |
Package vppcalls contains wrappers over VPP binary APIs for all supported interface types and for dumping all interfaces configured in VPP.
|
Package vppcalls contains wrappers over VPP binary APIs for all supported interface types and for dumping all interfaces configured in VPP. |