[pox-dev] Modifying existing flows on a switch periodically

Murphy McCauley murphy.mccauley at gmail.com
Mon Dec 16 23:46:48 PST 2013


That's strange.  Do your initial flow_mods (the ones you're modifying) use the enqueue action?

Also, see the last question of the FAQ.  Following some of the guidelines it gives will help.  In particular, if the problem exists in the carp or dart branch, please post a trace of the OpenFlow communication with the switch (e.g., captured with the openflow.debug component).

-- Murphy

On Dec 16, 2013, at 10:57 PM, Sadia Bashir <11msccssbashir at seecs.edu.pk> wrote:

> Hi, 
> 
> I am doing it the following way:
> 
> def _timer_func ():
> 
>   for connection in core.openflow._connections.values():
>     #log.debug("timer function called")
>     msg = of.ofp_flow_mod()
>     msg.command = of.OFPFC_MODIFY_STRICT
>     msg.match.dl_src = "00:00:00:00:00:01"
>     msg.match.dl_src = "00:00:00:00:00:02"
>     msg.actions.append(of.ofp_action_enqueue(port = 1, queue_id=4))
>     connection.send(msg)
> 
> def launch():
>      from pox.lib.recoco import Timer
>      Timer(4, _timer_func, recurring=True)
> 
> but it gives me the following error:
> 
> ERROR:openflow.of_01:[00-00-00-00-00-01 1] OpenFlow Error:
> [00-00-00-00-00-01 1] Error: header:
> [00-00-00-00-00-01 1] Error:   version: 1
> [00-00-00-00-00-01 1] Error:   type:    1 (OFPT_ERROR)
> [00-00-00-00-00-01 1] Error:   length:  76
> [00-00-00-00-00-01 1] Error:   xid:     9
> [00-00-00-00-00-01 1] Error: type: OFPET_BAD_ACTION (2)
> [00-00-00-00-00-01 1] Error: code: OFPBAC_BAD_LEN (1)
> [00-00-00-00-00-01 1] Error: datalen: 64
> [00-00-00-00-00-01 1] Error: 0000: 01 0e 00 58 00 00 00 09  00 10 00 1b 00 00 30 30   |...X..........00|
> [00-00-00-00-00-01 1] Error: 0010: 3a 30 30 3a 30 30 3a 30  30 3a 30 30 3a 30 32 00   |:00:00:00:00:02.|
> [00-00-00-00-00-01 1] Error: 0020: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
> [00-00-00-00-00-01 1] Error: 0030: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
> INFO:openflow.of_01:[00-00-00-00-00-01 1] closed
> 
> A bad action; is there a way to rewrite queue-id in installed flow-entries on switch? 
> 
> Thank you for any hint/help/suggestion. 
> 
> Kind regards;
> 
> 
> 
> On Mon, Dec 16, 2013 at 11:57 AM, Sadia Bashir <11msccssbashir at seecs.edu.pk> wrote:
> Thank you Murphy, It gave me a fair idea to precede. 
> 
> 
> On Mon, Dec 16, 2013 at 11:29 AM, Murphy McCauley <murphy.mccauley at gmail.com> wrote:
> Set your flow-mod's .command attribute to OFPFC_MODIFY (or OFPFC_MODIFY_STRICT).  If you've imported libopenflow as "of" (the POX convention), it's something like:
> 
> fm = of.ofp_flow_mod()
> ...
> fm.command = of.OFPFC_MODIFY_STRICT
> ...
> connection.send(fm)
> 
> 
> -- Murphy
> 
> On Dec 15, 2013, at 10:16 PM, Sadia Bashir <11msccssbashir at seecs.edu.pk> wrote:
> 
>> Thank you Junaid Khalid and Murphy!
>> 
>> I just got this from pox.openflow.libopenflow_o1
>> 
>> ofp_flow_mod_command_rev_map = {
>>   'OFPFC_ADD'           : 0,
>>   'OFPFC_MODIFY'        : 1,
>>   'OFPFC_MODIFY_STRICT' : 2,
>>   'OFPFC_DELETE'        : 3,
>>   'OFPFC_DELETE_STRICT' : 4,
>> }
>> 
>> 
>> I am not getting clear how do I use it in flow-mods. Please refer me to some example for it. Thank you for your guide and help. Thanks a lot!
>> 
>> sadia
>> 
>> 
>> On Mon, Dec 16, 2013 at 7:20 AM, Murphy McCauley <murphy.mccauley at gmail.com> wrote:
>> On Dec 14, 2013, at 1:56 PM, Sadia Bashir <11msccssbashir at seecs.edu.pk> wrote:
>> 
>> > Hi,
>> >
>> > I want to modify queue_id in installed flows on a switch periodically by sending a flow_mod message from controller(i.e., controller-to-switch message) I tried it using this way on pox-controller:
>> >
>> > def _timer_func ():
>> >     for connection in core.openflow._connections.values():
>> >            connection.send(of.ofp_action_nw_tos(port = 1, queue_id = 2))
>> 
>> This isn’t a flow-mod.  This is just an action!  Construct flow mods for the flows you want to change and include the new action.
>> 
>> > def launch():
>> >      from pox.lib.recoco import Timer
>> >      Timer(4, _timer_func, recurring=True)
>> >
>> > Please tell me if there is a way to modify a value in already existing flow entries on the switch.
>> >
>> > Thanks in advance for any hint or help.
>> > --
>> > sadia
>> 
>> Hope that helps.
>> 
>> — Murphy
>> 
>> 
>> 
>> -- 
>> 
>>  
> 
> 
> 
> 
> -- 
> 
>  
> 
> 
> 
> -- 
> 
>  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.noxrepo.org/pipermail/pox-dev-noxrepo.org/attachments/20131216/335ab586/attachment-0002.htm>


More information about the pox-dev mailing list