Documentation ¶
Index ¶
- Constants
- Variables
- func AddLayer2Link(g *graph.Graph, node1 *graph.Node, node2 *graph.Node, metadata graph.Metadata) *graph.Edge
- func AddOwnershipLink(g *graph.Graph, parent *graph.Node, child *graph.Node, metadata graph.Metadata, ...) *graph.Edge
- func GetOwnershipLink(g *graph.Graph, parent *graph.Node, child *graph.Node, metadata graph.Metadata) *graph.Edge
- func HaveLayer2Link(g *graph.Graph, node1 *graph.Node, node2 *graph.Node, metadata graph.Metadata) bool
- func HaveOwnershipLink(g *graph.Graph, parent *graph.Node, child *graph.Node, metadata graph.Metadata) bool
- func IsOwnershipLinked(g *graph.Graph, node *graph.Node) bool
- func NamespaceFromNode(g *graph.Graph, n *graph.Node) (string, string, error)
- func NewNetNSContextByNode(g *graph.Graph, n *graph.Node) (*common.NetNSContext, error)
- type HostNodeTIDMap
- type InterfaceMetric
- func (im *InterfaceMetric) Add(m common.Metric) common.Metric
- func (im *InterfaceMetric) GetFieldInt64(field string) (int64, error)
- func (im *InterfaceMetric) GetLast() int64
- func (im *InterfaceMetric) GetStart() int64
- func (im *InterfaceMetric) IsZero() bool
- func (im *InterfaceMetric) SetLast(last int64)
- func (im *InterfaceMetric) SetStart(start int64)
- func (im *InterfaceMetric) Split(cut int64) (common.Metric, common.Metric)
- func (im *InterfaceMetric) Sub(m common.Metric) common.Metric
- type TIDMapper
- type TopologySubscriberEndpoint
- func (t *TopologySubscriberEndpoint) OnConnected(c shttp.WSSpeaker)
- func (t *TopologySubscriberEndpoint) OnDisconnected(c shttp.WSSpeaker)
- func (t *TopologySubscriberEndpoint) OnEdgeAdded(e *graph.Edge)
- func (t *TopologySubscriberEndpoint) OnEdgeDeleted(e *graph.Edge)
- func (t *TopologySubscriberEndpoint) OnEdgeUpdated(e *graph.Edge)
- func (t *TopologySubscriberEndpoint) OnNodeAdded(n *graph.Node)
- func (t *TopologySubscriberEndpoint) OnNodeDeleted(n *graph.Node)
- func (t *TopologySubscriberEndpoint) OnNodeUpdated(n *graph.Node)
- func (t *TopologySubscriberEndpoint) OnWSStructMessage(c shttp.WSSpeaker, msg *shttp.WSStructMessage)
Constants ¶
const ( OwnershipLink = "ownership" Layer2Link = "layer2" )
Describe the relation type between nodes
Variables ¶
var ( OwnershipMetadata = graph.Metadata{"RelationType": OwnershipLink} Layer2Metadata = graph.Metadata{"RelationType": Layer2Link} )
Describe the relation type between nodes in the graph
Functions ¶
func AddLayer2Link ¶ added in v0.11.0
func AddLayer2Link(g *graph.Graph, node1 *graph.Node, node2 *graph.Node, metadata graph.Metadata) *graph.Edge
AddLayer2Link Link the parent and the child node
func AddOwnershipLink ¶ added in v0.11.0
func AddOwnershipLink(g *graph.Graph, parent *graph.Node, child *graph.Node, metadata graph.Metadata, h ...string) *graph.Edge
AddOwnershipLink Link between the parent and the child node, the child can have only one parent, previous will be overwritten
func GetOwnershipLink ¶ added in v0.17.0
func GetOwnershipLink(g *graph.Graph, parent *graph.Node, child *graph.Node, metadata graph.Metadata) *graph.Edge
GetOwnershipLink get ownership Link between the parent and the child node or nil
func HaveLayer2Link ¶ added in v0.11.0
func HaveLayer2Link(g *graph.Graph, node1 *graph.Node, node2 *graph.Node, metadata graph.Metadata) bool
HaveLayer2Link returns true if parent and child have the same layer 2
func HaveOwnershipLink ¶ added in v0.11.0
func HaveOwnershipLink(g *graph.Graph, parent *graph.Node, child *graph.Node, metadata graph.Metadata) bool
HaveOwnershipLink returns true if parent and child have an ownership link
func IsOwnershipLinked ¶ added in v0.13.0
IsOwnershipLinked checks whether the node as an OwnershipLink
func NamespaceFromNode ¶ added in v0.12.0
NamespaceFromNode returns the namespace name and the path of a node in the graph
func NewNetNSContextByNode ¶ added in v0.8.0
NewNetNSContextByNode creates a new network namespace context based on the node
Types ¶
type HostNodeTIDMap ¶ added in v0.9.0
HostNodeTIDMap a map that store the value node TID and the key node host
func BuildHostNodeTIDMap ¶ added in v0.9.0
func BuildHostNodeTIDMap(nodes []*graph.Node) HostNodeTIDMap
BuildHostNodeTIDMap creates a new node and host (key) map
type InterfaceMetric ¶ added in v0.16.0
type InterfaceMetric struct { Collisions int64 `json:"Collisions,omitempty"` Multicast int64 `json:"Multicast,omitempty"` RxBytes int64 `json:"RxBytes,omitempty"` RxCompressed int64 `json:"RxCompressed,omitempty"` RxCrcErrors int64 `json:"RxCrcErrors,omitempty"` RxDropped int64 `json:"RxDropped,omitempty"` RxErrors int64 `json:"RxErrors,omitempty"` RxFifoErrors int64 `json:"RxFifoErrors,omitempty"` RxFrameErrors int64 `json:"RxFrameErrors,omitempty"` RxLengthErrors int64 `json:"RxLengthErrors,omitempty"` RxMissedErrors int64 `json:"RxMissedErrors,omitempty"` RxOverErrors int64 `json:"RxOverErrors,omitempty"` RxPackets int64 `json:"RxPackets,omitempty"` TxAbortedErrors int64 `json:"TxAbortedErrors,omitempty"` TxBytes int64 `json:"TxBytes,omitempty"` TxCarrierErrors int64 `json:"TxCarrierErrors,omitempty"` TxCompressed int64 `json:"TxCompressed,omitempty"` TxDropped int64 `json:"TxDropped,omitempty"` TxErrors int64 `json:"TxErrors,omitempty"` TxFifoErrors int64 `json:"TxFifoErrors,omitempty"` TxHeartbeatErrors int64 `json:"TxHeartbeatErrors,omitempty"` TxPackets int64 `json:"TxPackets,omitempty"` TxWindowErrors int64 `json:"TxWindowErrors,omitempty"` Start int64 `json:"Start,omitempty"` Last int64 `json:"Last,omitempty"` }
InterfaceMetric the interface packets counters
func (*InterfaceMetric) Add ¶ added in v0.16.0
func (im *InterfaceMetric) Add(m common.Metric) common.Metric
Add sum two metrics and return a new Metrics object
func (*InterfaceMetric) GetFieldInt64 ¶ added in v0.16.0
func (im *InterfaceMetric) GetFieldInt64(field string) (int64, error)
GetFieldInt64 returns field by name
func (*InterfaceMetric) GetLast ¶ added in v0.16.0
func (im *InterfaceMetric) GetLast() int64
GetLast returns last time
func (*InterfaceMetric) GetStart ¶ added in v0.16.0
func (im *InterfaceMetric) GetStart() int64
GetStart returns start time
func (*InterfaceMetric) IsZero ¶ added in v0.16.0
func (im *InterfaceMetric) IsZero() bool
IsZero returns true if all the values are equal to zero
func (*InterfaceMetric) SetLast ¶ added in v0.16.0
func (im *InterfaceMetric) SetLast(last int64)
SetLast set last tome
func (*InterfaceMetric) SetStart ¶ added in v0.16.0
func (im *InterfaceMetric) SetStart(start int64)
SetStart set start time
type TIDMapper ¶ added in v0.6.0
type TIDMapper struct { graph.DefaultGraphListener Graph *graph.Graph // contains filtered or unexported fields }
TIDMapper describes the hostID nodes stored in a graph the mapper will broadcast node event to the registered listeners
func NewTIDMapper ¶ added in v0.6.0
NewTIDMapper creates a new node mapper in the graph g
func (*TIDMapper) OnEdgeAdded ¶ added in v0.6.0
OnEdgeAdded event
func (*TIDMapper) OnEdgeDeleted ¶ added in v0.11.0
OnEdgeDeleted event
func (*TIDMapper) OnEdgeUpdated ¶ added in v0.6.0
OnEdgeUpdated event
func (*TIDMapper) OnNodeAdded ¶ added in v0.6.0
OnNodeAdded evetn
func (*TIDMapper) OnNodeUpdated ¶ added in v0.6.0
OnNodeUpdated event
type TopologySubscriberEndpoint ¶ added in v0.15.0
type TopologySubscriberEndpoint struct { common.RWMutex shttp.DefaultWSSpeakerEventHandler Graph *graph.Graph // contains filtered or unexported fields }
TopologySubscriberEndpoint sends all the modifications to its subscribers.
func NewTopologySubscriberEndpoint ¶ added in v0.15.0
func NewTopologySubscriberEndpoint(pool shttp.WSStructSpeakerPool, auth *shttp.AuthenticationOpts, g *graph.Graph) *TopologySubscriberEndpoint
NewTopologySubscriberEndpoint returns a new server to be used by external subscribers, for instance the WebUI.
func (*TopologySubscriberEndpoint) OnConnected ¶ added in v0.15.0
func (t *TopologySubscriberEndpoint) OnConnected(c shttp.WSSpeaker)
OnConnected called when a subscriber got connected.
func (*TopologySubscriberEndpoint) OnDisconnected ¶ added in v0.15.0
func (t *TopologySubscriberEndpoint) OnDisconnected(c shttp.WSSpeaker)
OnDisconnected called when a subscriber got disconnected.
func (*TopologySubscriberEndpoint) OnEdgeAdded ¶ added in v0.15.0
func (t *TopologySubscriberEndpoint) OnEdgeAdded(e *graph.Edge)
OnEdgeAdded graph edge added event. Implements the GraphEventListener interface.
func (*TopologySubscriberEndpoint) OnEdgeDeleted ¶ added in v0.15.0
func (t *TopologySubscriberEndpoint) OnEdgeDeleted(e *graph.Edge)
OnEdgeDeleted graph edge deleted event. Implements the GraphEventListener interface.
func (*TopologySubscriberEndpoint) OnEdgeUpdated ¶ added in v0.15.0
func (t *TopologySubscriberEndpoint) OnEdgeUpdated(e *graph.Edge)
OnEdgeUpdated graph edge updated event. Implements the GraphEventListener interface.
func (*TopologySubscriberEndpoint) OnNodeAdded ¶ added in v0.15.0
func (t *TopologySubscriberEndpoint) OnNodeAdded(n *graph.Node)
OnNodeAdded graph node added event. Implements the GraphEventListener interface.
func (*TopologySubscriberEndpoint) OnNodeDeleted ¶ added in v0.15.0
func (t *TopologySubscriberEndpoint) OnNodeDeleted(n *graph.Node)
OnNodeDeleted graph node deleted event. Implements the GraphEventListener interface.
func (*TopologySubscriberEndpoint) OnNodeUpdated ¶ added in v0.15.0
func (t *TopologySubscriberEndpoint) OnNodeUpdated(n *graph.Node)
OnNodeUpdated graph node updated event. Implements the GraphEventListener interface.
func (*TopologySubscriberEndpoint) OnWSStructMessage ¶ added in v0.17.0
func (t *TopologySubscriberEndpoint) OnWSStructMessage(c shttp.WSSpeaker, msg *shttp.WSStructMessage)
OnWSStructMessage is triggered when receiving a message from a subscriber. It only responds to SyncRequestMsgType messages