def __process_results(self, client_output, service_output): result = {} result["connection_completed"] = False client_parser_error, client_leak_detected = WeaveUtilities.scan_for_leaks_and_parser_errors( client_output) result["no_client_parser_error"] = not client_parser_error result["no_client_leak_detected"] = not client_leak_detected service_parser_error, service_leak_detected = WeaveUtilities.scan_for_leaks_and_parser_errors( service_output) result["no_service_parser_error"] = not service_parser_error result["no_service_leak_detected"] = not service_leak_detected for line in client_output.split("\n"): if "AppConnectionComplete" in line: result["connection_completed"] = True break final_result = reduce((lambda x, y: x and y), result.values()) print "weave-service-dir test from client %s to service %s: " % ( self.client, self.service) if self.quiet == False: if final_result: print hgreen("succeeded") else: print hred("failed") if not final_result: pprint.pprint(result) return result
def __process_results(self, client_output, server_output, client_info): kevents = re.findall(r"WEAVE:.+kEvent_\w+", client_output) smoke_check = False client_parser_error = None client_leak_detected = None server_parser_error = None server_leak_detected = None result = {} client_parser_error, client_leak_detected = WeaveUtilities.scan_for_leaks_and_parser_errors( client_output) result["no_client_parser_error"] = not client_parser_error result["no_client_leak_detected"] = not client_leak_detected if server_output is not "": server_parser_error, server_leak_detected = WeaveUtilities.scan_for_leaks_and_parser_errors( server_output) result["no_server_parser_error"] = not client_parser_error result["no_server_leak_detected"] = not server_leak_detected if self.wdm_option == "view": if any("kEvent_ViewResponseReceived" in s for s in kevents) and \ kevents[-1] == "kEvent_ViewResponseConsumed": smoke_check = True else: smoke_check = False elif self.wdm_option == "one_way_subscribe": if any("Client->kEvent_OnSubscriptionEstablished" in s for s in kevents) \ and "Closing endpoints" in client_output: smoke_check = True else: smoke_check = False elif self.wdm_option == "mutual_subscribe": if any("Publisher->kEvent_OnSubscriptionEstablished" in s for s in kevents) \ and "Closing endpoints" in client_output: smoke_check = True else: smoke_check = False result["smoke_check"] = smoke_check if self.quiet is False: print "weave-wdm-next %s from node %s (%s) to node %s (%s) : "\ % (self.wdm_option, client_info["client_node_id"], client_info["client_ip"], self.server_node_id, self.server_ip) if smoke_check is True: for kevent in kevents: print hgreen(kevent) print hgreen("weave-wdm-next %s success" % self.wdm_option) else: for kevent in kevents: print hred(kevent) print hred("weave-wdm-next %s failure" % self.wdm_option) if client_parser_error is True: print hred("client parser error") if client_leak_detected is True: print hred("client_resource leak detected") if server_parser_error is True: print hred("server parser error") if server_leak_detected is True: print hred("server resource leak detected") return result
def run(self): self.logger.debug("[localhost] WeaveSecurityPing: Run.") self.__pre_check() if self.use_plaid: self.__start_plaid_server() self.__start_server_side() emsg = "WeaveSecurityPing %s should be running." % ( self.server_process_tag) self.logger.debug("[%s] WeaveSecurityPing: %s" % (self.server_node_id, emsg)) self.__start_client_side(False) self.__wait_for_client() client_output_value, client_output_data = \ self.get_test_output(self.client_node_id, self.client_process_tag, True) if self.strace: client_strace_value, client_strace_data = \ self.get_test_strace(self.client_node_id, self.client_process_tag, True) if self.no_service: server_output_data = "" server_strace_data = "" else: self.__stop_server_side() if self.use_plaid: self.__stop_plaid_server() server_output_value, server_output_data = \ self.get_test_output(self.server_node_id, self.server_process_tag, True) if self.strace: server_strace_value, server_strace_data = \ self.get_test_strace(self.server_node_id, self.server_process_tag, True) avg, results = self.__process_results(client_output_data) client_parser_error, client_leak_detected = WeaveUtilities.scan_for_leaks_and_parser_errors( client_output_data) server_parser_error, server_leak_detected = WeaveUtilities.scan_for_leaks_and_parser_errors( server_output_data) data = {} data["client_output"] = client_output_data data["server_output"] = server_output_data if self.strace: data["client_strace"] = client_strace_data data["server_strace"] = server_strace_data data[ "other_failure"] = client_parser_error or client_leak_detected or server_parser_error or server_leak_detected self.logger.debug("[localhost] WeaveSecurityPing: Done.") return ReturnMsg(avg, data)
def __process_results(self, client_output, server_output): parser_error = False leak_detected = False transfer_done = False parser_error, leak_detected = WeaveUtilities.scan_for_leaks_and_parser_errors( client_output) for line in client_output.split("\n"): if "WEAVE:BDX: Transfer complete!" in line: transfer_done = True break if self.quiet == False: if self.download: print "weave-bdx from server v%s %s (%s) to client v%s %s (%s) : " % \ (self.server_version, self.server_node_id, self.server_ip, self.client_version, self.client_node_id, self.client_ip) if transfer_done: print hgreen("downloaded") else: print hred("not downloaded") else: print "weave-bdx from client %s (%s) to server %s (%s) : " % \ (self.client_node_id, self.client_ip, self.server_node_id, self.server_ip) if transfer_done: print hgreen("uploaded") else: print hred("not uploaded") if leak_detected: print hred("resource leak detected in the client's ouput") if parser_error: print hred("parser error in the client's output") pass_test = transfer_done and not leak_detected and not parser_error if self.server is not "service": # check the server for leaks and parser errors parser_error, leak_detected = WeaveUtilities.scan_for_leaks_and_parser_errors( server_output) if self.quiet == False: if leak_detected: print hred("resource leak detected in the server's ouput") if parser_error: print hred("parser error in the server's output") pass_test = pass_test and not parser_error and not leak_detected return (pass_test, client_output)
def __process_tunnel_results(self, gw, gw_value, gw_data, ping_value, ping_data, test_tag): gw_output = gw_data.get("gateway_output") service_output = gw_data.get("service_output") tunnel_up = self.__is_tunnel_up(gw_output) gw_parser_error, gw_leak_detected = WeaveUtilities.scan_for_leaks_and_parser_errors(gw_output) service_parser_error, service_leak_detected = WeaveUtilities.scan_for_leaks_and_parser_errors(service_output) # at the end of the test, 'tunnel_up' should be True if not tunnel_up: print hred(" Tunnel start: Failed [" + test_tag + "]") if ping_value != 0: # loss_percentage == 0 print hred(" Ping test: Failed [" + test_tag + "]") if gw_parser_error is True: print hred(" gateway parser error [" + test_tag + "]") if gw_leak_detected is True: print hred(" gateway leak detected [" + test_tag + "]+") if service_parser_error is True: print hred("service parser error") if service_leak_detected is True: print hred("service resource leak detected") result = {} result["tunnel_up"] = tunnel_up result["ping_successful"] = ping_value == 0 #loss_percentage == 0 result["no_gw_parser_error"] = not gw_parser_error result["no_gw_leak_detected"] = not gw_leak_detected result["no_service_parser_error"] = not service_parser_error result["no_service_leak_detected"] = not service_leak_detected return result