Documentation ¶
Index ¶
- Variables
- func OvsMetadataDecoder(raw json.RawMessage) (common.Getter, error)
- type BridgeOfProber
- type Event
- type Execute
- type Match
- type OfctlProbe
- type OvsMetadata
- type OvsOfProbeHandler
- type Probe
- func (o *Probe) Init(ctx tp.Context, bundle *probe.Bundle) (probe.Handler, error)
- 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 ¶
var ( // ErrGroupNotSupported is reported when group monitoring is not supported by ovs ErrGroupNotSupported = errors.New("Group monitoring is only possible on OpenFlow 1.5 and later because of an OVS bug") )
Functions ¶
func OvsMetadataDecoder ¶
func OvsMetadataDecoder(raw json.RawMessage) (common.Getter, error)
OvsMetadataDecoder implements a json message raw decoder
Types ¶
type BridgeOfProber ¶
BridgeOfProber is the type of the probe retrieving Openflow rules on a Bridge.
func NewOfProbe ¶
func NewOfProbe(ctx tp.Context, bridge string, address string) BridgeOfProber
NewOfProbe returns a new OpenFlow natively speaking probe
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 OfctlProbe ¶
type OfctlProbe struct { Ctx tp.Context // Probe context 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 Handler *OvsOfProbeHandler // 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 ¶
func NewOfctlProbe(ctx tp.Context, host, bridge, uuid, address string, handler *OvsOfProbeHandler) *OfctlProbe
NewOfctlProbe returns a new ovs-ofctl based OpenFlow probe
func (*OfctlProbe) Monitor ¶
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 ¶
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 ¶
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 gendecoder
type OvsOfProbeHandler ¶
type OvsOfProbeHandler struct { sync.Mutex Host string // The host Ctx tp.Context // Probe context 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 }
OvsOfProbeHandler is the type of the probe retrieving Openflow rules on an Open Vswitch
func NewOvsOfProbeHandler ¶
func NewOvsOfProbeHandler(cancelCtx context.Context, ctx tp.Context, host string) *OvsOfProbeHandler
NewOvsOfProbeHandler creates a new probe associated to a given graph, root node and host.
func (*OvsOfProbeHandler) OnOvsBridgeAdd ¶
func (o *OvsOfProbeHandler) OnOvsBridgeAdd(bridgeNode *graph.Node)
OnOvsBridgeAdd is called when a bridge is added
func (*OvsOfProbeHandler) OnOvsBridgeDel ¶
func (o *OvsOfProbeHandler) OnOvsBridgeDel(uuid string)
OnOvsBridgeDel is called when a bridge is deleted
type Probe ¶
type Probe struct { sync.Mutex Ctx tp.Context OvsMon *ovsdb.OvsMonitor Handler *OvsOfProbeHandler // contains filtered or unexported fields }
Probe describes a probe that reads OVS database and updates the graph
func (*Probe) OnConnected ¶
func (o *Probe) OnConnected(monitor *ovsdb.OvsMonitor)
OnConnected event
func (*Probe) OnDisconnected ¶
func (o *Probe) OnDisconnected(monitor *ovsdb.OvsMonitor)
OnDisconnected event
func (*Probe) OnOvsBridgeAdd ¶
OnOvsBridgeAdd event
func (*Probe) OnOvsBridgeDel ¶
OnOvsBridgeDel event
func (*Probe) OnOvsBridgeUpdate ¶
OnOvsBridgeUpdate event
func (*Probe) OnOvsInterfaceAdd ¶
OnOvsInterfaceAdd event
func (*Probe) OnOvsInterfaceDel ¶
OnOvsInterfaceDel event
func (*Probe) OnOvsInterfaceUpdate ¶
func (o *Probe) OnOvsInterfaceUpdate(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)
OnOvsInterfaceUpdate event
func (*Probe) OnOvsPortAdd ¶
OnOvsPortAdd event
func (*Probe) OnOvsPortDel ¶
OnOvsPortDel event
func (*Probe) OnOvsPortUpdate ¶
OnOvsPortUpdate event
func (*Probe) OnOvsUpdate ¶
func (o *Probe) OnOvsUpdate(monitor *ovsdb.OvsMonitor, row *libovsdb.RowUpdate)
OnOvsUpdate event
type RawRule ¶
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.
func (RealExecute) ExecCommand ¶
func (r RealExecute) ExecCommand(com string, args ...string) ([]byte, error)
ExecCommand executes a command on a host