Improve support for CPqD and parameterize tests
Changes:
- Made device_type a test_params so it can be controller from the
command line and can be used to switch between device-specific
behavior. The current device types are:
pmc:
To work with the PMC OLT.
On this device when the inner VLAN tag is popped, the device actually
emits a frame with VLAN tag 0 and PCP 0. Or, put it another way,
the way to emit a frame with a zero VLAN tag and zero PCP is to pop
the vlan header. Weird.
cpqd:
User-space switch which cannot receive zero-tagged vlans
due to kernel limitations.
On this device when a frame arrives with a VLAN tag 0 and PCP 0,
the kernel removes the VLAN header before the frame is passed to the
user-space switch. Wireshark/tcpdump still shows the header, but
not the app. This is addressed in the tests with not expecting
a VLAN header in such cases.
normal:
This is intended for "per-the-books" openflow switches
that do exactly what the flow rules say
- Adjusted some of the test-cases to support the 3 device types
- IGMP packet generator using scapy.
This is still work in progress, but this is a fairly accurate IGMP
pkt generator using scapy. The membership query is considered complete,
but the fields for the memberhip reports still need to be added.
There is a simple self-test at the end of the lib which can be executed
by just running 'python IGMP.py'
- Added verbage to README.md how to run on CPqD
- Added command line option -u to olt-topo to bring up mininet with
user-space reference switch CPqD
- Fixed mixed tab/space use in olt.py
Conflicts:
olt.py
Change-Id: I23553c228c20614c5e97e097fad4c578817d62c3
diff --git a/olt-topo.py b/olt-topo.py
index 581084c..118e464 100755
--- a/olt-topo.py
+++ b/olt-topo.py
@@ -1,12 +1,17 @@
#!/usr/bin/python
+import sys
+
from mininet.topo import Topo
-from mininet.node import RemoteController
+from mininet.node import RemoteController, UserSwitch
from mininet.net import Mininet
from mininet.util import irange
from mininet.cli import CLI
from mininet.log import setLogLevel
+from optparse import OptionParser
+
+
class OltTopo( Topo ):
"Single switch with OLT port 129 and configurable number of ONU ports"
@@ -22,10 +27,23 @@
self.addLink( olt_port, switch, port2=129 )
if __name__ == '__main__':
- setLogLevel('debug')
- topo = OltTopo(k=2)
- net = Mininet( topo=topo, controller=RemoteController )
+ parser = OptionParser()
+ parser.add_option("-u", "--user-switch", dest="user_switch", action="store_true",
+ default=False, help="use given user mode switch (CPqD) or mininet")
+ (options, args) = parser.parse_args()
+
+ kargs = {}
+
+ if options.user_switch:
+ kargs['switch'] = UserSwitch
+
+ setLogLevel('debug')
+
+ topo = OltTopo()
+ topo.build(k=2)
+
+ net = Mininet( topo=topo, controller=RemoteController, **kargs )
net.start()