lab description added
diff --git a/web_app/__init__.py b/web_app/__init__.py
index a5be111..fe42ff8 100644
--- a/web_app/__init__.py
+++ b/web_app/__init__.py
@@ -5,6 +5,7 @@
from config import TEST_PATH
from report import build_vertical_bar, build_lines_chart
from storage_api import create_storage
+import requests
app = Flask(__name__)
Bootstrap(app)
@@ -53,7 +54,6 @@
table = [[]]
storage = create_storage('file://' + TEST_PATH + '/' + test_name + '.json')
results = storage.recent_builds()
-
bars = build_vertical_bar(results)
lines = build_lines_chart(results)
urls = bars + lines
@@ -78,11 +78,52 @@
return render_template("test.html", urls=urls, table_url=url_for('render_table', test_name=test_name))
+def collect_lab_data(tests, meta):
+ print requests.get(meta['__meta__'], cookies={"token" : '72237e94dc2b408482c29edaf3609da7'}).content
+ lab_info = json.loads(requests.get(meta['__meta__'], cookies={"token" : '72237e94dc2b408482c29edaf3609da7'}).content)
+ nodes = []
+ result = {}
+
+ for node in lab_info:
+ d = {}
+ d['name'] = node['name']
+ p = []
+ i = []
+ disks = []
+ devices = []
+
+ for processor in node['meta']['cpu']['spec']:
+ p.append(processor)
+
+ for iface in node['meta']['interfaces']:
+ i.append(iface)
+
+ m = node['meta']['memory'].copy()
+
+ for disk in node['meta']['disks']:
+ disks.append(disk)
+
+ d['memory'] = m
+ d['disks'] = disks
+ d['devices'] = devices
+ d['interfaces'] = i
+ d['processors'] = p
+
+ nodes.append(d)
+
+ result['nodes'] = nodes
+ result['name'] = 'Perf-1 Env'
+
+ return result
+
+
@app.route("/tests/table/<test_name>/")
def render_table(test_name):
tests = load_test(test_name)
header_keys = ['build_id', 'iso_md5', 'type']
table = [[]]
+ meta = {"__meta__" : "http://172.16.52.112:8000/api/nodes"}
+ data = collect_lab_data(tests, meta)
if len(tests) > 0:
sorted_keys = sorted(tests[0].keys())
@@ -102,7 +143,8 @@
table.append(row)
- return render_template("table.html", headers=header_keys, table=table, back_url=url_for('render_test', test_name=test_name))
+ return render_template("table.html", headers=header_keys, table=table,
+ back_url=url_for('render_test', test_name=test_name), lab=data)
@app.route("/tests/<test_name>", methods=['POST'])
diff --git a/web_app/templates/lab_header.html b/web_app/templates/lab_header.html
index 03b7e8e..203adf2 100644
--- a/web_app/templates/lab_header.html
+++ b/web_app/templates/lab_header.html
@@ -1,30 +1,38 @@
<div>
- <table>
- <th>
- Parameter name :
- </th>
- <th>
- Value :
- </th>
- <tr>
- <td>Proccessor </td>
- <td>Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz</td>
- </tr>
- <tr>
- <td>Proccessor count</td>
- <td>12</td>
- </tr>
- <tr>
- <td>RAM </td>
- <td> 2 x 16 GB, Total 32GB</td>
- </tr>
- <tr>
- <td>Disk Size</td>
- <td> 2 x 16 GB, Total 32GB</td>
- </tr>
- <tr>
- <td>Disk model</td>
- <td>ST2000NM0033-9ZM</td>
- </tr>
- </table>
+ <div>
+ Lab Name : {{ lab.name }}
+ </div>
+
+ {% for node in lab.nodes %}
+ {% for p in node.processors %}
+ <div>
+ Processor model : {{ p.model }}
+ Processor frequency : {{ p.frequency }}
+ </div>
+ {% endfor %}
+
+ {% for i in node.interfaces %}
+ <div>
+ name : {{ i.name }}
+ MAC frequency : {{ i.mac }}
+ max speed : {{ i.max_speed }}
+ current speed : {{ i.current_speed }}
+ state : {{ i.state }}
+ </div>
+ {% endfor %}
+
+ {% for disk in node.disks %}
+ <div>
+ Disk name : {{ disk.name }}
+ Size: {{ disk.size }}
+ </div>
+ {% endfor %}
+
+ <div>
+ Memory total : node.memory.total
+ Memory : node.memory.maximum_capacity
+ </div>
+
+ {% endfor %}
+
</div>
\ No newline at end of file
diff --git a/web_app/templates/test.html b/web_app/templates/test.html
index eb4df3d..6313b62 100644
--- a/web_app/templates/test.html
+++ b/web_app/templates/test.html
@@ -8,7 +8,7 @@
</head>
<body>
{% block body %}
- <h1 align="center">Lab name goes here:-)</h1>
+ <h1 align="center">Perf-1 Env</h1>
<div class="table-responsive">
<table class="table" width="600">
<div id="images">