Skip to content

Commit

Permalink
[syncd] Add supports of bulk api in syncd (#656)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytroxshevchuk committed Oct 23, 2020
1 parent a9f69c1 commit 1b6fc2e
Show file tree
Hide file tree
Showing 16 changed files with 1,273 additions and 38 deletions.
435 changes: 419 additions & 16 deletions saiplayer/SaiPlayer.cpp

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions saiplayer/SaiPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ namespace saiplayer
_In_ const std::vector<std::shared_ptr<saimeta::SaiAttributeList>> &attributes,
_In_ const std::vector<sai_status_t> &recorded_statuses);

sai_status_t handle_bulk_object(
_In_ sai_object_type_t object_type,
_In_ const std::vector<std::string> &object_ids,
_In_ sai_common_api_t api,
_In_ const std::vector<std::shared_ptr<saimeta::SaiAttributeList>> &attributes,
_Out_ std::vector<sai_status_t> &statuses);

sai_status_t handle_bulk_entry(
_In_ const std::vector<std::string> &object_ids,
_In_ sai_object_type_t object_type,
_In_ sai_common_api_t api,
_In_ const std::vector<std::shared_ptr<saimeta::SaiAttributeList>> &attributes,
_Out_ std::vector<sai_status_t> &statuses);

std::vector<std::string> tokenize(
_In_ std::string input,
_In_ const std::string &delim);
Expand Down
2 changes: 2 additions & 0 deletions syncd/CommandLineOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CommandLineOptions::CommandLineOptions()
m_enableUnittests = false;
m_enableConsistencyCheck = false;
m_enableSyncMode = false;
m_enableSaiBulkSupport = false;

m_startType = SAI_START_TYPE_COLD_BOOT;

Expand Down Expand Up @@ -51,6 +52,7 @@ std::string CommandLineOptions::getCommandLineString() const
ss << " EnableUnittests=" << (m_enableUnittests ? "YES" : "NO");
ss << " EnableConsistencyCheck=" << (m_enableConsistencyCheck ? "YES" : "NO");
ss << " EnableSyncMode=" << (m_enableSyncMode ? "YES" : "NO");
ss << " EnableSaiBulkSuport=" << (m_enableSaiBulkSupport ? "YES" : "NO");
ss << " StartType=" << startTypeToString(m_startType);
ss << " ProfileMapFile=" << m_profileMapFile;
ss << " GlobalContext=" << m_globalContext;
Expand Down
2 changes: 2 additions & 0 deletions syncd/CommandLineOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ namespace syncd

bool m_enableSyncMode;

bool m_enableSaiBulkSupport;

sai_start_type_t m_startType;

std::string m_profileMapFile;
Expand Down
15 changes: 11 additions & 4 deletions syncd/CommandLineOptionsParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ std::shared_ptr<CommandLineOptions> CommandLineOptionsParser::parseCommandLine(
auto options = std::make_shared<CommandLineOptions>();

#ifdef SAITHRIFT
const char* const optstring = "dp:t:g:x:b:uSUCsrm:h";
const char* const optstring = "dp:t:g:x:b:uSUCslrm:h";
#else
const char* const optstring = "dp:t:g:x:b:uSUCsh";
const char* const optstring = "dp:t:g:x:b:uSUCslh";
#endif // SAITHRIFT

while(true)
Expand All @@ -34,6 +34,7 @@ std::shared_ptr<CommandLineOptions> CommandLineOptionsParser::parseCommandLine(
{ "enableUnittests", no_argument, 0, 'U' },
{ "enableConsistencyCheck", no_argument, 0, 'C' },
{ "syncMode", no_argument, 0, 's' },
{ "enableSaiBulkSupport", no_argument, 0, 'l' },
{ "globalContext", required_argument, 0, 'g' },
{ "contextContig", required_argument, 0, 'x' },
{ "breakConfig", required_argument, 0, 'b' },
Expand Down Expand Up @@ -94,6 +95,10 @@ std::shared_ptr<CommandLineOptions> CommandLineOptionsParser::parseCommandLine(
options->m_enableSyncMode = true;
break;

case 'l':
options->m_enableSaiBulkSupport = true;
break;

case 'g':
options->m_globalContext = (uint32_t)std::stoul(optarg);
break;
Expand Down Expand Up @@ -138,9 +143,9 @@ void CommandLineOptionsParser::printUsage()
SWSS_LOG_ENTER();

#ifdef SAITHRIFT
std::cout << "Usage: syncd [-d] [-p profile] [-t type] [-u] [-S] [-U] [-C] [-s] [-g idx] [-x contextConfig] [-b breakConfig] [-r] [-m portmap] [-h]" << std::endl;
std::cout << "Usage: syncd [-d] [-p profile] [-t type] [-u] [-S] [-U] [-C] [-s] [-l] [-g idx] [-x contextConfig] [-b breakConfig] [-r] [-m portmap] [-h]" << std::endl;
#else
std::cout << "Usage: syncd [-d] [-p profile] [-t type] [-u] [-S] [-U] [-C] [-s] [-g idx] [-x contextConfig] [-b breakConfig] [-h]" << std::endl;
std::cout << "Usage: syncd [-d] [-p profile] [-t type] [-u] [-S] [-U] [-C] [-s] [-l] [-g idx] [-x contextConfig] [-b breakConfig] [-h]" << std::endl;
#endif // SAITHRIFT

std::cout << " -d --diag" << std::endl;
Expand All @@ -159,6 +164,8 @@ void CommandLineOptionsParser::printUsage()
std::cout << " Enable consisteny check DB vs ASIC after comparison logic" << std::endl;
std::cout << " -s --syncMode" << std::endl;
std::cout << " Enable synchronous mode" << std::endl;
std::cout << " -l --enableBulk" << std::endl;
std::cout << " Enable SAI Bulk support" << std::endl;
std::cout << " -g --globalContext" << std::endl;
std::cout << " Global context index to load from context config file" << std::endl;
std::cout << " -x --contextConfig" << std::endl;
Expand Down
Loading

0 comments on commit 1b6fc2e

Please sign in to comment.