Revision 08cef003 examples/sshd.py

View differences:

examples/sshd.py
1 1
#!/usr/bin/python
2 2

  
3 3
"""Create a network and start sshd(8) on the hosts.
4
   This is probably overkill - rshd(8) would be
5
   perfectly adequate, considering that the openflow
6
   network is private to the machine it's running on.
7
   It would also be lighter weight/faster.
8
   Nonetheless, most people already have sshd installed,
9
   and it's a good demo to show that mininet makes a
10
   'real', usable network! """
4
   While something like rshd(8) would be lighter and faster,
5
   (and perfectly adequate on an in-machine network)
6
   the advantage of running sshd is that scripts can work
7
   unchanged on mininet and hardware."""
11 8

  
12 9
from mininet import init, Node, createLink, TreeNet, Cli
13 10

  
......
16 13
   nets = {}
17 14
   for host in hosts:
18 15
      net = host.IP().split( '.' )[ : -1 ]
19
      net = '.'.join ( net ) + '.0/24'
16
      net = '.'.join( net ) + '.0/24'
20 17
      nets[ net ] = True
21 18
   return nets.keys()
22 19
   

Also available in: Unified diff