descriptor

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: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BDInterfaceDescriptorName is the name of the descriptor for bindings
	// between mock bridge domains and mock interfaces.
	BDInterfaceDescriptorName = "mock-bd-interface"
)
View Source
const (
	// BridgeDomainDescriptorName is the name of the descriptor for mock bridge domains.
	BridgeDomainDescriptorName = "mock-bridge-domain"
)
View Source
const (
	// FIBDescriptorName is the name of the descriptor for L2 FIBs in the mock SB.
	FIBDescriptorName = "mock-l2-fib"
)

Variables

View Source
var (
	// ErrBridgeDomainWithoutName is returned when mock bridge domain configuration
	// has undefined Name attribute.
	ErrBridgeDomainWithoutName = errors.New("mock bridge domain defined without logical name")

	// ErrBridgeDomainWithMultipleBVI is returned when mock bridge domain is defined with
	// multiple BVI interfaces.
	ErrBridgeDomainWithMultipleBVI = errors.New("mock bridge domain defined with mutliple BVIs")
)

Example of some validation errors:

View Source
var (
	// ErrFIBWithoutHwAddr is returned when mock L2 FIB has undefined hardware
	// address.
	ErrFIBWithoutHwAddr = errors.New("mock L2 FIB defined without hardware address")

	// ErrFIBWithoutBD is returned when mock L2 FIB has undefined bridge domain.
	ErrFIBWithoutBD = errors.New("mock L2 FIB defined without bridge domain")

	// ErrForwardFIBWithoutInterface is returned when mock L2 FORWARD FIB has undefined outgoing interface.
	ErrForwardFIBWithoutInterface = errors.New("mock L2 FORWARD FIB defined without outgoing interface")
)

Example of some validation errors:

Functions

func NewBDInterfaceDescriptor

func NewBDInterfaceDescriptor(bdIndex idxvpp.NameToIndex, bdHandler mockcalls.MockBDAPI, log logging.PluginLogger) *kvs.KVDescriptor

NewBDInterfaceDescriptor creates a new instance of the BDInterface descriptor.

func NewBridgeDomainDescriptor

func NewBridgeDomainDescriptor(bdHandler mockcalls.MockBDAPI, log logging.PluginLogger) *kvs.KVDescriptor

NewBridgeDomainDescriptor creates a new instance of the BridgeDomain descriptor.

func NewFIBDescriptor

func NewFIBDescriptor(fibHandler mockcalls.MockFIBAPI, log logging.PluginLogger) *kvs.KVDescriptor

NewFIBDescriptor creates a new instance of the FIB descriptor.

Types

type BDInterfaceDescriptor

type BDInterfaceDescriptor struct {
	// contains filtered or unexported fields
}

BDInterfaceDescriptor teaches KVScheduler how to put interface into bridge domain in the mock SB. A binding between bridge domain and an interface is a value derived from the bridge domain. This descriptor is therefore only for derived values.

func (*BDInterfaceDescriptor) Create

func (d *BDInterfaceDescriptor) Create(key string, bdIface *l2.BridgeDomain_Interface) (metadata interface{}, err error)

Create puts interface into bridge domain.

func (*BDInterfaceDescriptor) Delete

func (d *BDInterfaceDescriptor) Delete(key string, bdIface *l2.BridgeDomain_Interface, metadata interface{}) error

Delete removes interface from bridge domain.

func (*BDInterfaceDescriptor) Dependencies

func (d *BDInterfaceDescriptor) Dependencies(key string, value *l2.BridgeDomain_Interface) []kvs.Dependency

Dependencies lists the interface as the only dependency for the binding.

Note: some bindings derived from a given bridge domain may be pending (waiting for their interfaces), but others and the bridge domain itself will be unaffected and free to get configured. This is the power of derived values, which allows you to break complex items into multiple parts handled separately.

func (*BDInterfaceDescriptor) IsBDInterfaceKey

func (d *BDInterfaceDescriptor) IsBDInterfaceKey(key string) bool

IsBDInterfaceKey returns true if the key is identifying binding between bridge domain and interface in the mock SB.

type BridgeDomainDescriptor

type BridgeDomainDescriptor struct {
	// contains filtered or unexported fields
}

BridgeDomainDescriptor teaches KVScheduler how to configure bridge domains in the mock SB.

func (*BridgeDomainDescriptor) Create

func (d *BridgeDomainDescriptor) Create(key string, bd *l2.BridgeDomain) (metadata *idxvpp.OnlyIndex, err error)

Create adds new bridge domain.

func (*BridgeDomainDescriptor) Delete

func (d *BridgeDomainDescriptor) Delete(key string, bd *l2.BridgeDomain, metadata *idxvpp.OnlyIndex) error

Delete removes VPP bridge domain.

func (*BridgeDomainDescriptor) DerivedValues

func (d *BridgeDomainDescriptor) DerivedValues(key string, bd *l2.BridgeDomain) (derValues []kvs.KeyValuePair)

DerivedValues derives l2.BridgeDomain_Interface for every interface assigned to the bridge domain.

func (*BridgeDomainDescriptor) EquivalentBridgeDomains

func (d *BridgeDomainDescriptor) EquivalentBridgeDomains(key string, oldBD, newBD *l2.BridgeDomain) bool

EquivalentBridgeDomains always returns true - this may seems strange, but two revisions of the same BD have the same key, therefore they must equal in Name, which is included in the key. The interfaces may differ, but they are derived out and updated as separate key-value pairs.

func (*BridgeDomainDescriptor) MetadataFactory

func (d *BridgeDomainDescriptor) MetadataFactory() idxmap.NamedMappingRW

MetadataFactory is a factory for index-map customized for mock bridge domains.

func (*BridgeDomainDescriptor) Retrieve

Retrieve returns all configured mock bridge domains.

func (*BridgeDomainDescriptor) Validate

func (d *BridgeDomainDescriptor) Validate(key string, bd *l2.BridgeDomain) error

Validate validates mock bridge domain configuration.

type FIBDescriptor

type FIBDescriptor struct {
	// contains filtered or unexported fields
}

FIBDescriptor teaches KVScheduler how to configure L2 FIBs in the mock SB.

func (*FIBDescriptor) Create

func (d *FIBDescriptor) Create(key string, fib *l2.FIBEntry) (metadata interface{}, err error)

Create adds new L2 FIB.

func (*FIBDescriptor) Delete

func (d *FIBDescriptor) Delete(key string, fib *l2.FIBEntry, metadata interface{}) error

Delete removes VPP L2 FIB.

func (*FIBDescriptor) Dependencies

func (d *FIBDescriptor) Dependencies(key string, fib *l2.FIBEntry) (dependencies []kvs.Dependency)

Dependencies for FIBs are:

  • FORWARD FIB: bridge domain + outgoing interface already put into the bridge domain
  • DROP FIB: bridge domain

func (*FIBDescriptor) EquivalentFIBs

func (d *FIBDescriptor) EquivalentFIBs(key string, oldFIB, newFIB *l2.FIBEntry) bool

EquivalentFIBs is case-insensitive comparison function for l2.FIBEntry.

func (*FIBDescriptor) Retrieve

func (d *FIBDescriptor) Retrieve(correlate []adapter.FIBKVWithMetadata) (retrieved []adapter.FIBKVWithMetadata, err error)

Retrieve returns all configured VPP L2 FIBs.

func (*FIBDescriptor) Validate

func (d *FIBDescriptor) Validate(key string, fib *l2.FIBEntry) error

Validate validates mock L2 FIB configuration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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