Hi,
If you prefer to do it without extra implementations into Ryu core,
you can use "_ordered_fields" argument of OFPMatch().
e.g.)
>>> from ryu.ofproto import ofproto_v1_3_parser as parser
>>> # ordinary way to create a match
>>> m = parser.OFPMatch(in_port=1, eth_dst='aa:bb:cc:dd:ee:ff')
>>> m
OFPMatch(oxm_fields={'in_port': 1, 'eth_dst': 'aa:bb:cc:dd:ee:ff'})
>>> # match fields will be stored in "_fields2" member
>>> m._fields2
[('in_port', 1), ('eth_dst', 'aa:bb:cc:dd:ee:ff')]
>>> # "_ordered_fields" argument specifies "_fields2" member directly
>>> m = parser.OFPMatch(_ordered_fields=[('in_port', 1), ('eth_dst',
>>> 'aa:bb:cc:dd:ee:ff')])
>>> m
OFPMatch(oxm_fields={'in_port': 1, 'eth_dst': 'aa:bb:cc:dd:ee:ff'})
With "_ordered_fields" argument, you can specifies "_fields2" member directly,
and you can set the same filed multiple times.
e.g.)
>>> m = parser.OFPMatch(_ordered_fields=[('in_port', 1), ('eth_dst',
>>> 'aa:bb:cc:dd:ee:ff'), ('in_port', 2), ('eth_dst', 'ff:ee:dd:cc:bb:aa')])
>>> m._fields2
[('in_port', 1), ('eth_dst', 'aa:bb:cc:dd:ee:ff'), ('in_port', 2), ('eth_dst',
'ff:ee:dd:cc:bb:aa')]
Please note this way is not recommended way, I guess.
Because you need to do the following manually in your RyuApps:
- Align with prerequisite order.
e.g.) "eth_type" before "ipv4_src"
- Apply mask if needed.
e.g.) eth_dst=('aa:bb:cc:dd:ee:ff', 'ff:ff:ff:00:00:00')
--(do apply mask)--> eth_dst=('aa:bb:cc:00:00:00',
'ff:ff:ff:00:00:00')
- (There might be other problem...)
If you can handle the above manually, you can create more well-costumed matches
as you like.
Thanks,
Iwase
On 2016年12月14日 06:18, Alan Deikman wrote:
> I have added an OF Experimenter field to Ryu that defines an OXM object. I
> want to create an OFPMatch() object with that field referenced multiple
> times. So for example if my object is named “fieldA” then you might have:
>
> parser = datapath.ofproto_parser
> match = parser.OFPMatch(eth_type = 0x800, fieldA = 100, fieldA = 200,
> fieldA = 99)
>
> This of course doesn’t work because Python parameters follow the rules of a
> dict object where a key is always unique. Alternatively I could use the
> syntax:
>
> match = parser.OFPMatch(eth_type = 0x800, fieldA = [100, 200, 99 ])
>
> but Ryu doesn’t seem prepared to handle that either. Can anyone suggest a
> way of implementing this?
>
> Note: although not exactly condoned by the OF specification, the multiple
> instances of an OXM type in a match term is allowed by Section 7.2.3.6 of the
> OF 1.5 specification.
>
> ----------------------------
> Alan Deikman
> ZNYX Networks, Inc.
>
>
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel