diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapterImpl.java | 2 | ||||
-rwxr-xr-x | test/vcpe/cleanvGMUX.sh | 62 | ||||
-rw-r--r-- | test/vcpe/healthcheck-k8s.py | 36 | ||||
-rwxr-xr-x | test/vcpe/preload.py | 9 | ||||
-rw-r--r-- | test/vcpe/preload_templates/template.vcpe_bng_vfmodule.json | 6 | ||||
-rw-r--r-- | test/vcpe/preload_templates/template.vcpe_brgemu_vfmodule.json | 144 | ||||
-rw-r--r-- | test/vcpe/preload_templates/template.vcpe_gmux_vfmodule.json | 2 | ||||
-rw-r--r-- | test/vcpe/preload_templates/template.vcpe_gwgra_vfmodule.json | 125 | ||||
-rw-r--r-- | test/vcpe/preload_templates/template.vcpe_infra_vfmodule.json | 8 | ||||
-rw-r--r-- | test/vcpe/preload_templates/template_sniro_data.json | 2 | ||||
-rw-r--r-- | test/vcpe/preload_templates/template_sniro_request.json | 2 | ||||
-rwxr-xr-x | test/vcpe/soutils.py | 2 | ||||
-rwxr-xr-x | test/vcpe/vcpe.py | 8 | ||||
-rwxr-xr-x | test/vcpe/vcpe_custom_service.py | 8 | ||||
-rwxr-xr-x | test/vcpe/vcpecommon.py | 46 |
15 files changed, 364 insertions, 98 deletions
diff --git a/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapterImpl.java b/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapterImpl.java index db1ea1578..f0c9917f5 100644 --- a/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapterImpl.java +++ b/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/simulator/client/HttpClientAdapterImpl.java @@ -33,6 +33,7 @@ import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; @@ -65,6 +66,7 @@ public class HttpClientAdapterImpl implements HttpClientAdapter { try { HttpPost request = createRequest(content, url); HttpResponse response = client.execute(request); + EntityUtils.consumeQuietly(response.getEntity()); LOGGER.info(INVOKE, "Message sent, ves response code: {}", response.getStatusLine()); } catch (IOException e) { LOGGER.warn("Error sending message to ves: {}", e.getMessage()); diff --git a/test/vcpe/cleanvGMUX.sh b/test/vcpe/cleanvGMUX.sh new file mode 100755 index 000000000..3b8dabc8d --- /dev/null +++ b/test/vcpe/cleanvGMUX.sh @@ -0,0 +1,62 @@ +#! /usr/bin/env bash +######################################################################################### +# Script to cleanpu vGMUX and other parts of the vCPE Use Case +# +# Edit the IP addresses and portas as appropriate +# +####################################################################################### + + +VGMUX_IP=10.12.6.242 +#VBRG_IP=10.12.5.142 +#SDNC_IP=10.12.5.180 + +#curl -X DELETE -u admin:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U http://$SDNC_IP:8282/restconf/config/GENERIC-RESOURCE-API:tunnelxconn-allotted-resources +#curl -X DELETE -u admin:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U http://$SDNC_IP:8282/restconf/config/GENERIC-RESOURCE-API:brg-allotted-resources + +################################### +# vGMUX +curl -H 'Content-Type: application/json' -H 'Accept: application/json' -u admin:admin -X DELETE http://$VGMUX_IP:8183/restconf/config/ietf-interfaces:interfaces/interface/vxlanTun10.3.0.2/v3po:l2 +echo + +curl -H 'Content-Type: application/json' -H 'Accept: application/json' -u admin:admin -X DELETE http://$VGMUX_IP:8183/restconf/config/ietf-interfaces:interfaces/interface/vxlanTun10.5.0.22/v3po:l2 +echo + +curl -H 'Content-Type: application/json' -H 'Accept: application/json' -u admin:admin -X DELETE http://$VGMUX_IP:8183/restconf/config/ietf-interfaces:interfaces/interface/vxlanTun10.5.0.22 +echo + +curl -H 'Content-Type: application/json' -H 'Accept: application/json' -u admin:admin -X DELETE http://$VGMUX_IP:8183/restconf/config/ietf-interfaces:interfaces/interface/vxlanTun10.3.0.2 +echo + + +curl -H 'Content-Type: application/json' -H 'Accept: application/json' -u admin:admin -X DELETE http://$VGMUX_IP:8183/restconf/config/ietf-interfaces:interfaces/interface/vxlanTun10.5.0.106 +echo +curl -H 'Content-Type: application/json' -H 'Accept: application/json' -u admin:admin -X DELETE http://$VGMUX_IP:8183/restconf/config/ietf-interfaces:interfaces/interface/vxlanTun10.5.0.107 + +curl -H 'Content-Type: application/json' -H 'Accept: application/json' -u admin:admin -X DELETE http://$VGMUX_IP:8183/restconf/config/ietf-interfaces:interfaces/interface/vxlanTun10.5.0.111 + +curl -H 'Content-Type: application/json' -H 'Accept: application/json' -u admin:admin -X DELETE http://$VGMUX_IP:8183/restconf/config/ietf-interfaces:interfaces/interface/vxlanTun10.5.0.110 + +# Check by listing interfaces +echo "********************* vGMUX status ************************" +curl -H 'Content-Type: application/json' -H 'Accept: application/json' -u admin:admin -X GET http://$VGMUX_IP:8183/restconf/config/ietf-interfaces:interfaces| python -m json.tool + + +exit; + +######################################################################################### +# remove above exit if you want to interact with the other components +######################################################################################### + + + +################################### +# vBRG +curl -u admin:admin -X DELETE http://$VBRG_IP:8183/restconf/config/ietf-interfaces:interfaces/interface/vxlanTun10.1.0.21 + +# check +echo "********************* vBRG status ************************" +curl -H 'Content-Type: application/json' -H 'Accept: application/json' -u admin:admin -X GET http://$VBRG_IP:8183/restconf/config/ietf-interfaces:interfaces| python -m json.tool + + + diff --git a/test/vcpe/healthcheck-k8s.py b/test/vcpe/healthcheck-k8s.py new file mode 100644 index 000000000..0aea3fb9e --- /dev/null +++ b/test/vcpe/healthcheck-k8s.py @@ -0,0 +1,36 @@ +#! /usr/bin/python + +import logging +import json +from vcpecommon import * +import commands +import sys + +if len(sys.argv) <2: + print('namespace not provided') + print('Usage: healthcheck-k8s.py onap') + sys.exit() + +namespace=sys.argv[1] + +logging.basicConfig(level=logging.INFO, format='%(message)s') +common = VcpeCommon() + +print('Checking vGMUX REST API from SDNC') +cmd = 'curl -u admin:admin -X GET http://10.0.101.21:8183/restconf/config/ietf-interfaces:interfaces' +ret = commands.getstatusoutput("kubectl -n {0} exec dev-sdnc-sdnc-0 -- bash -c '{1}'".format(namespace,cmd)) +sz = ret[-1].split('\n')[-1] +print('\n') +print(sz) + +print('Checking vBRG REST API from SDNC') +cmd = 'curl -u admin:admin -X GET http://10.3.0.2:8183/restconf/config/ietf-interfaces:interfaces' +ret = commands.getstatusoutput("kubectl -n {0} exec dev-sdnc-sdnc-0 -- bash -c '{1}'".format(namespace,cmd)) +sz = ret[-1].split('\n')[-1] +print('\n') +print(sz) + +print('Checking SDNC DB for vBRG MAC address') +mac = common.get_brg_mac_from_sdnc() +print(mac) + diff --git a/test/vcpe/preload.py b/test/vcpe/preload.py index c4efafde6..d72150319 100755 --- a/test/vcpe/preload.py +++ b/test/vcpe/preload.py @@ -121,6 +121,15 @@ class Preload: self.logger.info('Preloading vGW') return self.preload(template_file, replace_dict, self.vcpecommon.sdnc_preload_vnf_url) + def preload_vgw_gra(self, template_file, brg_mac, commont_dict, name_suffix, vgw_vfmod_name_index): + replace_dict = {'${brg_mac}': brg_mac, + '${suffix}': name_suffix, + '${vgw_vfmod_name_index}': vgw_vfmod_name_index + } + replace_dict.update(commont_dict) + self.logger.info('Preloading vGW-GRA') + return self.preload(template_file, replace_dict, self.vcpecommon.sdnc_preload_vnf_url) + def preload_vfmodule(self, template_file, service_instance_id, vnf_model, vfmodule_model, common_dict, name_suffix): """ :param template_file: diff --git a/test/vcpe/preload_templates/template.vcpe_bng_vfmodule.json b/test/vcpe/preload_templates/template.vcpe_bng_vfmodule.json index a95d45671..7ef2fb7db 100644 --- a/test/vcpe/preload_templates/template.vcpe_bng_vfmodule.json +++ b/test/vcpe/preload_templates/template.vcpe_bng_vfmodule.json @@ -25,7 +25,7 @@ "VNF-API:vnf-parameters": [ { "vnf-parameter-name": "vcpe_image_name", - "vnf-parameter-value": "vbng-base-ubuntu-16-04" + "vnf-parameter-value": "vbng-casa-base-ubuntu-16-04" }, { "vnf-parameter-name": "vcpe_flavor_name", @@ -84,6 +84,10 @@ "vnf-parameter-value": "10.4.0.0/24" }, { + "vnf-parameter-name": "sdnc_ip_addr", + "vnf-parameter-value": "${sdnc_brg_bng_ip}" + }, + { "vnf-parameter-name": "vbng_private_ip_0", "vnf-parameter-value": "10.3.0.1" }, diff --git a/test/vcpe/preload_templates/template.vcpe_brgemu_vfmodule.json b/test/vcpe/preload_templates/template.vcpe_brgemu_vfmodule.json index 9a9ecc37d..7072f6825 100644 --- a/test/vcpe/preload_templates/template.vcpe_brgemu_vfmodule.json +++ b/test/vcpe/preload_templates/template.vcpe_brgemu_vfmodule.json @@ -1,138 +1,138 @@ { "VNF-API:input": { "VNF-API:request-information": { - "VNF-API:notification-url": "https://so.onap.org", - "VNF-API:order-number": "robot12", - "VNF-API:order-version": "1.0", - "VNF-API:request-action": "PreloadVNFRequest", - "VNF-API:request-id": "robot12", - "VNF-API:request-sub-action": "SUPP", + "VNF-API:notification-url": "https://so.onap.org", + "VNF-API:order-number": "robot12", + "VNF-API:order-version": "1.0", + "VNF-API:request-action": "PreloadVNFRequest", + "VNF-API:request-id": "robot12", + "VNF-API:request-sub-action": "SUPP", "VNF-API:source": "VID" - }, + }, "VNF-API:sdnc-request-header": { - "VNF-API:svc-action": "reserve", - "VNF-API:svc-notification-url": "https://son.onap.org", + "VNF-API:svc-action": "reserve", + "VNF-API:svc-notification-url": "https://son.onap.org", "VNF-API:svc-request-id": "robot12" - }, + }, "VNF-API:vnf-topology-information": { - "VNF-API:vnf-assignments": {}, + "VNF-API:vnf-assignments": {}, "VNF-API:vnf-parameters": [ { - "vnf-parameter-name": "vcpe_image_name", - "vnf-parameter-value": "vbrg-base-ubuntu-16-04-new" - }, + "vnf-parameter-name": "vcpe_image_name", + "vnf-parameter-value": "vbrg-casa-base-ubuntu-16-04" + }, { - "vnf-parameter-name": "vcpe_flavor_name", + "vnf-parameter-name": "vcpe_flavor_name", "vnf-parameter-value": "m1.medium" - }, + }, { - "vnf-parameter-name": "public_net_id", + "vnf-parameter-name": "public_net_id", "vnf-parameter-value": "${public_net_id}" - }, + }, { - "vnf-parameter-name": "vbrgemu_bng_private_net_id", + "vnf-parameter-name": "vbrgemu_bng_private_net_id", "vnf-parameter-value": "${brg_bng_net}" - }, + }, { - "vnf-parameter-name": "vbrgemu_bng_private_subnet_id", + "vnf-parameter-name": "vbrgemu_bng_private_subnet_id", "vnf-parameter-value": "${brg_bng_subnet}" - }, + }, { - "vnf-parameter-name": "onap_private_net_id", + "vnf-parameter-name": "onap_private_net_id", "vnf-parameter-value": "${oam_onap_net}" - }, + }, { - "vnf-parameter-name": "onap_private_subnet_id", + "vnf-parameter-name": "onap_private_subnet_id", "vnf-parameter-value": "${oam_onap_subnet}" - }, + }, { - "vnf-parameter-name": "onap_private_net_cidr", + "vnf-parameter-name": "onap_private_net_cidr", "vnf-parameter-value": "10.0.0.0/16" - }, + }, { - "vnf-parameter-name": "compile_state", + "vnf-parameter-name": "compile_state", "vnf-parameter-value": "done" - }, + }, { - "vnf-parameter-name": "vbrgemu_bng_private_net_cidr", + "vnf-parameter-name": "vbrgemu_bng_private_net_cidr", "vnf-parameter-value": "10.3.0.0/24" - }, + }, { - "vnf-parameter-name": "vbrgemu_private_ip_0", + "vnf-parameter-name": "vbrgemu_private_ip_0", "vnf-parameter-value": "10.3.0.21" - }, + }, { - "vnf-parameter-name": "sdnc_ip", - "vnf-parameter-value": "10.0.7.1" - }, + "vnf-parameter-name": "sdnc_ip", + "vnf-parameter-value": "${sdnc_brg_bng_ip}" + }, { - "vnf-parameter-name": "vbrgemu_name_0", + "vnf-parameter-name": "vbrgemu_name_0", "vnf-parameter-value": "zdcpe1cpe01brgemu01_${suffix}" - }, + }, { - "vnf-parameter-name": "vnf_id", + "vnf-parameter-name": "vnf_id", "vnf-parameter-value": "vCPE_Infrastructure_BGREMU_demo_app_${suffix}" - }, + }, { - "vnf-parameter-name": "vf_module_id", + "vnf-parameter-name": "vf_module_id", "vnf-parameter-value": "vCPE_Customer_BRGEMU_${suffix}" - }, + }, { - "vnf-parameter-name": "repo_url_blob", + "vnf-parameter-name": "repo_url_blob", "vnf-parameter-value": "https://nexus.onap.org/content/sites/raw" - }, + }, { - "vnf-parameter-name": "repo_url_artifacts", + "vnf-parameter-name": "repo_url_artifacts", "vnf-parameter-value": "https://nexus.onap.org/content/groups/staging" - }, + }, { - "vnf-parameter-name": "demo_artifacts_version", + "vnf-parameter-name": "demo_artifacts_version", "vnf-parameter-value": "1.1.1" - }, + }, { - "vnf-parameter-name": "install_script_version", + "vnf-parameter-name": "install_script_version", "vnf-parameter-value": "1.1.1" - }, + }, { - "vnf-parameter-name": "key_name", + "vnf-parameter-name": "key_name", "vnf-parameter-value": "vbrgemu_key" - }, + }, { - "vnf-parameter-name": "pub_key", + "vnf-parameter-name": "pub_key", "vnf-parameter-value": "${pub_key}" - }, + }, { - "vnf-parameter-name": "cloud_env", + "vnf-parameter-name": "cloud_env", "vnf-parameter-value": "openstack" - }, + }, { - "vnf-parameter-name": "vpp_source_repo_url", + "vnf-parameter-name": "vpp_source_repo_url", "vnf-parameter-value": "https://gerrit.fd.io/r/vpp" - }, + }, { - "vnf-parameter-name": "vpp_source_repo_branch", + "vnf-parameter-name": "vpp_source_repo_branch", "vnf-parameter-value": "stable/1704" - }, + }, { - "vnf-parameter-name": "hc2vpp_source_repo_url", + "vnf-parameter-name": "hc2vpp_source_repo_url", "vnf-parameter-value": "https://gerrit.fd.io/r/hc2vpp" - }, + }, { - "vnf-parameter-name": "hc2vpp_source_repo_branch", + "vnf-parameter-name": "hc2vpp_source_repo_branch", "vnf-parameter-value": "stable/1704" - }, + }, { - "vnf-parameter-name": "vpp_patch_url", + "vnf-parameter-name": "vpp_patch_url", "vnf-parameter-value": "https://git.onap.org/demo/plain/vnfs/vCPE/vpp-option-82-for-vbrg/src/patches/VPP-Add-Option82-Nat-Filter-For-vBRG.patch" } - ], + ], "vnf-topology-identifier": { - "generic-vnf-name": "${generic_vnf_name}", - "generic-vnf-type": "${generic_vnf_type}", - "service-type": "${service_type}", - "vnf-name": "${vnf_name}", + "generic-vnf-name": "${generic_vnf_name}", + "generic-vnf-type": "${generic_vnf_type}", + "service-type": "${service_type}", + "vnf-name": "${vnf_name}", "vnf-type": "${vnf_type}" } } } -}
\ No newline at end of file +} diff --git a/test/vcpe/preload_templates/template.vcpe_gmux_vfmodule.json b/test/vcpe/preload_templates/template.vcpe_gmux_vfmodule.json index 9dc747393..f3401326d 100644 --- a/test/vcpe/preload_templates/template.vcpe_gmux_vfmodule.json +++ b/test/vcpe/preload_templates/template.vcpe_gmux_vfmodule.json @@ -25,7 +25,7 @@ "VNF-API:vnf-parameters": [ { "vnf-parameter-name": "vcpe_image_name", - "vnf-parameter-value": "vgmux2-base-ubuntu-16-04" + "vnf-parameter-value": "vgmux-casa-base-ubuntu-16-04" }, { "vnf-parameter-name": "vcpe_flavor_name", diff --git a/test/vcpe/preload_templates/template.vcpe_gwgra_vfmodule.json b/test/vcpe/preload_templates/template.vcpe_gwgra_vfmodule.json new file mode 100644 index 000000000..ced57ca6a --- /dev/null +++ b/test/vcpe/preload_templates/template.vcpe_gwgra_vfmodule.json @@ -0,0 +1,125 @@ +{ + "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": "public_net_id", + "value": "${public_net_id}" + }, + { + "name": "mux_gw_private_net_id", + "value": "${mux_gw_net}" + }, + { + "name": "mux_gw_private_subnet_id", + "value": "${mux_gw_subnet}" + }, + { + "name": "mux_gw_private_net_cidr", + "value": "10.5.0.0/24" + }, + { + "name": "cpe_public_net_id", + "value": "${cpe_public_net}" + }, + { + "name": "cpe_public_subnet_id", + "value": "${cpe_public_subnet}" + }, + { + "name": "cpe_public_net_cidr", + "value": "10.2.0.0/24" + }, + { + "name": "vgw_private_ip_0", + "value": "10.5.0.92" + }, + { + "name": "vgw_private_ip_1", + "value": "10.0.101.92" + }, + { + "name": "vgw_private_ip_2", + "value": "10.2.0.7" + }, + { + "name": "vgw_name_0", + "value": "zdcpe1cpe01gw01_${suffix}" + }, + { + "name": "mux_ip_addr", + "value": "10.5.0.21" + }, + { + "name": "vg_vgmux_tunnel_vni", + "value": "92" + }, + { + "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": "repo_url_blob", + "value": "https://nexus.onap.org/content/sites/raw" + }, + { + "name": "repo_url_artifacts", + "value": "https://nexus.onap.org/content/groups/staging" + }, + { + "name": "demo_artifacts_version", + "value": "1.1.1" + }, + { + "name": "install_script_version", + "value": "1.1.1" + }, + { + "name": "key_name", + "value": "vgw_key" + }, + { + "name": "pub_key", + "value": "${pub_key}" + }, + { + "name": "cloud_env", + "value": "openstack" + } + ] }, + "vf-module-assignments": {}, + "vf-module-topology-identifier": { + "vf-module-name": "zRegionOne${vgw_vfmod_name_index}_base_vcpe_vgw_0" + } + }, + "vnf-resource-assignments": {}, + "vnf-topology-identifier-structure": { + "nf-type": "vgw", + "vnf-id": "VGW2BRG-${brg_mac}" + } + } + } +} diff --git a/test/vcpe/preload_templates/template.vcpe_infra_vfmodule.json b/test/vcpe/preload_templates/template.vcpe_infra_vfmodule.json index 27259546b..d2072e2e6 100644 --- a/test/vcpe/preload_templates/template.vcpe_infra_vfmodule.json +++ b/test/vcpe/preload_templates/template.vcpe_infra_vfmodule.json @@ -105,11 +105,11 @@ }, { "vnf-parameter-name": "mr_ip_addr", - "vnf-parameter-value": "10.12.5.239" + "vnf-parameter-value": "${mr_ip_addr}" }, { "vnf-parameter-name": "mr_ip_port", - "vnf-parameter-value": "30227" + "vnf-parameter-value": "${mr_ip_port}" }, { "vnf-parameter-name": "vaaa_name_0", @@ -153,11 +153,11 @@ }, { "vnf-parameter-name": "demo_artifacts_version", - "vnf-parameter-value": "1.3.0" + "vnf-parameter-value": "1.3.0-SNAPSHOT" }, { "vnf-parameter-name": "install_script_version", - "vnf-parameter-value": "1.2.0-SNAPSHOT" + "vnf-parameter-value": "1.3.0-SNAPSHOT" }, { "vnf-parameter-name": "key_name", diff --git a/test/vcpe/preload_templates/template_sniro_data.json b/test/vcpe/preload_templates/template_sniro_data.json index 92c9cc719..c2c6421e6 100644 --- a/test/vcpe/preload_templates/template_sniro_data.json +++ b/test/vcpe/preload_templates/template_sniro_data.json @@ -1,6 +1,6 @@ { "solutionInfo" : { - "placement" : [ + "placementInfo" : [ { "cloudRegionId" : "RegionOne", "inventoryType" : "service", diff --git a/test/vcpe/preload_templates/template_sniro_request.json b/test/vcpe/preload_templates/template_sniro_request.json index 565e14cd1..6fdbb7072 100644 --- a/test/vcpe/preload_templates/template_sniro_request.json +++ b/test/vcpe/preload_templates/template_sniro_request.json @@ -14,7 +14,7 @@ }, "method" : "POST", "base64Body" : "${base64_sniro_data}", - "url" : "https://${sniro_ip}:8080/adapters/rest/SDNCNotify/SNIROResponse" + "url" : " http://so-bpmn-infra.onap:8081/mso/WorkflowMessage/SNIROResponse" } } } diff --git a/test/vcpe/soutils.py b/test/vcpe/soutils.py index 623f12cc3..3749689f2 100755 --- a/test/vcpe/soutils.py +++ b/test/vcpe/soutils.py @@ -170,7 +170,7 @@ class SoUtils: 'modelInfo': model, 'subscriberInfo': {'subscriberName': 'Kaneohe', 'globalSubscriberId': self.vcpecommon.global_subscriber_id}, - 'cloudConfiguration': {"lcpCloudRegionId": 'CloudOwner_RegionOne', #self.vcpecommon.os_region_name, + 'cloudConfiguration': {"lcpCloudRegionId": 'RegionOne', #self.vcpecommon.os_region_name, "tenantId": self.vcpecommon.os_tenant_id}, 'requestParameters': { "userParams": [ diff --git a/test/vcpe/vcpe.py b/test/vcpe/vcpe.py index 26f27fb7a..8bd39960a 100755 --- a/test/vcpe/vcpe.py +++ b/test/vcpe/vcpe.py @@ -142,8 +142,9 @@ def deploy_custom_service(): # create new service csar_file = vcpecommon.find_file('rescust', 'csar', 'csar') vgw_template_file = vcpecommon.find_file('vgw', 'json', 'preload_templates') + vgw_gra_template_file = vcpecommon.find_file('gwgra', 'json', 'preload_templates') preload_dict = vcpecommon.load_preload_data() - custom_service.create_custom_service(csar_file, vgw_template_file, preload_dict) + custom_service.create_custom_service(csar_file, vgw_template_file, vgw_gra_template_file, preload_dict) def closed_loop(lossrate=0): @@ -174,6 +175,8 @@ def init_so_sdnc(): vcpecommon = VcpeCommon() config_sdnc_so.insert_customer_service_to_so(vcpecommon) config_sdnc_so.insert_customer_service_to_sdnc(vcpecommon) + vgw_vfmod_name_index= 0 + vcpecommon.save_object(vgw_vfmod_name_index, vcpecommon.vgw_vfmod_name_index_file) def tmp_sniro(): @@ -186,13 +189,14 @@ def tmp_sniro(): config_sniro(vcpecommon, svc_instance_uuid['gmux'], svc_instance_uuid['brg']) if __name__ == '__main__': - logging.basicConfig(level=logging.INFO, format='%(message)s') + logging.basicConfig(level=logging.DEBUG, format='%(message)s') print('----------------------------------------------------------------------------------------------------') print(' vcpe.py: Brief info about this program') # print(' vcpe.py sdc: Onboard VNFs, design and distribute vCPE services (under development)') print(' vcpe.py init: Add customer service data to SDNC and SO DBs.') print(' vcpe.py infra: Deploy infrastructure, including DHCP, AAA, DNS, Web Server, vBNG, vGMUX, vBRG.') + print(' vcpe.py brg: Deploy brg only (for testing after infra succeeds).') print(' vcpe.py customer: Deploy customer service, including vGW and VxLANs') print(' vcpe.py loop: Test closed loop control') print('----------------------------------------------------------------------------------------------------') diff --git a/test/vcpe/vcpe_custom_service.py b/test/vcpe/vcpe_custom_service.py index 8c5635473..f02802353 100755 --- a/test/vcpe/vcpe_custom_service.py +++ b/test/vcpe/vcpe_custom_service.py @@ -66,18 +66,24 @@ class CustomService: print(' 6. ping the web server: ping {0}'.format('10.2.0.10')) print(' 7. wget http://{0}'.format('10.2.0.10')) - def create_custom_service(self, csar_file, vgw_template_file, preload_dict=None): + def create_custom_service(self, csar_file, vgw_template_file, vgw_gra_template_file, preload_dict=None): name_suffix = datetime.now().strftime('%Y%m%d%H%M') if self.vcpecommon.oom_mode: brg_mac = str(raw_input("Enter the BRG MAC address: ")) else: brg_mac = self.vcpecommon.get_brg_mac_from_sdnc() + # get name index + self.vgw_vfmod_name_index= self.vcpecommon.load_object(self.vcpecommon.vgw_vfmod_name_index_file) + self.vgw_vfmod_name_index=self.vgw_vfmod_name_index + 1 + self.save_object(vgw_vfmod_name_index,self.vcpecommon.vgw_vfmod_name_index_file) # preload vGW if preload_dict: preloader = preload.Preload(self.vcpecommon) parameters_to_change = ['vgw_private_ip_0', 'vgw_private_ip_1', 'vgw_private_ip_2','vg_vgmux_tunnel_vni'] self.vcpecommon.increase_ip_address_or_vni_in_template(vgw_template_file, parameters_to_change) preloader.preload_vgw(vgw_template_file, brg_mac, preload_dict, name_suffix) + # preload vGW-GRA + preloader.preload_vgw_gra(vgw_gra_template_file, brg_mac, preload_dict, name_suffix, vgw_vfmod_name_index) # create service so = soutils.SoUtils(self.vcpecommon, 'v5') diff --git a/test/vcpe/vcpecommon.py b/test/vcpe/vcpecommon.py index 75f883835..f5e1b3046 100755 --- a/test/vcpe/vcpecommon.py +++ b/test/vcpe/vcpecommon.py @@ -19,17 +19,17 @@ class VcpeCommon: external_net_prefix_len = 16 ############################################################################################# # set the openstack cloud access credentials here - oom_mode = False + oom_mode = True cloud = { '--os-auth-url': 'http://10.12.25.2:5000', '--os-username': 'kxi', '--os-user-domain-id': 'default', '--os-project-domain-id': 'default', - '--os-tenant-id': '41d6d38489bd40b09ea8a6b6b852dcbd' if oom_mode else '1e097c6713e74fd7ac8e4295e605ee1e', + '--os-tenant-id': 'b8ad3842ab3642f7bf3fbe4e4d3b9f86' if oom_mode else '1e097c6713e74fd7ac8e4295e605ee1e', '--os-region-name': 'RegionOne', '--os-password': 'n3JhGMGuDzD8', - '--os-project-domain-name': 'Integration-SB-00' if oom_mode else 'Integration-SB-07', + '--os-project-domain-name': 'Integration-SB-05' if oom_mode else 'Integration-SB-07', '--os-identity-api-version': '3' } @@ -39,12 +39,8 @@ class VcpeCommon: 'public_net': 'external', 'public_net_id': '971040b2-7059-49dc-b220-4fab50cb2ad4' } -# for sb07 -# 'oam_onap_lAky', -# for sb00 - #'oam_onap_net': 'oam_network_0qV7', - #'oam_onap_subnet': 'oam_network_0qV7', - # End: configurations that you must change for a new ONAP installation + sdnc_controller_pod = 'dev-sdnc-sdnc-0' + ############################################################################################# template_variable_symbol = '${' @@ -71,9 +67,16 @@ class VcpeCommon: self.logger = logging.getLogger(__name__) self.logger.info('Initializing configuration') + # OOM: this is the address that the brg and bng will nat for config of brg - 10.0.0.x address of k8 host for sdnc + self.sdnc_brg_bng_ip = self.get_pod_node_oam_ip(self.sdnc_controller_pod)[1] + # OOM: this is a k8 host external IP self.oom_so_sdnc_aai_ip = '10.12.5.18' + # OOM: this is a k8 host external IP can be same as oom_so_sdnc_aai_ip self.oom_dcae_ves_collector = '10.12.5.18' - self.so_nbi_port = '30223' if self.oom_mode else '8080' + # OOM: this is a k8 host external IP can be same as oom_so_sdnc_aai_ip + self.mr_ip_addr = '10.12.5.18' + self.mr_ip_port = '30227' + self.so_nbi_port = '30277' if self.oom_mode else '8080' self.sdnc_preloading_port = '30202' if self.oom_mode else '8282' self.aai_query_port = '30233' if self.oom_mode else '8443' self.sniro_port = '30288' if self.oom_mode else '8080' @@ -85,6 +88,8 @@ class VcpeCommon: self.hosts = self.get_vm_ip(self.host_names, self.external_net_addr, self.external_net_prefix_len) # this is the keyword used to name vgw stack, must not be used in other stacks self.vgw_name_keyword = 'base_vcpe_vgw' + # this is the file that will keep the index of last assigned SO name + self.vgw_vfmod_name_index_file= '__var/vgw_vfmod_name_index' self.svc_instance_uuid_file = '__var/svc_instance_uuid' self.preload_dict_file = '__var/preload_dict' self.vgmux_vnf_name_file = '__var/vgmux_vnf_name' @@ -123,17 +128,19 @@ class VcpeCommon: ':' + self.sdnc_preloading_port + '/restconf/operations/VNF-API:preload-network-topology-operation' self.sdnc_preload_vnf_url = 'http://' + self.hosts['sdnc'] + \ ':' + self.sdnc_preloading_port + '/restconf/operations/VNF-API:preload-vnf-topology-operation' + self.sdnc_preload_gra_url = 'http://' + self.hosts['sdnc'] + \ + ':' + self.sdnc_preloading_port + '/restconf/operations/GENERIC-RESOURCE-API:preload-vf-module-topology-operation' self.sdnc_ar_cleanup_url = 'http://' + self.hosts['sdnc'] + ':' + self.sdnc_preloading_port + \ '/restconf/config/GENERIC-RESOURCE-API:' ############################################################################################# # SO urls, note: do NOT add a '/' at the end of the url - self.so_req_api_url = {'v4': 'http://' + self.hosts['so'] + ':' + self.so_nbi_port + '/ecomp/mso/infra/serviceInstances/v4', - 'v5': 'http://' + self.hosts['so'] + ':' + self.so_nbi_port + '/ecomp/mso/infra/serviceInstances/v5'} - self.so_check_progress_api_url = 'http://' + self.hosts['so'] + ':' + self.so_nbi_port + '/ecomp/mso/infra/orchestrationRequests/v5' + self.so_req_api_url = {'v4': 'http://' + self.hosts['so'] + ':' + self.so_nbi_port + '/onap/so/infra/serviceInstantiation/v7/serviceInstances', + 'v5': 'http://' + self.hosts['so'] + ':' + self.so_nbi_port + '/onap/so/infraserviceInstantiation/v7/serviceInstances'} + self.so_check_progress_api_url = 'http://' + self.hosts['so'] + ':' + self.so_nbi_port + '/onap/so/infra/orchestrationRequests/v6' self.so_userpass = 'InfraPortalClient', 'password1$' self.so_headers = {'Content-Type': 'application/json', 'Accept': 'application/json'} - self.so_db_name = 'mso_catalog' + self.so_db_name = 'catalogdb' self.so_db_user = 'root' self.so_db_pass = 'password' self.so_db_port = '30252' if self.oom_mode else '32769' @@ -310,6 +317,17 @@ class VcpeCommon: return str(ip) return None + def get_pod_node_oam_ip(self, pod): + """ + :Assuming kubectl is available + :param pod: pod name as a string, e.g. 'dev-sdnc-sdnc-0' + :return pod's node oam ip (10.0.0.0/16) + """ + cmd = "kubectl -n onap describe pod {0} |grep Node:|cut -d'/' -f2".format(pod) + ret = commands.getstatusoutput(cmd) + self.logger.debug("cmd = %s, ret = %s", cmd, ret) + return ret + def get_vm_ip(self, keywords, net_addr=None, net_addr_len=None): """ :param keywords: list of keywords to search for vm, e.g. ['bng', 'gmux', 'brg'] |