Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Thinkit] Ensure port IDs have converged prior to programming, Increase gnmi convergence timeout from 30s to 3 minutes, Use more restrictive ACL entry in test to avoid accidental colissions & Enable flow rate test with experimental action. #841

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 31 additions & 10 deletions tests/qos/cpu_qos_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ absl::StatusOr<p4::v1::TableEntry> 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 }
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 {} }
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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<IxiaLink> ready_links,
GetReadyIxiaLinks(*generic_testbed, *gnmi_stub));
Expand Down Expand Up @@ -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.
Expand Down
Loading