-
Notifications
You must be signed in to change notification settings - Fork 518
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add orchagent for debug generate dump
This update introduces support for the sai_dbg_gen_dump API The general process is as follows: The filename is written to configDB. This action triggers the dbgGenDumpOrch to write the necessary data to ASIC DB. The syncd process reads from ASIC DB and invokes the SAI. SAI processes the request and returns a response. syncd writes the response back to redis. dbgGenDumpOrch retrieves the response and informs the caller by writing to configDB. The caller then removes the data from configDB.
- Loading branch information
Showing
6 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include "dbggendumporch.h" | ||
#include "schema.h" | ||
|
||
using namespace std; | ||
using namespace swss; | ||
|
||
DbgGenDumpOrch::DbgGenDumpOrch(TableConnector stateDbConnector): | ||
Orch(stateDbConnector.first, stateDbConnector.second), | ||
m_stateDbDumpStatsTable(stateDbConnector.first, STATE_DBG_GEN_DUMP_STATS_TABLE_NAME) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
} | ||
|
||
DbgGenDumpOrch::~DbgGenDumpOrch() | ||
{ | ||
SWSS_LOG_ENTER(); | ||
} | ||
|
||
void DbgGenDumpOrch::doTask(Consumer &consumer) | ||
{ | ||
SWSS_LOG_ENTER(); | ||
auto it = consumer.m_toSync.begin(); | ||
while (it != consumer.m_toSync.end()) | ||
{ | ||
if (consumer.getTableName() == STATE_DBG_GEN_DUMP_TABLE_NAME) | ||
{ | ||
KeyOpFieldsValuesTuple t = it->second; | ||
string op = kfvOp(t); | ||
if (op == SET_COMMAND) | ||
{ | ||
auto& fieldValues = kfvFieldsValues(t); | ||
auto value = fvValue(fieldValues[0]); | ||
const char* value_cstr = value.c_str(); | ||
SWSS_LOG_INFO("call sai_dbg_generate_dump with file %s\n", value_cstr); | ||
sai_status_t ret = sai_dbg_generate_dump(value_cstr); | ||
if (ret != SAI_STATUS_SUCCESS) | ||
{ | ||
SWSS_LOG_ERROR("Failed to generate dbg dump file %s\n", value_cstr); | ||
} | ||
else | ||
{ | ||
SWSS_LOG_DEBUG("generate dbg dump file %s successfully\n", value_cstr); | ||
} | ||
|
||
//write to state DB the return status to inform the caller | ||
string ret_str = std::to_string(ret); | ||
string key = kfvKey(t); | ||
std::vector<swss::FieldValueTuple> fvTuples; | ||
fvTuples.push_back(swss::FieldValueTuple("status", ret_str)); | ||
m_stateDbDumpStatsTable.set(key, fvTuples); | ||
} | ||
} | ||
consumer.m_toSync.erase(it++); | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef SWSS_DBG_GEN_DUMP_H | ||
#define SWSS_DBG_GEN_DUMP_H | ||
|
||
#include "orch.h" | ||
#include "dbconnector.h" | ||
#include "table.h" | ||
#include <string> | ||
|
||
using namespace std; | ||
using namespace swss; | ||
|
||
extern "C" { | ||
#include "sai.h" | ||
} | ||
|
||
class DbgGenDumpOrch : public Orch | ||
{ | ||
public: | ||
DbgGenDumpOrch(TableConnector stateDbConnector); | ||
|
||
~DbgGenDumpOrch(); | ||
|
||
void doTask(Consumer& consumer); | ||
|
||
private: | ||
Table m_stateDbDumpStatsTable; | ||
|
||
}; | ||
|
||
#endif /* SWSS_DBG_GEN_DUMP_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters