Skip to content

Commit 6f59279

Browse files
daiwei1983meta-codesync[bot]
authored andcommitted
enhance AgentTrafficPfcTests to run with hyper ports
Summary: as titled Reviewed By: nivinl Differential Revision: D86116480 Privacy Context Container: L1297311 fbshipit-source-id: d3a2057fedf40c50285904b76938c88e9776742f
1 parent e8f9c2f commit 6f59279

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

fboss/agent/test/AgentHwTest.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ class AgentHwTest : public ::testing::Test {
138138
std::vector<PortID> masterLogicalFabricPortIds(SwitchID switchId) const {
139139
return masterLogicalPortIds({cfg::PortType::FABRIC_PORT}, switchId);
140140
}
141+
std::vector<PortID> masterLogicalHyperPortIds() const {
142+
return masterLogicalPortIds({cfg::PortType::HYPER_PORT});
143+
}
141144
void setSwitchDrainState(
142145
const cfg::SwitchConfig& curConfig,
143146
cfg::SwitchDrainState drainState);

fboss/agent/test/agent_hw_tests/AgentTrafficPfcTests.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,8 @@ class AgentTrafficPfcTest : public AgentHwTest {
350350
}
351351

352352
std::vector<PortID> portIdsForTest(bool scaleTest = false) {
353-
auto allPorts = masterLogicalInterfacePortIds();
353+
auto allPorts = FLAGS_hyper_port ? masterLogicalHyperPortIds()
354+
: masterLogicalInterfacePortIds();
354355
int numPorts = scaleTest ? allPorts.size() : 2;
355356
return std::vector<PortID>(allPorts.begin(), allPorts.begin() + numPorts);
356357
}
@@ -517,8 +518,8 @@ class AgentTrafficPfcTest : public AgentHwTest {
517518
auto srcMac = utility::MacAddressGenerator().get(intfMac.u64HBO() + 1);
518519
// pri = 7 => dscp 56
519520
int dscp = priority * 8;
520-
int numPacketsPerFlow = getAgentEnsemble()->getMinPktsForLineRate(
521-
masterLogicalInterfacePortIds()[0]);
521+
int numPacketsPerFlow =
522+
getAgentEnsemble()->getMinPktsForLineRate(portIdsForTest()[0]);
522523
if (FLAGS_num_packets_to_trigger_pfc > 0) {
523524
numPacketsPerFlow = FLAGS_num_packets_to_trigger_pfc;
524525
}
@@ -1152,8 +1153,8 @@ class AgentTrafficPfcWatchdogTest : public AgentTrafficPfcTest {
11521153
// Tx disabled. Then we send packets to that IP on a different port (portId),
11531154
// which will eventually cause queues to build up and PFC to trigger.
11541155
TEST_F(AgentTrafficPfcWatchdogTest, PfcWatchdogDetection) {
1155-
PortID portId = masterLogicalInterfacePortIds()[0];
1156-
PortID txOffPortId = masterLogicalInterfacePortIds()[1];
1156+
PortID portId = portIdsForTest()[0];
1157+
PortID txOffPortId = portIdsForTest()[1];
11571158
XLOG(DBG3) << "Injection port: " << portDesc(portId);
11581159
XLOG(DBG3) << "Tx off port: " << portDesc(txOffPortId);
11591160
auto ip = getDestinationIps()[0];
@@ -1184,8 +1185,8 @@ TEST_F(AgentTrafficPfcWatchdogTest, PfcWatchdogDetection) {
11841185
// Since the watchdog counters are sw based, upon warm boot
11851186
// we don't expect these counters to be incremented either
11861187
TEST_F(AgentTrafficPfcWatchdogTest, PfcWatchdogReset) {
1187-
PortID portId = masterLogicalInterfacePortIds()[0];
1188-
PortID txOffPortId = masterLogicalInterfacePortIds()[1];
1188+
PortID portId = portIdsForTest()[0];
1189+
PortID txOffPortId = portIdsForTest()[1];
11891190
XLOG(DBG3) << "Injection port: " << portDesc(portId);
11901191
XLOG(DBG3) << "Tx off port: " << portDesc(txOffPortId);
11911192
auto ip = getDestinationIps()[0];

0 commit comments

Comments
 (0)