Documentation ¶
Index ¶
- Variables
- func NewProbe(ctx tp.Context, bundle *probe.Bundle) (probe.Handler, error)
- func OvsMetadataDecoder(raw json.RawMessage) (getter.Getter, error)
- func Register()
- type BridgeOfProber
- type Event
- type Execute
- type Match
- type OfctlProbe
- type OvsMetadata
- func (obj *OvsMetadata) GetField(key string) (interface{}, error)
- func (obj *OvsMetadata) GetFieldBool(key string) (bool, error)
- func (obj *OvsMetadata) GetFieldInt64(key string) (int64, error)
- func (obj *OvsMetadata) GetFieldKeys() []string
- func (obj *OvsMetadata) GetFieldString(key string) (string, error)
- func (v OvsMetadata) MarshalEasyJSON(w *jwriter.Writer)
- func (v OvsMetadata) MarshalJSON() ([]byte, error)
- func (obj *OvsMetadata) MatchBool(key string, predicate getter.BoolPredicate) bool
- func (obj *OvsMetadata) MatchInt64(key string, predicate getter.Int64Predicate) bool
- func (obj *OvsMetadata) MatchString(key string, predicate getter.StringPredicate) bool
- func (v *OvsMetadata) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *OvsMetadata) UnmarshalJSON(data []byte) error
- type OvsOfProbeHandler
- 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() error
- 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 ¶ added in v0.23.0
func OvsMetadataDecoder(raw json.RawMessage) (getter.Getter, error)
OvsMetadataDecoder implements a json message raw decoder
Types ¶
type BridgeOfProber ¶ added in v0.23.0
BridgeOfProber is the type of the probe retrieving Openflow rules on a Bridge.
func NewOfProbe ¶ added in v0.23.0
func NewOfProbe(ctx tp.Context, bridge string, address string, tlsConfig *tls.Config) 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 ¶ added in v0.23.0
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 ¶ added in v0.23.0
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 ¶ 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 gendecoder
func (*OvsMetadata) GetField ¶ added in v0.23.0
func (obj *OvsMetadata) GetField(key string) (interface{}, error)
func (*OvsMetadata) GetFieldBool ¶ added in v0.26.0
func (obj *OvsMetadata) GetFieldBool(key string) (bool, error)
func (*OvsMetadata) GetFieldInt64 ¶ added in v0.23.0
func (obj *OvsMetadata) GetFieldInt64(key string) (int64, error)
func (*OvsMetadata) GetFieldKeys ¶ added in v0.23.0
func (obj *OvsMetadata) GetFieldKeys() []string
func (*OvsMetadata) GetFieldString ¶ added in v0.23.0
func (obj *OvsMetadata) GetFieldString(key string) (string, error)
func (OvsMetadata) MarshalEasyJSON ¶ added in v0.26.0
func (v OvsMetadata) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (OvsMetadata) MarshalJSON ¶ added in v0.26.0
func (v OvsMetadata) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*OvsMetadata) MatchBool ¶ added in v0.26.0
func (obj *OvsMetadata) MatchBool(key string, predicate getter.BoolPredicate) bool
func (*OvsMetadata) MatchInt64 ¶ added in v0.26.0
func (obj *OvsMetadata) MatchInt64(key string, predicate getter.Int64Predicate) bool
func (*OvsMetadata) MatchString ¶ added in v0.26.0
func (obj *OvsMetadata) MatchString(key string, predicate getter.StringPredicate) bool
func (*OvsMetadata) UnmarshalEasyJSON ¶ added in v0.26.0
func (v *OvsMetadata) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*OvsMetadata) UnmarshalJSON ¶ added in v0.26.0
func (v *OvsMetadata) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type OvsOfProbeHandler ¶ added in v0.25.0
type OvsOfProbeHandler struct { sync.Mutex Ctx tp.Context // Probe context // contains filtered or unexported fields }
OvsOfProbeHandler is the type of the probe retrieving Openflow rules on an Open Vswitch
func NewOvsOfProbeHandler ¶ added in v0.25.0
func NewOvsOfProbeHandler(cancelCtx context.Context, ctx tp.Context, host string, protocol string) (*OvsOfProbeHandler, error)
NewOvsOfProbeHandler creates a new probe associated to a given graph, root node and host.
func (*OvsOfProbeHandler) OnOvsBridgeAdd ¶ added in v0.25.0
func (o *OvsOfProbeHandler) OnOvsBridgeAdd(bridgeNode *graph.Node)
OnOvsBridgeAdd is called when a bridge is added
func (*OvsOfProbeHandler) OnOvsBridgeDel ¶ added in v0.25.0
func (o *OvsOfProbeHandler) OnOvsBridgeDel(uuid string)
OnOvsBridgeDel is called when a bridge is deleted
type Probe ¶ added in v0.21.0
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 ¶ added in v0.21.0
func (o *Probe) OnConnected(monitor *ovsdb.OvsMonitor)
OnConnected event
func (*Probe) OnDisconnected ¶ added in v0.21.0
func (o *Probe) OnDisconnected(monitor *ovsdb.OvsMonitor)
OnDisconnected event
func (*Probe) OnOvsBridgeAdd ¶ added in v0.21.0
OnOvsBridgeAdd event
func (*Probe) OnOvsBridgeDel ¶ added in v0.21.0
OnOvsBridgeDel event
func (*Probe) OnOvsBridgeUpdate ¶ added in v0.21.0
OnOvsBridgeUpdate event
func (*Probe) OnOvsInterfaceAdd ¶ added in v0.21.0
OnOvsInterfaceAdd event
func (*Probe) OnOvsInterfaceDel ¶ added in v0.21.0
OnOvsInterfaceDel event
func (*Probe) OnOvsInterfaceUpdate ¶ added in v0.21.0
func (o *Probe) OnOvsInterfaceUpdate(monitor *ovsdb.OvsMonitor, uuid string, row *libovsdb.RowUpdate)
OnOvsInterfaceUpdate event
func (*Probe) OnOvsPortAdd ¶ added in v0.21.0
OnOvsPortAdd event
func (*Probe) OnOvsPortDel ¶ added in v0.21.0
OnOvsPortDel event
func (*Probe) OnOvsPortUpdate ¶ added in v0.21.0
OnOvsPortUpdate event
func (*Probe) OnOvsUpdate ¶ added in v0.22.0
func (o *Probe) OnOvsUpdate(monitor *ovsdb.OvsMonitor, row *libovsdb.RowUpdate)
OnOvsUpdate 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.
func (RealExecute) ExecCommand ¶
func (r RealExecute) ExecCommand(com string, args ...string) ([]byte, error)
ExecCommand executes a command on a host