tests: python3 changes for span and aclplugin test
Type: fix Change-Id: Ia9f74f951f831cc5c9b5af863db1bb3f7a1a81ff Signed-off-by: snaramre <snaramre@cisco.com>
This commit is contained in:
@ -125,7 +125,7 @@ class TestACLplugin(VppTestCase):
|
|||||||
count = 16
|
count = 16
|
||||||
start = 0
|
start = 0
|
||||||
n_int = len(cls.pg_interfaces)
|
n_int = len(cls.pg_interfaces)
|
||||||
macs_per_if = count / n_int
|
macs_per_if = count // n_int
|
||||||
i = -1
|
i = -1
|
||||||
for pg_if in cls.pg_interfaces:
|
for pg_if in cls.pg_interfaces:
|
||||||
i += 1
|
i += 1
|
||||||
@ -133,7 +133,7 @@ class TestACLplugin(VppTestCase):
|
|||||||
end_nr = count + start if i == (n_int - 1) \
|
end_nr = count + start if i == (n_int - 1) \
|
||||||
else macs_per_if * (i + 1) + start
|
else macs_per_if * (i + 1) + start
|
||||||
hosts = cls.hosts_by_pg_idx[pg_if.sw_if_index]
|
hosts = cls.hosts_by_pg_idx[pg_if.sw_if_index]
|
||||||
for j in range(start_nr, end_nr):
|
for j in range(int(start_nr), int(end_nr)):
|
||||||
host = Host(
|
host = Host(
|
||||||
"00:00:00:ff:%02x:%02x" % (pg_if.sw_if_index, j),
|
"00:00:00:ff:%02x:%02x" % (pg_if.sw_if_index, j),
|
||||||
"172.17.1%02x.%u" % (pg_if.sw_if_index, j),
|
"172.17.1%02x.%u" % (pg_if.sw_if_index, j),
|
||||||
@ -175,8 +175,8 @@ class TestACLplugin(VppTestCase):
|
|||||||
% self.bd_id))
|
% self.bd_id))
|
||||||
|
|
||||||
def create_rule(self, ip=0, permit_deny=0, ports=PORTS_ALL, proto=-1,
|
def create_rule(self, ip=0, permit_deny=0, ports=PORTS_ALL, proto=-1,
|
||||||
s_prefix=0, s_ip='\x00\x00\x00\x00',
|
s_prefix=0, s_ip=b'\x00\x00\x00\x00',
|
||||||
d_prefix=0, d_ip='\x00\x00\x00\x00'):
|
d_prefix=0, d_ip=b'\x00\x00\x00\x00'):
|
||||||
if proto == -1:
|
if proto == -1:
|
||||||
return
|
return
|
||||||
if ports == self.PORTS_ALL:
|
if ports == self.PORTS_ALL:
|
||||||
@ -314,7 +314,7 @@ class TestACLplugin(VppTestCase):
|
|||||||
dst_hosts = self.hosts_by_pg_idx[dst_if.sw_if_index]
|
dst_hosts = self.hosts_by_pg_idx[dst_if.sw_if_index]
|
||||||
n_int = len(dst_hosts) * len(src_hosts)
|
n_int = len(dst_hosts) * len(src_hosts)
|
||||||
for i in range(0, n_int):
|
for i in range(0, n_int):
|
||||||
dst_host = dst_hosts[i / len(src_hosts)]
|
dst_host = dst_hosts[int(i / len(src_hosts))]
|
||||||
src_host = src_hosts[i % len(src_hosts)]
|
src_host = src_hosts[i % len(src_hosts)]
|
||||||
pkt_info = self.create_packet_info(src_if, dst_if)
|
pkt_info = self.create_packet_info(src_if, dst_if)
|
||||||
if ipv6 == 1:
|
if ipv6 == 1:
|
||||||
|
@ -218,7 +218,7 @@ class MethodHolder(VppTestCase):
|
|||||||
ip6 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
ip6 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||||
prefix_len4 = 0
|
prefix_len4 = 0
|
||||||
prefix_len6 = 0
|
prefix_len6 = 0
|
||||||
rules_count[(acl / 2) - 1] = 1
|
rules_count[int((acl / 2) - 1)] = 1
|
||||||
else:
|
else:
|
||||||
prefix_len4 = 24
|
prefix_len4 = 24
|
||||||
prefix_len6 = 64
|
prefix_len6 = 64
|
||||||
@ -235,7 +235,7 @@ class MethodHolder(VppTestCase):
|
|||||||
ip = ip6 if is_ip6 else ip4
|
ip = ip6 if is_ip6 else ip4
|
||||||
ip_len = prefix_len6 if is_ip6 else prefix_len4
|
ip_len = prefix_len6 if is_ip6 else prefix_len4
|
||||||
|
|
||||||
for i in range(0, rules_count[(acl / 2) - 1]):
|
for i in range(0, (rules_count[int((acl / 2) - 1)])):
|
||||||
src_mac += 16777217
|
src_mac += 16777217
|
||||||
if mac_type == self.WILD_MAC:
|
if mac_type == self.WILD_MAC:
|
||||||
mac = "00:00:00:00:00:00"
|
mac = "00:00:00:00:00:00"
|
||||||
|
@ -144,7 +144,7 @@ class TestSpan(VppTestCase):
|
|||||||
|
|
||||||
for i in range(0, self.pkts_per_burst):
|
for i in range(0, self.pkts_per_burst):
|
||||||
payload = "span test"
|
payload = "span test"
|
||||||
size = packet_sizes[(i / 2) % len(packet_sizes)]
|
size = packet_sizes[int((i / 2) % len(packet_sizes))]
|
||||||
p = (Ether(src=src_if.local_mac, dst=dst_mac) /
|
p = (Ether(src=src_if.local_mac, dst=dst_mac) /
|
||||||
IP(src=src_if.remote_ip4, dst=dst_if.remote_ip4) /
|
IP(src=src_if.remote_ip4, dst=dst_if.remote_ip4) /
|
||||||
UDP(sport=10000 + src_if.sw_if_index * 1000 + i, dport=1234) /
|
UDP(sport=10000 + src_if.sw_if_index * 1000 + i, dport=1234) /
|
||||||
|
Reference in New Issue
Block a user