Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
VPP-1506: dump local punts and registered punt sockets
[vpp.git]
/
test
/
test_l2_fib.py
diff --git
a/test/test_l2_fib.py
b/test/test_l2_fib.py
index
ba2f787
..
436aa10
100644
(file)
--- a/
test/test_l2_fib.py
+++ b/
test/test_l2_fib.py
@@
-70,13
+70,19
@@
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 src/vnet/l2/l2_fib.h
+MAC_EVENT_ACTION_ADD = 0
+MAC_EVENT_ACTION_DELETE = 1
+MAC_EVENT_ACTION_MOVE = 2
+
class TestL2fib(VppTestCase):
""" L2 FIB Test Case """
@classmethod
def bd_ifs(cls, bd_id):
class TestL2fib(VppTestCase):
""" L2 FIB Test Case """
@classmethod
def bd_ifs(cls, bd_id):
- return range((bd_id - 1) * cls.n_ifs_per_bd, bd_id * cls.n_ifs_per_bd)
+ return range((bd_id - 1) * cls.n_ifs_per_bd,
+ bd_id * cls.n_ifs_per_bd - 1)
@classmethod
def setUpClass(cls):
@classmethod
def setUpClass(cls):
@@
-93,7
+99,7
@@
class TestL2fib(VppTestCase):
n_brs = cls.n_brs = range(1, 3)
cls.n_ifs_per_bd = 4
n_ifs = range(cls.n_ifs_per_bd * len(cls.n_brs))
n_brs = cls.n_brs = range(1, 3)
cls.n_ifs_per_bd = 4
n_ifs = range(cls.n_ifs_per_bd * len(cls.n_brs))
- # Create
4
pg interfaces
+ # Create pg interfaces
cls.create_pg_interfaces(n_ifs)
cls.flows = dict()
cls.create_pg_interfaces(n_ifs)
cls.flows = dict()
@@
-385,8
+391,8
@@
class TestL2fib(VppTestCase):
self.config_l2_fib_entries(bd_id, hosts)
self.run_verify_test(bd_id, hosts, hosts)
self.config_l2_fib_entries(bd_id, hosts)
self.run_verify_test(bd_id, hosts, hosts)
- def test_l2_fib_delete12(self):
- """ L2 FIB - program 100
+
delete 12 MACs
+ def test_l2_fib_
program100_
delete12(self):
+ """ L2 FIB - program 100
,
delete 12 MACs
"""
bd_id = 1
hosts = self.create_hosts(100, subnet=17)
"""
bd_id = 1
hosts = self.create_hosts(100, subnet=17)
@@
-397,8
+403,8
@@
class TestL2fib(VppTestCase):
self.run_verify_test(bd_id, hosts, hosts)
self.run_verify_negat_test(bd_id, hosts, del_hosts)
self.run_verify_test(bd_id, hosts, hosts)
self.run_verify_negat_test(bd_id, hosts, del_hosts)
- def test_l2_fib_
add
100_add100(self):
- """ L2 FIB - program 100
+
100 MACs
+ def test_l2_fib_
program
100_add100(self):
+ """ L2 FIB - program 100
, add
100 MACs
"""
bd_id = 1
hosts = self.create_hosts(100, subnet=17)
"""
bd_id = 1
hosts = self.create_hosts(100, subnet=17)
@@
-408,7
+414,7
@@
class TestL2fib(VppTestCase):
self.run_verify_test(bd_id, hosts, hosts2)
def test_l2_fib_program10_learn10(self):
self.run_verify_test(bd_id, hosts, hosts2)
def test_l2_fib_program10_learn10(self):
- """ L2 FIB -
P
rogram 10 MACs, learn 10
+ """ L2 FIB -
p
rogram 10 MACs, learn 10
"""
hosts = self.create_hosts(20, subnet=35)
lhosts = self.split_hosts(hosts, 10)
"""
hosts = self.create_hosts(20, subnet=35)
lhosts = self.split_hosts(hosts, 10)
@@
-483,7
+489,7
@@
class TestL2fib(VppTestCase):
evs = self.vapi.collect_events()
learned_macs = {
e.mac[i].mac_addr for e in evs for i in range(e.n_macs)
evs = self.vapi.collect_events()
learned_macs = {
e.mac[i].mac_addr for e in evs for i in range(e.n_macs)
- if
not e.mac[i].is_del
}
+ if
e.mac[i].action == MAC_EVENT_ACTION_ADD
}
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_macs_learn_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_macs_learn_events(enable_disable=0)
@@
-507,7
+513,7
@@
class TestL2fib(VppTestCase):
self.assertGreater(len(evs), 0)
learned_macs = {
e.mac[i].mac_addr for e in evs for i in range(e.n_macs)
self.assertGreater(len(evs), 0)
learned_macs = {
e.mac[i].mac_addr for e in evs for i in range(e.n_macs)
- if
not e.mac[i].is_del
}
+ if
e.mac[i].action == MAC_EVENT_ACTION_ADD
}
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]}