-
Notifications
You must be signed in to change notification settings - Fork 547
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: Guohan Lu <lguohan@gmail.com>
- Loading branch information
1 parent
849bdf9
commit a83a2a4
Showing
2 changed files
with
39 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import json | ||
from dvslib.dvs_common import wait_for_result | ||
|
||
class DVSRoute(object): | ||
def __init__(self, adb, cdb): | ||
self.asic_db = adb | ||
self.config_db = cdb | ||
|
||
def check_asicdb_route_entries(self, destinations): | ||
def _access_function(): | ||
route_entries = self.asic_db.get_keys("ASIC_STATE:SAI_OBJECT_TYPE_ROUTE_ENTRY") | ||
route_destinations = [json.loads(route_entry)["dest"] | ||
for route_entry in route_entries] | ||
return (all(destination in route_destinations for destination in destinations), None) | ||
|
||
wait_for_result(_access_function) | ||
|
||
keys = self.asic_db.get_keys("ASIC_STATE:SAI_OBJECT_TYPE_ROUTE_ENTRY") | ||
|
||
return [k for k in keys if json.loads(k)['dest'] in destinations] | ||
|
||
def check_asicdb_deleted_route_entries(self, destinations): | ||
def _access_function(): | ||
route_entries = self.asic_db.get_keys("ASIC_STATE:SAI_OBJECT_TYPE_ROUTE_ENTRY") | ||
route_destinations = [json.loads(route_entry)["dest"] for route_entry in route_entries] | ||
return (all(destination not in route_destinations for destination in destinations), None) | ||
|
||
wait_for_result(_access_function) |