def queue_stats_request(self): self.logger.debug("queeu_stats_requests") self.logger.debug("print queue_stats") while True: hub.sleep(1) "ofctl.get_queue_stats()" #self.logger.debug("ofctl start") for dp in self.dps.keys(): stats = ofctl.get_queue_stats(self.datapaths[dp],self.waiters)[str(self.datapaths[dp].id)] sw = self.dps[dp] for st in stats: sw.updateCounter(st["port_no"],st["queue_id"],st["duration_sec"],st["duration_nsec"],st["tx_bytes"],st["tx_packets"])
def get_queue_stats(self, req, dpid, **_kwargs): dp = self.dpset.get(int(dpid)) if dp is None: return Response(status=404) if dp.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION: queues = ofctl_v1_0.get_queue_stats(dp, self.waiters) elif dp.ofproto.OFP_VERSION == ofproto_v1_2.OFP_VERSION: queues = ofctl_v1_2.get_queue_stats(dp, self.waiters) elif dp.ofproto.OFP_VERSION == ofproto_v1_3.OFP_VERSION: queues = ofctl_v1_3.get_queue_stats(dp, self.waiters) else: LOG.debug('Unsupported OF protocol') return Response(status=501) body = json.dumps(queues) return Response(content_type='application/json', body=body)