def udp_packet(self, setup, direction, ptfadapter, ip_version, src_ip=None, dst_ip=None, sport=1234, dport=80):
    'Generate a UDP packet for testing.'
    src_ip = (src_ip or DEFAULT_SRC_IP[ip_version])
    dst_ip = (dst_ip or self.get_dst_ip(direction, ip_version))
    if (ip_version == 'ipv4'):
        return testutils.simple_udp_packet(eth_dst=setup['destination_mac'][direction][self.src_port], eth_src=ptfadapter.dataplane.get_mac(0, 0), ip_dst=dst_ip, ip_src=src_ip, udp_sport=sport, udp_dport=dport, ip_ttl=64)
    else:
        return testutils.simple_udpv6_packet(eth_dst=setup['destination_mac'][direction][self.src_port], eth_src=ptfadapter.dataplane.get_mac(0, 0), ipv6_dst=dst_ip, ipv6_src=src_ip, udp_sport=sport, udp_dport=dport, ipv6_hlim=64)
Generate a UDP packet for testing.
def udp_packet(self, setup, direction, ptfadapter, ip_version, src_ip=None, dst_ip=None, sport=1234, dport=80):
    
    src_ip = (src_ip or DEFAULT_SRC_IP[ip_version])
    dst_ip = (dst_ip or self.get_dst_ip(direction, ip_version))
    if (ip_version == 'ipv4'):
        return testutils.simple_udp_packet(eth_dst=setup['destination_mac'][direction][self.src_port], eth_src=ptfadapter.dataplane.get_mac(0, 0), ip_dst=dst_ip, ip_src=src_ip, udp_sport=sport, udp_dport=dport, ip_ttl=64)
    else:
        return testutils.simple_udpv6_packet(eth_dst=setup['destination_mac'][direction][self.src_port], eth_src=ptfadapter.dataplane.get_mac(0, 0), ipv6_dst=dst_ip, ipv6_src=src_ip, udp_sport=sport, udp_dport=dport, ipv6_hlim=64)