@Test public void testOnServiceFunctionRemovedWithRSP() throws Exception { RenderedServicePath renderedServicePath = build_and_commit_rendered_service_path(); assertNotNull(renderedServicePath); SfName sfName = renderedServicePath.getRenderedServicePathHop().get(0).getServiceFunctionName(); ServiceFunction serviceFunction = SfcProviderServiceFunctionAPI.readServiceFunction(sfName); assertNotNull(serviceFunction); when(dataTreeModification.getRootNode()).thenReturn(dataObjectModification); when(dataObjectModification.getModificationType()).thenReturn(ModificationType.DELETE); when(dataObjectModification.getDataBefore()).thenReturn(serviceFunction); collection.add(dataTreeModification); serviceFunctionListener.onDataTreeChanged(collection); Thread.sleep(500); assertNull(SfcProviderRenderedPathAPI.readRenderedServicePath(renderedServicePath.getName())); List<RspName> rspNameList = SfcProviderServiceFunctionAPI.getRspsBySfName(serviceFunction.getName()); if (rspNameList != null) { for (RspName rspName : rspNameList) { assertNotEquals(rspName, renderedServicePath.getName()); } } assertTrue(SfcDataStoreAPI.deleteTransactionAPI(SfcInstanceIdentifiers.SFC_IID, LogicalDatastoreType.CONFIGURATION)); assertTrue(SfcDataStoreAPI.deleteTransactionAPI(SfcInstanceIdentifiers.SFF_IID, LogicalDatastoreType.CONFIGURATION)); assertTrue(SfcDataStoreAPI.deleteTransactionAPI(SfcInstanceIdentifiers.SFP_IID, LogicalDatastoreType.CONFIGURATION)); }
@Override public void add(ServiceFunction serviceFunction) { if (serviceFunction != null) { LOG.debug("Adding Service Function: {}", serviceFunction.getName()); if (!SfcProviderServiceTypeAPI.createServiceFunctionTypeEntry(serviceFunction)) { LOG.error("Failed to create Service Function: ", serviceFunction.getName()); } } }
ServiceFunctionListener extends AbstractDataTreeChangeListener<ServiceFunction> { @Override public void add(ServiceFunction serviceFunction) { if (serviceFunction != null) { LOG.debug("Adding Service Function: {}", serviceFunction.getName()); if (!SfcProviderServiceTypeAPI.createServiceFunctionTypeEntry(serviceFunction)) { LOG.error("Failed to create Service Function: ", serviceFunction.getName()); } } } }
ServiceFunctionListener extends AbstractDataTreeChangeListener<ServiceFunction> { @Override public void add(ServiceFunction serviceFunction) { if (serviceFunction != null) { LOG.debug("Adding Service Function: {}", serviceFunction.getName()); if (!SfcProviderServiceTypeAPI.createServiceFunctionTypeEntry(serviceFunction)) { LOG.error("Failed to create Service Function: ", serviceFunction.getName()); } } } ServiceFunctionListener(final DataBroker dataBroker); }
ServiceFunctionListener extends AbstractDataTreeChangeListener<ServiceFunction> { @Override public void add(ServiceFunction serviceFunction) { if (serviceFunction != null) { LOG.debug("Adding Service Function: {}", serviceFunction.getName()); if (!SfcProviderServiceTypeAPI.createServiceFunctionTypeEntry(serviceFunction)) { LOG.error("Failed to create Service Function: ", serviceFunction.getName()); } } } ServiceFunctionListener(final DataBroker dataBroker); void init(); @Override void close(); @Override void add(ServiceFunction serviceFunction); @Override void remove(ServiceFunction serviceFunction); }
ServiceFunctionListener extends AbstractDataTreeChangeListener<ServiceFunction> { @Override public void add(ServiceFunction serviceFunction) { if (serviceFunction != null) { LOG.debug("Adding Service Function: {}", serviceFunction.getName()); if (!SfcProviderServiceTypeAPI.createServiceFunctionTypeEntry(serviceFunction)) { LOG.error("Failed to create Service Function: ", serviceFunction.getName()); } } } ServiceFunctionListener(final DataBroker dataBroker); void init(); @Override void close(); @Override void add(ServiceFunction serviceFunction); @Override void remove(ServiceFunction serviceFunction);  }