Add netconf scale-util
[netconf.git] / netconf / tools / netconf-testtool / src / main / java / org / opendaylight / netconf / test / tool / scale / util / ScaleUtilParameters.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. 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
9 package org.opendaylight.netconf.test.tool.scale.util;
10
11 import java.io.File;
12 import net.sourceforge.argparse4j.ArgumentParsers;
13 import net.sourceforge.argparse4j.annotation.Arg;
14 import net.sourceforge.argparse4j.inf.ArgumentParser;
15 import net.sourceforge.argparse4j.inf.ArgumentParserException;
16
17 public class ScaleUtilParameters {
18
19     @Arg(dest = "distro-folder")
20     public File distroFolder;
21
22     static ArgumentParser getParser() {
23         final ArgumentParser parser = ArgumentParsers.newArgumentParser("scale test helper");
24
25         parser.addArgument("--distribution-folder")
26                 .type(File.class)
27                 .help("Directory where the karaf distribution for controller is located")
28                 .dest("distro-folder");
29
30         return parser;
31     }
32
33     static ScaleUtilParameters parseArgs(final String[] args, final ArgumentParser parser) {
34         final ScaleUtilParameters parameters = new ScaleUtilParameters();
35         try {
36             parser.parseArgs(args, parameters);
37             return parameters;
38         } catch (ArgumentParserException e) {
39             parser.handleError(e);
40         }
41
42         System.exit(1);
43         return null;
44     }
45
46 }