aboutsummaryrefslogtreecommitdiffstats
path: root/test/vcpe
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2019-10-07 14:25:30 +0200
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2019-10-07 14:25:30 +0200
commit92b3cd11dbd906f9304a2436498c6109f8d9a0f5 (patch)
treea20d99a1d14be7a140da9f754044ebadc0d4ba05 /test/vcpe
parent383a3e820a83c7c526aee35312a94a923a53022c (diff)
Automate curl installation in sdnc container (vCPE)
Curl package will be automatically installed be the healthcheck-k8s.py script. Change-Id: I7fc5579524c7519f6153b02d0de0000dc0138992 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com> Issue-ID: INT-1313
Diffstat (limited to 'test/vcpe')
-rwxr-xr-xtest/vcpe/healthcheck-k8s.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/test/vcpe/healthcheck-k8s.py b/test/vcpe/healthcheck-k8s.py
index 241603130..ae33e25b2 100755
--- a/test/vcpe/healthcheck-k8s.py
+++ b/test/vcpe/healthcheck-k8s.py
@@ -3,7 +3,7 @@
import argparse
import json
import logging
-from subprocess import Popen,PIPE
+from subprocess import Popen,PIPE,STDOUT,check_output,CalledProcessError
import sys
def parse_args():
@@ -28,7 +28,9 @@ namespace = args.namespace
environment = args.environment
# config section
-kube_cmd = 'kubectl -n {0} exec {1}-sdnc-sdnc-0 -- bash -c '.format(namespace, environment)
+kube_cmd = 'kubectl -n {0} exec {1}-sdnc-sdnc-0 -c sdnc -- bash -c '.format(namespace, environment)
+curl_check_cmd = 'apk info -e curl'
+curl_install_cmd = 'sudo apk add curl'
curl_cmd = 'curl -s -u admin:admin -X GET http://{0}:8183/restconf/config/ietf-interfaces:interfaces'
endpoints = {
"vGMUX": '10.0.101.21',
@@ -36,6 +38,18 @@ endpoints = {
}
# end of config section
+# Install curl command in SDNC container
+try:
+ check_output(kube_cmd.split() + [curl_check_cmd], stderr=STDOUT)
+except CalledProcessError:
+ try:
+ check_output(kube_cmd.split() + [curl_install_cmd], stderr=STDOUT)
+ except CalledProcessError:
+ print('Curl package installation failed, exiting.')
+ sys.exit(1)
+ else:
+ print("Curl package was installed in SDNC container")
+
for ename,eip in endpoints.items():
print('Checking {0} REST API from SDNC'.format(ename))
p = Popen(kube_cmd.split() + [curl_cmd.format(eip)], stdout=PIPE, stderr=PIPE)