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

fix the issue where port sai oid not correct when speed change is done from 400G to 100G #1814

Merged
merged 1 commit into from
Jul 3, 2023
Merged
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
41 changes: 32 additions & 9 deletions test/saithrift/src/switch_sai_rpc_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1685,13 +1685,29 @@ class switch_sai_rpcHandler : virtual public switch_sai_rpcIf {
port_lane_list_attribute.value.u32list.count = 8;
port_api->get_port_attribute(port_list_object_attribute.value.objlist.list[i], 1, &port_lane_list_attribute);

std::set<int> port_lanes;
uint32_t laneCnt = port_lane_list_attribute.value.u32list.count;
for (int j=0 ; j<laneCnt; j++){
port_lanes.insert(port_lane_list_attribute.value.u32list.list[j]);
uint32_t laneMatchCount = 0;

for (gPortMapIt = gPortMap.begin(); gPortMapIt != gPortMap.end(); gPortMapIt++)
{
laneMatchCount = 0;
for (int j=0; j<laneCnt; j++)
{
if (gPortMapIt->first.count(port_lane_list_attribute.value.u32list.list[j]))
{
laneMatchCount++;
}
else
{
break;
}
}
if (laneMatchCount == laneCnt)
{
break;
}
}

gPortMapIt = gPortMap.find(port_lanes);
if (gPortMapIt != gPortMap.end()){
std::string front_port_alias = gPortMapIt->second.c_str();
std::string front_port_number;
Expand Down Expand Up @@ -1774,13 +1790,20 @@ class switch_sai_rpcHandler : virtual public switch_sai_rpcIf {
port_lane_list_attribute.value.u32list.count = 8;
port_api->get_port_attribute(port_list_object_attribute.value.objlist.list[i], 1, &port_lane_list_attribute);

std::set<int> port_lanes;
uint32_t laneCnt = port_lane_list_attribute.value.u32list.count;
for (int j=0 ; j<laneCnt; j++){
port_lanes.insert(port_lane_list_attribute.value.u32list.list[j]);
uint32_t laneMatchCount = 0;
for (int j=0 ; j<laneCnt; j++)
{
if (lane_set.count(port_lane_list_attribute.value.u32list.list[j]))
{
laneMatchCount++;
}
else
{
break;
}
}

if (port_lanes == lane_set){
if (laneCnt == laneMatchCount){
port_id = (sai_thrift_object_id_t) port_list_object_attribute.value.objlist.list[i];
free(port_list_object_attribute.value.objlist.list);
free(port_lane_list_attribute.value.u32list.list);
Expand Down