Skip to content

Commit 1cd40f6

Browse files
committed
Cases that passed in tofino, failed in CI/CD
Cases that passed in tofino, failed in CI/CD Signed-off-by: Dinesh Kumar Sellappan <[email protected]>
1 parent 3840d2d commit 1cd40f6

File tree

6 files changed

+426
-0
lines changed

6 files changed

+426
-0
lines changed

tests/api/test_buffer_profile.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
from pprint import pprint
2+
3+
import pytest
4+
5+
6+
@pytest.fixture(scope='module', autouse=True)
7+
def skip_all(testbed_instance):
8+
testbed = testbed_instance
9+
if testbed is not None and len(testbed.npu) != 1:
10+
pytest.skip('invalid for {} testbed'.format(testbed.name))
11+
12+
13+
@pytest.mark.npu
14+
class TestSaiBufferProfile:
15+
# object with parent SAI_OBJECT_TYPE_BUFFER_POOL
16+
17+
def test_buffer_profile_create(self, npu):
18+
commands = [
19+
{
20+
'name': 'buffer_pool_1',
21+
'op': 'create',
22+
'type': 'SAI_OBJECT_TYPE_BUFFER_POOL',
23+
'attributes': [
24+
'SAI_BUFFER_POOL_ATTR_TYPE',
25+
'SAI_BUFFER_POOL_TYPE_INGRESS',
26+
'SAI_BUFFER_POOL_ATTR_SIZE',
27+
'10',
28+
],
29+
},
30+
{
31+
'name': 'buffer_profile_1',
32+
'op': 'create',
33+
'type': 'SAI_OBJECT_TYPE_BUFFER_PROFILE',
34+
'attributes': [
35+
'SAI_BUFFER_PROFILE_ATTR_POOL_ID',
36+
'$buffer_pool_1',
37+
'SAI_BUFFER_PROFILE_ATTR_RESERVED_BUFFER_SIZE',
38+
'10',
39+
'SAI_BUFFER_PROFILE_ATTR_THRESHOLD_MODE',
40+
'SAI_BUFFER_PROFILE_THRESHOLD_MODE_STATIC',
41+
'SAI_BUFFER_PROFILE_ATTR_SHARED_DYNAMIC_TH',
42+
'1',
43+
'SAI_BUFFER_PROFILE_ATTR_SHARED_STATIC_TH',
44+
'10',
45+
],
46+
},
47+
]
48+
49+
results = [*npu.process_commands(commands)]
50+
print('======= SAI commands RETURN values create =======')
51+
pprint(results)

tests/api/test_hostif.py

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
from pprint import pprint
2+
3+
import pytest
4+
5+
6+
@pytest.fixture(scope='module', autouse=True)
7+
def skip_all(testbed_instance):
8+
testbed = testbed_instance
9+
if testbed is not None and len(testbed.npu) != 1:
10+
pytest.skip('invalid for {} testbed'.format(testbed.name))
11+
12+
13+
@pytest.mark.npu
14+
class TestSaiHostif:
15+
# object with parent SAI_OBJECT_TYPE_PORT SAI_OBJECT_TYPE_LAG SAI_OBJECT_TYPE_VLAN SAI_OBJECT_TYPE_SYSTEM_PORT
16+
17+
def test_hostif_create(self, npu):
18+
commands = [
19+
{
20+
'name': 'port_1',
21+
'op': 'create',
22+
'type': 'SAI_OBJECT_TYPE_PORT',
23+
'attributes': [
24+
'SAI_PORT_ATTR_HW_LANE_LIST',
25+
'2:10,11',
26+
'SAI_PORT_ATTR_SPEED',
27+
'10',
28+
],
29+
},
30+
{
31+
'name': 'hostif_1',
32+
'op': 'create',
33+
'type': 'SAI_OBJECT_TYPE_HOSTIF',
34+
'attributes': [
35+
'SAI_HOSTIF_ATTR_TYPE',
36+
'SAI_HOSTIF_TYPE_NETDEV',
37+
'SAI_HOSTIF_ATTR_OBJ_ID',
38+
'$port_1',
39+
'SAI_HOSTIF_ATTR_NAME',
40+
'inbound',
41+
'SAI_HOSTIF_ATTR_GENETLINK_MCGRP_NAME',
42+
'inbound',
43+
],
44+
},
45+
]
46+
47+
results = [*npu.process_commands(commands)]
48+
print('======= SAI commands RETURN values create =======')
49+
pprint(results)
50+
51+
@pytest.mark.dependency(name='test_sai_hostif_attr_oper_status_set')
52+
def test_sai_hostif_attr_oper_status_set(self, npu):
53+
commands = [
54+
{
55+
'name': 'hostif_1',
56+
'op': 'set',
57+
'attributes': ['SAI_HOSTIF_ATTR_OPER_STATUS', 'false'],
58+
}
59+
]
60+
results = [*npu.process_commands(commands)]
61+
print('======= SAI commands RETURN values set =======')
62+
pprint(results)
63+
64+
@pytest.mark.dependency(depends=['test_sai_hostif_attr_oper_status_set'])
65+
def test_sai_hostif_attr_oper_status_get(self, npu):
66+
commands = [
67+
{
68+
'name': 'hostif_1',
69+
'op': 'get',
70+
'attributes': ['SAI_HOSTIF_ATTR_OPER_STATUS'],
71+
}
72+
]
73+
results = [*npu.process_commands(commands)]
74+
print('======= SAI commands RETURN values get =======')
75+
for command in results:
76+
for attribute in command:
77+
pprint(attribute.raw())
78+
r_value = results[0][0].value()
79+
print(r_value)
80+
assert r_value == 'false', 'Get error, expected false but got %s' % r_value
81+
82+
@pytest.mark.dependency(name='test_sai_hostif_attr_queue_set')
83+
def test_sai_hostif_attr_queue_set(self, npu):
84+
commands = [
85+
{
86+
'name': 'hostif_1',
87+
'op': 'set',
88+
'attributes': ['SAI_HOSTIF_ATTR_QUEUE', '0'],
89+
}
90+
]
91+
results = [*npu.process_commands(commands)]
92+
print('======= SAI commands RETURN values set =======')
93+
pprint(results)
94+
95+
@pytest.mark.dependency(depends=['test_sai_hostif_attr_queue_set'])
96+
def test_sai_hostif_attr_queue_get(self, npu):
97+
commands = [
98+
{'name': 'hostif_1', 'op': 'get', 'attributes': ['SAI_HOSTIF_ATTR_QUEUE']}
99+
]
100+
results = [*npu.process_commands(commands)]
101+
print('======= SAI commands RETURN values get =======')
102+
for command in results:
103+
for attribute in command:
104+
pprint(attribute.raw())
105+
r_value = results[0][0].value()
106+
print(r_value)
107+
assert r_value == '0', 'Get error, expected 0 but got %s' % r_value
108+
109+
@pytest.mark.dependency(name='test_sai_hostif_attr_vlan_tag_set')
110+
def test_sai_hostif_attr_vlan_tag_set(self, npu):
111+
commands = [
112+
{
113+
'name': 'hostif_1',
114+
'op': 'set',
115+
'attributes': ['SAI_HOSTIF_ATTR_VLAN_TAG', 'SAI_HOSTIF_VLAN_TAG_STRIP'],
116+
}
117+
]
118+
results = [*npu.process_commands(commands)]
119+
print('======= SAI commands RETURN values set =======')
120+
pprint(results)
121+
122+
@pytest.mark.dependency(depends=['test_sai_hostif_attr_vlan_tag_set'])
123+
def test_sai_hostif_attr_vlan_tag_get(self, npu):
124+
commands = [
125+
{
126+
'name': 'hostif_1',
127+
'op': 'get',
128+
'attributes': ['SAI_HOSTIF_ATTR_VLAN_TAG'],
129+
}
130+
]
131+
results = [*npu.process_commands(commands)]
132+
print('======= SAI commands RETURN values get =======')
133+
for command in results:
134+
for attribute in command:
135+
pprint(attribute.raw())
136+
r_value = results[0][0].value()
137+
print(r_value)
138+
assert r_value == 'SAI_HOSTIF_VLAN_TAG_STRIP', (
139+
'Get error, expected SAI_HOSTIF_VLAN_TAG_STRIP but got %s' % r_value
140+
)
141+
142+
def test_hostif_remove(self, npu):
143+
commands = [
144+
{'name': 'hostif_1', 'op': 'remove'},
145+
{'name': 'port_1', 'op': 'remove'},
146+
]
147+
148+
results = [*npu.process_commands(commands)]
149+
print('======= SAI commands RETURN values remove =======')
150+
pprint(results)
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
from pprint import pprint
2+
3+
import pytest
4+
5+
6+
@pytest.fixture(scope='module', autouse=True)
7+
def skip_all(testbed_instance):
8+
testbed = testbed_instance
9+
if testbed is not None and len(testbed.npu) != 1:
10+
pytest.skip('invalid for {} testbed'.format(testbed.name))
11+
12+
13+
@pytest.mark.npu
14+
class TestSaiIsolationGroupMember:
15+
# object with parent SAI_OBJECT_TYPE_ISOLATION_GROUP SAI_OBJECT_TYPE_PORT SAI_OBJECT_TYPE_BRIDGE_PORT
16+
17+
def test_isolation_group_member_create(self, npu):
18+
commands = [
19+
{
20+
'name': 'isolation_group_1',
21+
'op': 'create',
22+
'type': 'SAI_OBJECT_TYPE_ISOLATION_GROUP',
23+
'attributes': [
24+
'SAI_ISOLATION_GROUP_ATTR_TYPE',
25+
'SAI_ISOLATION_GROUP_TYPE_PORT',
26+
],
27+
},
28+
{
29+
'name': 'port_1',
30+
'op': 'create',
31+
'type': 'SAI_OBJECT_TYPE_PORT',
32+
'attributes': [
33+
'SAI_PORT_ATTR_HW_LANE_LIST',
34+
'2:10,11',
35+
'SAI_PORT_ATTR_SPEED',
36+
'10',
37+
],
38+
},
39+
{
40+
'name': 'isolation_group_member_1',
41+
'op': 'create',
42+
'type': 'SAI_OBJECT_TYPE_ISOLATION_GROUP_MEMBER',
43+
'attributes': [
44+
'SAI_ISOLATION_GROUP_MEMBER_ATTR_ISOLATION_GROUP_ID',
45+
'$isolation_group_1',
46+
'SAI_ISOLATION_GROUP_MEMBER_ATTR_ISOLATION_OBJECT',
47+
'$port_1',
48+
],
49+
},
50+
]
51+
52+
results = [*npu.process_commands(commands)]
53+
print('======= SAI commands RETURN values create =======')
54+
pprint(results)
55+
56+
def test_isolation_group_member_remove(self, npu):
57+
commands = [
58+
{'name': 'isolation_group_member_1', 'op': 'remove'},
59+
{'name': 'isolation_group_1', 'op': 'remove'},
60+
]
61+
62+
results = [*npu.process_commands(commands)]
63+
print('======= SAI commands RETURN values remove =======')
64+
pprint(results)

tests/api/test_lag_member.py

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
from pprint import pprint
2+
3+
import pytest
4+
5+
6+
@pytest.fixture(scope='module', autouse=True)
7+
def skip_all(testbed_instance):
8+
testbed = testbed_instance
9+
if testbed is not None and len(testbed.npu) != 1:
10+
pytest.skip('invalid for {} testbed'.format(testbed.name))
11+
12+
13+
@pytest.mark.npu
14+
class TestSaiLagMember:
15+
# object with parent SAI_OBJECT_TYPE_LAG SAI_OBJECT_TYPE_PORT SAI_OBJECT_TYPE_SYSTEM_PORT
16+
17+
def test_lag_member_create(self, npu):
18+
commands = [
19+
{
20+
'name': 'lag_1',
21+
'op': 'create',
22+
'type': 'SAI_OBJECT_TYPE_LAG',
23+
'attributes': [],
24+
},
25+
{
26+
'name': 'port_1',
27+
'op': 'create',
28+
'type': 'SAI_OBJECT_TYPE_PORT',
29+
'attributes': [
30+
'SAI_PORT_ATTR_HW_LANE_LIST',
31+
'2:10,11',
32+
'SAI_PORT_ATTR_SPEED',
33+
'10',
34+
],
35+
},
36+
{
37+
'name': 'lag_member_1',
38+
'op': 'create',
39+
'type': 'SAI_OBJECT_TYPE_LAG_MEMBER',
40+
'attributes': [
41+
'SAI_LAG_MEMBER_ATTR_LAG_ID',
42+
'$lag_1',
43+
'SAI_LAG_MEMBER_ATTR_PORT_ID',
44+
'$port_1',
45+
],
46+
},
47+
]
48+
49+
results = [*npu.process_commands(commands)]
50+
print('======= SAI commands RETURN values create =======')
51+
pprint(results)
52+
53+
@pytest.mark.dependency(name='test_sai_lag_member_attr_egress_disable_set')
54+
def test_sai_lag_member_attr_egress_disable_set(self, npu):
55+
commands = [
56+
{
57+
'name': 'lag_member_1',
58+
'op': 'set',
59+
'attributes': ['SAI_LAG_MEMBER_ATTR_EGRESS_DISABLE', 'false'],
60+
}
61+
]
62+
results = [*npu.process_commands(commands)]
63+
print('======= SAI commands RETURN values set =======')
64+
pprint(results)
65+
66+
67+
@pytest.mark.dependency(name='test_sai_lag_member_attr_ingress_disable_set')
68+
def test_sai_lag_member_attr_ingress_disable_set(self, npu):
69+
commands = [
70+
{
71+
'name': 'lag_member_1',
72+
'op': 'set',
73+
'attributes': ['SAI_LAG_MEMBER_ATTR_INGRESS_DISABLE', 'false'],
74+
}
75+
]
76+
results = [*npu.process_commands(commands)]
77+
print('======= SAI commands RETURN values set =======')
78+
pprint(results)
79+
80+
81+
def test_lag_member_remove(self, npu):
82+
commands = [
83+
{'name': 'lag_member_1', 'op': 'remove'},
84+
{'name': 'port_1', 'op': 'remove'},
85+
{'name': 'lag_1', 'op': 'remove'},
86+
]
87+
88+
results = [*npu.process_commands(commands)]
89+
print('======= SAI commands RETURN values remove =======')
90+
pprint(results)

tests/api/test_my_mac.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from pprint import pprint
2+
3+
import pytest
4+
5+
6+
@pytest.fixture(scope='module', autouse=True)
7+
def skip_all(testbed_instance):
8+
testbed = testbed_instance
9+
if testbed is not None and len(testbed.npu) != 1:
10+
pytest.skip('invalid for {} testbed'.format(testbed.name))
11+
12+
13+
@pytest.mark.npu
14+
class TestSaiMyMac:
15+
# object with no attributes
16+
17+
def test_my_mac_create(self, npu):
18+
commands = [
19+
{
20+
'name': 'my_mac_1',
21+
'op': 'create',
22+
'type': 'SAI_OBJECT_TYPE_MY_MAC',
23+
'attributes': [],
24+
}
25+
]
26+
27+
results = [*npu.process_commands(commands)]
28+
print('======= SAI commands RETURN values create =======')
29+
pprint(results)
30+
31+
def test_my_mac_remove(self, npu):
32+
commands = [{'name': 'my_mac_1', 'op': 'remove'}]
33+
34+
results = [*npu.process_commands(commands)]
35+
print('======= SAI commands RETURN values remove =======')
36+
pprint(results)

0 commit comments

Comments
 (0)