ifaceidx

package
v2.5.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: Apache-2.0 Imports: 4 Imported by: 437

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IfaceMetadata

type IfaceMetadata struct {
	SwIfIndex     uint32
	Vrf           uint32
	IPAddresses   []string // TODO: update from interfaceAddress descriptor with real IPs (not netalloc links)
	TAPHostIfName string   /* host interface name set for the Linux-side of the TAP interface; empty for non-TAPs */
}

IfaceMetadata collects metadata for VPP interface used in secondary lookups.

func (*IfaceMetadata) GetIndex

func (ifm *IfaceMetadata) GetIndex() uint32

GetIndex returns sw_if_index assigned to the interface.

type IfaceMetadataDto

type IfaceMetadataDto struct {
	idxmap.NamedMappingEvent
	Metadata *IfaceMetadata
}

IfaceMetadataDto represents an item sent through watch channel in IfaceMetadataIndex. In contrast to NamedMappingGenericEvent, it contains typed interface metadata.

type IfaceMetadataIndex

type IfaceMetadataIndex interface {
	// LookupByName retrieves a previously stored metadata of interface
	// identified by <name>. If there is no interface associated with the give
	// name in the mapping, the <exists> is returned as *false* and <metadata>
	// as *nil*.
	LookupByName(name string) (metadata *IfaceMetadata, exists bool)

	// LookupBySwIfIndex retrieves a previously stored interface identified in
	// VPP by the given <swIfIndex>.
	// If there is no interface associated with the given index, <exists> is returned
	// as *false* with <name> and <metadata> both set to empty values.
	LookupBySwIfIndex(swIfIndex uint32) (name string, metadata *IfaceMetadata, exists bool)

	// LookupByIP returns a list of interfaces that have the given IP address
	// assigned.
	LookupByIP(ip string) []string /* name */

	// ListAllInterfaces returns slice of names of all interfaces in the mapping.
	ListAllInterfaces() (names []string)

	// WatchInterfaces allows to subscribe to watch for changes in the mapping
	// if interface metadata.
	WatchInterfaces(subscriber string, channel chan<- IfaceMetadataDto)
}

IfaceMetadataIndex provides read-only access to mapping with VPP interface metadata. It extends from NameToIndex.

type IfaceMetadataIndexRW

type IfaceMetadataIndexRW interface {
	IfaceMetadataIndex
	idxmap.NamedMappingRW
}

IfaceMetadataIndexRW provides read-write access to mapping with interface metadata.

func NewIfaceIndex

func NewIfaceIndex(logger logging.Logger, title string) IfaceMetadataIndexRW

NewIfaceIndex creates a new instance implementing IfaceMetadataIndexRW.

Jump to

Keyboard shortcuts

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