Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[action] [PR:3240] Reduce log verbosity when the capability is not implemented (#3240) #3261

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading