diff options
Diffstat (limited to 'products/onap-dublin/features/integration/src/main/resources/script/vnf-tosca-provision.py')
-rw-r--r-- | products/onap-dublin/features/integration/src/main/resources/script/vnf-tosca-provision.py | 39 |
1 files changed, 28 insertions, 11 deletions
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-provision.py index 6dc7310e..0dd7ab5b 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-provision.py @@ -126,7 +126,7 @@ class ONAP: self.conf = conf self.ocomp = OCOMP(request_id, debug, product=product, profile=profile) self.preload() - self.tag = 'Created by Open Command Platform - OCOMP' + self.tag = 'Powered by Open Command Platform - OCOMP' def preload(self): if self.conf['ONAP']: @@ -173,7 +173,7 @@ class ONAP: 'vlm-version': self.vlm_version, 'vlm-key-group-id': self.key_group_id, 'vlm-entitle-pool-id': self.entitlement_id, - 'part-number': 'OCOMP'}) + 'part-number': '100000'}) self.feature_group_id = output['id'] submit = True @@ -211,15 +211,22 @@ class ONAP: params={'vsp-id': self.vsp_id, 'vsp-version': self.vsp_version_id, 'vsp-file': self.conf['vnf']['vsp-csar']}) + output = self.ocomp.run(command='vsp-validate', params={'vsp-id': self.vsp_id, 'vsp-version': self.vsp_version_id}) if not output['status'] == "Success": raise Exception("Invalid VSP package, please check it compliance using VTP") + self.ocomp.run(command='vsp-commit', + params={'vsp-id': self.vsp_id, + 'vsp-version': self.vsp_version_id, + 'remarks': self.tag}) + self.ocomp.run(command='vsp-submit', params={'vsp-id': self.vsp_id, 'vsp-version': self.vsp_version_id}) + self.ocomp.run(command='vsp-package', params={'vsp-id': self.vsp_id, 'vsp-version': self.vsp_version_id}) @@ -313,7 +320,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' + location_id = 'ocomp-region-{}'.format(self.ocomp.request_id) self.ocomp.run(command='complex-create', params={'physical-location-id': location_id, 'data-center-code': 'ocomp', @@ -342,7 +349,7 @@ class ONAP: break if not self.cloud_id and not self.cloud_version: - cloud_id = 'OCOMP' + cloud_id = 'OCOMP-{}'.format(self.ocomp.request_id) self.ocomp.run(command='cloud-create', params={'region-name': self.conf['cloud']['region'], 'complex-name': self.location_id, @@ -379,10 +386,11 @@ 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) self.ocomp.run(command='service-type-create', - params={'service-type': self.conf['subscription']['service-type'], - 'service-type-id': self.conf['subscription']['service-type']}) - self.service_type_id = self.conf['subscription']['service-type'] + params={'service-type': service_type_id, + 'service-type-id': service_type_id}) + self.service_type_id = service_type_id subscribe = True output = self.ocomp.run(command='service-type-list') @@ -393,10 +401,11 @@ 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) self.ocomp.run(command='customer-create', - params={'customer-name': self.conf['subscription']['customer-name'], - 'subscriber-name': self.conf['subscription']['customer-name']}) - self.customer_id = self.conf['subscription']['customer-name'] + params={'customer-name': customer_id, + 'subscriber-name': customer_id}) + self.customer_id = customer_id subscribe = True output = self.ocomp.run(command='customer-list') @@ -619,8 +628,9 @@ if __name__ == '__main__': '\ncleanup - Remove the ONAP objects which are either created during \nsetup and standup phase or provided by the user in result-json file ' \ '\nCAUTION: If required, do not provide the existing ONAP object ids \nin result-json while doing the cleanup, to avoid them getting deleted.'\ '\ncheckup - Check the deployment weather OCOMP is working properly or not' \ + '\nprovision - Run thru setup -> standup' \ '\nvalidate - run thru setup -> standup -> cleanup modes for end to end vnf validation', - choices=('setup', 'standup', 'cleanup', 'checkup', 'validate')) + choices=('setup', 'standup', 'cleanup', 'checkup', 'provision', 'validate')) args = parser.parse_args() print (args) @@ -636,6 +646,8 @@ if __name__ == '__main__': profile = args.profile request_id = args.request_id + if not request_id: + request_id = str(uuid.uuid4()) vsp_csar = args.vsp vnf_csar = args.vnf_csar ns_csar = args.ns_csar @@ -671,8 +683,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) if vnf_name: conf['vnf']['vendor-name'] = vendor_name + conf['vnf']['vendor-name'] = '{}-{}'.format(conf['vnf']['vendor-name'], request_id) if args.result: @@ -713,6 +727,9 @@ if __name__ == '__main__': elif mode == 'checkup': onap.ocomp.product = 'open-cli' onap.ocomp.run(command='schema-list', params={'product': 'open-cli'}) + elif mode == 'provision': + _setup() + _standup() elif mode == 'validate': _setup() _standup() |