예제 #1
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")
예제 #2
0
def test_ft_logging_verify_logs_after_system_reboot():
    """
    Author: Anil Kumar Kacharla <*****@*****.**>
    Referrence Topology :   Test bed ID:4 D1--Mgmt network
    Verify that  logs get generated upon system reboot.
    """
    st.log("Ensuring minimum topology")
    vars = st.ensure_min_topology("D1")
    data.count = '0'
    st.log("configuring syslog server in config_db file")
    slog_obj.config_syslog_server(vars.D1, [data.syslog_server])
    st.log("checking logging count")
    slog_obj.get_logging_count(vars.D1)
    count = slog_obj.get_logging_count(vars.D1)
    st.log("logging count:{}".format(count))
    st.log("performing system reboot")
    st.reboot(vars.D1, 'fast')
    st.log("checking logs after  system reboot ")
    count = slog_obj.get_logging_count(vars.D1)
    if slog_obj.get_logging_count(vars.D1) == data.count:
        st.report_fail("logs_are_not_getting_generated_after_reboot")
    else:
        st.log("Logs are generated after reboot")
        st.log("logs count after reboot:{}".format(count))
    output = bsapi.generate_tech_support(vars.D1)
    if "Tar append operation failed" in output:
        st.report_fail("Tech_support_operation_failed")
    st.report_pass("test_case_passed")
예제 #3
0
def sflow_copp_config_undo():
    copp_queue = retrun_group_dict(copp_data, 'sflow')['queue']
    string_copp = 'copp-scheduler-policy@' + copp_queue

    if "COPP_TABLE:trap.group.sflow" in copp_data.keys():
        copp_obj.set_copp_config(vars.D1, [
            "COPP_TABLE:trap.group.sflow", "cbs",
            copp_data["COPP_TABLE:trap.group.sflow"]['value']['cbs']
        ], [
            "COPP_TABLE:trap.group.sflow", "cir",
            copp_data["COPP_TABLE:trap.group.sflow"]['value']['cir']
        ])
    else:
        copp_obj.set_copp_config(vars.D1, [
            "COPP_TABLE:copp-system-sflow", "cbs",
            copp_data["COPP_TABLE:copp-system-sflow"]['value']['cbs']
        ], [
            "COPP_TABLE:copp-system-sflow", "cir",
            copp_data["COPP_TABLE:copp-system-sflow"]['value']['cir']
        ])
    if string_copp in copp_data_pir['SCHEDULER'].keys():
        if copp_data_pir['SCHEDULER'][string_copp]['pir'] != '600':
            copp_obj.set_copp_pir_config(vars.D1, 'apply', [
                string_copp, "pir",
                copp_data_pir['SCHEDULER'][string_copp]['pir']
            ])
    st.log("performing reboot")
    st.reboot(vars.D1)
예제 #4
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")
예제 #5
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")
예제 #6
0
def test_ft_arp_static_route_config_mgmt_verifying_config_with_warm_reboot():
    '''
    Author: Surendra Kumar Vella([email protected])
    Verify static ARP route config after warm-reboot
    '''

    st.log("Checking whether the platform supports warm-reboot")
    if not data.platform.lower(
    ) in data.constants['WARM_REBOOT_SUPPORTED_PLATFORMS']:
        st.report_unsupported('test_case_unsupported')
    st.log("Performing warm-reboot on DUT")
    st.reboot(vars.D1, "warm")
    st.log("Verifying static route entries after save and warm-reboot")
    st.wait(5)
    static_route_verify()
    st.log("Verifying dynamic ARP entries after save and warm-reboot")
    if not arp_obj.verify_arp(vars.D1, data.ipv4_address_tgen,
                              data.src_mac_addr, vars.D1T1P1):
        st.report_fail("ARP_entry_dynamic_entry_fail", data.ipv4_address_tgen,
                       vars.D1)
    else:
        st.log("Verified that dynamic ARP entry is present in arp table")
    if st.get_ui_type(vars.D1) != "click":
        st.log("Verifying static ARP entries after save and 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.report_pass("test_case_passed")
예제 #7
0
 def upgrade_libsai(self, dut, url):
     path = "/libsai.so"
     st.config(dut, "sudo curl --retry 15 -o {} {}".format(path, url))
     st.config(dut,
               "docker cp {} syncd:/usr/lib/libsai.so.1.0".format(path))
     st.reboot(dut)
     st.config(dut, "rm -f {}".format(path))
예제 #8
0
def config_pddf_mode(dut,
                     file_path="/usr/local/bin/pddf_util.py",
                     module_name="switch-pddf",
                     iteration=150,
                     delay=2):
    """
    API to enable / disable PDDF on the switch
    Author: Chaitanya Vella ([email protected])
    :param dut:
    :param file_path:
    :param module_name:
    :param iteration:
    :param delay:
    :return:
    """
    command = "{} {}".format(file_path, module_name)
    output = st.config(dut, command)
    st.log("OUTPUT : {}".format(output))
    if module_name == "switch-pddf":
        if 'REBOOT IS REQUIRED IMMEDIATELY' in output:
            st.reboot(dut, skip_fallback=True)
            if not poll_for_system_status(
                    dut, iteration=iteration, delay=delay):
                st.log("System status is not up ...")
                return False
        if not is_service_active(dut):
            st.log("PDDF service is not active ...")
            return False
    else:
        if is_service_active(dut):
            st.log("PDDF service is still active ...")
            return False
    return True
예제 #9
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")
예제 #10
0
def test_ft_eh_cetasonic21955():
    """
    This test case is to cover the CETA SONIC-21955 scenario
    1) Enable disable BGP error handling
    2)  Reboot the switch
    3) Check that vtysh and klish cli are accessbile after reboot or not
    :return:
    """
    report_flag = ""
    config_bgp_error_handling("yes")
    config_bgp_error_handling("no")
    st.reboot(vars.D1)
    output = bgpapi.show_bgp_ipv4_summary_vtysh(vars.D1,
                                                cli_type="vtysh",
                                                skip_tmpl=True)
    if "Error" in output:
        report_flag = "VTYSH"
    output = bgpapi.show_bgp_ipv4_summary_vtysh(vars.D1,
                                                cli_type="klish",
                                                skip_tmpl=True)
    if "Error" in output:
        report_flag += "KLISH" if not report_flag else "AND KLISH"
    config_bgp_error_handling("yes")
    if report_flag:
        st.report_fail("accessing_shell_status", report_flag, "FAILED")
    st.report_pass("accessing_shell_status", "VTYSH AND KLISH", "SUCCESS")
예제 #11
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")
예제 #12
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")
예제 #13
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")
def test_reboot_dut():
    """
    This test is to reload all the DUTs mentioned as part of TestBed file.
    :return:
    """
    for dut in st.get_dut_names():
        st.reboot(dut)
    st.report_pass("build_reboot_success")
예제 #15
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")
def fast_reboot_node(dut):
    st.reboot(dut, "fast")

    st.wait(100)
    ports = papi.get_interfaces_all(dut)
    if not ports:
        return False
    else:
        return True
예제 #17
0
def test_ft_dynamic_nat_warmboot():
    # ################ Author Details ################
    # Name: Kesava Swamy Karedla
    # Eamil: [email protected]
    # ################################################
    # Objective - FtOpSoRoNatWb001 - Verify warm boot with dynamic nat scaling entries.
    # #################################################
    result_flag=0
    platform = basic_obj.get_hwsku(vars.D1)
    common_constants = st.get_datastore(vars.D1, "constants", "default")
    if not platform.lower() in common_constants['WARM_REBOOT_SUPPORTED_PLATFORMS']:
        st.error("Warm-Reboot is not supported for this platform {}".format(platform))
        st.report_unsupported('test_case_unsupported')
    nat_obj.clear_nat(vars.D1, translations=True)
    nat_obj.config_nat_pool_binding(vars.D1, binding_name=data.bind_name[0], pool_name=data.pool_name[0],
                                    config=data.config_del)
    nat_obj.config_nat_pool_binding(vars.D1, binding_name="scale_bind", pool_name="scale_pool",
                                    acl_name=data.acl_table_in_nat_eg, config=data.config_add)
    st.log("Sending continuous traffic at 600 pps for the max dynamic nat entries to get learned")
    tg1.tg_traffic_control(action='run', handle=tg_str_data[1]["tg1_scale_nat_udp_data_str_id_1"])
    st.log("Waiting for traffic to run, such that max nat entries get learned")
    if not util_check_nat_translations_count(vars.D1,20,data.max_nat_entries):
        nat_reboot_debug_fun()
        st.log("Failed to learn max nat entries")
        result_flag = 1
    tg1.tg_traffic_control(action='stop', handle=tg_str_data[1]["tg1_scale_nat_udp_data_str_id_1"])
    # Show command for debugging purpose in case of failures.
    intf_obj.show_interface_counters_all(vars.D1)
    st.log("Warm boot verification")
    tgapi.traffic_action_control(tg_handler, actions=['clear_stats'])
    tg1.tg_traffic_control(action='run', handle=tg_str_data[1]["tg1_scale_nat_udp_data_str_id_1"])
    st.log("Performing warm-reboot, while traffic is forwarding for nat entries")
    st.reboot(vars.D1, 'warm')
    tg1.tg_traffic_control(action='stop', handle=tg_str_data[1]["tg1_scale_nat_udp_data_str_id_1"])
    traffic_details = {
        '1': {
            'tx_ports': [vars.T1D1P1],
            'tx_obj': [tg1],
            'exp_ratio': [1],
            'rx_ports': [vars.T1D1P2],
            'rx_obj': [tg2],
             }
                      }

    filter_result = tgapi.validate_tgen_traffic(traffic_details=traffic_details, mode='aggregate', comp_type='packet_count')
    if not filter_result:
        nat_reboot_debug_fun()
        st.log("Traffic loss observed for the SNAT traffic during warm-boot")
        result_flag = 1
    nat_obj.config_nat_pool_binding(vars.D1, binding_name=data.bind_name[1], pool_name=data.pool_name[1],
                                    config=data.config_add)
    nat_obj.config_nat_pool_binding(vars.D1, binding_name="scale_bind", pool_name="scale_pool",
                                    acl_name=data.acl_table_in_nat_eg, config=data.config_del)
    if result_flag:
        st.report_fail("nat_warm_reboot_failed")
    st.report_pass("test_case_passed")
예제 #18
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")
예제 #19
0
def test_ft_bootup_build_all():
    '''
    Author: Jagadish <*****@*****.**>
    Topology: DUT--- Service Port
    Test Description: Verify that SONiC installer new image download,
                      set_next_boot, list, update, set_default and
                      remove operations are successful.
    '''
    vars = st.get_testbed_vars()
    st.log("Removing additional builds")
    for build in data.build_details_list['Available']:
        if not build == data.initial_build:
            if not bootup_obj.sonic_installer_remove(vars.D1, build):
                st.report_fail("build_remove_fail", build)
    st.log("Loading build")
    build = "http://" + data.http_ip + data.build_path + "/" + data.build_name
    bootup_obj.sonic_installer_install(vars.D1, build)
    st.log("Verifying whether build is loaded or not")
    build_details_list = bootup_obj.sonic_installer_list(vars.D1)
    if not len(build_details_list['Available']) == 2:
        st.report_fail("build_load_unsuccessful")
    new_image = bootup_obj.sonic_installer_list(vars.D1)['Next'][0]
    if new_image == data.initial_build:
        st.report_fail('verify_next_active_build_as_new_build_fail')
    st.reboot(vars.D1, 'fast')
    err_count = logging_obj.get_logging_count(
        vars.D1,
        filter_list=['SIGABRT', 'Runtime error', 'SAI_STATUS_FAILURE'])
    if err_count:
        st.report_fail("error_string_found", 'string', 'show logging')
    if not bootup_obj.sonic_installer_list(vars.D1)['Current'][0] == new_image:
        st.report_fail('verify_active_build_as_new_build_fail')
    st.log("Configuring old build as next build")
    if not bootup_obj.sonic_installer_set_next_boot(vars.D1,
                                                    data.initial_build):
        st.report_fail("set_next_active_build_as_old_fail")
    st.log("Verifying next active build")
    if not bootup_obj.sonic_installer_list(
            vars.D1)['Next'][0] == data.initial_build:
        st.report_fail("verify_next_active_build_as_old_build_fail")
    st.log("Configuring new build as default build")
    if not bootup_obj.sonic_installer_set_default(vars.D1, new_image):
        st.report_fail("set_old_build_as_default_fail")
    st.log('Verify whether new build is set to next active or not')
    if not bootup_obj.sonic_installer_list(vars.D1)['Next'][0] == new_image:
        st.report_fail("verify_next_active_build_as_new_build_fail")
    st.log("Removing the old build")
    if not bootup_obj.sonic_installer_remove(vars.D1, data.initial_build):
        st.report_fail("remove_old_build_fail")
    st.log("Verifyig whether old build is deleted or not")
    if data.initial_build in bootup_obj.sonic_installer_list(
            vars.D1)['Available']:
        st.report_fail("verify_remove_old_build_fail")
    st.report_pass("test_case_passed")
예제 #20
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)
예제 #21
0
def lib_ft_pddf_reboot_cause():
    """
    Verify the output of "show reboot-cause" command.
    """
    log("# Device is rebooting - Type = {}".format(pddf_data.reboot_type))
    st.reboot(vars.D1, pddf_data.reboot_type)
    if not pddf_data.reboot_cause_dict[
            pddf_data.reboot_type] in rbapi.get_reboot_cause(
                vars.D1)[0]['message']:
        report_fail("pddf_reboot_cause_validation_failed",
                    pddf_data.reboot_type)
    report_pass("pddf_reboot_cause_validation_success", pddf_data.reboot_type)
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')
예제 #24
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 warm_reboot_node(dut):
    reboot_obj.config_warm_restart(dut, oper='enable')
    reboot_obj.config_warm_restart(dut, oper='enable', tasks=['swss', 'bgp'])
    reboot_obj.config_warm_restart(dut, bgp_timer=120)
    reboot_obj.config_warm_restart(dut, neighsyncd_timer=100)
    st.reboot(dut, "warm")

    st.wait(300)
    ports = papi.get_interfaces_all(dut)
    if not ports:
        return False
    else:
        return True
예제 #26
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')
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")
예제 #28
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")
def test_ft_netinstall_warm_reboot():
    """
    Author : Pradeep Bathula([email protected])
    Test function to verify system status after performing netinstall followed by ZTP disable and Warm reboot
    :return:
    """
    st.log("performing warm-reboot")
    st.reboot(vars.D1, 'warm')
    start_time = int(time.time())
    while True:
        current_time = int(time.time())
        if not basic_obj.poll_for_system_status(vars.D1, iteration=1):
            st.reboot(vars.D1)
            st.report_fail("system_not_ready")
        if (current_time - start_time) > 300:
            break
    st.report_pass("test_case_passed")
예제 #30
0
def test_ft_system_verify_traffic_fast_reboot():
    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("Fetching TGEN statistics")
    stats_tg1 = tgapi.get_traffic_stats(data.tg_handler["tg"],
                                        mode="aggregate",
                                        port_handle=data.tg_handler["tg_ph_1"])
    total_tx_tg1 = stats_tg1.tx.total_bytes
    stats_tg2 = tgapi.get_traffic_stats(data.tg_handler["tg"],
                                        mode="aggregate",
                                        port_handle=data.tg_handler["tg_ph_2"])
    total_rx_tg2 = stats_tg2.rx.total_bytes
    percentage_98_total_tx_tg1 = (98 * int(total_tx_tg1)) / 100
    st.log("###############")
    st.log("Sent bytes: {} and Received bytes : {}".format(
        percentage_98_total_tx_tg1, total_rx_tg2))
    st.log("##############")
    if not int(percentage_98_total_tx_tg1) <= int(total_rx_tg2):
        st.report_fail("traffic_transmission_failed", vars.T1D1P1)
    data.tg.tg_traffic_control(action="clear_stats",
                               port_handle=data.tg_handler["tg_ph_list"])
    data.tg.tg_traffic_control(action='run',
                               stream_handle=data.stream['stream_id'])
    st.reboot(vars.D1, 'fast')
    data.tg.tg_traffic_control(action='stop',
                               stream_handle=data.stream['stream_id'])
    stats_tg1 = tgapi.get_traffic_stats(data.tg_handler["tg"],
                                        mode="aggregate",
                                        port_handle=data.tg_handler["tg_ph_1"])
    total_tx_tg1 = stats_tg1.tx.total_bytes
    stats_tg2 = tgapi.get_traffic_stats(data.tg_handler["tg"],
                                        mode="aggregate",
                                        port_handle=data.tg_handler["tg_ph_2"])
    total_rx_tg2 = stats_tg2.rx.total_bytes
    percentage_98_total_tx_tg1 = (98 * int(total_tx_tg1)) / 100
    st.log("###############")
    st.log("Sent bytes: {} and Received bytes : {}".format(
        percentage_98_total_tx_tg1, total_rx_tg2))
    st.log("##############")
    if not int(percentage_98_total_tx_tg1) <= int(total_rx_tg2):
        st.report_fail("traffic_transmission_failed", vars.T1D1P1)
    st.report_pass("test_case_passed")