From: Giovanni Meo Date: Thu, 6 Feb 2014 20:23:00 +0000 (+0000) Subject: Merge "Fix for BUG 402: Subnet creation with NeutronAPIService sometimes fails with... X-Git-Tag: autorelease-tag-v20140601202136_82eb3f9~524 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=b02467e8b6cb7950b0c8fea7105688cc49ac29aa;hp=eff2c59fa4e670d97dc6f6c43e233b3e7628d67d Merge "Fix for BUG 402: Subnet creation with NeutronAPIService sometimes fails with a 409 error" --- 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 11a1be2118..6582d8c021 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 @@ -269,22 +269,26 @@ public class NeutronSubnet extends ConfigurationObject implements Serializable { } 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; }