def get_base_arguments(parser):
    """
    Append base arguments icetea run arguments to parser.

    :param parser: argument parser
    :return: ArgumentParser
    """
    thisfilepath = os.path.abspath(os.path.dirname(__file__))
    group = parser.add_mutually_exclusive_group(required=False)
    group.add_argument('--list',
                       action='store_true',
                       help='List of available testcases(nothing else)',
                       default=False)
    group.add_argument('--listsuites',
                       action='store_true',
                       help='List of available suites',
                       default=False)
    group.add_argument('--tc',
                       help='execute testcase. Give test index, name, list of indices/'
                            'names, or all to execute all testcases',
                       default=False)
    group.add_argument('--suite',
                       default=False,
                       help='Run tests from suite json file <suite>. Can be absolute path to '
                            'suite file or path relative to --suitedir.')
    group.add_argument('--version',
                       action='store_true',
                       default=False,
                       help='Show version')

    # Filters
    filter_group = parser.add_argument_group("Filter arguments", "Arguments used for filtering "
                                                                 "tc:s")
    filter_group.add_argument('--status', default=False,
                              help='Run all testcases with status <status>')
    filter_group.add_argument('--group',
                              default=False,
                              help='Run all testcases that have all items '
                                   'in <group/subgroup> or <group,group2> in their group path.')
    filter_group.add_argument('--testtype',
                              default=False,
                              help='Run all testcases with type <testtype>')
    filter_group.add_argument('--subtype',
                              default=False,
                              help="Run all testcases with subtype <subtype")
    filter_group.add_argument('--component',
                              default=False,
                              help='Run all testcases with component <component>')
    filter_group.add_argument('--feature',
                              default=False,
                              help='Run all testcases with feature <feature>')
    filter_group.add_argument("--platform_filter",
                              default=False,
                              help="Run all testcases that allow platform <platform_filter>")

    # JobId is BUILD_TAG (from Jenkins job), or generated UUID or command line argument value
    info_group = parser.add_argument_group("Run information", "Information of run, such as job "
                                                              "id and git or build information.")
    info_group.add_argument('--jobId',
                            default=os.environ.get('BUILD_TAG', str(uuid.uuid1())),
                            help='Job Unique ID')
    info_group.add_argument('--gitUrl',
                            default=os.environ.get('ghprbAuthorRepoGitUrl', None),
                            help='Set application used git url for results')
    info_group.add_argument('--branch',
                            default=os.environ.get('GIT_BRANCH', 'master'),
                            help='Set used build branch for results')
    info_group.add_argument('--commitId',
                            default=os.environ.get('ghprbActualCommit', None),
                            help='Set used commit ID for results')
    info_group.add_argument('--buildDate',
                            default=None,
                            help='Set build date')
    info_group.add_argument('--toolchain',
                            default=None,
                            help='Set toolchain for results')
    info_group.add_argument('--buildUrl',
                            default=os.environ.get('BUILD_URL', None),
                            help='Set build url for results')
    info_group.add_argument('--campaign',
                            default=os.environ.get('JOB_NAME', None),
                            help='Set campaign name for results')

    # Directories and paths
    directories = parser.add_argument_group("Paths", "Directory and file paths for various "
                                                     "Icetea features.")
    directories.add_argument('--tcdir',
                             help='Search for testcases in directory <path>',
                             default='./testcases')
    directories.add_argument('--suitedir',
                             help='Search for suites in directory <path>',
                             default='./testcases/suites')
    directories.add_argument("--cfg_file",
                             type=open,
                             default=None,
                             help="Load cli parameters from file. "
                                  "This will overwrite parameters given before --cfg_file, but "
                                  "results of this will be overwritten by "
                                  "parameters given after this one",
                             action=LoadFromFile)

    directories.add_argument('--plugin_path',
                             default=os.path.abspath(
                                 os.path.join(thisfilepath,
                                              "Plugin/plugins/plugins_to_load")),
                             help="location of file called plugins_to_load, "
                                  "where custom plugins are imported from.")

    # Allocator group
    alloc_group = parser.add_argument_group("Allocator", "Control allocation of resources for "
                                                         "tests.")
    alloc_group.add_argument("--allocator",
                             default="LocalAllocator",
                             help="Allocator to be used for allocating resources. "
                                  "Default is LocalAllocator")
    alloc_group.add_argument("--allocator_cfg",
                             help="File that contains configuration for used allocator.",
                             default=None)

    # Other arguments
    parser.add_argument('--env_cfg',
                        help='Use user specific environment configuration file',
                        default='')
    parser.add_argument("--logging_cfg",
                        help="Location of JSON configuration for logging.",
                        default=None)
    parser.add_argument('--repeat',
                        help='Repeat testcases N times',
                        default=1)
    parser.add_argument('--stop_on_failure',
                        help='Stop testruns/repeation on first failed TC',
                        default=False,
                        action="store_true")
    parser.add_argument('--clean',
                        action='store_true',
                        default=False,
                        help='Clean old logs')
    parser.add_argument('--connector',
                        default=None,
                        help='Connector credentials for selecting and/or generating endpoint '
                             'certificates. Format should be domain[:token] where token is '
                             'optional. Eg. --connector this_is_some_domain:this_is_my_token')
    parser.add_argument('--failure_return_value',
                        default=False,
                        action="store_true",
                        help='Sets Icetea to return a failing code to caller if '
                             'one or more tests fail during the run. Default is False')
    parser.add_argument('--color',
                        default=False,
                        action="store_true",
                        help='Indicates if console logs are printed plain'
                             ' or with colours. Default is False for plain'
                             'logs.')
    parser.add_argument("--check_version",
                        default=False,
                        action="store_true",
                        help="Enables version checks for test cases.")
    parser.add_argument('--ignore_invalid_params',
                        default=False,
                        action="store_true",
                        help="Disables checks for invalid parameters.")
    parser.add_argument('--parallel_flash',
                        default=False,
                        action="store_true",
                        help="Enables parallel flash.")
    parser.add_argument('--disable_log_truncate',
                        default=False,
                        action="store_true",
                        help="Disable long log line truncating. Over 10000"
                             "characters long lines are truncated by default.")
    parser.add_argument('--cm',
                        default="opentmi_client",
                        help='name of module that is to be used to send results to a cloud '
                             'service.')
    parser.add_argument("--json", action="store_true", default=False,
                        help="Output results of --list as json instead of a table.")
    parser.add_argument("--export", default=None, metavar="SUITE_FILE_NAME",
                        help="Export list into suite template file.")
    parser.add_argument("--sync_start", default=False, action="store_true",
                        help="Use echo-command to try and make sure duts have "
                             "started before proceeding with test.")
    return parser
Append base arguments icetea run arguments to parser.

    :param parser: argument parser
    :return: ArgumentParser