I want to know when a switch removes any flow rule after hard_timeout is passed. I know ofp_flow_mod
has an attribute flags
where I can test OFPFF_SEND_FLOW_REM
. I made the following in my controller:
def handle_flowRemoval(self, event):
msg = event.parsed
if msg.flags == of.OFPFF_SEND_FLOW_REM:
print ("The switch %s has raised the removal event!" % event.dpid)
In fact it does not trigger this method after hard_timeout is expired. I don't know why. Can anyone suggest how to fix it.
Tank you
If you are sure there are flows installed on the switch best approach would be to add the topology module and listen to the FlowRemoved event mixin
In your main class add something like
core.openflow.addListenerByName("FlowRemoved", self._handle_flow_removal)
and then somewhere to read the event
def _handle_flow_removal (self, event):
"""
handler flow removed event here
"""
print event.__dict__() # to get available info
The FlowRemoved event mixin is in the POX topology.py module at line 172 https://github.com/noxrepo/pox/blob/carp/pox/openflow/topology.py