@Test public void testDeleteNotExistingBindingOrigin() throws Exception { final DeleteBindingOriginInput input = new DeleteBindingOriginInputBuilder() .setOrigin(new OriginType("CLUSTER")) .build(); final RpcResult<DeleteBindingOriginOutput> result = service.deleteBindingOrigin(input).get(); assertFalse(result.getResult().isResult()); }
@Override public ListenableFuture<RpcResult<DeleteBindingOriginOutput>> deleteBindingOrigin(DeleteBindingOriginInput input) { final DeleteBindingOriginOutputBuilder output = new DeleteBindingOriginOutputBuilder().setResult(false); return executor.submit(() -> { LOG.info("RpcDeleteBindingOrigin event | {}", input.toString()); final OriginType origin = input.getOrigin(); if (origin == null) { LOG.info("RpcDeleteBindingOrigin exception | Parameter 'origin' not defined", input.toString()); return RpcResultBuilder.success(output.build()).build(); } synchronized (BindingOriginsConfig.INSTANCE) { final boolean deleteFromInternal = BindingOriginsConfig.INSTANCE.deleteBindingOrigin(origin); if (deleteFromInternal) { final boolean deleteFromDataStore = datastoreAccess .deleteSynchronous(InstanceIdentifier.builder(BindingOrigins.class) .child(BindingOrigin.class, new BindingOriginKey(new OriginType(origin))).build(), LogicalDatastoreType.CONFIGURATION); output.setResult(deleteFromDataStore); } } return RpcResultBuilder.success(output.build()).build(); }); }
SxpConfigRpcServiceImpl implements SxpConfigControllerService, AutoCloseable { @Override public ListenableFuture<RpcResult<DeleteBindingOriginOutput>> deleteBindingOrigin(DeleteBindingOriginInput input) { final DeleteBindingOriginOutputBuilder output = new DeleteBindingOriginOutputBuilder().setResult(false); return executor.submit(() -> { LOG.info("RpcDeleteBindingOrigin event | {}", input.toString()); final OriginType origin = input.getOrigin(); if (origin == null) { LOG.info("RpcDeleteBindingOrigin exception | Parameter 'origin' not defined", input.toString()); return RpcResultBuilder.success(output.build()).build(); } synchronized (BindingOriginsConfig.INSTANCE) { final boolean deleteFromInternal = BindingOriginsConfig.INSTANCE.deleteBindingOrigin(origin); if (deleteFromInternal) { final boolean deleteFromDataStore = datastoreAccess .deleteSynchronous(InstanceIdentifier.builder(BindingOrigins.class) .child(BindingOrigin.class, new BindingOriginKey(new OriginType(origin))).build(), LogicalDatastoreType.CONFIGURATION); output.setResult(deleteFromDataStore); } } return RpcResultBuilder.success(output.build()).build(); }); } }
SxpConfigRpcServiceImpl implements SxpConfigControllerService, AutoCloseable { @Override public ListenableFuture<RpcResult<DeleteBindingOriginOutput>> deleteBindingOrigin(DeleteBindingOriginInput input) { final DeleteBindingOriginOutputBuilder output = new DeleteBindingOriginOutputBuilder().setResult(false); return executor.submit(() -> { LOG.info("RpcDeleteBindingOrigin event | {}", input.toString()); final OriginType origin = input.getOrigin(); if (origin == null) { LOG.info("RpcDeleteBindingOrigin exception | Parameter 'origin' not defined", input.toString()); return RpcResultBuilder.success(output.build()).build(); } synchronized (BindingOriginsConfig.INSTANCE) { final boolean deleteFromInternal = BindingOriginsConfig.INSTANCE.deleteBindingOrigin(origin); if (deleteFromInternal) { final boolean deleteFromDataStore = datastoreAccess .deleteSynchronous(InstanceIdentifier.builder(BindingOrigins.class) .child(BindingOrigin.class, new BindingOriginKey(new OriginType(origin))).build(), LogicalDatastoreType.CONFIGURATION); output.setResult(deleteFromDataStore); } } return RpcResultBuilder.success(output.build()).build(); }); } SxpConfigRpcServiceImpl(final DataBroker broker); }
SxpConfigRpcServiceImpl implements SxpConfigControllerService, AutoCloseable { @Override public ListenableFuture<RpcResult<DeleteBindingOriginOutput>> deleteBindingOrigin(DeleteBindingOriginInput input) { final DeleteBindingOriginOutputBuilder output = new DeleteBindingOriginOutputBuilder().setResult(false); return executor.submit(() -> { LOG.info("RpcDeleteBindingOrigin event | {}", input.toString()); final OriginType origin = input.getOrigin(); if (origin == null) { LOG.info("RpcDeleteBindingOrigin exception | Parameter 'origin' not defined", input.toString()); return RpcResultBuilder.success(output.build()).build(); } synchronized (BindingOriginsConfig.INSTANCE) { final boolean deleteFromInternal = BindingOriginsConfig.INSTANCE.deleteBindingOrigin(origin); if (deleteFromInternal) { final boolean deleteFromDataStore = datastoreAccess .deleteSynchronous(InstanceIdentifier.builder(BindingOrigins.class) .child(BindingOrigin.class, new BindingOriginKey(new OriginType(origin))).build(), LogicalDatastoreType.CONFIGURATION); output.setResult(deleteFromDataStore); } } return RpcResultBuilder.success(output.build()).build(); }); } SxpConfigRpcServiceImpl(final DataBroker broker); @Override void close(); @Override ListenableFuture<RpcResult<AddBindingOriginOutput>> addBindingOrigin(final AddBindingOriginInput input); @Override ListenableFuture<RpcResult<UpdateBindingOriginOutput>> updateBindingOrigin(UpdateBindingOriginInput input); @Override ListenableFuture<RpcResult<DeleteBindingOriginOutput>> deleteBindingOrigin(DeleteBindingOriginInput input); }
SxpConfigRpcServiceImpl implements SxpConfigControllerService, AutoCloseable { @Override public ListenableFuture<RpcResult<DeleteBindingOriginOutput>> deleteBindingOrigin(DeleteBindingOriginInput input) { final DeleteBindingOriginOutputBuilder output = new DeleteBindingOriginOutputBuilder().setResult(false); return executor.submit(() -> { LOG.info("RpcDeleteBindingOrigin event | {}", input.toString()); final OriginType origin = input.getOrigin(); if (origin == null) { LOG.info("RpcDeleteBindingOrigin exception | Parameter 'origin' not defined", input.toString()); return RpcResultBuilder.success(output.build()).build(); } synchronized (BindingOriginsConfig.INSTANCE) { final boolean deleteFromInternal = BindingOriginsConfig.INSTANCE.deleteBindingOrigin(origin); if (deleteFromInternal) { final boolean deleteFromDataStore = datastoreAccess .deleteSynchronous(InstanceIdentifier.builder(BindingOrigins.class) .child(BindingOrigin.class, new BindingOriginKey(new OriginType(origin))).build(), LogicalDatastoreType.CONFIGURATION); output.setResult(deleteFromDataStore); } } return RpcResultBuilder.success(output.build()).build(); }); } SxpConfigRpcServiceImpl(final DataBroker broker); @Override void close(); @Override ListenableFuture<RpcResult<AddBindingOriginOutput>> addBindingOrigin(final AddBindingOriginInput input); @Override ListenableFuture<RpcResult<UpdateBindingOriginOutput>> updateBindingOrigin(UpdateBindingOriginInput input); @Override ListenableFuture<RpcResult<DeleteBindingOriginOutput>> deleteBindingOrigin(DeleteBindingOriginInput input);  }