Hi Kei

Thanks for your kind response. It works well.
What I did is just to combine the codes on the site you introduced with 
"simple_switch.py".

Our next step is to control the flow by considering the traffic 
information such as the number of packets.

Many thanks,
Bo

(2013/06/18 21:11), OHMURA Kei wrote:
> Hi,
>
> 2013/6/18 Bo HU (Haku Ko) <[email protected]>:
>> Dear all
>>
>> I am a new comer of Ryu. Very glad to join in this community.
>>
>> I created simple environment with 1 openvswitch, 1ryu controller, 4
>> KVM-based VMs in one physical server.
>>
>> Just very beginning question.
>> Could any professor kindly teach me how to get statistic information
>> such as packet counter and byte counter by ryu's app.
> We had the similar question before.
> http://sourceforge.net/mailarchive/message.php?msg_id=30222037
>
> Though it's old code, it would help your understanding.
>
>
>> I saw some codes on the following site.
>> https://github.com/osrg/ryu/wiki/OpenFlowV1.0-in-Ryu
>> ---
>>>    def send_flow_stats_request(self, datapath):
>>>        ofp = datapath.ofproto
>>>        ofp_parser = datapath.ofproto_parser
>>>
>>>        req = ofp_parser.OFPFlowStatsRequest(
>>>            datapath=datapath, flags=0,
>>>            match=ofp_parser.OFPMatch(
>>>                ofp.OFPFW_ALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
>>>            table_id=0xff, out_port=ofp.OFPP_NONE)
>>>        datapath.send_msg(req)
>>>
>>>    @set_ev_cls(ofp_event.EventOFPFlowStatsReply, MAIN_DISPATCHER)
>>>    def flow_stats_reply_handler(self, ev):
>>>        msg = ev.msg
>>>        body = msg.body
>>>
>>>        stats = []
>>>        for stat in body:
>>>            stats.append('length=%d table_id=%d match=%s '
>>>                         'duration_sec=%d duration_nsec=%d '
>>>                         'priority=%d idle_timeout=%d hard_timeout=%d '
>>>                         'cookie=%d packet_count=%d byte_count=%d '
>>>                         'actions=%s' % (stat.length, stat.table_id,
>>>                                         stat.match, stat.duration_sec,
>>>                                         stat.duration_nsec, stat.priority,
>>>                                         stat.idle_timeout, 
>>> stat.hard_timeout,
>>>                                         stat.cookie, stat.packet_count,
>>>                                         stat.byte_count, stat.actions))
>>>        self.logger.debug('OFPFlowStatsReply received: body=%s', stats)
>> ---
>>
>> It seems that the counter information can be collected by combing
>> "send_flow_stats_request", "set_ev_cls" and "flow_stats_reply_handler".
>> I add the above codes into "simple_switch.py"
>> However, it didn't work well without any message.
> Can you send a code that you implemented? I'm not sure what's a problem.
>
> Thanks,
>
>> By the way, the counter information can be checked in the openvswitch by
>> command "ovs-ofctl dump-ports"
>>
>> Sorry for this kind of very very beginning issue.
>>
>> Kind regards,
>> Bo
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel


-- 
----------------------------------------
NTT Laboratories
胡 博 / HU bo
E-mail: [email protected]
TEL: 0422-59-4414
FAX: 0422-59-5637
----------------------------------------



------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to