示例#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
文件: tid.go 项目: nplanel/skydive
// 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
文件: fabric.go 项目: nplanel/skydive
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
			}
		}
	}
}