Oops.. Looks like I inadvertently dropped ryu-devel from the thread..

So below was correspondence between Gandhimathi and I (Ali).  Feel free to
provide feedback...


### Gandhimathi  ###

Have you tried with set_field()?
page 167 from https://media.readthedocs.org/pdf/ryu/latest/ryu.pdf



### Ali ###

I've tried the following which works fine:

match = parser.OFPMatch(eth_dst="02:a3:33:b2:2d:21")

However, for my particular test case, I've got match conditions stored in a
config file and when a switch starts up, I read the config file and install
flows in the switch. Now my config file has things like:

inport = 1
eth_src = "None"
eth_dst = "02:a3:33:b2:2d:21"

And in my ryu application, I do something like (pseudo code):

match = parser.OFPMatch()

if inport != "None":
  match.append_field(ofproto.OXM_OF_IN_PORT, inport)

if eth_src != "None":
  match.append_field(ofproto.OXM_OF_ETH_SRC, eth_src)

if eth_dst != "None":
  match.append_field(ofproto.OXM_OF_ETH_SRC, eth_dst)

print "match:", match

match: 1,  02:a3:33:b2:2d:21

So if I don't have a value for a match condition (such as eth_src), I
insert "None" in the config file. Then when I create my match, if "None"
shows up for this parameter (like for eth_src), I don't add it to the match
condition. The the point here is that I append fields (inport, eth_src etc)
to the match condition iteratively. Hence, I can't use the form"match =
parser.OFPMatch(eth_dst="02:a3:33:b2:2d:21""

### Gandhimathi  ###

I understand what you are trying to do. May be the syntax you are using
with match. append_field() is not correct? could you please, refer here:
https://github.com/FlowForwarding/LINC-Switch/commit/4c9aa3ad5ad1250f8357e04a65773b409fbe4b4c.
They used pointer data type to pass in append_field() method.



### Ali ###

Per your suggest, below is what I attempted:

match = parser.OFPMatch()
test=[(ofproto.OXM_OF_IN_PORT,4),(ofproto.OXM_OF_ETH_SRC,"02:a3:33:b2:2d:21")]
for a in test:
    match.append_field(*a)
print "matching:", match

matching: OFPMatch(oxm_fields={'eth_src': '30:32:3a:61:33:3a', 'in_port':
4})

As shown, the mac address still has the same weird format as before

I also tried the following:

match = parser.OFPMatch()
match.set_in_port(4)
match.set_dl_src("02:a3:33:b2:2d:21")
print "matching:", match

matching: OFPMatch(oxm_fields={})

But as shown, the output is empty

REF:
https://github.com/osrg/ryu/blob/master/ryu/app/rest_router.py#L1722

On Fri, Aug 14, 2015 at 2:13 PM, A Sydney <asydney...@gmail.com> wrote:

> Any feedback?
>
> On Wed, Aug 12, 2015 at 5:29 PM, A Sydney <asydney...@gmail.com> wrote:
>
>> Hi Ryu folks,
>>                     This may be a trivial question...
>>
>> I'm using ryu 3.23.2 on CentOS 6.6 (OF 1.3). As shown below, when I
>> insert a mac address (02:a3:33:b2:2d:21), "appends_fields" seem to do
>> something smart that results in "30:32:3a:61:33:3a" in "match" (as opposed
>> to "02:a3:33:b2:2d:21").
>>
>> # Ryu app
>> match = parser.OFPMatch()
>> match.append_field(ofproto.OXM_OF_ETH_SRC, "02:a3:33:b2:2d:21")
>> print match
>>
>> # Output
>> OFPMatch(oxm_fields={'eth_src': '30:32:3a:61:33:3a'})
>>
>> How do I get the original mac address (02:a3:33:b2:2d:21) inserted in
>> "match"?
>>
>> Thanks,
>> Ali
>>
>
>
------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to