Tests: Refactor payload_to_info()
All callers of payload_to_info were required to wrap payload with str().
Refactor to call scapy's payload.load for raw payloads or specify the
specific fieldname.
Change-Id: I1c80599d4df8dc129dbb8274733afaad406d5bcf
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
diff --git a/test/test_srv6_as.py b/test/test_srv6_as.py
index 64ff957..1ff7906 100755
--- a/test/test_srv6_as.py
+++ b/test/test_srv6_as.py
@@ -810,14 +810,14 @@
# but packet[Raw] gives the complete payload
# (incl L2 header) for the T.Encaps L2 case
try:
- payload_info = self.payload_to_info(str(packet[Raw]))
+ payload_info = self.payload_to_info(packet[Raw])
except:
# remote L2 header from packet[Raw]:
# take packet[Raw], convert it to an Ether layer
# and then extract Raw from it
payload_info = self.payload_to_info(
- str(Ether(str(packet[Raw]))[Raw]))
+ Ether(str(packet[Raw]))[Raw])
return payload_info