Skip to content

Commit

Permalink
add an ageout test
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaofengWu123 committed Dec 18, 2024
1 parent 85d7032 commit d31a485
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions test/test-cases/functional/ptf/saidashdpapp_sanity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down

0 comments on commit d31a485

Please sign in to comment.