Hi,
This is a sample driver of sflow parser.
Please use as follows.
$ ryu-manager sFlow_collector.py
sFlow_collector.py
------------------------------------
import gflags
import socket
from ryu.base import app_manager
from ryu.lib import hub
from ryu.lib.xflow import sflow
FLAGS = gflags.FLAGS
gflags.DEFINE_string('sflow_listen_host', '', 'sflow listen host')
gflags.DEFINE_integer('sflow_listen_port', 6343, 'sflow listen port')
BUFSIZE = 65535
class sFlowCollector(app_manager.RyuApp):
def __init__(self):
super(sFlowCollector, self).__init__()
self.is_active = True
self._start_recv()
def close(self):
self.is_active = False
hub.joinall([self.thread])
def _start_recv(self):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.sock.bind((FLAGS.sflow_listen_host, FLAGS.sflow_listen_port))
self.thread = hub.spawn(self._recv_loop)
def _recv_loop(self):
self.logger.info('== sflow recv_loop start. ==')
while self.is_active:
(data, addrport) = self.sock.recvfrom(BUFSIZE)
msg = sflow.sFlow.parser(data)
if msg:
# debug print
self.logger.info(msg.__dict__)
------------------------------------
thanks.
(2013年07月24日 17:37), [email protected] wrote:
> Dear Sir or Madam,
> i am a newer for ryu.
> i want to use sflw, but i don not know how to use sflow function in ryu.
> In the ryu source code i only find a sflow.py file which implement the parse
> function of sflow datapacket.
> pls tell me how to use the sflow function in RYU project.
> thanks a lot.
> dongliang
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> [email protected]
>
>
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel