Fixed hash computation
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / services / SalFlowServiceImpl.java
index 19895116001e2a5a6f206509ea3208f3fec5ab24..2eef2a31948ae1fbb550c55b6eaeb58462331c67 100644 (file)
@@ -71,7 +71,7 @@ public class SalFlowServiceImpl extends CommonService implements SalFlowService
         }
 
 
-        final FlowHash flowHash = FlowHashFactory.create(input);
+        final FlowHash flowHash = FlowHashFactory.create(input, deviceContext);
         final FlowDescriptor flowDescriptor = FlowDescriptorFactory.create(input.getTableId(), flowId);
         deviceContext.getDeviceFlowRegistry().store(flowHash, flowDescriptor);
 
@@ -81,7 +81,7 @@ public class SalFlowServiceImpl extends CommonService implements SalFlowService
         Futures.addCallback(future, new FutureCallback<RpcResult<AddFlowOutput>>() {
             @Override
             public void onSuccess(final RpcResult<AddFlowOutput> rpcResult) {
-                messageSpy.spyMessage(input, MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMITTED_SUCCESS);
+                messageSpy.spyMessage(input.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMITTED_SUCCESS);
                 if (rpcResult.isSuccessful()) {
                     LOG.debug("flow add finished without error, id={}", flowId.getValue());
                 } else {
@@ -91,7 +91,7 @@ public class SalFlowServiceImpl extends CommonService implements SalFlowService
 
             @Override
             public void onFailure(final Throwable throwable) {
-                messageSpy.spyMessage(input, MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMITTED_FAILURE);
+                messageSpy.spyMessage(input.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMITTED_FAILURE);
                 deviceContext.getDeviceFlowRegistry().markToBeremoved(flowHash);
                 LOG.trace("Service call for adding flows failed, id={}.", flowId.getValue(), throwable);
             }
@@ -113,14 +113,14 @@ public class SalFlowServiceImpl extends CommonService implements SalFlowService
                         Futures.addCallback(future, new FutureCallback() {
                             @Override
                             public void onSuccess(final Object o) {
-                                messageSpy.spyMessage(input, MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMITTED_SUCCESS);
-                                FlowHash flowHash = FlowHashFactory.create(input);
+                                messageSpy.spyMessage(input.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMITTED_SUCCESS);
+                                FlowHash flowHash = FlowHashFactory.create(input, deviceContext);
                                 deviceContext.getDeviceFlowRegistry().markToBeremoved(flowHash);
                             }
 
                             @Override
                             public void onFailure(final Throwable throwable) {
-                                messageSpy.spyMessage(input, MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMITTED_FAILURE);
+                                messageSpy.spyMessage(input.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMITTED_FAILURE);
                                 StringBuffer errors = new StringBuffer();
                                 try {
                                     RpcResult<Void> result = future.get();
@@ -170,11 +170,11 @@ public class SalFlowServiceImpl extends CommonService implements SalFlowService
         Futures.addCallback(future, new FutureCallback() {
             @Override
             public void onSuccess(final Object o) {
-                messageSpy.spyMessage(input, MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMITTED_SUCCESS);
-                FlowHash flowHash = FlowHashFactory.create(original);
+                messageSpy.spyMessage(input.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMITTED_SUCCESS);
+                FlowHash flowHash = FlowHashFactory.create(original, deviceContext);
                 deviceContext.getDeviceFlowRegistry().markToBeremoved(flowHash);
 
-                flowHash = FlowHashFactory.create(updated);
+                flowHash = FlowHashFactory.create(updated, deviceContext);
                 FlowId flowId = input.getFlowRef().getValue().firstKeyOf(Flow.class, FlowKey.class).getId();
                 FlowDescriptor flowDescriptor = FlowDescriptorFactory.create(updated.getTableId(), flowId);
                 deviceContext.getDeviceFlowRegistry().store(flowHash, flowDescriptor);
@@ -183,7 +183,7 @@ public class SalFlowServiceImpl extends CommonService implements SalFlowService
 
             @Override
             public void onFailure(final Throwable throwable) {
-                messageSpy.spyMessage(input, MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMITTED_FAILURE);
+                messageSpy.spyMessage(input.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMITTED_FAILURE);
             }
         });
         return future;