From bff480ceb6e7dd9f624f3c8e39f7d7ece1f9248e Mon Sep 17 00:00:00 2001 From: Tibor Frank Date: Wed, 29 Jun 2016 16:44:34 +0200 Subject: 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 --- .../libraries/python/honeycomb/HoneycombSetup.py | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'resources/libraries/python/honeycomb/HoneycombSetup.py') 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) -- cgit 1.2.3-korg