ifaceidx

package
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package ifaceidx implements name-to-index mapping registry and cache for Linux interfaces.

Index

Constants

View Source
const DefNs = "default-ns"

DefNs is name for default namespace

Variables

This section is empty.

Functions

func IndexMetadata

func IndexMetadata(metaData interface{}) map[string][]string

IndexMetadata creates indices for metadata. Index for IPAddress will be created.

func ParseNameFromKey

func ParseNameFromKey(key string) (name string, err error)

ParseNameFromKey returns suffix of the key (name).

Types

type IndexedLinuxInterface

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 string, pluginChannel chan LinuxIfIndexDto)
}

LinuxIfIndex provides read-only access to mapping between software interface indices and interface names.

func Cache

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL