Script to Test Ports

From Observer GigaFlow Support | VIAVI Solutions Inc.
Revision as of 11:59, 23 November 2018 by Niall (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

//tcpPortTest(JSONArray jsa, String ip, String portsList, int timeout, int threads)

var utils = Java.type('ros.CROSUtils');
var jsonarray = Java.type('org.json.JSONArray')
var results=new jsonarray(true)
for (var i=0;i<results.length();i++){
 var entry =results.getJSONObject(i);
 if (entry.getInt("response")>-1){
 log.warn("Response for port "+entry.getInt("port")+" in "+entry.getInt("response")+" ms");
   log.warn("No response for port "+entry.getInt("port"));