Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
nat: use correct data types for memory sizes
[vpp.git]
/
test
/
test_l2_fib.py
diff --git
a/test/test_l2_fib.py
b/test/test_l2_fib.py
index
97915a3
..
51c1747
100644
(file)
--- a/
test/test_l2_fib.py
+++ b/
test/test_l2_fib.py
@@
-1,4
+1,4
@@
-#!/usr/bin/env python
+#!/usr/bin/env python
3
"""L2 FIB Test Case HLD:
**config 1**
"""L2 FIB Test Case HLD:
**config 1**
@@
-69,12
+69,7
@@
from scapy.layers.inet import IP, UDP
from framework import VppTestCase, VppTestRunner
from util import Host, ppp
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):
class TestL2fib(VppTestCase):
@@
-131,6
+126,10
@@
class TestL2fib(VppTestCase):
super(TestL2fib, cls).tearDownClass()
raise
super(TestL2fib, cls).tearDownClass()
raise
+ @classmethod
+ def tearDownClass(cls):
+ super(TestL2fib, cls).tearDownClass()
+
def setUp(self):
super(TestL2fib, self).setUp()
self.reset_packet_infos()
def setUp(self):
super(TestL2fib, self).setUp()
self.reset_packet_infos()
@@
-141,11
+140,13
@@
class TestL2fib(VppTestCase):
"""
super(TestL2fib, self).tearDown()
if not self.vpp_dead:
"""
super(TestL2fib, self).tearDown()
if not self.vpp_dead:
- self.logger.info(self.vapi.ppcli("show l2fib verbose"))
for bd_id in self.n_brs:
self.logger.info(self.vapi.ppcli("show bridge-domain %s detail"
% bd_id))
for bd_id in self.n_brs:
self.logger.info(self.vapi.ppcli("show bridge-domain %s detail"
% bd_id))
+ def show_commands_at_teardown(self):
+ self.logger.info(self.vapi.ppcli("show l2fib verbose"))
+
def create_hosts(self, n_hosts_per_if, subnet):
"""
Create required number of host MAC addresses and distribute them among
def create_hosts(self, n_hosts_per_if, subnet):
"""
Create required number of host MAC addresses and distribute them among
@@
-319,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)
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:
self.logger.error(ppp("Unexpected or invalid packet:", packet))
raise
for i in self.pg_interfaces:
@@
-488,9
+489,10
@@
class TestL2fib(VppTestCase):
self.sleep(1)
self.logger.info(self.vapi.ppcli("show l2fib"))
evs = self.vapi.collect_events()
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 = {
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)
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)
@@
-512,9
+514,10
@@
class TestL2fib(VppTestCase):
self.vapi.want_l2_macs_events(enable_disable=0)
self.assertGreater(len(evs), 0)
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 = {
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]}
macs = {h.bin_mac for swif in self.bd_ifs(bd1)
for h in hosts[self.pg_interfaces[swif].sw_if_index]}