Skip to content

Commit

Permalink
Fix fboss2 show interface counters fec uncorrectable for multi-switch
Browse files Browse the repository at this point in the history
Summary: title

Reviewed By: birdsoup

Differential Revision: D67256913

fbshipit-source-id: 9ddcbba45b5a7e90fd3e89adcab26e6131a159b3
  • Loading branch information
Harshit Gulati authored and facebook-github-bot committed Dec 16, 2024
1 parent 77bdc02 commit 249c4ba
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmake/CliFboss2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ add_executable(fboss2
fboss/cli/fboss2/commands/show/interface/counters/fec/CmdShowInterfaceCountersFec.h
fboss/cli/fboss2/commands/show/interface/counters/fec/ber/CmdShowInterfaceCountersFecBer.h
fboss/cli/fboss2/commands/show/interface/counters/fec/uncorrectable/CmdShowInterfaceCountersFecUncorrectable.h
fboss/cli/fboss2/commands/show/interface/counters/fec/tail/CmdShowInterfaceCountersFecTail.h
fboss/cli/fboss2/commands/show/interface/counters/fec/tail/CmdShowInterfaceCountersFecTail.h
fboss/cli/fboss2/commands/show/interface/counters/fec/histogram/CmdShowInterfaceCountersFecHistogram.h
fboss/cli/fboss2/commands/show/interface/counters/mka/CmdShowInterfaceCountersMKA.h
fboss/cli/fboss2/commands/show/interface/phy/CmdShowInterfacePhy.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ class CmdShowInterfaceCountersFecUncorrectable
qsfpClient->sync_getCounters(fb303CountersXPhyEgressUcSum);
qsfpClient->sync_getCounters(fb303CountersTcvrEgressUcSum);
#else
agentClient->sync_getRegexCounters(
fb303CountersIPhyIngressUcSum,
"^(eth|fab).*fec_uncorrectable_errors.sum.*");
fb303CountersIPhyIngressUcSum = utils::getAgentFb303RegexCounters(
hostInfo, "^(eth|fab).*fec_uncorrectable_errors.sum.*");
qsfpClient->sync_getRegexCounters(
fb303CountersXPhyIngressUcSum, ".*xphy.line.fec_uncorrectable.sum.*");
qsfpClient->sync_getRegexCounters(
Expand Down
23 changes: 23 additions & 0 deletions fboss/cli/fboss2/utils/CmdUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,4 +395,27 @@ std::map<std::string, FabricEndpoint> getFabricEndpoints(
return entries;
}

std::map<std::string, int64_t> getAgentFb303RegexCounters(
const HostInfo& hostInfo,
const std::string& regex) {
std::map<std::string, int64_t> counters;
#ifndef IS_OSS
// TODO: sync_getRegexCounters is not available in OSS
if (utils::isFbossFeatureEnabled(hostInfo.getName(), "multi_switch")) {
auto hwAgentQueryFn =
[&counters,
&regex](apache::thrift::Client<facebook::fboss::FbossCtrl>& client) {
std::map<std::string, int64_t> hwagentCounters;
client.sync_getRegexCounters(hwagentCounters, regex);
counters.merge(hwagentCounters);
};
utils::runOnAllHwAgents(hostInfo, hwAgentQueryFn);
} else {
utils::createClient<apache::thrift::Client<FbossCtrl>>(hostInfo)
->sync_getRegexCounters(counters, regex);
}
#endif
return counters;
}

} // namespace facebook::fboss::utils
4 changes: 4 additions & 0 deletions fboss/cli/fboss2/utils/CmdUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -475,4 +475,8 @@ cfg::SwitchType getSwitchType(
std::map<std::string, FabricEndpoint> getFabricEndpoints(
const HostInfo& hostInfo);

std::map<std::string, int64_t> getAgentFb303RegexCounters(
const HostInfo& hostInfo,
const std::string& regex);

} // namespace facebook::fboss::utils

0 comments on commit 249c4ba

Please sign in to comment.