ovsdb

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2018 License: Apache-2.0 Imports: 19 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BridgeOfProbe

type BridgeOfProbe struct {
	Host       string             // The global host
	Bridge     string             // The bridge monitored
	UUID       string             // The UUID of the bridge node
	Address    string             // The address of the bridge if different from name
	BridgeNode *graph.Node        // the bridge node on which the rule nodes are attached.
	OvsOfProbe *OvsOfProbe        // Back pointer to the probe
	Rules      map[string][]*Rule // The set of rules found so far grouped by rawUUID
	// contains filtered or unexported fields
}

BridgeOfProbe is the type of the probe retrieving Openflow rules on a Bridge.

An important notion is the rawUUID of a rule or the UUID obtained by ignoring the priority from the rule filter. Several rules may differ only by their priority (and associated actions). In practice the highest priority hides the other rules. It is important to handle rules with the same rawUUID as a group because ovs-ofctl monitor does not report priorities.

type Event

type Event struct {
	RawRule *Rule   // The rule from the event
	Rules   []*Rule // Rules found by ovs-ofctl matching the event rule filter.
	Date    int64   // the date of the event
	Action  string  // the action taken
	Bridge  string  // The bridge whtere it ocured
}

Event is an event as monitored by ovs-ofctl monitor <br> watch:

type Execute

type Execute interface {
	ExecCommand(string, ...string) ([]byte, error)
	ExecCommandPipe(context.Context, string, ...string) (io.Reader, error)
}

Execute exposes an interface to command launch on the OS

type OvsOfProbe

type OvsOfProbe struct {
	sync.Mutex
	Host         string                    // The host
	Graph        *graph.Graph              // The graph that will receive the rules found
	Root         *graph.Node               // The root node of the host in the graph
	BridgeProbes map[string]*BridgeOfProbe // The table of probes associated to each bridge
	Translation  map[string]string         // A translation table to find the url for a given bridge knowing its name
	Certificate  string                    // Path to the certificate used for authenticated communication with bridges
	PrivateKey   string                    // Path of the private key authenticating the probe.
	CA           string                    // Path of the certicate of the Certificate authority used for authenticated communication with bridges
	// contains filtered or unexported fields
}

OvsOfProbe is the type of the probe retrieving Openflow rules on an Open Vswitch

func NewOvsOfProbe

func NewOvsOfProbe(ctx context.Context, g *graph.Graph, root *graph.Node, host string) *OvsOfProbe

NewOvsOfProbe creates a new probe associated to a given graph, root node and host.

func (*OvsOfProbe) NewBridgeProbe

func (o *OvsOfProbe) NewBridgeProbe(host string, bridge string, uuid string, bridgeNode *graph.Node) (*BridgeOfProbe, error)

NewBridgeProbe creates a probe and launch the active process

func (*OvsOfProbe) OnOvsBridgeAdd

func (o *OvsOfProbe) OnOvsBridgeAdd(bridgeNode *graph.Node)

OnOvsBridgeAdd is called when a bridge is added

func (*OvsOfProbe) OnOvsBridgeDel

func (o *OvsOfProbe) OnOvsBridgeDel(uuid string, bridgeNode *graph.Node)

OnOvsBridgeDel is called when a bridge is deleted

type OvsdbProbe

type OvsdbProbe struct {
	sync.Mutex
	Graph      *graph.Graph
	Root       *graph.Node
	OvsMon     *ovsdb.OvsMonitor
	OvsOfProbe *OvsOfProbe
	// contains filtered or unexported fields
}

OvsdbProbe describes a probe that reads OVS database and updates the graph

func NewOvsdbProbe

func NewOvsdbProbe(g *graph.Graph, n *graph.Node, p string, t string) *OvsdbProbe

NewOvsdbProbe creates a new graph OVS database probe

func NewOvsdbProbeFromConfig

func NewOvsdbProbeFromConfig(g *graph.Graph, n *graph.Node) *OvsdbProbe

NewOvsdbProbeFromConfig creates a new probe based on configuration

func (*OvsdbProbe) OnOvsBridgeAdd

func (o *OvsdbProbe) OnOvsBridgeAdd(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)

OnOvsBridgeAdd event

func (*OvsdbProbe) OnOvsBridgeDel

func (o *OvsdbProbe) OnOvsBridgeDel(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)

OnOvsBridgeDel event

func (*OvsdbProbe) OnOvsBridgeUpdate

func (o *OvsdbProbe) OnOvsBridgeUpdate(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)

OnOvsBridgeUpdate event

func (*OvsdbProbe) OnOvsInterfaceAdd

func (o *OvsdbProbe) OnOvsInterfaceAdd(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)

OnOvsInterfaceAdd event

func (*OvsdbProbe) OnOvsInterfaceDel

func (o *OvsdbProbe) OnOvsInterfaceDel(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)

OnOvsInterfaceDel event

func (*OvsdbProbe) OnOvsInterfaceUpdate

func (o *OvsdbProbe) OnOvsInterfaceUpdate(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)

OnOvsInterfaceUpdate event

func (*OvsdbProbe) OnOvsPortAdd

func (o *OvsdbProbe) OnOvsPortAdd(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)

OnOvsPortAdd event

func (*OvsdbProbe) OnOvsPortDel

func (o *OvsdbProbe) OnOvsPortDel(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)

OnOvsPortDel event

func (*OvsdbProbe) OnOvsPortUpdate

func (o *OvsdbProbe) OnOvsPortUpdate(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)

OnOvsPortUpdate event

func (*OvsdbProbe) Start

func (o *OvsdbProbe) Start()

Start the probe

func (*OvsdbProbe) Stop

func (o *OvsdbProbe) Stop()

Stop the probe

type RealExecute

type RealExecute struct{}

RealExecute is the actual implementation given below. It can be overridden for tests.

func (RealExecute) ExecCommand

func (r RealExecute) ExecCommand(com string, args ...string) ([]byte, error)

ExecCommand executes a command on a host

func (RealExecute) ExecCommandPipe

func (r RealExecute) ExecCommandPipe(ctx context.Context, com string, args ...string) (io.Reader, error)

ExecCommandPipe executes a command on a host and gives back a pipe to control it.

type Rule

type Rule struct {
	Cookie   uint64 // cookie value of the rule
	Table    int    // table containing the rule
	Priority int    // priority of rule
	Filter   string // all the filters as a comma separated string
	Actions  string // all the actions (comma separated)
	InPort   int    // -1 is any
	UUID     string // Unique id
}

Rule is an OpenFlow rule in a switch

Jump to

Keyboard shortcuts

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