Re: [Ryu-devel] actions operation
Brought to you by:
nz_gizmoguy
|
From: Iwase Y. <iwa...@gm...> - 2016-08-02 06:43:51
|
Hi,
First, please try '--verbose' option of ryu-manager to get the detail logs.
On my environment, the following error messages were shown.
$ ryu-manager ryu.app.simple_switch_13 --verbose
...
move onto main mode
EventOFPErrorMsg received.
version=0x4, msg_type=0x1, msg_len=0x4c, xid=0x737ff375
`-- msg_type: OFPT_ERROR(1)
OFPErrorMsg(type=0x2, code=0xa, data=b'\x04\x0e\x00\x70\x73\x7f\xf3\x75\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x18\x80\x00\x06\x06\x00\x00\x00\x00\x00\x07\x80\x00')
|-- type: OFPET_BAD_ACTION(2)
|-- code: OFPBAC_MATCH_INCONSISTENT(10)
`-- data: version=0x4, msg_type=0xe, msg_len=0x70, xid=0x737ff375
`-- msg_type: OFPT_FLOW_MOD(14)
...(snip)
And, to use the SET_FIELD action, the OXM prerequisites (see 7.2.3.6 in OpenFlow Spec 1.3)
corresponding to the field to be set must be included in the flow entry.
For example, to set ip_dscp by the SET_FIELD action, eth_type=0x0800 or eth_type=0x86dd is
required in the match field.
$ git diff
diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py
index 3e7c598..21bbc35 100644
--- a/ryu/app/simple_switch_13.py
+++ b/ryu/app/simple_switch_13.py
@@ -48,6 +48,13 @@ class SimpleSwitch13(app_manager.RyuApp):
ofproto.OFPCML_NO_BUFFER)]
self.add_flow(datapath, 0, match, actions)
+ match = parser.OFPMatch(eth_src='00:00:00:00:00:04',
+ eth_dst='00:00:00:00:00:07',
+ eth_type=0x0800)
+ actions = [parser.OFPActionSetField(ip_dscp=32),
+ parser.OFPActionOutput(3)]
+ self.add_flow(datapath, 10, match, actions)
+
def add_flow(self, datapath, priority, match, actions, buffer_id=None):
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
$ sudo mn --controller remote
...
mininet> sh ovs-ofctl dump-flows s1
NXST_FLOW reply (xid=0x4):
cookie=0x0, duration=17.025s, table=0, n_packets=0, n_bytes=0, idle_age=17, priority=10,ip,dl_src=00:00:00:00:00:04,dl_dst=00:00:00:00:00:07 actions=mod_nw_tos:128,output:3
cookie=0x0, duration=17.025s, table=0, n_packets=1, n_bytes=70, idle_age=17, priority=0 actions=CONTROLLER:65535
...(snip)
Thanks,
Iwase
On 2016年07月28日 22:44, Tan...@da... wrote:
>
>
> Hi
>
>
> I tried to use the following code to add a data flow which has two specific actions operations: OFPActionSetField, and OFPActionOutput.
>
>
> match = parser.OFPMatch(eth_src='00:00:00:00:00:04', eth_dst='00:00:00:00:00:07')
> actions = [parser.OFPActionSetField(parser.OFPMatchField.make(ofproto.OXM_OF_IP_DSCP, 32)), parser.OFPActionOutput(3)]
> inst = [parser.OFPInstructionActions(ofp.OFPIT_WRITE_ACTIONS,actions)]
> self.add_flow(datapath=datapath, priority=10, match=match, instructions=inst)
>
> Although it is not showing any error but the rule (two actions operations) is not accepted by the switch. the other part of the coding is ok, and working perfectly fine.
>
> I want to mark the data packet flow (IP_DSCP). Could you please modify the code in the right way for me ?
>
> Thanks in advance ;)
> -Tanvir
>
>
>
>
>
> ------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> Ryu-devel mailing list
> Ryu...@li...
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
|