Skip to content

Commit

Permalink
Revert "Fix and add unitest - draft"
Browse files Browse the repository at this point in the history
This reverts commit 6b6fc3a.
  • Loading branch information
aviramd committed Nov 28, 2024
1 parent 6b6fc3a commit 932a732
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 66 deletions.
2 changes: 1 addition & 1 deletion lib/Recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ void Recorder::recordDbgGenDumpResponse(
{
SWSS_LOG_ENTER();

recordLine("G|" + sai_serialize_status(status));
recordLine("F|" + sai_serialize_status(status));
}

void Recorder::recordQueryAttributeCapability(
Expand Down
2 changes: 1 addition & 1 deletion lib/RedisRemoteSaiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1926,7 +1926,7 @@ sai_status_t RedisRemoteSaiInterface::dbgGenerateDump(

if (m_syncMode)
{
SWSS_LOG_DEBUG("wait for generate dump response");
SWSS_LOG_DEBUG("wait for generate dump response");
swss::KeyOpFieldsValuesTuple kco;
auto status = m_communicationChannel->wait(REDIS_ASIC_STATE_COMMAND_DBG_GEN_DUMPRESPONSE, kco);
m_recorder->recordDbgGenDumpResponse(status);
Expand Down
24 changes: 0 additions & 24 deletions proxylib/Proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,33 +362,9 @@ void Proxy::processSingleEvent(
if (op == "clear_stats")
return processClearStats(kco);

if (op == "dbg_gen_dump")
return processDbgGenerateDump(kco);

SWSS_LOG_THROW("event op '%s' is not implemented, FIXME", op.c_str());
}

void Proxy::processDbgGenerateDump(
_In_ const swss::KeyOpFieldsValuesTuple &kco)
{
SWSS_LOG_ENTER();

const auto& values = kfvFieldsValues(kco);
if (values.size() != 1)
{
SWSS_LOG_THROW("Invalid input: expected 1 arguments, received %zu", values.size());
}

auto& fieldValues = kfvFieldsValues(kco);

auto value = fvValue(fieldValues[0]);
const char* value_cstr = value.c_str();

sai_status_t status = m_vendorSai->dbgGenerateDump(value_cstr);

m_selectableChannel->set(sai_serialize_status(status), {} , "dbg_gen_dumpresponse");
}

void Proxy::processCreate(
_In_ const swss::KeyOpFieldsValuesTuple &kco)
{
Expand Down
3 changes: 0 additions & 3 deletions proxylib/Proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ namespace saiproxy
void processClearStats(
_In_ const swss::KeyOpFieldsValuesTuple &kco);

void processDbgGenerateDump(
_In_ const swss::KeyOpFieldsValuesTuple &kco);

private: // notifications

void onFdbEvent(
Expand Down
6 changes: 1 addition & 5 deletions proxylib/Sai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1133,11 +1133,7 @@ sai_status_t Sai::dbgGenerateDump(

m_communicationChannel->set(key, entry, "dbg_gen_dump");

swss::KeyOpFieldsValuesTuple kco;

auto status = m_communicationChannel->wait("dbg_gen_dumpresponse", kco);

return status;
return SAI_STATUS_SUCCESS;
}

void Sai::updateNotifications(
Expand Down
13 changes: 0 additions & 13 deletions unittest/lib/TestSai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,6 @@ TEST(Sai, queryApiVersion)
EXPECT_EQ(sai.queryApiVersion(&version), SAI_STATUS_SUCCESS);
}

TEST(Sai, dbgGenerateDump)
{
Sai sai;

sai.apiInitialize(0,&test_services);

const std::string filePath = "/var/log/testDump.log";

auto status = sai.dbgGenerateDump(filePath.c_str());

EXPECT_EQ(status, SAI_STATUS_SUCCESS);
}

TEST(Sai, bulkGet)
{
Sai sai;
Expand Down
11 changes: 0 additions & 11 deletions unittest/meta/TestDummySaiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@ TEST(DummySaiInterface, queryApiVersion)
EXPECT_EQ(sai.queryApiVersion(&version), SAI_STATUS_SUCCESS);
}

TEST(DummySaiInterface, dbgGenerateDump)
{
DummySaiInterface sai;

sai.apiInitialize(0,0);

const std::string filePath = "/var/log/testDump.log";

EXPECT_EQ(sai.dbgGenerateDump(filePath.c_str()), SAI_STATUS_SUCCESS);
}

TEST(DummySaiInterface, bulkGet)
{
DummySaiInterface sai;
Expand Down
7 changes: 0 additions & 7 deletions unittest/vslib/TestVirtualSwitchSaiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,6 @@ TEST_F(VirtualSwitchSaiInterfaceTest, queryApiVersion)
EXPECT_EQ(m_vssai->queryApiVersion(&version), SAI_STATUS_SUCCESS);
}

TEST_F(VirtualSwitchSaiInterfaceTest, dbgGenerateDump)
{
const std::string filePath = "/var/log/testDump.log";

EXPECT_EQ(m_vssai->dbgGenerateDump(filePath.c_str()), SAI_STATUS_SUCCESS);
}

TEST_F(VirtualSwitchSaiInterfaceTest, bulkGet)
{
sai_object_id_t oids[1] = {0};
Expand Down

0 comments on commit 932a732

Please sign in to comment.