Skip to content
Snippets Groups Projects
Commit 47e26cce authored by Bob Lantz's avatar Bob Lantz
Browse files

Fixed to be compatible with new setIP().

parent 086ef80e
No related branches found
No related tags found
No related merge requests found
...@@ -26,8 +26,8 @@ def scratchNet( cname='controller', cargs='ptcp:'): ...@@ -26,8 +26,8 @@ def scratchNet( cname='controller', cargs='ptcp:'):
createLink( node1=h1, port1=0, node2=switch, port2=1 ) createLink( node1=h1, port1=0, node2=switch, port2=1 )
info( "*** Configuring hosts\n" ) info( "*** Configuring hosts\n" )
h0.setIP( h0.intfs[ 0 ], '192.168.123.1', '/24' ) h0.setIP( h0.intfs[ 0 ], '192.168.123.1', 24 )
h1.setIP( h1.intfs[ 0 ], '192.168.123.2', '/24' ) h1.setIP( h1.intfs[ 0 ], '192.168.123.2', 24 )
info( str( h0 ) + '\n' ) info( str( h0 ) + '\n' )
info( str( h1 ) + '\n' ) info( str( h1 ) + '\n' )
...@@ -46,9 +46,11 @@ def scratchNet( cname='controller', cargs='ptcp:'): ...@@ -46,9 +46,11 @@ def scratchNet( cname='controller', cargs='ptcp:'):
controller.cmd( 'kill %' + cname) controller.cmd( 'kill %' + cname)
switch.cmd( 'dpctl deldp nl:0' ) switch.cmd( 'dpctl deldp nl:0' )
switch.cmd( 'kill %ofprotocol' ) switch.cmd( 'kill %ofprotocol' )
switch.deleteIntfs()
info( '\n' )
if __name__ == '__main__': if __name__ == '__main__':
lg.setLogLevel( 'info' )
info( '*** Scratch network demo (kernel datapath)\n' ) info( '*** Scratch network demo (kernel datapath)\n' )
init() init()
lg.setLogLevel( 'info' )
scratchNet() scratchNet()
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
from mininet.util import createLink from mininet.util import createLink
from mininet.log import lg, info from mininet.log import lg, info
def scratchNetUser( cname='controller', cargs='ptcp:'): def scratchNetUser( cname='controller', cargs='ptcp:' ):
# Create Network # Create Network
# It's not strictly necessary for the controller and switches # It's not strictly necessary for the controller and switches
# to be in separate namespaces. For performance, they probably # to be in separate namespaces. For performance, they probably
...@@ -30,12 +30,12 @@ def scratchNetUser( cname='controller', cargs='ptcp:'): ...@@ -30,12 +30,12 @@ def scratchNetUser( cname='controller', cargs='ptcp:'):
createLink( h1, 0, switch, 2 ) createLink( h1, 0, switch, 2 )
info( '*** Configuring control network\n' ) info( '*** Configuring control network\n' )
controller.setIP( controller.intfs[ 0 ], '10.0.123.1', '/24' ) controller.setIP( controller.intfs[ 0 ], '10.0.123.1', 24 )
switch.setIP( switch.intfs[ 0 ], '10.0.123.2', '/24' ) switch.setIP( switch.intfs[ 0 ], '10.0.123.2', 24 )
info( '*** Configuring hosts\n' ) info( '*** Configuring hosts\n' )
h0.setIP( h0.intfs[ 0 ], '192.168.123.1', '/24' ) h0.setIP( h0.intfs[ 0 ], '192.168.123.1', 24 )
h1.setIP( h1.intfs[ 0 ], '192.168.123.2', '/24' ) h1.setIP( h1.intfs[ 0 ], '192.168.123.2', 24 )
info( '*** Network state:\n' ) info( '*** Network state:\n' )
for node in controller, switch, h0, h1: for node in controller, switch, h0, h1:
...@@ -44,7 +44,7 @@ def scratchNetUser( cname='controller', cargs='ptcp:'): ...@@ -44,7 +44,7 @@ def scratchNetUser( cname='controller', cargs='ptcp:'):
info( '*** Starting controller and user datapath\n' ) info( '*** Starting controller and user datapath\n' )
controller.cmd( cname + ' ' + cargs + '&' ) controller.cmd( cname + ' ' + cargs + '&' )
switch.cmd( 'ifconfig lo 127.0.0.1' ) switch.cmd( 'ifconfig lo 127.0.0.1' )
intfs = [ switch.intfs[ port ] for port in (1, 2) ] intfs = [ switch.intfs[ port ] for port in ( 1, 2 ) ]
switch.cmd( 'ofdatapath -i ' + ','.join( intfs ) + ' ptcp: &' ) switch.cmd( 'ofdatapath -i ' + ','.join( intfs ) + ' ptcp: &' )
switch.cmd( 'ofprotocol tcp:' + controller.IP() + ' tcp:localhost &' ) switch.cmd( 'ofprotocol tcp:' + controller.IP() + ' tcp:localhost &' )
...@@ -55,9 +55,11 @@ def scratchNetUser( cname='controller', cargs='ptcp:'): ...@@ -55,9 +55,11 @@ def scratchNetUser( cname='controller', cargs='ptcp:'):
controller.cmd( 'kill %' + cname ) controller.cmd( 'kill %' + cname )
switch.cmd( 'kill %ofdatapath' ) switch.cmd( 'kill %ofdatapath' )
switch.cmd( 'kill %ofprotocol' ) switch.cmd( 'kill %ofprotocol' )
switch.deleteIntfs()
info( '\n' )
if __name__ == '__main__': if __name__ == '__main__':
lg.setLogLevel( 'info' )
info( '*** Scratch network demo (user datapath)\n' ) info( '*** Scratch network demo (user datapath)\n' )
init() init()
lg.setLogLevel( 'info' )
scratchNetUser() scratchNetUser()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment