Migrate onap-username and onap-password 29/24329/1
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Wed, 20 Sep 2017 11:04:10 +0000 (16:34 +0530)
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Tue, 14 Nov 2017 09:08:13 +0000 (14:38 +0530)
onap-username and onap-password are migrated into
host-username and host-password respectively

Issue-Id: CLI-66

Change-Id: I4d658283523e75a2223dac9d0b839fdbc6ae2da3
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
25 files changed:
README.md
deployment/http/web/index.html
docs/open_cli_schema_version_1_0.rst
framework/src/main/java/org/onap/cli/fw/conf/Constants.java
framework/src/main/resources/default_input_parameters.yaml
framework/src/main/resources/onap-cli-schema/schema-validate.yaml
framework/src/main/resources/onap.properties
framework/src/test/java/org/onap/cli/fw/cmd/OnapHttpCommandTest.java
framework/src/test/java/org/onap/cli/fw/cmd/OnapSchemaValidateCommandTest.java
framework/src/test/java/org/onap/cli/fw/defaultParameter/TestDefaultParameterSection.java
framework/src/test/resources/sample-cmd-test-help.txt
framework/src/test/resources/sample-test-include-exclude.yaml
framework/src/test/resources/sample-test-include-param.yaml
framework/src/test/resources/sample-test-invalid-exclude-noauth.yaml
framework/src/test/resources/sample-test-invalid-include-noauth.yaml
main/src/main/resources/onap-readme.txt
main/src/test/java/org/onap/cli/main/OnapCliMainTest.java
main/src/test/java/org/onap/cli/main/utils/OnapCliUtilsTest.java
plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-checkin-sample.yaml
plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-checkout-sample.yaml
plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-create-sample.yaml
plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-list-sample.yaml
plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-show-sample.yaml
plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-submit-sample.yaml
plugins/sdc/src/test/resources/onap-cli-sample/vsp/vsp-upload-sample.yaml

index 4762d07..d2abd5e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -7,8 +7,8 @@ Provides unified commands to operate ONAP from Linux console.
 Configure the following environment variables, before using it:
 
 1. **HOST_URL** - Onap Micro service bus(MSB) URL or a service URL
-2. **ONAP_USERNAME** - Onap user name
-3. **ONAP_PASSWORD** - Onap user password
+2. **HOST_USERNAME** - Onap user name
+3. **HOST_PASSWORD** - Onap user password
 
 To Run a command
 -----------------
@@ -20,9 +20,9 @@ Type **onap** from linux console.
 
 And use the directive set to set the values for following parameters:
 
-1. **host-url** - Onap Micro service bus(MSB) URL or a service URL
-2. **onap-username** - Onap user name
-3. **onap-password** - Onap user password
+1. **onap-host-url** - Onap Micro service bus(MSB) URL or a service URL
+2. **host-username** - Onap user name
+3. **host-password** - Onap user password
 
 Set the product version
 ------------------------
@@ -52,4 +52,4 @@ To run in debug mode, set following environment variables:
 
 More details
 -------------
-https://wiki.onap.org
\ No newline at end of file
+https://wiki.onap.org
index 1bc23d7..f722b65 100644 (file)
@@ -8,31 +8,5 @@ function redirectToConsole(){
 </head>
 
 <body onload="showSlides()" style="background-color: white;color: black">
-<div class="readme">
-<h2>ONAP Command-Line Interface (CLI)</h2>
-
-<p>Provides unified commands to operate ONAP from Linux shell and web-console.
-
-<h3 >Web Command Console</h3>
-<p>To open web command console for ONAP,
-<a onclick="redirectToConsole();" style="color: blue;cursor: pointer">Click here !</a>
-
-<h3>Linux Command Console</h3>
-<p>Please follow the instructions given below for installing ONAP CLI.</p>
-<ol>
-<li>Download ONAP CLI from <a href="./onap-cli.zip">here</a></li>
-<li>Unzip into folder /opt/onap/cli</li>
-<li>Initialize CLI by running /opt/onap/cli/cli-init.sh</li>
-<li>Run ONAP CLI, by typing <strong>onap</strong> from command line
-<li>For more details, refer /opt/onap/cli/README.md</li>
-</ol>
-<br>
-<a href="http://onap.readthedocs.io/en/latest/submodules/cli.git/docs/index.html" style="color: blue;">
-<sub style="color: blue;"><strong>One Command to command whole Onap !!</strong></sub></a>
-<hr>
-<p><i>Powered by <strong>Open CLI Platform (OCLIP) </strong>
-<a href="http://onap.readthedocs.io/en/latest/submodules/cli.git/docs/OCLIP.html" style="color: blue;">1.0</a>
-</i></p>
-</div>
 
 </body></html>
index f2e1d66..4205373 100644 (file)
@@ -474,7 +474,7 @@ OCLIP platform provides following default parameters for every command and
 author is allowed to customize the inclusion or exclusion of these input
 parameters for a given command.
 
-name: onap-username
+name: host-username
 ~~~~~~~~~~~~~~~~~~~
 
     type: string
@@ -483,13 +483,13 @@ name: onap-username
 
     short_option: u
 
-    long_option: onap-username
+    long_option: host-username
 
-    default_value: ${ONAP_USERNAME}
+    default_value: ${HOST_USERNAME}
 
     is_optional: false
 
-name: onap-password
+name: host-password
 ~~~~~~~~~~~~~~~~~~~
 
     type: string
@@ -498,9 +498,9 @@ name: onap-password
 
     short_option: p
 
-    long_option: onap-password
+    long_option: host-password
 
-    default_value: ${ONAP_PASSWORD}
+    default_value: ${HOST_PASSWORD}
 
     is_secured: true
 
@@ -611,15 +611,15 @@ and logout.
 
 For example, OCLIP platform provides a command called 'schema-validate' to
 validate schematics of template against the specification defined in this
-document. For this command, host-url, onap-username, onap-password, no-auth
+document. For this command, host-url, host-username, host-password, no-auth
 parameters are required. so author could exclude these parameters by defining
 as :
 
     default_parameters:
       exclude:
-        \- onap-username
+        \- host-username
 
-        \- onap-password
+        \- host-password
 
         \- host-url
 
index 29cdbce..d90f000 100644 (file)
@@ -115,8 +115,8 @@ public class Constants {
     public static final String DEFAULT_PARAMETER_FILE_NAME = "default_input_parameters.yaml";
 
     // Common parameters used across all commands.
-    public static final String DEAFULT_PARAMETER_USERNAME = "onap-username";
-    public static final String DEAFULT_PARAMETER_PASS_WORD = "onap-password";
+    public static final String DEAFULT_PARAMETER_USERNAME = "host-username";
+    public static final String DEAFULT_PARAMETER_PASS_WORD = "host-password";
     public static final String DEAFULT_PARAMETER_HOST_URL = "host-url";
     public static final String DEFAULT_PARAMETER_HELP = "help";
     public static final String DEFAULT_PARAMETER_VERSION = "version";
index c65f4d8..7f06e2b 100644 (file)
@@ -1,18 +1,18 @@
 open_cli_schema_version: 1.0
 parameters:
-  - name: onap-username
+  - name: host-username
     type: string
-    description: Onap user name
+    description: Host user name
     short_option: u
-    long_option: onap-username
-    default_value: $s{env:ONAP_USERNAME}
+    long_option: host-username
+    default_value: $s{env:HOST_USERNAME}
     is_optional: false
-  - name: onap-password
+  - name: host-password
     type: string
-    description: Onap user password
+    description: Host user password
     short_option: p
-    long_option: onap-password
-    default_value: $s{env:ONAP_PASSWORD}
+    long_option: host-password
+    default_value: $s{env:HOST_PASSWORD}
     is_secured: true
     is_optional: false
   - name: host-url
index 5eb29f0..55e61e5 100644 (file)
@@ -8,8 +8,8 @@ service:
   version: 1.0.0
 default_parameters:
   exclude:
-    - onap-username
-    - onap-password
+    - host-username
+    - host-password
     - host-url
     - no-auth
 parameters:
index a963b38..d73f145 100644 (file)
@@ -8,9 +8,9 @@ cli.api_gateway=msb
 cli.auth_service=auth
 
 # service section
-cli.exclude_params_internal_cmd=onap-username,onap-password,host-url,no-auth
-cli.no_auth_disable_include_params_external_cmd=onap-username,onap-password,host-url,no-auth
-cli.no_auth_enable_exclude_params_external_cmd=onap-username,onap-password,no-auth
+cli.exclude_params_internal_cmd=host-username,host-password,host-url,no-auth
+cli.no_auth_disable_include_params_external_cmd=host-username,host-password,host-url,no-auth
+cli.no_auth_enable_exclude_params_external_cmd=host-username,host-password,no-auth
 cli.no_auth_enable_include_params_external_cmd=host-url
 
 cli.http.basic.common_headers=x-auth-token,x-transaction-id,x-app-id
@@ -23,7 +23,7 @@ cli.http.basic.common_headers.x-app-id.value=onap-cli
 # Service specific headers
 cli.http.basic.common_headers.sdc=user-id
 cli.http.basic.common_headers.sdc.user-id=USER_ID
-cli.http.basic.common_headers.sdc.user-id.value=${onap-username}
+cli.http.basic.common_headers.sdc.user-id.value=${host-username}
 
 #TODO mrkanag add support for aaf like defined above for basic
 #cli.service.auth=aaf
index bfdb14a..7552cac 100644 (file)
@@ -31,12 +31,12 @@ public class OnapHttpCommandTest {
     @Test(expected = OnapCommandException.class)
     public void runTest() throws OnapCommandException {
         OnapCommandParameter param1 = new OnapCommandParameter();
-        param1.setLongOption("onap-username");
-        param1.setName("onap-username");
+        param1.setLongOption("host-username");
+        param1.setName("host-username");
         param1.setParameterType(ParameterType.STRING);
         OnapCommandParameter param2 = new OnapCommandParameter();
-        param2.setLongOption("onap-password");
-        param2.setName("onap-password");
+        param2.setLongOption("host-password");
+        param2.setName("host-password");
         param2.setParameterType(ParameterType.STRING);
         OnapCommandParameter param3 = new OnapCommandParameter();
         param3.setLongOption("host-url");
index 89c32c9..2355d66 100644 (file)
@@ -28,9 +28,9 @@ public class OnapSchemaValidateCommandTest {
         OnapSchemaValidateCommand cmd = new OnapSchemaValidateCommand();
         cmd.initializeSchema("schema-validate.yaml");
         for (OnapCommandParameter param : cmd.getParameters()) {
-            if ("onap-username".equals(param.getName())) {
+            if ("host-username".equals(param.getName())) {
                 param.setValue("test");
-            } else if ("onap-password".equals(param.getName())) {
+            } else if ("host-password".equals(param.getName())) {
                 param.setValue("test");
             } else if ("host-url".equals(param.getName())) {
                 param.setValue("test-url");
@@ -48,9 +48,9 @@ public class OnapSchemaValidateCommandTest {
         OnapSchemaValidateCommand cmd = new OnapSchemaValidateCommand();
         cmd.initializeSchema("schema-validate.yaml");
         for (OnapCommandParameter param : cmd.getParameters()) {
-            if ("onap-username".equals(param.getName())) {
+            if ("host-username".equals(param.getName())) {
                 param.setValue("test");
-            } else if ("onap-password".equals(param.getName())) {
+            } else if ("host-password".equals(param.getName())) {
                 param.setValue("test");
             } else if ("host-url".equals(param.getName())) {
                 param.setValue("test-url");
index 20ca10f..b059079 100644 (file)
@@ -41,8 +41,8 @@ public class TestDefaultParameterSection {
 
         OnapCommandUtils.loadSchema(cmd, "sample-test-include-param.yaml", true, false);
         List<String> parameters = cmd.getParameters().stream().map(p -> p.getName()).collect(Collectors.toList());
-        assertTrue(parameters.contains("onap-username"));
-        assertTrue(parameters.contains("onap-password"));
+        assertTrue(parameters.contains("host-username"));
+        assertTrue(parameters.contains("host-password"));
         assertTrue(parameters.contains("host-url"));
     }
 
@@ -55,8 +55,8 @@ public class TestDefaultParameterSection {
 
         OnapCommandUtils.loadSchema(cmd, "sample-test-exclude-param.yaml", true, false);
         List<String> parameters = cmd.getParameters().stream().map(p -> p.getName()).collect(Collectors.toList());
-        assertTrue(parameters.contains("onap-username"));
-        assertTrue(parameters.contains("onap-password"));
+        assertTrue(parameters.contains("host-username"));
+        assertTrue(parameters.contains("host-password"));
         assertTrue(parameters.contains("host-url"));
         assertFalse(parameters.contains("long"));
         assertFalse(parameters.contains("format"));
@@ -73,8 +73,8 @@ public class TestDefaultParameterSection {
         OnapCommandUtils.loadSchema(cmd, "sample-test-include-exclude.yaml", true, false);
         List<String> parameters = cmd.getParameters().stream().map(p -> p.getName()).collect(Collectors.toList());
 
-        assertTrue(parameters.contains("onap-username"));
-        assertTrue(parameters.contains("onap-password"));
+        assertTrue(parameters.contains("host-username"));
+        assertTrue(parameters.contains("host-password"));
         assertTrue(parameters.contains("host-url"));
     }
 
@@ -88,8 +88,8 @@ public class TestDefaultParameterSection {
         OnapCommandUtils.loadSchema(cmd, "onap-test-schema.yaml", true, false);
         List<String> parameters = cmd.getParameters().stream().map(p -> p.getName()).collect(Collectors.toList());
 
-        assertFalse(parameters.contains("onap-username"));
-        assertFalse(parameters.contains("onap-password"));
+        assertFalse(parameters.contains("host-username"));
+        assertFalse(parameters.contains("host-password"));
         assertTrue(parameters.contains("host-url"));
         assertTrue(parameters.contains("debug"));
         assertTrue(parameters.contains("long"));
index 074e833..3d3d241 100644 (file)
@@ -5,7 +5,7 @@ Onap sample command to test the command features
 Onap service: sample v1
 
 Options:
-[-u | --onap-username] [-p | --onap-password] [-m | --host-url]
+[-u | --host-username] [-p | --host-password] [-m | --host-url]
 [-h | --help] [-v | --version] [-d | --debug]
 [-f | --format] [-s | --long] [-t | --no-title]
 [-a | --no-auth] [-b | --bool] [-x | --secure]
@@ -13,12 +13,12 @@ Options:
 [-l | --long-opt] [-r | --url] [-z | --env]
 <positional-args>
 where,
--u | --onap-username   Onap user name. It is of type STRING. By
+-u | --host-username   Onap user name. It is of type STRING. By
                         default, it is read from environment variable
-                        ONAP_USERNAME.
--p | --onap-password   Onap user password. It is of type STRING. By
+                        HOST_USERNAME.
+-p | --host-password   Onap user password. It is of type STRING. By
                         default, it is read from environment variable
-                        ONAP_PASSWORD. Secured.
+                        HOST_PASSWORD. Secured.
 -m | --host-url          Onap MSB url. It is of type URL. By default, it
                         is read from environment variable ONAP_MSB_URL.
 -h | --help             Onap command help message. It is of type STRING.
index 77d3211..3568372 100644 (file)
@@ -1,8 +1,8 @@
 open_cli_schema_version: 1.0
 default_parameters:
   include:
-    - onap-username
-    - onap-password
+    - host-username
+    - host-password
     - host-url
     - no-auth
   exclude:
index 1809712..38e5149 100644 (file)
@@ -1,6 +1,6 @@
 open_cli_schema_version: 1.0
 default_parameters:
   include:
-    - onap-username
-    - onap-password
+    - host-username
+    - host-password
     - no-auth
index 1a42b8d..c158411 100644 (file)
@@ -1,4 +1,4 @@
 open_cli_schema_version: 1.0
 default_parameters:
   exclude:
-    - onap-username
\ No newline at end of file
+    - host-username
\ No newline at end of file
index 2d53ab1..1dda3b9 100644 (file)
@@ -3,4 +3,4 @@ service:
   auth: none
 default_parameters:
   include:
-    - onap-username
\ No newline at end of file
+    - host-username
\ No newline at end of file
index 668d758..0795cf5 100644 (file)
@@ -13,8 +13,8 @@ to access and operate Onap functionalities. To use this CLI, please
 configure the following environment variables:
 
 1. ONAP_MSB_URL - Onap Micro service bus(MSB) URL
-2. ONAP_USERNAME - Onap user name
-3. ONAP_PASSWORD - Onap user password
+2. HOST_USERNAME - Onap user name
+3. HOST_PASSWORD - Onap user password
 
 To know the CLI version, type onap [-v|--version]
 To know the CLI usage, type onap [-h|--help]
index 092ef8d..0ac00d1 100644 (file)
@@ -136,8 +136,8 @@ public class OnapCliMainTest {
     @Test
     public void testHandleSampleCommandSet() throws OnapCommandException {
         OnapCommandRegistrar.getRegistrar().addParamCache("sample:string-param", "paramValue");
-        OnapCommandRegistrar.getRegistrar().addParamCache("onap-username", "paramValue");
-        OnapCommandRegistrar.getRegistrar().addParamCache("onap-password", "paramValue");
+        OnapCommandRegistrar.getRegistrar().addParamCache("host-username", "paramValue");
+        OnapCommandRegistrar.getRegistrar().addParamCache("host-password", "paramValue");
         OnapCommandRegistrar.getRegistrar().addParamCache("host-url", "paramValue");
         this.handle(new String[] { "sample-test", "--string-param", "test"});
     }
index 622cea5..1ea1a22 100644 (file)
@@ -34,12 +34,12 @@ public class OnapCliUtilsTest {
     @Test
     public void testpopulateParamsLong() throws OnapCommandException {
         OnapCommandParameter param1 = new OnapCommandParameter();
-        param1.setLongOption("onap-username");
-        param1.setName("onap-username");
+        param1.setLongOption("host-username");
+        param1.setName("host-username");
         param1.setParameterType(ParameterType.STRING);
         OnapCommandParameter param2 = new OnapCommandParameter();
-        param2.setLongOption("onap-password");
-        param2.setName("onap-password");
+        param2.setLongOption("host-password");
+        param2.setName("host-password");
         param2.setParameterType(ParameterType.STRING);
         OnapCommandParameter param3 = new OnapCommandParameter();
         param3.setLongOption("host-url");
@@ -61,13 +61,13 @@ public class OnapCliUtilsTest {
         paramslist.add(param4);
         paramslist.add(param5);
 
-        String[] args = new String[] { "sample-create", "--onap-username", "admin", "--onap-password", "123",
+        String[] args = new String[] { "sample-create", "--host-username", "admin", "--host-password", "123",
                 "--host-url", "a@b.com", "--string-param", "blah", "--long-opt", "10" };
         OnapCliUtils.populateParams(paramslist, Arrays.asList(args));
         List<String> expectedList = Arrays.asList(args);
 
-        Assert.assertEquals("onap-username", expectedList.get(2), param1.getValue());
-        Assert.assertEquals("onap-password", expectedList.get(4), param2.getValue());
+        Assert.assertEquals("host-username", expectedList.get(2), param1.getValue());
+        Assert.assertEquals("host-password", expectedList.get(4), param2.getValue());
         Assert.assertEquals("host-url", expectedList.get(6), param3.getValue());
         Assert.assertEquals("string-param", expectedList.get(8), param4.getValue());
         Assert.assertEquals("long-opt", expectedList.get(10), param5.getValue());
@@ -184,11 +184,11 @@ public class OnapCliUtilsTest {
 
         OnapCommandParameter param1 = new OnapCommandParameter();
         param1.setShortOption("u");
-        param1.setName("onap-username");
+        param1.setName("host-username");
         param1.setParameterType(ParameterType.STRING);
         OnapCommandParameter param2 = new OnapCommandParameter();
         param2.setShortOption("p");
-        param2.setName("onap-password");
+        param2.setName("host-password");
         param2.setParameterType(ParameterType.STRING);
         OnapCommandParameter param3 = new OnapCommandParameter();
         param3.setShortOption("r");
index c5d6491..43023fe 100644 (file)
@@ -5,4 +5,4 @@ version: onap-1.0
 samples:
     sample1:
         name: Checkin the Vendor Software Product
-        input: --onap-username cs0008 --onap-password demo123456!  --host-url http://localhost:8080 --vsp-id E563CB23A6BE49AF9A84CF579DAFB929
+        input: --host-username cs0008 --host-password demo123456!  --host-url http://localhost:8080 --vsp-id E563CB23A6BE49AF9A84CF579DAFB929
index cbc689f..d7a9e37 100644 (file)
@@ -6,4 +6,4 @@ version: onap-1.1
 samples:
     sample1:
         name: Checkout the Vendor Software Product
-        input: --onap-username cs0008 --onap-password demo123456!  --host-url http://localhost:8080 --vsp-id E563CB23A6BE49AF9A84CF579DAFB929
+        input: --host-username cs0008 --host-password demo123456!  --host-url http://localhost:8080 --vsp-id E563CB23A6BE49AF9A84CF579DAFB929
index c96a76f..d5b7432 100644 (file)
@@ -5,7 +5,7 @@ version: onap-1.0
 samples:
     sample1:
         name: Create the Vendor Software Product
-        input: --onap-username cs0008 --onap-password demo123456! --host-url http://locahost:8080 --vsp-name demo-vsp2 --vsp-vendor-name 5aa8a88c --vsp-vendor-id DBB202617952486691C1E35C9    621CD4E --license-agreement-id E19DBDDB137B494385F9535325BFD585 --feature-group-id 94835F096DAF4ED78781A394A4F22AD1
+        input: --host-username cs0008 --host-password demo123456! --host-url http://locahost:8080 --vsp-name demo-vsp2 --vsp-vendor-name 5aa8a88c --vsp-vendor-id DBB202617952486691C1E35C9    621CD4E --license-agreement-id E19DBDDB137B494385F9535325BFD585 --feature-group-id 94835F096DAF4ED78781A394A4F22AD1
         output: |
            +----------+----------------------------------+
            |property  |value                             |
index 4cfa64a..fe494ac 100644 (file)
@@ -5,7 +5,7 @@ version: onap-1.0
 samples:
     sample1:
         name: List Vendor Software Products
-        input: --onap-username cs0008 --onap-password demo123456!  --host-url http://localhost:8080
+        input: --host-username cs0008 --host-password demo123456!  --host-url http://localhost:8080
         output: |
            +----------------------------------+------------+
            |ID                                |name        |
index 4938c0c..99cd88e 100644 (file)
@@ -5,7 +5,7 @@ version: onap-1.0
 samples:
     sample1:
         name: Show the details of Vendor Software Products
-        input: --onap-username cs0008 --onap-password demo123456!  --host-url http://localhost:8080 --vsp-id 2DEB6CB4B082415BB7A697C9CD1273BA
+        input: --host-username cs0008 --host-password demo123456!  --host-url http://localhost:8080 --vsp-id 2DEB6CB4B082415BB7A697C9CD1273BA
         output: |
            +----------+----------------------------------+--------------------------+
            |name      |ID                                |description               |
index 568fdf7..55ceaf3 100644 (file)
@@ -5,4 +5,4 @@ version: onap-1.0
 samples:
     sample1:
         name: Submit the Vendor Software Product
-        input: --onap-username cs0008 --onap-password demo123456!  --host-url http://localhost:8080 --vsp-id E563CB23A6BE49AF9A84CF579DAFB929
+        input: --host-username cs0008 --host-password demo123456!  --host-url http://localhost:8080 --vsp-id E563CB23A6BE49AF9A84CF579DAFB929
index 1fd1034..344dcc9 100644 (file)
@@ -5,4 +5,4 @@ version: onap-1.0
 samples:
     sample1:
         name: upload the zip file to Vendor Software Product
-        input: --onap-username cs0008 --onap-password demo123456! --host-url http://localhost:8080 --vsp-id E563CB23A6BE49AF9A84CF579DAFB929  --vsp-file /home/user/vFW.zip
+        input: --host-username cs0008 --host-password demo123456! --host-url http://localhost:8080 --vsp-id E563CB23A6BE49AF9A84CF579DAFB929  --vsp-file /home/user/vFW.zip