From ab20aed26e0cb5d1647b671b96637736c2510825 Mon Sep 17 00:00:00 2001 From: Kanagaraj M Date: Fri, 2 Aug 2019 13:47:12 +0530 Subject: Update the sample command OCS YAML Issue-ID: CLI-169 Change-Id: Ia797550dc327ddc63f72350c80cd807c181b58d1 Signed-off-by: Kanagaraj Manickam k00365106 --- .../open-cli-schema/hello-world-basic.yaml | 42 +++++++++ .../open-cli-schema/hello-world-command.yaml | 38 ++++++++ .../open-cli-schema/hello-world-http.yaml | 104 +++++++++++---------- .../open-cli-schema/hello-world-snmp.yaml | 10 +- .../resources/open-cli-schema/hello-world.yaml | 42 --------- 5 files changed, 138 insertions(+), 98 deletions(-) create mode 100644 products/sample/src/main/resources/open-cli-schema/hello-world-basic.yaml create mode 100644 products/sample/src/main/resources/open-cli-schema/hello-world-command.yaml delete mode 100644 products/sample/src/main/resources/open-cli-schema/hello-world.yaml (limited to 'products/sample') diff --git a/products/sample/src/main/resources/open-cli-schema/hello-world-basic.yaml b/products/sample/src/main/resources/open-cli-schema/hello-world-basic.yaml new file mode 100644 index 00000000..fcaaca2f --- /dev/null +++ b/products/sample/src/main/resources/open-cli-schema/hello-world-basic.yaml @@ -0,0 +1,42 @@ +# Copyright 2017-18 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +open_cli_schema_version: 1.0 + +name: hello + +description: First cmd hello world + +info: + product: tutorial + service: learning + author: Kanagaraj Manickam kanagaraj.manickam@huawei.com + +parameters: + - name: name + description: name of the person + long_option: name + short_option: b + default_value: ${env:DEMO_NAME} + type: string + is_optional: false + +results: + direction: landscape + attributes: + - name: output + description: hello world output + type: string + scope: short + diff --git a/products/sample/src/main/resources/open-cli-schema/hello-world-command.yaml b/products/sample/src/main/resources/open-cli-schema/hello-world-command.yaml new file mode 100644 index 00000000..fcf44bf1 --- /dev/null +++ b/products/sample/src/main/resources/open-cli-schema/hello-world-command.yaml @@ -0,0 +1,38 @@ +# Copyright 2018 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +open_cli_schema_version: 1.0 +name: dir +description: Oclip sample command to do dir +info: + product: tutorial + service: learning + author: Kanagaraj Manickam kanagaraj.manickam@huawei.com + +parameters: + - name: format + type: string + description: Output formats, supported formats such as table, csv, json, yaml + short_option: f + long_option: format + default_value: text + is_default_param: true + +cmd: + command: + - dir + success_codes: + - 0 + working_directory: . + output: $stdout diff --git a/products/sample/src/main/resources/open-cli-schema/hello-world-http.yaml b/products/sample/src/main/resources/open-cli-schema/hello-world-http.yaml index 7fe12ff1..8cad8668 100644 --- a/products/sample/src/main/resources/open-cli-schema/hello-world-http.yaml +++ b/products/sample/src/main/resources/open-cli-schema/hello-world-http.yaml @@ -1,62 +1,64 @@ -# Copyright 2017-18 Huawei Technologies Co., Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - open_cli_schema_version: 1.0 +name: weather-report +description: | + Place this OCS YAML under $OPEN_CLI_HOME/open-cli-schema folder. Then run the commands + oclip schema-refresh -name: hello-world-http + It is used to display the temparature and wind speed details from https://openweathermap.org. + Try to add new commands to display different weather details by exploring this site. -description: | - First cmd hello world using http runing under - lighttpd in cli at http://:8080/version.json + Sample usage: + oclip --product tutorial weather-report --host-url http://api.openweathermap.org --zip-code 637301 --country-code in info: - product: sample-helloworld - service: hello-world - author: ONAP CLI Team onap-discuss@lists.onap.org + product: tutorial + service: learning + author: Kanagaraj Manickam kanagaraj.manickam@huawei.com parameters: - - name: name - description: name of the person - long_option: name - short_option: b - default_value: ${DEMO_NAME} - type: string - is_optional: false + - name: zip-code + description: zip-code + type: string + short_option: x + long_option: zip-code + is_optional: true + default_value: 637301 + - name: country-code + description: country-code + type: string + short_option: y + long_option: country-code + is_optional: true + default_value: in + - name: api-code + description: api-code + type: string + short_option: z + long_option: api-code + is_optional: true + default_value: 13cf06b1b379a4b7501c34c2d67a625c results: - direction: landscape - attributes: - - name: output - description: hello world output - type: string - scope: short - + direction: landscape + attributes: + - name: temperature + description: temperature at city + scope: short + type: string + - name: wind + description: wind speed + scope: short + type: string http: - service: - name: sample-service - version: 1.0.0 - auth: none - mode: direct - - request: - uri: /version.json - method: GET - success_codes: - - 200 - - 201 - result_map: - output: Hello ${name}, You are running on $b{$.name} $b{$.version} + service: + auth: none + mode: direct + request: + uri: /data/2.5/weather?zip=${zip-code},${country-code}&appid=${api-code} + method: GET + success_codes: + - 200 + result_map: + temperature: $b{$.main.temp} + wind: $b{$.wind.speed} - sample_response: - body: {"name": "oclip", "version": "1.0"} \ No newline at end of file diff --git a/products/sample/src/main/resources/open-cli-schema/hello-world-snmp.yaml b/products/sample/src/main/resources/open-cli-schema/hello-world-snmp.yaml index d10051f7..15f3ad92 100644 --- a/products/sample/src/main/resources/open-cli-schema/hello-world-snmp.yaml +++ b/products/sample/src/main/resources/open-cli-schema/hello-world-snmp.yaml @@ -13,13 +13,13 @@ # limitations under the License. open_cli_schema_version: 1.0 -name: hello-world-snmp -description: Sample yaml usin snmp profile +name: hostname +description: Sample yaml using snmp profile for hostname info: - product: sample-helloworld - service: hello-world - author: ONAP CLI Team onap-discuss@lists.onap.org + product: tutorial + service: learning + author: Kanagaraj Manickam kanagaraj.manickam@huawei.com results: direction: portrait diff --git a/products/sample/src/main/resources/open-cli-schema/hello-world.yaml b/products/sample/src/main/resources/open-cli-schema/hello-world.yaml deleted file mode 100644 index d83a8b37..00000000 --- a/products/sample/src/main/resources/open-cli-schema/hello-world.yaml +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2017-18 Huawei Technologies Co., Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -open_cli_schema_version: 1.0 - -name: hello-world - -description: First cmd hello world - -info: - product: sample-helloworld - service: hello-world - author: ONAP CLI Team onap-discuss@lists.onap.org - -parameters: - - name: name - description: name of the person - long_option: name - short_option: b - default_value: ${env:DEMO_NAME} - type: string - is_optional: false - -results: - direction: landscape - attributes: - - name: output - description: hello world output - type: string - scope: short - -- cgit 1.2.3-korg