X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fsimulator-group%2Fsim-monitor.js;h=76739f35eca309e55f90904c3902186a4154c071;hb=72667f1d4b9e534b38b206f64f2ac67df01a2ed9;hp=da71a9e343dff7fac754f580419886e1b445f922;hpb=34882342628629b55c19e7f6a5369de045ab9102;p=nonrtric.git diff --git a/test/simulator-group/sim-monitor.js b/test/simulator-group/sim-monitor.js index da71a9e3..76739f35 100644 --- a/test/simulator-group/sim-monitor.js +++ b/test/simulator-group/sim-monitor.js @@ -21,10 +21,14 @@ // Presents a web page on localhost:9999/mon var LOCALHOST="http://127.0.0.1:" +var LOCALHOSTSECURE="https://127.0.0.1:" +//This var may switch between LOCALHOST and LOCALHOSTSECURE +var SIM_LOCALHOST=LOCALHOST var MRSTUB_PORT="3905" var AGENT_PORT="8081" var CR_PORT="8090" var http = require('http'); +var https = require('https'); var express = require('express'); var app = express(); @@ -38,28 +42,37 @@ app.get("/",function(req, res){ }) //Get parameter valuue from other server -function getSimCtr(url, index, cb) { +function getSimCtr(httpx, url, index, cb) { var data = ''; - http.get(url, (resp) => { - // A chunk of data has been recieved. - resp.on('data', (chunk) => { - data += chunk; - }); - - // The whole response has been received. - resp.on('end', () => { - var code=resp.statusCode - if (code > 199 && code < 300) { - cb(data, index); - } else { - cb("not found", index); - } - }); + var http_type=http + if (httpx=="https") { + http_type=https + } + console.log("URL: "+ url + " - " + httpx) + try { + http_type.get(url, (resp) => { + // A chunk of data has been recieved. + resp.on('data', (chunk) => { + data += chunk; + }); + + // The whole response has been received. + resp.on('end', () => { + var code=resp.statusCode + if (code > 199 && code < 300) { + cb(data, index); + } else { + cb("not found", index); + } + }); - }).on("error", (err) => { - console.log("Error: " + err.message); - cb("no response", index); - }); + }).on("error", (err) => { + console.log("Error: " + err.message); + cb("no response", index); + }); + } catch(err) { + cb("no response", index); + } }; @@ -144,11 +157,17 @@ var simvar1=[] var simvar2=[] var simvar3=[] var simvar4=[] +var simvar5=[] //Counts the number of get request for the html page var getCtr=0 -var refreshInterval=2000 +var refreshInterval=4000 + +//Ignore self signed cert +process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0; + +var sim_http_type="http" function fetchAllMetrics() { setTimeout(() => { @@ -178,60 +197,84 @@ function fetchAllMetrics() { //Get metric values from the simulators for(var index=0;index"+padding("",55,"=")+"
" - + htmlStr=htmlStr+padding("Instances", 10," ")+"
" + htmlStr=htmlStr+padding("",55,"=")+"
" for(var simIndex=0;simIndex"; } + htmlStr=htmlStr+"
"; + htmlStr=htmlStr+padding("Near-RT RIC Simulator name", 35," ") + htmlStr=htmlStr+padding("Remote hosts", 50," ")+"
" + htmlStr=htmlStr+padding("",90,"=")+"
" + for(simIndex=0;simIndex"; + } + htmlStr=htmlStr+ "" + "";