Hi everyone,

I wrote some code for monitoring traffic. I created a link which has
10 Mbps I tried to send traffic 5 Mbps with iperf and i expect it will
give me something like 600000 bytes/sec. it did actually but sometimes
it gives me 1000000 bytes/sec.

Here's my code

def _port_stats_reply_handler(self, ev):
    body = ev.msg.body

    for stat in sorted(body, key=attrgetter('port_no')):
        if stat.port_no != ofproto_v1_3.OFPP_LOCAL:
            key = (ev.msg.datapath.id, stat.port_no)
            value = (stat.tx_bytes, stat.rx_bytes, stat.rx_errors,
                stat.duration_sec, stat.duration_nsec)
            self._save_stats(self.port_stats, key, value, 5)

load = stat.tx_bytes
self._save_stats(self.AllLoad, key, load, 1)
if len(self.AllLoad[key]) == 1:
cur_load = load - 0
else:
cur_load = load -self.AllLoad[key][-2]
self._save_stats(self.CurLoad, key, cur_load, 1)
#print ("load-", load ,"allload-",self.AllLoad[key][-2])
#print "Request time:", time.time() - self.request_start
print self.port2curload
if ev.msg.datapath.id==0x1 and stat.port_no==0x2:
      load = stat.tx_bytes
self.port2curload.append(load-self.port2allload[-1])
self.port2allload.append(load)

the output I want is port2curload. your help would be highly appreciated. Thanks

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to