use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.IpVersionV4 in project netvirt by opendaylight.
the class DhcpServiceUtils method isIpv4Subnet.
public static boolean isIpv4Subnet(DataBroker broker, Uuid subnetUuid) {
final SubnetKey subnetkey = new SubnetKey(subnetUuid);
final InstanceIdentifier<Subnet> subnetidentifier = InstanceIdentifier.create(Neutron.class).child(Subnets.class).child(Subnet.class, subnetkey);
final Optional<Subnet> subnet = MDSALUtil.read(broker, LogicalDatastoreType.CONFIGURATION, subnetidentifier);
if (subnet.isPresent()) {
Class<? extends IpVersionBase> ipVersionBase = subnet.get().getIpVersion();
if (ipVersionBase.equals(IpVersionV4.class)) {
return true;
}
}
return false;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.IpVersionV4 in project netvirt by opendaylight.
the class VpnUtil method getVpnSubnetGatewayIp.
public static Optional<String> getVpnSubnetGatewayIp(DataBroker dataBroker, final Uuid subnetUuid) {
Optional<String> gwIpAddress = Optional.absent();
final SubnetKey subnetkey = new SubnetKey(subnetUuid);
final InstanceIdentifier<Subnet> subnetidentifier = InstanceIdentifier.create(Neutron.class).child(Subnets.class).child(Subnet.class, subnetkey);
final Optional<Subnet> subnet = read(dataBroker, LogicalDatastoreType.CONFIGURATION, subnetidentifier);
if (subnet.isPresent()) {
Class<? extends IpVersionBase> ipVersionBase = subnet.get().getIpVersion();
if (ipVersionBase.equals(IpVersionV4.class)) {
LOG.trace("getVpnSubnetGatewayIp: Obtained subnet {} for vpn interface", subnet.get().getUuid().getValue());
IpAddress gwIp = subnet.get().getGatewayIp();
if (gwIp != null && gwIp.getIpv4Address() != null) {
gwIpAddress = Optional.of(gwIp.getIpv4Address().getValue());
}
}
}
return gwIpAddress;
}
Aggregations