Esempio n. 1
0
def main(runtime):
    # using Task class to create a task object with "first_example.py"
    # (max runtime = 60*5 seconds = 5 minutes)
    task_1 = Task(testscript='first_example.py',
                  runtime=runtime,
                  taskid='example_task_1')

    # start the task
    task_1.start()

    # wait for a max runtime of 300 seconds = 5 minutes
    task_1.wait(timeout)

    # check whether the next script should continue
    # based on previous task's results.
    if task_1.result:
        # last result passed, run the next task
        task_2 = Task(testscript='second_example.py',
                      runtime=runtime,
                      taskid='example_task_2')

        # start & wait
        task_2.start()
        task_2.wait(timeout)

    # execute the third test script
    run('third_example.py')
def main():
    # definition of the path to test script
    script_path = os.path.dirname(os.path.abspath(__file__))
    testscript = os.path.join(script_path, 'first_example.py')

    # execute the testscript
    run(testscript=testscript)
def main(runtime):
    parser = argparse.ArgumentParser()
    parser.add_argument('--local_users',
                        dest='expected_local_users',
                        nargs='+',
                        default=['cisco'])
    args, unknown = parser.parse_known_args()
    # Find the location of the script in relation to the job file
    local_user_check = os.path.join('./local_users/local_user_check.py')
    # Execute the testscript as task
    task_1 = Task(testscript=local_user_check,
                  runtime=runtime,
                  taskid='Validate Locally Configured Usernames',
                  **vars(args))
    task_1.start()
    # wait for a max runtime of 60*5 seconds = 5 minutes
    task_1.wait(60 * 5)

    # add another task
    bgp_neighbors_check = os.path.join(
        './bgp_adjacencies/BGP_Neighbors_Established.py')
    task_2 = Task(testscript=bgp_neighbors_check,
                  runtime=runtime,
                  taskid='Verify BGP neighbors are established',
                  **vars(args))

    task_2.start()
    task_2.wait(60 * 5)

    crc_check = os.path.join('./crc_errors_CRC_Count_check.py')

    # or simply call run as many times as you'd like
    run(testscript=crc_check,
        taskid="Check all Interfaces for CRC errors",
        **vars(args))
Esempio n. 4
0
def main():
    # Find the location of the script in relation to the job file
    pwd = os.path.dirname(__file__)
    bgp_tests = os.path.join(pwd, 'bgp_check.py')
    # Execute the testscript
    # run(testscript=testscript)
    run(testscript=bgp_tests)
def main():
    """Segment routing script run"""
    run(testscript='/ws/mastarke-sjc/my_local_git/segment_routing/sr.py',
    uids=Or('common_setup',
            And('Sr_te_path_sr'),
            And('Sr_te_path_dynamic_sr'),
            And('Sr_te_path_exp_node_sid'),
            And('Sr_te_path_exp_adj_sid_via_main_intf'),
            And('Sr_te_path_exp_adj_sid_via_sub_intf'),
            And('Sr_te_path_exp_adj_sid_via_bundle_intf'),
            And('Rsp_failover_fail_back'),
            And('Process_restarts_rsp'),
            And('Process_restarts_lc'),
            And('Lc_reload'),
            And('Interface_flap_tunnel'),
            And('Remove_add_config_loopback'),
            And('Remove_add_config_l2vpn'),
            And('Remove_add_config_igp'),
            And('Interface_flap_main_interface'),
            And('Interface_flap_bundle'),
            And('Interface_flap_bundle_members'),
            And('Bundle_add_remove_members'),
            And('Ti_lfa_path_switch'),
            And('Prefered_path'),
            And('Prefered_path_change_tunnel_config'),
            And('Prefered_path_with_flow_label'),
            And('Sr_flow_label_64_Ecmp'),
            And('L2vpn_control_word'),
            Not('.*'),
            'common_cleanup')
        )
Esempio n. 6
0
def main():
    # Find the location of the script in relation to the job file
    ping_tests = os.path.join('task9_labpyats.py')
    testbed = load('pyats_testbed.yaml')

    # Execute the testscript
    run(testscript=ping_tests, pyats_testbed=testbed)
def main():
    # Find the location of the script in relation to the job file
    pwd = os.path.dirname(__file__)
    bgp_tests = os.path.join(pwd, 'BGP_Neighbors_Established.py')
    # Execute the testscript
    # run(testscript=testscript)
    run(testscript=bgp_tests)
def main():
    """Segment routing script run"""
    run(testscript='/nobackup/mastarke/my_local_git/segment_routing/sr.py',
        # uids=Or('common_setup',
        #      Not('Rsp_failover_fail_back'),
        #          'common_cleanup')
        )
def main():
    # Find the location of the script in relation to the job file
    test_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    testscript = os.path.join('vxlan_consistency_check_script.py')

    # Execute the testscript
    run(testscript=testscript)
Esempio n. 10
0
def main():
    # Find the location of the script in relation to the job file
    test_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    #testscript = os.path.join(test_path, 'connection_example_script.py')
    testscript = '/ws/ikyalnoo-bgl/pyatsgit/esacl_1.0/ESACL_SCRIPT.py'

    # Do some logic here to determine which devices to use
    # and pass these device names as script arguments
    # ...
    #chosen_uut_device = 'ott-tb1-n7k3'
    chosen_uut_device = 'fretta'
    stdby_device = 'notreallyadevice'
    enable_port_xconnect = 0  #### to enable port_xconnect streems ####

    run(
        testscript=testscript,
        uut_name=chosen_uut_device,
        stdby_name=stdby_device,
        R1=chosen_uut_device,
        intf_mode='interface',
        init_clean=0,
        console_type='console',
        config_lang_phy_mode=0,
        mtu_size_list=[1600, 9210, 9216],
        mac_dst_type='UNICAST',
        frame_size_with_CRC=[504, 9214, 9220],
        R1_TGN_int1='tengige0/7/0/32/0',
        R1_TGN_int2='tengige0/7/0/32/1',
        TGN_R1_int1='9/1',
        TGN_R1_int2='9/2',
        tgn_name='TGN-SPIRENT',
        pkts_per_burst=500,
        efp_exact=0,
        eth_autonego=0,
        vlan_header_cos=6,
        speed="ether10000",
        failover_tests=[
            'mtu_test_with_max_pkts_size',
            'mtu_test_with_max_plus_2_pkts_size',
            'mtu_test_with_max_plus_4_pkts_size',
            'mtu_test_with_max_plus_6_pkts_size'
        ],
        port_xconnect=enable_port_xconnect,
        #groups = Or('group1'),
        validate_pkt_hex=1,
        cfg_permutations=1,  #skip =  'cfg_permutations',
        #poss_failover_list = ['l2.es.xc.dot1ad_pri_tag_push1q','l2.es.xc.dot1q_vid_translate1_2ad_q','l2.es.xc.in_dot1ad_out_dot1ad_pop1','l2.es.xc.default_efp_untag'],
        #poss_failover_list = ['l2.es.xc.dot1ad_pri_tag_push1q'],
        poss_failover_list=['l2.es.xc.dot1q_push1q'],
        #poss_failover_list = ['l2.es.xc.in_dot1ad_out_dot1ad_pop1'],
        #config_data_yaml_file='/ws/ikyalnoo-bgl/pyats/examples/scripts/VPWS_NEW_DYANMIC/config_data.yaml',
        bundle_interface=0,
        run_ids=[
            'common_setup', 'L2aclPositive_Single_ACE_Match',
            'L2aclPositive_BasicACL', 'common_cleanup'
        ]
        #ids=Or('common_setup','L2aclPositive_BasicACL','L2aclPositive_acl_edits','L2aclPositive_atomic_replace','L2aclPositive_Single_ACE_Match','L2acl_triggers_tc','L2aclPositive_acl_double_tag','L2aclPositive_with_rewrite_tag','common_cleanup')
        # )
    )
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--device', dest='device')
    parser.add_argument('--nbr-count', dest='expected_nbr_count')
    args, unknown = parser.parse_known_args()
    pwd = os.path.dirname(__file__)
    eigrp = os.path.join(pwd, 'EIGRP_TestCases.py')
    run(testscript=eigrp, **vars(args))
Esempio n. 12
0
def main():
    """
    main() function is the default easypy job file entry point.
    """

    script_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    testscript = os.path.join(script_path, 'first_example.py')

    # execute the testscript
    run(testscript=testscript)
def main():
    '''
    main() function is the default easypy job file entry point.
    '''

    # eind the location of the script in relation to the job file
    script_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    testscript = os.path.join(script_path, 'basic_example_script.py')

    # execute the testscript
    run(testscript=testscript)
Esempio n. 14
0
def main():
    """Segment routing script run"""
    run(testscript='/ws/mastarke-sjc/my_local_git/segment_routing/sr.py',
        uids=Or('common_setup', And('SanityTraffic'), And('SrLoopback'),
                And('SrFeatureInteraction'), And('Rsp_failover_fail_back'),
                And('Process_restarts_rsp'), And('Process_restarts_lc'),
                And('Lc_reload'), And('Remove_add_config_loopback'),
                And('Remove_add_config_igp'),
                And('Interface_flap_main_interface'),
                And('Interface_flap_bundle'),
                And('Interface_flap_bundle_members'),
                And('Bundle_add_remove_members'), And('Sr_Ecmp'), Not('.*'),
                'common_cleanup'))
Esempio n. 15
0
def main():

    # parse args
    args, unknown = parser.parse_known_args()

    # configure your log outputs level
    #logging.getLogger('ats.connections').setLevel('DEBUG')

    # Find the location of the script in relation to the job file
    test_path = os.path.dirname(os.path.abspath(__file__))
    testscript = os.path.join(test_path, 'pyats_ios_example.py')

    # run it
    run(testscript, **vars(args))
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--local_users',
                        dest='expected_local_users',
                        nargs='+',
                        default=['cisco'])
    args, unknown = parser.parse_known_args()
    # Find the location of the script in relation to the job file
    local_user_check = os.path.join('./local_user_check.py')
    # Execute the testscript
    run(testscript=local_user_check,
        taskid="Local User Check",
        **vars(args),
        groups=Or('golden_config', 'bar'))
Esempio n. 17
0
def main():
    import argparse
    parser = argparse.ArgumentParser(usage="%(prog)s [options]",
                                     description="Job file test")
    parser.add_argument("--script",
                        type=str,
                        help="Script to execute",
                        required=True)
    args, _ = parser.parse_known_args()

    if args.script == "testscript1":
        run(testscript=
            "/local/ws1/production/tests/5d81def1cbd3495ddcef1e03/testscript1.py"
            )
    elif args.script == "testscript2":
        run(testscript=
            "/local/ws1/production/tests/5d81def1cbd3495ddcef1e03/testscript2.py"
            )
    else:
        print("No such file")
        exit(1)
Esempio n. 18
0
def main(runtime):
    custom_args = parser.parse_known_args()[0]
    logging.getLogger('ats.aetest').setLevel('INFO')
    logging.getLogger('libs').setLevel('DEBUG')
    logging.getLogger('ats.aetest').setLevel('INFO')
    logging.getLogger('libs').setLevel('DEBUG')

    run(testscript=os.path.join(script_path, 'extended_testscript.py'),
        runtime=runtime,
        parameter_A='jobfile value A',
        labels=labels,
        routers=routers,
        links=links,
        tgns=tgns)

    run(testscript=os.path.join(script_path, 'extended_testscript.py'),
        runtime=runtime,
        parameter_A='jobfile value A',
        labels=labels2,
        routers=routers2,
        links=links,
        tgns=tgns)
def main(runtime):

    # parse custom command-line arguments
    custom_args = parser.parse_known_args()[0]

    #**************************************
    #* Log Levels
    #*
    #*  within the job file main() section, you can set the various logger's
    #*  loglevels for your following testscripts. This allows users to modify
    #*  the logging output within the job file, for various modules & etc,
    #*  without modifying testscript and libraries.

    # set log levels for various modules
    # eg, set aetest to INFO, set your library to DEBUG
    logging.getLogger('ats.aetest').setLevel('INFO')
    logging.getLogger('testscripts.libs').setLevel('DEBUG')

    if custom_args.only_global:
        # only run Test{{ cookiecutter.testcase_class}}

        script_path = os.path.join(os.path.dirname(__file__), 'testscripts')
        testscript = os.path.join(script_path,
                                  'Test{{ cookiecutter.testcase_class}}.py')
        run(testscript=testscript,
            datafile='data/datafile.yaml',
            runtime=runtime,
            uids=Or('{{ cookiecutter.testcase_class }}'))

    # limit tests to a specific group
    elif custom_args.group:
        for script in get_testscripts():
            run(testscript=script,
                runtime=runtime,
                labels=labels,
                routers=routers,
                links=links,
                tgns=tgns,
                groups = Or(custom_args.group),
                **vars(custom_args))

    else:

        for script in get_testscripts():
            run(testscript=script,
                runtime=runtime,
                labels=labels,
                routers=routers,
                links=links,
                tgns=tgns,
                **vars(custom_args))
Esempio n. 20
0
def main(runtime):

    #
    # parse custom command-line arguments
    #
    custom_args = parser.parse_known_args()[0]

    #**************************************
    #* Log Levels
    #*
    #*  within the job file main() section, you can set the various logger's
    #*  loglevels for your following testscripts. This allows users to modify
    #*  the logging output within the job file, for various modules & etc,
    #*  without modifying testscript and libraries.

    # set log levels for various modules
    # eg, set aetest to INFO, set your library to DEBUG
    logging.getLogger('ats.aetest').setLevel('INFO')
    logging.getLogger('libs').setLevel('DEBUG')
    logging.getLogger('ats.aetest').setLevel('INFO')
    logging.getLogger('libs').setLevel('DEBUG')

    #
    # run a test script and provide some script argumentss
    # this will overwrite the default values set in your script.
    # also showing passing topology information arguments into script
    #
    run(testscript=os.path.join(script_path, 'base_example.py'),
        runtime=runtime,
        parameter_A='jobfile value A',
        labels=labels,
        routers=routers,
        links=links,
        tgns=tgns)

    #
    # run with a specific router
    #
    run(testscript=os.path.join(script_path, 'base_example.py'),
        runtime=runtime,
        parameter_A='jobfile value A',
        labels=labels2,
        routers=routers2,
        links=links,
        tgns=tgns)

    #
    # run the variant script with parsed custom_args and loglevel
    #
    run(testscript=os.path.join(script_path, 'variant_example.py'),
        runtime=runtime,
        loglevel=loglevel,
        **vars(custom_args))

    #**************************************
    #* Run by ID
    #*
    #*  use 'uids' feature to specify which test section uids should run.
    #*  'uids' accepts a callable argument. In this example, instead of writing
    #*  a callable function, we'll leverage datastructure.logic classes.
    #*

    #
    # eg, only run testcases with 'Testcase' in the name,
    # but not LoopingTestcase
    #
    run(testscript=os.path.join(script_path, 'base_example.py'),
        runtime=runtime,
        uids=And('.*Testcase.*', Not('ExampleTestcase')))

    #**************************************
    #* Run by Groups
    #*
    #*  use 'groups' feature to specify which testcase groups should run.
    #*  'groups' accepts a callable argument. In this example, we'll also be
    #*  using datastructure.logic classes.
    #*

    #
    # eg, only run testcases in group_A and group_C
    #
    run(testscript=os.path.join(script_path, 'variant_example.py'),
        runtime=runtime,
        groups=Or('group_A', 'group_C'))
Esempio n. 21
0
def main():
    # Find the location of the script in relation to the job file
    blue_ring = os.path.join('code/blue-ringtest.py')

    # Execute the testscript
    run(testscript=blue_ring)
Esempio n. 22
0
def main():
    # Find the location of the script in relation to the job file
    vxlan_tests = os.path.join('./vxlantest.py')
    # Execute the testscript
    run(testscript=vxlan_tests)
Esempio n. 23
0
def main():
    # Find the location of the script in relation to the job file
    ping_tests = os.path.join('./task10_labpyats.py')

    # Execute the testscript
    run(testscript=ping_tests)
def main():
    run(testscript=(
        '/ws/mastarke-sjc/my_local_git/image_picker_site/upgrade_script/auto_merit.py'
    ))
Esempio n. 25
0
def main():

    run(testscript=os.path.join(SCRIPT_DIR, 'script.py'),
        browser='firefox',
        base_url='http://www.google.com/')
def main():
    # Find the location of the script in relation to the job file
    testscript = os.path.join('./device_check.py')
    run(testscript=testscript)
Esempio n. 27
0
def main():
    # Find the location of the script in relation to the job file
    bgp_tests = os.path.join('./BGP_Neighbors_Established.py')
    # Execute the testscript
    # run(testscript=testscript)
    run(testscript=bgp_tests)
Esempio n. 28
0
def main():
    # Find the location of the script in relation to the job file
    ospf_tests = os.path.join('./OSPF_Working.py')
    # Execute the testscript
    # run(testscript=testscript)
    run(testscript=ospf_tests)
def main():
    run(testscript=('/ws/mastarke-sjc/my_local_git/merit/auto_merit.py'))
def main():
    run(testscript=('/ws/mastarke-sjc/my_local_git/image_picker_site/basic_telnet_script.py'))