{"modulePath":"github.com/EMnify/vpp-agent","version":"v1.4.1","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package ifplugin\n\nPackage ifplugin implements the Interface plugin that handles management of VPP interfaces.\n\n## Constants\n\n```go\nconst (\n\tDrop    counterType = 0\n\tPunt                = 1\n\tIPv4                = 2\n\tIPv6                = 3\n\tRxNoBuf             = 4\n\tRxMiss              = 5\n\tRxError             = 6\n\tTxError             = 7\n\tMPLS                = 8\n)\n```\nconstants as defined in the vnet\\_interface\\_counter\\_type\\_t enum in 'vnet/interface.h'\n\n```go\nconst (\n\tRx combinedCounterType = 0\n\tTx                     = 1\n)\n```\nconstants as defined in the vnet\\_interface\\_counter\\_type\\_t enum in 'vnet/interface.h'\n\n## Functions\n\n```go\nfunc AuthKeyIdentifier(id uint32) string\n```\nGenerates common identifier for authentication key\n\n```go\nfunc GetIdMappingIdentifier(mapping *nat.Nat44DNat_DNatConfig_IdentityMapping) string\n```\nGetIdMappingIdentifier returns unique ID of the mapping\n\n```go\nfunc GetStMappingIdentifier(mapping *nat.Nat44DNat_DNatConfig_StaticMapping) string\n```\nGetStMappingIdentifier returns unique ID of the mapping\n\n```go\nfunc StnIdentifier(iface string) string\n```\nStnIdentifier creates unique identifier which serves as a name in name to index mapping\n\n## Types\n\n```go\ntype AFPacketConfigurator struct {\n\t// contains filtered or unexported fields\n}\n```\nAFPacketConfigurator 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.\n\n```go\nfunc (plugin *AFPacketConfigurator) ConfigureAfPacketInterface(afpacket *intf.Interfaces_Interface) (swIndex uint32, pending bool, err error)\n```\nConfigureAfPacketInterface creates a new Afpacket interface or marks it as pending if the target host interface doesn't exist yet.\n\n```go\nfunc (plugin *AFPacketConfigurator) DeleteAfPacketInterface(afpacket *intf.Interfaces_Interface, ifIdx uint32) (err error)\n```\nDeleteAfPacketInterface removes Afpacket interface from VPP and from the cache.\n\n```go\nfunc (plugin *AFPacketConfigurator) GetAfPacketStatusByHost(hostIf string) (exists, pending bool, ifData *intf.Interfaces_Interface)\n```\nGetAfPacketStatusByHost looks for cached interface by host interface and returns its state and data\n\n```go\nfunc (plugin *AFPacketConfigurator) GetAfPacketStatusByName(name string) (exists, pending bool, ifData *intf.Interfaces_Interface)\n```\nGetAfPacketStatusByName looks for cached interface by its name and returns its state and data\n\n```go\nfunc (plugin *AFPacketConfigurator) GetHostInterfacesEntry(hostIf string) bool\n```\nGetHostInterfacesEntry looks for cached host interface and returns true if exists\n\n```go\nfunc (plugin *AFPacketConfigurator) Init(logger logging.Logger, vppCh vppcalls.VPPChannel, linux interface{},\n\tindexes ifaceidx.SwIfIndexRW, stopwatch *measure.Stopwatch) (err error)\n```\nInit members of AFPacketConfigurator.\n\n```go\nfunc (plugin *AFPacketConfigurator) IsPendingAfPacket(iface *intf.Interfaces_Interface) (pending bool)\n```\nIsPendingAfPacket returns true if the given config belongs to pending Afpacket interface.\n\n```go\nfunc (plugin *AFPacketConfigurator) ModifyAfPacketInterface(newConfig *intf.Interfaces_Interface,\n\toldConfig *intf.Interfaces_Interface) (recreate bool, err error)\n```\nModifyAfPacketInterface updates the cache with afpacket configurations and tells InterfaceConfigurator if the interface needs to be recreated for the changes to be applied.\n\n```go\nfunc (plugin *AFPacketConfigurator) ResolveCreatedLinuxInterface(interfaceName, hostIfName string, interfaceIndex uint32) *intf.Interfaces_Interface\n```\nResolveCreatedLinuxInterface reacts to a newly created Linux interface.\n\n```go\nfunc (plugin *AFPacketConfigurator) ResolveDeletedLinuxInterface(interfaceName, hostIfName string, ifIdx uint32)\n```\nResolveDeletedLinuxInterface reacts to a removed Linux interface.\n\n```go\ntype AfPacketConfig struct {\n\t// contains filtered or unexported fields\n}\n```\nAfPacketConfig 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.\n\n```go\ntype BFDConfigurator struct {\n\t// contains filtered or unexported fields\n}\n```\nBFDConfigurator 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.\n\n```go\nfunc (plugin *BFDConfigurator) Close() error\n```\nClose GOVPP channel\n\n```go\nfunc (plugin *BFDConfigurator) ConfigureBfdAuthKey(bfdAuthKey *bfd.SingleHopBFD_Key) error\n```\nConfigureBfdAuthKey crates new authentication key which can be used for BFD session\n\n```go\nfunc (plugin *BFDConfigurator) ConfigureBfdEchoFunction(bfdInput *bfd.SingleHopBFD_EchoFunction) error\n```\nConfigureBfdEchoFunction is used to setup BFD Echo function on existing interface\n\n```go\nfunc (plugin *BFDConfigurator) ConfigureBfdSession(bfdInput *bfd.SingleHopBFD_Session) error\n```\nConfigureBfdSession configures bfd session (including authentication if exists). Provided interface has to contain ip address defined in BFD as source\n\n```go\nfunc (plugin *BFDConfigurator) DeleteBfdAuthKey(bfdInput *bfd.SingleHopBFD_Key) error\n```\nDeleteBfdAuthKey removes BFD authentication key but only if it is not used in any BFD session\n\n```go\nfunc (plugin *BFDConfigurator) DeleteBfdEchoFunction(bfdInput *bfd.SingleHopBFD_EchoFunction) error\n```\nDeleteBfdEchoFunction removes BFD echo function\n\n```go\nfunc (plugin *BFDConfigurator) DeleteBfdSession(bfdInput *bfd.SingleHopBFD_Session) error\n```\nDeleteBfdSession removes BFD session\n\n```go\nfunc (plugin *BFDConfigurator) DumpBFDAuthKeys() ([]*bfd.SingleHopBFD_Key, error)\n```\nDumpBFDAuthKeys returns a list of all configured authentication keys\n\n```go\nfunc (plugin *BFDConfigurator) DumpBfdSessions() ([]*bfd.SingleHopBFD_Session, error)\n```\nDumpBfdSessions returns a list of all configured BFD sessions\n\n```go\nfunc (plugin *BFDConfigurator) GetBfdEchoFunctionIndexes() idxvpp.NameToIdxRW\n```\nGetBfdEchoFunctionIndexes gives access to BFD echo function indexes\n\n```go\nfunc (plugin *BFDConfigurator) GetBfdKeyIndexes() idxvpp.NameToIdxRW\n```\nGetBfdKeyIndexes gives access to BFD key indexes\n\n```go\nfunc (plugin *BFDConfigurator) GetBfdSessionIndexes() idxvpp.NameToIdxRW\n```\nGetBfdSessionIndexes gives access to BFD session indexes\n\n```go\nfunc (plugin *BFDConfigurator) Init(logger logging.PluginLogger, goVppMux govppmux.API,\n\tswIfIndexes ifaceidx.SwIfIndex, enableStopwatch bool) (err error)\n```\nInit members and channels\n\n```go\nfunc (plugin *BFDConfigurator) ModifyBfdAuthKey(oldInput *bfd.SingleHopBFD_Key, newInput *bfd.SingleHopBFD_Key) error\n```\nModifyBfdAuthKey modifies auth key fields. Key which is assigned to one or more BFD session cannot be modified\n\n```go\nfunc (plugin *BFDConfigurator) ModifyBfdEchoFunction(oldInput *bfd.SingleHopBFD_EchoFunction, newInput *bfd.SingleHopBFD_EchoFunction) error\n```\nModifyBfdEchoFunction handles echo function changes\n\n```go\nfunc (plugin *BFDConfigurator) ModifyBfdSession(oldBfdInput *bfd.SingleHopBFD_Session, newBfdInput *bfd.SingleHopBFD_Session) error\n```\nModifyBfdSession 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\n\n```go\nfunc (plugin *BFDConfigurator) ResyncAuthKey(nbKeys []*bfd.SingleHopBFD_Key) error\n```\nResyncAuthKey writes BFD keys to the empty VPP\n\n```go\nfunc (plugin *BFDConfigurator) ResyncEchoFunction(echoFunctions []*bfd.SingleHopBFD_EchoFunction) error\n```\nResyncEchoFunction writes BFD echo function to the empty VPP\n\n```go\nfunc (plugin *BFDConfigurator) ResyncSession(nbSessions []*bfd.SingleHopBFD_Session) error\n```\nResyncSession writes BFD sessions to the empty VPP\n\n```go\ntype InterfaceConfigurator struct {\n\n\t// Notification channels\n\tNotifChan chan govppapi.Message // to publish SwInterfaceDetails to interface_state.go\n\tDhcpChan  chan govppapi.Message // channel to receive DHCP notifications\n\t// contains filtered or unexported fields\n}\n```\nInterfaceConfigurator 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.\n\n```go\nfunc (plugin *InterfaceConfigurator) Close() error\n```\nClose GOVPP channel\n\n```go\nfunc (plugin *InterfaceConfigurator) ConfigureVPPInterface(iface *intf.Interfaces_Interface) (err error)\n```\nConfigureVPPInterface reacts to a new northbound VPP interface config by creating and configuring the interface in the VPP network stack through the VPP binary API.\n\n```go\nfunc (plugin *InterfaceConfigurator) DeleteVPPInterface(iface *intf.Interfaces_Interface) (wasError error)\n```\nDeleteVPPInterface reacts to a removed NB configuration of a VPP interface. It results in the interface being removed from VPP.\n\n```go\nfunc (plugin *InterfaceConfigurator) GetDHCPIndexes() ifaceidx.DhcpIndexRW\n```\nGetDHCPIndexes exposes DHCP name-to-index mapping\n\n```go\nfunc (plugin *InterfaceConfigurator) GetSwIfIndexes() ifaceidx.SwIfIndexRW\n```\nGetSwIfIndexes exposes interface name-to-index mapping\n\n```go\nfunc (plugin *InterfaceConfigurator) Init(logger logging.PluginLogger, goVppMux govppmux.API, linux interface{},\n\tnotifChan chan govppapi.Message, defaultMtu uint32, enableStopwatch bool) (err error)\n```\nInit members (channels...) and start go routines\n\n```go\nfunc (plugin *InterfaceConfigurator) IsSocketFilenameCached(filename string) bool\n```\nIsSocketFilenameCached returns true if provided filename is presented in the cache\n\n```go\nfunc (plugin *InterfaceConfigurator) IsUnnumberedIfCached(ifName string) bool\n```\nIsUnnumberedIfCached returns true if provided interface is cached as unconfigurabel unnubered interface\n\n```go\nfunc (plugin *InterfaceConfigurator) ModifyVPPInterface(newConfig *intf.Interfaces_Interface,\n\toldConfig *intf.Interfaces_Interface) error\n```\nModifyVPPInterface applies changes in the NB configuration of a VPP interface into the running VPP through the VPP binary API.\n\n```go\nfunc (plugin *InterfaceConfigurator) PropagateIfDetailsToStatus() error\n```\nPropagateIfDetailsToStatus looks up all VPP interfaces\n\n```go\nfunc (plugin *InterfaceConfigurator) ResolveCreatedLinuxInterface(interfaceName, hostIfName string, interfaceIndex uint32)\n```\nResolveCreatedLinuxInterface reacts to a newly created Linux interface.\n\n```go\nfunc (plugin *InterfaceConfigurator) ResolveDeletedLinuxInterface(interfaceName, hostIfName string, ifIdx uint32)\n```\nResolveDeletedLinuxInterface reacts to a removed Linux interface.\n\n```go\nfunc (plugin *InterfaceConfigurator) Resync(nbIfs []*intf.Interfaces_Interface) (errs []error)\n```\nResync 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:\n\n 1. Dump all VPP interfaces\n 2. 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.\n 3. Untagged interfaces are correlated heuristically (mac address, ip addresses). If correlation is found, interface is modified if needed and registered.\n 4. All remaining NB interfaces are configured\n\n```go\nfunc (plugin *InterfaceConfigurator) VerifyVPPConfigPresence(nbIfaces []*intf.Interfaces_Interface) bool\n```\nVerifyVPPConfigPresence 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\n\n```go\ntype InterfaceStateUpdater struct {\n\tLog      logging.Logger\n\tGoVppmux govppmux.API\n\t// contains filtered or unexported fields\n}\n```\nInterfaceStateUpdater holds state data of all VPP interfaces.\n\n```go\nfunc (plugin *InterfaceStateUpdater) AfterInit() (err error)\n```\nAfterInit subscribes for watching VPP notifications on previously initialized channel\n\n```go\nfunc (plugin *InterfaceStateUpdater) Close() error\n```\nClose unsubscribes from interface state notifications from VPP \u0026 GOVPP channel\n\n```go\nfunc (plugin *InterfaceStateUpdater) Init(ctx context.Context,\n\tswIfIndexes ifaceidx.SwIfIndex, notifChan chan govppapi.Message,\n\tpublishIfState func(notification *intf.InterfaceNotification)) (err error)\n```\nInit members (channels, maps...) and start go routines\n\n```go\ntype NatConfigurator struct {\n\t// contains filtered or unexported fields\n}\n```\nNatConfigurator 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:\n\n  - \"/vnf-agent/{agent-label}/vpp/config/v1/nat/{vrf}/addrpool/\" for NAT address pool\n  - \"/vnf-agent/{agent-label}/vpp/config/v1/nat/{vrf}/static/\" for NAT static mapping\n  - \"/vnf-agent/{agent-label}/vpp/config/v1/nat/{vrf}/staticlb/\" for NAT static mapping with load balancer\n\nUpdates received from the northbound API are compared with the VPP run-time configuration and differences are applied through the VPP binary API.\n\n```go\nfunc (plugin *NatConfigurator) Close() error\n```\nClose used resources\n\n```go\nfunc (plugin *NatConfigurator) ConfigureDNat(dNat *nat.Nat44DNat_DNatConfig) error\n```\nConfigureDNat configures new DNAT setup\n\n```go\nfunc (plugin *NatConfigurator) ConfigureSNat(sNat *nat.Nat44SNat_SNatConfig) error\n```\nConfigureSNat configures new SNAT setup\n\n```go\nfunc (plugin *NatConfigurator) DeleteDNat(dNat *nat.Nat44DNat_DNatConfig) error\n```\nDeleteDNat removes existing DNAT setup\n\n```go\nfunc (plugin *NatConfigurator) DeleteNatGlobalConfig(config *nat.Nat44Global) (err error)\n```\nDeleteNatGlobalConfig removes common setup for all NAT use cases\n\n```go\nfunc (plugin *NatConfigurator) DeleteSNat(sNat *nat.Nat44SNat_SNatConfig) error\n```\nDeleteSNat removes existing SNAT setup\n\n```go\nfunc (plugin *NatConfigurator) DumpNatDNat() (*nat.Nat44DNat, error)\n```\nDumpNatDNat returns the current NAT44 DNAT config\n\n```go\nfunc (plugin *NatConfigurator) DumpNatGlobal() (*nat.Nat44Global, error)\n```\nDumpNatGlobal returns the current NAT44 global config\n\n```go\nfunc (plugin *NatConfigurator) GetGlobalNat() *nat.Nat44Global\n```\nGetGlobalNat makes current global nat accessible\n\n```go\nfunc (plugin *NatConfigurator) Init(logger logging.PluginLogger, goVppMux govppmux.API, ifIndexes ifaceidx.SwIfIndex,\n\tenableStopwatch bool) (err error)\n```\nInit NAT configurator\n\n```go\nfunc (plugin *NatConfigurator) IsDNatLabelIdMappingRegistered(id string) bool\n```\nIsDNatLabelIdMappingRegistered checks if DNAT identity mapping with provided id is registered\n\n```go\nfunc (plugin *NatConfigurator) IsDNatLabelRegistered(label string) bool\n```\nIsInNotDisabledIfCache checks if interface is present in 'notDisabledIfs' cache\n\n```go\nfunc (plugin *NatConfigurator) IsDNatLabelStMappingRegistered(id string) bool\n```\nIsInNotDisabledIfCache checks if DNAT static mapping with provided id is registered\n\n```go\nfunc (plugin *NatConfigurator) IsInNotDisabledIfCache(ifName string) bool\n```\nIsInNotDisabledIfCache checks if interface is present in 'notDisabledIfs' cache\n\n```go\nfunc (plugin *NatConfigurator) IsInNotEnabledIfCache(ifName string) bool\n```\nIsInNotEnabledIfCache checks if interface is present in 'notEnabledIfs' cache\n\n```go\nfunc (plugin *NatConfigurator) ModifyDNat(oldDNat, newDNat *nat.Nat44DNat_DNatConfig) error\n```\nModifyDNat modifies existing DNAT setup\n\n```go\nfunc (plugin *NatConfigurator) ModifyNatGlobalConfig(oldConfig, newConfig *nat.Nat44Global) (err error)\n```\nModifyNatGlobalConfig modifies common setup for all NAT use cases\n\n```go\nfunc (plugin *NatConfigurator) ModifySNat(oldSNat, newSNat *nat.Nat44SNat_SNatConfig) error\n```\nModifySNat modifies existing SNAT setup\n\n```go\nfunc (plugin *NatConfigurator) ResolveCreatedInterface(ifName string, ifIdx uint32) error\n```\nResolveCreatedInterface looks for cache of interfaces which should be enabled or disabled for NAT\n\n```go\nfunc (plugin *NatConfigurator) ResolveDeletedInterface(ifName string, ifIdx uint32) error\n```\nResolveDeletedInterface handles removed interface from NAT perspective\n\n```go\nfunc (plugin *NatConfigurator) ResyncDNat(nbDNatConfig []*nat.Nat44DNat_DNatConfig) error\n```\nResyncDNat writes NAT static mapping config to the the empty VPP\n\n```go\nfunc (plugin *NatConfigurator) ResyncNatGlobal(nbGlobal *nat.Nat44Global) error\n```\nResyncNatGlobal writes NAT address pool config to the the empty VPP\n\n```go\nfunc (plugin *NatConfigurator) ResyncSNat(sNatConf []*nat.Nat44SNat_SNatConfig) error\n```\nResyncSNat writes NAT static mapping config to the the empty VPP\n\n```go\nfunc (plugin *NatConfigurator) SetNatGlobalConfig(config *nat.Nat44Global) error\n```\nSetNatGlobalConfig configures common setup for all NAT use cases\n\n```go\ntype StnConfigurator struct {\n\t// contains filtered or unexported fields\n}\n```\nStnConfigurator 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/\".\n\n```go\nfunc (plugin *StnConfigurator) Add(rule *modelStn.STN_Rule) error\n```\nAdd create a new STN rule.\n\n```go\nfunc (plugin *StnConfigurator) Close() error\n```\nClose GOVPP channel.\n\n```go\nfunc (plugin *StnConfigurator) Delete(rule *modelStn.STN_Rule) error\n```\nDelete removes STN rule.\n\n```go\nfunc (plugin *StnConfigurator) Dump() ([]*stn.StnRulesDetails, error)\n```\nDump STN rules configured on the VPP\n\n```go\nfunc (plugin *StnConfigurator) IndexExistsFor(name string) bool\n```\nIndexExistsFor returns true if there is and mapping entry for provided name\n\n```go\nfunc (plugin *StnConfigurator) Init(logger logging.PluginLogger, goVppMux govppmux.API, ifIndexes ifaceidx.SwIfIndex,\n\tenableStopwatch bool) (err error)\n```\nInit initializes STN configurator\n\n```go\nfunc (plugin *StnConfigurator) Modify(ruleOld *modelStn.STN_Rule, ruleNew *modelStn.STN_Rule) error\n```\nModify configured rule.\n\n```go\nfunc (plugin *StnConfigurator) ResolveCreatedInterface(interfaceName string)\n```\nResolveCreatedInterface will check rules and if there is one waiting for interfaces it will be written into VPP.\n\n```go\nfunc (plugin *StnConfigurator) ResolveDeletedInterface(interfaceName string)\n```\nResolveDeletedInterface resolves when interface is deleted. If there exist a rule for this interface the rule will be deleted also.\n\n```go\nfunc (plugin *StnConfigurator) Resync(nbStnRules []*stn.STN_Rule) error\n```\nResync writes stn rule to the the empty VPP\n\n```go\nfunc (plugin *StnConfigurator) UnstoredIndexExistsFor(name string) bool\n```\nUnstoredIndexExistsFor returns true if there is and mapping entry for provided name\n\n","path":"github.com/EMnify/vpp-agent/plugins/defaultplugins/ifplugin","name":"ifplugin","synopsis":"Package ifplugin implements the Interface plugin that handles management of VPP interfaces.","isRedistributable":true}
