testutils: add ip_ttl option to simple_*_packet
diff --git a/src/python/oftest/testutils.py b/src/python/oftest/testutils.py
index fc5e5bb..0e22d2c 100644
--- a/src/python/oftest/testutils.py
+++ b/src/python/oftest/testutils.py
@@ -66,6 +66,7 @@
                       ip_src='192.168.0.1',
                       ip_dst='192.168.0.2',
                       ip_tos=0,
+                      ip_ttl=64,
                       tcp_sport=1234,
                       tcp_dport=80,
                       ip_ihl=None,
@@ -84,6 +85,7 @@
     @param ip_src IP source
     @param ip_dst IP destination
     @param ip_tos IP ToS
+    @param ip_ttl IP TTL
     @param tcp_dport TCP destination port
     @param ip_sport TCP source port
 
@@ -99,16 +101,16 @@
     if (dl_vlan_enable):
         pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
             scapy.Dot1Q(prio=dl_vlan_pcp, id=dl_vlan_cfi, vlan=dl_vlan)/ \
-            scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ihl=ip_ihl)/ \
+            scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl)/ \
             scapy.TCP(sport=tcp_sport, dport=tcp_dport)
     else:
         if not ip_options:
             pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
-                scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ihl=ip_ihl)/ \
+                scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl)/ \
                 scapy.TCP(sport=tcp_sport, dport=tcp_dport)
         else:
             pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
-                scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ihl=ip_ihl, options=ip_options)/ \
+                scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl, options=ip_options)/ \
                 scapy.TCP(sport=tcp_sport, dport=tcp_dport)
 
     pkt = pkt/("D" * (pktlen - len(pkt)))
@@ -125,6 +127,7 @@
                       ip_src='192.168.0.1',
                       ip_dst='192.168.0.2',
                       ip_tos=0,
+                      ip_ttl=64,
                       udp_sport=1234,
                       udp_dport=80,
                       ip_ihl=None,
@@ -143,6 +146,7 @@
     @param ip_src IP source
     @param ip_dst IP destination
     @param ip_tos IP ToS
+    @param ip_ttl IP TTL
     @param udp_dport UDP destination port
     @param udp_sport UDP source port
 
@@ -157,16 +161,16 @@
     if (dl_vlan_enable):
         pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
             scapy.Dot1Q(prio=dl_vlan_pcp, id=dl_vlan_cfi, vlan=dl_vlan)/ \
-            scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ihl=ip_ihl)/ \
+            scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl)/ \
             scapy.UDP(sport=udp_sport, dport=udp_dport)
     else:
         if not ip_options:
             pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
-                scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ihl=ip_ihl)/ \
+                scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl)/ \
                 scapy.UDP(sport=udp_sport, dport=udp_dport)
         else:
             pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
-                scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ihl=ip_ihl, options=ip_options)/ \
+                scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl, options=ip_options)/ \
                 scapy.UDP(sport=udp_sport, dport=udp_dport)
 
     pkt = pkt/("D" * (pktlen - len(pkt)))
@@ -182,6 +186,7 @@
                       ip_src='192.168.0.1',
                       ip_dst='192.168.0.2',
                       ip_tos=0,
+                      ip_ttl=64,
                       icmp_type=8,
                       icmp_code=0
                       ):
@@ -198,6 +203,7 @@
     @param ip_src IP source
     @param ip_dst IP destination
     @param ip_tos IP ToS
+    @param ip_ttl IP TTL
     @param icmp_type ICMP type
     @param icmp_code ICMP code
 
@@ -212,11 +218,11 @@
     if (dl_vlan_enable):
         pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
             scapy.Dot1Q(prio=dl_vlan_pcp, id=0, vlan=dl_vlan)/ \
-            scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos)/ \
+            scapy.IP(src=ip_src, dst=ip_dst, ttl=ip_ttl, tos=ip_tos)/ \
             scapy.ICMP(type=icmp_type, code=icmp_code)
     else:
         pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
-            scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos)/ \
+            scapy.IP(src=ip_src, dst=ip_dst, ttl=ip_ttl, tos=ip_tos)/ \
             scapy.ICMP(type=icmp_type, code=icmp_code)
 
     pkt = pkt/("0" * (pktlen - len(pkt)))
@@ -249,6 +255,7 @@
                     ip_src='192.168.0.1',
                     ip_dst='192.168.0.2',
                     ip_tos=0,
+                    ip_ttl=64,
                     tcp_sport=1234,
                     tcp_dport=80,
                     ip_ihl=None,
@@ -285,7 +292,7 @@
     pkt = scapy.Ether(dst=dl_dst, src=dl_src)/ \
           scapy.Dot1Q(prio=dl_vlan_pcp_outer, id=dl_vlan_cfi_outer, vlan=dl_vlan_outer)/ \
           scapy.Dot1Q(prio=dl_vlan_pcp, id=dl_vlan_cfi, vlan=dl_vlan)/ \
-          scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ihl=ip_ihl)/ \
+          scapy.IP(src=ip_src, dst=ip_dst, tos=ip_tos, ttl=ip_ttl, ihl=ip_ihl)/ \
           scapy.TCP(sport=tcp_sport, dport=tcp_dport)
 
     pkt = pkt/("D" * (pktlen - len(pkt)))