Пример #1
0
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)
}
Пример #2
0
// 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)
}
Пример #3
0
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
			}
		}
	}
}