@XmlElement (name = "ipv6_ra_mode", nillable = true)
String ipV6RaMode;
- /* stores the OpenStackPorts associated with an instance
- * used to determine if that instance can be deleted.
- *
- * @deprecated, will be removed in Boron
- */
-
- List<NeutronPort> myPorts;
-
- public NeutronSubnet() {
- myPorts = new ArrayList<NeutronPort>();
- }
-
- // @deprecated - will be removed in Boron
- public void setPorts(List<NeutronPort> arg) {
- myPorts = arg;
- }
-
- @Deprecated
- public String getSubnetUUID() {
- return getID();
- }
-
- @Deprecated
- public void setSubnetUUID(String uuid) {
- setID(uuid);
- }
-
public String getNetworkUUID() {
return networkUUID;
}
return ans;
}
- // @deprecated - will be removed in Boron
- public List<NeutronPort> getPortsInSubnet() {
- return myPorts;
- }
-
- // @deprecated - will be removed in Boron
- public List<NeutronPort> getPortsInSubnet(String ignore) {
- List<NeutronPort> answer = new ArrayList<NeutronPort>();
- for (NeutronPort port : myPorts) {
- if (!port.getDeviceOwner().equalsIgnoreCase(ignore)) {
- answer.add(port);
- }
- }
- return answer;
- }
-
/* test to see if the cidr address used to define this subnet
* is a valid network address (an necessary condition when creating
* a new subnet)
package org.opendaylight.neutron.transcriber;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
-
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.neutron.spi.INeutronPortCRUD;
import org.opendaylight.neutron.spi.INeutronSubnetCRUD;
-import org.opendaylight.neutron.spi.Neutron_IPs;
-import org.opendaylight.neutron.spi.NeutronCRUDInterfaces;
-import org.opendaylight.neutron.spi.NeutronPort;
import org.opendaylight.neutron.spi.NeutronSubnet;
import org.opendaylight.neutron.spi.NeutronSubnet_HostRoute;
import org.opendaylight.neutron.spi.NeutronSubnetIPAllocationPool;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefixBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.Dhcpv6Base;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.Dhcpv6Off;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.constants.rev150712.Dhcpv6Slaac;
public class NeutronSubnetInterface extends AbstractNeutronInterface<Subnet, Subnets, NeutronSubnet> implements INeutronSubnetCRUD {
private static final Logger LOGGER = LoggerFactory.getLogger(NeutronSubnetInterface.class);
+ private static final int IPV4_VERSION = 4;
+ private static final int IPV6_VERSION = 6;
+
private static final ImmutableBiMap<Class<? extends IpVersionBase>,Integer> IPV_MAP
= new ImmutableBiMap.Builder<Class<? extends IpVersionBase>,Integer>()
- .put(IpVersionV4.class,Integer.valueOf(4))
- .put(IpVersionV6.class,Integer.valueOf(6))
+ .put(IpVersionV4.class,Integer.valueOf(IPV4_VERSION))
+ .put(IpVersionV6.class,Integer.valueOf(IPV6_VERSION))
.build();
private static final ImmutableBiMap<Class<? extends Dhcpv6Base>,String> DHCPV6_MAP
return update(uuid, delta);
}
-// note: this is being set to false in preparation for deprecation and removal
- @Override
- public boolean subnetInUse(String subnetUUID) {
- return false;
- }
-
protected NeutronSubnet fromMd(Subnet subnet) {
final NeutronSubnet result = new NeutronSubnet();
result.setName(subnet.getName());
result.setTenantID(subnet.getTenantId());
result.setNetworkUUID(subnet.getNetworkId().getValue());
result.setIpVersion(IPV_MAP.get(subnet.getIpVersion()));
- result.setCidr(subnet.getCidr());
+ result.setCidr(String.valueOf(subnet.getCidr().getValue()));
if (subnet.getGatewayIp() != null) {
result.setGatewayIP(String.valueOf(subnet.getGatewayIp().getValue()));
}
final List<NeutronSubnetIPAllocationPool> allocationPools = new ArrayList<NeutronSubnetIPAllocationPool>();
for (final AllocationPools allocationPool : subnet.getAllocationPools()) {
final NeutronSubnetIPAllocationPool pool = new NeutronSubnetIPAllocationPool();
- pool.setPoolStart(allocationPool.getStart());
- pool.setPoolEnd(allocationPool.getEnd());
+ pool.setPoolStart(String.valueOf(allocationPool.getStart().getValue()));
+ pool.setPoolEnd(String.valueOf(allocationPool.getEnd().getValue()));
allocationPools.add(pool);
}
result.setAllocationPools(allocationPools);
result.setHostRoutes(hostRoutes);
}
result.setID(subnet.getUuid().getValue());
-// read through the ports and put the ones in this subnet into the internal
-// myPorts object.
-// @deprecated and will be removed in Boron
- final Set<NeutronPort> allPorts = new HashSet<NeutronPort>();
- final NeutronCRUDInterfaces interfaces = new NeutronCRUDInterfaces()
- .fetchINeutronPortCRUD(this);
- final INeutronPortCRUD portIf = interfaces.getPortInterface();
- for (final NeutronPort port : portIf.getAllPorts()) {
- if (port.getFixedIPs() != null) {
- for (final Neutron_IPs ip : port.getFixedIPs()) {
- if (ip.getSubnetUUID().equals(result.getID())) {
- allPorts.add(port);
- }
- }
- }
- }
- final List<NeutronPort> ports = new ArrayList<NeutronPort>();
- ports.addAll(allPorts);
- result.setPorts(ports);
return result;
}
.getIpVersion()));
}
if (subnet.getCidr() != null) {
- subnetBuilder.setCidr(subnet.getCidr());
+ final IpPrefix ipPrefix = IpPrefixBuilder.getDefaultInstance(subnet.getCidr());
+ subnetBuilder.setCidr(ipPrefix);
}
if (subnet.getGatewayIP() != null) {
final IpAddress ipAddress = new IpAddress(subnet.getGatewayIP()
for (final NeutronSubnetIPAllocationPool allocationPool : subnet
.getAllocationPools()) {
final AllocationPoolsBuilder builder = new AllocationPoolsBuilder();
- builder.setStart(allocationPool.getPoolStart());
- builder.setEnd(allocationPool.getPoolEnd());
+ builder.setStart(new IpAddress(allocationPool.getPoolStart().toCharArray()));
+ builder.setEnd(new IpAddress(allocationPool.getPoolEnd().toCharArray()));
final AllocationPools temp = builder.build();
allocationPools.add(temp);
}