diff options
author | Brian Freeman <bf1936@att.com> | 2019-11-06 13:22:53 -0500 |
---|---|---|
committer | Daniel Rose <dr695h@att.com> | 2019-11-14 17:01:50 +0000 |
commit | 9b3d6ca160649ebd23c5646b2a24af0e86aa21fa (patch) | |
tree | 4e366e8400a7c63b3a56990561c05358c1a308f5 | |
parent | 48e2fd833c8ef9ea59f7312f5aea2cd9a2a22f1e (diff) |
Initial GRA_API Support
Updated after testing in integration-release-daily
Issue-ID: INT-1345
Change-Id: I61410e97d244ec7a736722727e11764fb5f3f5a9
Signed-off-by: Brian Freeman <bf1936@att.com>
-rwxr-xr-x | test/vcpe/preload.py | 27 | ||||
-rw-r--r-- | test/vcpe/preload_templates/template.vcpe_bnggra_vfmodule.json | 173 | ||||
-rw-r--r-- | test/vcpe/preload_templates/template.vcpe_brgemugra_vfmodule.json | 141 | ||||
-rw-r--r-- | test/vcpe/preload_templates/template.vcpe_gmuxgra_vfmodule.json | 161 | ||||
-rw-r--r-- | test/vcpe/preload_templates/template.vcpe_infragra_vfmodule.json | 182 | ||||
-rwxr-xr-x | test/vcpe/soutils.py | 32 | ||||
-rwxr-xr-x | test/vcpe/vcpe.py | 39 | ||||
-rwxr-xr-x | test/vcpe/vcpecommon.py | 17 |
8 files changed, 746 insertions, 26 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') diff --git a/test/vcpe/preload_templates/template.vcpe_bnggra_vfmodule.json b/test/vcpe/preload_templates/template.vcpe_bnggra_vfmodule.json new file mode 100644 index 000000000..544d8e1b1 --- /dev/null +++ b/test/vcpe/preload_templates/template.vcpe_bnggra_vfmodule.json @@ -0,0 +1,173 @@ +{ + "GENERIC-RESOURCE-API:input": { + "GENERIC-RESOURCE-API:request-information": { + "GENERIC-RESOURCE-API:notification-url": "https://so.onap.org", + "GENERIC-RESOURCE-API:order-number": "robot12", + "GENERIC-RESOURCE-API:order-version": "1.0", + "GENERIC-RESOURCE-API:request-action": "PreloadVfModuleRequest", + "GENERIC-RESOURCE-API:request-id": "robot12", + "GENERIC-RESOURCE-API:source": "VID" + }, + "GENERIC-RESOURCE-API:sdnc-request-header": { + "GENERIC-RESOURCE-API:svc-action": "reserve", + "GENERIC-RESOURCE-API:svc-notification-url": "https://son.onap.org", + "GENERIC-RESOURCE-API:svc-request-id": "robot12" + }, + "preload-vf-module-topology-information": { + "vf-module-topology": { + "vf-module-parameters": { + "param": [ + { + "name": "vcpe_image_name", + "value": "vbng-casa-base-ubuntu-16-04" + }, + { + "name": "vcpe_flavor_name", + "value": "m1.medium" + }, + { + "name": "public_net_id", + "value": "${public_net_id}" + }, + { + "name": "brgemu_bng_private_net_id", + "value": "${brg_bng_net}" + }, + { + "name": "brgemu_bng_private_subnet_id", + "value": "${brg_bng_subnet}" + }, + { + "name": "bng_gmux_private_net_id", + "value": "${bng_mux_net}" + }, + { + "name": "bng_gmux_private_subnet_id", + "value": "${bng_mux_subnet}" + }, + { + "name": "onap_private_net_id", + "value": "${oam_onap_net}" + }, + { + "name": "onap_private_subnet_id", + "value": "${oam_onap_subnet}" + }, + { + "name": "onap_private_net_cidr", + "value": "10.0.0.0/16" + }, + { + "name": "cpe_signal_net_id", + "value": "${cpe_signal_net}" + }, + { + "name": "cpe_signal_subnet_id", + "value": "${cpe_signal_subnet}" + }, + { + "name": "brgemu_bng_private_net_cidr", + "value": "10.3.0.0/24" + }, + { + "name": "bng_gmux_private_net_cidr", + "value": "10.1.0.0/24" + }, + { + "name": "cpe_signal_private_net_cidr", + "value": "10.4.0.0/24" + }, + { + "name": "sdnc_ip_addr", + "value": "${sdnc_oam_ip}" + }, + { + "name": "vbng_private_ip_0", + "value": "10.3.0.1" + }, + { + "name": "vbng_private_ip_1", + "value": "10.0.101.10" + }, + { + "name": "vbng_private_ip_2", + "value": "10.4.0.3" + }, + { + "name": "vbng_private_ip_3", + "value": "10.1.0.10" + }, + { + "name": "vbng_name_0", + "value": "zdcpe1cpe01bng01_${suffix}" + }, + { + "name": "vnf_id", + "value": "vCPE_Infrastructure_Metro_vBNG_demo_app" + }, + { + "name": "vf_module_id", + "value": "vCPE_Intrastructure_Metro_vBNG" + }, + { + "name": "dcae_collector_ip", + "value": "10.0.4.102" + }, + { + "name": "dcae_collector_port", + "value": "8080" + }, + { + "name": "repo_url_blob", + "value": "https://nexus.onap.org/content/sites/raw" + }, + { + "name": "repo_url_artifacts", + "value": "https://nexus.onap.org/content/repositories/releases" + }, + { + "name": "demo_artifacts_version", + "value": "1.1.1" + }, + { + "name": "script_version", + "value": "1.3.0" + }, + { + "name": "key_name", + "value": "vbng_key" + }, + { + "name": "pub_key", + "value": "${pub_key}" + }, + { + "name": "cloud_env", + "value": "openstack" + }, + { + "name": "vpp_source_repo_url", + "value": "https://gerrit.fd.io/r/vpp" + }, + { + "name": "vpp_source_repo_branch", + "value": "stable/1704" + }, + { + "name": "vpp_patch_url", + "value": "https://git.onap.org/demo/plain/vnfs/vCPE/vpp-radius-client-for-vbng/src/patches/Vpp-Integrate-FreeRADIUS-Client-for-vBNG.patch" + } + ] }, + "vf-module-assignments": {}, + "vf-module-topology-identifier": { + "vf-module-name": "${vnf_name}" + } + }, + "vnf-resource-assignments": {}, + "vnf-topology-identifier-structure": { + "nf-type": "${vnf_type}", + "vnf-id": "${vnf_name}" + } + } + } +} diff --git a/test/vcpe/preload_templates/template.vcpe_brgemugra_vfmodule.json b/test/vcpe/preload_templates/template.vcpe_brgemugra_vfmodule.json new file mode 100644 index 000000000..4d5b2d425 --- /dev/null +++ b/test/vcpe/preload_templates/template.vcpe_brgemugra_vfmodule.json @@ -0,0 +1,141 @@ +{ + "GENERIC-RESOURCE-API:input": { + "GENERIC-RESOURCE-API:request-information": { + "GENERIC-RESOURCE-API:notification-url": "https://so.onap.org", + "GENERIC-RESOURCE-API:order-number": "robot12", + "GENERIC-RESOURCE-API:order-version": "1.0", + "GENERIC-RESOURCE-API:request-action": "PreloadVfModuleRequest", + "GENERIC-RESOURCE-API:request-id": "robot12", + "GENERIC-RESOURCE-API:source": "VID" + }, + "GENERIC-RESOURCE-API:sdnc-request-header": { + "GENERIC-RESOURCE-API:svc-action": "reserve", + "GENERIC-RESOURCE-API:svc-notification-url": "https://son.onap.org", + "GENERIC-RESOURCE-API:svc-request-id": "robot12" + }, + "preload-vf-module-topology-information": { + "vf-module-topology": { + "vf-module-parameters": { + "param": [ + { + "name": "vcpe_image_name", + "value": "vbrg-casa-base-ubuntu-16-04" + }, + { + "name": "vcpe_flavor_name", + "value": "m1.medium" + }, + { + "name": "public_net_id", + "value": "${public_net_id}" + }, + { + "name": "vbrgemu_bng_private_net_id", + "value": "${brg_bng_net}" + }, + { + "name": "vbrgemu_bng_private_subnet_id", + "value": "${brg_bng_subnet}" + }, + { + "name": "onap_private_net_id", + "value": "${oam_onap_net}" + }, + { + "name": "onap_private_subnet_id", + "value": "${oam_onap_subnet}" + }, + { + "name": "onap_private_net_cidr", + "value": "10.0.0.0/16" + }, + { + "name": "compile_state", + "value": "done" + }, + { + "name": "vbrgemu_bng_private_net_cidr", + "value": "10.3.0.0/24" + }, + { + "name": "vbrgemu_private_ip_0", + "value": "10.3.0.21" + }, + { + "name": "sdnc_ip", + "value": "${sdnc_oam_ip}" + }, + { + "name": "vbrgemu_name_0", + "value": "zdcpe1cpe01brgemu01_${suffix}" + }, + { + "name": "vnf_id", + "value": "vCPE_Infrastructure_BGREMU_demo_app_${suffix}" + }, + { + "name": "vf_module_id", + "value": "vCPE_Customer_BRGEMU_${suffix}" + }, + { + "name": "repo_url_blob", + "value": "https://nexus.onap.org/content/sites/raw" + }, + { + "name": "repo_url_artifacts", + "value": "https://nexus.onap.org/content/repositories/releases" + }, + { + "name": "demo_artifacts_version", + "value": "1.1.1" + }, + { + "name": "script_version", + "value": "1.3.0" + }, + { + "name": "key_name", + "value": "vbrgemu_key" + }, + { + "name": "pub_key", + "value": "${pub_key}" + }, + { + "name": "cloud_env", + "value": "openstack" + }, + { + "name": "vpp_source_repo_url", + "value": "https://gerrit.fd.io/r/vpp" + }, + { + "name": "vpp_source_repo_branch", + "value": "stable/1704" + }, + { + "name": "hc2vpp_source_repo_url", + "value": "https://gerrit.fd.io/r/hc2vpp" + }, + { + "name": "hc2vpp_source_repo_branch", + "value": "stable/1704" + }, + { + "name": "vpp_patch_url", + "value": "https://git.onap.org/demo/plain/vnfs/vCPE/vpp-option-82-for-vbrg/src/patches/VPP-Add-Option82-Nat-Filter-For-vBRG.patch" + } + ] }, + "vf-module-assignments": {}, + "vf-module-topology-identifier": { + "vf-module-name": "${vnf_name}" + } + }, + "vnf-resource-assignments": {}, + "vnf-topology-identifier-structure": { + "nf-type": "${vnf_type}", + "vnf-id": "${vnf_name}" + } + } + } +} diff --git a/test/vcpe/preload_templates/template.vcpe_gmuxgra_vfmodule.json b/test/vcpe/preload_templates/template.vcpe_gmuxgra_vfmodule.json new file mode 100644 index 000000000..b97ac941b --- /dev/null +++ b/test/vcpe/preload_templates/template.vcpe_gmuxgra_vfmodule.json @@ -0,0 +1,161 @@ +{ + "GENERIC-RESOURCE-API:input": { + "GENERIC-RESOURCE-API:request-information": { + "GENERIC-RESOURCE-API:notification-url": "https://so.onap.org", + "GENERIC-RESOURCE-API:order-number": "robot12", + "GENERIC-RESOURCE-API:order-version": "1.0", + "GENERIC-RESOURCE-API:request-action": "PreloadVfModuleRequest", + "GENERIC-RESOURCE-API:request-id": "robot12", + "GENERIC-RESOURCE-API:source": "VID" + }, + "GENERIC-RESOURCE-API:sdnc-request-header": { + "GENERIC-RESOURCE-API:svc-action": "reserve", + "GENERIC-RESOURCE-API:svc-notification-url": "https://son.onap.org", + "GENERIC-RESOURCE-API:svc-request-id": "robot12" + }, + "preload-vf-module-topology-information": { + "vf-module-topology": { + "vf-module-parameters": { + "param": [ + { + "name": "vcpe_image_name", + "value": "vgmux-casa-base-ubuntu-16-04" + }, + { + "name": "vcpe_flavor_name", + "value": "m1.medium" + }, + { + "name": "public_net_id", + "value": "${public_net_id}" + }, + { + "name": "bng_gmux_private_net_id", + "value": "${bng_mux_net}" + }, + { + "name": "bng_gmux_private_subnet_id", + "value": "${bng_mux_subnet}" + }, + { + "name": "mux_gw_private_net_id", + "value": "${mux_gw_net}" + }, + { + "name": "mux_gw_private_subnet_id", + "value": "${mux_gw_subnet}" + }, + { + "name": "onap_private_net_id", + "value": "${oam_onap_net}" + }, + { + "name": "onap_private_subnet_id", + "value": "${oam_onap_subnet}" + }, + { + "name": "onap_private_net_cidr", + "value": "10.0.0.0/16" + }, + { + "name": "mux_gw_private_net_cidr", + "value": "10.5.0.0/24" + }, + { + "name": "bng_gmux_private_net_cidr", + "value": "10.1.0.0/24" + }, + { + "name": "vgmux_private_ip_0", + "value": "10.1.0.21" + }, + { + "name": "vgmux_private_ip_1", + "value": "10.0.101.21" + }, + { + "name": "vgmux_private_ip_2", + "value": "10.5.0.21" + }, + { + "name": "vgmux_name_0", + "value": "zdcpe1cpe01mux01_${suffix}" + }, + { + "name": "vnf_id", + "value": "vCPE_Infrastructure_Metro_vGMUX_demo_app" + }, + { + "name": "vf_module_id", + "value": "vCPE_Intrastructure_Metro_vGMUX" + }, + { + "name": "dcae_collector_ip", + "value": "10.0.4.102" + }, + { + "name": "dcae_collector_port", + "value": "8080" + }, + { + "name": "repo_url_blob", + "value": "https://nexus.onap.org/content/sites/raw" + }, + { + "name": "repo_url_artifacts", + "value": "https://nexus.onap.org/content/repositories/releases" + }, + { + "name": "demo_artifacts_version", + "value": "1.1.1" + }, + { + "name": "script_version", + "value": "1.3.0" + }, + { + "name": "key_name", + "value": "vgmux_key" + }, + { + "name": "pub_key", + "value": "${pub_key}" + }, + { + "name": "cloud_env", + "value": "openstack" + }, + { + "name": "vpp_source_repo_url", + "value": "https://gerrit.fd.io/r/vpp" + }, + { + "name": "vpp_source_repo_branch", + "value": "stable/1704" + }, + { + "name": "vpp_patch_url", + "value": "https://git.onap.org/demo/plain/vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/Vpp-Add-VES-agent-for-vG-MUX.patch" + }, + { + "name": "hc2vpp_patch_url", + "value": "https://git.onap.org/demo/plain/vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/Hc2vpp-Add-VES-agent-for-vG-MUX.patch" + }, + { + "name": "libevel_patch_url", + "value": "https://git.onap.org/demo/plain/vnfs/vCPE/vpp-ves-agent-for-vgmux/src/patches/vCPE-vG-MUX-libevel-fixup.patch" + } + ] }, + "vf-module-assignments": {}, + "vf-module-topology-identifier": { + "vf-module-name": "${vnf_name}" + } + }, + "vnf-resource-assignments": {}, + "vnf-topology-identifier-structure": { + "nf-type": "${vnf_type}", + "vnf-id": "${vnf_name}" + } + } + } +} diff --git a/test/vcpe/preload_templates/template.vcpe_infragra_vfmodule.json b/test/vcpe/preload_templates/template.vcpe_infragra_vfmodule.json new file mode 100644 index 000000000..0b076b448 --- /dev/null +++ b/test/vcpe/preload_templates/template.vcpe_infragra_vfmodule.json @@ -0,0 +1,182 @@ +{ + "GENERIC-RESOURCE-API:input": { + "GENERIC-RESOURCE-API:request-information": { + "GENERIC-RESOURCE-API:notification-url": "https://so.onap.org", + "GENERIC-RESOURCE-API:order-number": "robot12", + "GENERIC-RESOURCE-API:order-version": "1.0", + "GENERIC-RESOURCE-API:request-action": "PreloadVfModuleRequest", + "GENERIC-RESOURCE-API:request-id": "robot12", + "GENERIC-RESOURCE-API:source": "VID" + }, + "GENERIC-RESOURCE-API:sdnc-request-header": { + "GENERIC-RESOURCE-API:svc-action": "reserve", + "GENERIC-RESOURCE-API:svc-notification-url": "https://son.onap.org", + "GENERIC-RESOURCE-API:svc-request-id": "robot12" + }, + "preload-vf-module-topology-information": { + "vf-module-topology": { + "vf-module-parameters": { + "param": [ + { + "name": "vcpe_image_name", + "value": "ubuntu-16-04-cloud-amd64" + }, + { + "name": "vcpe_flavor_name", + "value": "m1.medium" + }, + { + "name": "public_net_id", + "value": "${public_net_id}" + }, + { + "name": "cpe_signal_net_id", + "value": "${cpe_signal_net}" + }, + { + "name": "cpe_signal_subnet_id", + "value": "${cpe_signal_subnet}" + }, + { + "name": "cpe_public_net_id", + "value": "${cpe_public_net}" + }, + { + "name": "cpe_public_subnet_id", + "value": "${cpe_public_subnet}" + }, + { + "name": "onap_private_net_id", + "value": "${oam_onap_net}" + }, + { + "name": "onap_private_subnet_id", + "value": "${oam_onap_subnet}" + }, + { + "name": "onap_private_net_cidr", + "value": "10.0.0.0/16" + }, + { + "name": "cpe_signal_net_cidr", + "value": "10.4.0.0/24" + }, + { + "name": "cpe_public_net_cidr", + "value": "10.2.0.0/24" + }, + { + "name": "vdhcp_private_ip_0", + "value": "10.4.0.1" + }, + { + "name": "vdhcp_private_ip_1", + "value": "10.0.101.1" + }, + { + "name": "vaaa_private_ip_0", + "value": "10.4.0.2" + }, + { + "name": "vaaa_private_ip_1", + "value": "10.0.101.2" + }, + { + "name": "vdns_private_ip_0", + "value": "10.2.0.1" + }, + { + "name": "vdns_private_ip_1", + "value": "10.0.101.3" + }, + { + "name": "vweb_private_ip_0", + "value": "10.2.0.10" + }, + { + "name": "vweb_private_ip_1", + "value": "10.0.101.40" + }, + { + "name": "mr_ip_addr", + "value": "${mr_ip_addr}" + }, + { + "name": "mr_ip_port", + "value": "${mr_ip_port}" + }, + { + "name": "vaaa_name_0", + "value": "zdcpe1cpe01aaa01_${suffix}" + }, + { + "name": "vdns_name_0", + "value": "zdcpe1cpe01dns01_${suffix}" + }, + { + "name": "vdhcp_name_0", + "value": "zdcpe1cpe01dhcp01_${suffix}" + }, + { + "name": "vweb_name_0", + "value": "zdcpe1cpe01web01_${suffix}" + }, + { + "name": "vnf_id", + "value": "vCPE_Infrastructure_demo_app_${suffix}" + }, + { + "name": "vf_module_id", + "value": "vCPE_Intrastructure_${suffix}" + }, + { + "name": "dcae_collector_ip", + "value": "10.0.4.102" + }, + { + "name": "dcae_collector_port", + "value": "8080" + }, + { + "name": "repo_url_blob", + "value": "https://nexus.onap.org/content/sites/raw" + }, + { + "name": "repo_url_artifacts", + "value": "https://nexus.onap.org/content/repositories/releases" + }, + { + "name": "demo_artifacts_version", + "value": "1.3.0" + }, + { + "name": "install_script_version", + "value": "1.3.0" + }, + { + "name": "key_name", + "value": "vaaa_key" + }, + { + "name": "pub_key", + "value": "${pub_key}" + }, + { + "name": "cloud_env", + "value": "openstack" + } + + ] }, + "vf-module-assignments": {}, + "vf-module-topology-identifier": { + "vf-module-name": "${vnf_name}" + } + }, + "vnf-resource-assignments": {}, + "vnf-topology-identifier-structure": { + "nf-type": "${vnf_type}", + "vnf-id": "${vnf_name}" + } + } + } +} diff --git a/test/vcpe/soutils.py b/test/vcpe/soutils.py index 2a953e795..627d74b6a 100755 --- a/test/vcpe/soutils.py +++ b/test/vcpe/soutils.py @@ -25,6 +25,7 @@ class SoUtils: self.logger.error('Incorrect SO API version: %s', api_version) sys.exit(1) self.service_req_api_url = self.vcpecommon.so_req_api_url[api_version] + self.testApi = 'VNF_API' def submit_create_req(self, req_json, req_type, service_instance_id=None, vnf_instance_id=None): """ @@ -119,11 +120,16 @@ class SoUtils: def generate_vnf_or_network_request(self, req_type, instance_name, vnf_or_network_model, service_instance_id, service_model): + if self.vcpecommon.gra_api_flag: + self.testApi = 'GR_API' req_details = { 'modelInfo': vnf_or_network_model, 'cloudConfiguration': {"lcpCloudRegionId": self.vcpecommon.os_region_name, "tenantId": self.vcpecommon.os_tenant_id}, - 'requestParameters': {"userParams": []}, + 'requestParameters': { + "userParams": [], + "testApi": self.testApi + }, 'platform': {"platformName": "Platform-Demonstration"} } self.add_req_info(req_details, instance_name, self.vcpecommon.product_family_id) @@ -132,11 +138,16 @@ class SoUtils: def generate_vfmodule_request(self, instance_name, vfmodule_model, service_instance_id, service_model, vnf_instance_id, vnf_model): + if self.vcpecommon.gra_api_flag: + self.testApi = 'GR_API' req_details = { 'modelInfo': vfmodule_model, 'cloudConfiguration': {"lcpCloudRegionId": self.vcpecommon.os_region_name, "tenantId": self.vcpecommon.os_tenant_id}, - 'requestParameters': {"usePreload": 'true'} + 'requestParameters': { + "usePreload": 'true', + "testApi": self.testApi + } } self.add_req_info(req_details, instance_name, self.vcpecommon.product_family_id) self.add_related_instance(req_details, service_instance_id, service_model) @@ -144,18 +155,25 @@ class SoUtils: return {'requestDetails': req_details} def generate_service_request(self, instance_name, model): + if self.vcpecommon.gra_api_flag: + self.testApi = 'GR_API' + + self.logger.info('testApi' + self.testApi) + req_details = { 'modelInfo': model, 'subscriberInfo': {'globalSubscriberId': self.vcpecommon.global_subscriber_id}, 'requestParameters': { "userParams": [], "subscriptionServiceType": "vCPE", - "aLaCarte": 'true' + "aLaCarte": 'true', + "testApi": self.testApi } } self.add_req_info(req_details, instance_name) self.add_project_info(req_details) self.add_owning_entity(req_details) + self.logger.info(json.dumps(req_details, indent=2, sort_keys=True)) return {'requestDetails': req_details} def add_project_info(self, req_details): @@ -323,8 +341,12 @@ class SoUtils: self.wait_for_aai('vnf', vnf_instance_id) preloader = preload.Preload(self.vcpecommon) - preloader.preload_vfmodule(vnf_template_file, svc_instance_id, parser.vnf_models[0], parser.vfmodule_models[0], - preload_dict, name_suffix) + if self.vcpecommon.gra_api_flag: + preloader.preload_vfmodule(vnf_template_file, svc_instance_id, parser.vnf_models[0], parser.vfmodule_models[0], + preload_dict, name_suffix, True) + else: + preloader.preload_vfmodule(vnf_template_file, svc_instance_id, parser.vnf_models[0], parser.vfmodule_models[0], + preload_dict, name_suffix, False) # create VF Module if len(parser.vfmodule_models) == 1: if not vnf_instance_id or not vnf_model: diff --git a/test/vcpe/vcpe.py b/test/vcpe/vcpe.py index 3356e2ba3..c768aa84d 100755 --- a/test/vcpe/vcpe.py +++ b/test/vcpe/vcpe.py @@ -80,7 +80,7 @@ def deploy_brg_only(): sys.exit(1) # Setting up SNIRO - config_sniro(vcpecommon, svc_instance_uuid['gmux'], svc_instance_uuid['brg']) + config_sniro(vcpecommon, svc_instance_uuid['gmux'], svc_instance_uuid['brgemu']) def deploy_infra(): @@ -88,8 +88,8 @@ def deploy_infra(): vcpecommon = VcpeCommon() - # preload all networks - network_template = vcpecommon.find_file('network', 'json', 'preload_templates') + # preload all VNF-API networks + network_template = vcpecommon.find_file('network.', 'json', 'preload_templates') name_suffix = datetime.now().strftime('%Y%m%d%H%M') preloader = preload.Preload(vcpecommon) preload_dict = preloader.preload_all_networks(network_template, name_suffix) @@ -100,20 +100,39 @@ def deploy_infra(): sys.exit(1) vcpecommon.save_preload_data(preload_dict) + # preload all GRA-API networks + network_template_gra = vcpecommon.find_file('networkgra.', 'json', 'preload_templates') + preloader = preload.Preload(vcpecommon) + preload_dict_gra = preloader.preload_all_networks(network_template_gra, name_suffix) + logger.debug('Initial preload dictionary:') + logger.debug(json.dumps(preload_dict, indent=4, sort_keys=True)) + if not preload_dict_gra: + logger.error("Failed to preload networks.") + sys.exit(1) + vcpecommon.save_preload_data(preload_dict_gra) + # create multiple services based on the pre-determined order svc_instance_uuid = {} - for keyword in ['infra', 'bng', 'gmux', 'brg']: + for keyword in ['infra', 'bng', 'gmux', 'brgemu']: + keyword_vnf=keyword + "_" + keyword_gra=keyword + "gra_" heatbridge = 'gmux' == keyword csar_file = vcpecommon.find_file(keyword, 'csar', 'csar') - vnf_template_file = vcpecommon.find_file(keyword, 'json', 'preload_templates') - svc_instance_uuid[keyword] = create_one_service(vcpecommon, csar_file, vnf_template_file, preload_dict, + vnf_template_file = vcpecommon.find_file(keyword_vnf, 'json', 'preload_templates') + gra_template_file = vcpecommon.find_file(keyword_gra, 'json', 'preload_templates') + if vcpecommon.gra_api_flag: + svc_instance_uuid[keyword] = create_one_service(vcpecommon, csar_file, gra_template_file, preload_dict, + name_suffix, heatbridge) + else: + svc_instance_uuid[keyword] = create_one_service(vcpecommon, csar_file, vnf_template_file, preload_dict, name_suffix, heatbridge) if not svc_instance_uuid[keyword]: sys.exit(1) vcpecommon.save_object(svc_instance_uuid, vcpecommon.svc_instance_uuid_file) + # Setting up SNIRO - config_sniro(vcpecommon, svc_instance_uuid['gmux'], svc_instance_uuid['brg']) + config_sniro(vcpecommon, svc_instance_uuid['gmux'], svc_instance_uuid['brgemu']) print('----------------------------------------------------------------------------------------------------') print('Congratulations! The following have been completed correctly:') @@ -182,7 +201,7 @@ def closed_loop(lossrate=0): def init_so_sdnc(): logger = logging.getLogger('__name__') vcpecommon = VcpeCommon() - config_sdnc_so.insert_sdnc_ip_pool(vcpecommon) + #config_sdnc_so.insert_sdnc_ip_pool(vcpecommon) config_sdnc_so.insert_customer_service_to_so(vcpecommon) #config_sdnc_so.insert_customer_service_to_sdnc(vcpecommon) vgw_vfmod_name_index= 0 @@ -213,7 +232,7 @@ def tmp_sniro(): svc_instance_uuid = vcpecommon.load_object(vcpecommon.svc_instance_uuid_file) # Setting up SNIRO - config_sniro(vcpecommon, svc_instance_uuid['gmux'], svc_instance_uuid['brg']) + config_sniro(vcpecommon, svc_instance_uuid['gmux'], svc_instance_uuid['brgemu']) def test(): @@ -242,7 +261,7 @@ if __name__ == '__main__': init() init_so_sdnc() elif sys.argv[1] == 'infra': - if 'y' == raw_input('Ready to deploy infrastructure? y/n: ').lower(): + #if 'y' == raw_input('Ready to deploy infrastructure? y/n: ').lower(): deploy_infra() elif sys.argv[1] == 'customer': if 'y' == raw_input('Ready to deploy customer service? y/n: ').lower(): diff --git a/test/vcpe/vcpecommon.py b/test/vcpe/vcpecommon.py index 58f91a777..371029e19 100755 --- a/test/vcpe/vcpecommon.py +++ b/test/vcpe/vcpecommon.py @@ -30,7 +30,12 @@ class VcpeCommon: ############################################################################################# # set the openstack cloud access credentials here - oom_mode = False + oom_mode = True + + ############################################################################################# + # set the gra_api flag + #gra_api_flag= False + gra_api_flag= True ########################### # set Openstack credentials @@ -40,10 +45,10 @@ class VcpeCommon: '--os-username': 'kxi', '--os-user-domain-id': 'default', '--os-project-domain-id': 'default', - '--os-tenant-id': 'bc43d50ffcb84750bac0c1707a9a765b' if oom_mode else '1e097c6713e74fd7ac8e4295e605ee1e', + '--os-tenant-id': '712b6016580e410b9abfec9ca34953ce' if oom_mode else '1e097c6713e74fd7ac8e4295e605ee1e', '--os-region-name': 'RegionOne', '--os-password': 'n3JhGMGuDzD8', - '--os-project-domain-name': 'Integration-SB-03' if oom_mode else 'Integration-SB-07', + '--os-project-domain-name': 'Integration-Release-Daily' if oom_mode else 'Integration-SB-07', '--os-identity-api-version': '3' } @@ -51,8 +56,8 @@ class VcpeCommon: # set oam and public network which must exist in openstack before deployment # CHANGEME part common_preload_config = { - 'oam_onap_net': 'oam_network_2No2' if oom_mode else 'oam_onap_lAky', - 'oam_onap_subnet': 'oam_network_2No2' if oom_mode else 'oam_onap_lAky', + 'oam_onap_net': 'oam_network_exxC' if oom_mode else 'oam_onap_lAky', + 'oam_onap_subnet': 'oam_network_exxC' if oom_mode else 'oam_onap_lAky', 'public_net': 'external', 'public_net_id': '971040b2-7059-49dc-b220-4fab50cb2ad4' } @@ -176,6 +181,8 @@ class VcpeCommon: self.sdnc_headers = {'Content-Type': 'application/json', 'Accept': 'application/json'} self.sdnc_preload_network_url = 'https://' + self.hosts['sdnc'] + \ ':' + self.sdnc_preloading_port + '/restconf/operations/VNF-API:preload-network-topology-operation' + self.sdnc_preload_network_gra_url = 'https://' + self.hosts['sdnc'] + \ + ':' + self.sdnc_preloading_port + '/restconf/operations/GENERIC-RESOURCE-API:preload-network-topology-operation' self.sdnc_preload_vnf_url = 'https://' + self.hosts['sdnc'] + \ ':' + self.sdnc_preloading_port + '/restconf/operations/VNF-API:preload-vnf-topology-operation' self.sdnc_preload_gra_url = 'https://' + self.hosts['sdnc'] + \ |