VPP-1505 VPP-1508 Remove dep.: py_lispnetworking 41/16141/2
authorPaul Vinciguerra <pvinci@vinciconsulting.com>
Fri, 23 Nov 2018 11:20:21 +0000 (03:20 -0800)
committerPaul Vinciguerra <pvinci@vinciconsulting.com>
Sun, 25 Nov 2018 03:59:30 +0000 (19:59 -0800)
test_lisp.py No longer needs the external dependency to run.

py27 runtests: commands[6] | stestr --test-path ./test run --slowest test_lisp
==============================================================================
Basic LISP test
==============================================================================
{0} test.test_lisp.TestLisp.test_lisp_basic_encap [0.487960s] ... ok

======
Totals
======
Ran: 1 tests in 18.0000 sec.
 - Passed: 1
 - Skipped: 0
 - Expected Fail: 0
 - Unexpected Success: 0
 - Failed: 0
Sum of execute time for each test: 0.4880 sec.

==============
Worker Balance
==============
 - Worker 0 (1 tests) => 0:00:00.487960
Test id                                        Runtime (s)
---------------------------------------------  -----------
test.test_lisp.TestLisp.test_lisp_basic_encap  0.488
______________________________________________________ summary ______________________________________________________
  py27: commands succeeded
  congratulations :)
vagrant@vpp:/vpp$

Change-Id: I35b35f8ddaed79066b3ed62fa0460c9ea83273c2
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
test/Makefile
test/lisp.py
test/test_lisp.py

index 5b4a965..9f13e90 100644 (file)
@@ -73,7 +73,7 @@ PYTHON_EXTRA_DEPENDS=
 endif
 
 PYTHON_VENV_PATH=$(VPP_PYTHON_PREFIX)/virtualenv
-PYTHON_DEPENDS=$(PYTHON_EXTRA_DEPENDS) psutil faulthandler six scapy==2.4.0 pexpect cryptography subprocess32 cffi syslog-rfc5424-parser git+https://github.com/vpp-dev/py-lispnetworking
+PYTHON_DEPENDS=$(PYTHON_EXTRA_DEPENDS) psutil faulthandler six scapy==2.4.0 pexpect cryptography subprocess32 cffi syslog-rfc5424-parser
 SCAPY_SOURCE=$(shell find $(PYTHON_VENV_PATH) -name site-packages)
 BUILD_COV_DIR=$(BR)/test-cov
 
index 865070d..a1f0c16 100644 (file)
@@ -1,10 +1,4 @@
-from random import randint
-from socket import AF_INET, AF_INET6
-from scapy.all import *
-from scapy.packet import *
 from scapy.fields import *
-from lisp import *
-from framework import *
 from vpp_object import *
 
 
@@ -292,7 +286,8 @@ class VppLispAdjacency(VppObject):
                 reid_len=self._reid.prefix_length, vni=self._vni)
         self._test.registry.register(self, self.test.logger)
 
-    def eid_equal(self, eid, eid_type, eid_data, prefix_len):
+    @staticmethod
+    def eid_equal(eid, eid_type, eid_data, prefix_len):
         if eid.eid_type != eid_type:
             return False
 
index cfe8e0a..b6272dc 100644 (file)
@@ -1,13 +1,31 @@
 #!/usr/bin/env python
 import unittest
 
-from scapy.packet import Raw
+from scapy.fields import BitField, ByteField, FlagsField, IntField
+from scapy.packet import bind_layers, Packet, Raw
 from scapy.layers.inet import IP, UDP, Ether
-from py_lispnetworking.lisp import LISP_GPE_Header
+from scapy.layers.inet6 import IPv6
 
-from util import ppp, ForeignAddressFactory
 from framework import VppTestCase, VppTestRunner
 from lisp import *
+from util import ppp, ForeignAddressFactory
+
+# From py_lispnetworking.lisp.py:  # GNU General Public License v2.0
+
+
+class LISP_GPE_Header(Packet):
+    name = "LISP GPE Header"
+    fields_desc = [
+        FlagsField("gpe_flags", None, 6, ["N", "L", "E", "V", "I", "P"]),
+        BitField("reserved", 0, 18),
+        ByteField("next_proto", 0),
+        IntField("iid", 0),
+    ]
+bind_layers(UDP, LISP_GPE_Header, dport=4341)
+bind_layers(UDP, LISP_GPE_Header, sport=4341)
+bind_layers(LISP_GPE_Header, IP, next_proto=1)
+bind_layers(LISP_GPE_Header, IPv6, next_proto=2)
+bind_layers(LISP_GPE_Header, Ether, next_proto=3)
 
 
 class Driver(object):