SfcProviderRenderedPathAPI { protected static List<RenderedServicePathHop> createRenderedServicePathHopList(List<SfName> serviceFunctionNameList, List<String> sfgNameList, int serviceIndex) { List<RenderedServicePathHop> renderedServicePathHopArrayList = new ArrayList<>(); RenderedServicePathHopBuilder renderedServicePathHopBuilder = new RenderedServicePathHopBuilder(); short posIndex = 0; if (serviceFunctionNameList == null && sfgNameList == null) { LOG.error("Could not create the hop list caused by empty name list"); return null; } if (sfgNameList != null) { for (String sfgName : sfgNameList) { ServiceFunctionGroup sfg = SfcProviderServiceFunctionGroupAPI.readServiceFunctionGroup(sfgName); if (sfg == null) { LOG.error("Could not find suitable SFG in data store by name: {}", sfgName); renderedServicePathHopArrayList.clear(); break; } ServiceFunction serviceFunction = SfcProviderServiceFunctionAPI .readServiceFunction(new SfName(sfg.getSfcServiceFunction().get(0).getName())); if (serviceFunction == null) { LOG.error("Could not find suitable SF in data store by name: {}", sfg.getSfcServiceFunction().get(0).getName()); renderedServicePathHopArrayList.clear(); break; } createSFGHopBuilder(serviceIndex, renderedServicePathHopBuilder, posIndex, sfg.getName(), serviceFunction); renderedServicePathHopArrayList.add(posIndex, renderedServicePathHopBuilder.build()); serviceIndex--; posIndex++; } } else { for (SfName serviceFunctionName : serviceFunctionNameList) { ServiceFunction serviceFunction = SfcProviderServiceFunctionAPI.readServiceFunction(serviceFunctionName); if (serviceFunction == null) { LOG.error("Could not find suitable SF in data store by name: {}", serviceFunctionName); return null; } createSFHopBuilder(serviceIndex, renderedServicePathHopBuilder, posIndex, serviceFunctionName, serviceFunction); renderedServicePathHopArrayList.add(posIndex, renderedServicePathHopBuilder.build()); serviceIndex--; posIndex++; } } return renderedServicePathHopArrayList; }  static RenderedServicePath createRenderedServicePathAndState(ServiceFunctionPath createdServiceFunctionPath,
            CreateRenderedPathInput createRenderedPathInput, SfcServiceFunctionSchedulerAPI scheduler); static RenderedServicePath createRenderedServicePathAndState(ServiceFunctionPath createdServiceFunctionPath,
            CreateRenderedPathInput createRenderedPathInput); static RenderedServicePath createSymmetricRenderedServicePathAndState(
            RenderedServicePath renderedServicePath); static RenderedServicePath createReverseRenderedServicePathEntry(RenderedServicePath renderedServicePath); static RspName generateReversedPathName(RspName rspName); static RspName getReversedRspName(RspName rspName); static RenderedServicePath readRenderedServicePath(RspName rspName); static boolean deleteRenderedServicePaths(List<RspName> servicePaths); static boolean deleteRenderedServicePathsAndStates(List<RspName> rspNames); static boolean deleteRenderedServicePath(RspName renderedServicePathName); static RenderedServicePathFirstHop readRenderedServicePathFirstHop(RspName rspName); static RenderedServicePathFirstHop readRspFirstHopBySftList(
            Class<? extends ServiceFunctionSchedulerTypeIdentity> serviceFunctionSchedulerType,
            List<SftTypeName> serviceFunctionTypeList); static boolean setSymmetricPathId(RenderedServicePath renderedServicePath, long pathId); static boolean isChainSymmetric(ServiceFunctionPath sfp, RenderedServicePath rsp); static String createRenderedIoamPath(String sysName); static boolean deleteRenderedIoamPath(String renderedIoamPathName);  }
@SuppressWarnings(value = {"serial", "static-access"}) @Test public void testCreateRenderedServicePathHopList() { init(); List<SfName> sfNameList = new ArrayList<SfName>() { { add(new SfName("unittest-fw-1")); add(new SfName("unittest-dpi-1")); add(new SfName("unittest-napt-1")); } }; final int startingIndex = 255; SfcProviderRenderedPathAPI sfcProviderRenderedPathAPI = new SfcProviderRenderedPathAPI(); List<RenderedServicePathHop> rspHopList; rspHopList = sfcProviderRenderedPathAPI.createRenderedServicePathHopList(null, null, startingIndex); assertNull("Must be null", rspHopList); rspHopList = sfcProviderRenderedPathAPI.createRenderedServicePathHopList(sfNameList, null, startingIndex); assertEquals("Size must be equal", sfNameList.size(), rspHopList.size()); assertEquals("SI must be equal", rspHopList.get(0).getServiceIndex().intValue(), startingIndex); assertEquals("SF name must be equal", rspHopList.get(0).getServiceFunctionName(), sfNameList.get(0)); assertEquals("SI must be equal", rspHopList.get(1).getServiceIndex().intValue(), startingIndex - 1); assertEquals("SF name must be equal", rspHopList.get(1).getServiceFunctionName(), sfNameList.get(1)); assertEquals("SI must be equal", rspHopList.get(2).getServiceIndex().intValue(), startingIndex - 2); assertEquals("SF name must be equal", rspHopList.get(2).getServiceFunctionName(), sfNameList.get(2)); sfNameList = new ArrayList<SfName>() { { add(new SfName("unittest-fw-1")); add(new SfName("unittest-blabla-1")); add(new SfName("unittest-napt-1")); } }; rspHopList = sfcProviderRenderedPathAPI.createRenderedServicePathHopList(sfNameList, null, startingIndex); assertNull("Must be null", rspHopList); }