Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. def prepareStats(self, link_ports_all, sw1, sw2, path_element):
  2. global tx_sum, all_switch_checked, traffic_all_single, links
  3. print "&&&&&&&&&&&&&&&&&&&&&&&&&&&&"
  4. print self.net
  5. print "@@@"
  6. self.path_element=path_element
  7. len_port=0
  8. for elo in link_ports_all:
  9. if elo['inquiry: '] ==path_element:
  10. len_port+=1
  11. print "co jest w elo"
  12. print elo
  13. print "ile jest teraz len_port: "+str(len_port)
  14. if all_switch_checked:
  15. nr_path = 0
  16. n = 0
  17. nn = 0 #ile linkow w danej sciezce
  18. list_tx_kbytes = []
  19. traffic_all_single = []
  20.  
  21. while n < len_port:
  22.  
  23. for one_link in link_ports_all:
  24. if one_link['path: '] == nr_path:
  25. nn += 1
  26. tx_sum += (one_link['tx_bytes: '])
  27. list_tx_kbytes.append((one_link['tx_bytes: ']))
  28. self.net[one_link['dst: ']][one_link['src: ']]['weight']=one_link['tx_bytes: ']
  29. n += 1
  30. s = []
  31. tx_max = max(list_tx_kbytes)
  32. print "Paths with metrics. Path_nr: "+str(nr_path)
  33. s.extend([sw1, sw2, nn, tx_max, tx_sum])
  34. print s
  35. if traffic_all_single == []:
  36. traffic_all_single.append(s)
  37. else:
  38. if s[4] < traffic_all_single[0][4]:
  39. traffic_all_single = []
  40. traffic_all_single.append(s)
  41. nr_path += 1
  42. nn = 0
  43. tx_sum = 0
  44. traffic_all_all.append(traffic_all_single[0])
  45. print "Chosen paths:"
  46. print traffic_all_all
  47. return traffic_all_all
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement