From 73a323f2a2c45d0a853f64b5ed817a4b81ca3681 Mon Sep 17 00:00:00 2001 From: Bob Lantz <rlantz@cs.stanford.edu> Date: Tue, 9 Mar 2010 21:46:32 -0800 Subject: [PATCH] Made compatible with rearranged args for createLink. --- examples/scratchnet.py | 4 ++-- examples/scratchnetuser.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/scratchnet.py b/examples/scratchnet.py index cbb32692..5f21ca11 100755 --- a/examples/scratchnet.py +++ b/examples/scratchnet.py @@ -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 ) diff --git a/examples/scratchnetuser.py b/examples/scratchnetuser.py index 1304508b..3c000ebd 100755 --- a/examples/scratchnetuser.py +++ b/examples/scratchnetuser.py @@ -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: @@ -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 &' ) -- GitLab