From a754579cbb48be46d69eb7cdd51df16a1f3ff65b Mon Sep 17 00:00:00 2001 From: jumao Date: Tue, 26 Dec 2023 19:22:48 -0500 Subject: [PATCH 1/5] To fix the issue: https://github.com/sonic-net/sonic-sairedis/pull/1288#issuecomment-1865371815 --- saidump/saidump.cpp | 214 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 209 insertions(+), 5 deletions(-) diff --git a/saidump/saidump.cpp b/saidump/saidump.cpp index 6a3321e58..522f5bb40 100644 --- a/saidump/saidump.cpp +++ b/saidump/saidump.cpp @@ -2,6 +2,10 @@ #include #include #include +#include +#include +#include +#include extern "C" { #include @@ -10,32 +14,44 @@ extern "C" { #include "swss/table.h" #include "meta/sai_serialize.h" #include "sairediscommon.h" +#include "swss/json.hpp" #include // TODO split to multiple cpp using namespace swss; +using json = nlohmann::json; + +// Default value: 100 MB +constexpr int64_t RDB_JSON_MAX_SIZE = 1024 * 1024 * 100; struct CmdOptions { bool skipAttributes; bool dumpTempView; bool dumpGraph; + std::string rdbJsonFile; + uint64_t rdbJSonSizeLimit; }; -CmdOptions g_cmdOptions; -std::map g_oid_map; + +static CmdOptions g_cmdOptions; +static std::map g_oid_map; void printUsage() { SWSS_LOG_ENTER(); - std::cout << "Usage: saidump [-t] [-g] [-h]" << std::endl; + std::cout << "Usage: saidump [-t] [-g] [-r] [-m] [-h]" << std::endl; std::cout << " -t --tempView:" << std::endl; std::cout << " Dump temp view" << std::endl; std::cout << " -g --dumpGraph:" << std::endl; std::cout << " Dump current graph" << std::endl; + std::cout << " -r --rdb:" << std::endl; + std::cout << " Dump by parsing the RDB JSON file, which is created by rdbtools based on Redis dump.rdb that is generated by Redis SAVE command" << std::endl; + std::cout << " -m --max:" << std::endl; + std::cout << " Config the the RDB JSON file's max size in MB, which is optional with default value 100MB" << std::endl; std::cout << " -h --help:" << std::endl; std::cout << " Print out this message" << std::endl; } @@ -48,8 +64,10 @@ CmdOptions handleCmdLine(int argc, char **argv) options.dumpTempView = false; options.dumpGraph = false; + options.rdbJSonSizeLimit = RDB_JSON_MAX_SIZE; - const char* const optstring = "gth"; + const char* const optstring = "gtr:m:h"; + uint64_t result = 0; while (true) { @@ -57,6 +75,8 @@ CmdOptions handleCmdLine(int argc, char **argv) { { "dumpGraph", no_argument, 0, 'g' }, { "tempView", no_argument, 0, 't' }, + { "rdb", required_argument, 0, 'r' }, + { "max", required_argument, 0, 'm' }, { "help", no_argument, 0, 'h' }, { 0, 0, 0, 0 } }; @@ -82,6 +102,33 @@ CmdOptions handleCmdLine(int argc, char **argv) options.dumpTempView = true; break; + case 'r': + SWSS_LOG_NOTICE("Dumping from %s", optarg); + options.rdbJsonFile = std::string(optarg); + break; + + case 'm': + if(!regex_match(optarg, std::regex(R"([+]?\d+)"))) //only positive numeric chars are valid, such as 3984, +3232, etc. + { + SWSS_LOG_WARN("invalid option -m %s", optarg); + printUsage(); + exit(EXIT_SUCCESS); + } + + result = strtoull(optarg, NULL, 0); + + if((errno == ERANGE && result == ULLONG_MAX) || result == 0 || result >= INT_MAX) + { + SWSS_LOG_WARN("invalid option -m %s", optarg); + printUsage(); + exit(EXIT_SUCCESS); + } + + options.rdbJSonSizeLimit = result * 1024 * 1024; + SWSS_LOG_NOTICE("Configure the RDB JSON MAX size to %llu MB", options.rdbJSonSizeLimit / 1024 / 1024); + + break; + case 'h': printUsage(); exit(EXIT_SUCCESS); @@ -399,7 +446,153 @@ void dumpGraph(const TableDump& td) std::cout << "}" << std::endl; } -int main(int argc, char ** argv) +#define SWSS_LOG_ERROR_AND_STDERR(format, ...) { fprintf(stderr, format"\n", ##__VA_ARGS__); SWSS_LOG_ERROR(format, ##__VA_ARGS__); } + +/** + * @brief Process the input JSON file to make sure it's a valid JSON file for the JSON library. + */ +static sai_status_t preProcessFile(const std::string file_name) +{ + SWSS_LOG_ENTER(); + + std::ifstream input_file(file_name); + + if (!input_file.is_open()) + { + SWSS_LOG_ERROR_AND_STDERR("Failed to open the input file %s.", file_name.c_str()); + return SAI_STATUS_FAILURE; + } + + input_file.seekg(0, std::ios::end); // Move to the end of the file + uint64_t file_size = input_file.tellg(); // Get the current position + SWSS_LOG_NOTICE("Get %s's size %" PRIu64 " Bytes, limit: %" PRIu64 " MB.", file_name.c_str(), file_size, g_cmdOptions.rdbJSonSizeLimit / 1024 / 1024); + + if (file_size >= g_cmdOptions.rdbJSonSizeLimit) + { + SWSS_LOG_ERROR_AND_STDERR("Get %s's size failure or its size %" PRIu64 " >= %" PRIu64 " MB.", file_name.c_str(), file_size, g_cmdOptions.rdbJSonSizeLimit / 1024 / 1024); + return SAI_STATUS_FAILURE; + } + + input_file.seekg(0); // Move to the begin of the file + + // Read the content of the input file into a string + std::string content((std::istreambuf_iterator(input_file)), + std::istreambuf_iterator()); + + content = regex_replace(content, std::regex("\\},\\{\\r"), ","); + + std::ofstream outputFile(file_name); + + if (!outputFile.is_open()) + { + SWSS_LOG_ERROR_AND_STDERR("Failed to open the output file %s.", file_name.c_str()); + return SAI_STATUS_FAILURE; + } + + //Remove the 1st and last char to make sure its format is same as previous output + if (content.size() >= 2 && content[0] == '[' && content[content.length()-1] == ']') + { + outputFile << content.substr(1, content.size()-2); + } + else + { + outputFile << content; + } + + return SAI_STATUS_SUCCESS; +} + +static sai_status_t dumpFromRedisRdbJson(const std::string file_name) +{ + SWSS_LOG_ENTER(); + + std::ifstream input_file(file_name); + + if (!input_file.is_open()) + { + SWSS_LOG_ERROR_AND_STDERR("The file %s does not exist for dumping from Redis RDB JSON file.", file_name.c_str()); + return SAI_STATUS_FAILURE; + } + + try + { + // Parse the JSON data from the file (validation) + nlohmann::json jsonData; + input_file >> jsonData; + + SWSS_LOG_DEBUG("JSON file is valid."); + + for (json::iterator it = jsonData.begin(); it != jsonData.end(); ++it) + { + json jj_key = it.key(); + + std::string keystr = jj_key; + std::string item_name = keystr; + size_t pos = keystr.find_first_of(":"); + + if (pos != std::string::npos) + { + if(ASIC_STATE_TABLE != keystr.substr(0, pos)) // filter out non ASIC_STATE + { + continue; + } + + item_name = keystr.substr(pos + 1); + + if (item_name.find(":") != std::string::npos) + { + item_name.replace(item_name.find_first_of(":"), 1, " "); + } + } + else + { + continue; + } + + std::cout << item_name << " " << std::endl; + + json jj = it.value(); + + if (!it->is_object()) + { + continue; + } + + TableMap map; + + for (json::iterator itt = jj.begin(); itt != jj.end(); ++itt) + { + if (itt.key() != "NULL") + { + map[itt.key()] = itt.value(); + } + } + + constexpr size_t LINE_IDENT = 4; + size_t max_len = get_max_attr_len(map); + std::string str_indent = pad_string("", LINE_IDENT); + + for (const auto&field: map) + { + std::cout << str_indent << pad_string(field.first, max_len) << " : "; + std::cout << field.second << std::endl; + } + + std::cout << std::endl; + } + + return SAI_STATUS_SUCCESS; + } + catch (std::exception &ex) + { + SWSS_LOG_ERROR_AND_STDERR("JSON file %s is invalid.", file_name.c_str()); + SWSS_LOG_ERROR_AND_STDERR("JSON parsing error: %s.", ex.what()); + } + + return SAI_STATUS_FAILURE; +} + +int main(int argc, char **argv) { swss::Logger::getInstance().setMinPrio(swss::Logger::SWSS_DEBUG); @@ -411,6 +604,17 @@ int main(int argc, char ** argv) g_cmdOptions = handleCmdLine(argc, argv); + + if (g_cmdOptions.rdbJsonFile.size() > 0) + { + if (SAI_STATUS_FAILURE == preProcessFile(g_cmdOptions.rdbJsonFile)) + { + return EXIT_FAILURE; + } + + return dumpFromRedisRdbJson(g_cmdOptions.rdbJsonFile); + } + swss::DBConnector db("ASIC_DB", 0); std::string table = ASIC_STATE_TABLE; From dbb9532dc6f3fcbaafd83dc17de266baf4c1e782 Mon Sep 17 00:00:00 2001 From: jumao Date: Wed, 3 Jan 2024 16:33:45 -0500 Subject: [PATCH 2/5] Fix the CodeQL stage error of https://github.com/sonic-net/sonic-sairedis/pull/1335 --- .github/workflows/codeql-analysis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index f7c9db7fe..9521892a7 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -69,7 +69,8 @@ jobs: autoconf-archive \ uuid-dev \ libjansson-dev \ - python + python \ + nlohmann-json3-dev - if: matrix.language == 'cpp' name: build-swss-common From 5ba869cdb628be670843be4c4c8acb80ea227100 Mon Sep 17 00:00:00 2001 From: jumao Date: Thu, 1 Feb 2024 16:19:09 -0500 Subject: [PATCH 3/5] Add unittests codes for saidump --- .github/workflows/codeql-analysis.yml | 4 +- configure.ac | 1 + saidump/Makefile.am | 4 ++ saidump/saidump.cpp | 24 +++------ saidump/saidump.h | 19 +++++++ unittest/Makefile.am | 2 +- unittest/saidump/Makefile.am | 13 +++++ unittest/saidump/dump.json | 73 +++++++++++++++++++++++++++ unittest/saidump/main.cpp | 57 +++++++++++++++++++++ 9 files changed, 176 insertions(+), 21 deletions(-) create mode 100755 saidump/saidump.h create mode 100755 unittest/saidump/Makefile.am create mode 100755 unittest/saidump/dump.json create mode 100755 unittest/saidump/main.cpp diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 9521892a7..e1413cfa5 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -69,8 +69,8 @@ jobs: autoconf-archive \ uuid-dev \ libjansson-dev \ - python \ - nlohmann-json3-dev + nlohmann-json3-dev \ + python - if: matrix.language == 'cpp' name: build-swss-common diff --git a/configure.ac b/configure.ac index b95367ef5..0d25c024b 100644 --- a/configure.ac +++ b/configure.ac @@ -249,6 +249,7 @@ AC_OUTPUT(Makefile unittest/lib/Makefile unittest/vslib/Makefile unittest/syncd/Makefile + unittest/saidump/Makefile pyext/Makefile pyext/py2/Makefile pyext/py3/Makefile) diff --git a/saidump/Makefile.am b/saidump/Makefile.am index 46c51d0fc..104c175d9 100644 --- a/saidump/Makefile.am +++ b/saidump/Makefile.am @@ -7,3 +7,7 @@ saidump_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS) saidump_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS) saidump_LDADD = -lhiredis -lswsscommon -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta \ -L$(top_srcdir)/lib/.libs -lsairedis -lzmq $(CODE_COVERAGE_LIBS) + +noinst_LIBRARIES = libsaidump.a +libsaidump_a_SOURCES = saidump.cpp +AM_CPPFLAGS = -D_UNITTEST_ \ No newline at end of file diff --git a/saidump/saidump.cpp b/saidump/saidump.cpp index 522f5bb40..094de48b1 100644 --- a/saidump/saidump.cpp +++ b/saidump/saidump.cpp @@ -15,28 +15,14 @@ extern "C" { #include "meta/sai_serialize.h" #include "sairediscommon.h" #include "swss/json.hpp" - +#include "saidump.h" #include // TODO split to multiple cpp using namespace swss; using json = nlohmann::json; - -// Default value: 100 MB -constexpr int64_t RDB_JSON_MAX_SIZE = 1024 * 1024 * 100; - -struct CmdOptions -{ - bool skipAttributes; - bool dumpTempView; - bool dumpGraph; - std::string rdbJsonFile; - uint64_t rdbJSonSizeLimit; -}; - - -static CmdOptions g_cmdOptions; +CmdOptions g_cmdOptions; static std::map g_oid_map; void printUsage() @@ -451,7 +437,7 @@ void dumpGraph(const TableDump& td) /** * @brief Process the input JSON file to make sure it's a valid JSON file for the JSON library. */ -static sai_status_t preProcessFile(const std::string file_name) +sai_status_t preProcessFile(const std::string file_name) { SWSS_LOG_ENTER(); @@ -502,7 +488,7 @@ static sai_status_t preProcessFile(const std::string file_name) return SAI_STATUS_SUCCESS; } -static sai_status_t dumpFromRedisRdbJson(const std::string file_name) +sai_status_t dumpFromRedisRdbJson(const std::string file_name) { SWSS_LOG_ENTER(); @@ -592,6 +578,7 @@ static sai_status_t dumpFromRedisRdbJson(const std::string file_name) return SAI_STATUS_FAILURE; } +#ifndef _UNITTEST_ int main(int argc, char **argv) { swss::Logger::getInstance().setMinPrio(swss::Logger::SWSS_DEBUG); @@ -674,3 +661,4 @@ int main(int argc, char **argv) return EXIT_SUCCESS; } +#endif \ No newline at end of file diff --git a/saidump/saidump.h b/saidump/saidump.h new file mode 100755 index 000000000..33cf10956 --- /dev/null +++ b/saidump/saidump.h @@ -0,0 +1,19 @@ +#pragma once +#include + +// Default value: 100MB +constexpr int64_t RDB_JSON_MAX_SIZE = 1024 * 1024 * 100; + +struct CmdOptions +{ + bool skipAttributes; + bool dumpTempView; + bool dumpGraph; + std::string rdbJsonFile; + uint64_t rdbJSonSizeLimit; +}; + +void printUsage(); +CmdOptions handleCmdLine(int argc, char **argv); +sai_status_t dumpFromRedisRdbJson(const std::string file_name); +sai_status_t preProcessFile(const std::string file_name); diff --git a/unittest/Makefile.am b/unittest/Makefile.am index 9be94ee0a..175555bed 100644 --- a/unittest/Makefile.am +++ b/unittest/Makefile.am @@ -1 +1 @@ -SUBDIRS = meta lib vslib syncd +SUBDIRS = meta lib vslib syncd saidump diff --git a/unittest/saidump/Makefile.am b/unittest/saidump/Makefile.am new file mode 100755 index 000000000..0519d4ca6 --- /dev/null +++ b/unittest/saidump/Makefile.am @@ -0,0 +1,13 @@ +AM_CXXFLAGS = $(SAIINC) -I$(top_srcdir)/saidump -I$(top_srcdir)/lib -I$(top_srcdir)/vslib -I$(top_srcdir)/meta + +bin_PROGRAMS = tests + +LDADD_GTEST = -L/usr/src/gtest -lgtest -lgtest_main + +tests_SOURCES = main.cpp + +tests_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) +tests_LDFLAGS = -D_UNITTEST_ +tests_LDADD = $(LDADD_GTEST) $(top_srcdir)/saidump/libsaidump.a -lhiredis -lswsscommon -lnl-genl-3 -lnl-nf-3 -lnl-route-3 -lnl-3 -lpthread -L$(top_srcdir)/lib/.libs -lsairedis -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) + +TESTS = tests \ No newline at end of file diff --git a/unittest/saidump/dump.json b/unittest/saidump/dump.json new file mode 100755 index 000000000..6ab042953 --- /dev/null +++ b/unittest/saidump/dump.json @@ -0,0 +1,73 @@ +[{ +"ROUTE_TABLE:10.1.0.2":{"nexthop":"3.3.3.18,3.3.3.20","ifname":"Ethernet-IB0,Ethernet-IB0","weight":"1,1"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic0:Ethernet136:5-6":{"profile":"egress_lossy_profile"}, +"SYSTEM_PORT_TABLE:ixre-egl-board41|asic0|Ethernet112":{"core_index":"0","core_port_index":"15","num_voq":"8","speed":"400000","switch_id":"18","system_port_id":"57"}, +"SYSTEM_PORT_TABLE:ixre-egl-board40|asic1|Ethernet280":{"core_index":"0","core_port_index":"18","num_voq":"8","speed":"400000","switch_id":"2","system_port_id":"39"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic1:Ethernet176:3-4":{"profile":"egress_lossless_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic0:Ethernet64:5-6":{"profile":"egress_lossy_profile"}, +"SYSTEM_PORT_TABLE:ixre-egl-board40|asic0|Ethernet-IB0":{"core_index":"0","core_port_index":"19","num_voq":"8","speed":"10000","switch_id":"0","system_port_id":"19"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board40:asic1:Ethernet176:3-4":{"profile":"egress_lossless_profile"}, +"SYSTEM_PORT_TABLE:ixre-egl-board40|asic1|Ethernet208":{"core_index":"1","core_port_index":"9","num_voq":"8","speed":"400000","switch_id":"2","system_port_id":"30"}, +"INTF_TABLE:Ethernet136:10.0.0.4/31":{"scope":"global","family":"IPv4"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board40:asic1:Ethernet224:3-4":{"profile":"egress_lossless_profile"}, +"BUFFER_PROFILE_TABLE:egress_lossy_profile":{"dynamic_th":"-1","pool":"ingress_lossless_pool","size":"0"}, +"ROUTE_TABLE:10.0.0.10/31":{"nexthop":"3.3.3.2","ifname":"Ethernet-IB0"}, +"SYSTEM_PORT_TABLE:ixre-egl-board41|asic0|Ethernet-IB0":{"core_index":"0","core_port_index":"19","num_voq":"8","speed":"10000","switch_id":"18","system_port_id":"61"}, +"SYSTEM_PORT_TABLE:ixre-egl-board40|asic0|Ethernet64":{"core_index":"1","core_port_index":"9","num_voq":"8","speed":"400000","switch_id":"0","system_port_id":"9"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic0:Ethernet0:5-6":{"profile":"egress_lossy_profile"}, +"BUFFER_PG_TABLE:Ethernet80:0":{"profile":"ingress_lossy_profile"}, +"SYSTEM_PORT_TABLE:ixre-egl-board41|asic1|Ethernet-Rec1":{"core_index":"1","core_port_index":"20","num_voq":"8","speed":"10000","switch_id":"20","system_port_id":"83"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic1:Ethernet224:0-2":{"profile":"egress_lossy_profile"}, +"ROUTE_TABLE:10.0.0.4/31":{"nexthop":"0.0.0.0","ifname":"Ethernet136"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic0:Ethernet120:3-4":{"profile":"egress_lossless_profile"}, +"PORT_TABLE:Ethernet104":{"alias":"Ethernet14/1","asic_port_name":"Eth104","coreid":"0","coreportid":"14","description":"Ethernet14/1","index":"14","lanes":"32,33,34,35,36,37,38,39","mtu":"9100","numvoq":"8","pfc_asym":"off","role":"Ext","speed":"400000","tpid":"0x8100","admin_status":"down","oper_status":"down"}, +"ROUTE_TABLE:3333::3:1":{"nexthop":"::","ifname":"Ethernet-IB0"}, +"INTF_TABLE:Ethernet-IB0:3.3.3.1/32":{"scope":"global","family":"IPv4"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic1:Ethernet272:0-2":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic0:Ethernet8:5-6":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board40:asic0:Ethernet104:0-2":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic0:Ethernet96:0-2":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic0:Ethernet8:3-4":{"profile":"egress_lossless_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic0:Ethernet72:0-2":{"profile":"egress_lossy_profile"}, +"LAG_MEMBER_TABLE:PortChannel102:Ethernet80":{"status":"disabled"}, +"SYSTEM_PORT_TABLE:ixre-egl-board41|asic1|Ethernet192":{"core_index":"1","core_port_index":"7","num_voq":"8","speed":"400000","switch_id":"20","system_port_id":"70"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board40:asic1:Ethernet160:3-4":{"profile":"egress_lossless_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board40:asic0:Ethernet96:5-6":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board40:asic1:Ethernet264:3-4":{"profile":"egress_lossless_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board40:asic1:Ethernet272:5-6":{"profile":"egress_lossy_profile"}, +"BUFFER_POOL_TABLE:ingress_lossless_pool":{"mode":"dynamic","size":"6441610000","type":"both","xoff":"11354112"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic1:Ethernet192:5-6":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board40:asic1:Ethernet272:3-4":{"profile":"egress_lossless_profile"}, +"LAG_MEMBER_TABLE:PortChannel102:Ethernet32":{"status":"disabled"}, +"SYSTEM_PORT_TABLE:ixre-egl-board41|asic1|Ethernet184":{"core_index":"1","core_port_index":"6","num_voq":"8","speed":"400000","switch_id":"20","system_port_id":"69"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic1:Ethernet208:0-2":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board40:asic1:Ethernet248:0-2":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board40:asic0:Ethernet72:0-2":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board40:asic0:Ethernet32:3-4":{"profile":"egress_lossless_profile"}, +"INTF_TABLE:PortChannel102:10.0.0.0/31":{"scope":"global","family":"IPv4"}, +"PORT_TABLE:Ethernet32":{"mtu":"9100","admin_status":"up","alias":"Ethernet5/1","asic_port_name":"Eth32","coreid":"1","coreportid":"5","description":"ARISTA01T3:Ethernet1","index":"5","lanes":"104,105,106,107,108,109,110,111","numvoq":"8","pfc_asym":"off","role":"Ext","speed":"400000","tpid":"0x8100","oper_status":"up"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board40:asic1:Ethernet168:5-6":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic1:Ethernet176:0-2":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic0:Ethernet56:5-6":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic0:Ethernet96:3-4":{"profile":"egress_lossless_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board40:asic0:Ethernet120:5-6":{"profile":"egress_lossy_profile"}, +"BUFFER_PROFILE_TABLE:ingress_lossy_profile":{"dynamic_th":"0","pool":"ingress_lossless_pool","size":"1280","xon_offset":"2560"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic0:Ethernet48:0-2":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic1:Ethernet200:0-2":{"profile":"egress_lossy_profile"}, +"COPP_TABLE:queue1_group1":{"cbs":"6000","cir":"6000","meter_type":"packets","mode":"sr_tcm","queue":"1","red_action":"drop","trap_action":"trap","trap_priority":"1","trap_ids":"ip2me"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board40:asic1:Ethernet184:3-4":{"profile":"egress_lossless_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic1:Ethernet248:5-6":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic1:Ethernet256:3-4":{"profile":"egress_lossless_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board40:asic0:Ethernet88:5-6":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board40:asic0:Ethernet48:3-4":{"profile":"egress_lossless_profile"}, +"SYSTEM_PORT_TABLE:ixre-egl-board40|asic1|Ethernet224":{"core_index":"0","core_port_index":"11","num_voq":"8","speed":"400000","switch_id":"2","system_port_id":"32"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic0:Ethernet24:0-2":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board40:asic1:Ethernet168:0-2":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic0:Ethernet56:3-4":{"profile":"egress_lossless_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic1:Ethernet272:5-6":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board40:asic1:Ethernet208:5-6":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic0:Ethernet96:5-6":{"profile":"egress_lossy_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic1:Ethernet152:3-4":{"profile":"egress_lossless_profile"}, +"BUFFER_QUEUE_TABLE:ixre-egl-board41:asic0:Ethernet40:5-6":{"profile":"egress_lossy_profile"}, +"INTF_TABLE:Loopback0":{"NULL":"NULL","mac_addr":"00:00:00:00:00:00"} +}] \ No newline at end of file diff --git a/unittest/saidump/main.cpp b/unittest/saidump/main.cpp new file mode 100755 index 000000000..06a77b5d9 --- /dev/null +++ b/unittest/saidump/main.cpp @@ -0,0 +1,57 @@ +#include +#include "meta/sai_serialize.h" +#include "saidump.h" +#define ARGVN 5 + +extern CmdOptions g_cmdOptions; + +TEST(SaiDump, printUsage) +{ + SWSS_LOG_ENTER(); + testing::internal::CaptureStdout(); + printUsage(); + std::string output = testing::internal::GetCapturedStdout(); + EXPECT_EQ(true, output.find("Usage: saidump [-t] [-g] [-r] [-m] [-h]") != std::string::npos); +} + +TEST(SaiDump, handleCmdLine) +{ + SWSS_LOG_ENTER(); + const char *arr[] = {"saidump", "-r", "./dump.json", "-m", "100"}; + char **argv = new char *[ARGVN]; + + for (int i = 0; i < ARGVN; ++i) + { + argv[i] = const_cast(arr[i]); + } + + g_cmdOptions = handleCmdLine(ARGVN, argv); + delete[] argv; + EXPECT_EQ(g_cmdOptions.rdbJsonFile, "./dump.json"); + EXPECT_EQ(g_cmdOptions.rdbJSonSizeLimit, RDB_JSON_MAX_SIZE); +} + +TEST(SaiDump, dumpFromRedisRdbJson) +{ + SWSS_LOG_ENTER(); + EXPECT_EQ(SAI_STATUS_FAILURE, dumpFromRedisRdbJson("")); + EXPECT_EQ(SAI_STATUS_FAILURE, dumpFromRedisRdbJson("./dump.json")); +} + +TEST(SaiDump, preProcessFile) +{ + SWSS_LOG_ENTER(); + EXPECT_EQ(SAI_STATUS_FAILURE, preProcessFile("")); + g_cmdOptions.rdbJSonSizeLimit = 0; + EXPECT_EQ(SAI_STATUS_FAILURE, preProcessFile("./dump.json")); + g_cmdOptions.rdbJSonSizeLimit = RDB_JSON_MAX_SIZE; + EXPECT_EQ(SAI_STATUS_SUCCESS, preProcessFile("./dump.json")); + EXPECT_EQ(SAI_STATUS_SUCCESS, dumpFromRedisRdbJson("./dump.json")); +} + +int main(int argc, char *argv[]) +{ + SWSS_LOG_ENTER(); + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} \ No newline at end of file From 5cf3960e92bbdc160f7f0fc3e80d1ad14456edc1 Mon Sep 17 00:00:00 2001 From: jumao Date: Mon, 15 Apr 2024 20:37:16 -0400 Subject: [PATCH 4/5] Wrap saidump's functions into a class and update the unittest codes. --- saidump/Makefile.am | 3 +- saidump/main.cpp | 21 +++++++ saidump/saidump.cpp | 127 +++++++++++++------------------------- saidump/saidump.h | 57 +++++++++++++---- unittest/saidump/main.cpp | 34 +++++----- 5 files changed, 130 insertions(+), 112 deletions(-) mode change 100644 => 100755 saidump/Makefile.am create mode 100755 saidump/main.cpp mode change 100644 => 100755 saidump/saidump.cpp diff --git a/saidump/Makefile.am b/saidump/Makefile.am old mode 100644 new mode 100755 index 104c175d9..c4515cc99 --- a/saidump/Makefile.am +++ b/saidump/Makefile.am @@ -2,7 +2,7 @@ AM_CXXFLAGS = $(SAIINC) -I$(top_srcdir)/lib bin_PROGRAMS = saidump -saidump_SOURCES = saidump.cpp +saidump_SOURCES = main.cpp saidump.cpp saidump_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS) saidump_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS) saidump_LDADD = -lhiredis -lswsscommon -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta \ @@ -10,4 +10,3 @@ saidump_LDADD = -lhiredis -lswsscommon -lpthread -L$(top_srcdir)/meta/.libs -lsa noinst_LIBRARIES = libsaidump.a libsaidump_a_SOURCES = saidump.cpp -AM_CPPFLAGS = -D_UNITTEST_ \ No newline at end of file diff --git a/saidump/main.cpp b/saidump/main.cpp new file mode 100755 index 000000000..433d73924 --- /dev/null +++ b/saidump/main.cpp @@ -0,0 +1,21 @@ +#include "saidump.h" + +using namespace syncd; + +int main(int argc, char **argv) +{ + SWSS_LOG_ENTER(); + swss::Logger::getInstance().setMinPrio(swss::Logger::SWSS_DEBUG); + swss::Logger::getInstance().setMinPrio(swss::Logger::SWSS_NOTICE); + swss::Logger::getInstance().setMinPrio(swss::Logger::SWSS_INFO); + + SaiDump m_saiDump; + + if(SAI_STATUS_SUCCESS != m_saiDump.handleCmdLine(argc, argv)) + { + return EXIT_FAILURE; + } + + m_saiDump.dumpFromRedisDb(); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/saidump/saidump.cpp b/saidump/saidump.cpp old mode 100644 new mode 100755 index 094de48b1..2f5f63e1b --- a/saidump/saidump.cpp +++ b/saidump/saidump.cpp @@ -1,31 +1,8 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -extern "C" { -#include -} - -#include "swss/table.h" -#include "meta/sai_serialize.h" -#include "sairediscommon.h" -#include "swss/json.hpp" #include "saidump.h" -#include +using namespace syncd; -// TODO split to multiple cpp -using namespace swss; -using json = nlohmann::json; -CmdOptions g_cmdOptions; -static std::map g_oid_map; - -void printUsage() +void SaiDump::printUsage() { SWSS_LOG_ENTER(); @@ -42,15 +19,14 @@ void printUsage() std::cout << " Print out this message" << std::endl; } -CmdOptions handleCmdLine(int argc, char **argv) +sai_status_t SaiDump::handleCmdLine(int argc, char **argv) { SWSS_LOG_ENTER(); - CmdOptions options; - - options.dumpTempView = false; - options.dumpGraph = false; - options.rdbJSonSizeLimit = RDB_JSON_MAX_SIZE; + sai_status_t status = SAI_STATUS_SUCCESS; + dumpTempView = false; + dumpGraph = false; + rdbJSonSizeLimit = RDB_JSON_MAX_SIZE; const char* const optstring = "gtr:m:h"; uint64_t result = 0; @@ -80,17 +56,20 @@ CmdOptions handleCmdLine(int argc, char **argv) { case 'g': SWSS_LOG_NOTICE("Dumping graph"); - options.dumpGraph = true; + dumpGraph = true; + status = SAI_STATUS_SUCCESS; break; case 't': SWSS_LOG_NOTICE("Dumping temp view"); - options.dumpTempView = true; + dumpTempView = true; + status = SAI_STATUS_SUCCESS; break; case 'r': SWSS_LOG_NOTICE("Dumping from %s", optarg); - options.rdbJsonFile = std::string(optarg); + rdbJsonFile = std::string(optarg); + status = SAI_STATUS_SUCCESS; break; case 'm': @@ -110,9 +89,9 @@ CmdOptions handleCmdLine(int argc, char **argv) exit(EXIT_SUCCESS); } - options.rdbJSonSizeLimit = result * 1024 * 1024; - SWSS_LOG_NOTICE("Configure the RDB JSON MAX size to %llu MB", options.rdbJSonSizeLimit / 1024 / 1024); - + rdbJSonSizeLimit = result * 1024 * 1024; + SWSS_LOG_NOTICE("Configure the RDB JSON MAX size to %llu MB", rdbJSonSizeLimit / 1024 / 1024); + status = SAI_STATUS_SUCCESS; break; case 'h': @@ -129,11 +108,10 @@ CmdOptions handleCmdLine(int argc, char **argv) exit(EXIT_FAILURE); } } - - return options; + return status; } -size_t get_max_attr_len(const TableMap& map) +size_t SaiDump::get_max_attr_len(const TableMap& map) { SWSS_LOG_ENTER(); @@ -147,7 +125,7 @@ size_t get_max_attr_len(const TableMap& map) return max; } -std::string pad_string(std::string s, size_t pad) +std::string SaiDump::pad_string(std::string s, size_t pad) { SWSS_LOG_ENTER(); @@ -161,7 +139,7 @@ std::string pad_string(std::string s, size_t pad) return s; } -const TableMap* get_table_map(sai_object_id_t object_id) +const TableMap* SaiDump::get_table_map(sai_object_id_t object_id) { SWSS_LOG_ENTER(); @@ -176,7 +154,7 @@ const TableMap* get_table_map(sai_object_id_t object_id) return it->second; } -void print_attributes(size_t indent, const TableMap& map) +void SaiDump::print_attributes(size_t indent, const TableMap& map) { SWSS_LOG_ENTER(); @@ -204,7 +182,7 @@ void print_attributes(size_t indent, const TableMap& map) #define GV_ROOT_COLOR "0.650 0.200 1.000" #define GV_NODE_COLOR "0.650 0.500 1.000" -void dumpGraph(const TableDump& td) +void SaiDump::dumpGraphFun(const TableDump& td) { SWSS_LOG_ENTER(); @@ -437,7 +415,7 @@ void dumpGraph(const TableDump& td) /** * @brief Process the input JSON file to make sure it's a valid JSON file for the JSON library. */ -sai_status_t preProcessFile(const std::string file_name) +sai_status_t SaiDump::preProcessFile(const std::string file_name) { SWSS_LOG_ENTER(); @@ -451,11 +429,11 @@ sai_status_t preProcessFile(const std::string file_name) input_file.seekg(0, std::ios::end); // Move to the end of the file uint64_t file_size = input_file.tellg(); // Get the current position - SWSS_LOG_NOTICE("Get %s's size %" PRIu64 " Bytes, limit: %" PRIu64 " MB.", file_name.c_str(), file_size, g_cmdOptions.rdbJSonSizeLimit / 1024 / 1024); + SWSS_LOG_NOTICE("Get %s's size %" PRIu64 " Bytes, limit: %" PRIu64 " MB.", file_name.c_str(), file_size, rdbJSonSizeLimit / 1024 / 1024); - if (file_size >= g_cmdOptions.rdbJSonSizeLimit) + if (file_size >= rdbJSonSizeLimit) { - SWSS_LOG_ERROR_AND_STDERR("Get %s's size failure or its size %" PRIu64 " >= %" PRIu64 " MB.", file_name.c_str(), file_size, g_cmdOptions.rdbJSonSizeLimit / 1024 / 1024); + SWSS_LOG_ERROR_AND_STDERR("Get %s's size failure or its size %" PRIu64 " >= %" PRIu64 " MB.", file_name.c_str(), file_size, rdbJSonSizeLimit / 1024 / 1024); return SAI_STATUS_FAILURE; } @@ -488,15 +466,20 @@ sai_status_t preProcessFile(const std::string file_name) return SAI_STATUS_SUCCESS; } -sai_status_t dumpFromRedisRdbJson(const std::string file_name) +sai_status_t SaiDump::dumpFromRedisRdbJson() { SWSS_LOG_ENTER(); - std::ifstream input_file(file_name); + if (SAI_STATUS_FAILURE == preProcessFile(rdbJsonFile)) + { + return SAI_STATUS_FAILURE; + } + + std::ifstream input_file(rdbJsonFile); if (!input_file.is_open()) { - SWSS_LOG_ERROR_AND_STDERR("The file %s does not exist for dumping from Redis RDB JSON file.", file_name.c_str()); + SWSS_LOG_ERROR_AND_STDERR("The file %s does not exist for dumping from Redis RDB JSON file.", rdbJsonFile.c_str()); return SAI_STATUS_FAILURE; } @@ -571,42 +554,27 @@ sai_status_t dumpFromRedisRdbJson(const std::string file_name) } catch (std::exception &ex) { - SWSS_LOG_ERROR_AND_STDERR("JSON file %s is invalid.", file_name.c_str()); + SWSS_LOG_ERROR_AND_STDERR("JSON file %s is invalid.", rdbJsonFile.c_str()); SWSS_LOG_ERROR_AND_STDERR("JSON parsing error: %s.", ex.what()); } return SAI_STATUS_FAILURE; } -#ifndef _UNITTEST_ -int main(int argc, char **argv) +void SaiDump::dumpFromRedisDb() { - swss::Logger::getInstance().setMinPrio(swss::Logger::SWSS_DEBUG); - SWSS_LOG_ENTER(); - - swss::Logger::getInstance().setMinPrio(swss::Logger::SWSS_NOTICE); - - swss::Logger::getInstance().setMinPrio(swss::Logger::SWSS_INFO); - - g_cmdOptions = handleCmdLine(argc, argv); - - - if (g_cmdOptions.rdbJsonFile.size() > 0) + if (rdbJsonFile.size() > 0) { - if (SAI_STATUS_FAILURE == preProcessFile(g_cmdOptions.rdbJsonFile)) - { - return EXIT_FAILURE; - } - - return dumpFromRedisRdbJson(g_cmdOptions.rdbJsonFile); + dumpFromRedisRdbJson(); + return; } swss::DBConnector db("ASIC_DB", 0); std::string table = ASIC_STATE_TABLE; - if (g_cmdOptions.dumpTempView) + if (dumpTempView) { table = TEMP_PREFIX + table; } @@ -614,7 +582,6 @@ int main(int argc, char **argv) swss::Table t(&db, table); TableDump dump; - t.dump(dump); for (const auto&key: dump) @@ -632,16 +599,14 @@ int main(int argc, char **argv) { sai_object_id_t object_id; sai_deserialize_object_id(str_object_id, object_id); - g_oid_map[object_id] = &key.second; } } - if (g_cmdOptions.dumpGraph) + if (dumpGraph) { - dumpGraph(dump); - - return EXIT_SUCCESS; + dumpGraphFun(dump); + return; } for (const auto&key: dump) @@ -649,16 +614,10 @@ int main(int argc, char **argv) auto start = key.first.find_first_of(":"); auto str_object_type = key.first.substr(0, start); auto str_object_id = key.first.substr(start + 1); - std::cout << str_object_type << " " << str_object_id << " " << std::endl; size_t indent = 4; - print_attributes(indent, key.second); - std::cout << std::endl; } - - return EXIT_SUCCESS; } -#endif \ No newline at end of file diff --git a/saidump/saidump.h b/saidump/saidump.h index 33cf10956..5bb5f2869 100755 --- a/saidump/saidump.h +++ b/saidump/saidump.h @@ -1,19 +1,52 @@ #pragma once + +extern "C" { +#include +} #include +#include +#include +#include +#include +#include "swss/table.h" +#include "meta/sai_serialize.h" +#include "sairediscommon.h" +#include "swss/json.hpp" + +using namespace swss; +using json = nlohmann::json; // Default value: 100MB -constexpr int64_t RDB_JSON_MAX_SIZE = 1024 * 1024 * 100; +static constexpr int64_t RDB_JSON_MAX_SIZE = 1024 * 1024 * 100; -struct CmdOptions +namespace syncd { - bool skipAttributes; - bool dumpTempView; - bool dumpGraph; - std::string rdbJsonFile; - uint64_t rdbJSonSizeLimit; -}; + class SaiDump + { + public: + SaiDump() = default; + ~SaiDump() = default; + sai_status_t handleCmdLine(int argc, char **argv); + void dumpFromRedisDb(); + void printUsage(); + sai_status_t dumpFromRedisRdbJson(); + sai_status_t preProcessFile(const std::string file_name); + + public: + std::string rdbJsonFile; + uint64_t rdbJSonSizeLimit; + + private: + bool skipAttributes; + bool dumpTempView; + bool dumpGraph; + std::map g_oid_map; -void printUsage(); -CmdOptions handleCmdLine(int argc, char **argv); -sai_status_t dumpFromRedisRdbJson(const std::string file_name); -sai_status_t preProcessFile(const std::string file_name); + private: + size_t get_max_attr_len(const TableMap& map); + std::string pad_string(std::string s, size_t pad); + const TableMap* get_table_map(sai_object_id_t object_id); + void dumpGraphFun(const TableDump& td); + void print_attributes(size_t indent, const TableMap& map); + }; +} diff --git a/unittest/saidump/main.cpp b/unittest/saidump/main.cpp index 06a77b5d9..72d095683 100755 --- a/unittest/saidump/main.cpp +++ b/unittest/saidump/main.cpp @@ -3,13 +3,12 @@ #include "saidump.h" #define ARGVN 5 -extern CmdOptions g_cmdOptions; - TEST(SaiDump, printUsage) { SWSS_LOG_ENTER(); testing::internal::CaptureStdout(); - printUsage(); + syncd::SaiDump m_saiDump; + m_saiDump.printUsage(); std::string output = testing::internal::GetCapturedStdout(); EXPECT_EQ(true, output.find("Usage: saidump [-t] [-g] [-r] [-m] [-h]") != std::string::npos); } @@ -25,28 +24,35 @@ TEST(SaiDump, handleCmdLine) argv[i] = const_cast(arr[i]); } - g_cmdOptions = handleCmdLine(ARGVN, argv); + syncd::SaiDump m_saiDump; + m_saiDump.handleCmdLine(ARGVN, argv); delete[] argv; - EXPECT_EQ(g_cmdOptions.rdbJsonFile, "./dump.json"); - EXPECT_EQ(g_cmdOptions.rdbJSonSizeLimit, RDB_JSON_MAX_SIZE); + EXPECT_EQ(m_saiDump.rdbJsonFile, "./dump.json"); + EXPECT_EQ(m_saiDump.rdbJSonSizeLimit, RDB_JSON_MAX_SIZE); } + TEST(SaiDump, dumpFromRedisRdbJson) { SWSS_LOG_ENTER(); - EXPECT_EQ(SAI_STATUS_FAILURE, dumpFromRedisRdbJson("")); - EXPECT_EQ(SAI_STATUS_FAILURE, dumpFromRedisRdbJson("./dump.json")); + syncd::SaiDump m_saiDump; + m_saiDump.rdbJsonFile = ""; + EXPECT_EQ(SAI_STATUS_FAILURE, m_saiDump.dumpFromRedisRdbJson()); + m_saiDump.rdbJsonFile = "./dump.json"; + EXPECT_EQ(SAI_STATUS_SUCCESS, m_saiDump.dumpFromRedisRdbJson()); } TEST(SaiDump, preProcessFile) { SWSS_LOG_ENTER(); - EXPECT_EQ(SAI_STATUS_FAILURE, preProcessFile("")); - g_cmdOptions.rdbJSonSizeLimit = 0; - EXPECT_EQ(SAI_STATUS_FAILURE, preProcessFile("./dump.json")); - g_cmdOptions.rdbJSonSizeLimit = RDB_JSON_MAX_SIZE; - EXPECT_EQ(SAI_STATUS_SUCCESS, preProcessFile("./dump.json")); - EXPECT_EQ(SAI_STATUS_SUCCESS, dumpFromRedisRdbJson("./dump.json")); + syncd::SaiDump m_saiDump; + EXPECT_EQ(SAI_STATUS_FAILURE, m_saiDump.preProcessFile("")); + m_saiDump.rdbJSonSizeLimit = 0; + EXPECT_EQ(SAI_STATUS_FAILURE, m_saiDump.preProcessFile("./dump.json")); + m_saiDump.rdbJSonSizeLimit = RDB_JSON_MAX_SIZE; + EXPECT_EQ(SAI_STATUS_SUCCESS, m_saiDump.preProcessFile("./dump.json")); + m_saiDump.rdbJsonFile = "./dump.json"; + EXPECT_EQ(SAI_STATUS_SUCCESS, m_saiDump.dumpFromRedisRdbJson()); } int main(int argc, char *argv[]) From c02410f96f87d3f84e081770104e9055d61ffc89 Mon Sep 17 00:00:00 2001 From: jumao Date: Tue, 16 Apr 2024 08:52:19 -0400 Subject: [PATCH 5/5] Remove useless codes. --- saidump/main.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/saidump/main.cpp b/saidump/main.cpp index 433d73924..1c6c70ef9 100755 --- a/saidump/main.cpp +++ b/saidump/main.cpp @@ -5,8 +5,6 @@ using namespace syncd; int main(int argc, char **argv) { SWSS_LOG_ENTER(); - swss::Logger::getInstance().setMinPrio(swss::Logger::SWSS_DEBUG); - swss::Logger::getInstance().setMinPrio(swss::Logger::SWSS_NOTICE); swss::Logger::getInstance().setMinPrio(swss::Logger::SWSS_INFO); SaiDump m_saiDump;