def _get_iteration_syslist(self, system_node_list, system_name_list):
        """
        Process the initial system_list and remove the systems
        that do not have iter=yes.
        """
        iteration_syslist = []
        for i in range(0, len(system_node_list)):
            system = system_node_list[i]
            iter_flag = system.get("iter", None)
            if iter_flag is None:
                iter_flag = xml_Utils.get_text_from_direct_child(
                    system, "iter")
            iter_flag = data_Utils.sub_from_env_var(iter_flag)

            if str(iter_flag).lower() == "no":
                pass
            else:
                system_name = system_name_list[i]
                if not system_name:
                    pNote("No name provided for system/susbsystem in datafile",
                          "error")
                else:
                    iteration_syslist.append(system_name)

        return iteration_syslist
def get_browser_details(browser,
                        datafile,
                        br_name="browser_name",
                        def_name_tuple=("DEF_ecf", "DEF_et"),
                        **kwargs):

    # Gets all tags from the data file and adds it to idf_data_dict.
    # kwargs remains intact

    final_dict, idf_data_dict = split_kwargs_on_tag_equalto(
        kwargs, datafile, browser)

    # Gets all default tags from the data file and adds it to idf_data_dict.
    # idf_data_dict maintains all the data gotten from the data file
    idf_data_dict = get_default_tags_from_datafile(kwargs, idf_data_dict,
                                                   browser)

    final_dict.update(idf_data_dict)

    # gets mappings of all elements
    mapper = get_mappers_for_all_elements(final_dict, def_name_tuple)

    mapper_list = get_mapped_to_elements(mapper)

    # final_dict updated to contain only element values and no mappings
    final_dict = update_final_dict_to_have_no_mappings(final_dict)

    # All mapping dependent values get updated from json file
    for element in final_dict:
        if element not in mapper_list:
            final_dict = get_final_json_values(element, final_dict, mapper,
                                               def_name_tuple)

    # All the mapped-to elements get updated from the json file
    for element in final_dict:
        if element in mapper_list:
            final_dict = get_final_json_values(element, final_dict, mapper,
                                               def_name_tuple)

    # since data file has priority, vales from data file get imposed on the
    # json values
    for element in final_dict:
        if element in idf_data_dict and idf_data_dict[
                element] is not None and idf_data_dict[element] is not False:
            final_dict[element] = idf_data_dict[element]

    # Finally, if arguments are still None, the defaults and alues from the
    # testcases are applied
    for element in final_dict:
        if final_dict[element] is None:
            if element in kwargs:
                final_dict[element] = kwargs[element]

    # Browser name matching
    if kwargs[br_name] != "all" and final_dict[br_name] != kwargs[br_name]:
        return None

    final_dict = data_Utils.sub_from_env_var(final_dict)

    return final_dict
    def cmp_response(self,
                     response,
                     expected_api_response,
                     expected_response_type,
                     output_file,
                     generate_output_diff_file=True):
        """
            Performs the comparison between api response
            and expected_api_response

            arguments:
              1.response: API response getting from the data repository
              2.expected_api_response : expected response which needs
              to be compared given by the user.
              3.expected_response_type: The type of the expected response.
              It can be xml or json or text.
              4.output_file: The file in which the difference will be written
              if the responses are not equal.
              5.generate_output_diff_file: If the responses does not match,
              then generates an output file by writing the difference
              to the file by default and if it set to False then doesnot
              generate any file.
            returns:
                Returns True if the response matches with
                the expected response else False.
        """
        if response is not None and expected_api_response is not None:
            if expected_response_type in response.headers['Content-Type']:
                extracted_response = response.content
                extension = Utils.rest_Utils.get_extension_from_path(
                    expected_api_response)
                if 'xml' in response.headers['Content-Type']:
                    try:
                        f = open(expected_api_response, 'r')
                    except IOError as exception:
                        if ".xml" == extension:
                            pNote(
                                "File does not exist in the"
                                " provided file path", "error")
                            return False
                    status, sorted_file1, sorted_file2, output_file = \
                    Utils.xml_Utils.compare_xml(extracted_response, expected_api_response,
                                                output_file, sorted_json=False)

                elif 'json' in response.headers['Content-Type']:
                    try:
                        expected_api_response = JSON.load(
                            open(expected_api_response, 'r'))
                        for key, value in expected_api_response.items():
                            # replacing the environment/repo variable with value in the verify json
                            dict_key_value = {key: value}
                            env_out = data_Utils.sub_from_env_var(
                                dict_key_value)
                            details_dict = data_Utils.sub_from_data_repo(
                                dict_key_value)
                            expected_api_response[key] = env_out[key]
                            expected_api_response[key] = details_dict[key]
                    except IOError as exception:
                        if ".json" == extension:
                            pNote(
                                "File does not exist in the"
                                " provided file path", "error")
                            return False
                        expected_api_response = JSON.loads(
                            expected_api_response)
                    extracted_response = JSON.loads(extracted_response)
                    status = self.json_utils.write_json_diff_to_file(
                        extracted_response, expected_api_response, output_file)

                elif 'text' in response.headers['Content-Type']:
                    try:
                        f = open(expected_api_response, 'r')
                        expected_api_response = f.read()
                        f.close()
                    except IOError as exception:
                        if ".txt" == extension:
                            pNote(
                                "File does not exist in the"
                                " provided file path", "error")
                            return False
                    status = Utils.string_Utils.text_compare(
                        extracted_response, expected_api_response, output_file)
                if not status:
                    if not generate_output_diff_file:
                        os.remove(output_file)
                    else:
                        pNote(
                            "api_response and expected_api_response do not match",
                            "error")
                        pNote(
                            "The difference between the responses is saved here:{0}"
                            .format(output_file), "info")
                return status
            else:
                type_of_response = Utils.rest_Utils.\
                get_type_of_api_response(response)
                pNote(
                    "Expected response type is {0}".format(
                        expected_response_type), "info")
                pNote("API response type is {0}".format(type_of_response),
                      "info")
                pNote(
                    "api_response and expected_api_response"
                    " types do not match", "error")
                return False
        else:
            return False