diff --git a/fboss/agent/test/link_tests/AgentEnsembleLinkTest.h b/fboss/agent/test/link_tests/AgentEnsembleLinkTest.h index cae029d55c72b..0b17884447f7e 100644 --- a/fboss/agent/test/link_tests/AgentEnsembleLinkTest.h +++ b/fboss/agent/test/link_tests/AgentEnsembleLinkTest.h @@ -157,6 +157,19 @@ class AgentEnsembleLinkTest : public AgentEnsembleTest { void printProductionFeatures() const; + void updateCablePorts() { + cabledPorts_.clear(); + auto swConfig = getSw()->getConfig(); + + for (const auto& port : *swConfig.ports()) { + if (!(*port.expectedLLDPValues()).empty() || + !(*port.expectedNeighborReachability()).empty()) { + auto portID = *port.logicalID(); + cabledPorts_.emplace_back(portID); + } + } + } + private: void initializeCabledPorts(); void logLinkDbgMessage(std::vector& portIDs) const override; diff --git a/fboss/agent/test/link_tests/AgentEnsembleSpeedChangeTest.cpp b/fboss/agent/test/link_tests/AgentEnsembleSpeedChangeTest.cpp index 45a0dcf10111c..a77b7f3d0eee8 100644 --- a/fboss/agent/test/link_tests/AgentEnsembleSpeedChangeTest.cpp +++ b/fboss/agent/test/link_tests/AgentEnsembleSpeedChangeTest.cpp @@ -142,6 +142,9 @@ class AgentEnsembleSpeedChangeTest : public AgentEnsembleLinkTest { // updated applyNewConfig(newConfig); + // Speed change may alter the number of logical ports, + // so we need to refresh the cabledPorts_. + updateCablePorts(); EXPECT_NO_THROW(waitForAllCabledPorts(true, 60, 5s);); createL3DataplaneFlood(); };