Fix issues in vcpe test script

1. SDNC GRA url issue
2. Add mr ip and port to prepload
3. Allow SO service_recipe table to be populated
4. Add SDNC ip to preload
5. Add vfmoduleName section in SO request
6. Set Generic NeutronNet shared as False

Change-Id: Iba4ff695759ceab53e33367092b6b59678e082e7
Issue-ID: INT-717
Signed-off-by: Yang Xu <yang.xu3@huawei.com>
diff --git a/test/vcpe/config_sdnc_so.py b/test/vcpe/config_sdnc_so.py
index 7c063b5..2cfc0f9 100755
--- a/test/vcpe/config_sdnc_so.py
+++ b/test/vcpe/config_sdnc_so.py
@@ -78,7 +78,9 @@
                     "`SERVICE_MODEL_UUID`) VALUES ('createInstance','1','{0}'," \
                     "'/mso/async/services/CreateVcpeResCustService',NULL,181,NULL, NOW()," \
                     "'{1}');".format(parser.svc_model['modelName'], parser.svc_model['modelVersionId']))
+        vcpecommon.execute_cmds_so_db(cmds)
 
+    cmds = []
     cmds.append("delete from `heat_template_params` where"
                 "`HEAT_TEMPLATE_ARTIFACT_UUID`='efee1d84-b8ec-11e7-abc4-cec278b6b50a';")
     cmds.append("delete from `heat_template` where ARTIFACT_UUID='efee1d84-b8ec-11e7-abc4-cec278b6b50a';")
diff --git a/test/vcpe/preload.py b/test/vcpe/preload.py
index 0d451d2..0108566 100755
--- a/test/vcpe/preload.py
+++ b/test/vcpe/preload.py
@@ -128,7 +128,7 @@
                         }
         replace_dict.update(commont_dict)
         self.logger.info('Preloading vGW-GRA')
-        return self.preload(template_file, replace_dict, self.vcpecommon.sdnc_preload_vnf_url)
+        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):
         """
@@ -156,6 +156,7 @@
                         '${vnf_name}': vfmodule_name,
                         '${mr_ip_addr}': self.vcpecommon.mr_ip_addr,
                         '${mr_ip_port}': self.vcpecommon.mr_ip_port,
+                        '${sdnc_oam_ip}': self.vcpecommon.sdnc_oam_ip,
                         '${suffix}': name_suffix}
         replace_dict.update(common_dict)
         self.logger.info('Preloading VF Module ' + vfmodule_name)
diff --git a/test/vcpe/preload_templates/simple_neutron_heat.yaml b/test/vcpe/preload_templates/simple_neutron_heat.yaml
index d20c081..f64248b 100644
--- a/test/vcpe/preload_templates/simple_neutron_heat.yaml
+++ b/test/vcpe/preload_templates/simple_neutron_heat.yaml
@@ -8,7 +8,7 @@
   shared:
      type: boolean
      description: Shared amongst tenants
-     default: True
+     default: False
 outputs:
   network_id:
     description: Openstack network identifier
diff --git a/test/vcpe/preload_templates/template.vcpe_bng_vfmodule.json b/test/vcpe/preload_templates/template.vcpe_bng_vfmodule.json
index 7ef2fb7..0758dc1 100644
--- a/test/vcpe/preload_templates/template.vcpe_bng_vfmodule.json
+++ b/test/vcpe/preload_templates/template.vcpe_bng_vfmodule.json
@@ -85,7 +85,7 @@
 		},
 		{
 		"vnf-parameter-name": "sdnc_ip_addr",
-		"vnf-parameter-value": "${sdnc_brg_bng_ip}"
+		"vnf-parameter-value": "${sdnc_oam_ip}"
 		},
 		{
 		"vnf-parameter-name": "vbng_private_ip_0",
diff --git a/test/vcpe/preload_templates/template.vcpe_brgemu_vfmodule.json b/test/vcpe/preload_templates/template.vcpe_brgemu_vfmodule.json
index 7072f68..9e04b99 100644
--- a/test/vcpe/preload_templates/template.vcpe_brgemu_vfmodule.json
+++ b/test/vcpe/preload_templates/template.vcpe_brgemu_vfmodule.json
@@ -63,7 +63,7 @@
                 },
                 {
                     "vnf-parameter-name": "sdnc_ip",
-                    "vnf-parameter-value": "${sdnc_brg_bng_ip}"
+                    "vnf-parameter-value": "${sdnc_oam_ip}"
                 },
                 {
                     "vnf-parameter-name": "vbrgemu_name_0",
diff --git a/test/vcpe/preload_templates/template.vcpe_vgw_vfmodule.json b/test/vcpe/preload_templates/template.vcpe_vgw_vfmodule.json
index 87059e1..fef5cbb 100644
--- a/test/vcpe/preload_templates/template.vcpe_vgw_vfmodule.json
+++ b/test/vcpe/preload_templates/template.vcpe_vgw_vfmodule.json
@@ -47,15 +47,15 @@
                 }, 
                 {
                     "vnf-parameter-name": "vgw_private_ip_0", 
-                    "vnf-parameter-value": "10.5.0.92"
+                    "vnf-parameter-value": "10.5.0.111"
                 }, 
                 {
                     "vnf-parameter-name": "vgw_private_ip_1", 
-                    "vnf-parameter-value": "10.0.101.92"
+                    "vnf-parameter-value": "10.0.101.111"
                 }, 
                 {
                     "vnf-parameter-name": "vgw_private_ip_2", 
-                    "vnf-parameter-value": "10.2.0.7"
+                    "vnf-parameter-value": "10.2.0.26"
                 }, 
                 {
                     "vnf-parameter-name": "vgw_name_0", 
@@ -67,7 +67,7 @@
                 }, 
                 {
                     "vnf-parameter-name": "vg_vgmux_tunnel_vni", 
-                    "vnf-parameter-value": "92"
+                    "vnf-parameter-value": "111"
                 }, 
                 {
                     "vnf-parameter-name": "onap_private_net_id", 
diff --git a/test/vcpe/soutils.py b/test/vcpe/soutils.py
index 3749689..7603127 100755
--- a/test/vcpe/soutils.py
+++ b/test/vcpe/soutils.py
@@ -177,8 +177,16 @@
                     {
                         'name': 'BRG_WAN_MAC_Address',
                         'value': brg_mac
-                    }
-                     ,
+                    },
+                    {
+                       'name': 'VfModuleNames',
+                       'value': [
+                            {
+                                'VfModuleModelInvariantUuid': 'c16ad38c-2c2c-49ae-bbe8-66c7ffbcc30a',
+                                'VfModuleName': 'VGW2BRG-fa:16:3e:5c:27:8b'
+                            }
+                       ]
+                    },
                     {
                          "name": "Customer_Location",
                          "value": self.vcpecommon.customer_location_used_by_oof
diff --git a/test/vcpe/vcpe.py b/test/vcpe/vcpe.py
index 8bd3996..925f11d 100755
--- a/test/vcpe/vcpe.py
+++ b/test/vcpe/vcpe.py
@@ -174,7 +174,7 @@
     logger = logging.getLogger('__name__')
     vcpecommon = VcpeCommon()
     config_sdnc_so.insert_customer_service_to_so(vcpecommon)
-    config_sdnc_so.insert_customer_service_to_sdnc(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)
 
diff --git a/test/vcpe/vcpe_custom_service.py b/test/vcpe/vcpe_custom_service.py
index f028023..408f8a8 100755
--- a/test/vcpe/vcpe_custom_service.py
+++ b/test/vcpe/vcpe_custom_service.py
@@ -75,7 +75,7 @@
         # 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)
+        self.vcpecommon.save_object(self.vgw_vfmod_name_index,self.vcpecommon.vgw_vfmod_name_index_file)
         # preload vGW
         if preload_dict:
             preloader = preload.Preload(self.vcpecommon)
@@ -83,7 +83,7 @@
             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)
+            preloader.preload_vgw_gra(vgw_gra_template_file, brg_mac, preload_dict, name_suffix, str(self.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 f5e1b30..29aad19 100755
--- a/test/vcpe/vcpecommon.py
+++ b/test/vcpe/vcpecommon.py
@@ -34,8 +34,8 @@
     }
 
     common_preload_config = {
-        'oam_onap_net': 'oam_network_0qV7' if oom_mode else 'oam_onap_lAky',
-        'oam_onap_subnet': 'oam_network_0qV7' if oom_mode else 'oam_onap_lAky',
+        'oam_onap_net': 'oam_network_AiBB' if oom_mode else 'oam_onap_lAky',
+        'oam_onap_subnet': 'oam_network_AiBB' if oom_mode else 'oam_onap_lAky',
         'public_net': 'external',
         'public_net_id': '971040b2-7059-49dc-b220-4fab50cb2ad4'
     }
@@ -68,13 +68,13 @@
         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]
+        self.sdnc_oam_ip = '10.0.0.20'
         # OOM: this is a k8 host external IP 
-        self.oom_so_sdnc_aai_ip = '10.12.5.18'
+        self.oom_so_sdnc_aai_ip = '10.12.5.228'
         # 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.oom_dcae_ves_collector = '10.12.5.228'
         # 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_addr = '10.12.5.228'
         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'
@@ -136,7 +136,7 @@
         #############################################################################################
         # 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 + '/onap/so/infra/serviceInstantiation/v7/serviceInstances',
-                           'v5': 'http://' + self.hosts['so'] + ':' + self.so_nbi_port + '/onap/so/infraserviceInstantiation/v7/serviceInstances'}
+                           'v5': 'http://' + self.hosts['so'] + ':' + self.so_nbi_port + '/onap/so/infra/serviceInstantiation/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'}