diff --git a/tests/BUILD.bazel b/tests/BUILD.bazel index 5e111900..d7fa86ba 100644 --- a/tests/BUILD.bazel +++ b/tests/BUILD.bazel @@ -103,6 +103,7 @@ cc_library( "@com_github_gnmi//proto/gnmi:gnmi_cc_grpc_proto", "@com_github_google_glog//:glog", "@com_github_nlohmann_json//:nlohmann_json", + "@com_github_p4lang_p4runtime//:p4info_cc_proto", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/container:flat_hash_set", "@com_google_absl//absl/status", diff --git a/tests/forwarding/BUILD.bazel b/tests/forwarding/BUILD.bazel index 281e623c..e3c95516 100644 --- a/tests/forwarding/BUILD.bazel +++ b/tests/forwarding/BUILD.bazel @@ -130,6 +130,7 @@ cc_library( deps = [ "//dvaas:test_vector", "//p4_pdpi/netaddr:ipv4_address", + "//p4_pdpi/netaddr:ipv6_address", "//p4_pdpi/netaddr:mac_address", "//p4_pdpi/packetlib", "@com_google_absl//absl/base:core_headers", diff --git a/tests/forwarding/packet_test_util.cc b/tests/forwarding/packet_test_util.cc index 3affde68..60c7780f 100644 --- a/tests/forwarding/packet_test_util.cc +++ b/tests/forwarding/packet_test_util.cc @@ -15,6 +15,7 @@ #include "tests/forwarding/packet_test_util.h" namespace pins { +#include "p4_pdpi/netaddr/ipv6_address.h" using ::packetlib::EthernetHeader; using ::packetlib::IpDscp; @@ -33,17 +34,16 @@ using ::packetlib::Ipv6Header; using ::packetlib::UdpHeader; using ::packetlib::UdpPort; -const uint64_t kBaseDstMac = 234; -const uint64_t kMaxMacAddr = static_cast(1) << (6 * 8); +namespace { +constexpr uint64_t kBaseDstMac = 234; +constexpr uint64_t kMacAddrSize = static_cast(1) << (48); // Base IPv4 address for generating the outer IP header for packets that are not // supposed to be decapped. -const uint32_t kBaseIpV4Src = 0x01020304; // 1.2.3.4 -const uint32_t kBaseIpV4Dst = 0x02030405; // 2.3.4.5 -const uint32_t kBaseDecapIpV4Src = 0x0a020304; // 10.2.3.4 -const uint32_t kBaseDecapIpV4Dst = 0x14030405; // 20.3.4.5 - -namespace { +constexpr uint32_t kBaseIpV4Src = 0x01020304; // 1.2.3.4 +constexpr uint32_t kBaseIpV4Dst = 0x02030405; // 2.3.4.5 +constexpr uint32_t kBaseDecapIpV4Src = 0x0a020304; // 10.2.3.4 +constexpr uint32_t kBaseDecapIpV4Dst = 0x14030405; // 20.3.4.5 std::string PacketFieldToString(const PacketField field) { switch (field) { @@ -152,7 +152,7 @@ bool IsValidTestConfiguration(const TestConfiguration& config) { // Returns the ith destination MAC that is used when varying that field. netaddr::MacAddress GetIthDstMac(int i) { - return netaddr::MacAddress(std::bitset<48>(kBaseDstMac + i % kMaxMacAddr)); + return netaddr::MacAddress(std::bitset<48>(kBaseDstMac + i % kMacAddrSize)); } // Returns a human-readable description of a test config. @@ -175,18 +175,21 @@ std::string TestConfigurationToPayload(const TestConfiguration& config) { // and vary in exactly one field (the one specified in the config). absl::StatusOr GenerateIthPacket( const TestConfiguration& config, int index) { + constexpr uint64_t kDefaultSrcIpUpper = 0x0001000200030004; + constexpr uint64_t kDefaultDstIpUpper = 0x0002000300040005; + constexpr uint64_t kDefaultSrcMac = 123; + packetlib::Packet packet; const auto& field = config.field; EthernetHeader* eth = packet.add_headers()->mutable_ethernet_header(); - uint64_t default_src_mac = 123; eth->set_ethernet_source( - netaddr::MacAddress(std::bitset<48>(default_src_mac)).ToString()); + netaddr::MacAddress(std::bitset<48>(kDefaultSrcMac)).ToString()); if (field == PacketField::kEthernetSrc) { eth->set_ethernet_source( netaddr::MacAddress( - std::bitset<48>(default_src_mac + index % kMaxMacAddr)) + std::bitset<48>(kDefaultSrcMac + index % kMacAddrSize)) .ToString()); } eth->set_ethernet_destination( @@ -239,20 +242,14 @@ absl::StatusOr GenerateIthPacket( ip->set_fragment_offset(IpFragmentOffset(0)); } else { Ipv6Header* ip = packet.add_headers()->mutable_ipv6_header(); - auto default_src = absl::MakeUint128(0x0001000200030004, 0); - if (field == PacketField::kIpSrc) { - ip->set_ipv6_source( - netaddr::Ipv6Address(default_src + index).ToString()); - } else { - ip->set_ipv6_source(netaddr::Ipv6Address(default_src).ToString()); - } - auto default_dst = absl::MakeUint128(0x0002000300040005, 0); - if (field == PacketField::kIpDst) { - ip->set_ipv6_destination( - netaddr::Ipv6Address(default_dst + index).ToString()); - } else { - ip->set_ipv6_destination(netaddr::Ipv6Address(default_dst).ToString()); - } + auto src_ip = absl::MakeUint128( + kDefaultSrcIpUpper + (field == PacketField::kIpSrc ? index : 0), 0); + ip->set_ipv6_source(netaddr::Ipv6Address(src_ip).ToString()); + + auto dst_ip = absl::MakeUint128( + kDefaultDstIpUpper + (field == PacketField::kIpDst ? index : 0), 0); + ip->set_ipv6_destination(netaddr::Ipv6Address(dst_ip).ToString()); + ip->set_hop_limit(IpHopLimit(hop_limit)); ip->set_dscp(IpDscp(dscp)); uint32_t flow_label = 0; @@ -310,7 +307,7 @@ absl::StatusOr GenerateIthPacket( ip->set_fragment_offset(IpFragmentOffset(0)); } else { Ipv6Header* ip = packet.add_headers()->mutable_ipv6_header(); - auto default_inner_src = absl::MakeUint128(0x00030000400050006, 0); + auto default_inner_src = absl::MakeUint128(0x0003000400050006, 0); if (field == PacketField::kInnerIpSrc) { ip->set_ipv6_source( netaddr::Ipv6Address(default_inner_src + index).ToString()); diff --git a/tests/thinkit_gnmi_interface_tests.cc b/tests/thinkit_gnmi_interface_tests.cc index c8e34e0b..aff1d017 100644 --- a/tests/thinkit_gnmi_interface_tests.cc +++ b/tests/thinkit_gnmi_interface_tests.cc @@ -62,7 +62,8 @@ void BreakoutDuringPortInUse(thinkit::Switch& sut, gnmi::gNMI::StubInterface* sut_gnmi_stub, RandomPortBreakoutInfo port_info, const std::string& platform_json_contents, - bool test_child_port_in_use) { + bool test_child_port_in_use, + const p4::config::v1::P4Info& p4_info) { // Get the original breakout info on the port. // This contains the state values of physical channels and // operational status information for ports in original breakout mode. @@ -119,13 +120,11 @@ void BreakoutDuringPortInUse(thinkit::Switch& sut, ASSERT_OK(pdpi::SetMetadataAndSetForwardingPipelineConfig( sut_p4_session.get(), p4::v1::SetForwardingPipelineConfigRequest::RECONCILE_AND_COMMIT, - sai::GetP4Info(sai::Instantiation::kMiddleblock))) + p4_info)) << "SetForwardingPipelineConfig: Failed to push P4Info: "; ASSERT_OK(pdpi::ClearTableEntries(sut_p4_session.get())); - p4::config::v1::P4Info p4info = - sai::GetP4Info(sai::Instantiation::kMiddleblock); - ASSERT_OK_AND_ASSIGN(auto ir_p4info, pdpi::CreateIrP4Info(p4info)); + ASSERT_OK_AND_ASSIGN(auto ir_p4info, pdpi::CreateIrP4Info(p4_info)); ASSERT_OK_AND_ASSIGN(const p4::v1::TableEntry pi_entry, pdpi::PartialPdTableEntryToPiTableEntry(pdpi::IrP4Info(), pd_entry)); @@ -203,7 +202,8 @@ void BreakoutDuringPortInUse(thinkit::Switch& sut, } void TestGNMIParentPortInUseDuringBreakout( - thinkit::Switch& sut, std::string& platform_json_contents) { + thinkit::Switch& sut, std::string& platform_json_contents, + const p4::config::v1::P4Info& p4_info) { ASSERT_OK_AND_ASSIGN(auto sut_gnmi_stub, sut.CreateGnmiStub()); // Get a random port from list of front panel ports that supports at least // one breakout mode of required type other than its current mode. @@ -211,11 +211,12 @@ void TestGNMIParentPortInUseDuringBreakout( *sut_gnmi_stub, platform_json_contents, BreakoutType::kAny)); BreakoutDuringPortInUse(sut, sut_gnmi_stub.get(), port, - platform_json_contents, false); + platform_json_contents, false, p4_info); } -void TestGNMIChildPortInUseDuringBreakout(thinkit::Switch& sut, - std::string& platform_json_contents) { +void TestGNMIChildPortInUseDuringBreakout( + thinkit::Switch& sut, std::string& platform_json_contents, + const p4::config::v1::P4Info& p4_info) { ASSERT_OK_AND_ASSIGN(auto sut_gnmi_stub, sut.CreateGnmiStub()); // Get a random port from list of front panel ports that supports at least // one breakout mode of required type other than its current mode. @@ -223,6 +224,6 @@ void TestGNMIChildPortInUseDuringBreakout(thinkit::Switch& sut, *sut_gnmi_stub, platform_json_contents, BreakoutType::kChannelized)); BreakoutDuringPortInUse(sut, sut_gnmi_stub.get(), port, - platform_json_contents, true); + platform_json_contents, true, p4_info); } } // namespace pins_test diff --git a/tests/thinkit_gnmi_interface_tests.h b/tests/thinkit_gnmi_interface_tests.h index d3b97e82..c0ad5a6f 100644 --- a/tests/thinkit_gnmi_interface_tests.h +++ b/tests/thinkit_gnmi_interface_tests.h @@ -18,6 +18,9 @@ #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" #include "absl/strings/string_view.h" +#include "p4/config/v1/p4info.pb.h" +#include "sai_p4/instantiations/google/instantiations.h" +#include "sai_p4/instantiations/google/sai_p4info.h" #include "tests/thinkit_gnmi_interface_util.h" #include "thinkit/ssh_client.h" #include "thinkit/switch.h" @@ -25,19 +28,24 @@ namespace pins_test { // Test port breakout during parent port in use. -void TestGNMIParentPortInUseDuringBreakout(thinkit::Switch& sut, - std::string& platform_json_contents); +void TestGNMIParentPortInUseDuringBreakout( + thinkit::Switch& sut, std::string& platform_json_contents, + const p4::config::v1::P4Info& p4_info = + sai::GetP4Info(sai::Instantiation::kMiddleblock)); // Test port breakout during child port in use. -void TestGNMIChildPortInUseDuringBreakout(thinkit::Switch& sut, - std::string& platform_json_contents); +void TestGNMIChildPortInUseDuringBreakout( + thinkit::Switch& sut, std::string& platform_json_contents, + const p4::config::v1::P4Info& p4_info = + sai::GetP4Info(sai::Instantiation::kMiddleblock)); // Helper function to test port in use. void BreakoutDuringPortInUse(thinkit::Switch& sut, gnmi::gNMI::StubInterface* sut_gnmi_stub, RandomPortBreakoutInfo port_info, const std::string& platform_json_contents, - bool test_child_port_in_use); + bool test_child_port_in_use, + const p4::config::v1::P4Info& p4_info); // Test port breakout during parent port in use. void TestGNMIParentPortInUseDuringBreakout(thinkit::Switch& sut, diff --git a/tests/thinkit_gnmi_interface_util.cc b/tests/thinkit_gnmi_interface_util.cc index 1edb8255..6d7f97c0 100644 --- a/tests/thinkit_gnmi_interface_util.cc +++ b/tests/thinkit_gnmi_interface_util.cc @@ -163,14 +163,15 @@ absl::StatusOr GetRandomPortWithSupportedBreakoutModes( std::vector up_parent_port_list; for (auto& intf : interface_to_oper_status_map) { if (absl::StartsWith(intf.first, kEthernet)) { - auto port_number_str = intf.first.substr(kEthernetLen); - int port_number; - if (!absl::SimpleAtoi(port_number_str, &port_number)) { + ASSIGN_OR_RETURN(std::vector slot_port_lane, + GetSlotPortLaneForPort(intf.first)); + int curr_lane_number; + if (!absl::SimpleAtoi(slot_port_lane[kLaneIndex], &curr_lane_number)) { return gutil::InternalErrorBuilder().LogError() - << "Failed to convert string (" << port_number_str + << "Failed to convert string (" << slot_port_lane[kLaneIndex] << ") to integer"; } - if (((port_number % kMaxPortLanes) == 0) && intf.second == kStateUp) { + if ((curr_lane_number == 1) && intf.second == kStateUp) { up_parent_port_list.push_back(intf.first); } } @@ -255,6 +256,22 @@ absl::StatusOr GetRandomPortWithSupportedBreakoutModes( return port_info; } +absl::StatusOr> GetSlotPortLaneForPort( + const absl::string_view port) { + if (!absl::StartsWith(port, kEthernet)) { + return absl::InvalidArgumentError( + absl::StrCat("Requested port (", port, ") is not a front panel port")); + } + auto slot_port_lane = port.substr(kEthernetLen); + std::vector values = absl::StrSplit(slot_port_lane, '/'); + if (values.size() != 3) { + return absl::InvalidArgumentError( + absl::StrCat("Requested port (", port, + ") does not have a valid format (EthernetX/Y/Z)")); + } + return values; +} + absl::StatusOr> GetExpectedPortInfoForBreakoutMode(const std::string& port, absl::string_view breakout_mode) { @@ -270,17 +287,19 @@ GetExpectedPortInfoForBreakoutMode(const std::string& port, // Get maximum physical channels in a breakout group which is max // lanes per physical port/number of groups in a breakout mode. auto max_channels_in_group = kMaxPortLanes / modes.size(); - auto port_number_str = port.substr(kEthernetLen); - int current_port_number; - if (!absl::SimpleAtoi(port_number_str, ¤t_port_number)) { + ASSIGN_OR_RETURN(std::vector slot_port_lane, + GetSlotPortLaneForPort(port)); + int curr_lane_number; + if (!absl::SimpleAtoi(slot_port_lane[kLaneIndex], &curr_lane_number)) { return gutil::InternalErrorBuilder().LogError() - << "Failed to convert string (" << port_number_str << ") to integer"; + << "Failed to convert string (" << slot_port_lane[kLaneIndex] + << ") to integer"; } - if (current_port_number % kMaxPortLanes != 0) { - return gutil::InternalErrorBuilder().LogError() - << "Requested port (" << port << ") is not a parent port"; + // Lane number for a master port is always 1. + if (curr_lane_number != 1) { + return absl::InvalidArgumentError( + absl::StrCat("Requested port (", port, ") is not a parent port")); } - auto current_physical_channel = 0; absl::flat_hash_map expected_breakout_info; @@ -295,14 +314,16 @@ GetExpectedPortInfoForBreakoutMode(const std::string& port, } // For each resulting interface, construct the front panel interface name - // using offset from the parent port. For a breakout mode of Ethernet0 => - // 2x100(4)G+1x200G(4), the max channels per group would be 4 (8 max lanes - // per port/2 groups). Hence, breakout mode 2x100G (numBreakouts=2) would - // have an offset of 2 and 1x200G(numBreakouts=1) would have an offset of 1 - // leading to interfaces Ethernet0, Ethernet2 for mode 2x100G and - // Ethernet4 for mode 1x200G. + // using offset from the parent port. For a breakout mode of Ethernet1/1/1 + // => 2x100(4)G+1x200G(4), the max channels per group would be 4 (8 max + // lanes per port/2 groups). Hence, breakout mode 2x100G (numBreakouts=2) + // would have an offset of 2 and 1x200G(numBreakouts=1) would have an offset + // of 1 leading to interfaces Ethernet1/1/1, Ethernet1/1/3 for mode 2x100G + // and Ethernet1/1/5 for mode 1x200G. for (int i = 0; i < num_breakouts; i++) { - auto port = absl::StrCat(kEthernet, std::to_string(current_port_number)); + auto port = absl::StrCat(kEthernet, slot_port_lane[kSlotIndex], "/", + slot_port_lane[kPortIndex], "/", + std::to_string(curr_lane_number)); // Populate expected physical channels for each port. // Physical channels are between 0 to 7. int offset = max_channels_in_group / num_breakouts; @@ -319,7 +340,7 @@ GetExpectedPortInfoForBreakoutMode(const std::string& port, } physical_channels += "]"; current_physical_channel += offset; - current_port_number += offset; + curr_lane_number += offset; expected_breakout_info[port] = PortBreakoutInfo{physical_channels}; } } @@ -495,13 +516,14 @@ absl::Status GetBreakoutModeConfigFromString( auto index = 0; // Get current port number. - int current_port_number; - if (!absl::SimpleAtoi(port_index, ¤t_port_number)) { + ASSIGN_OR_RETURN(std::vector slot_port_lane, + GetSlotPortLaneForPort(intf_name)); + int curr_lane_number; + if (!absl::SimpleAtoi(slot_port_lane[kLaneIndex], &curr_lane_number)) { return gutil::InternalErrorBuilder().LogError() - << "Failed to convert string (" << port_index << ") to integer"; + << "Failed to convert string (" << slot_port_lane[kLaneIndex] + << ") to integer"; } - current_port_number = (current_port_number - 1) * kMaxPortLanes; - ASSIGN_OR_RETURN(bool is_copper_port, IsCopperPort(sut_gnmi_stub, intf_name)); for (const auto& mode : modes) { @@ -524,14 +546,16 @@ absl::Status GetBreakoutModeConfigFromString( // Get the interface config for all ports corresponding to current breakout // group. for (int i = 0; i < num_breakouts; i++) { - auto port = absl::StrCat(kEthernet, std::to_string(current_port_number)); + auto port = absl::StrCat(kEthernet, slot_port_lane[kSlotIndex], "/", + slot_port_lane[kPortIndex], "/", + std::to_string(curr_lane_number)); ASSIGN_OR_RETURN( auto interface_config, - GenerateInterfaceBreakoutConfig(port, current_port_number, + GenerateInterfaceBreakoutConfig(port, curr_lane_number, breakout_speed, is_copper_port)); interface_configs.push_back(interface_config); int offset = max_channels_in_group / num_breakouts; - current_port_number += offset; + curr_lane_number += offset; } index += 1; } diff --git a/tests/thinkit_gnmi_interface_util.h b/tests/thinkit_gnmi_interface_util.h index 5b27069a..2a6a249c 100644 --- a/tests/thinkit_gnmi_interface_util.h +++ b/tests/thinkit_gnmi_interface_util.h @@ -34,6 +34,9 @@ namespace pins_test { inline constexpr int kMaxPortLanes = 8; inline constexpr int kEthernetLen = 8; inline constexpr char kEthernet[] = "Ethernet"; +const int kSlotIndex = 0; +const int kPortIndex = 1; +const int kLaneIndex = 2; // // PortBreakoutInfo contains physical channels and operational status for an // // interface. @@ -136,5 +139,10 @@ std::string ConstructSupportedBreakoutMode(absl::string_view num_breakouts, // IsCopperPort returns whether the port is copper or optic. absl::StatusOr IsCopperPort(gnmi::gNMI::StubInterface* sut_gnmi_stub, absl::string_view port); + +// Returns vector of from front panel port +// Ethernet +absl::StatusOr> GetSlotPortLaneForPort( + const absl::string_view port); } // namespace pins_test #endif // PINS_TESTS_THINKIT_GNMI_INTERFACE_UTIL_H_ diff --git a/tests/thinkit_gnmi_interface_util_tests.cc b/tests/thinkit_gnmi_interface_util_tests.cc index 60f8f5fb..c704a37f 100644 --- a/tests/thinkit_gnmi_interface_util_tests.cc +++ b/tests/thinkit_gnmi_interface_util_tests.cc @@ -40,7 +40,7 @@ constexpr char get_xcvrd_req_str[] = elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "transceiver" } @@ -56,13 +56,13 @@ constexpr char get_xcvrd_resp_str[] = elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "transceiver" } } val { - json_ietf_val: "{\"openconfig-platform-transceiver:transceiver\":\"Ethernet0\"}" + json_ietf_val: "{\"openconfig-platform-transceiver:transceiver\":\"Ethernet1/1/1\"}" } } } @@ -74,7 +74,7 @@ constexpr char cable_len_req_str[] = elem { name: "components" } elem { name: "component" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "transceiver" } elem { name: "state" } @@ -91,7 +91,7 @@ constexpr char cable_len_resp_copper_str[] = elem { name: "components" } elem { name: "component" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "transceiver" } elem { name: "state" } @@ -113,7 +113,7 @@ constexpr char cable_len_resp_optic_str[] = elem { name: "components" } elem { name: "component" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "transceiver" } elem { name: "state" } @@ -139,7 +139,7 @@ class GNMIThinkitInterfaceUtilityTest : public ::testing::Test { TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetSupportedBreakoutModesForPortAnySuccess) { - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; std::vector expected_breakout_modes = { "1x400G", "2x200G", "2x100G", "2x40G", "4x100G"}; @@ -152,7 +152,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetSupportedBreakoutModesForPortChannelizedSuccess) { - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; std::vector expected_breakout_modes = {"2x200G", "2x100G", "2x40G", "4x100G"}; @@ -166,7 +166,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetSupportedBreakoutModesForPortBreakoutModesNotFoundFailure) { - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; const std::string interface_info = R"pb({} )pb"; @@ -179,7 +179,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetSupportedBreakoutModesForPortNumBreakoutsIntConversionFailure) { - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; const std::string interface_info = R"pb({ "breakout_modes": "Xx400G, 2x200G[100G,40G], 4x100G" } )pb"; @@ -195,26 +195,26 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, absl::flat_hash_map expected_port_info; pins_test::RandomPortBreakoutInfo r; - r.port_name = "Ethernet0"; + r.port_name = "Ethernet1/1/1"; r.curr_breakout_mode = "1x400G"; r.supported_breakout_mode = "2x200G"; - expected_port_info["Ethernet0"] = r; - r.port_name = "Ethernet8"; + expected_port_info["Ethernet1/1/1"] = r; + r.port_name = "Ethernet1/2/1"; r.curr_breakout_mode = "2x200G"; r.supported_breakout_mode = "1x400G"; - expected_port_info["Ethernet8"] = r; + expected_port_info["Ethernet1/2/1"] = r; const std::string platform_json_contents = R"pb({ "interfaces": { - "Ethernet0": { + "Ethernet1/1/1": { "default_brkout_mode": "1x400G", "breakout_modes": "1x400G, 2x200G[100G,40G]" }, - "Ethernet8": { + "Ethernet1/2/1": { "default_brkout_mode": "2x200G", "breakout_modes": "1x400G, 2x200G[100G,40G]" }, - "Ethernet12": { "breakout_modes": "1x200G[100G,40G]" } + "Ethernet1/2/5": { "breakout_modes": "1x200G[100G,40G]" } } } )pb"; @@ -232,7 +232,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, update { path { elem { name: "interfaces" } } val { - json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet0\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 1}},{\"name\":\"Ethernet8\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 2}}]}}" + json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet1/1/1\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 1}},{\"name\":\"Ethernet1/2/1\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 2}}]}}" } } } @@ -259,22 +259,22 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, absl::flat_hash_map expected_port_info; pins_test::RandomPortBreakoutInfo r; - r.port_name = "Ethernet0"; + r.port_name = "Ethernet1/1/1"; r.curr_breakout_mode = "1x400G"; r.supported_breakout_mode = "2x200G"; - expected_port_info["Ethernet0"] = r; + expected_port_info["Ethernet1/1/1"] = r; const std::string platform_json_contents = R"pb({ "interfaces": { - "Ethernet0": { + "Ethernet1/1/1": { "default_brkout_mode": "1x400G", "breakout_modes": "1x400G, 2x200G[100G,40G]" }, - "Ethernet8": { + "Ethernet1/2/1": { "default_brkout_mode": "1x400G", "breakout_modes": "1x400G" }, - "Ethernet16": { + "Ethernet1/3/1": { "default_brkout_mode": "1x400G", "breakout_modes": "1x400G" } @@ -295,7 +295,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, update { path { elem { name: "interfaces" } } val { - json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet0\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 1}},{\"name\":\"Ethernet8\",\"state\":{\"oper-status\":\"UP\"}},{\"name\":\"Ethernet16\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 2}}]}}" + json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet1/1/1\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 1}},{\"name\":\"Ethernet1/2/1\",\"state\":{\"oper-status\":\"UP\"}},{\"name\":\"Ethernet1/3/1\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 2}}]}}" } } } @@ -352,7 +352,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, update { path { elem { name: "interfaces" } } val { - json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet0\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 1}},{\"name\":\"Ethernet8\",\"state\":{\"oper-status\":\"UP\"}},{\"name\":\"Ethernet16\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 2}}]}}" + json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet1/1/1\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 1}},{\"name\":\"Ethernet1/2/1\",\"state\":{\"oper-status\":\"UP\"}},{\"name\":\"Ethernet1/3/1\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 2}}]}}" } } } @@ -390,7 +390,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, update { path { elem { name: "interfaces" } } val { - json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"EthernetX\",\"state\":{\"oper-status\":\"UP\"}}, {\"name\":\"Ethernet8\",\"state\":{\"oper-status\":\"UP\"}}]}}" + json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet1/1/X\",\"state\":{\"oper-status\":\"UP\"}}, {\"name\":\"Ethernet1/2/1\",\"state\":{\"oper-status\":\"UP\"}}]}}" } } } @@ -410,15 +410,15 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, const std::string platform_json_contents = R"pb({ "interfaces": { - "Ethernet0": { + "Ethernet1/1/1": { "default_brkout_mode": "1x400G", "breakout_modes": "1x400G, 2x200G[100G,40G]" }, - "Ethernet8": { + "Ethernet1/2/1": { "default_brkout_mode": "2x200G", "breakout_modes": "1x400G, 2x200G[100G,40G]" }, - "Ethernet12": { "breakout_modes": "1x200G[100G,40G]" } + "Ethernet1/2/5": { "breakout_modes": "1x200G[100G,40G]" } } } )pb"; @@ -436,7 +436,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, update { path { elem { name: "interfaces" } } val { - json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet0\",\"state\":{\"oper-status\":\"DOWN\",\"openconfig-p4rt:id\": 1}}, {\"name\":\"Ethernet8\",\"state\":{\"oper-status\":\"DOWN\",\"openconfig-p4rt:id\": 2}}]}}" + json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet1/1/1\",\"state\":{\"oper-status\":\"DOWN\",\"openconfig-p4rt:id\": 1}}, {\"name\":\"Ethernet1/2/1\",\"state\":{\"oper-status\":\"DOWN\",\"openconfig-p4rt:id\": 2}}]}}" } } } @@ -457,15 +457,15 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, const std::string platform_json_contents = R"pb({ "interfaces": { - "Ethernet0": { + "Ethernet1/1/1": { "default_brkout_mode": "1x400G", "breakout_modes": "1x400G, 2x200G[100G,40G]" }, - "Ethernet8": { + "Ethernet1/2/1": { "default_brkout_mode": "2x200G", "breakout_modes": "1x400G, 2x200G[100G,40G]" }, - "Ethernet12": { "breakout_modes": "1x200G[100G,40G]" } + "Ethernet1/2/5": { "breakout_modes": "1x200G[100G,40G]" } } } )pb"; @@ -483,7 +483,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, update { path { elem { name: "interfaces" } } val { - json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet0\",\"state\":{\"oper-status\":\"UP\"}}, {\"name\":\"Ethernet8\",\"state\":{\"oper-status\":\"UP\"}}]}}" + json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet1/1/1\",\"state\":{\"oper-status\":\"UP\"}}, {\"name\":\"Ethernet1/2/1\",\"state\":{\"oper-status\":\"UP\"}}]}}" } } } @@ -519,7 +519,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, update { path { elem { name: "interfaces" } } val { - json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet0\",\"state\":{\"oper-status\":\"UP\"}}]}}" + json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet1/1/1\",\"state\":{\"oper-status\":\"UP\"}}]}}" } } } @@ -553,7 +553,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, update { path { elem { name: "interfaces" } } val { - json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet0\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 1}}]}}" + json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet1/1/1\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 1}}]}}" } } } @@ -565,7 +565,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, pins_test::GetRandomPortWithSupportedBreakoutModes( *mock_gnmi_stub_ptr, platform_json_contents), StatusIs(absl::StatusCode::kInternal, - HasSubstr("Ethernet0 entry not found in platform.json"))); + HasSubstr("Ethernet1/1/1 entry not found in platform.json"))); } TEST_F(GNMIThinkitInterfaceUtilityTest, @@ -574,7 +574,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, const std::string platform_json_contents = R"pb({ "interfaces": { - "Ethernet0": { "breakout_modes": "1x400G, 2x200G[100G,40G]" } + "Ethernet1/1/1": { "breakout_modes": "1x400G, 2x200G[100G,40G]" } } } )pb"; @@ -592,7 +592,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, update { path { elem { name: "interfaces" } } val { - json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet0\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 1}}]}}" + json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet1/1/1\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 1}}]}}" } } } @@ -604,7 +604,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, *mock_gnmi_stub_ptr, platform_json_contents), StatusIs(absl::StatusCode::kInternal, HasSubstr("Default breakout mode not found for " - "Ethernet0 in platform.json"))); + "Ethernet1/1/1 in platform.json"))); } TEST_F( @@ -613,7 +613,9 @@ TEST_F( auto mock_gnmi_stub_ptr = absl::make_unique(); const std::string platform_json_contents = R"pb({ - "interfaces": { "Ethernet0": { "default_brkout_mode": "1x400G" } } + "interfaces": { + "Ethernet1/1/1": { "default_brkout_mode": "1x400G" } + } } )pb"; gnmi::GetRequest req; @@ -630,7 +632,7 @@ TEST_F( update { path { elem { name: "interfaces" } } val { - json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet0\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 1}}]}}" + json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet1/1/1\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 1}}]}}" } } } @@ -641,9 +643,10 @@ TEST_F( EXPECT_THAT( pins_test::GetRandomPortWithSupportedBreakoutModes( *mock_gnmi_stub_ptr, platform_json_contents), - StatusIs(absl::StatusCode::kInternal, - HasSubstr( - "Breakout modes not found for Ethernet0 in platform.json"))); + StatusIs( + absl::StatusCode::kInternal, + HasSubstr( + "Breakout modes not found for Ethernet1/1/1 in platform.json"))); } TEST_F( @@ -653,11 +656,11 @@ TEST_F( const std::string platform_json_contents = R"pb({ "interfaces": { - "Ethernet0": { + "Ethernet1/1/1": { "default_brkout_mode": "1x400G", "breakout_modes": "1x400G" }, - "Ethernet8": { + "Ethernet1/2/1": { "default_brkout_mode": "1x400G", "breakout_modes": "1x400G" } @@ -678,7 +681,7 @@ TEST_F( update { path { elem { name: "interfaces" } } val { - json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet0\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 1}},{\"name\":\"Ethernet8\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 2}}]}}" + json_ietf_val: "{\"openconfig-interfaces:interfaces\":{\"interface\":[{\"name\":\"Ethernet1/1/1\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 1}},{\"name\":\"Ethernet1/2/1\",\"state\":{\"oper-status\":\"UP\",\"openconfig-p4rt:id\": 2}}]}}" } } } @@ -697,68 +700,72 @@ TEST_F( TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetExpectedPortInfoForBreakoutModeUnchannelizedBreakoutModeSuccess) { - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; absl::string_view breakout_mode = "1x400G"; auto breakout_info = pins_test::GetExpectedPortInfoForBreakoutMode(port, breakout_mode); ASSERT_OK(breakout_info.status()); - EXPECT_EQ(breakout_info.value()["Ethernet0"].physical_channels, + EXPECT_EQ(breakout_info.value()["Ethernet1/1/1"].physical_channels, "[0,1,2,3,4,5,6,7]"); } TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetExpectedPortInfoForBreakoutModeChannelizedBreakoutModeSuccess) { - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; absl::string_view breakout_mode = "2x200G"; auto breakout_info = pins_test::GetExpectedPortInfoForBreakoutMode(port, breakout_mode); ASSERT_OK(breakout_info.status()); - EXPECT_EQ(breakout_info.value()["Ethernet0"].physical_channels, "[0,1,2,3]"); - EXPECT_EQ(breakout_info.value()["Ethernet4"].physical_channels, "[4,5,6,7]"); + EXPECT_EQ(breakout_info.value()["Ethernet1/1/1"].physical_channels, + "[0,1,2,3]"); + EXPECT_EQ(breakout_info.value()["Ethernet1/1/5"].physical_channels, + "[4,5,6,7]"); } TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetExpectedPortInfoForBreakoutModeMixedBreakoutModeSuccess) { - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; absl::string_view breakout_mode = "1x200G(4)+2x100G(4)"; auto breakout_info = pins_test::GetExpectedPortInfoForBreakoutMode(port, breakout_mode); ASSERT_OK(breakout_info.status()); - EXPECT_EQ(breakout_info.value()["Ethernet0"].physical_channels, "[0,1,2,3]"); - EXPECT_EQ(breakout_info.value()["Ethernet4"].physical_channels, "[4,5]"); - EXPECT_EQ(breakout_info.value()["Ethernet6"].physical_channels, "[6,7]"); + EXPECT_EQ(breakout_info.value()["Ethernet1/1/1"].physical_channels, + "[0,1,2,3]"); + EXPECT_EQ(breakout_info.value()["Ethernet1/1/5"].physical_channels, "[4,5]"); + EXPECT_EQ(breakout_info.value()["Ethernet1/1/7"].physical_channels, "[6,7]"); } TEST_F( GNMIThinkitInterfaceUtilityTest, TestGetExpectedPortInfoForBreakoutModeAlternatedMixedBreakoutModeSuccess) { - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; absl::string_view breakout_mode = "2x100G(4)+1x200G(4)"; auto breakout_info = pins_test::GetExpectedPortInfoForBreakoutMode(port, breakout_mode); ASSERT_OK(breakout_info.status()); - EXPECT_EQ(breakout_info.value()["Ethernet0"].physical_channels, "[0,1]"); - EXPECT_EQ(breakout_info.value()["Ethernet2"].physical_channels, "[2,3]"); - EXPECT_EQ(breakout_info.value()["Ethernet4"].physical_channels, "[4,5,6,7]"); + EXPECT_EQ(breakout_info.value()["Ethernet1/1/1"].physical_channels, "[0,1]"); + EXPECT_EQ(breakout_info.value()["Ethernet1/1/3"].physical_channels, "[2,3]"); + EXPECT_EQ(breakout_info.value()["Ethernet1/1/5"].physical_channels, + "[4,5,6,7]"); } TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetExpectedPortInfoForBreakoutModeWithQuotesSuccess) { - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; absl::string_view breakout_mode = "\"1x400G\""; auto breakout_info = pins_test::GetExpectedPortInfoForBreakoutMode(port, breakout_mode); ASSERT_OK(breakout_info.status()); - EXPECT_EQ(breakout_info.value()["Ethernet0"].physical_channels, + EXPECT_EQ(breakout_info.value()["Ethernet1/1/1"].physical_channels, "[0,1,2,3,4,5,6,7]"); } TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetExpectedPortInfoForBreakoutModeEmptyBreakoutModeFailure) { - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; absl::string_view breakout_mode = ""; EXPECT_THAT( @@ -769,7 +776,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetExpectedPortInfoForBreakoutModePortNumberIntConversionFailure) { - const std::string port = "EthernetX"; + const std::string port = "Ethernet1/1/X"; absl::string_view breakout_mode = "1x400G"; EXPECT_THAT( @@ -780,18 +787,19 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetExpectedPortInfoForBreakoutModeNonParentPortFailure) { - const std::string port = "Ethernet4"; + const std::string port = "Ethernet1/2/5"; absl::string_view breakout_mode = "1x400G"; EXPECT_THAT( pins_test::GetExpectedPortInfoForBreakoutMode(port, breakout_mode), - StatusIs(absl::StatusCode::kInternal, - HasSubstr("Requested port (Ethernet4) is not a parent port"))); + StatusIs( + absl::StatusCode::kInvalidArgument, + HasSubstr("Requested port (Ethernet1/2/5) is not a parent port"))); } TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetExpectedPortInfoForBreakoutModeNumBreakoutsIntConversionFailure) { - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; absl::string_view breakout_mode = "InvalidNumBreakoutsx400G"; EXPECT_THAT( @@ -804,7 +812,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetExpectedPortInfoForBreakoutModeInvalidBreakoutModeFailure) { - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; absl::string_view breakout_mode = "3x200G(4)+2x100G(4)"; EXPECT_THAT( @@ -817,7 +825,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetBreakoutStateInfoForPortSuccess) { auto mock_gnmi_stub_ptr = absl::make_unique(); - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; const std::string breakout_mode = "1x400G"; gnmi::GetRequest physical_channels_req; ASSERT_TRUE(google::protobuf::TextFormat::ParseFromString( @@ -826,7 +834,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "physical-channel" } @@ -843,7 +851,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "physical-channel" } @@ -861,7 +869,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "oper-status" } @@ -878,7 +886,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "oper-status" } @@ -899,15 +907,15 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, auto breakout_state_info = pins_test::GetBreakoutStateInfoForPort( mock_gnmi_stub_ptr.get(), port, breakout_mode); ASSERT_OK(breakout_state_info.status()); - EXPECT_EQ(breakout_state_info.value()["Ethernet0"].physical_channels, + EXPECT_EQ(breakout_state_info.value()["Ethernet1/1/1"].physical_channels, "[0,1,2,3,4,5,6,7]"); - EXPECT_EQ(breakout_state_info.value()["Ethernet0"].oper_status, "\"UP\""); + EXPECT_EQ(breakout_state_info.value()["Ethernet1/1/1"].oper_status, "\"UP\""); } TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetBreakoutStateInfoForPortExpectedBreakoutInfoFailure) { auto mock_gnmi_stub_ptr = absl::make_unique(); - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; const std::string breakout_mode = ""; EXPECT_THAT(pins_test::GetBreakoutStateInfoForPort(mock_gnmi_stub_ptr.get(), port, breakout_mode), @@ -918,7 +926,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetBreakoutStateInfoForPortPhysicalChannelsGetFailure) { auto mock_gnmi_stub_ptr = absl::make_unique(); - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; const std::string breakout_mode = "1x400G"; gnmi::GetRequest physical_channels_req; ASSERT_TRUE(google::protobuf::TextFormat::ParseFromString( @@ -927,7 +935,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "physical-channel" } @@ -941,7 +949,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "oper-status" } @@ -958,7 +966,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "oper-status" } @@ -979,13 +987,13 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, port, breakout_mode), StatusIs(absl::StatusCode::kDeadlineExceeded, HasSubstr("Failed to get GNMI state path value for " - "physical-channels for port Ethernet0"))); + "physical-channels for port Ethernet1/1/1"))); } TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetBreakoutStateInfoForPortOperStatusGetFailure) { auto mock_gnmi_stub_ptr = absl::make_unique(); - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; const std::string breakout_mode = "1x400G"; gnmi::GetRequest oper_status_req; ASSERT_TRUE(google::protobuf::TextFormat::ParseFromString( @@ -994,7 +1002,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "oper-status" } @@ -1007,13 +1015,13 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, port, breakout_mode), StatusIs(absl::StatusCode::kDeadlineExceeded, HasSubstr("Failed to get GNMI state path value for " - "oper-status for port Ethernet0"))); + "oper-status for port Ethernet1/1/1"))); } TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetBreakoutModeConfigFromStringUnchannelizedBreakoutModeSuccess) { const std::string port_index = "1"; - const std::string intf_name = "Ethernet0"; + const std::string intf_name = "Ethernet1/1/1"; const std::string breakout_mode = "1x400G"; gnmi::SetRequest req, expected_breakout_config; const std::string expected_breakout_config_str = @@ -1022,7 +1030,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, replace { path {} val { - json_ietf_val: "{\n \"openconfig-interfaces:interfaces\": { \"interface\": [ {\n \"config\": {\n \"enabled\": true,\n \"loopback-mode\": false,\n \"mtu\": 9216,\n \"name\": \"Ethernet0\",\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n \"name\": \"Ethernet0\",\n \"openconfig-if-ethernet:ethernet\": {\n \"config\": { \"port-speed\": \"openconfig-if-ethernet:SPEED_400GB\" }\n },\n \"subinterfaces\": {\n \"subinterface\":\n [ {\n \"config\": { \"index\": 0 },\n \"index\": 0,\n \"openconfig-if-ip:ipv6\": {\n \"unnumbered\": { \"config\": { \"enabled\": true } }\n }\n }]\n }\n }\n ] },\n \"openconfig-platform:components\": {\n \"component\":\n [ {\n \"name\": \"1/1\",\n \"config\": { \"name\": \"1/1\" },\n \"port\": {\n \"config\": { \"port-id\": 1 },\n \"breakout-mode\": { \"groups\": { \"group\": [ {\n \"config\": {\n \"breakout-speed\": \"openconfig-if-ethernet:SPEED_400GB\",\n \"index\": 0,\n \"num-breakouts\": 1,\n \"num-physical-channels\": 8\n },\n \"index\": 0\n } ] } }\n }\n }]\n }\n }" + json_ietf_val: "{\n \"openconfig-interfaces:interfaces\": { \"interface\": [ {\n \"config\": {\n \"enabled\": true,\n \"loopback-mode\": false,\n \"mtu\": 9216,\n \"name\": \"Ethernet1/1/1\",\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n \"name\": \"Ethernet1/1/1\",\n \"openconfig-if-ethernet:ethernet\": {\n \"config\": { \"port-speed\": \"openconfig-if-ethernet:SPEED_400GB\" }\n },\n \"subinterfaces\": {\n \"subinterface\":\n [ {\n \"config\": { \"index\": 0 },\n \"index\": 0,\n \"openconfig-if-ip:ipv6\": {\n \"unnumbered\": { \"config\": { \"enabled\": true } }\n }\n }]\n }\n }\n ] },\n \"openconfig-platform:components\": {\n \"component\":\n [ {\n \"name\": \"1/1\",\n \"config\": { \"name\": \"1/1\" },\n \"port\": {\n \"config\": { \"port-id\": 1 },\n \"breakout-mode\": { \"groups\": { \"group\": [ {\n \"config\": {\n \"breakout-speed\": \"openconfig-if-ethernet:SPEED_400GB\",\n \"index\": 0,\n \"num-breakouts\": 1,\n \"num-physical-channels\": 8\n },\n \"index\": 0\n } ] } }\n }\n }]\n }\n }" } })pb"; ASSERT_TRUE(google::protobuf::TextFormat::ParseFromString( @@ -1054,7 +1062,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetBreakoutModeConfigFromStringChannelizedBreakoutModeSuccess) { const std::string port_index = "1"; - const std::string intf_name = "Ethernet0"; + const std::string intf_name = "Ethernet1/1/1"; const std::string breakout_mode = "2x200G"; gnmi::SetRequest req, expected_breakout_config; const std::string expected_breakout_config_str = R"pb( @@ -1062,7 +1070,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, replace { path {} val { - json_ietf_val: "{\n \"openconfig-interfaces:interfaces\": { \"interface\": [ {\n \"config\": {\n \"enabled\": true,\n \"loopback-mode\": false,\n \"mtu\": 9216,\n \"name\": \"Ethernet0\",\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n \"name\": \"Ethernet0\",\n \"openconfig-if-ethernet:ethernet\": {\n \"config\": { \"port-speed\": \"openconfig-if-ethernet:SPEED_200GB\" }\n },\n \"subinterfaces\": {\n \"subinterface\":\n [ {\n \"config\": { \"index\": 0 },\n \"index\": 0,\n \"openconfig-if-ip:ipv6\": {\n \"unnumbered\": { \"config\": { \"enabled\": true } }\n }\n }]\n }\n }\n ,{\n \"config\": {\n \"enabled\": true,\n \"loopback-mode\": false,\n \"mtu\": 9216,\n \"name\": \"Ethernet4\",\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n \"name\": \"Ethernet4\",\n \"openconfig-if-ethernet:ethernet\": {\n \"config\": { \"port-speed\": \"openconfig-if-ethernet:SPEED_200GB\" }\n },\n \"subinterfaces\": {\n \"subinterface\":\n [ {\n \"config\": { \"index\": 0 },\n \"index\": 0,\n \"openconfig-if-ip:ipv6\": {\n \"unnumbered\": { \"config\": { \"enabled\": true } }\n }\n }]\n }\n }\n ] },\n \"openconfig-platform:components\": {\n \"component\":\n [ {\n \"name\": \"1/1\",\n \"config\": { \"name\": \"1/1\" },\n \"port\": {\n \"config\": { \"port-id\": 1 },\n \"breakout-mode\": { \"groups\": { \"group\": [ {\n \"config\": {\n \"breakout-speed\": \"openconfig-if-ethernet:SPEED_200GB\",\n \"index\": 0,\n \"num-breakouts\": 2,\n \"num-physical-channels\": 4\n },\n \"index\": 0\n } ] } }\n }\n }]\n }\n }" + json_ietf_val: "{\n \"openconfig-interfaces:interfaces\": { \"interface\": [ {\n \"config\": {\n \"enabled\": true,\n \"loopback-mode\": false,\n \"mtu\": 9216,\n \"name\": \"Ethernet1/1/1\",\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n \"name\": \"Ethernet1/1/1\",\n \"openconfig-if-ethernet:ethernet\": {\n \"config\": { \"port-speed\": \"openconfig-if-ethernet:SPEED_200GB\" }\n },\n \"subinterfaces\": {\n \"subinterface\":\n [ {\n \"config\": { \"index\": 0 },\n \"index\": 0,\n \"openconfig-if-ip:ipv6\": {\n \"unnumbered\": { \"config\": { \"enabled\": true } }\n }\n }]\n }\n }\n ,{\n \"config\": {\n \"enabled\": true,\n \"loopback-mode\": false,\n \"mtu\": 9216,\n \"name\": \"Ethernet1/1/5\",\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n \"name\": \"Ethernet1/1/5\",\n \"openconfig-if-ethernet:ethernet\": {\n \"config\": { \"port-speed\": \"openconfig-if-ethernet:SPEED_200GB\" }\n },\n \"subinterfaces\": {\n \"subinterface\":\n [ {\n \"config\": { \"index\": 0 },\n \"index\": 0,\n \"openconfig-if-ip:ipv6\": {\n \"unnumbered\": { \"config\": { \"enabled\": true } }\n }\n }]\n }\n }\n ] },\n \"openconfig-platform:components\": {\n \"component\":\n [ {\n \"name\": \"1/1\",\n \"config\": { \"name\": \"1/1\" },\n \"port\": {\n \"config\": { \"port-id\": 1 },\n \"breakout-mode\": { \"groups\": { \"group\": [ {\n \"config\": {\n \"breakout-speed\": \"openconfig-if-ethernet:SPEED_200GB\",\n \"index\": 0,\n \"num-breakouts\": 2,\n \"num-physical-channels\": 4\n },\n \"index\": 0\n } ] } }\n }\n }]\n }\n }" } } )pb"; @@ -1095,7 +1103,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetBreakoutModeConfigFromStringMixedBreakoutModeSuccess) { const std::string port_index = "1"; - const std::string intf_name = "Ethernet0"; + const std::string intf_name = "Ethernet1/1/1"; const std::string breakout_mode = "1x200G(4)+2x100G(4)"; gnmi::SetRequest req, expected_breakout_config; const std::string expected_breakout_config_str = R"pb( @@ -1103,7 +1111,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, replace { path {} val { - json_ietf_val: "{\n \"openconfig-interfaces:interfaces\": { \"interface\": [ {\n \"config\": {\n \"enabled\": true,\n \"loopback-mode\": false,\n \"mtu\": 9216,\n \"name\": \"Ethernet0\",\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n \"name\": \"Ethernet0\",\n \"openconfig-if-ethernet:ethernet\": {\n \"config\": { \"port-speed\": \"openconfig-if-ethernet:SPEED_200GB\" }\n },\n \"subinterfaces\": {\n \"subinterface\":\n [ {\n \"config\": { \"index\": 0 },\n \"index\": 0,\n \"openconfig-if-ip:ipv6\": {\n \"unnumbered\": { \"config\": { \"enabled\": true } }\n }\n }]\n }\n }\n ,{\n \"config\": {\n \"enabled\": true,\n \"loopback-mode\": false,\n \"mtu\": 9216,\n \"name\": \"Ethernet4\",\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n \"name\": \"Ethernet4\",\n \"openconfig-if-ethernet:ethernet\": {\n \"config\": { \"port-speed\": \"openconfig-if-ethernet:SPEED_100GB\" }\n },\n \"subinterfaces\": {\n \"subinterface\":\n [ {\n \"config\": { \"index\": 0 },\n \"index\": 0,\n \"openconfig-if-ip:ipv6\": {\n \"unnumbered\": { \"config\": { \"enabled\": true } }\n }\n }]\n }\n }\n ,{\n \"config\": {\n \"enabled\": true,\n \"loopback-mode\": false,\n \"mtu\": 9216,\n \"name\": \"Ethernet6\",\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n \"name\": \"Ethernet6\",\n \"openconfig-if-ethernet:ethernet\": {\n \"config\": { \"port-speed\": \"openconfig-if-ethernet:SPEED_100GB\" }\n },\n \"subinterfaces\": {\n \"subinterface\":\n [ {\n \"config\": { \"index\": 0 },\n \"index\": 0,\n \"openconfig-if-ip:ipv6\": {\n \"unnumbered\": { \"config\": { \"enabled\": true } }\n }\n }]\n }\n }\n ] },\n \"openconfig-platform:components\": {\n \"component\":\n [ {\n \"name\": \"1/1\",\n \"config\": { \"name\": \"1/1\" },\n \"port\": {\n \"config\": { \"port-id\": 1 },\n \"breakout-mode\": { \"groups\": { \"group\": [ {\n \"config\": {\n \"breakout-speed\": \"openconfig-if-ethernet:SPEED_200GB\",\n \"index\": 0,\n \"num-breakouts\": 1,\n \"num-physical-channels\": 4\n },\n \"index\": 0\n },{\n \"config\": {\n \"breakout-speed\": \"openconfig-if-ethernet:SPEED_100GB\",\n \"index\": 1,\n \"num-breakouts\": 2,\n \"num-physical-channels\": 2\n },\n \"index\": 1\n } ] } }\n }\n }]\n }\n }" + json_ietf_val: "{\n \"openconfig-interfaces:interfaces\": { \"interface\": [ {\n \"config\": {\n \"enabled\": true,\n \"loopback-mode\": false,\n \"mtu\": 9216,\n \"name\": \"Ethernet1/1/1\",\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n \"name\": \"Ethernet1/1/1\",\n \"openconfig-if-ethernet:ethernet\": {\n \"config\": { \"port-speed\": \"openconfig-if-ethernet:SPEED_200GB\" }\n },\n \"subinterfaces\": {\n \"subinterface\":\n [ {\n \"config\": { \"index\": 0 },\n \"index\": 0,\n \"openconfig-if-ip:ipv6\": {\n \"unnumbered\": { \"config\": { \"enabled\": true } }\n }\n }]\n }\n }\n ,{\n \"config\": {\n \"enabled\": true,\n \"loopback-mode\": false,\n \"mtu\": 9216,\n \"name\": \"Ethernet1/1/5\",\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n \"name\": \"Ethernet1/1/5\",\n \"openconfig-if-ethernet:ethernet\": {\n \"config\": { \"port-speed\": \"openconfig-if-ethernet:SPEED_100GB\" }\n },\n \"subinterfaces\": {\n \"subinterface\":\n [ {\n \"config\": { \"index\": 0 },\n \"index\": 0,\n \"openconfig-if-ip:ipv6\": {\n \"unnumbered\": { \"config\": { \"enabled\": true } }\n }\n }]\n }\n }\n ,{\n \"config\": {\n \"enabled\": true,\n \"loopback-mode\": false,\n \"mtu\": 9216,\n \"name\": \"Ethernet1/1/7\",\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n \"name\": \"Ethernet1/1/7\",\n \"openconfig-if-ethernet:ethernet\": {\n \"config\": { \"port-speed\": \"openconfig-if-ethernet:SPEED_100GB\" }\n },\n \"subinterfaces\": {\n \"subinterface\":\n [ {\n \"config\": { \"index\": 0 },\n \"index\": 0,\n \"openconfig-if-ip:ipv6\": {\n \"unnumbered\": { \"config\": { \"enabled\": true } }\n }\n }]\n }\n }\n ] },\n \"openconfig-platform:components\": {\n \"component\":\n [ {\n \"name\": \"1/1\",\n \"config\": { \"name\": \"1/1\" },\n \"port\": {\n \"config\": { \"port-id\": 1 },\n \"breakout-mode\": { \"groups\": { \"group\": [ {\n \"config\": {\n \"breakout-speed\": \"openconfig-if-ethernet:SPEED_200GB\",\n \"index\": 0,\n \"num-breakouts\": 1,\n \"num-physical-channels\": 4\n },\n \"index\": 0\n },{\n \"config\": {\n \"breakout-speed\": \"openconfig-if-ethernet:SPEED_100GB\",\n \"index\": 1,\n \"num-breakouts\": 2,\n \"num-physical-channels\": 2\n },\n \"index\": 1\n } ] } }\n }\n }]\n }\n }" } } )pb"; @@ -1136,7 +1144,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetBreakoutModeConfigFromStringCopperPortSuccess) { const std::string port_index = "1"; - const std::string intf_name = "Ethernet0"; + const std::string intf_name = "Ethernet1/1/1"; const std::string breakout_mode = "1x200G(4)+2x100G(4)"; gnmi::SetRequest req, expected_breakout_config; const std::string expected_breakout_config_str = R"pb( @@ -1144,7 +1152,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, replace { path {} val { - json_ietf_val: "{\n \"openconfig-interfaces:interfaces\": { \"interface\": [ {\n \"config\": {\n \"enabled\": true,\n \"loopback-mode\": false,\n \"mtu\": 9216,\n \"name\": \"Ethernet0\",\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n \"name\": \"Ethernet0\",\n \"openconfig-if-ethernet:ethernet\": {\n \"config\": {\n \"port-speed\": \"openconfig-if-ethernet:SPEED_200GB\",\n \"standalone-link-training\": true\n }\n },\n \"subinterfaces\": {\n \"subinterface\":\n [ {\n \"config\": { \"index\": 0 },\n \"index\": 0,\n \"openconfig-if-ip:ipv6\": {\n \"unnumbered\": { \"config\": { \"enabled\": true } }\n }\n }]\n }\n }\n ,{\n \"config\": {\n \"enabled\": true,\n \"loopback-mode\": false,\n \"mtu\": 9216,\n \"name\": \"Ethernet4\",\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n \"name\": \"Ethernet4\",\n \"openconfig-if-ethernet:ethernet\": {\n \"config\": {\n \"port-speed\": \"openconfig-if-ethernet:SPEED_100GB\",\n \"standalone-link-training\": true\n }\n },\n \"subinterfaces\": {\n \"subinterface\":\n [ {\n \"config\": { \"index\": 0 },\n \"index\": 0,\n \"openconfig-if-ip:ipv6\": {\n \"unnumbered\": { \"config\": { \"enabled\": true } }\n }\n }]\n }\n }\n ,{\n \"config\": {\n \"enabled\": true,\n \"loopback-mode\": false,\n \"mtu\": 9216,\n \"name\": \"Ethernet6\",\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n \"name\": \"Ethernet6\",\n \"openconfig-if-ethernet:ethernet\": {\n \"config\": {\n \"port-speed\": \"openconfig-if-ethernet:SPEED_100GB\",\n \"standalone-link-training\": true\n }\n },\n \"subinterfaces\": {\n \"subinterface\":\n [ {\n \"config\": { \"index\": 0 },\n \"index\": 0,\n \"openconfig-if-ip:ipv6\": {\n \"unnumbered\": { \"config\": { \"enabled\": true } }\n }\n }]\n }\n }\n ] },\n \"openconfig-platform:components\": {\n \"component\":\n [ {\n \"name\": \"1/1\",\n \"config\": { \"name\": \"1/1\" },\n \"port\": {\n \"config\": { \"port-id\": 1 },\n \"breakout-mode\": { \"groups\": { \"group\": [ {\n \"config\": {\n \"breakout-speed\": \"openconfig-if-ethernet:SPEED_200GB\",\n \"index\": 0,\n \"num-breakouts\": 1,\n \"num-physical-channels\": 4\n },\n \"index\": 0\n },{\n \"config\": {\n \"breakout-speed\": \"openconfig-if-ethernet:SPEED_100GB\",\n \"index\": 1,\n \"num-breakouts\": 2,\n \"num-physical-channels\": 2\n },\n \"index\": 1\n } ] } }\n }\n }]\n }\n }" + json_ietf_val: "{\n \"openconfig-interfaces:interfaces\": { \"interface\": [ {\n \"config\": {\n \"enabled\": true,\n \"loopback-mode\": false,\n \"mtu\": 9216,\n \"name\": \"Ethernet1/1/1\",\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n \"name\": \"Ethernet1/1/1\",\n \"openconfig-if-ethernet:ethernet\": {\n \"config\": {\n \"port-speed\": \"openconfig-if-ethernet:SPEED_200GB\",\n \"standalone-link-training\": true\n }\n },\n \"subinterfaces\": {\n \"subinterface\":\n [ {\n \"config\": { \"index\": 0 },\n \"index\": 0,\n \"openconfig-if-ip:ipv6\": {\n \"unnumbered\": { \"config\": { \"enabled\": true } }\n }\n }]\n }\n }\n ,{\n \"config\": {\n \"enabled\": true,\n \"loopback-mode\": false,\n \"mtu\": 9216,\n \"name\": \"Ethernet1/1/5\",\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n \"name\": \"Ethernet1/1/5\",\n \"openconfig-if-ethernet:ethernet\": {\n \"config\": {\n \"port-speed\": \"openconfig-if-ethernet:SPEED_100GB\",\n \"standalone-link-training\": true\n }\n },\n \"subinterfaces\": {\n \"subinterface\":\n [ {\n \"config\": { \"index\": 0 },\n \"index\": 0,\n \"openconfig-if-ip:ipv6\": {\n \"unnumbered\": { \"config\": { \"enabled\": true } }\n }\n }]\n }\n }\n ,{\n \"config\": {\n \"enabled\": true,\n \"loopback-mode\": false,\n \"mtu\": 9216,\n \"name\": \"Ethernet1/1/7\",\n \"type\": \"iana-if-type:ethernetCsmacd\"\n },\n \"name\": \"Ethernet1/1/7\",\n \"openconfig-if-ethernet:ethernet\": {\n \"config\": {\n \"port-speed\": \"openconfig-if-ethernet:SPEED_100GB\",\n \"standalone-link-training\": true\n }\n },\n \"subinterfaces\": {\n \"subinterface\":\n [ {\n \"config\": { \"index\": 0 },\n \"index\": 0,\n \"openconfig-if-ip:ipv6\": {\n \"unnumbered\": { \"config\": { \"enabled\": true } }\n }\n }]\n }\n }\n ] },\n \"openconfig-platform:components\": {\n \"component\":\n [ {\n \"name\": \"1/1\",\n \"config\": { \"name\": \"1/1\" },\n \"port\": {\n \"config\": { \"port-id\": 1 },\n \"breakout-mode\": { \"groups\": { \"group\": [ {\n \"config\": {\n \"breakout-speed\": \"openconfig-if-ethernet:SPEED_200GB\",\n \"index\": 0,\n \"num-breakouts\": 1,\n \"num-physical-channels\": 4\n },\n \"index\": 0\n },{\n \"config\": {\n \"breakout-speed\": \"openconfig-if-ethernet:SPEED_100GB\",\n \"index\": 1,\n \"num-breakouts\": 2,\n \"num-physical-channels\": 2\n },\n \"index\": 1\n } ] } }\n }\n }]\n }\n }" } } )pb"; @@ -1177,7 +1185,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetBreakoutModeConfigFromStringIntConversionFailure) { const std::string port_index = "1"; - const std::string intf_name = "Ethernet0"; + const std::string intf_name = "Ethernet1/1/1"; const std::string breakout_mode = "Xx400G"; auto mock_gnmi_stub_ptr = absl::make_unique(); gnmi::GetRequest get_xcvrd_req; @@ -1209,7 +1217,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetBreakoutModeConfigFromStringIsCopperPortFailure) { const std::string port_index = "1"; - const std::string intf_name = "Ethernet0"; + const std::string intf_name = "Ethernet1/1/1"; const std::string breakout_mode = "Xx400G"; auto mock_gnmi_stub_ptr = absl::make_unique(); gnmi::GetRequest get_xcvrd_req; @@ -1219,7 +1227,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "transceiver" } @@ -1234,20 +1242,34 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, req, mock_gnmi_stub_ptr.get(), port_index, intf_name, breakout_mode), StatusIs(absl::StatusCode::kDeadlineExceeded, HasSubstr("Failed to get GNMI state path value for port " - "transceiver for port Ethernet0"))); + "transceiver for port Ethernet1/1/1"))); +} + +TEST_F(GNMIThinkitInterfaceUtilityTest, + TestGetBreakoutModeConfigFromStringInvalidLaneNumberFailure) { + const std::string port_index = "1"; + const std::string intf_name = "Ethernet1/1/X"; + const std::string breakout_mode = "1x400G"; + auto mock_gnmi_stub_ptr = absl::make_unique(); + gnmi::SetRequest req; + EXPECT_THAT( + pins_test::GetBreakoutModeConfigFromString( + req, mock_gnmi_stub_ptr.get(), port_index, intf_name, breakout_mode), + StatusIs(absl::StatusCode::kInternal, + HasSubstr("Failed to convert string (X) to integer"))); } TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetNonExistingPortsAfterBreakoutForBreakoutAppliedSuccess) { absl::flat_hash_map orig_breakout_info; - orig_breakout_info["Ethernet0"] = + orig_breakout_info["Ethernet1/1/1"] = pins_test::PortBreakoutInfo{"[0,1,2,3,4,5,6,7]", pins_test::kStateUp}; absl::flat_hash_map new_breakout_info; - new_breakout_info["Ethernet0"] = + new_breakout_info["Ethernet1/1/1"] = pins_test::PortBreakoutInfo{"[0,1,2,3]", pins_test::kStateUp}; - new_breakout_info["Ethernet4"] = + new_breakout_info["Ethernet1/2/5"] = pins_test::PortBreakoutInfo{"[4,5,6,7]", pins_test::kStateUp}; std::vector expected_non_existing_ports; @@ -1260,16 +1282,16 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetNonExistingPortsAfterBreakoutForBreakoutAppliedAlternateSuccess) { absl::flat_hash_map orig_breakout_info; - orig_breakout_info["Ethernet0"] = + orig_breakout_info["Ethernet1/1/1"] = pins_test::PortBreakoutInfo{"[0,1,2,3]", pins_test::kStateUp}; - orig_breakout_info["Ethernet4"] = + orig_breakout_info["Ethernet1/2/5"] = pins_test::PortBreakoutInfo{"[4,5,6,7]", pins_test::kStateUp}; absl::flat_hash_map new_breakout_info; - new_breakout_info["Ethernet0"] = + new_breakout_info["Ethernet1/1/1"] = pins_test::PortBreakoutInfo{"[0,1,2,3,4,5,6,7]", pins_test::kStateUp}; - std::vector expected_non_existing_ports{"Ethernet4"}; + std::vector expected_non_existing_ports{"Ethernet1/2/5"}; EXPECT_THAT(GetNonExistingPortsAfterBreakout(orig_breakout_info, new_breakout_info, true), ContainerEq(expected_non_existing_ports)); @@ -1279,16 +1301,16 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetNonExistingPortsAfterBreakoutForBreakoutNotAppliedSuccess) { absl::flat_hash_map orig_breakout_info; - orig_breakout_info["Ethernet0"] = + orig_breakout_info["Ethernet1/1/1"] = pins_test::PortBreakoutInfo{"[0,1,2,3,4,5,6,7]", pins_test::kStateUp}; absl::flat_hash_map new_breakout_info; - new_breakout_info["Ethernet0"] = + new_breakout_info["Ethernet1/1/1"] = pins_test::PortBreakoutInfo{"[0,1,2,3]", pins_test::kStateDown}; - new_breakout_info["Ethernet4"] = + new_breakout_info["Ethernet1/2/5"] = pins_test::PortBreakoutInfo{"[4,5,6,7]", pins_test::kStateDown}; - std::vector expected_non_existing_ports{"Ethernet4"}; + std::vector expected_non_existing_ports{"Ethernet1/2/5"}; EXPECT_THAT(GetNonExistingPortsAfterBreakout(orig_breakout_info, new_breakout_info, false), ContainerEq(expected_non_existing_ports)); @@ -1299,13 +1321,13 @@ TEST_F( TestGetNonExistingPortsAfterBreakoutForBreakoutNotAppliedAlternateSuccess) { absl::flat_hash_map orig_breakout_info; - orig_breakout_info["Ethernet0"] = + orig_breakout_info["Ethernet1/1/1"] = pins_test::PortBreakoutInfo{"[0,1,2,3]", pins_test::kStateUp}; - orig_breakout_info["Ethernet4"] = + orig_breakout_info["Ethernet1/2/5"] = pins_test::PortBreakoutInfo{"[4,5,6,7]", pins_test::kStateUp}; absl::flat_hash_map new_breakout_info; - new_breakout_info["Ethernet0"] = + new_breakout_info["Ethernet1/1/1"] = pins_test::PortBreakoutInfo{"[0,1,2,3,4,5,6,7]", pins_test::kStateDown}; std::vector expected_non_existing_ports{}; @@ -1332,7 +1354,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, auto mock_gnmi_stub_ptr = absl::make_unique(); absl::flat_hash_map expected_port_info; - expected_port_info["Ethernet0"] = + expected_port_info["Ethernet1/1/1"] = pins_test::PortBreakoutInfo{"[0,1,2,3,4,5,6,7]", pins_test::kStateUp}; std::vector non_existing_port_list; gnmi::GetRequest oper_status_req; @@ -1342,7 +1364,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "oper-status" } @@ -1359,7 +1381,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "oper-status" } @@ -1376,11 +1398,12 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, EXPECT_THAT( pins_test::ValidateBreakoutState( mock_gnmi_stub_ptr.get(), expected_port_info, non_existing_port_list), - StatusIs(absl::StatusCode::kInternal, - HasSubstr(absl::StrCat( - "Port oper-status match failed for port Ethernet0. got: \"", - pins_test::kStateDown, - "\", want:", expected_port_info["Ethernet0"].oper_status)))); + StatusIs( + absl::StatusCode::kInternal, + HasSubstr(absl::StrCat( + "Port oper-status match failed for port Ethernet1/1/1. got: \"", + pins_test::kStateDown, + "\", want:", expected_port_info["Ethernet1/1/1"].oper_status)))); } TEST_F(GNMIThinkitInterfaceUtilityTest, @@ -1388,7 +1411,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, auto mock_gnmi_stub_ptr = absl::make_unique(); absl::flat_hash_map expected_port_info; - expected_port_info["Ethernet0"] = + expected_port_info["Ethernet1/1/1"] = pins_test::PortBreakoutInfo{"[0,1,2,3]", pins_test::kStateUp}; std::vector non_existing_port_list; gnmi::GetRequest oper_status_req; @@ -1398,7 +1421,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "oper-status" } @@ -1415,7 +1438,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "oper-status" } @@ -1433,7 +1456,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "physical-channel" } @@ -1450,7 +1473,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "physical-channel" } @@ -1473,9 +1496,9 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, mock_gnmi_stub_ptr.get(), expected_port_info, non_existing_port_list), StatusIs(absl::StatusCode::kInternal, HasSubstr(absl::StrCat( - "Physical channel match failed for port Ethernet0. got: " + "Physical channel match failed for port Ethernet1/1/1. got: " "[0,1,2,3,4,5,6,7], want: ", - expected_port_info["Ethernet0"].physical_channels)))); + expected_port_info["Ethernet1/1/1"].physical_channels)))); } TEST_F(GNMIThinkitInterfaceUtilityTest, @@ -1483,9 +1506,9 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, auto mock_gnmi_stub_ptr = absl::make_unique(); absl::flat_hash_map expected_port_info; - expected_port_info["Ethernet0"] = + expected_port_info["Ethernet1/1/1"] = pins_test::PortBreakoutInfo{"[0,1,2,3,4,5,6,7]", pins_test::kStateUp}; - std::vector non_existing_port_list{"Ethernet0"}; + std::vector non_existing_port_list{"Ethernet1/1/1"}; gnmi::GetRequest oper_status_req; ASSERT_TRUE(google::protobuf::TextFormat::ParseFromString( R"pb(prefix { origin: "openconfig" } @@ -1493,7 +1516,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "oper-status" } @@ -1510,7 +1533,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "oper-status" } @@ -1528,7 +1551,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "physical-channel" } @@ -1545,7 +1568,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "physical-channel" } @@ -1568,7 +1591,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, pins_test::ValidateBreakoutState( mock_gnmi_stub_ptr.get(), expected_port_info, non_existing_port_list), StatusIs(absl::StatusCode::kInternal, - HasSubstr("Unexpected port (Ethernet0) found after " + HasSubstr("Unexpected port (Ethernet1/1/1) found after " "application of breakout mode"))); } @@ -1576,7 +1599,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TestValidateBreakoutStateSuccess) { auto mock_gnmi_stub_ptr = absl::make_unique(); absl::flat_hash_map expected_port_info; - expected_port_info["Ethernet0"] = + expected_port_info["Ethernet1/1/1"] = pins_test::PortBreakoutInfo{"[0,1,2,3,4,5,6,7]", pins_test::kStateUp}; std::vector non_existing_port_list{}; gnmi::GetRequest oper_status_req; @@ -1586,7 +1609,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TestValidateBreakoutStateSuccess) { elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "oper-status" } @@ -1603,7 +1626,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TestValidateBreakoutStateSuccess) { elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "oper-status" } @@ -1621,7 +1644,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TestValidateBreakoutStateSuccess) { elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "physical-channel" } @@ -1638,7 +1661,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TestValidateBreakoutStateSuccess) { elem { name: "interfaces" } elem { name: "interface" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "state" } elem { name: "physical-channel" } @@ -1664,9 +1687,9 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TestValidateBreakoutStateSuccess) { TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetPortIndexSuccess) { const std::string platform_json_contents = - R"pb({ "interfaces": { "Ethernet0": { "index": "1,1,1,1,1,1,1,1" } } } + R"pb({ "interfaces": { "Ethernet1/1/1": { "index": "1,1,1,1,1,1,1,1" } } } )pb"; - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; const std::string expected_port_index = "1"; EXPECT_THAT(pins_test::GetPortIndex(platform_json_contents, port), expected_port_index); @@ -1677,7 +1700,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, const std::string platform_json_contents = R"pb({} )pb"; - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; const std::string expected_port_index = ""; EXPECT_THAT(pins_test::GetPortIndex(platform_json_contents, port), StatusIs(absl::StatusCode::kInternal, @@ -1689,7 +1712,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, const std::string platform_json_contents = R"pb({ "interfaces": {} } )pb"; - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; const std::string expected_port_index = ""; EXPECT_THAT(pins_test::GetPortIndex(platform_json_contents, port), StatusIs(absl::StatusCode::kInternal, @@ -1699,9 +1722,9 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TEST_F(GNMIThinkitInterfaceUtilityTest, TestGetPortIndexIndexNotFoundFailure) { const std::string platform_json_contents = - R"pb({ "interfaces": { "Ethernet0": {} } } + R"pb({ "interfaces": { "Ethernet1/1/1": {} } } )pb"; - const std::string port = "Ethernet0"; + const std::string port = "Ethernet1/1/1"; const std::string expected_port_index = ""; EXPECT_THAT(pins_test::GetPortIndex(platform_json_contents, port), StatusIs(absl::StatusCode::kInternal, @@ -1721,28 +1744,20 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TEST_F(GNMIThinkitInterfaceUtilityTest, TestBreakoutResultsInSpeedChangeOnlySuccess) { - EXPECT_THAT(pins_test::BreakoutResultsInSpeedChangeOnly("Ethernet0", "1x400G", - "1x100G"), + EXPECT_THAT(pins_test::BreakoutResultsInSpeedChangeOnly("Ethernet1/1/1", + "1x400G", "1x100G"), true); EXPECT_THAT(pins_test::BreakoutResultsInSpeedChangeOnly( - "Ethernet0", "1x200G(4)+2x100G(4)", "1x100G(4)+2x40G(4)"), + "Ethernet1/1/1", "1x200G(4)+2x100G(4)", "1x100G(4)+2x40G(4)"), true); - EXPECT_THAT(pins_test::BreakoutResultsInSpeedChangeOnly("Ethernet0", "1x400G", - "2x200G"), + EXPECT_THAT(pins_test::BreakoutResultsInSpeedChangeOnly("Ethernet1/1/1", + "1x400G", "2x200G"), false); EXPECT_THAT(pins_test::BreakoutResultsInSpeedChangeOnly( - "Ethernet0", "1x200G(4)+2x40G(4)", "1x200G(4)+1x40G(4)"), + "Ethernet1/1/1", "1x200G(4)+2x40G(4)", "1x200G(4)+1x40G(4)"), false); } -TEST_F(GNMIThinkitInterfaceUtilityTest, - TestBreakoutResultsInSpeedChangeOnlyInvalidPortFailure) { - EXPECT_THAT(pins_test::BreakoutResultsInSpeedChangeOnly("EthernetX", "1x400G", - "1x100G"), - StatusIs(absl::StatusCode::kInternal, - HasSubstr("Failed to convert string (X) to integer"))); -} - TEST_F(GNMIThinkitInterfaceUtilityTest, TestIsCopperPortSuccessOpticPort) { auto mock_gnmi_stub_ptr = absl::make_unique(); gnmi::GetRequest req; @@ -1762,8 +1777,9 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TestIsCopperPortSuccessOpticPort) { EXPECT_CALL(*mock_gnmi_stub_ptr, Get(_, EqualsProto(cable_len_req), _)) .WillOnce( DoAll(SetArgPointee<2>(cable_len_resp), Return(grpc::Status::OK))); - EXPECT_THAT(pins_test::IsCopperPort(mock_gnmi_stub_ptr.get(), "Ethernet0"), - false); + EXPECT_THAT( + pins_test::IsCopperPort(mock_gnmi_stub_ptr.get(), "Ethernet1/1/1"), + false); } TEST_F(GNMIThinkitInterfaceUtilityTest, TestIsCopperPortSuccessCopperPort) { @@ -1785,8 +1801,8 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TestIsCopperPortSuccessCopperPort) { EXPECT_CALL(*mock_gnmi_stub_ptr, Get(_, EqualsProto(cable_len_req), _)) .WillOnce( DoAll(SetArgPointee<2>(cable_len_resp), Return(grpc::Status::OK))); - EXPECT_THAT(pins_test::IsCopperPort(mock_gnmi_stub_ptr.get(), "Ethernet0"), - true); + EXPECT_THAT( + pins_test::IsCopperPort(mock_gnmi_stub_ptr.get(), "Ethernet1/1/1"), true); } TEST_F(GNMIThinkitInterfaceUtilityTest, TestIsCopperPortTransceiverGetFailure) { @@ -1796,10 +1812,11 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TestIsCopperPortTransceiverGetFailure) { google::protobuf::TextFormat::ParseFromString(get_xcvrd_req_str, &req)); EXPECT_CALL(*mock_gnmi_stub_ptr, Get(_, EqualsProto(req), _)) .WillOnce(Return(grpc::Status(grpc::StatusCode::DEADLINE_EXCEEDED, ""))); - EXPECT_THAT(pins_test::IsCopperPort(mock_gnmi_stub_ptr.get(), "Ethernet0"), - StatusIs(absl::StatusCode::kDeadlineExceeded, - HasSubstr("Failed to get GNMI state path value for " - "port transceiver for port Ethernet0"))); + EXPECT_THAT( + pins_test::IsCopperPort(mock_gnmi_stub_ptr.get(), "Ethernet1/1/1"), + StatusIs(absl::StatusCode::kDeadlineExceeded, + HasSubstr("Failed to get GNMI state path value for " + "port transceiver for port Ethernet1/1/1"))); } TEST_F(GNMIThinkitInterfaceUtilityTest, TestIsCopperPortCableLengthGetFailure) { @@ -1817,10 +1834,11 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, TestIsCopperPortCableLengthGetFailure) { &cable_len_req)); EXPECT_CALL(*mock_gnmi_stub_ptr, Get(_, EqualsProto(cable_len_req), _)) .WillOnce(Return(grpc::Status(grpc::StatusCode::DEADLINE_EXCEEDED, ""))); - EXPECT_THAT(pins_test::IsCopperPort(mock_gnmi_stub_ptr.get(), "Ethernet0"), - StatusIs(absl::StatusCode::kDeadlineExceeded, - HasSubstr("Failed to get GNMI state path value for " - "cable-length for port Ethernet0"))); + EXPECT_THAT( + pins_test::IsCopperPort(mock_gnmi_stub_ptr.get(), "Ethernet1/1/1"), + StatusIs(absl::StatusCode::kDeadlineExceeded, + HasSubstr("Failed to get GNMI state path value for " + "cable-length for port Ethernet1/1/1"))); } TEST_F(GNMIThinkitInterfaceUtilityTest, @@ -1847,7 +1865,7 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, elem { name: "components" } elem { name: "component" - key { key: "name" value: "Ethernet0" } + key { key: "name" value: "Ethernet1/1/1" } } elem { name: "transceiver" } elem { name: "state" } @@ -1863,9 +1881,25 @@ TEST_F(GNMIThinkitInterfaceUtilityTest, EXPECT_CALL(*mock_gnmi_stub_ptr, Get(_, EqualsProto(cable_len_req), _)) .WillOnce( DoAll(SetArgPointee<2>(cable_len_resp), Return(grpc::Status::OK))); - EXPECT_THAT(pins_test::IsCopperPort(mock_gnmi_stub_ptr.get(), "Ethernet0"), - StatusIs(absl::StatusCode::kInternal, - HasSubstr("Failed to convert string (XYZ) to float"))); + EXPECT_THAT( + pins_test::IsCopperPort(mock_gnmi_stub_ptr.get(), "Ethernet1/1/1"), + StatusIs(absl::StatusCode::kInternal, + HasSubstr("Failed to convert string (XYZ) to float"))); +} + +TEST_F(GNMIThinkitInterfaceUtilityTest, + TestGetSlotPortLaneForPortNonFrontPanelPortFailure) { + EXPECT_THAT(pins_test::GetSlotPortLaneForPort("NonFrontPanelPort1/1/1"), + StatusIs(absl::StatusCode::kInvalidArgument, + HasSubstr("Requested port (NonFrontPanelPort1/1/1) is " + "not a front panel port"))); } +TEST_F(GNMIThinkitInterfaceUtilityTest, + TestGetSlotPortLaneForPortInvalidPortFailure) { + EXPECT_THAT(pins_test::GetSlotPortLaneForPort("Ethernet1/1"), + StatusIs(absl::StatusCode::kInvalidArgument, + HasSubstr("Requested port (Ethernet1/1) does not have a " + "valid format (EthernetX/Y/Z)"))); +} } // namespace pins_test