Hi Yusuke,

Thanks for the suggestion, I tried the following code in "simple_switch.py"
however when I send TCP packets from h1 to h2 using iperf in mininet, the
packets are getting transmitted but the flows are not getting written in
the switch table:

@set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
    def _packet_in_handler(self, ev):
        msg = ev.msg

        pkt = packet.Packet(msg.data)
        pkt_tcp = pkt.get_protocol(tcp.tcp)

        if pkt_tcp:
           mod = datapath.ofproto_parser.OFPFlowMod(
               datapath=datapath, match=match, cookie=0,
               command=ofproto.OFPFC_ADD, idle_timeout=100, hard_timeout=0,
               priority=ofproto.OFP_DEFAULT_PRIORITY,
               flags=ofproto.OFPFF_SEND_FLOW_REM, actions=actions)
           datapath.send_msg(mod)
        else:
           mod = datapath.ofproto_parser.OFPFlowMod(
                datapath=datapath, match=match, cookie=0,
                command=ofproto.OFPFC_ADD, idle_timeout=30, hard_timeout=0,
                priority=ofproto.OFP_DEFAULT_PRIORITY,
                flags=ofproto.OFPFF_SEND_FLOW_REM, actions=actions)
           datapath.send_msg(mod)


can you please advise whether I am doing it right as I am not very good in
programming and started learning python these days.

Appreciate your help!!!

Regards,
Govind Prasad



On Sun, Apr 12, 2015 at 8:30 PM, Yusuke Iwase <iwase.yusu...@gmail.com>
wrote:

> Hi Govind,
>
> > 4. If port numbe is greater than 5000, idle timeout is 100 seconds.
>
> You can parse the Packet-In data and get the port number by using packet
> library.
>
> e.g.)
>     @set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
>     def _packet_in_handler(self, ev):
>         msg = ev.msg
>
>         pkt = packet.Packet(msg.data)
>         pkt_tcp = pkt.get_protocol(tcp.tcp)
>
>         if pkt_tcp:
>             dst_port = pkt_tcp.dst_port
>             print "dst_port = %d" % dst_port
>
>
> For more information of packet library, please refer to the Ryu-Book.
>  (http://osrg.github.io/ryu-book/en/html/packet_lib.html)
>
> Thanks,
> Iwase
>
> On 2015年04月13日 08:18, Govind Prasad wrote:
> > Hi yusuke,
> >
> > Thanks fir the info however can you please specify how to implement the
> following scenario:
> >
> > 1. Iperf client send the tcp message on port 8000
> > 2. Iperf server receives the tcp port through ovs
> > 3. Ryu asks the ovs to write the flow with default values
> > 4. If port numbe is greater than 5000, idle timeout is 100 seconds.
> >
> > This is what I want to implement. Can you please guide.
> >
> > Regard,
> > Govind
> >
> > Sent from my iPhone
> >
> >> On Apr 10, 2015, at 10:23 AM, Govind Prasad <pr.govind1...@gmail.com>
> wrote:
> >>
> >> Hi Yusuke,
> >>
> >> Thanks a lot for the response, I will check and reply with my queries
> today.
> >>
> >> Thanks once again!!!
> >>
> >> Regards,
> >> Govind
> >>
> >> Sent from my iPhone
> >>
> >>> On Apr 10, 2015, at 12:45 AM, Yusuke Iwase <iwase.yusu...@gmail.com>
> wrote:
> >>>
> >>> Hi Govind,
> >>>
> >>> To learn "How to implement Ryu Application", please refer to the
> ryu-book.
> >>> The first chapter shows implementation of a simple switching hub.
> >>> (http://osrg.github.io/ryu-book/en/html/switching_hub.html)
> >>>
> >>> And, to set the idle timeout, please refer to "OpenFlow protocol API
> reference" on the Ryu-Documentations.
> >>> If you use OpenFlow 1.3, the following section is helpful for you.
> >>> (
> http://ryu.readthedocs.org/en/latest/ofproto_v1_3_ref.html#modify-state-messages
> )
> >>>
> >>> Thanks,
> >>> Iwase
> >>>
> >>>> On 2015年04月08日 23:44, Govind prasad wrote:
> >>>>
> >>>> Hi experts,
> >>>>
> >>>> I am working on an application which works as follows:
> >>>>
> >>>> 1. The switch gets the first TCP packet
> >>>> 2. It sends the packet to the controller
> >>>> 3. The controller invokes an application which was looking for TCP
> packets.
> >>>> 4. The application sets a extended idle timeout (fore ample 1 hour)
> and sends the flow back to the controller.
> >>>> 5. Now the controller sends the flow modification message for this
> flow with the extended idle timeout.
> >>>>
> >>>> Can anyone help me in building this application which extends the
> idle timeout. I am very new to sdn and programming so would require your
> esteemed support on this.
> >>>>
> >>>> Regards,
> >>>> Govind
> >>>> Sent from my iPhone
> >>>>
> ------------------------------------------------------------------------------
> >>>> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> >>>> Develop your own process in accordance with the BPMN 2 standard
> >>>> Learn Process modeling best practices with Bonita BPM through live
> exercises
> >>>> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual-
> event?utm_
> >>>> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> >>>> _______________________________________________
> >>>> Ryu-devel mailing list
> >>>> Ryu-devel@lists.sourceforge.net
> >>>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> >>>
> >>>
> ------------------------------------------------------------------------------
> >>> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> >>> Develop your own process in accordance with the BPMN 2 standard
> >>> Learn Process modeling best practices with Bonita BPM through live
> exercises
> >>> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual-
> event?utm_
> >>> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> >>> _______________________________________________
> >>> Ryu-devel mailing list
> >>> Ryu-devel@lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> >
> >
> ------------------------------------------------------------------------------
> > BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> > Develop your own process in accordance with the BPMN 2 standard
> > Learn Process modeling best practices with Bonita BPM through live
> exercises
> > http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual-
> event?utm_
> > source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> > _______________________________________________
> > Ryu-devel mailing list
> > Ryu-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/ryu-devel
> >
>
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to