From 21b09c956609d3ebee0081686802d20da194c523 Mon Sep 17 00:00:00 2001 From: Yang Xu Date: Thu, 13 Jun 2019 13:19:20 -0400 Subject: Improve vCPE test automation Signed-off-by: Yang Xu Issue-ID: INT-847 Change-Id: Ib5b0a547f1c228de4cee02f3526401028c10bff0 --- test/vcpe/bin/setup.sh | 20 ++++++++++++++++++++ test/vcpe/config_sdnc_so.py | 7 ++++--- test/vcpe/healthcheck-k8s.py | 2 +- test/vcpe/sdcutils.py | 2 +- test/vcpe/vcpecommon.py | 2 +- 5 files changed, 27 insertions(+), 6 deletions(-) create mode 100755 test/vcpe/bin/setup.sh (limited to 'test/vcpe') diff --git a/test/vcpe/bin/setup.sh b/test/vcpe/bin/setup.sh new file mode 100755 index 000000000..a52e0222e --- /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 2cfc0f9f3..bce8fde81 100755 --- a/test/vcpe/config_sdnc_so.py +++ b/test/vcpe/config_sdnc_so.py @@ -73,11 +73,12 @@ def insert_customer_service_to_so(vcpecommon): 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 0a728a429..04c6f158e 100755 --- a/test/vcpe/healthcheck-k8s.py +++ b/test/vcpe/healthcheck-k8s.py @@ -28,7 +28,7 @@ print(json.dumps(json.loads(sz), indent=4)) 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 1a202b4cf..60050a4b5 100755 --- a/test/vcpe/sdcutils.py +++ b/test/vcpe/sdcutils.py @@ -34,7 +34,7 @@ class SdcUtils: 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 47ba23851..4f4613a59 100755 --- a/test/vcpe/vcpecommon.py +++ b/test/vcpe/vcpecommon.py @@ -171,7 +171,7 @@ class VcpeCommon: 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' -- cgit 1.2.3-korg