Hi, First, which field you want to use as the keys of the delete command?
If you want to delete a flow by priority, you need to use OFPFC_MODIFY_STRICT command instead. But please note OFPFC_MODIFY_STRICT command requires all match fields to be strictly matched. e.g.) The following deletes the flow after sleeping 3 seconds $ git diff diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py index 3e7c598..0172d84 100644 --- a/ryu/app/simple_switch_13.py +++ b/ryu/app/simple_switch_13.py @@ -21,6 +21,8 @@ from ryu.ofproto import ofproto_v1_3 from ryu.lib.packet import packet from ryu.lib.packet import ethernet from ryu.lib.packet import ether_types +from ryu.lib.packet import in_proto +from ryu.lib import hub class SimpleSwitch13(app_manager.RyuApp): @@ -48,6 +50,35 @@ class SimpleSwitch13(app_manager.RyuApp): ofproto.OFPCML_NO_BUFFER)] self.add_flow(datapath, 0, match, actions) + actions = [parser.OFPActionOutput(1)] + match = parser.OFPMatch(eth_type=ether_types.ETH_TYPE_IPV6, + ipv6_dst='2001:db8::1', + ip_proto=in_proto.IPPROTO_ICMPV6) + + self.add_flow(datapath, 35, match, actions) + + hub.spawn(self.del_icmp_flow, datapath) + + def del_icmp_flow(self, datapath): + parser = datapath.ofproto_parser + ofproto = datapath.ofproto + + hub.sleep(3) + + match = parser.OFPMatch(eth_type=ether_types.ETH_TYPE_IPV6, + ipv6_dst='2001:db8::1', + ip_proto=in_proto.IPPROTO_ICMPV6) + priority = 35 + flow_mod = datapath.ofproto_parser.OFPFlowMod( + datapath, + priority=priority, + out_port=1, + out_group=ofproto.OFPG_ANY, + command=datapath.ofproto.OFPFC_DELETE_STRICT, + match=match) + + datapath.send_msg(flow_mod) + def add_flow(self, datapath, priority, match, actions, buffer_id=None): ofproto = datapath.ofproto parser = datapath.ofproto_parser mininet> sh ovs-ofctl dump-flows s1 NXST_FLOW reply (xid=0x4): cookie=0x0, duration=1.754s, table=0, n_packets=0, n_bytes=0, idle_age=717, priority=35,icmp6,ipv6_dst=2001:db8::1 actions=output:1 cookie=0x0, duration=1.755s, table=0, n_packets=0, n_bytes=0, idle_age=1284, priority=0 actions=CONTROLLER:65535 mininet> sh ovs-ofctl dump-flows s1 NXST_FLOW reply (xid=0x4): cookie=0x0, duration=2.359s, table=0, n_packets=0, n_bytes=0, idle_age=718, priority=35,icmp6,ipv6_dst=2001:db8::1 actions=output:1 cookie=0x0, duration=2.360s, table=0, n_packets=0, n_bytes=0, idle_age=1285, priority=0 actions=CONTROLLER:65535 mininet> sh ovs-ofctl dump-flows s1 NXST_FLOW reply (xid=0x4): cookie=0x0, duration=2.852s, table=0, n_packets=0, n_bytes=0, idle_age=718, priority=35,icmp6,ipv6_dst=2001:db8::1 actions=output:1 cookie=0x0, duration=2.853s, table=0, n_packets=0, n_bytes=0, idle_age=1285, priority=0 actions=CONTROLLER:65535 mininet> sh ovs-ofctl dump-flows s1 NXST_FLOW reply (xid=0x4): cookie=0x0, duration=3.721s, table=0, n_packets=0, n_bytes=0, idle_age=1286, priority=0 actions=CONTROLLER:65535 mininet> Thanks, Iwase On 2016年11月24日 00:02, Aqsa Malik wrote: > Hi All, > > I want to delete a single flow entry from the switch table. > > Here are the flow entries in my switch: > > OFPST_FLOW reply (OF1.3) (xid=0x2): > cookie=0x0, duration=176.841s, table=0, n_packets=0, n_bytes=0, > priority=35,icmp6,ipv6_dst=2001:db8:0:f101::1 actions=output:1 > cookie=0x0, duration=176.841s, table=0, n_packets=0, n_bytes=0, > priority=1,icmp6,ipv6_src=2001:db8:0:f101::1 > actions=set_field:fe80::200:ff:fe00:1->ipv6_src,output:2 > cookie=0x0, duration=176.843s, table=0, n_packets=0, n_bytes=0, > priority=0,arp actions=NORMAL > cookie=0x0, duration=176.841s, table=0, n_packets=0, n_bytes=0, > priority=0,icmp6 actions=CONTROLLER:65509 > > and here is my code: > > table_id=0 > parser = datapath.ofproto_parser > ofproto = datapath.ofproto > match = parser.OFPMatch() > instructions = [parser.OFPActionOutput(1)] > dpid=1 > priority=35 > flow_mod = datapath.ofproto_parser.OFPFlowMod(datapath, cookie=0, > cookie_mask=0, table_id=0, hard_timeout=0, priority=priority, > buffer_id=ofproto.OFPCML_NO_BUFFER, out_port=ofproto.OFPP_ANY, > out_group=ofproto.OFPG_ANY, command=datapath.ofproto.OFPFC_DELETE, > match=match, instructions=instructions) > > datapath.send_msg(flow_mod) > > but it does not delete any flow entry. Also I am not sure what to add in > the "match" and "instructions". > > > > ------------------------------------------------------------------------------ > > > > _______________________________________________ > Ryu-devel mailing list > Ryu-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ryu-devel > ------------------------------------------------------------------------------ _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel