ifaceidx

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

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

func IndexDHCPMetadata added in v1.4.0

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

IndexDHCPMetadata creates indexes for metadata.

func IndexMetadata

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

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

Types

type DHCPSettings added in v1.4.0

type DHCPSettings struct {
	IfName        string
	IsIPv6        bool
	IPAddress     string
	Mask          uint32
	PhysAddress   string
	RouterAddress string
}

DHCPSettings contains all DHCP related information. Used as a metadata type for DHCP mapping.

type DhcpIdxDto added in v1.4.0

type DhcpIdxDto struct {
	idxvpp.NameToIdxDtoWithoutMeta
	Metadata *DHCPSettings
}

DhcpIdxDto represents an item sent through watch channel in dhcpIfIndex. In contrast to NameToIdxDto, it contains typed metadata.

type DhcpIndex added in v1.4.0

type DhcpIndex interface {
	// GetMapping returns internal read-only mapping with metadata.
	GetMapping() idxvpp.NameToIdxRW

	// LookupIdx looks up previously stored item identified by index in mapping.
	LookupIdx(name string) (idx uint32, metadata *DHCPSettings, exists bool)

	// LookupName looks up previously stored item identified by name in mapping.
	LookupName(idx uint32) (name string, metadata *DHCPSettings, exists bool)

	// WatchNameToIdx allows to subscribe for watching changes in DhcpIndex mapping.
	WatchNameToIdx(subscriber core.PluginName, pluginChannel chan DhcpIdxDto)
}

DhcpIndex provides read-only access to mapping between software interface names, indices (used internally in VPP) and DHCP configuration.

type DhcpIndexRW added in v1.4.0

type DhcpIndexRW interface {
	DhcpIndex

	// RegisterName adds a new item into name-to-index mapping.
	RegisterName(name string, idx uint32, ifMeta *DHCPSettings)

	// UnregisterName removes an item identified by name from mapping.
	UnregisterName(name string) (idx uint32, metadata *DHCPSettings, exists bool)
}

DhcpIndexRW is mapping between software interface names, indices (used internally in VPP) and DHCP configuration.

func NewDHCPIndex added in v1.4.0

func NewDHCPIndex(mapping idxvpp.NameToIdxRW) DhcpIndexRW

NewDHCPIndex creates new instance of dhcpIndex.

type SwIfIdxDto

type SwIfIdxDto struct {
	idxvpp.NameToIdxDtoWithoutMeta
	Metadata *intf.Interfaces_Interface
}

SwIfIdxDto represents an item sent through watch channel in swIfIndex. In contrast to NameToIdxDto, it contains typed metadata.

type SwIfIndex

type SwIfIndex 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 *intf.Interfaces_Interface, exists bool)

	// LookupName looks up previously stored item identified by name in mapping.
	LookupName(idx uint32) (name string, metadata *intf.Interfaces_Interface, exists bool)

	// LookupNameByIP returns name of items, that contains given IP address in metadata.
	LookupNameByIP(ip string) []string

	// WatchNameToIdx allows to subscribe for watching changes in swIfIndex mapping.
	WatchNameToIdx(subscriber core.PluginName, pluginChannel chan SwIfIdxDto)
}

SwIfIndex provides read-only access to mapping between software interface indices (used internally in VPP) and interface names.

func Cache

func Cache(watcher datasync.KeyValProtoWatcher) SwIfIndex

Cache the network interfaces of a particular agent by watching (ETCD or different transport). Beware: the indices in cache do not correspond with the real indices.

type SwIfIndexRW

type SwIfIndexRW interface {
	SwIfIndex

	// RegisterName adds a new item into name-to-index mapping.
	RegisterName(name string, idx uint32, ifMeta *intf.Interfaces_Interface)

	// UnregisterName removes an item identified by name from mapping.
	UnregisterName(name string) (idx uint32, metadata *intf.Interfaces_Interface, exists bool)

	// UpdateMetadata updates metadata in existing interface entry.
	UpdateMetadata(name string, metadata *intf.Interfaces_Interface) (success bool)
}

SwIfIndexRW is mapping between software interface indices (used internally in VPP) and interface names.

func NewSwIfIndex

func NewSwIfIndex(mapping idxvpp.NameToIdxRW) SwIfIndexRW

NewSwIfIndex creates new instance of swIfIndex.

Jump to

Keyboard shortcuts

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