BUG-5602: OFP-Li implements a YANG notification which notifies its 39/38639/2
authorShuva Kar <shuva.jyoti.kar@ericsson.com>
Tue, 10 May 2016 16:40:36 +0000 (22:10 +0530)
committerShuva Kar <shuva.jyoti.kar@ericsson.com>
Tue, 10 May 2016 17:49:25 +0000 (23:19 +0530)
applications of the removal of a flow entry on the event of receiving
FLOW_REMOVED message from a switch.

Change-Id: I3496effc0313e38702907e0e0eaf202f460d2406
Signed-off-by: Shuva Kar <shuva.jyoti.kar@ericsson.com>
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImplTest.java

index 800fa9cfa7933a3e2458bba4c382c22f9279e708..c8ca1bf723e559dcac1f846e5253dd1d6f85f32b 100644 (file)
@@ -410,6 +410,8 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi
                         .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={}",
                         getDeviceState().getNodeId(), flowRegKey.getTableId(), flowRemovedNotification.getPriority());
index af48f96fdf42d6a028d103b0eb13892cfa49b451..228f39fe8b752bb9d263db7fcc3262c17876e4fb 100644 (file)
@@ -466,6 +466,7 @@ public class DeviceContextImplTest {
                 .setPriority(42)
                 .setCookie(new FlowCookie(BigInteger.ONE))
                 .setMatch(new MatchBuilder().build());
+        final NotificationPublishService mockedNotificationPublishService = mock(NotificationPublishService.class);
 
         Mockito.when(messageTranslatorFlowRemoved.translate(any(Object.class), any(DeviceContext.class), any(Object.class)))
                 .thenReturn(flowRemovedMdsalBld.build());
@@ -490,6 +491,7 @@ public class DeviceContextImplTest {
                 .child(Table.class, new TableKey((short) 0))
                 .child(Flow.class, new FlowKey(new FlowId("ut-ofp:f456")));
 
+        deviceContext.setNotificationPublishService(mockedNotificationPublishService);
         deviceContext.processFlowRemovedMessage(flowRemovedBld.build());
         Mockito.verify(itemLifecycleListener).onRemoved(flowToBeRemovedPath);
     }