From 932a732064577ed9e9b8eb1ead7e97be3d2e8d69 Mon Sep 17 00:00:00 2001 From: aviramd Date: Thu, 28 Nov 2024 14:42:48 +0000 Subject: [PATCH] Revert "Fix and add unitest - draft" This reverts commit 6b6fc3ae58c76166e53eef4ade1dc2ef5b6ad43c. --- SAI | 2 +- lib/Recorder.cpp | 2 +- lib/RedisRemoteSaiInterface.cpp | 2 +- proxylib/Proxy.cpp | 24 ------------------- proxylib/Proxy.h | 3 --- proxylib/Sai.cpp | 6 +---- unittest/lib/TestSai.cpp | 13 ---------- unittest/meta/TestDummySaiInterface.cpp | 11 --------- .../vslib/TestVirtualSwitchSaiInterface.cpp | 7 ------ 9 files changed, 4 insertions(+), 66 deletions(-) diff --git a/SAI b/SAI index 9fee2f610..054085547 160000 --- a/SAI +++ b/SAI @@ -1 +1 @@ -Subproject commit 9fee2f610cf63e0bf8c880108add94f8fbca6a4e +Subproject commit 054085547c2042b95ab0fa1a75a44da3288b26bf diff --git a/lib/Recorder.cpp b/lib/Recorder.cpp index 643553a32..3faf3af94 100644 --- a/lib/Recorder.cpp +++ b/lib/Recorder.cpp @@ -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( diff --git a/lib/RedisRemoteSaiInterface.cpp b/lib/RedisRemoteSaiInterface.cpp index 91d847441..2af0b723c 100644 --- a/lib/RedisRemoteSaiInterface.cpp +++ b/lib/RedisRemoteSaiInterface.cpp @@ -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); diff --git a/proxylib/Proxy.cpp b/proxylib/Proxy.cpp index 6b6d741b3..ab3a280e0 100644 --- a/proxylib/Proxy.cpp +++ b/proxylib/Proxy.cpp @@ -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) { diff --git a/proxylib/Proxy.h b/proxylib/Proxy.h index e97b15b53..029772634 100644 --- a/proxylib/Proxy.h +++ b/proxylib/Proxy.h @@ -106,9 +106,6 @@ namespace saiproxy void processClearStats( _In_ const swss::KeyOpFieldsValuesTuple &kco); - void processDbgGenerateDump( - _In_ const swss::KeyOpFieldsValuesTuple &kco); - private: // notifications void onFdbEvent( diff --git a/proxylib/Sai.cpp b/proxylib/Sai.cpp index 56009bc91..826fcf8f1 100644 --- a/proxylib/Sai.cpp +++ b/proxylib/Sai.cpp @@ -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( diff --git a/unittest/lib/TestSai.cpp b/unittest/lib/TestSai.cpp index 73766bd10..9d3e11790 100644 --- a/unittest/lib/TestSai.cpp +++ b/unittest/lib/TestSai.cpp @@ -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; diff --git a/unittest/meta/TestDummySaiInterface.cpp b/unittest/meta/TestDummySaiInterface.cpp index 15436dd30..4c8ca1ca5 100644 --- a/unittest/meta/TestDummySaiInterface.cpp +++ b/unittest/meta/TestDummySaiInterface.cpp @@ -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; diff --git a/unittest/vslib/TestVirtualSwitchSaiInterface.cpp b/unittest/vslib/TestVirtualSwitchSaiInterface.cpp index c07ecd16c..445bc56b6 100644 --- a/unittest/vslib/TestVirtualSwitchSaiInterface.cpp +++ b/unittest/vslib/TestVirtualSwitchSaiInterface.cpp @@ -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};