Search in sources :

Example 1 with NetworkKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.NetworkKey in project netvirt by opendaylight.

the class VpnUtil method getNeutronNetwork.

@SuppressWarnings("checkstyle:linelength")
static Network getNeutronNetwork(DataBroker broker, Uuid networkId) {
    Network network = null;
    LOG.debug("getNeutronNetwork for {}", networkId.getValue());
    InstanceIdentifier<Network> inst = InstanceIdentifier.create(Neutron.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.Networks.class).child(Network.class, new NetworkKey(networkId));
    Optional<Network> net = read(broker, LogicalDatastoreType.CONFIGURATION, inst);
    if (net.isPresent()) {
        network = net.get();
    }
    return network;
}
Also used : Networks(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.networks.Networks) ExternalNetworks(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ExternalNetworks) NetworkKey(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.NetworkKey) Network(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network)

Example 2 with NetworkKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.NetworkKey in project netvirt by opendaylight.

the class DhcpServiceUtils method getSegmentationId.

public static String getSegmentationId(Uuid networkId, DataBroker broker) {
    InstanceIdentifier<Network> inst = InstanceIdentifier.create(Neutron.class).child(Networks.class).child(Network.class, new NetworkKey(networkId));
    Optional<Network> optionalNetwork = MDSALUtil.read(broker, LogicalDatastoreType.CONFIGURATION, inst);
    if (!optionalNetwork.isPresent()) {
        return null;
    }
    Network network = optionalNetwork.get();
    String segmentationId = NeutronUtils.getSegmentationIdFromNeutronNetwork(network, NetworkTypeVxlan.class);
    return segmentationId;
}
Also used : Networks(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.Networks) NetworkKey(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.NetworkKey) Network(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network)

Example 3 with NetworkKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.NetworkKey in project netvirt by opendaylight.

the class DhcpAllocationPoolManager method getAllocationPoolByNetwork.

public AllocationPool getAllocationPoolByNetwork(String networkId) throws ReadFailedException {
    InstanceIdentifier<Network> network = InstanceIdentifier.builder(DhcpAllocationPool.class).child(Network.class, new NetworkKey(networkId)).build();
    Optional<Network> optionalNetworkConfData = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, network);
    if (!optionalNetworkConfData.isPresent()) {
        LOG.info("No network configuration data for network {}", networkId);
        return null;
    }
    Network networkConfData = optionalNetworkConfData.get();
    List<AllocationPool> allocationPoolList = networkConfData.getAllocationPool();
    // as we have no info about a specific subnet
    if (allocationPoolList != null && !allocationPoolList.isEmpty()) {
        return allocationPoolList.get(0);
    } else {
        LOG.warn("No allocation pools for network {}", networkId);
        return null;
    }
}
Also used : NetworkKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.NetworkKey) Network(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network) DhcpAllocationPool(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.DhcpAllocationPool) AllocationPool(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.network.AllocationPool)

Example 4 with NetworkKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.NetworkKey in project netvirt by opendaylight.

the class NeutronvpnUtils method getNeutronNetwork.

protected Network getNeutronNetwork(Uuid networkId) {
    Network network = null;
    network = networkMap.get(networkId);
    if (network != null) {
        return network;
    }
    LOG.debug("getNeutronNetwork for {}", networkId.getValue());
    InstanceIdentifier<Network> inst = InstanceIdentifier.create(Neutron.class).child(Networks.class).child(Network.class, new NetworkKey(networkId));
    Optional<Network> net = read(LogicalDatastoreType.CONFIGURATION, inst);
    if (net.isPresent()) {
        network = net.get();
    }
    return network;
}
Also used : Networks(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.Networks) NetworkKey(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.NetworkKey) Network(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network)

Aggregations

Network (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network)3 NetworkKey (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.NetworkKey)3 Networks (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.Networks)2 DhcpAllocationPool (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.DhcpAllocationPool)1 Network (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network)1 NetworkKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.NetworkKey)1 AllocationPool (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.network.AllocationPool)1 ExternalNetworks (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ExternalNetworks)1 Networks (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.networks.Networks)1