Search in sources :

Example 6 with NetworkProviderExtension

use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.provider.ext.rev150712.NetworkProviderExtension 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.getAugmentation(NetworkProviderExtension.class);
    if (providerExtension != null) {
        segmentationId = providerExtension.getSegmentationId();
        if (segmentationId == null) {
            List<Segments> providerSegments = providerExtension.getSegments();
            if (providerSegments != null && providerSegments.size() > 0) {
                for (Segments providerSegment : providerSegments) {
                    if (isNetworkSegmentType(providerSegment, networkType)) {
                        segmentationId = providerSegment.getSegmentationId();
                        break;
                    }
                }
            }
        }
    }
    return segmentationId;
}
Also used : 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)

Example 7 with NetworkProviderExtension

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

the class NeutronUtils method getSegmentationIdFromNeutronNetworkSegment.

public static String getSegmentationIdFromNeutronNetworkSegment(Network network, Long index) {
    String segmentationId = null;
    NetworkProviderExtension providerExtension = network.getAugmentation(NetworkProviderExtension.class);
    if (providerExtension != null) {
        List<Segments> providerSegments = providerExtension.getSegments();
        if (providerSegments != null && providerSegments.size() > 0) {
            for (Segments providerSegment : providerSegments) {
                if (Objects.equals(providerSegment.getSegmentationIndex(), index)) {
                    segmentationId = providerSegment.getSegmentationId();
                    break;
                }
            }
        }
    }
    return segmentationId;
}
Also used : 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)7 Segments (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.provider.ext.rev150712.neutron.networks.network.Segments)4 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Nonnull (javax.annotation.Nonnull)1 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)1 VpnInstance (org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance)1 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)1 Subnetmap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)1 NetworkTypeGre (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.NetworkTypeGre)1 NetworkTypeVlan (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.NetworkTypeVlan)1 Network (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network)1