@@ -741,6 +741,7 @@ TEST_P(FrontpanelQosTest,
741741 (kDscpsByQueueName == kDscpsByMulticastQueueName );
742742
743743 QueueCounters kInitialQueueCounters ;
744+ Counters kInitialPortCounters ;
744745 // Actual testing -- inject test IPv4 and IPv6 packets for each DSCP,
745746 // and check the behavior is as eexpted.
746747 constexpr int kMaxDscp = 63 ;
@@ -785,6 +786,9 @@ TEST_P(FrontpanelQosTest,
785786 ASSERT_OK_AND_ASSIGN (
786787 kInitialQueueCounters ,
787788 GetGnmiQueueCounters (kSutEgressPort , kTargetQueue , *gnmi_stub));
789+ ASSERT_OK_AND_ASSIGN (
790+ kInitialPortCounters ,
791+ GetCountersForInterface (kSutEgressPort , *gnmi_stub));
788792 }
789793 // Configure & start test packet flow.
790794 const std::string kTrafficName =
@@ -904,6 +908,17 @@ TEST_P(FrontpanelQosTest,
904908 } while (TotalPacketsForQueue (delta_counters) <
905909 kIxiaTrafficStats .num_tx_frames () &&
906910 absl::Now () < kDeadline );
911+ ASSERT_OK_AND_ASSIGN (
912+ Counters final_port_counters,
913+ GetCountersForInterface (kSutEgressPort , *gnmi_stub));
914+
915+ SCOPED_TRACE (
916+ absl::StrCat (" port counters incremented by " ,
917+ kInitialPortCounters - final_port_counters));
918+ SCOPED_TRACE (
919+ absl::StrCat (" Initial port counters: " , kInitialPortCounters ));
920+ SCOPED_TRACE (
921+ absl::StrCat (" Final port counters: " , final_port_counters));
907922 LOG (INFO) << " queue counters incremented by " << delta_counters;
908923 LOG (INFO) << " Queue Counters.\n Before: "
909924 << ToString (kInitialQueueCounters )
@@ -1238,6 +1253,9 @@ TEST_P(FrontpanelQosTest, WeightedRoundRobinWeightsAreRespected) {
12381253 ASSERT_OK_AND_ASSIGN (sut_p4rt, pdpi::P4RuntimeSession::Create (sut));
12391254 }
12401255 // Start traffic.
1256+ Counters kInitialPortCounters ;
1257+ ASSERT_OK_AND_ASSIGN (kInitialPortCounters ,
1258+ GetCountersForInterface (kSutEgressPort , *gnmi_stub));
12411259 LOG (INFO) << " starting traffic" ;
12421260 ASSERT_OK (ixia::StartTraffic (traffic_items, kIxiaHandle , *testbed));
12431261 auto stop_traffic = absl::Cleanup (
@@ -1255,6 +1273,14 @@ TEST_P(FrontpanelQosTest, WeightedRoundRobinWeightsAreRespected) {
12551273 // weights.
12561274 ASSERT_OK_AND_ASSIGN (const ixia::TrafficStats kTrafficStats ,
12571275 ixia::GetAllTrafficItemStats (kIxiaHandle , *testbed));
1276+
1277+ ASSERT_OK_AND_ASSIGN (Counters final_port_counters,
1278+ GetCountersForInterface (kSutEgressPort , *gnmi_stub));
1279+
1280+ SCOPED_TRACE (absl::StrCat (" port counters incremented by " ,
1281+ final_port_counters - kInitialPortCounters ));
1282+ SCOPED_TRACE (absl::StrCat (" Initial port counters: " , kInitialPortCounters ));
1283+ SCOPED_TRACE (absl::StrCat (" Final port counters: " , final_port_counters));
12581284 absl::flat_hash_map<std::string, int64_t > num_rx_frames_by_queue;
12591285 for (auto &[traffic_item_name, stats] :
12601286 Ordered (kTrafficStats .stats_by_traffic_item ())) {
@@ -1685,6 +1711,18 @@ TEST_P(FrontpanelQosTest, StrictQueuesAreStrictlyPrioritized) {
16851711 LOG (INFO) << " NSF reboot complete, sending traffic again to ensure "
16861712 " the forwarding traffic is not disrupted." ;
16871713 }
1714+ bool not_after_nsf_reboot =
1715+ !GetParam ().nsf_reboot ||
1716+ test_operation == TestOperations::NsfRebootAndTrafficTest;
1717+ Counters kInitialPortCounters ;
1718+ if (not_after_nsf_reboot) {
1719+ // Get initial port counters after NSF Reboot is complete since
1720+ // gnmi calls cannot be made during NSF reboot.
1721+ ASSERT_OK_AND_ASSIGN (
1722+ kInitialPortCounters ,
1723+ GetCountersForInterface (kSutEgressPort , *gnmi_stub));
1724+ }
1725+
16881726 // Run traffic for a while, then obtain stats.
16891727 LOG (INFO) << " starting traffic (" << traffic_items.size () << " items)" ;
16901728 // Occasionally the Ixia API cannot keep up and starting traffic
@@ -1703,6 +1741,23 @@ TEST_P(FrontpanelQosTest, StrictQueuesAreStrictlyPrioritized) {
17031741 ASSERT_OK_AND_ASSIGN (
17041742 const ixia::TrafficStats kTrafficStats ,
17051743 ixia::GetAllTrafficItemStats (kIxiaHandle , *testbed));
1744+
1745+ if (not_after_nsf_reboot) {
1746+ // Get port counters after NSF Reboot is complete since
1747+ // gnmi calls cannot be made during NSF reboot.
1748+ ASSERT_OK_AND_ASSIGN (
1749+ Counters final_port_counters,
1750+ GetCountersForInterface (kSutEgressPort , *gnmi_stub));
1751+
1752+ SCOPED_TRACE (
1753+ absl::StrCat (" port counters incremented by " ,
1754+ final_port_counters - kInitialPortCounters ));
1755+ SCOPED_TRACE (
1756+ absl::StrCat (" Initial port counters: " , kInitialPortCounters ));
1757+ SCOPED_TRACE (
1758+ absl::StrCat (" Final port counters: " , final_port_counters));
1759+ }
1760+
17061761 LOG (INFO) << " validating traffic stats against expectation" ;
17071762 double bytes_per_second_received = 0 ;
17081763 for (auto &[traffic_item, stats] :
@@ -2127,6 +2182,9 @@ TEST_P(FrontpanelQosTest, TestWredEcnMarking) {
21272182
21282183 ResetEcnTestPacketCounters (packet_receive_info);
21292184
2185+ Counters kInitialPortCounters ;
2186+ ASSERT_OK_AND_ASSIGN (kInitialPortCounters ,
2187+ GetCountersForInterface (kSutOutPort , *gnmi_stub));
21302188 ASSERT_OK (pins::TryUpToNTimes (3 , /* delay=*/ absl::Seconds (1 ), [&] {
21312189 return pins_test::ixia::StartTraffic (ixia_setup_result.traffic_refs ,
21322190 ixia_setup_result.topology_ref ,
@@ -2163,13 +2221,27 @@ TEST_P(FrontpanelQosTest, TestWredEcnMarking) {
21632221 // Wait for a bit to collect queue statistics.
21642222 constexpr absl::Duration kQueueStatsWaitTime = absl::Seconds (5 );
21652223 absl::SleepFor (kQueueStatsWaitTime );
2224+
2225+ ASSERT_OK_AND_ASSIGN (Counters final_port_counters,
2226+ GetCountersForInterface (kSutOutPort , *gnmi_stub));
2227+
2228+ SCOPED_TRACE (absl::StrCat (" port counters incremented by " ,
2229+ final_port_counters - kInitialPortCounters ));
2230+ SCOPED_TRACE (
2231+ absl::StrCat (" Initial port counters: " , kInitialPortCounters ));
2232+ SCOPED_TRACE (
2233+ absl::StrCat (" Final port counters: " , final_port_counters));
21662234
21672235 // Read counters of the target queue.
21682236 ASSERT_OK_AND_ASSIGN (
21692237 const QueueCounters queue_counters_after_test_packet,
21702238 GetGnmiQueueCounters (/* port=*/ kSutOutPort ,
21712239 /* queue=*/ target_queue, *gnmi_stub));
2172-
2240+
2241+ SCOPED_TRACE (absl::StrCat (" Queue counters before test packet: " ,
2242+ ToString (queue_counters_before_test_packet)));
2243+ SCOPED_TRACE (absl::StrCat (" Queue counters after test packet: " ,
2244+ ToString (queue_counters_after_test_packet)));
21732245 // This test expects WRED config to only mark packets and not
21742246 // drop. Expect no drops in target queue and queue transmit
21752247 // counter increments.
@@ -2525,6 +2597,10 @@ TEST_P(FrontpanelBufferTest, BufferCarving) {
25252597 ASSERT_OK (DoNsfRebootAndWaitForSwitchReadyOrRecover (
25262598 testbed.get (), *GetParam ().default_params .ssh_client_for_nsf ));
25272599 }
2600+ Counters kInitialPortCounters ;
2601+ ASSERT_OK_AND_ASSIGN (kInitialPortCounters ,
2602+ GetCountersForInterface (kSutEgressPort , *gnmi_stub));
2603+
25282604 // Start traffic.
25292605 LOG (INFO) << " starting traffic" ;
25302606 ASSERT_OK (ixia::StartTraffic (traffic_items, kIxiaHandle , *testbed));
@@ -2536,6 +2612,13 @@ TEST_P(FrontpanelBufferTest, BufferCarving) {
25362612 // config.
25372613 ASSERT_OK_AND_ASSIGN (const ixia::TrafficStats kTrafficStats ,
25382614 ixia::GetAllTrafficItemStats (kIxiaHandle , *testbed));
2615+
2616+ ASSERT_OK_AND_ASSIGN (Counters final_port_counters,
2617+ GetCountersForInterface (kSutEgressPort , *gnmi_stub));
2618+ SCOPED_TRACE (absl::StrCat (" port counters incremented by " ,
2619+ final_port_counters - kInitialPortCounters ));
2620+ SCOPED_TRACE (absl::StrCat (" Initial port counters: " , kInitialPortCounters ));
2621+ SCOPED_TRACE (absl::StrCat (" Final port counters: " , final_port_counters));
25392622
25402623 absl::flat_hash_map<int , int64_t > rx_frames_by_buffer_config;
25412624 for (auto &[traffic_item_name, stats] :
0 commit comments