public Set<NodeId> clearSffsIfNoRspExists() {
Set<NodeId> sffNodeIDs = new HashSet<>();
+ if (!rspNameToFlowsMap.containsKey(SfcOfRspProcessor.SFC_FLOWS)) {
+ LOG.warn("clearSffsIfNoRspExists() - Attempting to delete initialization flows, and they do not exist");
+ return sffNodeIDs;
+ }
+
Map<String, List<FlowDetails>> theInitializationFlows =
rspNameToFlowsMap.get(SfcOfRspProcessor.SFC_FLOWS);
import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.VxlanGpe;
import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.Nsh;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
sfcFlowWriterTestMock.deleteRspFlows((long) 31);
Set<SfcOfFlowWriterImpl.FlowDetails> flowsToDelete = Whitebox
.getInternalState(sfcFlowWriterTestMock, "setOfFlowsToDelete");
- Assert.assertEquals(0, flowsToDelete.size());
+ Assert.assertTrue(flowsToDelete.isEmpty());
+ }
+
+ @Test
+ public void clearNonExistentInitializationFlows() {
+ Set<NodeId> theOrphanSffs = sfcFlowWriterTestMock.clearSffsIfNoRspExists();
+ Assert.assertTrue(theOrphanSffs.isEmpty());
}
/*