Search in sources :

Example 1 with SegmentsKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.provider.ext.rev150712.neutron.networks.network.SegmentsKey in project netvirt by opendaylight.

the class NeutronUtils method getSegmentationIdFromNeutronNetwork.

public static <T extends NetworkTypeBase> String getSegmentationIdFromNeutronNetwork(Network network, Class<T> networkType) {
    String segmentationId = null;
    NetworkProviderExtension providerExtension = network.augmentation(NetworkProviderExtension.class);
    if (providerExtension != null) {
        segmentationId = providerExtension.getSegmentationId();
        if (segmentationId == null) {
            Map<SegmentsKey, Segments> providerSegmentsMap = providerExtension.getSegments();
            if (providerSegmentsMap != null && providerSegmentsMap.size() > 0) {
                for (Segments providerSegment : providerSegmentsMap.values()) {
                    if (isNetworkSegmentType(providerSegment, networkType)) {
                        segmentationId = providerSegment.getSegmentationId();
                        break;
                    }
                }
            }
        }
    }
    return segmentationId;
}
Also used : SegmentsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.provider.ext.rev150712.neutron.networks.network.SegmentsKey) Segments(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.provider.ext.rev150712.neutron.networks.network.Segments) NetworkProviderExtension(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.provider.ext.rev150712.NetworkProviderExtension)

Aggregations

NetworkProviderExtension (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.provider.ext.rev150712.NetworkProviderExtension)1 Segments (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.provider.ext.rev150712.neutron.networks.network.Segments)1 SegmentsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.provider.ext.rev150712.neutron.networks.network.SegmentsKey)1