Revision edf60032 bin/mn

View differences:

bin/mn
37 37
# built in topologies, created only when run
38 38
TOPODEF = 'minimal'
39 39
TOPOS = { 'minimal': lambda: SingleSwitchTopo( k=2 ),
40
         'linear': LinearTopo,
41
         'reversed': SingleSwitchReversedTopo,
42
         'single': SingleSwitchTopo,
43
         'tree': TreeTopo }
40
          'linear': LinearTopo,
41
          'reversed': SingleSwitchReversedTopo,
42
          'single': SingleSwitchTopo,
43
          'tree': TreeTopo }
44 44

  
45 45
SWITCHDEF = 'ovsk'
46 46
SWITCHES = { 'user': UserSwitch,
47
            'ovsk': OVSKernelSwitch,
47
             'ovsk': OVSKernelSwitch,
48 48
             'ovsl': OVSLegacyKernelSwitch }
49 49

  
50 50
HOSTDEF = 'proc'
......
66 66

  
67 67
# optional tests to run
68 68
TESTS = [ 'cli', 'build', 'pingall', 'pingpair', 'iperf', 'all', 'iperfudp',
69
         'none' ]
69
          'none' ]
70 70

  
71
ALTSPELLING = { 'pingall': 'pingAll', 'pingpair': 'pingPair',
72
    'iperfudp': 'iperfUdp', 'iperfUDP': 'iperfUdp', 'prefixlen': 'prefixLen' }
71
ALTSPELLING = { 'pingall': 'pingAll',
72
                'pingpair': 'pingPair',
73
                'iperfudp': 'iperfUdp',
74
                'iperfUDP': 'iperfUdp',
75
                'prefixlen': 'prefixLen' }
73 76

  
74 77

  
75 78
def addDictOption( opts, choicesDict, default, name, helpStr=None ):
......
81 84
       help: string"""
82 85
    if default not in choicesDict:
83 86
        raise Exception( 'Invalid  default %s for choices dict: %s' %
84
                        ( default, name ) )
87
                         ( default, name ) )
85 88
    if not helpStr:
86 89
        helpStr = ( '|'.join( sorted( choicesDict.keys() ) ) +
87
                   '[,param=value...]' )
90
                    '[,param=value...]' )
88 91
    opts.add_option( '--' + name,
89
                    type='string',
90
                    default = default,
91
                    help = helpStr )
92
                     type='string',
93
                     default = default,
94
                     help = helpStr )
92 95

  
93 96

  
94 97
def version( *_args ):
......
158 161
        addDictOption( opts, TOPOS, TOPODEF, 'topo' )
159 162

  
160 163
        opts.add_option( '--clean', '-c', action='store_true',
161
                        default=False, help='clean and exit' )
164
                         default=False, help='clean and exit' )
162 165
        opts.add_option( '--custom', type='string', default=None,
163
                        help='read custom topo and node params from .py file' )
166
                         help='read custom topo and node params from .py file' )
164 167
        opts.add_option( '--test', type='choice', choices=TESTS,
165
                        default=TESTS[ 0 ],
166
                        help='|'.join( TESTS ) )
168
                         default=TESTS[ 0 ],
169
                         help='|'.join( TESTS ) )
167 170
        opts.add_option( '--xterms', '-x', action='store_true',
168
                        default=False, help='spawn xterms for each node' )
171
                         default=False, help='spawn xterms for each node' )
169 172
        opts.add_option( '--ipbase', '-i', type='string', default='10.0.0.0/8',
170 173
                         help='base IP address for hosts' )
171 174
        opts.add_option( '--mac', action='store_true',
172
                        default=False, help='automatically set host MACs' )
175
                         default=False, help='automatically set host MACs' )
173 176
        opts.add_option( '--arp', action='store_true',
174
                        default=False, help='set all-pairs ARP entries' )
177
                         default=False, help='set all-pairs ARP entries' )
175 178
        opts.add_option( '--verbosity', '-v', type='choice',
176
                        choices=LEVELS.keys(), default = 'info',
177
                        help = '|'.join( LEVELS.keys() )  )
179
                         choices=LEVELS.keys(), default = 'info',
180
                         help = '|'.join( LEVELS.keys() )  )
178 181
        opts.add_option( '--innamespace', action='store_true',
179
                        default=False, help='sw and ctrl in namespace?' )
182
                         default=False, help='sw and ctrl in namespace?' )
180 183
        opts.add_option( '--listenport', type='int', default=6635,
181 184
                         help='base port for passive switch listening' )
182 185
        opts.add_option( '--nolistenport', action='store_true',
183
                        default=False, help="don't use passive listening port")
186
                         default=False, help="don't use passive listening port")
184 187
        opts.add_option( '--pre', type='string', default=None,
185
                        help='CLI script to run before tests' )
188
                         help='CLI script to run before tests' )
186 189
        opts.add_option( '--post', type='string', default=None,
187
                        help='CLI script to run after tests' )
190
                         help='CLI script to run after tests' )
188 191
        opts.add_option( '--prefixlen', type='int', default=8,
189
                        help='prefix length (e.g. /8) for automatic '
190
                        'network configuration' )
192
                         help='prefix length (e.g. /8) for automatic '
193
                         'network configuration' )
191 194
        opts.add_option( '--pin', action='store_true',
192 195
                         default=False, help="pin hosts to CPU cores "
193 196
                         "(requires --host cfs or --host rt)" )

Also available in: Unified diff