Hi Sayed Qaiser, 

If you would like to check the queue stats, could you check the stats via this 
command: 
ovs-ofctl queue-stats switch or tcp:127.0.0.1:6634. 

If there is no result, you need to create queues at each port by using 
ovs-vsctl .

then, you should use [msg.actions.append(of.ofp_action_enqueue(port = port, 
queue_id = ??)) ] to select which queue to forward a particular flow. ((Thanks 
to Murphy, I've read this information from previous threads))

Ali



On Wednesday, 23 October 2013, 21:35, Sayed Qaiser Ali Shah Shah 
<[email protected]> wrote:
 
Hello everybody,

I am working with pox controller. I want to check the traffic passing through 
queues i.e. how many flows are there, how many packets and bytes are there and 
what is passing which queue. For calculating flows and packets/bytes I am using 
flow_stats.py which is given in 
https://github.com/hip2b2/poxstuff/blob/master/flow_stats.py.
I have created queues in l2_learning. I tried to integrate both scripts but 
couldn't. Now what I want to do is to create queues in flow_stats.py. I tried 
many ways but was unable to get what I want to achieve. Code for flow_stats.py 
is given below. I am not posting the code which I have modified because I have 
messed with that code a lot. Can anybody tell me that what method I can use to 
create queues and where should I use that method so that the traffic can pass 
via those queues.


from pox.core import core
from pox.lib.util import dpidToStr
import pox.openflow.libopenflow_01 as of

# include as part of the betta branch
from pox.openflow.of_json import *

log = core.getLogger()

# handler for timer function that sends the requests to all the
# switches connected to the controller.
def _timer_func ():
  for connection in core.openflow._connections.values():
    connection.send(of.ofp_stats_request(body=of.ofp_flow_stats_request()))
    connection.send(of.ofp_stats_request(body=of.ofp_port_stats_request()))
  log.debug("Sent %iflow/port stats request(s)", 
len(core.openflow._connections))

# handler to display flow statistics received in JSON format
# structure of event.stats is defined by ofp_flow_stats()
def _handle_flowstats_received (event):
  stats = flow_stats_to_list(event.stats)
  log.debug("FlowStatsReceived from %s: %s", 
    dpidToStr(event.connection.dpid), stats)

  # Get number of bytes/packets in flows for web traffic only
  web_bytes = 0
  web_flows = 0
  web_packet = 0
  for f in event.stats:
    if f.match.tp_dst == 80 or f.match.tp_src == 80:
      web_bytes += f.byte_count
      web_packet += f.packet_count
      web_flows += 1
  log.info("Web traffic from %s: %sbytes (%spackets) over %sflows", 
    dpidToStr(event.connection.dpid), web_bytes, web_packet, web_flows)

# handler to display port statistics received in JSON format
def _handle_portstats_received (event):
  stats = flow_stats_to_list(event.stats)
  log.debug("PortStatsReceived from %s: %s", 
    dpidToStr(event.connection.dpid), stats)
    
# main functiont to launch the module
def launch ():
  from pox.lib.recoco import Timer

  # attach handsers to listners
  core.openflow.addListenerByName("FlowStatsReceived", 
    _handle_flowstats_received) 
  core.openflow.addListenerByName("PortStatsReceived", 
    _handle_portstats_received) 

  # timer set to execute every five seconds
  Timer(5, _timer_func, recurring=True)

Reply via email to