blob: 16a0a845a76b075ffafdecb73bf02b17c590c65b [file] [log] [blame]
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07001"""
2Copyright 2016 Open Networking Foundation (ONF)
3
4Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
5the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
6or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
7
8 TestON is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
11 (at your option) any later version.
12
13 TestON is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with TestON. If not, see <http://www.gnu.org/licenses/>.
20"""
21
kavitha Alagesan373e0552016-11-22 05:22:05 +053022#!/usr/bin/python
23
24"""
25Custom topology for Mininet
26"""
27from mininet.topo import Topo
28from mininet.net import Mininet
29from mininet.node import Host, RemoteController
30from mininet.node import Node
31from mininet.node import CPULimitedHost
32from mininet.link import TCLink
33from mininet.cli import CLI
34from mininet.log import setLogLevel
35from mininet.util import dumpNodeConnections
36from mininet.node import ( UserSwitch, OVSSwitch, IVSSwitch )
37
38class MyTopo( Topo ):
39
40 def __init__( self, **opts ):
41 # Initialize topology
42 Topo.__init__( self, **opts)
43
44 # IPv4 hosts
45 host1=self.addHost( 'h1', ip='10.0.0.1/24' )
46 host2=self.addHost( 'h2', ip='10.0.0.2/24' )
47 host3=self.addHost( 'h3', ip='10.0.0.3/24' )
48 host4=self.addHost( 'h4', ip='10.0.0.4/24' )
49
50 s1 = self.addSwitch( 's1' )
51
52 self.addLink(s1, host1)
53 self.addLink(s1, host2)
54 self.addLink(s1, host3)
55 self.addLink(s1, host4)
56
57 topos = { 'mytopo': ( lambda: MyTopo() ) }
58
59def setupNetwork():
60 "Create network"
61 topo = MyTopo()
62 network = Mininet(topo=topo, autoSetMacs=True, autoStaticArp=True, controller=None)
63 network.start()
64 CLI( network )
65 network.stop()
66
67if __name__ == '__main__':
68 setLogLevel('info')
69 #setLogLevel('debug')
70 setupNetwork()