Exemple #1
0
def test_ft_bgp_unnumbered_bfd():
    utils_obj.banner_log('FtOtSoRtBgpUnFn006')
    # ################ Author Details ################
    # Name: Kiran Vedula
    # Email: [email protected]
    # ################################################
    result = 0
    st.log('######------Enable BFD on unnumbered BGP peers------######')
    dict1 = {
        'config': 'yes',
        'local_asn': data.d1_local_as,
        'neighbor_ip': vars.D1D2P1,
        'interface': vars.D1D2P1
    }
    dict2 = {
        'config': 'yes',
        'local_asn': data.d2_local_as,
        'neighbor_ip': vars.D2D1P1,
        'interface': vars.D2D1P1
    }
    parallel.exec_parallel(True, [vars.D1, vars.D2], bfd_obj.configure_bfd,
                           [dict1, dict2])
    if not utils.poll_wait(bfd_obj.verify_bfd_peers_brief,
                           data.wait_timer,
                           vars.D2,
                           peeraddress=d1_prt_link_local[0],
                           ouraddress=d2_prt_link_local[0],
                           status="UP"):
        st.log("Failed to get BFD status Up")
        result += 1
    if result == 0:
        st.report_pass("test_case_passed")
    else:
        st.log("BGP unnumbered neighborship failure")
        st.report_fail("test_case_failed")
Exemple #2
0
def get_root_bridge_for_vlan(dut_vlan_data, thread=True):
    params = list()
    result = dict()
    for dut, vlan in dut_vlan_data.items():
        params.append([check_dut_is_root_bridge_for_vlan, dut, vlan])
    if params:
        [out, exceptions] = exec_all(thread, params)
    utils.banner_log("Getting root bridge details")
    for i, response in enumerate(out):
        result[params[i][1]] = response
    print(result)
    return result
Exemple #3
0
def tf_collecting_debug_logs_when_test_fails(test, delay, traffic_mode):
    cutils.banner_log("TEST Failed - Collecting the DEBUG log and prints")
    tfapi.threshold_feature_debug(vars.D1,
                                  mode=['clear_counters', 'debug_log_enable'])
    tf_tg_traffic_start_stop(traffic_mode, traffic_action=False)

    tf_data.tg.tg_traffic_control(action='run',
                                  stream_handle=tf_data.stream_list)
    st.wait(delay)
    tfapi.threshold_feature_debug(
        vars.D1,
        mode=['show_counters', 'asic_info', 'show_logging'],
        platform=tf_data.platform,
        test=test)

    tf_data.tg.tg_traffic_control(action='stop',
                                  stream_handle=tf_data.stream_list)
    tfapi.threshold_feature_debug(vars.D1, mode='debug_log_disable')
Exemple #4
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)
Exemple #5
0
def test_ft_bgp_unnumbered_pc_mem_add_rem():
    # ################ Author Details ################
    # Name: Kiran Vedula
    # Email: [email protected]
    # ################################################
    utils_obj.banner_log('FtOtSoRtBgpUnFn003,FtOtSoRtBgpUnFn008')
    result = 0
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=data.portchannel_name,
                           state='Established'):
        st.log("Failed to form BGP unnumbered peering using IPv6 link local")
        result += 1
    ip_obj.config_interface_ip6_link_local(vars.D1, data.portchannel_name,
                                           'disable')
    pc_obj.add_del_portchannel_member(vars.D1, data.portchannel_name,
                                      [vars.D1D2P3, vars.D1D2P4], 'del')
    st.wait(data.wait)
    pc_obj.add_del_portchannel_member(vars.D1, data.portchannel_name,
                                      [vars.D1D2P3, vars.D1D2P4], 'add')
    ip_obj.config_interface_ip6_link_local(vars.D1, data.portchannel_name,
                                           'enable')
    st.wait(data.wait)
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=data.portchannel_name,
                           state='Established'):
        st.log("Failed to form BGP unnumbered peering using IPv6 link local")
        result += 1
    if result == 0:
        st.report_pass("test_case_passed")
    else:
        st.log(
            "BGP unnumbered neighborship failed after PC member del and re-add"
        )
        st.report_fail("test_case_failed")
Exemple #6
0
def get_stp_stats(dut, vlan, interface, param):
    """

    :param dut:
    :param vlan:
    :param interface:
    :param param:
                    tx_bpdu : BPDU Transmission count
                    rx_bpdu : BPDU Receive count
                    tx_tcn  : TCN Transmission count
                    rx_tcn  : TCN Receive count

    :return:
    """
    output = show_stp_stats_vlan(dut, vlan)
    #show_stp_config_using_klish(dut, 'statistics', vlan)
    value_list = [
        row[param] for row in output
        if int(row['st_vid']) == vlan and row['st_portno'] == interface
    ]
    utils.banner_log(value_list)
    return None if len(output) == 0 else int(value_list[0])
Exemple #7
0
def test_ft_bgp_unnumbered_peer_basic():
    # ################ Author Details ################
    # Name: Kiran Vedula
    # Email: [email protected]
    # ################################################
    utils_obj.banner_log(
        'FtOtSoRtBgpUnFn001,FtOtSoRtBgpUnFn002,FtOtSoRtBgpUnFn018,FtOtSoRtBgpUnFn019'
    )
    st.log('######------Configure Unnumbered BGP peers------######')
    result = 0
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           state='Established'):
        st.log("Failed to form BGP unnumbered peering using IPv6 link local")
        result += 1
    bgp_obj.config_bgp_neighbor_properties(vars.D1,
                                           data.d1_local_as,
                                           vars.D1D2P1,
                                           family="ipv6",
                                           neighbor_shutdown='',
                                           no_form='')
    if utils.poll_wait(bgp_obj.verify_bgp_summary,
                       data.wait,
                       vars.D1,
                       family='ipv6',
                       shell=bgp_cli_type,
                       neighbor=vars.D1D2P1,
                       state='Established'):
        st.log("unnumbered BGP peering is established even after shutdown")
        result += 1
    bgp_obj.config_bgp_neighbor_properties(vars.D1,
                                           data.d1_local_as,
                                           vars.D1D2P1,
                                           family="ipv6",
                                           neighbor_shutdown='',
                                           no_form='no')
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           state='Established'):
        st.log(
            "Failed to form BGP unnumbered peering using IPv6 link local after no shutdown"
        )
        result += 1
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=data.vlan_in_1,
                           state='Established'):
        st.log(
            "Failed to form BGP unnumbered peering using IPv6 link local on a VLAN"
        )
        result += 1
    # Get show ndp output
    st.log('######------shut/no shut link with unnumbered BGP------######')
    utils.exec_all(
        True,
        [[arp_obj.show_ndp, vars.D1, None], [arp_obj.show_ndp, vars.D2, None]])
    intf_obj.interface_operation(vars.D1,
                                 vars.D1D2P1,
                                 operation="shutdown",
                                 skip_verify=True)
    st.wait(data.wait)
    intf_obj.interface_status_show(vars.D1, vars.D1D2P1)
    intf_obj.interface_operation(vars.D1,
                                 vars.D1D2P1,
                                 operation="startup",
                                 skip_verify=True)
    st.wait(data.wait)
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           state='Established'):
        st.log("Failed to form BGP unnumbered peering using IPv6 link local")
        result += 1
    if result == 0:
        st.report_pass("test_case_passed")
    else:
        st.log("BGP IPv6 unnumbered neighborship failure")
        st.report_fail("test_case_failed")
Exemple #8
0
def test_ft_bgp_unnumbered_warmboot():
    # ################ Author Details ################
    # Name: Kiran Vedula
    # Email: [email protected]
    # ################################################
    utils_obj.banner_log('FtOtSoRtBgpUnFn009')
    utils.exec_all(True, [[bgp_obj.show_bgp_ipv6_summary_vtysh, vars.D1],
                          [bgp_obj.show_bgp_ipv6_summary_vtysh, vars.D2]])
    utils.exec_all(
        True,
        [[arp_obj.show_ndp, vars.D1, None], [arp_obj.show_ndp, vars.D2, None]])
    result = 0
    st.log('######------Warm reboot with BGP unnumbered------######')
    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('Warmboot_unsupported_platform', platform)
    reboot_obj.config_save(vars.D1, "sonic")
    reboot_obj.config_save(vars.D1, "vtysh")
    st.reboot(vars.D1, 'warm')
    st.wait(data.wait)
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D2,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D2D1P1,
                           state='Established'):
        st.log("Failed to form BGP unnumbered peering after warm reboot")
        result += 1
    st.wait(data.wait)
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D2,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=data.vlan_in_1,
                           state='Established'):
        st.log("Failed to form BGP unnumbered peering after warm reboot")
        result += 1
    st.wait(data.wait)
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D2,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=data.portchannel_name,
                           state='Established'):
        st.log("Failed to form BGP unnumbered peering after warm reboot")
        result += 1
    if result == 0:
        st.report_pass("test_case_passed")
    else:
        st.log("BGP unnumbered neighborship failed warm reboot")
        utils.exec_all(True, [[arp_obj.show_ndp, vars.D1, None],
                              [arp_obj.show_ndp, vars.D2, None]])
        utils.exec_all(True, [[bgp_obj.show_bgp_ipv6_neighbor_vtysh, vars.D1],
                              [bgp_obj.show_bgp_ipv6_neighbor_vtysh, vars.D2]])
        st.report_fail("test_case_failed")
Exemple #9
0
def test_ft_bgp_unnumbered_nondefault_vrf():
    """
    # ################ Author Details ################
    # Name: Sesha Reddy Koilkonda
    # Email: [email protected]
    # ################################################
    :return:
    """
    utils_obj.banner_log("FtOtSoRtBgpUnFn016,FtOtSoRtBgpUnFn017")
    result = 0
    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    dict1 = {'vrf_name': data.vrf_name, 'skip_error': True}
    parallel.exec_parallel(True, [vars.D1, vars.D2], vrf_api.config_vrf,
                           [dict1, dict1])
    utils.exec_all(True, [[
        ip_obj.config_interface_ip6_link_local, vars.D1, vars.D1D2P1, "disable"
    ], [
        ip_obj.config_interface_ip6_link_local, vars.D2, vars.D2D1P1, "disable"
    ]])
    dict1 = {
        'vrf_name': data.vrf_name,
        'intf_name': vars.D1D2P1,
        'skip_error': True
    }
    dict2 = {
        'vrf_name': data.vrf_name,
        'intf_name': vars.D2D1P1,
        'skip_error': True
    }

    parallel.exec_parallel(True, [vars.D1, vars.D2],
                           vrf_api.bind_vrf_interface, [dict1, dict2])
    utils.exec_all(
        True, [[ip_obj.config_interface_ip6_link_local, vars.D1, vars.D1D2P1],
               [ip_obj.config_interface_ip6_link_local, vars.D2, vars.D2D1P1]])
    utils.exec_all(True,
                   [[ip_obj.get_interface_ip_address, vars.D1, None, "ipv6"],
                    [ip_obj.get_interface_ip_address, vars.D2, None, "ipv6"]])
    dict1 = {
        'vrf_name': data.vrf_name,
        'router_id': data.d1_rid,
        'local_as': data.d1_local_as,
        'addr_family': 'ipv6',
        'neighbor': vars.D1D2P1,
        'remote_as': 'external',
        'config_type_list': ["remote-as", "activate"],
        'interface': vars.D1D2P1
    }
    dict2 = {
        'vrf_name': data.vrf_name,
        'router_id': data.d2_rid,
        'local_as': data.d2_local_as,
        'addr_family': 'ipv6',
        'neighbor': vars.D2D1P1,
        'remote_as': 'external',
        'config_type_list': ["remote-as", "activate"],
        'interface': vars.D2D1P1
    }
    parallel.exec_parallel(True, [vars.D1, vars.D2], bgp_obj.config_bgp,
                           [dict1, dict2])

    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           vrf=data.vrf_name,
                           state='Established'):
        st.error(
            "BGP unnumbered neighbourship with the non-default vrf configuration failed."
        )
        result += 1
    st.log('######------Save and reboot------######')
    reboot_obj.config_save(vars.D1, "sonic")
    reboot_obj.config_save(vars.D1, "vtysh")

    st.reboot(vars.D1)
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           vrf=data.vrf_name,
                           state='Established'):
        st.error(
            "BGP unnumbered neighbourship with the non-default vrf configuration failed after save and reboot."
        )
        result += 1
    st.log('######------Config reload with BGP unnumbered------######')
    st.log("Config reload the DUT")
    reboot_obj.config_save_reload(vars.D1)
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           vrf=data.vrf_name,
                           state='Established'):
        st.error(
            "BGP unnumbered neighbourship with the non-default vrf configuration failed after config reload."
        )
        result += 1
    # unconfig part:

    dict1 = {
        'vrf_name': data.vrf_name,
        'local_as': data.d1_local_as,
        'config': 'no',
        'removeBGP': 'yes',
        'config_type_list': ['removeBGP']
    }
    dict2 = {
        'vrf_name': data.vrf_name,
        'local_as': data.d2_local_as,
        'config': 'no',
        'removeBGP': 'yes',
        'config_type_list': ['removeBGP']
    }
    parallel.exec_parallel(True, [vars.D1, vars.D2], bgp_obj.config_bgp,
                           [dict1, dict2])
    utils.exec_all(True, [[
        ip_obj.config_interface_ip6_link_local, vars.D1, vars.D1D2P1, "disable"
    ], [
        ip_obj.config_interface_ip6_link_local, vars.D2, vars.D2D1P1, "disable"
    ]])
    dict1 = {
        'vrf_name': data.vrf_name,
        'intf_name': vars.D1D2P1,
        'skip_error': True,
        'config': 'no'
    }
    dict2 = {
        'vrf_name': data.vrf_name,
        'intf_name': vars.D2D1P1,
        'skip_error': True,
        'config': 'no'
    }
    parallel.exec_parallel(True, [vars.D1, vars.D2],
                           vrf_api.bind_vrf_interface, [dict1, dict2])
    dict1 = {'vrf_name': data.vrf_name, 'skip_error': True, 'config': 'no'}
    parallel.exec_parallel(True, [vars.D1, vars.D2], vrf_api.config_vrf,
                           [dict1, dict1])
    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    utils.exec_all(
        True,
        [[ip_obj.config_interface_ip6_link_local, vars.D1, d1_int_ipv6_list],
         [ip_obj.config_interface_ip6_link_local, vars.D2, d2_int_ipv6_list]])
    if result == 0:
        st.report_pass("test_case_passed")
    else:
        st.error(
            "BGP unnumbered neighborship failed with the non-default vrf configuration."
        )
        st.report_fail("test_case_failed")
Exemple #10
0
def test_ft_bgp_unnumbered_manual_ll():
    """
    # ################ Author Details ################
    # Name: Sesha Reddy Koilkonda
    # Email: [email protected]
    # ################################################
    :return:
    """
    utils_obj.banner_log(
        'FtOtSoRtBgpUnFn013,FtOtSoRtBgpUnFn014,FtOtSoRtBgpUnFn015')
    result = 0
    # Configure the Link-local manually on Dut1 and auto link-local on DUT2 and verify the neighbourship.
    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    ip_obj.config_ip_addr_interface(vars.D1,
                                    vars.D1D2P1,
                                    data.ip6_addr_manual_ll[0],
                                    96,
                                    family='ipv6')
    dict1 = {
        'config': 'yes',
        'router_id': data.d1_rid,
        'addr_family': 'ipv6',
        'local_as': data.d1_local_as,
        'remote_as': 'external',
        'config_type_list': ["remote-as", "activate"],
        'interface': vars.D1D2P1,
        'neighbor': vars.D1D2P1
    }
    dict2 = {
        'config': 'yes',
        'router_id': data.d2_rid,
        'addr_family': 'ipv6',
        'local_as': data.d2_local_as,
        'remote_as': 'external',
        'config_type_list': ["remote-as", "activate"],
        'interface': vars.D2D1P1,
        'neighbor': vars.D2D1P1
    }
    parallel.exec_parallel(True, [vars.D1, vars.D2], bgp_obj.config_bgp,
                           [dict1, dict2])
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           state='Established'):
        st.error(
            "Failed to form BGP unnumbered peering using IPv6 link local with the Manual-Auto link-local address combination."
        )
        result += 1
    # with the manual link-local on Dut1 and configure the link-local on DUT2 also manually and verify the neighbourship.
    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    ip_obj.config_ip_addr_interface(vars.D2,
                                    vars.D2D1P1,
                                    data.ip6_addr_manual_ll[1],
                                    96,
                                    family='ipv6')
    parallel.exec_parallel(True, [vars.D1, vars.D2], bgp_obj.config_bgp,
                           [dict1, dict2])
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           state='Established'):
        st.error(
            "Failed to form BGP unnumbered peering using IPv6 link local with the manual-manual link-local address combination."
        )
        result += 1
    # update the manual link-local on Dut2 and verify the neighbourship.
    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    data.ip6_addr_ll3 = 'FE80:0:0:0:204:5FF:FE00:500'
    ip_obj.config_ip_addr_interface(vars.D2,
                                    vars.D2D1P1,
                                    data.ip6_addr_manual_ll[2],
                                    96,
                                    family='ipv6')
    parallel.exec_parallel(True, [vars.D1, vars.D2], bgp_obj.config_bgp,
                           [dict1, dict2])
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           state='Established'):
        st.error(
            "Failed to form BGP unnumbered peering using IPv6 link local, after uodating the manual link-local address on peer DUT.."
        )
        result += 1
    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    ip_obj.config_ip_addr_interface(vars.D1,
                                    vars.D1D2P1,
                                    data.ip6_addr_manual_ll[0],
                                    96,
                                    family='ipv6',
                                    config='remove')
    ip_obj.config_ip_addr_interface(vars.D2,
                                    vars.D2D1P1,
                                    data.ip6_addr_manual_ll[1],
                                    96,
                                    family='ipv6',
                                    config='remove')
    ip_obj.config_ip_addr_interface(vars.D2,
                                    vars.D2D1P1,
                                    data.ip6_addr_manual_ll[2],
                                    96,
                                    family='ipv6',
                                    config='remove')
    if result == 0:
        st.report_pass("test_case_passed")
    else:
        st.error(
            "BGP unnumbered neighborship failed with the manual link-local address configuration."
        )
        st.report_fail("test_case_failed")
Exemple #11
0
def test_ft_tf_pg_thre_con_shared():
    """
    Author : Prudvi Mangadu ([email protected])
    """

    tf_data.index = 7
    if tf_data.platform in tf_data.th3_platforms:
        tf_data.index = 0
    st.log("Testing with PG{} for PG SHARED test on {}".format(
        tf_data.index, tf_data.platform))
    tf_data.threshold = 4

    count = 1
    while True:
        result = 1
        result2 = 1

        cutils.banner_log("TEST Starts for iteration - {}".format(count))

        config_parameter = {
            "threshold_type": 'priority-group',
            "buffer_type": 'shared',
            "port_alias": vars.D1T1P1,
            "pg{}".format(tf_data.index): tf_data.threshold
        }

        st.log("PG shared threshold config")
        tfapi.config_threshold(vars.D1,
                               threshold_type='priority-group',
                               port_alias=vars.D1T1P1,
                               index=tf_data.index,
                               buffer_type='shared',
                               value=tf_data.threshold)
        st.log("PG shared threshold config verify")
        if not tfapi.verify_threshold(vars.D1, **config_parameter):
            st.error(
                "Unable to configure the PG index and corresponding threshold value on PG shared buffer"
            )
            result = 0

        st.log("Traffic start and stop")
        tf_tg_traffic_start_stop(tf_data.unicast, tf_data.traffic_duration)

        st.log("Checking PG shared breach event")
        if not tfapi.verify_threshold_breaches(vars.D1,
                                               buffer='priority-group',
                                               port=vars.D1T1P1,
                                               index=tf_data.index,
                                               threshold_type='shared'):
            st.error("PG shared threshold breach Event is not found")
            if tf_data.need_debug_prints:
                tf_collecting_debug_logs_when_test_fails(
                    'shared', tf_data.traffic_duration, tf_data.unicast)
            result = 0
            result2 = 0

        st.log("Clear PG shared threshold breach")
        tfapi.clear_threshold(vars.D1, breach='all')

        st.log("Checking PG shared breach event")
        if tfapi.verify_threshold_breaches(vars.D1,
                                           buffer='priority-group',
                                           port=vars.D1T1P1,
                                           index=tf_data.index,
                                           threshold_type='shared'):
            st.error("Post clear - PG shared threshold breach Event is found")
            result = 0

        st.log("PG shared threshold config clear")
        tfapi.clear_threshold(vars.D1,
                              threshold_type='priority-group',
                              port_alias=vars.D1T1P1,
                              index=tf_data.index,
                              buffer_type='shared')
        st.log("PG shared threshold config verify")
        if tfapi.verify_threshold(vars.D1, **config_parameter):
            st.error(
                "Unable to configure the PG index and corresponding shared threshold value"
            )
            result = 0

        if not result2 and tf_data.need_debug_prints:
            st.log(
                "As Breach events are not observed collecting logs by disabling the Thresholds"
            )
            tf_collecting_debug_logs_when_test_fails('shared',
                                                     tf_data.traffic_duration,
                                                     tf_data.unicast)

        tfapi.clear_threshold(vars.D1, breach='all')

        if result:
            st.log("Test PASSED in Iteration {}.".format(count))
            report_result(result)
            break

        if count == tf_data.test_max_retries_count:
            st.log("Test Failed in all {} Iterations. Hence Declaring as FAIL".
                   format(count))
            report_result(result)

        st.log(
            "Test Failed in the Iteration-{}. Hence re-testing".format(count))
        count += 1
Exemple #12
0
def gnmi_call(dut, **kwargs):
    """
    Call to test gnmi session using diff users w.r.t RBAC.
    Author : Prudvi Mangadu ([email protected])
    :param dut:
    :param kwargs:
    :return:
    """
    banner_log('Performing gnmi operations using - {}'.format(kwargs))

    for each in ['login_type', 'username', 'password', 'mode']:
        if not kwargs.get(each):
            st.error("Mandatory argument is not found - {}".format(each))
            return False

    dut_ip = "127.0.0.1"
    result = {'gnmi_get_out': True, 'gnmi_set_out': True}
    result2 = True
    username = kwargs.get('username')
    password = kwargs.get('password')
    cert = kwargs.get('cert')
    login_type = kwargs.get('login_type')
    mode = kwargs.get('mode')
    port = st.get_free_ports(dut)[0]
    insecure = kwargs.get('insecure', '')
    xpath = '/openconfig-interfaces:interfaces/interface[name={}]/config/description'.format(
        port)
    json_content = {"openconfig-interfaces:description": "Eth"}

    if login_type == 'cred':
        gnmi_set_out = gnmi_set(dut,
                                xpath,
                                json_content=json_content,
                                ip_address=dut_ip,
                                username=username,
                                password=password)
        st.log(gnmi_set_out)
        gnmi_get_out = gnmi_get(dut,
                                xpath,
                                ip_address=dut_ip,
                                username=username,
                                password=password)
        st.log(gnmi_get_out)

    elif login_type == 'cert':
        gnmi_set_out = gnmi_set(dut,
                                xpath,
                                json_content=json_content,
                                ip_address=dut_ip,
                                cert=cert,
                                username=None,
                                password=None,
                                insecure='none',
                                target_name='admin')
        st.log(gnmi_set_out)
        gnmi_get_out = gnmi_get(dut,
                                xpath,
                                ip_address=dut_ip,
                                cert=cert,
                                username=None,
                                password=None,
                                insecure='none',
                                target_name='admin')
        st.log(gnmi_get_out)

    else:
        st.error("Invalid 'login_type' used = {}".format(login_type))
        return False

    if mode == 'rw':
        if not (gnmi_set_out and gnmi_get_out):
            st.report_fail('rbac_call_fail', "gNMI", mode, login_type)
    else:
        if not (not gnmi_set_out and gnmi_get_out):
            st.report_fail('rbac_call_fail', "gNMI", mode, login_type)

    msg = 'Failed to execute set command using gNMI session with mode- {mode}, type- {login_type}'
    if mode == 'rw' and "op: UPDATE" not in gnmi_set_out and "description" not in str(
            gnmi_get_out):
        st.error(msg.format(**kwargs))
        result2 = False
    if mode == 'ro' and not gnmi_set_out and "description" not in str(
            gnmi_get_out):
        st.error(msg.format(**kwargs))
        result2 = False

    if not result2:
        st.report_fail('rbac_test_status', 'Fail', mode, 'gNMI', login_type,
                       result)
    st.report_pass('rbac_test_status', 'Pass', mode, 'gNMI', login_type,
                   result)
Exemple #13
0
def test_ft_bgp_unnumbered_traffic():
    """
    # ################ Author Details ################
    # Name: Sesha Reddy Koilkonda
    # Email: [email protected]
    # ################################################
    :return:
    """
    utils_obj.banner_log('FtOtSoRtBgpUnFn021')
    (tg1, tg2, tg_ph_1, tg_ph_2) = get_handles()
    dut1_mac = basic_obj.get_ifconfig_ether(vars.D1, vars.D1T1P1)
    h1 = tg1.tg_interface_config(port_handle=tg_ph_1,
                                 mode='config',
                                 intf_ip_addr=data.tg_ip4_addr_l[0],
                                 gateway=data.tgd_ip4_addr_l[0],
                                 src_mac_addr='00:0a:01:00:00:01',
                                 arp_send_req='1')
    h2 = tg2.tg_interface_config(port_handle=tg_ph_2,
                                 mode='config',
                                 intf_ip_addr=data.tg_ip4_addr_l[1],
                                 gateway=data.tgd_ip4_addr_l[1],
                                 src_mac_addr='00:0a:01:00:00:01',
                                 arp_send_req='1')
    # Advertise a network to peer
    network = '55.1.1.0/24'
    bgp_obj.advertise_bgp_network(vars.D2, data.d2_local_as, network)
    stream_tg1 = tg1.tg_traffic_config(port_handle=tg_ph_1,
                                       mode='create',
                                       transmit_mode="single_burst",
                                       length_mode='fixed',
                                       pkts_per_burst=1000,
                                       mac_src='00.00.00.11.12.53',
                                       mac_dst=dut1_mac,
                                       l3_protocol='ipv4',
                                       ip_src_addr=data.tg_ip4_addr_l[0],
                                       ip_dst_addr=data.tg_ip4_addr_l[1],
                                       port_handle2=tg_ph_2)
    stream_id = stream_tg1['stream_id']
    tg1.tg_traffic_control(action='run', stream_handle=stream_id)
    st.wait(5)
    tg1.tg_traffic_control(action='stop', stream_handle=stream_id)
    traffic_details = {
        '1': {
            'tx_ports': [vars.T1D1P1],
            'tx_obj': [tg1],
            'exp_ratio': [1],
            'rx_ports': [vars.T1D2P1],
            'rx_obj': [tg2],
            'stream_list': [(stream_id)],
        }
    }
    # verify statistics
    aggrResult = validate_tgen_traffic(traffic_details=traffic_details,
                                       mode='aggregate',
                                       comp_type='packet_count')
    tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1)
    tg1.tg_interface_config(port_handle=tg_ph_1,
                            handle=h1['handle'],
                            mode='destroy')
    tg2.tg_interface_config(port_handle=tg_ph_2,
                            handle=h2['handle'],
                            mode='destroy')
    bgp_obj.advertise_bgp_network(vars.D2,
                                  data.d2_local_as,
                                  network,
                                  config='no')
    if aggrResult:
        st.log("IPv4 traffic over BGPv6 unnumbered neighbour is passed")
        st.report_pass("test_case_passed")
    else:
        st.error("IPv4 traffic over BGPv6 unnumbered neighbour is failed.")
        st.report_fail("test_case_failed")
Exemple #14
0
def test_ft_bgp_unnumbered_clear_bgp_ndp():
    # ################ Author Details ################
    # Name: Kiran Vedula
    # Email: [email protected]
    # ################################################
    utils_obj.banner_log(
        'FtOtSoRtBgpUnFn004,FtOtSoRtBgpUnFn005,FtOtSoRtBgpUnFn007')
    result = 0
    st.log('######------Clear BGP on both nodes------######')
    utils.exec_all(True, [[arp_obj.clear_ndp_table, vars.D1],
                          [arp_obj.clear_ndp_table, vars.D2]])
    utils.exec_all(True,
                   [[arp_obj.show_ndp, vars.D1], [arp_obj.show_ndp, vars.D2]])
    utils.exec_all(True, [[bgp_obj.clear_ip_bgp_vtysh, vars.D1],
                          [bgp_obj.clear_ip_bgp_vtysh, vars.D2]])
    utils.exec_all(True,
                   [[arp_obj.show_ndp, vars.D1], [arp_obj.show_ndp, vars.D2]])
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           state='Established'):
        st.log("Failed to form BGP unnumbered peering after clear NDP/BGP")
        result += 1
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D2,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D2D1P1,
                           state='Established'):
        st.log("Failed to form BGP unnumbered peering after clear NDP/BGP")
        result += 1
    utils.exec_all(True, [[ip_obj.config_ipv6, vars.D1, "disable"],
                          [ip_obj.config_ipv6, vars.D2, "disable"]])
    utils.exec_all(True, [[bgp_obj.clear_ip_bgp_vtysh, vars.D1],
                          [bgp_obj.clear_ip_bgp_vtysh, vars.D2]])
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D2,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D2D1P1,
                           state='Active'):
        st.log("BGP unnumbered peers established even after disable IPv6")
        result += 1
    utils.exec_all(True, [[ip_obj.config_ipv6, vars.D1, "enable"],
                          [ip_obj.config_ipv6, vars.D2, "enable"]])
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D2,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D2D1P1,
                           state='Established'):
        st.log("Failed to form BGP unnumbered peering after enable IPv6")
        result += 1
    if result == 0:
        st.report_pass("test_case_passed")
    else:
        st.log("BGP unnumbered neighborship failed after config state toggle")
        st.report_fail("test_case_failed")
Exemple #15
0
def test_ft_tf_queue_thre_con_multicast():
    """
    Author : Prudvi Mangadu ([email protected])
    """

    tf_data.index = 0
    tf_data.threshold = 2
    count = 1
    while True:
        result = 1
        result2 = 1

        cutils.banner_log("TEST Starts for iteration - {}".format(count))

        st.log("Multicast queue threshold config")
        tfapi.config_threshold(vars.D1,
                               threshold_type='queue',
                               port_alias=vars.D1T1P4,
                               index=tf_data.index,
                               buffer_type='multicast',
                               value=tf_data.threshold)
        st.log("Multicast queue threshold config verify")
        if not tfapi.verify_threshold(vars.D1,
                                      threshold_type='queue',
                                      buffer_type='multicast',
                                      port_alias=vars.D1T1P4,
                                      mc0=tf_data.threshold):
            st.error(
                "Unable to configure multicast queue threshold value on multicast-queue buffer"
            )
            result = 0

        st.log("Traffic start and stop")
        tf_tg_traffic_start_stop(tf_data.multicast,
                                 tf_data.traffic_duration + 7)

        st.log("Checking multicast queue breach event")
        if not tfapi.verify_threshold_breaches(vars.D1,
                                               buffer='queue',
                                               port=vars.D1T1P4,
                                               index=tf_data.index,
                                               threshold_type='multicast'):
            st.error("Multicast queue threshold breach Event is not found")
            if tf_data.need_debug_prints:
                tf_collecting_debug_logs_when_test_fails(
                    'multicast', tf_data.traffic_duration + 7,
                    tf_data.multicast)
            result = 0
            result2 = 0

        st.log("Clear Multicast queue threshold breach")
        tfapi.clear_threshold(vars.D1, breach='all')

        st.log("Checking multicast queue breach event")
        if tfapi.verify_threshold_breaches(vars.D1,
                                           buffer='multicast',
                                           port=vars.D1T1P4,
                                           index=tf_data.index,
                                           threshold_type='queue'):
            st.error(
                "Post clear - Multicast queue threshold breach Event is found")
            result = 0

        st.log("Multicast queue threshold config clear")
        tfapi.clear_threshold(vars.D1,
                              threshold_type='queue',
                              port_alias=vars.D1T1P4,
                              index=tf_data.index,
                              buffer_type='multicast')
        st.log("Multicast queue threshold config verify")
        if tfapi.verify_threshold(vars.D1,
                                  threshold_type='queue',
                                  buffer_type='multicast',
                                  port_alias=vars.D1T1P4,
                                  mc0=tf_data.threshold):
            st.error("Unable to configure multicast queue threshold value")
            result = 0

        if not result2 and tf_data.need_debug_prints:
            st.log(
                "As Breach events are not observed collecting logs by disabling the Thresholds"
            )
            tf_collecting_debug_logs_when_test_fails('multicast',
                                                     tf_data.traffic_duration,
                                                     tf_data.multicast)

        tfapi.clear_threshold(vars.D1, breach='all')
        if result:
            st.log("Test PASSED in Iteration {}.".format(count))
            report_result(result)
            break

        if count == tf_data.test_max_retries_count:
            st.log("Test Failed in all {} Iterations. Hence Declaring as FAIL".
                   format(count))
            report_result(result)

        st.log(
            "Test Failed in the Iteration-{}. Hence re-testing".format(count))
        count += 1
Exemple #16
0
def rest_rbac_call(dut, **kwargs):
    """
    Call to test REST sessions using diff users w.r.t RBAC.
    Author : Prudvi Mangadu ([email protected])
    :param dut:
    :param kwargs:
    :return:
    """
    banner_log('Performing REST call using - {}'.format(kwargs))
    for each in ['login_type', 'username', 'password', 'mode']:
        if not kwargs.get(each):
            st.error("Mandatory argument is not found - {}".format(each))
            return False

    result = {'get': True, 'put': True}
    result2 = True
    pass_status = [200, 204]
    fail_status = [401, 403]
    username = kwargs.get('username')
    password = kwargs.get('password')
    login_type = kwargs.get('login_type')
    mode = kwargs.get('mode')
    operation_down = {"sonic-port:admin_status": "down"}
    operation_up = {"sonic-port:admin_status": "up"}
    port = st.get_free_ports(dut)[0]
    device_ip = st.get_mgmt_ip(dut)
    cert = kwargs.get("cert")
    url = 'restconf/data/sonic-port:sonic-port/PORT/PORT_LIST={}/admin_status'.format(
        port)

    if login_type == 'cred':
        headers1 = {
            'Content-Type': 'application/yang-data+json',
            'Accept': 'application/yang-data+json'
        }
        rest_get_out = rest_call(dut,
                                 headers=headers1,
                                 username=username,
                                 password=password,
                                 url=url,
                                 call_type='get')
        st.log(rest_get_out)
        rest_put_out = rest_call(dut,
                                 headers=headers1,
                                 username=username,
                                 password=password,
                                 url=url,
                                 call_type='put',
                                 data=operation_down)
        st.log(rest_put_out)

    elif login_type == 'token':
        headers2 = {
            'Content-Type': 'application/yang-data+json',
            'Accept': 'application/yang-data+json',
            'Authorization': 'Bearer {}'
        }
        tocken = get_jwt_token(dut, username=username, password=password)
        if not tocken:
            st.report_fail('rbac_test_jwt_token_fail', mode, login_type)
        headers2['Authorization'] = headers2['Authorization'].format(tocken)
        rest_get_out = rest_call(dut,
                                 headers=headers2,
                                 url=url,
                                 call_type='get')
        st.log(rest_get_out)
        rest_put_out = rest_call(dut,
                                 headers=headers2,
                                 url=url,
                                 call_type='put',
                                 data=operation_up)
        st.log(rest_put_out)

    elif login_type == 'cert':
        get_curl = 'curl --key {} --cert {} ' \
              '"https://localhost/restconf/data/sonic-port:sonic-port/PORT/PORT_LIST={}/admin_status"' \
              ' -k'.format(cert[0], cert[1], port)
        out = st.show(dut, get_curl, skip_tmpl=True, skip_error_check=True)
        rest_get_out = {'status': 401}
        rest_put_out = {'status': 200}
        if 'sonic-port:admin_status' in out:
            rest_get_out = {'status': 200}

    else:
        st.error("Invalid 'login_type' used = {}".format(login_type))
        return False

    if not (rest_get_out and rest_put_out):
        st.report_fail('rbac_call_fail', "REST", mode, login_type)

    msg = 'Failed to authenticate  using rest session with mode- {mode}, type- {login_type}'
    if mode == 'rw' and not (rest_get_out["status"] in pass_status
                             and rest_put_out["status"] in pass_status):
        st.error(msg.format(**kwargs))
        result2 = False
    if mode == 'ro' and not (rest_get_out["status"] in pass_status
                             and rest_put_out["status"] in fail_status):
        st.error(msg.format(**kwargs))
        result2 = False

    if not result2:
        st.report_fail('rbac_test_status', 'Fail', mode, 'REST', login_type,
                       result)
    st.report_pass('rbac_test_status', 'Pass', mode, 'REST', login_type,
                   result)
Exemple #17
0
def test_ft_bgp_unnumbered_rmap():
    """
    # ################ Author Details ################
    # Name: Sesha Reddy Koilkonda
    # Email: [email protected]
    # ################################################
    :return:
    """
    utils_obj.banner_log('FtOtSoRtBgpUnFn010,FtOtSoRtBgpUnFn016')
    result = 0
    network_ipv6 = '6002:1::0/64'

    bgp_obj.config_bgp(config='yes',
                       dut=vars.D2,
                       local_as=data.d2_local_as,
                       addr_family='ipv6',
                       neighbor=vars.D2D1P1,
                       weight='35000',
                       config_type_list=["weight"])
    bgp_obj.config_bgp_network_advertise(vars.D1,
                                         data.d1_local_as,
                                         network_ipv6,
                                         addr_family='ipv6',
                                         config='yes',
                                         network_import_check=True)
    st.wait(60)
    n1 = ip_obj.verify_ip_route(vars.D2,
                                family='ipv6',
                                shell='sonic',
                                ip_address='6002:1::/64')
    if (n1 is False):
        st.error("Failed to advertise the ipv6 network to the peer")
        result += 1
    bgp_obj.get_ip_bgp_route(vars.D2, family="ipv6", network="6002:1/64")
    # Add route-map to advertised network
    ip_obj.config_access_list(vars.D1,
                              'Ubgp-access-list1',
                              network_ipv6,
                              'deny',
                              family='ipv6',
                              seq_num="1")
    ip_obj.config_route_map_match_ip_address(vars.D1,
                                             'Ubgp-rmap',
                                             'deny',
                                             '10',
                                             'Ubgp-access-list1',
                                             family='ipv6')
    bgp_obj.advertise_bgp_network(vars.D1,
                                  data.d1_local_as,
                                  network_ipv6,
                                  'Ubgp-rmap',
                                  family='ipv6')
    # verify route-map to advertised network
    n1 = ip_obj.verify_ip_route(vars.D2,
                                family='ipv6',
                                shell='sonic',
                                ip_address='6002:1::/64')
    if (n1 is True):
        st.error(
            "Advertised network is not filtered by the configured route map")
        result += 1
    else:
        st.log("As expected, advertised network is filtered by the route map.")
    # Veirfy the BGP unnumbered neighbourship post r-map config
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           state='Established'):
        st.error(
            "Failed to form BGP unnumbered peering using IPv6 link local, with the route map configuration."
        )
        result += 1
    # Unconfig the r-map and verify the BGP neighbourship
    ip_obj.config_route_map_mode(vars.D1,
                                 'Ubgp-rmap',
                                 'deny',
                                 '10',
                                 config='no')
    ip_obj.config_access_list(vars.D1,
                              'Ubgp-access-list1',
                              network_ipv6,
                              'deny',
                              config='no',
                              family='ipv6',
                              seq_num="1")
    bgp_obj.config_bgp(config='no',
                       dut=vars.D2,
                       local_as=data.d2_local_as,
                       addr_family='ipv6',
                       neighbor=vars.D2D1P1,
                       weight='35000',
                       config_type_list=["weight"])
    bgp_obj.config_bgp_network_advertise(vars.D1,
                                         data.d1_local_as,
                                         network_ipv6,
                                         addr_family='ipv6',
                                         config='no')
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           state='Established'):
        st.error(
            "Failed to form BGP unnumbered peering using IPv6 link local, after route map un-configuration."
        )
        result += 1
    if result == 0:
        st.report_pass("test_case_passed")
    else:
        st.error(
            "BGP unnumbered neighborship failed with the route map configuration."
        )
        st.report_fail("test_case_failed")
Exemple #18
0
def ssh_call(dut, remote_dut=None, **kwargs):
    """
    Call to test SSH session using diff users w.r.t RBAC.
    Author : Prudvi Mangadu ([email protected])
    :param dut:
    :param remote_dut:
    :param kwargs:
    :return:
    """
    banner_log('Performing SSH call using - {}'.format(kwargs))
    for each in ['login_type', 'username', 'password', 'mode']:
        if not kwargs.get(each):
            st.error("Mandatory argument is not found - {}".format(each))
            return False

    dut_ip = st.get_mgmt_ip(dut)
    result = {'show': True, 'config': True}
    result2 = True
    username = kwargs.get('username')
    password = kwargs.get('password')
    login_type = kwargs.get('login_type')
    mode = kwargs.get('mode')

    if login_type == 'cred':
        ssh_out = st.exec_ssh(dut, username, password, [
            'show vlan config', 'sudo config vlan add 100\n{}'.format(password)
        ])
        st.log(ssh_out)
    elif login_type == 'pubkey':
        show_out = st.exec_ssh_remote_dut(remote_dut, dut_ip, username,
                                          password, 'show vlan config')
        config_out = st.exec_ssh_remote_dut(
            remote_dut, dut_ip, username, password,
            'sudo config vlan add 100\n{}'.format(password))
        ssh_out = show_out + "\n" + config_out
    else:
        st.error("Invalid 'login_type' used = {}".format(login_type))
        return False

    if not ssh_out:
        st.report_fail('rbac_call_fail', "SSH", mode, login_type)

    if 'Sorry, user {} is not allowed to execute'.format(username) in ssh_out or \
            "no askpass program specified" in ssh_out:
        result['config'] = False
    if 'VID' not in ssh_out:
        result['show'] = False
    st.log(result)

    msg = 'Failed to execute show command using ssh session with mode- {mode}, type- {login_type}'
    if mode == 'rw' and not all(result.values()):
        st.error(msg.format(**kwargs))
        result2 = False
    if mode == 'ro' and not (result['show'] and not result['config']):
        st.error(msg.format(**kwargs))
        result2 = False

    if not result2:
        st.report_fail('rbac_test_status', 'Fail', mode, 'SSH', login_type,
                       result)
    st.report_pass('rbac_test_status', 'Pass', mode, 'SSH', login_type, result)
Exemple #19
0
def test_ft_bgp_unnumbered_rr():
    """
    # ################ Author Details ################
    # Name: Sesha Reddy Koilkonda
    # Email: [email protected]
    # ################################################
    :return:
    """
    utils_obj.banner_log('FtOtSoRtBgpUnFn011,FtOtSoRtBgpUnFn012')
    result = 0

    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    dict1 = {
        'config': 'yes',
        'router_id': data.d1_rid,
        'addr_family': 'ipv6',
        'local_as': data.d1_local_as,
        'remote_as': 'internal',
        'config_type_list': ["remote-as", "activate"],
        'interface': vars.D1D2P1,
        'neighbor': vars.D1D2P1
    }
    dict2 = {
        'config': 'yes',
        'router_id': data.d2_rid,
        'addr_family': 'ipv6',
        'local_as': data.d1_local_as,
        'remote_as': 'internal',
        'config_type_list': ["remote-as", "activate"],
        'interface': vars.D2D1P1,
        'neighbor': vars.D2D1P1
    }
    parallel.exec_parallel(True, [vars.D1, vars.D2], bgp_obj.config_bgp,
                           [dict1, dict2])
    result_rr = bgp_obj.create_bgp_route_reflector_client(
        vars.D1, data.d1_local_as, 'ipv6', vars.D1D2P1, 'yes')
    if not result_rr:
        st.error(
            "BGP SP - Configuring client reflection on {} {} bgp {} Failed".
            format(vars.D1, 'ipv6', data.d1_local_as))
        result += 1
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           state='Established'):
        st.error(
            "Failed to form iBGP unnumbered peering using IPv6 link local with Route-reflector-client config"
        )
        result += 1
    # Unconfiguration
    bgp_obj.create_bgp_route_reflector_client(vars.D1,
                                              data.d1_local_as,
                                              'ipv6',
                                              vars.D1D2P1,
                                              config='no')

    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    if result == 0:
        st.report_pass("test_case_passed")
    else:
        st.error(
            "BGP unnumbered neighborship failed with the Route-reflector-client configuration failed."
        )
        st.report_fail("test_case_failed")