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/integration | |
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/integration')
-rw-r--r-- | products/onap-dublin/features/integration/src/main/resources/conf/vnf-tosca-lcm.json (renamed from products/onap-dublin/features/integration/src/main/resources/conf/vnf-tosca-provision.json) | 0 | ||||
-rw-r--r-- | products/onap-dublin/features/integration/src/main/resources/open-cli-sample/vnf-tosca-lcm-dublin-schema-sample.yaml (renamed from products/onap-dublin/features/integration/src/main/resources/open-cli-sample/vnf-tosca-provision-dublin-schema-sample.yaml) | 4 | ||||
-rw-r--r-- | products/onap-dublin/features/integration/src/main/resources/open-cli-schema/vnf-tosca-lcm-dublin-schema.yaml (renamed from products/onap-dublin/features/integration/src/main/resources/open-cli-schema/vnf-tosca-provision-dublin-schema.yaml) | 8 | ||||
-rw-r--r-- | products/onap-dublin/features/integration/src/main/resources/script/vnf-tosca-lcm.py (renamed from products/onap-dublin/features/integration/src/main/resources/script/vnf-tosca-provision.py) | 33 |
4 files changed, 30 insertions, 15 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 |