def test_ft_verify_static_portchannel_enable_disable_with_MTU_Value():
    '''
    Author: Venkatesh Terli <*****@*****.**>
    Scenario - 3.1.4 Verify that mtu value is configured and enable/disable the portchannel.
    '''
    st.log(
        'Scenario - 3.1.4 Verify that mtu value is configured and enable/disable the portchannel.'
    )
    portchannelobj.add_del_portchannel_member(vars.D1,
                                              static_data.portchannel_name,
                                              static_data.members_dut1, 'del')
    intfobj.interface_properties_set(
        vars.D1, static_data.members_dut1 + [static_data.portchannel_name],
        'mtu', '4096')
    portchannelobj.add_del_portchannel_member(vars.D1,
                                              static_data.portchannel_name,
                                              static_data.members_dut1)
    portchannelobj.add_del_portchannel_member(vars.D1,
                                              static_data.portchannel_name,
                                              static_data.members_dut1, 'del')
    intfobj.interface_properties_set(
        vars.D1, static_data.members_dut1 + [static_data.portchannel_name],
        'mtu', static_data.mtu_default)
    portchannelobj.add_del_portchannel_member(vars.D1,
                                              static_data.portchannel_name,
                                              static_data.members_dut1)
    intfobj.interface_operation(vars.D1,
                                static_data.portchannel_name,
                                operation="shutdown")
    if not intfobj.interface_operation(
            vars.D1, static_data.portchannel_name, operation="startup"):
        st.report_fail('portchannel_state_fail', static_data.portchannel_name,
                       vars.D1, 'down')
    st.report_pass('Enable_disable_portchannel_with_mtu',
                   static_data.portchannel_name)
示例#2
0
def test_ft_port_frame_fwd_diff_mtu():
    intfapi.get_interface_property(vars.D1, vars.D1T1P1, "mtu")
    intfapi.get_interface_property(vars.D1, vars.D1T1P2, "mtu")
    st.log("Configuring MTU values for each interface")
    intfapi.interface_properties_set(vars.D1, [vars.D1T1P1, vars.D1T1P2], 'mtu', intf_data.mtu1)

    intf_data.tg.tg_traffic_control(action='run', stream_handle=[intf_data.streams['mtu1'], intf_data.streams['mtu2']])
    st.wait(2)
    intf_data.tg.tg_traffic_control(action='stop', stream_handle=[intf_data.streams['mtu1'], intf_data.streams['mtu2']])
    st.log("Fetching TGen statistics")
    traffic_details = {
        '1': {
            'tx_ports': [vars.T1D1P1],
            'tx_obj': [intf_data.tg],
            'exp_ratio': [[1, 0]],
            'rx_ports': [vars.T1D1P2],
            'rx_obj': [intf_data.tg],
            'stream_list': [[intf_data.streams['mtu1'], intf_data.streams['mtu2']]],
        },
    }
    streamResult = tgapi.validate_tgen_traffic(traffic_details=traffic_details, mode='streamblock',
                                               comp_type='packet_count')
    if not streamResult:
        st.report_fail("traffic_transmission_failed", vars.T1D1P1)
    st.report_pass("test_case_passed")
示例#3
0
def test_ft_ovr_counters():
    """
    Author: Ramprakash Reddy ([email protected])
    Verify tx_ovr and rx_ovr counters should not increment.
    Verify rx_err counters should increment, when framesize is more than MTU.
    """
    flag = 1
    properties = ['rx_ovr', 'tx_ovr']
    intf_data.port_list = [vars.D1T1P1, vars.D1T1P2]
    intfapi.clear_interface_counters(vars.D1)
    intf_data.tg.tg_traffic_control(
        action='clear_stats',
        port_handle=[intf_data.tg_ph_1, intf_data.tg_ph_2])

    intf_data.tg.tg_traffic_control(action='run',
                                    stream_handle=[
                                        intf_data.streams['traffic_tg1'],
                                        intf_data.streams['traffic_tg2']
                                    ])
    st.wait(intf_data.wait_sec)
    intf_data.tg.tg_traffic_control(action='stop',
                                    stream_handle=[
                                        intf_data.streams['traffic_tg1'],
                                        intf_data.streams['traffic_tg2']
                                    ])
    counters = intfapi.get_interface_counter_value(vars.D1,
                                                   intf_data.port_list,
                                                   properties)
    for each_port in intf_data.port_list:
        for each_property in properties:
            value = counters[each_port][each_property]
            if value:
                flag = 0
                st.error(
                    "{} counters value expected 0, but found {} for port {}".
                    format(each_property, value, each_port))
    if flag == 1:
        st.log("rx_ovr and tx_ovr counters is not increasing as expected")
    intfapi.clear_interface_counters(vars.D1)
    intfapi.interface_properties_set(vars.D1, vars.D1T1P1, 'mtu',
                                     intf_data.mtu)
    intf_data.tg.tg_traffic_control(action='clear_stats',
                                    port_handle=[intf_data.tg_ph_1])
    intf_data.tg.tg_traffic_control(
        action='run', stream_handle=intf_data.streams['traffic_tg1'])
    st.wait(intf_data.wait_sec)
    intf_data.tg.tg_traffic_control(
        action='stop', stream_handle=intf_data.streams['traffic_tg1'])
    rx_err = intfapi.get_interface_counter_value(
        vars.D1, vars.D1T1P1, properties="rx_err")[vars.D1T1P1]['rx_err']

    if not rx_err:
        st.report_fail("interface_rx_err_counters_fail", vars.D1T1P1)
    if flag == 1:
        st.log("rx_err counters is increasing as expected")
    if flag == 0:
        st.report_fail("test_case_failed")
    st.report_pass("test_case_passed")
示例#4
0
def system_fast_reboot_module_hooks(request):
    # add things at the start of this module
    global vars
    vars = st.ensure_min_topology("D1T1:2", 'D1D2:2', 'D2T1:1')
    initialize_variables()
    st.log("Configuring CRM")
    crm_config()
    st.log("Checking CRM config before save and fast-reboot")
    crm_config_verify()
    if st.is_feature_supported("interface-mtu", vars.D1):
        st.log("Configuring MTU on interface")
        mtu_config()
        st.log("Checking the configured MTU value before save and fast-reboot")
        mtu_verify()
    if st.is_feature_supported("threshold", vars.D1):
        st.log("configuring threshold values on interface")
        threshold_config()
        st.log("configured threshold values verification")
        threshold_verify()
    st.log("configure mirror session values")
    mirror_action_config()
    st.log("configured mirror session verification")
    mirror_action_verify()
    if st.is_feature_supported("span-mirror-session", vars.D1):
        st.log("Configuring port mirroring values")
        port_mirror_config()
        st.log("Checking port mirroring before save and reboot")
        port_mirror_verify()
    st.log("Configuring Port-Channel")
    config_portchannel()
    st.log("Configuring VLAN related configuration")
    dut_vlan_config()
    st.log("Configuring TGEN handlers and streams")
    tgen_config()
    yield
    # add things at the end of this module"
    #Setting the MTU value to default
    intf_obj.interface_properties_set(vars.D1, data.eth, data.property,
                                      data.mtu_default)
    #Below step will clear all CRM config from the device.
    crm_obj.set_crm_clear_config(vars.D1)
    #Below steps will clear all threshold values configured on the device
    tf_obj.clear_threshold(vars.D1, breach='all')
    tf_obj.clear_threshold(vars.D1,
                           threshold_type='priority-group',
                           buffer_type='all')
    tf_obj.clear_threshold(vars.D1, threshold_type='queue', buffer_type='all')
    mirror.delete_session(vars.D1, "Mirror_Ses")
    mirror.delete_session(vars.D1, mirror_session=data.session_name_port)
    rb_obj.config_save(vars.D1)
def system_save_reboot_module_hooks(request):
    # add things at the start of this module
    global vars, tg_stream
    vars = st.ensure_min_topology("D1T1:2")
    initialize_variables()
    st.log("Configuring CRM")
    crm_config()
    st.log("Checking CRM config before save and reboot")
    crm_config_verify()
    if st.is_feature_supported("interface-mtu", vars.D1):
        st.log("Configuring MTU on interface")
        mtu_config()
        st.log("Checking the configured MTU value before save and reboot")
        mtu_verify()
    if st.is_feature_supported("threshold", vars.D1):
        st.log("configuring threshold values on interface")
        threshold_config()
        st.log("configured threshold values verification")
        threshold_verify()
    st.log("Configuration of erspan")
    mirror_action_config()
    st.log("Checking ERSPAN config before save and reboot")
    mirror_action_verify()
    if st.is_feature_supported("span-mirror-session", vars.D1):
        st.log("Configuring port mirror session")
        port_mirror_config()
        st.log("Checking port mirroring(SPAN) before save and reboot")
        port_mirror_verify()
    if st.is_feature_supported("strom-control", vars.D1):
        st.log("Configuring BUM/Storm control")
        storm_control_config()
    tg_stream = config_tg_stream()

    yield
    # delete things at the end of this module"
    crm_obj.set_crm_clear_config(vars.D1)
    if st.is_feature_supported("interface-mtu", vars.D1):
        intf_obj.interface_properties_set(vars.D1, data.eth, data.property,
                                          data.mtu_default)
    if st.is_feature_supported("threshold", vars.D1):
        tf_obj.clear_threshold(vars.D1, breach='all')
        tf_obj.clear_threshold(vars.D1,
                               threshold_type='priority-group',
                               buffer_type='all')
        tf_obj.clear_threshold(vars.D1,
                               threshold_type='queue',
                               buffer_type='all')
    mirror.delete_session(vars.D1, mirror_session=data.session_name)
    bum_clear_config()
    reboot_obj.config_save(vars.D1)
示例#6
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")
示例#7
0
def config_mgmt_module_hooks(request):
    # add things at the start of this module
    yield
    # add things at the end of this module"
    #Setting the MTU value to default
    intf_obj.interface_properties_set(vars.D1, data.eth, data.property,
                                      data.mtu_default)
    #Below step will clear all CRM config from the device.
    crm_obj.set_crm_clear_config(vars.D1)
    #Below step will clear COS, WRED and ECN config from the device.
    qos_obj.clear_qos_config(vars.D1)
    #Below step will clear all ACL config from the device.
    acl_obj.clear_acl_config(vars.D1)
    st.log("Deleting the vlan-{}".format(data.vlan))
    rv = vlan_obj.clear_vlan_configuration(st.get_dut_names())
    if not rv:
        st.report_fail("vlan_delete_fail", data.vlan)
示例#8
0
def test_ft_port_frame_fwd_diff_mtu():
    intfapi.get_interface_property(vars.D1, vars.D1T1P1, "mtu")
    intfapi.get_interface_property(vars.D1, vars.D1T1P2, "mtu")
    st.log("Configuring MTU values for each interface")
    intfapi.interface_properties_set(vars.D1, [vars.D1T1P1, vars.D1T1P2],
                                     'mtu', intf_data.mtu1)

    intf_data.tg.tg_traffic_control(action='run',
                                    stream_handle=intf_data.streams['mtu1'])
    st.wait(intf_data.wait_sec)
    intf_data.tg.tg_traffic_control(action='stop',
                                    stream_handle=intf_data.streams['mtu1'])
    st.log("Fetching TGen statistics")
    stats_tg1 = tgapi.get_traffic_stats(intf_data.tg,
                                        mode="aggregate",
                                        port_handle=intf_data.tg_ph_1)
    total_tx_tg1 = stats_tg1.tx.total_bytes
    stats_tg2 = tgapi.get_traffic_stats(intf_data.tg,
                                        mode="aggregate",
                                        port_handle=intf_data.tg_ph_2)
    total_rx_tg2 = stats_tg2.rx.total_bytes
    percentage_98_total_tx_tg1 = (98 * int(total_tx_tg1)) / 100
    st.banner("Sent bytes: {} and Received bytes : {}".format(
        percentage_98_total_tx_tg1, total_rx_tg2))
    if int(percentage_98_total_tx_tg1) <= 0 and int(
            percentage_98_total_tx_tg1) <= int(total_rx_tg2):
        st.report_fail("traffic_transmission_failed", vars.T1D1P1)

    intf_data.tg.tg_traffic_control(action='run',
                                    stream_handle=intf_data.streams['mtu2'])
    st.wait(intf_data.wait_sec)
    intf_data.tg.tg_traffic_control(action='stop',
                                    stream_handle=intf_data.streams['mtu2'])

    st.log("Fetching TGen statistics")
    stats_tg2 = tgapi.get_traffic_stats(intf_data.tg,
                                        mode="aggregate",
                                        port_handle=intf_data.tg_ph_2)
    total_rx_tg2 = stats_tg2.rx.total_packets
    st.banner("Received packets : {}".format(total_rx_tg2))
    if int(total_rx_tg2) >= 100:
        st.report_fail("traffic_transmission_failed", vars.T1D1P1)
    st.report_pass("test_case_passed")
示例#9
0
def port_fec_no_fec(vars, speed, fec=["none", "rs"]):
    """
    Author : Nagarjuna Suravarapu <[email protected]
    By using this function we can pass parameters where we required (In my usage only fec parameter is changed )
    and we can also reuse the code so that we can reduce the codes of line.
    """
    if not isinstance(fec, list):
        st.log("FEC is not matching the criteria ..")
        st.report_fail("interface_is_down_on_dut", [vars.D1D2P1, vars.D1D2P2])
    st.log("Observed that speed as {} on interface {}".format(speed, vars.D1D2P1))
    if not st.poll_wait(intfapi.verify_interface_status, 20, vars.D1, [vars.D1D2P1, vars.D1D2P2], 'oper', 'up'):
        st.report_fail("interface_is_down_on_dut", [vars.D1D2P1, vars.D1D2P2])
    if not st.poll_wait(intfapi.verify_interface_status, 20, vars.D2, [vars.D2D1P1, vars.D2D1P2], 'oper', 'up'):
        st.report_fail("interface_is_down_on_dut", [vars.D2D1P1, vars.D2D1P2])
    if base_obj.get_hwsku(vars.D1).lower() in vars.constants[vars.D1]["TH3_PLATFORMS"]:
        if speed not in ['400G', '400000']:
            st.log("enabling the fec on Dut1")
            st.log(" if the fec on both duts interfaces mismatch then the ports should be down")
            intfapi.interface_properties_set(vars.D1, [vars.D1D2P1, vars.D1D2P2], "fec", fec[0], skip_error=False)
            if not st.poll_wait(intfapi.verify_interface_status, 20, vars.D1, [vars.D1D2P1, vars.D1D2P2], 'oper', 'down'):
                st.report_fail("interface_is_up_on_dut", [vars.D1D2P1, vars.D1D2P2])
            if not st.poll_wait(intfapi.verify_interface_status, 20, vars.D2, [vars.D2D1P1, vars.D2D1P2], 'oper', 'down'):
                st.report_fail("interface_is_up_on_dut", [vars.D2D1P1, vars.D2D1P2])
            st.log("disabling the fec on Dut1")
            intfapi.interface_properties_set(vars.D1, [vars.D1D2P1, vars.D1D2P2], "fec", fec[1], skip_error=False,
                                             no_form=True)
            if not st.poll_wait(intfapi.verify_interface_status, 20, vars.D1, [vars.D1D2P1, vars.D1D2P2], 'oper', 'up'):
                st.report_fail("interface_is_down_on_dut", [vars.D1D2P1, vars.D1D2P2])
            if not st.poll_wait(intfapi.verify_interface_status, 20, vars.D2, [vars.D2D1P1, vars.D2D1P2], 'oper', 'up'):
                st.report_fail("interface_is_down_on_dut", [vars.D2D1P1, vars.D2D1P2])
    else:
        st.log("enabling the fec on Dut1")
        st.log("if the fec on both duts interfaces mismatch then the ports should be down")
        intfapi.interface_properties_set(vars.D1, [vars.D1D2P1, vars.D1D2P2], "fec", fec[1], skip_error=False)
        if not st.poll_wait(intfapi.verify_interface_status, 20, vars.D1, [vars.D1D2P1, vars.D1D2P2], 'oper', 'down'):
            st.report_fail("interface_is_up_on_dut", [vars.D1D2P1, vars.D1D2P2])
        if not st.poll_wait(intfapi.verify_interface_status, 20, vars.D2, [vars.D2D1P1, vars.D2D1P2], 'oper', 'down'):
            st.report_fail("interface_is_up_on_dut", [vars.D2D1P1, vars.D2D1P2])
        st.log("disabling the fec on Dut1")
        intfapi.interface_properties_set(vars.D1, [vars.D1D2P1, vars.D1D2P2], "fec", fec[0], skip_error=False)
        if not st.poll_wait(intfapi.verify_interface_status, 20, vars.D1, [vars.D1D2P1, vars.D1D2P2], 'oper', 'up'):
            st.report_fail("interface_is_down_on_dut", [vars.D1D2P1, vars.D1D2P2])
        if not st.poll_wait(intfapi.verify_interface_status, 20, vars.D2, [vars.D2D1P1, vars.D2D1P2], 'oper', 'up'):
            st.report_fail("interface_is_down_on_dut", [vars.D2D1P1, vars.D2D1P2])
示例#10
0
def mtu_config():
    st.log("configuring mtu value of 9216 on interface")
    intf_obj.interface_properties_set(vars.D1, data.eth, data.property,
                                      data.mtu)
示例#11
0
def interface_func_hooks(request):
    yield
    if st.get_func_name(request) == 'test_ft_ovr_counters':
        intfapi.interface_properties_set(vars.D1, vars.D1T1P1, 'mtu',
                                         intf_data.mtu_default)
def mtu_config():
    st.log("configuring mtu value {} on interface".format(data.mtu))
    intf_obj.interface_properties_set(vars.D1, data.eth, data.property,
                                      data.mtu)