SfcGeniusSfReader extends SfcGeniusReaderAbstract { public CompletableFuture<List<String>> readInterfacesOfSf(SfName sfName) { InstanceIdentifier<ServiceFunction> sfID = InstanceIdentifier.builder(ServiceFunctions.class) .child(ServiceFunction.class, new ServiceFunctionKey(sfName)).build(); return doRead(LogicalDatastoreType.CONFIGURATION, sfID) .thenApply(SfcGeniusSfReader::getInterfacesOfServiceFunction); } SfcGeniusSfReader(ReadTransaction readTransaction, Executor executor); CompletableFuture<List<SfName>> readSfOnInterface(String interfaceName); CompletableFuture<List<String>> readInterfacesOfSf(SfName sfName);  }
@Test public void readInterfacesOfSf() throws Exception { SfName sfName = new SfName("SF5"); InstanceIdentifier<ServiceFunction> iid = InstanceIdentifier.builder(ServiceFunctions.class) .child(ServiceFunction.class, new ServiceFunctionKey(sfName)) .build(); doReturn(CompletableFuture.completedFuture(serviceFunctions.getServiceFunction().stream().filter( serviceFunction -> serviceFunction.getName().equals(sfName)).findFirst().get())) .when(reader) .doRead(LogicalDatastoreType.CONFIGURATION, iid); List<String> ifNames = reader.readInterfacesOfSf(sfName).get(); assertThat(ifNames, containsInAnyOrder("IFA", "IFB")); assertThat(ifNames.size(), is(2)); }