ClassifierRspUpdateProcessor { public List<FlowDetails> processClassifier( final SclServiceFunctionForwarder theClassifier, final Acl theAcl, final RenderedServicePath theRsp) { LOG.info("processClassifier - Processing the upadate of RSP {}", theRsp.getPathId()); SffName sffName = new SffName(theClassifier.getName()); Optional<String> itfName = classifierHandler.getInterfaceNameFromClassifier(theClassifier); ServiceFunctionForwarder sff = SfcProviderServiceForwarderAPI.readServiceFunctionForwarder(sffName); if (!classifierHandler.usesLogicalInterfaces(sff)) { LOG.error("processClassifier - Not attached to a logical SFF; Bailing out"); return Collections.emptyList(); } if (!itfName.isPresent()) { LOG.error("processClassifier - Could not extract a LogicalInterface from the classifier's attachment point"); return Collections.emptyList(); } Optional<String> nodeName = classifierInterface.getNodeName(itfName.get()); if(!nodeName.isPresent()) { LOG.error("processClassifier - Could not extract the node name from the OVS interface"); return Collections.emptyList(); } Optional<Long> inPort = classifierInterface.getInPort(itfName.get(), nodeName.get()); if (!inPort.isPresent()) { LOG.error("processClassifier - port is null; returning empty list"); return Collections.emptyList(); } return theAcl .getAccessListEntries() .getAce() .stream() .map(theAce -> processAce(theRsp, nodeName.get(), theClassifier.getName(), theAcl.getAclName(), inPort.get(), theAce)) .reduce(new ArrayList<>(), (dstList, theList) -> Stream.concat(dstList.stream(), theList.stream()).collect(Collectors.toList())); } private  ClassifierRspUpdateProcessor();  ClassifierRspUpdateProcessor(LogicallyAttachedClassifier theClassifierInterface); List<FlowDetails> processClassifier(
            final SclServiceFunctionForwarder theClassifier,
            final Acl theAcl,
            final RenderedServicePath theRsp);  }
@Test public void updateClassifierOK() { List<FlowDetails> flowList = theUpdateProcessor.processClassifier(sffClassifier, acl, newRsp); Assert.assertFalse(flowList.isEmpty()); Assert.assertEquals(2, flowList.size()); }
@Test public void updateClassifierInvalidACL() { when(accessListEntries.getAce()).thenReturn(Collections.emptyList()); List<FlowDetails> flowList = theUpdateProcessor.processClassifier(sffClassifier, acl, newRsp); Assert.assertTrue(flowList.isEmpty()); }
@Test public void updateClassifierInvalidClassifier() { when(sffClassifier.getAttachmentPointType()).thenReturn(null); List<FlowDetails> flowList = theUpdateProcessor.processClassifier(sffClassifier, acl, newRsp); Assert.assertTrue(flowList.isEmpty()); }
@Test public void updateClassifierWrongAttachmentType() { when(sffClassifier.getAttachmentPointType()).thenReturn(new BridgeBuilder().build()); List<FlowDetails> flowList = theUpdateProcessor.processClassifier(sffClassifier, acl, newRsp); Assert.assertTrue(flowList.isEmpty()); }