From a7427ec6f86cbeba7594f98e41fecab291d66b73 Mon Sep 17 00:00:00 2001 From: Paul Vinciguerra Date: Sun, 10 Mar 2019 10:04:23 -0700 Subject: VPP-1508: Use scapy.compat to manage packet level library differences. Change-Id: Icdf6abc9e53d33b26fd1d531c7dda6be0bb9cb55 Signed-off-by: Paul Vinciguerra --- test/test_acl_plugin_macip.py | 48 ++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 19 deletions(-) (limited to 'test/test_acl_plugin_macip.py') diff --git a/test/test_acl_plugin_macip.py b/test/test_acl_plugin_macip.py index d2d684abc11..6f99646e6e2 100644 --- a/test/test_acl_plugin_macip.py +++ b/test/test_acl_plugin_macip.py @@ -3,12 +3,14 @@ from __future__ import print_function """ACL plugin - MACIP tests """ import binascii +import ipaddress import random from socket import inet_ntop, inet_pton, AF_INET, AF_INET6 from struct import pack, unpack import re import unittest +import scapy.compat from scapy.packet import Raw from scapy.layers.l2 import Ether from scapy.layers.inet import IP, UDP @@ -194,8 +196,10 @@ class MethodHolder(VppTestCase): return acls def create_rules(self, mac_type=EXACT_MAC, ip_type=EXACT_IP, - acl_count=1, rules_count=[1]): + acl_count=1, rules_count=None): acls = [] + if rules_count is None: + rules_count = [1] src_mac = int("220000dead00", 16) for acl in range(2, (acl_count+1) * 2): rules = [] @@ -248,7 +252,7 @@ class MethodHolder(VppTestCase): ip4[3] = 0 ip6[8] = random.randint(100, 200) ip6[15] = 0 - ip_pack = '' + ip_pack = b'' for j in range(0, len(ip)): ip_pack += pack('