-
Notifications
You must be signed in to change notification settings - Fork 648
Orchagent changes needed to support single ASIC VOQ Fixed-System #3847
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
base: master
Are you sure you want to change the base?
Changes from 14 commits
f0b2cec
9925e34
a878c08
756c48c
77b17bf
a63b4d9
49d7b93
f1a54fa
7e36333
6140dd1
a5a7d9b
4028a48
49f2df5
a9b094d
5561705
7a6d0ae
0780b1c
504be65
212f021
340f91a
b90964a
e563a9b
74427f6
b220bb4
566e45b
f2e9985
eae99a5
5e89254
36fd1c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,8 @@ extern "C" { | |
| #include <stdexcept> | ||
| #include <stdlib.h> | ||
| #include <string.h> | ||
| #include <fstream> | ||
| #include <nlohmann/json.hpp> | ||
|
|
||
| #include <sys/time.h> | ||
| #include <sairedis.h> | ||
|
|
@@ -205,6 +207,18 @@ void getCfgSwitchType(DBConnector *cfgDb, string &switch_type, string &switch_su | |
|
|
||
| } | ||
|
|
||
| bool isChassisAppDbPresent() | ||
| { | ||
| std::ifstream file("/etc/sonic/database_config.json"); | ||
| if (!file.is_open()) return false; | ||
|
|
||
| nlohmann::json db_config; | ||
| file >> db_config; | ||
|
|
||
| return db_config.contains("DATABASES") && | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we handle this by any other field in Config_DB and not reading file? @arlakshm There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At some point, there was an idea/suggestion to use a different flag in DEVICE_METADATA to indicate this mode. It's definitely a plausible solution, but a bit redundant and we have to worry about inconsistency between what that flag says and the presence/absence of this file. Both are valid approaches though and it will be good to see what @arlakshm suggests here
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tjchadaga : can you put final conclusion here ?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @prsunny, currently we do not have any config_db entry to identify this. We can keep the check for chassis_db.conf. We will revisit this once we have any config_db entry is added |
||
| db_config["DATABASES"].contains("CHASSIS_APP_DB"); | ||
| } | ||
|
|
||
| bool getSystemPortConfigList(DBConnector *cfgDb, DBConnector *appDb, vector<sai_system_port_config_t> &sysportcfglist) | ||
| { | ||
| Table cfgDeviceMetaDataTable(cfgDb, CFG_DEVICE_METADATA_TABLE_NAME); | ||
|
|
@@ -607,7 +621,17 @@ int main(int argc, char **argv) | |
|
|
||
| //Connect to CHASSIS_APP_DB in redis-server in control/supervisor card as per | ||
| //connection info in database_config.json | ||
| chassis_app_db = make_shared<DBConnector>("CHASSIS_APP_DB", 0, true); | ||
| chassis_app_db = nullptr; | ||
| if (isChassisAppDbPresent()) | ||
| { | ||
| try { | ||
lakshmi-nexthop marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| chassis_app_db = make_shared<DBConnector>("CHASSIS_APP_DB", 0, true); | ||
| } | ||
| catch (const std::exception& e) | ||
| { | ||
| SWSS_LOG_NOTICE("CHASSIS_APP_DB not available, operating in standalone VOQ mode"); | ||
| } | ||
| } | ||
| } | ||
| else if (gMySwitchType == "fabric") | ||
| { | ||
|
|
@@ -804,6 +828,11 @@ int main(int argc, char **argv) | |
| } | ||
|
|
||
| shared_ptr<OrchDaemon> orchDaemon; | ||
| DBConnector *chassis_db = nullptr; | ||
| if (chassis_app_db != nullptr) | ||
| { | ||
| chassis_db = chassis_app_db.get(); | ||
| } | ||
|
|
||
| /* | ||
| * Declare shared pointers for dpu specific databases. | ||
|
|
@@ -821,7 +850,7 @@ int main(int argc, char **argv) | |
|
|
||
| else if (gMySwitchType != "fabric") | ||
| { | ||
| orchDaemon = make_shared<OrchDaemon>(&appl_db, &config_db, &state_db, chassis_app_db.get(), zmq_server.get()); | ||
| orchDaemon = make_shared<OrchDaemon>(&appl_db, &config_db, &state_db, chassis_db, zmq_server.get()); | ||
| if (gMySwitchType == "voq") | ||
| { | ||
| orchDaemon->setFabricEnabled(true); | ||
|
|
@@ -831,7 +860,7 @@ int main(int argc, char **argv) | |
| } | ||
| else | ||
| { | ||
| orchDaemon = make_shared<FabricOrchDaemon>(&appl_db, &config_db, &state_db, chassis_app_db.get(), zmq_server.get()); | ||
| orchDaemon = make_shared<FabricOrchDaemon>(&appl_db, &config_db, &state_db, chassis_db, zmq_server.get()); | ||
| } | ||
|
|
||
| if (gRingMode) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.