X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=test%2Fvcpe%2Fsoutils.py;h=6cddd6d0888ed7773a08a9c165ebffe672b0d8cb;hb=refs%2Fheads%2Fcasablanca;hp=cc82068a632e5bc9d96615b4476f91bdf6a7bc58;hpb=c2d1135b4d1d3c7259e44cd821d94b36ba8c26de;p=integration.git diff --git a/test/vcpe/soutils.py b/test/vcpe/soutils.py index cc82068a6..5cfe46408 100755 --- a/test/vcpe/soutils.py +++ b/test/vcpe/soutils.py @@ -18,6 +18,7 @@ class SoUtils: :param vcpecommon: :param api_version: must be 'v4' or 'v5' """ + self.tmp_solution_for_so_bug = False self.logger = logging.getLogger(__name__) self.vcpecommon = vcpecommon if api_version not in self.vcpecommon.so_req_api_url: @@ -49,7 +50,9 @@ class SoUtils: self.logger.error('Invalid request type: {0}. Can only be service/vnf/network/vfmodule'.format(req_type)) return None, None + self.logger.info(url) r = requests.post(url, headers=self.vcpecommon.so_headers, auth=self.vcpecommon.so_userpass, json=req_json) + self.logger.debug(r) response = r.json() self.logger.debug('---------------------------------------------------------------') @@ -58,6 +61,7 @@ class SoUtils: self.logger.debug('---------------------------------------------------------------') req_id = response.get('requestReferences', {}).get('requestId', '') instance_id = response.get('requestReferences', {}).get('instanceId', '') + return req_id, instance_id def check_progress(self, req_id, eta=0, interval=5): @@ -119,7 +123,8 @@ class SoUtils: 'modelInfo': vnf_or_network_model, 'cloudConfiguration': {"lcpCloudRegionId": self.vcpecommon.os_region_name, "tenantId": self.vcpecommon.os_tenant_id}, - 'requestParameters': {"userParams": []} + 'requestParameters': {"userParams": []}, + 'platform': {"platformName": "Platform-Demonstration"} } self.add_req_info(req_details, instance_name, self.vcpecommon.product_family_id) self.add_related_instance(req_details, service_instance_id, service_model) @@ -149,20 +154,47 @@ class SoUtils: } } self.add_req_info(req_details, instance_name) + self.add_project_info(req_details) + self.add_owning_entity(req_details) return {'requestDetails': req_details} + def add_project_info(self, req_details): + req_details['project'] = {'projectName': self.vcpecommon.project_name} + + def add_owning_entity(self, req_details): + req_details['owningEntity'] = {'owningEntityId': self.vcpecommon.owning_entity_id, + 'owningEntityName': self.vcpecommon.owning_entity_name} + def generate_custom_service_request(self, instance_name, model, brg_mac): + brg_mac_enc = brg_mac.replace(':', '-') req_details = { 'modelInfo': model, 'subscriberInfo': {'subscriberName': 'Kaneohe', 'globalSubscriberId': self.vcpecommon.global_subscriber_id}, - 'cloudConfiguration': {"lcpCloudRegionId": self.vcpecommon.os_region_name, + 'cloudConfiguration': {"lcpCloudRegionId": 'RegionOne', #self.vcpecommon.os_region_name, "tenantId": self.vcpecommon.os_tenant_id}, 'requestParameters': { "userParams": [ { 'name': 'BRG_WAN_MAC_Address', 'value': brg_mac + }, + { + 'name': 'VfModuleNames', + 'value': [ + { + 'VfModuleModelInvariantUuid': self.vcpecommon.vgw_VfModuleModelInvariantUuid, + 'VfModuleName': 'VGW2BRG-{0}'.format(brg_mac_enc) + } + ] + }, + { + "name": "Customer_Location", + "value": self.vcpecommon.customer_location_used_by_oof + }, + { + "name": "Homing_Solution", + "value": self.vcpecommon.homing_solution } ], "subscriptionServiceType": "vCPE", @@ -170,6 +202,8 @@ class SoUtils: } } self.add_req_info(req_details, instance_name, self.vcpecommon.custom_product_family_id) + self.add_project_info(req_details) + self.add_owning_entity(req_details) return {'requestDetails': req_details} def create_custom_service(self, csar_file, brg_mac, name_suffix=None): @@ -183,10 +217,10 @@ class SoUtils: # create service instance_name = '_'.join([self.vcpecommon.instance_name_prefix['service'], - parser.svc_model['modelName'], name_suffix]) + parser.svc_model['modelName'][0:10], name_suffix]) instance_name = instance_name.lower() req = self.generate_custom_service_request(instance_name, parser.svc_model, brg_mac) - self.logger.debug(json.dumps(req, indent=2, sort_keys=True)) + self.logger.info(json.dumps(req, indent=2, sort_keys=True)) self.logger.info('Creating custom service {0}.'.format(instance_name)) req_id, svc_instance_id = self.submit_create_req(req, 'service') if not self.check_progress(req_id, 140): @@ -306,7 +340,7 @@ class SoUtils: vnf_instance_id, vnf_model) self.logger.debug(json.dumps(req, indent=2, sort_keys=True)) req_id, vfmodule_instance_id = self.submit_create_req(req, 'vfmodule', svc_instance_id, vnf_instance_id) - if not self.check_progress(req_id, eta=70, interval=5): + if not self.check_progress(req_id, eta=70, interval=50): self.logger.error('Failed to create VF Module {0}.'.format(vfmodule_instance_name)) return None