Thank you for your reply. The thing is I need to also get the port number of
each flow in match section so in flow table ,I should have src_mac,
dst_mac,ip_proto, eth_type, tcp/udp_src,tcp/udp_dst. The problem is I have all
of other feature but cannot get tcp/udp_src, tcp_udp_dst.
I also configured the switch for tcp to have:
Ip_proto=6
Eth_type = 0x800
And for udp:
Ip_proto = 17
Eth_type = 0x800
The portion of code that do the match for me is:
ethtype = msg.match['eth_type']
if ethtype == 0x800 and ipproto in [ 1, 6, 17]:
ipsrc = msg.match['ipv4_src']
ipdst = msg.match['ipv4_dst']
match = ofparser.OFPMatch(eth_type=0x0800, eth_src=
src,eth_dst=dst, ip_proto = ipproto , ipv4_src = ipsrc,ipv4_dst = ipdst )
else:
match = ofparser.OFPMatch(eth_type=ethtype, eth_src=
src,eth_dst=dst)
but I don't know how to add for example tcp/udp_src and tcp/udp_dst to the msg
because with print msg I see none of the mentioned feature.
I would appreciated if you point me into a right direction.
Thank you again.
Best regards
AK
________________________________
From: Iwase Yusuke <[email protected]>
Sent: Tuesday, September 27, 2016 8:03 AM
To: [email protected]
Cc: [email protected]
Subject: Re: [Ryu-devel] TCP_SRC/TCP_DST
Hi,
What exactly error did you get?
For adding tcp_src/tcp_dst match fields, please check the "7.2.3.6 Flow
Match Field Prerequisite" in OpenFlow Spec 1.3, first.
For example, if you want to add tcp_dst=80, you also need to specify
eth_type=0x0800 and ip_proto=6.
$ git diff
diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py
index 3e7c598..9f29041 100644
--- a/ryu/app/simple_switch_13.py
+++ b/ryu/app/simple_switch_13.py
@@ -48,6 +48,11 @@ class SimpleSwitch13(app_manager.RyuApp):
ofproto.OFPCML_NO_BUFFER)]
self.add_flow(datapath, 0, match, actions)
+ match = parser.OFPMatch(eth_type=0x0800, ip_proto=6, tcp_dst=80)
+ actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,
+ ofproto.OFPCML_NO_BUFFER)]
+ self.add_flow(datapath, 0, match, actions)
+
def add_flow(self, datapath, priority, match, actions, buffer_id=None):
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
$ sudo mn --controller remote
...(snip)
mininet> sh ovs-ofctl dump-flows s1
NXST_FLOW reply (xid=0x4):
cookie=0x0, duration=11.877s, table=0, n_packets=0, n_bytes=0, idle_age=11,
priority=0 actions=CONTROLLER:65535
cookie=0x0, duration=11.877s, table=0, n_packets=0, n_bytes=0, idle_age=11,
priority=0,tcp,tp_dst=80 actions=CONTROLLER:65535
Thanks,
Iwase
On 2016?09?23? 02:20, Aidin Kelki wrote:
> Hi guys
>
>
> I am trying to add tcp_src/tcp_dst to the flow table but whenever I run Ryu,
> it gives me error. also I checked the msg but there is no tcp(src_port,
> dst_port). I want to ask how to add tcp_src/tcp_dst to match so I can get
> that from the flow?
>
>
> Thank you
>
>
>
> ------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel