Add a private modifiers to command arguments in clustering-test-app
[controller.git] / opendaylight / md-sal / samples / clustering-test-app / karaf-cli / src / main / java / org / opendaylight / clustering / it / karaf / cli / people / AddPersonCommand.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.people;
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.AbstractRpcAction;
16 import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.AddPersonInputBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.PeopleService;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.PersonId;
20 import org.opendaylight.yangtools.yang.common.RpcResult;
21 import org.opendaylight.yangtools.yang.common.Uint32;
22
23 @Service
24 @Command(scope = "test-app", name = "add-person", description = " Run an add-person test")
25 public class AddPersonCommand extends AbstractRpcAction {
26     @Reference
27     private RpcConsumerRegistry rpcService;
28     @Argument(index = 0, name = "id", required = true)
29     private PersonId id;
30     @Argument(index = 1, name = "gender", required = true)
31     private String gender;
32     @Argument(index = 2, name = "age", required = true)
33     private long age;
34     @Argument(index = 3, name = "address", required = true)
35     private String address;
36     @Argument(index = 4, name = "contactNo", required = true)
37     private String contactNo;
38
39     @Override
40     protected ListenableFuture<? extends RpcResult<?>> invokeRpc() {
41         return rpcService.getRpcService(PeopleService.class).addPerson(new AddPersonInputBuilder()
42                 .setId(id)
43                 .setGender(gender)
44                 .setAge(Uint32.valueOf(age))
45                 .setAddress(address)
46                 .setContactNo(contactNo)
47                 .build());
48     }
49 }