summaryrefslogtreecommitdiff
path: root/cesar/test_general/dataplane
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/test_general/dataplane')
-rw-r--r--cesar/test_general/dataplane/py/basic.py27
-rw-r--r--cesar/test_general/dataplane/py/test_dataplane/__init__.py21
-rw-r--r--cesar/test_general/dataplane/py/test_dataplane/test_dataplane.py1
3 files changed, 48 insertions, 1 deletions
diff --git a/cesar/test_general/dataplane/py/basic.py b/cesar/test_general/dataplane/py/basic.py
new file mode 100644
index 0000000000..4d77e3f183
--- /dev/null
+++ b/cesar/test_general/dataplane/py/basic.py
@@ -0,0 +1,27 @@
+from test_dataplane import *
+
+bp_tck = 5000000
+
+t1, t2 = begin (2)
+
+t1.sync ()
+
+t1.set_config (tei = 1, snid = 1, authenticated = True, mac = 0x010000010100)
+t2.set_config (tei = 2, snid = 1, authenticated = True, mac = 0x020000010100)
+
+add_mac (t1, t2)
+
+t1.set_beacon_period (glid = 0xff, coex = 0, beacon_period_tck = bp_tck,
+ sync = True)
+t2.set_beacon_period (glid = 0xff, coex = 0, beacon_period_tck = bp_tck,
+ sync = True)
+
+t2.set_tonemap (RX, tei = 1, tmi = 5, bits = 8)
+t1.set_tonemap (TX, tei = 2, tmi = 5, bits = 8)
+t1.set_tonemap (RX, tei = 2, tmi = 6, bits = 8)
+t2.set_tonemap (TX, tei = 1, tmi = 6, bits = 8)
+
+t2.activate ()
+t1.activate ()
+
+end (t1, t2)
diff --git a/cesar/test_general/dataplane/py/test_dataplane/__init__.py b/cesar/test_general/dataplane/py/test_dataplane/__init__.py
index 769a908b95..ee14d2f15e 100644
--- a/cesar/test_general/dataplane/py/test_dataplane/__init__.py
+++ b/cesar/test_general/dataplane/py/test_dataplane/__init__.py
@@ -14,6 +14,9 @@ opt.add_option ('-i', '--interface',
help = 'use IFACE interface to send MME', metavar = 'IFACE')
opt.add_option ('-m', '--mac', action = 'append', metavar = 'MAC',
help = "use MAC address for a station (may be used several times)")
+opt.add_option ('-b', '--bridged', action = 'append', nargs = 2,
+ metavar = 'TEI MAC',
+ help = "add the bridged MAC to the given TEI")
opt.add_option ('--swap', action = 'store_true',
help = 'swap stations')
(options, args) = opt.parse_args ()
@@ -40,6 +43,15 @@ elif not options.maximus:
macs = macs[::-1]
args = tuple ((mac, ) for mac in macs)
+# Parse bridge entries.
+bridged = [ ]
+for b in options.bridged:
+ tei = int (b[0])
+ mac = 0l
+ for v in b[1].split (':')[::-1]:
+ mac = (mac << 8) | int (v, 16)
+ bridged.append (dict (tei = tei, mac = mac))
+
class AutoInit:
"""Automatically initialise system."""
@@ -99,6 +111,13 @@ def begin (n):
"""Create n stations."""
return (Sta ('sta%d' % (i + 1), i + 1) for i in range (n))
+def add_mac (*stas):
+ """Add bridged mac."""
+ for b in bridged:
+ for s in stas:
+ if s.tei != b['tei']:
+ s.add_mac (**b)
+
def end (*stas):
"""Stop stations and eventually dump trace."""
for sta in stas:
@@ -111,4 +130,4 @@ def wait (delay_tck):
_auto_init.maximus.wait (delay_tck)
__all__ = tuple (test_dataplane.enum.keys ()
- + [ 'Sta', 'begin', 'end', 'wait' ])
+ + [ 'Sta', 'begin', 'add_mac', 'end', 'wait' ])
diff --git a/cesar/test_general/dataplane/py/test_dataplane/test_dataplane.py b/cesar/test_general/dataplane/py/test_dataplane/test_dataplane.py
index 592b701374..b635329d6b 100644
--- a/cesar/test_general/dataplane/py/test_dataplane/test_dataplane.py
+++ b/cesar/test_general/dataplane/py/test_dataplane/test_dataplane.py
@@ -27,6 +27,7 @@ class TestDataplane:
return fc
def set_config (self, **args):
+ self.tei = args['tei']
self.create_fcall ('set_config', **args).send (self.sta)
def add_mac (self, **args):