From d31a485d6a91feda4a44c9b99b35cb2e5fcf260b Mon Sep 17 00:00:00 2001 From: ShaofengWu123 Date: Wed, 18 Dec 2024 12:40:09 +0000 Subject: [PATCH] add an ageout test --- .../functional/ptf/saidashdpapp_sanity.py | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/test/test-cases/functional/ptf/saidashdpapp_sanity.py b/test/test-cases/functional/ptf/saidashdpapp_sanity.py index f03b59af7..feefefa59 100644 --- a/test/test-cases/functional/ptf/saidashdpapp_sanity.py +++ b/test/test-cases/functional/ptf/saidashdpapp_sanity.py @@ -289,11 +289,64 @@ def trafficTcpTest(self): print(f"{self.__class__.__name__} trafficTcpTest OK\n") + def ageoutTcpTest(self): + + src_vm_ip = "10.1.1.11" + outer_smac = "00:00:05:06:06:07" + tcp_src_port = 0x1234 + tcp_dst_port = 0x50 + + # customer packet: tcp SYN + inner_pkt = simple_tcp_packet(eth_dst="02:02:02:02:02:02", + eth_src=self.eni_mac, + ip_dst=self.dst_ca_ip, + ip_src=src_vm_ip, + tcp_sport=tcp_src_port, + tcp_dport=tcp_dst_port, + tcp_flags="S") + vxlan_pkt = simple_vxlan_packet(eth_dst=self.our_mac, + eth_src=outer_smac, + ip_dst=self.vip, + ip_src=self.src_vm_pa_ip, + udp_sport=11638, + with_udp_chksum=False, + vxlan_vni=self.outbound_vni, + inner_frame=inner_pkt) + + inner_exp_pkt = simple_tcp_packet(eth_dst=self.dst_ca_mac, + eth_src=self.eni_mac, + ip_dst=self.dst_ca_ip, + ip_src=src_vm_ip, + tcp_sport=tcp_src_port, + tcp_dport=tcp_dst_port, + tcp_flags="S") + vxlan_exp_pkt = simple_vxlan_packet(eth_dst="00:00:00:00:00:00", + eth_src="00:00:00:00:00:00", + ip_dst=self.dst_pa_ip, + ip_src=self.vip, + udp_sport=0, # TODO: Fix sport in pipeline + with_udp_chksum=False, + vxlan_vni=self.vnet_vni, + inner_frame=inner_exp_pkt) + + self.pkt_exp = vxlan_exp_pkt + print("\tSending outbound packet TCP SYN ...") + send_packet(self, 0, vxlan_pkt) + print("\tVerifying flow created...") + verify_flow(self.eni_mac, self.vnet & 0xffff, inner_pkt) + time.sleep(30) + print("\tVerifying flow aged out...") + verify_no_flow(self.eni_mac, self.vnet & 0xffff, inner_pkt) + + + print(f"{self.__class__.__name__} ageoutTcpTest OK\n") + def runTest(self): self.configureVnet() self.trafficUdpTest() self.trafficTcpTest() + self.ageoutTcpTest() def tearDown(self):