From 9c60936e543a56bf3d3782704c5178004c7c9406 Mon Sep 17 00:00:00 2001 From: Rancho Zhang Date: Mon, 2 Mar 2026 06:36:04 +0000 Subject: [PATCH 1/2] [LinkTest] Fix speed change (200G->400g) test issue --- fboss/agent/test/link_tests/AgentEnsembleLinkTest.h | 13 +++++++++++++ .../link_tests/AgentEnsembleSpeedChangeTest.cpp | 1 + 2 files changed, 14 insertions(+) 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..70482692f899d 100644 --- a/fboss/agent/test/link_tests/AgentEnsembleSpeedChangeTest.cpp +++ b/fboss/agent/test/link_tests/AgentEnsembleSpeedChangeTest.cpp @@ -142,6 +142,7 @@ class AgentEnsembleSpeedChangeTest : public AgentEnsembleLinkTest { // updated applyNewConfig(newConfig); + updateCablePorts(); EXPECT_NO_THROW(waitForAllCabledPorts(true, 60, 5s);); createL3DataplaneFlood(); }; From 56e8edb560fb0549ba9558d22139859cd721001d Mon Sep 17 00:00:00 2001 From: Rancho Zhang Date: Tue, 3 Mar 2026 06:25:08 +0000 Subject: [PATCH 2/2] [LinkTest] Add a comment before calling updateCablePorts() to explain why it is needed --- fboss/agent/test/link_tests/AgentEnsembleSpeedChangeTest.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fboss/agent/test/link_tests/AgentEnsembleSpeedChangeTest.cpp b/fboss/agent/test/link_tests/AgentEnsembleSpeedChangeTest.cpp index 70482692f899d..a77b7f3d0eee8 100644 --- a/fboss/agent/test/link_tests/AgentEnsembleSpeedChangeTest.cpp +++ b/fboss/agent/test/link_tests/AgentEnsembleSpeedChangeTest.cpp @@ -142,6 +142,8 @@ 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();