ifaceidx

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

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

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 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

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.

Jump to

Keyboard shortcuts

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