Hi > This learning flow is not getting configured on the switch due to command syntax error. > There is some mistake with the command syntax. > > Could you please send me an example of a learning flow similar to what i have done ? or is it possible to point out the mistake in above syntax ?
Type of src and dst has become the list rather than the tuple. https://github.com/osrg/ryu/blob/a3c8c591d9e6fe1353f7ba54f56a40f09d301f79/ryu/tests/unit/ofproto/json/of13/libofproto-OFP13-flow_mod.packet.json An example of setting of the above actions is the following. $ git diff diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py index 3e7c598..2fa052a 100644 --- a/ryu/app/simple_switch_13.py +++ b/ryu/app/simple_switch_13.py @@ -44,9 +44,38 @@ class SimpleSwitch13(app_manager.RyuApp): # truncated packet data. In that case, we cannot output packets # correctly. The bug has been fixed in OVS v2.1.0. match = parser.OFPMatch() - actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, - ofproto.OFPCML_NO_BUFFER)] - self.add_flow(datapath, 0, match, actions) + #actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER, + # ofproto.OFPCML_NO_BUFFER)] + #self.add_flow(datapath, 0, match, actions) + + actions = [parser.NXActionLearn( + table_id=99, + specs=[parser.NXFlowSpecMatch(src=('vlan_vid', 0), + dst=('vlan_vid', 0), + n_bits=12), + parser.NXFlowSpecMatch(src=('eth_src_nxm', 0), + dst=('eth_dst_nxm', 0), + n_bits=48), + parser.NXFlowSpecLoad(src=0, + dst=('vlan_vid', 0), + n_bits=12), + parser.NXFlowSpecLoad(src=('tunnel_id_nxm', 0), + dst=('tunnel_id_nxm', 0), + n_bits=64), + parser.NXFlowSpecOutput(src=('in_port', 0), + dst="", + n_bits=32)], + idle_timeout=0, + hard_timeout=300, + priority=1, + cookie=0, + flags=0, + fin_idle_timeout=0, + fin_hard_timeout=0, + ) + ] + + self.add_flow(datapath, 100, match, actions) def add_flow(self, datapath, priority, match, actions, buffer_id=None): ofproto = datapath.ofproto @@ -54,6 +83,9 @@ class SimpleSwitch13(app_manager.RyuApp): inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS, actions)] + + print("inst=%s" % inst) + if buffer_id: mod = parser.OFPFlowMod(datapath=datapath, buffer_id=buffer_id, priority=priority, match=match, The following is the output of the instructions. inst=[OFPInstructionActions(actions=[NXActionLearn(cookie=0,experimenter=8992,fin_hard_timeout=0,fin_idle_timeout=0,flags=0,hard_timeout=300,idle_timeout=0,len=None,priority=1,specs=[NXFlowSpecMatch(dst=('vlan_vid', 0),n_bits=12,src=('vlan_vid', 0)), NXFlowSpecMatch(dst=('eth_dst_nxm', 0),n_bits=48,src=('eth_src_nxm', 0)), NXFlowSpecLoad(dst=('vlan_vid', 0),n_bits=12,src=0), NXFlowSpecLoad(dst=('tunnel_id_nxm', 0),n_bits=64,src=('tunnel_id_nxm', 0)), NXFlowSpecOutput(dst='',n_bits=32,src=('in_port', 0))],subtype=16,table_id=99,type=65535)],type=4)] Please try these to reference. Thanks, On 2016年07月27日 02:59, Krishnamurthy Karthika wrote: > Hi Ryu Developers, > > Could you please help me with the following REST API query ? > > I need to configure a new learning flow on the switch through a new REST API > with given input parameters. > > I took the json example given in the following path > https://github.com/osrg/ryu/blob/a3c8c591d9e6fe1353f7ba54f56a40f09d301f79/ryu/tests/unit/ofproto/json/of13/libofproto-OFP13-flow_mod.packet.json > and tried to frame the following command to give it as an input to ofctl > mod_flow_entry() function > > ######################################################################################################### > > cookie=0 > cookie_mask=0 > flags=0 > hard_timeout=0 > idle_timeout=0 > priority=10 > table_id=0 > > instructions=[parser.OFPInstructionActions(dp.ofproto.OFPIT_APPLY_ACTIONS,[parser.NXActionLearn(cookie=0, > experimenter=8992, fin_hard_timeout=0, fin_idle_timeout=0, flags=0, > hard_timeout=300, idle_timeout=0, priority=2, specs=[ { > parser.NXFlowSpecMatch(dst=[ "00:00:00:00:00:01", 0 ], n_bits=48, src=[ > "00:00:00:00:00:02", 0 ] ) }, { parser.NXFlowSpecLoad( dst=[ 100, 0 ], > n_bits=12, src=0 ) }, { parser.NXFlowSpecLoad( dst=[ 12, 0 ], n_bits=64, > src=[ 24, 0 ] ) }, { parser.NXFlowSpecOutput(dst="", n_bits=32, src=[ 1, 1 ] > ) } ], subtype=16, table_id=99 )]), parser.OFPInstructionGotoTable(100)] > > msg = parser.OFPFlowMod(datapath = dp, > priority = priority, > table_id = table_id, > instructions = instructions) > dp.send_msg(msg) > > > ######################################################################################################### > > This learning flow is not getting configured on the switch due to command > syntax error. > There is some mistake with the command syntax. > > Could you please send me an example of a learning flow similar to what i have > done ? or is it possible to point out the mistake in above syntax ? > Thank you. > > Regards, > Karthika Krishnamurthy. > ------------------------------------------------------------------------------ > What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic > patterns at an interface-level. Reveals which users, apps, and protocols are > consuming the most bandwidth. Provides multi-vendor support for NetFlow, > J-Flow, sFlow and other flows. Make informed decisions using capacity planning > reports.http://sdm.link/zohodev2dev > _______________________________________________ > Ryu-devel mailing list > Ryu-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ryu-devel > ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel