X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2Fhoneycomb%2FHoneycombSetup.py;h=d10a5ccb4e0510aeb439ac05fbb0e424eb1c3783;hb=442a2a7b0dfd2f1cd5a4ba03fb91ed32c96f8965;hp=b5e964dd6c807de9e452588fa68d8ecb38520619;hpb=fcee621dda66ed8b218158c36afbf07bd08b23a1;p=csit.git diff --git a/resources/libraries/python/honeycomb/HoneycombSetup.py b/resources/libraries/python/honeycomb/HoneycombSetup.py index b5e964dd6c..d10a5ccb4e 100644 --- a/resources/libraries/python/honeycomb/HoneycombSetup.py +++ b/resources/libraries/python/honeycomb/HoneycombSetup.py @@ -155,33 +155,22 @@ class HoneycombSetup(object): ssh = SSH() ssh.connect(node) - ret_code, pid, _ = ssh.exec_command("pgrep honeycomb") - if ret_code != 0: - raise HoneycombError("No process named 'honeycomb' found.") - pid = int(pid) count = 0 start = time() while time() - start < timeout and count < retries: count += 1 - ret_code, _, _ = ssh.exec_command( - " | ".join([ - "sudo tail -n 1000 /var/log/syslog", - "grep {pid}".format(pid=pid), - "grep 'Honeycomb started successfully!'"]) - ) - if ret_code != 0: - logger.debug( - "Attempt #{count} failed on log check.".format( - count=count)) + + try: + status_code_version, _ = HcUtil.get_honeycomb_data( + node, "oper_vpp_version") + status_code_if_cfg, _ = HcUtil.get_honeycomb_data( + node, "config_vpp_interfaces") + status_code_if_oper, _ = HcUtil.get_honeycomb_data( + node, "oper_vpp_interfaces") + except HTTPRequestError: sleep(interval) continue - status_code_version, _ = HcUtil.get_honeycomb_data( - node, "oper_vpp_version") - status_code_if_cfg, _ = HcUtil.get_honeycomb_data( - node, "config_vpp_interfaces") - status_code_if_oper, _ = HcUtil.get_honeycomb_data( - node, "oper_vpp_interfaces") if status_code_if_cfg == HTTPCodes.OK\ and status_code_if_cfg == HTTPCodes.OK\ and status_code_if_oper == HTTPCodes.OK: @@ -200,16 +189,10 @@ class HoneycombSetup(object): sleep(interval) continue else: - _, vpp_status, _ = ssh.exec_command("service vpp status") - ret_code, hc_log, _ = ssh.exec_command( - " | ".join([ - "sudo tail -n 1000 /var/log/syslog", - "grep {pid}".format(pid=pid)])) + _, vpp_status, _ = ssh.exec_command("sudo service vpp status") raise HoneycombError( "Timeout or max retries exceeded. Status of VPP:\n" - "{vpp_status}\n" - "Syslog entries filtered by Honeycomb's pid:\n" - "{hc_log}".format(vpp_status=vpp_status, hc_log=hc_log)) + "{vpp_status}".format(vpp_status=vpp_status)) @staticmethod def check_honeycomb_shutdown_state(node): @@ -654,21 +637,6 @@ class HoneycombSetup(object): logger.info("ODL client service stopped.") - @staticmethod - def stop_vpp_service(node): - """Stop VPP service on the specified node. - - :param node: VPP node. - :type node: dict - :raises RuntimeError: If VPP fails to stop. - """ - - ssh = SSH() - ssh.connect(node) - cmd = "service vpp stop" - ret_code, _, _ = ssh.exec_command_sudo(cmd, timeout=80) - if int(ret_code) != 0: - logger.debug("VPP service refused to shut down.") class HoneycombStartupConfig(object): @@ -677,8 +645,7 @@ class HoneycombStartupConfig(object): def __init__(self): """Initializer.""" - self.template = """ - #!/bin/sh - + self.template = """#!/bin/sh - STATUS=100 while [ $STATUS -eq 100 ]