From 90eb79018b459c1aa6606168f1ee592da535643c Mon Sep 17 00:00:00 2001
From: Nauman_Ahad <Nauman_Ahad@dell.com>
Date: Tue, 12 Jan 2016 14:47:37 +0500
Subject: Include Ramspeed Index calulcation

Ramspeed Index calculation included.
Additionally, error handling for suite indices calulcation
to ignore absent result files

Change-Id: I8b2360b0f16b6d3b7d8485e88a0c1f7f0787ad5a
Signed-off-by: Nauman_Ahad <Nauman_Ahad@dell.com>
---
 data/opnfv-creds.sh                            | 16 -------
 data/ref_results/compute_benchmarks_indices.py | 33 +++++++++++++-
 data/ref_results/compute_suite.py              | 59 ++++++++++++++++++++------
 data/ref_results/generator_ref_json.py         |  5 +++
 data/ref_results/network_suite.py              | 30 +++++++++----
 data/ref_results/reference.json                |  8 ++++
 data/ref_results/result_accum.py               |  8 ++--
 data/ref_results/storage_suite.py              | 33 ++++++++------
 8 files changed, 138 insertions(+), 54 deletions(-)
 delete mode 100644 data/opnfv-creds.sh

(limited to 'data')

diff --git a/data/opnfv-creds.sh b/data/opnfv-creds.sh
deleted file mode 100644
index 9266c19a..00000000
--- a/data/opnfv-creds.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-export LC_ALL=C
-export OS_NO_CACHE='true'
-export OS_TENANT_NAME='admin'
-export OS_USERNAME='admin'
-export OS_PASSWORD='admin'
-export OS_AUTH_URL='http://172.18.0.69:5000/v2.0'
-export OS_AUTH_STRATEGY='keystone'
-export OS_REGION_NAME='RegionOne'
-export CINDER_ENDPOINT_TYPE='internalURL'
-export GLANCE_ENDPOINT_TYPE='internalURL'
-export KEYSTONE_ENDPOINT_TYPE='internalURL'
-export NOVA_ENDPOINT_TYPE='internalURL'
-export NEUTRON_ENDPOINT_TYPE='internalURL'
-export OS_ENDPOINT_TYPE='internalURL'
-export MURANO_REPO_URL='http://storage.apps.openstack.org/'
diff --git a/data/ref_results/compute_benchmarks_indices.py b/data/ref_results/compute_benchmarks_indices.py
index 305b6b02..1e6922ec 100644
--- a/data/ref_results/compute_benchmarks_indices.py
+++ b/data/ref_results/compute_benchmarks_indices.py
@@ -9,7 +9,7 @@ def dpi_index ():
     for k,v in dpi_dict.iteritems():
         for i,j in dpi_dict[k].iteritems():
             if i=="3  DPI result": 
-                raw_num=int(dpi_dict[k][i]["DPI_benchmark(Gb/s)"])
+                raw_num=float(dpi_dict[k][i]["DPI_benchmark(Gb/s)"])
                 total=total+raw_num
     
     l=len(dpi_dict)
@@ -45,6 +45,37 @@ def dwstone_index (file_dir,benchmark):
     dwstone_dict_i['2. Results']=dwstone_dict
     return dwstone_dict_i
 
+
+def ramspeed_index ():
+    total_int=0
+    total_float=0
+    ramspeed_dict=concat('../../results/ramspeed/')
+    for k,v in ramspeed_dict.iteritems():
+        for i,j in ramspeed_dict[k].iteritems():
+            if i=="3  RamSpeed result":
+                for a,b in ramspeed_dict[k][i].iteritems():
+                    if a=="1. INTmem bandwidth":
+                        raw_int=ramspeed_dict[k][i][a]["5. Average (MB/s)"]
+                        total_int=total_int+float(raw_int)
+                    elif a=="2. FLOATmem bandwidth":
+                        raw_float=ramspeed_dict[k][i][a]["5. Average (MB/s)"]
+                        total_float=total_float+float(raw_float)
+
+    l=len(ramspeed_dict)
+    with open ('./reference.json') as reference_file:
+        reference_djson=json.load(reference_file)
+        int_mem_ref=reference_djson['compute']['ramspeed']['INTmem']['Average (MB/s)']
+        float_mem_ref=reference_djson['compute']['ramspeed']['FLOATmem']['Average (MB/s)']
+        
+    int_mem_index= float((total_int/l)/int_mem_ref)
+    float_mem_index=float((total_float/l)/float_mem_ref)
+    ramspeed_index=float((int_mem_index+float_mem_index)/2)
+    ramspeed_dict_i={};
+    ramspeed_dict_i['1. Index']=ramspeed_index
+    ramspeed_dict_i['2. Results']=ramspeed_dict
+    return ramspeed_dict_i
+
+
 def ssl_index ():
     total_512rsa=0
     total_1024rsa=0
diff --git a/data/ref_results/compute_suite.py b/data/ref_results/compute_suite.py
index 78eaae6f..ce7f33cd 100644
--- a/data/ref_results/compute_suite.py
+++ b/data/ref_results/compute_suite.py
@@ -3,20 +3,53 @@ import compute_benchmarks_indices as benchmark_indices
 
 
 compute_dict={};
-compute_dict['DPI']=benchmark_indices.dpi_index()
-compute_dict['Dhrystone']=benchmark_indices.dwstone_index('dhrystone','Dhrystone')
-compute_dict['Whetstone']=benchmark_indices.dwstone_index('whetstone','Whetstone') 
-compute_dict['SSL']=benchmark_indices.ssl_index()
 
-compute_bench_list=['DPI','Dhrystone','Whetstone','SSL']
+try:
+   compute_dict['DPI']=benchmark_indices.dpi_index()
+except  OSError:
+    pass
+   
+   
+
+try:
+    compute_dict['Dhrystone']=benchmark_indices.dwstone_index('dhrystone','Dhrystone')
+except OSError:
+    pass
+
+try:
+    compute_dict['Whetstone']=benchmark_indices.dwstone_index('whetstone','Whetstone') 
+except OSError:
+    pass
+
+try:
+    compute_dict['SSL']=benchmark_indices.ssl_index()
+except OSError:
+    pass
+
+try:
+    compute_dict['RamSpeed']=benchmark_indices.ramspeed_index()
+except OSError:
+    pass
+
+
+compute_bench_list=['DPI','Dhrystone','Whetstone','SSL','RamSpeed']
+l=len(compute_bench_list)
+
 temp=0
 for benchmark in compute_bench_list:
-    temp=temp+float(compute_dict[benchmark]['1. Index'])
-compute_suite_index=temp/len(compute_bench_list)
-
-compute_dict_f={};
-compute_dict_f['1. Index']=compute_suite_index
-compute_dict_f['2. Compute suite results']=compute_dict
-with open('../../results/compute_result.json', 'w+') as result_json:
-    json.dump(compute_dict_f, result_json, indent=4, sort_keys=True)
+    try:
+        temp=temp+float(compute_dict[benchmark]['1. Index'])
+    except KeyError:
+        l=l-1
+        pass
+
+if l == 0:
+    print "No compute suite results found"
+else:
+    compute_suite_index=temp/l 
+    compute_dict_f={};
+    compute_dict_f['index']=compute_suite_index
+    compute_dict_f['suite results']=compute_dict
+    with open('../../results/compute_result.json', 'w+') as result_json:
+        json.dump(compute_dict_f, result_json, indent=4, sort_keys=True)
 
diff --git a/data/ref_results/generator_ref_json.py b/data/ref_results/generator_ref_json.py
index 986ac61c..a82dbc5d 100644
--- a/data/ref_results/generator_ref_json.py
+++ b/data/ref_results/generator_ref_json.py
@@ -20,6 +20,11 @@ dict_ref['compute']['ssl']['AES']['256B']=803323650
 dict_ref['compute']['ssl']['AES']['1024B']=808861020
 dict_ref['compute']['ssl']['AES']['8192B']=807701160
 
+dict_ref['compute']['ramspeed']={};
+dict_ref['compute']['ramspeed']['INTmem']={};
+dict_ref['compute']['ramspeed']['FLOATmem']={};
+dict_ref['compute']['ramspeed']['INTmem']['Average (MB/s)']=11775.85
+dict_ref['compute']['ramspeed']['FLOATmem']['Average (MB/s)']=9780.23
 
 dict_ref['storage']={};
 dict_ref['storage']['read']={};
diff --git a/data/ref_results/network_suite.py b/data/ref_results/network_suite.py
index 0e687f6a..fd756aa0 100644
--- a/data/ref_results/network_suite.py
+++ b/data/ref_results/network_suite.py
@@ -3,20 +3,32 @@ import network_benchmarks_indices as benchmark_indices
 
 
 network_dict={};
-network_dict['IPERF']=benchmark_indices.iperf_index()
+try:
+    network_dict['IPERF']=benchmark_indices.iperf_index()
+except:
+    pass
 
 
 
 
 network_bench_list=['IPERF']
 temp=0
+l=len(network_bench_list)
+
 for benchmark in network_bench_list:
-    temp=temp+float(network_dict[benchmark]['1. Index'])
-network_suite_index=temp/len(network_bench_list)
-
-network_dict_f={};
-network_dict_f['1. Index']=network_suite_index
-network_dict_f['2. Network suite results']=network_dict
-with open('../../results/network_result.json', 'w+') as result_json:
-    json.dump(network_dict_f, result_json, indent=4, sort_keys=True)
+    try:
+        temp=temp+float(network_dict[benchmark]['1. Index'])
+    except:
+        l=l-1
+        pass
+
+if l == 0:
+   print "No network results found"
+else:
+    network_suite_index=temp/len(network_bench_list)
+    network_dict_f={};
+    network_dict_f['index']=network_suite_index
+    network_dict_f['suite results']=network_dict
+    with open('../../results/network_result.json', 'w+') as result_json:
+        json.dump(network_dict_f, result_json, indent=4, sort_keys=True)
 
diff --git a/data/ref_results/reference.json b/data/ref_results/reference.json
index 7ded5532..cd5f7e67 100644
--- a/data/ref_results/reference.json
+++ b/data/ref_results/reference.json
@@ -2,6 +2,14 @@
     "compute": {
         "dhrystone": 3146.66, 
         "dpi": 8.12, 
+        "ramspeed": {
+            "FLOATmem": {
+                "Average (MB/s)": 9780.23
+            }, 
+            "INTmem": {
+                "Average (MB/s)": 11775.85
+            }
+        }, 
         "ssl": {
             "AES": {
                 "1024B": 808861020, 
diff --git a/data/ref_results/result_accum.py b/data/ref_results/result_accum.py
index 4c600048..4fffb6b1 100644
--- a/data/ref_results/result_accum.py
+++ b/data/ref_results/result_accum.py
@@ -5,12 +5,12 @@ def result_concat(targ_dir):
     list_vm=[];
     list_bm=[];
     diction={};
+   
     for file in os.listdir(targ_dir):
         if file.endswith(".json"):
             if file.startswith("instance"):
                 print str(file)
                 list_vm.append(file)
-                #echo "I am here"
             else:
                 list_bm.append(file)
     l=len(list_bm)
@@ -21,11 +21,13 @@ def result_concat(targ_dir):
         with open (targ_dir+file_t) as result_file:
             result_djson=json.load(result_file)
             diction['Baremetal'+str(int(x+1))]=result_djson
-
+        
     for x in range (0,k):
         file_t=list_vm[x]
         with open (targ_dir+file_t) as result_file:
             result_djson=json.load(result_file)
             diction['Virtual Machine '+str(x+1)]=result_djson
     return diction
-
+    
+   
+         
diff --git a/data/ref_results/storage_suite.py b/data/ref_results/storage_suite.py
index 0c5b4c66..5c1a89a2 100644
--- a/data/ref_results/storage_suite.py
+++ b/data/ref_results/storage_suite.py
@@ -3,20 +3,29 @@ import storage_benchmarks_indices as benchmark_indices
 
 
 storage_dict={};
-storage_dict['FIO']=benchmark_indices.fio_index()
-
-
-
+try:
+    storage_dict['FIO']=benchmark_indices.fio_index()
+except OSError:
+    pass
+    
 
 storage_bench_list=['FIO']
+l=len(storage_bench_list)
 temp=0
 for benchmark in storage_bench_list:
-    temp=temp+float(storage_dict[benchmark]['1. Index'])
-storage_suite_index=temp/len(storage_bench_list)
-
-storage_dict_f={};
-storage_dict_f['1. Index']=storage_suite_index
-storage_dict_f['2. Storage suite results']=storage_dict
-with open('../../results/storage_result.json', 'w+') as result_json:
-    json.dump(storage_dict_f, result_json, indent=4, sort_keys=True)
+    try:
+        temp=temp+float(storage_dict[benchmark]['1. Index'])
+    except KeyError:
+        l-=1
+        
+   
+if l == 0:
+    print "No Storage results found"
+else:
+    storage_suite_index=temp/l
+    storage_dict_f={};
+    storage_dict_f['index']=storage_suite_index
+    storage_dict_f['storage suite']=storage_dict
+    with open('../../results/storage_result.json', 'w+') as result_json:
+        json.dump(storage_dict_f, result_json, indent=4, sort_keys=True)
 
-- 
cgit