Introduce cli commands for clustering-test-app
[controller.git] / opendaylight / md-sal / samples / clustering-test-app / karaf-cli / src / main / java / org / opendaylight / clustering / it / karaf / cli / car / UnregisterCommitCohortCommand.java
1 /*
2  * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.clustering.it.karaf.cli.car;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import org.apache.karaf.shell.api.action.Command;
12 import org.apache.karaf.shell.api.action.lifecycle.Reference;
13 import org.apache.karaf.shell.api.action.lifecycle.Service;
14 import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction;
15 import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.CarService;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.car.rev140818.UnregisterCommitCohortInputBuilder;
18 import org.opendaylight.yangtools.yang.common.RpcResult;
19
20 @Service
21 @Command(scope = "test-app", name = "unregister-commit-cohort", description = "Run a unregister-commit-cohort test")
22 public class UnregisterCommitCohortCommand extends AbstractRpcAction {
23     @Reference
24     private RpcConsumerRegistry rpcService;
25
26     @Override
27     protected ListenableFuture<? extends RpcResult<?>> invokeRpc() {
28         return rpcService.getRpcService(CarService.class)
29             .unregisterCommitCohort(new UnregisterCommitCohortInputBuilder().build());
30     }
31 }