@Test public void testOnServiceFunctionUpdated() throws Exception { String UPDATED_IP_MGMT_ADDRESS = "196.168.55.102"; ServiceFunction originalServiceFunction = build_service_function(); assertTrue(SfcProviderServiceFunctionAPI.putServiceFunction(originalServiceFunction)); ServiceFunctionBuilder updatedServiceFunctionBuilder = new ServiceFunctionBuilder(originalServiceFunction); IpAddress updatedIpMgmtAddress = new IpAddress(new Ipv4Address(UPDATED_IP_MGMT_ADDRESS)); SftTypeName updatedType = new SftTypeName("dpi"); updatedServiceFunctionBuilder.setIpMgmtAddress(updatedIpMgmtAddress).setType(updatedType); ServiceFunction updatedServiceFunction = updatedServiceFunctionBuilder.build(); when(dataTreeModification.getRootNode()).thenReturn(dataObjectModification); when(dataObjectModification.getModificationType()).thenReturn(ModificationType.SUBTREE_MODIFIED); when(dataObjectModification.getDataBefore()).thenReturn(originalServiceFunction); when(dataObjectModification.getDataAfter()).thenReturn(updatedServiceFunction); collection.add(dataTreeModification); serviceFunctionListener.onDataTreeChanged(collection); Thread.sleep(500); assertNull(SfcProviderServiceTypeAPI.readServiceFunctionTypeEntry(originalServiceFunction)); assertNotNull(SfcProviderServiceTypeAPI.readServiceFunctionTypeEntry(updatedServiceFunction)); assertTrue(SfcProviderServiceTypeAPI.deleteServiceFunctionTypeEntry(updatedServiceFunction)); Thread.sleep(500); assertNull(SfcProviderServiceTypeAPI.readServiceFunctionTypeEntry(originalServiceFunction)); }
@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);  }