[dts] [PATCH V1 2/3][scapy vxlan] framework: update vxlan name from Vxlan to VXLAN

lihong lihongx.ma at intel.com
Tue Jul 23 02:50:52 CEST 2019


depend on dep/vxlan.py, update Vxlan to VXLAN

Signed-off-by: lihong <lihongx.ma at intel.com>
---
 framework/etgen.py       | 12 ++++++------
 framework/packet.py      |  4 ++--
 framework/pktgen_ixia.py | 14 +++++++-------
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/framework/etgen.py b/framework/etgen.py
index cd6829d..212b9c2 100644
--- a/framework/etgen.py
+++ b/framework/etgen.py
@@ -238,19 +238,19 @@ class IxiaPacketGenerator(SSHConnection):
     def parse_pcap(self, fpcap):
         dump_str1 = "cmds = []\n"
         dump_str2 = "for i in rdpcap('%s', -1):\n" % fpcap
-        dump_str3 = "    if 'Vxlan' in i.command():\n" + \
+        dump_str3 = "    if 'VXLAN' in i.command():\n" + \
                     "        vxlan_str = ''\n" + \
-                    "        l = len(i[Vxlan])\n" + \
-                    "        vxlan = str(i[Vxlan])\n" + \
+                    "        l = len(i[VXLAN])\n" + \
+                    "        vxlan = str(i[VXLAN])\n" + \
                     "        first = True\n" + \
                     "        for j in range(l):\n" + \
                     "            if first:\n" + \
-                    "                vxlan_str += \"Vxlan(hexval='%02X\" %ord(vxlan[j])\n" + \
+                    "                vxlan_str += \"VXLAN(hexval='%02X\" %ord(vxlan[j])\n" + \
                     "                first = False\n" + \
                     "            else:\n" + \
                     "                vxlan_str += \" %02X\" %ord(vxlan[j])\n" + \
                     "        vxlan_str += \"\')\"\n" + \
-                    "        command = re.sub(r\"Vxlan(.*)\", vxlan_str, i.command())\n" + \
+                    "        command = re.sub(r\"VXLAN(.*)\", vxlan_str, i.command())\n" + \
                     "    else:\n" + \
                     "        command = i.command()\n" + \
                     "    cmds.append(command)\n" + \
@@ -375,7 +375,7 @@ class IxiaPacketGenerator(SSHConnection):
                 match = pat.match(header)
                 params = eval('dict(%s)' % match.group(2))
                 method_name = match.group(1)
-                if method_name == 'Vxlan':
+                if method_name == 'VXLAN':
                     method = getattr(self, method_name.lower())
                     method(txport, **params)
                     break
diff --git a/framework/packet.py b/framework/packet.py
index d39479f..502d85c 100755
--- a/framework/packet.py
+++ b/framework/packet.py
@@ -65,7 +65,7 @@ DTS_PATH = exec_file.replace('/framework/packet.py', '')
 DEP_FOLDER = DTS_PATH + '/dep'
 sys.path.append(DEP_FOLDER)
 
-from vxlan import Vxlan
+from vxlan import VXLAN
 from nvgre import NVGRE, IPPROTO_NVGRE
 from lldp import LLDP, LLDPManagementAddress
 from Dot1BR import Dot1BR
@@ -123,7 +123,7 @@ class scapy(object):
         'icmp': ICMP(),
         'gre': GRE(),
         'raw': Raw(),
-        'vxlan': Vxlan(),
+        'vxlan': VXLAN(),
 
         'inner_mac': Ether(),
         'inner_vlan': Dot1Q(),
diff --git a/framework/pktgen_ixia.py b/framework/pktgen_ixia.py
index 80481fe..2895c6b 100644
--- a/framework/pktgen_ixia.py
+++ b/framework/pktgen_ixia.py
@@ -141,19 +141,19 @@ class Ixia(SSHConnection):
 
         dump_str1 = "cmds = []\n"
         dump_str2 = "for i in rdpcap('%s', -1):\n" % pcap_path
-        dump_str3 = "    if 'Vxlan' in i.command():\n" + \
+        dump_str3 = "    if 'VXLAN' in i.command():\n" + \
                     "        vxlan_str = ''\n" + \
-                    "        l = len(i[Vxlan])\n" + \
-                    "        vxlan = str(i[Vxlan])\n" + \
+                    "        l = len(i[VXLAN])\n" + \
+                    "        vxlan = str(i[VXLAN])\n" + \
                     "        first = True\n" + \
                     "        for j in range(l):\n" + \
                     "            if first:\n" + \
-                    "                vxlan_str += \"Vxlan(hexval='%02X\" %ord(vxlan[j])\n" + \
+                    "                vxlan_str += \"VXLAN(hexval='%02X\" %ord(vxlan[j])\n" + \
                     "                first = False\n" + \
                     "            else:\n" + \
                     "                vxlan_str += \" %02X\" %ord(vxlan[j])\n" + \
                     "        vxlan_str += \"\')\"\n" + \
-                    "        command = re.sub(r\"Vxlan(.*)\", vxlan_str, i.command())\n" + \
+                    "        command = re.sub(r\"VXLAN(.*)\", vxlan_str, i.command())\n" + \
                     "    else:\n" + \
                     "        command = i.command()\n" + \
                     "    cmds.append(command)\n" + \
@@ -502,7 +502,7 @@ class Ixia(SSHConnection):
                 match = pat.match(header)
                 params = eval('dict(%s)' % match.group(2))
                 method_name = match.group(1)
-                if method_name == 'Vxlan':
+                if method_name == 'VXLAN':
                     method = getattr(self, method_name.lower())
                     method(ixia_port, vm.get('fields_config', {}), **params)
                     break
@@ -1747,4 +1747,4 @@ class IxiaPacketGenerator(PacketGenerator):
         ''' close ixia session '''
         if self._conn is not None:
             self._disconnect()
-        return
\ No newline at end of file
+        return
-- 
2.7.4



More information about the dts mailing list