Skip to content

Commit befd0e0

Browse files
benoit-nexthopmeta-codesync[bot]
authored andcommitted
Add a utility class to help map ports to interfaces. (#755)
Summary: **Pre-submission checklist** - [x] I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running `pip install -r requirements-dev.txt && pre-commit install` - [x] `pre-commit run` This is a small helper class used to lookup ports and interfaces in a consistent fashion in CLI commands. Note: this change is part of a series, the previous one is #754, the next one is #756. Pull Request resolved: #755 Test Plan: Unit tests. Reviewed By: KevinYakar Differential Revision: D89903145 Pulled By: joseph5wu fbshipit-source-id: e36f8198ed19bb4141285b56da93632f8d660a06
1 parent 9dac490 commit befd0e0

File tree

8 files changed

+864
-2
lines changed

8 files changed

+864
-2
lines changed

cmake/CliFboss2.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ add_library(fboss2_lib
476476
fboss/cli/fboss2/utils/CLIParserUtils.cpp
477477
fboss/cli/fboss2/utils/CmdClientUtils.cpp
478478
fboss/cli/fboss2/utils/CmdUtilsCommon.cpp
479+
fboss/cli/fboss2/utils/PortMap.cpp
479480
fboss/cli/fboss2/utils/Table.cpp
480481
fboss/cli/fboss2/utils/HostInfo.h
481482
fboss/cli/fboss2/utils/FilterOp.h

cmake/CliFboss2Test.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ add_executable(fboss2_cmd_test
3737
# fboss/cli/fboss2/test/CmdShowTransceiverTest.cpp - excluded (depends on configerator bgp namespace)
3838
fboss/cli/fboss2/test/CmdStartPcapTest.cpp
3939
fboss/cli/fboss2/test/CmdStopPcapTest.cpp
40+
fboss/cli/fboss2/test/PortMapTest.cpp
4041
)
4142

4243
target_link_libraries(fboss2_cmd_test

fboss/cli/fboss2/BUCK

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ cpp_library(
313313
"utils/CmdClientUtils.cpp",
314314
"utils/CmdUtils.cpp",
315315
"utils/NetwhoamiUtils.cpp",
316+
"utils/PortMap.cpp",
316317
"utils/PrbsUtils.cpp",
317318
"utils/TeFlowUtils.cpp",
318319
"utils/clients/BmcClient.cpp",
@@ -524,6 +525,8 @@ cpp_library(
524525
"//employee/if:thrift-cpp2-types",
525526
"//fastcli:utils-cpp",
526527
"//fboss/agent:address_utils",
528+
"//fboss/agent:agent_config-cpp2-types",
529+
"//fboss/agent:fboss-types",
527530
"//fboss/agent/hw:hardware_stats-cpp2-types",
528531
"//fboss/agent/if:common-cpp2-types",
529532
"//fboss/agent/if:ctrl-cpp2-clients",
@@ -667,6 +670,7 @@ cpp_library(
667670
"//fboss/qsfp_service/if:qsfp-cpp2-services",
668671
"//fboss/qsfp_service/if:transceiver-cpp2-types",
669672
"//folly:conv",
673+
"//folly:cpp_attributes",
670674
"//folly:format",
671675
"//folly:network_address",
672676
"//folly:range",
@@ -693,7 +697,7 @@ cpp_library(
693697
"//neteng/netwhoami/lib/cpp:recover",
694698
"//neteng/routing/policy/if:policy_thrift-cpp2-types",
695699
"//nettools/bgplib:bgp_structs",
696-
"//nettools/bgplib:bgplib",
700+
"//nettools/bgplib:bgplib_util",
697701
"//nettools/bgplib/if:bgp-structs-cpp2-types",
698702
"//nettools/skynet/if:query-cpp2-types",
699703
"//nettools/skynet/if:skynet_structs-cpp2-types",
@@ -720,6 +724,7 @@ cpp_library(
720724
"//thrift/lib/cpp2/protocol:protocol",
721725
],
722726
exported_external_deps = [
727+
"glog",
723728
("boost", None, "boost_algorithm"),
724729
],
725730
)
@@ -774,6 +779,7 @@ cpp_library(
774779
exported_deps = [
775780
":cmd-handler",
776781
":fboss2-lib",
782+
"//fboss/agent/if:ctrl-cpp2-types",
777783
"//folly:conv",
778784
],
779785
)
@@ -843,7 +849,7 @@ cpp_binary(
843849
"//neteng/fboss/bgp/if:bgp_thrift-cpp2-types",
844850
"//neteng/routing/policy/if:policy_thrift-cpp2-types",
845851
"//nettools/bgplib:bgp_structs",
846-
"//nettools/bgplib:bgplib",
852+
"//nettools/bgplib:bgplib_util",
847853
"//nettools/bgplib/if:bgp-structs-cpp2-types",
848854
"//nettools/skynet/if:query-cpp2-types",
849855
"//nettools/skynet/if:skynet_structs-cpp2-types",

fboss/cli/fboss2/test/BUCK

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,15 @@ cpp_unittest(
8787
"CmdShowTransceiverTest.cpp",
8888
"CmdStartPcapTest.cpp",
8989
"CmdStopPcapTest.cpp",
90+
"PortMapTest.cpp",
9091
],
92+
# Config files for PortMapTest parameterized tests
93+
resources = [
94+
"//fboss/oss/link_test_configs:link_test_configs",
95+
],
96+
# Required for parameterized tests (TEST_P) - static listing doesn't support them
97+
# See: https://fburl.com/parameterized-test-not-supported
98+
supports_static_listing = False,
9199
deps = [
92100
"fbsource//third-party/googletest:gmock",
93101
":cmd_test_utils",
@@ -121,9 +129,11 @@ cpp_unittest(
121129
"//fboss/cli/fboss2/commands/show/route:model-cpp2-types",
122130
"//fboss/cli/fboss2/commands/show/teflow:model-cpp2-types",
123131
"//fboss/cli/fboss2/commands/show/transceiver:model-cpp2-types",
132+
"//folly:file_util",
124133
"//folly:network_address",
125134
"//folly/json:dynamic",
126135
"//neteng/fboss/bgp/if:bgp_thrift-cpp2-services",
136+
"//thrift/lib/cpp2/protocol:protocol",
127137
"//thrift/lib/cpp2/reflection:testing",
128138
],
129139
external_deps = [("boost", None, "boost_algorithm")],

0 commit comments

Comments
 (0)