From 4adcf131fb5879d053a8226ee9705946fdc8d021 Mon Sep 17 00:00:00 2001 From: Ryan Moats Date: Fri, 12 Jun 2015 16:19:51 -0500 Subject: [PATCH] Fix if/else/for/while/do statements that lack braces Change-Id: Iaeaa652a2c06115e05c6e8db0ba4638af275f856 Signed-off-by: Ryan Moats --- .../neutron/spi/NeutronLoadBalancerPool.java | 7 +- .../api/NeutronFloatingIPsNorthbound.java | 101 ++++++++++++------ ...tronLoadBalancerPoolMembersNorthbound.java | 12 ++- .../NeutronMeteringLabelRulesNorthbound.java | 17 +-- .../api/NeutronMeteringLabelsNorthbound.java | 17 +-- .../api/NeutronRoutersNorthbound.java | 92 ++++++++++------ .../api/NeutronSecurityGroupsNorthbound.java | 4 +- .../api/NeutronVPNIKEPoliciesNorthbound.java | 29 +++-- .../NeutronVPNIPSECPoliciesNorthbound.java | 29 +++-- ...tronVPNIPSECSiteConnectionsNorthbound.java | 32 ++++-- .../api/NeutronVPNServicesNorthbound.java | 5 +- 11 files changed, 227 insertions(+), 118 deletions(-) diff --git a/neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronLoadBalancerPool.java b/neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronLoadBalancerPool.java index 137ce2043..88ec9803f 100644 --- a/neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronLoadBalancerPool.java +++ b/neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronLoadBalancerPool.java @@ -162,8 +162,9 @@ public class NeutronLoadBalancerPool implements Serializable { * Update the pool_id of the member to that this.loadBalancerPoolID */ if (loadBalancerPoolMembers != null) { - for (NeutronLoadBalancerPoolMember member: loadBalancerPoolMembers) + for (NeutronLoadBalancerPoolMember member: loadBalancerPoolMembers) { member.setPoolID(loadBalancerPoolID); + } return loadBalancerPoolMembers; } return loadBalancerPoolMembers; @@ -201,10 +202,10 @@ public class NeutronLoadBalancerPool implements Serializable { if(s.equals("protocol")) { ans.setLoadBalancerPoolProtocol(this.getLoadBalancerPoolProtocol()); } - if(s.equals("lb_algorithm")) { + if (s.equals("lb_algorithm")) { ans.setLoadBalancerPoolLbAlgorithm(this.getLoadBalancerPoolLbAlgorithm()); } - if(s.equals("healthmonitor_id")) { + if (s.equals("healthmonitor_id")) { ans.setNeutronLoadBalancerPoolHealthMonitorID(this.getNeutronLoadBalancerPoolHealthMonitorID()); } if (s.equals("admin_state_up")) { diff --git a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronFloatingIPsNorthbound.java b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronFloatingIPsNorthbound.java index c02205e06..63e62fc2f 100644 --- a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronFloatingIPsNorthbound.java +++ b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronFloatingIPsNorthbound.java @@ -110,10 +110,11 @@ public class NeutronFloatingIPsNorthbound { (queryStatus == null || queryStatus.equals(oSS.getStatus())) && (queryRouterID == null || queryRouterID.equals(oSS.getRouterUUID())) && (queryTenantID == null || queryTenantID.equals(oSS.getTenantUUID()))) { - if (fields.size() > 0) + if (fields.size() > 0) { ans.add(extractFields(oSS,fields)); - else + } else { ans.add(oSS); + } } } //TODO: apply pagination to results @@ -142,8 +143,9 @@ public class NeutronFloatingIPsNorthbound { throw new ServiceUnavailableException("Floating IP CRUD Interface " + RestMessages.SERVICEUNAVAILABLE.toString()); } - if (!floatingIPInterface.floatingIPExists(floatingipUUID)) + if (!floatingIPInterface.floatingIPExists(floatingipUUID)) { throw new ResourceNotFoundException("Floating IP UUID doesn't exist."); + } if (fields.size() > 0) { NeutronFloatingIP ans = floatingIPInterface.getFloatingIP(floatingipUUID); return Response.status(200).entity( @@ -191,60 +193,74 @@ public class NeutronFloatingIPsNorthbound { if (input.isSingleton()) { NeutronFloatingIP singleton = input.getSingleton(); // check existence of id in cache and return badrequest if exists - if (floatingIPInterface.floatingIPExists(singleton.getID())) + if (floatingIPInterface.floatingIPExists(singleton.getID())) { throw new BadRequestException("Floating IP UUID already exists."); + } // check if the external network is specified, exists, and is an external network String externalNetworkUUID = singleton.getFloatingNetworkUUID(); - if (externalNetworkUUID == null) + if (externalNetworkUUID == null) { throw new BadRequestException("external network UUID doesn't exist."); - if (!networkInterface.networkExists(externalNetworkUUID)) + } + if (!networkInterface.networkExists(externalNetworkUUID)) { throw new BadRequestException("external network UUID doesn't exist."); + } NeutronNetwork externNetwork = networkInterface.getNetwork(externalNetworkUUID); - if (!externNetwork.isRouterExternal()) + if (!externNetwork.isRouterExternal()) { throw new BadRequestException("external network isn't marked router:external"); + } // if floating IP is specified, make sure it can come from the network String floatingIP = singleton.getFloatingIPAddress(); if (floatingIP != null) { - if (externNetwork.getSubnets().size() != 1) + if (externNetwork.getSubnets().size() != 1) { throw new BadRequestException("external network doesn't have a subnet"); + } NeutronSubnet externSubnet = subnetInterface.getSubnet(externNetwork.getSubnets().get(0)); - if (!externSubnet.isValidIP(floatingIP)) + if (!externSubnet.isValidIP(floatingIP)) { throw new BadRequestException("external IP isn't valid for the specified subnet."); - if (externSubnet.getFloatingIpPortsInSubnet(floatingIP).isEmpty() && externSubnet.isIPInUse(floatingIP)) + } + if (externSubnet.getFloatingIpPortsInSubnet(floatingIP).isEmpty() && externSubnet.isIPInUse(floatingIP)) { throw new ResourceConflictException("floating IP is in use."); + } } // if port_id is specified, then check that the port exists and has at least one IP String port_id = singleton.getPortUUID(); if (port_id != null) { String fixedIP = null; // used for the fixedIP calculation - if (!portInterface.portExists(port_id)) + if (!portInterface.portExists(port_id)) { throw new ResourceNotFoundException("Port UUID doesn't exist."); + } NeutronPort port = portInterface.getPort(port_id); - if (port.getFixedIPs().size() < 1) + if (port.getFixedIPs().size() < 1) { throw new BadRequestException("port UUID doesn't have an IP address."); + } // if there is more than one fixed IP then check for fixed_ip_address // and that it is in the list of port addresses if (port.getFixedIPs().size() > 1) { fixedIP = singleton.getFixedIPAddress(); - if (fixedIP == null) + if (fixedIP == null) { throw new BadRequestException("fixed IP address doesn't exist."); + } Iterator i = port.getFixedIPs().iterator(); boolean validFixedIP = false; while (i.hasNext() && !validFixedIP) { Neutron_IPs ip = i.next(); - if (ip.getIpAddress().equals(fixedIP)) + if (ip.getIpAddress().equals(fixedIP)) { validFixedIP = true; + } } - if (!validFixedIP) + if (!validFixedIP) { throw new BadRequestException("can't find a valid fixed IP address"); + } } else { fixedIP = port.getFixedIPs().get(0).getIpAddress(); - if (singleton.getFixedIPAddress() != null && !fixedIP.equalsIgnoreCase(singleton.getFixedIPAddress())) + if (singleton.getFixedIPAddress() != null && !fixedIP.equalsIgnoreCase(singleton.getFixedIPAddress())) { throw new BadRequestException("mismatched fixed IP address in request"); + } } //lastly check that this fixed IP address isn't already used - if (port.isBoundToFloatingIP(fixedIP)) + if (port.isBoundToFloatingIP(fixedIP)) { throw new ResourceConflictException("fixed IP is in use."); + } singleton.setFixedIPAddress(fixedIP); } Object[] instances = NeutronUtil.getInstances(INeutronFloatingIPAware.class, this); @@ -253,8 +269,9 @@ public class NeutronFloatingIPsNorthbound { for (Object instance : instances) { INeutronFloatingIPAware service = (INeutronFloatingIPAware) instance; int status = service.canCreateFloatingIP(singleton); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); @@ -314,15 +331,18 @@ public class NeutronFloatingIPsNorthbound { throw new ServiceUnavailableException("Port CRUD Interface " + RestMessages.SERVICEUNAVAILABLE.toString()); } - if (!floatingIPInterface.floatingIPExists(floatingipUUID)) + if (!floatingIPInterface.floatingIPExists(floatingipUUID)) { throw new ResourceNotFoundException("Floating IP UUID doesn't exist."); + } NeutronFloatingIP sourceFloatingIP = floatingIPInterface.getFloatingIP(floatingipUUID); - if (!input.isSingleton()) + if (!input.isSingleton()) { throw new BadRequestException("only singleton requests allowed."); + } NeutronFloatingIP singleton = input.getSingleton(); - if (singleton.getID() == null) + if (singleton.getID() == null) { throw new BadRequestException("singleton UUID doesn't exist."); + } NeutronNetwork externNetwork = networkInterface.getNetwork( sourceFloatingIP.getFloatingNetworkUUID()); @@ -330,48 +350,58 @@ public class NeutronFloatingIPsNorthbound { // if floating IP is specified, make sure it can come from the network String floatingIP = singleton.getFloatingIPAddress(); if (floatingIP != null) { - if (externNetwork.getSubnets().size() != 1) + if (externNetwork.getSubnets().size() != 1) { throw new BadRequestException("external network doesn't have a subnet."); + } NeutronSubnet externSubnet = subnetInterface.getSubnet(externNetwork.getSubnets().get(0)); - if (!externSubnet.isValidIP(floatingIP)) + if (!externSubnet.isValidIP(floatingIP)) { throw new BadRequestException("floating IP not valid for external subnet"); - if (externSubnet.isIPInUse(floatingIP)) + } + if (externSubnet.isIPInUse(floatingIP)) { throw new ResourceConflictException("floating IP is in use."); + } } // if port_id is specified, then check that the port exists and has at least one IP String port_id = singleton.getPortUUID(); if (port_id != null) { String fixedIP = null; // used for the fixedIP calculation - if (!portInterface.portExists(port_id)) + if (!portInterface.portExists(port_id)) { throw new ResourceNotFoundException("Port UUID doesn't exist."); + } NeutronPort port = portInterface.getPort(port_id); - if (port.getFixedIPs().size() < 1) + if (port.getFixedIPs().size() < 1) { throw new BadRequestException("port ID doesn't have a fixed IP address."); + } // if there is more than one fixed IP then check for fixed_ip_address // and that it is in the list of port addresses if (port.getFixedIPs().size() > 1) { fixedIP = singleton.getFixedIPAddress(); - if (fixedIP == null) + if (fixedIP == null) { throw new BadRequestException("request doesn't have a fixed IP address"); + } Iterator i = port.getFixedIPs().iterator(); boolean validFixedIP = false; while (i.hasNext() && !validFixedIP) { Neutron_IPs ip = i.next(); - if (ip.getIpAddress().equals(fixedIP)) + if (ip.getIpAddress().equals(fixedIP)) { validFixedIP = true; + } } - if (!validFixedIP) + if (!validFixedIP) { throw new BadRequestException("couldn't find a valid fixed IP address"); + } } else { fixedIP = port.getFixedIPs().get(0).getIpAddress(); if (singleton.getFixedIPAddress() != null && - !fixedIP.equalsIgnoreCase(singleton.getFixedIPAddress())) + !fixedIP.equalsIgnoreCase(singleton.getFixedIPAddress())) { throw new BadRequestException("mismatch in fixed IP addresses"); + } } //lastly check that this fixed IP address isn't already used - if (port.isBoundToFloatingIP(fixedIP)) + if (port.isBoundToFloatingIP(fixedIP)) { throw new ResourceConflictException("fixed IP is in use."); + } singleton.setFixedIPAddress(fixedIP); } NeutronFloatingIP target = floatingIPInterface.getFloatingIP(floatingipUUID); @@ -381,8 +411,9 @@ public class NeutronFloatingIPsNorthbound { for (Object instance : instances) { INeutronFloatingIPAware service = (INeutronFloatingIPAware) instance; int status = service.canUpdateFloatingIP(singleton, target); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); @@ -421,8 +452,9 @@ public class NeutronFloatingIPsNorthbound { throw new ServiceUnavailableException("Floating IP CRUD Interface " + RestMessages.SERVICEUNAVAILABLE.toString()); } - if (!floatingIPInterface.floatingIPExists(floatingipUUID)) + if (!floatingIPInterface.floatingIPExists(floatingipUUID)) { throw new ResourceNotFoundException("Floating IP UUID doesn't exist."); + } // TODO: need to undo port association if it exists NeutronFloatingIP singleton = floatingIPInterface.getFloatingIP(floatingipUUID); Object[] instances = NeutronUtil.getInstances(INeutronFloatingIPAware.class, this); @@ -431,8 +463,9 @@ public class NeutronFloatingIPsNorthbound { for (Object instance : instances) { INeutronFloatingIPAware service = (INeutronFloatingIPAware) instance; int status = service.canDeleteFloatingIP(singleton); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); diff --git a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronLoadBalancerPoolMembersNorthbound.java b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronLoadBalancerPoolMembersNorthbound.java index 8c1632e29..671527897 100644 --- a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronLoadBalancerPoolMembersNorthbound.java +++ b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronLoadBalancerPoolMembersNorthbound.java @@ -143,8 +143,9 @@ public Response showLoadBalancerPoolMember( List members = loadBalancerPoolInterface.getNeutronLoadBalancerPool(loadBalancerPoolUUID).getLoadBalancerPoolMembers(); for (NeutronLoadBalancerPoolMember ans: members) { - if (!ans.getPoolMemberID().equals(loadBalancerPoolMemberUUID)) + if (!ans.getPoolMemberID().equals(loadBalancerPoolMemberUUID)) { continue; + } if (fields.size() > 0) { return Response.status(200).entity( @@ -195,8 +196,9 @@ public Response createLoadBalancerPoolMember( if (singletonPool.getLoadBalancerPoolMembers() != null) { List members = singletonPool.getLoadBalancerPoolMembers(); for (NeutronLoadBalancerPoolMember member: members) { - if (member.getPoolMemberID().equals(loadBalancerPoolMemberUUID)) + if (member.getPoolMemberID().equals(loadBalancerPoolMemberUUID)) { throw new BadRequestException("LoadBalancerPoolMember UUID already exists"); + } } } @@ -243,8 +245,9 @@ public Response createLoadBalancerPoolMember( */ List members = singletonPool.getLoadBalancerPoolMembers(); for (NeutronLoadBalancerPoolMember member: members) { - if (member.getPoolMemberID().equals(loadBalancerPoolMemberUUID)) + if (member.getPoolMemberID().equals(loadBalancerPoolMemberUUID)) { throw new BadRequestException("LoadBalancerPoolMember UUID already exists"); + } } if (testMap.containsKey(test.getPoolMemberID())) { @@ -345,8 +348,9 @@ public Response deleteLoadBalancerPoolMember( break; } } - if (singleton == null) + if (singleton == null) { throw new BadRequestException("LoadBalancerPoolMember UUID does not exist."); + } Object[] instances = NeutronUtil.getInstances(INeutronLoadBalancerPoolMemberAware.class, this); if (instances != null) { diff --git a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronMeteringLabelRulesNorthbound.java b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronMeteringLabelRulesNorthbound.java index 2ed61b6e7..dd7bd8e91 100644 --- a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronMeteringLabelRulesNorthbound.java +++ b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronMeteringLabelRulesNorthbound.java @@ -99,10 +99,11 @@ public class NeutronMeteringLabelRulesNorthbound { (queryDirection == null || queryDirection.equals(oSS.getMeteringLabelRuleDirection())) && (queryRemoteIPPrefix == null || queryRemoteIPPrefix.equals(oSS.getMeteringLabelRuleRemoteIPPrefix())) && (queryLabelID == null || queryLabelID.equals(oSS.getMeteringLabelRuleLabelID()))) { - if (fields.size() > 0) + if (fields.size() > 0) { ans.add(extractFields(oSS,fields)); - else + } else { ans.add(oSS); + } } } //TODO: apply pagination to results @@ -169,16 +170,18 @@ public class NeutronMeteringLabelRulesNorthbound { /* * verify that the meteringLabelRule doesn't already exist (issue: is deeper inspection necessary?) */ - if (meteringLabelRuleInterface.neutronMeteringLabelRuleExists(singleton.getMeteringLabelRuleUUID())) + if (meteringLabelRuleInterface.neutronMeteringLabelRuleExists(singleton.getMeteringLabelRuleUUID())) { throw new BadRequestException("meteringLabelRule UUID already exists"); + } Object[] instances = NeutronUtil.getInstances(INeutronMeteringLabelRuleAware.class, this); if (instances != null) { if (instances.length > 0) { for (Object instance : instances) { INeutronMeteringLabelRuleAware service = (INeutronMeteringLabelRuleAware) instance; int status = service.canCreateMeteringLabelRule(singleton); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); @@ -230,8 +233,9 @@ public class NeutronMeteringLabelRulesNorthbound { /* * verify that the meteringLabelRule exists and is not in use before removing it */ - if (!meteringLabelRuleInterface.neutronMeteringLabelRuleExists(ruleUUID)) + if (!meteringLabelRuleInterface.neutronMeteringLabelRuleExists(ruleUUID)) { throw new ResourceNotFoundException("MeteringLabelRule UUID not found"); + } NeutronMeteringLabelRule singleton = meteringLabelRuleInterface.getNeutronMeteringLabelRule(ruleUUID); Object[] instances = NeutronUtil.getInstances(INeutronMeteringLabelRuleAware.class, this); if (instances != null) { @@ -239,8 +243,9 @@ public class NeutronMeteringLabelRulesNorthbound { for (Object instance : instances) { INeutronMeteringLabelRuleAware service = (INeutronMeteringLabelRuleAware) instance; int status = service.canDeleteMeteringLabelRule(singleton); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); diff --git a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronMeteringLabelsNorthbound.java b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronMeteringLabelsNorthbound.java index 938703bd5..31a83c140 100644 --- a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronMeteringLabelsNorthbound.java +++ b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronMeteringLabelsNorthbound.java @@ -99,10 +99,11 @@ public class NeutronMeteringLabelsNorthbound { (queryName == null || queryName.equals(oSS.getMeteringLabelName())) && (queryDescription == null || queryDescription.equals(oSS.getMeteringLabelDescription())) && (queryTenantID == null || queryTenantID.equals(oSS.getMeteringLabelTenantID()))) { - if (fields.size() > 0) + if (fields.size() > 0) { ans.add(extractFields(oSS,fields)); - else + } else { ans.add(oSS); + } } } //TODO: apply pagination to results @@ -169,16 +170,18 @@ public class NeutronMeteringLabelsNorthbound { /* * verify that the meteringLabel doesn't already exist (issue: is deeper inspection necessary?) */ - if (meteringLabelInterface.neutronMeteringLabelExists(singleton.getMeteringLabelUUID())) + if (meteringLabelInterface.neutronMeteringLabelExists(singleton.getMeteringLabelUUID())) { throw new BadRequestException("meteringLabel UUID already exists"); + } Object[] instances = NeutronUtil.getInstances(INeutronMeteringLabelAware.class, this); if (instances != null) { if (instances.length > 0) { for (Object instance : instances) { INeutronMeteringLabelAware service = (INeutronMeteringLabelAware) instance; int status = service.canCreateMeteringLabel(singleton); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); @@ -230,8 +233,9 @@ public class NeutronMeteringLabelsNorthbound { /* * verify that the meteringLabel exists and is not in use before removing it */ - if (!meteringLabelInterface.neutronMeteringLabelExists(labelUUID)) + if (!meteringLabelInterface.neutronMeteringLabelExists(labelUUID)) { throw new ResourceNotFoundException("MeteringLabel UUID not found"); + } NeutronMeteringLabel singleton = meteringLabelInterface.getNeutronMeteringLabel(labelUUID); Object[] instances = NeutronUtil.getInstances(INeutronMeteringLabelAware.class, this); if (instances != null) { @@ -239,8 +243,9 @@ public class NeutronMeteringLabelsNorthbound { for (Object instance : instances) { INeutronMeteringLabelAware service = (INeutronMeteringLabelAware) instance; int status = service.canDeleteMeteringLabel(singleton); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); diff --git a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronRoutersNorthbound.java b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronRoutersNorthbound.java index 6e1de5d45..40e36d44c 100644 --- a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronRoutersNorthbound.java +++ b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronRoutersNorthbound.java @@ -109,10 +109,11 @@ public class NeutronRoutersNorthbound { (queryStatus == null || queryStatus.equals(oSS.getStatus())) && (queryExternalGatewayInfo == null || queryExternalGatewayInfo.equals(oSS.getExternalGatewayInfo())) && (queryTenantID == null || queryTenantID.equals(oSS.getTenantID()))) { - if (fields.size() > 0) + if (fields.size() > 0) { ans.add(extractFields(oSS,fields)); - else + } else { ans.add(oSS); + } } } //TODO: apply pagination to results @@ -187,15 +188,18 @@ public class NeutronRoutersNorthbound { * if there is external gateway information provided, verify that the specified network * exists and has been designated as "router:external" */ - if (routerInterface.routerExists(singleton.getID())) + if (routerInterface.routerExists(singleton.getID())) { throw new BadRequestException("router UUID already exists"); + } if (singleton.getExternalGatewayInfo() != null) { String externNetworkPtr = singleton.getExternalGatewayInfo().getNetworkID(); - if (!networkInterface.networkExists(externNetworkPtr)) + if (!networkInterface.networkExists(externNetworkPtr)) { throw new BadRequestException("External Network Pointer doesn't exist"); + } NeutronNetwork externNetwork = networkInterface.getNetwork(externNetworkPtr); - if (!externNetwork.isRouterExternal()) + if (!externNetwork.isRouterExternal()) { throw new BadRequestException("External Network Pointer isn't marked as router:external"); + } } Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this); if (instances != null) { @@ -203,8 +207,9 @@ public class NeutronRoutersNorthbound { for (Object instance : instances) { INeutronRouterAware service = (INeutronRouterAware) instance; int status = service.canCreateRouter(singleton); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); @@ -266,10 +271,12 @@ public class NeutronRoutersNorthbound { /* * router has to exist and only a single delta can be supplied */ - if (!routerInterface.routerExists(routerUUID)) + if (!routerInterface.routerExists(routerUUID)) { throw new ResourceNotFoundException("Router UUID not found"); - if (!input.isSingleton()) + } + if (!input.isSingleton()) { throw new BadRequestException("Only single router deltas supported"); + } NeutronRouter singleton = input.getSingleton(); NeutronRouter original = routerInterface.getRouter(routerUUID); @@ -277,8 +284,9 @@ public class NeutronRoutersNorthbound { * attribute changes blocked by Neutron */ if (singleton.getID() != null || singleton.getTenantID() != null || - singleton.getStatus() != null) + singleton.getStatus() != null) { throw new BadRequestException("Request attribute change not allowed"); + } Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this); if (instances != null) { @@ -286,8 +294,9 @@ public class NeutronRoutersNorthbound { for (Object instance : instances) { INeutronRouterAware service = (INeutronRouterAware) instance; int status = service.canUpdateRouter(singleton, original); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); @@ -301,11 +310,13 @@ public class NeutronRoutersNorthbound { */ if (singleton.getExternalGatewayInfo() != null) { String externNetworkPtr = singleton.getExternalGatewayInfo().getNetworkID(); - if (!networkInterface.networkExists(externNetworkPtr)) + if (!networkInterface.networkExists(externNetworkPtr)) { throw new BadRequestException("External Network Pointer does not exist"); + } NeutronNetwork externNetwork = networkInterface.getNetwork(externNetworkPtr); - if (!externNetwork.isRouterExternal()) + if (!externNetwork.isRouterExternal()) { throw new BadRequestException("External Network Pointer isn't marked as router:external"); + } } /* @@ -347,10 +358,12 @@ public class NeutronRoutersNorthbound { /* * verify that the router exists and is not in use before removing it */ - if (!routerInterface.routerExists(routerUUID)) + if (!routerInterface.routerExists(routerUUID)) { throw new ResourceNotFoundException("Router UUID not found"); - if (routerInterface.routerInUse(routerUUID)) + } + if (routerInterface.routerInUse(routerUUID)) { throw new ResourceConflictException("Router UUID in Use"); + } NeutronRouter singleton = routerInterface.getRouter(routerUUID); Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this); if (instances != null) { @@ -358,8 +371,9 @@ public class NeutronRoutersNorthbound { for (Object instance : instances) { INeutronRouterAware service = (INeutronRouterAware) instance; int status = service.canDeleteRouter(singleton); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); @@ -417,39 +431,48 @@ public class NeutronRoutersNorthbound { * While the Neutron specification says that the router has to exist and the input can only specify either a subnet id * or a port id, but not both, this code assumes that the plugin has filled everything in for us and so both must be present */ - if (!routerInterface.routerExists(routerUUID)) + if (!routerInterface.routerExists(routerUUID)) { throw new BadRequestException("Router UUID doesn't exist"); + } NeutronRouter target = routerInterface.getRouter(routerUUID); if (input.getSubnetUUID() == null || - input.getPortUUID() == null) + input.getPortUUID() == null) { throw new BadRequestException("Must specify at subnet id, port id or both"); + } // check that the port is part of the subnet NeutronSubnet targetSubnet = subnetInterface.getSubnet(input.getSubnetUUID()); - if (targetSubnet == null) + if (targetSubnet == null) { throw new BadRequestException("Subnet id doesn't exist"); + } NeutronPort targetPort = portInterface.getPort(input.getPortUUID()); - if (targetPort == null) + if (targetPort == null) { throw new BadRequestException("Port id doesn't exist"); - if (!targetSubnet.getPortsInSubnet().contains(targetPort)) + } + if (!targetSubnet.getPortsInSubnet().contains(targetPort)) { throw new BadRequestException("Port id not part of subnet id"); + } - if (targetPort.getFixedIPs().size() != 1) + if (targetPort.getFixedIPs().size() != 1) { throw new BadRequestException("Port id must have a single fixedIP address"); - if (targetPort.getDeviceID() != null && !targetPort.getDeviceID().equals(routerUUID)) + } + if (targetPort.getDeviceID() != null && !targetPort.getDeviceID().equals(routerUUID)) { throw new ResourceConflictException("Target Port already allocated to a different device id"); + } if (targetPort.getDeviceOwner() != null && !targetPort.getDeviceOwner().equalsIgnoreCase(ROUTER_INTERFACE_STR) && - !targetPort.getDeviceOwner().equalsIgnoreCase(ROUTER_GATEWAY_STR)) + !targetPort.getDeviceOwner().equalsIgnoreCase(ROUTER_GATEWAY_STR)) { throw new ResourceConflictException("Target Port already allocated to non-router interface"); + } Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this); if (instances != null) { if (instances.length > 0) { for (Object instance : instances) { INeutronRouterAware service = (INeutronRouterAware) instance; int status = service.canAttachInterface(target, input); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); @@ -459,8 +482,9 @@ public class NeutronRoutersNorthbound { } //mark the port device id and device owner fields - if (targetPort.getDeviceOwner() == null || targetPort.getDeviceOwner().isEmpty()) + if (targetPort.getDeviceOwner() == null || targetPort.getDeviceOwner().isEmpty()) { targetPort.setDeviceOwner(ROUTER_INTERFACE_STR); + } targetPort.setDeviceID(routerUUID); target.addInterface(input.getPortUUID(), input); @@ -511,8 +535,9 @@ public class NeutronRoutersNorthbound { } // verify the router exists - if (!routerInterface.routerExists(routerUUID)) + if (!routerInterface.routerExists(routerUUID)) { throw new BadRequestException("Router does not exist"); + } NeutronRouter target = routerInterface.getRouter(routerUUID); /* @@ -522,8 +547,9 @@ public class NeutronRoutersNorthbound { if (input.getPortUUID() == null && input.getSubnetUUID() != null) { NeutronPort port = portInterface.getGatewayPort(input.getSubnetUUID()); - if (port == null) + if (port == null) { throw new ResourceNotFoundException("Port UUID not found"); + } input.setPortUUID(port.getID()); input.setID(target.getID()); input.setTenantID(target.getTenantID()); @@ -534,8 +560,9 @@ public class NeutronRoutersNorthbound { for (Object instance : instances) { INeutronRouterAware service = (INeutronRouterAware) instance; int status = service.canDetachInterface(target, input); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); @@ -577,8 +604,9 @@ public class NeutronRoutersNorthbound { for (Object instance : instances) { INeutronRouterAware service = (INeutronRouterAware) instance; int status = service.canDetachInterface(target, input); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); @@ -615,16 +643,18 @@ public class NeutronRoutersNorthbound { if (subnet == null) { throw new ResourceNotFoundException("Subnet UUID not found"); } - if (!subnet.isValidIP(port.getFixedIPs().get(0).getIpAddress())) + if (!subnet.isValidIP(port.getFixedIPs().get(0).getIpAddress())) { throw new ResourceConflictException("Target Port IP not in Target Subnet"); + } Object[] instances = NeutronUtil.getInstances(INeutronRouterAware.class, this); if (instances != null) { if (instances.length > 0) { for (Object instance : instances) { INeutronRouterAware service = (INeutronRouterAware) instance; int status = service.canDetachInterface(target, input); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); diff --git a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronSecurityGroupsNorthbound.java b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronSecurityGroupsNorthbound.java index 86fc6e337..4e5b3a362 100644 --- a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronSecurityGroupsNorthbound.java +++ b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronSecurityGroupsNorthbound.java @@ -223,7 +223,9 @@ public class NeutronSecurityGroupsNorthbound { for (Object instance : instances) { INeutronSecurityGroupAware service = (INeutronSecurityGroupAware) instance; int status = service.canCreateNeutronSecurityGroup(test); - if ((status < 200) || (status > 299)) return Response.status(status).build(); + if ((status < 200) || (status > 299)) { + return Response.status(status).build(); + } } } else { throw new BadRequestException("No providers registered. Please try again later"); diff --git a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNIKEPoliciesNorthbound.java b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNIKEPoliciesNorthbound.java index 727dd7682..390d05811 100644 --- a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNIKEPoliciesNorthbound.java +++ b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNIKEPoliciesNorthbound.java @@ -108,10 +108,11 @@ public class NeutronVPNIKEPoliciesNorthbound { (queryPFS == null || queryPFS.equals(oSS.getPerfectForwardSecrecy())) && (queryIKEVersion == null || queryIKEVersion.equals(oSS.getIkeVersion())) && (queryTenantID == null || queryTenantID.equals(oSS.getTenantID()))) { - if (fields.size() > 0) + if (fields.size() > 0) { ans.add(extractFields(oSS,fields)); - else + } else { ans.add(oSS); + } } } //TODO: apply pagination to results @@ -179,16 +180,18 @@ public class NeutronVPNIKEPoliciesNorthbound { /* * verify that the ikePolicy doesn't already exist (issue: is deeper inspection necessary?) */ - if (ikePolicyInterface.neutronVPNIKEPolicyExists(singleton.getID())) + if (ikePolicyInterface.neutronVPNIKEPolicyExists(singleton.getID())) { throw new BadRequestException("ikePolicy UUID already exists"); + } Object[] instances = NeutronUtil.getInstances(INeutronVPNIKEPolicyAware.class, this); if (instances != null) { if (instances.length > 0) { for (Object instance : instances) { INeutronVPNIKEPolicyAware service = (INeutronVPNIKEPolicyAware) instance; int status = service.canCreateNeutronVPNIKEPolicy(singleton); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); @@ -242,18 +245,21 @@ public class NeutronVPNIKEPoliciesNorthbound { /* * ikePolicy has to exist and only a single delta can be supplied */ - if (!ikePolicyInterface.neutronVPNIKEPolicyExists(policyUUID)) + if (!ikePolicyInterface.neutronVPNIKEPolicyExists(policyUUID)) { throw new ResourceNotFoundException("VPNIKEPolicy UUID not found"); - if (!input.isSingleton()) + } + if (!input.isSingleton()) { throw new BadRequestException("Only single ikePolicy deltas supported"); + } NeutronVPNIKEPolicy singleton = input.getSingleton(); NeutronVPNIKEPolicy original = ikePolicyInterface.getNeutronVPNIKEPolicy(policyUUID); /* * attribute changes blocked by Neutron */ - if (singleton.getID() != null || singleton.getTenantID() != null) + if (singleton.getID() != null || singleton.getTenantID() != null) { throw new BadRequestException("Request attribute change not allowed"); + } Object[] instances = NeutronUtil.getInstances(INeutronVPNIKEPolicyAware.class, this); if (instances != null) { @@ -261,8 +267,9 @@ public class NeutronVPNIKEPoliciesNorthbound { for (Object instance : instances) { INeutronVPNIKEPolicyAware service = (INeutronVPNIKEPolicyAware) instance; int status = service.canUpdateNeutronVPNIKEPolicy(singleton, original); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); @@ -308,8 +315,9 @@ public class NeutronVPNIKEPoliciesNorthbound { /* * verify that the policy exists and is not in use before removing it */ - if (!policyInterface.neutronVPNIKEPolicyExists(policyUUID)) + if (!policyInterface.neutronVPNIKEPolicyExists(policyUUID)) { throw new ResourceNotFoundException("VPNIKEPolicy UUID not found"); + } NeutronVPNIKEPolicy singleton = policyInterface.getNeutronVPNIKEPolicy(policyUUID); Object[] instances = NeutronUtil.getInstances(INeutronVPNIKEPolicyAware.class, this); if (instances != null) { @@ -317,8 +325,9 @@ public class NeutronVPNIKEPoliciesNorthbound { for (Object instance : instances) { INeutronVPNIKEPolicyAware service = (INeutronVPNIKEPolicyAware) instance; int status = service.canDeleteNeutronVPNIKEPolicy(singleton); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); diff --git a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNIPSECPoliciesNorthbound.java b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNIPSECPoliciesNorthbound.java index 2e35d1150..b10041572 100644 --- a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNIPSECPoliciesNorthbound.java +++ b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNIPSECPoliciesNorthbound.java @@ -108,10 +108,11 @@ public class NeutronVPNIPSECPoliciesNorthbound { (queryTransformProtocol == null || queryTransformProtocol.equals(oSS.getTransformProtocol())) && (queryEncapsulationMode == null || queryEncapsulationMode.equals(oSS.getEncapsulationMode())) && (queryTenantID == null || queryTenantID.equals(oSS.getTenantID()))) { - if (fields.size() > 0) + if (fields.size() > 0) { ans.add(extractFields(oSS,fields)); - else + } else { ans.add(oSS); + } } } //TODO: apply pagination to results @@ -179,16 +180,18 @@ public class NeutronVPNIPSECPoliciesNorthbound { /* * verify that the ipsecPolicy doesn't already exist (issue: is deeper inspection necessary?) */ - if (ipsecPolicyInterface.neutronVPNIPSECPolicyExists(singleton.getID())) + if (ipsecPolicyInterface.neutronVPNIPSECPolicyExists(singleton.getID())) { throw new BadRequestException("ipsecPolicy UUID already exists"); + } Object[] instances = NeutronUtil.getInstances(INeutronVPNIPSECPolicyAware.class, this); if (instances != null) { if (instances.length > 0) { for (Object instance : instances) { INeutronVPNIPSECPolicyAware service = (INeutronVPNIPSECPolicyAware) instance; int status = service.canCreateNeutronVPNIPSECPolicy(singleton); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); @@ -242,18 +245,21 @@ public class NeutronVPNIPSECPoliciesNorthbound { /* * ipsecPolicy has to exist and only a single delta can be supplied */ - if (!ipsecPolicyInterface.neutronVPNIPSECPolicyExists(policyUUID)) + if (!ipsecPolicyInterface.neutronVPNIPSECPolicyExists(policyUUID)) { throw new ResourceNotFoundException("VPNIPSECPolicy UUID not found"); - if (!input.isSingleton()) + } + if (!input.isSingleton()) { throw new BadRequestException("Only single ipsecPolicy deltas supported"); + } NeutronVPNIPSECPolicy singleton = input.getSingleton(); NeutronVPNIPSECPolicy original = ipsecPolicyInterface.getNeutronVPNIPSECPolicy(policyUUID); /* * attribute changes blocked by Neutron */ - if (singleton.getID() != null || singleton.getTenantID() != null) + if (singleton.getID() != null || singleton.getTenantID() != null) { throw new BadRequestException("Request attribute change not allowed"); + } Object[] instances = NeutronUtil.getInstances(INeutronVPNIPSECPolicyAware.class, this); if (instances != null) { @@ -261,8 +267,9 @@ public class NeutronVPNIPSECPoliciesNorthbound { for (Object instance : instances) { INeutronVPNIPSECPolicyAware service = (INeutronVPNIPSECPolicyAware) instance; int status = service.canUpdateNeutronVPNIPSECPolicy(singleton, original); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); @@ -308,8 +315,9 @@ public class NeutronVPNIPSECPoliciesNorthbound { /* * verify that the policy exists and is not in use before removing it */ - if (!policyInterface.neutronVPNIPSECPolicyExists(policyUUID)) + if (!policyInterface.neutronVPNIPSECPolicyExists(policyUUID)) { throw new ResourceNotFoundException("VPNIPSECPolicy UUID not found"); + } NeutronVPNIPSECPolicy singleton = policyInterface.getNeutronVPNIPSECPolicy(policyUUID); Object[] instances = NeutronUtil.getInstances(INeutronVPNIPSECPolicyAware.class, this); if (instances != null) { @@ -317,8 +325,9 @@ public class NeutronVPNIPSECPoliciesNorthbound { for (Object instance : instances) { INeutronVPNIPSECPolicyAware service = (INeutronVPNIPSECPolicyAware) instance; int status = service.canDeleteNeutronVPNIPSECPolicy(singleton); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); diff --git a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNIPSECSiteConnectionsNorthbound.java b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNIPSECSiteConnectionsNorthbound.java index ead037078..205d01b0a 100644 --- a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNIPSECSiteConnectionsNorthbound.java +++ b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNIPSECSiteConnectionsNorthbound.java @@ -117,11 +117,13 @@ public class NeutronVPNIPSECSiteConnectionsNorthbound { && (queryStatus == null || queryStatus.equals(oSS.getStatus())) && (queryIkePolicyID == null || queryIkePolicyID.equals(oSS.getIkePolicyID())) && (queryIpSecPolicyID == null || queryIpSecPolicyID.equals(oSS.getIpsecPolicyID())) - && (queryVpnServiceID == null || queryVpnServiceID.equals(oSS.getVpnServiceID()))) - if (fields.size() > 0) + && (queryVpnServiceID == null || queryVpnServiceID.equals(oSS.getVpnServiceID()))) { + if (fields.size() > 0) { ans.add(extractFields(oSS, fields)); - else + } else { ans.add(oSS); + } + } } // TODO: apply pagination to results @@ -190,16 +192,18 @@ public class NeutronVPNIPSECSiteConnectionsNorthbound { * verify that the ipsec site connection doesn't already exist (issue: is deeper * inspection necessary?) */ - if (ipsecSiteConnectionsInterface.neutronVPNIPSECSiteConnectionsExists(singleton.getID())) + if (ipsecSiteConnectionsInterface.neutronVPNIPSECSiteConnectionsExists(singleton.getID())) { throw new BadRequestException("VPNIPSECSiteConnections ID already exists"); + } Object[] instances = NeutronUtil.getInstances(INeutronVPNIPSECSiteConnectionAware.class, this); if (instances != null) { if (instances.length > 0) { for (Object instance : instances) { INeutronVPNIPSECSiteConnectionAware service = (INeutronVPNIPSECSiteConnectionAware) instance; int status = service.canCreateNeutronVPNIPSECSiteConnection(singleton); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); @@ -253,10 +257,12 @@ public class NeutronVPNIPSECSiteConnectionsNorthbound { * ipsecSiteConnection has to exist and only a single delta can be * supplied */ - if (!ipsecSiteConnectionsInterface.neutronVPNIPSECSiteConnectionsExists(policyID)) + if (!ipsecSiteConnectionsInterface.neutronVPNIPSECSiteConnectionsExists(policyID)) { throw new ResourceNotFoundException("VPNIPSECSiteConnections ID not found"); - if (!input.isSingleton()) + } + if (!input.isSingleton()) { throw new BadRequestException("Only singleton deltas supported"); + } NeutronVPNIPSECSiteConnection singleton = input.getSingleton(); NeutronVPNIPSECSiteConnection original = ipsecSiteConnectionsInterface .getNeutronVPNIPSECSiteConnections(policyID); @@ -264,8 +270,9 @@ public class NeutronVPNIPSECSiteConnectionsNorthbound { /* * attribute changes blocked by Neutron */ - if (singleton.getID() != null || singleton.getTenantID() != null) + if (singleton.getID() != null || singleton.getTenantID() != null) { throw new BadRequestException("Request attribute change not allowed"); + } Object[] instances = NeutronUtil.getInstances(INeutronVPNIKEPolicyAware.class, this); if (instances != null) { @@ -273,8 +280,9 @@ public class NeutronVPNIPSECSiteConnectionsNorthbound { for (Object instance : instances) { INeutronVPNIPSECSiteConnectionAware service = (INeutronVPNIPSECSiteConnectionAware) instance; int status = service.canUpdateNeutronVPNIPSECSiteConnection(singleton, original); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); @@ -323,8 +331,9 @@ public class NeutronVPNIPSECSiteConnectionsNorthbound { * verify that the iSiteConnections exists and is not in use before * removing it */ - if (!ipsecSiteConnectionsInterface.neutronVPNIPSECSiteConnectionsExists(policyID)) + if (!ipsecSiteConnectionsInterface.neutronVPNIPSECSiteConnectionsExists(policyID)) { throw new ResourceNotFoundException("VPNIPSECSiteConnections ID not found"); + } NeutronVPNIPSECSiteConnection singleton = ipsecSiteConnectionsInterface .getNeutronVPNIPSECSiteConnections(policyID); Object[] instances = NeutronUtil.getInstances(INeutronVPNIPSECSiteConnectionAware.class, this); @@ -333,8 +342,9 @@ public class NeutronVPNIPSECSiteConnectionsNorthbound { for (Object instance : instances) { INeutronVPNIPSECSiteConnectionAware service = (INeutronVPNIPSECSiteConnectionAware) instance; int status = service.canDeleteNeutronVPNIPSECSiteConnection(singleton); - if (status < 200 || status > 299) + if (status < 200 || status > 299) { return Response.status(status).build(); + } } } else { throw new ServiceUnavailableException("No providers registered. Please try again later"); diff --git a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNServicesNorthbound.java b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNServicesNorthbound.java index 611db03f2..ca6b9a8da 100644 --- a/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNServicesNorthbound.java +++ b/northbound-api/src/main/java/org/opendaylight/neutron/northbound/api/NeutronVPNServicesNorthbound.java @@ -104,10 +104,11 @@ public class NeutronVPNServicesNorthbound { && (querySubnetID == null || querySubnetID.equals(oSS.getSubnetUUID())) && (queryRouterID == null || queryRouterID.equals(oSS.getRouterUUID())) && (queryTenantID == null || queryTenantID.equals(oSS.getTenantID()))) { - if (fields.size() > 0) + if (fields.size() > 0) { ans.add(extractFields(oSS, fields)); - else + } else { ans.add(oSS); + } } } -- 2.36.6