X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fsimulator-group%2Fsim-monitor.js;h=f993410fc510c454ce3c4550accd5bb3cdae39b3;hb=d2aeca8843fe3ffca2e73dec5b64daeef0dda938;hp=56a6e6d211eafde2265bd0f5fab651b79d55687f;hpb=cdc8a586be446a08d1d43f1f8a56115d5f72d9c6;p=nonrtric.git diff --git a/test/simulator-group/sim-monitor.js b/test/simulator-group/sim-monitor.js index 56a6e6d2..f993410f 100644 --- a/test/simulator-group/sim-monitor.js +++ b/test/simulator-group/sim-monitor.js @@ -17,14 +17,14 @@ # */ -// Sim mon server - query the agent and the simulators for counters and other data +// Sim mon server - query the a1pms and the simulators for counters and other data // Presents a web page on localhost:9999/mon var LOCALHOST="http://127.0.0.1:" var MRSTUB_PORT="3905" -var AGENT_PORT="8081" +var A1PMS_PORT="8081" var CR_PORT="8090" -var ECS_PORT="8083" +var ICS_PORT="8083" var PRODSTUB_PORT="8092" var RC_PORT="8680" @@ -161,7 +161,7 @@ function clearFlag(flag) { //Status variables, for parameters values fetched from other simulators var mr1="", mr2="", mr3="", mr4="", mr5="", mr6=""; -//Status variables for agent +//Status variables for a1pms var ag1="" var ag2="" var ag3="" @@ -186,14 +186,14 @@ var simvar4=[] var simvar5=[] var simvar6=[] -//Status variables, for parameters values fetched from ecs -var ecs1="", ecs2="", ecs3="", ecs4="", ecs_types="-", ecs_producers="-"; -var ecs_producer_arr=new Array(0) -var ecs_producer_type_arr=new Array(0) -var ecs_producer_jobs_arr=new Array(0) -var ecs_producer_status_arr=new Array(0) -var ecs_jobs=new Array(0) -var ecs_job_status=new Array(0) +//Status variables, for parameters values fetched from ics +var ics1="", ics2="", ics3="", ics4="", ics_types="-", ics_producers="-"; +var ics_producer_arr=new Array(0) +var ics_producer_type_arr=new Array(0) +var ics_producer_jobs_arr=new Array(0) +var ics_producer_status_arr=new Array(0) +var ics_jobs=new Array(0) +var ics_job_status=new Array(0) //Status variables, for parameters values fetched from prodstub var ps2="", ps3="", ps4="", ps_types="-", ps_producers="-"; @@ -209,7 +209,7 @@ var getCtr=0 var refreshCount_pol=-1 -var refreshCount_ecs=-1 +var refreshCount_ics=-1 var refreshCount_cr=-1 @@ -219,7 +219,7 @@ var ricbasename="ricsim" var rc_services="" -var pmsprefix="" +var a1pmsprefix="" function fetchAllMetrics_pol() { @@ -236,7 +236,7 @@ function fetchAllMetrics_pol() { if (getCtr%3 == 0) { //Extract the port numbers from the running simulators, for every 3 calls const { exec } = require('child_process'); - exec('docker ps --filter "name='+ricbasename+'" --format "{{.Names}} {{.Ports}}" | sed s/0.0.0.0:// | cut -d \'>\' -f1 | sed \'s/[[-]]*$//\'', (err, stdout, stderr) => { + exec('docker ps --filter "name='+ricbasename+'" --filter "network=nonrtric-docker-net" --format "{{.Names}} {{.Ports}}" | sed s/0.0.0.0:// | cut -d \'>\' -f1 | sed \'s/[[-]]*$//\'', (err, stdout, stderr) => { var simulators = "" simulators=`${stdout}`.replace(/(\r\n|\n|\r)/gm," "); @@ -354,15 +354,15 @@ function fetchAllMetrics_pol() { clearFlag("cr3") }); } - //Agent - more get metrics from the agent + //A1PMS - more get metrics from the a1pms if (checkFunctionFlag("ag1")) { - getSimCtr(LOCALHOST+AGENT_PORT+"/status", 0, function(data, idx) { + getSimCtr(LOCALHOST+A1PMS_PORT+"/status", 0, function(data, idx) { ag1 = data; clearFlag("ag1") }); } if (checkFunctionFlag("ag2")) { - getSimCtr(LOCALHOST+AGENT_PORT+"/services", 0, function(data, idx) { + getSimCtr(LOCALHOST+A1PMS_PORT+"/services", 0, function(data, idx) { ag2=""; try { var jd=JSON.parse(data); @@ -380,7 +380,7 @@ function fetchAllMetrics_pol() { }); } if (checkFunctionFlag("ag3")) { - getSimCtr(LOCALHOST+AGENT_PORT+"/policy_types", 0, function(data, idx) { + getSimCtr(LOCALHOST+A1PMS_PORT+"/policy_types", 0, function(data, idx) { ag3=""; try { var jd=JSON.parse(data); @@ -399,7 +399,7 @@ function fetchAllMetrics_pol() { } if (checkFunctionFlag("ag4")) { - getSimCtr(LOCALHOST+AGENT_PORT+"/policy_ids", 0, function(data, idx) { + getSimCtr(LOCALHOST+A1PMS_PORT+"/policy_ids", 0, function(data, idx) { try { var jd=JSON.parse(data); ag4=""+jd.length @@ -412,7 +412,7 @@ function fetchAllMetrics_pol() { } if (checkFunctionFlag("ag5")) { - getSimCtr(LOCALHOST+AGENT_PORT+"/rics", 0, function(data, idx) { + getSimCtr(LOCALHOST+A1PMS_PORT+"/rics", 0, function(data, idx) { try { var jd=JSON.parse(data); ag5=""+jd.length @@ -429,180 +429,181 @@ function fetchAllMetrics_pol() { }, 500) } -function fetchAllMetrics_ecs() { +function fetchAllMetrics_ics() { - console.log("Fetching enrichment metrics - timer:" + refreshCount_ecs) + console.log("Fetching information metrics - timer:" + refreshCount_ics) - if (refreshCount_ecs < 0) { - refreshCount_ecs = -1 + if (refreshCount_ics < 0) { + refreshCount_ics = -1 return } else { - refreshCount_ecs = refreshCount_ecs - 1 + refreshCount_ics = refreshCount_ics - 1 } setTimeout(() => { - if (checkFunctionFlag("ecs_stat")) { - getSimCtr(LOCALHOST+ECS_PORT+"/status", 0, function(data, index) { + if (checkFunctionFlag("ics_stat")) { + getSimCtr(LOCALHOST+ICS_PORT+"/status", 0, function(data, index) { try { var jd=JSON.parse(data); - ecs1=jd["status"] - ecs2=""+jd["no_of_producers"] - ecs3=""+jd["no_of_types"] - ecs4=""+jd["no_of_jobs"] + ics1=jd["status"] + ics2=""+jd["no_of_producers"] + ics3=""+jd["no_of_types"] + ics4=""+jd["no_of_jobs"] } catch (err) { - ecs1="error response" - ecs2="error response" - ecs3="error response" - ecs4="error response" + ics1="error response" + ics2="error response" + ics3="error response" + ics4="error response" } }); - clearFlag("ecs_stat") + clearFlag("ics_stat") } - if (checkFunctionFlag("ecs_types")) { - getSimCtr(LOCALHOST+ECS_PORT+"/ei-producer/v1/eitypes", 0, function(data, index) { - var tmp_ecs_types="-" + if (checkFunctionFlag("ics_types")) { + getSimCtr(LOCALHOST+ICS_PORT+"/ei-producer/v1/eitypes", 0, function(data, index) { + var tmp_ics_types="-" try { var jd=JSON.parse(data); for(var i=0;i" + "" + ""+ //2 sec auto refresh - "Enrichment coordinator service and producer stub"+ + "information coordinator service and producer stub"+ "" + "" + "" @@ -809,50 +810,50 @@ app.get("/mon2",function(req, res){ } else { htmlStr=htmlStr+"

Set query param '?summary' to false to only show full statistics

" } - if (ecs_job_status.length > 10) { + if (ics_job_status.length > 10) { htmlStr=htmlStr+"
Avoid running the server for large number of producers and/or jobs
" } htmlStr=htmlStr+"
" + - "

Enrichment Coordinator Service

" + + "

Information Coordinator Service

" + "" + - "Status:..........." + formatDataRow(ecs1) + "
" + - "Producers:........" + formatDataRow(ecs2) + "
" + - "Types:............" + formatDataRow(ecs3) + "
" + - "Jobs:............." + formatDataRow(ecs4) + "
" + + "Status:..........." + formatDataRow(ics1) + "
" + + "Producers:........" + formatDataRow(ics2) + "
" + + "Types:............" + formatDataRow(ics3) + "
" + + "Jobs:............." + formatDataRow(ics4) + "
" + "
" if (summary == "false") { htmlStr=htmlStr+ "

Details

" + "" + - "Producer ids:....." + formatDataRow(ecs_producers) + "
" + - "Type ids:........." + formatDataRow(ecs_types) + "
" + + "Producer ids:....." + formatDataRow(ics_producers) + "
" + + "Type ids:........." + formatDataRow(ics_types) + "
" + "
"; - for(var i=0;i" + var s = "Producer types...." + formatDataRow(ics_producer_type_arr[i]) + "
" htmlStr=htmlStr+s } } htmlStr=htmlStr+"
"; - for(i=0;i" + s = "Producer jobs....." + formatDataRow(ics_producer_jobs_arr[i]) + "
" htmlStr=htmlStr+s } } htmlStr=htmlStr+"
"; - for(i=0;i" htmlStr=htmlStr+s } } htmlStr=htmlStr+"
"; - for(i=0;i" htmlStr=htmlStr+s @@ -925,12 +926,12 @@ app.get("/mon",function(req, res){ refreshCount_rc=5 var bn=req.query.basename - pmsprefix=req.query.pmsprefix + a1pmsprefix=req.query.a1pmsprefix - console.log("PMS"+pmsprefix) - if ((bn == undefined) || (pmsprefix == undefined)) { + console.log("A1PMS"+a1pmsprefix) + if ((bn == undefined) || (a1pmsprefix == undefined)) { getCtr=0 - return res.redirect('/mon?basename=ricsim&pmsprefix=/a1-policy/v2'); + return res.redirect('/mon?basename=ricsim&a1pmsprefix=/a1-policy/v2'); } else { ricbasename=bn } @@ -941,14 +942,14 @@ app.get("/mon",function(req, res){ "" + "" + ""+ //2 sec auto refresh - "Policy Agent and simulator monitor"+ + "Policy Management Service and simulator monitor"+ "" + "" + "" + "

Change basename in url if other ric sim prefix is used

" + - "

Change pmsprefix in url if pms with other prefix is used

" + + "

Change a1pmsprefix in url if a1pms with other prefix is used

" + "
" + - "

Policy agent

" + + "

Policy Management Service

" + "" + "Status:..............................." + formatDataRow(ag1) + "
" + "Services:............................." + formatIdRowCompact(ag2) + "
" + @@ -965,7 +966,7 @@ app.get("/mon",function(req, res){ "Fetched responses.............................." + formatDataRow(mr5) + "
" + "Current responses waiting......................" + formatDataRow(mr6) + "
" + "
"+ - "

Callback receiver

" + + "

Callback|Notification receiver

" + "" + "Callbacks received:..................." + formatDataRow(cr1) + "
" + "Callbacks fetched:...................." + formatDataRow(cr2) + "
" + @@ -975,7 +976,7 @@ app.get("/mon",function(req, res){ "" + "Services:............................." + formatIdRowCompact(rc_services) + "
" + "
" + - "

Near-RT RIC Simulators

" + + "

Near-RT RIC | A1 Simulators

" + "" htmlStr=htmlStr+padding("Near-RT RIC Simulator name", 35," ") @@ -1024,5 +1025,5 @@ var httpPort=9999; httpServer.listen(httpPort); console.log("Simulator monitor listening (http) at "+httpPort); console.log("Open the web page on localhost:9999/mon to view the policy statistics page.") -console.log("Open the web page on localhost:9999/mon2 to view the enrichment statistics page.") +console.log("Open the web page on localhost:9999/mon2 to view the information statistics page.") console.log("Open the web page on localhost:9999/mon3 to view CR DB in json.") \ No newline at end of file