X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetworkconfiguration%2Fneutron%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetworkconfig%2Fneutron%2FNeutronSubnet.java;h=d032d2e8acf7f1694da85b7fec18a0623176962d;hp=e53c3d4b1a9ddee674c231bdf400f0beed22a162;hb=c46e223995956f1f759c551163c212947c1e2fb7;hpb=dde5cf25470fae922209771b4f0aa71ed872cabe diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java index e53c3d4b1a..d032d2e8ac 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java @@ -1,5 +1,5 @@ /* - * Copyright IBM Corporation, 2013. All rights reserved. + * Copyright IBM Corporation and others, 2013. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -8,9 +8,11 @@ package org.opendaylight.controller.networkconfig.neutron; +import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; + import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -18,11 +20,14 @@ import javax.xml.bind.annotation.XmlRootElement; import org.apache.commons.net.util.SubnetUtils; import org.apache.commons.net.util.SubnetUtils.SubnetInfo; +import org.opendaylight.controller.configuration.ConfigurationObject; @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) -public class NeutronSubnet { +public class NeutronSubnet extends ConfigurationObject implements Serializable, INeutronObject { + private static final long serialVersionUID = 1L; + // See OpenStack Network API v2.0 Reference for description of // annotated attributes @@ -59,12 +64,18 @@ public class NeutronSubnet { @XmlElement (name="tenant_id") String tenantID; + @XmlElement (name="ipv6_address_mode", nillable=true) + String ipV6AddressMode; + + @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. */ List myPorts; - boolean gatewayIPAssigned; + Boolean gatewayIPAssigned; public NeutronSubnet() { myPorts = new ArrayList(); @@ -72,6 +83,8 @@ public class NeutronSubnet { public String getID() { return subnetUUID; } + public void setID(String id) { this.subnetUUID = id; } + public String getSubnetUUID() { return subnetUUID; } @@ -165,6 +178,14 @@ public class NeutronSubnet { this.tenantID = tenantID; } + public String getIpV6AddressMode() { return ipV6AddressMode; } + + public void setIpV6AddressMode(String ipV6AddressMode) { this.ipV6AddressMode = ipV6AddressMode; } + + public String getIpV6RaMode() { return ipV6RaMode; } + + public void setIpV6RaMode(String ipV6RaMode) { this.ipV6RaMode = ipV6RaMode; } + /** * This method copies selected fields from the object and returns them * as a new object, suitable for marshaling. @@ -219,6 +240,12 @@ public class NeutronSubnet { if (s.equals("tenant_id")) { ans.setTenantID(this.getTenantID()); } + if (s.equals("ipv6_address_mode")) { + ans.setIpV6AddressMode(this.getIpV6AddressMode()); + } + if (s.equals("ipv6_ra_mode")) { + ans.setIpV6RaMode(this.getIpV6RaMode()); + } } return ans; } @@ -264,22 +291,26 @@ public class NeutronSubnet { } gatewayIPAssigned = false; dnsNameservers = new ArrayList(); - allocationPools = new ArrayList(); - hostRoutes = new ArrayList(); - try { - SubnetUtils util = new SubnetUtils(cidr); - SubnetInfo info = util.getInfo(); - if (gatewayIP == null) { - gatewayIP = info.getLowAddress(); - } - if (allocationPools.size() < 1) { - NeutronSubnet_IPAllocationPool source = - new NeutronSubnet_IPAllocationPool(info.getLowAddress(), - info.getHighAddress()); - allocationPools = source.splitPool(gatewayIP); + if (hostRoutes == null) { + hostRoutes = new ArrayList(); + } + if (allocationPools == null) { + allocationPools = new ArrayList(); + try { + SubnetUtils util = new SubnetUtils(cidr); + SubnetInfo info = util.getInfo(); + if (gatewayIP == null) { + gatewayIP = info.getLowAddress(); + } + if (allocationPools.size() < 1) { + NeutronSubnet_IPAllocationPool source = + new NeutronSubnet_IPAllocationPool(info.getLowAddress(), + info.getHighAddress()); + allocationPools = source.splitPool(gatewayIP); + } + } catch (Exception e) { + return false; } - } catch (Exception e) { - return false; } return true; } @@ -428,4 +459,18 @@ public class NeutronSubnet { public void resetGatewayIPAllocated() { gatewayIPAssigned = false; } + + public Boolean getGatewayIPAllocated() { + return gatewayIPAssigned; + } + + @Override + public String toString() { + return "NeutronSubnet [subnetUUID=" + subnetUUID + ", networkUUID=" + networkUUID + ", name=" + name + + ", ipVersion=" + ipVersion + ", cidr=" + cidr + ", gatewayIP=" + gatewayIP + ", dnsNameservers=" + + dnsNameservers + ", allocationPools=" + allocationPools + ", hostRoutes=" + hostRoutes + + ", enableDHCP=" + enableDHCP + ", tenantID=" + tenantID + ", myPorts=" + myPorts + + ", gatewayIPAssigned=" + gatewayIPAssigned + ", ipv6AddressMode=" + ipV6AddressMode + + ", ipv6RaMode=" + ipV6RaMode + "]"; + } }