Bug 4987 - ExternalMapper flows not populated 16/32916/2
authorTomas Cechvala <tcechval@cisco.com>
Mon, 18 Jan 2016 10:26:53 +0000 (11:26 +0100)
committerTomas Cechvala <tcechval@cisco.com>
Mon, 18 Jan 2016 10:43:30 +0000 (11:43 +0100)
 - fixed by removing redundant condition

Change-Id: I3d0e43c6abebab776b21a9c12c91a5a570d0e55c
Signed-off-by: Tomas Cechvala <tcechval@cisco.com>
renderers/ofoverlay/src/main/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/flow/ExternalMapper.java
renderers/ofoverlay/src/test/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/flow/ExternalMapperTest.java

index a89d9de8edc4cfca11ed2e3d750b94a815a6f6e3..b8ea58f5da397478469b5baee0fcd81dae3f6920 100755 (executable)
@@ -70,10 +70,6 @@ public class ExternalMapper extends FlowTable {
     @Override
     public void sync(NodeId nodeId, OfWriter ofWriter) throws Exception {
 
-        if (ctx.getSwitchManager().getExternalPorts(nodeId).isEmpty()) {
-            LOG.trace("No external ports found for node: {}", nodeId);
-            return;
-        }
         // Default drop all
         ofWriter.writeFlow(nodeId, TABLE_ID, dropFlow(Integer.valueOf(1), null, TABLE_ID));
 
index 08497d036c9c2bf0818f0e90676b52934f317ad4..66792f1cf921d833e96a7e42cab1385b04e40a74 100755 (executable)
@@ -93,7 +93,8 @@ public class ExternalMapperTest extends FlowTableTest {
 
     @Test
     public void syncTestNoExternalPorts() throws Exception {
+        // we still need ExternalMapper flows (default output and default drop) to be generated
         mapper.sync(nodeId, ofWriter);
-        verify(ofWriter, never()).writeFlow(any(NodeId.class), any(Short.class), any(Flow.class));
+        verify(ofWriter, times(2)).writeFlow(any(NodeId.class), any(Short.class), any(Flow.class));
     }
 }