Hi Saman,

On 2015年02月24日 16:42, saman biook aghazadeh wrote:
> Hello everyone,
> 
> I'm looking for a RYU code example, which uses the Pipeline processing 
> feature of the switch,
> but I couldn't find one. Could somebody provide a simple code which shows how 
> to do pipelining?

I couldn't find one too, from Ryu Sample Apps (e.g. ryu/app/*)
How about the following?

---------
    @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
    def switch_features_handler(self, ev):
        datapath = ev.msg.datapath
        ofproto = datapath.ofproto
        parser = datapath.ofproto_parser

        # Install Flow entry to the First Table (table_id=0)
        cookie = cookie_mask = 0
        table_id = 0
        idle_timeout = hard_timeout = 0
        priority = 1111
        buffer_id = ofproto.OFP_NO_BUFFER
        match = parser.OFPMatch(in_port=1, eth_dst='ff:ff:ff:ff:ff:ff')

        next_table_id = 1
        inst = [parser.OFPInstructionGotoTable(next_table_id)]

        req = parser.OFPFlowMod(datapath, cookie, cookie_mask,
                                    table_id, ofproto.OFPFC_ADD,
                                    idle_timeout, hard_timeout,
                                    priority, buffer_id,
                                    ofproto.OFPP_ANY, ofproto.OFPG_ANY,
                                    ofproto.OFPFF_SEND_FLOW_REM,
                                    match, inst)

        datapath.send_msg(req)

        # Install Flow entry to the Second Table (table_id=1)
        cookie = cookie_mask = 0
        table_id = 1
        idle_timeout = hard_timeout = 0
        priority = 2222
        buffer_id = ofproto.OFP_NO_BUFFER
        match = parser.OFPMatch(in_port=1, eth_dst='ff:ff:ff:ff:ff:ff')

        actions = [parser.OFPActionOutput(ofproto.OFPP_NORMAL, 0)]
        inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS,
                                                 actions)]

        req = parser.OFPFlowMod(datapath, cookie, cookie_mask,
                                    table_id, ofproto.OFPFC_ADD,
                                    idle_timeout, hard_timeout,
                                    priority, buffer_id,
                                    ofproto.OFPP_ANY, ofproto.OFPG_ANY,
                                    ofproto.OFPFF_SEND_FLOW_REM,
                                    match, inst)

        datapath.send_msg(req)
---------

I refered to the sample codes of Ryu documentation.

- Flow Mod messages
 
(http://ryu.readthedocs.org/en/latest/ofproto_v1_3_ref.html#modify-state-messages)

- Instruction (e.g. OFPInstructionGotoTable)
 
(http://ryu.readthedocs.org/en/latest/ofproto_v1_3_ref.html#flow-instruction-structures)

> 
> Thanks,
> Saman
> 
> 
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the 
> conversation now. http://goparallel.sourceforge.net/
> 
> 
> 
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to