Starts or stops a switch
( self, line )
| 388 | output( link, link.status(), '\n' ) |
| 389 | |
| 390 | def do_switch( self, line ): |
| 391 | "Starts or stops a switch" |
| 392 | args = line.split() |
| 393 | if len(args) != 2: |
| 394 | error( 'invalid number of args: switch <switch name>' |
| 395 | '{start, stop}\n' ) |
| 396 | return |
| 397 | sw = args[ 0 ] |
| 398 | command = args[ 1 ] |
| 399 | if sw not in self.mn or self.mn.get( sw ) not in self.mn.switches: |
| 400 | error( 'invalid switch: %s\n' % args[ 1 ] ) |
| 401 | else: |
| 402 | sw = args[ 0 ] |
| 403 | command = args[ 1 ] |
| 404 | if command == 'start': |
| 405 | self.mn.get( sw ).start( self.mn.controllers ) |
| 406 | elif command == 'stop': |
| 407 | self.mn.get( sw ).stop( deleteIntfs=False ) |
| 408 | else: |
| 409 | error( 'invalid command: ' |
| 410 | 'switch <switch name> {start, stop}\n' ) |
| 411 | |
| 412 | def do_wait( self, _line ): |
| 413 | "Wait until all switches have connected to a controller" |