-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LLDP]: Update init_db to load global database config #166
[LLDP]: Update init_db to load global database config #166
Conversation
before initializing SonicV2Connector class. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
OID string. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
# SyncD database connector. THIS MUST BE INITIALIZED ON A PER-THREAD BASIS. | ||
# Redis PubSub objects (such as those within swsssdk) are NOT thread-safe. | ||
db_conn = SonicV2Connector(**redis_kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redis_kwargs [](start = 33, length = 12)
Why remove existing feature? #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously redis_kwargs had unix socket path, with the changes done in SonicV2Connector class, unix socket path should be read from database config file. Fixed this to use unix_socket_path from database config file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is still arguable and irrelevant to the LLDP test fix. Could you minimize the changes in this PR, and submit another PR if you really want to change this part?
In reply to: 503657219 [](ancestors = 503657219)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted back as suggested, only to provide fix for unit-test.
@@ -181,9 +181,10 @@ def init_db(): | |||
Connects to DB | |||
:return: db_conn | |||
""" | |||
SonicDBConfig.load_sonic_global_db_config() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
load_sonic_global_db_config [](start = 18, length = 27)
Is it working for single ASIC use case? #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this works for single asic as well.
Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
With the changes done in SonicV2Connector class, unix socket path should be read from database config file and flag to use unix socket path should be set to true. Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
Signed-off-by: SuvarnaMeenakshi <sumeenak@microsoft.com>
[LLDP]: Update init_db to load global database config before initializing SonicV2Connector class. LLDPLocManAddrUpdater requires information from host database hence uses init_db() to initialize the host db. For unit-testing multi-asic code path, there are mock db files provided for global_db and namespace specific dbs. As init_db did not load global database config, unit-test mock db was not loading global_db database files for LLDPLocManAddrUpdater unit-testing. Fixed this by loading global database config in init_db function. Fixed by: Loading global database config in init_db() unit-test: Loading mock db files from "global_db" director for multi-asic platform if namespace is empty or None.
[LLDP]: Update init_db to load global database config
before initializing SonicV2Connector class.
LLDPLocManAddrUpdater requires information from host database hence uses init_db() to initialize the host db.
For unit-testing multi-asic code path, there are mock db files provided for global_db and namespace specific dbs.
As init_db did not load global database config, unit-test mock db was not loading global_db database files for LLDPLocManAddrUpdater unit-testing. Fixed this by loading global database config in init_db function.
- What I did
As init_db did not load global database config, unit-test mock db was not loading global_db database files for LLDPLocManAddrUpdater unit-testing. Fixed this by loading global database config in init_db function.
- How I did it
- How to verify it
Run unit-test test_subtype_lldp_loc_man_addr_table and make sure that for multi-asic platform, mock_tables/global_db/appl_db.json file is loaded and mock_tables/appl_db.json file is loaded for single-asic platform unit-test.
- Description for the changelog