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.

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.

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

-- 
----------------------------------------
NTT Laboratories
胡 博 / HU bo
E-mail: hu...@lab.ntt.co.jp
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
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to