Skip to content

Commit 9cf613e

Browse files
committed
resolving conflicts
Signed-off-by: selldinesh <[email protected]>
1 parent d03b202 commit 9cf613e

File tree

1 file changed

+34
-53
lines changed

1 file changed

+34
-53
lines changed

tests/api/test_udf.py

Lines changed: 34 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,50 @@
1-
21
from pprint import pprint
3-
42
import pytest
53

64

7-
@pytest.fixture(scope="module", autouse=True)
8-
def discovery(npu):
9-
npu.objects_discovery()
10-
11-
12-
@pytest.fixture(scope="module", autouse=True)
5+
@pytest.fixture(scope='module', autouse=True)
136
def skip_all(testbed_instance):
147
testbed = testbed_instance
158
if testbed is not None and len(testbed.npu) != 1:
16-
pytest.skip("invalid for {} testbed".format(testbed.name))
17-
9+
pytest.skip('invalid for {} testbed'.format(testbed.name))
1810

1911
@pytest.mark.npu
2012
class TestSaiUdf:
2113
# object with parent SAI_OBJECT_TYPE_UDF_MATCH SAI_OBJECT_TYPE_UDF_GROUP
2214

2315
def test_udf_create(self, npu):
24-
25-
commands = [{'name': 'udf_match_1', 'op': 'create', 'type': 'SAI_OBJECT_TYPE_UDF_MATCH', 'attributes': []}, {'name': 'udf_group_1', 'op': 'create', 'type': 'SAI_OBJECT_TYPE_UDF_GROUP', 'attributes': ['SAI_UDF_GROUP_ATTR_LENGTH', '10']}, {'name': 'udf_1', 'op': 'create', 'type': 'SAI_OBJECT_TYPE_UDF', 'attributes': ['SAI_UDF_ATTR_MATCH_ID', '$udf_match_1', 'SAI_UDF_ATTR_GROUP_ID', '$udf_group_1', 'SAI_UDF_ATTR_OFFSET', '10']}]
16+
commands = [
17+
{
18+
'name': 'udf_match_1',
19+
'op': 'create',
20+
'type': 'SAI_OBJECT_TYPE_UDF_MATCH',
21+
'attributes': [],
22+
},
23+
{
24+
'name': 'udf_group_1',
25+
'op': 'create',
26+
'type': 'SAI_OBJECT_TYPE_UDF_GROUP',
27+
'attributes': ['SAI_UDF_GROUP_ATTR_LENGTH', '10'],
28+
},
29+
{
30+
'name': 'udf_1',
31+
'op': 'create',
32+
'type': 'SAI_OBJECT_TYPE_UDF',
33+
'attributes': [
34+
'SAI_UDF_ATTR_MATCH_ID',
35+
'$udf_match_1',
36+
'SAI_UDF_ATTR_GROUP_ID',
37+
'$udf_group_1',
38+
'SAI_UDF_ATTR_OFFSET',
39+
'10',
40+
],
41+
},
42+
]
2643

2744
results = [*npu.process_commands(commands)]
2845
print('======= SAI commands RETURN values create =======')
2946
pprint(results)
3047

31-
32-
3348
@pytest.mark.dependency(name="test_sai_udf_attr_base_set")
3449
def test_sai_udf_attr_base_set(self, npu):
3550

@@ -66,47 +81,13 @@ def test_sai_udf_attr_base_get(self, npu):
6681
assert r_value == 'SAI_UDF_BASE_L2', 'Get error, expected SAI_UDF_BASE_L2 but got %s' % r_value
6782

6883

69-
@pytest.mark.dependency(name="test_sai_udf_attr_hash_mask_set")
70-
def test_sai_udf_attr_hash_mask_set(self, npu):
71-
72-
commands = [
73-
{
74-
"name": "udf_1",
75-
"op": "set",
76-
"attributes": ["SAI_UDF_ATTR_HASH_MASK", 'const']
77-
}
78-
]
79-
results = [*npu.process_commands(commands)]
80-
print("======= SAI commands RETURN values set =======")
81-
pprint(results)
82-
83-
84-
85-
@pytest.mark.dependency(depends=["test_sai_udf_attr_hash_mask_set"])
86-
def test_sai_udf_attr_hash_mask_get(self, npu):
87-
84+
def test_udf_remove(self, npu):
8885
commands = [
89-
{
90-
"name": "udf_1",
91-
"op": "get",
92-
"attributes": ["SAI_UDF_ATTR_HASH_MASK"]
93-
}
86+
{'name': 'udf_1', 'op': 'remove'},
87+
{'name': 'udf_group_1', 'op': 'remove'},
88+
{'name': 'udf_match_1', 'op': 'remove'},
9489
]
95-
results = [*npu.process_commands(commands)]
96-
print("======= SAI commands RETURN values get =======")
97-
for command in results:
98-
for attribute in command:
99-
pprint(attribute.raw())
100-
r_value = results[0][0].value()
101-
print(r_value)
102-
assert r_value == 'const', 'Get error, expected const but got %s' % r_value
103-
104-
105-
def test_udf_remove(self, npu):
106-
107-
commands = [{'name': 'udf_1', 'op': 'remove'}, {'name': 'udf_group_1', 'op': 'remove'}, {'name': 'udf_match_1', 'op': 'remove'}]
10890

10991
results = [*npu.process_commands(commands)]
11092
print('======= SAI commands RETURN values remove =======')
111-
pprint(results)
112-
93+
pprint(results)

0 commit comments

Comments
 (0)