def tf_unconfig(): tfapi.clear_threshold(vars.D1, breach='all') tfapi.clear_threshold(vars.D1, threshold_type='priority-group', buffer_type='all', port_alias=dut_port[0]) tfapi.clear_threshold(vars.D1, threshold_type='queue', buffer_type='all', port_alias=dut_port[0]) tfapi.clear_threshold(vars.D1, threshold_type='queue', buffer_type='multicast', index=1, port_alias='CPU')
def tf_unconfig(): tfapi.clear_threshold(vars.D1, breach='all') tfapi.clear_threshold(vars.D1, threshold_type='priority-group', buffer_type='all', port_alias=[vars.D1T1P1, vars.D1T1P4]) tfapi.clear_threshold(vars.D1, threshold_type='queue', buffer_type='all', port_alias=[vars.D1T1P1, vars.D1T1P4])
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)
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
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