forked from sonic-net/DASH
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created test-cases to test the SAI API routing (create and remove)
- Loading branch information
1 parent
3d62a6b
commit ce534df
Showing
2 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
test/test-cases/functional/saic/sai-api/test_sai_api_vnet_nhop_route.py
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from pprint import pprint | ||
|
||
import pytest | ||
|
||
# Constants | ||
SWITCH_ID = 5 | ||
|
||
commands = [ | ||
{ | ||
"name": "route_entry_1", | ||
"op": "create", | ||
"type": "SAI_OBJECT_TYPE_ROUTE_ENTRY", | ||
"key": { | ||
"switch_id": "$SWITCH_ID", | ||
"vr_id": "10", | ||
"destination": "221.1.0.0/24" | ||
}, | ||
"attributes": [ | ||
"SAI_ROUTE_ENTRY_ATTR_NEXT_HOP_ID", | ||
"0" | ||
] | ||
}, | ||
{ | ||
"name": "route_entry_2", | ||
"op": "create", | ||
"type": "SAI_OBJECT_TYPE_ROUTE_ENTRY", | ||
"key": { | ||
"switch_id": "$SWITCH_ID", | ||
"vr_id": "10", | ||
"destination": "221.2.0.0/24", | ||
}, | ||
"attributes": [ | ||
"SAI_ROUTE_ENTRY_ATTR_NEXT_HOP_ID", | ||
"1" | ||
] | ||
} | ||
] | ||
|
||
class TestSaiVnetRoutingEntry: | ||
def test_vnet_nhop_routing_create(self, dpu): | ||
results = [*dpu.process_commands(commands)] | ||
print('======= SAI commands RETURN values create =======') | ||
pprint(results) | ||
assert all(results), 'Create error' | ||
|
||
def test_vnet_nhop_routing_remove(self, dpu): | ||
results = [*dpu.process_commands(commands, cleanup=True)] | ||
print("\n======= SAI commands RETURN values remove =======") | ||
pprint(results) | ||
assert all( | ||
[result == 'SAI_STATUS_SUCCESS' for result in results] | ||
), 'Remove error' |
52 changes: 52 additions & 0 deletions
52
test/test-cases/scale/saic/test_sai_api_vnet_nhop_route.py
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from pprint import pprint | ||
|
||
import pytest | ||
|
||
# Constants | ||
SWITCH_ID = 5 | ||
|
||
commands = [ | ||
{ | ||
"name": "route_entry_1", | ||
"op": "create", | ||
"type": "SAI_OBJECT_TYPE_ROUTE_ENTRY", | ||
"key": { | ||
"switch_id": "$SWITCH_ID", | ||
"vr_id": "10", | ||
"destination": "221.1.0.0/24" | ||
}, | ||
"attributes": [ | ||
"SAI_ROUTE_ENTRY_ATTR_NEXT_HOP_ID", | ||
"0" | ||
] | ||
}, | ||
{ | ||
"name": "route_entry_2", | ||
"op": "create", | ||
"type": "SAI_OBJECT_TYPE_ROUTE_ENTRY", | ||
"key": { | ||
"switch_id": "$SWITCH_ID", | ||
"vr_id": "10", | ||
"destination": "221.2.0.0/24", | ||
}, | ||
"attributes": [ | ||
"SAI_ROUTE_ENTRY_ATTR_NEXT_HOP_ID", | ||
"1" | ||
] | ||
} | ||
] | ||
|
||
class TestSaiVnetRoutingEntry: | ||
def test_vnet_nhop_routing_create(self, dpu): | ||
results = [*dpu.process_commands(commands)] | ||
print('======= SAI commands RETURN values create =======') | ||
pprint(results) | ||
assert all(results), 'Create error' | ||
|
||
def test_vnet_nhop_routing_remove(self, dpu): | ||
results = [*dpu.process_commands(commands, cleanup=True)] | ||
print("\n======= SAI commands RETURN values remove =======") | ||
pprint(results) | ||
assert all( | ||
[result == 'SAI_STATUS_SUCCESS' for result in results] | ||
), 'Remove error' |