Skip to content

Commit

Permalink
[SAi-PTF]Fix Failed cases by add dataplane flush with time comsuming …
Browse files Browse the repository at this point in the history
…verify (#1648)

Fix Failed cases by add dataplane flush with time comsuming verify
For some long time running cases(within a loop) there might be some noise from network, and the noise packet might impact the test result, in order to reduce the impact, add a dataplance flush before send the packet to elimit the noice.

Test Done
DUT test

Signed-off-by: richardyu-ms <richard.yu@microsoft.com>

Signed-off-by: richardyu-ms <richard.yu@microsoft.com>
  • Loading branch information
richardyu-ms authored Nov 10, 2022
1 parent 44d3f6b commit 36c235c
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 21 deletions.
40 changes: 21 additions & 19 deletions test/sai_test/sai_ecmp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_load_balance_on_sportv4(self):
tcp_sport= src_port,
ip_id=105,
ip_ttl=63)

self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
rcv_idx = verify_any_packet_any_port(
self, [exp_pkt1, exp_pkt2, exp_pkt3, exp_pkt4], recv_dev_port_idxs)
Expand Down Expand Up @@ -156,7 +156,7 @@ def test_load_balance_on_sportv6(self):
ipv6_src=ip_src,
tcp_sport= src_port,
ipv6_hlim=63)

self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
rcv_idx = verify_any_packet_any_port(
self, [exp_pkt1, exp_pkt2, exp_pkt3, exp_pkt4], recv_dev_port_idxs)
Expand Down Expand Up @@ -327,7 +327,7 @@ def test_load_balance_on_dportv6(self):
ipv6_src=ip_src,
tcp_dport= dst_port,
ipv6_hlim=63)

self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
rcv_idx = verify_any_packet_any_port(
self, [exp_pkt1, exp_pkt2, exp_pkt3, exp_pkt4], recv_dev_port_idxs)
Expand Down Expand Up @@ -409,7 +409,7 @@ def test_load_balance_on_sipv4(self):
ip_src=ip_src,
ip_id=105,
ip_ttl=63)

self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
rcv_idx = verify_any_packet_any_port(
self, [exp_pkt1, exp_pkt2, exp_pkt3, exp_pkt4], recv_dev_port_idxs)
Expand Down Expand Up @@ -486,7 +486,7 @@ def test_load_balance_on_sipv6(self):
ipv6_dst=ip_dst,
ipv6_src=ip_src,
ipv6_hlim=63)

self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
rcv_idx = verify_any_packet_any_port(
self, [exp_pkt1, exp_pkt2, exp_pkt3, exp_pkt4], recv_dev_port_idxs)
Expand Down Expand Up @@ -607,7 +607,7 @@ def test_load_balance_on_protocolv4(self):
ip_src=ip_src,
ip_id=105,
ip_ttl=63)

self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
rcv_idx = verify_any_packet_any_port(
self, [exp_pkt1, exp_pkt2, exp_pkt3, exp_pkt4], recv_dev_port_idxs)
Expand Down Expand Up @@ -718,7 +718,7 @@ def test_load_balance_on_protocolv6(self):
ipv6_dst=ip_dst,
ipv6_src=ip_src,
ipv6_hlim=63)

self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
rcv_idx = verify_any_packet_any_port(
self, [exp_pkt1, exp_pkt2, exp_pkt3, exp_pkt4], recv_dev_port_idxs)
Expand Down Expand Up @@ -797,13 +797,15 @@ def test_ingress_no_diff(self):

for i in range(5, 9):
# step 4
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[i].dev_port_index, pkt1)
if exp_port_idx1 == -1:
exp_port_idx1, _ = verify_packet_any_port(self, exp_pkt1, recv_dev_port_idxs)
else:
verify_packet(self, exp_pkt1, recv_dev_port_idxs[exp_port_idx1])

# step 6
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[i].dev_port_index, pkt2)
if exp_port_idx2 == -1:
exp_port_idx2, _ = verify_packet_any_port(self, exp_pkt2, recv_dev_port_idxs)
Expand Down Expand Up @@ -877,7 +879,7 @@ def test_lag_ecmp_remove(self):
ip_src=ip_src,
ip_id=105,
ip_ttl=63)

self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
verify_any_packet_any_port(self, [exp_pkt1, exp_pkt2, exp_pkt3], recv_dev_port_idxs)

Expand Down Expand Up @@ -951,7 +953,7 @@ def test_lag_ecmp_remove_v6(self):
ipv6_src=ip_src,
tcp_dport= dst_port,
ipv6_hlim=63)

self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
rcv_idx = verify_any_packet_any_port(
self, [exp_pkt1, exp_pkt2, exp_pkt3], recv_dev_port_idxs)
Expand Down Expand Up @@ -1035,7 +1037,7 @@ def test_nexthopgroup_remove(self):
tcp_sport= src_port,
ip_id=105,
ip_ttl=63)

self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
verify_no_other_packets(self)

Expand Down Expand Up @@ -1118,7 +1120,7 @@ def test_nexthopgroup_remove(self):
tcp_sport= src_port,
ip_id=105,
ip_ttl=63)

self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
verify_no_other_packets(self)

Expand Down Expand Up @@ -1189,7 +1191,7 @@ def test_lag_ecmp_readd(self):
ip_src=ip_src,
ip_id=105,
ip_ttl=63)

self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
verify_any_packet_any_port(self, [exp_pkt1, exp_pkt2, exp_pkt3], recv_dev_port_idxs)

Expand Down Expand Up @@ -1231,7 +1233,7 @@ def test_lag_ecmp_readd(self):
ip_src=ip_src,
ip_id=105,
ip_ttl=63)

self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
verify_any_packet_any_port(self, [exp_pkt1, exp_pkt2, exp_pkt3, exp_pkt4], recv_dev_port_idxs)
def runTest(self):
Expand Down Expand Up @@ -1296,7 +1298,7 @@ def test_lag_ecmp_readdv6(self):
ipv6_src=ip_src,
tcp_dport= dst_port,
ipv6_hlim=63)

self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
rcv_idx = verify_any_packet_any_port(
self, [exp_pkt1, exp_pkt2, exp_pkt3], recv_dev_port_idxs)
Expand Down Expand Up @@ -1349,7 +1351,7 @@ def test_lag_ecmp_readdv6(self):
ipv6_src=ip_src,
tcp_dport= dst_port,
ipv6_hlim=63)

self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
rcv_idx = verify_any_packet_any_port(
self, [exp_pkt1, exp_pkt2, exp_pkt3, exp_pkt4], recv_dev_port_idxs)
Expand Down Expand Up @@ -1420,7 +1422,7 @@ def test_lag_ecmp_disable(self):
ip_id=105,
ip_ttl=63)


self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
verify_no_packet_any(self, exp_pkt1, self.dut.lag_list[0].member_port_indexs)

Expand Down Expand Up @@ -1491,7 +1493,7 @@ def test_lag_ecmp_disablev6(self):
ipv6_src=ip_src,
tcp_dport= dst_port,
ipv6_hlim=63)

self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
verify_no_packet_any(self, exp_pkt1, self.dut.lag_list[0].member_port_indexs)

Expand Down Expand Up @@ -1563,7 +1565,7 @@ def test_ecmp_ingress_disable_v4(self):
ip_id=105,
ip_ttl=63)


self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
verify_no_packet_any(self, exp_pkt1, self.dut.lag_list[0].member_port_indexs)

Expand Down Expand Up @@ -1630,7 +1632,7 @@ def test_ecmp_ingress_disable_v6(self):
ipv6_src=ip_src,
tcp_dport= dst_port,
ipv6_hlim=63)

self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
verify_no_packet_any(self, exp_pkt1, self.dut.lag_list[0].member_port_indexs)

Expand Down
2 changes: 1 addition & 1 deletion test/sai_test/sai_fdb_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def runTest(self):
vlan_vid=10,
ip_id=101,
ip_ttl=64)

self.dataplane.flush()
send_packet(
self, send_port.dev_port_index, pkt)
verify_packet(
Expand Down
14 changes: 14 additions & 0 deletions test/sai_test/sai_lag_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def runTest(self):
tcp_sport=src_port,
ip_id=105,
ip_ttl=63)
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
rcv_idx, _ = verify_packet_any_port(
self, exp_pkt, self.recv_dev_port_idxs)
Expand Down Expand Up @@ -173,6 +174,7 @@ def runTest(self):
tcp_dport=des_port,
ip_id=105,
ip_ttl=63)
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
rcv_idx, _ = verify_packet_any_port(
self, exp_pkt, self.recv_dev_port_idxs)
Expand Down Expand Up @@ -226,6 +228,7 @@ def runTest(self):
ip_src=self.servers[1][i].ipv4,
ip_id=105,
ip_ttl=63)
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
rcv_idx, _ = verify_packet_any_port(
self, exp_pkt, self.recv_dev_port_idxs)
Expand Down Expand Up @@ -280,6 +283,7 @@ def runTest(self):
ip_src=self.servers[1][1].ipv4,
ip_id=105,
ip_ttl=63)
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
rcv_idx, _ = verify_packet_any_port(
self, exp_pkt, self.recv_dev_port_idxs)
Expand Down Expand Up @@ -354,6 +358,7 @@ def runTest(self):
ip_src=self.servers[1][1].ipv4,
ip_id=105,
ip_ttl=63)
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
rcv_idx, _ = verify_packet_any_port(
self, exp_pkt, self.recv_dev_port_idxs)
Expand Down Expand Up @@ -416,6 +421,7 @@ def runTest(self):
tcp_sport=src_port,
ip_id=105,
ip_ttl=63)
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
rcv_idx, _ = verify_packet_any_port(
self, exp_pkt, self.recv_dev_port_idxs)
Expand Down Expand Up @@ -445,6 +451,7 @@ def runTest(self):
tcp_sport=src_port,
ip_id=105,
ip_ttl=63)
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
if src_port in exp_drop:
verify_no_packet(self, exp_pkt, self.get_dev_port_index(18))
Expand Down Expand Up @@ -508,6 +515,7 @@ def runTest(self):
tcp_sport=src_port,
ip_id=105,
ip_ttl=63)
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[18].dev_port_index, pkt)
verify_packet(self, exp_pkt, self.dut.port_obj_list[1].dev_port_index)
# git disable ingress of lag member: port18
Expand All @@ -532,6 +540,7 @@ def runTest(self):
tcp_sport=src_port,
ip_id=105,
ip_ttl=63)
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[18].dev_port_index, pkt)
verify_no_packet(self, exp_pkt, self.dut.port_obj_list[1].dev_port_index)
finally:
Expand Down Expand Up @@ -584,6 +593,7 @@ def runTest(self):
tcp_sport=src_port,
ip_id=105,
ip_ttl=63)
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
verify_packet_any_port(
self, exp_pkt, self.recv_dev_port_idxs)
Expand All @@ -607,6 +617,7 @@ def runTest(self):
tcp_sport=src_port,
ip_id=105,
ip_ttl=63)
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
verify_no_packet(self, exp_pkt, self.get_dev_port_index(18))
self.lag_configer.create_lag_member(lag_obj=self.servers[11][1].l3_lag_obj,
Expand Down Expand Up @@ -662,6 +673,7 @@ def runTest(self):
tcp_sport=src_port,
ip_id=105,
ip_ttl=63)
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
verify_packet_any_port(
self, exp_pkt, self.recv_dev_port_idxs)
Expand All @@ -685,6 +697,7 @@ def runTest(self):
tcp_sport=src_port,
ip_id=105,
ip_ttl=63)
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[1].dev_port_index, pkt)
rcv_idx, _ = verify_packet_any_port(
self, exp_pkt, self.recv_dev_port_idxs)
Expand Down Expand Up @@ -729,6 +742,7 @@ def runTest(self):
exp_port_idx = -1
exp_port_list = self.get_dev_port_indexes(self.servers[11][1].l3_lag_obj.member_port_indexs)
for i in range(1, 9):
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[i].dev_port_index, pkt)
if exp_port_idx == -1:
exp_port_idx, _ = verify_packet_any_port(
Expand Down
3 changes: 3 additions & 0 deletions test/sai_test/sai_route_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def runTest(self):
ip_dst=self.servers[12][i].ipv4,
ip_id=105,
ip_ttl=63)
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[5].dev_port_index, pkt)
verify_packet_any_port(self, exp_pkt, self.recv_dev_port_idxs)
print("received packet with dst_ip:{} on one of lag2 member".format(self.servers[12][i].ipv4))
Expand Down Expand Up @@ -94,6 +95,7 @@ def runTest(self):
eth_dst=self.servers[12][i].l3_lag_obj.neighbor_mac,
ipv6_dst=self.servers[12][i].ipv6,
ipv6_hlim=63)
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[5].dev_port_index, pkt_v6)
verify_packet_any_port(self, exp_pkt_v6, self.recv_dev_port_idxs)
print("received packet with dst_ip:{} on one of lag2 member".format(self.servers[12][i].ipv6))
Expand Down Expand Up @@ -1012,6 +1014,7 @@ def runTest(self):
ip_dst=self.servers[12][i].ipv4,
ip_id=105,
ip_ttl=63)
self.dataplane.flush()
send_packet(self, self.dut.port_obj_list[5].dev_port_index, pkt)
verify_no_other_packets(self)
finally:
Expand Down
Loading

0 comments on commit 36c235c

Please sign in to comment.