aboutsummaryrefslogtreecommitdiffstats
path: root/test/vcpe
diff options
context:
space:
mode:
authorBrian Freeman <bf1936@att.com>2018-11-11 22:36:20 -0500
committerBrian Freeman <bf1936@att.com>2018-11-12 10:28:55 -0500
commit81f6e9ee662695a818bdb5f24c17f09fac5c962f (patch)
treea60da066457b1746ab63e0f023b192d14eeadbf6 /test/vcpe
parenta71e3709faa5f281361ddfcd79eb4bd11550edca (diff)
Updates for Casbalanca vcpe.py
Issue-ID: INT-717 Change-Id: I0d5978da205fcc02935e9547424578f90e5a5c38 Signed-off-by: Brian Freeman <bf1936@att.com>
Diffstat (limited to 'test/vcpe')
-rw-r--r--test/vcpe/healthcheck-k8s.py36
-rwxr-xr-xtest/vcpe/preload.py9
-rw-r--r--test/vcpe/preload_templates/template.vcpe_gwgra_vfmodule.json125
-rw-r--r--test/vcpe/preload_templates/template_sniro_data.json2
-rwxr-xr-xtest/vcpe/vcpe.py5
-rwxr-xr-xtest/vcpe/vcpe_custom_service.py9
-rwxr-xr-xtest/vcpe/vcpecommon.py4
7 files changed, 187 insertions, 3 deletions
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..caf9eb184 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_gwgra_vfmodule.json b/test/vcpe/preload_templates/template.vcpe_gwgra_vfmodule.json
new file mode 100644
index 000000000..856212bb3
--- /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_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/vcpe.py b/test/vcpe/vcpe.py
index 26f27fb7a..efebecb6d 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
+ self.save_object(vgw_vfmod_name_index, vgw_vfmod_name_index_file)
def tmp_sniro():
diff --git a/test/vcpe/vcpe_custom_service.py b/test/vcpe/vcpe_custom_service.py
index 8c5635473..ad55ed586 100755
--- a/test/vcpe/vcpe_custom_service.py
+++ b/test/vcpe/vcpe_custom_service.py
@@ -66,18 +66,25 @@ 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')
+ self.load_object(vgw_vfmod_name_index,vgw_vfmod_name_index_file)
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.load_object(vgw_vfmod_name_index,vgw_vfmod_name_index_file)
+ vgw_vfmod_name_index=vgw_vfmod_name_index+1
+ self.save_object(vgw_vfmod_name_index,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..59286037c 100755
--- a/test/vcpe/vcpecommon.py
+++ b/test/vcpe/vcpecommon.py
@@ -85,6 +85,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,6 +125,8 @@ 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:'