Skip to content

Commit

Permalink
Use config instead of switch state for dsfNodes
Browse files Browse the repository at this point in the history
Summary: As titled. Avoid creating dependency on dsfNodes being updated in switch state.

Reviewed By: jasmeetbagga

Differential Revision:
D65898718

Privacy Context Container: L1125642

fbshipit-source-id: c005b22f5c6aed9325db1c94772e26984a1ab9f5
  • Loading branch information
Ron He authored and facebook-github-bot committed Nov 22, 2024
1 parent 808901a commit a517286
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions fboss/agent/ApplyThriftConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1227,18 +1227,17 @@ void ThriftConfigApplier::processReachabilityGroup(
std::unordered_map<std::string, std::vector<uint32_t>> switchNameToSwitchIds;

bool isSingleStageCluster = true;
for (const auto& [_, dsfNodeMap] : std::as_const(*new_->getDsfNodes())) {
for (const auto& [_, dsfNode] : std::as_const(*dsfNodeMap)) {
std::string nodeName = dsfNode->getName();
auto iter = switchNameToSwitchIds.find(nodeName);
if (iter != switchNameToSwitchIds.end()) {
iter->second.push_back(dsfNode->getID());
} else {
switchNameToSwitchIds[nodeName] = {dsfNode->getID()};
}
if (auto fabricLevel = dsfNode->getFabricLevel()) {
isSingleStageCluster &= (fabricLevel.value() < 2);
}
for (const auto& [_, dsfNode] : *cfg_->dsfNodes()) {
std::string nodeName = *dsfNode.name();
auto iter = switchNameToSwitchIds.find(nodeName);
if (iter != switchNameToSwitchIds.end()) {
iter->second.push_back(*dsfNode.switchId());
} else {
switchNameToSwitchIds[nodeName] = {
static_cast<uint32_t>(*dsfNode.switchId())};
}
if (auto fabricLevel = dsfNode.fabricLevel()) {
isSingleStageCluster &= (fabricLevel.value() < 2);
}
}

Expand Down

0 comments on commit a517286

Please sign in to comment.