Commit 92723feb authored by Boxiang Sun's avatar Boxiang Sun

Add gadget from SR to display on Monitor APP

Credit: This originally based on XU Lu's work
I rewrite it base on Romain's comment and add the tests
parent 0bce726c
......@@ -16,7 +16,7 @@
[template]
filename = instance.cfg
md5sum = 3f982f31a642ba9d6a1613f49e1c0d10
md5sum = 4af831f81760b37250fa50ad3812142a
[amarisoft-stats.jinja2.py]
_update_hash_filename_ = amarisoft-stats.jinja2.py
......@@ -36,35 +36,35 @@ md5sum = e0b68a87238282568e0e04c792ec7288
[template-lte-enb-epc]
_update_hash_filename_ = instance-enb-epc.jinja2.cfg
md5sum = bb4435f433e100fede09ff921d42c927
md5sum = 071a6455b5942655190dbe4f1991e989
[template-lte-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg
md5sum = 49f8628e616c1fa09608b58a7f9ac34e
md5sum = 515e30dc753f77814a49ac17ef9a8446
[template-lte-gnb-epc]
_update_hash_filename_ = instance-gnb-epc.jinja2.cfg
md5sum = 9a0e36188b23831bec3cb53b226baa66
md5sum = 4750fd885b768a32b727875c9b985582
[template-lte-epc]
_update_hash_filename_ = instance-epc.jinja2.cfg
md5sum = acc9176fd9abe1d04c60a08cdd520eee
md5sum = a9dd56a8bb84aa86618782e9492b96fb
[template-lte-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg
md5sum = 6695165ae0e5116073a802f10aba3d94
md5sum = 1f6ce21afbe126b5c9ff2be357c6241a
[template-lte-mme]
_update_hash_filename_ = instance-mme.jinja2.cfg
md5sum = 400accb9d5bc104b1b122a7b9bc3a261
md5sum = e4ce3208b530e4d01fed328843ea76ca
[template-lte-ue-lte]
_update_hash_filename_ = instance-ue-lte.jinja2.cfg
md5sum = 5c1f78588a0d7447807c10765552a6e7
md5sum = e201f486d31388cc2542e91bbda85711
[template-lte-ue-nr]
_update_hash_filename_ = instance-ue-nr.jinja2.cfg
md5sum = 5b032c3c9dbbd5b8552b0ebd8dcc9acf
md5sum = 765fd303d6013cf4dbee108c53623412
[ue_db.jinja2.cfg]
filename = config/ue_db.jinja2.cfg
......@@ -109,3 +109,11 @@ md5sum = e435990eb0a0d4be41efa9bd16dce09b
[cu_config.jinja2.xml]
filename = netconf/cu_config.jinja2.xml
md5sum = 50b8f86cf4ed87be179f6a62284c56d7
[software.cfg.html]
_update_hash_filename_ = gadget/software.cfg.html
md5sum = 61a2f783fbf683a34aed3d13e00baca2
[promise.gadget.js]
_update_hash_filename_ = gadget/promise.gadget.js
md5sum = 330f5f07806f1da11cd05bb8e4b52e55
/*global window, rJS, RSVP, LineChart*/
/*jslint indent:2, maxlen:80, nomen:true */
(function () {
"use strict";
rJS(window)
.declareAcquiredMethod("getPromiseDocument", "getPromiseDocument")
.declareMethod("render", function () {
var gadget = this;
return gadget.getPromiseDocument(
"check-cpu-temperature",
"log/monitor/promise/check-cpu-temperature.json.log"
)
.push(function (result) {
//gadget.element.textContent = result;
result = result.replace(/\'/g, "\"");
var item = result.split("\n"),
tmp = "",
data_tmp = "",
data_list = [],
time = [],
data = [],
i = 0,
data_list_list,
canvas,
label,
tooltip,
line_chart;
item = JSON.parse(JSON.stringify(item));
for (i = 0; i < 30; i += 1) {
data_list.push(item[i]);
data_list_list = JSON.parse(data_list[i]);
if (data_list_list.hasOwnProperty("time")
&& data_list_list.hasOwnProperty("data")) {
tmp = data_list_list.time.split(" ")[1].split(",")[0];
data_tmp = data_list_list.data.cpu_temperature;
}
time.push(tmp);
data.push(data_tmp);
gadget.time = time;
gadget.data = data;
}
canvas = gadget.element.children.line;
data = gadget.data;
label = gadget.time;
tooltip = ['Twelve', 'Fifteen', 'Thirteen', 'Twenty-two',
'Eight', 'Twelve', 'Thirdy-one', 'Three', 'Five'];
line_chart = new LineChart(canvas, data, label, tooltip);
line_chart.draw();
line_chart.tooltipOn('mousemove');
});
});
}());
\ No newline at end of file
<html>
<head>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="g-chart.line.js"></script>
<script src="promise.gadget.js"></script>
<style type="text/css">
.tooltip-chart {
position: fixed;
z-index: 1000;
transform: translate(-50%, -120%);
padding: 10px;
background-color: white;
border-radius: 5px;
text-align: center;
min-width: 100px;
border: 1px solid #000;
box-shadow: 0 0 10px 5px #000;
}
</style>
</head>
<body>
<canvas id="line" width="1600" height="350"></canvas>
</body>
</html>
......@@ -26,6 +26,20 @@ eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
[monitor-httpd-conf-parameter]
httpd-include-file = {{ buildout_directory }}/etc/httpd-include-file.conf
port = ${monitor-instance-parameter:monitor-httpd-port}
url = https://[${monitor-instance-parameter:monitor-httpd-ipv6}]:${:port}
[monitor-instance-parameter]
monitor-httpd-port = ${monitor-address:port}
[monitor-address]
recipe = slapos.cookbook:free_port
minimum = 8035
maximum = 8055
ip = ${monitor-instance-parameter:monitor-httpd-ipv6}
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = {{ slap_connection['computer-id'] }}
......@@ -106,3 +120,4 @@ recipe = slapos.cookbook:publish.serialised
<= monitor-publish
epc-ipv6 = ${lte-mme-request:connection-epc-ipv6}
epc-ipv4 = {{ epc_ipv4 }}
monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html
......@@ -30,6 +30,20 @@ eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
[monitor-httpd-conf-parameter]
httpd-include-file = {{ buildout_directory }}/etc/httpd-include-file.conf
port = ${monitor-instance-parameter:monitor-httpd-port}
url = https://[${monitor-instance-parameter:monitor-httpd-ipv6}]:${:port}
[monitor-instance-parameter]
monitor-httpd-port = ${monitor-address:port}
[monitor-address]
recipe = slapos.cookbook:free_port
minimum = 8035
maximum = 8055
ip = ${monitor-instance-parameter:monitor-httpd-ipv6}
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = {{ slap_connection['computer-id'] }}
......@@ -235,6 +249,7 @@ output = ${directory:etc}/enb.cfg
[publish-connection-information]
<= monitor-publish
recipe = slapos.cookbook:publish.serialised
monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html
[monitor-instance-parameter]
{% if slapparameter_dict.get("name", None) %}
......
......@@ -25,6 +25,20 @@ eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
[monitor-httpd-conf-parameter]
httpd-include-file = {{ buildout_directory }}/etc/httpd-include-file.conf
port = ${monitor-instance-parameter:monitor-httpd-port}
url = https://[${monitor-instance-parameter:monitor-httpd-ipv6}]:${:port}
[monitor-instance-parameter]
monitor-httpd-port = ${monitor-address:port}
[monitor-address]
recipe = slapos.cookbook:free_port
minimum = 8035
maximum = 8055
ip = ${monitor-instance-parameter:monitor-httpd-ipv6}
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = {{ slap_connection['computer-id'] }}
......@@ -93,3 +107,4 @@ recipe = slapos.cookbook:publish.serialised
<= monitor-publish
epc-ipv6 = ${lte-mme-request:connection-epc-ipv6}
epc-ipv4 = {{ epc_ipv4 }}
monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html
......@@ -26,6 +26,20 @@ eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
[monitor-httpd-conf-parameter]
httpd-include-file = {{ buildout_directory }}/etc/httpd-include-file.conf
port = ${monitor-instance-parameter:monitor-httpd-port}
url = https://[${monitor-instance-parameter:monitor-httpd-ipv6}]:${:port}
[monitor-instance-parameter]
monitor-httpd-port = ${monitor-address:port}
[monitor-address]
recipe = slapos.cookbook:free_port
minimum = 8035
maximum = 8055
ip = ${monitor-instance-parameter:monitor-httpd-ipv6}
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = {{ slap_connection['computer-id'] }}
......@@ -106,3 +120,4 @@ recipe = slapos.cookbook:publish.serialised
<= monitor-publish
epc-ipv6 = ${lte-mme-request:connection-epc-ipv6}
epc-ipv4 = {{ epc_ipv4 }}
monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html
......@@ -28,6 +28,20 @@ eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
[monitor-httpd-conf-parameter]
httpd-include-file = {{ buildout_directory }}/etc/httpd-include-file.conf
port = ${monitor-instance-parameter:monitor-httpd-port}
url = https://[${monitor-instance-parameter:monitor-httpd-ipv6}]:${:port}
[monitor-instance-parameter]
monitor-httpd-port = ${monitor-address:port}
[monitor-address]
recipe = slapos.cookbook:free_port
minimum = 8035
maximum = 8055
ip = ${monitor-instance-parameter:monitor-httpd-ipv6}
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = {{ slap_connection['computer-id'] }}
......@@ -188,6 +202,7 @@ output = ${directory:etc}/gnb.cfg
[publish-connection-information]
<= monitor-publish
recipe = slapos.cookbook:publish.serialised
monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html
[monitor-instance-parameter]
{% if slapparameter_dict.get("name", None) %}
......
......@@ -18,6 +18,20 @@ eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
[monitor-httpd-conf-parameter]
httpd-include-file = {{ buildout_directory }}/etc/httpd-include-file.conf
port = ${monitor-instance-parameter:monitor-httpd-port}
url = https://[${monitor-instance-parameter:monitor-httpd-ipv6}]:${:port}
[monitor-instance-parameter]
monitor-httpd-port = ${monitor-address:port}
[monitor-address]
recipe = slapos.cookbook:free_port
minimum = 8035
maximum = 8055
ip = ${monitor-instance-parameter:monitor-httpd-ipv6}
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = {{ slap_connection['computer-id'] }}
......@@ -180,6 +194,7 @@ password = {{ slapparameter_dict['monitor-password'] | string }}
recipe = slapos.cookbook:publish.serialised
epc-ipv6 = ${slap-configuration:ipv6-random}
epc-ipv4 = {{ epc_ipv4 }}
monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html
[macro.promise]
<= monitor-promise-base
......
......@@ -15,6 +15,20 @@ eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
[monitor-httpd-conf-parameter]
httpd-include-file = {{ buildout_directory }}/etc/httpd-include-file.conf
port = ${monitor-instance-parameter:monitor-httpd-port}
url = https://[${monitor-instance-parameter:monitor-httpd-ipv6}]:${:port}
[monitor-instance-parameter]
monitor-httpd-port = ${monitor-address:port}
[monitor-address]
recipe = slapos.cookbook:free_port
minimum = 8035
maximum = 8055
ip = ${monitor-instance-parameter:monitor-httpd-ipv6}
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = {{ slap_connection['computer-id'] }}
......@@ -116,6 +130,7 @@ output = ${directory:etc}/ue.cfg
recipe = slapos.cookbook:publish.serialised
rue_bind_addr = ${slap-configuration:ipv6-random}
com_addr = [${slap-configuration:ipv6-random}]:9002
monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html
[monitor-instance-parameter]
{% if slapparameter_dict.get("name", None) %}
......
......@@ -15,6 +15,20 @@ eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
[monitor-httpd-conf-parameter]
httpd-include-file = {{ buildout_directory }}/etc/httpd-include-file.conf
port = ${monitor-instance-parameter:monitor-httpd-port}
url = https://[${monitor-instance-parameter:monitor-httpd-ipv6}]:${:port}
[monitor-instance-parameter]
monitor-httpd-port = ${monitor-address:port}
[monitor-address]
recipe = slapos.cookbook:free_port
minimum = 8035
maximum = 8055
ip = ${monitor-instance-parameter:monitor-httpd-ipv6}
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = {{ slap_connection['computer-id'] }}
......@@ -119,6 +133,7 @@ output = ${directory:etc}/ue.cfg
recipe = slapos.cookbook:publish.serialised
rue_bind_addr = ${slap-configuration:ipv6-random}
com_addr = [${slap-configuration:ipv6-random}]:9002
monitor-gadget-url = ${:monitor-base-url}/gadget/software.cfg.html
[monitor-instance-parameter]
{% if slapparameter_dict.get("name", None) %}
......
......@@ -25,8 +25,16 @@ parts +=
CreateProcessingEle.jinja2.xml
cu_config.jinja2.xml
sib23.asn
monitor-httpd-extra-conf
# copy all gadget file
gadget
g-chart.line.js
promise.gadget.js
software.cfg.html
rsvp.js
iperf3
eggs
# unimplemented parts - the http monitor and better log handling using logrotate
# apache-php
# logrotate
......@@ -88,6 +96,30 @@ url = ${:_profile_base_location_}/config/${:_buildout_section_name_}
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/netconf/${:_buildout_section_name_}
[gadget]
recipe = slapos.recipe.template
output = ${buildout:directory}/${:_buildout_section_name_}/renderjs.js
url = https://lab.nexedi.com/nexedi/renderjs/raw/b715d066bfddc30bedfc8356fb720dcbb391378e/dist/renderjs-0.28.0.js
md5sum = 7e074a29b07e0045d2ba8a8e63bd499e
[monitor-httpd-extra-conf]
recipe = slapos.recipe.template
output = ${buildout:directory}/etc/httpd-include-file.conf
inline =
Alias /gadget ${buildout:directory}/gadget
<Directory ${buildout:directory}/gadget>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
Satisfy Any
Allow from all
</Directory>
[copy-gadget-to-software]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/gadget/${:_buildout_section_name_}
destination = ${buildout:directory}/gadget/${:_buildout_section_name_}
[enb.jinja2.cfg]
<= copy-config-to-instance
filename = enb.jinja2.cfg
......@@ -123,6 +155,22 @@ filename = CreateProcessingEle.jinja2.xml
<= copy-netconf-to-instance
filename = cu_config.jinja2.xml
# Download gadget files
[software.cfg.html]
<= copy-gadget-to-software
[promise.gadget.js]
<= copy-gadget-to-software
[rsvp.js]
<= copy-gadget-to-software
url = https://lab.nexedi.com/nexedi/rsvp.js/raw/b0c4596df6a52d75705a59262bc992a166ff11a1/dist/rsvp-2.0.4.js
md5sum = 2b0f2d52857b17fdfb8a5c2ea451a5ad
[g-chart.line.js]
<= copy-gadget-to-software
url = https://raw.githubusercontent.com/guschnwg/g-chart/cbcc7bc40f88fcce4854b55d0902b6273004ba3e/g-chart.line.js
md5sum = 57c50b46c9492c6ab78dc44deac3c0ce
[eggs]
recipe = zc.recipe.egg
eggs =
......
......@@ -29,6 +29,7 @@ import os
import yaml
import json
import glob
import requests
from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass
......@@ -181,8 +182,25 @@ def test_sim_card(self):
self.slap.waitForInstance() # Wait until publish is done
p = self.requestSlaveInstance().getConnectionParameterDict()
p = p['_'] if '_' in p else p
self.assertIn('info', p)
p = p['_'] if '_' in p else p
self.assertIn('info', p)
def test_monitor_gadget_url(self):
parameters = json.loads(self.computer_partition.getConnectionParameterDict()['_'])
self.assertIn('monitor-gadget-url', parameters)
monitor_setup_url = parameters['monitor-setup-url']
monitor_gadget_url = parameters['monitor-gadget-url']
monitor_base_url = parameters['monitor-base-url']
public_url = monitor_base_url + '/public'
response = requests.get(public_url, verify=False)
self.assertEqual(requests.codes['OK'], response.status_code)
self.assertIn('software.cfg.html', monitor_gadget_url)
response = requests.get(monitor_gadget_url, verify=False)
self.assertEqual(requests.codes['OK'], response.status_code)
self.assertIn('<script src="rsvp.js"></script>', response.text)
self.assertIn('<script src="renderjs.js"></script>', response.text)
self.assertIn('<script src="g-chart.line.js"></script>', response.text)
self.assertIn('<script src="promise.gadget.js"></script>', response.text)
class TestENBParameters(ORSTestCase):
@classmethod
......@@ -263,6 +281,110 @@ def requestSlaveInstance(cls, software_type):
software_type=software_type,
)
class TestEPCMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True})}
@classmethod
def getInstanceSoftwareType(cls):
return "epc"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestENBMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(enb_param_dict)}
@classmethod
def getInstanceSoftwareType(cls):
return "enb"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestENBEPCMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(enb_param_dict)}
@classmethod
def getInstanceSoftwareType(cls):
return "enb-epc"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestGNBEPCMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(gnb_param_dict1)}
@classmethod
def getInstanceSoftwareType(cls):
return "gnb-epc"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestGNBMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(gnb_param_dict1)}
@classmethod
def getInstanceSoftwareType(cls):
return "gnb"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestMMEMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True, 'slave-list': []})}
@classmethod
def getInstanceSoftwareType(cls):
return "mme"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestUELTEMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True})}
@classmethod
def getInstanceSoftwareType(cls):
return "ue-lte"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestUENRMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True})}
@classmethod
def getInstanceSoftwareType(cls):
return "ue-nr"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestEPCSimCard(ORSTestCase):
@classmethod
def requestDefaultInstance(cls, state='started'):
......
......@@ -29,6 +29,7 @@ import os
import yaml
import json
import glob
import requests
from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass
......@@ -181,8 +182,25 @@ def test_sim_card(self):
self.slap.waitForInstance() # Wait until publish is done
p = self.requestSlaveInstance().getConnectionParameterDict()
p = p['_'] if '_' in p else p
self.assertIn('info', p)
p = p['_'] if '_' in p else p
self.assertIn('info', p)
def test_monitor_gadget_url(self):
parameters = json.loads(self.computer_partition.getConnectionParameterDict()['_'])
self.assertIn('monitor-gadget-url', parameters)
monitor_setup_url = parameters['monitor-setup-url']
monitor_gadget_url = parameters['monitor-gadget-url']
monitor_base_url = parameters['monitor-base-url']
public_url = monitor_base_url + '/public'
response = requests.get(public_url, verify=False)
self.assertEqual(requests.codes['OK'], response.status_code)
self.assertIn('software.cfg.html', monitor_gadget_url)
response = requests.get(monitor_gadget_url, verify=False)
self.assertEqual(requests.codes['OK'], response.status_code)
self.assertIn('<script src="rsvp.js"></script>', response.text)
self.assertIn('<script src="renderjs.js"></script>', response.text)
self.assertIn('<script src="g-chart.line.js"></script>', response.text)
self.assertIn('<script src="promise.gadget.js"></script>', response.text)
class TestENBParameters(ORSTestCase):
@classmethod
......@@ -263,6 +281,110 @@ def requestSlaveInstance(cls, software_type):
software_type=software_type,
)
class TestEPCMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True})}
@classmethod
def getInstanceSoftwareType(cls):
return "epc"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestENBMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(enb_param_dict)}
@classmethod
def getInstanceSoftwareType(cls):
return "enb"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestENBEPCMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(enb_param_dict)}
@classmethod
def getInstanceSoftwareType(cls):
return "enb-epc"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestGNBEPCMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(gnb_param_dict1)}
@classmethod
def getInstanceSoftwareType(cls):
return "gnb-epc"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestGNBMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(gnb_param_dict1)}
@classmethod
def getInstanceSoftwareType(cls):
return "gnb"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestMMEMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True, 'slave-list': []})}
@classmethod
def getInstanceSoftwareType(cls):
return "mme"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestUELTEMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True})}
@classmethod
def getInstanceSoftwareType(cls):
return "ue-lte"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestUENRMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True})}
@classmethod
def getInstanceSoftwareType(cls):
return "ue-nr"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestEPCSimCard(ORSTestCase):
@classmethod
def requestDefaultInstance(cls, state='started'):
......
......@@ -29,6 +29,7 @@ import os
import yaml
import json
import glob
import requests
from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass
......@@ -181,8 +182,25 @@ def test_sim_card(self):
self.slap.waitForInstance() # Wait until publish is done
p = self.requestSlaveInstance().getConnectionParameterDict()
p = p['_'] if '_' in p else p
self.assertIn('info', p)
p = p['_'] if '_' in p else p
self.assertIn('info', p)
def test_monitor_gadget_url(self):
parameters = json.loads(self.computer_partition.getConnectionParameterDict()['_'])
self.assertIn('monitor-gadget-url', parameters)
monitor_setup_url = parameters['monitor-setup-url']
monitor_gadget_url = parameters['monitor-gadget-url']
monitor_base_url = parameters['monitor-base-url']
public_url = monitor_base_url + '/public'
response = requests.get(public_url, verify=False)
self.assertEqual(requests.codes['OK'], response.status_code)
self.assertIn('software.cfg.html', monitor_gadget_url)
response = requests.get(monitor_gadget_url, verify=False)
self.assertEqual(requests.codes['OK'], response.status_code)
self.assertIn('<script src="rsvp.js"></script>', response.text)
self.assertIn('<script src="renderjs.js"></script>', response.text)
self.assertIn('<script src="g-chart.line.js"></script>', response.text)
self.assertIn('<script src="promise.gadget.js"></script>', response.text)
class TestENBParameters(ORSTestCase):
@classmethod
......@@ -263,6 +281,110 @@ def requestSlaveInstance(cls, software_type):
software_type=software_type,
)
class TestEPCMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True})}
@classmethod
def getInstanceSoftwareType(cls):
return "epc"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestENBMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(enb_param_dict)}
@classmethod
def getInstanceSoftwareType(cls):
return "enb"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestENBEPCMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(enb_param_dict)}
@classmethod
def getInstanceSoftwareType(cls):
return "enb-epc"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestGNBEPCMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(gnb_param_dict1)}
@classmethod
def getInstanceSoftwareType(cls):
return "gnb-epc"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestGNBMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(gnb_param_dict1)}
@classmethod
def getInstanceSoftwareType(cls):
return "gnb"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestMMEMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True, 'slave-list': []})}
@classmethod
def getInstanceSoftwareType(cls):
return "mme"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestUELTEMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True})}
@classmethod
def getInstanceSoftwareType(cls):
return "ue-lte"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestUENRMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True})}
@classmethod
def getInstanceSoftwareType(cls):
return "ue-nr"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestEPCSimCard(ORSTestCase):
@classmethod
def requestDefaultInstance(cls, state='started'):
......
......@@ -29,6 +29,7 @@ import os
import yaml
import json
import glob
import requests
from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass
......@@ -181,8 +182,25 @@ def test_sim_card(self):
self.slap.waitForInstance() # Wait until publish is done
p = self.requestSlaveInstance().getConnectionParameterDict()
p = p['_'] if '_' in p else p
self.assertIn('info', p)
p = p['_'] if '_' in p else p
self.assertIn('info', p)
def test_monitor_gadget_url(self):
parameters = json.loads(self.computer_partition.getConnectionParameterDict()['_'])
self.assertIn('monitor-gadget-url', parameters)
monitor_setup_url = parameters['monitor-setup-url']
monitor_gadget_url = parameters['monitor-gadget-url']
monitor_base_url = parameters['monitor-base-url']
public_url = monitor_base_url + '/public'
response = requests.get(public_url, verify=False)
self.assertEqual(requests.codes['OK'], response.status_code)
self.assertIn('software.cfg.html', monitor_gadget_url)
response = requests.get(monitor_gadget_url, verify=False)
self.assertEqual(requests.codes['OK'], response.status_code)
self.assertIn('<script src="rsvp.js"></script>', response.text)
self.assertIn('<script src="renderjs.js"></script>', response.text)
self.assertIn('<script src="g-chart.line.js"></script>', response.text)
self.assertIn('<script src="promise.gadget.js"></script>', response.text)
class TestENBParameters(ORSTestCase):
@classmethod
......@@ -263,6 +281,110 @@ def requestSlaveInstance(cls, software_type):
software_type=software_type,
)
class TestEPCMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True})}
@classmethod
def getInstanceSoftwareType(cls):
return "epc"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestENBMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(enb_param_dict)}
@classmethod
def getInstanceSoftwareType(cls):
return "enb"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestENBEPCMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(enb_param_dict)}
@classmethod
def getInstanceSoftwareType(cls):
return "enb-epc"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestGNBEPCMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(gnb_param_dict1)}
@classmethod
def getInstanceSoftwareType(cls):
return "gnb-epc"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestGNBMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(gnb_param_dict1)}
@classmethod
def getInstanceSoftwareType(cls):
return "gnb"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestMMEMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True, 'slave-list': []})}
@classmethod
def getInstanceSoftwareType(cls):
return "mme"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestUELTEMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True})}
@classmethod
def getInstanceSoftwareType(cls):
return "ue-lte"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestUENRMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True})}
@classmethod
def getInstanceSoftwareType(cls):
return "ue-nr"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestEPCSimCard(ORSTestCase):
@classmethod
def requestDefaultInstance(cls, state='started'):
......
......@@ -29,6 +29,7 @@ import os
import yaml
import json
import glob
import requests
from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass
......@@ -181,8 +182,25 @@ def test_sim_card(self):
self.slap.waitForInstance() # Wait until publish is done
p = self.requestSlaveInstance().getConnectionParameterDict()
p = p['_'] if '_' in p else p
self.assertIn('info', p)
p = p['_'] if '_' in p else p
self.assertIn('info', p)
def test_monitor_gadget_url(self):
parameters = json.loads(self.computer_partition.getConnectionParameterDict()['_'])
self.assertIn('monitor-gadget-url', parameters)
monitor_setup_url = parameters['monitor-setup-url']
monitor_gadget_url = parameters['monitor-gadget-url']
monitor_base_url = parameters['monitor-base-url']
public_url = monitor_base_url + '/public'
response = requests.get(public_url, verify=False)
self.assertEqual(requests.codes['OK'], response.status_code)
self.assertIn('software.cfg.html', monitor_gadget_url)
response = requests.get(monitor_gadget_url, verify=False)
self.assertEqual(requests.codes['OK'], response.status_code)
self.assertIn('<script src="rsvp.js"></script>', response.text)
self.assertIn('<script src="renderjs.js"></script>', response.text)
self.assertIn('<script src="g-chart.line.js"></script>', response.text)
self.assertIn('<script src="promise.gadget.js"></script>', response.text)
class TestENBParameters(ORSTestCase):
@classmethod
......@@ -263,6 +281,110 @@ def requestSlaveInstance(cls, software_type):
software_type=software_type,
)
class TestEPCMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True})}
@classmethod
def getInstanceSoftwareType(cls):
return "epc"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestENBMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(enb_param_dict)}
@classmethod
def getInstanceSoftwareType(cls):
return "enb"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestENBEPCMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(enb_param_dict)}
@classmethod
def getInstanceSoftwareType(cls):
return "enb-epc"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestGNBEPCMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(gnb_param_dict1)}
@classmethod
def getInstanceSoftwareType(cls):
return "gnb-epc"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestGNBMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps(gnb_param_dict1)}
@classmethod
def getInstanceSoftwareType(cls):
return "gnb"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestMMEMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True, 'slave-list': []})}
@classmethod
def getInstanceSoftwareType(cls):
return "mme"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestUELTEMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True})}
@classmethod
def getInstanceSoftwareType(cls):
return "ue-lte"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestUENRMonitorGadgetUrl(ORSTestCase):
@classmethod
def getInstanceParameterDict(cls):
return {'_': json.dumps({'testing': True})}
@classmethod
def getInstanceSoftwareType(cls):
return "ue-nr"
def test_monitor_gadget_url(self):
self.slap.waitForInstance() # Wait until publish is done
test_monitor_gadget_url(self)
class TestEPCSimCard(ORSTestCase):
@classmethod
def requestDefaultInstance(cls, state='started'):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment