Esempio n. 1
0
def test_ft_erspan_warm_reboot():
    """
    Author: Anil Kumar Kacharla<*****@*****.**>
    Verify that ERSPAN is working as expected and intended traffic is mirrored to remote interface while warm reboot
    """
    data.tg1.tg_traffic_control(action="clear_stats", port_handle=data.tg_ph_1)
    data.tg2.tg_traffic_control(action="clear_stats", port_handle=data.tg_ph_2)
    data.tg1.tg_traffic_control(action='run', stream_handle=data.stream)
    st.wait(5)
    st.log("performing Config save")
    rb_obj.config_save(vars.D1)
    st.log("performing warm-reboot")
    st.reboot(vars.D1, 'warm')
    st.log("Stop  the traffic")
    data.tg1.tg_traffic_control(action='stop', stream_handle=data.stream)
    st.wait(10)
    st.log("verifying traffic after warm reboot")
    filter_result = tgapi.validate_tgen_traffic(
        traffic_details=data.traffic_details,
        mode='aggregate',
        comp_type='packet_count')
    if not filter_result:
        st.log("traffic verification failed")
        st.report_fail("operation_failed")
    else:
        st.log("ERSPAN traffic verification is successful")

    st.log("verifying erspan configuration after warm reboot")
    erspan_pre_config_verify()
    st.report_pass("test_case_passed")
Esempio n. 2
0
def test_ft_system_verify_traffic_during_fast_reboot():
    data.tg_handler["tg"].tg_traffic_config(
        mode='modify',
        stream_id=data.stream['stream_id'],
        transmit_mode='continuous',
        port_handle=data.tg_handler["tg_ph_1"])
    st.log("performing Config save")
    rb_obj.config_save(vars.D1)
    data.tg_handler["tg"].tg_traffic_control(
        action='clear_stats',
        port_handle=[data.tg_handler["tg_ph_1"], data.tg_handler["tg_ph_2"]])
    data.tg_handler["tg"].tg_traffic_control(
        action='run', stream_handle=data.stream['stream_id'])
    st.log("performing fast-reboot")
    st.reboot(vars.D1, 'fast')
    data.tg_handler["tg"].tg_traffic_control(
        action='stop', stream_handle=data.stream['stream_id'])
    loss_pkts_count = 26 * 100
    stats_tg1 = tgapi.get_traffic_stats(data.tg_handler["tg"],
                                        mode="aggregate",
                                        port_handle=data.tg_handler["tg_ph_1"])
    tx_pkts = stats_tg1.tx.total_packets
    stats_tg2 = tgapi.get_traffic_stats(data.tg_handler["tg"],
                                        mode="aggregate",
                                        port_handle=data.tg_handler["tg_ph_2"])
    rx_pkts = stats_tg2.rx.total_packets
    st.log("Traffic sent from TGEN: {}".format(tx_pkts))
    st.log("Traffic received on TGEN: {}".format(rx_pkts))
    if not loss_pkts_count > int(tx_pkts) - int(rx_pkts):
        st.report_fail('data_traffic_loss_during_fast_reboot')
    st.report_pass("test_case_passed")
Esempio n. 3
0
def test_dhcp_relay_warm_reboot():
    #################################################
    #
    # Objective - Configure DHCP relay and verify if the configuration is retained after warm reboot.
    #
    #################################################
    data.platform = basic_obj.get_hwsku(vars.D2)
    data.constants = st.get_datastore(vars.D2, "constants", 'default')
    st.log("OUTPUT:{}".format(data.constants))
    if not data.platform.lower(
    ) in data.constants['WARM_REBOOT_SUPPORTED_PLATFORMS']:
        st.report_fail('test_case_unsupported')
    st.log("Performing Config save")
    rb_obj.config_save(vars.D2)
    st.log("Performing warm Reboot")
    st.reboot(vars.D2, "warm")
    if not basic_obj.poll_for_system_status(vars.D2, 'dhcp_relay.service', 120,
                                            1):
        st.report_fail("service_not_running", "dhcp-relay")
    if not st.poll_wait(basic_obj.verify_service_status, 60, vars.D2,
                        "dhcp_relay"):
        st.log("DHCP relay service not running")
    st.log("Verifying DHCP Helper configuration post reboot")
    check_dhcp_relay_config()
    dhcp_relay_obj.dhcp_client_start(vars.D3, vars.D3D2P1)
    if ip_obj.verify_interface_ip_address(vars.D3,
                                          vars.D3D2P1,
                                          data.pool_ip_address,
                                          family="ipv4",
                                          vrfname=''):
        st.report_fail("IP_address_assignment_failed", vars.D3)
    st.log(
        "Successfully verified DHCP Helper configuration is retained after warm reboot"
    )
    st.report_pass("test_case_passed")
Esempio n. 4
0
def test_ft_nat_save_reboot():
    # ################ Author Details ################
    # Name: Kiran Vedula
    # Eamil: [email protected]
    # ################################################
    # Objective - Verify dynamic NAPT translations after DUT reboot
    # #################################################
    nat_obj.clear_nat(vars.D1, translations=True)
    nat_obj.clear_nat(vars.D1, statistics=True)
    nat_obj.show_nat_translations(vars.D1)
    st.log("Reboot the DUT")
    reboot_obj.config_save(vars.D1, "sonic")
    reboot_obj.config_save(vars.D1, "vtysh")
    st.reboot(vars.D1)
    st.log("Traffic for snat case")
    tg1.tg_traffic_control(action='run', handle=tg_str_data[1]["tg1_dyn_nat_udp_data_str_id_1"])
    tg1.tg_traffic_control(action='stop', handle=tg_str_data[1]["tg1_dyn_nat_udp_data_str_id_1"])
    if not ip_obj.ping(vars.D1, data.in1_ip_addr_h[-1], family='ipv4',count=3):
        nat_reboot_debug_fun()
        st.report_fail("ping_fail",data.in1_ip_addr,data.in1_ip_addr_h[-1])
    st.wait(data.wait_nat_stats)
    st.log("Checking for STATIC entries after reboot")
    trn_val_1 = nat_obj.get_nat_translations(vars.D1, protocol=data.proto_all, src_ip=data.in1_ip_addr_h[0])
    if not trn_val_1:
        nat_reboot_debug_fun()
        st.report_fail("static_nat_translation_entry_create_fail", data.in1_ip_addr_h[0], data.out_ip_pool[0])
    count = data.pkt_count
    trn_val = nat_obj.get_nat_translations(vars.D1, protocol=data.proto_udp, src_ip=data.in1_ip_addr_h[-1],
                                           src_ip_port=data.local_src_port[0])
    if not trn_val:
        nat_reboot_debug_fun()
        st.error("Received empty list,nat translation table not updated")
        st.report_fail("dynamic_snat_translation_entry_create_fail", data.in1_ip_addr_h[-1], data.out_ip_pool[0])
    trn_src_ip = trn_val[0]["trn_src_ip"]
    trn_src_port = trn_val[0]["trn_src_ip_port"]
    st.log("Traffic for dnat case")
    tg2_str_obj = tg2_str_selector(trn_src_ip, trn_src_port)
    tg2.tg_traffic_control(action='run', handle=tg2_str_obj)
    tg2.tg_traffic_control(action='stop', handle=tg2_str_obj)
    st.wait(data.wait_nat_stats)
    nat_stats_s = nat_obj.poll_for_nat_statistics(vars.D1, protocol=data.proto_udp,
                                                  src_ip=data.in1_ip_addr_h[-1], src_ip_port=data.local_src_port[0])
    if not nat_stats_s:
        nat_reboot_debug_fun()
        st.error("Received empty list,nat statistics are not updated")
        st.report_fail("dynamic_snat_translation_entry_create_fail", data.in1_ip_addr_h[-1], data.out_ip_pool[0])
    if not (int(nat_stats_s[0]['packets']) >= (0.80 * (int(count)))):
        nat_reboot_debug_fun()
        st.report_fail("dynamic_snat_translation_entry_create_fail", data.in1_ip_addr_h[-1], data.out_ip_pool[0])

    nat_stats_d = nat_obj.poll_for_nat_statistics(vars.D1, protocol=data.proto_udp, dst_ip=trn_src_ip,
                                                  dst_ip_port=trn_src_port)
    if not nat_stats_d:
        nat_reboot_debug_fun()
        st.error("Received empty list, nat statistics are not updated")
        st.report_fail("dynamic_dnat_translation_entry_create_fail", data.out_ip_pool[0], data.out_ip_pool[0])
    if not (int(nat_stats_d[0]['packets']) >= (0.80 * (int(count)))):
        nat_reboot_debug_fun()
        st.report_fail("dynamic_dnat_translation_entry_create_fail", data.out_ip_pool[0], data.out_ip_pool[0])
    st.report_pass("nat_translation_successful_after_reboot")
Esempio n. 5
0
def test_ft_snmp_warmstart_trap():
    """
    Author : Prasad Darnasi<*****@*****.**>
    Verify that trap is sent when reboot is performed.
    """
    check_flag = snmptrapd_checking()
    if not check_flag:
        st.report_fail("snmptrapd_not_running")

    # trigger trap on DUT
    reboot.config_save(vars.D1)
    st.reboot(vars.D1, 'warm')

    # Get the ip address of the switch after reboot
    device_eth0_ip_addr()

    # get data from capture
    read_cmd = "cat {}".format(capture_file)
    output = execute_command(ssh_conn_obj, read_cmd)
    trap_lines = output.split("\n")[:-1]

    result = any('warmStart' in x for x in trap_lines)
    if result == 0:
        for i in range(1, 4):
            read_cmd = "cat {}".format(capture_file)
            output = execute_command(ssh_conn_obj, read_cmd)
            trap_lines = output.split("\n")[:-1]
            result = any('warmStart' in x for x in trap_lines)
            if result == 1:
                break
            st.wait(10)
    if result == 0:
        st.report_fail("snmp_output_failed", "warmStart")
    else:
        st.report_pass("test_case_passed")
def test_l3_host_scaling_tc5_7():
    vars = st.get_testbed_vars()
    # Config 2 IPV4 interfaces on DUT.
    (tg1, _, tg_ph_1, _) = get_handles_1()
    dut1 = vars.D1
    ipfeature.get_interface_ip_address(dut1, family="ipv4")
    ipfeature.get_interface_ip_address(dut1, family="ipv6")
    ipfeature.show_ip_route(dut1)
    papi.get_status(dut1)

    reboot_obj.config_save(dut1)

    #To clean-up inconsistent state left in previous test
    reboot_node(dut1)

    ret = warm_reboot_node(dut1)

    pre_test_l3_fwding()
    if (ret):
        tg1.tg_traffic_control(action='reset',port_handle=tg_ph_1)
        tr1 = create_l3_host(tg1, tg_ph_1, data.max_host_1, 20)
        st.wait(15)
        total = get_arp_count(dut1)
        st.log("Total ARP entries: {}".format(total))

        tg1.tg_traffic_control(action='stop', handle=tr1['stream_id'])
        tg1.tg_traffic_control(action='reset',port_handle=tg_ph_1)
        post_test_l3_fwding()
        if (total >= data.max_host_1):
            st.report_pass("test_case_passed")
        else:
            st.report_fail("test_case_failed")
    else:
        post_test_l3_fwding()
        st.report_fail("test_case_failed")
Esempio n. 7
0
def config_ntp_server_on_config_db_file(dut, iplist):
    """
    Author: Anil Kumar Kacharla <*****@*****.**>
    """
    st.log("Configuring NTP servers in Config_db file")
    ntp_obj.add_ntp_servers(dut, iplist=iplist)
    data.time_date = time.strftime('%a %B %d %H:%M:%S %Z %Y')
    ntp_obj.config_date(vars.D1, data.time_date)
    reboot_obj.config_save(vars.D1)
    st.log("verifying ntp service status")
    if ntp_obj.verify_ntp_service_status(vars.D1, 'active (running)'):
        st.log("ntpd is running")
    else:
        st.log("ntpd is exited and restarting ntp service")
        basic_obj.service_operations(vars.D1, data.ntp_service, action="restart")
    if not st.poll_wait(ntp_obj.verify_ntp_server_details, 30, dut, iplist, remote=iplist):
        st.log("ip not matching")
        st.report_fail("operation_failed")
    if not ntp_obj.verify_ntp_service_status(dut, 'active (running)', iteration=65, delay=2):
        st.log("ntp is exited")
        st.report_fail("operation_failed")
    st.log("Verify that NTP server connectivity from DUT")
    result = 0
    for server_ip in data.servers:
        if not ping_obj.ping(vars.D1, server_ip):
            st.log("ping to ntp server is not successfull:{}".format(server_ip))
            result += 1
    if len(data.servers) == result:
        st.report_fail("None_of_the_configured_ntp_server_reachable")
    if not ntp_obj.verify_ntp_status(vars.D1, iteration=65, delay=2, server=data.servers):
        st.log("ntp syncronization failed")
        st.report_fail("operation_failed")
def arp_static_route_reboot_module_hooks(request):
    # add things at the start of this module
    init_vars()
    initialize_variables()
    get_parms()

    global tg_handler
    tg_handler = tgapi.get_handles_byname("T1D1P1", "T1D1P2")
    global tg
    tg = tg_handler["tg"]
    tg_ph_list = [tg_handler["tg_ph_1"], tg_handler["tg_ph_2"]]
    st.log("configuring static route")
    adding_static_route()
    st.log("Getting ARP entry dynamically")
    adding_dynamic_arp()
    ip_obj.config_ip_addr_interface(vars.D1,
                                    vars.D1T1P2,
                                    data.ipv4_address_1,
                                    data.mask,
                                    family="ipv4",
                                    config='add')
    st.log("Configuring static ARP")
    arp_obj.add_static_arp(vars.D1, data.static_arp_ip, data.static_arp_mac,
                           vars.D1T1P2)
    st.log(
        "Verifying static route entries before save and reboot/fast-reboot/warm-reboot"
    )
    static_route_verify()
    st.log(
        "Verifying dynamic ARP entries before save and reboot/fast-reboot/warm-reboot"
    )
    if not arp_obj.verify_arp(vars.D1, data.ipv4_address_ixia,
                              data.src_mac_addr, vars.D1T1P1):
        st.report_fail("ARP_entry_dynamic_entry_fail", data.ipv4_address_ixia,
                       vars.D1)
    else:
        st.log("Verified that dynamic ARP entry is present in arp table")
    st.log(
        "Verifying static ARP entries before save and reboot/fast-reboot/warm-reboot"
    )
    if not arp_obj.verify_arp(vars.D1, data.static_arp_ip, data.static_arp_mac,
                              ""):
        st.report_fail("static_arp_create_fail", vars.D1)
    else:
        st.log("Verified that static ARP entry is present in arp table")
    st.log("Save the config on the DUT")
    rb_obj.config_save(vars.D1)
    st.log("saving config in vtysh mode to save static route")
    rb_obj.config_save(vars.D1, shell="vtysh")
    yield
    # Below step will clear IP adresses configured on different interfaces in the device
    ip_obj.clear_ip_configuration(st.get_dut_names())
    #Below step will clear static route configured in the device
    ip_obj.delete_static_route(vars.D1,
                               data.ipv4_address_ixia,
                               data.ipv4_address_network,
                               family='ipv4',
                               shell="vtysh")
    #Below step will delete static arp entries configured in the device
    arp_obj.delete_static_arp(vars.D1, data.static_arp_ip, vars.D1T1P2)
Esempio n. 9
0
def test_ft_system_config_mgmt_verifying_config_with_save_fast_reboot():
    st.log("performing Config save")
    rb_obj.config_save(vars.D1)
    st.log("performing fast-reboot")
    st.reboot(vars.D1, 'fast')
    st.log(
        "Checking whether config is loaded to running config from config_db after fast-reboot"
    )
    st.log("Checking CRM config after save and fast-reboot")
    crm_config_verify()
    if st.is_feature_supported("interface-mtu", vars.D1):
        st.log("Checking the configured MTU value after save and fast-reboot")
        mtu_verify()
    if st.is_feature_supported("threshold", vars.D1):
        st.log("configured threshold values verification")
        threshold_verify()
    st.log("Checking ERSPAN config after fast-reboot")
    mirror_action_verify()
    if st.is_feature_supported("span-mirror-session", vars.D1):
        st.log("Checking SPAN config after save and reboot")
        port_mirror_verify()
    st.log(
        "configuration is successfully stored to config_db file after save and fast-reboot"
    )
    st.report_pass("test_case_passed")
Esempio n. 10
0
def test_bgp_v4_warm_reboot(fixture_v4):
    ################# Author Details ################
    # Name: V Sreenivasula Reddy
    # Email:  [email protected]
    #
    ############### Test bed details ################
    #  TG --- DUT --- TG
    #################################################

    bgpfeature.enable_docker_routing_config_mode(vars.D1)
    tr1 = tg.tg_traffic_config(
        port_handle=tg_handler["tg_ph_2"],
        emulation_src_handle=h2['handle'],
        emulation_dst_handle=bgp_rtr1['route'][0]['handle'],
        circuit_endpoint_type='ipv4',
        mode='create',
        transmit_mode='continuous',
        length_mode='fixed',
        rate_pps=data.traffic_rate_pps,
        enable_stream_only_gen='0')

    # Verify the total route count
    count = verify_bgp_route_count(dut,
                                   family='ipv4',
                                   neighbor=data.neigh_ip_addr,
                                   state='Established')
    st.log("Route count: " + str(count))
    if int(count) != int(data.test_bgp_route_count):
        st.report_fail("route_table_not_updated_by_advertise_from_tg")

    # Starting the TG traffic after clearing the DUT counters
    papi.clear_interface_counters(dut)
    tg.tg_traffic_control(action="run", handle=tr1['stream_id'])

    bgpfeature.enable_docker_routing_config_mode(vars.D1)
    st.log("saving the BGP config in vtysh shell")
    reboot_obj.config_save(vars.D1, shell='vtysh')
    st.log("config save in D1")
    reboot_obj.config_save([vars.D1])
    st.log("Performing warm reboot")
    st.reboot(vars.D1, "warm")

    # Stopping the TG traffic
    tg.tg_traffic_control(action='stop', handle=tr1['stream_id'])

    traffic_details = {
        '1': {
            'tx_ports': [vars.T1D1P2],
            'tx_obj': [tg],
            'exp_ratio': [1],
            'rx_ports': [vars.T1D1P1],
            'rx_obj': [tg],
        }
    }
    if not tgapi.validate_tgen_traffic(traffic_details=traffic_details,
                                       mode='aggregate',
                                       comp_type='packet_count'):
        st.report_fail("traffic_verification_failed_during_warm_reboot")
    st.report_pass("test_case_passed")
Esempio n. 11
0
 def config_dut():
     config_ip_topology(config)
     config_ip_loopback(config)
     config_bgp_route_map(config)
     config_bgp_topology(config)
     if config == 'yes':
         config_save(eh_data.dut_list)
     config_tg_ip_bgp_stream_error_handling(config)
Esempio n. 12
0
def test_ft_security_config_mgmt_verifying_config_with_save_warm_reboot():
    st.log("performing Config save")
    rb_obj.config_save(vars.D1)
    st.log("performing warm-reboot")
    st.reboot(vars.D1, 'warm')
    st.log("Checking whether config is loaded to running config from config_db after warm-reboot")
    tacacs_config_verify()
    st.log("configuration  is successfully stored to config_db file after save and warm-reboot")
    st.report_pass("test_case_passed")
Esempio n. 13
0
def test_ft_system_verify_traffic_through_port_channel_during_fast_reboot():
    [output,
     exceptions] = exec_all(True,
                            [[
                                po_obj.verify_portchannel_member, vars.D1,
                                data.portchannel_name, data.members_dut1
                            ],
                             [
                                 po_obj.verify_portchannel_member, vars.D2,
                                 data.portchannel_name, data.members_dut2
                             ]])
    if False in output:
        st.report_fail('portchannel_member_verification_failed',
                       data.portchannel_name, vars.D1, data.members_dut1)
    ensure_no_exception(exceptions)
    exceptions = exec_all(True, [[
        vlan_obj.add_vlan_member, vars.D1, data.vlan, data.portchannel_name,
        True
    ],
                                 [
                                     vlan_obj.add_vlan_member, vars.D2,
                                     data.vlan, data.portchannel_name, True
                                 ]])[1]
    ensure_no_exception(exceptions)
    data.tg_handler["tg"].tg_traffic_config(
        mode='modify',
        stream_id=data.stream['stream_id'],
        transmit_mode='continuous',
        port_handle=data.tg_handler["tg_ph_1"])
    st.log("performing Config save")
    rb_obj.config_save(vars.D1)
    data.tg_handler["tg"].tg_traffic_control(
        action='clear_stats',
        port_handle=[data.tg_handler["tg_ph_1"], data.tg_handler["tg_ph_3"]])
    data.tg_handler["tg"].tg_traffic_control(
        action='run', stream_handle=data.stream['stream_id'])
    st.log("performing fast-reboot")
    st.reboot(vars.D1, 'fast')
    data.tg_handler["tg"].tg_traffic_control(
        action='stop', stream_handle=data.stream['stream_id'])
    loss_pkts_count = 26 * 100
    stats_tg1 = tgapi.get_traffic_stats(data.tg_handler["tg"],
                                        mode="aggregate",
                                        port_handle=data.tg_handler["tg_ph_1"])
    tx_pkts = stats_tg1.tx.total_packets
    stats_tg2 = tgapi.get_traffic_stats(data.tg_handler["tg"],
                                        mode="aggregate",
                                        port_handle=data.tg_handler["tg_ph_3"])
    rx_pkts = stats_tg2.rx.total_packets
    st.log("Traffic sent from TGEN: {}".format(tx_pkts))
    st.log("Traffic received on TGEN: {}".format(rx_pkts))
    if not loss_pkts_count > int(tx_pkts) - int(rx_pkts):
        st.report_fail('data_traffic_loss_during_fast_reboot')
    st.report_pass("test_case_passed")
Esempio n. 14
0
def test_ft_stormcontrol_fast_reboot():
    status = 1
    interface_list = [vars.D1T1P1, vars.D1T1P2]
    storm_control_type = ["broadcast", "unknown-multicast", "unknown-unicast"]
    msg_id = "storm_control_reboot_successful"
    utils.banner_log("Verifying BUM storm control before fast reboot")
    if not verify_bum_traffic_mode(
            'broadcast', tg_info['tg1_stream_id'], skip_traffic_verify=False):
        st.error("Broadcast traffic verification got failed")
        status = 0
    st.log("performing Config save")
    reboot.config_save(vars.D1)
    #############################################################################################
    utils.banner_log("Performing fast-reboot operation --STARTED")
    #############################################################################################
    st.log("performing fast-reboot")
    st.reboot(vars.D1, 'fast')
    #############################################################################################
    utils.banner_log("Performing fast-reboot operation --COMPLETED")
    #############################################################################################
    for interface in interface_list:
        for stc_type in storm_control_type:
            if not scapi.verify_config(vars.D1,
                                       interface_name=interface,
                                       type=stc_type,
                                       rate=sc_data.kbps):
                st.report_fail("storm_control_config_verify_failed", stc_type,
                               interface)
                status = 0
    st.log("Traffic Config for verifying BUM storm control feature")
    tg.tg_traffic_control(action="reset", port_handle=tg_handler["tg_ph_list"])
    tg_1 = tg.tg_traffic_config(port_handle=tg_handler["tg_ph_1"],
                                mode='create',
                                rate_pps=5000,
                                duration=10,
                                l2_encap='ethernet_ii_vlan',
                                vlan_id=sc_data.vlan,
                                mac_src="00:00:00:00:00:01",
                                mac_dst="ff:ff:ff:ff:ff:ff",
                                high_speed_result_analysis=0,
                                vlan="enable",
                                port_handle2=tg_handler["tg_ph_2"],
                                frame_size=sc_data.frame_size,
                                length_mode='fixed')
    tg_info['tg1_stream_id'] = tg_1['stream_id']
    utils.banner_log("Verifying BUM storm control after fast reboot")
    if not verify_bum_traffic_mode(
            'broadcast', tg_info['tg1_stream_id'], skip_traffic_verify=False):
        st.error("Broadcast traffic verification got failed")
        status = 0
    if not status:
        msg_id = "storm_control_reboot_failed"
    report_result(status, msg_id)
def test_ft_security_config_mgmt_verifying_config_with_save_fast_reboot():
    '''
     Author: Sai Durga <*****@*****.**>
     FtOpSoScRaFn007:   Verify that radius config retained after config save and fast boot
    '''
    reboot.config_save(vars.D1)
    st.reboot(vars.D1, 'fast')
    st.wait(security_data.delay)
    tacacs_config_verify()
    if st.is_feature_supported("radius", vars.D1):
        checking_radius_config(security_data.radius_host_ip)
    st.report_pass("security_config_retained_after_fast_reboot")
def test_warm_reboot_ip_unnumbered():

    #####################################################################################################################################

    result = 0
    st.banner(
        'FtOpSoRoIPunRel002 - Verify unnumbered interface accross a warm reboot'
    )
    st.log('Enable warm restart for dockers')
    reboot_obj.config_warm_restart(data.dut2, oper="enable")
    reboot_obj.config_warm_restart(data.dut2,
                                   oper="enable",
                                   tasks=["swss", "teamd", "system"])
    st.log("Save the running config in sonic and vtysh modes")
    reboot_obj.config_save(data.dut2)
    st.vtysh(data.dut2, "copy running startup")
    if not loc_lib.retry_api(ip_obj.ping,
                             data.dut1,
                             addresses=dut3_loopback_ip[0],
                             retry_count=5,
                             delay=10):
        st.error('IPv4 Ping from DUT1 to DUT3 failed before warm_restart')
        result += 1
    aggrResult = loc_lib.send_verify_traffic(type='ipv4')
    if not aggrResult:
        st.error(
            'IPv4 traffic with IPv4 unnumbered failed before warm_restart')
        result += 1
    st.reboot(data.dut2, 'warm')
    if not loc_lib.retry_api(ip_obj.ping,
                             data.dut1,
                             addresses=dut3_loopback_ip[0],
                             retry_count=4,
                             delay=10):
        st.error('IPv4 Ping from DUT1 to DUT2 failed')
        result += 1
    aggrResult = loc_lib.send_verify_traffic(type='ipv4')
    if not aggrResult:
        st.error('IPv4 traffic with IPv4 unnumbered failed')
        result += 1
    reboot_obj.config_warm_restart(data.dut2, oper="disable")
    reboot_obj.config_warm_restart(data.dut2,
                                   oper="disable",
                                   tasks=["swss", "teamd", "system"])
    if result == 0:
        st.report_tc_pass('FtOpSoRoIPunRel002', 'test_case_passed')
    else:
        st.report_tc_fail('FtOpSoRoIPunRel002', 'test_case_failed')
    if result == 0:
        st.report_pass('test_case_passed')
    else:
        st.report_fail('test_case_failed')
Esempio n. 17
0
def test_bgp_v6_warm_boot(fixture_v6):
    ################# Author Details ################
    # Name: V Sreenivasula Reddy
    # Email:  [email protected]
    #
    ############### Test bed details ################
    #  TG --- DUT --- TG
    #################################################

    # Configuring traffic stream on the TG interfac

    tr1 = tg.tg_traffic_config(
        port_handle=tg_handler["tg_ph_2"],
        emulation_src_handle=h2['handle'],
        emulation_dst_handle=bgp_rtr2['route'][0]['handle'],
        circuit_endpoint_type='ipv6',
        mode='create',
        transmit_mode='continuous',
        length_mode='fixed',
        rate_pps=data.traffic_rate_pps,
        enable_stream_only_gen='0')

    # Starting the TG traffic after clearing the DUT counters
    papi.clear_interface_counters(dut)
    tgapi.traffic_action_control(tg_handler, actions=['clear_stats'])
    tg.tg_traffic_control(action="run", handle=tr1['stream_id'])

    bgpfeature.enable_docker_routing_config_mode(vars.D1)
    st.log("saving the BGP config in vtysh shell")
    reboot_obj.config_save(vars.D1, shell='vtysh')
    st.log("config save in D1")
    reboot_obj.config_save([vars.D1])
    st.log("Performing warm reboot")
    st.reboot(vars.D1, "warm")

    # Stopping the TG traffic
    tg.tg_traffic_control(action='stop', handle=tr1['stream_id'])
    st.wait(5)
    traffic_details = {
        '1': {
            'tx_ports': [vars.T1D1P2],
            'tx_obj': [tg],
            'exp_ratio': [1],
            'rx_ports': [vars.T1D1P1],
            'rx_obj': [tg],
        }
    }
    if not tgapi.validate_tgen_traffic(traffic_details=traffic_details,
                                       mode='aggregate',
                                       comp_type='packet_count'):
        st.report_fail("traffic_verification_failed_during_warm_reboot")
    st.report_pass("test_case_passed")
def system_save_reboot_module_hooks(request):
    # add things at the start of this module
    global vars, tg_stream
    vars = st.ensure_min_topology("D1T1:2")
    initialize_variables()
    st.log("Configuring CRM")
    crm_config()
    st.log("Checking CRM config before save and reboot")
    crm_config_verify()
    if st.is_feature_supported("interface-mtu", vars.D1):
        st.log("Configuring MTU on interface")
        mtu_config()
        st.log("Checking the configured MTU value before save and reboot")
        mtu_verify()
    if st.is_feature_supported("threshold", vars.D1):
        st.log("configuring threshold values on interface")
        threshold_config()
        st.log("configured threshold values verification")
        threshold_verify()
    st.log("Configuration of erspan")
    mirror_action_config()
    st.log("Checking ERSPAN config before save and reboot")
    mirror_action_verify()
    if st.is_feature_supported("span-mirror-session", vars.D1):
        st.log("Configuring port mirror session")
        port_mirror_config()
        st.log("Checking port mirroring(SPAN) before save and reboot")
        port_mirror_verify()
    if st.is_feature_supported("strom-control", vars.D1):
        st.log("Configuring BUM/Storm control")
        storm_control_config()
    tg_stream = config_tg_stream()

    yield
    # delete things at the end of this module"
    crm_obj.set_crm_clear_config(vars.D1)
    if st.is_feature_supported("interface-mtu", vars.D1):
        intf_obj.interface_properties_set(vars.D1, data.eth, data.property,
                                          data.mtu_default)
    if st.is_feature_supported("threshold", vars.D1):
        tf_obj.clear_threshold(vars.D1, breach='all')
        tf_obj.clear_threshold(vars.D1,
                               threshold_type='priority-group',
                               buffer_type='all')
        tf_obj.clear_threshold(vars.D1,
                               threshold_type='queue',
                               buffer_type='all')
    mirror.delete_session(vars.D1, mirror_session=data.session_name)
    bum_clear_config()
    reboot_obj.config_save(vars.D1)
Esempio n. 19
0
def system_fast_reboot_module_hooks(request):
    # add things at the start of this module
    global vars
    vars = st.ensure_min_topology("D1T1:2", 'D1D2:2', 'D2T1:1')
    initialize_variables()
    st.log("Configuring CRM")
    crm_config()
    st.log("Checking CRM config before save and fast-reboot")
    crm_config_verify()
    if st.is_feature_supported("interface-mtu", vars.D1):
        st.log("Configuring MTU on interface")
        mtu_config()
        st.log("Checking the configured MTU value before save and fast-reboot")
        mtu_verify()
    if st.is_feature_supported("threshold", vars.D1):
        st.log("configuring threshold values on interface")
        threshold_config()
        st.log("configured threshold values verification")
        threshold_verify()
    st.log("configure mirror session values")
    mirror_action_config()
    st.log("configured mirror session verification")
    mirror_action_verify()
    if st.is_feature_supported("span-mirror-session", vars.D1):
        st.log("Configuring port mirroring values")
        port_mirror_config()
        st.log("Checking port mirroring before save and reboot")
        port_mirror_verify()
    st.log("Configuring Port-Channel")
    config_portchannel()
    st.log("Configuring VLAN related configuration")
    dut_vlan_config()
    st.log("Configuring TGEN handlers and streams")
    tgen_config()
    yield
    # add things at the end of this module"
    #Setting the MTU value to default
    intf_obj.interface_properties_set(vars.D1, data.eth, data.property,
                                      data.mtu_default)
    #Below step will clear all CRM config from the device.
    crm_obj.set_crm_clear_config(vars.D1)
    #Below steps will clear all threshold values configured on the device
    tf_obj.clear_threshold(vars.D1, breach='all')
    tf_obj.clear_threshold(vars.D1,
                           threshold_type='priority-group',
                           buffer_type='all')
    tf_obj.clear_threshold(vars.D1, threshold_type='queue', buffer_type='all')
    mirror.delete_session(vars.D1, "Mirror_Ses")
    mirror.delete_session(vars.D1, mirror_session=data.session_name_port)
    rb_obj.config_save(vars.D1)
Esempio n. 20
0
def test_ft_bgp_fast_reboot():
    st.log("Enabling docker routing config mode in D1 and D2")
    bgp_obj.enable_docker_routing_config_mode(vars.D1)
    bgp_obj.enable_docker_routing_config_mode(vars.D2)
    st.log("saving the BGP config in vtysh shell")
    st.log("config save in D1 and D2")
    reboot_obj.config_save([vars.D1, vars.D2])
    st.log("Performing fast reboot")
    st.reboot(vars.D1, "fast")
    st.log("Verifying BGP is established after fast reboot")
    verify_v4_bgp_neigborship()
    if data.ipv6_support:
        st.log("Verifying BGPV6 is  established after fast reboot")
        verify_v6_bgp_neigborship()
    st.report_pass('test_case_passed')
Esempio n. 21
0
def config_nondefault_user(config='add'):
    if config == 'add':
        st.log("creating non-default username={},password={}".format(
            ssh_data.usr_non_default, ssh_data.pwd_non_default))
        config_user(vars.D1, ssh_data.usr_non_default, 'add')
        if not st.change_passwd(vars.D1, ssh_data.usr_non_default,
                                ssh_data.pwd_non_default):
            st.error(
                "Failed to create non-default username={},password={}".format(
                    ssh_data.usr_non_default, ssh_data.pwd_non_default))
            return False
        st.log('Saving the configuration')
        config_save(vars.D1)
    else:
        config_user(vars.D1, ssh_data.usr_non_default, 'del')
    return True
def test_ft_system_config_mgmt_verifying_config_with_save_warm_reboot():
    st.log("performing Config save")
    rb_obj.config_save(vars.D1)
    st.log("performing warm-reboot")
    st.reboot(vars.D1, 'warm')
    st.log("verifying crm parameters for FDB resource after warm-reboot")
    crm_fdb_config_verify()
    st.log("Send TG traffic to populate fdb entries after warm-reboot")
    tg.tg_traffic_control(action='run', stream_handle=data.streams['Ixia_1'])
    st.wait(5)
    tg.tg_traffic_control(action='stop', stream_handle=data.streams['Ixia_1'])
    st.log(
        "verifying whether proper logs are generated when crm threshold hits after warm-reboot"
    )
    crm_fdb_high_low_threshold_verify()
    st.report_pass("test_case_passed")
Esempio n. 23
0
def test_ft_config_mgmt_verifying_config_with_save_reboot():
    st.log("Configuring DUT with supported feature with CLI")
    vlan_obj.delete_all_vlan(vars.D1)
    vlan_obj.verify_vlan_config(vars.D1, data.vlan)
    vlan_obj.create_vlan(vars.D1, data.vlan)
    st.log("Configuring supported QoS features with CLI")
    st.log("Configuring IPV4 ACL with rule")
    ipv4_acl_config()
    st.log("Configuring IPV6 ACL with rule")
    ipv6_acl_config()
    st.log("Configuring COS")
    cos_config()
    st.log("Configuring WRED")
    config_ecn()
    st.log("Configuring CRM")
    crm_config()
    st.log("Configuring MTU on interface")
    intf_obj.interface_properties_set(vars.D1, data.eth, data.property,
                                      data.mtu)
    st.log("performing Config save")
    rb_obj.config_save(vars.D1)
    st.log("performing Reboot")
    st.reboot(vars.D1, 'fast')
    st.log(
        "Checking whether config is loaded to running config from config_db after reboot"
    )
    if not vlan_obj.verify_vlan_config(vars.D1, data.vlan):
        st.report_fail("Config_not_loaded_from_config_db_json")
    st.log("Checking for IPV4 ACL config")
    ipv4_acl_run_config()
    st.log("Checking for IPV6 ACL config")
    ipv6_acl_run_config()
    st.log("Checking for COS config")
    cos_run_config()
    st.log("Checking for WRED config")
    if not ecn_obj.show_ecn_config(vars.D1):
        st.report_fail("Config_not_loaded_from_config_db_json")
    st.log("Checking CRM config after save and reload")
    crm_config_verify()
    st.log("Checking the configured MTU value after save and reload")
    if not sconf_obj.verify_running_config(vars.D1, "PORT", data.eth,
                                           data.property, data.mtu):
        st.report_fail("fail_to_configure_mtu_on_Device", 1)
    st.log(
        "configuration  is successfully stored to config_db file after save and reboot"
    )
    st.report_pass("test_case_passed")
Esempio n. 24
0
def reset_module_config():
    basic_obj.delete_directory_contents(vars.D1, config_params.ztp_run_path)
    st.log("Resetting all DHCP services as part of module unconfig...")
    if ssh_conn_obj:
        con_obj.ssh_disconnect(ssh_conn_obj)
    connection_objs = [ssh_conn_obj_inb_v6, ssh_conn_obj_oob_v6]
    for connection_obj in connection_objs:
        if connection_obj:
            basic_obj.service_operations(connection_obj,
                                         config_params.dhcp6_service_name,
                                         "start", "server")
            con_obj.ssh_disconnect(connection_obj)
    if inband_ssh_conn_obj:
        basic_obj.service_operations(inband_ssh_conn_obj,
                                     config_params.dhcp_service_name, "start",
                                     "server")
        con_obj.ssh_disconnect(inband_ssh_conn_obj)
    reboot_obj.config_save(vars.D1)
def test_ft_verify_static_portchannel_config_after_fast_reboot():
    '''
    Author: Venkatesh Terli <*****@*****.**>
    Scenario - 3.3.3 Verify that portchannel configuration is retained after save and fast-reboot.
    '''
    st.log(
        'Scenario - 3.3.3 Verify that portchannel configuration is retained after save and fast-reboot.'
    )
    st.log("performing Config save")
    rbobj.config_save(vars.D1)
    st.log("performing fast-reboot")
    st.reboot(vars.D1, 'fast')
    st.log(
        "Checking whether config is loaded to running config from config_db after warm-reboot"
    )
    portchannelobj.verify_portchannel_state(vars.D1,
                                            static_data.portchannel_name)
    st.report_pass('portchannel_functionality_after_save_and_fastreboot')
Esempio n. 26
0
def test_ft_sys_soft_reboot_multiple_iter():
    '''
    Author : Sreenivasula Reddy <*****@*****.**>
    '''
    st.log("Performing save and soft-reboot")
    reboot_obj.config_save(vars.D1)
    st.log("Soft rebooting device for multiple iterations")
    for each_iter in range(1, data.iter_count + 1):
        st.log("Reload iteration number {}".format(each_iter))
        st.log("About to reload the switch")
        st.reboot(vars.D1, "fast")
        intf_obj.poll_for_interfaces(vars.D1, iteration_count=180, delay=1)
    st.log("After reload about to check 'show platform summary'")
    if not basic_obj.get_hwsku(vars.D1):
        st.report_fail("After_soft_reboot_DUT_access_fail", data.iter_count)
    st.log("performing clearconfig operation")
    reboot_obj.config_reload(vars.D1)
    st.report_pass('test_case_passed')
Esempio n. 27
0
def test_vrf_reload():
    result = 0
    ###############################################################################################################################

    reboot_api.config_save(data.dut1)
    st.vtysh(data.dut1, "copy running startup")
    st.reboot(data.dut1, 'fast')

    ###############################################################################################################################

    if not vrf_api.verify_vrf(data.dut1, vrfname=vrf_list):
        st.log('Binding of VRF to interfaces failed on DUT1')
        result += 1

    ###############################################################################################################################

    if result == 0:
        st.report_pass('test_case_passed')
    else:
        st.log('Save and reload with VRF configuration failed')
        st.report_fail('test_case_failed')
Esempio n. 28
0
def test_ft_qos_config_mgmt_verifying_config_with_save_reboot():
    st.log("performing Config save")
    rb_obj.config_save(vars.D1)
    st.log("performing reboot")
    st.reboot(vars.D1)
    st.log(
        "Checking whether config is loaded to running config from config_db after save and reboot"
    )
    st.log("Checking for IPV4 ACL config after save and reboot")
    ipv4_acl_verify()
    st.log("Checking for IPV6 ACL config after save and reboot")
    ipv6_acl_verify()
    st.log("Checking for COS config after save and reboot")
    cos_config_verify()
    st.log("Checking for wred config after save and reboot")
    wred_verify()
    st.log("checking for ecn config after save and reboot")
    ecn_verify()
    st.log(
        "configuration is successfully stored to config_db file after save and reboot"
    )
    st.report_pass("test_case_passed")
Esempio n. 29
0
def ztp_func_hooks(request):
    initialize_config_params()
    initialize_data_variables()
    basic_obj.remove_file(vars.D1, data.ztp_local_json_path)
    if st.get_func_name(
            request) == 'test_ft_ztp_behv_invalid_json_and_config_sections':
        mvrfconfig(vars.D1, cli_type="click")
        reboot_obj.config_save(vars.D1)
    basic_obj.copy_config_db_to_temp(vars.D1, data.config_db_path,
                                     data.config_db_temp)
    basic_obj.change_permissions(vars.D1, data.config_db_temp)
    # st.log("Shutting down the inband interface ...")
    # intf_obj.interface_shutdown(vars.D1, ztp_params.inband_port)
    reboot_obj.config_save(vars.D1)
    ztp_obj.enable_ztp_if_disabled(vars.D1)
    config_params.func_name = st.get_func_name(request)
    yield
    basic_obj.copy_config_db_to_temp(vars.D1, data.config_db_temp,
                                     data.config_db_path)
    ztp_obj.ztp_operations(vars.D1, "disable")
    ztp_cfg = {
        "admin-mode": True,
        "restart-ztp-interval": 30,
        "feat-console-logging": feat_logging_console
    }
    ztp_obj.config_ztp_backdoor_options(vars.D1, ztp_cfg)
    if st.get_func_name(
            request) == 'test_ft_ztp_behv_invalid_json_and_config_sections':
        mvrfconfig(vars.D1, no_form=True, cli_type="click")
    config_params.dhcp_config_file = ztp_params.dhcp.config_file
    config_params.option_type = ""
    if st.get_func_name(request) in functions_67:
        config_params.option_type = "option_67"
    elif st.get_func_name(request) in functions_225:
        config_params.option_type = "option_225"
    elif st.get_func_name(request) in functions_239:
        config_params.option_type = "option_239"
    if config_params.option_type:
        ztp_obj.clear_options_from_dhcp_server(ssh_conn_obj, config_params)
Esempio n. 30
0
def config_dut2_verify():
    st.log("Enabling docker routing config mode in D2 ")
    bgp_obj.enable_docker_routing_config_mode(vars.D2)

    st.log("saving the BGP config in vtysh shell")
    st.log("config save in D2")
    reboot_obj.config_save(vars.D2, shell='vtysh')

    st.log("Performing reboot")
    st.reboot(vars.D2)
    st.wait(data.neighborship_wait, "wait for bgp neighborship")

    st.log("Verifying BGP is established after save and reload")
    if not st.poll_wait(bgp_obj.verify_bgp_neighborship,
                        60,
                        vars.D2,
                        family=data.af_ipv4,
                        shell=data.shell_vtysh,
                        neighbor=data.local_ip_addr,
                        state='Established',
                        asn=data.local_asn4):
        st.report_fail('bgp_ip_peer_establish_fail', data.local_ip_addr)
    else:
        st.log("eBGP V4 peer neigborship is successful")

    if data.ipv6_support:
        st.log("Verifying BGPV6 is  established after save and reload")
        if not st.poll_wait(bgp_obj.verify_bgp_neighborship,
                            60,
                            vars.D2,
                            family=data.af_ipv6,
                            shell=data.shell_vtysh,
                            neighbor=data.local_ip6_addr,
                            state='Established',
                            asn=data.local_asn4):
            st.report_fail('bgp_ip6_peer_establish_fail', data.local_ip6_addr)
        else:
            st.log("eBGP V6 peer neigborship is successful")