Log enhancements and fixes for VPP renderer 28/62828/2
authorMichal Cmarada <mcmarada@cisco.com>
Thu, 7 Sep 2017 11:56:04 +0000 (13:56 +0200)
committerMichal Cmarada <mcmarada@cisco.com>
Thu, 7 Sep 2017 11:56:04 +0000 (13:56 +0200)
Change-Id: Idcfa502603cd0cfd9975cb79ba71070bc63d84e6
Signed-off-by: Michal Cmarada <mcmarada@cisco.com>
renderers/vpp/src/main/java/org/opendaylight/groupbasedpolicy/renderer/vpp/iface/InterfaceManager.java
renderers/vpp/src/main/java/org/opendaylight/groupbasedpolicy/renderer/vpp/iface/VppEndpointLocationProvider.java
renderers/vpp/src/main/java/org/opendaylight/groupbasedpolicy/renderer/vpp/routing/RoutingManager.java
renderers/vpp/src/main/java/org/opendaylight/groupbasedpolicy/renderer/vpp/util/MountedDataBrokerProvider.java

index e0e7b42523e0a1c22789c600fa21d71d436cfa03..f136e27226dd51277e0fff61884bd21291cd2187 100644 (file)
@@ -133,9 +133,8 @@ public class InterfaceManager implements AutoCloseable {
         }
         LOG.info(message);
         } catch (InterruptedException | ExecutionException e) {
-            // TODO Auto-generated catch block
-            LOG.error("Failed to process changed vpp endpoint - before: {}, after {}: ", event.getBefore(),
-                    event.getBefore());
+            LOG.error("Failed to process changed vpp endpoint. before: {}, after: {}.Exception: {} ", event.getBefore(),
+                    event.getAfter(), e);
         }
     }
 
@@ -262,19 +261,17 @@ public class InterfaceManager implements AutoCloseable {
         return deleteIfaceOnVpp(ifaceWithoutBdCommand, vppNodeIid, vppEndpoint);
     }
 
-    private ListenableFuture<Void> deleteIfaceOnVpp(AbstractInterfaceCommand deleteIfaceWithoutBdCommand, InstanceIdentifier<Node> vppIid,
-            VppEndpoint vppEndpoint) {
-        InterfaceBuilder intfBuilder = deleteIfaceWithoutBdCommand.getInterfaceBuilder();
-        final boolean transactionState = GbpNetconfTransaction.netconfSyncedDelete(vppIid,
-                deleteIfaceWithoutBdCommand, GbpNetconfTransaction.RETRY_COUNT);
+    private ListenableFuture<Void> deleteIfaceOnVpp(AbstractInterfaceCommand interfaceCommand,
+        InstanceIdentifier<Node> vppIid, VppEndpoint vppEndpoint) {
+        final boolean transactionState = GbpNetconfTransaction.netconfSyncedDelete(vppIid, interfaceCommand,
+            GbpNetconfTransaction.RETRY_COUNT);
         if (transactionState) {
-            LOG.debug("Delete interface on VPP command was successful: VPP: {} Command: {}", vppIid,
-                    deleteIfaceWithoutBdCommand);
-            AccessListWrapper.removeAclsForInterface(vppIid, new InterfaceKey(intfBuilder.getName()));
+            LOG.debug("Delete interface on VPP command was successful: VPP: {} Command: {}", vppIid, interfaceCommand);
+            AccessListWrapper.removeAclsForInterface(vppIid, new InterfaceKey(interfaceCommand.getName()));
             return vppEndpointLocationProvider.deleteLocationForVppEndpoint(vppEndpoint);
         } else {
             final String message = "Delete interface on VPP command was not successful: VPP: " + vppIid
-                    + " Command: " + deleteIfaceWithoutBdCommand;
+                    + " Command: " + interfaceCommand;
             LOG.warn(message);
             return Futures.immediateFailedFuture(new VppRendererProcessingException(message));
         }
index 5c93e268c6747535954e8a9825b8e2b572fef915..b5e1f4732f8a2ab56001d4a5d9788e4abcb4c200 100644 (file)
@@ -352,4 +352,4 @@ public class VppEndpointLocationProvider
                 .collect(Collectors.toList());
         }
     };
-}
\ No newline at end of file
+}
index 164af17a428e6064640673310b8080d43b2bd699..5caedab312cadda15bdc301a9c9eea0226763af3 100644 (file)
@@ -179,7 +179,7 @@ public class RoutingManager {
         LOG.trace("Submitting routing for routing command: {}, nodeId: {}", routing, nodeIid);
 
         Optional<DataBroker> mountPointDataBroker = mountDataProvider.resolveDataBrokerForMountPoint(nodeIid);
-        if (mountPointDataBroker.isPresent()) {
+        if (!mountPointDataBroker.isPresent()) {
             throw new IllegalStateException("Cannot find data broker for mount point " + nodeIid);
         }
         LOG.info("Routing was created for forwarding. Routing: {}, for node: {}", routing, nodeIid);
index 0065554b6bdeaff5270d485dd03548f56b473f22..ffc2fa653cb78e51ad3c9f3dea136db76d740cec 100644 (file)
@@ -76,10 +76,10 @@ public class MountedDataBrokerProvider {
             }
         } catch (TimeoutException e) {
             LOG.warn("Mountpoint not obtained within {} seconds. Iid: {}", NODE_CONNECTION_TIMER, iidToMountPoint, e);
-            return null;
+            return Optional.absent();
         } catch (ExecutionException | InterruptedException e) {
             LOG.warn("Error while getting mountpoint. Iid: {}", iidToMountPoint, e);
-            return null;
+            return Optional.absent();
         }
     }