Skip to content

Commit

Permalink
Reduce log verbosity when the capability is not implemented (sonic-ne…
Browse files Browse the repository at this point in the history
…t#3240)

Co-authored-by: Sudharsan Dhamal Gopalarathnam <sudharsand@nvidia.com>
  • Loading branch information
vivekrnv and dgsudharsan authored Aug 5, 2024
1 parent 3c9d6b3 commit 465391d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
7 changes: 6 additions & 1 deletion orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,12 @@ static bool isPathTracingSupported()
}
}
}
else
else if (status == SAI_STATUS_ATTR_NOT_IMPLEMENTED_0)
{
SWSS_LOG_INFO("Querying OBJECT_TYPE_LIST is not supported on this platform");
return false;
}
else
{
SWSS_LOG_ERROR(
"Failed to get a list of supported switch capabilities. Error=%d", status
Expand Down
11 changes: 11 additions & 0 deletions tests/mock_tests/portsorch_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ namespace portsorch_test
{
using namespace std;

bool support_object_type_list = true;

// SAI default ports
std::map<std::string, std::vector<swss::FieldValueTuple>> defaultPortList;

Expand Down Expand Up @@ -197,6 +199,10 @@ namespace portsorch_test
sai_status_t status;
if (attr_count == 1 && attr_list[0].id == SAI_SWITCH_ATTR_SUPPORTED_OBJECT_TYPE_LIST)
{
if (!support_object_type_list)
{
return SAI_STATUS_ATTR_NOT_IMPLEMENTED_0;
}
uint32_t i;
for (i = 0; i < attr_list[0].value.s32list.count && i < supported_sai_objects.size(); i++)
{
Expand Down Expand Up @@ -1626,6 +1632,11 @@ namespace portsorch_test
// Port count: 32 Data + 1 CPU
ASSERT_EQ(gPortsOrch->getAllPorts().size(), ports.size() + 1);

// Scenario 0: Query to fetch OBJECT_TYPE_LIST is not Implemented by the vendor
support_object_type_list = false;
ASSERT_FALSE(gPortsOrch->checkPathTracingCapability());
support_object_type_list = true;

// Scenario 1: Path Tracing supported
ASSERT_TRUE(gPortsOrch->checkPathTracingCapability());

Expand Down

0 comments on commit 465391d

Please sign in to comment.