1+ from pprint import pprint
2+
3+ import pytest
4+
5+ @pytest .fixture (scope = 'module' , autouse = True )
6+ def skip_all (testbed_instance ):
7+ testbed = testbed_instance
8+ if testbed is not None and len (testbed .npu ) != 1 :
9+ pytest .skip ('invalid for {} testbed' .format (testbed .name ))
10+
11+
12+ @pytest .mark .npu
13+ class TestSaiAclCounter :
14+ # object with parent SAI_OBJECT_TYPE_ACL_TABLE
15+
16+ def test_acl_counter_create (self , npu ):
17+ commands = [
18+ {
19+ 'name' : 'acl_table_1' ,
20+ 'op' : 'create' ,
21+ 'type' : 'SAI_OBJECT_TYPE_ACL_TABLE' ,
22+ 'attributes' : ['SAI_ACL_TABLE_ATTR_ACL_STAGE' , 'SAI_ACL_STAGE_INGRESS' ],
23+ },
24+ {
25+ 'name' : 'acl_counter_1' ,
26+ 'op' : 'create' ,
27+ 'type' : 'SAI_OBJECT_TYPE_ACL_COUNTER' ,
28+ 'attributes' : ['SAI_ACL_COUNTER_ATTR_TABLE_ID' , '$acl_table_1' ],
29+ },
30+ ]
31+ results = [* npu .process_commands (commands )]
32+ print ('======= SAI commands RETURN values create =======' )
33+ pprint (results )
34+
35+
36+ @pytest .mark .dependency (name = 'test_sai_acl_counter_attr_label_set' )
37+ def test_sai_acl_counter_attr_label_set (self , npu ):
38+ commands = [
39+ {
40+ 'name' : 'acl_counter_1' ,
41+ 'op' : 'set' ,
42+ 'attributes' : ['SAI_ACL_COUNTER_ATTR_LABEL' , '""' ],
43+ }
44+ ]
45+ results = [* npu .process_commands (commands )]
46+ print ('======= SAI commands RETURN values get =======' )
47+ pprint (results )
48+
49+
50+ def test_acl_counter_remove (self , npu ):
51+ commands = [
52+ {'name' : 'acl_counter_1' , 'op' : 'remove' },
53+ {'name' : 'acl_table_1' , 'op' : 'remove' },
54+ ]
55+ results = [* npu .process_commands (commands )]
56+ print ('======= SAI commands RETURN values remove =======' )
57+ pprint (results )
0 commit comments