Example #1
0
def linegraph_lmrtt(request):
    device = request.GET.get('deviceid')
    filter_by = request.GET.get('filter_by')

    details = Devicedetails.objects.filter(deviceid=device)[0]

    all_device_details= MLmrtt.objects.filter(average__lte=3000).order_by('eventstamp')
    device_details = all_device_details.filter(deviceid=device)
   
    other_device_details = []
    filtered_deviceids = []	

    if (filter_by == 'location'):
		filtered_deviceids = Devicedetails.objects.filter(city=details.city).exclude(deviceid=device)

    if (filter_by == 'provider'):
		filtered_deviceids = Devicedetails.objects.filter(isp=details.isp).exclude(deviceid=device)

    for row in filtered_deviceids:
		other_device_details.extend(all_device_details.filter(deviceid=row.deviceid))
    result=[]
    result.append(cvs_helper.linegraph_normal(device_details,'Last mile latency',1,1))

    if (filter_by != 'none'):
		bucket_width = 2*3600
		result.append(cvs_helper.linegraph_bucket(other_device_details,bucket_width,'median'))
    answer = str(result).replace("['","[")
    answer = answer.replace(")'",")")

    return HttpResponse("(" + answer + ")")
Example #2
0
def linegraph_bitrate(request):
    g_filter = Graph_Filter(request)
    chosen_limit = 100000000

    details = Devicedetails.objects.filter(deviceid=g_filter.device)[0]
		
    all_device_details= MBitrate.objects.filter(average__lte=chosen_limit).order_by('eventstamp')

    other_device_details_netperf_3 = []
    other_device_details_other = []
    filtered_deviceids = []

    if (g_filter.filter_by == 'location'):
		filtered_deviceids = Devicedetails.objects.filter(city=details.city).exclude(deviceid=g_filter.device)

    if (g_filter.filter_by == 'provider'):
		filtered_deviceids = Devicedetails.objects.filter(isp=details.isp).exclude(deviceid=g_filter.device)

    for row in filtered_deviceids:
		other_device_details_other.extend(all_device_details.filter(deviceid=row.deviceid).exclude(toolid='NETPERF_3'))
		other_device_details_netperf_3.extend(all_device_details.filter(deviceid=row.deviceid).filter(toolid='NETPERF_3'))	

    if (g_filter.graphno==1):
		all_device_details = all_device_details.filter(srcip='143.215.131.173')		
    elif (g_filter.graphno==2): 
        all_device_details = all_device_details.filter(dstip='143.215.131.173')

    my_device_details = all_device_details.filter(deviceid=g_filter.device)

    my_device_details_netperf_3 = my_device_details.filter(toolid='NETPERF_3')
    my_device_details_other = my_device_details.exclude(toolid='NETPERF_3')

    result=[]
    result.append(cvs_helper.linegraph_normal(my_device_details_netperf_3,"Multi-threaded TCP",1000,18000))
    result.append(cvs_helper.linegraph_normal(my_device_details_other,"Single-threaded TCP",1000,18000))
    
    if (g_filter.filter_by != 'none'):
		bucket_width = 24*3600
		result.append(cvs_helper.linegraph_bucket(other_device_details_netperf_3,bucket_width,"multi-median"))
		result.append(cvs_helper.linegraph_bucket(other_device_details_other,bucket_width,"single-median"))
	
    answer = str(result).replace("'D","D")
    answer = answer.replace(")'",")")


    return HttpResponse("(" + answer + ")")