ifplugin

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultPlugin = *NewPlugin()

DefaultPlugin is a default instance of IfPlugin.

Functions

This section is empty.

Types

type API

type API interface {
	// GetBDIndex gives read-only access to map with metadata of all configured
	// mock bridge domains.
	GetBDIndex() idxvpp.NameToIndex
}

API defines methods exposed by mock l2plugin.

type Deps

type Deps struct {
	infra.PluginDeps

	// the plugin depends on KVScheduler because it needs to register the
	// descriptors for BDs and FIBs.
	KVScheduler kvs.KVScheduler

	// ifplugin is needed to convert interface name to the corresponding integer
	// handle used in the mock SB
	IfPlugin ifplugin.API
}

Deps lists dependencies of the mock interface plugin.

type L2Plugin

type L2Plugin struct {
	Deps
	// contains filtered or unexported fields
}

L2Plugin configures mock bridge domains and L2 FIBs.

func NewPlugin

func NewPlugin(opts ...Option) *L2Plugin

NewPlugin creates a new Plugin with the provides Options

func (*L2Plugin) Close

func (p *L2Plugin) Close() error

Close of a real (not-mock) plugin usually:

  • stops all the associated go routines (if any)
  • closes channels, registrations, etc..

In this example we do nothing (no need to un-register descriptor).

func (*L2Plugin) GetBDIndex

func (p *L2Plugin) GetBDIndex() idxvpp.NameToIndex

GetBDIndex gives read-only access to map with metadata of all configured mock bridge domains.

func (*L2Plugin) Init

func (p *L2Plugin) Init() error

Init of a real (not-mock) plugin usually:

  • loads configuration from a file (if any)
  • registers descriptors for all objects the plugin implements
  • potentially starts go routine to watch for some asynchronous events (from which usually sends notifications to KVScheduler via PushSBNotification)
  • etc.

In this mock ifplugin, we only create mock SB handlers and register the descriptors.

type Option

type Option func(*L2Plugin)

Option is a function that can be used in NewPlugin to customize Plugin.

func UseDeps

func UseDeps(f func(*Deps)) Option

UseDeps returns Option that can inject custom dependencies.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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