aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2016-06-29 16:44:34 +0200
committerDave Wallace <dwallacelf@gmail.com>2016-09-28 03:34:19 +0000
commitbff480ceb6e7dd9f624f3c8e39f7d7ece1f9248e (patch)
tree031c4f28b401ee01a07022fc4db9915779f67873 /resources/libraries
parent313dd6b6a2eac04a6dd686a1407e35ac2424913f (diff)
Add automated deployment of Honeycomb on DUTs
JIRA: CSIT-56 - create bootstrap_vpp_honeycomb.sh script which deploys VPP and Honeycomb on DUTs - Modify start-testcase script Change-Id: I88511479cb8681168675c934f4fccbea83fa34bc Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/libraries')
-rw-r--r--resources/libraries/python/honeycomb/HoneycombSetup.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/resources/libraries/python/honeycomb/HoneycombSetup.py b/resources/libraries/python/honeycomb/HoneycombSetup.py
index 1c232f08a5..04af9a5a8b 100644
--- a/resources/libraries/python/honeycomb/HoneycombSetup.py
+++ b/resources/libraries/python/honeycomb/HoneycombSetup.py
@@ -53,6 +53,9 @@ class HoneycombSetup(object):
:type nodes: list
:raises HoneycombError: If Honeycomb fails to start.
"""
+
+ HoneycombSetup.print_environment(nodes)
+
logger.console("\nStarting Honeycomb service ...")
cmd = "{0}/bin/start".format(Const.REMOTE_HC_DIR)
@@ -123,6 +126,7 @@ class HoneycombSetup(object):
for node in nodes:
if node['type'] == NodeType.DUT:
+ HoneycombSetup.print_ports(node)
status_code, _ = HTTPRequest.get(node, path, timeout=10,
enable_logging=False)
if status_code == HTTPCodes.OK:
@@ -185,3 +189,53 @@ class HoneycombSetup(object):
logger.info("Honeycomb on node {0} has stopped".
format(node['host']))
return True
+
+ @staticmethod
+ def print_environment(nodes):
+ """Print information about the nodes to log. The information is defined
+ by commands in cmds tuple at the beginning of this method.
+
+ :param nodes: List of DUT nodes to get information about.
+ :type nodes: list
+ """
+
+ # TODO: When everything is set and running in VIRL env, transform this
+ # method to a keyword checking the environment.
+
+ cmds = ("uname -a",
+ "df -lh",
+ "echo $JAVA_HOME",
+ "echo $PATH",
+ "which java",
+ "java -version",
+ "dpkg --list | grep openjdk",
+ "ls -la /opt/honeycomb",
+ "ls -la /opt/honeycomb/v3po-karaf-1.0.0-SNAPSHOT")
+
+ for node in nodes:
+ if node['type'] == NodeType.DUT:
+ logger.info("Checking node {} ...".format(node['host']))
+ for cmd in cmds:
+ logger.info("Command: {}".format(cmd))
+ ssh = SSH()
+ ssh.connect(node)
+ ssh.exec_command_sudo(cmd)
+
+ @staticmethod
+ def print_ports(node):
+ """Uses "sudo netstat -anp | grep java" to print port where a java
+ application listens.
+
+ :param node: Honeycomb node where we want to print the ports.
+ :type node: dict
+ """
+
+ cmds = ("netstat -anp | grep java",
+ "ps -ef | grep karaf")
+
+ logger.info("Checking node {} ...".format(node['host']))
+ for cmd in cmds:
+ logger.info("Command: {}".format(cmd))
+ ssh = SSH()
+ ssh.connect(node)
+ ssh.exec_command_sudo(cmd)