From f48af2a44cfd1ea6c7963c702187343a31880d19 Mon Sep 17 00:00:00 2001
From: Guillaume Valadon <guillaume.valadon@ssi.gouv.fr>
Date: Thu, 14 Sep 2017 11:36:53 +0200
Subject: [PATCH] OSPF unit tests improved

---
 {test => scapy/contrib}/ospf.uts | 17 +++++++++++------
 scapy/fields.py                  |  1 +
 2 files changed, 12 insertions(+), 6 deletions(-)
 rename {test => scapy/contrib}/ospf.uts (78%)

diff --git a/test/ospf.uts b/scapy/contrib/ospf.uts
similarity index 78%
rename from test/ospf.uts
rename to scapy/contrib/ospf.uts
index bde90303..0dc1d6e1 100644
--- a/test/ospf.uts
+++ b/scapy/contrib/ospf.uts
@@ -1,6 +1,11 @@
-##############################
-% OSPF Related regression tests
-##############################
+# OSPF Related regression tests
+#
+# Type the following command to launch start the tests:
+# $ test/run_tests -P "load_contrib('ospf')" -t scapy/contrib/ospf.uts
+
++ OSPF
+
+= OSPF, basic instanciation
 
 data = '\x01\x00^\x00\x00\x05\x00\xe0\x18\xb1\x0c\xad\x08\x00E\xc0\x00T\x08\x19\x00\x00\x01Ye\xc2\xc0\xa8\xaa\x08\xe0\x00\x00\x05\x02\x04\x00@\xc0\xa8\xaa\x08\x00\x00\x00\x01\x96\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x03\xe2\x02\x01\xc0\xa8\xaa\x08\xc0\xa8\xaa\x08\x80\x00\r\xc3%\x06\x00$\x02\x00\x00\x01\xc0\xa8\xaa\x00\xff\xff\xff\x00\x03\x00\x00\n'
 
@@ -10,8 +15,8 @@ assert (p[OSPF_LSUpd][OSPF_Router_LSA].age == 994)
 assert (p[OSPF_LSUpd][OSPF_Router_LSA].type == 1)
 assert (p[OSPF_LSUpd][OSPF_Router_LSA].id == '192.168.170.8')
 assert (p[OSPF_LSUpd][OSPF_Router_LSA].adrouter == '192.168.170.8')
-assert (hex(p[OSPF_LSUpd][OSPF_Router_LSA].seq) == '0x80000dc3')
-assert (hex(p[OSPF_LSUpd][OSPF_Router_LSA].chksum) == '0x2506')
+assert (p[OSPF_LSUpd][OSPF_Router_LSA].seq == 0x80000dc3)
+assert (p[OSPF_LSUpd][OSPF_Router_LSA].chksum == 0x2506)
 assert (p[OSPF_LSUpd][OSPF_Router_LSA].len == 36)
 assert (p[OSPF_LSUpd][OSPF_Router_LSA].reserved == 0)
 assert (p[OSPF_LSUpd][OSPF_Router_LSA].linkcount == 1)
@@ -20,4 +25,4 @@ assert (p[OSPF_LSUpd][OSPF_Router_LSA].linklist[0][OSPF_Link].id == '192.168.170
 assert (p[OSPF_LSUpd][OSPF_Router_LSA].linklist[0][OSPF_Link].data == '255.255.255.0')
 assert (p[OSPF_LSUpd][OSPF_Router_LSA].linklist[0][OSPF_Link].type == 3)
 assert (p[OSPF_LSUpd][OSPF_Router_LSA].linklist[0][OSPF_Link].toscount == 0)
-assert (p[OSPF_LSUpd][OSPF_Router_LSA].linklist[0][OSPF_Link].metric == 10)
\ No newline at end of file
+assert (p[OSPF_LSUpd][OSPF_Router_LSA].linklist[0][OSPF_Link].metric == 10)
diff --git a/scapy/fields.py b/scapy/fields.py
index 73161055..28ff64d9 100644
--- a/scapy/fields.py
+++ b/scapy/fields.py
@@ -439,6 +439,7 @@ class PacketListField(PacketField):
         self.count_from = count_from
         self.length_from = length_from
 
+
     def any2i(self, pkt, x):
         if not isinstance(x, list):
             return [x]
-- 
GitLab