diff options
author | Kanagaraj M <mkr1481@gmail.com> | 2019-09-30 06:19:30 +0200 |
---|---|---|
committer | Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com> | 2019-09-30 06:45:54 +0200 |
commit | 08f6cbf5307459ac3e91fc2c98f9b76010b23d4a (patch) | |
tree | bbacf435b123328961858076e948d83c89b723f6 /products/onap-dublin/features | |
parent | 6e167e934b0d384a3c588cfc88c583bdddd1bfaa (diff) |
Fix ovp lcm validation
Issue-ID: CLI-166
Change-Id: I0c8def49c6d3eb79d4686b40899ff165ae2461ce
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'products/onap-dublin/features')
19 files changed, 130 insertions, 55 deletions
diff --git a/products/onap-dublin/features/integration/src/main/resources/conf/vnf-tosca-provision.json b/products/onap-dublin/features/integration/src/main/resources/conf/vnf-tosca-lcm.json index a944e373..a944e373 100644 --- a/products/onap-dublin/features/integration/src/main/resources/conf/vnf-tosca-provision.json +++ b/products/onap-dublin/features/integration/src/main/resources/conf/vnf-tosca-lcm.json diff --git a/products/onap-dublin/features/integration/src/main/resources/open-cli-sample/vnf-tosca-provision-dublin-schema-sample.yaml b/products/onap-dublin/features/integration/src/main/resources/open-cli-sample/vnf-tosca-lcm-dublin-schema-sample.yaml index 46c98327..360418df 100644 --- a/products/onap-dublin/features/integration/src/main/resources/open-cli-sample/vnf-tosca-provision-dublin-schema-sample.yaml +++ b/products/onap-dublin/features/integration/src/main/resources/open-cli-sample/vnf-tosca-lcm-dublin-schema-sample.yaml @@ -1,9 +1,9 @@ open_cli_sample_version: 1.0 -name: vnf-tosca-provision +name: vnf-tosca-lcm version: onap-dublin samples: sample1: - name: vnf-tosca-provision + name: vnf-tosca-lcm input: --mode checkup --vsp c:\Users\k00365106\Desktop\vtp\tosca-lcm\vgw.csar --vnf-csar c:\Users\k00365106\Desktop\vtp\tosca-lcm\vgw.csar --ns-csar c:\Users\k00365106\Desktop\vtp\tosca-lcm\vgw.csar --vnfm-driver hwvnfmdriver --timeout 800000 --vnf-name vgw12345678901 --vnf-vendor-name vnfvendor12345678901 --onap-objects D:\workspace\cli\deployment\zip\target\deployunzip\data\tmp\1234567890-1567065851687_result.json moco: vnf-tosca-provision-dublin-schema-moco.json output: | diff --git a/products/onap-dublin/features/integration/src/main/resources/open-cli-schema/vnf-tosca-provision-dublin-schema.yaml b/products/onap-dublin/features/integration/src/main/resources/open-cli-schema/vnf-tosca-lcm-dublin-schema.yaml index ff67ee5e..980a9493 100644 --- a/products/onap-dublin/features/integration/src/main/resources/open-cli-schema/vnf-tosca-provision-dublin-schema.yaml +++ b/products/onap-dublin/features/integration/src/main/resources/open-cli-schema/vnf-tosca-lcm-dublin-schema.yaml @@ -13,7 +13,7 @@ # limitations under the License. open_cli_schema_version: 1.0 -name: vnf-tosca-provision +name: vnf-tosca-lcm description: | ONAP TOSCA VNF validation using ONAP CLI and Open Command Platform (OCOMP) @@ -82,7 +82,7 @@ description: | Similarly, other service IP and Port could be discovered like above, in case not know earlier :) This profile would be used while running the command with ONAP setup configured in it, as below - oclip --profile onap-dublin vnf-tosca-provision ..... + oclip --profile onap-dublin vnf-tosca-lcm ..... e. Verify these details once by typing 'set' @@ -104,7 +104,7 @@ parameters: type: string short_option: x long_option: config-json - default_value: $s{env:OPEN_CLI_HOME}/conf/vnf-tosca-provision.json + default_value: $s{env:OPEN_CLI_HOME}/conf/vnf-tosca-lcm.json is_optional: false - name: vsp description: Path to the ONAP vendor service product (VSP) for the VNF to provision @@ -194,7 +194,7 @@ results: scope: short cmd: command: - - python $s{env:OPEN_CLI_HOME}/script/vnf-tosca-provision.py --vendor-name ${vnf-vendor-name} --vnf-name ${vnf-name} --mode ${mode} --result-json $s{tmp:result.json:onap-objects} --conf ${config-json} --vsp ${vsp} --vnf-csar ${vnf-csar} --ns-csar ${ns-csar} --vnfm-driver ${vnfm-driver} + - python $s{env:OPEN_CLI_HOME}/script/vnf-tosca-lcm.py --vendor-name ${vnf-vendor-name} --vnf-name ${vnf-name} --mode ${mode} --result-json $s{tmp:result.json:onap-objects} --conf ${config-json} --vsp ${vsp} --vnf-csar ${vnf-csar} --ns-csar ${ns-csar} --vnfm-driver ${vnfm-driver} success_codes: - 0 working_directory: . diff --git a/products/onap-dublin/features/integration/src/main/resources/script/vnf-tosca-provision.py b/products/onap-dublin/features/integration/src/main/resources/script/vnf-tosca-lcm.py index d412fa66..e6201714 100644 --- a/products/onap-dublin/features/integration/src/main/resources/script/vnf-tosca-provision.py +++ b/products/onap-dublin/features/integration/src/main/resources/script/vnf-tosca-lcm.py @@ -13,6 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +# This script uses the ONAP CLI for providing the end-end service creation and termination. +# Used in devops, testing, certification and production +# NOTE: This feature is avaialble as ONAP CLI vnf-tosca-lcm +# +# Author: kanagaraj.manickam@huawei.com +# + import json import os import argparse @@ -21,6 +28,9 @@ import uuid import subprocess import platform import datetime +import string +import random + from argparse import RawTextHelpFormatter if platform.system() == 'Windows': @@ -123,7 +133,7 @@ class ONAP: conf, request_id, debug = False): - self.conf = conf + self.conf = conf or {} self.ocomp = OCOMP(request_id, debug, product=product, profile=profile) self.preload() self.tag = 'Powered by Open Command Platform - OCOMP' @@ -132,6 +142,8 @@ class ONAP: if self.conf['ONAP']: for attr in self.conf['ONAP']: setattr(self, attr, self.conf['ONAP'][attr]) + else: + self.conf['ONAP'] = {} def create_vlm(self): submit = False @@ -320,7 +332,7 @@ class ONAP: def setup_cloud_and_subscription(self): associate = False if not self.location_id and not self.location_version: - location_id = 'ocomp-region-{}'.format(self.ocomp.request_id) + location_id = 'ocomp-region-{}'.format(self.conf['ONAP']['uid']) self.ocomp.run(command='complex-create', params={'physical-location-id': location_id, 'data-center-code': 'ocomp', @@ -349,7 +361,7 @@ class ONAP: break if not self.cloud_id and not self.cloud_version: - cloud_id = 'OCOMP-{}'.format(self.ocomp.request_id) + cloud_id = 'OCOMP-{}'.format(self.conf['ONAP']['uid']) self.ocomp.run(command='cloud-create', params={'region-name': self.conf['cloud']['region'], 'complex-name': self.location_id, @@ -386,7 +398,7 @@ class ONAP: subscribe = False if not self.service_type_id and not self.service_type_version: - service_type_id = '{}-{}'.format(self.conf['subscription']['service-type'], self.ocomp.request_id) + service_type_id = '{}-{}'.format(self.conf['subscription']['service-type'], self.conf['ONAP']['uid']) self.ocomp.run(command='service-type-create', params={'service-type': service_type_id, 'service-type-id': service_type_id}) @@ -401,7 +413,7 @@ class ONAP: break if not self.customer_id and not self.customer_version: - customer_id = '{}-{}'.format(self.conf['subscription']['customer-name'], self.ocomp.request_id) + customer_id = '{}-{}'.format(self.conf['subscription']['customer-name'], self.ocomp.conf['ONAP']['random']) self.ocomp.run(command='customer-create', params={'customer-name': customer_id, 'subscriber-name': customer_id}) @@ -508,6 +520,8 @@ class ONAP: def cleanup(self): if self.ns_instance_id: + self.ocomp.run(command='vfc-nslcm-terminate', + params={'ns-instance-id': self.ns_instance_id}) self.ocomp.run(command='vfc-nslcm-delete', params={'ns-instance-id': self.ns_instance_id}) self.ns_instance_id = None @@ -675,6 +689,8 @@ if __name__ == '__main__': config_file = args.config_file_path with open(config_file) as json_file: conf = json.load(json_file) + if not conf['ONAP']['uid']: + conf['ONAP']['uid'] = ''.join(random.sample(string.ascii_lowercase,5)) if vsp_csar: conf['vnf']['vsp-csar'] = vsp_csar if vnf_csar: @@ -683,11 +699,10 @@ if __name__ == '__main__': conf['vnf']['ns-csar'] = vnf_csar if vnf_name: conf['vnf']['name'] = vnf_name - conf['vnf']['name'] = '{}{}'.format(conf['vnf']['name'], request_id).replace("-", "").replace("_", "") - if vnf_name: + conf['vnf']['name'] = '{}{}'.format(conf['vnf']['name'], conf['ONAP']['uid']) + if vendor_name: conf['vnf']['vendor-name'] = vendor_name - conf['vnf']['vendor-name'] = '{}-{}'.format(conf['vnf']['vendor-name'], request_id) - + conf['vnf']['vendor-name'] = '{}-{}'.format(conf['vnf']['vendor-name'], conf['ONAP']['uid']) if args.result: result_file = args.result diff --git a/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/catalog/vfc-catalog-onboard-ns-schema-moco.json b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/catalog/vfc-catalog-onboard-ns-schema-moco.json index 5218f7fd..41accfa7 100644 --- a/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/catalog/vfc-catalog-onboard-ns-schema-moco.json +++ b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/catalog/vfc-catalog-onboard-ns-schema-moco.json @@ -1,14 +1,7 @@ [ { "request" : { "method" : "post", - "uri" : "/api/catalog/v1/nspackages", - "headers" : { - "Accept" : "application/json", - "Content-Type" : "application/json" - }, - "json" : { - "csarId" : "a3394090-c5b4-49b4-974c-00a6eac755ab" - } + "uri" : "/api/catalog/v1/nspackages" }, "response" : { "status" : 202, diff --git a/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/catalog/vfc-catalog-onboard-vnf-schema-moco.json b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/catalog/vfc-catalog-onboard-vnf-schema-moco.json index 5e0591de..5327af7a 100644 --- a/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/catalog/vfc-catalog-onboard-vnf-schema-moco.json +++ b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/catalog/vfc-catalog-onboard-vnf-schema-moco.json @@ -1,14 +1,7 @@ [ { "request" : { "method" : "post", - "uri" : "/api/catalog/v1/vnfpackages", - "headers" : { - "Accept" : "application/json", - "Content-Type" : "application/json" - }, - "json" : { - "csarId" : "c1cec675-1069-487d-b1a9-c256b17c3291" - } + "uri" : "/api/catalog/v1/vnfpackages" }, "response" : { "status" : 202, @@ -16,4 +9,4 @@ "jobId" : "1d871fc4-380c-4699-8f7f-77e508f9734d" } } -} ]
\ No newline at end of file +} ] diff --git a/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/moco-global.json b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/moco-global.json new file mode 100644 index 00000000..1ae10db0 --- /dev/null +++ b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/moco-global.json @@ -0,0 +1,20 @@ +[ + { + "include" : "catalog/vfc-catalog-onboard-vnf-schema-moco.json" + }, + { + "include" : "catalog/vfc-catalog-onboard-ns-schema-moco.json" + }, + { + "include" : "nslcm/vfc-nslcm-create-schema-moco.json" + }, + { + "include" : "nslcm/vfc-nslcm-instantiate-schema-moco.json" + }, + { + "include" : "nslcm/vfc-nslcm-delete-schema-moco.json" + }, + { + "include" : "nslcm/vfc-nslcm-terminate-schema-moco.json" + } +]
\ No newline at end of file diff --git a/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-create-schema-moco.json b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-create-schema-moco.json index 07392582..9a7fd103 100644 --- a/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-create-schema-moco.json +++ b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-create-schema-moco.json @@ -1,15 +1,7 @@ [ { "request" : { "method" : "post", - "uri" : "/api/nslcm/v1/ns", - "headers" : { - "Accept" : "application/json", - "Content-Type" : "application/json" - }, - "json" : { - "csarId" : "a3394090-c5b4-49b4-974c-00a6eac755ab", - "nsName" : "vcpe1" - } + "uri" : "/api/nslcm/v1/ns" }, "response" : { "status" : 201, diff --git a/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-delete-schema-moco.json b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-delete-schema-moco.json new file mode 100644 index 00000000..de6743cc --- /dev/null +++ b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-delete-schema-moco.json @@ -0,0 +1,10 @@ +[ { + "request" : { + "method" : "delete", + "uri" : "/api/nslcm/v1/ns/25f3159c-ff2d-4ad0-ac66-3270941bfa52" + }, + "response" : { + "status" : 204, + "json" : null + } +} ] diff --git a/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-delete-schema-sample.yaml b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-delete-schema-sample.yaml new file mode 100644 index 00000000..4ce418b8 --- /dev/null +++ b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-delete-schema-sample.yaml @@ -0,0 +1,9 @@ +open_cli_sample_version: 1.0 +name: vfc-nslcm-delete +version: onap-dublin +samples: + sample1: + name: vfc-nslcm-delete + input: --host-url http://localhost:12306 --ns-instance-id 25f3159c-ff2d-4ad0-ac66-3270941bfa52 + moco: vfc-nslcm-delete-schema-moco.json + output:
\ No newline at end of file diff --git a/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-instantiate-schema-moco.json b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-instantiate-schema-moco.json new file mode 100644 index 00000000..94a357b3 --- /dev/null +++ b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-instantiate-schema-moco.json @@ -0,0 +1,12 @@ +[ { + "request" : { + "method" : "post", + "uri" : "/api/nslcm/v1/ns/25f3159c-ff2d-4ad0-ac66-3270941bfa52/instantiate" + }, + "response" : { + "status" : 200, + "json" : { + "jobId" : "7b06898d-e67a-4c9f-b1ce-90346ed6e520" + } + } +} ] diff --git a/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-instantiate-schema-sample.yaml b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-instantiate-schema-sample.yaml new file mode 100644 index 00000000..bdda2352 --- /dev/null +++ b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-instantiate-schema-sample.yaml @@ -0,0 +1,14 @@ +open_cli_sample_version: 1.0 +name: vfc-nslcm-instantiate +version: onap-dublin +samples: + sample1: + name: vfc-nslcm-instantiate + input: --host-url http://localhost:12306 --ns-instance-id 25f3159c-ff2d-4ad0-ac66-3270941bfa52 --location OCOMP-lcm3_RegionOVP --sdn-controller-id 1 + moco: vfc-nslcm-instantiate-schema-moco.json + output: | + +--------------------------------------+ + |job-id | + +--------------------------------------+ + |7b06898d-e67a-4c9f-b1ce-90346ed6e520 | + +--------------------------------------+ diff --git a/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-terminate-schema-moco.json b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-terminate-schema-moco.json new file mode 100644 index 00000000..f7d43635 --- /dev/null +++ b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-terminate-schema-moco.json @@ -0,0 +1,12 @@ +[ { + "request" : { + "method" : "post", + "uri" : "/api/nslcm/v1/ns/25f3159c-ff2d-4ad0-ac66-3270941bfa52/terminate" + }, + "response" : { + "status" : 202, + "json" : { + "jobId" : "f479d5eb-82a1-4a1f-9174-e071ee46c841" + } + } +} ] diff --git a/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-terminate-schema-sample.yaml b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-terminate-schema-sample.yaml new file mode 100644 index 00000000..e6bdfbce --- /dev/null +++ b/products/onap-dublin/features/vfc/src/main/resources/open-cli-sample/nslcm/vfc-nslcm-terminate-schema-sample.yaml @@ -0,0 +1,14 @@ +open_cli_sample_version: 1.0 +name: vfc-nslcm-terminate +version: onap-dublin +samples: + sample1: + name: vfc-nslcm-terminate + input: --host-url http://localhost:12306 --ns-instance-id 25f3159c-ff2d-4ad0-ac66-3270941bfa52 + moco: vfc-nslcm-terminate-schema-moco.json + output: | + +--------------------------------------+ + |job-id | + +--------------------------------------+ + |f479d5eb-82a1-4a1f-9174-e071ee46c841 | + +--------------------------------------+ diff --git a/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-create-schema.yaml b/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-create-schema.yaml index 29fceccd..777e33bb 100644 --- a/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-create-schema.yaml +++ b/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-create-schema.yaml @@ -48,7 +48,7 @@ parameters: is_optional: false results: - direction: landscape + direction: portrait attributes: - name: ns-instance-id description: ns-instance-id diff --git a/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-delete-schema.yaml b/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-delete-schema.yaml index 4850e070..cda2e7f8 100644 --- a/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-delete-schema.yaml +++ b/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-delete-schema.yaml @@ -29,14 +29,6 @@ parameters: long_option: ns-instance-id is_optional: false -results: - direction: landscape - attributes: - - name: status - description: status - scope: short - type: string - http: service: auth: none @@ -52,5 +44,4 @@ http: Accept: application/json success_codes: - 204 - result_map: - status: ${success_codes} + diff --git a/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-get-schema.yaml b/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-get-schema.yaml index d6fa4398..984a1dc7 100644 --- a/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-get-schema.yaml +++ b/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-get-schema.yaml @@ -22,7 +22,7 @@ info: author: ONAP HPA Integration Team (haibin.huang@intel.com) results: - direction: landscape + direction: portrait attributes: - name: ns-instance-id description: ns-instance-id diff --git a/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-instantiate-schema.yaml b/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-instantiate-schema.yaml index b31d4e4f..91387f03 100644 --- a/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-instantiate-schema.yaml +++ b/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-instantiate-schema.yaml @@ -42,7 +42,7 @@ parameters: is_optional: false results: - direction: landscape + direction: portrait attributes: - name: job-id description: job id diff --git a/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-terminate-schema.yaml b/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-terminate-schema.yaml index 19f68666..387ab16c 100644 --- a/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-terminate-schema.yaml +++ b/products/onap-dublin/features/vfc/src/main/resources/open-cli-schema/nslcm/vfc-nslcm-terminate-schema.yaml @@ -30,7 +30,7 @@ parameters: is_optional: false results: - direction: landscape + direction: portrait attributes: - name: job-id description: job id |