def test_summaries(self): print("--test_summaries--") os.chdir(os.path.dirname(os.path.realpath(__file__))) summaries_file = "test_summaries_file.txt" measurement = Measurement(1001, summaries_file) summary, local_hit = measurement._get_summary(summaries_file) self.assertEqual(summary, measurement.summary) self.assertTrue(local_hit) local_dict = measurement._get_dict_from_nonempty_file(summaries_file) local_summary = local_dict["1001"] self.assertEqual(local_summary, measurement.summary)
import My_RIPE from My_RIPE import Measurement, Measurement_Data d = Measurement._get_dict_from_nonempty_file('test_dict_all.out') total_shorter = 0 total_longer = 0 ipv4_only = 0 ipv6_only = 0 both = 0 neither = 0 # loop through probes for probe in d: ipv4 = 0 ipv6 = 0 shorter = 0 longer = 0 # loop through origins for origin in d[probe]['origins']: length = len(origin) if length < 4+3 and origin != "": shorter += 1 print(origin) elif length >= 4+3 and length <= 3*4+3: ipv4 +=1 elif length > 3*4+3 and length <= 8*4+7: ipv6 +=1 elif length > 8*4+7:
import My_RIPE from My_RIPE import Measurement, Measurement_Data import numpy as np import matplotlib.mlab as mlab import matplotlib.pyplot as plt import json from collections import Counter d = Measurement._get_dict_from_nonempty_file('probe-target_dict_all.txt') pings_1 = [] pings_2 = [] dns_1 = [] dns_2 = [] traceroutes_1 = [] traceroutes_2 = [] for k in d: if len(d[k]['origins']) == 1: pings_1.append(d[k]['ping']) dns_1.append(d[k]['dns']) traceroutes_1.append(d[k]['traceroute']) elif len(d[k]['origins']) == 2: pings_2.append(d[k]['ping']) dns_2.append(d[k]['dns']) traceroutes_2.append(d[k]['traceroute']) out_dict = {} out_dict['pings_1'] = pings_1 out_dict['pings_2'] = pings_2 out_dict['dns_1'] = dns_1
import My_RIPE from My_RIPE import Measurement, Measurement_Data d = Measurement._get_dict_from_nonempty_file('test_dict_all.out') total_shorter = 0 total_longer = 0 ipv4_only = 0 ipv6_only = 0 both = 0 neither = 0 # loop through probes for probe in d: ipv4 = 0 ipv6 = 0 shorter = 0 longer = 0 # loop through origins for origin in d[probe]['origins']: length = len(origin) if length < 4 + 3 and origin != "": shorter += 1 print(origin) elif length >= 4 + 3 and length <= 3 * 4 + 3: ipv4 += 1 elif length > 3 * 4 + 3 and length <= 8 * 4 + 7: ipv6 += 1 elif length > 8 * 4 + 7: longer += 1
import My_RIPE from My_RIPE import Measurement, Measurement_Data import numpy as np import matplotlib.mlab as mlab import matplotlib.pyplot as plt import json from collections import Counter d = Measurement._get_dict_from_nonempty_file('probe-target_dict_all.txt') pings_1 = [] pings_2 = [] dns_1 = [] dns_2 = [] traceroutes_1 = [] traceroutes_2 = [] for k in d: if len(d[k]['origins']) == 1: pings_1.append(d[k]['ping']) dns_1.append(d[k]['dns']) traceroutes_1.append(d[k]['traceroute']) elif len(d[k]['origins']) == 2: pings_2.append(d[k]['ping']) dns_2.append(d[k]['dns']) traceroutes_2.append(d[k]['traceroute']) out_dict = {} out_dict['pings_1'] = pings_1 out_dict['pings_2'] = pings_2 out_dict['dns_1'] = dns_1