Hi,
On 2015年01月09日 18:15, 林彥宏 wrote:
> Hi,
>
> We got a problem to ask you.
>
> If we want to know which port that data comes in, where can we find it?
> Is it wrapped in ev?
>
> We tested SimpleMonitor.py and simple_switch_13.py using iperf.
> We can see ip and port while running simple_switch_13.py.
> The output is like ip=10.0.0.1 port=5001.
>
> However, the result of ip and port in SimpleMonitor.py is not what we want.
> We also use iperf to throw some data to a specific ip and port.
> We print out body, then we get flow information inside body.
> The outcome of ip is correct, but port is something like 1, 2, or 3, seem
> like its number.
> Is it possible to get the real port in SimpleMonitor.py?
> Like http is 80, HTTPS is 8080.
Information that simple monitor to get is the flow statistics and port
statistics.
Details are described in the following.
OFSpec1.3.4
7.3.5.6 Port Statistics
7.3.5.2 Individual Flow Statistics
These statistics do not include transfer packet own information (TCP/IP/ETH...).
> We are making a monitor that can track traffic on http, ftp and bt three
> ports.
> Can SImpleMonitor do this job for us? Or is there any better suggestions?
Just an idea, if you want to track a packet of TCP_SRC=5001/8080,
and Why not try adding the following code.
(Sorry, this code is quick and dirty.)
@@ -98,6 +98,12 @@ class SimpleSwitch13(app_manager.RyuApp):
# install a flow to avoid packet_in next time
if out_port != ofproto.OFPP_FLOOD:
+
+ tcp_port = [5001,8080]
+ for port in tcp_port:
+ match = parser.OFPMatch(in_port=in_port, eth_dst=dst,
tcp_src=port, ip_proto=6, eth_type=2048)
+ self.add_flow(datapath, 2, match, actions)
+
match = parser.OFPMatch(in_port=in_port, eth_dst=dst)
@@ -63,6 +63,22 @@ class SimpleMonitor(simple_switch_13.SimpleSwitch13):
stat.instructions[0].actions[0].port,
stat.packet_count, stat.byte_count)
+ self.logger.info('datapath '
+ 'tcp-src in-port eth-dst '
+ 'out-port packets bytes')
+ self.logger.info('---------------- '
+ '-------- -------- ----------------- '
+ '-------- -------- --------')
+ for stat in sorted([flow for flow in body if flow.priority == 2],
+ key=lambda flow: (flow.match['tcp_src'],
+ flow.match['in_port'],
+ flow.match['eth_dst'])):
+ self.logger.info('%016x %8d %8x %17s %8x %8d %8d',
+ ev.msg.datapath.id,
+ stat.match['tcp_src'], stat.match['in_port'],
stat.match['eth_dst'],
+ stat.instructions[0].actions[0].port,
+ stat.packet_count, stat.byte_count)
+
@set_ev_cls(ofp_event.EventOFPPortStatsReply, MAIN_DISPATCHER)
Execution results are as follows.
$ ryu-manager ./ryu/app/SimpleMonitor.py
...
datapath in-port eth-dst out-port packets bytes
---------------- -------- ----------------- -------- -------- --------
0000000000000001 1 00:00:00:00:00:02 2 4 168
0000000000000001 2 00:00:00:00:00:01 1 1208886 56447642468
datapath tcp-src in-port eth-dst out-port packets bytes
---------------- -------- -------- ----------------- -------- -------- --------
0000000000000001 5001 1 00:00:00:00:00:02 2 582162 38491340
0000000000000001 5001 2 00:00:00:00:00:01 1 0 0
0000000000000001 8080 1 00:00:00:00:00:02 2 0 0
0000000000000001 8080 2 00:00:00:00:00:01 1 0 0
....
Thanks
>
> Code and screenshots are attached.
>
> thanks for your help!
>
> Best regards,
> David Lin
>
>
> ------------------------------------------------------------------------------
> 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
>
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel