Merge Sonar fixes from stable/lithium..
authorAndre Fredette <afredette@redhat.com>
Mon, 6 Jul 2015 13:54:57 +0000 (09:54 -0400)
committerAndre Fredette <afredette@redhat.com>
Wed, 8 Jul 2015 17:44:11 +0000 (13:44 -0400)
Change-Id: I03d18ba2dcaa76de565d53bc9dd68f9b28c2b240
Signed-off-by: Andre Fredette <afredette@redhat.com>
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/ConfigActivator.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/SouthboundHandler.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/BridgeConfigurationManagerImpl.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/NeutronL3Adapter.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SouthboundImpl.java

index b29c53346e543cd7acc54e7901e28aa80b1526a5..552a352b11aad4ef18ccaa8ff0f2f9ffe545e46e 100644 (file)
@@ -21,17 +21,17 @@ public class ConfigActivator implements BundleActivator {
     private static final Logger LOG = LoggerFactory.getLogger(ConfigActivator.class);
     private List<ServiceRegistration<?>> registrations = new ArrayList<ServiceRegistration<?>>();
     private ProviderContext providerContext;
-    private ServiceTracker INeutronNetworkCRUDTracker;
-    private ServiceTracker INeutronPortCRUDTracker;
-    private ServiceTracker INeutronLoadBalancerCRUDTracker;
-    private ServiceTracker INeutronLoadBalancerPoolCRUDTracker;
-    private ServiceTracker INeutronSubnetCRUDTracker;
-    private ServiceTracker LoadBalancerProviderTracker;
-    private ServiceTracker ArpProviderTracker;
-    private ServiceTracker InboundNatProviderTracker;
-    private ServiceTracker OutboundNatProviderTracker;
-    private ServiceTracker RoutingProviderTracker;
-    private ServiceTracker L3ForwardingProviderTracker;
+    private ServiceTracker iNeutronNetworkCRUDTracker;
+    private ServiceTracker iNeutronPortCRUDTracker;
+    private ServiceTracker iNeutronLoadBalancerCRUDTracker;
+    private ServiceTracker iNeutronLoadBalancerPoolCRUDTracker;
+    private ServiceTracker iNeutronSubnetCRUDTracker;
+    private ServiceTracker loadBalancerProviderTracker;
+    private ServiceTracker arpProviderTracker;
+    private ServiceTracker inboundNatProviderTracker;
+    private ServiceTracker outboundNatProviderTracker;
+    private ServiceTracker routingProviderTracker;
+    private ServiceTracker l3ForwardingProviderTracker;
 
     public ConfigActivator(ProviderContext providerContext) {
         this.providerContext = providerContext;
@@ -206,7 +206,7 @@ public class ConfigActivator implements BundleActivator {
         // addingService may not be called if the service is already available when the ServiceTracker
         // is started
         @SuppressWarnings("unchecked")
-        ServiceTracker INeutronNetworkCRUDTracker = new ServiceTracker(context, INeutronNetworkCRUD.class, null) {
+        ServiceTracker iNeutronNetworkCRUDTracker = new ServiceTracker(context, INeutronNetworkCRUD.class, null) {
             @Override
             public Object addingService(ServiceReference reference) {
                 LOG.info("addingService INeutronNetworkCRUD");
@@ -221,26 +221,12 @@ public class ConfigActivator implements BundleActivator {
                 }
                 return service;
             }
-
-            /*@Override
-            public void modifiedService(ServiceReference reference, Object service) {
-                LOG.info("modifiedService INeutronNetworkCRUD");
-                if (service != null) {
-                    tenantNetworkManager.setDependencies(service);
-                    networkHandler.setDependencies(service);
-                    lBaaSHandler.setDependencies(service);
-                    lBaaSPoolHandler.setDependencies(service);
-                    lBaaSPoolMemberHandler.setDependencies(service);
-                    neutronL3Adapter.setDependencies(service);
-                }
-            }*/
-
         };
-        INeutronNetworkCRUDTracker.open();
-        this.INeutronNetworkCRUDTracker = INeutronNetworkCRUDTracker;
+        iNeutronNetworkCRUDTracker.open();
+        this.iNeutronNetworkCRUDTracker = iNeutronNetworkCRUDTracker;
 
         @SuppressWarnings("unchecked")
-        ServiceTracker INeutronSubnetCRUDTracker = new ServiceTracker(context, INeutronSubnetCRUD.class, null) {
+        ServiceTracker iNeutronSubnetCRUDTracker = new ServiceTracker(context, INeutronSubnetCRUD.class, null) {
             @Override
             public Object addingService(ServiceReference reference) {
                 LOG.info("addingService INeutronSubnetCRUD");
@@ -254,11 +240,11 @@ public class ConfigActivator implements BundleActivator {
                 return service;
             }
         };
-        INeutronSubnetCRUDTracker.open();
-        this.INeutronSubnetCRUDTracker = INeutronSubnetCRUDTracker;
+        iNeutronSubnetCRUDTracker.open();
+        this.iNeutronSubnetCRUDTracker = iNeutronSubnetCRUDTracker;
 
         @SuppressWarnings("unchecked")
-        ServiceTracker INeutronPortCRUDTracker = new ServiceTracker(context, INeutronPortCRUD.class, null) {
+        ServiceTracker iNeutronPortCRUDTracker = new ServiceTracker(context, INeutronPortCRUD.class, null) {
             @Override
             public Object addingService(ServiceReference reference) {
                 LOG.info("addingService INeutronPortCRUD");
@@ -274,11 +260,11 @@ public class ConfigActivator implements BundleActivator {
                 return service;
             }
         };
-        INeutronPortCRUDTracker.open();
-        this.INeutronPortCRUDTracker = INeutronPortCRUDTracker;
+        iNeutronPortCRUDTracker.open();
+        this.iNeutronPortCRUDTracker = iNeutronPortCRUDTracker;
 
         @SuppressWarnings("unchecked")
-        ServiceTracker INeutronLoadBalancerCRUDTracker = new ServiceTracker(context,
+        ServiceTracker iNeutronLoadBalancerCRUDTracker = new ServiceTracker(context,
                 INeutronLoadBalancerCRUD.class, null) {
             @Override
             public Object addingService(ServiceReference reference) {
@@ -292,11 +278,11 @@ public class ConfigActivator implements BundleActivator {
                 return service;
             }
         };
-        INeutronLoadBalancerCRUDTracker.open();
-        this.INeutronLoadBalancerCRUDTracker = INeutronLoadBalancerCRUDTracker;
+        iNeutronLoadBalancerCRUDTracker.open();
+        this.iNeutronLoadBalancerCRUDTracker = iNeutronLoadBalancerCRUDTracker;
 
         @SuppressWarnings("unchecked")
-        ServiceTracker INeutronLoadBalancerPoolCRUDTracker = new ServiceTracker(context,
+        ServiceTracker iNeutronLoadBalancerPoolCRUDTracker = new ServiceTracker(context,
                 INeutronLoadBalancerPoolCRUD.class, null) {
             @Override
             public Object addingService(ServiceReference reference) {
@@ -310,11 +296,11 @@ public class ConfigActivator implements BundleActivator {
                 return service;
             }
         };
-        INeutronLoadBalancerPoolCRUDTracker.open();
-        this.INeutronLoadBalancerPoolCRUDTracker = INeutronLoadBalancerPoolCRUDTracker;
+        iNeutronLoadBalancerPoolCRUDTracker.open();
+        this.iNeutronLoadBalancerPoolCRUDTracker = iNeutronLoadBalancerPoolCRUDTracker;
 
         @SuppressWarnings("unchecked")
-        ServiceTracker LoadBalancerProviderTracker = new ServiceTracker(context,
+        ServiceTracker ioadBalancerProviderTracker = new ServiceTracker(context,
                 LoadBalancerProvider.class, null) {
             @Override
             public Object addingService(ServiceReference reference) {
@@ -329,11 +315,11 @@ public class ConfigActivator implements BundleActivator {
                 return service;
             }
         };
-        LoadBalancerProviderTracker.open();
-        this.LoadBalancerProviderTracker = LoadBalancerProviderTracker;
+        ioadBalancerProviderTracker.open();
+        this.loadBalancerProviderTracker = ioadBalancerProviderTracker;
 
         @SuppressWarnings("unchecked")
-        ServiceTracker ArpProviderTracker = new ServiceTracker(context,
+        ServiceTracker arpProviderTracker = new ServiceTracker(context,
                 ArpProvider.class, null) {
             @Override
             public Object addingService(ServiceReference reference) {
@@ -346,11 +332,11 @@ public class ConfigActivator implements BundleActivator {
                 return service;
             }
         };
-        ArpProviderTracker.open();
-        this.ArpProviderTracker = ArpProviderTracker;
+        arpProviderTracker.open();
+        this.arpProviderTracker = arpProviderTracker;
 
         @SuppressWarnings("unchecked")
-        ServiceTracker InboundNatProviderTracker = new ServiceTracker(context,
+        ServiceTracker inboundNatProviderTracker = new ServiceTracker(context,
                 InboundNatProvider.class, null) {
             @Override
             public Object addingService(ServiceReference reference) {
@@ -363,11 +349,11 @@ public class ConfigActivator implements BundleActivator {
                 return service;
             }
         };
-        InboundNatProviderTracker.open();
-        this.InboundNatProviderTracker = InboundNatProviderTracker;
+        inboundNatProviderTracker.open();
+        this.inboundNatProviderTracker = inboundNatProviderTracker;
 
         @SuppressWarnings("unchecked")
-        ServiceTracker OutboundNatProviderTracker = new ServiceTracker(context,
+        ServiceTracker outboundNatProviderTracker = new ServiceTracker(context,
                 OutboundNatProvider.class, null) {
             @Override
             public Object addingService(ServiceReference reference) {
@@ -380,11 +366,11 @@ public class ConfigActivator implements BundleActivator {
                 return service;
             }
         };
-        OutboundNatProviderTracker.open();
-        this.OutboundNatProviderTracker = OutboundNatProviderTracker;
+        outboundNatProviderTracker.open();
+        this.outboundNatProviderTracker = outboundNatProviderTracker;
 
         @SuppressWarnings("unchecked")
-        ServiceTracker RoutingProviderTracker = new ServiceTracker(context,
+        ServiceTracker routingProviderTracker = new ServiceTracker(context,
                 RoutingProvider.class, null) {
             @Override
             public Object addingService(ServiceReference reference) {
@@ -397,11 +383,11 @@ public class ConfigActivator implements BundleActivator {
                 return service;
             }
         };
-        RoutingProviderTracker.open();
-        this.RoutingProviderTracker = RoutingProviderTracker;
+        routingProviderTracker.open();
+        this.routingProviderTracker = routingProviderTracker;
 
         @SuppressWarnings("unchecked")
-        ServiceTracker L3ForwardingProviderTracker = new ServiceTracker(context,
+        ServiceTracker l3ForwardingProviderTracker = new ServiceTracker(context,
                 L3ForwardingProvider.class, null) {
             @Override
             public Object addingService(ServiceReference reference) {
@@ -414,20 +400,20 @@ public class ConfigActivator implements BundleActivator {
                 return service;
             }
         };
-        L3ForwardingProviderTracker.open();
-        this.L3ForwardingProviderTracker = L3ForwardingProviderTracker;
+        l3ForwardingProviderTracker.open();
+        this.l3ForwardingProviderTracker = l3ForwardingProviderTracker;
     }
 
     @Override
     public void stop(BundleContext context) throws Exception {
         LOG.info("ConfigActivator stop");
         /* ServiceTrackers and services are already released when bundle stops
-        INeutronNetworkCRUDTracker.close();
-        INeutronPortCRUDTracker.close();
-        INeutronSubnetCRUDTracker.close();
-        INeutronLoadBalancerCRUDTracker.close();
-        INeutronLoadBalancerPoolCRUDTracker.close();
-        LoadBalancerProviderTracker.close();
+        iNeutronNetworkCRUDTracker.close();
+        iNeutronPortCRUDTracker.close();
+        iNeutronSubnetCRUDTracker.close();
+        iNeutronLoadBalancerCRUDTracker.close();
+        iNeutronLoadBalancerPoolCRUDTracker.close();
+        loadBalancerProviderTracker.close();
 
         for (ServiceRegistration registration : registrations) {
             if (registration != null) {
index 739dbe22c9ea07f7bca86fdb4e58c5c1e1739fb1..3d89b43dc468720399509f45103ee61d56e4181c 100644 (file)
@@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory;
  */
 public class SouthboundHandler extends AbstractHandler
         implements ConfigInterface, NodeCacheListener, OvsdbInventoryListener {
-    static final Logger logger = LoggerFactory.getLogger(SouthboundHandler.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(SouthboundHandler.class);
 
     // The implementation for each of these services is resolved by the OSGi Service Manager
     private volatile ConfigurationService configurationService;
@@ -64,7 +64,7 @@ public class SouthboundHandler extends AbstractHandler
                 type = SouthboundEvent.Type.OPENVSWITCH;
                 break;
             default:
-                logger.warn("Invalid OvsdbType: {}", ovsdbType);
+                LOGGER.warn("Invalid OvsdbType: {}", ovsdbType);
                 break;
         }
         return type;
@@ -72,28 +72,28 @@ public class SouthboundHandler extends AbstractHandler
 
     @Override
     public void ovsdbUpdate(Node node, DataObject resourceAugmentationData, OvsdbType ovsdbType, Action action) {
-        logger.info("ovsdbUpdate: {} - {} - <<{}>> <<{}>>", ovsdbType, action, node, resourceAugmentationData);
+        LOGGER.info("ovsdbUpdate: {} - {} - <<{}>> <<{}>>", ovsdbType, action, node, resourceAugmentationData);
         enqueueEvent(new SouthboundEvent(node, resourceAugmentationData,
                 ovsdbTypeToSouthboundEventType(ovsdbType), action));
     }
 
     private void handleInterfaceUpdate (Node node, OvsdbTerminationPointAugmentation tp) {
-        logger.debug("handleInterfaceUpdate <{}> <{}>", node, tp);
+        LOGGER.debug("handleInterfaceUpdate <{}> <{}>", node, tp);
         NeutronNetwork network = tenantNetworkManager.getTenantNetwork(tp);
         if (network != null && !network.getRouterExternal()) {
-            logger.trace("handleInterfaceUpdate <{}> <{}> network: {}", node, tp, network.getNetworkUUID());
+            LOGGER.trace("handleInterfaceUpdate <{}> <{}> network: {}", node, tp, network.getNetworkUUID());
             if (bridgeConfigurationManager.createLocalNetwork(node, network)) {
                 networkingProviderManager.getProvider(node).handleInterfaceUpdate(network, node, tp);
             }
         } else {
-            logger.debug("No tenant network found on node: <{}> for interface: <{}>", node, tp);
+            LOGGER.debug("No tenant network found on node: <{}> for interface: <{}>", node, tp);
         }
         neutronL3Adapter.handleInterfaceEvent(node, tp, network, Action.UPDATE);
     }
 
     private void handleInterfaceDelete (Node node, OvsdbTerminationPointAugmentation intf,
                                         boolean isLastInstanceOnNode, NeutronNetwork network) {
-        logger.debug("handleInterfaceDelete: node: <{}>, isLastInstanceOnNode: {}, interface: <{}>",
+        LOGGER.debug("handleInterfaceDelete: node: <{}>, isLastInstanceOnNode: {}, interface: <{}>",
                 node, isLastInstanceOnNode, intf);
 
         neutronL3Adapter.handleInterfaceEvent(node, intf, network, Action.DELETE);
@@ -104,11 +104,10 @@ public class SouthboundHandler extends AbstractHandler
                     network, node, intf, isLastInstanceOnNode);
         } else if (network != null) {
             // vlan doesn't need a tunnel endpoint
-            if (!network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VLAN)) {
-                if (configurationService.getTunnelEndPoint(node) == null) {
-                    logger.error("Tunnel end-point configuration missing. Please configure it in OpenVSwitch Table");
-                    return;
-                }
+            if (!network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VLAN) &&
+                    configurationService.getTunnelEndPoint(node) == null) {
+                LOGGER.error("Tunnel end-point configuration missing. Please configure it in OpenVSwitch Table");
+                return;
             }
             networkingProviderManager.getProvider(node).handleInterfaceDelete(network.getProviderNetworkType(),
                     network, node, intf, isLastInstanceOnNode);
@@ -117,7 +116,7 @@ public class SouthboundHandler extends AbstractHandler
 
     @Override
     public void triggerUpdates() {
-        logger.info("triggerUpdates");
+        LOGGER.info("triggerUpdates");
         List<Node> ovsdbNodes = southbound.readOvsdbTopologyNodes();
         for (Node node : ovsdbNodes) {
             ovsdbUpdate(node, node.getAugmentation(OvsdbNodeAugmentation.class),
@@ -127,7 +126,7 @@ public class SouthboundHandler extends AbstractHandler
 
     private void processPortDelete(Node node, OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation,
                                    Object context) {
-        logger.debug("processPortDelete <{}> <{}>", node, ovsdbTerminationPointAugmentation);
+        LOGGER.debug("processPortDelete <{}> <{}>", node, ovsdbTerminationPointAugmentation);
         NeutronNetwork network = null;
         if (context == null) {
             network = tenantNetworkManager.getTenantNetwork(ovsdbTerminationPointAugmentation);
@@ -139,10 +138,10 @@ public class SouthboundHandler extends AbstractHandler
             if (network != null) {
                 this.handleInterfaceDelete(node, ovsdbTerminationPointAugmentation, false, network);
             } else {
-                logger.warn("processPortDelete: network was null, ignoring update");
+                LOGGER.warn("processPortDelete: network was null, ignoring update");
             }
         } else if (network != null && !network.getRouterExternal()) {
-            logger.debug("Network {}: Delete interface {} attached to bridge {}", network.getNetworkUUID(),
+            LOGGER.debug("Network {}: Delete interface {} attached to bridge {}", network.getNetworkUUID(),
                     ovsdbTerminationPointAugmentation.getInterfaceUuid(), node.getNodeId());
             try {
                 OvsdbBridgeAugmentation ovsdbBridgeAugmentation = southbound.getBridge(node);
@@ -168,26 +167,26 @@ public class SouthboundHandler extends AbstractHandler
                     }
                 }
             } catch (Exception e) {
-                logger.error("Error fetching Interface Rows for node " + node, e);
+                LOGGER.error("Error fetching Interface Rows for node " + node, e);
             }
         }
     }
 
     private boolean isInterfaceOfInterest(OvsdbTerminationPointAugmentation terminationPoint, List<String> phyIfName) {
-        logger.trace("SouthboundHandler#isInterfaceOfInterest: Interface : {}", terminationPoint);
+        LOGGER.trace("SouthboundHandler#isInterfaceOfInterest: Interface : {}", terminationPoint);
 
         if(terminationPoint.getInterfaceType() == null){
             // This is OK since eth ports don't have an interface type
-            logger.info("No type found for the interface : {}", terminationPoint);
+            LOGGER.info("No type found for the interface : {}", terminationPoint);
             return false;
         }
-        return (MdsalHelper.createOvsdbInterfaceType(
+        return MdsalHelper.createOvsdbInterfaceType(
                 terminationPoint.getInterfaceType()).equals(NetworkHandler.NETWORK_TYPE_VXLAN)
-                ||
-                MdsalHelper.createOvsdbInterfaceType(
-                        terminationPoint.getInterfaceType()).equals(NetworkHandler.NETWORK_TYPE_GRE)
-                ||
-                phyIfName.contains(terminationPoint.getName()));
+               ||
+               MdsalHelper.createOvsdbInterfaceType(
+                       terminationPoint.getInterfaceType()).equals(NetworkHandler.NETWORK_TYPE_GRE)
+               ||
+               phyIfName.contains(terminationPoint.getName());
     }
 
     /**
@@ -199,12 +198,10 @@ public class SouthboundHandler extends AbstractHandler
      */
     @Override
     public void notifyNode (Node node, Action action) {
-        logger.info("notifyNode: action: {}, Node <{}>", action, node);
+        LOGGER.info("notifyNode: action: {}, Node <{}>", action, node);
 
-        if (action.equals(Action.ADD)) {
-            if (southbound.getBridge(node) != null) {
-                networkingProviderManager.getProvider(node).initializeOFFlowRules(node);
-            }
+        if ((action.equals(Action.ADD)) && (southbound.getBridge(node) != null)) {
+            networkingProviderManager.getProvider(node).initializeOFFlowRules(node);
         }
     }
 
@@ -217,11 +214,11 @@ public class SouthboundHandler extends AbstractHandler
     @Override
     public void processEvent(AbstractEvent abstractEvent) {
         if (!(abstractEvent instanceof SouthboundEvent)) {
-            logger.error("processEvent: Unable to process abstract event {}", abstractEvent);
+            LOGGER.error("processEvent: Unable to process abstract event {}", abstractEvent);
             return;
         }
         SouthboundEvent ev = (SouthboundEvent) abstractEvent;
-        logger.trace("processEvent: {}", ev);
+        LOGGER.trace("processEvent: {}", ev);
         switch (ev.getType()) {
             case NODE:
                 processOvsdbNodeEvent(ev);
@@ -240,7 +237,7 @@ public class SouthboundHandler extends AbstractHandler
                 break;
 
             default:
-                logger.warn("Unable to process type " + ev.getType() +
+                LOGGER.warn("Unable to process type " + ev.getType() +
                         " action " + ev.getAction() + " for node " + ev.getNode());
                 break;
         }
@@ -261,18 +258,18 @@ public class SouthboundHandler extends AbstractHandler
     }
 
     private void processOvsdbNodeCreate(Node node, OvsdbNodeAugmentation ovsdbNode) {
-        logger.info("processOvsdbNodeCreate <{}> <{}>", node, ovsdbNode);
+        LOGGER.info("processOvsdbNodeCreate <{}> <{}>", node, ovsdbNode);
         nodeCacheManager.nodeAdded(node);
         bridgeConfigurationManager.prepareNode(node);
     }
 
     private void processOvsdbNodeUpdate(Node node, OvsdbNodeAugmentation ovsdbNode) {
-        logger.info("processOvsdbNodeUpdate <{}> <{}>", node, ovsdbNode);
+        LOGGER.info("processOvsdbNodeUpdate <{}> <{}>", node, ovsdbNode);
         nodeCacheManager.nodeAdded(node);
     }
 
     private void processOvsdbNodeDelete(Node node, OvsdbNodeAugmentation ovsdbNode) {
-        logger.info("processOvsdbNodeDelete <{}> <{}>", node, ovsdbNode);
+        LOGGER.info("processOvsdbNodeDelete <{}> <{}>", node, ovsdbNode);
         nodeCacheManager.nodeRemoved(node);
         /* TODO SB_MIGRATION
         * I don't think we want to do this yet
@@ -296,7 +293,7 @@ public class SouthboundHandler extends AbstractHandler
     }
 
     private void processPortUpdate(Node node, OvsdbTerminationPointAugmentation port) {
-        logger.debug("processPortUpdate <{}> <{}>", node, port);
+        LOGGER.debug("processPortUpdate <{}> <{}>", node, port);
         NeutronNetwork network = tenantNetworkManager.getTenantNetwork(port);
         if (network != null && !network.getRouterExternal()) {
             this.handleInterfaceUpdate(node, port);
@@ -315,7 +312,7 @@ public class SouthboundHandler extends AbstractHandler
     }
 
     private void processOpenVSwitchUpdate(Node node) {
-        logger.debug("processOpenVSwitchUpdate {}", node);
+        LOGGER.debug("processOpenVSwitchUpdate {}", node);
         // TODO this node might be the OvsdbNode and not have termination points
         // Would need to change listener or grab tp nodes in here.
         List<TerminationPoint> terminationPoints = southbound.extractTerminationPoints(node);
@@ -344,6 +341,8 @@ public class SouthboundHandler extends AbstractHandler
         String bridgeName = nodeIdStr.substring(nodeIdStr.lastIndexOf('/') + 1);
         List<TerminationPoint> terminationPoints = southbound.extractTerminationPoints(node);
         if (terminationPoints != null && terminationPoints.size() == 1) {
+            // TODO: Either do something or remove this if statement.
+            // If there's only one termination point, is it a 1-port bridge?
         }
         OvsdbTerminationPointAugmentation port = southbound.extractTerminationPointAugmentation(node, bridgeName);
         if (port != null) {
@@ -352,36 +351,36 @@ public class SouthboundHandler extends AbstractHandler
             if (datapathId != null) {
                 rv = true;
             } else {
-                logger.info("datapathId not found");
+                LOGGER.info("datapathId not found");
             }
         }
         return rv;
     }
 
     private void processBridgeCreate(Node node, OvsdbBridgeAugmentation bridge) {
-        logger.debug("processBridgeCreate <{}> <{}>", node, bridge);
+        LOGGER.debug("processBridgeCreate <{}> <{}>", node, bridge);
         String datapathId = southbound.getDatapathId(bridge);
         // Having a datapathId means the ovsdb node has connected to ODL
         if (datapathId != null) {
             nodeCacheManager.nodeAdded(node);
         } else {
-            logger.info("processBridgeCreate datapathId not found");
+            LOGGER.info("processBridgeCreate datapathId not found");
         }
     }
 
     private void processBridgeUpdate(Node node, OvsdbBridgeAugmentation bridge) {
-        logger.debug("processBridgeUpdate <{}> <{}>", node, bridge);
+        LOGGER.debug("processBridgeUpdate <{}> <{}>", node, bridge);
         String datapathId = southbound.getDatapathId(bridge);
         // Having a datapathId means the ovsdb node has connected to ODL
         if (datapathId != null) {
             nodeCacheManager.nodeAdded(node);
         } else {
-            logger.info("processBridgeUpdate datapathId not found");
+            LOGGER.info("processBridgeUpdate datapathId not found");
         }
     }
 
     private void processBridgeDelete(Node node, OvsdbBridgeAugmentation bridge) {
-        logger.debug("processBridgeDelete: Delete bridge from config data store: <{}> <{}>",
+        LOGGER.debug("processBridgeDelete: Delete bridge from config data store: <{}> <{}>",
                 node, bridge);
         nodeCacheManager.nodeRemoved(node);
         // TODO SB_MIGRATION
@@ -417,5 +416,6 @@ public class SouthboundHandler extends AbstractHandler
     }
 
     @Override
-    public void setDependencies(Object impl) {}
+    public void setDependencies(Object impl) {
+    }
 }
index 69ed6c95d00594364a72c51cc572d1d93f95e57a..08fd8d5c8303bde3850aca5278aee655c735c1a1 100644 (file)
@@ -43,7 +43,7 @@ import org.slf4j.LoggerFactory;
  * @author Sam Hague (shague@redhat.com)
  */
 public class BridgeConfigurationManagerImpl implements BridgeConfigurationManager, ConfigInterface {
-    static final Logger LOGGER = LoggerFactory.getLogger(BridgeConfigurationManagerImpl.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(BridgeConfigurationManagerImpl.class);
 
     // The implementation for each of these services is resolved by the OSGi Service Manager
     private volatile ConfigurationService configurationService;
@@ -180,7 +180,8 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
     public boolean createLocalNetwork (Node bridgeNode, NeutronNetwork network) {
         boolean isCreated = false;
         Node ovsdbNode = southbound.readOvsdbNode(bridgeNode);
-        if (ovsdbNode == null) { //this should never happen
+        if (ovsdbNode == null) {
+            //this should never happen
             LOGGER.error("createLocalNetwork could not find ovsdbNode from bridge node " + bridgeNode);
             return false;
         }
@@ -554,11 +555,9 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
 
                 for (Enumeration<InetAddress> inetAddrs = iface.getInetAddresses(); inetAddrs.hasMoreElements();) {
                     InetAddress inetAddr = (InetAddress) inetAddrs.nextElement();
-                    if (!inetAddr.isLoopbackAddress()) {
-                        if (inetAddr.isSiteLocalAddress()) {
-                            ipaddress = inetAddr.getHostAddress();
-                            break;
-                        }
+                    if (!inetAddr.isLoopbackAddress() && inetAddr.isSiteLocalAddress()) {
+                        ipaddress = inetAddr.getHostAddress();
+                        break;
                     }
                 }
             }
@@ -579,5 +578,6 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
     }
 
     @Override
-    public void setDependencies(Object impl) {}
+    public void setDependencies(Object impl) {
+    }
 }
index 061c527c025069096c92f2ee70e878cc0c7bbf99..5fc8e9683d18505781a91f58afa7bf38ac8f9b96 100644 (file)
@@ -49,7 +49,7 @@ import java.util.Set;
  * as well as the multi-tenant router forwarding provider.
  */
 public class NeutronL3Adapter implements ConfigInterface {
-    static final Logger logger = LoggerFactory.getLogger(NeutronL3Adapter.class);
+    private static final Logger LOGGER = LoggerFactory.getLogger(NeutronL3Adapter.class);
 
     // The implementation for each of these services is resolved by the OSGi Service Manager
     private volatile ConfigurationService configurationService;
@@ -65,6 +65,14 @@ public class NeutronL3Adapter implements ConfigInterface {
     private volatile RoutingProvider routingProvider;
 
     private class FloatIpData {
+        private final Long dpid;          // br-int of node where floating ip is associated with tenant port
+        private final Long ofPort;        // patch port in br-int used to reach br-ex
+        private final String segId;       // segmentation id of the net where fixed ip is instantiated
+        private final String macAddress;  // mac address assigned to neutron port of floating ip
+        private final String floatingIpAddress;
+        private final String fixedIpAddress;  // ip address given to tenant vm
+        private final String neutronRouterMac;
+
         FloatIpData(final Long dpid, final Long ofPort, final String segId, final String macAddress,
                     final String floatingIpAddress, final String fixedIpAddress, final String neutronRouterMac) {
             this.dpid = dpid;
@@ -75,14 +83,6 @@ public class NeutronL3Adapter implements ConfigInterface {
             this.fixedIpAddress = fixedIpAddress;
             this.neutronRouterMac = neutronRouterMac;
         }
-
-        public final Long dpid;          // br-int of node where floating ip is associated with tenant port
-        public final Long ofPort;        // patch port in br-int used to reach br-ex
-        public final String segId;       // segmentation id of the net where fixed ip is instantiated
-        public final String macAddress;  // mac address assigned to neutron port of floating ip
-        public final String floatingIpAddress;
-        public final String fixedIpAddress;  // ip address given to tenant vm
-        public final String neutronRouterMac;
     }
 
     private Set<String> inboundIpRewriteCache;
@@ -101,14 +101,14 @@ public class NeutronL3Adapter implements ConfigInterface {
     private Boolean flgDistributedARPEnabled = true;
     private Southbound southbound;
 
-    final static String OWNER_ROUTER_INTERFACE = "network:router_interface";
-    final static String OWNER_ROUTER_INTERFACE_DISTRIBUTED = "network:router_interface_distributed";
-    final static String OWNER_ROUTER_GATEWAY = "network:router_gateway";
-    final static String OWNER_FLOATING_IP = "network:floatingip";
-    final static String DEFAULT_EXT_RTR_MAC = "00:00:5E:00:01:01";
+    private static final String OWNER_ROUTER_INTERFACE = "network:router_interface";
+    private static final String OWNER_ROUTER_INTERFACE_DISTRIBUTED = "network:router_interface_distributed";
+    private static final String OWNER_ROUTER_GATEWAY = "network:router_gateway";
+    private static final String OWNER_FLOATING_IP = "network:floatingip";
+    private static final String DEFAULT_EXT_RTR_MAC = "00:00:5E:00:01:01";
 
     public NeutronL3Adapter() {
-        logger.info(">>>>>> NeutronL3Adapter constructor {}", this.getClass());
+        LOGGER.info(">>>>>> NeutronL3Adapter constructor {}", this.getClass());
     }
 
     private void initL3AdapterMembers() {
@@ -133,15 +133,15 @@ public class NeutronL3Adapter implements ConfigInterface {
             }
 
             this.enabled = true;
-            logger.info("OVSDB L3 forwarding is enabled");
+            LOGGER.info("OVSDB L3 forwarding is enabled");
             if (configurationService.isDistributedArpDisabled()) {
                 this.flgDistributedARPEnabled = false;
-                logger.info("Distributed ARP responder is disabled");
+                LOGGER.info("Distributed ARP responder is disabled");
             } else {
-                logger.debug("Distributed ARP responder is enabled");
+                LOGGER.debug("Distributed ARP responder is enabled");
             }
         } else {
-            logger.debug("OVSDB L3 forwarding is disabled");
+            LOGGER.debug("OVSDB L3 forwarding is disabled");
         }
     }
 
@@ -158,15 +158,17 @@ public class NeutronL3Adapter implements ConfigInterface {
     }
 
     public void handleNeutronSubnetEvent(final NeutronSubnet subnet, Action action) {
-        logger.debug("Neutron subnet {} event : {}", action, subnet.toString());
-        if (!this.enabled)
+        LOGGER.debug("Neutron subnet {} event : {}", action, subnet.toString());
+        if (!this.enabled) {
             return;
+        }
     }
 
     public void handleNeutronPortEvent(final NeutronPort neutronPort, Action action) {
-        logger.debug("Neutron port {} event : {}", action, neutronPort.toString());
-        if (!this.enabled)
+        LOGGER.debug("Neutron port {} event : {}", action, neutronPort.toString());
+        if (!this.enabled) {
             return;
+        }
 
         final boolean isDelete = action == Action.DELETE;
 
@@ -203,20 +205,22 @@ public class NeutronL3Adapter implements ConfigInterface {
     }
 
     public void handleNeutronRouterEvent(final NeutronRouter neutronRouter, Action action) {
-        logger.debug("Neutron router {} event : {}", action, neutronRouter.toString());
-        if (!this.enabled)
+        LOGGER.debug("Neutron router {} event : {}", action, neutronRouter.toString());
+        if (!this.enabled) {
             return;
+        }
     }
 
     public void handleNeutronRouterInterfaceEvent(final NeutronRouter neutronRouter,
                                                   final NeutronRouter_Interface neutronRouterInterface,
                                                   Action action) {
-        logger.debug("Router interface {} got event {}. Subnet {}",
+        LOGGER.debug("Router interface {} got event {}. Subnet {}",
                      neutronRouterInterface.getPortUUID(),
                      action,
                      neutronRouterInterface.getSubnetUUID());
-        if (!this.enabled)
+        if (!this.enabled) {
             return;
+        }
 
         final boolean isDelete = action == Action.DELETE;
 
@@ -241,20 +245,25 @@ public class NeutronL3Adapter implements ConfigInterface {
     }
 
     public void handleNeutronFloatingIPEvent(final NeutronFloatingIP neutronFloatingIP,
-                                             Action action) {
+                                             Action actionIn) {
         Preconditions.checkNotNull(neutronFloatingIP);
 
-        logger.debug(" Floating IP {} {}<->{}, network uuid {}", action,
+        LOGGER.debug(" Floating IP {} {}<->{}, network uuid {}", actionIn,
                 neutronFloatingIP.getFixedIPAddress(),
                 neutronFloatingIP.getFloatingIPAddress(),
                 neutronFloatingIP.getFloatingNetworkUUID());
-        if (!this.enabled)
+        if (!this.enabled) {
             return;
+        }
+
+        Action action;
 
         // Consider action to be delete if getFixedIPAddress is null
         //
         if (neutronFloatingIP.getFixedIPAddress() == null) {
             action = Action.DELETE;
+        } else {
+            action = actionIn;
         }
 
         // this.programFlowsForFloatingIP(neutronFloatingIP, action == Action.DELETE);
@@ -277,7 +286,7 @@ public class NeutronL3Adapter implements ConfigInterface {
 
         final FloatIpData fid = floatIpDataMapCache.get(neutronFloatingIP.getID());
         if (fid == null) {
-            logger.trace("programFlowsForFloatingIPInboundAdd {} for {} uuid {} not in local cache",
+            LOGGER.trace("programFlowsForFloatingIPInboundAdd {} for {} uuid {} not in local cache",
                     action, neutronFloatingIP.getFloatingIPAddress(), neutronFloatingIP.getID());
             return;
         }
@@ -290,7 +299,7 @@ public class NeutronL3Adapter implements ConfigInterface {
 
         final FloatIpData fid = floatIpDataMapCache.get(neutronFloatingIP.getID());
         if (fid == null) {
-            logger.trace("programFlowsForFloatingIPOutbound {} for {} uuid {} not in local cache",
+            LOGGER.trace("programFlowsForFloatingIPOutbound {} for {} uuid {} not in local cache",
                     action, neutronFloatingIP.getFloatingIPAddress(), neutronFloatingIP.getID());
             return;
         }
@@ -315,7 +324,7 @@ public class NeutronL3Adapter implements ConfigInterface {
         Preconditions.checkNotNull(neutronFloatingIP.getFloatingIPAddress());
 
         if (floatIpDataMapCache.get(neutronFloatingIP.getID()) != null) {
-            logger.trace("programFlowsForFloatingIPArpAdd for neutronFloatingIP {} uuid {} is already done",
+            LOGGER.trace("programFlowsForFloatingIPArpAdd for neutronFloatingIP {} uuid {} is already done",
                     neutronFloatingIP.getFloatingIPAddress(), neutronFloatingIP.getID());
             return;
         }
@@ -340,7 +349,7 @@ public class NeutronL3Adapter implements ConfigInterface {
                 providerSegmentationId == null || providerSegmentationId.isEmpty() ||
                 floatingIpMac == null || floatingIpMac.isEmpty() ||
                 neutronRouterMac == null || neutronRouterMac.isEmpty()) {
-            logger.trace("Floating IP {}<->{}, incomplete floatPort {} tenantPortUuid {} seg {} mac {} rtrMac {}",
+            LOGGER.trace("Floating IP {}<->{}, incomplete floatPort {} tenantPortUuid {} seg {} mac {} rtrMac {}",
                     fixedIpAddress,
                     floatingIpAddress,
                     neutronPortForFloatIp,
@@ -355,7 +364,7 @@ public class NeutronL3Adapter implements ConfigInterface {
         final Long dpId = nodeIfPair.getLeft();
         final Long ofPort = findOFPortForExtPatch(dpId);
         if (ofPort == null) {
-            logger.warn("Unable to locate OF port of patch port to connect floating ip to external bridge. dpid {}",
+            LOGGER.warn("Unable to locate OF port of patch port to connect floating ip to external bridge. dpid {}",
                     dpId);
             return;
         }
@@ -367,7 +376,7 @@ public class NeutronL3Adapter implements ConfigInterface {
             final FloatIpData floatIpData = new FloatIpData(dpId, ofPort, providerSegmentationId, floatingIpMac,
                     floatingIpAddress, fixedIpAddress, neutronRouterMac);
             floatIpDataMapCache.put(neutronFloatingIP.getID(), floatIpData);
-            logger.info("Floating IP {}<->{} programmed ARP mac {} on OFport {} seg {} dpid {}",
+            LOGGER.info("Floating IP {}<->{} programmed ARP mac {} on OFport {} seg {} dpid {}",
                     neutronFloatingIP.getFixedIPAddress(), neutronFloatingIP.getFloatingIPAddress(),
                     floatingIpMac, ofPort, providerSegmentationId, dpId);
         }
@@ -376,14 +385,14 @@ public class NeutronL3Adapter implements ConfigInterface {
     private void programFlowsForFloatingIPArpDelete(final String neutronFloatingIPUuid) {
         final FloatIpData floatIpData = floatIpDataMapCache.get(neutronFloatingIPUuid);
         if (floatIpData == null) {
-            logger.trace("programFlowsForFloatingIPArpDelete for uuid {} is not needed", neutronFloatingIPUuid);
+            LOGGER.trace("programFlowsForFloatingIPArpDelete for uuid {} is not needed", neutronFloatingIPUuid);
             return;
         }
 
         if (programStaticArpStage1(floatIpData.dpid, encodeExcplicitOFPort(floatIpData.ofPort), floatIpData.macAddress,
                 floatIpData.floatingIpAddress, Action.DELETE)) {
             floatIpDataMapCache.remove(neutronFloatingIPUuid);
-            logger.info("Floating IP {} un-programmed ARP mac {} on {} dpid {}",
+            LOGGER.info("Floating IP {} un-programmed ARP mac {} on {} dpid {}",
                     floatIpData.floatingIpAddress, floatIpData.macAddress, floatIpData.ofPort, floatIpData.dpid);
         }
     }
@@ -418,9 +427,10 @@ public class NeutronL3Adapter implements ConfigInterface {
     }
 
     public void handleNeutronNetworkEvent(final NeutronNetwork neutronNetwork, Action action) {
-        logger.debug("neutronNetwork {}: network: {}", action, neutronNetwork);
-        if (!this.enabled)
+        LOGGER.debug("neutronNetwork {}: network: {}", action, neutronNetwork);
+        if (!this.enabled) {
             return;
+        }
     }
 
     //
@@ -428,7 +438,7 @@ public class NeutronL3Adapter implements ConfigInterface {
     //
     public void handleInterfaceEvent(final Node bridgeNode, final OvsdbTerminationPointAugmentation intf,
                                      final NeutronNetwork neutronNetwork, Action action) {
-        logger.debug("southbound interface {} node:{} interface:{}, neutronNetwork:{}",
+        LOGGER.debug("southbound interface {} node:{} interface:{}, neutronNetwork:{}",
                      action, bridgeNode.getNodeId().getValue(), intf.getName(), neutronNetwork);
         if (!this.enabled) {
             return;
@@ -438,7 +448,7 @@ public class NeutronL3Adapter implements ConfigInterface {
         final Long dpId = getDpidForIntegrationBridge(bridgeNode);
         final Uuid interfaceUuid = intf.getInterfaceUuid();
 
-        logger.trace("southbound interface {} node:{} interface:{}, neutronNetwork:{} port:{} dpid:{} intfUuid:{}",
+        LOGGER.trace("southbound interface {} node:{} interface:{}, neutronNetwork:{} port:{} dpid:{} intfUuid:{}",
                 action, bridgeNode.getNodeId().getValue(), intf.getName(), neutronNetwork, neutronPort, dpId, interfaceUuid);
 
         if (neutronPort != null) {
@@ -459,7 +469,7 @@ public class NeutronL3Adapter implements ConfigInterface {
 
     private void handleInterfaceEventAdd(final String neutronPortUuid, Long dpId, final Uuid interfaceUuid) {
         neutronPortToDpIdCache.put(neutronPortUuid, new ImmutablePair<>(dpId, interfaceUuid));
-        logger.debug("handleInterfaceEvent add cache entry NeutronPortUuid {} : dpid {}, ifUuid {}",
+        LOGGER.debug("handleInterfaceEvent add cache entry NeutronPortUuid {} : dpid {}, ifUuid {}",
                 neutronPortUuid, dpId, interfaceUuid.getValue());
     }
 
@@ -468,7 +478,7 @@ public class NeutronL3Adapter implements ConfigInterface {
         for (Map.Entry<String, Pair<Long, Uuid>> entry : neutronPortToDpIdCache.entrySet()) {
             final String currPortUuid = entry.getKey();
             if (intf.getInterfaceUuid().equals(entry.getValue().getRight())) {
-                logger.debug("handleInterfaceEventDelete remove cache entry NeutronPortUuid {} : dpid {}, ifUuid {}",
+                LOGGER.debug("handleInterfaceEventDelete remove cache entry NeutronPortUuid {} : dpid {}, ifUuid {}",
                         currPortUuid, dpId, intf.getInterfaceUuid().getValue());
                 neutronPortToDpIdCache.remove(currPortUuid);
                 break;
@@ -502,13 +512,14 @@ public class NeutronL3Adapter implements ConfigInterface {
 
         if (providerSegmentationId == null || providerSegmentationId.isEmpty() ||
             tenantMac == null || tenantMac.isEmpty()) {
-            return;  // done: go no further w/out all the info needed...
+            // done: go no further w/out all the info needed...
+            return;
         }
 
         final Action action = isDelete ? Action.DELETE : Action.ADD;
         List<Node> nodes = nodeCacheManager.getBridgeNodes();
         if (nodes.isEmpty()) {
-            logger.trace("updateL3ForNeutronPort has no nodes to work with");
+            LOGGER.trace("updateL3ForNeutronPort has no nodes to work with");
         }
         for (Node node : nodes) {
             final Long dpid = getDpidForIntegrationBridge(node);
@@ -544,12 +555,12 @@ public class NeutronL3Adapter implements ConfigInterface {
         final Boolean isProgrammed = l3ForwardingCache.contains(cacheKey);
 
         if (actionForNode == Action.DELETE && isProgrammed == Boolean.FALSE) {
-            logger.trace("programL3ForwardingStage1 for node {} providerId {} mac {} ip {} action {} is already done",
+            LOGGER.trace("programL3ForwardingStage1 for node {} providerId {} mac {} ip {} action {} is already done",
                          node.getNodeId().getValue(), providerSegmentationId, macAddress, ipStr, actionForNode);
             return;
         }
         if (actionForNode == Action.ADD && isProgrammed == Boolean.TRUE) {
-            logger.trace("programL3ForwardingStage1 for node {} providerId {} mac {} ip {} action {} is already done",
+            LOGGER.trace("programL3ForwardingStage1 for node {} providerId {} mac {} ip {} action {} is already done",
                     node.getNodeId().getValue(), providerSegmentationId, macAddress, ipStr, actionForNode);
             return;
         }
@@ -582,11 +593,11 @@ public class NeutronL3Adapter implements ConfigInterface {
         }
 
         if (status.isSuccess()) {
-            logger.debug("ProgramL3Forwarding {} for mac:{} addr:{} node:{} action:{}",
+            LOGGER.debug("ProgramL3Forwarding {} for mac:{} addr:{} node:{} action:{}",
                          l3ForwardingProvider == null ? "skipped" : "programmed",
                          macAddress, address, node.getNodeId().getValue(), actionForNode);
         } else {
-            logger.error("ProgramL3Forwarding failed for mac:{} addr:{} node:{} action:{} status:{}",
+            LOGGER.error("ProgramL3Forwarding failed for mac:{} addr:{} node:{} action:{} status:{}",
                          macAddress, address, node.getNodeId().getValue(), actionForNode, status);
         }
         return status;
@@ -611,7 +622,7 @@ public class NeutronL3Adapter implements ConfigInterface {
         final String cidr = subnet != null ? subnet.getCidr() : null;
         final int mask = getMaskLenFromCidr(cidr);
 
-        logger.trace("programFlowsForNeutronRouterInterface called for interface {} isDelete {}",
+        LOGGER.trace("programFlowsForNeutronRouterInterface called for interface {} isDelete {}",
                      destNeutronRouterInterface, isDelete);
 
         // in delete path, mac address as well as ip address are not provided. Being so, let's find them from
@@ -629,9 +640,10 @@ public class NeutronL3Adapter implements ConfigInterface {
             cidr == null || cidr.isEmpty() ||
             macAddress == null || macAddress.isEmpty() ||
             ipList == null || ipList.isEmpty()) {
-            logger.debug("programFlowsForNeutronRouterInterface is bailing seg:{} cidr:{} mac:{}  ip:{}",
+            LOGGER.debug("programFlowsForNeutronRouterInterface is bailing seg:{} cidr:{} mac:{}  ip:{}",
                          destinationSegmentationId, cidr, macAddress, ipList);
-            return;  // done: go no further w/out all the info needed...
+            // done: go no further w/out all the info needed...
+            return;
         }
 
         final Action actionForNode = isDelete ? Action.DELETE : Action.ADD;
@@ -646,7 +658,7 @@ public class NeutronL3Adapter implements ConfigInterface {
 
         List<Node> nodes = nodeCacheManager.getBridgeNodes();
         if (nodes.isEmpty()) {
-            logger.trace("programFlowsForNeutronRouterInterface has no nodes to work with");
+            LOGGER.trace("programFlowsForNeutronRouterInterface has no nodes to work with");
         }
         for (Node node : nodes) {
             final Long dpid = getDpidForIntegrationBridge(node);
@@ -657,7 +669,7 @@ public class NeutronL3Adapter implements ConfigInterface {
             for (Neutron_IPs neutronIP : ipList) {
                 final String ipStr = neutronIP.getIpAddress();
                 if (ipStr.isEmpty()) {
-                    logger.debug("programFlowsForNeutronRouterInterface is skipping node {} ip {}",
+                    LOGGER.debug("programFlowsForNeutronRouterInterface is skipping node {} ip {}",
                             node.getNodeId().getValue(), ipStr);
                     continue;
                 }
@@ -725,7 +737,7 @@ public class NeutronL3Adapter implements ConfigInterface {
 
         final String sourceSubnetId = srcNeutronRouterInterface.getSubnetUUID();
         if (sourceSubnetId == null) {
-            logger.error("Could not get provider Subnet ID from router interface {}",
+            LOGGER.error("Could not get provider Subnet ID from router interface {}",
                          srcNeutronRouterInterface.getID());
             return;
         }
@@ -733,13 +745,13 @@ public class NeutronL3Adapter implements ConfigInterface {
         final NeutronSubnet sourceSubnet = neutronSubnetCache.getSubnet(sourceSubnetId);
         final String sourceNetworkId = sourceSubnet == null ? null : sourceSubnet.getNetworkUUID();
         if (sourceNetworkId == null) {
-            logger.error("Could not get provider Network ID from subnet {}", sourceSubnetId);
+            LOGGER.error("Could not get provider Network ID from subnet {}", sourceSubnetId);
             return;
         }
 
         final NeutronNetwork sourceNetwork = neutronNetworkCache.getNetwork(sourceNetworkId);
         if (sourceNetwork == null) {
-            logger.error("Could not get provider Network for Network ID {}", sourceNetworkId);
+            LOGGER.error("Could not get provider Network for Network ID {}", sourceNetworkId);
             return;
         }
 
@@ -749,7 +761,7 @@ public class NeutronL3Adapter implements ConfigInterface {
         }
         final String sourceSegmentationId = sourceNetwork.getProviderSegmentationID();
         if (sourceSegmentationId == null) {
-            logger.error("Could not get provider Segmentation ID for Subnet {}", sourceSubnetId);
+            LOGGER.error("Could not get provider Segmentation ID for Subnet {}", sourceSubnetId);
             return;
         }
         if (sourceSegmentationId.equals(destinationSegmentationId)) {
@@ -771,9 +783,10 @@ public class NeutronL3Adapter implements ConfigInterface {
             if (cidr2 == null || cidr2.isEmpty() ||
                 macAddress2 == null || macAddress2.isEmpty() ||
                 ipList2 == null || ipList2.isEmpty()) {
-                logger.trace("programFlowsForNeutronRouterInterfacePair reflexive is bailing seg:{} cidr:{} mac:{} ip:{}",
+                LOGGER.trace("programFlowsForNeutronRouterInterfacePair reflexive is bailing seg:{} cidr:{} mac:{} ip:{}",
                              sourceSegmentationId, cidr2, macAddress2, ipList2);
-                return;  // done: go no further w/out all the info needed...
+                // done: go no further w/out all the info needed...
+                return;
             }
 
             for (Neutron_IPs neutronIP2 : ipList2) {
@@ -803,14 +816,14 @@ public class NeutronL3Adapter implements ConfigInterface {
         final Boolean isProgrammed = routerInterfacesCache.contains(cacheKey);
 
         if (actionForNode == Action.DELETE && isProgrammed == Boolean.FALSE) {
-            logger.trace("programRouterInterfaceStage1 for node {} sourceSegId {} destSegId {} mac {} ip {} mask {}" +
+            LOGGER.trace("programRouterInterfaceStage1 for node {} sourceSegId {} destSegId {} mac {} ip {} mask {}" +
                          " action {} is already done",
                          node.getNodeId().getValue(), sourceSegmentationId, destinationSegmentationId,
                          macAddress, ipStr, mask, actionForNode);
             return;
         }
         if (actionForNode == Action.ADD && isProgrammed == Boolean.TRUE) {
-            logger.trace("programRouterInterfaceStage1 for node {} sourceSegId {} destSegId {} mac {} ip {} mask {}" +
+            LOGGER.trace("programRouterInterfaceStage1 for node {} sourceSegId {} destSegId {} mac {} ip {} mask {}" +
                          " action {} is already done",
                          node.getNodeId().getValue(), sourceSegmentationId, destinationSegmentationId,
                          macAddress, ipStr, mask, actionForNode);
@@ -848,12 +861,12 @@ public class NeutronL3Adapter implements ConfigInterface {
         }
 
         if (status.isSuccess()) {
-            logger.debug("ProgramRouterInterface {} for mac:{} addr:{}/{} node:{} srcTunId:{} destTunId:{} action:{}",
+            LOGGER.debug("ProgramRouterInterface {} for mac:{} addr:{}/{} node:{} srcTunId:{} destTunId:{} action:{}",
                          routingProvider == null ? "skipped" : "programmed",
                          macAddress, address, mask, node.getNodeId().getValue(), sourceSegmentationId, destinationSegmentationId,
                          actionForNode);
         } else {
-            logger.error("ProgramRouterInterface failed for mac:{} addr:{}/{} node:{} srcTunId:{} destTunId:{} action:{} status:{}",
+            LOGGER.error("ProgramRouterInterface failed for mac:{} addr:{}/{} node:{} srcTunId:{} destTunId:{} action:{} status:{}",
                          macAddress, address, mask, node.getNodeId().getValue(), sourceSegmentationId, destinationSegmentationId,
                          actionForNode, status);
         }
@@ -870,12 +883,12 @@ public class NeutronL3Adapter implements ConfigInterface {
         final Boolean isProgrammed = staticArpEntryCache.contains(cacheKey);
 
         if (action == Action.DELETE && isProgrammed == Boolean.FALSE) {
-            logger.trace("programStaticArpStage1 dpid {} segOrOfPort {} mac {} ip {} action {} is already done",
+            LOGGER.trace("programStaticArpStage1 dpid {} segOrOfPort {} mac {} ip {} action {} is already done",
                     dpid, segOrOfPort, macAddress, ipStr, action);
             return true;
         }
         if (action == Action.ADD && isProgrammed == Boolean.TRUE) {
-            logger.trace("programStaticArpStage1 dpid {} segOrOfPort {} mac {} ip {} action {} is already done",
+            LOGGER.trace("programStaticArpStage1 dpid {} segOrOfPort {} mac {} ip {} action {} is already done",
                     dpid, segOrOfPort, macAddress, ipStr, action);
             return true;
         }
@@ -910,11 +923,11 @@ public class NeutronL3Adapter implements ConfigInterface {
         }
 
         if (status.isSuccess()) {
-            logger.debug("ProgramStaticArp {} for mac:{} addr:{} dpid:{} segOrOfPort:{} action:{}",
+            LOGGER.debug("ProgramStaticArp {} for mac:{} addr:{} dpid:{} segOrOfPort:{} action:{}",
                          arpProvider == null ? "skipped" : "programmed",
                          macAddress, address, dpid, segOrOfPort, action);
         } else {
-            logger.error("ProgramStaticArp failed for mac:{} addr:{} dpid:{} segOrOfPort:{} action:{} status:{}",
+            LOGGER.error("ProgramStaticArp failed for mac:{} addr:{} dpid:{} segOrOfPort:{} action:{} status:{}",
                          macAddress, address, dpid, segOrOfPort, action, status);
         }
         return status;
@@ -930,13 +943,13 @@ public class NeutronL3Adapter implements ConfigInterface {
         final Boolean isProgrammed = inboundIpRewriteCache.contains(cacheKey);
 
         if (action == Action.DELETE && isProgrammed == Boolean.FALSE) {
-            logger.trace("programInboundIpRewriteStage1 dpid {} OFPort {} seg {} matchAddress {} rewriteAddress {}" +
+            LOGGER.trace("programInboundIpRewriteStage1 dpid {} OFPort {} seg {} matchAddress {} rewriteAddress {}" +
                     " action {} is already done",
                     dpid, inboundOFPort, providerSegmentationId, matchAddress, rewriteAddress, action);
             return true;
         }
         if (action == Action.ADD && isProgrammed == Boolean.TRUE) {
-            logger.trace("programInboundIpRewriteStage1 dpid {} OFPort {} seg {} matchAddress {} rewriteAddress {}" +
+            LOGGER.trace("programInboundIpRewriteStage1 dpid {} OFPort {} seg {} matchAddress {} rewriteAddress {}" +
                     " action is already done",
                     dpid, inboundOFPort, providerSegmentationId, matchAddress, rewriteAddress, action);
             return true;
@@ -974,11 +987,11 @@ public class NeutronL3Adapter implements ConfigInterface {
 
         if (status.isSuccess()) {
             final boolean isSkipped = inboundNatProvider == null;
-            logger.debug("programInboundIpRewriteStage2 {} for dpid:{} ofPort:{} seg:{} match:{} rewrite:{} action:{}",
-                    (isSkipped ? "skipped" : "programmed"),
+            LOGGER.debug("programInboundIpRewriteStage2 {} for dpid:{} ofPort:{} seg:{} match:{} rewrite:{} action:{}",
+                    isSkipped ? "skipped" : "programmed",
                     dpid, inboundOFPort, providerSegmentationId, matchAddress, rewriteAddress, action);
         } else {
-            logger.error("programInboundIpRewriteStage2 failed for dpid:{} ofPort:{} seg:{} match:{} rewrite:{} action:{}" +
+            LOGGER.error("programInboundIpRewriteStage2 failed for dpid:{} ofPort:{} seg:{} match:{} rewrite:{} action:{}" +
                          " status:{}",
                     dpid, inboundOFPort, providerSegmentationId, matchAddress, rewriteAddress, action,
                     status);
@@ -995,12 +1008,12 @@ public class NeutronL3Adapter implements ConfigInterface {
         final Boolean isProgrammed = outboundIpRewriteExclusionCache.contains(cacheKey);
 
         if (actionForRewriteExclusion == Action.DELETE && isProgrammed == Boolean.FALSE) {
-            logger.trace("programIpRewriteExclusionStage1 node {} providerId {} cidr {} action {} is already done",
+            LOGGER.trace("programIpRewriteExclusionStage1 node {} providerId {} cidr {} action {} is already done",
                          node.getNodeId().getValue(), providerSegmentationId, cidr, actionForRewriteExclusion);
             return;
         }
         if (actionForRewriteExclusion == Action.ADD && isProgrammed == Boolean.TRUE) {
-            logger.trace("programIpRewriteExclusionStage1 node {} providerId {} cidr {} action {} is already done",
+            LOGGER.trace("programIpRewriteExclusionStage1 node {} providerId {} cidr {} action {} is already done",
                          node.getNodeId().getValue(), providerSegmentationId, cidr, actionForRewriteExclusion);
             return;
         }
@@ -1024,11 +1037,11 @@ public class NeutronL3Adapter implements ConfigInterface {
 
         if (status.isSuccess()) {
             final boolean isSkipped = outboundNatProvider == null;
-            logger.debug("IpRewriteExclusion {} for cidr:{} node:{} action:{}",
-                         (isSkipped ? "skipped" : "programmed"),
+            LOGGER.debug("IpRewriteExclusion {} for cidr:{} node:{} action:{}",
+                         isSkipped ? "skipped" : "programmed",
                          cidr, node.getNodeId().getValue(), actionForNode);
         } else {
-            logger.error("IpRewriteExclusion failed for cidr:{} node:{} action:{} status:{}",
+            LOGGER.error("IpRewriteExclusion failed for cidr:{} node:{} action:{} status:{}",
                          cidr, node.getNodeId().getValue(), actionForNode, status);
         }
         return status;
@@ -1042,13 +1055,13 @@ public class NeutronL3Adapter implements ConfigInterface {
         final Boolean isProgrammed = outboundIpRewriteCache.contains(cacheKey);
 
         if (action == Action.DELETE && isProgrammed == Boolean.FALSE) {
-            logger.trace("programOutboundIpRewriteStage1 dpid {} seg {} fixedIpAddress {} floatIp {} action {} " +
+            LOGGER.trace("programOutboundIpRewriteStage1 dpid {} seg {} fixedIpAddress {} floatIp {} action {} " +
                          "is already done",
                     fid.dpid, fid.segId, fid.fixedIpAddress, fid.floatingIpAddress, action);
             return;
         }
         if (action == Action.ADD && isProgrammed == Boolean.TRUE) {
-            logger.trace("programOutboundIpRewriteStage1 dpid {} seg {} fixedIpAddress {} floatIp {} action {} " +
+            LOGGER.trace("programOutboundIpRewriteStage1 dpid {} seg {} fixedIpAddress {} floatIp {} action {} " +
                          "is already done",
                     fid.dpid, fid.segId, fid.fixedIpAddress, fid.floatingIpAddress, action);
             return;
@@ -1081,12 +1094,12 @@ public class NeutronL3Adapter implements ConfigInterface {
 
         if (status.isSuccess()) {
             final boolean isSkipped = outboundNatProvider == null;
-            logger.debug("programOutboundIpRewriteStage2 {} for dpid {} seg {} fixedIpAddress {} floatIp {}" +
-                         " action {}",
-                         (isSkipped ? "skipped" : "programmed"),
+            LOGGER.debug("programOutboundIpRewriteStage2 {} for dpid {} seg {} fixedIpAddress {} floatIp {}" +
+                            " action {}",
+                         isSkipped ? "skipped" : "programmed",
                          fid.dpid, fid.segId, fid.fixedIpAddress, fid.floatingIpAddress, action);
         } else {
-            logger.error("programOutboundIpRewriteStage2 failed for dpid {} seg {} fixedIpAddress {} floatIp {}" +
+            LOGGER.error("programOutboundIpRewriteStage2 failed for dpid {} seg {} fixedIpAddress {} floatIp {}" +
                          " action {} status:{}",
                          fid.dpid, fid.segId, fid.fixedIpAddress, fid.floatingIpAddress, action, status);
         }
@@ -1094,16 +1107,18 @@ public class NeutronL3Adapter implements ConfigInterface {
     }
 
     private int getMaskLenFromCidr(String cidr) {
-        if (cidr == null) return 0;
+        if (cidr == null) {
+            return 0;
+        }
         String[] splits = cidr.split("/");
-        if (splits.length != 2) return 0;
+        if (splits.length != 2) {
+            return 0;
+        }
 
         int result;
         try {
             result = Integer.parseInt(splits[1].trim());
-        }
-        catch (NumberFormatException nfe)
-        {
+        } catch (NumberFormatException nfe) {
             result = 0;
         }
         return result;
index b127c64afa2d15882a9d2d7e9787ca228779ce6f..175aad9c58bb124b2f0628c77b613686d6b917ba 100644 (file)
@@ -162,7 +162,7 @@ public class SouthboundImpl implements Southbound {
         return value;
     }
 
-    public boolean addBridge(Node ovsdbNode, String bridgeName, String target) throws InvalidParameterException {
+    public boolean addBridge(Node ovsdbNode, String bridgeName, String target) {
         boolean result = false;
 
         LOG.info("addBridge: node: {}, bridgeName: {}, target: {}", ovsdbNode, bridgeName, target);
@@ -316,17 +316,14 @@ public class SouthboundImpl implements Southbound {
 
     public OvsdbBridgeAugmentation getBridge(Node node, String name) {
         OvsdbBridgeAugmentation bridge = node.getAugmentation(OvsdbBridgeAugmentation.class);
-        if (bridge != null) {
-            if (!bridge.getBridgeName().getValue().equals(name)) {
-                bridge = null;
-            }
+        if ((bridge != null) && (!bridge.getBridgeName().getValue().equals(name))) {
+            bridge = null;
         }
         return bridge;
     }
 
     public OvsdbBridgeAugmentation getBridge(Node node) {
-        OvsdbBridgeAugmentation bridge = node.getAugmentation(OvsdbBridgeAugmentation.class);
-        return bridge;
+        return node.getAugmentation(OvsdbBridgeAugmentation.class);
     }
 
     public String getBridgeName(Node node) {
@@ -339,7 +336,7 @@ public class SouthboundImpl implements Southbound {
     }
 
     public String extractBridgeName(Node node) {
-        return (node.getAugmentation(OvsdbBridgeAugmentation.class).getBridgeName().getValue());
+        return node.getAugmentation(OvsdbBridgeAugmentation.class).getBridgeName().getValue();
     }
 
     public OvsdbBridgeAugmentation extractBridgeAugmentation(Node node) {