@@ -44,7 +44,7 @@ import re
import time
import os
-from packet import Packet, NVGRE, IPPROTO_NVGRE
+from packet import Packet
from scapy.utils import wrpcap, rdpcap
from scapy.packet import split_layers,bind_layers
@@ -80,7 +80,6 @@ class TestIpgre(TestCase):
self.tester_iface = self.tester.get_interface(tester_port)
self.tester_iface_mac = self.tester.get_mac(tester_port)
self.initialize_port_config()
- self.re_bind_nvgre_to_gre()
def initialize_port_config(self):
self.outer_mac_src = '00:00:10:00:00:00'
@@ -142,10 +141,6 @@ class TestIpgre(TestCase):
wrpcap("/tmp/ref_pkt.pcap", pkt.pktgen.pkt)
time.sleep(1)
- def re_bind_nvgre_to_gre(self):
- split_layers(IP, NVGRE, frag=0, proto=IPPROTO_NVGRE)
- bind_layers(IP, GRE, frag=0, proto=IPPROTO_NVGRE)
-
def get_chksums(self, pcap=None):
"""
get chksum values of Outer and Inner packet L3&L4
@@ -48,9 +48,8 @@ from socket import AF_INET6
from scapy.utils import struct, socket, wrpcap, rdpcap
from scapy.layers.inet import Ether, IP, TCP, UDP
from scapy.layers.inet6 import IPv6
-from scapy.layers.l2 import Dot1Q
+from scapy.layers.l2 import Dot1Q, GRE
from scapy.layers.sctp import SCTP, SCTPChunkData
-from nvgre import NVGRE
from scapy.sendrecv import sniff
from scapy.config import conf
from scapy.route import *
@@ -307,7 +306,7 @@ class NvgreTestConfig(object):
GRE package: outer/GRE header/inner
"""
if self.outer_ip_proto == 47:
- self.pkt = outer / NVGRE() / inner
+ self.pkt = outer / GRE(key_present=1,proto=0x6558,key=0x00000100) / inner
else:
self.pkt = outer / ("X" * self.payload_size)
@@ -332,8 +331,8 @@ class NvgreTestConfig(object):
if payload.guess_payload_class(payload).name == "IP":
chk_sums['outer_ip'] = hex(payload[IP].chksum)
- if pkts[0].haslayer(NVGRE) == 1:
- inner = pkts[0][NVGRE]
+ if pkts[0].haslayer(GRE) == 1:
+ inner = pkts[0][GRE]
if inner.haslayer(IP) == 1:
chk_sums['inner_ip'] = hex(inner[IP].chksum)
if inner[IP].proto == 6:
@@ -101,16 +101,6 @@ class TestTSO(TestCase):
"""
pass
- def load_module(self):
- """
- Load vxlan or nvgre module to scapy.
- """
- cwd = os.getcwd()
- dir_module = cwd + r'/' + 'dep' + '/scapy_modules'
- self.tester.scapy_append('sys.path.append("%s")' % dir_module)
- self.tester.scapy_append("from vxlan import VXLAN")
- self.tester.scapy_append('from nvgre import NVGRE')
-
def tcpdump_start_sniffing(self, ifaces=[]):
"""
Starts tcpdump in the background to sniff the tester interface where
@@ -347,7 +337,6 @@ class TestTSO(TestCase):
for loading_size in self.loading_sizes:
# Vxlan test
self.tcpdump_start_sniffing([tx_interface, rx_interface])
- self.load_module()
out = self.dut.send_expect("clear port stats all", "testpmd> ", 120)
self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/UDP(sport=1021,dport=4789)/VXLAN()/Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, mac, loading_size, tx_interface))
out = self.tester.scapy_execute()
@@ -371,9 +360,8 @@ class TestTSO(TestCase):
for loading_size in self.loading_sizes:
# Nvgre test
self.tcpdump_start_sniffing([tx_interface, rx_interface])
- self.load_module()
out = self.dut.send_expect("clear port stats all", "testpmd> ", 120)
- self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2",proto=47)/NVGRE()/Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, mac, loading_size, tx_interface))
+ self.tester.scapy_append('sendp([Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2",proto=47)/GRE(key_present=1,proto=0x6558,key=0x00001000)/Ether(dst="%s",src="52:00:00:00:00:00")/IP(src="192.168.1.1",dst="192.168.1.2")/TCP(sport=1021,dport=1021)/("X"*%s)], iface="%s")' % (mac, mac, loading_size, tx_interface))
out = self.tester.scapy_execute()
out = self.dut.send_expect("show port stats all", "testpmd> ", 120)
print(out)