Start network.
( self )
| 3015 | CLI(self.net) |
| 3016 | |
| 3017 | def start( self ): |
| 3018 | "Start network." |
| 3019 | if self.net is None: |
| 3020 | self.net = self.build() |
| 3021 | |
| 3022 | # Since I am going to inject per switch controllers. |
| 3023 | # I can't call net.start(). I have to replicate what it |
| 3024 | # does and add the controller options. |
| 3025 | #self.net.start() |
| 3026 | info( '**** Starting %s controllers\n' % len( self.net.controllers ) ) |
| 3027 | for controller in self.net.controllers: |
| 3028 | info( str(controller) + ' ') |
| 3029 | controller.start() |
| 3030 | info('\n') |
| 3031 | info( '**** Starting %s switches\n' % len( self.net.switches ) ) |
| 3032 | #for switch in self.net.switches: |
| 3033 | # info( switch.name + ' ') |
| 3034 | # switch.start( self.net.controllers ) |
| 3035 | for widget, item in self.widgetToItem.items(): |
| 3036 | name = widget[ 'text' ] |
| 3037 | tags = self.canvas.gettags( item ) |
| 3038 | if 'Switch' in tags: |
| 3039 | opts = self.switchOpts[name] |
| 3040 | switchControllers = [] |
| 3041 | for ctrl in opts['controllers']: |
| 3042 | switchControllers.append(self.net.get(ctrl)) |
| 3043 | info( name + ' ') |
| 3044 | # Figure out what controllers will manage this switch |
| 3045 | self.net.get(name).start( switchControllers ) |
| 3046 | if 'LegacySwitch' in tags: |
| 3047 | self.net.get(name).start( [] ) |
| 3048 | info( name + ' ') |
| 3049 | info('\n') |
| 3050 | |
| 3051 | self.postStartSetup() |
| 3052 | |
| 3053 | def stop( self ): |
| 3054 | "Stop network." |
no test coverage detected