@@ -303,7 +303,7 @@ def setup_module(duthosts, rand_one_dut_hostname, request):
303303
304304 duthost = duthosts [rand_one_dut_hostname ]
305305 detect_buffer_model (duthost )
306- if not is_mellanox_device (duthost ) and not is_innovium_device (duthost ):
306+ if not is_mellanox_device (duthost ) and not is_innovium_device (duthost ) and not is_barefoot_device ( duthost ) :
307307 load_lossless_headroom_data (duthost )
308308 yield
309309 return
@@ -519,19 +519,44 @@ def _fetch_size_difference_for_8lane_ports(duthost, conn_graph_facts):
519519
520520 logging .debug ("Expected pool {}, expec shp {}, curr_shp {} default ovs {}" .format (expected_pool_size , expected_shp_size , curr_shp_size , DEFAULT_OVER_SUBSCRIBE_RATIO ))
521521
522- pytest_assert (ensure_pool_size (duthost , 20 , expected_pool_size , expected_shp_size , ingress_lossless_pool_oid ),
523- "Pool size isn't correct in database: expected pool {} shp {}, size in APPL_DB pool {} shp {}, size in ASIC_DB {}" .format (
524- expected_pool_size ,
525- expected_shp_size ,
526- duthost .shell ('redis-cli hget "BUFFER_POOL_TABLE:ingress_lossless_pool" size' )['stdout' ],
527- duthost .shell ('redis-cli hget "BUFFER_POOL_TABLE:ingress_lossless_pool" xoff' )['stdout' ],
528- get_pool_size_from_asic_db (duthost , ingress_lossless_pool_oid ))
529- if DEFAULT_OVER_SUBSCRIBE_RATIO else
530- "Pool size isn't correct in database: expected {}, size in APPL_DB pool {}, size in ASIC_DB {}" .format (
531- expected_pool_size ,
532- duthost .shell ('redis-cli hget "BUFFER_POOL_TABLE:ingress_lossless_pool" size' )['stdout' ],
533- get_pool_size_from_asic_db (duthost , ingress_lossless_pool_oid ))
534- )
522+ pytest_assert (ensure_pool_size (duthost , 20 , expected_pool_size , expected_shp_size , ingress_lossless_pool_oid ),
523+ "Pool size isn't correct in database: expected pool {} shp {}, size in APPL_DB pool {} shp {}, size in ASIC_DB {}" .format (
524+ expected_pool_size ,
525+ expected_shp_size ,
526+ duthost .shell ('redis-cli hget "BUFFER_POOL_TABLE:ingress_lossless_pool" size' )['stdout' ],
527+ duthost .shell ('redis-cli hget "BUFFER_POOL_TABLE:ingress_lossless_pool" xoff' )['stdout' ],
528+ get_pool_size_from_asic_db (duthost , ingress_lossless_pool_oid ))
529+ if DEFAULT_OVER_SUBSCRIBE_RATIO else
530+ "Pool size isn't correct in database: expected {}, size in APPL_DB pool {}, size in ASIC_DB {}" .format (
531+ expected_pool_size ,
532+ duthost .shell ('redis-cli hget "BUFFER_POOL_TABLE:ingress_lossless_pool" size' )['stdout' ],
533+ get_pool_size_from_asic_db (duthost , ingress_lossless_pool_oid ))
534+ )
535+ elif duthost .facts ['asic_type' ] == 'barefoot' :
536+ expected_pool_size = 43067728
537+ expected_shp_size = 3153920
538+ pytest_assert (ensure_pool_size (duthost , 20 , expected_pool_size , expected_shp_size , ingress_lossless_pool_oid ),
539+ "Pool size isn't correct in database: expected pool {} shp {}, size in APPL_DB pool {} shp {}, size in ASIC_DB {}" .format (
540+ expected_pool_size ,
541+ expected_shp_size ,
542+ duthost .shell ('redis-cli hget "BUFFER_POOL_TABLE:ingress_lossless_pool" size' )['stdout' ],
543+ duthost .shell ('redis-cli hget "BUFFER_POOL_TABLE:ingress_lossless_pool" xoff' )['stdout' ],
544+ get_pool_size_from_asic_db (duthost , ingress_lossless_pool_oid ))
545+ )
546+ else :
547+ pytest_assert (ensure_pool_size (duthost , 20 , expected_pool_size , expected_shp_size , ingress_lossless_pool_oid ),
548+ "Pool size isn't correct in database: expected pool {} shp {}, size in APPL_DB pool {} shp {}, size in ASIC_DB {}" .format (
549+ expected_pool_size ,
550+ expected_shp_size ,
551+ duthost .shell ('redis-cli hget "BUFFER_POOL_TABLE:ingress_lossless_pool" size' )['stdout' ],
552+ duthost .shell ('redis-cli hget "BUFFER_POOL_TABLE:ingress_lossless_pool" xoff' )['stdout' ],
553+ get_pool_size_from_asic_db (duthost , ingress_lossless_pool_oid ))
554+ if DEFAULT_OVER_SUBSCRIBE_RATIO else
555+ "Pool size isn't correct in database: expected {}, size in APPL_DB pool {}, size in ASIC_DB {}" .format (
556+ expected_pool_size ,
557+ duthost .shell ('redis-cli hget "BUFFER_POOL_TABLE:ingress_lossless_pool" size' )['stdout' ],
558+ get_pool_size_from_asic_db (duthost , ingress_lossless_pool_oid ))
559+ )
535560
536561
537562def get_pool_size_from_asic_db (duthost , ingress_lossless_pool_oid ):
@@ -846,7 +871,7 @@ def port_to_test(request, duthost):
846871 return PORT_TO_TEST
847872
848873
849- @pytest .fixture (params = ['3-4' , '5' , ' 6' ])
874+ @pytest .fixture (params = ['3-4' , '6' ])
850875def pg_to_test (request ):
851876 """Used to parametrized test cases for PGs under test
852877
@@ -982,10 +1007,7 @@ def test_change_speed_cable(duthosts, rand_one_dut_hostname, conn_graph_facts, p
9821007
9831008 # Re-add another lossless priority
9841009 logging .info ('Re-add a lossless_pg and check pool size and pfc_enable' )
985- if duthost .facts ['asic_type' ] == 'barefoot' :
986- duthost .shell ('config interface buffer priority-group lossless add {} 5' .format (port_to_test ))
987- else :
988- duthost .shell ('config interface buffer priority-group lossless add {} 6' .format (port_to_test ))
1010+ duthost .shell ('config interface buffer priority-group lossless add {} 6' .format (port_to_test ))
9891011
9901012 check_pool_size (duthost ,
9911013 pool_oid ,
@@ -997,10 +1019,7 @@ def test_change_speed_cable(duthosts, rand_one_dut_hostname, conn_graph_facts, p
9971019 new_size = pg_size ,
9981020 new_pg_number = 1 )
9991021
1000- if duthost .facts ['asic_type' ] == 'barefoot' :
1001- check_pfc_enable (duthost , port_to_test , '5' )
1002- else :
1003- check_pfc_enable (duthost , port_to_test , '6' )
1022+ check_pfc_enable (duthost , port_to_test , '6' )
10041023 profile_oid , _ = check_buffer_profile_details (duthost , initial_asic_db_profiles , expected_profile , None , pool_oid , port_to_test )
10051024
10061025 if cable_len_to_test != original_cable_len :
@@ -1015,11 +1034,7 @@ def test_change_speed_cable(duthosts, rand_one_dut_hostname, conn_graph_facts, p
10151034 logging .info ('[Remove dynamic profile on cable length and/or MTU updated] Checking whether the old profile is removed' )
10161035 check_lossless_profile_removed (duthost , expected_profile , profile_oid )
10171036 expected_profile = make_expected_profile_name (speed_to_test , original_cable_len )
1018-
1019- if duthost .facts ['asic_type' ] == 'barefoot' :
1020- check_pg_profile (duthost , 'BUFFER_PG_TABLE:{}:5' .format (port_to_test ), expected_profile )
1021- else :
1022- check_pg_profile (duthost , 'BUFFER_PG_TABLE:{}:6' .format (port_to_test ), expected_profile )
1037+ check_pg_profile (duthost , 'BUFFER_PG_TABLE:{}:6' .format (port_to_test ), expected_profile )
10231038
10241039 pg_size = int (duthost .shell ('redis-cli hget "BUFFER_PROFILE_TABLE:{}" size' .format (expected_profile ))['stdout' ])
10251040 pg_xoff = int (duthost .shell ('redis-cli hget "BUFFER_PROFILE_TABLE:{}" xoff' .format (expected_profile ))['stdout' ]) if DEFAULT_OVER_SUBSCRIBE_RATIO else None
@@ -1033,10 +1048,7 @@ def test_change_speed_cable(duthosts, rand_one_dut_hostname, conn_graph_facts, p
10331048 new_size = pg_size ,
10341049 new_pg_number = 1 )
10351050
1036- if duthost .facts ['asic_type' ] == 'barefoot' :
1037- duthost .shell ('config interface buffer priority-group lossless remove {} 5' .format (port_to_test ))
1038- else :
1039- duthost .shell ('config interface buffer priority-group lossless remove {} 6' .format (port_to_test ))
1051+ duthost .shell ('config interface buffer priority-group lossless remove {} 6' .format (port_to_test ))
10401052
10411053 check_pool_size (duthost ,
10421054 pool_oid ,
@@ -1074,14 +1086,10 @@ def test_change_speed_cable(duthosts, rand_one_dut_hostname, conn_graph_facts, p
10741086 old_size = original_pg_size )
10751087
10761088 logging .info ('[Extra lossless PG]' )
1077- if duthost .facts ['asic_type' ] == 'barefoot' :
1078- duthost .shell ('config interface buffer priority-group lossless add {} 5' .format (port_to_test ))
1079- check_pg_profile (duthost , 'BUFFER_PG_TABLE:{}:5' .format (port_to_test ), expected_profile )
1080- check_pfc_enable (duthost , port_to_test , '3,4,5' )
1081- else :
1082- duthost .shell ('config interface buffer priority-group lossless add {} 6' .format (port_to_test ))
1083- check_pg_profile (duthost , 'BUFFER_PG_TABLE:{}:6' .format (port_to_test ), expected_profile )
1084- check_pfc_enable (duthost , port_to_test , '3,4,6' )
1089+ duthost .shell ('config interface buffer priority-group lossless add {} 6' .format (port_to_test ))
1090+
1091+ check_pg_profile (duthost , 'BUFFER_PG_TABLE:{}:6' .format (port_to_test ), expected_profile )
1092+ check_pfc_enable (duthost , port_to_test , '3,4,6' )
10851093
10861094 check_pool_size (duthost ,
10871095 pool_oid ,
@@ -1092,11 +1100,7 @@ def test_change_speed_cable(duthosts, rand_one_dut_hostname, conn_graph_facts, p
10921100 new_pg_number = 3 )
10931101
10941102 logging .info ('[Restore config]' )
1095-
1096- if duthost .facts ['asic_type' ] == 'barefoot' :
1097- duthost .shell ('config interface buffer priority-group lossless remove {} 5' .format (port_to_test ))
1098- else :
1099- duthost .shell ('config interface buffer priority-group lossless remove {} 6' .format (port_to_test ))
1103+ duthost .shell ('config interface buffer priority-group lossless remove {} 6' .format (port_to_test ))
11001104
11011105 check_pfc_enable (duthost , port_to_test , '3,4' )
11021106
@@ -1232,16 +1236,12 @@ def test_headroom_override(duthosts, rand_one_dut_hostname, conn_graph_facts, po
12321236 new_size = new_size )
12331237
12341238 # Add another headroom override
1235- if duthost .facts ['asic_type' ] == 'barefoot' :
1236- logging .info ("[Test: headroom override on more lossless PGs 5] Apply the profile on the PG and check pool size" )
1237- duthost .shell ('config interface buffer priority-group lossless add {} 5 headroom-override' .format (port_to_test ))
1238- check_pg_profile (duthost , 'BUFFER_PG_TABLE:{}:5' .format (port_to_test ), 'headroom-override' )
1239- check_pfc_enable (duthost , port_to_test , '3,4,5' )
1240- else :
1241- logging .info ("[Test: headroom override on more lossless PGs 6] Apply the profile on the PG and check pool size" )
1242- duthost .shell ('config interface buffer priority-group lossless add {} 6 headroom-override' .format (port_to_test ))
1243- check_pg_profile (duthost , 'BUFFER_PG_TABLE:{}:6' .format (port_to_test ), 'headroom-override' )
1244- check_pfc_enable (duthost , port_to_test , '3,4,6' )
1239+ logging .info ("[Test: headroom override on more lossless PGs 6] Apply the profile on the PG and check pool size" )
1240+ duthost .shell ('config interface buffer priority-group lossless add {} 6 headroom-override' .format (port_to_test ))
1241+
1242+ check_pg_profile (duthost , 'BUFFER_PG_TABLE:{}:6' .format (port_to_test ), 'headroom-override' )
1243+ check_pfc_enable (duthost , port_to_test , '3,4,6' )
1244+ profile_oid , _ = check_buffer_profile_details (duthost , initial_asic_db_profiles , "headroom-override" , profile_oid , pool_oid , port_to_test )
12451245
12461246 check_pool_size (duthost ,
12471247 pool_oid ,
@@ -1491,10 +1491,6 @@ def test_lossless_pg(duthosts, rand_one_dut_hostname, conn_graph_facts, port_to_
14911491 skip_traditional_model ()
14921492
14931493 duthost = duthosts [rand_one_dut_hostname ]
1494-
1495- if (pg_to_test == '6' and is_barefoot_device (duthost )) or (pg_to_test == '5' and not is_barefoot_device (duthost )):
1496- pytest .skip ("Skip test case for " + pg_to_test + "th PG" )
1497-
14981494 original_speed = duthost .shell ('redis-cli -n 4 hget "PORT|{}" speed' .format (port_to_test ))['stdout' ]
14991495 original_cable_len = duthost .shell ('redis-cli -n 4 hget "CABLE_LENGTH|AZURE" {}' .format (port_to_test ))['stdout' ]
15001496 original_pool_size = duthost .shell ('redis-cli hget BUFFER_POOL_TABLE:ingress_lossless_pool size' )['stdout' ]
@@ -1914,6 +1910,7 @@ def _check_buffer_object_list_aligns_with_expected_ones(port_to_test, table, exp
19141910 ensure_pool_size (duthost , 60 , original_pool_size , original_shp_size , None )
19151911
19161912
1913+ @pytest .mark .disable_loganalyzer
19171914def test_port_auto_neg (duthosts , rand_one_dut_hostname , conn_graph_facts , port_to_test ):
19181915 """The test case for auto negotiation enabled ports
19191916
@@ -2021,31 +2018,20 @@ def _get_max_speed_from_list(speed_list_str):
20212018 check_buffer_profile_details (duthost , initial_asic_db_profiles , expected_profile , new_profile_id , pool_id , port_to_test )
20222019
20232020 # Add new PGs. The maximum advertised speed should be used
2024- if duthost .facts ['asic_type' ] == 'barefoot' :
2025- logging .info ('Add new PG 5' )
2026- duthost .shell ('config interface buffer priority-group lossless add {} 5' .format (port_to_test ))
2027- check_pg_profile (duthost , 'BUFFER_PG_TABLE:{}:5' .format (port_to_test ), expected_profile )
2028- else :
2029- logging .info ('Add new PG 6' )
2030- duthost .shell ('config interface buffer priority-group lossless add {} 6' .format (port_to_test ))
2031- check_pg_profile (duthost , 'BUFFER_PG_TABLE:{}:6' .format (port_to_test ), expected_profile )
2021+ logging .info ('Add new PG 6' )
2022+ duthost .shell ('config interface buffer priority-group lossless add {} 6' .format (port_to_test ))
2023+ check_pg_profile (duthost , 'BUFFER_PG_TABLE:{}:6' .format (port_to_test ), expected_profile )
20322024
20332025 # Update the advertised speed to all
20342026 logging .info ('Update advertised speeds to all' )
20352027 duthost .shell ('config interface advertised-speeds {} all' .format (port_to_test ))
20362028 expected_profile = make_expected_profile_name (max_supported_speed , cable_length_to_test )
20372029 check_pg_profile (duthost , 'BUFFER_PG_TABLE:{}:3-4' .format (port_to_test ), expected_profile )
2038- if duthost .facts ['asic_type' ] == 'barefoot' :
2039- check_pg_profile (duthost , 'BUFFER_PG_TABLE:{}:5' .format (port_to_test ), expected_profile )
2040- else :
2041- check_pg_profile (duthost , 'BUFFER_PG_TABLE:{}:6' .format (port_to_test ), expected_profile )
2030+ check_pg_profile (duthost , 'BUFFER_PG_TABLE:{}:6' .format (port_to_test ), expected_profile )
20422031 check_buffer_profile_details (duthost , initial_asic_db_profiles , expected_profile , new_profile_id , pool_id , port_to_test )
20432032 finally :
20442033 # Clean up
2045- if duthost .facts ['asic_type' ] == 'barefoot' :
2046- duthost .shell ('config interface buffer priority-group lossless remove {} 5' .format (port_to_test ), module_ignore_errors = True )
2047- else :
2048- duthost .shell ('config interface buffer priority-group lossless remove {} 6' .format (port_to_test ), module_ignore_errors = True )
2034+ duthost .shell ('config interface buffer priority-group lossless remove {} 6' .format (port_to_test ), module_ignore_errors = True )
20492035 duthost .shell ('config interface cable-length {} {}' .format (port_to_test , original_cable_length ), module_ignore_errors = True )
20502036 duthost .shell ('config interface speed {} {}' .format (port_to_test , original_speed ), module_ignore_errors = True )
20512037 duthost .shell ('config interface advertised-speeds {} all' .format (port_to_test ), module_ignore_errors = True )
@@ -2267,7 +2253,6 @@ def _recovery_to_dynamic_buffer_model(duthost):
22672253 config_reload (duthost , config_source = 'config_db' )
22682254
22692255
2270- @pytest .mark .disable_loganalyzer
22712256def test_buffer_model_test (duthosts , rand_one_dut_hostname , conn_graph_facts ):
22722257 """Verify whether the buffer model is expected after configuration operations:
22732258 The following items are verified
0 commit comments