[V1,1/2] framework/packet: Add GTPU and GENEVE support for packet module.

Message ID 20230704064726.455361-2-ke1.xu@intel.com (mailing list archive)
State Superseded
Headers
Series Updating packet module for new util functions and packet types. |

Commit Message

Ke Xu July 4, 2023, 6:47 a.m. UTC
  Implemented GTPU and GENEVE layer in packet module.

Packet module only supports limited tunneling layers like VxLAN,
 GRE. New packet types are required in recent DPDK releases and
 GTPU and GENEVE are required to be added.

Signed-off-by: Ke Xu <ke1.xu@intel.com>
---
 framework/packet.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
  

Patch

diff --git a/framework/packet.py b/framework/packet.py
index 2c16e7cb..c44c955f 100644
--- a/framework/packet.py
+++ b/framework/packet.py
@@ -17,6 +17,8 @@  import time
 from importlib import import_module
 from socket import AF_INET6
 
+from scapy.contrib.geneve import GENEVE
+from scapy.contrib.gtp import GTP_U_Header, GTPPDUSessionContainer
 from scapy.contrib.lldp import LLDPDU, LLDPDUManagementAddress
 from scapy.contrib.mpls import MPLS
 from scapy.contrib.nsh import NSH
@@ -51,6 +53,7 @@  scapy_modules_required = {
         "GTPEchoRequest",
         "GTPEchoResponse",
     ],
+    "scapy.contrib.geneve": ["GENEVE"],
     "scapy.contrib.lldp": ["LLDPDU", "LLDPDUManagementAddress"],
     "scapy.contrib.pfcp": ["PFCP"],
     "scapy.contrib.nsh": ["NSH"],
@@ -90,7 +93,7 @@  LayersTypes = {
     # <'ether type'=0x0800 'version'=4, 'protocol'=17 'destination port'=4789>
     # or
     # <'ether type'=0x86DD 'version'=6, 'next header'=17 'destination port'=4789>
-    "TUNNEL": ["ip", "gre", "vxlan", "nvgre", "geneve", "grenat"],
+    "TUNNEL": ["ip", "gre", "vxlan", "nvgre", "gtpu", "geneve", "grenat"],
     "INNER L2": ["inner_mac", "inner_vlan"],
     # inner_ipv4_unknown, inner_ipv6_unknown
     "INNER L3": ["inner_ipv4", "inner_ipv4_ext", "inner_ipv6", "inner_ipv6_ext"],
@@ -167,7 +170,8 @@  class scapy(object):
         "ipv6_in_ip": IP() / IPv6(src="::1"),
         "ipv6_frag_in_ip": IP() / IPv6(src="::1", nh=44) / IPv6ExtHdrFragment(),
         "nvgre": GRE(key_present=1, proto=0x6558, key=0x00000100),
-        "geneve": "Not Implement",
+        "gtpu": GTP_U_Header(gtp_type=255, teid=0x123456),
+        "geneve": GENEVE(),
     }
 
     def __init__(self):