Hi,

On 2016年11月25日 00:02, Aqsa Malik wrote:
> Hi Iwase,
>
> Thank you so much. I had no idea I had to define all the match entries like
> that. However it is not working for me for some reason, my flow is still
> there.

Hummm... if it is difficult to define the typical match field in your flow,
how about using cookie/cookie_mask field?
Modify and Delete command can apply the filter by cookie value if cookie_mask
contain a value other than 0.


>
> Also is there any help or documentation that can guide me in translating
> the Ryu curl commands in to the python alternatives?

Are you using ofctl_rest.py now?
   http://ryu.readthedocs.io/en/latest/app/ofctl_rest.html

"ryu.lib.ofctl_v1_3" is translating the inputs of REST API into the OpenFlow
message classes, but there is no documentation to translate REST API command
format into RyuApp python code, IIRC.
   https://github.com/osrg/ryu/blob/master/ryu/lib/ofctl_v1_3.py

If it is difficult to use directly the OpenFlow message classes defined in
"ryu.ofproto.ofproto_v1_3_parser", how about trying "ryu.lib.ofctl_v1_3"?
"ryu.lib.ofctl_v1_3" can send the OpenFlow messages by using dict of str
format arguments, and a little more easy to implement your RyuApps.

Thanks,
Iwase


>
> Thanks
>
> On Thu, Nov 24, 2016 at 4:06 AM, Iwase Yusuke <[email protected]>
> wrote:
>
>> 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
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>>
>>>
>
>
>
>
> ------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>

------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to