blob: dace73012fbaff3694d23d3627dc66e40e9ec274 [file] [log] [blame]
YPZhangcb86c5b2016-01-27 17:38:12 -08001#!/usr/bin/python
2
3"""
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07004Copyright 2015 Open Networking Foundation (ONF)
5
6Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
7the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
8or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
9
10 TestON is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 2 of the License, or
13 (at your option) any later version.
14
15 TestON is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with TestON. If not, see <http://www.gnu.org/licenses/>.
22"""
23
24"""
YPZhangcb86c5b2016-01-27 17:38:12 -080025Custom 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.link import TCLink
32from mininet.cli import CLI
33from mininet.log import setLogLevel
34from mininet.util import dumpNodeConnections
35from mininet.node import ( UserSwitch, OVSSwitch, IVSSwitch )
36
37class MyTopo( Topo ):
38
39 def __init__( self ):
40 # Initialize topology
41 Topo.__init__( self )
42
43 host1 = self.addHost('h1', ip='10.1.0.1/24')
44 host2 = self.addHost('h2', ip='10.1.0.2/24')
45 host3 = self.addHost('h3', ip='10.1.0.3/24')
46 host4 = self.addHost('h4', ip='10.1.0.4/24')
47 host5 = self.addHost('h5', ip='10.1.0.5/24')
48 host6 = self.addHost('h6', ip='10.1.0.6/24')
49 host7 = self.addHost('h7', ip='10.1.0.7/24')
50
51 s1 = self.addSwitch( 's1' )
52 s2 = self.addSwitch( 's2' )
53 s3 = self.addSwitch( 's3' )
54 s4 = self.addSwitch( 's4' )
55 s5 = self.addSwitch( 's5' )
56 s6 = self.addSwitch( 's6' )
57 s7 = self.addSwitch( 's7' )
58 s8 = self.addSwitch( 's8' )
59
60
61 self.addLink(s1, host1)
62 self.addLink(s2, host2)
63 self.addLink(s3, host3)
64 self.addLink(s4, host4)
65 self.addLink(s5, host5)
66 self.addLink(s6, host6)
67 self.addLink(s7, host7)
68
69
70
71 self.addLink(s1,s2)
72 self.addLink(s2,s3)
73 self.addLink(s3,s4)
74 self.addLink(s4,s5)
75 self.addLink(s5,s6)
76 self.addLink(s6,s7)
77 self.addLink(s4,s8)
78 self.addLink(s8,s5)
79
80 topos = { 'mytopo': ( lambda: MyTopo() ) }
81
82# HERE THE CODE DEFINITION OF THE TOPOLOGY ENDS
83
84def setupNetwork():
85 "Create network"
86 topo = MyTopo()
87 network = Mininet(topo=topo, autoSetMacs=True, controller=None)
88 network.start()
89 CLI( network )
90 network.stop()
91
92if __name__ == '__main__':
93 setLogLevel('info')
94 #setLogLevel('debug')
95 setupNetwork()