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;
}
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;
}
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;
}
}
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;
}
Aggregations