From 9b3d6ca160649ebd23c5646b2a24af0e86aa21fa Mon Sep 17 00:00:00 2001 From: Brian Freeman Date: Wed, 6 Nov 2019 13:22:53 -0500 Subject: Initial GRA_API Support Updated after testing in integration-release-daily Issue-ID: INT-1345 Change-Id: I61410e97d244ec7a736722727e11764fb5f3f5a9 Signed-off-by: Brian Freeman --- test/vcpe/preload.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'test/vcpe/preload.py') diff --git a/test/vcpe/preload.py b/test/vcpe/preload.py index 513d6e8e4..f99d8dee1 100755 --- a/test/vcpe/preload.py +++ b/test/vcpe/preload.py @@ -101,9 +101,14 @@ class Preload: '${subnet_gateway}': subnet_gateway } self.logger.info('Preloading network ' + network_role) - return self.preload(template_file, replace_dict, self.vcpecommon.sdnc_preload_network_url) + self.logger.info('template_file:' + template_file) + if 'networkgra' in template_file: + return self.preload(template_file, replace_dict, self.vcpecommon.sdnc_preload_network_gra_url) + else: + return self.preload(template_file, replace_dict, self.vcpecommon.sdnc_preload_network_url) def preload(self, template_file, replace_dict, url): + self.logger.debug('tempalte_file:'+ template_file) json_data = self.generate_json(template_file, replace_dict) self.logger.debug(json.dumps(json_data, indent=4, sort_keys=True)) r = requests.post(url, headers=self.vcpecommon.sdnc_headers, auth=self.vcpecommon.sdnc_userpass, json=json_data, verify=False) @@ -131,7 +136,7 @@ class Preload: self.logger.info('Preloading vGW-GRA') return self.preload(template_file, replace_dict, self.vcpecommon.sdnc_preload_gra_url) - def preload_vfmodule(self, template_file, service_instance_id, vnf_model, vfmodule_model, common_dict, name_suffix): + def preload_vfmodule(self, template_file, service_instance_id, vnf_model, vfmodule_model, common_dict, name_suffix , gra_api_flag): """ :param template_file: :param service_instance_id: @@ -161,7 +166,10 @@ class Preload: '${suffix}': name_suffix} replace_dict.update(common_dict) self.logger.info('Preloading VF Module ' + vfmodule_name) - return self.preload(template_file, replace_dict, self.vcpecommon.sdnc_preload_vnf_url) + if gra_api_flag: + return self.preload(template_file, replace_dict, self.vcpecommon.sdnc_preload_gra_url) + else: + return self.preload(template_file, replace_dict, self.vcpecommon.sdnc_preload_vnf_url) def preload_all_networks(self, template_file, name_suffix): common_dict = {'${' + k + '}': v for k, v in self.vcpecommon.common_preload_config.items()} @@ -191,14 +199,21 @@ class Preload: keys = ['infra', 'bng', 'gmux', 'brg'] for key in keys: + key_vnf= key + "_" + key_gra = key + "gra_" csar_file = self.vcpecommon.find_file(key, 'csar', 'csar') - template_file = self.vcpecommon.find_file(key, 'json', 'preload_templates') - if csar_file and template_file: + template_file = self.vcpecommon.find_file(key_vnf, 'json', 'preload_templates') + template_file_gra = self.vcpecommon.find_file(key_gra, 'json', 'preload_templates') + if csar_file and template_file and template_file_gra: parser = csar_parser.CsarParser() parser.parse_csar(csar_file) service_instance_id = 'test112233' + # preload both VNF-API and GRA-API preloader.preload_vfmodule(template_file, service_instance_id, parser.vnf_models[0], - parser.vfmodule_models[0], network_dict, name_suffix) + parser.vfmodule_models[0], network_dict, name_suffix, False) + preloader.preload_vfmodule(template_file_gra, service_instance_id, parser.vnf_models[0], + parser.vfmodule_models[0], network_dict, name_suffix, True) + def test_sniro(self): template_sniro_data = self.vcpecommon.find_file('sniro_data', 'json', 'preload_templates') -- cgit 1.2.3-korg