Improve vCPE test automation

Signed-off-by: Yang Xu <yang.xu@futurewei.com>
Issue-ID: INT-847
Change-Id: Ib5b0a547f1c228de4cee02f3526401028c10bff0
diff --git a/test/vcpe/bin/setup.sh b/test/vcpe/bin/setup.sh
new file mode 100755
index 0000000..a52e022
--- /dev/null
+++ b/test/vcpe/bin/setup.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+# 
+# Copyright 2019 Futurewei Technologies Co., Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+
+apt-get install -y python-pip
+pip install ipaddress
+pip install pyyaml
+pip install mysql-connector-python
+pip install progressbar2
+pip install python-novaclient
+pip install python-openstackclient
+pip install netaddr
+pip install kubernetes
diff --git a/test/vcpe/config_sdnc_so.py b/test/vcpe/config_sdnc_so.py
index 2cfc0f9..bce8fde 100755
--- a/test/vcpe/config_sdnc_so.py
+++ b/test/vcpe/config_sdnc_so.py
@@ -73,11 +73,12 @@
         csar_file = vcpecommon.find_file('rescust', 'csar', 'csar')
         parser = csar_parser.CsarParser()
         parser.parse_csar(csar_file)
-        cmds.append("INSERT INTO `service_recipe` (`ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, " \
-                    "`SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, " \
-                    "`SERVICE_MODEL_UUID`) VALUES ('createInstance','1','{0}'," \
+        cmds.append("INSERT INTO service_recipe (ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, " \
+                    "SERVICE_PARAM_XSD, RECIPE_TIMEOUT, SERVICE_TIMEOUT_INTERIM, CREATION_TIMESTAMP, " \
+                    "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']))
+        logger.info('\n'.join(cmds))
         vcpecommon.execute_cmds_so_db(cmds)
 
     cmds = []
diff --git a/test/vcpe/healthcheck-k8s.py b/test/vcpe/healthcheck-k8s.py
index 0a728a4..04c6f15 100755
--- a/test/vcpe/healthcheck-k8s.py
+++ b/test/vcpe/healthcheck-k8s.py
@@ -28,7 +28,7 @@
 
 print('\n')
 print('Checking SDNC DB for vBRG MAC address')
-cmd = "kubectl -n onap exec dev-sdnc-sdnc-db-0 -c sdnc-db  -- mysql -usdnctl -pgamma sdnctl -e 'select * from DHCP_MAP;'"
+cmd = "kubectl exec dev-mariadb-galera-mariadb-galera-0 -- mysql -uroot -psecretpassword sdnctl -e 'select * from DHCP_MAP'"
 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
 (output, error) = p.communicate()
 print(output)
diff --git a/test/vcpe/sdcutils.py b/test/vcpe/sdcutils.py
index 1a202b4..60050a4 100755
--- a/test/vcpe/sdcutils.py
+++ b/test/vcpe/sdcutils.py
@@ -34,7 +34,7 @@
         self.logger.debug('---------------------------------------------------------------')
 
         for service in data:
-            if service['name'].startswith('demoVCPE') or service['name'].startswith('vCPEResCust'):
+            if (service['name'].startswith('demoVCPE') or service['name'].startswith('vCPEResCust')) and service['distributionStatus'] == 'DISTRIBUTED':
                 self.logger.debug('service name = %s, url = %s' % (service['name'], service['toscaModelURL']))
                 self.download_file(self.vcpecommon.sdc_be_url_prefix + service['toscaModelURL'])
 
diff --git a/test/vcpe/vcpecommon.py b/test/vcpe/vcpecommon.py
index 47ba238..4f4613a 100755
--- a/test/vcpe/vcpecommon.py
+++ b/test/vcpe/vcpecommon.py
@@ -171,7 +171,7 @@
         self.so_headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}
         self.so_db_name = 'catalogdb'
         self.so_db_user = 'root'
-        self.so_db_pass = 'password'
+        self.so_db_pass = 'secretpassword'
         self.so_db_port = '30252' if self.oom_mode else '32769'
 
         self.vpp_inf_url = 'http://{0}:8183/restconf/config/ietf-interfaces:interfaces'