Skip to content

Commit

Permalink
[acl-loader]: Read state from state db instead of appl db (sonic-net#415
Browse files Browse the repository at this point in the history
)

The mirror session's state is now stored in the state database
instead of the application database.

Signed-off-by: Shu0T1an ChenG <shuche@microsoft.com>
  • Loading branch information
Shuotian Cheng authored Dec 12, 2018
1 parent ff2ed75 commit 415959d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions acl_loader/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def __init__(self):
self.sessions_db_info = {}
self.configdb = ConfigDBConnector()
self.configdb.connect()
self.appdb = SonicV2Connector(host="127.0.0.1")
self.appdb.connect(self.appdb.APPL_DB)
self.statedb = SonicV2Connector(host="127.0.0.1")
self.statedb.connect(self.statedb.STATE_DB)

self.read_tables_info()
self.read_rules_info()
Expand Down Expand Up @@ -120,9 +120,9 @@ def read_sessions_info(self):
"""
self.sessions_db_info = self.configdb.get_table(self.MIRROR_SESSION)
for key in self.sessions_db_info.keys():
app_db_info = self.appdb.get_all(self.appdb.APPL_DB, "{}:{}".format(self.MIRROR_SESSION, key))
if app_db_info:
status = app_db_info.get("status", "inactive")
state_db_info = self.statedb.get_all(self.statedb.STATE_DB, "{}|{}".format(self.MIRROR_SESSION, key))
if state_db_info:
status = state_db_info.get("status", "inactive")
else:
status = "error"
self.sessions_db_info[key]["status"] = status
Expand Down

0 comments on commit 415959d

Please # to comment.