SfcProviderRpc implements ServiceFunctionService, ServiceFunctionChainService, RenderedServicePathService,
        ServicePathIdService, RenderedIoamPathService { @Override public Future<RpcResult<Void>> putServiceFunction(PutServiceFunctionInput input) { printTraceStart(LOG); LOG.info("\n####### Input: " + input); if (dataBroker == null) { return Futures.immediateFuture( RpcResultBuilder.<Void>failed().withError(ErrorType.APPLICATION, "No data provider.").build()); } List<SfDataPlaneLocator> sfDataPlaneLocatorList = input.getSfDataPlaneLocator(); ServiceFunctionBuilder sfbuilder = new ServiceFunctionBuilder(); ServiceFunctionKey sfkey = new ServiceFunctionKey(input.getName()); ServiceFunction sf = sfbuilder.setName(input.getName()) .setType(input.getType()) .setKey(sfkey) .setIpMgmtAddress(input.getIpMgmtAddress()) .setSfDataPlaneLocator(sfDataPlaneLocatorList) .build(); InstanceIdentifier<ServiceFunction> sfEntryIID = InstanceIdentifier.builder(ServiceFunctions.class).child(ServiceFunction.class, sf.getKey()).build(); WriteTransaction writeTx = dataBroker.newWriteOnlyTransaction(); writeTx.merge(LogicalDatastoreType.CONFIGURATION, sfEntryIID, sf, true); printTraceStop(LOG); return Futures.transform(writeTx.submit(), (Function<Void, RpcResult<Void>>) input1 -> RpcResultBuilder.<Void>success().build()); }  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);  }
@Test public void putAndReadServiceFunctionTest() throws Exception { PutServiceFunctionInput putSfInput1 = createPutServiceFunctionInput(new SfName("sfName1"), new SftTypeName("firewall"), "192.168.50.80", "192.168.50.85", 6644, new SfDataPlaneLocatorName("dpLocatorKey1")); createPutServiceFunctionInput(new SfName("sfName2"), new SftTypeName("dpi"), "192.168.50.90", "192.168.50.95", 6655, new SfDataPlaneLocatorName("dpLocatorKey2")); assertServiceFunctionDoesNotExist(putSfInput1.getName()); putServiceFunction(putSfInput1); readAndAssertServiceFunction(putSfInput1); }