Merge "Bug 5936 - DeviceFlowRegistry flowId bug"
authorJozef Bacigal <jbacigal@cisco.com>
Tue, 28 Jun 2016 08:40:29 +0000 (08:40 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 28 Jun 2016 08:40:29 +0000 (08:40 +0000)
1  2 
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java

index f85f29d06f5d6f717090a55095385e0b37b78673,7e4302a50fb9a2a334ab4480c6be25d9586078b5..5fb487c2cf408cc0546222e176214e8c1b852b3a
@@@ -148,7 -148,7 +148,7 @@@ public class DeviceContextImpl implemen
          deviceInfo = primaryConnectionContext.getDeviceInfo();
          this.transactionChainManager = new TransactionChainManager(dataBroker, deviceInfo, conductor);
          auxiliaryConnectionContexts = new HashMap<>();
-         deviceFlowRegistry = new DeviceFlowRegistryImpl();
+         deviceFlowRegistry = new DeviceFlowRegistryImpl(dataBroker);
          deviceGroupRegistry = new DeviceGroupRegistryImpl();
          deviceMeterRegistry = new DeviceMeterRegistryImpl();
          messageSpy = conductor.getMessageIntelligenceAgency();
  
      @Override
      public void processFlowRemovedMessage(final FlowRemoved flowRemoved) {
 +        //1. translate to general flow (table, priority, match, cookie)
 +        final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved flowRemovedNotification =
 +                flowRemovedTranslator.translate(flowRemoved, deviceInfo, null);
 +        // Trigger off a notification
 +        notificationPublishService.offerNotification(flowRemovedNotification);
 +
          final ItemLifecycleListener itemLifecycleListener = flowLifeCycleKeeper.getItemLifecycleListener();
          if (itemLifecycleListener != null) {
 -            //1. translate to general flow (table, priority, match, cookie)
 -            final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved flowRemovedNotification =
 -                    flowRemovedTranslator.translate(flowRemoved, deviceInfo, null);
              //2. create registry key
              final FlowRegistryKey flowRegKey = FlowRegistryKeyFactory.create(flowRemovedNotification);
              //3. lookup flowId
                          .child(Flow.class, new FlowKey(flowDescriptor.getFlowId()));
                  // b) notify listener
                  itemLifecycleListener.onRemoved(flowPath);
 -                // c) trigger off a notification
 -                notificationPublishService.offerNotification(flowRemovedNotification);
              } else {
                  LOG.debug("flow id not found: nodeId={} tableId={}, priority={}",
                          getDeviceInfo().getNodeId(), flowRegKey.getTableId(), flowRemovedNotification.getPriority());