-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: selldinesh <[email protected]>
- Loading branch information
1 parent
9a75130
commit 1410fa6
Showing
9 changed files
with
2,521 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,75 @@ | ||
|
||
from pprint import pprint | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="module", autouse=True) | ||
def discovery(npu): | ||
npu.objects_discovery() | ||
|
||
|
||
@pytest.fixture(scope="module", autouse=True) | ||
def skip_all(testbed_instance): | ||
testbed = testbed_instance | ||
if testbed is not None and len(testbed.npu) != 1: | ||
pytest.skip("invalid for {} testbed".format(testbed.name)) | ||
|
||
|
||
@pytest.mark.npu | ||
class TestSaiNextHopGroup: | ||
# object with no parents | ||
|
||
def test_next_hop_group_create(self, npu): | ||
|
||
commands = [{'name': 'next_hop_group_1', 'op': 'create', 'type': 'SAI_OBJECT_TYPE_NEXT_HOP_GROUP', 'attributes': ['SAI_NEXT_HOP_GROUP_ATTR_TYPE', 'SAI_NEXT_HOP_GROUP_TYPE_DYNAMIC_UNORDERED_ECMP']}] | ||
|
||
results = [*npu.process_commands(commands)] | ||
print('======= SAI commands RETURN values create =======') | ||
pprint(results) | ||
|
||
|
||
@pytest.mark.dependency(name="test_sai_next_hop_group_attr_set_switchover_set") | ||
def test_sai_next_hop_group_attr_set_switchover_set(self, npu): | ||
|
||
commands = [ | ||
{ | ||
'name': 'next_hop_group_1', | ||
'op': 'create', | ||
'type': 'SAI_OBJECT_TYPE_NEXT_HOP_GROUP', | ||
'attributes': [ | ||
'SAI_NEXT_HOP_GROUP_ATTR_TYPE', | ||
'SAI_NEXT_HOP_GROUP_TYPE_DYNAMIC_UNORDERED_ECMP', | ||
], | ||
"name": "next_hop_group_1", | ||
"op": "set", | ||
"attributes": ["SAI_NEXT_HOP_GROUP_ATTR_SET_SWITCHOVER", 'false'] | ||
} | ||
] | ||
|
||
results = [*npu.process_commands(commands)] | ||
print('======= SAI commands RETURN values create =======') | ||
print("======= SAI commands RETURN values set =======") | ||
pprint(results) | ||
|
||
def test_next_hop_group_remove(self, npu): | ||
|
||
|
||
@pytest.mark.dependency(depends=["test_sai_next_hop_group_attr_set_switchover_set"]) | ||
def test_sai_next_hop_group_attr_set_switchover_get(self, npu): | ||
|
||
commands = [ | ||
{ | ||
'name': 'next_hop_group_1', | ||
'op': 'remove', | ||
"name": "next_hop_group_1", | ||
"op": "get", | ||
"attributes": ["SAI_NEXT_HOP_GROUP_ATTR_SET_SWITCHOVER"] | ||
} | ||
] | ||
results = [*npu.process_commands(commands)] | ||
print("======= SAI commands RETURN values get =======") | ||
for command in results: | ||
for attribute in command: | ||
pprint(attribute.raw()) | ||
r_value = results[0][0].value() | ||
print(r_value) | ||
assert r_value == 'false', 'Get error, expected false but got %s' % r_value | ||
|
||
|
||
def test_next_hop_group_remove(self, npu): | ||
|
||
commands = [{'name': 'next_hop_group_1', 'op': 'remove'}] | ||
|
||
results = [*npu.process_commands(commands)] | ||
print('======= SAI commands RETURN values remove =======') | ||
pprint(results) | ||
|
Oops, something went wrong.