Documentation ¶
Overview ¶
Package ifaceidx implements name-to-index mapping registry and cache for Linux interfaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IndexMetadata ¶
IndexMetadata creates indices for metadata. Index for IPAddress will be created.
func ParseNameFromKey ¶
ParseNameFromKey returns suffix of the key (name).
Types ¶
type LinuxIfIndex ¶
type LinuxIfIndex interface { // GetMapping returns internal read-only mapping with metadata of type interface{}. GetMapping() idxvpp.NameToIdxRW // LookupIdx looks up previously stored item identified by index in mapping. LookupIdx(name string) (idx uint32, metadata *interfaces.LinuxInterfaces_Interface, exists bool) // LookupName looks up previously stored item identified by name in mapping. LookupName(idx uint32) (name string, metadata *interfaces.LinuxInterfaces_Interface, exists bool) // LookupNameByHostIfName looks up the interface identified by the name used in HostOs. LookupNameByHostIfName(hostIfName string) []string // WatchNameToIdx allows to subscribe for watching changes in linuxIfIndex mapping. WatchNameToIdx(subscriber core.PluginName, pluginChannel chan LinuxIfIndexDto) }
LinuxIfIndex provides read-only access to mapping between software interface indices and interface names.
func Cache ¶
func Cache(watcher datasync.KeyValProtoWatcher, caller core.PluginName) LinuxIfIndex
Cache the VETH interfaces of a particular agent by watching transport. If change appears, it is registered in idx map.
type LinuxIfIndexDto ¶
type LinuxIfIndexDto struct { idxvpp.NameToIdxDtoWithoutMeta Metadata *interfaces.LinuxInterfaces_Interface }
LinuxIfIndexDto represents an item sent through watch channel in linuxIfIndex. In contrast to NameToIdxDto it contains typed metadata.
type LinuxIfIndexRW ¶
type LinuxIfIndexRW interface { LinuxIfIndex // RegisterName adds new item into name-to-index mapping. RegisterName(name string, idx uint32, ifMeta *interfaces.LinuxInterfaces_Interface) // UnregisterName removes an item identified by name from mapping. UnregisterName(name string) (idx uint32, metadata *interfaces.LinuxInterfaces_Interface, exists bool) }
LinuxIfIndexRW is mapping between software interface indices (used internally in VPP) and interface names.
func NewLinuxIfIndex ¶
func NewLinuxIfIndex(mapping idxvpp.NameToIdxRW) LinuxIfIndexRW
NewLinuxIfIndex creates new instance of linuxIfIndex.