@Test public void testDeleteNode() throws Exception { initMasterDatabaseOperations(SxpRpcServiceImplTest.generalAnswer); NodesRegister.unRegister(NODE_ID.getValue()); RpcResult<DeleteNodeOutput> result = service.deleteNode( new DeleteNodeInputBuilder().setNodeId(new NodeId("0.0.0.0")).build()).get(); assertNotNull(result); assertTrue(result.isSuccessful()); assertNotNull(result.getResult()); assertTrue(result.getResult().isResult()); }
@Override public ListenableFuture<RpcResult<DeleteNodeOutput>> deleteNode(final DeleteNodeInput input) { final String nodeId = getNodeId(input.getNodeId()); final DatastoreAccess datastoreAccess = getDatastoreAccess(nodeId); final DeleteNodeOutputBuilder output = new DeleteNodeOutputBuilder().setResult(false); return executor.submit(() -> { if (nodeId != null) { final InstanceIdentifier<Node> identifier = InstanceIdentifier.builder(NetworkTopology.class) .child(Topology.class, new TopologyKey(new TopologyId(Configuration.TOPOLOGY_NAME))) .child(Node.class, new NodeKey( new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId( nodeId))) .build(); LOG.info("RpcDeleteNode event | {}", input.toString()); final boolean config = datastoreAccess.checkAndDelete(identifier, LogicalDatastoreType.CONFIGURATION); if (config) { output.setResult(true); return RpcResultBuilder.success(output.build()).build(); } final boolean operational = datastoreAccess.checkAndDelete(identifier, LogicalDatastoreType.OPERATIONAL); output.setResult(operational); } return RpcResultBuilder.success(output.build()).build(); }); }
SxpRpcServiceImpl implements SxpControllerService, AutoCloseable { @Override public ListenableFuture<RpcResult<DeleteNodeOutput>> deleteNode(final DeleteNodeInput input) { final String nodeId = getNodeId(input.getNodeId()); final DatastoreAccess datastoreAccess = getDatastoreAccess(nodeId); final DeleteNodeOutputBuilder output = new DeleteNodeOutputBuilder().setResult(false); return executor.submit(() -> { if (nodeId != null) { final InstanceIdentifier<Node> identifier = InstanceIdentifier.builder(NetworkTopology.class) .child(Topology.class, new TopologyKey(new TopologyId(Configuration.TOPOLOGY_NAME))) .child(Node.class, new NodeKey( new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId( nodeId))) .build(); LOG.info("RpcDeleteNode event | {}", input.toString()); final boolean config = datastoreAccess.checkAndDelete(identifier, LogicalDatastoreType.CONFIGURATION); if (config) { output.setResult(true); return RpcResultBuilder.success(output.build()).build(); } final boolean operational = datastoreAccess.checkAndDelete(identifier, LogicalDatastoreType.OPERATIONAL); output.setResult(operational); } return RpcResultBuilder.success(output.build()).build(); }); } }
SxpRpcServiceImpl implements SxpControllerService, AutoCloseable { @Override public ListenableFuture<RpcResult<DeleteNodeOutput>> deleteNode(final DeleteNodeInput input) { final String nodeId = getNodeId(input.getNodeId()); final DatastoreAccess datastoreAccess = getDatastoreAccess(nodeId); final DeleteNodeOutputBuilder output = new DeleteNodeOutputBuilder().setResult(false); return executor.submit(() -> { if (nodeId != null) { final InstanceIdentifier<Node> identifier = InstanceIdentifier.builder(NetworkTopology.class) .child(Topology.class, new TopologyKey(new TopologyId(Configuration.TOPOLOGY_NAME))) .child(Node.class, new NodeKey( new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId( nodeId))) .build(); LOG.info("RpcDeleteNode event | {}", input.toString()); final boolean config = datastoreAccess.checkAndDelete(identifier, LogicalDatastoreType.CONFIGURATION); if (config) { output.setResult(true); return RpcResultBuilder.success(output.build()).build(); } final boolean operational = datastoreAccess.checkAndDelete(identifier, LogicalDatastoreType.OPERATIONAL); output.setResult(operational); } return RpcResultBuilder.success(output.build()).build(); }); } SxpRpcServiceImpl(final DataBroker broker); }
SxpRpcServiceImpl implements SxpControllerService, AutoCloseable { @Override public ListenableFuture<RpcResult<DeleteNodeOutput>> deleteNode(final DeleteNodeInput input) { final String nodeId = getNodeId(input.getNodeId()); final DatastoreAccess datastoreAccess = getDatastoreAccess(nodeId); final DeleteNodeOutputBuilder output = new DeleteNodeOutputBuilder().setResult(false); return executor.submit(() -> { if (nodeId != null) { final InstanceIdentifier<Node> identifier = InstanceIdentifier.builder(NetworkTopology.class) .child(Topology.class, new TopologyKey(new TopologyId(Configuration.TOPOLOGY_NAME))) .child(Node.class, new NodeKey( new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId( nodeId))) .build(); LOG.info("RpcDeleteNode event | {}", input.toString()); final boolean config = datastoreAccess.checkAndDelete(identifier, LogicalDatastoreType.CONFIGURATION); if (config) { output.setResult(true); return RpcResultBuilder.success(output.build()).build(); } final boolean operational = datastoreAccess.checkAndDelete(identifier, LogicalDatastoreType.OPERATIONAL); output.setResult(operational); } return RpcResultBuilder.success(output.build()).build(); }); } SxpRpcServiceImpl(final DataBroker broker); @Override ListenableFuture<RpcResult<AddConnectionOutput>> addConnection(final AddConnectionInput input); @Override ListenableFuture<RpcResult<DeleteDomainFilterOutput>> deleteDomainFilter(final DeleteDomainFilterInput input); @Override ListenableFuture<RpcResult<AddDomainFilterOutput>> addDomainFilter(final AddDomainFilterInput input); @Override ListenableFuture<RpcResult<AddFilterOutput>> addFilter(final AddFilterInput input); @Override ListenableFuture<RpcResult<AddPeerGroupOutput>> addPeerGroup(final AddPeerGroupInput input); @Override ListenableFuture<RpcResult<DeleteConnectionTemplateOutput>> deleteConnectionTemplate(
            final DeleteConnectionTemplateInput input); @Override ListenableFuture<RpcResult<DeleteNodeOutput>> deleteNode(final DeleteNodeInput input); @Override ListenableFuture<RpcResult<DeleteBindingsOutput>> deleteBindings(final DeleteBindingsInput input); @Override void close(); @Override ListenableFuture<RpcResult<DeleteConnectionOutput>> deleteConnection(final DeleteConnectionInput input); @Override ListenableFuture<RpcResult<DeleteFilterOutput>> deleteFilter(final DeleteFilterInput input); @Override ListenableFuture<RpcResult<DeletePeerGroupOutput>> deletePeerGroup(final DeletePeerGroupInput input); @Override ListenableFuture<RpcResult<DeleteDomainOutput>> deleteDomain(final DeleteDomainInput input); @Override ListenableFuture<RpcResult<AddConnectionTemplateOutput>> addConnectionTemplate(
            final AddConnectionTemplateInput input); @Override ListenableFuture<RpcResult<GetConnectionsOutput>> getConnections(final GetConnectionsInput input); @Override ListenableFuture<RpcResult<GetNodeBindingsOutput>> getNodeBindings(final GetNodeBindingsInput input); @Override ListenableFuture<RpcResult<GetPeerGroupOutput>> getPeerGroup(final GetPeerGroupInput input); @Override ListenableFuture<RpcResult<GetPeerGroupsOutput>> getPeerGroups(final GetPeerGroupsInput input); @Override ListenableFuture<RpcResult<AddNodeOutput>> addNode(final AddNodeInput input); @Override ListenableFuture<RpcResult<AddDomainOutput>> addDomain(final AddDomainInput input); @Override ListenableFuture<RpcResult<AddBindingsOutput>> addBindings(final AddBindingsInput input); @Override ListenableFuture<RpcResult<UpdateFilterOutput>> updateFilter(final UpdateFilterInput input); }
SxpRpcServiceImpl implements SxpControllerService, AutoCloseable { @Override public ListenableFuture<RpcResult<DeleteNodeOutput>> deleteNode(final DeleteNodeInput input) { final String nodeId = getNodeId(input.getNodeId()); final DatastoreAccess datastoreAccess = getDatastoreAccess(nodeId); final DeleteNodeOutputBuilder output = new DeleteNodeOutputBuilder().setResult(false); return executor.submit(() -> { if (nodeId != null) { final InstanceIdentifier<Node> identifier = InstanceIdentifier.builder(NetworkTopology.class) .child(Topology.class, new TopologyKey(new TopologyId(Configuration.TOPOLOGY_NAME))) .child(Node.class, new NodeKey( new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId( nodeId))) .build(); LOG.info("RpcDeleteNode event | {}", input.toString()); final boolean config = datastoreAccess.checkAndDelete(identifier, LogicalDatastoreType.CONFIGURATION); if (config) { output.setResult(true); return RpcResultBuilder.success(output.build()).build(); } final boolean operational = datastoreAccess.checkAndDelete(identifier, LogicalDatastoreType.OPERATIONAL); output.setResult(operational); } return RpcResultBuilder.success(output.build()).build(); }); } SxpRpcServiceImpl(final DataBroker broker); @Override ListenableFuture<RpcResult<AddConnectionOutput>> addConnection(final AddConnectionInput input); @Override ListenableFuture<RpcResult<DeleteDomainFilterOutput>> deleteDomainFilter(final DeleteDomainFilterInput input); @Override ListenableFuture<RpcResult<AddDomainFilterOutput>> addDomainFilter(final AddDomainFilterInput input); @Override ListenableFuture<RpcResult<AddFilterOutput>> addFilter(final AddFilterInput input); @Override ListenableFuture<RpcResult<AddPeerGroupOutput>> addPeerGroup(final AddPeerGroupInput input); @Override ListenableFuture<RpcResult<DeleteConnectionTemplateOutput>> deleteConnectionTemplate(
            final DeleteConnectionTemplateInput input); @Override ListenableFuture<RpcResult<DeleteNodeOutput>> deleteNode(final DeleteNodeInput input); @Override ListenableFuture<RpcResult<DeleteBindingsOutput>> deleteBindings(final DeleteBindingsInput input); @Override void close(); @Override ListenableFuture<RpcResult<DeleteConnectionOutput>> deleteConnection(final DeleteConnectionInput input); @Override ListenableFuture<RpcResult<DeleteFilterOutput>> deleteFilter(final DeleteFilterInput input); @Override ListenableFuture<RpcResult<DeletePeerGroupOutput>> deletePeerGroup(final DeletePeerGroupInput input); @Override ListenableFuture<RpcResult<DeleteDomainOutput>> deleteDomain(final DeleteDomainInput input); @Override ListenableFuture<RpcResult<AddConnectionTemplateOutput>> addConnectionTemplate(
            final AddConnectionTemplateInput input); @Override ListenableFuture<RpcResult<GetConnectionsOutput>> getConnections(final GetConnectionsInput input); @Override ListenableFuture<RpcResult<GetNodeBindingsOutput>> getNodeBindings(final GetNodeBindingsInput input); @Override ListenableFuture<RpcResult<GetPeerGroupOutput>> getPeerGroup(final GetPeerGroupInput input); @Override ListenableFuture<RpcResult<GetPeerGroupsOutput>> getPeerGroups(final GetPeerGroupsInput input); @Override ListenableFuture<RpcResult<AddNodeOutput>> addNode(final AddNodeInput input); @Override ListenableFuture<RpcResult<AddDomainOutput>> addDomain(final AddDomainInput input); @Override ListenableFuture<RpcResult<AddBindingsOutput>> addBindings(final AddBindingsInput input); @Override ListenableFuture<RpcResult<UpdateFilterOutput>> updateFilter(final UpdateFilterInput input);  }