Search code examples
pythontcpsdnmininetpox

Stopping a switch from Pox controller


I am trying to make a test network where I have a list of switches and only one of them can be active at a time. I'm already keeping a list of connections updated on every ConnectionUp event working like this:

def _handle_ConnectionUp (event):    
  for switch in switchesList:
      ...
      if switch.dpid == str(event.dpid):
        switch.connection = event.connection
      ...
      if any other switch from switchesList is running
        stop that switch
      ...

As far as I understand I can then use connection.send to send a message to that switch, however I didn't manage to find an Openflow message containing a "stop" command. Whenever in the mininet CLI I manually run:

switch s1 start

I want POX to achieve an effect similar to running:

switch s2 stop

from mininet CLI.

Is there a way to send such message or maybe accessing the switch reference in some other way?


Solution

  • Setting flows within the flow-table (for eg. action = of.ofp_action_output(port = of.OFPP_DROP)) to drop all packets at different ports of the said switch could provide the desired effect.