aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2017-10-12 09:06:58 +0000
committerPeter Mikus <pmikus@cisco.com>2017-10-16 11:24:30 +0000
commit9ed22194b7a52e02205b2c2e021868ee6e6abe64 (patch)
treea60d429975bd03c40de6500b82802e9bb8fea943 /resources/libraries
parenta8f23402624475b2c871d1bebc0d9855369893bd (diff)
CSIT-841 Optimize creating of vnf-agent docker image Part I
- Optimize building of prod_vpp_agent docker image by using dev_vpp_agent docker image pulled from dockerhub/ligato instead of building on slave. - Add detailed logs from every POD deployed in namespace. - Hardening condition for considering PODs Running. Change-Id: I9f771d6365d38fef2ec2e00ab642853e6a44ad03 Signed-off-by: Peter Mikus <pmikus@cisco.com> (cherry picked from commit fcaf06abdd27a3a6ef18de14ce3d1dab2c75a8c9)
Diffstat (limited to 'resources/libraries')
-rw-r--r--resources/libraries/python/KubernetesUtils.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/resources/libraries/python/KubernetesUtils.py b/resources/libraries/python/KubernetesUtils.py
index 5faa056ddc..77628b64d8 100644
--- a/resources/libraries/python/KubernetesUtils.py
+++ b/resources/libraries/python/KubernetesUtils.py
@@ -244,6 +244,36 @@ class KubernetesUtils(object):
rtype)
@staticmethod
+ def get_kubernetes_logs_on_node(node, namespace='csit'):
+ """Get Kubernetes logs on node.
+
+ :param node: DUT node.
+ :param namespace: Kubernetes namespace.
+ :type node: dict
+ :type namespace: str
+ """
+ ssh = SSH()
+ ssh.connect(node)
+
+ cmd = "for p in $(kubectl get pods -n {namespace} --no-headers"\
+ " | cut -f 1 -d ' '); do echo $p; kubectl logs -n {namespace} $p; "\
+ "done".format(namespace=namespace)
+ ssh.exec_command(cmd, timeout=120)
+
+ @staticmethod
+ def get_kubernetes_logs_on_all_duts(nodes, namespace='csit'):
+ """Get Kubernetes logs on all DUTs.
+
+ :param nodes: Topology nodes.
+ :param namespace: Kubernetes namespace.
+ :type nodes: dict
+ :type namespace: str
+ """
+ for node in nodes.values():
+ if node['type'] == NodeType.DUT:
+ KubernetesUtils.get_kubernetes_logs_on_node(node, namespace)
+
+ @staticmethod
def reset_kubernetes_on_node(node):
"""Reset Kubernetes on node.
@@ -288,7 +318,9 @@ class KubernetesUtils(object):
if int(ret_code) == 0:
ready = True
for line in stdout.splitlines():
- if 'Running' not in line:
+ if 'Running' in line and '1/1' in line:
+ ready = True
+ else:
ready = False
if ready:
break