Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def prepareStats(self, link_ports_all, sw1, sw2, path_element):
- global tx_sum, all_switch_checked, traffic_all_single, links
- print "&&&&&&&&&&&&&&&&&&&&&&&&&&&&"
- print self.net
- print "@@@"
- self.path_element=path_element
- len_port=0
- for elo in link_ports_all:
- if elo['inquiry: '] ==path_element:
- len_port+=1
- print "co jest w elo"
- print elo
- print "ile jest teraz len_port: "+str(len_port)
- if all_switch_checked:
- nr_path = 0
- n = 0
- nn = 0 #ile linkow w danej sciezce
- list_tx_kbytes = []
- traffic_all_single = []
- while n < len_port:
- for one_link in link_ports_all:
- if one_link['path: '] == nr_path:
- nn += 1
- tx_sum += (one_link['tx_bytes: '])
- list_tx_kbytes.append((one_link['tx_bytes: ']))
- self.net[one_link['dst: ']][one_link['src: ']]['weight']=one_link['tx_bytes: ']
- n += 1
- s = []
- tx_max = max(list_tx_kbytes)
- print "Paths with metrics. Path_nr: "+str(nr_path)
- s.extend([sw1, sw2, nn, tx_max, tx_sum])
- print s
- if traffic_all_single == []:
- traffic_all_single.append(s)
- else:
- if s[4] < traffic_all_single[0][4]:
- traffic_all_single = []
- traffic_all_single.append(s)
- nr_path += 1
- nn = 0
- tx_sum = 0
- traffic_all_all.append(traffic_all_single[0])
- print "Chosen paths:"
- print traffic_all_all
- return traffic_all_all
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement