Rework karaf CLI commands to print results on console
[controller.git] / opendaylight / md-sal / sal-cluster-admin-karaf-cli / src / main / java / org / opendaylight / controller / cluster / datastore / admin / command / ActivateEosDatacenterCommand.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.controller.cluster.datastore.admin.command;
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.mdsal.binding.api.RpcConsumerRegistry;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.ActivateEosDatacenterInputBuilder;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.cluster.admin.rev151013.ClusterAdminService;
17 import org.opendaylight.yangtools.yang.common.RpcResult;
18
19 @Service
20 @Command(scope = "cluster-admin", name = "activate-eos-datacenter", description = "Run an activate-eos-datacenter test")
21 public class ActivateEosDatacenterCommand extends AbstractRpcAction {
22     @Reference
23     private RpcConsumerRegistry rpcConsumerRegistry;
24
25     @Override
26     protected ListenableFuture<? extends RpcResult<?>> invokeRpc() {
27         return rpcConsumerRegistry.getRpcService(ClusterAdminService.class)
28                 .activateEosDatacenter(new ActivateEosDatacenterInputBuilder().build());
29     }
30 }