blob: d795a37c5179f0c5bd5d77e0aa22695fa31e1c9b [file] [log] [blame]
Simon Hunt57e91822017-09-12 11:58:44 -07001#!/usr/bin/env python
2
3"""
4"""
5from mininet.topo import Topo
6
7class DualTopo( Topo ):
8 """Switches and Dual-homed host"""
9
10 def __init__( self ):
11 """Create a topology."""
12
13 # Initialize Topology
14 Topo.__init__( self )
15
16 # add nodes, switches first...
Simon Huntec120102017-09-12 13:11:11 -070017 SWA = self.addSwitch( 's1' )
18 SWB = self.addSwitch( 's2' )
Simon Hunt57e91822017-09-12 11:58:44 -070019
20 # ... and now hosts
Simon Huntec120102017-09-12 13:11:11 -070021 HOSTX = self.addHost( 'h1' )
Simon Hunt57e91822017-09-12 11:58:44 -070022
23 # add edges between switch and corresponding host
Simon Huntec120102017-09-12 13:11:11 -070024 self.addLink( SWA, HOSTX )
25 self.addLink( SWB, HOSTX )
Simon Hunt57e91822017-09-12 11:58:44 -070026
27 # add edges between switches
Simon Huntec120102017-09-12 13:11:11 -070028 self.addLink( SWA, SWB, bw=10, delay='1.0ms' )
Simon Hunt57e91822017-09-12 11:58:44 -070029
30
31topos = { 'dual': ( lambda: DualTopo() ) }
32
33if __name__ == '__main__':
34 from onosnet import run
35 run( DualTopo() )