SfcGeniusBoundServiceWriter { public CompletableFuture<Void> bindService(String interfaceName) { return new GeniusServiceBinder() .bindService(transaction, interfaceName, NwConstants.SFC_SERVICE_INDEX, NwConstants.SFC_TRANSPORT_INGRESS_TABLE, SfcGeniusConstants.COOKIE_SFC_INGRESS_TABLE, SfcGeniusConstants.SFC_SERVICE_PRIORITY, NwConstants.SFC_SERVICE_NAME); } SfcGeniusBoundServiceWriter(WriteTransaction transaction); CompletableFuture<Void> bindService(String interfaceName); CompletableFuture<Void> unbindService(String interfaceName);  }
@Test public void bindService() throws Exception { CompletableFuture<Void> future = writer.bindService("IF1"); verify(writeTransaction).put( eq(LogicalDatastoreType.CONFIGURATION), instanceIdentifierCaptor.capture(), boundServicesCaptor.capture()); assertThat(future.isDone(), is(true)); assertThat(future.isCompletedExceptionally(), is(false)); assertThat(future.isCancelled(), is(false)); InstanceIdentifier<BoundServices> iid = instanceIdentifierCaptor.getValue(); assertThat(iid.firstKeyOf(ServicesInfo.class), is(new ServicesInfoKey("IF1", ServiceModeIngress.class))); assertThat(iid.firstKeyOf(BoundServices.class), is(new BoundServicesKey(NwConstants.SFC_SERVICE_INDEX))); BoundServices boundServices = boundServicesCaptor.getValue(); assertThat(boundServices.getServiceName(), is(NwConstants.SFC_SERVICE_NAME)); assertThat(boundServices.getServicePriority(), is(NwConstants.SFC_SERVICE_INDEX)); assertThat(boundServices.getServiceType(), is(equalTo(ServiceTypeFlowBased.class))); StypeOpenflow stypeOpenflow = boundServices.getAugmentation(StypeOpenflow.class); assertThat(stypeOpenflow.getFlowCookie(), is(SfcGeniusConstants.COOKIE_SFC_INGRESS_TABLE)); assertThat(stypeOpenflow.getFlowPriority(), is(SfcGeniusConstants.SFC_SERVICE_PRIORITY)); assertThat(stypeOpenflow.getInstruction().size(), is(1)); Instruction instruction = stypeOpenflow.getInstruction().get(0); assertThat(instruction.getInstruction(), is(instanceOf(GoToTableCase.class))); GoToTableCase goToTable = (GoToTableCase) instruction.getInstruction(); assertThat(goToTable.getGoToTable().getTableId(), is(NwConstants.SFC_TRANSPORT_INGRESS_TABLE)); }