Found this information from the OpenFlow spec.
IPv4_dst and IPv4_src fields need the eth_type to be set as 0x800 and the
tcp_src and tcp_dst fields require the ip_proto as 6.
Thanks,
Srinath
From: Srinath Ananthakrishnana
<[email protected]<mailto:[email protected]>>
Date: Friday, April 17, 2015 at 5:27 PM
To: "[email protected]<mailto:[email protected]>"
<[email protected]<mailto:[email protected]>>
Subject: Adding OpenFlow rules matching TCP
Hello,
I’m new to openvswitch and ryu and am trying to write a simple flow matcher
with openvswitch and ryu and I’m trying to match flows based on TCP 4 tuple.
And the open flow version I’m using is 1.2.
This is what my add_flow function looks like.
def add_tcp_flow(self, dp, in_port, out_port, actions,
eth_src=None, eth_dst=None, ip_src=None, ip_dst=None,
tcp_src=None, tcp_dst=None):
ofproto = dp.ofproto
match = dp.ofproto_parser.OFPMatch(in_port=in_port, tcp_src=tcp_src,
tcp_dst=tcp_dst, ipv4_src=ip_src,
ipv4_dst=ip_dst)
inst = [dp.ofproto_parser.OFPInstructionActions(
ofproto.OFPIT_APPLY_ACTIONS, actions)]
mod = dp.ofproto_parser.OFPFlowMod(datapath=dp, cookie=0,
cookie_mask=0, table_id=0, command=ofproto.OFPFC_ADD,
idle_timeout=0, hard_timeout=0, priority=0,
buffer_id=ofproto.OFP_NO_BUFFER, out_port=out_port,
out_group=ofproto.OFPG_ANY, flags=0, match=match,
instructions=inst)
dp.send_msg(mod)
When I run this code, however, I get an asynchronous error thrown from the
switch.
(Pdb) p ev.msg
OFPErrorMsg(code=9,data="\x03\x0e\x00p`\xcb'\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x
00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\x03\xff\xff\xff\xff\x00\x00\x00\x00\x00\x01\x00(\x80\x00\x00\x0
4\x00\x00\x00\x04\x80\x00\x16\x04",type=4)
I understand that this has an error type = 4 (OFPET_BAD_MATCH) and the code is
9 (OFPBMC_BAD_PREREQ).
I’m not sure what prerequisite I’m missing in my flow add code. Can someone
help me find this piece of information in the docs.
Thanks,
Srinath
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel