Revision 80be5642 examples/scratchnetuser.py

View differences:

examples/scratchnetuser.py
5 5
This is more complicated than using the higher-level classes,
6 6
but it exposes the configuration details and allows customization.
7 7

  
8
This version uses the user datapath.
8
This version uses the user datapath and an explicit control network.
9 9
"""
10 10

  
11 11
from mininet.net import init
......
14 14
from mininet.log import lg, info
15 15

  
16 16
def scratchNetUser( cname='controller', cargs='ptcp:' ):
17
    # Create Network
17
    "Create network from scratch using user switch."
18

  
18 19
    # It's not strictly necessary for the controller and switches
19 20
    # to be in separate namespaces. For performance, they probably
20 21
    # should be in the root namespace. However, it's interesting to
......
32 33
    info( '*** Configuring control network\n' )
33 34
    controller.setIP( controller.intfs[ 0 ], '10.0.123.1', 24 )
34 35
    switch.setIP( switch.intfs[ 0 ], '10.0.123.2', 24 )
35
    
36

  
36 37
    info( '*** Configuring hosts\n' )
37 38
    h0.setIP( h0.intfs[ 0 ], '192.168.123.1', 24 )
38 39
    h1.setIP( h1.intfs[ 0 ], '192.168.123.2', 24 )
39
    
40

  
40 41
    info( '*** Network state:\n' )
41 42
    for node in controller, switch, h0, h1:
42 43
        info( str( node ) + '\n' )
43
        
44

  
44 45
    info( '*** Starting controller and user datapath\n' )
45 46
    controller.cmd( cname + ' ' + cargs + '&' )
46 47
    switch.cmd( 'ifconfig lo 127.0.0.1' )
......
57 58
    switch.cmd( 'kill %ofprotocol' )
58 59
    switch.deleteIntfs()
59 60
    info( '\n' )
60
        
61

  
61 62
if __name__ == '__main__':
62 63
    lg.setLogLevel( 'info' )
63 64
    info( '*** Scratch network demo (user datapath)\n' )
64
    init()   
65
    init()
65 66
    scratchNetUser()

Also available in: Unified diff