Skip to content

Commit

Permalink
Port HwParityErrorTest to agent hw parity error test
Browse files Browse the repository at this point in the history
Summary: Porting HW parity error test to agent hw parity error test

Differential Revision: D67288660

fbshipit-source-id: 383b7bd76a4e370b20caa32dde78dec921aee9ef
  • Loading branch information
Santhosh Nagaraj authored and facebook-github-bot committed Dec 18, 2024
1 parent beebc0b commit 028a651
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmake/AgentTestAgentHwTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ add_library(agent_hw_test_src
fboss/agent/test/agent_hw_tests/AgentHwAclQualifierTest.cpp
fboss/agent/test/agent_hw_tests/AgentHwAclStatTests.cpp
fboss/agent/test/agent_hw_tests/AgentHwResourceStatsTests.cpp
fboss/agent/test/agent_hw_tests/AgentHwParityErrorTests.cpp
)

target_link_libraries(agent_hw_test_src
Expand Down
57 changes: 57 additions & 0 deletions fboss/agent/test/agent_hw_tests/AgentHwParityErrorTests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2004-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional
* grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/

#include "fboss/agent/test/AgentHwTest.h"
#include "fboss/agent/test/utils/AsicUtils.h"
#include "fboss/agent/test/utils/ConfigUtils.h"
#include "fboss/lib/CommonUtils.h"

namespace facebook::fboss {
class AgentHwParityErrorTest : public AgentHwTest {
protected:
cfg::SwitchConfig initialConfig(
const AgentEnsemble& ensemble) const override {
return utility::onePortPerInterfaceConfig(
ensemble.getSw(),
ensemble.masterLogicalPortIds(),
true /*interfaceHasSubnet*/);
}
std::vector<production_features::ProductionFeature>
getProductionFeaturesVerified() const override {
return {production_features::ProductionFeature::HW_SWITCH};
}
};

TEST_F(AgentHwParityErrorTest, verifyParityError) {
auto setup = [=, this]() {
applyNewConfig(initialConfig(*getAgentEnsemble()));
};
auto verify = [=, this]() {
const auto kPort = masterLogicalInterfacePortIds()[0];
auto switchId = scopeResolver().scope(kPort).switchId();
auto switchIndex =
getSw()->getSwitchInfoTable().getSwitchIndexFromSwitchId(switchId);
auto client = getAgentEnsemble()->getHwAgentTestClient(switchId);
WITH_RETRIES({
auto switchStats = getSw()->getHwSwitchStatsExpensive()[switchIndex];
auto asicErrors = switchStats.hwAsicErrors().value();
EXPECT_EVENTUALLY_EQ(*asicErrors.correctedParityErrors(), 0);
});
client->sync_triggerParityError();
WITH_RETRIES({
auto switchStats = getSw()->getHwSwitchStatsExpensive()[switchIndex];
auto asicErrors = switchStats.hwAsicErrors().value();
EXPECT_EVENTUALLY_GT(*asicErrors.correctedParityErrors(), 0);
});
};
this->verifyAcrossWarmBoots(setup, verify);
}
} // namespace facebook::fboss
1 change: 1 addition & 0 deletions fboss/agent/test/agent_hw_tests/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ cpp_library(
"AgentHwAclMatchActionsTest.cpp",
"AgentHwAclQualifierTest.cpp",
"AgentHwAclStatTests.cpp",
"AgentHwParityErrorTests.cpp",
"AgentHwResourceStatsTests.cpp",
"AgentInNullRouteDiscardsTest.cpp",
"AgentInTrapDiscardsTest.cpp",
Expand Down

0 comments on commit 028a651

Please sign in to comment.