Hi,

First, please check the log messages of ryu-manager with the debug level.
e.g.)
$ ryu-manager --verbose YOUR_APP(s)

This is my assumption, the following message would be displayed.
e.g.)
$ ryu-manager ryu/app/simple_switch_14.py --verbose
EventOFPErrorMsg received.
version=0x5, msg_type=0x1, msg_len=0x4c, xid=0x3398ab1b
  `-- msg_type: OFPT_ERROR(1)
OFPErrorMsg(type=0x4, code=0x9, 
data=b'\x05\x0e\x00\x70\x33\x98\xab\x1b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x24\x80\x00\x00\x04\x00\x00\x00\x02\x80\x00\x06\x06')
  |-- type: OFPET_BAD_MATCH(4)
  |-- code: OFPBMC_BAD_PREREQ(9)
  `-- data: version=0x5, msg_type=0xe, msg_len=0x70, xid=0x3398ab1b
      `-- msg_type: OFPT_FLOW_MOD(14)

Then, please confirm "Flow Match Field Prerequisite" in the OpenFlow spec.
For example, the "ipv4_src" field should be specified with "eth_type=0x0800".
This means the packet which matches this flow should have the IPv4 Ether Type.

Here is the sample I tested on my environment.
$ git diff
diff --git a/ryu/app/simple_switch_14.py b/ryu/app/simple_switch_14.py
index d3151bc..351ea18 100644
--- a/ryu/app/simple_switch_14.py
+++ b/ryu/app/simple_switch_14.py
@@ -48,6 +48,14 @@ class SimpleSwitch14(app_manager.RyuApp):
                                            ofproto.OFPCML_NO_BUFFER)]
          self.add_flow(datapath, 0, match, actions)
  
+        actions = [parser.OFPActionOutput(1)]
+        match = parser.OFPMatch(in_port=2,
+                                eth_dst='ff:ff:ff:ff:ff:ff',
+                                eth_type=ether_types.ETH_TYPE_IP,
+                                ipv4_src='1.1.1.1')
+
+        self.add_flow(datapath, 0, match, actions)
+
      def add_flow(self, datapath, priority, match, actions):
          ofproto = datapath.ofproto
          parser = datapath.ofproto_parser


$ ryu-manager ryu/app/simple_switch_14.py
...

$ sudo mn --controller remote --switch ovs,protocols=OpenFlow14
...
mininet> sh ovs-ofctl dump-flows s1 -O OpenFlow14
OFPST_FLOW reply (OF1.4) (xid=0x2):
  cookie=0x0, duration=4.061s, table=0, n_packets=0, n_bytes=0, priority=0 
actions=CONTROLLER:65535
  cookie=0x0, duration=4.061s, table=0, n_packets=0, n_bytes=0, 
priority=0,ip,in_port=2,dl_dst=ff:ff:ff:ff:ff:ff,nw_src=1.1.1.1 actions=output:1
...


Thanks,
Iwase


On 2016年11月24日 02:45, Prashant Pandey wrote:
> Hi,
>
> Request someone to kindly respond!
>
> Regards.
>
> ---------- Forwarded message ----------
> From: Prashant Pandey <[email protected]>
> Date: Sun, Nov 20, 2016 at 1:59 AM
> Subject: Need help with parser.OFPFlowMod
> To: [email protected]
>
>
> Hi,
>     I'm a new user to RYU and I've a query regarding adding/modifying flow
> entries from controller to switch. I've referred the latest RYU
> documentation here
> <http://ryu.readthedocs.io/en/latest/ofproto_v1_4_ref.html#ryu.ofproto.ofproto_v1_4_parser.OFPFlowMod>,
> but couldn't get help from there.
>
> I want to store an entry on my OVS switch with src_ip too, e.g. my current
> table looks something like this:
>
> OFPST_FLOW reply (OF1.4) (xid=0x2):
>  cookie=0x0, duration=5325.673s, table=0, n_packets=1809, n_bytes=101304,
> priority=1,in_port=2,dl_dst=ff:ff:ff:ff:ff:ff actions=output:2
>  cookie=0x0, duration=5326.418s, table=0, n_packets=35, n_bytes=3220,
> priority=0 actions=CONTROLLER:65535
> root@OVS:~#
>
> However, I wish that it should look something like this (the src_ip for
> that particular flow should also be reflected and stored in the flow):
>
> OFPST_FLOW reply (OF1.4) (xid=0x2):
>  cookie=0x0, duration=5325.673s, table=0, n_packets=1809, n_bytes=101304,
> priority=1,in_port=2,dl_dst=ff:ff:ff:ff:ff:ff actions=output:2,
> src_ip=1.1.1.1
>  cookie=0x0, duration=5326.418s, table=0, n_packets=35, n_bytes=3220,
> priority=0 actions=CONTROLLER:65535
> root@OVS:~#
>
> Is there a way this is achievable?
>
> Thanks and regards,
> Prashant Pandey
>
>
>
> ------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> 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

Reply via email to