added test-network files
diff --git a/test-network/mininet/capsulator b/test-network/mininet/capsulator
new file mode 100755
index 0000000..bd47b70
--- /dev/null
+++ b/test-network/mininet/capsulator
Binary files differ
diff --git a/test-network/mininet/onos-nw.py b/test-network/mininet/onos-nw.py
new file mode 100755
index 0000000..60cfb92
--- /dev/null
+++ b/test-network/mininet/onos-nw.py
@@ -0,0 +1,176 @@
+#!/usr/bin/python
+
+NWID="a"
+
+"""
+Start up a Simple topology
+"""
+from mininet.net import Mininet
+from mininet.node import Controller, RemoteController
+from mininet.log import setLogLevel, info, error, warn, debug
+from mininet.cli import CLI
+from mininet.topo import Topo
+from mininet.util import quietRun
+from mininet.moduledeps import pathCheck
+from mininet.link import Link, TCLink
+
+from sys import exit
+import os.path
+from subprocess import Popen, STDOUT, PIPE
+
+import sys
+
+
+#import argparse
+
+class MyController( Controller ):
+ def __init__( self, name, ip='10.0.1.217', port=6633, **kwargs):
+ """Init.
+ name: name to give controller
+ ip: the IP address where the remote controller is
+ listening
+ port: the port where the remote controller is listening"""
+ Controller.__init__( self, name, ip=ip, port=port, **kwargs )
+
+ def start( self ):
+ "Overridden to do nothing."
+ return
+
+ def stop( self ):
+ "Overridden to do nothing."
+ return
+
+ def checkListening( self ):
+ "Warn if remote controller is not accessible"
+ listening = self.cmd( "echo A | telnet -e A %s %d" %
+ ( self.ip, self.port ) )
+ if 'Unable' in listening:
+ warn( "Unable to contact the remote controller"
+ " at %s:%d\n" % ( self.ip, self.port ) )
+
+class SDNTopo( Topo ):
+ "SDN Topology"
+
+ def __init__( self, *args, **kwargs ):
+ Topo.__init__( self, *args, **kwargs )
+ sw1 = self.addSwitch('sw%s1' % NWID, dpid='00000000000000%s1' % NWID)
+ sw2 = self.addSwitch('sw%s2' % NWID, dpid='00000000000000%s2' % NWID)
+ sw3 = self.addSwitch('sw%s3' % NWID, dpid='00000000000000%s3' % NWID)
+ sw4 = self.addSwitch('sw%s4' % NWID, dpid='00000000000000%s4' % NWID)
+ sw5 = self.addSwitch('sw%s5' % NWID, dpid='00000000000000%s5' % NWID)
+
+ host1 = self.addHost( 'host1' )
+ host2 = self.addHost( 'host2' )
+ host3 = self.addHost( 'host3' )
+ host4 = self.addHost( 'host4' )
+ host5 = self.addHost( 'host5' )
+
+ root1 = self.addHost( 'root1', inNamespace=False )
+ root2 = self.addHost( 'root2', inNamespace=False )
+ root3 = self.addHost( 'root3', inNamespace=False )
+ root4 = self.addHost( 'root4', inNamespace=False )
+ root5 = self.addHost( 'root5', inNamespace=False )
+
+
+ self.addLink( host1, sw1 )
+ self.addLink( host2, sw2 )
+ self.addLink( host3, sw3 )
+ self.addLink( host4, sw4 )
+ self.addLink( host5, sw5 )
+
+
+ self.addLink( sw1, sw3 )
+ self.addLink( sw2, sw3 )
+ self.addLink( sw4, sw3 )
+ self.addLink( sw5, sw3 )
+
+ self.addLink( root1, host1 )
+ self.addLink( root2, host2 )
+ self.addLink( root3, host3 )
+ self.addLink( root4, host4 )
+ self.addLink( root5, host5 )
+
+# self.addLink( sw1, sw2 )
+
+def startsshd( host ):
+ "Start sshd on host"
+ info( '*** Starting sshd\n' )
+ name, intf, ip = host.name, host.defaultIntf(), host.IP()
+ banner = '/tmp/%s.banner' % name
+ host.cmd( 'echo "Welcome to %s at %s" > %s' % ( name, ip, banner ) )
+ host.cmd( '/usr/sbin/sshd -o "Banner %s"' % banner, '-o "UseDNS no"' )
+ info( '***', host.name, 'is running sshd on', intf, 'at', ip, '\n' )
+
+def startsshds ( hosts ):
+ for h in hosts:
+ startsshd( h )
+
+def stopsshd( ):
+ "Stop *all* sshd processes with a custom banner"
+ info( '*** Shutting down stale sshd/Banner processes ',
+ quietRun( "pkill -9 -f Banner" ), '\n' )
+
+def sdnnet(opt):
+# os.system('/home/ubuntu/openflow/controller/controller ptcp: &')
+# os.system('/home/ubuntu/openflow/controller/controller ptcp:7000 &')
+
+ topo = SDNTopo()
+ info( '*** Creating network\n' )
+# net = Mininet( topo=topo, controller=RemoteController )
+ net = Mininet( topo=topo, controller=MyController, link=TCLink)
+# dc = DebugController('c3', ip='127.0.0.1', port=7000)
+# net.addController(dc)
+# net.addController(controller=RemoteController)
+
+ host1, host2, host3, host4, host5 = net.get( 'host1', 'host2', 'host3', 'host4', 'host5')
+
+ ## Adding 2nd, 3rd and 4th interface to host1 connected to sw1 (for another BGP peering)
+ sw1 = net.get('sw%s1' % NWID)
+ sw2 = net.get('sw%s2' % NWID)
+ sw3 = net.get('sw%s3' % NWID)
+ sw4 = net.get('sw%s4' % NWID)
+ sw5 = net.get('sw%s5' % NWID)
+
+ net.start()
+
+ sw5.attach('tap%s0' % NWID)
+
+ host1.defaultIntf().setIP('192.168.10.111/24')
+ host2.defaultIntf().setIP('192.168.10.112/24')
+ host3.defaultIntf().setIP('192.168.10.113/24')
+ host4.defaultIntf().setIP('192.168.10.114/24')
+ host5.defaultIntf().setIP('192.168.10.115/24')
+
+ root1, root2, root3, root4, root5 = net.get( 'root1', 'root2', 'root3', 'root4', 'root5' )
+ host1.intf('host1-eth1').setIP('1.1.1.1/24')
+ root1.intf('root1-eth0').setIP('1.1.1.2/24')
+
+ host2.intf('host2-eth1') .setIP('1.1.2.1/24')
+ root2.intf('root2-eth0').setIP('1.1.2.2/24')
+
+ host3.intf('host3-eth1') .setIP('1.1.3.1/24')
+ root3.intf('root3-eth0').setIP('1.1.3.2/24')
+
+ host4.intf('host4-eth1') .setIP('1.1.4.1/24')
+ root4.intf('root4-eth0').setIP('1.1.4.2/24')
+
+ host5.intf('host5-eth1') .setIP('1.1.5.1/24')
+ root5.intf('root5-eth0').setIP('1.1.5.2/24')
+
+ hosts = [ host1, host2, host3, host4, host5 ]
+ stopsshd ()
+ startsshds ( hosts )
+
+ if opt=="cli":
+ CLI(net)
+ stopsshd()
+ net.stop()
+
+if __name__ == '__main__':
+ setLogLevel( 'info' )
+ if len(sys.argv) == 1:
+ sdnnet("cli")
+ elif len(sys.argv) == 2 and sys.argv[1] == "-n":
+ sdnnet("nocli")
+ else:
+ print "%s [-n]" % sys.argv[0]
diff --git a/test-network/mininet/tunnel.sh b/test-network/mininet/tunnel.sh
new file mode 100755
index 0000000..0731bb7
--- /dev/null
+++ b/test-network/mininet/tunnel.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+VIP_ONOS1=10.0.1.217
+VIP_ONOS2=10.0.1.176
+VIP_ONOS3=10.0.1.173
+VIP_ONOS4=10.0.1.222
+VIP_ONOS5=10.0.1.191
+VIP_ONOS6=10.0.1.158
+VIP_ONOS9=10.0.1.29
+VIP_ONOS10=10.0.1.28
+VIP_ONOS11=10.0.1.62
+
+NW_ID="a"
+# [[tap_if_nr, tag, other_end],..]
+TUNNEL=("0 1 VIP_ONOS5")
+
+start () {
+ ## Modify ##
+ ulimit -c
+ for (( i = 0; i< ${#TUNNEL[@]}; i ++)); do
+ t=`echo ${TUNNEL[$i]}`
+ ifnr=`echo $t | awk '{print $1}'`
+ tun_tag=`echo $t | awk '{print $2}'`
+ tun_end_=`echo $t | awk '{print $3}'`
+ tun_end=`eval echo '$'$tun_end_`
+ ifconfig tap${NW_ID}${ifnr}
+ echo "ifconfig tap${NW_ID}${ifnr}"
+ if [ $? -ne 0 ]; then
+ echo "creating tap${NW_ID}${ifnr}"
+ sudo tunctl
+ fi
+ echo "./capsulator -v -d -t eth0 -f ${tun_end} -vb tap${NW_ID}${ifnr}#${tun_tag}"
+ sudo ifconfig tap${NW_ID}${ifnr} 0.0.0.0 up > /dev/null 2>&1
+ sudo ./capsulator -v -d -t eth0 -f ${tun_end} -vb tap${NW_ID}${ifnr}#${tun_tag} > /dev/null 2>&1 &
+ done
+}
+
+stop () {
+ sudo pkill capsulator
+}
+
+case "$1" in
+ start | restart)
+ stop
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ nr=`pgrep capsulator | wc -l`
+ if [ $nr -gt 0 ]; then
+ echo "$nr tunnel(s) is running"
+ else
+ echo "tunnel is not running"
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status}" >&2
+ exit 1
+ ;;
+esac
diff --git a/web/topology_rest.py b/web/topology_rest.py
index cbb2300..be4844d 100755
--- a/web/topology_rest.py
+++ b/web/topology_rest.py
@@ -11,7 +11,7 @@
from flask import Flask, json, Response, render_template, make_response, request
## Global Var ##
-RestIP="onos1vpc"
+RestIP="localhost"
RestPort=8080
#DBName="onos-network-map"
@@ -310,4 +310,5 @@
# devices()
else:
app.debug = True
+# app.run(host="10.0.1.29", port=9000)
app.run(host="0.0.0.0", port=9000)