@Test public void createSymmetricRenderedPathTest() throws Exception { initWithTypes(true); ServiceFunctionPath sfp = SfcProviderServicePathAPI.readServiceFunctionPath(pathNames.get(0)); assertTrue("Must be true", createServiceFunctionPath(pathNames.get(0), SFC_NAME, null)); sfp = SfcProviderServicePathAPI.readServiceFunctionPath(pathNames.get(0)); assertNotNull("SFP cant be null", sfp); CreateRenderedPathInputBuilder createRenderedPathInputBuilder = new CreateRenderedPathInputBuilder(); createRenderedPathInputBuilder.setName(RSP_NAME.getValue()) .setParentServiceFunctionPath(pathNames.get(0).getValue()); CreateRenderedPathInput createRenderedPathInput = createRenderedPathInputBuilder.build(); Future<RpcResult<CreateRenderedPathOutput>> futureTask = sfcProviderRpc.createRenderedPath(createRenderedPathInput); RpcResult<CreateRenderedPathOutput> rpcResult = null; try { rpcResult = futureTask.get(); assertTrue("Must be true", rpcResult.isSuccessful()); } catch (InterruptedException | ExecutionException e) { LOG.warn("failed to ....", e); } RenderedServicePath createdRsp = null; if (rpcResult != null) { createdRsp = SfcProviderRenderedPathAPI.readRenderedServicePath(new RspName(rpcResult.getResult().getName())); } assertNotNull("Must not be null", createdRsp); assertNotNull("RSP is symmetric", createdRsp.getSymmetricPathId()); }
@Override public Future<RpcResult<CreateRenderedPathOutput>> createRenderedPath( CreateRenderedPathInput createRenderedPathInput) { ServiceFunctionPath createdServiceFunctionPath; RenderedServicePath renderedServicePath; RenderedServicePath revRenderedServicePath; CreateRenderedPathOutputBuilder createRenderedPathOutputBuilder = new CreateRenderedPathOutputBuilder(); RpcResult<CreateRenderedPathOutput> rpcResult; RspName retRspName = null; createdServiceFunctionPath = SfcProviderServicePathAPI .readServiceFunctionPath(new SfpName(createRenderedPathInput.getParentServiceFunctionPath())); if (createdServiceFunctionPath != null) { renderedServicePath = SfcProviderRenderedPathAPI .createRenderedServicePathAndState(createdServiceFunctionPath, createRenderedPathInput); if (renderedServicePath != null) { retRspName = renderedServicePath.getName(); createRenderedPathOutputBuilder.setName(retRspName.getValue()); rpcResult = RpcResultBuilder.success(createRenderedPathOutputBuilder.build()).build(); if (SfcProviderRenderedPathAPI.isChainSymmetric(createdServiceFunctionPath, renderedServicePath)) { revRenderedServicePath = SfcProviderRenderedPathAPI.createSymmetricRenderedServicePathAndState(renderedServicePath); if (revRenderedServicePath == null) { LOG.error("Failed to create symmetric service path: {}"); } else { SfcProviderRenderedPathAPI.setSymmetricPathId(renderedServicePath, revRenderedServicePath.getPathId()); } } } else { rpcResult = RpcResultBuilder.<CreateRenderedPathOutput>failed() .withError(ErrorType.APPLICATION, "Failed to create RSP") .build(); } } else { rpcResult = RpcResultBuilder.<CreateRenderedPathOutput>failed() .withError(ErrorType.APPLICATION, "Service Function Path does not exist") .build(); } return Futures.immediateFuture(rpcResult); }
SfcProviderRpc implements ServiceFunctionService, ServiceFunctionChainService, RenderedServicePathService,
        ServicePathIdService, RenderedIoamPathService { @Override public Future<RpcResult<CreateRenderedPathOutput>> createRenderedPath( CreateRenderedPathInput createRenderedPathInput) { ServiceFunctionPath createdServiceFunctionPath; RenderedServicePath renderedServicePath; RenderedServicePath revRenderedServicePath; CreateRenderedPathOutputBuilder createRenderedPathOutputBuilder = new CreateRenderedPathOutputBuilder(); RpcResult<CreateRenderedPathOutput> rpcResult; RspName retRspName = null; createdServiceFunctionPath = SfcProviderServicePathAPI .readServiceFunctionPath(new SfpName(createRenderedPathInput.getParentServiceFunctionPath())); if (createdServiceFunctionPath != null) { renderedServicePath = SfcProviderRenderedPathAPI .createRenderedServicePathAndState(createdServiceFunctionPath, createRenderedPathInput); if (renderedServicePath != null) { retRspName = renderedServicePath.getName(); createRenderedPathOutputBuilder.setName(retRspName.getValue()); rpcResult = RpcResultBuilder.success(createRenderedPathOutputBuilder.build()).build(); if (SfcProviderRenderedPathAPI.isChainSymmetric(createdServiceFunctionPath, renderedServicePath)) { revRenderedServicePath = SfcProviderRenderedPathAPI.createSymmetricRenderedServicePathAndState(renderedServicePath); if (revRenderedServicePath == null) { LOG.error("Failed to create symmetric service path: {}"); } else { SfcProviderRenderedPathAPI.setSymmetricPathId(renderedServicePath, revRenderedServicePath.getPathId()); } } } else { rpcResult = RpcResultBuilder.<CreateRenderedPathOutput>failed() .withError(ErrorType.APPLICATION, "Failed to create RSP") .build(); } } else { rpcResult = RpcResultBuilder.<CreateRenderedPathOutput>failed() .withError(ErrorType.APPLICATION, "Service Function Path does not exist") .build(); } return Futures.immediateFuture(rpcResult); } }
SfcProviderRpc implements ServiceFunctionService, ServiceFunctionChainService, RenderedServicePathService,
        ServicePathIdService, RenderedIoamPathService { @Override public Future<RpcResult<CreateRenderedPathOutput>> createRenderedPath( CreateRenderedPathInput createRenderedPathInput) { ServiceFunctionPath createdServiceFunctionPath; RenderedServicePath renderedServicePath; RenderedServicePath revRenderedServicePath; CreateRenderedPathOutputBuilder createRenderedPathOutputBuilder = new CreateRenderedPathOutputBuilder(); RpcResult<CreateRenderedPathOutput> rpcResult; RspName retRspName = null; createdServiceFunctionPath = SfcProviderServicePathAPI .readServiceFunctionPath(new SfpName(createRenderedPathInput.getParentServiceFunctionPath())); if (createdServiceFunctionPath != null) { renderedServicePath = SfcProviderRenderedPathAPI .createRenderedServicePathAndState(createdServiceFunctionPath, createRenderedPathInput); if (renderedServicePath != null) { retRspName = renderedServicePath.getName(); createRenderedPathOutputBuilder.setName(retRspName.getValue()); rpcResult = RpcResultBuilder.success(createRenderedPathOutputBuilder.build()).build(); if (SfcProviderRenderedPathAPI.isChainSymmetric(createdServiceFunctionPath, renderedServicePath)) { revRenderedServicePath = SfcProviderRenderedPathAPI.createSymmetricRenderedServicePathAndState(renderedServicePath); if (revRenderedServicePath == null) { LOG.error("Failed to create symmetric service path: {}"); } else { SfcProviderRenderedPathAPI.setSymmetricPathId(renderedServicePath, revRenderedServicePath.getPathId()); } } } else { rpcResult = RpcResultBuilder.<CreateRenderedPathOutput>failed() .withError(ErrorType.APPLICATION, "Failed to create RSP") .build(); } } else { rpcResult = RpcResultBuilder.<CreateRenderedPathOutput>failed() .withError(ErrorType.APPLICATION, "Service Function Path does not exist") .build(); } return Futures.immediateFuture(rpcResult); }  }
SfcProviderRpc implements ServiceFunctionService, ServiceFunctionChainService, RenderedServicePathService,
        ServicePathIdService, RenderedIoamPathService { @Override public Future<RpcResult<CreateRenderedPathOutput>> createRenderedPath( CreateRenderedPathInput createRenderedPathInput) { ServiceFunctionPath createdServiceFunctionPath; RenderedServicePath renderedServicePath; RenderedServicePath revRenderedServicePath; CreateRenderedPathOutputBuilder createRenderedPathOutputBuilder = new CreateRenderedPathOutputBuilder(); RpcResult<CreateRenderedPathOutput> rpcResult; RspName retRspName = null; createdServiceFunctionPath = SfcProviderServicePathAPI .readServiceFunctionPath(new SfpName(createRenderedPathInput.getParentServiceFunctionPath())); if (createdServiceFunctionPath != null) { renderedServicePath = SfcProviderRenderedPathAPI .createRenderedServicePathAndState(createdServiceFunctionPath, createRenderedPathInput); if (renderedServicePath != null) { retRspName = renderedServicePath.getName(); createRenderedPathOutputBuilder.setName(retRspName.getValue()); rpcResult = RpcResultBuilder.success(createRenderedPathOutputBuilder.build()).build(); if (SfcProviderRenderedPathAPI.isChainSymmetric(createdServiceFunctionPath, renderedServicePath)) { revRenderedServicePath = SfcProviderRenderedPathAPI.createSymmetricRenderedServicePathAndState(renderedServicePath); if (revRenderedServicePath == null) { LOG.error("Failed to create symmetric service path: {}"); } else { SfcProviderRenderedPathAPI.setSymmetricPathId(renderedServicePath, revRenderedServicePath.getPathId()); } } } else { rpcResult = RpcResultBuilder.<CreateRenderedPathOutput>failed() .withError(ErrorType.APPLICATION, "Failed to create RSP") .build(); } } else { rpcResult = RpcResultBuilder.<CreateRenderedPathOutput>failed() .withError(ErrorType.APPLICATION, "Service Function Path does not exist") .build(); } return Futures.immediateFuture(rpcResult); }  static SfcProviderRpc getSfcProviderRpc(); void setDataProvider(DataBroker r); static void setDataProviderAux(DataBroker r); @Override Future<RpcResult<Void>> deleteAllServiceFunction(); @Override Future<RpcResult<Void>> deleteServiceFunction(DeleteServiceFunctionInput input); @Override Future<RpcResult<Void>> putServiceFunction(PutServiceFunctionInput input); @Override Future<RpcResult<ReadServiceFunctionOutput>> readServiceFunction(ReadServiceFunctionInput input); @Override Future<RpcResult<InstantiateServiceFunctionChainOutput>> instantiateServiceFunctionChain(
            InstantiateServiceFunctionChainInput input); @Override Future<RpcResult<Void>> putServiceFunctionChains(PutServiceFunctionChainsInput input); @Override Future<RpcResult<CreateRenderedPathOutput>> createRenderedPath(
            CreateRenderedPathInput createRenderedPathInput); @Override Future<RpcResult<DeleteRenderedPathOutput>> deleteRenderedPath(DeleteRenderedPathInput input); @Override Future<RpcResult<ReadRenderedServicePathFirstHopOutput>> readRenderedServicePathFirstHop(
            ReadRenderedServicePathFirstHopInput input); @Override Future<RpcResult<ReadRspFirstHopBySftListOutput>> readRspFirstHopBySftList(
            ReadRspFirstHopBySftListInput input); @Override Future<RpcResult<TraceRenderedServicePathOutput>> traceRenderedServicePath(
            TraceRenderedServicePathInput input); @Override Future<RpcResult<ReservePathIdRangeOutput>> reservePathIdRange(ReservePathIdRangeInput input); @Override Future<RpcResult<ReadPathIdOutput>> readPathId(ReadPathIdInput input); @Override Future<RpcResult<AllocatePathIdOutput>> allocatePathId(AllocatePathIdInput input); @Override Future<RpcResult<DeletePathIdOutput>> deletePathId(DeletePathIdInput input); @Override Future<RpcResult<SetGenerationAlgorithmOutput>> setGenerationAlgorithm(SetGenerationAlgorithmInput input); @Override Future<RpcResult<CreateIoamPathOutput>> createIoamPath(final CreateIoamPathInput input); @Override Future<RpcResult<DeleteIoamPathOutput>> deleteIoamPath(DeleteIoamPathInput input); }
SfcProviderRpc implements ServiceFunctionService, ServiceFunctionChainService, RenderedServicePathService,
        ServicePathIdService, RenderedIoamPathService { @Override public Future<RpcResult<CreateRenderedPathOutput>> createRenderedPath( CreateRenderedPathInput createRenderedPathInput) { ServiceFunctionPath createdServiceFunctionPath; RenderedServicePath renderedServicePath; RenderedServicePath revRenderedServicePath; CreateRenderedPathOutputBuilder createRenderedPathOutputBuilder = new CreateRenderedPathOutputBuilder(); RpcResult<CreateRenderedPathOutput> rpcResult; RspName retRspName = null; createdServiceFunctionPath = SfcProviderServicePathAPI .readServiceFunctionPath(new SfpName(createRenderedPathInput.getParentServiceFunctionPath())); if (createdServiceFunctionPath != null) { renderedServicePath = SfcProviderRenderedPathAPI .createRenderedServicePathAndState(createdServiceFunctionPath, createRenderedPathInput); if (renderedServicePath != null) { retRspName = renderedServicePath.getName(); createRenderedPathOutputBuilder.setName(retRspName.getValue()); rpcResult = RpcResultBuilder.success(createRenderedPathOutputBuilder.build()).build(); if (SfcProviderRenderedPathAPI.isChainSymmetric(createdServiceFunctionPath, renderedServicePath)) { revRenderedServicePath = SfcProviderRenderedPathAPI.createSymmetricRenderedServicePathAndState(renderedServicePath); if (revRenderedServicePath == null) { LOG.error("Failed to create symmetric service path: {}"); } else { SfcProviderRenderedPathAPI.setSymmetricPathId(renderedServicePath, revRenderedServicePath.getPathId()); } } } else { rpcResult = RpcResultBuilder.<CreateRenderedPathOutput>failed() .withError(ErrorType.APPLICATION, "Failed to create RSP") .build(); } } else { rpcResult = RpcResultBuilder.<CreateRenderedPathOutput>failed() .withError(ErrorType.APPLICATION, "Service Function Path does not exist") .build(); } return Futures.immediateFuture(rpcResult); }  static SfcProviderRpc getSfcProviderRpc(); void setDataProvider(DataBroker r); static void setDataProviderAux(DataBroker r); @Override Future<RpcResult<Void>> deleteAllServiceFunction(); @Override Future<RpcResult<Void>> deleteServiceFunction(DeleteServiceFunctionInput input); @Override Future<RpcResult<Void>> putServiceFunction(PutServiceFunctionInput input); @Override Future<RpcResult<ReadServiceFunctionOutput>> readServiceFunction(ReadServiceFunctionInput input); @Override Future<RpcResult<InstantiateServiceFunctionChainOutput>> instantiateServiceFunctionChain(
            InstantiateServiceFunctionChainInput input); @Override Future<RpcResult<Void>> putServiceFunctionChains(PutServiceFunctionChainsInput input); @Override Future<RpcResult<CreateRenderedPathOutput>> createRenderedPath(
            CreateRenderedPathInput createRenderedPathInput); @Override Future<RpcResult<DeleteRenderedPathOutput>> deleteRenderedPath(DeleteRenderedPathInput input); @Override Future<RpcResult<ReadRenderedServicePathFirstHopOutput>> readRenderedServicePathFirstHop(
            ReadRenderedServicePathFirstHopInput input); @Override Future<RpcResult<ReadRspFirstHopBySftListOutput>> readRspFirstHopBySftList(
            ReadRspFirstHopBySftListInput input); @Override Future<RpcResult<TraceRenderedServicePathOutput>> traceRenderedServicePath(
            TraceRenderedServicePathInput input); @Override Future<RpcResult<ReservePathIdRangeOutput>> reservePathIdRange(ReservePathIdRangeInput input); @Override Future<RpcResult<ReadPathIdOutput>> readPathId(ReadPathIdInput input); @Override Future<RpcResult<AllocatePathIdOutput>> allocatePathId(AllocatePathIdInput input); @Override Future<RpcResult<DeletePathIdOutput>> deletePathId(DeletePathIdInput input); @Override Future<RpcResult<SetGenerationAlgorithmOutput>> setGenerationAlgorithm(SetGenerationAlgorithmInput input); @Override Future<RpcResult<CreateIoamPathOutput>> createIoamPath(final CreateIoamPathInput input); @Override Future<RpcResult<DeleteIoamPathOutput>> deleteIoamPath(DeleteIoamPathInput input);  }