SfcProviderServicePathAPI { public static List<SfpRenderedServicePath> readServicePathState(SfpName servicePathName) { printTraceStart(LOG); InstanceIdentifier<ServiceFunctionPathState> sfpIID; List<SfpRenderedServicePath> ret = null; ServiceFunctionPathStateKey serviceFunctionPathStateKey = new ServiceFunctionPathStateKey(servicePathName); sfpIID = InstanceIdentifier.builder(ServiceFunctionPathsState.class) .child(ServiceFunctionPathState.class, serviceFunctionPathStateKey) .build(); ServiceFunctionPathState serviceFunctionPathState = SfcDataStoreAPI.readTransactionAPI(sfpIID, LogicalDatastoreType.OPERATIONAL); if (serviceFunctionPathState != null) { ret = serviceFunctionPathState.getSfpRenderedServicePath(); } printTraceStop(LOG); return ret; }  static List<SfpRenderedServicePath> readServicePathState(SfpName servicePathName); static boolean addRenderedPathToServicePathState(SfpName servicePathName, RspName renderedPathName); static ServiceFunctionPath readServiceFunctionPath(SfpName serviceFunctionPathName); static ServiceFunctionPaths readAllServiceFunctionPaths(); static boolean putServiceFunctionPath(ServiceFunctionPath sfp);  }
@Test public void testReadAndDeleteServicePathState() { SfpName sfpKey = new SfpName("sfpKey"); RspName rspKey = new RspName("rspKey"); List<SfpRenderedServicePath> renderedServicePaths = new ArrayList<>(); SfpRenderedServicePathBuilder sfpRenderedServicePathBuilder = new SfpRenderedServicePathBuilder(); sfpRenderedServicePathBuilder.setKey(new SfpRenderedServicePathKey(rspKey)); renderedServicePaths.add(sfpRenderedServicePathBuilder.build()); ServiceFunctionPathStateBuilder serviceFunctionPathStateBuilder = new ServiceFunctionPathStateBuilder(); serviceFunctionPathStateBuilder.setKey(new ServiceFunctionPathStateKey(sfpKey)) .setSfpRenderedServicePath(renderedServicePaths); InstanceIdentifier<ServiceFunctionPathState> sfpIID = InstanceIdentifier.builder(ServiceFunctionPathsState.class) .child(ServiceFunctionPathState.class, new ServiceFunctionPathStateKey(sfpKey)) .build(); boolean transactionSuccessful = SfcDataStoreAPI.writePutTransactionAPI(sfpIID, serviceFunctionPathStateBuilder.build(), LogicalDatastoreType.OPERATIONAL); assertTrue("Must be true", transactionSuccessful); List<SfpRenderedServicePath> sfpList = SfcProviderServicePathAPI.readServicePathState(sfpKey); assertNotNull("Must not be null", sfpList); assertEquals("Must be equal", sfpList.get(0).getName(), rspKey); transactionSuccessful = SfcDataStoreAPI.deleteTransactionAPI(sfpIID, LogicalDatastoreType.OPERATIONAL); assertTrue("Must be true", transactionSuccessful); sfpList = SfcProviderServicePathAPI.readServicePathState(sfpKey); assertNull("Must be null", sfpList); }