Пример #1
0
def test_ft_watermark_telemetry_interval():
    """
    Author : Phani kumar R ([email protected])
    """
    result = 0
    st.banner('ft_sf_wm_telemetry_interval')
    if not sfapi.config_snapshot_interval(
            vars.D1, snap="telemetry",
            interval_val=sf_data.telemetry_interval):
        st.error("Failed to configure watermark telemetry interval")
        result += 1
    match = [{'telemetryinterval': sf_data.telemetry_interval}]
    if not sfapi.verify(vars.D1, 'telemetry_interval', verify_list=match):
        st.error(
            "Failed to verify the configured watermark telemetry interval value"
        )
        result += 1
    if not sfapi.config_snapshot_interval(
            vars.D1,
            snap="telemetry",
            interval_val=sf_data.default_telemetry_interval):
        st.error("Failed to configure default watermark telemetry interval")
        result += 1
    match = [{'telemetryinterval': sf_data.default_telemetry_interval}]
    if not sfapi.verify(vars.D1, 'telemetry_interval', verify_list=match):
        st.error(
            "Failed to verify the default watermark telemetry interval value")
        result += 1

    if not result:
        st.report_pass("snapshot_telemetry_interval_config_and_reset",
                       "successful")
    else:
        st.report_fail("snapshot_telemetry_interval_config_and_reset",
                       "failed")
Пример #2
0
def test_ft_sf_verify_cpu_counters():
    """
    Author : prudviraj k ([email protected]) and phani kumar ravula([email protected])
    """
    result = 0
    if not sfapi.config_snapshot_interval(
            vars.D1, snap="interval", interval_val=sf_data.snapshot_interval):
        st.error("Failed to configure snapshot interval")
        result += 1
    match = [{'snapshotinterval': sf_data.snapshot_interval}]
    if not sfapi.verify(vars.D1, 'snapshot_interval', verify_list=match):
        st.error("Failed to verify the configured snapshot interval")
        result += 1

    st.log("sflow configuration")
    sflow.enable_disable_config(vars.D1,
                                interface=False,
                                interface_name=None,
                                action="enable")
    sflow.config_attributes(vars.D1,
                            sample_rate=sf_data.sflow_sample_rate,
                            interface_name=vars.D1T1P1)

    sf_tg_traffic_start_stop(sf_data.unicast, True)
    st.log(
        "waiting for two snapshot interval times to get the counter values reflect correctly"
    )
    st.wait(2 * sf_data.snapshot_interval)

    st.banner(
        'TC name:::: ft_sf_verify_cpu_counter_value_using_counter_DB ::::')

    st.banner('#### cpu_counters using CLI ####')
    match = [{'CPU:3': sf_data.initial_counter_value}]
    if sfapi.verify(vars.D1,
                    'queue_user_watermark_cpu',
                    verify_list=match,
                    port_alias="CPU"):
        st.error("Failed to verify the cpu counter value using CLI")
        result += 1

    st.banner('#### cpu_counters using counter DB ####')
    match = [{
        'SAI_QUEUE_STAT_SHARED_WATERMARK_BYTES':
        sf_data.initial_counter_value
    }]
    if sfapi.verify(vars.D1,
                    column_name="COUNTERS_QUEUE_NAME_MAP",
                    interface_name='CPU',
                    queue_value=3,
                    table_name="COUNTERS",
                    verify_list=match):
        st.error("Failed to verify the cpu counter value using counter DB")
        result += 1
        sf_collecting_debug_logs_when_test_fails()
    if result:
        st.report_fail("snapshot_tc_verify", "cpu", "failed")
    else:
        st.report_pass("snapshot_tc_verify", "cpu", "successful")
Пример #3
0
def test_ft_sf_periodic_verify_using_counter_DB():
    """
    Author : prudviraj k ([email protected]) and phani kumar ravula([email protected])
    """
    result = 0
    if not sfapi.config_snapshot_interval(
            vars.D1, snap="interval", interval_val=sf_data.snapshot_interval):
        st.error("Failed to configure snapshot interval")
        result += 1
    match = [{'snapshotinterval': sf_data.snapshot_interval}]
    if not sfapi.verify(vars.D1, 'snapshot_interval', verify_list=match):
        st.error("Failed to verify the configured snapshot interval")
        result += 1
    #sf_tg_traffic_start_stop(sf_data.periodic, True)
    st.wait(2 * sf_data.snapshot_interval)

    st.banner(
        '####verification_of_queue_unicast_periodic_update_using_counter_DB####'
    )
    st.banner('TC name:::: ft_sf_verify_time_stamp_using_counter_DB::::')

    counters = sfapi.show(vars.D1,
                          column_name="COUNTERS_QUEUE_NAME_MAP",
                          interface_name=vars.D1T1P4,
                          queue_value=0,
                          table_name="COUNTERS")

    Timestamp_40 = counters[0]['SAI_QUEUE_STAT_TIMESTAMP']
    Time_40 = Timestamp_40.split('.')

    st.log("Collecting Time stamp  when traffic rate is 40..... :{}".format(
        Time_40[1]))
    st.wait(sf_data.snapshot_interval)

    counters = sfapi.show(vars.D1,
                          column_name="COUNTERS_QUEUE_NAME_MAP",
                          interface_name=vars.D1T1P4,
                          queue_value=0,
                          table_name="COUNTERS")

    Timestamp_100 = counters[0]['SAI_QUEUE_STAT_TIMESTAMP']
    Time_100 = Timestamp_100.split('.')
    st.log("Collecting Time stamp when traffic rate is 100 ..... :{}".format(
        Time_100[1]))

    Timestamp_diff = datetime.strptime(
        Time_100[1], sf_data.FMT) - datetime.strptime(Time_40[1], sf_data.FMT)
    st.log("Time stamp difference in Seconds is :{}".format(
        Timestamp_diff.seconds))
    if (Timestamp_diff.seconds) < (sf_data.snapshot_interval):
        st.error("Time stamp interval is not increementing correctly")
        result += 1

    if not result:
        st.report_pass("snapshot_tc_verify", "Time stamp interval",
                       "successful")
    else:
        sf_collecting_debug_logs_when_test_fails()
        st.report_fail("snapshot_tc_verify", "Time stamp interval", "failed")
    """
Пример #4
0
def test_ft_snapshot_interval():
    """
    Author : Phani kumar R ([email protected])
    """
    st.banner(
        'ft_sf_snapshot_interval, ft_sf_verify_default_snapshot_interval')

    result1 = result2 = 0
    if not sfapi.config_snapshot_interval(
            vars.D1, snap="interval", interval_val=sf_data.snapshot_interval):
        st.error("Failed to configure snapshot interval")
        result1 += 1
    match = [{'snapshotinterval': sf_data.snapshot_interval}]
    if not sfapi.verify(vars.D1, 'snapshot_interval', verify_list=match):
        st.error("Failed to verify the configured snapshot interval")
        result1 += 1
        st.report_tc_fail("ft_sf_snapshot_interval",
                          "snapshot_interval_config", "failed")
    else:
        st.report_tc_pass("ft_sf_snapshot_interval",
                          "snapshot_interval_config", "successful")

    if not sfapi.config_snapshot_interval(vars.D1,
                                          snap="clear_snaphot_interval"):
        st.error("Failed to clear the snapshot interval")
        result2 += 1
    match = [{'snapshotinterval': sf_data.default_snapshot_interval}]
    if not sfapi.verify(vars.D1, 'snapshot_interval', verify_list=match):
        st.error(
            "Failed to reset the snapshot interval to default value after clear"
        )
        result2 += 1
        st.report_tc_fail("ft_sf_verify_default_snapshot_interval",
                          "snapshot_verify_default_interval", "failed")
    else:
        st.report_tc_pass("ft_sf_verify_default_snapshot_interval",
                          "snapshot_verify_default_interval", "successful")
    if not (result1 or result2):
        st.report_pass("snapshot_interval_config_and_reset", "successful")
    else:
        st.report_fail("snapshot_interval_config_and_reset", "failed")
Пример #5
0
def test_ft_sf_verify_buffer_pool_counters():
    """
    Author : prudviraj k ([email protected]) and phani kumar ravula([email protected])
    """
    result = 0
    per_result = 0
    sf_data.platform_name_summary = get_platform_summary(vars.D1)
    sf_data.platform_name = sf_data.platform_name_summary["platform"]
    sf_data.platform_hwsku = sf_data.platform_name_summary["hwsku"]

    path = "/usr/share/sonic/device/{}/{}/{}".format(sf_data.platform_name,
                                                     sf_data.platform_hwsku,
                                                     sf_data.device_j2_file)
    convert_json = "sonic-cfggen -d -t " "{} > {}".format(
        path, sf_data.config_file)
    sfapi.load_json_config(vars.D1, convert_json, sf_data.config_file)
    reboot_api.config_save_reload(vars.D1)
    st.log("To make sure after reload DUT is fully operational")
    st.wait(sf_data.reload_interval)

    if not sfapi.config_snapshot_interval(
            vars.D1, snap="interval", interval_val=sf_data.snapshot_interval):
        st.error("Failed to configure snapshot interval")
        result += 1
    match = [{'snapshotinterval': sf_data.snapshot_interval}]
    if not sfapi.verify(vars.D1, 'snapshot_interval', verify_list=match):
        st.error("Failed to verify the configured snapshot interval")
        result += 1

    sf_tg_traffic_start_stop(sf_data.unicast, True)
    st.log(
        "waiting for two snapshot interval times to get the counter values reflect correctly"
    )
    st.wait(2 * sf_data.snapshot_interval)

    st.banner('#### buffer_Pool_for_user_watermark####')
    st.banner('TC name :::: ft_sf_buffer_pool_using_uwm ::::')
    match = {'pool': 'ingress_lossless_pool'}
    value = {'bytes': sf_data.initial_counter_value}
    if sfapi.verify_buffer_pool(vars.D1,
                                'buffer_pool_watermark',
                                verify_list=match,
                                key=value):
        st.error(
            "Failed to verify the buffer pool counters for user watermark")
        result += 1
        st.report_tc_fail("ft_sf_buffer_pool_using_uwm", "snapshot_tc_verify",
                          "buffer_pool_for_user_watermark", "failed")
    else:
        st.report_tc_pass("ft_sf_buffer_pool_using_uwm", "snapshot_tc_verify",
                          "buffer_pool_for_user_watermark", "successful")

    st.banner('TC name :::: ft_sf_buffer_pool_using_persistent_wm ::::')
    st.banner('#### buffer_pool_for_persistent_watermark using percentage####')
    match = {'pool': 'egress_lossless_pool'}
    value = {'percent': sf_data.initial_counter_value}
    if sfapi.verify_buffer_pool(vars.D1,
                                'buffer_pool_persistent-watermark',
                                verify_list=match,
                                key=value,
                                percent=sf_data.percentage[0]):
        st.error(
            "Failed to verify the buffer pool counters for persistent watermark"
        )
        result += 1
        per_result += 1
    st.banner('#### buffer_pool_for_persistent_watermark using CLI####')
    match = {'pool': 'egress_lossless_pool'}
    value = {'bytes': sf_data.initial_counter_value}
    if sfapi.verify_buffer_pool(vars.D1,
                                'buffer_pool_persistent-watermark',
                                verify_list=match,
                                key=value):
        st.error(
            "Failed to verify the buffer pool counters for persistent watermark"
        )
        result += 1
        per_result += 1
    if per_result:
        st.report_tc_fail("ft_sf_buffer_pool_using_persistent_wm",
                          "snapshot_tc_verify",
                          "buffer_pool_for_persistent_watermark", "failed")
    else:
        st.report_tc_pass("ft_sf_buffer_pool_using_persistent_wm",
                          "snapshot_tc_verify",
                          "buffer_pool_for_persistent_watermark", "successful")

    st.banner('#### buffer_pool_using_counter_DB ####')
    st.banner('TC name :::: ft_sf_buffer_pool_using_counter_DB ::::')

    match = [{
        'SAI_BUFFER_POOL_STAT_WATERMARK_BYTES':
        sf_data.initial_counter_value
    }]
    if sfapi.verify(vars.D1,
                    'buffer_pool_counters_DB',
                    oid_type='ingress_lossless_pool',
                    verify_list=match):
        st.error(
            "Failed to verify the ingress lossless buffer pool counter using counter DB value"
        )
        result += 1
        st.report_tc_fail("ft_sf_buffer_pool_using_counter_DB",
                          "snapshot_tc_verify", "ingress lossless buffer pool",
                          "failed")
    else:
        st.report_tc_pass("ft_sf_buffer_pool_using_counter_DB",
                          "snapshot_tc_verify", "ingress lossless buffer pool",
                          "successful")

    sf_tg_traffic_start_stop(sf_data.unicast, False)
    st.log(
        "waiting for two snapshot interval times to get the counter values reflect correctly"
    )
    st.wait(2 * sf_data.snapshot_interval)

    st.banner('#### clear_buffer_Pool_for_user_watermark####')
    st.banner('TC name :::: ft_sf_buffer_pool_clear_using_uwm ::::')
    if not sfapi.config_snapshot_interval(vars.D1,
                                          snap="clear_buffer-pool watermark"):
        st.error("Failed to clear buffer-pool watermark")

    st.log(
        "After clear buffer_pool checking the stats with 10 cells tolerance")
    counters = sfapi.get(vars.D1,
                         'buffer_pool_watermark',
                         get_value='bytes',
                         match={'pool': 'ingress_lossless_pool'})
    if counters > sf_data.buffer_pool_tolerance:
        st.error("Failed to clear the buffer pool counters for user watermark")
        result += 1
        st.report_tc_fail("ft_sf_buffer_pool_clear_using_uwm",
                          "snapshot_tc_verify",
                          "buffer_pool_clear_for_user_watermark", "failed")
    else:
        st.report_tc_pass("ft_sf_buffer_pool_clear_using_uwm",
                          "snapshot_tc_verify",
                          "buffer_pool_clear_for_user_watermark", "successful")

    st.banner('#### clear_buffer_pool_for_persistent_watermark ####')
    st.banner('TC name :::: ft_sf_buffer_pool_clear_using_persistent_wm ::::')
    if not sfapi.config_snapshot_interval(
            vars.D1, snap="clear_buffer-pool persistent-watermark"):
        st.error("Failed to clear_buffer-pool persistent-watermark")

    st.log(
        "After clear buffer_pool checking the stats with 10 cells tolerance")
    counters = sfapi.get(vars.D1,
                         'buffer_pool_watermark',
                         get_value='bytes',
                         match={'pool': 'egress_lossless_pool'})
    if counters > sf_data.buffer_pool_tolerance:
        st.error(
            "Failed to clear the buffer pool counters for persistent watermark"
        )
        result += 1
        st.report_tc_fail("ft_sf_buffer_pool_clear_using_persistent_wm",
                          "snapshot_tc_verify",
                          "buffer_pool_clear_for_persistent_watermark",
                          "failed")
    else:
        st.report_tc_pass("ft_sf_buffer_pool_clear_using_persistent_wm",
                          "snapshot_tc_verify",
                          "buffer_pool_clear_for_persistent_watermark",
                          "successful")
    if not result:
        st.report_pass("snapshot_tc_verify", "buffer pool", "successful")
    else:
        sf_collecting_debug_logs_when_test_fails()
        st.report_fail("snapshot_tc_verify", "buffer pool", "failed")
Пример #6
0
def test_ft_sf_all_buffer_stats_using_multicast_traffic():
    """
    Author : prudviraj k ([email protected]) and phani kumar ravula([email protected])
    """
    result = 0
    if not sfapi.config_snapshot_interval(
            vars.D1, snap="interval", interval_val=sf_data.snapshot_interval):
        st.error("Failed to configure snapshot interval")
        result += 1
    match = [{'snapshotinterval': sf_data.snapshot_interval}]
    if not sfapi.verify(vars.D1, 'snapshot_interval', verify_list=match):
        st.error("Failed to verify the configured snapshot interval")
        result += 1

    if sfapi.multicast_queue_start_value(vars.D1,
                                         'queue_user_watermark_multicast',
                                         port_alias=vars.D1T1P4):
        match = [{'mc8': sf_data.initial_counter_value}]
    else:
        match = [{'mc10': sf_data.initial_counter_value}]

    sf_tg_traffic_start_stop(sf_data.multicast, True)
    st.wait(2 * sf_data.snapshot_interval)

    st.banner('#### queue_multicast_for_user_watermark ####')
    st.banner('TC name:::: ft_sf_queue_multicast_using_uwm ::::')

    if sfapi.verify(vars.D1,
                    'queue_user_watermark_multicast',
                    verify_list=match,
                    port_alias=vars.D1T1P4):
        st.error(
            "Failed to verify the queue_user_watermark_multicast counter value"
        )
        result += 1
        st.report_tc_fail("ft_sf_queue_multicast_using_uwm",
                          "snapshot_tc_verify",
                          "queue_multicast_for_user_watermark", "failed")
    else:
        st.report_tc_pass("ft_sf_queue_multicast_using_uwm",
                          "snapshot_tc_verify",
                          "queue_multicast_for_user_watermark", "successful")

    st.banner('#### queue_multicast_for_persistent_watermark ####')
    st.banner('TC name :::: ft_sf_queue_multicast_using_persistent_wm ::::')

    if sfapi.verify(vars.D1,
                    'queue_persistent_watermark_multicast',
                    verify_list=match,
                    port_alias=vars.D1T1P4):
        st.error(
            "Failed to verify the queue_persistent_watermark_unicast counter value"
        )
        result += 1
        st.report_tc_fail("ft_sf_queue_multicast_using_persistent_wm",
                          "snapshot_tc_verify",
                          "queue_multicast_for_persistent_watermark", "failed")
    else:
        st.report_tc_pass("ft_sf_queue_multicast_using_persistent_wm",
                          "snapshot_tc_verify",
                          "queue_multicast_for_persistent_watermark",
                          "successful")

    sf_tg_traffic_start_stop(sf_data.multicast, False)
    st.wait(2 * sf_data.snapshot_interval)

    st.banner('#### clear_queue_multicast_for_user_watermark ####')
    st.banner('TC name :::: ft_sf_queue_multicast_clear_using_uwm ::::')
    if not sfapi.config_snapshot_interval(vars.D1,
                                          snap="clear_snapshot_counters",
                                          group=sf_data.group[1],
                                          table=sf_data.table[0],
                                          counter_type=sf_data.PG[3]):
        st.error(
            "Failed to execute the command clear {} snapshot counters".format(
                sf_data.PG[3]))
        result += 1

    if not sfapi.verify(vars.D1,
                        'queue_user_watermark_multicast',
                        verify_list=match,
                        port_alias=vars.D1T1P4):
        st.error("Failed to clear the snapshot counters")
        result += 1
        st.report_tc_fail(
            "ft_sf_queue_multicast_clear_using_uwm", "snapshot_clear_verify",
            "clearing the multicast queue counters for user watermark",
            "failed")
    else:
        st.report_tc_pass(
            "ft_sf_queue_multicast_clear_using_uwm", "snapshot_clear_verify",
            "clearing the multicast queue counters for user watermark",
            "successful")

    st.banner('#### clear_queue_multicast_for_persistent_watermark ####')
    st.banner(
        'TC name :::: ft_sf_queue_multicast_clear_using_persistent_wm ::::')
    if not sfapi.config_snapshot_interval(vars.D1,
                                          snap="clear_snapshot_counters",
                                          group=sf_data.group[1],
                                          table=sf_data.table[1],
                                          counter_type=sf_data.PG[3]):
        st.error(
            "Failed to execute the command clear {} snapshot counters".format(
                sf_data.PG[3]))
        result += 1

    if not sfapi.verify(vars.D1,
                        'queue_persistent_watermark_multicast',
                        verify_list=match,
                        port_alias=vars.D1T1P4):
        st.error("Failed to clear the snapshot counters")
        result += 1
        st.report_tc_fail(
            "ft_sf_queue_multicast_clear_using_persistent_wm",
            "snapshot_clear_verify",
            "clearing the multicast queue counters for persistent watermark",
            "failed")
    else:
        st.report_tc_pass(
            "ft_sf_queue_multicast_clear_using_persistent_wm",
            "snapshot_clear_verify",
            "clearing the multicast queue counters for persistent watermark",
            "successful")

    if not result:
        st.report_pass("snapshot_all_buffer_counters", "multicast",
                       "successful")
    else:
        sf_collecting_debug_logs_when_test_fails()
        st.report_fail("snapshot_all_buffer_counters", "multicast", "failed")
Пример #7
0
def test_ft_sf_all_buffer_stats_using_unicast_traffic():
    """
    Author : prudviraj k ([email protected]) and phani kumar ravula([email protected])
    """
    result = 0
    per_result = 0
    clr_result = 0
    if not sfapi.config_snapshot_interval(
            vars.D1, snap="interval", interval_val=sf_data.snapshot_interval):
        st.error("Failed to configure snapshot interval")
        result += 1
    match = [{'snapshotinterval': sf_data.snapshot_interval}]
    if not sfapi.verify(vars.D1, 'snapshot_interval', verify_list=match):
        st.error("Failed to verify the configured snapshot interval")
        result += 1
    st.log("configuring the QOS maps")
    if not cos_api.config_dot1p_to_tc_map(vars.D1, sf_data.obj_name[0],
                                          sf_data.dot1p_to_tc_map_dict):
        st.error("Failed to configure qos map of type dot1p to tc")
    if not cos_api.config_tc_to_pg_map(vars.D1, sf_data.obj_name[1],
                                       sf_data.tc_to_pg_map_dict):
        st.error("Failed to configure qos map of type tc to pg")
    if not cos_api.verify_qos_map_table(
            vars.D1, 'dot1p_to_tc_map', sf_data.obj_name[0], {
                '0': '0',
                '1': '1',
                '2': '2',
                '3': '3',
                '4': '4',
                '5': '5',
                '6': '6',
                '7': '7'
            }):
        st.error("Failed to verify configured dot1p to tc map values")
        result += 1

    if not cos_api.verify_qos_map_table(
            vars.D1, 'tc_to_pg_map', sf_data.obj_name[1], {
                '0': '7',
                '1': '7',
                '2': '7',
                '3': '7',
                '4': '7',
                '5': '7',
                '6': '7',
                '7': '7'
            }):
        st.error("Failed to verify configured tc to pg map values")
        result += 1

    if not cos_api.config_port_qos_map_all(vars.D1, sf_data.dot1p_tc_bind_map):
        st.error(
            "Failed to bind the configured qos map of type dot1p to tc on interface"
        )
    if not cos_api.config_port_qos_map_all(vars.D1, sf_data.tc_pg_bind_map):
        st.error(
            "Failed to bind the configured qos map of type tc to pg on interface"
        )

    sf_tg_traffic_start_stop(sf_data.unicast, True)
    st.wait(2 * sf_data.snapshot_interval)

    st.banner('#### PG_shared_for_user_watermark####')
    st.banner('TC name :::: ft_sf_pg_shared_using_uwm ::::')
    match = [{'pg7': sf_data.initial_counter_value}]
    if sfapi.verify(vars.D1,
                    'user_watermark_PG_shared',
                    verify_list=match,
                    port_alias=vars.D1T1P1):
        st.error("Failed to verify the user_watermark_PG_shared counter value")
        result += 1
        st.report_tc_fail("ft_sf_pg_shared_using_uwm", "snapshot_tc_verify",
                          "PG_shared_for_user_watermark", "failed")
    else:
        st.report_tc_pass("ft_sf_pg_shared_using_uwm", "snapshot_tc_verify",
                          "PG_shared_for_user_watermark", "successful")

    st.banner('####verification_of_PG_shared_using_counter_DB####')
    st.banner('TC name :::: ft_sf_pg_shared_using_Counter_DB ::::')
    match = [{
        'SAI_INGRESS_PRIORITY_GROUP_STAT_SHARED_WATERMARK_BYTES':
        sf_data.initial_counter_value
    }]
    if sfapi.verify(vars.D1,
                    column_name="COUNTERS_PG_NAME_MAP",
                    interface_name=vars.D1T1P1,
                    queue_value=7,
                    table_name="COUNTERS",
                    verify_list=match):
        st.error(
            "Failed to verify the user_watermark_PG_shared counter DB value")
        result += 1
        st.report_tc_fail("ft_sf_pg_shared_using_Counter_DB",
                          "snapshot_tc_counter_DB_verify", "PG_shared",
                          "failed")
    else:
        st.report_tc_pass("ft_sf_pg_shared_using_Counter_DB",
                          "snapshot_tc_counter_DB_verify", "PG_shared",
                          "successful")

    st.banner('TC name:::: ft_sf_queue_unicast_using_uwm ::::')
    match = [{'uc0': sf_data.initial_counter_value}]

    st.banner(
        '#### queue_unicast_for_user_watermark using percentage values####')
    if sfapi.verify(vars.D1,
                    'queue_user_watermark_unicast',
                    verify_list=match,
                    port_alias=vars.D1T1P4,
                    percentage=sf_data.percentage[0]):
        st.error(
            "Failed to verify the queue_user_watermark_unicast counter value using percentage"
        )
        result += 1
        per_result += 1

    st.banner('#### queue_unicast_for_user_watermark using CLI####')
    if sfapi.verify(vars.D1,
                    'queue_user_watermark_unicast',
                    verify_list=match,
                    port_alias=vars.D1T1P4):
        st.error(
            "Failed to verify the queue_user_watermark_unicast counter value")
        result += 1
        per_result += 1

    if per_result:
        st.report_tc_fail("ft_sf_queue_unicast_using_uwm",
                          "snapshot_tc_verify",
                          "queue_unicast_for_user_watermark", "failed")
    else:
        st.report_tc_pass("ft_sf_queue_unicast_using_uwm",
                          "snapshot_tc_verify",
                          "queue_unicast_for_user_watermark", "successful")

    st.banner(
        '####verification_of_queue_unicast_for_user_watermark_using_counter_DB####'
    )
    st.banner('TC name:::: ft_sf_queue_unicast_using_Counter_DB ::::')
    match = [{
        'SAI_QUEUE_STAT_SHARED_WATERMARK_BYTES':
        sf_data.initial_counter_value
    }]
    if sfapi.verify(vars.D1,
                    column_name="COUNTERS_QUEUE_NAME_MAP",
                    interface_name=vars.D1T1P4,
                    queue_value=0,
                    table_name="COUNTERS",
                    verify_list=match):
        st.error(
            "Failed to verify the queue_user_watermark_unicast counter DB value"
        )
        result += 1
        st.report_tc_fail("ft_sf_queue_unicast_using_Counter_DB",
                          "snapshot_tc_counter_DB_verify", "queue_unicast",
                          "failed")
    else:
        st.report_tc_pass("ft_sf_queue_unicast_using_Counter_DB",
                          "snapshot_tc_counter_DB_verify", "queue_unicast",
                          "successful")

    st.banner('#### PG_shared_for_persistent_watermark####')
    st.banner('TC name :::: ft_sf_pg_shared_using_persistent_wm ::::')
    match = [{'pg7': sf_data.initial_counter_value}]
    if sfapi.verify(vars.D1,
                    'persistent_PG_shared',
                    verify_list=match,
                    port_alias=vars.D1T1P2):
        st.error(
            "Failed to verify the persistent_watermark_PG_shared counter value"
        )
        result += 1
        st.report_tc_fail("ft_sf_pg_shared_using_persistent_wm",
                          "snapshot_tc_verify",
                          "PG_shared_for_persistent_watermark", "failed")
    else:
        st.report_tc_pass("ft_sf_pg_shared_using_persistent_wm",
                          "snapshot_tc_verify",
                          "PG_shared_for_persistent_watermark", "successful")

    st.banner('#### queue_unicast_for_persistent_watermark ####')
    st.banner('TC name :::: ft_sf_queue_unicast_using_persistent_wm ::::')
    match = [{'uc0': sf_data.initial_counter_value}]
    if sfapi.verify(vars.D1,
                    'queue_persistent_watermark_unicast',
                    verify_list=match,
                    port_alias=vars.D1T1P4):
        st.error(
            "Failed to verify the queue_persistent_watermark_unicast counter value"
        )
        result += 1
        st.report_tc_fail("ft_sf_queue_unicast_using_persistent_wm",
                          "snapshot_tc_verify",
                          "queue_unicast_for_persistent_watermark", "failed")
    else:
        st.report_tc_pass("ft_sf_queue_unicast_using_persistent_wm",
                          "snapshot_tc_verify",
                          "queue_unicast_for_persistent_watermark",
                          "successful")

    sf_tg_traffic_start_stop(sf_data.unicast, False)
    st.wait(2 * sf_data.snapshot_interval)

    st.banner('#### clear_PG_shared_for_user_watermark####')
    st.banner('TC name :::: ft_sf_pg_shared_clear_using_uwm ::::')
    if not sfapi.config_snapshot_interval(vars.D1,
                                          snap="clear_snapshot_counters",
                                          group=sf_data.group[0],
                                          table=sf_data.table[0],
                                          counter_type=sf_data.PG[0]):
        st.error(
            "Failed to execute the command clear {} snapshot counters".format(
                sf_data.group[0]))
        result += 1
    match = [{'pg0': sf_data.initial_counter_value}]
    if not sfapi.verify(vars.D1,
                        'user_watermark_PG_shared',
                        verify_list=match,
                        port_alias=vars.D1T1P1):
        st.error("Failed to clear the snapshot counters")
        result += 1
        st.report_tc_fail(
            "ft_sf_pg_shared_clear_using_uwm", "snapshot_clear_verify",
            "clearing the PG shared counters for user_watermark", "failed")
    else:
        st.report_tc_pass(
            "ft_sf_pg_shared_clear_using_uwm", "snapshot_clear_verify",
            "clearing the PG shared counters for user watermark", "successful")

    st.banner('TC name :::: ft_sf_queue_unicast_clear_using_uwm ::::')
    if not sfapi.config_snapshot_interval(vars.D1,
                                          snap="clear_snapshot_counters",
                                          group=sf_data.group[1],
                                          table=sf_data.table[0],
                                          counter_type=sf_data.PG[2]):
        st.error(
            "Failed to execute the command clear  {} snapshot counters".format(
                sf_data.group[0]))
        result += 1
    match = [{'uc0': sf_data.initial_counter_value}]

    st.banner(
        '#### clear_queue_unicast_percentage_Values_for_user_watermark ####')
    if not sfapi.verify(vars.D1,
                        'queue_user_watermark_unicast',
                        verify_list=match,
                        port_alias=vars.D1T1P4,
                        percentage=sf_data.percentage[1]):
        st.error("Failed to clear percentage snapshot counters")
        result += 1
        clr_result += 1
    st.banner('#### clear_queue_unicast_for_user_watermark using CLI####')
    if not sfapi.verify(vars.D1,
                        'queue_user_watermark_unicast',
                        verify_list=match,
                        port_alias=vars.D1T1P4):
        st.error("Failed to clear the snapshot counters")
        result += 1
        clr_result += 1

    if clr_result:
        st.report_tc_fail(
            "ft_sf_queue_unicast_clear_using_uwm", "snapshot_clear_verify",
            "clearing the unicast queue counters for user watermark", "failed")
    else:
        st.report_tc_pass(
            "ft_sf_queue_unicast_clear_using_uwm", "snapshot_clear_verify",
            "clearing the unicast queue counters for user watermark",
            "successful")

    st.banner('#### clear_PG_shared_for_persistent_watermark ####')
    st.banner('TC name :::: ft_sf_pg_shared_clear_using_persistent_wm ::::')
    if not sfapi.config_snapshot_interval(vars.D1,
                                          snap="clear_snapshot_counters",
                                          group=sf_data.group[0],
                                          table=sf_data.table[1],
                                          counter_type=sf_data.PG[0]):
        st.error(
            "Failed to execute the command clear {} snapshot counters".format(
                sf_data.group[0]))
        result += 1
    match = [{'pg0': sf_data.initial_counter_value}]
    if not sfapi.verify(vars.D1,
                        'persistent_PG_shared',
                        verify_list=match,
                        port_alias=vars.D1T1P2):
        st.error("Failed to clear the snapshot counters")
        result += 1
        st.report_tc_fail(
            "ft_sf_pg_shared_clear_using_persistent_wm",
            "snapshot_clear_verify",
            "clearing the PG shared counters for persistent watermark",
            "failed")
    else:
        st.report_tc_pass(
            "ft_sf_pg_shared_clear_using_persistent_wm",
            "snapshot_clear_verify",
            "clearing the PG shared counters for persistent watermark",
            "successful")

    st.banner('#### clear_queue_unicast_for_persistent_watermark ####')
    st.banner(
        'TC name :::: ft_sf_queue_unicast_clear_using_persistent_wm ::::')
    if not sfapi.config_snapshot_interval(vars.D1,
                                          snap="clear_snapshot_counters",
                                          group=sf_data.group[1],
                                          table=sf_data.table[1],
                                          counter_type=sf_data.PG[2]):
        st.error(
            "Failed to execute the command clear {} snapshot counters".format(
                sf_data.group[0]))
        result += 1
    match = [{'uc0': sf_data.initial_counter_value}]
    if not sfapi.verify(vars.D1,
                        'queue_persistent_watermark_unicast',
                        verify_list=match,
                        port_alias=vars.D1T1P4):
        st.error("Failed to clear the snapshot counters")
        result += 1
        st.report_tc_fail(
            "ft_sf_queue_unicast_clear_using_persistent_wm",
            "snapshot_clear_verify",
            "clearing the unicast queue counters for persistent watermark",
            "failed")
    else:
        st.report_tc_pass(
            "ft_sf_queue_unicast_clear_using_persistent_wm",
            "snapshot_clear_verify",
            "clearing the unicast queue counters for persistent watermark",
            "successful")
    clear_qos_map_config()
    if not result:
        st.report_pass("snapshot_all_buffer_counters", "unicast", "successful")
    else:
        sf_collecting_debug_logs_when_test_fails()
        st.report_fail("snapshot_all_buffer_counters", "unicast", "failed")