def get_packet_loss(probe, start_time, end_time): kwargs = { "msm_id": "1001", ## K Root Servers "start": start_time - 300, "stop": end_time + 300, "probe_ids": [probe] } is_success, results = AtlasResultsRequest(**kwargs).create() count = 0 if is_success: for result in results: ping_data = PingResult(result) if ping_data.packets_sent != ping_data.packets_received: count += 1 packet_loss = False if count > 0: packet_loss = True return packet_loss
"msm_id": measurement, # my south africa measurement #"start": datetime(2015, 05, 19), # just testing date filtering #"stop": datetime(2015, 05, 20), # just testing date filtering #"probe_ids": [1000070] # the first probe in the measurement } is_success, results = AtlasLatestRequest(**kwargs).create() if is_success: # if measuremnt was a success measurements_dict[measurement] = {} # initialis this measurements dictionary probes = {} # initialise all the probes dictionaries within this measurement i = 0 for result in results: # get all the results of the pings from landmarks to target print("Reading measurement data, ",measurement, "from probes ", i," one moment") # print("this is result ",i, "of measuremnt ", measurement) result = PingResult(result) p = result.probe_id probe = Probe(id=p) # Get all the properties of the individual probe used in this individual measurement a = probe.geometry['coordinates'] # Create a list of Coordinates probe_x = a[0] # Probes X coordinate probe_y = a[1] # Probes Y coordinate probe_id = result.probe_id # get the probe_id for this individual measurement measurements_dict[measurement][probe_id] = {} # initialise this probes dictioonary measurements_dict[measurement][probe_id]['rtt'] = result.rtt_min # get the minimum RTT measurement of the 3 pings from this probe measurements_dict[measurement][probe_id]['ip_addr'] = result.origin # get the Ip address of this probe measurements_dict[measurement][probe_id]['x_coord'] = probe_x # get the x coordinate of this probe measurements_dict[measurement][probe_id]['y_coord'] = probe_y # get the y coordinate of this probe measurements_dict[measurement][probe_id]['asn'] = probe.asn_v4