diff options
| author | guoqiuya <[email protected]> | 2024-11-27 11:14:17 +0800 |
|---|---|---|
| committer | guoqiuya <[email protected]> | 2024-11-27 11:14:17 +0800 |
| commit | 1ed2a77d34f4f30dec6b10ac01619922999e8f5b (patch) | |
| tree | 2ebd5663908da00b2d5a6d1d9faa271303a932f9 | |
| parent | 4b16609dfb03ac088b9b44af3f5820993d96ecf2 (diff) | |
| parent | fcd09cbee6f64c63c59cc6ef996bdb3be01b048c (diff) | |
Merge branch 'develop' of https://git.mesalab.cn/chongming/tsg_test into develop
335 files changed, 2743 insertions, 3556 deletions
diff --git a/support/api_utils/create_objects.py b/support/api_utils/create_objects.py index 76edfb670..db20ce7d6 100644 --- a/support/api_utils/create_objects.py +++ b/support/api_utils/create_objects.py @@ -33,29 +33,29 @@ class CreateObjects: object_template_json["object"]["member_type"] = "tunnel" else: object_template_json["object"]["member_type"] = "item" - if "excluded_sub_object_uuids" in object_temp[j]: + if "excluded_sub_objects" in object_temp[j]: object_template_json["object"]["excluded_sub_object_uuids"] = [] - excluded_object_temp = object_temp[j]["excluded_sub_object_uuids"] + excluded_object_temp = object_temp[j]["excluded_sub_objects"] for v in range(len(excluded_object_temp)): object_uuids_list.append(self.create_common_objects(object_template_json, excluded_object_temp[v], "")) filter_object_uuids_list = [item for item in object_uuids_list if "type" in item and item["type"] == object_temp[j]["type"]] object_template_json["object"]["excluded_sub_object_uuids"].append(filter_object_uuids_list[0]["uuid"]) - if "included_sub_object_uuids" in object_temp[j]: + if "included_sub_objects" in object_temp[j]: object_template_json["object"]["included_sub_object_uuids"] = [] - include_object_temp = object_temp[j]["included_sub_object_uuids"] + include_object_temp = object_temp[j]["included_sub_objects"] for u in range(len(include_object_temp)): object_uuids_list.append(self.create_common_objects(object_template_json, include_object_temp[u], "")) filter_object_uuids_list = [item for item in object_uuids_list if "type" in item and item["type"] == object_temp[j]["type"]] object_template_json["object"]["included_sub_object_uuids"].append(filter_object_uuids_list[1]["uuid"]) # included_sub_object_uuids 在group 中必定会存在 - object_template_json["object"]["member_type"] = "subordinate" + object_template_json["object"]["member_type"] = object_temp[j]["member_type"] object_template_json["object"]["statistics_option"] = object_temp[j]["statistics_option"] if "items" in object_template_json["object"]: del object_template_json["object"]["items"] if object_temp[j]["type"] not in ["ip", "mobile_identity"]: del object_template_json["object"]["sub_type"] object_uuids_list.append(self.create_common_objects(object_template_json, object_temp[u], "")) - if object_temp[j]["type"] != "tunnel" and "included_sub_object_uuids" not in object_temp[j]: + if object_temp[j]["type"] != "tunnel" and "included_sub_objects" not in object_temp[j]: object_uuids_list.append(self.create_common_objects(object_template_json, object_temp[j], "")) elif object_temp[j]["type"] == "tunnel": tunnel = {} @@ -82,10 +82,10 @@ class CreateObjects: object_template_json["object"]["type"] = object_temp[j]["type"] if "sub_type" in object_temp[j]: object_template_json["object"]["sub_type"] = object_temp[j]["sub_type"] - if "excluded_sub_object_uuids" in object_temp[j]: + if "excluded_sub_objects" in object_temp[j]: object_uuids_temp_dict = {} object_template_json["object"]["excluded_sub_object_uuids"] = [] - excluded_object_temp = object_temp[j]["excluded_sub_object_uuids"] + excluded_object_temp = object_temp[j]["excluded_sub_objects"] for x in range(len(excluded_object_temp)): item_temp = excluded_object_temp[x]["items"] object_uuids_temp_dict["uuid"] = self.query_uuids_by_sql(item_temp, excluded_object_temp[x]["type"]) @@ -94,10 +94,10 @@ class CreateObjects: object_uuids_list.append(object_uuids_temp_dict) filter_object_uuids_list = [item for item in object_uuids_list if "type" in item and item["type"] == object_temp[j]["type"]] object_template_json["object"]["excluded_sub_object_uuids"] = filter_object_uuids_list[0]["uuid"] - if "included_sub_object_uuids" in object_temp[j]: + if "included_sub_objects" in object_temp[j]: object_uuids_temp_dict = {} object_template_json["object"]["included_sub_object_uuids"] = [] - include_object_temp = object_temp[j]["included_sub_object_uuids"] + include_object_temp = object_temp[j]["included_sub_objects"] for w in range(len(include_object_temp)): item_temp = include_object_temp[w]["items"] object_uuids_temp_dict["uuid"] = self.query_uuids_by_sql(item_temp, object_temp[w]["type"]) @@ -106,14 +106,14 @@ class CreateObjects: object_uuids_list.append(object_uuids_temp_dict) filter_object_uuids_list = [item for item in object_uuids_list if "type" in item and item["type"] == object_temp[j]["type"]] object_template_json["object"]["included_sub_object_uuids"]= filter_object_uuids_list[1]["uuid"] - object_template_json["object"]["member_type"] = "subordinate" + object_template_json["object"]["member_type"] = object_temp[j]["member_type"] object_template_json["object"]["statistics_option"] = object_temp[j]["statistics_option"] if "items" in object_template_json["object"]: del object_template_json["object"]["items"] if "sub_type" in object_template_json["object"]: del object_template_json["object"]["sub_type"] object_uuids_list.append(self.create_common_objects(object_template_json, object_temp[j], "")) - if "included_sub_object_uuids" not in object_temp[j]: + if "included_sub_objects" not in object_temp[j]: item_temp = object_temp[j]["items"] object_uuids_temp_dict = {} object_uuids_temp_dict["uuid"] = self.query_uuids_by_sql(item_temp, object_temp[j]["type"]) @@ -265,7 +265,7 @@ class CreateObjects: "tunnel_level": "tunnel-levels", } object_type = object_temp["type"] - if object_type not in ["tunnel", "application", "signature", "user_defined_attribute"] and "included_sub_object_uuids" not in object_temp: + if object_type not in ["tunnel", "application", "signature", "user_defined_attribute"] and "included_sub_objects" not in object_temp: item_temp = object_temp["items"] item_list = [] if object_type == "ip": @@ -293,7 +293,7 @@ class CreateObjects: object_template_json["object"]["items"] = item_list object_template_json["object"]["type"] = object_temp["type"] object_template_json["object"]["name"] = object_temp["name"] - elif "included_sub_object_uuids" in object_temp: + elif "included_sub_objects" in object_temp: object_template_json["object"]["type"] = object_temp["type"] object_template_json["object"]["name"] = object_temp["name"] # object_template_json["object"]["member_type"] = "application" @@ -329,9 +329,9 @@ class CreateObjects: del temp_headers["Content-Type"] response = requests.post(url=url, data=user_defined_attribute_data, headers=self.headers, files=files, verify=False) if response.status_code == 200: - if "included_sub_object_uuids" not in object_temp: + if "included_sub_objects" not in object_temp: print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], "Create {} object successfully.".format(object_type), flush=True) - elif "included_sub_object_uuids" in object_temp: + elif "included_sub_objects" in object_temp: print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], "Create {} object group successfully.".format(object_type), flush=True) response_dict = json.loads(response.text) object_uuids = self.get_uuids(response_dict, object_type) @@ -345,7 +345,7 @@ class CreateObjects: object_uuids_temp_dict["uuid"] = object_uuids if object_type == "user_defined_attribute": object_uuids_temp_dict["name"] = user_defined_attribute_data["name"] - elif object_type == "application" and "included_sub_object_uuids" not in object_temp: + elif object_type == "application" and "included_sub_objects" not in object_temp: object_uuids_temp_dict["name"] = object_temp["application"]["app_name"] else: object_uuids_temp_dict["name"] = object_temp["name"] diff --git a/support/api_utils/query_rule_log.py b/support/api_utils/query_rule_log.py index 7a2fe53c7..6ea0a58d9 100644 --- a/support/api_utils/query_rule_log.py +++ b/support/api_utils/query_rule_log.py @@ -93,7 +93,7 @@ class QueryRuleLog: log_condition_dict["intervals"].append(start_time + '/' + end_time) log_condition_dict['vsys'] = self.parameter["vsys"] if self.is_attribute_name_exsit("ATTR_SUBSCRIBER_ID") == True: - log_filter = f"vsys_id in ({int(self.parameter["vsys"])}) AND subscriber_id='{self.parameter['test_subcriber_id']}' AND has({log_query_rule_type}, '{rule_uuid})'" + log_filter = f"vsys_id in ({int(self.parameter['vsys'])}) AND subscriber_id='{self.parameter['test_subcriber_id']}' AND has({log_query_rule_type}, '{rule_uuid}')" log_condition_dict['filter'] = log_filter else: if self.traffic_generation["tool"] == "trex": @@ -101,12 +101,12 @@ class QueryRuleLog: attack_type = "Custom Network Attack" log_condition_dict['filter'] = f"destination_ip='{traffic_generation['servers_start_ip']}'AND attack_type='{attack_type}'" else: - log_filter = f"vsys_id in ({int(self.parameter["vsys"])}) AND client_ip={traffic_generation['clients_start_ip']} AND has({log_query_rule_type}, '{rule_uuid}')" + log_filter = f"vsys_id in ({int(self.parameter['vsys'])}) AND client_ip={traffic_generation['clients_start_ip']} AND has({log_query_rule_type}, '{rule_uuid}')" log_condition_dict['filter'] = log_filter log_condition_dict['filter'] = log_condition_dict['filter'].replace(f"client_ip={traffic_generation['clients_start_ip']}",f"client_ip='{traffic_generation['clients_start_ip']}'") else: # log_filter = f"client_ip={self.parameter['test_pc_ip']} AND has({log_query_rule_type}, '{rule_uuid}')" - log_filter = f"vsys_id in ({int(self.parameter["vsys"])}) AND client_ip={self.parameter['test_pc_ip']} AND has({log_query_rule_type}, '{rule_uuid}')" + log_filter = f"vsys_id in ({int(self.parameter['vsys'])}) AND client_ip={self.parameter['test_pc_ip']} AND has({log_query_rule_type}, '{rule_uuid}')" log_condition_dict['filter'] = log_filter log_condition_dict['filter'] = log_condition_dict['filter'].replace(f"client_ip={self.parameter['test_pc_ip']}", f"client_ip='{self.parameter['test_pc_ip']}'") dsl_dict["dsl"] = log_condition_dict @@ -119,6 +119,7 @@ class QueryRuleLog: "query_jobs":[{"id": job_id,"query_option":"list"}], "vsys":int(self.parameter["vsys"]),"limit":20,"offset":0 } + time.sleep(2) response = requests.post(url, headers=headers, json=query_list_dict, verify=False) assert response.status_code == 200 log_list = json.loads(response.text) diff --git a/support/ui_utils/element_position/map_element_position_library.py b/support/ui_utils/element_position/map_element_position_library.py index 1b9b8b59d..f7f6f7f64 100644 --- a/support/ui_utils/element_position/map_element_position_library.py +++ b/support/ui_utils/element_position/map_element_position_library.py @@ -2113,7 +2113,7 @@ def get_name_list(test_data): def create_pre_policy(data, driver): "manipulition创建前添加前置策略,security deny quic 和 intercept" - create_rule = CreateRule(driver) + create_rule = CreateRules(driver) test_data = data security_temp_deny_quic = { "is_multi_priority": False, @@ -2242,9 +2242,9 @@ def delete_pre_policy(name_list, driver): policy_type = name_list[i]["type"] policy_name = name_list[i]["name"] element_position = get_element_position(policy_type) - search_rule = SearchRule(driver) + search_rule = SearchRules(driver) search_rule_code, first_row_checkbox_element = search_rule.search(policy_type, policy_name, element_position) - delete_rule = DeleteRule(driver) + delete_rule = DeleteRules(driver) delete_rule_code = delete_rule.delete(element_position, first_row_checkbox_element, True) if policy_type == "proxy_intercept": policy_type = "intercept" diff --git a/support/ui_utils/policy/create_rules.py b/support/ui_utils/policy/create_rules.py index efae2f33b..d17e7d541 100644 --- a/support/ui_utils/policy/create_rules.py +++ b/support/ui_utils/policy/create_rules.py @@ -21,13 +21,10 @@ class CreateRules: def create_rules(self, policy_configuration): try: - # 根据rule type获取增删改查全部元素定位库,可单独写一个函数,下面只是举例 - element_position_library = get_element_position(policy_configuration["policy_type"]) - if policy_configuration["threshold"]["type"] == "rate": - element_position_library["create"]["policyRulePage_thresholdType_posId"] = dosRulePage_thresholdRateType_posXpath - element_position_library["create"]["policyRulePage_mitigationTimeouts_select_posXpath"] = policyRulePage_mitigationTimeouts_select_posXpath + # 根据rule type获取增删改查全部元素定位库,若有需要补充的,在下面或在map_element_position_library中追加 + element_position_library = get_element_position(policy_configuration["type"]) page_jump_element_position = element_position_library["page_jump"] - create_element_position = element_position_library["create"] + creation_element_position = element_position_library["create"] # 页面跳转 page_jump = PageJump(self.driver) @@ -35,98 +32,96 @@ class CreateRules: # 点击create time.sleep(0.3) - self.driver.find_element(By.XPATH, create_element_position["policyRuleListPage_createButton_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRuleListPage_createButton_posXpath"]).click() # 输入name - rule_name = policy_configuration["rule_name"] + rule_name = policy_configuration["name"] time.sleep(0.5) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_inputName_posXpath"]).send_keys(rule_name) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_inputName_posXpath"]).send_keys(rule_name) # 选择action - if policy_configuration["policy_type"] == "security" or policy_configuration["policy_type"] == "proxy_intercept" or policy_configuration["policy_type"] == "dos_protection": - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectAction_posXpath"]).click() - elif policy_configuration["policy_type"] == "proxy_manipulation": - if policy_configuration["rule_action"] == "allow": - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectAllow_posXpath"]).click() - elif policy_configuration["rule_action"] == "deny": - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectDeny_posXpath"]).click() - elif policy_configuration["rule_action"] == "monitor": - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectMonitor_posXpath"]).click() - elif policy_configuration["rule_action"] == "redirect": - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectRedirect_posXpath"]).click() - elif policy_configuration["rule_action"] in ["replace", "hijack", "insert", "edit_element"]: - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectModify_posXpath"]).click() - # elif policy_configuration["rule_action"] == "hijack": - # self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectHijack_posXpath"]).click() - # elif policy_configuration["rule_action"] == "insert": - # self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectInsert_posXpath"]).click() - # elif policy_configuration["rule_action"] == "edit_element": - # self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectEditElement_posXpath"]).click() + if policy_configuration["type"] == "security" or policy_configuration["type"] == "proxy_intercept" or policy_configuration["type"] == "dos_protection": + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectAction_posXpath"]).click() + elif policy_configuration["type"] == "proxy_manipulation": + if policy_configuration["action"] == "allow": + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectAllow_posXpath"]).click() + elif policy_configuration["action"] == "deny": + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectDeny_posXpath"]).click() + elif policy_configuration["action"] == "monitor": + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectMonitor_posXpath"]).click() + elif policy_configuration["action"] == "redirect": + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectRedirect_posXpath"]).click() + elif policy_configuration["action"] in ["replace", "hijack", "insert", "edit_element"]: + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectModify_posXpath"]).click() + # elif policy_configuration["action"] == "hijack": + # self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectHijack_posXpath"]).click() + # elif policy_configuration["action"] == "insert": + # self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectInsert_posXpath"]).click() + # elif policy_configuration["action"] == "edit_element": + # self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectEditElement_posXpath"]).click() else: # run script - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectRunScript_posXpath"]).click() - elif policy_configuration["policy_type"]== "monitor" and "is_mirror" in policy_configuration : - if policy_configuration["is_mirror"] == "on": - self.driver.find_element(By.XPATH,create_element_position["policyRulePage_mirrorTrafficButton_posXpath"]).click() - else: - pass - if "log_options" in policy_configuration and policy_configuration["log_options"] == "all": + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectRunScript_posXpath"]).click() + elif policy_configuration["type"]== "monitor": + if policy_configuration["action_parameter"]["traffic_mirroring"]["enable"] == 1: + self.driver.find_element(By.XPATH,creation_element_position["policyRulePage_mirrorTrafficButton_posXpath"]).click() + if "log_option" in policy_configuration and policy_configuration["log_option"] == "all": self.driver.find_element(By.XPATH,monitorRulePage_logOptions_all_posXpath).click() # 添加ip - if "source_ip" in policy_configuration["condition"] and len(policy_configuration["condition"]["source_ip"]) != 0: - src_ip_data = policy_configuration["condition"]["source_ip"] - self.add_ip(src_ip_data, "SrcIP", create_element_position) - if "source_ip_group" in policy_configuration["condition"] and len(policy_configuration["condition"]["source_ip_group"]) != 0: - src_ip_group_data = policy_configuration["condition"]["source_ip_group"] - self.add_ip(src_ip_group_data, "SrcIP", create_element_position) - if "destination_ip" in policy_configuration["condition"] and len(policy_configuration["condition"]["destination_ip"]) != 0: - dst_ip_data = policy_configuration["condition"]["destination_ip"] - self.add_ip(dst_ip_data, "DstIP", create_element_position) - if "destination_ip_group" in policy_configuration["condition"] and len(policy_configuration["condition"]["destination_ip_group"]) != 0: - dst_ip_group_data = policy_configuration["condition"]["destination_ip_group"] - self.add_ip(dst_ip_group_data, "DstIP", create_element_position) - if "internal_ip" in policy_configuration["condition"] and len(policy_configuration["condition"]["internal_ip"]) != 0: - internal_ip_data = policy_configuration["condition"]["internal_ip"] - self.add_ip(internal_ip_data, "InternalIP", create_element_position) - if "internal_ip_group" in policy_configuration["condition"] and len(policy_configuration["condition"]["internal_ip_group"]) != 0: - internal_ip_group_data = policy_configuration["condition"]["internal_ip_group"] - self.add_ip(internal_ip_group_data, "InternalIP", create_element_position) - if "external_ip" in policy_configuration["condition"] and len(policy_configuration["condition"]["external_ip"]) != 0: - external_ip_data = policy_configuration["condition"]["external_ip"] - self.add_ip(external_ip_data, "ExternalIP", create_element_position) - if "external_ip_group" in policy_configuration["condition"] and len(policy_configuration["condition"]["external_ip_group"]) != 0: - external_ip_group_data = policy_configuration["condition"]["external_ip_group"] - self.add_ip(external_ip_group_data, "ExternalIP", create_element_position) + if self.is_attribute_name_exsit(policy_configuration, "ATTR_SOURCE_IP")[0] and self.is_group_exsit(policy_configuration, "member_type")[0] == False: + src_ip_data = self.is_attribute_name_exsit(policy_configuration, "ATTR_SOURCE_IP")[1] + self.add_ip(src_ip_data, "SrcIP", creation_element_position) + if self.is_attribute_name_exsit(policy_configuration, "ATTR_SOURCE_IP")[0] and self.is_group_exsit(policy_configuration, "member_type")[0]: + src_ip_group_data = self.is_group_exsit(policy_configuration, "ATTR_SOURCE_IP")[1] + self.add_ip(src_ip_group_data, "SrcIP", creation_element_position) + if self.is_attribute_name_exsit(policy_configuration, "ATTR_DESTINATION_IP")[0] and self.is_group_exsit(policy_configuration, "member_type")[0] == False: + dst_ip_data = self.is_attribute_name_exsit(policy_configuration, "ATTR_DESTINATION_IP")[1] + self.add_ip(dst_ip_data, "DstIP", creation_element_position) + if self.is_attribute_name_exsit(policy_configuration, "ATTR_DESTINATION_IP")[0] and self.is_group_exsit(policy_configuration, "member_type")[0]: + dst_ip_group_data = self.is_group_exsit(policy_configuration, "ATTR_DESTINATION_IP")[1] + self.add_ip(dst_ip_group_data, "DstIP", creation_element_position) + if self.is_attribute_name_exsit(policy_configuration, "ATTR_INTERNAL_IP")[0] and self.is_group_exsit(policy_configuration, "member_type")[0] == False: + internal_ip_data = self.is_attribute_name_exsit(policy_configuration, "ATTR_INTERNAL_IP")[1] + self.add_ip(internal_ip_data, "InternalIP", creation_element_position) + if self.is_attribute_name_exsit(policy_configuration, "ATTR_INTERNAL_IP")[0] and self.is_group_exsit(policy_configuration, "member_type")[0]: + internal_ip_group_data = self.is_group_exsit(policy_configuration, "ATTR_INTERNAL_IP")[1] + self.add_ip(internal_ip_group_data, "InternalIP", creation_element_position) + if self.is_attribute_name_exsit(policy_configuration, "ATTR_EXTERNAL_IP")[0] and self.is_group_exsit(policy_configuration, "member_type")[0] == False: + external_ip_data = self.is_attribute_name_exsit(policy_configuration, "ATTR_EXTERNAL_IP")[1] + self.add_ip(external_ip_data, "ExternalIP", creation_element_position) + if self.is_attribute_name_exsit(policy_configuration, "ATTR_EXTERNAL_IP")[0] and self.is_group_exsit(policy_configuration, "member_type")[0]: + external_ip_group_data = self.is_group_exsit(policy_configuration, "member_type")[1] + self.add_ip(external_ip_group_data, "ExternalIP", creation_element_position) # 添加port - if "source_port" in policy_configuration["condition"] and len(policy_configuration["condition"]["source_port"]) != 0: - src_port_data = policy_configuration["condition"]["source_port"] - self.add_port(src_port_data, "SrcPort", create_element_position) - if "source_port_group" in policy_configuration["condition"] and len(policy_configuration["condition"]["source_port_group"]) != 0: - src_port_group_data = policy_configuration["condition"]["source_port_group"] - self.add_port(src_port_group_data, "SrcPort", create_element_position) - if "destination_port" in policy_configuration["condition"] and len(policy_configuration["condition"]["destination_port"]) != 0: - dst_port_data = policy_configuration["condition"]["destination_port"] - self.add_port(dst_port_data, "DstPort", create_element_position) - if "destination_port_group" in policy_configuration["condition"] and len(policy_configuration["condition"]["destination_port_group"]) != 0: - dst_port_group_data = policy_configuration["condition"]["destination_port_group"] - self.add_port(dst_port_group_data, "DstPort", create_element_position) - if "internal_port" in policy_configuration["condition"] and len(policy_configuration["condition"]["internal_port"]) != 0: - internal_port_data = policy_configuration["condition"]["internal_port"] - self.add_port(internal_port_data, "InternalPort", create_element_position) - if "internal_port_group" in policy_configuration["condition"] and len(policy_configuration["condition"]["internal_port_group"]) != 0: - internal_port_group_data = policy_configuration["condition"]["internal_port_group"] - self.add_port(internal_port_group_data, "InternalPort", create_element_position) - if "external_port" in policy_configuration["condition"] and len(policy_configuration["condition"]["external_port"]) != 0: - external_port_data = policy_configuration["condition"]["external_port"] - self.add_port(external_port_data, "ExternalPort", create_element_position) - if "external_port_group" in policy_configuration["condition"] and len(policy_configuration["condition"]["external_port_group"]) != 0: - external_port_group_data = policy_configuration["condition"]["external_port_group"] - self.add_port(external_port_group_data, "ExternalPort", create_element_position) + if self.is_attribute_name_exsit(policy_configuration, "ATTR_SOURCE_PORT")[0] and self.is_group_exsit(policy_configuration, "member_type")[0] == False: + src_port_data = self.is_attribute_name_exsit(policy_configuration, "ATTR_SOURCE_PORT")[1] + self.add_port(src_port_data, "SrcPort", creation_element_position) + if self.is_attribute_name_exsit(policy_configuration, "ATTR_SOURCE_PORT")[0] and self.is_group_exsit(policy_configuration, "member_type")[0]: + src_port_group_data = self.is_group_exsit(policy_configuration, "member_type")[1] + self.add_port(src_port_group_data, "SrcPort", creation_element_position) + if self.is_attribute_name_exsit(policy_configuration, "ATTR_DESTINATION_PORT")[0] and self.is_group_exsit(policy_configuration, "member_type")[0] == False: + dst_port_data = self.is_attribute_name_exsit(policy_configuration, "ATTR_DESTINATION_PORT")[1] + self.add_port(dst_port_data, "DstPort", creation_element_position) + if self.is_attribute_name_exsit(policy_configuration, "ATTR_DESTINATION_PORT")[0] and self.is_group_exsit(policy_configuration, "member_type")[0]: + dst_port_group_data = self.is_group_exsit(policy_configuration, "member_type")[1] + self.add_port(dst_port_group_data, "DstPort", creation_element_position) + if self.is_attribute_name_exsit(policy_configuration, "ATTR_INTERNAL_PORT")[0] and self.is_group_exsit(policy_configuration, "member_type")[0] == False: + internal_port_data = self.is_attribute_name_exsit(policy_configuration, "ATTR_INTERNAL_PORT")[1] + self.add_port(internal_port_data, "InternalPort", creation_element_position) + if self.is_attribute_name_exsit(policy_configuration, "ATTR_INTERNAL_PORT")[0] and self.is_group_exsit(policy_configuration, "member_type")[0]: + internal_port_group_data = self.is_group_exsit(policy_configuration, "member_type")[1] + self.add_port(internal_port_group_data, "InternalPort", creation_element_position) + if self.is_attribute_name_exsit(policy_configuration, "ATTR_EXTERNAL_PORT")[0] and self.is_group_exsit(policy_configuration, "member_type")[0] == False: + external_port_data = self.is_attribute_name_exsit(policy_configuration, "ATTR_EXTERNAL_PORT")[1] + self.add_port(external_port_data, "ExternalPort", creation_element_position) + if self.is_attribute_name_exsit(policy_configuration, "ATTR_EXTERNAL_PORT")[0] and self.is_group_exsit(policy_configuration, "member_type")[0]: + external_port_group_data = self.is_group_exsit(policy_configuration, "member_type")[1] + self.add_port(external_port_group_data, "ExternalPort", creation_element_position) - if "sub_id" in policy_configuration["condition"] and len(policy_configuration["condition"]["sub_id"]) != 0: - subid_data = policy_configuration["condition"]["sub_id"] - self.add_subid(subid_data, "User", create_element_position) + if self.is_attribute_name_exsit(policy_configuration, "ATTR_SUBSCRIBER_ID")[0] and self.is_group_exsit(policy_configuration, "member_type")[0] == False: + subid_data = self.is_attribute_name_exsit(policy_configuration, "ATTR_SUBSCRIBER_ID")[1] + self.add_subid(subid_data, "User", creation_element_position) # 添加device if "device" in policy_configuration["condition"] and len(policy_configuration["condition"]["device"]) != 0: @@ -134,104 +129,105 @@ class CreateRules: for t in range(len(device_data)): if device_data[t]['item'][0]["item_type"] == "imsi": # 点add condition的+ - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_posXpath"]).click() # 选中imsi - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addConditionImsi_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_close_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addConditionImsi_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_close_posXpath"]).click() # 点imsi的+,因为dst ip已经是第一层且t初始值是0,所以要+2 - temp_element_position = create_element_position["policyRulePage_addImsi_posXpath"] + temp_element_position = creation_element_position["policyRulePage_addImsi_posXpath"] self.driver.find_element(By.XPATH, temp_element_position).click() # 通过imsi搜索并选中 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchImsi_posXpath"], find_after_wait_time=1).send_keys(device_data[t]["name"]) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchImsi_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectImsi_posXpath"], find_after_wait_time=0.5).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_closeImsi_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchImsi_posXpath"], find_after_wait_time=1).send_keys(device_data[t]["name"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchImsi_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectImsi_posXpath"], find_after_wait_time=0.5).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_closeImsi_posXpath"]).click() elif device_data[t]['item'][0]["item_type"] == "phone_number": # 点add condition的+ - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_posXpath"]).click() # 都属于device,所以调用imsi的定位即可 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addConditionImsi_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_close_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addConditionImsi_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_close_posXpath"]).click() # 点device的+ - temp_element_position = create_element_position["policyRulePage_addImsi_posXpath"] + temp_element_position = creation_element_position["policyRulePage_addImsi_posXpath"] self.driver.find_element(By.XPATH, temp_element_position).click() # 选中phone number - temp_element_position = create_element_position["policyRulePage_choosePhoneNumber_posXpath"] + temp_element_position = creation_element_position["policyRulePage_choosePhoneNumber_posXpath"] self.driver.find_element(By.XPATH, temp_element_position).click() # 通过phone number搜索并选中(与imsi共用) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchImsi_posXpath"], find_after_wait_time=1).send_keys(device_data[t]["name"]) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchImsi_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectImsi_posXpath"], find_after_wait_time=0.5).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_closeImsi_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchImsi_posXpath"], find_after_wait_time=1).send_keys(device_data[t]["name"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchImsi_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectImsi_posXpath"], find_after_wait_time=0.5).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_closeImsi_posXpath"]).click() elif device_data[t]['item'][0]["item_type"] == "imei": # 点add condition的+ - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_posXpath"]).click() # 都属于device,所以调用imsi的定位即可 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addConditionImsi_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_close_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addConditionImsi_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_close_posXpath"]).click() # 点device的+ - temp_element_position = create_element_position["policyRulePage_addImsi_posXpath"] + temp_element_position = creation_element_position["policyRulePage_addImsi_posXpath"] self.driver.find_element(By.XPATH, temp_element_position).click() # 选中phone number - temp_element_position = create_element_position["policyRulePage_chooseImei_posXpath"] + temp_element_position = creation_element_position["policyRulePage_chooseImei_posXpath"] self.driver.find_element(By.XPATH, temp_element_position).click() # 通过phone number搜索并选中(与imsi共用) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchImsi_posXpath"], find_after_wait_time=1).send_keys(device_data[t]["name"]) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchImsi_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectImsi_posXpath"], find_after_wait_time=0.5).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_closeImsi_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchImsi_posXpath"], find_after_wait_time=1).send_keys(device_data[t]["name"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchImsi_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectImsi_posXpath"], find_after_wait_time=0.5).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_closeImsi_posXpath"]).click() for j in range(len(device_data)): if device_data[j]["negate"] == True: time.sleep(1) # 暂停1秒 - negate_element = self.driver.find_element(By.XPATH, create_element_position["policyRulePage_negateImsi_posXpath"]) + negate_element = self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_negateImsi_posXpath"]) ActionChains(self.driver).move_to_element(negate_element).perform() # 悬停以使元素可见 negate_element.click() + # 添加apn if "apn" in policy_configuration["condition"] and len(policy_configuration["condition"]["apn"]) != 0: device_data = policy_configuration["condition"]["apn"] for t in range(len(device_data)): if device_data[t]['items'][0]["item_type"] == "apn": # 点add condition的+ - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_posXpath"]).click() # 都属于device,所以调用apn的定位即可 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addConditionImsi_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_close_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addConditionImsi_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_close_posXpath"]).click() # 点device的+ - temp_element_position = create_element_position["policyRulePage_addImsi_posXpath"] + temp_element_position = creation_element_position["policyRulePage_addImsi_posXpath"] self.driver.find_element(By.XPATH, temp_element_position).click() # 选中apn - temp_element_position = create_element_position["policyRulePage_chooseApn_posXpath"] + temp_element_position = creation_element_position["policyRulePage_chooseApn_posXpath"] self.driver.find_element(By.XPATH, temp_element_position).click() # 通过apn搜索并选中(与imsi共用) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchImsi_posXpath"], find_after_wait_time=1).send_keys(device_data[t]["name"]) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchImsi_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectImsi_posXpath"], find_after_wait_time=0.5).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_closeImsi_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchImsi_posXpath"], find_after_wait_time=1).send_keys(device_data[t]["name"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchImsi_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectImsi_posXpath"], find_after_wait_time=0.5).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_closeImsi_posXpath"]).click() # 添加application if "application" in policy_configuration["condition"] and len(policy_configuration["condition"]["application"]) != 0: - if policy_configuration["policy_type"] == "proxy_manipulation": + if policy_configuration["type"] == "proxy_manipulation": if policy_configuration["condition"]["application"][0]["name"].lower() == "doh": # doh需要操作application - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addApplication_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchDoHApplication_posXpath"], find_before_wait_time=0.5).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_closeApplication_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addApplication_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchDoHApplication_posXpath"], find_before_wait_time=0.5).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_closeApplication_posXpath"]).click() else: # 非doh不需要操作application pass else: - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addApplication_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addApplication_posXpath"]).click() application_data = policy_configuration["condition"]["application"] # 通过application name搜索并选中 for j in range(len(application_data)): if application_data[j]["object_type"] == "application_group": - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectApplicationGroupLabel_posXpath"]).click() - if policy_configuration["policy_type"] == "proxy_intercept": # intercept 中 application不用搜索,直接选择 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectApplication_posXpath"].format(replaceValue=application_data[j]["name"]), find_after_wait_time=0.5).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectApplicationGroupLabel_posXpath"]).click() + if policy_configuration["type"] == "proxy_intercept": # intercept 中 application不用搜索,直接选择 + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectApplication_posXpath"].format(replaceValue=application_data[j]["name"]), find_after_wait_time=0.5).click() else: - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchApplication_posXpath"], find_after_wait_time=0.5).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchApplication_posXpath"], find_after_wait_time=1).send_keys(application_data[j]["name"]) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchApplication_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectApplication_posXpath"].format(replaceValue = application_data[j]["name"]), find_after_wait_time=0.5).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_closeApplication_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchApplication_posXpath"], find_after_wait_time=0.5).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchApplication_posXpath"], find_after_wait_time=1).send_keys(application_data[j]["name"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchApplication_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectApplication_posXpath"].format(replaceValue = application_data[j]["name"]), find_after_wait_time=0.5).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_closeApplication_posXpath"]).click() # 添加server fqdn if "server_fqdn" in policy_configuration["condition"] and len(policy_configuration["condition"]["server_fqdn"]) != 0: @@ -239,26 +235,26 @@ class CreateRules: for t in range(len(server_fqdn_data)): if server_fqdn_data[t]["object_type"] == "fqdn": # 点add condition的+ - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_posXpath"]).click() time.sleep(1) # 选中server fqdn - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addConditionServerFqdn_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_close_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addConditionServerFqdn_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_close_posXpath"]).click() # 点server fqdn的+,因为dst ip已经是第一层且t初始值是0,所以要+2 # temp = t + 2 - # temp_element_position = create_element_position["policyRulePage_addServerFqdn_posXpath"].format(replaceValue=temp) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addServerFqdn_posXpath"]).click() + # temp_element_position = creation_element_position["policyRulePage_addServerFqdn_posXpath"].format(replaceValue=temp) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addServerFqdn_posXpath"]).click() time.sleep(1) # 通过server fqdn name搜索并选中 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchServerFqdn_posXpath"], find_after_wait_time=1).send_keys(server_fqdn_data[t]["name"]) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchServerFqdn_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) - btn = self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectServerFqdn_posXpath"].format(replaceValue=server_fqdn_data[t]["name"]), find_after_wait_time= 1) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchServerFqdn_posXpath"], find_after_wait_time=1).send_keys(server_fqdn_data[t]["name"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchServerFqdn_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) + btn = self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectServerFqdn_posXpath"].format(replaceValue=server_fqdn_data[t]["name"]), find_after_wait_time= 1) self.driver.execute_script("arguments[0].click()", btn) - # self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectServerFqdn_posXpath"], find_after_wait_time=0.5).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_closeServerFqdn_posXpath"]).click() + # self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectServerFqdn_posXpath"], find_after_wait_time=0.5).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_closeServerFqdn_posXpath"]).click() if server_fqdn_data[t]["negate"] == True: time.sleep(1) # 暂停1秒 - negate_element = self.driver.find_element(By.XPATH, create_element_position["policyRulePage_negateServerFqdn_posXpath"]) + negate_element = self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_negateServerFqdn_posXpath"]) # 使用JavaScript确保元素完全进入视图 self.driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'nearest'});", negate_element) # 使用JavaScript执行悬停 @@ -273,7 +269,7 @@ class CreateRules: #添加ip_protocol if "ip_protocol" in policy_configuration["condition"] and len(policy_configuration["condition"]["ip_protocol"]) != 0: protocol_field_data = policy_configuration["condition"]["ip_protocol"] - self.add_ip_protocol(protocol_field_data, "IpProtocol", create_element_position) + self.add_ip_protocol(protocol_field_data, "IpProtocol", creation_element_position) # 添加protocol field if "protocol_filed" in policy_configuration["condition"] and len(policy_configuration["condition"]["protocol_filed"]) != 0: @@ -360,61 +356,61 @@ class CreateRules: for x in range(len(protocol_field_data)): temp = x + 1 if protocol_field_data[x]["object_type"] == "url": - self.add_protocol_field(protocol_field_data, "Url", create_element_position, temp) + self.add_protocol_field(protocol_field_data, "Url", creation_element_position, temp) elif protocol_field_data[x]["object_type"] == "fqdn": for item_dict in protocol_field_data[x]["items"]: if item_dict["item_type"] == "cn": - self.add_protocol_field(protocol_field_data, "Cn", create_element_position, temp) + self.add_protocol_field(protocol_field_data, "Cn", creation_element_position, temp) elif item_dict["item_type"] == "san": - self.add_protocol_field(protocol_field_data, "San", create_element_position, temp) + self.add_protocol_field(protocol_field_data, "San", creation_element_position, temp) elif item_dict["item_type"] == "qname": - self.add_protocol_field(protocol_field_data, "Qname", create_element_position, temp) + self.add_protocol_field(protocol_field_data, "Qname", creation_element_position, temp) else: print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], f"todo {item_dict['item_type']}") # elif protocol_field_data[x]["object_type"] == "http_signature": # item_dict = protocol_field_data[x]["item"][0] # if item_dict["item_type"] == "request_header": - # self.add_protocol_field(protocol_field_data, "RequestHeader", create_element_position, temp) + # self.add_protocol_field(protocol_field_data, "RequestHeader", creation_element_position, temp) # elif item_dict["item_type"] == "response_header": - # self.add_protocol_field(protocol_field_data, "ResponseHeader", create_element_position, temp) + # self.add_protocol_field(protocol_field_data, "ResponseHeader", creation_element_position, temp) # else: # print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], f"todo {item_dict['item_type']}") elif protocol_field_data[x]["object_type"] == "keywords": item_dict = protocol_field_data[x]["item"][0] if item_dict["item_type"] == "request_header": - self.add_protocol_field(protocol_field_data, "RequestHeader", create_element_position, temp) + self.add_protocol_field(protocol_field_data, "RequestHeader", creation_element_position, temp) elif item_dict["item_type"] == "response_header": - self.add_protocol_field(protocol_field_data, "ResponseHeader", create_element_position, temp) + self.add_protocol_field(protocol_field_data, "ResponseHeader", creation_element_position, temp) elif item_dict["item_type"] == "request_body": - self.add_protocol_field(protocol_field_data, "RequestBody", create_element_position, temp) + self.add_protocol_field(protocol_field_data, "RequestBody", creation_element_position, temp) elif item_dict["item_type"] == "response_body": - self.add_protocol_field(protocol_field_data, "ResponseBody", create_element_position, temp) + self.add_protocol_field(protocol_field_data, "ResponseBody", creation_element_position, temp) elif item_dict["item_type"] == "ftp_content": - self.add_protocol_field(protocol_field_data, "FtpContent", create_element_position, temp) + self.add_protocol_field(protocol_field_data, "FtpContent", creation_element_position, temp) elif item_dict["item_type"] == "mail_subject": - self.add_protocol_field(protocol_field_data, "MailSubject", create_element_position, temp) + self.add_protocol_field(protocol_field_data, "MailSubject", creation_element_position, temp) elif item_dict["item_type"] == "mail_attachment_name": - self.add_protocol_field(protocol_field_data, "MailAttachmentName", create_element_position, temp) + self.add_protocol_field(protocol_field_data, "MailAttachmentName", creation_element_position, temp) elif item_dict["item_type"] == "mail_attachment_content": - self.add_protocol_field(protocol_field_data, "MailAttachmentContent", create_element_position, temp) + self.add_protocol_field(protocol_field_data, "MailAttachmentContent", creation_element_position, temp) elif item_dict["item_type"] == "mail_content": - self.add_protocol_field(protocol_field_data, "MailContent", create_element_position, temp) + self.add_protocol_field(protocol_field_data, "MailContent", creation_element_position, temp) else: print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], f"todo {item_dict['item_type']}") elif protocol_field_data[x]["object_type"] == "account": for item_dict in protocol_field_data[x]["items"]: if item_dict["item_type"] == "ftp_account": - self.add_protocol_field(protocol_field_data, "FtpAccount", create_element_position, temp) + self.add_protocol_field(protocol_field_data, "FtpAccount", creation_element_position, temp) elif item_dict["item_type"] == "mail_account": - self.add_protocol_field(protocol_field_data, "MailAccount",create_element_position, temp) + self.add_protocol_field(protocol_field_data, "MailAccount",creation_element_position, temp) elif item_dict["item_type"] == "mail_from": - self.add_protocol_field(protocol_field_data, "MailFrom", create_element_position,temp) + self.add_protocol_field(protocol_field_data, "MailFrom", creation_element_position,temp) elif item_dict["item_type"] == "to": - self.add_protocol_field(protocol_field_data, "MailTo", create_element_position,temp) + self.add_protocol_field(protocol_field_data, "MailTo", creation_element_position,temp) else: print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], f"todo {item_dict['item_type']}") elif protocol_field_data[x]["object_type"] == 'boolean': - self.add_bool_type_protocol_field(protocol_field_data, "Boolean", create_element_position, temp) + self.add_bool_type_protocol_field(protocol_field_data, "Boolean", creation_element_position, temp) break if "application" in policy_configuration["condition"] and len(policy_configuration["condition"]["application"]) != 0 and "protocol_filed" in policy_configuration["condition"] and len(policy_configuration["condition"]["protocol_filed"]) == 0: @@ -423,58 +419,58 @@ class CreateRules: override_flag = False # 选择target traffic - if policy_configuration["policy_type"] == "service_chaining": + if policy_configuration["type"] == "service_chaining": if policy_configuration["targeted_traffic"] == "decrypted": - self.driver.find_element(By.XPATH,create_element_position["policyRulePage_decryptedTraffic_posXpath"]).click() + self.driver.find_element(By.XPATH,creation_element_position["policyRulePage_decryptedTraffic_posXpath"]).click() else: - self.driver.find_element(By.XPATH,create_element_position["policyRulePage_rawTraffic_posXpath"]).click() + self.driver.find_element(By.XPATH,creation_element_position["policyRulePage_rawTraffic_posXpath"]).click() # 添加sub action if "sub_action" in policy_configuration["condition"] and len(policy_configuration["condition"]["sub_action"]) != 0 and policy_configuration["condition"]["sub_action_override"] == True: sub_action_data = policy_configuration["condition"]["sub_action"] if override_flag == True: - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_override_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_override_posXpath"]).click() if sub_action_data[0]["type"] == "drop": - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_drop_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_drop_dropPkt_posXpath"]).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_drop_dropPkt_posXpath"]).send_keys(sub_action_data[0]["drop_packet"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_drop_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_drop_dropPkt_posXpath"]).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_drop_dropPkt_posXpath"]).send_keys(sub_action_data[0]["drop_packet"]) # quic不支持tcp rst;默认tcp rst是选中,不需要操作,只有当sendTcpRst为false时 if (override_flag == False and len(policy_configuration["condition"]["application"]) == 1 and policy_configuration["condition"]["application"][0]['name'] == "quic")or (sub_action_data[0]["send_tcp_rst"] == False and policy_configuration["condition"]["application"][0]['name'] != "quic" and policy_configuration["condition"]["application"][0]['name'] != "dns"): - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_drop_sendTcpRst_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_drop_sendIcmp_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_drop_sendTcpRst_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_drop_sendIcmp_posXpath"]).click() elif sub_action_data[0]["type"] == "rate_limit": - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_rateLimit_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_rateLimit_rate_posXpath"]).send_keys(sub_action_data[0]["rate_value"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_rateLimit_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_rateLimit_rate_posXpath"]).send_keys(sub_action_data[0]["rate_value"]) elif sub_action_data[0]["type"] == "tamper": time.sleep(1) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_tamper_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_tamper_posXpath"]).click() elif sub_action_data[0]["type"] == "block": - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_block_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_block_responseCode_posXpath"]).click() - dropdown_item_posXpath = create_element_position["policyRulePage_subAction_block_responseCode_change_posXpath"].format(replaceValue=sub_action_data[0]["code"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_block_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_block_responseCode_posXpath"]).click() + dropdown_item_posXpath = creation_element_position["policyRulePage_subAction_block_responseCode_change_posXpath"].format(replaceValue=sub_action_data[0]["code"]) self.driver.find_element(By.XPATH, dropdown_item_posXpath).click() # 如mail协议的block动作,没有content内容,只需要选择code if 'content_type' in sub_action_data[0]: - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_block_responseContent_posXpath"]).click() - dropdown_item_posXpath = create_element_position["policyRulePage_subAction_block_responseContent_change_posXpath"].format(replaceValue=sub_action_data[0]["content_type"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_block_responseContent_posXpath"]).click() + dropdown_item_posXpath = creation_element_position["policyRulePage_subAction_block_responseContent_change_posXpath"].format(replaceValue=sub_action_data[0]["content_type"]) self.driver.find_element(By.XPATH, dropdown_item_posXpath).click() if sub_action_data[0]["content_type"].lower() == "text": - self.driver.find_element(By.ID, create_element_position["policyRulePage_subAction_block_responseContent_text_posId"]).send_keys(sub_action_data[0]["content"]) + self.driver.find_element(By.ID, creation_element_position["policyRulePage_subAction_block_responseContent_text_posId"]).send_keys(sub_action_data[0]["content"]) elif sub_action_data[0]["content_type"].lower() == "profile": - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_block_responseContent_clickProfile_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_block_responseContent_searchProfile_posXpath"]).send_keys(sub_action_data[0]["content"]) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_block_responseContent_searchProfile_posXpath"]).send_keys(Keys.ENTER) - self.driver.find_element(By.ID, create_element_position["policyRulePage_subAction_block_responseContent_selectProfile_posId"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_block_responseContent_clickProfile_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_block_responseContent_searchProfile_posXpath"]).send_keys(sub_action_data[0]["content"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_block_responseContent_searchProfile_posXpath"]).send_keys(Keys.ENTER) + self.driver.find_element(By.ID, creation_element_position["policyRulePage_subAction_block_responseContent_selectProfile_posId"]).click() elif sub_action_data[0]["type"] == "redirect": if 'application' in policy_configuration["condition"] and len(policy_configuration["condition"])>0: application_data = policy_configuration["condition"]["application"] if application_data[0]['name'] == 'http': - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_redirect_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_redirect_posXpath"]).click() redirect_url = sub_action_data[0]["to_url"] - self.driver.find_element(By.ID, create_element_position["policyRulePage_subAction_redirect_input_posId"]).clear() - self.driver.find_element(By.ID, create_element_position["policyRulePage_subAction_redirect_input_posId"]).send_keys(redirect_url) + self.driver.find_element(By.ID, creation_element_position["policyRulePage_subAction_redirect_input_posId"]).clear() + self.driver.find_element(By.ID, creation_element_position["policyRulePage_subAction_redirect_input_posId"]).send_keys(redirect_url) elif application_data[0]['name'] == 'dns': - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_redirect_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_redirect_posXpath"]).click() resolution_len = len(sub_action_data[0]['resolution']) for detail in sub_action_data[0]['resolution']: answer0_len = len(detail['answer']) @@ -485,99 +481,101 @@ class CreateRules: ttl = detail['answer'][0]['ttl'] # 点击切换qtype,默认即会选中qtype A if qtype == "AAAA": - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_dnsAnswerqTypeAAAA_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_dnsAnswerqTypeAAAA_posXpath"]).click() # 切换Answer Type - self.driver.find_element(By.ID, create_element_position["policyRulePage_dnsAnswerType0Choose_posId"]).click() - answer_type_posXpath = create_element_position["policyRulePage_dnsAnswerType0ChooseValue_posXpath"].format(replaceValue=atype) + self.driver.find_element(By.ID, creation_element_position["policyRulePage_dnsAnswerType0Choose_posId"]).click() + answer_type_posXpath = creation_element_position["policyRulePage_dnsAnswerType0ChooseValue_posXpath"].format(replaceValue=atype) self.driver.find_element(By.XPATH, answer_type_posXpath).click() # 点击切换answer的返回方式 - self.driver.find_element(By.ID, create_element_position["policyRulePage_dnsAnswer0ValueType_posId"]).click() - choose_answer_type_posXpath = create_element_position["policyRulePage_dnsAnswer0ValueTypeChoose_posXpath"].format(replaceValue=answer_value_type) + self.driver.find_element(By.ID, creation_element_position["policyRulePage_dnsAnswer0ValueType_posId"]).click() + choose_answer_type_posXpath = creation_element_position["policyRulePage_dnsAnswer0ValueTypeChoose_posXpath"].format(replaceValue=answer_value_type) self.driver.find_element(By.XPATH, choose_answer_type_posXpath).click() if answer_value_type == "Profile": dns_records_profile_name = detail['answer'][0]['profile_name'] - self.driver.find_element(By.ID, create_element_position["policyRulePage_dnsAnswerValueSelectPlaceholder_posId"]).click() - self.driver.find_element(By.ID, create_element_position["policyRulePage_dnsAnswerValueNameSearch_posId"]).send_keys(dns_records_profile_name) - self.driver.find_element(By.ID, create_element_position["policyRulePage_dnsAnswerValueNameSearch_posId"]).send_keys(Keys.ENTER) - self.driver.find_element(By.ID, create_element_position["policyRulePage_dnsAnswerValueNameSelect_posId"]).click() + self.driver.find_element(By.ID, creation_element_position["policyRulePage_dnsAnswerValueSelectPlaceholder_posId"]).click() + self.driver.find_element(By.ID, creation_element_position["policyRulePage_dnsAnswerValueNameSearch_posId"]).send_keys(dns_records_profile_name) + self.driver.find_element(By.ID, creation_element_position["policyRulePage_dnsAnswerValueNameSearch_posId"]).send_keys(Keys.ENTER) + self.driver.find_element(By.ID, creation_element_position["policyRulePage_dnsAnswerValueNameSelect_posId"]).click() else: dns_text_value = detail['answer'][0]['answer_value'] if atype == "A": - self.driver.find_element(By.ID, create_element_position["policyRulePage_dnsAnswer0ATextPlaceholder_posId"]).send_keys(dns_text_value) + self.driver.find_element(By.ID, creation_element_position["policyRulePage_dnsAnswer0ATextPlaceholder_posId"]).send_keys(dns_text_value) elif atype == "AAAA": - self.driver.find_element(By.ID, create_element_position["policyRulePage_dnsAnswer0AAAATextPlaceholder_posId"]).send_keys(dns_text_value) + self.driver.find_element(By.ID, creation_element_position["policyRulePage_dnsAnswer0AAAATextPlaceholder_posId"]).send_keys(dns_text_value) elif atype == "CNAME": - self.driver.find_element(By.ID, create_element_position["policyRulePage_dnsAnswer0CnameTextPlaceholder_posId"]).send_keys(dns_text_value) - self.driver.find_element(By.ID, create_element_position["policyRulePage_dnsAnswerValueTTL0_posId"]).send_keys(ttl) + self.driver.find_element(By.ID, creation_element_position["policyRulePage_dnsAnswer0CnameTextPlaceholder_posId"]).send_keys(dns_text_value) + self.driver.find_element(By.ID, creation_element_position["policyRulePage_dnsAnswerValueTTL0_posId"]).send_keys(ttl) elif sub_action_data[0]["type"] == "alert": - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_alert_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_alert_responseCode_posXpath"]).click() - dropdown_item_posXpath = create_element_position["policyRulePage_subAction_alert_responseCode_change_posXpath"].format(replaceValue=sub_action_data[0]["code"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_alert_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_alert_responseCode_posXpath"]).click() + dropdown_item_posXpath = creation_element_position["policyRulePage_subAction_alert_responseCode_change_posXpath"].format(replaceValue=sub_action_data[0]["code"]) self.driver.find_element(By.XPATH, dropdown_item_posXpath).click() if sub_action_data[0]["code"] == 200: - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_alert_responseContent_posXpath"]).click() - dropdown_item_posXpath = create_element_position["policyRulePage_subAction_alert_responseContent_change_posXpath"].format(replaceValue=sub_action_data[0]["content_type"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_alert_responseContent_posXpath"]).click() + dropdown_item_posXpath = creation_element_position["policyRulePage_subAction_alert_responseContent_change_posXpath"].format(replaceValue=sub_action_data[0]["content_type"]) self.driver.find_element(By.XPATH, dropdown_item_posXpath).click() if sub_action_data[0]["content_type"].lower() == "text": - self.driver.find_element(By.ID, create_element_position["policyRulePage_subAction_alert_responseContent_text_posId"]).send_keys(sub_action_data[0]["content"]) + self.driver.find_element(By.ID, creation_element_position["policyRulePage_subAction_alert_responseContent_text_posId"]).send_keys(sub_action_data[0]["content"]) elif sub_action_data[0]["content_type"].lower() == "profile": - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_alert_responseContent_clickProfile_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_alert_responseContent_searchProfile_posXpath"]).send_keys(sub_action_data[0]["content"]) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subAction_alert_responseContent_searchProfile_posXpath"]).send_keys(Keys.ENTER) - self.driver.find_element(By.ID, create_element_position["policyRulePage_subAction_alert_responseContent_selectProfile_posId"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_alert_responseContent_clickProfile_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_alert_responseContent_searchProfile_posXpath"]).send_keys(sub_action_data[0]["content"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subAction_alert_responseContent_searchProfile_posXpath"]).send_keys(Keys.ENTER) + self.driver.find_element(By.ID, creation_element_position["policyRulePage_subAction_alert_responseContent_selectProfile_posId"]).click() + # 添加flag if "flag" in policy_configuration["condition"] and len(policy_configuration["condition"]["flag"]) != 0: flag_data = policy_configuration["condition"]["flag"] for t in range(len(flag_data)): if flag_data[t]['item'][0]["item_type"] == "flag": # 点add condition的+ - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_posXpath"]).click() # 调用flag的定位 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addConditionFlag_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_close_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addConditionFlag_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_close_posXpath"]).click() # 点flag的+ - temp_element_position = create_element_position["policyRulePage_addFlag_posXpath"] + temp_element_position = creation_element_position["policyRulePage_addFlag_posXpath"] self.driver.find_element(By.XPATH, temp_element_position).click() # 通过flag搜索并选中 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchFlag_posXpath"], find_after_wait_time=1).send_keys(flag_data[t]["name"]) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchFlag_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectFlag_posXpath"], find_after_wait_time=0.5).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_closeFlag_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchFlag_posXpath"], find_after_wait_time=1).send_keys(flag_data[t]["name"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchFlag_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectFlag_posXpath"], find_after_wait_time=0.5).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_closeFlag_posXpath"]).click() # 添加packet capture if "packet_capture" in policy_configuration["condition"] and len(policy_configuration["condition"]["packet_capture"]) != 0 and policy_configuration["condition"]["packet_capture"][0]["enable"] == True: packet_capture_data = policy_configuration["condition"]["packet_capture"] - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_packetCapture_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_packetCapture_posXpath"]).click() # 获取元素 - input_element = self.driver.find_element(By.XPATH, create_element_position["policyRulePage_packetCapture_depth_posXpath"]) + input_element = self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_packetCapture_depth_posXpath"]) # 使用JavaScript完全清除并设置新值 self.driver.execute_script("arguments[0].value = '';", input_element) self.driver.execute_script("arguments[0].value = arguments[1];", input_element,packet_capture_data[0]["capture_depth"]) - # self.driver.find_element(By.XPATH, create_element_position["policyRulePage_packetCapture_depth_posXpath"]).clear() - # self.driver.find_element(By.XPATH, create_element_position["policyRulePage_packetCapture_depth_posXpath"]).send_keys(packet_capture_data[0]["capture_depth"]) + # self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_packetCapture_depth_posXpath"]).clear() + # self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_packetCapture_depth_posXpath"]).send_keys(packet_capture_data[0]["capture_depth"]) # + # 添加shaping的priority和fair factor - if policy_configuration["policy_type"] == "shaping": - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_priority_posId"]).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_priority_posId"]).send_keys(policy_configuration["rulePriority"]) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_fairFactor_posId"]).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_fairFactor_posId"]).send_keys(policy_configuration["ruleFairFactor"]) + if policy_configuration["type"] == "shaping": + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_priority_posId"]).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_priority_posId"]).send_keys(policy_configuration["rulePriority"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_fairFactor_posId"]).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_fairFactor_posId"]).send_keys(policy_configuration["ruleFairFactor"]) # 添加statistics、shaping、sc、manipulation的profile action parameters if ("action_parameter" in policy_configuration and len(policy_configuration["action_parameter"]) != 0) or ("profile" in policy_configuration and len(policy_configuration["profile"]) != 0): - if policy_configuration["policy_type"] == "shaping": + if policy_configuration["type"] == "shaping": # 点profile的+ - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addProfile_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addProfile_posXpath"]).click() # 通过profile name搜索并选中 profile_data = policy_configuration["action_parameter"] for y in range(len(profile_data)): - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchProfile_posXpath"], find_after_wait_time=1).send_keys(profile_data[y]["name"]) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchProfile_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectProfile_posXpath"], find_after_wait_time=0.5).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_closeProfile_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchProfile_posXpath"], find_after_wait_time=1).send_keys(profile_data[y]["name"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchProfile_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectProfile_posXpath"], find_after_wait_time=0.5).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_closeProfile_posXpath"]).click() if policy_configuration["multiProfile"] == True and y != len(profile_data) - 1: - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addProfile_plus_posXpath"]).click() - elif policy_configuration["policy_type"] == "proxy_intercept": + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addProfile_plus_posXpath"]).click() + elif policy_configuration["type"] == "proxy_intercept": profile_data = policy_configuration["action_parameter"] if "ssl_decryption_keyring" in profile_data.keys(): ssl_decryption_keyrings = profile_data["ssl_decryption_keyring"] @@ -585,77 +583,77 @@ class CreateRules: # trusted if ssl_decryption_keyrings[i]["decryption_keying_type"] == "trusted": trusted_profile_name = ssl_decryption_keyrings[i]["profile_file"]["name"] - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_addTrustedSelectBox_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searchTrustedInput_posXpath"], find_after_wait_time=0.6).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searchTrustedInput_posXpath"]).send_keys(trusted_profile_name) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_addTrustedSelectBox_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searchTrustedInput_posXpath"], find_after_wait_time=0.6).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searchTrustedInput_posXpath"]).send_keys(trusted_profile_name) # 点击回车键 - search_box = self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searchTrustedInput_posXpath"]) + search_box = self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searchTrustedInput_posXpath"]) search_box.send_keys(Keys.RETURN) # 选择第一个 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searchTrustedDorpItem_posXpath"], find_after_wait_time=0.6).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searchTrustedDorpItem_posXpath"], find_after_wait_time=0.6).click() # untrusted elif ssl_decryption_keyrings[i]["decryption_keying_type"] == "untrusted": untrusted_profile_name = ssl_decryption_keyrings[i]["profile_file"]["name"] - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_addUntrustedSelectBox_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searchUntrustedInput_posXpath"], find_after_wait_time=0.6).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searchUntrustedInput_posXpath"]).send_keys(untrusted_profile_name) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_addUntrustedSelectBox_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searchUntrustedInput_posXpath"], find_after_wait_time=0.6).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searchUntrustedInput_posXpath"]).send_keys(untrusted_profile_name) # 点击回车键 - search_box = self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searchUntrustedInput_posXpath"]) + search_box = self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searchUntrustedInput_posXpath"]) search_box.send_keys(Keys.RETURN) # 选择第一个 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searchUntrustedDorpItem_posXpath"], find_after_wait_time=0.6).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searchUntrustedDorpItem_posXpath"], find_after_wait_time=0.6).click() # mirror decrypted profile if "traffic_mirroring_profile" in profile_data.keys(): traffic_mirroring_profiles = profile_data["traffic_mirroring_profile"] for i in range(len(traffic_mirroring_profiles)): value_id = traffic_mirroring_profiles[i]["vlan_id"] - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_addTrafficMirrorProfileButton_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_addTrafficMirrorProfileButton_posXpath"]).click() if value_id == "default": continue else: - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_addVlanIDButton_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_addVlanIDButton_posXpath"]).click() traffic_mirroring_profile_name = traffic_mirroring_profiles[i]["profile_file"]["name"] - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_addTrafficMirrorProfileSelectBox_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searcTrafficMirrorProfileInput_posXpath"], find_after_wait_time=0.6).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searcTrafficMirrorProfileInput_posXpath"]).send_keys(traffic_mirroring_profile_name) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_addTrafficMirrorProfileSelectBox_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searcTrafficMirrorProfileInput_posXpath"], find_after_wait_time=0.6).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searcTrafficMirrorProfileInput_posXpath"]).send_keys(traffic_mirroring_profile_name) # 点击回车键 - search_box = self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searcTrafficMirrorProfileInput_posXpath"]) + search_box = self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searcTrafficMirrorProfileInput_posXpath"]) search_box.send_keys(Keys.RETURN) # 选择第一个 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searchTrafficMirrorProfileDorpItem_posXpath"], find_after_wait_time=0.6).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searchTrafficMirrorProfileDorpItem_posXpath"], find_after_wait_time=0.6).click() # decryption profile if "ssl_decryption_profile" in profile_data.keys(): ssl_decryption_profiles = profile_data["ssl_decryption_profile"] for i in range(len(ssl_decryption_profiles)): ssl_decryption_profile_name = ssl_decryption_profiles[i]["profile_file"]["name"] - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_addDecryptionProfileSelectBox_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searchDecryptionProfileInput_posXpath"], find_after_wait_time=0.6).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searchDecryptionProfileInput_posXpath"]).send_keys(ssl_decryption_profile_name) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_addDecryptionProfileSelectBox_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searchDecryptionProfileInput_posXpath"], find_after_wait_time=0.6).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searchDecryptionProfileInput_posXpath"]).send_keys(ssl_decryption_profile_name) # 点击回车键 - search_box = self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searchDecryptionProfileInput_posXpath"]) + search_box = self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searchDecryptionProfileInput_posXpath"]) search_box.send_keys(Keys.RETURN) # 选择第一个 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searchDecryptionProfileDorpItem_posXpath"], find_after_wait_time=0.6).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searchDecryptionProfileDorpItem_posXpath"], find_after_wait_time=0.6).click() # tcp proxy profile if "tcp_proxy_profile" in profile_data.keys(): tcp_proxy_profiles = profile_data["tcp_proxy_profile"] for i in range(len(tcp_proxy_profiles)): tcp_proxy_profile_name = tcp_proxy_profiles[i]["profile_file"]["name"] - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_addTcpProfileSelectBox_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searchTcpProfileInput_posXpath"], find_after_wait_time=0.6).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searchTcpProfileInput_posXpath"]).send_keys(tcp_proxy_profile_name) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_addTcpProfileSelectBox_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searchTcpProfileInput_posXpath"], find_after_wait_time=0.6).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searchTcpProfileInput_posXpath"]).send_keys(tcp_proxy_profile_name) # 点击回车键 - search_box = self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searchTcpProfileInput_posXpath"]) + search_box = self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searchTcpProfileInput_posXpath"]) search_box.send_keys(Keys.RETURN) # 选择第一个 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_intercept_searchTcpProfileDorpItem_posXpath"], find_after_wait_time=0.6).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_intercept_searchTcpProfileDorpItem_posXpath"], find_after_wait_time=0.6).click() - elif policy_configuration["policy_type"] == "proxy_manipulation": + elif policy_configuration["type"] == "proxy_manipulation": profile_data = policy_configuration["action_parameter"] # 页面滚动到最底部 div_container = self.driver.find_element(By.XPATH, "//div[@id='root']//div[contains(@class, 'manipulation-policy-page')]") self.driver.execute_script("arguments[0].scrollTop = arguments[0].scrollHeight;", div_container) # 移动到页面最底部 - if policy_configuration["rule_action"] == "deny": + if policy_configuration["action"] == "deny": # 选择 response code if "deny_response_block" in policy_configuration["action_parameter"].keys(): # action为 close connection pass @@ -665,44 +663,44 @@ class CreateRules: else: response_type = "response_page" response_code = policy_configuration["action_parameter"][response_type][0]["response_code"] - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_deny_addResponseCodeSelectBox_posXpath"]).click() - response_code_drop_position = create_element_position["policyRulePage_deny_addResponseCodeSelectDropItem_posXpath"].format(replace_code=response_code) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_deny_addResponseCodeSelectBox_posXpath"]).click() + response_code_drop_position = creation_element_position["policyRulePage_deny_addResponseCodeSelectDropItem_posXpath"].format(replace_code=response_code) self.driver.find_element(By.XPATH, response_code_drop_position).click() # 选择 response content type - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_deny_addResponseContentSelectBox_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_deny_addResponseContentSelectBox_posXpath"]).click() response_content_type = policy_configuration["action_parameter"][response_type][0]["response_content_type"].strip() - response_content_type_position = create_element_position["policyRulePage_deny_addResponseContentSelectDropItem_posXpath"].format(replace_type=response_content_type) + response_content_type_position = creation_element_position["policyRulePage_deny_addResponseContentSelectDropItem_posXpath"].format(replace_type=response_content_type) self.driver.find_element(By.XPATH, response_content_type_position).click() if response_content_type == "TEXT": # 输入response content text response_context_text = policy_configuration["action_parameter"][response_type][0]["response_content"].strip() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_deny_addResponseContentTextInput_posXpath"]).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_deny_addResponseContentTextInput_posXpath"]).send_keys(response_context_text) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_deny_addResponseContentTextInput_posXpath"]).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_deny_addResponseContentTextInput_posXpath"]).send_keys(response_context_text) else: # Profile response_profile_data = policy_configuration["action_parameter"][response_type][0]["profile_file"] response_profile_name = response_profile_data["name"] - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_deny_addResponseContentProfileSelectBox_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_deny_searchResponseProfile_posXpath"]).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_deny_searchResponseProfile_posXpath"]).send_keys(response_profile_name) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_deny_addResponseContentProfileSelectBox_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_deny_searchResponseProfile_posXpath"]).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_deny_searchResponseProfile_posXpath"]).send_keys(response_profile_name) # 点击回车键 - search_box = self.driver.find_element(By.XPATH, create_element_position["policyRulePage_deny_searchResponseProfile_posXpath"]) + search_box = self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_deny_searchResponseProfile_posXpath"]) search_box.send_keys(Keys.RETURN) # 选择第一个 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_deny_searchResponseProfileDorpItem_posXpath"]).click() - elif policy_configuration["rule_action"] == "redirect": + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_deny_searchResponseProfileDorpItem_posXpath"]).click() + elif policy_configuration["action"] == "redirect": # print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], policy_configuration["condition"]["application"][0]["name"].lower().strip()) if policy_configuration["condition"]["application"][0]["name"].lower().strip() == "http": response_code = policy_configuration["action_parameter"]["redirect_url"][0]["response_code"] - response_code_drop_position = create_element_position["policyRulePage_redirectHttp_addResponseCodeSelectDropItem_posXpath"].format(replace_code=response_code) + response_code_drop_position = creation_element_position["policyRulePage_redirectHttp_addResponseCodeSelectDropItem_posXpath"].format(replace_code=response_code) redirect_url = policy_configuration["action_parameter"]["redirect_url"][0]["redirect_url"] # 操作 action parameter - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_redirectHttp_addResponseCodeSelectBox_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_redirectHttp_addResponseCodeSelectBox_posXpath"]).click() time.sleep(0.3) btn = self.driver.find_element(By.XPATH, response_code_drop_position) self.driver.execute_script("arguments[0].click()", btn) # 强制点击 time.sleep(0.3) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_redirectHttp_redirectHttp_addRedirectUrlInput_posXpath"]).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_redirectHttp_redirectHttp_addRedirectUrlInput_posXpath"]).send_keys(redirect_url) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_redirectHttp_redirectHttp_addRedirectUrlInput_posXpath"]).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_redirectHttp_redirectHttp_addRedirectUrlInput_posXpath"]).send_keys(redirect_url) else: # 遍历,是否含有多个value doh_parameter_list = policy_configuration["action_parameter"]["doh"] @@ -713,250 +711,250 @@ class CreateRules: doh_ttl = doh_parameter_list[i]["doh_ttl"] replace_index = i + 2 if i != 0: # 非第一次遍历点击 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_redirectDoH_add_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_redirectDoH_add_posXpath"]).click() if i == 0: # 只有第一次遍历点击 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_redirectDoH_qtypeRadio_posXpath"].format(replace_qtype=q_type)).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_redirectDoH_atypeSelectBox_posXpath"].format(replace_index=replace_index)).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_redirectDoH_atypeSelectDropItem_posXpath"].format(replace_atype=a_type)).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_redirectDoH_valueInput_posXpath"].format(replace_index=replace_index)).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_redirectDoH_valueInput_posXpath"].format(replace_index=replace_index), find_after_wait_time=0.5).send_keys(doh_value) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_redirectDoH_ttlInput_posXpath"].format(replace_index=replace_index)).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_redirectDoH_ttlInput_posXpath"].format(replace_index=replace_index), find_after_wait_time=0.5).send_keys(doh_ttl) - elif policy_configuration["rule_action"] == "replace": + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_redirectDoH_qtypeRadio_posXpath"].format(replace_qtype=q_type)).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_redirectDoH_atypeSelectBox_posXpath"].format(replace_index=replace_index)).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_redirectDoH_atypeSelectDropItem_posXpath"].format(replace_atype=a_type)).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_redirectDoH_valueInput_posXpath"].format(replace_index=replace_index)).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_redirectDoH_valueInput_posXpath"].format(replace_index=replace_index), find_after_wait_time=0.5).send_keys(doh_value) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_redirectDoH_ttlInput_posXpath"].format(replace_index=replace_index)).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_redirectDoH_ttlInput_posXpath"].format(replace_index=replace_index), find_after_wait_time=0.5).send_keys(doh_ttl) + elif policy_configuration["action"] == "replace": # 遍历,是否含有多个search in replace_parameter_list = policy_configuration["action_parameter"]["replace_parameter"] - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subActionButton_replaceText_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subActionButton_replaceText_posXpath"]).click() for i in range(len(replace_parameter_list)): # 从第二次遍历开始点击 + 加号 if i != 0: - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_replace_add_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_replace_add_posXpath"]).click() regex_status = replace_parameter_list[i]["regex"].lower() search_in = replace_parameter_list[i]["search_in"] find_text = replace_parameter_list[i]["find"] replace_with_text = replace_parameter_list[i]["replace_with"] # 操作action parameter, 获取regex当前属性 is-checked 表示开 - regex_class_status = self.driver.find_element(By.XPATH, create_element_position["policyRulePage_replace_addRegex_posXpath"].format(replace_sort=i+1)).get_attribute("class") + regex_class_status = self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_replace_addRegex_posXpath"].format(replace_sort=i+1)).get_attribute("class") #print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], regex_class_status) if regex_status == "on": # 开 if "Mui-checked" in regex_class_status: # 当前状态开,不用再点击 pass else: # 当前状态关,需要再点击打开 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_replace_addRegex_posXpath"].format(replace_sort=i+1)).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_replace_addRegex_posXpath"].format(replace_sort=i+1)).click() else: # off 关 if "Mui-checked" in regex_class_status: # 当前状态开,需要点击关闭 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_replace_addRegex_posXpath"].format(replace_sort=i+1)).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_replace_addRegex_posXpath"].format(replace_sort=i+1)).click() else: # # 当前状态关,不用再点击 pass # 操作search in - search_in_drop_position = create_element_position["policyRulePage_replace_addSearchInSelectDropItem_posXpath"].format(replace_sort=i+1, replace_type=search_in) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_replace_addSearchInSelectBox_posXpath"].format(replace_sort=i+1)).click() + search_in_drop_position = creation_element_position["policyRulePage_replace_addSearchInSelectDropItem_posXpath"].format(replace_sort=i+1, replace_type=search_in) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_replace_addSearchInSelectBox_posXpath"].format(replace_sort=i+1)).click() self.driver.find_element(By.XPATH, search_in_drop_position, find_after_wait_time=0.5).click() # 操作 find replace with 输入框 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_replace_addFindInput_posXpath"].format(replace_sort=i+1)).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_replace_addFindInput_posXpath"].format(replace_sort=i+1), find_after_wait_time=0.5).send_keys(find_text) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_replace_addReplaceWithInput_posXpath"].format(replace_sort=i+1)).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_replace_addReplaceWithInput_posXpath"].format(replace_sort=i+1), find_after_wait_time=0.5).send_keys(replace_with_text) - elif policy_configuration["rule_action"] == "hijack": + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_replace_addFindInput_posXpath"].format(replace_sort=i+1)).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_replace_addFindInput_posXpath"].format(replace_sort=i+1), find_after_wait_time=0.5).send_keys(find_text) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_replace_addReplaceWithInput_posXpath"].format(replace_sort=i+1)).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_replace_addReplaceWithInput_posXpath"].format(replace_sort=i+1), find_after_wait_time=0.5).send_keys(replace_with_text) + elif policy_configuration["action"] == "hijack": hijack_profile_data = policy_configuration["action_parameter"]["hijack_file"][0]["profile_file"] hijack_profile_name = hijack_profile_data["name"] - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_hijack_addHijackProfileSelectBox_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_hijack_searchHijackProfile_posXpath"]).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_hijack_searchHijackProfile_posXpath"]).send_keys(hijack_profile_name) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_hijack_addHijackProfileSelectBox_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_hijack_searchHijackProfile_posXpath"]).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_hijack_searchHijackProfile_posXpath"]).send_keys(hijack_profile_name) # 点击回车键 - search_box = self.driver.find_element(By.XPATH, create_element_position["policyRulePage_hijack_searchHijackProfile_posXpath"]) + search_box = self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_hijack_searchHijackProfile_posXpath"]) search_box.send_keys(Keys.RETURN) # 选择第一个 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_hijack_searchHijackProfileDorpItem_posXpath"]).click() - elif policy_configuration["rule_action"] == "insert": + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_hijack_searchHijackProfileDorpItem_posXpath"]).click() + elif policy_configuration["action"] == "insert": hijack_profile_data = policy_configuration["action_parameter"]["insert_script"][0]["profile_file"] hijack_profile_name = hijack_profile_data["name"] - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_insert_addInsertProfileSelectBox_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_insert_searchInsertProfile_posXpath"]).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_insert_searchInsertProfile_posXpath"]).send_keys(hijack_profile_name) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_insert_addInsertProfileSelectBox_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_insert_searchInsertProfile_posXpath"]).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_insert_searchInsertProfile_posXpath"]).send_keys(hijack_profile_name) # 点击回车键 - search_box = self.driver.find_element(By.XPATH, create_element_position["policyRulePage_insert_searchInsertProfile_posXpath"]) + search_box = self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_insert_searchInsertProfile_posXpath"]) search_box.send_keys(Keys.RETURN) # 选择第一个 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_insert_searchInsertProfileDorpItem_posXpath"]).click() - elif policy_configuration["rule_action"] == "edit_element": + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_insert_searchInsertProfileDorpItem_posXpath"]).click() + elif policy_configuration["action"] == "edit_element": # 遍历多个编辑内容 edit_element_parameter_list = policy_configuration["action_parameter"]["edit_element_parameter"] - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_subActionButton_editElement_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_subActionButton_editElement_posXpath"]).click() for i in range(len(edit_element_parameter_list)): # 从第二次遍历开始点击 + 加号 replace_sort = i + 1 if i != 0: - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_editElement_add_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_editElement_add_posXpath"]).click() search_scope = edit_element_parameter_list[i]["search_scope"].lower().strip() start_indicator = edit_element_parameter_list[i]["start_indicator"].lower() contained_keyword = edit_element_parameter_list[i]["contained_keyword"].lower() distance_from_anchor = edit_element_parameter_list[i]["distance_from_anchor"].lower() treatment = edit_element_parameter_list[i]["treatment"].lower() if search_scope == "whole_file": # search scope 操作 - # print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], create_element_position["policyRulePage_editElement_addSearchScopeWholeFileRadio_posXpath"]) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_editElement_addSearchScopeWholeFileRadio_posXpath"].format(replace_sort=replace_sort)).click() + # print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], creation_element_position["policyRulePage_editElement_addSearchScopeWholeFileRadio_posXpath"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_editElement_addSearchScopeWholeFileRadio_posXpath"].format(replace_sort=replace_sort)).click() else: # inside_element - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_editElement_addSearchScopeInsideElementRadio_posXpath"].format(replace_sort=replace_sort)).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_editElement_addStartIndicatorInput_posXpath"].format(replace_sort=replace_sort), find_after_wait_time=0.5).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_editElement_addStartIndicatorInput_posXpath"].format(replace_sort=replace_sort), find_after_wait_time=0.5).send_keys(start_indicator) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_editElement_addSearchScopeInsideElementRadio_posXpath"].format(replace_sort=replace_sort)).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_editElement_addStartIndicatorInput_posXpath"].format(replace_sort=replace_sort), find_after_wait_time=0.5).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_editElement_addStartIndicatorInput_posXpath"].format(replace_sort=replace_sort), find_after_wait_time=0.5).send_keys(start_indicator) # 输入 contained_keyword - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_editElement_addContainedKeywordInput_posXpath"].format(replace_sort=replace_sort)).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_editElement_addContainedKeywordInput_posXpath"].format(replace_sort=replace_sort), find_after_wait_time=0.5).send_keys(contained_keyword) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_editElement_addContainedKeywordInput_posXpath"].format(replace_sort=replace_sort)).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_editElement_addContainedKeywordInput_posXpath"].format(replace_sort=replace_sort), find_after_wait_time=0.5).send_keys(contained_keyword) # 输入 distance_from_anchor - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_editElement_addSDistanceFromAnchorInput_posXpath"].format(replace_sort=replace_sort)).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_editElement_addSDistanceFromAnchorInput_posXpath"].format(replace_sort=replace_sort), find_after_wait_time=0.5).send_keys(distance_from_anchor) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_editElement_addSDistanceFromAnchorInput_posXpath"].format(replace_sort=replace_sort)).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_editElement_addSDistanceFromAnchorInput_posXpath"].format(replace_sort=replace_sort), find_after_wait_time=0.5).send_keys(distance_from_anchor) if treatment == "mark": - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_editElement_addMarkRadio_posXpath"].format(replace_sort=replace_sort)).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_editElement_addMarkRadio_posXpath"].format(replace_sort=replace_sort)).click() else: # inside_element - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_editElement_addRemoveRadio_posXpath"].format(replace_sort=replace_sort)).click() - elif policy_configuration["rule_action"] == "run_script": + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_editElement_addRemoveRadio_posXpath"].format(replace_sort=replace_sort)).click() + elif policy_configuration["action"] == "run_script": run_scirpt_profile_data = policy_configuration["action_parameter"]["run_script"][0]["profile_file"] run_scirpt_profile_name = run_scirpt_profile_data["name"] - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_runScript_addrunScriptProfileSelectBox_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_runScript_searchrunScriptProfile_posXpath"]).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_runScript_searchrunScriptProfile_posXpath"]).send_keys(run_scirpt_profile_name) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_runScript_addrunScriptProfileSelectBox_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_runScript_searchrunScriptProfile_posXpath"]).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_runScript_searchrunScriptProfile_posXpath"]).send_keys(run_scirpt_profile_name) # 点击回车键 - search_box = self.driver.find_element(By.XPATH, create_element_position["policyRulePage_runScript_searchrunScriptProfile_posXpath"]) + search_box = self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_runScript_searchrunScriptProfile_posXpath"]) search_box.send_keys(Keys.RETURN) # 选择第一个 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_runScript_searchrunScriptProfileDorpItem_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_runScript_closerunScriptProfile_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_runScript_searchrunScriptProfileDorpItem_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_runScript_closerunScriptProfile_posXpath"]).click() else: print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], "to be added manipulation action parameters..") - elif policy_configuration["policy_type"] == "statistics": + elif policy_configuration["type"] == "statistics": # 点击Statistics Template添加按钮打开Template侧滑列表 - self.driver.find_element(By.XPATH, create_element_position["plicyRulePage_addStatisticsTemplate_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["plicyRulePage_addStatisticsTemplate_posXpath"]).click() # 通过Statistics Template name搜索并选中 profile_data = policy_configuration["action_parameter"]["statistics_template"] for template in range(len(profile_data)): - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchProfile_posXpath"], find_after_wait_time=1).send_keys(profile_data[template]["name"]) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchProfile_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectProfile_posXpath"].format(replaceValue=profile_data[template]["name"]), find_after_wait_time=0.5).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_closeProfile_posXpath"]).click() - elif policy_configuration["policy_type"] == "service_chaining": + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchProfile_posXpath"], find_after_wait_time=1).send_keys(profile_data[template]["name"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchProfile_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectProfile_posXpath"].format(replaceValue=profile_data[template]["name"]), find_after_wait_time=0.5).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_closeProfile_posXpath"]).click() + elif policy_configuration["type"] == "service_chaining": sff_data = policy_configuration["profile"] # 点击SFF Profile添加按钮 - self.driver.find_element(By.XPATH,create_element_position["policyRulePage_addSFFProfile_posXpath"]).click() + self.driver.find_element(By.XPATH,creation_element_position["policyRulePage_addSFFProfile_posXpath"]).click() time.sleep(1) #在侧滑框中搜索sff并选中 for sff in sff_data: - btn = self.driver.find_element(By.XPATH,create_element_position["policyRulePage_searchSFFProfile_posXpath"], find_after_wait_time=1) + btn = self.driver.find_element(By.XPATH,creation_element_position["policyRulePage_searchSFFProfile_posXpath"], find_after_wait_time=1) self.driver.execute_script("arguments[0].click()", btn) - self.driver.find_element(By.XPATH,create_element_position["policyRulePage_searchSFFProfile_posXpath"]).send_keys(sff["name"]) - self.driver.find_element(By.XPATH,create_element_position["policyRulePage_searchSFFProfile_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) - selectSFFXpath = create_element_position["policyRulePage_selectSFFProfile_posXpath"].format(replaceValue=sff["name"]) + self.driver.find_element(By.XPATH,creation_element_position["policyRulePage_searchSFFProfile_posXpath"]).send_keys(sff["name"]) + self.driver.find_element(By.XPATH,creation_element_position["policyRulePage_searchSFFProfile_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) + selectSFFXpath = creation_element_position["policyRulePage_selectSFFProfile_posXpath"].format(replaceValue=sff["name"]) self.driver.find_element(By.XPATH,selectSFFXpath).click() # self.driver.execute_script("arguments[0].click()", btn) - self.driver.find_element(By.XPATH,create_element_position["policyRulePage_closeSFFProfile_posXpath"]).click() - elif policy_configuration["policy_type"] == "monitor": + self.driver.find_element(By.XPATH,creation_element_position["policyRulePage_closeSFFProfile_posXpath"]).click() + elif policy_configuration["type"] == "monitor": #步骤:开启vlan_button->选择select->输入name->搜索 if policy_configuration["is_mirror"] == "on": - self.driver.find_element(By.XPATH, create_element_position[ + self.driver.find_element(By.XPATH, creation_element_position[ "policyRulePage_mirrorTrafficButton_posXpath"]).click() else: pass - self.driver.find_element(By.XPATH,create_element_position["policyRulePage_addVLANIDButton_posXpath"]).click() + self.driver.find_element(By.XPATH,creation_element_position["policyRulePage_addVLANIDButton_posXpath"]).click() for flag in range(len(policy_configuration["profile"])): - self.driver.find_element(By.XPATH,create_element_position["policyRulePage_firstSelectMirrorProfile_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchMirrorProfile_posXpath"], find_after_wait_time=1).send_keys(policy_configuration["profile"][flag]["name"]) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_searchMirrorProfile_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) + self.driver.find_element(By.XPATH,creation_element_position["policyRulePage_firstSelectMirrorProfile_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchMirrorProfile_posXpath"], find_after_wait_time=1).send_keys(policy_configuration["profile"][flag]["name"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_searchMirrorProfile_posXpath"], find_after_wait_time=0.5).send_keys(Keys.ENTER) self.driver.find_element(By.XPATH,'//ul[@class="MuiList-root MuiList-vertical MuiList-variantPlain MuiList-colorNeutral MuiList-sizeMd css-1cklc3"]//li[1]//div[@class="MuiListItemButton-root MuiListItemButton-colorNeutral MuiListItemButton-variantPlain css-18mv95p"]').click() self.driver.find_element(By.XPATH,'//div[@class="absolute bottom-0 h-[40px] w-[100%] overflow-hidden text-[16px] truncate bg-[--color-background-secondary] flex justify-center items-center pl-[12px] pr-[38px]"]/button').click() - # selectProfileXpath = create_element_position["policyRulePage_selectMirrorProfile_posXpath"].format(replaceValue=policy_configuration["profile"][flag]["name"]) + # selectProfileXpath = creation_element_position["policyRulePage_selectMirrorProfile_posXpath"].format(replaceValue=policy_configuration["profile"][flag]["name"]) # self.driver.find_element(By.XPATH,selectProfileXpath, find_after_wait_time=0.5).click() # 配置DoS的Threshold和Mitigation - if policy_configuration["policy_type"] == "dos_protection" and policy_configuration["rule_action"] == "protect": - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_thresholdType_posXpath"]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_groupBy_dropDownBox_posXpath"]).click() + if policy_configuration["type"] == "dos_protection" and policy_configuration["action"] == "protect": + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_thresholdType_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_groupBy_dropDownBox_posXpath"]).click() if policy_configuration["threshold"]["type"] == "rate": if policy_configuration["threshold"]["rate_threshold"]["group_by"] == "source_ip": - temp_group_by_element_position = create_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Source IP") + temp_group_by_element_position = creation_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Source IP") elif policy_configuration["threshold"]["rate_threshold"]["group_by"] == "source_asn": - temp_group_by_element_position = create_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Source ASN") + temp_group_by_element_position = creation_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Source ASN") elif policy_configuration["threshold"]["rate_threshold"]["group_by"] == "source_country": - temp_group_by_element_position = create_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Source Country") + temp_group_by_element_position = creation_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Source Country") elif policy_configuration["threshold"]["rate_threshold"]["group_by"] == "server_fqdn": - temp_group_by_element_position = create_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Server FQDN") + temp_group_by_element_position = creation_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Server FQDN") elif policy_configuration["threshold"]["rate_threshold"]["group_by"] == "source_ip_and_destination_ip": - temp_group_by_element_position = create_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Source IP and Destination IP") + temp_group_by_element_position = creation_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Source IP and Destination IP") self.driver.find_element(By.XPATH, temp_group_by_element_position).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_requestPerPeriod_posXpath"]).send_keys(policy_configuration["threshold"]["rate_threshold"]["request_per_period"]) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_countingPeriod_dropDownBox_posXpath"]).click() - temp_counting_period_element_position = create_element_position["policyRulePage_countingPeriod_select_posXpath"].format(replaceValue=policy_configuration["threshold"]["rate_threshold"]["counting_period"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_requestPerPeriod_posXpath"]).send_keys(policy_configuration["threshold"]["rate_threshold"]["request_per_period"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_countingPeriod_dropDownBox_posXpath"]).click() + temp_counting_period_element_position = creation_element_position["policyRulePage_countingPeriod_select_posXpath"].format(replaceValue=policy_configuration["threshold"]["rate_threshold"]["counting_period"]) self.driver.find_element(By.XPATH, temp_counting_period_element_position).click() elif policy_configuration["threshold"]["type"] == "concurrency": if policy_configuration["threshold"]["concurrency_threshold"]["group_by"] == "source_ip": - temp_group_by_element_position = create_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Source IP") + temp_group_by_element_position = creation_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Source IP") elif policy_configuration["threshold"]["concurrency_threshold"]["group_by"] == "source_asn": - temp_group_by_element_position = create_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Source ASN") + temp_group_by_element_position = creation_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Source ASN") elif policy_configuration["threshold"]["rate_threshold"]["group_by"] == "source_country": - temp_group_by_element_position = create_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Source Country") + temp_group_by_element_position = creation_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Source Country") elif policy_configuration["threshold"]["rate_threshold"]["group_by"] == "server_fqdn": - temp_group_by_element_position = create_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Server FQDN") + temp_group_by_element_position = creation_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Server FQDN") elif policy_configuration["threshold"]["rate_threshold"]["group_by"] == "source_ip_and_destination_ip": - temp_group_by_element_position = create_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Source IP and Destination IP") + temp_group_by_element_position = creation_element_position["policyRulePage_groupBy_select_posXpath"].format(replaceValue="Source IP and Destination IP") self.driver.find_element(By.XPATH, temp_group_by_element_position).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_concurrentSsessions_posXpath"]).send_keys(policy_configuration["threshold"]["concurrency_threshold"]["concurrent_sessions"]) - #self.driver.find_element(By.ID, create_element_position["policyRulePage_mitigationBehavior_posId"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_concurrentSsessions_posXpath"]).send_keys(policy_configuration["threshold"]["concurrency_threshold"]["concurrent_sessions"]) + #self.driver.find_element(By.ID, creation_element_position["policyRulePage_mitigationBehavior_posId"]).click() if policy_configuration["mitigation"]["behavior"] == "deny": self.driver.find_element(By.XPATH, dosRulePage_mitigationBehavior_deny_posXpath).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_mitigationTimeouts_dropDownBox_posXpath"]).click() - temp_mitigation_timeout_element_position = create_element_position["policyRulePage_mitigationTimeouts_select_posXpath"].format(replaceValue=policy_configuration["mitigation"]["timeout"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_mitigationTimeouts_dropDownBox_posXpath"]).click() + temp_mitigation_timeout_element_position = creation_element_position["policyRulePage_mitigationTimeouts_select_posXpath"].format(replaceValue=policy_configuration["mitigation"]["timeout"]) self.driver.find_element(By.XPATH, temp_mitigation_timeout_element_position).click() elif policy_configuration["mitigation"]["behavior"] == "none": - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_mitigationBehavior_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_mitigationBehavior_posXpath"]).click() # other options 操作 - if policy_configuration["policy_type"] == "proxy_manipulation": + if policy_configuration["type"] == "proxy_manipulation": # log option =》 log all - if "log_options" in policy_configuration: - if policy_configuration["log_options"] == "all": - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_logOptions_all_posXpath"]).click() - elif policy_configuration["log_options"] == "off": + if "log_option" in policy_configuration: + if policy_configuration["log_option"] == "all": + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_logOptions_all_posXpath"]).click() + elif policy_configuration["log_option"] == "off": pass else: print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], "Error: todo...") if "effective_devices" in policy_configuration: - self.add_effective_devices(policy_configuration["effective_devices"], create_element_position) + self.add_effective_devices(policy_configuration["effective_devices"], creation_element_position) # 点enable,不加sleep有一定几率点不上 time.sleep(1) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_enable_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_enable_posXpath"]).click() # 确认创建 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_okButton_posXpath"]).click() - #self.driver.find_element(By.XPATH, create_element_position["policyRulePage_okButton_warningYes_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_okButton_posXpath"]).click() + #self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_okButton_warningYes_posXpath"]).click() return 200 except Exception as e: print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], f"Exception: {e}", flush=True) raise #return 400, None - def add_ip(self, ip_data, ip_condition_type, create_element_position): + def add_ip(self, ip_data, ip_condition_type, creation_element_position): try: if ip_condition_type != "SrcIP" and ip_condition_type != "DstIP": # 点add condition的+ - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_posXpath"]).click() # 选中port - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition{}_posXpath".format(ip_condition_type)]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_close_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition{}_posXpath".format(ip_condition_type)]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_close_posXpath"]).click() # 点ip address的+ - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_add{}_posXpath".format(ip_condition_type)]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_add{}_posXpath".format(ip_condition_type)]).click() # 通过ip name搜索并选中 for i in range(len(ip_data)): - #self.driver.find_element(By.XPATH, create_element_position["policyRulePage_search{}_posXpath".format(ip_condition_type)]).clear() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_search{}_posXpath".format(ip_condition_type)]).send_keys(Keys.CONTROL + "a") - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_search{}_posXpath".format(ip_condition_type)], find_after_wait_time=1).send_keys(ip_data[i]["name"]) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_search{}_posXpath".format(ip_condition_type)], find_after_wait_time=0.5).send_keys(Keys.ENTER) - temp_element_position = create_element_position["policyRulePage_select{}_posXpath".format(ip_condition_type)].format(replaceValue=ip_data[i]["name"]) + #self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_search{}_posXpath".format(ip_condition_type)]).clear() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_search{}_posXpath".format(ip_condition_type)]).send_keys(Keys.CONTROL + "a") + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_search{}_posXpath".format(ip_condition_type)], find_after_wait_time=1).send_keys(ip_data[i]["name"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_search{}_posXpath".format(ip_condition_type)], find_after_wait_time=0.5).send_keys(Keys.ENTER) + temp_element_position = creation_element_position["policyRulePage_select{}_posXpath".format(ip_condition_type)].format(replaceValue=ip_data[i]["name"]) self.driver.find_element(By.XPATH, temp_element_position, find_after_wait_time=0.5).click() - # self.driver.find_element(By.XPATH, create_element_position["policyRulePage_select{}_posXpath".format(ip_condition_type)]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_close{}_posXpath".format(ip_condition_type)]).click() + # self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_select{}_posXpath".format(ip_condition_type)]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_close{}_posXpath".format(ip_condition_type)]).click() for j in range(len(ip_data)): if ip_data[j]["negate"] == True: time.sleep(1) # 暂停1秒 - negate_element = self.driver.find_element(By.XPATH, create_element_position["policyRulePage_negate{}_posXpath".format(ip_condition_type)]) + negate_element = self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_negate{}_posXpath".format(ip_condition_type)]) # 使用JavaScript确保元素完全进入视图 self.driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'nearest'});",negate_element) # 使用JavaScript执行悬停 @@ -968,27 +966,27 @@ class CreateRules: except Exception as e: raise - def add_port(self, port_data, port_condition_type, create_element_position): + def add_port(self, port_data, port_condition_type, creation_element_position): try: # 点add condition的+ - btn = self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_posXpath"]) + btn = self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_posXpath"]) self.driver.execute_script("arguments[0].click()", btn) # 强制点击 # 选中port - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition{}_posXpath".format(port_condition_type)]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_close_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition{}_posXpath".format(port_condition_type)]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_close_posXpath"]).click() # 点source port的+ - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_add{}_posXpath".format(port_condition_type)]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_add{}_posXpath".format(port_condition_type)]).click() # 通过port name搜索并选中 for z in range(len(port_data)): - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_search{}_posXpath".format(port_condition_type)], find_after_wait_time=1).send_keys(port_data[z]["name"]) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_search{}_posXpath".format(port_condition_type)], find_after_wait_time=0.5).send_keys(Keys.ENTER) - temp_element_position = create_element_position["policyRulePage_select{}_posXpath".format(port_condition_type)].format(replaceValue=port_data[z]["name"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_search{}_posXpath".format(port_condition_type)], find_after_wait_time=1).send_keys(port_data[z]["name"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_search{}_posXpath".format(port_condition_type)], find_after_wait_time=0.5).send_keys(Keys.ENTER) + temp_element_position = creation_element_position["policyRulePage_select{}_posXpath".format(port_condition_type)].format(replaceValue=port_data[z]["name"]) self.driver.find_element(By.XPATH, temp_element_position, find_after_wait_time=0.5).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_close{}_posXpath".format(port_condition_type)]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_close{}_posXpath".format(port_condition_type)]).click() for j in range(len(port_data)): if port_data[j]["negate"] == True: time.sleep(1) # 暂停1秒 - negate_element = self.driver.find_element(By.XPATH, create_element_position["policyRulePage_negate{}_posXpath".format(port_condition_type)]) + negate_element = self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_negate{}_posXpath".format(port_condition_type)]) ActionChains(self.driver).move_to_element(negate_element).perform() # 悬停以使元素可见 negate_element.click() except Exception as e: @@ -996,83 +994,101 @@ class CreateRules: add_subid = add_port - def add_protocol_field(self, protocol_field_data, filed_type, create_element_position, num): + def add_protocol_field(self, protocol_field_data, filed_type, creation_element_position, num): try: # 强制点击add condition的+ - btn = self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_posXpath"]) + btn = self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_posXpath"]) self.driver.execute_script("arguments[0].click()", btn) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition{}_posXpath".format(filed_type)]).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_close_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition{}_posXpath".format(filed_type)]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_close_posXpath"]).click() # 点protocol filed的+ - temp_element_position = create_element_position["policyRulePage_add{}_posXpath".format(filed_type)].format(replaceValue=num) + temp_element_position = creation_element_position["policyRulePage_add{}_posXpath".format(filed_type)].format(replaceValue=num) self.driver.find_element(By.XPATH, temp_element_position).click() # 通过protocol filed name搜索并选中 for x in range(len(protocol_field_data)): - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_search{}_posXpath".format(filed_type)], find_after_wait_time=1).send_keys(protocol_field_data[x]["name"]) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_search{}_posXpath".format(filed_type)], find_after_wait_time=0.5).send_keys(Keys.ENTER) - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_select{}_posXpath".format(filed_type)].format(replaceValue=protocol_field_data[x]["name"]), find_after_wait_time=0.5).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_close{}_posXpath".format(filed_type)]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_search{}_posXpath".format(filed_type)], find_after_wait_time=1).send_keys(protocol_field_data[x]["name"]) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_search{}_posXpath".format(filed_type)], find_after_wait_time=0.5).send_keys(Keys.ENTER) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_select{}_posXpath".format(filed_type)].format(replaceValue=protocol_field_data[x]["name"]), find_after_wait_time=0.5).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_close{}_posXpath".format(filed_type)]).click() except Exception as e: raise - def add_bool_type_protocol_field(self, protocol_field_data, filed_type, create_element_position, num): + def add_bool_type_protocol_field(self, protocol_field_data, filed_type, creation_element_position, num): try: for x in range(len(protocol_field_data)): - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_posXpath"]).click() var1 = protocol_field_data[x]["boolean_type"] - xpath_temp = create_element_position["policyRulePage_addCondition{}_posXpath".format(filed_type)] + xpath_temp = creation_element_position["policyRulePage_addCondition{}_posXpath".format(filed_type)] xpath_last = xpath_temp.format(replaceValue=var1) self.driver.find_element(By.XPATH, xpath_last).click() - self.driver.find_element(By.XPATH,create_element_position["policyRulePage_addCondition_close_posXpath"]).click() + self.driver.find_element(By.XPATH,creation_element_position["policyRulePage_addCondition_close_posXpath"]).click() # 点protocol filed的+ - temp_element_position = create_element_position["policyRulePage_add{}_posXpath".format(filed_type)].format(replaceValue=num) + temp_element_position = creation_element_position["policyRulePage_add{}_posXpath".format(filed_type)].format(replaceValue=num) self.driver.find_element(By.XPATH, temp_element_position).click() # 通过protocol filed name搜索并选中 - self.driver.find_element(By.XPATH,create_element_position["policyRulePage_search{}_posXpath".format(filed_type)],find_after_wait_time=1).send_keys(protocol_field_data[x]["name"]) - self.driver.find_element(By.XPATH,create_element_position["policyRulePage_search{}_posXpath".format(filed_type)],find_after_wait_time=0.5).send_keys(Keys.ENTER) - self.driver.find_element(By.XPATH,create_element_position["policyRulePage_select{}_posXpath".format(filed_type)],find_after_wait_time=0.5).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_close{}_posXpath".format(filed_type)]).click() + self.driver.find_element(By.XPATH,creation_element_position["policyRulePage_search{}_posXpath".format(filed_type)],find_after_wait_time=1).send_keys(protocol_field_data[x]["name"]) + self.driver.find_element(By.XPATH,creation_element_position["policyRulePage_search{}_posXpath".format(filed_type)],find_after_wait_time=0.5).send_keys(Keys.ENTER) + self.driver.find_element(By.XPATH,creation_element_position["policyRulePage_select{}_posXpath".format(filed_type)],find_after_wait_time=0.5).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_close{}_posXpath".format(filed_type)]).click() num = num +1 except Exception as e: raise - def add_ip_protocol(self, ip_protocol_data, filed_type, create_element_position): + def add_ip_protocol(self, ip_protocol_data, filed_type, creation_element_position): try: # 点add condition的+ - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition_posXpath"]).click() # 选中port - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addCondition{}_posXpath".format(filed_type)]).click() - self.driver.find_element(By.XPATH,create_element_position["policyRulePage_addCondition_close_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addCondition{}_posXpath".format(filed_type)]).click() + self.driver.find_element(By.XPATH,creation_element_position["policyRulePage_addCondition_close_posXpath"]).click() # 点source port的+ - self.driver.find_element(By.XPATH, create_element_position[ "policyRulePage_add{}_posXpath".format(filed_type)]).click() + self.driver.find_element(By.XPATH, creation_element_position[ "policyRulePage_add{}_posXpath".format(filed_type)]).click() # 通过port name搜索并选中 is_first_iteration = True for z in ip_protocol_data: #如果不是第一次循环,需要点加号调侧滑框 if not is_first_iteration: self.driver.find_element(By.XPATH, policyRulePage_little_button_addIpProtocol_posXpath).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_search{}_posXpath".format(filed_type)], find_after_wait_time=1).send_keys(z) - self.driver.find_element(By.XPATH, create_element_position[ "policyRulePage_search{}_posXpath".format(filed_type)], find_after_wait_time=0.5).send_keys(Keys.ENTER) - temp_element_position = create_element_position[ "policyRulePage_select{}_posXpath".format(filed_type)].format( replaceValue=z) + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_search{}_posXpath".format(filed_type)], find_after_wait_time=1).send_keys(z) + self.driver.find_element(By.XPATH, creation_element_position[ "policyRulePage_search{}_posXpath".format(filed_type)], find_after_wait_time=0.5).send_keys(Keys.ENTER) + temp_element_position = creation_element_position[ "policyRulePage_select{}_posXpath".format(filed_type)].format( replaceValue=z) self.driver.find_element(By.XPATH, temp_element_position, find_after_wait_time=0.5).click() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_close{}_posXpath".format(filed_type)]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_close{}_posXpath".format(filed_type)]).click() is_first_iteration = False except Exception as e: raise - def add_effective_devices(self, effective_device_data, create_element_position): + def add_effective_devices(self, effective_device_data, creation_element_position): try: # 点击 add effective devices按钮 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_addEffectiveDevices_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_addEffectiveDevices_posXpath"]).click() # 从侧滑中选择数据 for i in range(len(effective_device_data)): replace_device = effective_device_data[i].strip() - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_selectEffectiveDevices_posXpath"].format(replace_device=replace_device), find_after_wait_time=1).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_selectEffectiveDevices_posXpath"].format(replace_device=replace_device), find_after_wait_time=1).click() # 关闭侧滑 - self.driver.find_element(By.XPATH, create_element_position["policyRulePage_closeEffectiveDevices_posXpath"]).click() + self.driver.find_element(By.XPATH, creation_element_position["policyRulePage_closeEffectiveDevices_posXpath"]).click() except Exception as e: raise - + def is_attribute_name_exsit(self, policy_configuration, attribute_name): + if "and_conditions" in policy_configuration: + and_conditions = policy_configuration["and_conditions"] + for i in range(len(and_conditions)): + or_conditions = and_conditions[i]["or_conditions"] + for j in range(len(or_conditions)): + if or_conditions[j]["attribute_name"] == attribute_name: + return [True, or_conditions[j]] + return [False, ""] + + def is_group_exsit(self, policy_configuration): + if "and_conditions" in policy_configuration: + and_conditions = policy_configuration["and_conditions"] + for i in range(len(and_conditions)): + or_conditions = and_conditions[i]["or_conditions"] + for j in range(len(or_conditions)): + if "member_type" in or_conditions[j].keys and or_conditions[j]["member_type"] != "": + return [True, or_conditions[j]] + return [False, ""] diff --git a/support/ui_utils/policy/delete_rules.py b/support/ui_utils/policy/delete_rules.py index 19e7cf558..66f731072 100644 --- a/support/ui_utils/policy/delete_rules.py +++ b/support/ui_utils/policy/delete_rules.py @@ -13,16 +13,16 @@ class DeleteRules: self.driver = driver def delete_rules(self, rule_element_position, first_row_checkbox_element, is_del_all): - delete_element_position = rule_element_position["delete"] + deletion_element_position = rule_element_position["delete"] try: time.sleep(0.3) if is_del_all == True: - self.driver.find_element(By.XPATH, delete_element_position["policyRuleListPage_allSelect_posXpath"]).click() + self.driver.find_element(By.XPATH, deletion_element_position["policyRuleListPage_allSelect_posXpath"]).click() else: first_row_checkbox_element.click() time.sleep(0.3) - self.driver.find_element(By.XPATH, delete_element_position["policyRuleListPage_deleteButton_posXpath"]).click() - self.driver.find_element(By.XPATH, delete_element_position["policyRuleListPage_okButton_warningYes_posXpath"]).click() + self.driver.find_element(By.XPATH, deletion_element_position["policyRuleListPage_deleteButton_posXpath"]).click() + self.driver.find_element(By.XPATH, deletion_element_position["policyRuleListPage_okButton_warningYes_posXpath"]).click() time.sleep(2) return 200 except Exception as e: diff --git a/tests/manipulation/man_deny_srcip_subid_sub_fqdn_sub_url_http_sub_reqheader_by_ua_resheader_ct_sub_reqbody_sub_resbody.py b/tests/manipulation/man_deny_srcip_subid_sub_fqdn_sub_url_http_sub_reqheader_by_ua_resheader_ct_sub_reqbody_sub_resbody.py index 03e4ab8f7..3b8042bd8 100644 --- a/tests/manipulation/man_deny_srcip_subid_sub_fqdn_sub_url_http_sub_reqheader_by_ua_resheader_ct_sub_reqbody_sub_resbody.py +++ b/tests/manipulation/man_deny_srcip_subid_sub_fqdn_sub_url_http_sub_reqheader_by_ua_resheader_ct_sub_reqbody_sub_resbody.py @@ -51,23 +51,6 @@ def run(parameter): "negate_option": False, "or_conditions": [ { - "attribute_name": "ATTR_SUBSCRIBER_ID", - "name": "manipulation_subid", - "type": "subscriberid", - "statistics_option": "none", - "member_type": "item", - "items": [ - { - "op": "add", - "expr_type": "and", - "expression": "^{}$".format(parameter["test_subcriber_id"]) - }] - }] - }, - { - "negate_option": False, - "or_conditions": [ - { "attribute_name": "ATTR_APP_ID", "type": "application", "items": ["http"] diff --git a/tests/manipulation/man_edit_element_srcip_http_substr_url_whole_file_mark_logall.py b/tests/manipulation/man_edit_element_srcip_http_substr_url_whole_file_mark_logall.py index 25535e557..961c60f89 100644 --- a/tests/manipulation/man_edit_element_srcip_http_substr_url_whole_file_mark_logall.py +++ b/tests/manipulation/man_edit_element_srcip_http_substr_url_whole_file_mark_logall.py @@ -122,9 +122,7 @@ def run(parameter): "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "http_host", "query_value": "open.node.com"}, - {"query_field_key": "decoded_as", "query_value": "HTTP"}, - {"query_field_key": "http_request_body", "query_value": True}, - {"query_field_key": "http_response_body", "query_value": True} + {"query_field_key": "decoded_as", "query_value": "HTTP"} ] } diff --git a/tests/manipulation/man_monitor_srcip_http_logall.py b/tests/manipulation/man_monitor_srcip_http_logall.py index 6831f1a14..97dd12bc0 100644 --- a/tests/manipulation/man_monitor_srcip_http_logall.py +++ b/tests/manipulation/man_monitor_srcip_http_logall.py @@ -70,9 +70,7 @@ def run(parameter): "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "http_host", "query_value": "open.node.com"}, - {"query_field_key": "decoded_as", "query_value": "HTTP"}, - {"query_field_key": "http_request_body", "query_value": True}, - {"query_field_key": "http_response_body", "query_value": True} + {"query_field_key": "decoded_as", "query_value": "HTTP"} ] } diff --git a/tests/manipulation/man_monitor_srcip_http_substr_reqbody_selectmorelog.py b/tests/manipulation/man_monitor_srcip_http_substr_reqbody_selectmorelog.py index 7f5967326..6c8a38047 100644 --- a/tests/manipulation/man_monitor_srcip_http_substr_reqbody_selectmorelog.py +++ b/tests/manipulation/man_monitor_srcip_http_substr_reqbody_selectmorelog.py @@ -88,13 +88,9 @@ def run(parameter): "expected_log": [ {"query_field_key": "http_host", "query_value": "open.node.com"}, {"query_field_key": "decoded_as", "query_value": "HTTP"}, - {"query_field_key": "decoded_as", "query_value": "HTTP"}, {"query_field_key": "client_ip", "query_value": parameter["test_pc_ip"]}, - {"query_field_key": "server_ip", "query_value": "open.node.com"}, - {"query_field_key": "server_fqdn", "query_value": "open.node.com"}, {"query_field_key": "ip_protocol", "query_value": "tcp"}, {"query_field_key": "http_url", "query_value": "open.node.com:1443/go"}, - {"query_field_key": "http_request_line", "query_value": "POST open.node.com:1443/go HTTP/1.1"}, {"query_field_key": "http_response_line", "query_value": "HTTP/1.1 200 OK"} ] } diff --git a/tests/manipulation/man_monitor_srcip_subid_sub_fqdn_http_sub_url_sub_reqheader_by_ua_resheader_by_ct_reqbodyr_esbody.py b/tests/manipulation/man_monitor_srcip_subid_sub_fqdn_http_sub_url_sub_reqheader_by_ua_resheader_by_ct_reqbodyr_esbody.py index 3eec7a1ef..c528b2f71 100644 --- a/tests/manipulation/man_monitor_srcip_subid_sub_fqdn_http_sub_url_sub_reqheader_by_ua_resheader_by_ct_reqbodyr_esbody.py +++ b/tests/manipulation/man_monitor_srcip_subid_sub_fqdn_http_sub_url_sub_reqheader_by_ua_resheader_by_ct_reqbodyr_esbody.py @@ -77,23 +77,6 @@ def run(parameter): "negate_option": False, "or_conditions": [ { - "attribute_name": "ATTR_SERVER_FQDN", - "name": "manipulation_fqdn", - "type": "fqdn", - "statistics_option": "none", - "member_type": "item", - "items": [ - { - "op": "add", - "expr_type": "and", - "expression": "open.node.com" - }] - }] - }, - { - "negate_option": False, - "or_conditions": [ - { "attribute_name": "ATTR_HTTP_URL", "name": "manipulation_url", "type": "url", diff --git a/tests/manipulation/man_redirect_srcip_http_2item_in_url_302.py b/tests/manipulation/man_redirect_srcip_http_2item_in_url_302.py index 411bc7f52..e606b004e 100644 --- a/tests/manipulation/man_redirect_srcip_http_2item_in_url_302.py +++ b/tests/manipulation/man_redirect_srcip_http_2item_in_url_302.py @@ -69,6 +69,11 @@ def run(parameter): { "op": "add", "expr_type": "and", + "expression": "baidu" + }, + { + "op": "add", + "expr_type": "and", "expression": "google" }] }] diff --git a/tests/manipulation/man_replace_srcip_http_substr_url_search_in_request_body_logall.py b/tests/manipulation/man_replace_srcip_http_substr_url_search_in_request_body_logall.py index aa9c9e677..c7b4079ea 100644 --- a/tests/manipulation/man_replace_srcip_http_substr_url_search_in_request_body_logall.py +++ b/tests/manipulation/man_replace_srcip_http_substr_url_search_in_request_body_logall.py @@ -98,9 +98,7 @@ def run(parameter): "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "http_host", "query_value": "open.node.com"}, - {"query_field_key": "decoded_as", "query_value": "HTTP"}, - {"query_field_key": "http_request_body", "query_value": True}, - {"query_field_key": "http_response_body", "query_value": True} + {"query_field_key": "decoded_as", "query_value": "HTTP"} ] } diff --git a/tests/manipulation/test.py b/tests/manipulation/test.py index 62d1570a5..a37526aa3 100644 --- a/tests/manipulation/test.py +++ b/tests/manipulation/test.py @@ -41,10 +41,19 @@ def local_run(): all_list = os.listdir() man_list = [] # 要执行的测试文件名称 + tmp_no = ["pre_reqheader", "xly_reqheader", "suff_reqheader", "pre_resheader", "xly_resheader", "pre_resheader", "doh"] for i in all_list: if "man_" in i: i_1 = i[:-3] - man_list.append(i_1) + # 临时过滤掉不执行header的其它匹配 + flag_1 = 0 + for j in range(len(tmp_no)): + if tmp_no[j] in i_1: + flag_1 = 1 + break + if flag_1 == 0: + man_list.append(i_1) + n = 1 sum_all = len(man_list) @@ -962,10 +971,10 @@ if __name__ == '__main__': file_endswith = ".py" # 本地运行所有用例 - #local_run() + local_run() # 对比MS工具 - diff_ms(ms_json_path=ms_json_path, case_directory_path=case_directory_path, file_startwith=file_startwith, file_endswith=file_endswith) + # diff_ms(ms_json_path=ms_json_path, case_directory_path=case_directory_path, file_startwith=file_startwith, file_endswith=file_endswith) # 生成excle使用数据工具 #get_excel_formate_from_case(case_directory_path=case_directory_path, file_startwith=file_startwith, file_endswith=file_endswith) diff --git a/tests/security/sec_allow_extip_app_group.py b/tests/security/sec_allow_extip_app_group.py index 17990f73a..d37a626ec 100644 --- a/tests/security/sec_allow_extip_app_group.py +++ b/tests/security/sec_allow_extip_app_group.py @@ -52,15 +52,16 @@ def run(parameter): "attribute_name": "ATTR_APP_ID", "type": "application", "statistics_option": "brief", + "member_type": "subordinate", "name": "sec_application_group", - "included_sub_object_uuids":[ + "included_sub_objects":[ { "attribute_name": "ATTR_APP_ID", "type": "application", "items": ["http"], } ], - "excluded_sub_object_uuids":[ + "excluded_sub_objects":[ { "attribute_name": "ATTR_APP_ID", "type": "application", diff --git a/tests/security/sec_allow_extip_ftp_substr_uri_group.py b/tests/security/sec_allow_extip_ftp_substr_uri_group.py index 40640d5d6..3f313843b 100644 --- a/tests/security/sec_allow_extip_ftp_substr_uri_group.py +++ b/tests/security/sec_allow_extip_ftp_substr_uri_group.py @@ -62,8 +62,9 @@ def run(parameter): "attribute_name": "ATTR_FTP_URI", "type": "url", "statistics_option": "brief", - "name": "sec_url_group", - "included_sub_object_uuids":[ + "member_type": "subordinate", + "name": "sec_url_group", # "included_sub_object_uuids" + "included_sub_objects":[ { "attribute_name": "ATTR_FTP_URI", "type": "url", @@ -77,7 +78,7 @@ def run(parameter): ], } ], - "excluded_sub_object_uuids": [ + "excluded_sub_objects": [ { "attribute_name": "ATTR_FTP_URI", "type": "url", diff --git a/tests/service_chaining/sc_decrypted_negate_srcip_fqdn_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_decrypted_negate_srcip_fqdn_ssl_mirror_bypass_vlan_none.py index 4f088a45d..c94425ba1 100644 --- a/tests/service_chaining/sc_decrypted_negate_srcip_fqdn_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_negate_srcip_fqdn_ssl_mirror_bypass_vlan_none.py @@ -120,7 +120,7 @@ def run(parameter): } verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 0}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -209,13 +209,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() diff --git a/tests/service_chaining/sc_decrypted_negate_srcip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_negate_srcip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py index 42e294f07..fe45613e2 100644 --- a/tests/service_chaining/sc_decrypted_negate_srcip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_negate_srcip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -29,7 +29,7 @@ def run(parameter): "action": "service_chaining", "and_conditions": [ { - "negate_option": False, + "negate_option": True, "or_conditions": [ { "attribute_name": "ATTR_SOURCE_IP", @@ -120,7 +120,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 0}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -209,13 +209,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -228,7 +226,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_scrip_fqdn_ssl_mirror_block_disabled_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_scrip_fqdn_ssl_mirror_block_disabled_vxlan_activeip_bfd.py index fec3ee6d4..1b5a86cdf 100644 --- a/tests/service_chaining/sc_decrypted_scrip_fqdn_ssl_mirror_block_disabled_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_scrip_fqdn_ssl_mirror_block_disabled_vxlan_activeip_bfd.py @@ -120,7 +120,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "百度", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -209,13 +209,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -228,7 +226,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_ext_cidr_geoip_asn_library_fqdn_ssl_mirror_block_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_ext_cidr_geoip_asn_library_fqdn_ssl_mirror_block_vlan_none.py index 9a53f3c7f..7f8c7322f 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ext_cidr_geoip_asn_library_fqdn_ssl_mirror_block_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_ext_cidr_geoip_asn_library_fqdn_ssl_mirror_block_vlan_none.py @@ -160,7 +160,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_ext_compliance_risk_library_fqdn_ssl_mirror_block_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_ext_compliance_risk_library_fqdn_ssl_mirror_block_vlan_none.py index b53472168..63d6c6567 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ext_compliance_risk_library_fqdn_ssl_mirror_block_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_ext_compliance_risk_library_fqdn_ssl_mirror_block_vlan_none.py @@ -157,7 +157,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "example", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } diff --git a/tests/service_chaining/sc_decrypted_srcip_ext_geoip_city_library_fqdn_ssl_mirror_block_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_ext_geoip_city_library_fqdn_ssl_mirror_block_vlan_none.py index b4f93cb9d..8a9ec4709 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ext_geoip_city_library_fqdn_ssl_mirror_block_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_ext_geoip_city_library_fqdn_ssl_mirror_block_vlan_none.py @@ -151,7 +151,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "example", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -245,13 +245,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -264,7 +262,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_ext_internet_service_library_fqdn_ssl_mirror_block_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_ext_internet_service_library_fqdn_ssl_mirror_block_vlan_none.py index 4834997d5..ec40b6d1c 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ext_internet_service_library_fqdn_ssl_mirror_block_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_ext_internet_service_library_fqdn_ssl_mirror_block_vlan_none.py @@ -157,7 +157,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "example", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -251,13 +251,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() diff --git a/tests/service_chaining/sc_decrypted_srcip_ext_iprange_geoip_country_library_fqdn_ssl_mirror_block_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_ext_iprange_geoip_country_library_fqdn_ssl_mirror_block_vlan_none.py index 7e90ee976..065d6e43d 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ext_iprange_geoip_country_library_fqdn_ssl_mirror_block_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_ext_iprange_geoip_country_library_fqdn_ssl_mirror_block_vlan_none.py @@ -151,7 +151,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "example", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -245,13 +245,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() diff --git a/tests/service_chaining/sc_decrypted_srcip_ext_iprange_security_threat_library_fqdn_ssl_mirror_block_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_ext_iprange_security_threat_library_fqdn_ssl_mirror_block_vlan_none.py index f015dd53c..4aa256003 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ext_iprange_security_threat_library_fqdn_ssl_mirror_block_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_ext_iprange_security_threat_library_fqdn_ssl_mirror_block_vlan_none.py @@ -151,7 +151,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "example", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -245,13 +245,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() diff --git a/tests/service_chaining/sc_decrypted_srcip_ext_website_classification_library_fqdn_ssl_mirror_block_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_ext_website_classification_library_fqdn_ssl_mirror_block_vlan_none.py index 394877e97..112836b4c 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ext_website_classification_library_fqdn_ssl_mirror_block_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_ext_website_classification_library_fqdn_ssl_mirror_block_vlan_none.py @@ -157,7 +157,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "example", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -251,13 +251,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_http_url_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_http_url_mirror_bypass_vlan_none.py index cbfb342c1..fed898981 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_http_url_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_http_url_mirror_bypass_vlan_none.py @@ -141,7 +141,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "ct.cn", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -230,13 +230,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index ec0f096a2..fc4324bb6 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -141,7 +141,7 @@ def run(parameter): } verification_result = { "excepted_traffic_result": "yumi", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -230,13 +230,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -249,7 +247,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_negate_extport_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_negate_extport_ssl_steer_bypass_vxlan_activeip_bfd.py index 6bef3bfc6..bc31505fd 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_negate_extport_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_negate_extport_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -138,7 +138,7 @@ def run(parameter): } verification_result = { "excepted_traffic_result": "baidu", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [] } @@ -227,13 +227,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -246,7 +244,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_negate_intport_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_negate_intport_ssl_mirror_bypass_vlan_none.py index d687718b6..0495df7ba 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_negate_intport_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_negate_intport_ssl_mirror_bypass_vlan_none.py @@ -139,7 +139,7 @@ def run(parameter): } verification_result = { "excepted_traffic_result": "baidu", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [] } @@ -228,13 +228,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -247,7 +245,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vlan_none.py index 215e2f3db..560f7e952 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vlan_none.py @@ -122,7 +122,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -211,13 +211,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -230,7 +228,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_activeip_bfd.py index f44b2c9a2..a36e9e721 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_activeip_bfd.py @@ -118,7 +118,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "百度", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } # 创建 @@ -206,13 +206,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -225,7 +223,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_activeip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_activeip_none.py index 207b95cbb..3634328a3 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_activeip_none.py @@ -120,7 +120,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -209,13 +209,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -228,7 +226,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_inactiveip_bfd.py index 4b7affdce..b30357db6 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_inactiveip_bfd.py @@ -118,7 +118,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "百度", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } # 创建 @@ -206,13 +206,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -225,7 +223,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_inactiveip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_inactiveip_none.py index da99ab37b..68adbf02b 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_inactiveip_none.py @@ -120,7 +120,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "百度", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } # 创建 @@ -208,13 +208,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -227,7 +225,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_unavailableip_bfd.py index 099f84f35..be6bb313f 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_unavailableip_bfd.py @@ -120,7 +120,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -209,13 +209,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -228,7 +226,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_unavailableip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_unavailableip_none.py index b7d5beec9..09ae999b2 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_block_vxlan_unavailableip_none.py @@ -119,7 +119,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -208,13 +208,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -227,7 +225,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_disabled_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_disabled_vxlan_activeip_bfd.py index 148f6773d..f7d723604 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_disabled_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_disabled_vxlan_activeip_bfd.py @@ -123,7 +123,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vlan_none.py index dce1c5e8b..18ce5c008 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vlan_none.py @@ -121,7 +121,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -210,13 +210,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -229,7 +227,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_activeip_bfd.py index 75476dfda..693041fdc 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_activeip_bfd.py @@ -120,7 +120,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -209,13 +209,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -228,7 +226,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_activeip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_activeip_none.py index f8ebfb9db..17b43bced 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_activeip_none.py @@ -119,7 +119,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -208,13 +208,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -227,7 +225,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_inactiveip_bfd.py index 18ccd0004..4d98bdf5c 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_inactiveip_bfd.py @@ -120,7 +120,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -209,13 +209,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -228,7 +226,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_inactiveip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_inactiveip_none.py index e7d6967e8..0af385b24 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_inactiveip_none.py @@ -120,7 +120,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -209,13 +209,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -228,7 +226,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_bfd.py index 7c9dd3d8c..83b816c3f 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_bfd.py @@ -120,7 +120,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -209,13 +209,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -228,7 +226,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_none.py index e06d48d67..ae0795ea7 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_none.py @@ -119,7 +119,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -208,13 +208,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -227,7 +225,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vlan_none.py index 60f343795..9a6a6e945 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vlan_none.py @@ -124,7 +124,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "百度", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -213,13 +213,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -232,7 +230,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_activeip_bfd.py index 922fc41c6..43c9f3770 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_activeip_bfd.py @@ -121,7 +121,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -210,13 +210,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -229,7 +227,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_activeip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_activeip_none.py index eeba61079..6ed26bcb9 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_activeip_none.py @@ -123,7 +123,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "百度", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } # 创建 @@ -211,13 +211,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -230,7 +228,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_inactiveip_bfd.py index dd06cc2cb..c6819771d 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_inactiveip_bfd.py @@ -121,7 +121,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -210,13 +210,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -229,7 +227,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_inactiveip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_inactiveip_none.py index 4e81176b6..80d181675 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_inactiveip_none.py @@ -123,7 +123,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -212,13 +212,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -231,7 +229,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_unavailableip_bfd.py index 98255b0bc..497f70e5d 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_unavailableip_bfd.py @@ -123,7 +123,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -212,13 +212,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -231,7 +229,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_unavailableip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_unavailableip_none.py index 18657581b..8533daef0 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_block_vxlan_unavailableip_none.py @@ -122,7 +122,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -211,13 +211,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -230,7 +228,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_disabled_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_disabled_vxlan_activeip_bfd.py index 8c99010db..677447dc8 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_disabled_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_disabled_vxlan_activeip_bfd.py @@ -123,7 +123,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -212,13 +212,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -231,7 +229,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vlan_none.py index c6873048a..9bc241f0a 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vlan_none.py @@ -125,7 +125,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -214,13 +214,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -233,7 +231,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_activeip_bfd.py index 6b07fa1c6..1d8809563 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_activeip_bfd.py @@ -121,7 +121,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -210,13 +210,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -229,7 +227,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_activeip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_activeip_none.py index ae4f0cb4c..887cb7667 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_activeip_none.py @@ -122,7 +122,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -211,13 +211,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -230,7 +228,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_inactiveip_bfd.py index 6bc0b0e89..f59cf81da 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_inactiveip_bfd.py @@ -124,7 +124,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -213,13 +213,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -232,7 +230,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_inactiveip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_inactiveip_none.py index a3c3c7539..0f34ad382 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_inactiveip_none.py @@ -123,7 +123,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -212,13 +212,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -231,7 +229,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_unavailableip_bfd.py index 93aafef51..67194082d 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_unavailableip_bfd.py @@ -121,7 +121,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -210,13 +210,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -229,7 +227,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_unavailableip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_unavailableip_none.py index 0fd2ac457..6d6fdcb4a 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_mirror_redispatch_bypass_vxlan_unavailableip_none.py @@ -123,7 +123,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -212,13 +212,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -231,7 +229,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_disabled_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_disabled_vxlan_activeip_bfd.py index bb2322e39..a721fea94 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_disabled_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_disabled_vxlan_activeip_bfd.py @@ -119,7 +119,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -208,13 +208,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -227,7 +225,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_activeip_bfd.py index 72f044437..af17f668a 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_activeip_bfd.py @@ -119,7 +119,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -208,13 +208,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -227,7 +225,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_activeip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_activeip_none.py index d9dd13b7c..1ccab221b 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_activeip_none.py @@ -118,7 +118,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -207,13 +207,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -226,7 +224,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_inactiveip_bfd.py index df9da4d18..043da118a 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_inactiveip_bfd.py @@ -119,7 +119,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -208,13 +208,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -227,7 +225,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_inactiveip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_inactiveip_none.py index 6a741b59e..3f112ddd6 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_inactiveip_none.py @@ -120,7 +120,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -209,13 +209,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -228,7 +226,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_unavailableip_bfd.py index a19b3d27e..f29893c03 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_unavailableip_bfd.py @@ -119,7 +119,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -208,13 +208,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -227,7 +225,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_unavailableip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_unavailableip_none.py index bc86cc864..373823d5c 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_block_vxlan_unavailableip_none.py @@ -119,7 +119,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -208,13 +208,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -227,7 +225,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_disabled_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_disabled_vxlan_activeip_bfd.py index 4042d9bb9..e33f426d4 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_disabled_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_disabled_vxlan_activeip_bfd.py @@ -117,7 +117,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -206,13 +206,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -225,7 +223,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py index acaec7f44..4da9d235e 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -120,7 +120,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -209,13 +209,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -228,7 +226,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_activeip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_activeip_none.py index 0301ed0c7..b7c7b5038 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_activeip_none.py @@ -118,7 +118,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -207,13 +207,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -226,7 +224,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_inactiveip_bfd.py index d77c07ea2..fec58d551 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_inactiveip_bfd.py @@ -119,7 +119,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -208,13 +208,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -227,7 +225,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_inactiveip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_inactiveip_none.py index 79d766352..ca22d4e91 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_inactiveip_none.py @@ -119,7 +119,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -208,13 +208,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -227,7 +225,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_unavailableip_bfd.py index 2498308aa..7b19f31c6 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_unavailableip_bfd.py @@ -119,7 +119,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -208,13 +208,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -227,7 +225,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_unavailableip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_unavailableip_none.py index 1597f7541..b076ea857 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_bypass_vxlan_unavailableip_none.py @@ -118,7 +118,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -207,13 +207,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -226,7 +224,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_global_bypass_diff_device_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_global_bypass_diff_device_vxlan_activeip_bfd.py index 129a63061..ffb1c8fd5 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_global_bypass_diff_device_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_global_bypass_diff_device_vxlan_activeip_bfd.py @@ -118,7 +118,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -207,13 +207,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -226,7 +224,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_nearby_bypass_diff_device_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_nearby_bypass_diff_device_vxlan_activeip_bfd.py index b07abe7c8..085fb18f6 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_nearby_bypass_diff_device_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_nearby_bypass_diff_device_vxlan_activeip_bfd.py @@ -119,7 +119,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -208,13 +208,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -227,7 +225,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_disabled_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_disabled_vxlan_activeip_bfd.py index 426923689..27e0cb9cd 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_disabled_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_disabled_vxlan_activeip_bfd.py @@ -121,7 +121,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -210,13 +210,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -229,7 +227,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_activeip_bfd.py index b6dd55dfd..80305b001 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_activeip_bfd.py @@ -123,7 +123,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -212,13 +212,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -231,7 +229,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_activeip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_activeip_none.py index 39164cd04..74696c73b 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_activeip_none.py @@ -122,7 +122,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -211,13 +211,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -230,7 +228,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_inactiveip_bfd.py index f5a19d2e1..268771931 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_inactiveip_bfd.py @@ -122,7 +122,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -211,13 +211,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -230,7 +228,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_inactiveip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_inactiveip_none.py index 680d15d2a..9843e286e 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_inactiveip_none.py @@ -121,7 +121,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -210,13 +210,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -229,7 +227,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_unavailableip_bfd.py index 13fc99673..0a3510eee 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_unavailableip_bfd.py @@ -122,7 +122,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -211,13 +211,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -230,7 +228,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_unavailableip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_unavailableip_none.py index a70534fb2..8080ad899 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_block_vxlan_unavailableip_none.py @@ -121,7 +121,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -210,13 +210,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -229,7 +227,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_disabled_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_disabled_vxlan_activeip_bfd.py index 5300ffb30..e74d55f9b 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_disabled_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_disabled_vxlan_activeip_bfd.py @@ -122,7 +122,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -211,13 +211,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -230,7 +228,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_activeip_bfd.py index 40be641ea..59789d9ba 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_activeip_bfd.py @@ -124,7 +124,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -213,13 +213,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -232,7 +230,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_activeip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_activeip_none.py index 82716347e..88c73b5de 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_activeip_none.py @@ -122,7 +122,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -211,13 +211,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -230,7 +228,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_inactiveip_bfd.py index 6b5e9bf58..8c61396c2 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_inactiveip_bfd.py @@ -123,7 +123,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -212,13 +212,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -231,7 +229,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_inactiveip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_inactiveip_none.py index 2035d71cb..d3819db88 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_inactiveip_none.py @@ -124,7 +124,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -213,13 +213,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -232,7 +230,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_unavailableip_bfd.py index 3c5cb71d7..60f9ab81c 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_unavailableip_bfd.py @@ -121,7 +121,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -210,13 +210,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -229,7 +227,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_unavailableip_none.py b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_unavailableip_none.py index ae27fb921..692e19a89 100644 --- a/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_fqdn_ssl_steer_redispatch_bypass_vxlan_unavailableip_none.py @@ -122,7 +122,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -211,13 +211,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -230,7 +228,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_int_compliance_risk_library_fqdn_ssl_mirror_block_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_int_compliance_risk_library_fqdn_ssl_mirror_block_vlan_none.py index fdcd0e67b..bb239fa85 100644 --- a/tests/service_chaining/sc_decrypted_srcip_int_compliance_risk_library_fqdn_ssl_mirror_block_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_int_compliance_risk_library_fqdn_ssl_mirror_block_vlan_none.py @@ -151,7 +151,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -240,13 +240,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -259,7 +257,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_int_geoip_asn_library_fqdn_ssl_mirror_block_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_int_geoip_asn_library_fqdn_ssl_mirror_block_vlan_none.py index f019709a4..b887a41dd 100644 --- a/tests/service_chaining/sc_decrypted_srcip_int_geoip_asn_library_fqdn_ssl_mirror_block_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_int_geoip_asn_library_fqdn_ssl_mirror_block_vlan_none.py @@ -150,7 +150,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -239,13 +239,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -258,7 +256,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_int_geoip_city_library_fqdn_ssl_mirror_block_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_int_geoip_city_library_fqdn_ssl_mirror_block_vlan_none.py index a00bc8c39..9ee9028d6 100644 --- a/tests/service_chaining/sc_decrypted_srcip_int_geoip_city_library_fqdn_ssl_mirror_block_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_int_geoip_city_library_fqdn_ssl_mirror_block_vlan_none.py @@ -150,7 +150,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -239,13 +239,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -258,7 +256,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_int_geoip_country_library_fqdn_ssl_mirror_block_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_int_geoip_country_library_fqdn_ssl_mirror_block_vlan_none.py index 08ad60196..e6b765465 100644 --- a/tests/service_chaining/sc_decrypted_srcip_int_geoip_country_library_fqdn_ssl_mirror_block_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_int_geoip_country_library_fqdn_ssl_mirror_block_vlan_none.py @@ -150,7 +150,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -239,13 +239,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -258,7 +256,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_int_internet_service_library_fqdn_ssl_mirror_block_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_int_internet_service_library_fqdn_ssl_mirror_block_vlan_none.py index 09b9ba0f8..bb5ffb119 100644 --- a/tests/service_chaining/sc_decrypted_srcip_int_internet_service_library_fqdn_ssl_mirror_block_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_int_internet_service_library_fqdn_ssl_mirror_block_vlan_none.py @@ -150,7 +150,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -239,13 +239,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -258,7 +256,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_int_security_threat_library_fqdn_ssl_mirror_block_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_int_security_threat_library_fqdn_ssl_mirror_block_vlan_none.py index 80cef16ff..c4a11dc78 100644 --- a/tests/service_chaining/sc_decrypted_srcip_int_security_threat_library_fqdn_ssl_mirror_block_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_int_security_threat_library_fqdn_ssl_mirror_block_vlan_none.py @@ -150,7 +150,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -239,13 +239,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -258,7 +256,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_int_website_classification_library_fqdn_ssl_mirror_block_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_int_website_classification_library_fqdn_ssl_mirror_block_vlan_none.py index 4becb6c0a..00a10e836 100644 --- a/tests/service_chaining/sc_decrypted_srcip_int_website_classification_library_fqdn_ssl_mirror_block_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_int_website_classification_library_fqdn_ssl_mirror_block_vlan_none.py @@ -150,7 +150,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -239,13 +239,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -258,7 +256,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_negate_apn_fqdn_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_negate_apn_fqdn_ssl_mirror_bypass_vlan_none.py index 60c59a2c3..8394e6746 100644 --- a/tests/service_chaining/sc_decrypted_srcip_negate_apn_fqdn_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_negate_apn_fqdn_ssl_mirror_bypass_vlan_none.py @@ -141,7 +141,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 0}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -230,13 +230,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() diff --git a/tests/service_chaining/sc_decrypted_srcip_negate_apn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_negate_apn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py index 1c81d5eed..7bdc3c198 100644 --- a/tests/service_chaining/sc_decrypted_srcip_negate_apn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_negate_apn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -140,15 +140,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip.com", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_decrypted", "query_value": ""}, - {"query_field_key": "subscriber_id", "query_value": "test6494"}, - {"query_field_key": "imei", "query_value": "1234567801"}, - {"query_field_key": "imsi", "query_value": "43458960456"}, - {"query_field_key": "apn", "query_value": "www.lyautotest.com"}, - {"query_field_key": "phone_number", "query_value": "12345678901"} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -236,13 +229,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -257,7 +248,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_negate_imei_fqdn_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_negate_imei_fqdn_ssl_mirror_bypass_vlan_none.py index 365dc6e11..83cc67fcb 100644 --- a/tests/service_chaining/sc_decrypted_srcip_negate_imei_fqdn_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_negate_imei_fqdn_ssl_mirror_bypass_vlan_none.py @@ -49,7 +49,7 @@ def run(parameter): ] }, { - "negate_option": False, + "negate_option": True, "or_conditions": [ { "attribute_name": "ATTR_GTP_IMEI", @@ -142,15 +142,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip.com", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_decrypted", "query_value": ""}, - {"query_field_key": "subscriber_id", "query_value": "test6494"}, - {"query_field_key": "imei", "query_value": "1234567801"}, - {"query_field_key": "imsi", "query_value": "43458960456"}, - {"query_field_key": "apn", "query_value": "www.lyautotest.com"}, - {"query_field_key": "phone_number", "query_value": "12345678901"} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -238,13 +231,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -258,7 +249,7 @@ if __name__ == '__main__': "test_subcriber_id": "test6776", "test_imei":"1234567801", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_negate_imei_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_negate_imei_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py index f86c9b958..465a40d71 100644 --- a/tests/service_chaining/sc_decrypted_srcip_negate_imei_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_negate_imei_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -141,15 +141,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip.com", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_decrypted", "query_value": ""}, - {"query_field_key": "subscriber_id", "query_value": "test6494"}, - {"query_field_key": "imei", "query_value": "1234567801"}, - {"query_field_key": "imsi", "query_value": "43458960456"}, - {"query_field_key": "apn", "query_value": "www.lyautotest.com"}, - {"query_field_key": "phone_number", "query_value": "12345678901"} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -237,13 +230,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -257,7 +248,7 @@ if __name__ == '__main__': "test_subcriber_id": "test6776", "test_imei":"434589604510", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_negate_imsi_fqdn_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_negate_imsi_fqdn_ssl_mirror_bypass_vlan_none.py index 48393e7c3..832f1b47e 100644 --- a/tests/service_chaining/sc_decrypted_srcip_negate_imsi_fqdn_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_negate_imsi_fqdn_ssl_mirror_bypass_vlan_none.py @@ -49,7 +49,7 @@ def run(parameter): ] }, { - "negate_option": False, + "negate_option": True, "or_conditions": [ { "attribute_name": "ATTR_GTP_IMSI", @@ -142,15 +142,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip.com", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_decrypted", "query_value": ""}, - {"query_field_key": "subscriber_id", "query_value": "test6494"}, - {"query_field_key": "imei", "query_value": "1234567801"}, - {"query_field_key": "imsi", "query_value": "43458960456"}, - {"query_field_key": "apn", "query_value": "www.lyautotest.com"}, - {"query_field_key": "phone_number", "query_value": "12345678901"} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -238,13 +231,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -258,7 +249,7 @@ if __name__ == '__main__': "test_subcriber_id": "test6776", "test_imsi":"434589604510", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_negate_imsi_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_negate_imsi_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py index 60db59fa5..7eca114c3 100644 --- a/tests/service_chaining/sc_decrypted_srcip_negate_imsi_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_negate_imsi_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -49,7 +49,7 @@ def run(parameter): ] }, { - "negate_option": False, + "negate_option": True, "or_conditions": [ { "attribute_name": "ATTR_GTP_IMSI", @@ -141,15 +141,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip.com", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_decrypted", "query_value": ""}, - {"query_field_key": "subscriber_id", "query_value": "test6494"}, - {"query_field_key": "imei", "query_value": "1234567801"}, - {"query_field_key": "imsi", "query_value": "43458960456"}, - {"query_field_key": "apn", "query_value": "www.lyautotest.com"}, - {"query_field_key": "phone_number", "query_value": "12345678901"} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -237,13 +230,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -257,7 +248,7 @@ if __name__ == '__main__': "test_subcriber_id": "test6776", "test_imsi":"434589604510", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_negate_pn_fqdn_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_negate_pn_fqdn_ssl_mirror_bypass_vlan_none.py index 88d12422d..595940d70 100644 --- a/tests/service_chaining/sc_decrypted_srcip_negate_pn_fqdn_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_negate_pn_fqdn_ssl_mirror_bypass_vlan_none.py @@ -142,15 +142,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip.com", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_decrypted", "query_value": ""}, - {"query_field_key": "subscriber_id", "query_value": "test6494"}, - {"query_field_key": "imei", "query_value": "1234567801"}, - {"query_field_key": "imsi", "query_value": "43458960456"}, - {"query_field_key": "apn", "query_value": "www.lyautotest.com"}, - {"query_field_key": "phone_number", "query_value": "12345678901"} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -238,13 +231,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -258,7 +249,7 @@ if __name__ == '__main__': "test_subcriber_id": "test6776", "test_phone_number": "12345678901", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_negate_pn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_negate_pn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py index 09efec36a..4258ba5e1 100644 --- a/tests/service_chaining/sc_decrypted_srcip_negate_pn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_negate_pn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -49,7 +49,7 @@ def run(parameter): ] }, { - "negate_option": False, + "negate_option": True, "or_conditions": [ { "attribute_name": "ATTR_GTP_PHONE_NUMBER", @@ -141,15 +141,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip.com", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_decrypted", "query_value": ""}, - {"query_field_key": "subscriber_id", "query_value": "test6494"}, - {"query_field_key": "imei", "query_value": "1234567801"}, - {"query_field_key": "imsi", "query_value": "43458960456"}, - {"query_field_key": "apn", "query_value": "www.lyautotest.com"}, - {"query_field_key": "phone_number", "query_value": "12345678901"} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -237,13 +230,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -257,7 +248,7 @@ if __name__ == '__main__': "test_subcriber_id": "test6776", "test_phone_number": "12345678901", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_negate_srcport_range_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_negate_srcport_range_mirror_bypass_vlan_none.py index b8de260f8..7ada0dc1c 100644 --- a/tests/service_chaining/sc_decrypted_srcip_negate_srcport_range_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_negate_srcport_range_mirror_bypass_vlan_none.py @@ -49,7 +49,7 @@ def run(parameter): ] }, { - "negate_option": False, + "negate_option": True, "or_conditions": [ { "attribute_name": "ATTR_SOURCE_PORT", @@ -112,8 +112,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", - "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -201,13 +201,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -221,7 +219,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_negate_srcport_range_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_negate_srcport_range_steer_bypass_vxlan_activeip_bfd.py index e8c9d8860..bc6b8d412 100644 --- a/tests/service_chaining/sc_decrypted_srcip_negate_srcport_range_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_negate_srcport_range_steer_bypass_vxlan_activeip_bfd.py @@ -49,7 +49,7 @@ def run(parameter): ] }, { - "negate_option": False, + "negate_option": True, "or_conditions": [ { "attribute_name": "ATTR_SOURCE_PORT", @@ -111,8 +111,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", - "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -200,13 +200,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -220,7 +218,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_negate_subid_fqdn_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_negate_subid_fqdn_ssl_mirror_bypass_vlan_none.py index 92e83b0ea..62c031a15 100644 --- a/tests/service_chaining/sc_decrypted_srcip_negate_subid_fqdn_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_negate_subid_fqdn_ssl_mirror_bypass_vlan_none.py @@ -49,7 +49,7 @@ def run(parameter): ] }, { - "negate_option": False, + "negate_option": True, "or_conditions": [ { "attribute_name": "ATTR_SUBSCRIBER_ID", @@ -140,15 +140,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip.com", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_decrypted", "query_value": ""}, - {"query_field_key": "subscriber_id", "query_value": "test6494"}, - {"query_field_key": "imei", "query_value": "1234567801"}, - {"query_field_key": "imsi", "query_value": "43458960456"}, - {"query_field_key": "apn", "query_value": "www.lyautotest.com"}, - {"query_field_key": "phone_number", "query_value": "12345678901"} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -236,13 +229,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -256,7 +247,7 @@ if __name__ == '__main__': "test_imsi": "43458960456", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_negate_subid_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_negate_subid_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py index 54e5ca142..1943b85d5 100644 --- a/tests/service_chaining/sc_decrypted_srcip_negate_subid_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_negate_subid_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -49,7 +49,7 @@ def run(parameter): ] }, { - "negate_option": False, + "negate_option": True, "or_conditions": [ { "attribute_name": "ATTR_SUBSCRIBER_ID", @@ -139,7 +139,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip.com", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_decrypted", "query_value": ""}, {"query_field_key": "subscriber_id", "query_value": "test6494"}, @@ -235,13 +235,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -255,7 +253,7 @@ if __name__ == '__main__': "test_imsi": "43458960456", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_block_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_block_vlan_none.py index c3eea8424..d8c0a3022 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_block_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_block_vlan_none.py @@ -103,7 +103,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "百度", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -192,13 +192,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -211,7 +209,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_block_vxlan_activeip_none.py b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_block_vxlan_activeip_none.py index d6f8e8cbf..a8a3f4157 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_block_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_block_vxlan_activeip_none.py @@ -101,7 +101,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "百度", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -190,13 +190,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -209,7 +207,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_bypass_disabled_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_bypass_disabled_vlan_none.py index 7941f8184..2b1acea54 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_bypass_disabled_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_bypass_disabled_vlan_none.py @@ -100,7 +100,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "百度", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -189,13 +189,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -208,7 +206,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_bypass_vlan_none.py index 1f548e4d1..0733f95f6 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_bypass_vlan_none.py @@ -102,7 +102,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "百度", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -191,13 +191,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -210,7 +208,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_global_bypass_diff_device_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_global_bypass_diff_device_vlan_none.py index 3461d7972..5ab865a18 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_global_bypass_diff_device_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_global_bypass_diff_device_vlan_none.py @@ -102,7 +102,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "百度", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -191,13 +191,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -210,7 +208,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_nearby_bypass_diff_device_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_nearby_bypass_diff_device_vlan_none.py index c0b31c982..bab6a270e 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_nearby_bypass_diff_device_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_nearby_bypass_diff_device_vlan_none.py @@ -102,7 +102,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "百度", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -191,13 +191,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -210,7 +208,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_block_disabled_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_block_disabled_vxlan_activeip_bfd.py index fd81c8f7f..26d6e2907 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_block_disabled_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_block_disabled_vxlan_activeip_bfd.py @@ -102,7 +102,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "百度", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -191,13 +191,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -210,7 +208,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_block_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_block_vxlan_activeip_bfd.py index 87978d7a0..bbdfac4c5 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_block_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_block_vxlan_activeip_bfd.py @@ -103,7 +103,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "百度", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -192,13 +192,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -211,7 +209,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_block_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_block_vxlan_inactiveip_bfd.py index e88525162..b93b43b54 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_block_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_block_vxlan_inactiveip_bfd.py @@ -99,7 +99,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "百度", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -188,13 +188,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -207,7 +205,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_block_vxlan_inactiveip_none.py b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_block_vxlan_inactiveip_none.py index a550fbe87..aaf4e7941 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_block_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_block_vxlan_inactiveip_none.py @@ -107,7 +107,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "百度", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -196,13 +196,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -215,7 +213,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_bypass_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_bypass_vlan_none.py index 2bb305365..650e3f84e 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_bypass_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_ssl_mirror_redispatch_bypass_vlan_none.py @@ -107,7 +107,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "百度", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -196,13 +196,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -215,7 +213,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_ssl_steer_bypass_vxlan_inactiveip_none.py b/tests/service_chaining/sc_decrypted_srcip_ssl_steer_bypass_vxlan_inactiveip_none.py index 679c4001a..34a1fa33a 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ssl_steer_bypass_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_ssl_steer_bypass_vxlan_inactiveip_none.py @@ -100,7 +100,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -189,13 +189,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -208,7 +206,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_ssl_steer_redispatch_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_ssl_steer_redispatch_bypass_vxlan_activeip_bfd.py index 3b12a1c9e..ab7d4de46 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ssl_steer_redispatch_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_ssl_steer_redispatch_bypass_vxlan_activeip_bfd.py @@ -105,7 +105,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -194,13 +194,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -213,7 +211,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_ssl_steer_redispatch_bypass_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_ssl_steer_redispatch_bypass_vxlan_unavailableip_bfd.py index 918dfbc3f..3850588af 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ssl_steer_redispatch_bypass_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_ssl_steer_redispatch_bypass_vxlan_unavailableip_bfd.py @@ -103,7 +103,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -192,13 +192,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -211,7 +209,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_ssl_steer_redispatch_bypass_vxlan_unavailableip_none.py b/tests/service_chaining/sc_decrypted_srcip_ssl_steer_redispatch_bypass_vxlan_unavailableip_none.py index 8277673f9..3c6f333de 100644 --- a/tests/service_chaining/sc_decrypted_srcip_ssl_steer_redispatch_bypass_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_ssl_steer_redispatch_bypass_vxlan_unavailableip_none.py @@ -105,7 +105,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -194,13 +194,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -213,7 +211,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_subid_fqdn_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_subid_fqdn_ssl_mirror_bypass_vlan_none.py index bb62de851..fbcd5be9f 100644 --- a/tests/service_chaining/sc_decrypted_srcip_subid_fqdn_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_subid_fqdn_ssl_mirror_bypass_vlan_none.py @@ -140,7 +140,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip.com", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_decrypted", "query_value": ""}, {"query_field_key": "subscriber_id", "query_value": "test6494"}, @@ -236,13 +236,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -256,7 +254,7 @@ if __name__ == '__main__': "test_imsi": "43458960456", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_subid_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_subid_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py index 0ed729f28..9757d56e4 100644 --- a/tests/service_chaining/sc_decrypted_srcip_subid_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_subid_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -139,7 +139,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [{"query_field_key": "sc_rsp_decrypted", "query_value": ""}] } @@ -228,13 +228,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -247,7 +245,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_subid_imei_apn_fqdn_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_subid_imei_apn_fqdn_ssl_mirror_bypass_vlan_none.py index 31bc3e50c..92132af3a 100644 --- a/tests/service_chaining/sc_decrypted_srcip_subid_imei_apn_fqdn_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_subid_imei_apn_fqdn_ssl_mirror_bypass_vlan_none.py @@ -177,7 +177,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip.com", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_decrypted", "query_value": ""}, {"query_field_key": "subscriber_id", "query_value": "test6494"}, @@ -273,13 +273,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() diff --git a/tests/service_chaining/sc_decrypted_srcip_subid_imei_apn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_subid_imei_apn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py index aaa5e32d4..24ac5ff95 100644 --- a/tests/service_chaining/sc_decrypted_srcip_subid_imei_apn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_subid_imei_apn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -172,7 +172,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip.com", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_decrypted", "query_value": ""}, {"query_field_key": "subscriber_id", "query_value": "test6494"}, @@ -268,13 +268,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() diff --git a/tests/service_chaining/sc_decrypted_srcip_subid_imsi_fqdn_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_subid_imsi_fqdn_ssl_mirror_bypass_vlan_none.py index 1df803b1f..950627538 100644 --- a/tests/service_chaining/sc_decrypted_srcip_subid_imsi_fqdn_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_subid_imsi_fqdn_ssl_mirror_bypass_vlan_none.py @@ -159,7 +159,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip.com", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_decrypted", "query_value": ""}, {"query_field_key": "subscriber_id", "query_value": "test6494"}, @@ -255,13 +255,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -275,7 +273,7 @@ if __name__ == '__main__': "test_subcriber_id": "test6776", "test_imsi":"434589604510", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_subid_imsi_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_subid_imsi_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py index f63099999..c1b002f92 100644 --- a/tests/service_chaining/sc_decrypted_srcip_subid_imsi_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_subid_imsi_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -153,7 +153,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip.com", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_decrypted", "query_value": ""}, {"query_field_key": "subscriber_id", "query_value": "test6494"}, @@ -249,13 +249,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -269,7 +267,7 @@ if __name__ == '__main__': "test_imsi": "43458960456", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_subid_pn_apn_fqdn_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_subid_pn_apn_fqdn_ssl_mirror_bypass_vlan_none.py index 9a43ed466..a1ada941f 100644 --- a/tests/service_chaining/sc_decrypted_srcip_subid_pn_apn_fqdn_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_subid_pn_apn_fqdn_ssl_mirror_bypass_vlan_none.py @@ -177,7 +177,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip.com", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_decrypted", "query_value": ""}, {"query_field_key": "subscriber_id", "query_value": "test6494"}, @@ -273,13 +273,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -294,7 +292,7 @@ if __name__ == '__main__': "test_subcriber_id": "test6776", "test_phone_number": "12345678901", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_subid_pn_apn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_subid_pn_apn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py index e7f4e12ac..853af4ee8 100644 --- a/tests/service_chaining/sc_decrypted_srcip_subid_pn_apn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_subid_pn_apn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -171,7 +171,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip.com", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_decrypted", "query_value": ""}, {"query_field_key": "subscriber_id", "query_value": "test6494"}, @@ -267,13 +267,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -288,7 +286,7 @@ if __name__ == '__main__': "test_subcriber_id": "test6776", "test_phone_number": "12345678901", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_subid_pn_fqdn_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_decrypted_srcip_subid_pn_fqdn_ssl_mirror_bypass_vlan_none.py index c27960210..5e4b2c20d 100644 --- a/tests/service_chaining/sc_decrypted_srcip_subid_pn_fqdn_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_decrypted_srcip_subid_pn_fqdn_ssl_mirror_bypass_vlan_none.py @@ -159,7 +159,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip.com", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_decrypted", "query_value": ""}, {"query_field_key": "subscriber_id", "query_value": "test6494"}, @@ -255,13 +255,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -275,7 +273,7 @@ if __name__ == '__main__': "test_subcriber_id": "test6776", "test_phone_number": "12345678901", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_decrypted_srcip_subid_pn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_decrypted_srcip_subid_pn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py index c538069b1..8395484a3 100644 --- a/tests/service_chaining/sc_decrypted_srcip_subid_pn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_decrypted_srcip_subid_pn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -153,7 +153,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "vip.com", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_decrypted", "query_value": ""}, {"query_field_key": "subscriber_id", "query_value": "test6494"}, @@ -249,13 +249,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -269,7 +267,7 @@ if __name__ == '__main__': "test_subcriber_id": "test6776", "test_phone_number": "12345678901", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_dstip_dstport_range_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_dstip_dstport_range_mirror_bypass_vlan_none.py index 0d6ce9bb9..32be63dfd 100644 --- a/tests/service_chaining/sc_raw_dstip_dstport_range_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_dstip_dstport_range_mirror_bypass_vlan_none.py @@ -117,7 +117,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -213,13 +213,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() diff --git a/tests/service_chaining/sc_raw_dstip_dstport_range_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_dstip_dstport_range_steer_bypass_vxlan_activeip_bfd.py index 0a2122c23..131bc07c3 100644 --- a/tests/service_chaining/sc_raw_dstip_dstport_range_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_dstip_dstport_range_steer_bypass_vxlan_activeip_bfd.py @@ -116,7 +116,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -212,13 +212,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -232,7 +230,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_dstip_external_port_range_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_dstip_external_port_range_mirror_bypass_vlan_none.py index 8e37f6a97..a90bd98f5 100644 --- a/tests/service_chaining/sc_raw_dstip_external_port_range_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_dstip_external_port_range_mirror_bypass_vlan_none.py @@ -137,7 +137,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -233,13 +233,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -253,7 +251,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_dstip_external_port_range_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_dstip_external_port_range_steer_bypass_vxlan_activeip_bfd.py index 7f83db2f9..1354a6cd6 100644 --- a/tests/service_chaining/sc_raw_dstip_external_port_range_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_dstip_external_port_range_steer_bypass_vxlan_activeip_bfd.py @@ -116,7 +116,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -212,13 +212,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -232,7 +230,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_imsi_fqdn_http_url_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_imsi_fqdn_http_url_mirror_bypass_vlan_none.py index 9a2503843..3fda6bdc3 100644 --- a/tests/service_chaining/sc_raw_imsi_fqdn_http_url_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_imsi_fqdn_http_url_mirror_bypass_vlan_none.py @@ -147,7 +147,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -247,13 +247,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -266,7 +264,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test2425", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_imsi_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_imsi_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index f661d02e0..70c8a8309 100644 --- a/tests/service_chaining/sc_raw_imsi_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_imsi_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -146,7 +146,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -246,13 +246,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -265,7 +263,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test2425", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_multiple_port_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_multiple_port_steer_bypass_vxlan_activeip_bfd.py index 23c676d69..bc2e3e84f 100644 --- a/tests/service_chaining/sc_raw_multiple_port_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_multiple_port_steer_bypass_vxlan_activeip_bfd.py @@ -149,7 +149,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -246,13 +246,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -266,7 +264,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_negate_apn_fqdn_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_negate_apn_fqdn_ssl_mirror_bypass_vlan_none.py index 41a3c541c..1965e39a7 100644 --- a/tests/service_chaining/sc_raw_negate_apn_fqdn_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_negate_apn_fqdn_ssl_mirror_bypass_vlan_none.py @@ -128,19 +128,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_raw", "query_value": ""}, - {"query_field_key": "sent_pkts", "query_value": ""}, - {"query_field_key": "received_pkts", "query_value": ""}, - {"query_field_key": "sent_bytes", "query_value": ""}, - {"query_field_key": "received_bytes", "query_value": ""}, - {"query_field_key": "subscriber_id", "query_value": "test2425"}, - {"query_field_key": "imei", "query_value": "1234567802"}, - {"query_field_key": "imsi", "query_value": "43458960458"}, - {"query_field_key": "apn", "query_value": "www.lyrawautotest.com"}, - {"query_field_key": "phone_number", "query_value": "12345678902"} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 if parameter["initiation_method"] == "ui": @@ -227,13 +216,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -248,7 +235,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_negate_apn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_negate_apn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py index adef8e470..ad37a01c8 100644 --- a/tests/service_chaining/sc_raw_negate_apn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_negate_apn_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -29,7 +29,7 @@ def run(parameter): "action": "service_chaining", "and_conditions": [ { - "negate_option": False, + "negate_option": True, "or_conditions": [ { "attribute_name": "ATTR_GTP_APN", @@ -126,19 +126,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_raw", "query_value": ""}, - {"query_field_key": "sent_pkts", "query_value": ""}, - {"query_field_key": "received_pkts", "query_value": ""}, - {"query_field_key": "sent_bytes", "query_value": ""}, - {"query_field_key": "received_bytes", "query_value": ""}, - {"query_field_key": "subscriber_id", "query_value": "test2425"}, - {"query_field_key": "imei", "query_value": "1234567802"}, - {"query_field_key": "imsi", "query_value": "43458960458"}, - {"query_field_key": "apn", "query_value": "www.lyrawautotest.com"}, - {"query_field_key": "phone_number", "query_value": "12345678902"} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 if parameter["initiation_method"] == "ui": @@ -225,13 +214,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -246,7 +233,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_negate_imei_fqdn_http_url_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_negate_imei_fqdn_http_url_mirror_bypass_vlan_none.py index cd80b6a83..844ff62ee 100644 --- a/tests/service_chaining/sc_raw_negate_imei_fqdn_http_url_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_negate_imei_fqdn_http_url_mirror_bypass_vlan_none.py @@ -147,19 +147,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_raw", "query_value": ""}, - {"query_field_key": "sent_pkts", "query_value": ""}, - {"query_field_key": "received_pkts", "query_value": ""}, - {"query_field_key": "sent_bytes", "query_value": ""}, - {"query_field_key": "received_bytes", "query_value": ""}, - {"query_field_key": "subscriber_id", "query_value": "test2425"}, - {"query_field_key": "imei", "query_value": "1234567802"}, - {"query_field_key": "imsi", "query_value": "43458960458"}, - {"query_field_key": "apn", "query_value": "www.lyrawautotest.com"}, - {"query_field_key": "phone_number", "query_value": "12345678902"} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -247,13 +236,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -266,7 +253,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test2425", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_negate_imei_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_negate_imei_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 977a5c8fb..58b8d0ff4 100644 --- a/tests/service_chaining/sc_raw_negate_imei_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_negate_imei_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -146,19 +146,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_raw", "query_value": ""}, - {"query_field_key": "sent_pkts", "query_value": ""}, - {"query_field_key": "received_pkts", "query_value": ""}, - {"query_field_key": "sent_bytes", "query_value": ""}, - {"query_field_key": "received_bytes", "query_value": ""}, - {"query_field_key": "subscriber_id", "query_value": "test2425"}, - {"query_field_key": "imei", "query_value": "1234567802"}, - {"query_field_key": "imsi", "query_value": "43458960458"}, - {"query_field_key": "apn", "query_value": "www.lyrawautotest.com"}, - {"query_field_key": "phone_number", "query_value": "12345678902"} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -246,13 +235,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -265,7 +252,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test2425", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_negate_imsi_fqdn_http_url_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_negate_imsi_fqdn_http_url_mirror_bypass_vlan_none.py index 14deb75cf..c1c872cd6 100644 --- a/tests/service_chaining/sc_raw_negate_imsi_fqdn_http_url_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_negate_imsi_fqdn_http_url_mirror_bypass_vlan_none.py @@ -148,19 +148,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_raw", "query_value": ""}, - {"query_field_key": "sent_pkts", "query_value": ""}, - {"query_field_key": "received_pkts", "query_value": ""}, - {"query_field_key": "sent_bytes", "query_value": ""}, - {"query_field_key": "received_bytes", "query_value": ""}, - {"query_field_key": "subscriber_id", "query_value": "test2425"}, - {"query_field_key": "imei", "query_value": "1234567802"}, - {"query_field_key": "imsi", "query_value": "43458960458"}, - {"query_field_key": "apn", "query_value": "www.lyrawautotest.com"}, - {"query_field_key": "phone_number", "query_value": "12345678902"} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -248,13 +237,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -267,7 +254,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test2425", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_negate_imsi_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_negate_imsi_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index b0a054902..4156ebaa5 100644 --- a/tests/service_chaining/sc_raw_negate_imsi_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_negate_imsi_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -29,7 +29,7 @@ def run(parameter): "action": "service_chaining", "and_conditions": [ { - "negate_option": False, + "negate_option": True, "or_conditions": [ { "attribute_name": "ATTR_GTP_IMSI", @@ -146,19 +146,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_raw", "query_value": ""}, - {"query_field_key": "sent_pkts", "query_value": ""}, - {"query_field_key": "received_pkts", "query_value": ""}, - {"query_field_key": "sent_bytes", "query_value": ""}, - {"query_field_key": "received_bytes", "query_value": ""}, - {"query_field_key": "subscriber_id", "query_value": "test2425"}, - {"query_field_key": "imei", "query_value": "1234567802"}, - {"query_field_key": "imsi", "query_value": "43458960458"}, - {"query_field_key": "apn", "query_value": "www.lyrawautotest.com"}, - {"query_field_key": "phone_number", "query_value": "12345678902"} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -246,13 +235,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -265,7 +252,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test2425", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_negate_pn_fqdn_http_url_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_negate_pn_fqdn_http_url_mirror_bypass_vlan_none.py index a1c8171d4..67c4bb9ab 100644 --- a/tests/service_chaining/sc_raw_negate_pn_fqdn_http_url_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_negate_pn_fqdn_http_url_mirror_bypass_vlan_none.py @@ -29,7 +29,7 @@ def run(parameter): "action": "service_chaining", "and_conditions": [ { - "negate_option": False, + "negate_option": True, "or_conditions": [ { "attribute_name": "ATTR_GTP_PHONE_NUMBER", @@ -147,19 +147,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_raw", "query_value": ""}, - {"query_field_key": "sent_pkts", "query_value": ""}, - {"query_field_key": "received_pkts", "query_value": ""}, - {"query_field_key": "sent_bytes", "query_value": ""}, - {"query_field_key": "received_bytes", "query_value": ""}, - {"query_field_key": "subscriber_id", "query_value": "test2425"}, - {"query_field_key": "imei", "query_value": "1234567802"}, - {"query_field_key": "imsi", "query_value": "43458960458"}, - {"query_field_key": "apn", "query_value": "www.lyrawautotest.com"}, - {"query_field_key": "phone_number", "query_value": "12345678902"} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -247,13 +236,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -267,7 +254,7 @@ if __name__ == '__main__': "test_subcriber_id": "test2425", "test_phone_number": "12345678901", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_negate_pn_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_negate_pn_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 9a4993ce3..af541e739 100644 --- a/tests/service_chaining/sc_raw_negate_pn_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_negate_pn_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -146,19 +146,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_raw", "query_value": ""}, - {"query_field_key": "sent_pkts", "query_value": ""}, - {"query_field_key": "received_pkts", "query_value": ""}, - {"query_field_key": "sent_bytes", "query_value": ""}, - {"query_field_key": "received_bytes", "query_value": ""}, - {"query_field_key": "subscriber_id", "query_value": "test2425"}, - {"query_field_key": "imei", "query_value": "1234567802"}, - {"query_field_key": "imsi", "query_value": "43458960458"}, - {"query_field_key": "apn", "query_value": "www.lyrawautotest.com"}, - {"query_field_key": "phone_number", "query_value": "12345678902"} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -246,13 +235,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -265,7 +252,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test2425", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_negate_srcip_dstip_fqdn_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_negate_srcip_dstip_fqdn_ssl_mirror_bypass_vlan_none.py index df4895da7..a0692b7c7 100644 --- a/tests/service_chaining/sc_raw_negate_srcip_dstip_fqdn_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_negate_srcip_dstip_fqdn_ssl_mirror_bypass_vlan_none.py @@ -150,14 +150,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_raw", "query_value": ""}, - {"query_field_key": "sent_pkts", "query_value": ""}, - {"query_field_key": "received_pkts", "query_value": ""}, - {"query_field_key": "sent_bytes", "query_value": ""}, - {"query_field_key": "received_bytes", "query_value": ""} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -245,13 +239,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -264,7 +256,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_negate_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_negate_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py index 340a11f0a..1dd99ed84 100644 --- a/tests/service_chaining/sc_raw_negate_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_negate_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -106,8 +106,8 @@ def run(parameter): "return_data": 1, "name": "steer_bypass_vxlan_activeip_bfd", "type": 1, - "load_balance_method": "hash-innermost-int-ip", - "load_balance_localization": "nearby", + "load_balance_method": "hash-innermost-int-ip", + "load_balance_localization": "nearby", "failure_action": "bypass", "service_func_profiles":[ { @@ -149,14 +149,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_raw", "query_value": ""}, - {"query_field_key": "sent_pkts", "query_value": ""}, - {"query_field_key": "received_pkts", "query_value": ""}, - {"query_field_key": "sent_bytes", "query_value": ""}, - {"query_field_key": "received_bytes", "query_value": ""} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -244,13 +238,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -263,13 +255,14 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, "root_path": "C:/automation_project/tsg_test", "path": "C:/automation_project/tsg_test/tests/ui", "module_name": "service_chaining", - "test_case_name": "sc_raw_negate_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd" + "test_case_name": "sc_raw_src_compliance_risk_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd" } run(parameter) """ diff --git a/tests/service_chaining/sc_raw_negate_subid_fqdn_http_url_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_negate_subid_fqdn_http_url_mirror_bypass_vlan_none.py index 08e0263d9..e92a6651a 100644 --- a/tests/service_chaining/sc_raw_negate_subid_fqdn_http_url_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_negate_subid_fqdn_http_url_mirror_bypass_vlan_none.py @@ -29,7 +29,7 @@ def run(parameter): "action": "service_chaining", "and_conditions": [ { - "negate_option": False, + "negate_option": True, "or_conditions": [ { "attribute_name": "ATTR_SUBSCRIBER_ID", @@ -145,19 +145,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_raw", "query_value": ""}, - {"query_field_key": "sent_pkts", "query_value": ""}, - {"query_field_key": "received_pkts", "query_value": ""}, - {"query_field_key": "sent_bytes", "query_value": ""}, - {"query_field_key": "received_bytes", "query_value": ""}, - {"query_field_key": "subscriber_id", "query_value": "test2425"}, - {"query_field_key": "imei", "query_value": "1234567802"}, - {"query_field_key": "imsi", "query_value": "43458960458"}, - {"query_field_key": "apn", "query_value": "www.lyrawautotest.com"}, - {"query_field_key": "phone_number", "query_value": "12345678902"} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -245,13 +234,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -264,7 +251,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test2425", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_negate_subid_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_negate_subid_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 4161615fe..e6ef01110 100644 --- a/tests/service_chaining/sc_raw_negate_subid_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_negate_subid_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -29,7 +29,7 @@ def run(parameter): "action": "service_chaining", "and_conditions": [ { - "negate_option": False, + "negate_option": True, "or_conditions": [ { "attribute_name": "ATTR_SUBSCRIBER_ID", @@ -144,19 +144,8 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", - "expected_log": [ - {"query_field_key": "sc_rsp_raw", "query_value": ""}, - {"query_field_key": "sent_pkts", "query_value": ""}, - {"query_field_key": "received_pkts", "query_value": ""}, - {"query_field_key": "sent_bytes", "query_value": ""}, - {"query_field_key": "received_bytes", "query_value": ""}, - {"query_field_key": "subscriber_id", "query_value": "test2425"}, - {"query_field_key": "imei", "query_value": "1234567802"}, - {"query_field_key": "imsi", "query_value": "43458960458"}, - {"query_field_key": "apn", "query_value": "www.lyrawautotest.com"}, - {"query_field_key": "phone_number", "query_value": "12345678902"} - ] + "expected_metric": {"hits": 0}, + "expected_log": [] } # 创建 @@ -244,13 +233,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -263,7 +250,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test2425", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_pn_fqdn_http_url_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_pn_fqdn_http_url_mirror_bypass_vlan_none.py index cab2c3d82..d2849540b 100644 --- a/tests/service_chaining/sc_raw_pn_fqdn_http_url_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_pn_fqdn_http_url_mirror_bypass_vlan_none.py @@ -147,7 +147,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -247,13 +247,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -266,7 +264,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test2425", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_pn_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_pn_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 6649b4947..949b36d94 100644 --- a/tests/service_chaining/sc_raw_pn_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_pn_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -146,7 +146,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -246,13 +246,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -265,7 +263,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test2425", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_rtp_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_rtp_mirror_bypass_vlan_none.py index ff1361d38..775bd906a 100644 --- a/tests/service_chaining/sc_raw_rtp_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_rtp_mirror_bypass_vlan_none.py @@ -92,7 +92,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""} ] @@ -183,13 +183,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -202,7 +200,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_rtp_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_rtp_steer_bypass_vxlan_activeip_bfd.py index d6135b143..0a36276ff 100644 --- a/tests/service_chaining/sc_raw_rtp_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_rtp_steer_bypass_vxlan_activeip_bfd.py @@ -91,7 +91,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""} ] @@ -182,13 +182,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -201,7 +199,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_scrip_dstip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_none.py b/tests/service_chaining/sc_raw_scrip_dstip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_none.py index 844d44910..4ada4da1d 100644 --- a/tests/service_chaining/sc_raw_scrip_dstip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_raw_scrip_dstip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_none.py @@ -148,7 +148,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -243,13 +243,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -262,7 +260,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_src_compliance_risk_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_src_compliance_risk_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index b5f82b67b..4bb95661d 100644 --- a/tests/service_chaining/sc_raw_src_compliance_risk_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_src_compliance_risk_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -182,7 +182,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -277,13 +277,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -296,7 +294,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_src_geoip_asn_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_src_geoip_asn_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 85edbd005..d3ceb7e74 100644 --- a/tests/service_chaining/sc_raw_src_geoip_asn_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_src_geoip_asn_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -181,7 +181,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -276,13 +276,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -295,7 +293,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_src_geoip_city_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_src_geoip_city_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 0c88beb09..df60230bb 100644 --- a/tests/service_chaining/sc_raw_src_geoip_city_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_src_geoip_city_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -176,7 +176,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -271,13 +271,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -290,7 +288,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_src_geoip_country_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_src_geoip_country_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 03b4031e2..efe50ab82 100644 --- a/tests/service_chaining/sc_raw_src_geoip_country_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_src_geoip_country_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -180,7 +180,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -275,13 +275,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -294,7 +292,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_src_internet_service_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_src_internet_service_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 30119bc9c..3e51d37e9 100644 --- a/tests/service_chaining/sc_raw_src_internet_service_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_src_internet_service_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -182,7 +182,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -277,13 +277,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -296,7 +294,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_src_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_src_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 7b8bb6efd..1617026c2 100644 --- a/tests/service_chaining/sc_raw_src_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_src_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -175,7 +175,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -270,13 +270,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -289,7 +287,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_src_security_threat_library_iprange_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_src_security_threat_library_iprange_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index a6e33224e..c7589e99f 100644 --- a/tests/service_chaining/sc_raw_src_security_threat_library_iprange_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_src_security_threat_library_iprange_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -175,7 +175,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -270,13 +270,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -289,7 +287,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_src_website_classification_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_src_website_classification_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 3a418ed59..0ace6a631 100644 --- a/tests/service_chaining/sc_raw_src_website_classification_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_src_website_classification_library_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -180,7 +180,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -275,13 +275,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -294,7 +292,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dst_compliance_risk_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dst_compliance_risk_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index cc91e6ee7..0d260e716 100644 --- a/tests/service_chaining/sc_raw_srcip_dst_compliance_risk_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dst_compliance_risk_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -175,7 +175,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -270,13 +270,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -289,7 +287,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dst_geoip_asn_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dst_geoip_asn_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 5b2860d7d..980a6aa98 100644 --- a/tests/service_chaining/sc_raw_srcip_dst_geoip_asn_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dst_geoip_asn_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -175,7 +175,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -270,13 +270,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -289,7 +287,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dst_geoip_city_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dst_geoip_city_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 247bbe9f8..c1e29f208 100644 --- a/tests/service_chaining/sc_raw_srcip_dst_geoip_city_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dst_geoip_city_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -175,7 +175,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -270,13 +270,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -289,7 +287,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dst_geoip_country_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dst_geoip_country_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 15cd26dd6..4f84318e4 100644 --- a/tests/service_chaining/sc_raw_srcip_dst_geoip_country_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dst_geoip_country_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -175,7 +175,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -270,13 +270,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -289,7 +287,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dst_internet_service_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dst_internet_service_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 21b0fe495..45873e8b3 100644 --- a/tests/service_chaining/sc_raw_srcip_dst_internet_service_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dst_internet_service_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -175,7 +175,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -270,13 +270,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -289,7 +287,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dst_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dst_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 85aa271db..a933100da 100644 --- a/tests/service_chaining/sc_raw_srcip_dst_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dst_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -175,7 +175,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -270,13 +270,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -289,7 +287,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dst_security_threat_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dst_security_threat_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 6012ad434..4a5c0aacb 100644 --- a/tests/service_chaining/sc_raw_srcip_dst_security_threat_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dst_security_threat_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -175,7 +175,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -270,13 +270,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -289,7 +287,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dst_website_classification_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dst_website_classification_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 74db755cd..46cded137 100644 --- a/tests/service_chaining/sc_raw_srcip_dst_website_classification_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dst_website_classification_library_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -176,7 +176,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -209,7 +209,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_dns_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_dns_mirror_bypass_vlan_none.py index ec73941fb..d18f264d6 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_dns_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_dns_mirror_bypass_vlan_none.py @@ -132,7 +132,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -227,13 +227,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -246,7 +244,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_dns_qname_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_dns_qname_mirror_bypass_vlan_none.py index 8fe5e97b9..923cb75cd 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_dns_qname_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_dns_qname_mirror_bypass_vlan_none.py @@ -150,7 +150,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -245,13 +245,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -264,7 +262,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_dns_qname_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_dns_qname_steer_bypass_vxlan_activeip_bfd.py index 0230ae029..1a0f3c8da 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_dns_qname_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_dns_qname_steer_bypass_vxlan_activeip_bfd.py @@ -149,7 +149,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -244,13 +244,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -263,7 +261,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_dns_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_dns_steer_bypass_vxlan_activeip_bfd.py index 1c7fe344b..9fe278871 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_dns_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_dns_steer_bypass_vxlan_activeip_bfd.py @@ -131,7 +131,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -226,13 +226,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -245,7 +243,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_exact_fqdn_category_library_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_exact_fqdn_category_library_http_url_steer_bypass_vxlan_activeip_bfd.py index 44b1bcb4c..a2ec6d20e 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_exact_fqdn_category_library_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_exact_fqdn_category_library_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -177,7 +177,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -272,13 +272,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -291,7 +289,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_exact_fqdn_geoip_city_library_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_exact_fqdn_geoip_city_library_http_url_steer_bypass_vxlan_activeip_bfd.py index d2b59431d..dd4b71dc5 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_exact_fqdn_geoip_city_library_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_exact_fqdn_geoip_city_library_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -176,7 +176,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -271,13 +271,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -290,7 +288,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_exact_fqdn_library_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_exact_fqdn_library_http_url_steer_bypass_vxlan_activeip_bfd.py index fa768d50f..9fc647703 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_exact_fqdn_library_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_exact_fqdn_library_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -176,7 +176,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -271,13 +271,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -290,7 +288,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_exact_fqdn_security_threat_library_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_exact_fqdn_security_threat_library_http_url_steer_bypass_vxlan_activeip_bfd.py index c95b43bf7..f5cd38a86 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_exact_fqdn_security_threat_library_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_exact_fqdn_security_threat_library_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -176,7 +176,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -271,13 +271,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_all_ipproto_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_all_ipproto_http_url_steer_bypass_vxlan_activeip_bfd.py index b99584842..2211b8406 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_all_ipproto_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_all_ipproto_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -177,7 +177,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -272,13 +272,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -291,7 +289,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_all_ipproto_quic_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_all_ipproto_quic_steer_bypass_vxlan_activeip_bfd.py index 54e2c4310..75e0398b0 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_all_ipproto_quic_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_all_ipproto_quic_steer_bypass_vxlan_activeip_bfd.py @@ -160,7 +160,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_http_url_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_http_url_mirror_bypass_vlan_none.py index 6d0ecc2ef..4b9bc796a 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_http_url_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_http_url_mirror_bypass_vlan_none.py @@ -168,7 +168,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -263,13 +263,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -282,7 +280,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index ec4f1a468..1cd3dacdc 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -167,7 +167,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -262,13 +262,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -281,7 +279,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ipprototcp_http_url_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ipprototcp_http_url_mirror_bypass_vlan_none.py index c268fcbaa..4cb0cb563 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ipprototcp_http_url_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ipprototcp_http_url_mirror_bypass_vlan_none.py @@ -178,7 +178,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -273,13 +273,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -292,7 +290,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ipprototcp_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ipprototcp_http_url_steer_bypass_vxlan_activeip_bfd.py index 9de396912..c8351f7c3 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ipprototcp_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ipprototcp_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -177,7 +177,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -272,13 +272,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -291,7 +289,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_library_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_library_http_url_steer_bypass_vxlan_activeip_bfd.py index 0d88a4fc9..945f28831 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_library_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_library_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -183,7 +183,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -278,13 +278,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -297,7 +295,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_negate_extport_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_negate_extport_ssl_mirror_bypass_vlan_none.py index 13b74b10b..87094524b 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_negate_extport_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_negate_extport_ssl_mirror_bypass_vlan_none.py @@ -167,7 +167,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -262,13 +262,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -281,7 +279,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_negate_extport_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_negate_extport_ssl_steer_bypass_vxlan_activeip_bfd.py index 975e3da85..e9db3ec9e 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_negate_extport_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_negate_extport_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -166,7 +166,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -261,13 +261,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -280,7 +278,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_negate_intport_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_negate_intport_ssl_mirror_bypass_vlan_none.py index 6cf2b18c9..5f48880a6 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_negate_intport_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_negate_intport_ssl_mirror_bypass_vlan_none.py @@ -167,7 +167,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -262,13 +262,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -281,7 +279,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_negate_intport_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_negate_intport_ssl_steer_bypass_vxlan_activeip_bfd.py index 3758f6976..5f48880a6 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_negate_intport_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_negate_intport_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -167,7 +167,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -262,13 +262,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -281,7 +279,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_quic_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_quic_mirror_bypass_vlan_none.py index 03fe0fe1f..2909b58fa 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_quic_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_quic_mirror_bypass_vlan_none.py @@ -149,7 +149,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -244,13 +244,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -263,7 +261,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_quic_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_quic_steer_bypass_vxlan_activeip_bfd.py index 53fb68433..5ca4ef460 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_quic_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_quic_steer_bypass_vxlan_activeip_bfd.py @@ -148,7 +148,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -243,13 +243,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -262,7 +260,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_ech_false_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_ech_false_mirror_bypass_vlan_none.py index f6db47082..9789e3a22 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_ech_false_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_ech_false_mirror_bypass_vlan_none.py @@ -160,7 +160,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -256,13 +256,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -275,7 +273,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_ech_false_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_ech_false_steer_bypass_vxlan_activeip_bfd.py index b188cf9d6..639084518 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_ech_false_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_ech_false_steer_bypass_vxlan_activeip_bfd.py @@ -159,7 +159,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -255,13 +255,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -274,7 +272,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_ech_true_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_ech_true_mirror_bypass_vlan_none.py index 9149b9ee5..ef1e78162 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_ech_true_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_ech_true_mirror_bypass_vlan_none.py @@ -160,7 +160,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -256,13 +256,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -275,7 +273,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_ech_true_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_ech_true_steer_bypass_vxlan_activeip_bfd.py index 1b2e5dcb9..75821d3fa 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_ech_true_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_ech_true_steer_bypass_vxlan_activeip_bfd.py @@ -159,7 +159,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -255,13 +255,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -274,7 +272,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_esni_false_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_esni_false_mirror_bypass_vlan_none.py index 1b8304c81..c3d4e10d1 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_esni_false_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_esni_false_mirror_bypass_vlan_none.py @@ -160,7 +160,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "trex", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -256,13 +256,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -275,7 +273,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_esni_false_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_esni_false_steer_bypass_vxlan_activeip_bfd.py index 5851da970..d2cab0b15 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_esni_false_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_esni_false_steer_bypass_vxlan_activeip_bfd.py @@ -159,7 +159,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "trex", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -255,13 +255,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -274,7 +272,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_disabled_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_disabled_vxlan_activeip_bfd.py index e0ef2d9c6..7f937730d 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_disabled_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_disabled_vxlan_activeip_bfd.py @@ -147,7 +147,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -242,13 +242,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -261,7 +259,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_vxlan_activeip_bfd.py index 91e9b56fc..9be08ecde 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_vxlan_activeip_bfd.py @@ -145,7 +145,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -240,13 +240,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -259,7 +257,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_vxlan_activeip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_vxlan_activeip_none.py index f17bace96..f5544e470 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_vxlan_activeip_none.py @@ -147,7 +147,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -242,13 +242,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -261,7 +259,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_vxlan_inactiveip_bfd.py index dbedfbbd0..356975934 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_vxlan_inactiveip_bfd.py @@ -144,7 +144,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -239,13 +239,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -258,7 +256,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_vxlan_inactiveip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_vxlan_inactiveip_none.py index e2c3460a5..577317fb5 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_block_vxlan_inactiveip_none.py @@ -146,7 +146,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -241,13 +241,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -260,7 +258,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vlan_none.py index cbf70db3b..ad28a8927 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vlan_none.py @@ -150,7 +150,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -245,13 +245,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -264,7 +262,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_activeip_bfd.py index 5f3cd2311..8455a67d3 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_activeip_bfd.py @@ -144,7 +144,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -239,13 +239,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -258,7 +256,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_activeip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_activeip_none.py index 22faed15c..6523c879a 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_activeip_none.py @@ -149,7 +149,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -244,13 +244,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -263,7 +261,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_inactiveip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_inactiveip_none.py index bf2ba2990..aef17ce1b 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_inactiveip_none.py @@ -147,7 +147,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -242,13 +242,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -261,7 +259,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_bfd.py index 82f1d79ca..b7d2a2ed7 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_bfd.py @@ -141,7 +141,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -236,13 +236,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -255,7 +253,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_none.py index 75c251fee..ed87dea65 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_bypass_vxlan_unavailableip_none.py @@ -143,7 +143,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -238,13 +238,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -257,7 +255,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_global_bypass_diff_device_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_global_bypass_diff_device_vlan_none.py index 657496ba1..a17405201 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_global_bypass_diff_device_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_global_bypass_diff_device_vlan_none.py @@ -148,7 +148,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -243,13 +243,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -262,7 +260,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_nearby_bypass_diff_device_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_nearby_bypass_diff_device_vlan_none.py index 9e937a326..b44ae5a4a 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_nearby_bypass_diff_device_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_nearby_bypass_diff_device_vlan_none.py @@ -147,7 +147,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -242,13 +242,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -261,7 +259,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_disabled_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_disabled_vxlan_activeip_bfd.py index afda5ec68..9b402ad75 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_disabled_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_disabled_vxlan_activeip_bfd.py @@ -152,7 +152,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -247,13 +247,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -266,7 +264,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vlan_none.py index adf96eed6..efea4196c 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vlan_none.py @@ -4,6 +4,7 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath( import time import pytz from datetime import datetime +from support.ui_utils.element_position.map_element_position_library import replace_paras from support.ui_utils.workpath import workdir from support.ui_utils.ui_client import UIClient from support.api_utils.api_client import APIClient @@ -41,7 +42,7 @@ def run(parameter): "items": [ { "op": "add", - "ip": "10.64.224.25", + "ip": "10.64.224.3", "interval": "0-65535" } ] @@ -153,7 +154,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -248,13 +249,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -267,15 +266,16 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", - "vsys_id": 11, + "vsys": 5, "is_log": 1, "root_path": "C:/automation_project/tsg_test", "path": "C:/automation_project/tsg_test/tests/ui", "module_name": "service_chaining", "test_case_name": "" } + parameter = replace_paras(parameter) run(parameter) """ # 在测试文件的当前路径执行如下命令执行测试用例: diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_activeip_bfd.py index 01a0899d9..17818b457 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_activeip_bfd.py @@ -152,7 +152,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -247,13 +247,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -266,7 +264,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_activeip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_activeip_none.py index 2c2c9a94e..f1c020a10 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_activeip_none.py @@ -149,7 +149,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -244,13 +244,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -263,7 +261,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_inactiveip_bfd.py index 603eef595..dbd8f0f2a 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_inactiveip_bfd.py @@ -152,7 +152,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -247,13 +247,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -266,7 +264,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_inactiveip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_inactiveip_none.py index 130f327ec..1f38779d5 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_inactiveip_none.py @@ -152,7 +152,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -247,13 +247,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -266,7 +264,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_unavailableip_bfd.py index 06880c3db..3d5b3304f 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_unavailableip_bfd.py @@ -145,7 +145,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -240,13 +240,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -259,7 +257,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_unavailableip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_unavailableip_none.py index 6f07af4c9..09ed5d29b 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_block_vxlan_unavailableip_none.py @@ -152,7 +152,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -247,13 +247,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -266,7 +264,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_disabled_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_disabled_vxlan_activeip_bfd.py index 736d3ab6c..1086d2258 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_disabled_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_disabled_vxlan_activeip_bfd.py @@ -153,7 +153,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -248,13 +248,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -267,7 +265,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vlan_none.py index c614e4f32..35918f2d3 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vlan_none.py @@ -154,7 +154,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -249,13 +249,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -268,7 +266,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_activeip_bfd.py index 27219816e..0254ef498 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_activeip_bfd.py @@ -153,7 +153,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -248,13 +248,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -267,7 +265,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_activeip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_activeip_none.py index 5cd599bf8..ac874d306 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_activeip_none.py @@ -153,7 +153,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -248,13 +248,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -267,7 +265,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_inactiveip_bfd.py index 2104d92fa..3c1237fda 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_inactiveip_bfd.py @@ -153,7 +153,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -248,13 +248,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -267,7 +265,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_inactiveip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_inactiveip_none.py index ddb83c082..eb90d95e1 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_inactiveip_none.py @@ -153,7 +153,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -248,13 +248,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -267,7 +265,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_unavailableip_bfd.py index f7f3b3a31..d628bc889 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_unavailableip_bfd.py @@ -153,7 +153,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -248,13 +248,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -267,7 +265,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_unavailableip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_unavailableip_none.py index 4f46eca7a..f33e650c9 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_mirror_redispatch_bypass_vxlan_unavailableip_none.py @@ -153,7 +153,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -248,13 +248,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -267,7 +265,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_no_sni_false_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_no_sni_false_mirror_bypass_vlan_none.py index 5926f7fb8..7ca91f24e 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_no_sni_false_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_no_sni_false_mirror_bypass_vlan_none.py @@ -160,7 +160,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_no_sni_false_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_no_sni_false_steer_bypass_vxlan_activeip_bfd.py index df8200b22..3f2129095 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_no_sni_false_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_no_sni_false_steer_bypass_vxlan_activeip_bfd.py @@ -159,7 +159,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -254,13 +254,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -273,7 +271,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_activeip_bfd.py index 903990390..087c7d278 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_activeip_bfd.py @@ -146,7 +146,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -241,13 +241,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -260,7 +258,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_activeip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_activeip_none.py index e77abe64d..144e346be 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_activeip_none.py @@ -146,7 +146,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -241,13 +241,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -260,7 +258,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_inactiveip_bfd.py index 7233c4329..7b56bb6a7 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_inactiveip_bfd.py @@ -140,7 +140,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -235,13 +235,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -254,7 +252,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_inactiveip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_inactiveip_none.py index 96253f27f..68833670a 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_inactiveip_none.py @@ -146,7 +146,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -241,13 +241,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -260,7 +258,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_unavailableip_bfd.py index 8d8f3f7b8..105e371de 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_unavailableip_bfd.py @@ -139,7 +139,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -234,13 +234,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -253,7 +251,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_unavailableip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_unavailableip_none.py index 8876efbb3..ca2ad4654 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_block_vxlan_unavailableip_none.py @@ -143,7 +143,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -238,13 +238,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -257,7 +255,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py index 646788bad..0c27bba5c 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -149,7 +149,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -244,13 +244,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -263,7 +261,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_activeip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_activeip_none.py index fdaad1ef4..513bb9cf1 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_activeip_none.py @@ -146,7 +146,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -241,13 +241,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -260,7 +258,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_inactiveip_bfd.py index 2d00cc80f..f44aacd3d 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_inactiveip_bfd.py @@ -140,7 +140,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -235,13 +235,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -254,7 +252,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_inactiveip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_inactiveip_none.py index dff230508..59c7b14e1 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_inactiveip_none.py @@ -146,7 +146,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -241,13 +241,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -260,7 +258,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_unavailableip_bfd.py index b8443a630..d1e1257e2 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_unavailableip_bfd.py @@ -137,7 +137,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -232,13 +232,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -251,7 +249,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_unavailableip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_unavailableip_none.py index a954b3016..507cc244e 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_bypass_vxlan_unavailableip_none.py @@ -144,7 +144,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -239,13 +239,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -258,7 +256,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_activeip_bfd.py index a069c89e7..c8b617320 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_activeip_bfd.py @@ -144,7 +144,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -239,13 +239,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -258,7 +256,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_activeip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_activeip_none.py index 22b709544..a1a60af89 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_activeip_none.py @@ -149,7 +149,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -244,13 +244,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -263,7 +261,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_inactiveip_bfd.py index d12ab3f03..4d97ea328 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_inactiveip_bfd.py @@ -143,7 +143,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -238,13 +238,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -257,7 +255,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_inactiveip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_inactiveip_none.py index e5cdbac6d..ef9db3894 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_inactiveip_none.py @@ -149,7 +149,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -244,13 +244,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -263,7 +261,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_unavailableip_bfd.py index c57e155db..0a5498b38 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_unavailableip_bfd.py @@ -144,7 +144,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -239,13 +239,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -258,7 +256,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_unavailableip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_unavailableip_none.py index dab711cac..183dea0d8 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_block_vxlan_unavailableip_none.py @@ -146,7 +146,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -241,13 +241,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -260,7 +258,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_activeip_bfd.py index dd5786d3a..d0850bb37 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_activeip_bfd.py @@ -144,7 +144,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -239,13 +239,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -258,7 +256,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_activeip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_activeip_none.py index 2ab5af66c..cf3a3f7eb 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_activeip_none.py @@ -150,7 +150,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -245,13 +245,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -264,7 +262,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_inactiveip_bfd.py index bc97dd5ba..6fffdfff4 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_inactiveip_bfd.py @@ -144,7 +144,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -239,13 +239,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -258,7 +256,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_inactiveip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_inactiveip_none.py index f4e002e58..3b4e4762f 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_inactiveip_none.py @@ -150,7 +150,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -245,13 +245,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -264,7 +262,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_unavailableip_bfd.py index 599a2a253..63ae19965 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_unavailableip_bfd.py @@ -146,7 +146,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -241,13 +241,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -260,7 +258,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_unavailableip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_unavailableip_none.py index 0012eaffb..bf73c730c 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_fqdn_ssl_steer_redispatch_bypass_vxlan_unavailableip_none.py @@ -147,7 +147,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -242,13 +242,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -261,7 +259,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_ftp_account_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_ftp_account_mirror_bypass_vlan_none.py index 86ccef492..1344af48b 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_ftp_account_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_ftp_account_mirror_bypass_vlan_none.py @@ -147,7 +147,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -241,13 +241,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -260,7 +258,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_ftp_account_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_ftp_account_steer_bypass_vxlan_activeip_bfd.py index eb215d9d1..f3c7eb3f3 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_ftp_account_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_ftp_account_steer_bypass_vxlan_activeip_bfd.py @@ -144,7 +144,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -238,13 +238,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -257,7 +255,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_ipprototcp_ftp_account_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_ipprototcp_ftp_account_steer_bypass_vxlan_activeip_bfd.py index 3bedc15ce..59cf265d5 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_ipprototcp_ftp_account_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_ipprototcp_ftp_account_steer_bypass_vxlan_activeip_bfd.py @@ -155,7 +155,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -251,13 +251,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -270,7 +268,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_ipprotoudp_dns_qname_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_ipprotoudp_dns_qname_steer_bypass_vxlan_activeip_bfd.py index 0d3b1514d..842b56e2e 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_ipprotoudp_dns_qname_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_ipprotoudp_dns_qname_steer_bypass_vxlan_activeip_bfd.py @@ -159,7 +159,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -255,13 +255,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -274,7 +272,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_mail_from_to_account_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_mail_from_to_account_mirror_bypass_vlan_none.py index dbaea128a..11e3376f2 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_mail_from_to_account_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_mail_from_to_account_mirror_bypass_vlan_none.py @@ -186,7 +186,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -281,13 +281,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -300,7 +298,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_mail_from_to_account_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_mail_from_to_account_steer_bypass_vxlan_activeip_bfd.py index 38bd9ecb3..a87e5b22c 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_mail_from_to_account_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_mail_from_to_account_steer_bypass_vxlan_activeip_bfd.py @@ -180,7 +180,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -275,13 +275,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -294,7 +292,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_mirror_block_vxlan_activeip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_mirror_block_vxlan_activeip_none.py index 9cbb816a6..8f7a4cb4b 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_mirror_block_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_mirror_block_vxlan_activeip_none.py @@ -118,7 +118,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -213,13 +213,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -232,7 +230,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_mirror_bypass_disabled_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_mirror_bypass_disabled_vxlan_activeip_bfd.py index ef926c6fa..3174b6376 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_mirror_bypass_disabled_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_mirror_bypass_disabled_vxlan_activeip_bfd.py @@ -116,7 +116,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -211,13 +211,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -230,7 +228,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_mirror_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_mirror_bypass_vxlan_activeip_bfd.py index 59c8c55e5..9f64ba0c1 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_mirror_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_mirror_bypass_vxlan_activeip_bfd.py @@ -116,7 +116,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -211,13 +211,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -230,7 +228,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_mirror_bypass_vxlan_activeip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_mirror_bypass_vxlan_activeip_none.py index 7d9818adf..c1b217ec0 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_mirror_bypass_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_mirror_bypass_vxlan_activeip_none.py @@ -118,7 +118,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -213,13 +213,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -232,7 +230,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_multiple_port_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_multiple_port_mirror_bypass_vlan_none.py index 2702af36c..9967f3282 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_multiple_port_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_multiple_port_mirror_bypass_vlan_none.py @@ -190,7 +190,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -287,13 +287,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -307,7 +305,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_negate_dstport_dns_qname_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_negate_dstport_dns_qname_mirror_bypass_vlan_none.py index 571e1cab3..e50f6af13 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_negate_dstport_dns_qname_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_negate_dstport_dns_qname_mirror_bypass_vlan_none.py @@ -167,7 +167,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -264,13 +264,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -283,7 +281,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_negate_dstport_dns_qname_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_negate_dstport_dns_qname_steer_bypass_vxlan_activeip_bfd.py index aa8b38b28..fb7eaaf15 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_negate_dstport_dns_qname_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_negate_dstport_dns_qname_steer_bypass_vxlan_activeip_bfd.py @@ -166,7 +166,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -263,13 +263,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -282,8 +280,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", - "debug_flag":"local", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_negate_fqdn_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_negate_fqdn_ssl_mirror_bypass_vlan_none.py index 1e43cd0ff..00ae85056 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_negate_fqdn_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_negate_fqdn_ssl_mirror_bypass_vlan_none.py @@ -150,7 +150,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -245,13 +245,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -264,7 +262,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_negate_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_negate_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py index b0320be12..8b6755c88 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_negate_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_negate_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -149,7 +149,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -244,13 +244,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -263,7 +261,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_openvpn_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_openvpn_mirror_bypass_vlan_none.py index e8fe5053a..745d2b739 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_openvpn_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_openvpn_mirror_bypass_vlan_none.py @@ -132,7 +132,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -227,13 +227,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -246,7 +244,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_openvpn_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_openvpn_steer_bypass_vxlan_activeip_bfd.py index 9f819caac..c2a5e2fa8 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_openvpn_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_openvpn_steer_bypass_vxlan_activeip_bfd.py @@ -131,7 +131,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -227,13 +227,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -246,7 +244,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_quic_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_quic_mirror_bypass_vlan_none.py index 44722e075..33fb31809 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_quic_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_quic_mirror_bypass_vlan_none.py @@ -131,7 +131,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -226,13 +226,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -245,7 +243,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_quic_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_quic_steer_bypass_vxlan_activeip_bfd.py index 46c58509a..2bb325abb 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_quic_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_quic_steer_bypass_vxlan_activeip_bfd.py @@ -130,7 +130,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -225,13 +225,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -244,7 +242,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_rdp_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_rdp_mirror_bypass_vlan_none.py index 8c3425752..fdd0eb4f9 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_rdp_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_rdp_mirror_bypass_vlan_none.py @@ -132,7 +132,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -227,13 +227,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -246,7 +244,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_rdp_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_rdp_steer_bypass_vxlan_activeip_bfd.py index b6acef864..76fb405ed 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_rdp_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_rdp_steer_bypass_vxlan_activeip_bfd.py @@ -131,7 +131,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -226,13 +226,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -245,7 +243,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_ssl_esni_true_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_ssl_esni_true_mirror_bypass_vlan_none.py index 026c58695..886db334a 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_ssl_esni_true_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_ssl_esni_true_mirror_bypass_vlan_none.py @@ -142,7 +142,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -238,13 +238,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -257,7 +255,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_ssl_esni_true_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_ssl_esni_true_steer_bypass_vxlan_activeip_bfd.py index 006df99dc..96e5420eb 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_ssl_esni_true_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_ssl_esni_true_steer_bypass_vxlan_activeip_bfd.py @@ -141,7 +141,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -237,13 +237,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -256,7 +254,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vlan_none.py index d2a770438..1a5a1add9 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vlan_none.py @@ -130,7 +130,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -225,13 +225,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -244,7 +242,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_activeip_bfd.py index e8566558f..3455c3ad7 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_activeip_bfd.py @@ -122,7 +122,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -217,13 +217,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -236,7 +234,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_activeip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_activeip_none.py index 5d0eda8d9..eea1a8a24 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_activeip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_activeip_none.py @@ -128,7 +128,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -223,13 +223,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -242,7 +240,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_inactiveip_bfd.py index d233e7134..92a589aa6 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_inactiveip_bfd.py @@ -122,7 +122,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -217,13 +217,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -236,7 +234,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_inactiveip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_inactiveip_none.py index d1e925cc4..78c079aae 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_inactiveip_none.py @@ -129,7 +129,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -224,13 +224,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -243,7 +241,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_unavailableip_bfd.py index acbda2f5e..cc7fd93d0 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_unavailableip_bfd.py @@ -119,7 +119,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -214,13 +214,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -233,7 +231,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_unavailableip_none.py b/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_unavailableip_none.py index 8d6eb7be4..aa4093f58 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_block_vxlan_unavailableip_none.py @@ -125,7 +125,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -220,13 +220,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -239,7 +237,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 5, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_bypass_disabled_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_bypass_disabled_vlan_none.py index 2a0b3bcfa..838e3822a 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_bypass_disabled_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_bypass_disabled_vlan_none.py @@ -130,7 +130,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -225,13 +225,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -244,7 +242,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_bypass_vlan_none.py index 27e4fa488..ce00e0842 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_ssl_mirror_bypass_vlan_none.py @@ -132,7 +132,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -227,13 +227,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -246,7 +244,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_ssl_no_sni_true_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstip_ssl_no_sni_true_mirror_bypass_vlan_none.py index d9ff24649..f250bb816 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_ssl_no_sni_true_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_ssl_no_sni_true_mirror_bypass_vlan_none.py @@ -142,7 +142,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -237,13 +237,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -256,7 +254,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_ssl_no_sni_true_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_ssl_no_sni_true_steer_bypass_vxlan_activeip_bfd.py index 0956e0264..e636514bf 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_ssl_no_sni_true_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_ssl_no_sni_true_steer_bypass_vxlan_activeip_bfd.py @@ -141,7 +141,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -236,13 +236,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -255,7 +253,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_steer_bypass_disabled_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_steer_bypass_disabled_vxlan_activeip_bfd.py index c4aa13c4a..d153c17d5 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_steer_bypass_disabled_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_steer_bypass_disabled_vxlan_activeip_bfd.py @@ -115,7 +115,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -210,13 +210,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -229,7 +227,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_steer_bypass_vxlan_activeip_bfd.py index 1ef905a0d..42820e307 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_steer_bypass_vxlan_activeip_bfd.py @@ -112,7 +112,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -207,13 +207,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -226,7 +224,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_compliance_risk_library_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_compliance_risk_library_http_url_steer_bypass_vxlan_activeip_bfd.py index 93603d455..c31fe77be 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_compliance_risk_library_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_compliance_risk_library_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -176,7 +176,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -271,13 +271,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -290,7 +288,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_geoip_asn_library_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_geoip_asn_library_http_url_steer_bypass_vxlan_activeip_bfd.py index 3b42930fe..bdf4fffc1 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_geoip_asn_library_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_geoip_asn_library_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -183,7 +183,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -278,13 +278,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -297,7 +295,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_internet_geoip_country_library_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_internet_geoip_country_library_http_url_steer_bypass_vxlan_activeip_bfd.py index 6a0013412..41732d811 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_internet_geoip_country_library_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_internet_geoip_country_library_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -177,7 +177,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -272,13 +272,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -291,7 +289,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_internet_service_library_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_internet_service_library_http_url_steer_bypass_vxlan_activeip_bfd.py index b174b7740..92f71829d 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_internet_service_library_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_internet_service_library_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -176,7 +176,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -271,13 +271,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -290,7 +288,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_library_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_library_http_url_steer_bypass_vxlan_activeip_bfd.py index 1eb5b3a9c..87f688ddd 100644 --- a/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_library_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstip_suff_fqdn_library_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -182,7 +182,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -277,13 +277,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -296,7 +294,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstport_external_port_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstport_external_port_steer_bypass_vxlan_activeip_bfd.py index 33e8de183..49c3b2692 100644 --- a/tests/service_chaining/sc_raw_srcip_dstport_external_port_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstport_external_port_steer_bypass_vxlan_activeip_bfd.py @@ -135,7 +135,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -231,13 +231,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -251,7 +249,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstport_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstport_mirror_bypass_vlan_none.py index ef47e32d3..7f90b275f 100644 --- a/tests/service_chaining/sc_raw_srcip_dstport_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstport_mirror_bypass_vlan_none.py @@ -119,7 +119,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -214,13 +214,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -234,7 +232,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstport_range_external_port_range_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_dstport_range_external_port_range_mirror_bypass_vlan_none.py index 9ede8663c..460931e47 100644 --- a/tests/service_chaining/sc_raw_srcip_dstport_range_external_port_range_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_dstport_range_external_port_range_mirror_bypass_vlan_none.py @@ -137,7 +137,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -232,13 +232,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -252,7 +250,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dstport_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_dstport_steer_bypass_vxlan_activeip_bfd.py index 97fb8b248..f02df52f4 100644 --- a/tests/service_chaining/sc_raw_srcip_dstport_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dstport_steer_bypass_vxlan_activeip_bfd.py @@ -118,7 +118,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -214,13 +214,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -234,7 +232,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_dtsip_mirror_bypass_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_raw_srcip_dtsip_mirror_bypass_vxlan_inactiveip_bfd.py index 86f0722f5..7469ff8aa 100644 --- a/tests/service_chaining/sc_raw_srcip_dtsip_mirror_bypass_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_dtsip_mirror_bypass_vxlan_inactiveip_bfd.py @@ -113,7 +113,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -208,13 +208,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -227,7 +225,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_fqdn_ipprototcp_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_fqdn_ipprototcp_ssl_steer_bypass_vxlan_activeip_bfd.py index 5ff23f7dc..0aa47f42e 100644 --- a/tests/service_chaining/sc_raw_srcip_fqdn_ipprototcp_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_fqdn_ipprototcp_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -137,7 +137,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -233,13 +233,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -252,7 +250,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_fqdn_ssl_steer_block_disabled_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_fqdn_ssl_steer_block_disabled_vxlan_activeip_bfd.py index 71828258a..6e5b4c2f0 100644 --- a/tests/service_chaining/sc_raw_srcip_fqdn_ssl_steer_block_disabled_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_fqdn_ssl_steer_block_disabled_vxlan_activeip_bfd.py @@ -128,7 +128,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -223,13 +223,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -242,7 +240,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_fqdn_ssl_steer_bypass_disabled_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_fqdn_ssl_steer_bypass_disabled_vxlan_activeip_bfd.py index d63ab14da..0263e52ac 100644 --- a/tests/service_chaining/sc_raw_srcip_fqdn_ssl_steer_bypass_disabled_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_fqdn_ssl_steer_bypass_disabled_vxlan_activeip_bfd.py @@ -127,7 +127,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -222,13 +222,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -241,7 +239,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_fqdn_ssl_steer_global_bypass_diff_device_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_fqdn_ssl_steer_global_bypass_diff_device_vxlan_activeip_bfd.py index 6e7847c8c..fde2a8c8c 100644 --- a/tests/service_chaining/sc_raw_srcip_fqdn_ssl_steer_global_bypass_diff_device_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_fqdn_ssl_steer_global_bypass_diff_device_vxlan_activeip_bfd.py @@ -125,7 +125,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -220,13 +220,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -239,7 +237,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_fqdn_ssl_steer_nearby_bypass_diff_device_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_fqdn_ssl_steer_nearby_bypass_diff_device_vxlan_activeip_bfd.py index 6203c8482..ccb48bfe4 100644 --- a/tests/service_chaining/sc_raw_srcip_fqdn_ssl_steer_nearby_bypass_diff_device_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_fqdn_ssl_steer_nearby_bypass_diff_device_vxlan_activeip_bfd.py @@ -124,7 +124,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -219,13 +219,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -238,7 +236,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.64.91", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_internal_port_range_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_internal_port_range_mirror_bypass_vlan_none.py index b22cda42f..855a5c353 100644 --- a/tests/service_chaining/sc_raw_srcip_internal_port_range_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_internal_port_range_mirror_bypass_vlan_none.py @@ -118,7 +118,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -214,13 +214,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -234,7 +232,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_internal_port_range_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_internal_port_range_steer_bypass_vxlan_activeip_bfd.py index 777b48afe..5763c79ed 100644 --- a/tests/service_chaining/sc_raw_srcip_internal_port_range_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_internal_port_range_steer_bypass_vxlan_activeip_bfd.py @@ -117,7 +117,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -213,13 +213,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -233,7 +231,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_mirror_block_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_raw_srcip_mirror_block_vxlan_inactiveip_bfd.py index 8b25b9911..8a199d407 100644 --- a/tests/service_chaining/sc_raw_srcip_mirror_block_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_mirror_block_vxlan_inactiveip_bfd.py @@ -101,7 +101,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -196,13 +196,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -215,7 +213,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_mirror_block_vxlan_inactiveip_none.py b/tests/service_chaining/sc_raw_srcip_mirror_block_vxlan_inactiveip_none.py index 9a6196391..4846f7166 100644 --- a/tests/service_chaining/sc_raw_srcip_mirror_block_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_raw_srcip_mirror_block_vxlan_inactiveip_none.py @@ -129,7 +129,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -224,13 +224,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -243,7 +241,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_mirror_block_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_raw_srcip_mirror_block_vxlan_unavailableip_bfd.py index c9e9c0cd3..2afb209af 100644 --- a/tests/service_chaining/sc_raw_srcip_mirror_block_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_mirror_block_vxlan_unavailableip_bfd.py @@ -101,7 +101,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -196,13 +196,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -215,7 +213,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_mirror_block_vxlan_unavailableip_none.py b/tests/service_chaining/sc_raw_srcip_mirror_block_vxlan_unavailableip_none.py index 86b7dc40b..e4497d01c 100644 --- a/tests/service_chaining/sc_raw_srcip_mirror_block_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_raw_srcip_mirror_block_vxlan_unavailableip_none.py @@ -101,7 +101,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -215,7 +215,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_mirror_bypass_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_raw_srcip_mirror_bypass_vxlan_unavailableip_bfd.py index 3e5946f54..8840cb1f7 100644 --- a/tests/service_chaining/sc_raw_srcip_mirror_bypass_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_mirror_bypass_vxlan_unavailableip_bfd.py @@ -99,7 +99,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -194,13 +194,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -213,7 +211,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_mirror_redispatch_block_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_raw_srcip_mirror_redispatch_block_vxlan_inactiveip_bfd.py index 9b23a4e33..f749f9d94 100644 --- a/tests/service_chaining/sc_raw_srcip_mirror_redispatch_block_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_mirror_redispatch_block_vxlan_inactiveip_bfd.py @@ -104,7 +104,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -199,13 +199,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -218,7 +216,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_negate_dstip_fqdn_ssl_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_negate_dstip_fqdn_ssl_mirror_bypass_vlan_none.py index 126daed44..7c3fe8e27 100644 --- a/tests/service_chaining/sc_raw_srcip_negate_dstip_fqdn_ssl_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_negate_dstip_fqdn_ssl_mirror_bypass_vlan_none.py @@ -150,7 +150,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -245,13 +245,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -264,7 +262,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_negate_dstip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_negate_dstip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py index 98ed77b30..5cd556fd2 100644 --- a/tests/service_chaining/sc_raw_srcip_negate_dstip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_negate_dstip_fqdn_ssl_steer_bypass_vxlan_activeip_bfd.py @@ -149,7 +149,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -244,13 +244,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -263,7 +261,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_negate_srcport_range_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcip_negate_srcport_range_mirror_bypass_vlan_none.py index 3d7101d85..149c5f122 100644 --- a/tests/service_chaining/sc_raw_srcip_negate_srcport_range_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcip_negate_srcport_range_mirror_bypass_vlan_none.py @@ -119,7 +119,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -214,13 +214,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -234,7 +232,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_negate_srcport_range_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcip_negate_srcport_range_steer_bypass_vxlan_activeip_bfd.py index f1ec9d575..149c5f122 100644 --- a/tests/service_chaining/sc_raw_srcip_negate_srcport_range_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_negate_srcport_range_steer_bypass_vxlan_activeip_bfd.py @@ -119,7 +119,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -214,13 +214,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -234,7 +232,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "api", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_steer_block_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_raw_srcip_steer_block_vxlan_inactiveip_bfd.py index cfecdb0e6..f93332d14 100644 --- a/tests/service_chaining/sc_raw_srcip_steer_block_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_steer_block_vxlan_inactiveip_bfd.py @@ -99,7 +99,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -194,13 +194,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -213,7 +211,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_steer_block_vxlan_inactiveip_none.py b/tests/service_chaining/sc_raw_srcip_steer_block_vxlan_inactiveip_none.py index c729dcbe3..ecaf71fb8 100644 --- a/tests/service_chaining/sc_raw_srcip_steer_block_vxlan_inactiveip_none.py +++ b/tests/service_chaining/sc_raw_srcip_steer_block_vxlan_inactiveip_none.py @@ -99,7 +99,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -194,13 +194,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -213,7 +211,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_steer_block_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_raw_srcip_steer_block_vxlan_unavailableip_bfd.py index ea9e0eed9..f4e9fc752 100644 --- a/tests/service_chaining/sc_raw_srcip_steer_block_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_steer_block_vxlan_unavailableip_bfd.py @@ -99,7 +99,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -194,13 +194,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -213,7 +211,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_steer_block_vxlan_unavailableip_none.py b/tests/service_chaining/sc_raw_srcip_steer_block_vxlan_unavailableip_none.py index db36babfe..488a328fb 100644 --- a/tests/service_chaining/sc_raw_srcip_steer_block_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_raw_srcip_steer_block_vxlan_unavailableip_none.py @@ -99,7 +99,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -194,13 +194,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -213,7 +211,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_steer_bypass_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_raw_srcip_steer_bypass_vxlan_inactiveip_bfd.py index 32b5626a2..2c4caa9bc 100644 --- a/tests/service_chaining/sc_raw_srcip_steer_bypass_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_steer_bypass_vxlan_inactiveip_bfd.py @@ -99,7 +99,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -194,13 +194,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -213,7 +211,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_steer_bypass_vxlan_unavailableip_bfd.py b/tests/service_chaining/sc_raw_srcip_steer_bypass_vxlan_unavailableip_bfd.py index 1585a1bb2..c0d680a0e 100644 --- a/tests/service_chaining/sc_raw_srcip_steer_bypass_vxlan_unavailableip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_steer_bypass_vxlan_unavailableip_bfd.py @@ -99,7 +99,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -194,13 +194,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -213,7 +211,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_steer_bypass_vxlan_unavailableip_none.py b/tests/service_chaining/sc_raw_srcip_steer_bypass_vxlan_unavailableip_none.py index 1211f27de..1fa714676 100644 --- a/tests/service_chaining/sc_raw_srcip_steer_bypass_vxlan_unavailableip_none.py +++ b/tests/service_chaining/sc_raw_srcip_steer_bypass_vxlan_unavailableip_none.py @@ -99,7 +99,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -194,13 +194,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -213,7 +211,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_steer_redispatch_block_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_raw_srcip_steer_redispatch_block_vxlan_inactiveip_bfd.py index f42ea0d5d..d156bbb4b 100644 --- a/tests/service_chaining/sc_raw_srcip_steer_redispatch_block_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_steer_redispatch_block_vxlan_inactiveip_bfd.py @@ -102,7 +102,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -197,13 +197,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -216,7 +214,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcip_steer_redispatch_bypass_vxlan_inactiveip_bfd.py b/tests/service_chaining/sc_raw_srcip_steer_redispatch_bypass_vxlan_inactiveip_bfd.py index 30ef2df9e..6ad0e5bdb 100644 --- a/tests/service_chaining/sc_raw_srcip_steer_redispatch_bypass_vxlan_inactiveip_bfd.py +++ b/tests/service_chaining/sc_raw_srcip_steer_redispatch_bypass_vxlan_inactiveip_bfd.py @@ -103,7 +103,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -198,13 +198,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -217,7 +215,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 11, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcport_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcport_mirror_bypass_vlan_none.py index 2555336a5..7fe8f46c6 100644 --- a/tests/service_chaining/sc_raw_srcport_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcport_mirror_bypass_vlan_none.py @@ -98,7 +98,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -194,13 +194,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -214,7 +212,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcport_range_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_srcport_range_mirror_bypass_vlan_none.py index 6c039f53b..b763d46dc 100644 --- a/tests/service_chaining/sc_raw_srcport_range_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_srcport_range_mirror_bypass_vlan_none.py @@ -98,7 +98,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -194,13 +194,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -214,7 +212,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcport_range_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcport_range_steer_bypass_vxlan_activeip_bfd.py index 18e70e54c..9a188cd73 100644 --- a/tests/service_chaining/sc_raw_srcport_range_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcport_range_steer_bypass_vxlan_activeip_bfd.py @@ -105,7 +105,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -201,13 +201,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -221,7 +219,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_srcport_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_srcport_steer_bypass_vxlan_activeip_bfd.py index 8fc71359d..473138348 100644 --- a/tests/service_chaining/sc_raw_srcport_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_srcport_steer_bypass_vxlan_activeip_bfd.py @@ -93,7 +93,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -189,13 +189,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() @@ -209,7 +207,7 @@ if __name__ == '__main__': "test_pc_ip": "192.168.50.88", "test_subcriber_id": "test6776", "api_server": "http://192.168.44.72", - "script_type": "ui", + "initiation_method": "api", "env": "tsgx", "vsys_id": 1, "is_log": 1, diff --git a/tests/service_chaining/sc_raw_subid_fqdn_http_url_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_subid_fqdn_http_url_mirror_bypass_vlan_none.py index c8035a9da..58f0a5819 100644 --- a/tests/service_chaining/sc_raw_subid_fqdn_http_url_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_subid_fqdn_http_url_mirror_bypass_vlan_none.py @@ -145,7 +145,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -245,13 +245,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() diff --git a/tests/service_chaining/sc_raw_subid_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_subid_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 3aaa1d8ff..a34873741 100644 --- a/tests/service_chaining/sc_raw_subid_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_subid_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -144,7 +144,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -244,13 +244,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() diff --git a/tests/service_chaining/sc_raw_subid_imei_apn_fqdn_http_url_mirror_bypass_vlan_none.py b/tests/service_chaining/sc_raw_subid_imei_apn_fqdn_http_url_mirror_bypass_vlan_none.py index 92dbc3f9c..6eef4892a 100644 --- a/tests/service_chaining/sc_raw_subid_imei_apn_fqdn_http_url_mirror_bypass_vlan_none.py +++ b/tests/service_chaining/sc_raw_subid_imei_apn_fqdn_http_url_mirror_bypass_vlan_none.py @@ -182,7 +182,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -282,13 +282,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() diff --git a/tests/service_chaining/sc_raw_subid_imei_apn_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py b/tests/service_chaining/sc_raw_subid_imei_apn_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py index 333ce4530..0e70ec19b 100644 --- a/tests/service_chaining/sc_raw_subid_imei_apn_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py +++ b/tests/service_chaining/sc_raw_subid_imei_apn_fqdn_http_url_steer_bypass_vxlan_activeip_bfd.py @@ -181,7 +181,7 @@ def run(parameter): verification_result = { "excepted_traffic_result": "", - "expected_metric": "", + "expected_metric": {"hits": 1}, "expected_log": [ {"query_field_key": "sc_rsp_raw", "query_value": ""}, {"query_field_key": "sent_pkts", "query_value": ""}, @@ -281,13 +281,11 @@ def run(parameter): if profiles_tuple: api_client.delete_profiles(profiles_tuple) - # 统计脚本用时 - end_time = time.time() - duration = end_time - start_time - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Duration of running the test case: ", "{:.3f}".format(duration), flush=True) - print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], - "Finish test case: " + parameter["test_case_name"], flush=True) + # 脚本结束时间和耗时 + script_end_time = time.time() + duration = script_end_time - script_start_time + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Duration of running the test case: ", "{:.3f}".format(duration), flush=True) + print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3],"Finish test case: " + parameter["test_case_name"], flush=True) # 生成csv报告 update = ReportUpdate() |
