aboutsummaryrefslogtreecommitdiffstats
path: root/test/vcpe/preload.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/vcpe/preload.py')
-rwxr-xr-xtest/vcpe/preload.py27
1 files changed, 21 insertions, 6 deletions
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')