diff --git a/tests/qos/cpu_qos_test.cc b/tests/qos/cpu_qos_test.cc index b1b42d3b..d008f37d 100644 --- a/tests/qos/cpu_qos_test.cc +++ b/tests/qos/cpu_qos_test.cc @@ -237,7 +237,7 @@ absl::StatusOr SetUpPuntToCPUWithRateLimit( src_ip { value: "$1" mask: "255.255.255.255" } dst_ip { value: "$2" mask: "255.255.255.255" } } - action { acl_trap { qos_queue: "$3" } } + action { acl_experimental_trap { qos_queue: "$3" } } priority: 1 meter_config { bytes_per_second: $4 burst_bytes: $5 } } @@ -506,9 +506,15 @@ TEST_P(CpuQosTestWithoutIxia, PerEntryAclCounterIncrementsWhenEntryIsHit) { ASSERT_OK_AND_ASSIGN(auto gnmi_stub, sut.CreateGnmiStub()); // TODO: Poll for config to be applied, links to come up instead. - LOG(INFO) << "Sleeping 10 seconds to wait for config to be applied/links to " - "come up."; - absl::SleepFor(absl::Seconds(10)); + LOG(INFO) << "Sleeping " << kTimeToWaitForGnmiConfigToApply + << " to wait for config to be applied/links to come up."; + absl::SleepFor(kTimeToWaitForGnmiConfigToApply); + ASSERT_OK( + pins_test::WaitForGnmiPortIdConvergence(sut, GetParam().gnmi_config, + /*timeout=*/absl::Minutes(3))); + ASSERT_OK(pins_test::WaitForGnmiPortIdConvergence( + control_device, GetParam().gnmi_config, + /*timeout=*/absl::Minutes(3))); // Pick a link to be used for packet injection. ASSERT_OK_AND_ASSIGN(SutToControlLink link_used_for_test_packets, @@ -536,7 +542,7 @@ TEST_P(CpuQosTestWithoutIxia, PerEntryAclCounterIncrementsWhenEntryIsHit) { priority: 1 match { is_ipv6 { value: "0x1" } - ttl { value: "0xff" mask: "0xff" } + ip_protocol { value: "0xfd" mask: "0xff" } } action { acl_drop {} } } @@ -572,11 +578,13 @@ TEST_P(CpuQosTestWithoutIxia, PerEntryAclCounterIncrementsWhenEntryIsHit) { ipv6_destination: "2001:db8:0:12::2" } } - payload: "IPv6 packet with TTL 0xff (255)." + payload: "IPv6 packet with next header 0xfd (253)." )pb")); // The ACL entry should match the test packet. - ASSERT_EQ(test_packet.headers().at(1).ipv6_header().hop_limit(), - pd_acl_entry.acl_ingress_table_entry().match().ttl().value()); + ASSERT_EQ( + test_packet.headers().at(1).ipv6_header().next_header(), + pd_acl_entry.acl_ingress_table_entry().match().ip_protocol().value()); + ASSERT_OK(packetlib::PadPacketToMinimumSize(test_packet)); ASSERT_OK(packetlib::UpdateAllComputedFields(test_packet)); ASSERT_OK_AND_ASSIGN(const std::string raw_packet, @@ -804,6 +812,12 @@ TEST_P(CpuQosTestWithoutIxia, LOG(INFO) << "Sleeping " << kTimeToWaitForGnmiConfigToApply << " to wait for config to be applied/links to come up."; absl::SleepFor(kTimeToWaitForGnmiConfigToApply); + ASSERT_OK( + pins_test::WaitForGnmiPortIdConvergence(sut, GetParam().gnmi_config, + /*timeout=*/absl::Minutes(3))); + ASSERT_OK(pins_test::WaitForGnmiPortIdConvergence( + control_device, GetParam().gnmi_config, + /*timeout=*/absl::Minutes(3))); // Pick a link to be used for packet injection. ASSERT_OK_AND_ASSIGN(SutToControlLink link_used_for_test_packets, @@ -915,6 +929,12 @@ TEST_P(CpuQosTestWithoutIxia, TrafficToLoopackIpGetsMappedToCorrectQueues) { LOG(INFO) << "Sleeping " << kTimeToWaitForGnmiConfigToApply << " to wait for config to be applied/links to come up."; absl::SleepFor(kTimeToWaitForGnmiConfigToApply); + ASSERT_OK( + pins_test::WaitForGnmiPortIdConvergence(sut, GetParam().gnmi_config, + /*timeout=*/absl::Minutes(3))); + ASSERT_OK(pins_test::WaitForGnmiPortIdConvergence( + control_device, GetParam().gnmi_config, + /*timeout=*/absl::Minutes(3))); // Pick a link to be used for packet injection. ASSERT_OK_AND_ASSIGN(SutToControlLink link_used_for_test_packets, @@ -1205,6 +1225,9 @@ TEST_P(CpuQosTestWithIxia, TestPuntFlowRateLimitAndCounters) { LOG(INFO) << "Sleeping " << kTimeToWaitForGnmiConfigToApply << " to wait for config to be applied/links to come up."; absl::SleepFor(kTimeToWaitForGnmiConfigToApply); + ASSERT_OK( + pins_test::WaitForGnmiPortIdConvergence(sut, GetParam().gnmi_config, + /*timeout=*/absl::Minutes(3))); ASSERT_OK_AND_ASSIGN(std::vector ready_links, GetReadyIxiaLinks(*generic_testbed, *gnmi_stub)); @@ -1334,8 +1357,6 @@ TEST_P(CpuQosTestWithIxia, TestPuntFlowRateLimitAndCounters) { // Wait for Traffic to be sent. absl::SleepFor(kTrafficDuration); - ASSERT_OK(pins_test::ixia::StopTraffic(traffic_ref, *generic_testbed)); - // Check for counters every 5 seconds upto 30 seconds till the fetched gNMI // queue counter stats match packets and bytes sent by Ixia. // Check that the counters increment within kMaxQueueCounterUpdateTime.