summaryrefslogtreecommitdiffstats
path: root/test/test_l2_fib.py
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2019-10-24 13:52:42 +0200
committerOle Trøan <otroan@employees.org>2020-03-09 13:46:29 +0000
commit145e330f019920b5ef77f4e8b3fa70de3228710d (patch)
tree7eede6c2dfa7a3f0568071c9f1bbf6aa8319fb71 /test/test_l2_fib.py
parent262971e7830413c58b9b45965f799f540e634437 (diff)
l2: API cleanup
Use consistent API types. Type: fix Change-Id: I7ac7cd00606101864fa3422e7b9ea2f1143665dd Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'test/test_l2_fib.py')
-rw-r--r--test/test_l2_fib.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/test/test_l2_fib.py b/test/test_l2_fib.py
index 106a7902da5..51c17470966 100644
--- a/test/test_l2_fib.py
+++ b/test/test_l2_fib.py
@@ -69,12 +69,7 @@ from scapy.layers.inet import IP, UDP
from framework import VppTestCase, VppTestRunner
from util import Host, ppp
-from vpp_papi import mac_pton
-
-# from src/vnet/l2/l2_fib.h
-MAC_EVENT_ACTION_ADD = 0
-MAC_EVENT_ACTION_DELETE = 1
-MAC_EVENT_ACTION_MOVE = 2
+from vpp_papi import mac_pton, VppEnum
class TestL2fib(VppTestCase):
@@ -325,7 +320,7 @@ class TestL2fib(VppTestCase):
self.assertEqual(ip.dst, saved_packet[IP].dst)
self.assertEqual(udp.sport, saved_packet[UDP].sport)
self.assertEqual(udp.dport, saved_packet[UDP].dport)
- except:
+ except BaseException:
self.logger.error(ppp("Unexpected or invalid packet:", packet))
raise
for i in self.pg_interfaces:
@@ -494,9 +489,10 @@ class TestL2fib(VppTestCase):
self.sleep(1)
self.logger.info(self.vapi.ppcli("show l2fib"))
evs = self.vapi.collect_events()
+ action = VppEnum.vl_api_mac_event_action_t.MAC_EVENT_ACTION_API_ADD
learned_macs = {
- e.mac[i].mac_addr for e in evs for i in range(e.n_macs)
- if e.mac[i].action == MAC_EVENT_ACTION_ADD}
+ e.mac[i].mac_addr.packed for e in evs for i in range(e.n_macs)
+ if e.mac[i].action == action}
macs = {h.bin_mac for swif in self.bd_ifs(bd1)
for h in hosts[self.pg_interfaces[swif].sw_if_index]}
self.vapi.want_l2_macs_events(enable_disable=0)
@@ -518,9 +514,10 @@ class TestL2fib(VppTestCase):
self.vapi.want_l2_macs_events(enable_disable=0)
self.assertGreater(len(evs), 0)
+ action = VppEnum.vl_api_mac_event_action_t.MAC_EVENT_ACTION_API_ADD
learned_macs = {
- e.mac[i].mac_addr for e in evs for i in range(e.n_macs)
- if e.mac[i].action == MAC_EVENT_ACTION_ADD}
+ e.mac[i].mac_addr.packed for e in evs for i in range(e.n_macs)
+ if e.mac[i].action == action}
macs = {h.bin_mac for swif in self.bd_ifs(bd1)
for h in hosts[self.pg_interfaces[swif].sw_if_index]}