Improve segmented journal actor metrics
[controller.git] / opendaylight / md-sal / samples / clustering-test-app / karaf-cli / src / main / java / org / opendaylight / clustering / it / karaf / cli / odl / mdsal / lowlevel / tgt / GetContextedConstantCommand.java
1 /*
2  * Copyright (c) 2022 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.odl.mdsal.lowlevel.tgt;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import org.apache.karaf.shell.api.action.Argument;
12 import org.apache.karaf.shell.api.action.Command;
13 import org.apache.karaf.shell.api.action.lifecycle.Reference;
14 import org.apache.karaf.shell.api.action.lifecycle.Service;
15 import org.opendaylight.clustering.it.karaf.cli.AbstractDOMRpcAction;
16 import org.opendaylight.clustering.it.karaf.cli.InstanceIdentifierSupport;
17 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
18 import org.opendaylight.mdsal.dom.api.DOMRpcResult;
19 import org.opendaylight.mdsal.dom.api.DOMRpcService;
20 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.target.rev170215.GetContextedConstantInput;
21 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.target.rev170215.GetContextedConstantInputBuilder;
22 import org.opendaylight.yangtools.yang.common.QName;
23 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
24
25 @Service
26 @Command(scope = "test-app", name = "get-contexted-constant", description = "Run an get-contexted-constant test")
27 public class GetContextedConstantCommand extends AbstractDOMRpcAction {
28     @Reference
29     private DOMRpcService rpcService;
30     @Reference
31     private BindingNormalizedNodeSerializer serializer;
32     @Reference
33     private InstanceIdentifierSupport iidSupport;
34     @Argument(index = 0, name = "context", required = true)
35     private String context;
36
37     @Override
38     protected ListenableFuture<? extends DOMRpcResult> invokeRpc() {
39         final ContainerNode inputNode = serializer.toNormalizedNodeRpcData(new GetContextedConstantInputBuilder()
40             .setContext(iidSupport.parseArgument(context))
41             .build());
42         return rpcService.invokeRpc(QName.create(GetContextedConstantInput.QNAME, "get-contexted-constant"), inputNode);
43     }
44 }