On Mon, 17 Feb 2014 12:31:51 -0800
vinay pai <[email protected]> wrote:

> What I am trying to achieve is incrementally pass flow with the combination
> of matches. For Example, I first pass a flow with match on ethertype, next
> with match on ethertype and source MAC, then with match on ethertype,
> source MAC and destination MAC, and so on. I have added this small snipet
> of code below:
> 
>     while (count < 7):
> 
>       match = parser.OFPMatch(in_port=5097) ----> (creating here)
> 
>       if (count & 1):
>         #match = parser.OFPMatch(in_port=5097, vlan_vid=vlan)
>         match.vlan_vid=vlan -----> (modifying here)
>         print 'match on vlan = ',vlan
> 
>       if (count & 2):
>         #match = parser.OFPMatch(in_port=5097, eth_src=src)
>         match.eth_src=src
>         print 'match on Source MAC Address', src
> 
>       if (count & 4):
>         #match = parser.OFPMatch(in_port=5097, eth_dst=dst)
>         match.eth_dst=dst
>         print 'match on Destination MAC Address', dst
> 
>       actions = [parser.OFPActionOutput(out_port)]
>       print 'Flow to be added'
>       self.add_flow(datapath, 1000, match, actions, table_id)
>       time.sleep(2)
>       count+=1
> 
> This code only pushes match on in_port=5097 and action as out_port. Is
> there no way I can modify the match fields on the object once I have
> created other than by passing as parameter to parser.OFPMatch()? It would
> be great if you could point out a way of modifying the match object in the
> code above. I am sorry if I am ignoring something very obvious.

Instead of updating OFPMatch, how about something like the followings?

while (count < 7):
    d = {'in_port': 5097}

    if (count & 1):
        d.update({'vlan_vid': vlan})

    if (count & 2):
        d.update({'eth_src': src})

    ....

    match = parser.OFPMatch(**d)
    self.add_flow(datapath, 1000, match, actions, table_id)

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to