Skip to content

Commit

Permalink
Made compatible with rearranged args for createLink.
Browse files Browse the repository at this point in the history
  • Loading branch information
lantz committed Mar 10, 2010
1 parent 315cbf9 commit 73a323f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions examples/scratchnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def scratchNet( cname='controller', cargs='ptcp:' ):
h1 = Node( 'h1' )

info( "*** Creating links\n" )
createLink( node1=h0, port1=0, node2=switch, port2=0 )
createLink( node1=h1, port1=0, node2=switch, port2=1 )
createLink( node1=h0, node2=switch, port1=0, port2=0 )
createLink( node1=h1, node2=switch, port1=0, port2=1 )

info( "*** Configuring hosts\n" )
h0.setIP( h0.intfs[ 0 ], '192.168.123.1', 24 )
Expand Down
16 changes: 8 additions & 8 deletions examples/scratchnetuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ def scratchNetUser( cname='controller', cargs='ptcp:' ):
switch = Node( 's0')
h0 = Node( 'h0' )
h1 = Node( 'h1' )
createLink( controller, 0, switch, 0 )
createLink( h0, 0, switch, 1 )
createLink( h1, 0, switch, 2 )
cintf, sintf = createLink( controller, switch )
h0intf, sintf1 = createLink( h0, switch )
h1intf, sintf2 = createLink( h1, switch )

info( '*** Configuring control network\n' )
controller.setIP( controller.intfs[ 0 ], '10.0.123.1', 24 )
switch.setIP( switch.intfs[ 0 ], '10.0.123.2', 24 )
controller.setIP( cintf, '10.0.123.1', 24 )
switch.setIP( sintf, '10.0.123.2', 24 )

info( '*** Configuring hosts\n' )
h0.setIP( h0.intfs[ 0 ], '192.168.123.1', 24 )
h1.setIP( h1.intfs[ 0 ], '192.168.123.2', 24 )
h0.setIP( h0intf, '192.168.123.1', 24 )
h1.setIP( h1intf, '192.168.123.2', 24 )

info( '*** Network state:\n' )
for node in controller, switch, h0, h1:
Expand All @@ -45,7 +45,7 @@ def scratchNetUser( cname='controller', cargs='ptcp:' ):
info( '*** Starting controller and user datapath\n' )
controller.cmd( cname + ' ' + cargs + '&' )
switch.cmd( 'ifconfig lo 127.0.0.1' )
intfs = [ switch.intfs[ port ] for port in ( 1, 2 ) ]
intfs = [ sintf1, sintf2 ]
switch.cmd( 'ofdatapath -i ' + ','.join( intfs ) + ' ptcp: &' )
switch.cmd( 'ofprotocol tcp:' + controller.IP() + ' tcp:localhost &' )

Expand Down

0 comments on commit 73a323f

Please sign in to comment.