Ah, I begin to see the problem here. :)
The ports that the port stats are referring to are *switch ports*. Like the
ethernet and wifi interfaces. Not TCP/UDP ports.
If you want to gather statistics on TCP/UDP ports, you do that by installing
flows that match on those TCP/UDP ports and then monitoring the flow stats.
-- Murphy
On Feb 18, 2012, at 1:53 AM, Diana Marosin wrote:
> Hello,
>
> I use a Linksys wrt54gl, v1.1.
>
> With Wireshark I can identify ports 46245 for ACK controller -> switch and 22
> for the SSH PC -> switch, in nox the output is totally different.
>
> In nox, if I use the monitoring.py I receive empty stats and ports 1 and
> 65534, but if I use the packet_in_callback I can extract the port from the
> packet (here the 22 for the ssh)
>
> Maybe I misunderstood what those stats should show, but please point me in
> the right direction.
>
> My output is in this form :
> Aggregate stats in from datapath 58:6d:87:62:f8:b1
> {'packet_count': 0L, 'byte_count': 0L, 'flow_count': 0L}
> packet_in_callback: 58:6d:87:62:f8:b1
> ssh packet received on port 22
> Table stats in from datapath 58:6d:87:62:f8:b1
> hash2 : 0
> linear : 0
> Port stats in from datapath 58:6d:87:62:f8:b1
> 1 : 4162
> 65534 : 0
>
> My code is bellow:
> def aggregate_timer(self, dpid):
> flow = ofp_match()
> flow.wildcards = 0xffffffff
> self.ctxt.send_aggregate_stats_request(dpid, flow, 0xff)
> self.post_callback(MONITOR_TABLE_PERIOD, lambda :
> self.aggregate_timer(dpid))
>
> def table_timer(self, dpid):
> self.ctxt.send_table_stats_request(dpid)
> self.post_callback(MONITOR_TABLE_PERIOD, lambda :
> self.table_timer(dpid))
>
> def port_timer(self, dpid):
> self.ctxt.send_port_stats_request(dpid, OFPP_NONE)
> self.post_callback(MONITOR_PORT_PERIOD, lambda :
> self.port_timer(dpid))
>
> # For each new datapath that joins, create a timer loop that monitors
> # the statistics for that switch
> def datapath_join_callback(self, dpid, stats):
> print "datapath_join_callback: ", longlong_to_octstr(dpid)[6:]
> self.post_callback(MONITOR_TABLE_PERIOD, lambda :
> self.table_timer(dpid))
> self.post_callback(MONITOR_PORT_PERIOD + 1, lambda :
> self.port_timer(dpid))
> self.post_callback(MONITOR_AGGREGATE_PERIOD + 2, lambda :
> self.aggregate_timer(dpid))
>
> def aggregate_stats_in_handler(self, dpid, stats):
> print "Aggregate stats in from datapath", longlong_to_octstr(dpid)[6:]
> print '\t',stats
>
> def table_stats_in_handler(self, dpid, tables):
> print "Table stats in from datapath", longlong_to_octstr(dpid)[6:]
> for item in tables:
> print '\t',item['name'],':',item['active_count']
>
> def port_stats_in_handler(self, dpid, ports):
> print "Port stats in from datapath", longlong_to_octstr(dpid)[6:]
> for item in ports:
> print '\t',item['port_no'],':',item['rx_packets']
>
> def packet_in_callback(self, dpid, inport, reason, len, bufid, packet):
> flow=extract_flow(packet)
> if flow['tp_dst'] == 22:
> print "packet_in_callback: ", longlong_to_octstr(dpid)[6:]
> print "ssh packet received on port 22"
>
> def install(self):
> self.register_for_packet_in(self.packet_in_callback)
> self.register_for_datapath_join(lambda dpid, stats :
> self.datapath_join_callback(dpid,stats))
> self.register_for_table_stats_in(self.table_stats_in_handler)
> self.register_for_port_stats_in(self.port_stats_in_handler)
> self.register_for_aggregate_stats_in(self.aggregate_stats_in_handler)
>
>
> Thank you!
> Diana
>
>
> On Fri, Feb 17, 2012 at 2:14 PM, Murphy McCauley <[email protected]> wrote:
> What type of switch are you using, and are you sure that it's reporting the
> ports correctly? I assume your ssh traffic should be going through multiple
> ports...
>
> The first thing I'd suggest is that you check the control traffic with
> Wireshark and the OpenFlow dissector to see if what's coming across the wire
> is consistent with what you see in NOX.
>
> -- Murphy
>
> On Feb 17, 2012, at 5:02 AM, Diana Marosin wrote:
>
> > Hello,
> >
> > I am trying to retrieve the ports statistics from an openflow switch using
> > nox. I tried to use the coreapp/ examples /monitoring.py script, but no
> > matter what I do (for example a ssh) I retrive only ports 1 (rx_packets
> > values are always increasing) and 65534 (rx_packets = 0). If I use the
> > packet_in_callback then from the packet I can extract the port number, but
> > the parameter inport is 1 (not as I would expect).
> >
> > Any idea on what is happening and why the stats don't work?
> >
> > I mention I use NOX 0.9.1-full-beta compiled with OpenFlow 0x01.
> >
> > Thank you,
> > Diana _______________________________________________
> > nox-dev mailing list
> > [email protected]
> > http://noxrepo.org/mailman/listinfo/nox-dev
>
>
_______________________________________________
nox-dev mailing list
[email protected]
http://noxrepo.org/mailman/listinfo/nox-dev