Skip to content

Commit

Permalink
Provide support for VOQ switch ID via device-metadata file
Browse files Browse the repository at this point in the history
  • Loading branch information
VenkatCisco committed Oct 17, 2022
1 parent 15beee4 commit 2d30173
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions orchagent/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,28 @@ int main(int argc, char **argv)
attr.id = SAI_SWITCH_ATTR_TYPE;
attr.value.u32 = SAI_SWITCH_TYPE_FABRIC;
attrs.push_back(attr);

Table cfgDeviceMetaDataTable(&config_db, CFG_DEVICE_METADATA_TABLE_NAME);
string value;
if (!cfgDeviceMetaDataTable.hget("localhost", "switch_id", value))
{
//VOQ switch id is not configured.
SWSS_LOG_ERROR("VOQ switch id is not configured");
exit(EXIT_FAILURE);
}

if (value.size())
gVoqMySwitchId = stoi(value);

if (gVoqMySwitchId < 0)
{
SWSS_LOG_ERROR("Invalid VOQ switch id %d configured", gVoqMySwitchId);
exit(EXIT_FAILURE);
}

attr.id = SAI_SWITCH_ATTR_SWITCH_ID;
attr.value.u32 = gVoqMySwitchId;
attrs.push_back(attr);
}

/* Must be last Attribute */
Expand Down

0 comments on commit 2d30173

Please sign in to comment.