Documentation ¶
Overview ¶
Package ifaceidx implements name-to-index mapping registry and cache for Linux interfaces.
Index ¶
Constants ¶
const DefNs = "default-ns"
DefNs is name for default namespace
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 IndexedLinuxInterface ¶ added in v1.4.0
type IndexedLinuxInterface struct { Index uint32 Data *interfaces.LinuxInterfaces_Interface }
IndexedLinuxInterface is linux interface configuration with its system index. Used as a metadata object.
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 *IndexedLinuxInterface, exists bool) // LookupIdxByNamespace looks up previously stored item identified by system index in mapping using namespace. LookupIdxByNamespace(name string, ns string) (osIdx uint32, metadata *IndexedLinuxInterface, exists bool) // LookupName looks up previously stored item identified by name in mapping. LookupName(idx uint32) (name string, metadata *IndexedLinuxInterface, exists bool) // LookupNameByNamespace looks up previously stored item identified by name in mapping using namespace. LookupNameByNamespace(osIdx uint32, ns string) (name string, metadata *IndexedLinuxInterface, 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) 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 *IndexedLinuxInterface }
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 *IndexedLinuxInterface) // UnregisterName removes an item identified by name from mapping. UnregisterName(name string) (idx uint32, metadata *IndexedLinuxInterface, 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.