summaryrefslogtreecommitdiffstats
path: root/test/template_bd.py
diff options
context:
space:
mode:
authorEyal Bari <ebari@cisco.com>2017-01-11 13:39:54 +0200
committerJohn Lo <loj@cisco.com>2017-01-11 15:08:18 +0000
commitd81da8c0b5094de6635ad9575a2a2bb6f44070dc (patch)
treefc0c13e143b82a6c08e6d5253c38c1ceac4f4a5e /test/template_bd.py
parent724f64ccf691e170973bdcdc6c09bfdc7e2ab5e4 (diff)
vxlan unit test - minor fixes
moved ip4_range and ip4n_range to util added n_ucast_tunnels Change-Id: I9140c4e54a0636d90a97db03da842f5183319af5 Signed-off-by: Eyal Bari <ebari@cisco.com>
Diffstat (limited to 'test/template_bd.py')
-rw-r--r--test/template_bd.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/test/template_bd.py b/test/template_bd.py
index 6c384922bbd..91d5dd719f4 100644
--- a/test/template_bd.py
+++ b/test/template_bd.py
@@ -5,6 +5,8 @@ from abc import abstractmethod, ABCMeta
from scapy.layers.l2 import Ether, Raw
from scapy.layers.inet import IP, UDP
+from util import ip4_range
+
class BridgeDomain(object):
""" Bridge domain abstraction """
@@ -110,7 +112,7 @@ class BridgeDomain(object):
self.pg_start()
# Get packet from each tunnel and assert it's corectly encapsulated.
- out = self.pg0.get_capture(10)
+ out = self.pg0.get_capture(self.n_ucast_tunnels)
for pkt in out:
self.check_encapsulation(pkt, self.ucast_flood_bd, True)
payload = self.decapsulate(pkt)
@@ -135,10 +137,6 @@ class BridgeDomain(object):
payload = self.decapsulate(pkt)
self.assert_eq_pkts(payload, self.frame_reply)
- @staticmethod
- def ipn_to_ip(ipn):
- return '.'.join(str(i) for i in bytearray(ipn))
-
def test_mcast_rcv(self):
""" Multicast receive test
Send 20 encapsulated frames from pg0 only 10 match unicast tunnels
@@ -148,10 +146,9 @@ class BridgeDomain(object):
ip_range_start = 10
ip_range_end = 30
mcast_stream = [
- self.encap_mcast(self.frame_request, self.ipn_to_ip(ip), mac,
- self.mcast_flood_bd)
- for ip in self.ip4_range(self.pg0.remote_ip4n,
- ip_range_start, ip_range_end)]
+ self.encap_mcast(self.frame_request, ip, mac, self.mcast_flood_bd)
+ for ip in ip4_range(self.pg0.remote_ip4,
+ ip_range_start, ip_range_end)]
self.pg0.add_stream(mcast_stream)
self.pg2.enable_capture()
self.pg_start()