Esempio n. 1
0
func (mapper *NeutronMapper) retrieveAttributes(mac string) Attributes {
	logging.GetLogger().Debug("Retrieving attributes from Neutron for Mac: %s", mac)

	attrs := Attributes{}

	port, err := mapper.retrievePort(mac)
	if err != nil {
		return attrs
	}
	attrs.TenantID = port.TenantID

	result := networks.Get(mapper.client, port.NetworkID)
	network, err := provider.ExtractGet(result)
	if err != nil {
		return attrs
	}

	if err != nil {
		return attrs
	}

	segID, err := strconv.Atoi(network.SegmentationID)
	if err == nil {
		attrs.VNI = uint64(segID)
	}

	return attrs
}
Esempio n. 2
0
func (mapper *NeutronMapper) retrieveAttributes(mac string) (*Attributes, error) {
	logging.GetLogger().Debugf("Retrieving attributes from Neutron for MAC: %s", mac)

	port, err := mapper.retrievePort(mac)
	if err != nil {
		return nil, err
	}

	result := networks.Get(mapper.client, port.NetworkID)
	network, err := provider.ExtractGet(result)
	if err != nil {
		return nil, err
	}

	return &Attributes{TenantID: port.TenantID, VNI: network.SegmentationID}, nil
}
Esempio n. 3
0
func (mapper *NeutronMapper) retrieveAttributes(metadata graph.Metadata) (*Attributes, error) {
	port, err := mapper.retrievePort(metadata)
	if err != nil {
		return nil, err
	}

	result := networks.Get(mapper.client, port.NetworkID)
	network, err := provider.ExtractGet(result)
	if err != nil {
		return nil, err
	}

	a := &Attributes{
		NetworkID:   port.NetworkID,
		NetworkName: network.Name,
		TenantID:    port.TenantID,
		VNI:         network.SegmentationID,
	}

	return a, nil
}