Skip to content

Commit

Permalink
Add test for switch reachability notif on fabric devices
Browse files Browse the repository at this point in the history
Summary:
Add a test that will ensure that fabric switches are getting notified of
the switch reachability information.

Reviewed By: jasmeetbagga

Differential Revision: D61036834

fbshipit-source-id: 003375b048aac0b2897b66f9d7c39eb1a188b0ba
  • Loading branch information
Nivin Lawrence authored and facebook-github-bot committed Aug 14, 2024
1 parent d9761eb commit 202ef16
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions fboss/agent/test/agent_hw_tests/AgentFabricSwitchTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,4 +402,40 @@ TEST_F(AgentFabricSwitchTest, dtlQueueWatermarks) {

verifyAcrossWarmBoots([]() {}, verify);
}

TEST_F(AgentFabricSwitchTest, switchReachability) {
auto verify = [this]() {
utility::checkFabricPortsActiveState(
getAgentEnsemble(),
masterLogicalFabricPortIds(),
true /*expectActive*/);
for (auto switchId : getFabricSwitchIdsWithPorts()) {
bool switchReachabilityWorking = false;
WITH_RETRIES({
auto switchIter = getSw()->getSwitchReachability().find(switchId);
EXPECT_EVENTUALLY_TRUE(
switchIter != getSw()->getSwitchReachability().end());
for (auto& [destinationSwitchId, portGroupId] :
*switchIter->second.switchIdToFabricPortGroupMap()) {
auto portGroupIter =
switchIter->second.fabricPortGroupMap()->find(portGroupId);
if (portGroupIter != switchIter->second.fabricPortGroupMap()->end()) {
XLOG(DBG0) << "On local switch id " << switchId
<< ", destination switch id " << destinationSwitchId
<< " reachability available over port group ID "
<< portGroupId << ", with group size "
<< portGroupIter->second.size();
// Fabric device does not have physical rechability to
// any other device, so no ports expected in port group.
EXPECT_EQ(portGroupIter->second.size(), 0);
switchReachabilityWorking = true;
}
}
EXPECT_EVENTUALLY_TRUE(switchReachabilityWorking);
});
}
};

verifyAcrossWarmBoots([]() {}, verify);
}
} // namespace facebook::fboss

0 comments on commit 202ef16

Please sign in to comment.