func (o *OnDemandProbeClient) OnEdgeAdded(e *graph.Edge) { parent, child := o.graph.GetEdgeNodes(e) if parent == nil || child == nil || e.Metadata()["RelationType"] != "ownership" { return } o.onNodeEvent(child) }
// onEdgeEvent set TID for child TID nodes which is composed of the name // the TID of the parent node and the type. func (t *TIDMapper) onEdgeEvent(e *graph.Edge) { if e.Metadata()["RelationType"] != "ownership" { return } parent, child := t.Graph.GetEdgeNodes(e) if parent == nil { return } t.setTID(parent, child) }
func (fb *FabricProbe) OnEdgeAdded(e *graph.Edge) { parent, child := fb.Graph.GetEdgeNodes(e) if parent == nil || child == nil || e.Metadata()["RelationType"] != "ownership" { return } if parent.Metadata()["Type"] == "host" { for node, link := range fb.links { if child.MatchMetadata(link.metadata) { if !fb.Graph.AreLinked(child, node) { fb.Graph.Link(node, child, graph.Metadata{"RelationType": "layer2", "Type": "fabric"}) } delete(fb.links, node) break } } } }