Basic topo to test new VPLS
Change-Id: Ie6b6f0ab431850e58dc8741f94c98f06b2243e2c
diff --git a/tools/test/topos/vpls.json b/tools/test/topos/vpls.json
new file mode 100644
index 0000000..a7eceea
--- /dev/null
+++ b/tools/test/topos/vpls.json
@@ -0,0 +1,64 @@
+{
+ "devices": {
+ "of:0000000000000001": { "basic": { "name": "s1", "latitude": 37.7576793, "longitude": -122.5076405 }},
+ "of:0000000000000002": { "basic": { "name": "s2", "latitude": 34.0502337, "longitude": -118.3263353 }},
+ "of:0000000000000003": { "basic": { "name": "s3", "latitude": 38.9082909, "longitude": -77.0886051 }},
+ "of:0000000000000004": { "basic": { "name": "s4", "latitude": 30.2787717, "longitude": -82.3069047 }}
+ },
+ "hosts": {
+ "00:00:00:00:00:01/100": { "basic": { "location": "of:0000000000000001/1", "ips": [ "10.0.0.1" ], "name": "v100h1", "latitude": 37.7576793, "longitude": -125.0076405 }},
+ "00:00:00:00:00:02/200": { "basic": { "location": "of:0000000000000002/1", "ips": [ "10.0.0.2" ], "name": "v200h1", "latitude": 34.0502337, "longitude": -120.8263353 }},
+ "00:00:00:00:00:03/300": { "basic": { "location": "of:0000000000000003/1", "ips": [ "10.0.0.3" ], "name": "v300h1", "latitude": 38.9082909, "longitude": -74.5886051 }},
+ "00:00:00:00:00:04/400": { "basic": { "location": "of:0000000000000004/1", "ips": [ "10.0.0.4" ], "name": "v400h1", "latitude": 30.2787717, "longitude": -79.8069047 }}
+ },
+ "ports": {
+ "of:0000000000000001/1": {
+ "interfaces": [
+ {
+ "name": "vlan100H1",
+ "vlan": "100"
+ }
+ ]
+ },
+ "of:0000000000000002/1": {
+ "interfaces": [
+ {
+ "name": "vlan200H1",
+ "vlan": "200"
+ }
+ ]
+ },
+ "of:0000000000000003/1": {
+ "interfaces": [
+ {
+ "name": "vlan300H1",
+ "vlan": "300"
+ }
+ ]
+ },
+ "of:0000000000000004/1": {
+ "interfaces": [
+ {
+ "name": "vlan400H1",
+ "vlan": "400"
+ }
+ ]
+ }
+ },
+ "apps" : {
+ "org.onosproject.vpls" : {
+ "vpls" : {
+ "vplsNetworks" : [
+ {
+ "name" : "net1",
+ "interfaces" : ["vlan100H1", "vlan200H1"]
+ },
+ {
+ "name" : "net2",
+ "interfaces" : []
+ }
+ ]
+ }
+ }
+ }
+}
diff --git a/tools/test/topos/vpls.py b/tools/test/topos/vpls.py
new file mode 100755
index 0000000..0124541
--- /dev/null
+++ b/tools/test/topos/vpls.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+
+from mininet.cli import CLI
+from mininet.node import Link, Host
+from mininet.net import Mininet
+from mininet.node import RemoteController
+from mininet.term import makeTerm
+from mininet.topo import Topo
+from functools import partial
+
+class VLANHost( Host ):
+ "Host connected to VLAN interface"
+
+ def config( self, vlan=100, **params ):
+ """Configure VLANHost according to (optional) parameters:
+ vlan: VLAN ID for default interface"""
+
+ r = super( VLANHost, self ).config( **params )
+
+ intf = self.defaultIntf()
+ # remove IP from default, "physical" interface
+ self.cmd( 'ifconfig %s inet 0' % intf )
+ # create VLAN interface
+ self.cmd( 'vconfig add %s %d' % ( intf, vlan ) )
+ # assign the host's IP to the VLAN interface
+ self.cmd( 'ifconfig %s.%d inet %s' % ( intf, vlan, params['ip'] ) )
+ # update the intf name and host's intf map
+ newName = '%s.%d' % ( intf, vlan )
+ # update the (Mininet) interface to refer to VLAN interface name
+ intf.name = newName
+ # add VLAN interface to host's name to intf map
+ self.nameToIntf[ newName ] = intf
+
+ return r
+
+class VplsTopo(Topo):
+ ''' VPLS demo Topology '''
+
+ def __init__(self):
+ Topo.__init__(self)
+
+ s1 = self.addSwitch('s1')
+ s2 = self.addSwitch('s2')
+ s3 = self.addSwitch('s3')
+ s4 = self.addSwitch('s4')
+
+ v100h1 = self.addHost('v100h1', cls=VLANHost, vlan=100, mac='00:00:00:00:00:01')
+ v200h1 = self.addHost('v200h1', cls=VLANHost, vlan=200, mac='00:00:00:00:00:02')
+ v300h1 = self.addHost('v300h1', cls=VLANHost, vlan=300, mac='00:00:00:00:00:03')
+ v400h1 = self.addHost('v400h1', cls=VLANHost, vlan=400, mac='00:00:00:00:00:04')
+
+ self.addLink(s1, v100h1, port1=1, port2=0)
+ self.addLink(s2, v200h1, port1=1, port2=0)
+ self.addLink(s3, v300h1, port1=1, port2=0)
+ self.addLink(s4, v400h1, port1=1, port2=0)
+
+ self.addLink(s1, s4)
+ self.addLink(s1, s2)
+ self.addLink(s2, s4)
+ self.addLink(s2, s3)
+ self.addLink(s3, s4)
+
+topos = { 'vpls': ( lambda: VplsTopo() ) }
+
+if __name__ == '__main__':
+ from onosnet import run
+ run(VplsTopo())
diff --git a/tools/test/topos/vpls.recipe b/tools/test/topos/vpls.recipe
new file mode 100644
index 0000000..468ce99
--- /dev/null
+++ b/tools/test/topos/vpls.recipe
@@ -0,0 +1,4 @@
+# Default VPLS topology recipe
+export OTD=4 # ONOS Topology Devices
+export OTL=10 # ONOS Topology Links
+export OTH=4 # ONOS Topology Hosts