Merge "Sonar clean-ups"
authorSam Hague <shague@redhat.com>
Thu, 10 Sep 2015 16:04:04 +0000 (16:04 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 10 Sep 2015 16:04:04 +0000 (16:04 +0000)
1  2 
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SecurityServicesImpl.java

index 4a56401d44542c9f7dc1e39c872a06c7017225e6,efad7fca4db2eb449d2b1b27e050dbef2ba69ebe..a2087e14e5157f94de4aa176cd5e8618add8987b
@@@ -109,10 -109,6 +109,10 @@@ public class SecurityServicesImpl imple
                  LOG.error("getDHCPServerPort: neutron port of {} is not found", neutronPortId);
                  return null;
              }
 +            /* if the current port is a DHCP port, return the same*/
 +            if (neutronPort.getDeviceOwner().contains("dhcp")) {
 +                return neutronPort;
 +            }
              /*Since all the fixed ip assigned to a port should be
               *from the same network, first port is sufficient.*/
              List<Neutron_IPs> fixedIps = neutronPort.getFixedIPs();
                                                                                  Constants.EXTERNAL_ID_INTERFACE_ID);
                          if (null != portId) {
                              NeutronPort port = neutronPortCache.getPort(portId);
-                             if (null != port) {
-                                 if (!(port.getID().equals(neutronPort.getID()))
-                                         && port.getDeviceOwner().contains("compute")) {
-                                     List<Neutron_IPs> portFixedIp = port.getFixedIPs();
-                                     if (null == portFixedIp || portFixedIp.isEmpty()) {
-                                         return false;
-                                     }
-                                     if (portFixedIp.iterator().next().getSubnetUUID()
-                                             .equals(neutronPort.getFixedIPs().iterator().next().getSubnetUUID())) {
-                                         LOG.trace("isLastPortinSubnet: Port is not the only port.");
-                                         return false;
-                                     }
+                             if (null != port && !(port.getID().equals(neutronPort.getID()))
+                                     && port.getDeviceOwner().contains("compute")) {
+                                 List<Neutron_IPs> portFixedIp = port.getFixedIPs();
+                                 if (null == portFixedIp || portFixedIp.isEmpty()) {
+                                     return false;
+                                 }
+                                 if (portFixedIp.iterator().next().getSubnetUUID()
+                                         .equals(neutronPort.getFixedIPs().iterator().next().getSubnetUUID())) {
+                                     LOG.trace("isLastPortinSubnet: Port is not the only port.");
+                                     return false;
                                  }
                              }
                          }
              for (TerminationPoint tp : terminationPoints) {
                  OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation =
                          tp.getAugmentation(OvsdbTerminationPointAugmentation.class);
-                 if (null != ovsdbTerminationPointAugmentation) {
-                     if (!(ovsdbTerminationPointAugmentation.getName().equals(Constants.INTEGRATION_BRIDGE))
-                             && !(terminationPointAugmentation.getInterfaceUuid()
-                                     .equals(ovsdbTerminationPointAugmentation.getInterfaceUuid()))) {
-                         LOG.debug("isLastPortinBridge: it the last port in bridge {}",
-                                   terminationPointAugmentation.getName());
-                         return false;
-                     }
+                 if (null != ovsdbTerminationPointAugmentation
+                         && !(ovsdbTerminationPointAugmentation.getName().equals(Constants.INTEGRATION_BRIDGE))
+                         && !(terminationPointAugmentation.getInterfaceUuid()
+                         .equals(ovsdbTerminationPointAugmentation.getInterfaceUuid()))) {
+                     LOG.debug("isLastPortinBridge: it the last port in bridge {}",
+                             terminationPointAugmentation.getName());
+                     return false;
                  }
              }
          }