Documentation
¶
Index ¶
- Variables
- func OvsMetadataDecoder(raw json.RawMessage) (common.Getter, error)
- type BridgeOfProber
- type Event
- type Execute
- type Match
- type OfctlProbe
- type OvsMetadata
- type OvsOfProbe
- type Probe
- func (o *Probe) OnConnected(monitor *ovsdb.OvsMonitor)
- func (o *Probe) OnDisconnected(monitor *ovsdb.OvsMonitor)
- func (o *Probe) OnOvsBridgeAdd(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)
- func (o *Probe) OnOvsBridgeDel(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)
- func (o *Probe) OnOvsBridgeUpdate(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)
- func (o *Probe) OnOvsInterfaceAdd(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)
- func (o *Probe) OnOvsInterfaceDel(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)
- func (o *Probe) OnOvsInterfaceUpdate(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)
- func (o *Probe) OnOvsPortAdd(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)
- func (o *Probe) OnOvsPortDel(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)
- func (o *Probe) OnOvsPortUpdate(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)
- func (o *Probe) OnOvsUpdate(monitor *ovsdb.OvsMonitor, row *libovsdb.RowUpdate)
- func (o *Probe) Start()
- func (o *Probe) Stop()
- type RawRule
- type RealExecute
- type Stats
- type Waiter
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type BridgeOfProber ¶ added in v0.23.0
BridgeOfProber is the type of the probe retrieving Openflow rules on a Bridge.
type Event ¶
type Event struct {
RawRule *RawRule // The rule from the event
Rules []*jsonof.JSONRule // 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, Waiter, error)
}
Execute exposes an interface to command launch on the OS
type Match ¶ added in v0.23.0
Match is the interface of an OpenFlow match
type OfctlProbe ¶ added in v0.23.0
type OfctlProbe 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][]*jsonof.JSONRule // The set of rules found so far grouped by rawUUID
Groups map[uint]*graph.Node // The set of groups found so far
// contains filtered or unexported fields
}
OfctlProbe describes an ovs-ofctl based OpenFlow rule prober. 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.
func NewOfctlProbe ¶ added in v0.23.0
func NewOfctlProbe(host, bridge, uuid, address string, bridgeNode *graph.Node, o *OvsOfProbe) *OfctlProbe
NewOfctlProbe returns a new ovs-ofctl based OpenFlow probe
func (*OfctlProbe) Monitor ¶ added in v0.23.0
func (probe *OfctlProbe) Monitor(ctx context.Context) error
Monitor monitors the openflow rules of a bridge by launching a goroutine. The context is used to control the execution of the routine.
func (*OfctlProbe) MonitorGroup ¶ added in v0.23.0
func (probe *OfctlProbe) MonitorGroup() error
MonitorGroup monitors the openflow groups of a bridge by launching a goroutine. It uses OpenFlow 1.4 ForwardRequest command that is not directly available in ovs-ofctl
Note: Openflow15 is really needed. Receiving an insert_bucket on an OF14 monitor crashes the switch (yes, the switch itself) on OVS 2.9
type OvsMetadata ¶ added in v0.23.0
type OvsMetadata struct {
OtherConfig map[string]string `json:"OtherConfig,omitempty"`
Options map[string]string `json:"Options,omitempty"`
Protocols []string `json:"Protocols,omitempty"`
DBVersion string `json:"DBVersion,omitempty"`
Version string `json:"Version,omitempty"`
Error string `json:"Error,omitempty"`
Metric *topology.InterfaceMetric `json:"Metric,omitempty"`
LastUpdateMetric *topology.InterfaceMetric `json:"LastUpdateMetric,omitempty"`
}
OvsMetadata describe Ovs metadata sub section easyjson:json
func (*OvsMetadata) GetField ¶ added in v0.23.0
func (o *OvsMetadata) GetField(key string) (interface{}, error)
GetField implements Getter interface
func (*OvsMetadata) GetFieldInt64 ¶ added in v0.23.0
func (o *OvsMetadata) GetFieldInt64(key string) (int64, error)
GetFieldInt64 implements Getter interface
func (*OvsMetadata) GetFieldKeys ¶ added in v0.23.0
func (o *OvsMetadata) GetFieldKeys() []string
GetFieldKeys returns the list of valid field of a Flow
func (*OvsMetadata) GetFieldString ¶ added in v0.23.0
func (o *OvsMetadata) GetFieldString(key string) (string, error)
GetFieldString implements Getter interface
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
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 ¶
NewOvsOfProbe creates a new probe associated to a given graph, root node and host.
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)
OnOvsBridgeDel is called when a bridge is deleted
type Probe ¶ added in v0.22.0
type Probe struct {
sync.Mutex
Graph *graph.Graph
Root *graph.Node
OvsMon *ovsdb.OvsMonitor
OvsOfProbe *OvsOfProbe
// contains filtered or unexported fields
}
Probe describes a probe that reads OVS database and updates the graph
func NewProbe ¶ added in v0.22.0
NewProbe creates a new graph OVS database probe
func NewProbeFromConfig ¶ added in v0.22.0
func NewProbeFromConfig(g *graph.Graph, n *graph.Node, address string, enableStats bool) (*Probe, error)
NewProbeFromConfig creates a new probe based on configuration
func (*Probe) OnConnected ¶ added in v0.22.0
func (o *Probe) OnConnected(monitor *ovsdb.OvsMonitor)
OnConnected event
func (*Probe) OnDisconnected ¶ added in v0.22.0
func (o *Probe) OnDisconnected(monitor *ovsdb.OvsMonitor)
OnDisconnected event
func (*Probe) OnOvsBridgeAdd ¶ added in v0.22.0
OnOvsBridgeAdd event
func (*Probe) OnOvsBridgeDel ¶ added in v0.22.0
OnOvsBridgeDel event
func (*Probe) OnOvsBridgeUpdate ¶ added in v0.22.0
OnOvsBridgeUpdate event
func (*Probe) OnOvsInterfaceAdd ¶ added in v0.22.0
OnOvsInterfaceAdd event
func (*Probe) OnOvsInterfaceDel ¶ added in v0.22.0
OnOvsInterfaceDel event
func (*Probe) OnOvsInterfaceUpdate ¶ added in v0.22.0
func (o *Probe) OnOvsInterfaceUpdate(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)
OnOvsInterfaceUpdate event
func (*Probe) OnOvsPortAdd ¶ added in v0.22.0
OnOvsPortAdd event
func (*Probe) OnOvsPortDel ¶ added in v0.22.0
OnOvsPortDel event
func (*Probe) OnOvsPortUpdate ¶ added in v0.22.0
OnOvsPortUpdate event
type RawRule ¶ added in v0.23.0
type RawRule 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
UUID string // Unique id
}
RawRule is an OpenFlow rule in a switch captured as an event.
type RealExecute ¶
type RealExecute struct{}
RealExecute is the actual implementation given below. It can be overridden for tests.
Source Files
¶
- of10.go
- of12.go
- of13.go
- of14.go
- of15.go
- ofctl.go
- ofnative.go
- ovs_of.go
- ovsdb.go