Thomas Vachuska | e76f653 | 2015-07-08 09:40:53 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | |
| 3 | """ |
| 4 | """ |
| 5 | from mininet.topo import Topo |
| 6 | from mininet.net import Mininet |
| 7 | from mininet.node import RemoteController |
| 8 | from mininet.node import Node |
| 9 | from mininet.node import CPULimitedHost |
| 10 | from mininet.link import TCLink |
| 11 | from mininet.cli import CLI |
| 12 | from mininet.log import setLogLevel |
| 13 | from mininet.util import dumpNodeConnections |
| 14 | |
| 15 | class ReactiveForwardingTestTopo( Topo ): |
| 16 | "Internet Topology Zoo Specimen." |
| 17 | |
| 18 | def __init__( self ): |
| 19 | "Create a topology." |
| 20 | |
| 21 | # Initialize Topology |
| 22 | Topo.__init__( self ) |
| 23 | |
| 24 | # add nodes, switches first... |
| 25 | s1 = self.addSwitch( 's1' ) |
| 26 | s2 = self.addSwitch( 's2' ) |
| 27 | s3 = self.addSwitch( 's3' ) |
| 28 | s4 = self.addSwitch( 's4' ) |
| 29 | s5 = self.addSwitch( 's5' ) |
| 30 | s6 = self.addSwitch( 's6' ) |
| 31 | s7 = self.addSwitch( 's7' ) |
| 32 | s8 = self.addSwitch( 's8' ) |
| 33 | s9 = self.addSwitch( 's9' ) |
| 34 | |
| 35 | # ... and now hosts |
| 36 | h1 = self.addHost( 'h1' ) |
| 37 | h2 = self.addHost( 'h2' ) |
| 38 | h3 = self.addHost( 'h3' ) |
| 39 | h4 = self.addHost( 'h4' ) |
| 40 | |
| 41 | # add edges between switch and corresponding host |
| 42 | self.addLink( s1 , h1 ) |
| 43 | self.addLink( s2 , h2 ) |
| 44 | self.addLink( s3 , h3 ) |
| 45 | self.addLink( s4 , h4 ) |
| 46 | |
| 47 | # add edges between switches |
| 48 | self.addLink( s1 , s5 ) |
| 49 | self.addLink( s2 , s5 ) |
| 50 | self.addLink( s2 , s8 ) |
| 51 | self.addLink( s3 , s4 ) |
| 52 | self.addLink( s3 , s7 ) |
| 53 | self.addLink( s4 , s5 ) |
| 54 | self.addLink( s6 , s8 ) |
| 55 | self.addLink( s6 , s7 ) |
| 56 | self.addLink( s5 , s9 ) |
| 57 | self.addLink( s6 , s9 ) |
| 58 | |
| 59 | topos = { 'att': ( lambda: ReactiveForwardingTestTopo() ) } |