Пример #1
0
func (gfe *OvsFlowEnhancer) getNodeUUID(mac string) string {
	if packet.IsBroadcastMac(mac) || packet.IsMulticastMac(mac) {
		return "*"
	}

	gfe.Graph.RLock()
	defer gfe.Graph.RUnlock()

	intfs := gfe.Graph.LookupNodes(graph.Metadata{"ExtID/attached-mac": mac})
	if len(intfs) > 1 {
		logging.GetLogger().Infof("OvsFlowEnhancer found more than one interface for the mac: %s", mac)
	} else if len(intfs) == 1 {
		return string(intfs[0].ID)
	}
	return ""
}
Пример #2
0
func (gfe *GraphFlowEnhancer) getNodeTID(mac string) string {
	if packet.IsBroadcastMac(mac) || packet.IsMulticastMac(mac) {
		return "*"
	}

	gfe.Graph.RLock()
	defer gfe.Graph.RUnlock()

	intfs := gfe.Graph.GetNodes(graph.Metadata{"MAC": mac})
	if len(intfs) > 1 {
		logging.GetLogger().Infof("GraphFlowEnhancer found more than one interface for the mac: %s", mac)
	} else if len(intfs) == 1 {
		if t, ok := intfs[0].Metadata()["TID"]; ok {
			return t.(string)
		}
	}
	return ""
}