Hi Fujimoto,
I realized my first assumption was incorrect, I am able to insert the flow
defining the IP tunnel endpoints as well as the key in the action set with the
following:
curl -X POST -d '{"dpid": 1193046, "match": {"ipv4_src": "192.168.0.100",
"in_port": 100, "eth_type": 2048, "ipv4_dst": "172.16.0.2"}, "actions":
[{"field": "eth_src", "value": "00:00:00:00:00:00", "type": "SET_FIELD"},
{"field": "eth_dst", "value": "00:00:00:00:00:00", "type": "SET_FIELD"},
{"field": "ipv4_src", "value": "0.0.0.0", "type": "SET_FIELD"}, {"field":
"ipv4_dst", "value": "0.0.0.0", "type": "SET_FIELD"}, {"field": "tun_ipv4_src",
"value": "100.64.1.130", "type": "SET_FIELD"}, {"field": "tun_ipv4_dst",
"value": "100.64.2.130", "type": "SET_FIELD"}, {"field": "tunnel_id", "value":
5, "type": "SET_FIELD"}, {"port": 101, "type": "OUTPUT"}], "priority": 10,
"table_id": 1}' http://localhost:8081/stats/flowentry/add
After taking a closer look, I noticed the problem of matching on “tun_ipv4_src”
and “tun_ipv4_dst” only happen when used in the “match” part of the message.
For example, this is not properly inserted and Ryu throws the “Unknown match
field” messages:
curl -X POST -d '{"actions": [{"type": "SET_FIELD", "field": "eth_src",
"value": "00:00:00:12:34:56"}, {"type": "SET_FIELD", "field": "eth_src",
"value": "00:00:00:12:34:56"}, {"type": "SET_FIELD", "field": "ipv4_src",
"value": "172.16.0.2"}, {"type": "SET_FIELD", "field": "ipv4_dst", "value":
"192.168.0.100"}, {"type": "OUTPUT", "port": 100}], "priority": 10, "dpid":
1193046, "table_id": 2, "match": {"tunnel_id": 5, "in_port": 101,
"tun_ipv4_dst": "100.64.1.130", "tun_ipv4_src": "100.64.2.130", "eth_type":
2048}}' http://localhost:8081/stats/flowentry/add
Do we have an asymmetric behaviour with respect to the NXM fields allowed in
the action vs the matching section? Is this intended or should it be fixed?
Thank you for your quick response!
Best,
Jesus Llorente
From: Fujimoto Satoshi [mailto:[email protected]]
Sent: 02 June 2017 03:48
To: Llorente Santos Jesus <[email protected]>;
[email protected]
Subject: Re: [Ryu-devel] Issue with Ryu REST API and fields tun_ipv4_dst and
tun_ipv4_src
Hi, Llorente
For historical reasons, REST API cannot use full of fields defined in
ofproto/*.py.
The list of match fields REST API can use is shown here:
http://ryu.readthedocs.io/en/latest/app/ofctl_rest.html#description-of-match-and-actions
To use "tun_ipv4_src" and "tun_ipv4_dst" via REST API,
adding fields in this list might be good:
https://github.com/osrg/ryu/blob/6dfda4a227c493c1aed6c468d763650d21d5acce/ryu/lib/ofctl_v1_3.py#L195
Thanks,
Fujimoto
On 2017年06月01日 22:47, Llorente Santos Jesus wrote:
Hello community!
I am trying to use Ryu REST API to insert a flow in an OpenvSwitch datapath.
Unfortunately, I have run into problems with the fields tun_ipv4_src and
tun_ipv4_dst. However, if I add the intended flow via ovs-ofctl, then I can
then fetch it correctly through the Ryu REST API.
The ovs-ofctl command is the following:
# ovs-ofctl add-flow -O OpenFlow13 br-test0
"table=0,priority=10,in_port=100,ip,nw_src=192.168.0.100,nw_dst=172.16.0.1
actions=set_field:100.64.1.130->tun_src,set_field:100.64.2.130->tun_dst,set_field:5->tun_id,output:101"
Is there any way around this issue? I took a look at the ofctl_rest.py but
couldn't figure out myself how to modify the parser so it accepts Nicira fields.
Thank you!
Jesus
PS: This is exactly the same problem as already reported by Zhao Jun on
2016-03-03. I copy it here for further reference
>>> Hi, all
>>> I want to use ryu rest api to add a flow rule to OpenvSwitch.
>>> Here is the body I use
>>> { "dpid": 95529493015, "table_id": 0, "idle_timeout": 0,
>>> "hard_timeout": 1800, "priority": 11, "match":{ "in_port":2,
>>> "tunnel_id_nxm":5001, "tun_ipv4_src":"52.193.10.12",
>>> "dl_type":2048, "nw_src":"10.0.0.0/24",
>>> "nw_dst":"10.0.1.0/24" }, "actions":[ {
>>> "type":"SET_FIELD", "field":"tunnel_id_nxm",
>>> "value":5001 }, { "type":"SET_FIELD",
>>> "field":"tun_ipv4_dst", "value":"52.33.232.199" },
>>> { "type":"OUTPUT", "port": 0xfffffff8 } ]}
>>> The log shows that "Unknown match field: tunnel_id_nxm" and "Unknown match
>>> field: tun_ipv4_src"
>>> These two match fields are found here:
>>> https://github.com/osrg/ryu/blob/7a9b1be5d6874933fdfbf4e610992dd302915ed9/ryu/ofproto/nx_match.py
>>> I guess they are corresponding with "tun_id" and "tun_src" in OpenvSwitch.
>>> But the result is not same as I expected. So if I want to match "tun_id"
>>> and "tun_src" in Openvswitch, which match field shoud I use?
>>> Many thanks.
>>>
>>> Zhao Jun
------------------------------------------------------------------------------
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]<mailto:[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