Hello,

I'd like to delete all the flows in case of a SIGINT signal.

I added a handler for SIGINT signal and tried to delete the flows inside the
handler. But, it doesn't seem to work. I'm not getting errors when I try to send
the flow-mod message, though. I captured all control packets at the controller;
I don't see these delete flow-mods.

Skeleton code below. Any help would be appreciated.

Thanks,
/Aravind

fw_dp = None

def delete_flow(dp, table_id, match):
    ofp = dp.ofproto
    parser = dp.ofproto_parser
    instructions = []
    flow_mod = parser.OFPFlowMod(dp, 0, 0, table_id, ofp.OFPFC_DELETE, 0, 0, 1,
        ofp.OFPCML_NO_BUFFER, ofp.OFPP_ANY, ofp.OFPG_ANY, 0, match, 
instructions)
    dp.send_msg(flow_mod)


def handler_signals(signal_num, frame):
    global fw_dp

    if signal_num == signal.SIGINT:
        dp = fw_dp
        ofp = dp.ofproto
        parser = dp.ofproto_parser
        match = parser.OFPMatch()

       for table_id in range(TABLE_ID_DUMMY, TABLE_ID_NON_FPM + 1):
           delete_flow(dp, table_id, match)
        sys.exit(0)


class fw_app(app_manager.RyuApp):
    def __init__(self, *args, **kwargs):
        super(fw_app, self).__init__(args, **kwargs)
        signal.signal(signal.SIGINT, handler_signals)

    # Switch/controller bringup
    @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
    def handle_switch_bringup(self, ev):
        global fpm_dp

        dp = ev.msg.datapath
        fw_dp = dp

        # Default rules and PACKET_IN handling code here

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to