From 2f8e4d0c778ce07a1da90a7aefa65467cd572286 Mon Sep 17 00:00:00 2001 From: Al Rotundo Date: Fri, 24 Mar 2017 13:54:52 +0000 Subject: [SDNGC-XXXX] fixing sql connection leak was not cleaning up sql connections during checkDB, removed call to checkDB, redundant Change-Id: I3d4a10cb7b743eb68a1969c1719c376829bc27c3 Signed-off-by: Al Rotundo Former-commit-id: d9b6e415838e94bf485c01a3f5d6aaa841e37c45 --- admportal/server/router/routes/Odl.js | 594 ------------------------- admportal/server/router/routes/OdlInterface.js | 594 +++++++++++++++++++++++++ admportal/server/router/routes/mobility.js | 62 +-- admportal/server/router/routes/odl.js | 20 +- admportal/server/router/routes/preload.js | 7 +- admportal/server/router/routes/root.js | 10 +- admportal/server/router/routes/sla.js | 16 +- admportal/server/router/routes/user.js | 14 +- 8 files changed, 657 insertions(+), 660 deletions(-) delete mode 100755 admportal/server/router/routes/Odl.js create mode 100755 admportal/server/router/routes/OdlInterface.js diff --git a/admportal/server/router/routes/Odl.js b/admportal/server/router/routes/Odl.js deleted file mode 100755 index a27d73b3..00000000 --- a/admportal/server/router/routes/Odl.js +++ /dev/null @@ -1,594 +0,0 @@ -// Odl.js -var https = require('https'); -var http = require('http'); -var properties = require(process.env.SDNC_CONFIG_DIR + '/admportal.json'); - - -var Odl = function() { - // Call ODL page - // get(uri,res) - // post(uri,data, res) - - var _healthcheck = function(options, callback) - { - // Setup request to ODL side - console.log('options:' + JSON.stringify(options,null,2)); - var request = https.request(options, function(response) { - - var response_str = ''; - // Read the response from ODL side - response.on('data', function(chunk) { - response_str += chunk; - }); - - response.on('end', function() - { - //logger.debug(response_str); - if(response.statusCode == 200) - { - console.log('200 OK'); - callback(null, response_str); - return; - } - else{ - console.log('not ok status=' + response.statusCode); - callback(response_str, 'statusCode=' + response.statusCode + '\n' + response_str); - return; - } - }); - }); - request.end() - - request.on('error', function(err) { - console.error('err:' + err); - callback(err, err); - return; - }); - } - - var _get = function(uri,options,callback,req,res) - { - - options.method = "GET"; - options.path = uri; - - // Setup request to ODL side - console.log('options:' + JSON.stringify(options,null,2)); - var request = https.request(options, function(response) { - // console.dir(response); - console.log('STATUS: ' + response.statusCode); - var response_str = ''; - // Read the response from ODL side - response.on('data', function(chunk) { - response_str += chunk; - }); - - response.on('end', function() - { - console.log(response_str); - - if(response.statusCode == 200) - { - // make sure response starts with JSON string - if (response_str && response_str.indexOf('{') == 0) { - //console.log("response: ", result); - - req.session.l3sdnPageInfo = undefined; - var x=0; - var pageList = []; - var obj_rows = []; - var rows = []; - var robj = JSON.parse(response_str); - - if ( typeof robj['services']['layer3-service-list'] != 'undefined' ) - { - for( var i=0; i 0){ - pageList.push(obj_rows.splice(0,l3sdnPageInfo.pageSize)); - } - l3sdnPageInfo.rows = pageList[0]; // first page - l3sdnPageInfo.pages = pageList; // all pages - - - req.session.l3sdnPageInfo = l3sdnPageInfo; - var privObj = req.session.loggedInAdmin; - - res.render('odl/listWklst', - { - pageInfo : l3sdnPageInfo, - result : {code:'', msg:''}, - privilege : privObj, header:process.env.MAIN_MENU - }); - - - } else { - res.render('pages/err', {result:{code:'failure', msg:'no data Error: ' + String(err)}, header:process.env.MAIN_MENU}); - } - callback(null, response_str, res); - } - else - { - callback(response_str,response_str,res); - //res.render('pages/err', {result:{code:'failure', msg:'Failed to retrieve worklist. ' + response_str}}); - } - }); - }); - - request.end() - - request.on('error', function(err) { - callback(err,null, res); - }); - } - - var _getid = function(uri,options,res) { - options.method = "GET"; - options.path = uri; - - // Setup request to ODL side - var request = https.request(options, function(response) { - // console.dir(response); - //console.log('STATUS: ' + response.statusCode); - var response_str = ''; - // Read the response from ODL side - response.on('data', function(chunk) { - response_str += chunk; - }); - - response.on('end', function() { - if(response.statusCode == 200){ - if(response_str){ - //console.log("response: ", response_str); - res.render('odl/view', {response_obj: JSON.parse(response_str), header:process.env.MAIN_MENU}); - } - else{ - //console.log("no data"); - res.render('pages/err', {result:{code:'failure', msg:'Failed to retrieve worklist'}, header:process.env.MAIN_MENU}); - } - } - else { - //console.log("bad status code:", response.statusCode); - res.render('pages/err', {result:{code:'failure', msg:'Failed to retrieve worklist. Status Code:' + response.statusCode}, header:process.env.MAIN_MENU}); - } - }); - }); - - request.end() - - request.on('error', function(err) { - //console.log(err); - res.render('pages/err', {result:{code:'failure', msg:'Failed to get worklist item. ' + String(err)}, header:process.env.MAIN_MENU}); - }); - } - - var _getvrlan = function(uri,options,callback) { - options.method = "GET"; - options.path = uri; - - - //callback(null,''); - // Setup request to ODL side - var request = https.request(options, function(response) { - // console.dir(response); - //console.log('STATUS: ' + response.statusCode); - var response_str = ''; - // Read the response from ODL side - response.on('data', function(chunk) { - response_str += chunk; - }); - - - response.on('end', function() { - if(response.statusCode == 200){ - if(response_str){ - callback(null,response_str); - return; - } - else{ - callback('err','no data'); - return; - } - } - else { - callback('error',response.statusCode); - return; - } - }); - }); - - request.end() - - request.on('error', function(err) { - callback(err,String(err)); - return; - }); - } - - - var _getvnf = function(uri,options,req,res) { - options.method = "GET"; - options.path = uri; - - // Setup request to ODL side - var request = https.request(options, function(response) { - // console.dir(response); - //console.log('STATUS: ' + response.statusCode); - var response_str = ''; - // Read the response from ODL side - response.on('data', function(chunk) { - response_str += chunk; - }); - - response.on('end', function() { - if(response.statusCode == 200){ - if(response_str){ - //console.log("response: ", response_str); - res.render('odl/viewvnf', { vnf_obj: JSON.parse(response_str), - request_id: req.query['request'], header:process.env.MAIN_MENU }); - } - else{ - //console.log("no data"); - res.render('pages/err', {result:{code:'failure', msg:'Failed to retrieve worklist item.'}, header:process.env.MAIN_MENU}); - } - } - else { - //console.log("bad status code:", response.statusCode); - res.render('pages/err', {result:{code:'failure', msg:'Failed to retrieve worklist. Status Code:' + response.statusCode}, header:process.env.MAIN_MENU}); - } - }); - }); - - request.end() - - request.on('error', function(err) { - //console.log(err); - res.render('pages/err', {result:{code:'failure', msg:'Failed getting VNF information. Error: '+ String(err)}, header:process.env.MAIN_MENU}); - }); - } - - var _getPreloadVnfData = function(uri,options,res,callback) { - - options.method = "GET"; - options.path = uri; - - - // Setup request to ODL side - var protocol; - if ( process.env.NODE_ENV != 'production' ){ - protocol = http; - }else{ - protocol = https; - } - -console.log('NODE_ENV:' + process.env.NODE_ENV); -console.log('GET: ' + JSON.stringify(options,null,4)); - - var request = protocol.request(options, function(response) { - - var response_str = ''; - - // Read the response from ODL side - response.on('data', function(chunk) { - response_str += chunk; - }); - - response.on('end', function() { -console.log('response_str: ' + response_str); -console.log('response.statusCode: ' + response.statusCode); - if(response.statusCode == 200){ - if(response_str){ - callback(null,response_str); - return; - } - else{ - callback('Error - No data returned.'); - return; - } - } - else { - if ( response.statusCode == 404 ) - { - callback('HTTP Status Code:' + response.statusCode + '. Not Found.'); - return; - } - else if ( response_str.length > 0 ) - { - callback('HTTP Status Code:' + response.statusCode + '. ' + response_str); - return; - } - else - { - callback('HTTP Status Code:' + response.statusCode + '. No data returned.'); - return; - } - } - }); - }); - - request.end() - - request.on('error', function(err) { - callback(err); - return; - }); - } - -var _getClusterStatus = function(options,callback) { - //options.method = "GET"; - //options.path = uri; - - console.log('URI='+options.path); - - // Setup request to ODL side - var protocol = properties.odlProtocol; -console.log('protocol=' + protocol); - if ( protocol == 'http' || protocol == 'HTTP' ) - { -console.log('http request'); - var request = http.request(options, function(response) { - var response_str = ''; - - // Read the response from ODL side - response.on('data', function(chunk) { - response_str += chunk; - }); - - - response.on('end', function() { -console.log('HTTP StatusCode='+response.statusCode); - if(response.statusCode == 200){ - if(response_str){ -console.log('response_str='+response_str); - callback(null,JSON.parse(response_str)); - return; - } - else{ - callback(null,'no data'); - return; - } - } - else { - callback(null,response.statusCode); - return; - } - }); - }); - - request.end() - - request.on('error', function(err) { - callback(null,String(err)); - return; - }); - } - else { - var request = https.request(options, function(response) { - var response_str = ''; - - // Read the response from ODL side - response.on('data', function(chunk) { - response_str += chunk; - }); - - - response.on('end', function() { - if(response.statusCode == 200){ - if(response_str){ -console.log('response_str='+response_str); - callback(null,JSON.parse(response_str)); - return; - } - else{ - callback(null,'no data'); - return; - } - } - else { - callback(null,response.statusCode); - return; - } - }); - }); - - request.end() - - request.on('error', function(err) { - callback(null,String(err)); - return; - }); - } -} - - var _delete = function(uri,options,res,callback) { - options.method = 'DELETE'; - options.path = uri; - - - // Setup request to ODL side - //var request = https.request(options, function(response) { - var request = http.request(options, function(response) { - //console.log('STATUS: ' + response.statusCode); - var response_str = ''; - // Read the response from ODL side - response.on('data', function(chunk) { - response_str += chunk; - }); - - response.on('end', function() { - if(response.statusCode == 200){ - callback(null); - return; - } - else { - callback('Error:' + response_str); - return; - } - }); - }); - request.on('error', function(err) { - callback(err); - return; - }); - request.end() - } - - var _post = function(uri,options,data,res,callback) - { - options.method = 'POST'; - options.path = uri; - - - // Setup request to ODL side - var protocol; - //if ( process.env.NODE_ENV != 'production' ){ - protocol = http; - //}else{ - //protocol = https; - //} - var request = protocol.request(options, function(response) - { - var response_str = ''; - // Read the response from ODL side - response.on('data', function(chunk) { - response_str += chunk; - //logger.debug('chunk:' + chunk); - }); - - // end of request, check response - response.on('end', function() { - console.log('post status code:'+response.statusCode); - if(response.statusCode == 200 ){ - try { - var respObj = JSON.parse(response_str); - console.log('response_str.length:' + response_str.length); - if(response_str){ - console.log("post response-code:" + respObj['output']['response-code']); - - if ( respObj['output']['response-code'] == 200 ){ - callback(null,response_str); - return; - }else{ - callback('Error - response-code:' + respObj['output']['response-code'] + ' response-message:' + respObj['output']['response-message']); - return; - } - }else{ - // success - callback(null); - return; - } - } - catch (error) { - callback('Error parsing response: ' + error); - return; - } - } - else { - var respObj = null; - if ( response_str.length > 0 ) { - console.log('response_str:' + response_str); - try { - respObj = JSON.parse(response_str); - if ( typeof respObj['errors'] != 'undefined' ) - { - console.log('Error' + JSON.stringify(respObj)); - if ( typeof respObj['errors']['error'][0]['error-message'] != 'undefined' ) - { - callback('HTTP Status Code:' + response.statusCode + '. Message:' - + respObj['errors']['error'][0]['error-message']); - return; - } - else - { - callback('Error - HTTP Status Code:' + response.statusCode + '.'); - return; - } - } - else - { - callback('Error - HTTP Status Code:' + response.statusCode + '.'); - return; - } - } - catch (error) { - callback('Error - HTTP Status Code:' + response.statusCode + '.'); - return; - } - } - else{ - callback('Error - HTTP Status Code:' + response.statusCode + '.'); - return; - } - } - }); - }); - - request.on('error', function(err) { - callback(err); - return; - }); - - request.write(data); - request.end() - } - - var _postSubnetAllocated = function(uri,options,data,callback,res) { - options.method = 'POST'; - options.path = uri; - - // Setup request to ODL side - var request = https.request(options, function(response) { - var response_str = ''; - // Read the response from ODL side - response.on('data', function(chunk) { - response_str += chunk; - }); - - // end of request, check response - response.on('end', function() { - //console.log("post: response: " + response_str); - callback(response_str,null,res); - }); - }); - request.on('error', function(err) { - callback(err,null, res); - }); - request.write(data); - request.end() - } - - return { - GetClusterStatus: _getClusterStatus, - Get: _get, - GetID: _getid, - GetVNF: _getvnf, - GetVRlan: _getvrlan, - GetPreloadVnfData: _getPreloadVnfData, - Post: _post, - PostSubnetAllocated: _postSubnetAllocated, - Delete: _delete, - Healthcheck: _healthcheck - }; -}(); - -module.exports = Odl; - diff --git a/admportal/server/router/routes/OdlInterface.js b/admportal/server/router/routes/OdlInterface.js new file mode 100755 index 00000000..1fc615c4 --- /dev/null +++ b/admportal/server/router/routes/OdlInterface.js @@ -0,0 +1,594 @@ +// OdlInterface.js +var https = require('https'); +var http = require('http'); +var properties = require(process.env.SDNC_CONFIG_DIR + '/admportal.json'); + + +var OdlInterface = function() { + // Call ODL page + // get(uri,res) + // post(uri,data, res) + + var _healthcheck = function(options, callback) + { + // Setup request to ODL side + console.log('options:' + JSON.stringify(options,null,2)); + var request = https.request(options, function(response) { + + var response_str = ''; + // Read the response from ODL side + response.on('data', function(chunk) { + response_str += chunk; + }); + + response.on('end', function() + { + //logger.debug(response_str); + if(response.statusCode == 200) + { + console.log('200 OK'); + callback(null, response_str); + return; + } + else{ + console.log('not ok status=' + response.statusCode); + callback(response_str, 'statusCode=' + response.statusCode + '\n' + response_str); + return; + } + }); + }); + request.end() + + request.on('error', function(err) { + console.error('err:' + err); + callback(err, err); + return; + }); + } + + var _get = function(uri,options,callback,req,res) + { + + options.method = "GET"; + options.path = uri; + + // Setup request to ODL side + console.log('options:' + JSON.stringify(options,null,2)); + var request = https.request(options, function(response) { + // console.dir(response); + console.log('STATUS: ' + response.statusCode); + var response_str = ''; + // Read the response from ODL side + response.on('data', function(chunk) { + response_str += chunk; + }); + + response.on('end', function() + { + console.log(response_str); + + if(response.statusCode == 200) + { + // make sure response starts with JSON string + if (response_str && response_str.indexOf('{') == 0) { + //console.log("response: ", result); + + req.session.l3sdnPageInfo = undefined; + var x=0; + var pageList = []; + var obj_rows = []; + var rows = []; + var robj = JSON.parse(response_str); + + if ( typeof robj['services']['layer3-service-list'] != 'undefined' ) + { + for( var i=0; i 0){ + pageList.push(obj_rows.splice(0,l3sdnPageInfo.pageSize)); + } + l3sdnPageInfo.rows = pageList[0]; // first page + l3sdnPageInfo.pages = pageList; // all pages + + + req.session.l3sdnPageInfo = l3sdnPageInfo; + var privObj = req.session.loggedInAdmin; + + res.render('odl/listWklst', + { + pageInfo : l3sdnPageInfo, + result : {code:'', msg:''}, + privilege : privObj, header:process.env.MAIN_MENU + }); + + + } else { + res.render('pages/err', {result:{code:'failure', msg:'no data Error: ' + String(err)}, header:process.env.MAIN_MENU}); + } + callback(null, response_str, res); + } + else + { + callback(response_str,response_str,res); + //res.render('pages/err', {result:{code:'failure', msg:'Failed to retrieve worklist. ' + response_str}}); + } + }); + }); + + request.end() + + request.on('error', function(err) { + callback(err,null, res); + }); + } + + var _getid = function(uri,options,res) { + options.method = "GET"; + options.path = uri; + + // Setup request to ODL side + var request = https.request(options, function(response) { + // console.dir(response); + //console.log('STATUS: ' + response.statusCode); + var response_str = ''; + // Read the response from ODL side + response.on('data', function(chunk) { + response_str += chunk; + }); + + response.on('end', function() { + if(response.statusCode == 200){ + if(response_str){ + //console.log("response: ", response_str); + res.render('odl/view', {response_obj: JSON.parse(response_str), header:process.env.MAIN_MENU}); + } + else{ + //console.log("no data"); + res.render('pages/err', {result:{code:'failure', msg:'Failed to retrieve worklist'}, header:process.env.MAIN_MENU}); + } + } + else { + //console.log("bad status code:", response.statusCode); + res.render('pages/err', {result:{code:'failure', msg:'Failed to retrieve worklist. Status Code:' + response.statusCode}, header:process.env.MAIN_MENU}); + } + }); + }); + + request.end() + + request.on('error', function(err) { + //console.log(err); + res.render('pages/err', {result:{code:'failure', msg:'Failed to get worklist item. ' + String(err)}, header:process.env.MAIN_MENU}); + }); + } + + var _getvrlan = function(uri,options,callback) { + options.method = "GET"; + options.path = uri; + + + //callback(null,''); + // Setup request to ODL side + var request = https.request(options, function(response) { + // console.dir(response); + //console.log('STATUS: ' + response.statusCode); + var response_str = ''; + // Read the response from ODL side + response.on('data', function(chunk) { + response_str += chunk; + }); + + + response.on('end', function() { + if(response.statusCode == 200){ + if(response_str){ + callback(null,response_str); + return; + } + else{ + callback('err','no data'); + return; + } + } + else { + callback('error',response.statusCode); + return; + } + }); + }); + + request.end() + + request.on('error', function(err) { + callback(err,String(err)); + return; + }); + } + + + var _getvnf = function(uri,options,req,res) { + options.method = "GET"; + options.path = uri; + + // Setup request to ODL side + var request = https.request(options, function(response) { + // console.dir(response); + //console.log('STATUS: ' + response.statusCode); + var response_str = ''; + // Read the response from ODL side + response.on('data', function(chunk) { + response_str += chunk; + }); + + response.on('end', function() { + if(response.statusCode == 200){ + if(response_str){ + //console.log("response: ", response_str); + res.render('odl/viewvnf', { vnf_obj: JSON.parse(response_str), + request_id: req.query['request'], header:process.env.MAIN_MENU }); + } + else{ + //console.log("no data"); + res.render('pages/err', {result:{code:'failure', msg:'Failed to retrieve worklist item.'}, header:process.env.MAIN_MENU}); + } + } + else { + //console.log("bad status code:", response.statusCode); + res.render('pages/err', {result:{code:'failure', msg:'Failed to retrieve worklist. Status Code:' + response.statusCode}, header:process.env.MAIN_MENU}); + } + }); + }); + + request.end() + + request.on('error', function(err) { + //console.log(err); + res.render('pages/err', {result:{code:'failure', msg:'Failed getting VNF information. Error: '+ String(err)}, header:process.env.MAIN_MENU}); + }); + } + + var _getPreloadVnfData = function(uri,options,res,callback) { + + options.method = "GET"; + options.path = uri; + + + // Setup request to ODL side + var protocol; + if ( process.env.NODE_ENV != 'production' ){ + protocol = http; + }else{ + protocol = https; + } + +console.log('NODE_ENV:' + process.env.NODE_ENV); +console.log('GET: ' + JSON.stringify(options,null,4)); + + var request = protocol.request(options, function(response) { + + var response_str = ''; + + // Read the response from ODL side + response.on('data', function(chunk) { + response_str += chunk; + }); + + response.on('end', function() { +console.log('response_str: ' + response_str); +console.log('response.statusCode: ' + response.statusCode); + if(response.statusCode == 200){ + if(response_str){ + callback(null,response_str); + return; + } + else{ + callback('Error - No data returned.'); + return; + } + } + else { + if ( response.statusCode == 404 ) + { + callback('HTTP Status Code:' + response.statusCode + '. Not Found.'); + return; + } + else if ( response_str.length > 0 ) + { + callback('HTTP Status Code:' + response.statusCode + '. ' + response_str); + return; + } + else + { + callback('HTTP Status Code:' + response.statusCode + '. No data returned.'); + return; + } + } + }); + }); + + request.end() + + request.on('error', function(err) { + callback(err); + return; + }); + } + +var _getClusterStatus = function(options,callback) { + //options.method = "GET"; + //options.path = uri; + + console.log('URI='+options.path); + + // Setup request to ODL side + var protocol = properties.odlProtocol; +console.log('protocol=' + protocol); + if ( protocol == 'http' || protocol == 'HTTP' ) + { +console.log('http request'); + var request = http.request(options, function(response) { + var response_str = ''; + + // Read the response from ODL side + response.on('data', function(chunk) { + response_str += chunk; + }); + + + response.on('end', function() { +console.log('HTTP StatusCode='+response.statusCode); + if(response.statusCode == 200){ + if(response_str){ +console.log('response_str='+response_str); + callback(null,JSON.parse(response_str)); + return; + } + else{ + callback(null,'no data'); + return; + } + } + else { + callback(null,response.statusCode); + return; + } + }); + }); + + request.end() + + request.on('error', function(err) { + callback(null,String(err)); + return; + }); + } + else { + var request = https.request(options, function(response) { + var response_str = ''; + + // Read the response from ODL side + response.on('data', function(chunk) { + response_str += chunk; + }); + + + response.on('end', function() { + if(response.statusCode == 200){ + if(response_str){ +console.log('response_str='+response_str); + callback(null,JSON.parse(response_str)); + return; + } + else{ + callback(null,'no data'); + return; + } + } + else { + callback(null,response.statusCode); + return; + } + }); + }); + + request.end() + + request.on('error', function(err) { + callback(null,String(err)); + return; + }); + } +} + + var _delete = function(uri,options,res,callback) { + options.method = 'DELETE'; + options.path = uri; + + + // Setup request to ODL side + //var request = https.request(options, function(response) { + var request = http.request(options, function(response) { + //console.log('STATUS: ' + response.statusCode); + var response_str = ''; + // Read the response from ODL side + response.on('data', function(chunk) { + response_str += chunk; + }); + + response.on('end', function() { + if(response.statusCode == 200){ + callback(null); + return; + } + else { + callback('Error:' + response_str); + return; + } + }); + }); + request.on('error', function(err) { + callback(err); + return; + }); + request.end() + } + + var _post = function(uri,options,data,res,callback) + { + options.method = 'POST'; + options.path = uri; + + + // Setup request to ODL side + var protocol; + //if ( process.env.NODE_ENV != 'production' ){ + protocol = http; + //}else{ + //protocol = https; + //} + var request = protocol.request(options, function(response) + { + var response_str = ''; + // Read the response from ODL side + response.on('data', function(chunk) { + response_str += chunk; + //logger.debug('chunk:' + chunk); + }); + + // end of request, check response + response.on('end', function() { + console.log('post status code:'+response.statusCode); + if(response.statusCode == 200 ){ + try { + var respObj = JSON.parse(response_str); + console.log('response_str.length:' + response_str.length); + if(response_str){ + console.log("post response-code:" + respObj['output']['response-code']); + + if ( respObj['output']['response-code'] == 200 ){ + callback(null,response_str); + return; + }else{ + callback('Error - response-code:' + respObj['output']['response-code'] + ' response-message:' + respObj['output']['response-message']); + return; + } + }else{ + // success + callback(null); + return; + } + } + catch (error) { + callback('Error parsing response: ' + error); + return; + } + } + else { + var respObj = null; + if ( response_str.length > 0 ) { + console.log('response_str:' + response_str); + try { + respObj = JSON.parse(response_str); + if ( typeof respObj['errors'] != 'undefined' ) + { + console.log('Error' + JSON.stringify(respObj)); + if ( typeof respObj['errors']['error'][0]['error-message'] != 'undefined' ) + { + callback('HTTP Status Code:' + response.statusCode + '. Message:' + + respObj['errors']['error'][0]['error-message']); + return; + } + else + { + callback('Error - HTTP Status Code:' + response.statusCode + '.'); + return; + } + } + else + { + callback('Error - HTTP Status Code:' + response.statusCode + '.'); + return; + } + } + catch (error) { + callback('Error - HTTP Status Code:' + response.statusCode + '.'); + return; + } + } + else{ + callback('Error - HTTP Status Code:' + response.statusCode + '.'); + return; + } + } + }); + }); + + request.on('error', function(err) { + callback(err); + return; + }); + + request.write(data); + request.end() + } + + var _postSubnetAllocated = function(uri,options,data,callback,res) { + options.method = 'POST'; + options.path = uri; + + // Setup request to ODL side + var request = https.request(options, function(response) { + var response_str = ''; + // Read the response from ODL side + response.on('data', function(chunk) { + response_str += chunk; + }); + + // end of request, check response + response.on('end', function() { + //console.log("post: response: " + response_str); + callback(response_str,null,res); + }); + }); + request.on('error', function(err) { + callback(err,null, res); + }); + request.write(data); + request.end() + } + + return { + GetClusterStatus: _getClusterStatus, + Get: _get, + GetID: _getid, + GetVNF: _getvnf, + GetVRlan: _getvrlan, + GetPreloadVnfData: _getPreloadVnfData, + Post: _post, + PostSubnetAllocated: _postSubnetAllocated, + Delete: _delete, + Healthcheck: _healthcheck + }; +}(); + +module.exports = OdlInterface; + diff --git a/admportal/server/router/routes/mobility.js b/admportal/server/router/routes/mobility.js index 1c45452e..d19f65aa 100644 --- a/admportal/server/router/routes/mobility.js +++ b/admportal/server/router/routes/mobility.js @@ -32,7 +32,7 @@ var options = { }; // Connection to OpenDaylight -Odl = require('./Odl'); +OdlInterface = require('./OdlInterface'); // used for file upload button, retain original file name //router.use(bodyParser()); @@ -60,23 +60,23 @@ var upload = multer({ // GET -router.get('/getVnfData', csp.checkAuth, dbRoutes.checkDB, function(req,res) { +router.get('/getVnfData', csp.checkAuth, function(req,res) { dbRoutes.getVnfData(req,res, {code:'', msg:''}, req.session.loggedInAdmin); }); -router.get('/getVmNetworks', csp.checkAuth, dbRoutes.checkDB, function(req,res) { +router.get('/getVmNetworks', csp.checkAuth, function(req,res) { dbRoutes.getVmNetworks(req,res, {code:'', msg:''}, req.session.loggedInAdmin); }); -router.get('/getVnfProfile', csp.checkAuth, dbRoutes.checkDB, function(req,res) { +router.get('/getVnfProfile', csp.checkAuth, function(req,res) { dbRoutes.getVnfProfile(req,res, {code:'', msg:''}, req.session.loggedInAdmin); }); -router.get('/getVnfNetworks', csp.checkAuth, dbRoutes.checkDB, function(req,res) { +router.get('/getVnfNetworks', csp.checkAuth, function(req,res) { dbRoutes.getVnfNetworks(req,res, {code:'', msg:''}, req.session.loggedInAdmin); }); -router.get('/getVmProfile', csp.checkAuth, dbRoutes.checkDB, function(req,res) { +router.get('/getVmProfile', csp.checkAuth, function(req,res) { dbRoutes.getVmProfile(req,res, {code:'', msg:''}, req.session.loggedInAdmin); }); //////// -router.get('/getVnfNetworkData', csp.checkAuth, dbRoutes.checkDB, function(req,res) { +router.get('/getVnfNetworkData', csp.checkAuth, function(req,res) { dbRoutes.getVnfNetworkData(req,res, {code:'', msg:''}, req.session.loggedInAdmin); }); @@ -89,7 +89,7 @@ router.get('/viewVnfNetworkData', csp.checkAuth, function(req,res) var tasks = []; tasks.push(function(callback){ - Odl.GetPreloadVnfData('/restconf/config/VNF-API:preload-vnfs/vnf-preload-list/' + OdlInterface.GetPreloadVnfData('/restconf/config/VNF-API:preload-vnfs/vnf-preload-list/' + encodeURIComponent(network_name) + '/' + encodeURIComponent(network_type) + '/', options,res,callback); }); @@ -119,7 +119,7 @@ router.get('/viewVnfData', csp.checkAuth, function(req,res) var tasks = []; tasks.push(function(callback){ - Odl.GetPreloadVnfData('/restconf/config/VNF-API:preload-vnfs/vnf-preload-list/' + OdlInterface.GetPreloadVnfData('/restconf/config/VNF-API:preload-vnfs/vnf-preload-list/' + encodeURIComponent(vnf_name) + '/' + encodeURIComponent(vnf_type) + '/', options,res,callback); }); @@ -140,7 +140,7 @@ router.get('/viewVnfData', csp.checkAuth, function(req,res) }); -router.get('/loadVnfNetworkData', csp.checkAuth, dbRoutes.checkDB, function(req,res) +router.get('/loadVnfNetworkData', csp.checkAuth, function(req,res) { var privilegeObj = req.session.loggedInAdmin; @@ -188,7 +188,7 @@ router.get('/loadVnfNetworkData', csp.checkAuth, dbRoutes.checkDB, function(req, // add the two curly braces at the end that we stripped off s_file = s_file.concat('}}'); - Odl.Post('/restconf/operations/VNF-API:preload-network-topology-operation', + OdlInterface.Post('/restconf/operations/VNF-API:preload-network-topology-operation', options,s_file,res,callback); }); @@ -216,7 +216,7 @@ router.get('/loadVnfNetworkData', csp.checkAuth, dbRoutes.checkDB, function(req, }); -router.get('/loadVnfData', csp.checkAuth, dbRoutes.checkDB, function(req,res) +router.get('/loadVnfData', csp.checkAuth, function(req,res) { var privilegeObj = req.session.loggedInAdmin; var full_path_file_name = process.cwd() + "/uploads/" + req.query.filename @@ -266,7 +266,7 @@ router.get('/loadVnfData', csp.checkAuth, dbRoutes.checkDB, function(req,res) // add the two curly braces at the end that we stripped off s_file = s_file.concat('}}'); - Odl.Post('/restconf/operations/VNF-API:preload-vnf-topology-operation', + OdlInterface.Post('/restconf/operations/VNF-API:preload-vnf-topology-operation', options,s_file,res,callback); }); @@ -294,7 +294,7 @@ router.get('/loadVnfData', csp.checkAuth, dbRoutes.checkDB, function(req,res) }); -router.get('/deleteVnfNetworkData', csp.checkAuth, dbRoutes.checkDB, function(req,res) { +router.get('/deleteVnfNetworkData', csp.checkAuth, function(req,res) { var privilegeObj = req.session.loggedInAdmin; var tasks = []; @@ -323,7 +323,7 @@ router.get('/deleteVnfNetworkData', csp.checkAuth, dbRoutes.checkDB, function(re inputString = inputString.concat('","svc-action": "delete"}}}'); tasks.push(function(callback) { - Odl.Post('/restconf/operations/VNF-API:preload-network-topology-operation', + OdlInterface.Post('/restconf/operations/VNF-API:preload-network-topology-operation', options,inputString,res,callback); }); tasks.push(function(callback) { @@ -347,7 +347,7 @@ router.get('/deleteVnfNetworkData', csp.checkAuth, dbRoutes.checkDB, function(re }); -router.get('/deleteVnfData', csp.checkAuth, dbRoutes.checkDB, function(req,res) { +router.get('/deleteVnfData', csp.checkAuth, function(req,res) { var privilegeObj = req.session.loggedInAdmin; var tasks = []; @@ -388,7 +388,7 @@ router.get('/deleteVnfData', csp.checkAuth, dbRoutes.checkDB, function(req,res) //inputString = inputString.concat('"svc-action": "delete"}}}'); tasks.push(function(callback) { - Odl.Post('/restconf/operations/VNF-API:preload-vnf-topology-operation', + OdlInterface.Post('/restconf/operations/VNF-API:preload-vnf-topology-operation', options,inputString,res,callback); }); tasks.push(function(callback) { @@ -412,7 +412,7 @@ router.get('/deleteVnfData', csp.checkAuth, dbRoutes.checkDB, function(req,res) }); -router.get('/deleteVmProfile', csp.checkAuth, dbRoutes.checkDB, function(req,res) { +router.get('/deleteVmProfile', csp.checkAuth, function(req,res) { var privilegeObj = req.session.loggedInAdmin; var tasks = []; @@ -441,7 +441,7 @@ router.get('/deleteVmProfile', csp.checkAuth, dbRoutes.checkDB, function(req,res }); -router.get('/deleteVnfNetwork', csp.checkAuth, dbRoutes.checkDB, function(req,res) { +router.get('/deleteVnfNetwork', csp.checkAuth, function(req,res) { var privilegeObj = req.session.loggedInAdmin; var tasks = []; @@ -469,7 +469,7 @@ router.get('/deleteVnfNetwork', csp.checkAuth, dbRoutes.checkDB, function(req,re }); }); -router.get('/deleteVnfProfile', csp.checkAuth, dbRoutes.checkDB, function(req,res) { +router.get('/deleteVnfProfile', csp.checkAuth, function(req,res) { var privilegeObj = req.session.loggedInAdmin; var tasks = []; @@ -496,7 +496,7 @@ router.get('/deleteVnfProfile', csp.checkAuth, dbRoutes.checkDB, function(req,re }); }); -router.get('/deleteVmNetwork', csp.checkAuth, dbRoutes.checkDB, function(req,res) { +router.get('/deleteVmNetwork', csp.checkAuth, function(req,res) { var privilegeObj = req.session.loggedInAdmin; var tasks = []; @@ -527,7 +527,7 @@ router.get('/deleteVmNetwork', csp.checkAuth, dbRoutes.checkDB, function(req,res // POST -router.post('/addVmProfile', csp.checkAuth, dbRoutes.checkDB, function(req,res){ +router.post('/addVmProfile', csp.checkAuth, function(req,res){ var privilegeObj = req.session.loggedInAdmin; var tasks = []; @@ -568,7 +568,7 @@ router.post('/addVmProfile', csp.checkAuth, dbRoutes.checkDB, function(req,res){ }); -router.post('/addVnfNetwork', csp.checkAuth, dbRoutes.checkDB, function(req,res){ +router.post('/addVnfNetwork', csp.checkAuth, function(req,res){ var privilegeObj = req.session.loggedInAdmin; var tasks = []; @@ -595,7 +595,7 @@ router.post('/addVnfNetwork', csp.checkAuth, dbRoutes.checkDB, function(req,res) }); }); -router.post('/addVnfProfile', csp.checkAuth, dbRoutes.checkDB, function(req,res){ +router.post('/addVnfProfile', csp.checkAuth, function(req,res){ var privilegeObj = req.session.loggedInAdmin; var tasks = []; @@ -624,7 +624,7 @@ console.log(sql); }); }); -router.post('/addVmNetwork', csp.checkAuth, dbRoutes.checkDB, function(req,res){ +router.post('/addVmNetwork', csp.checkAuth, function(req,res){ var privilegeObj = req.session.loggedInAdmin; var tasks = []; @@ -704,7 +704,7 @@ router.post('/addVmNetwork', csp.checkAuth, dbRoutes.checkDB, function(req,res){ }); // POST -router.post('/uploadVnfData', csp.checkAuth, dbRoutes.checkDB, upload.single('filename'), function(req, res) +router.post('/uploadVnfData', csp.checkAuth, upload.single('filename'), function(req, res) { console.log('filename:'+ JSON.stringify(req.file.originalname)); var msgArray = new Array(); @@ -776,7 +776,7 @@ console.log('filename:'+ JSON.stringify(req.file.originalname)); } ); -router.post('/uploadVnfNetworkData', csp.checkAuth, dbRoutes.checkDB, upload.single('filename'), function(req, res) +router.post('/uploadVnfNetworkData', csp.checkAuth, upload.single('filename'), function(req, res) { var msgArray = new Array(); var privilegeObj = req.session.loggedInAdmin; @@ -846,7 +846,7 @@ router.post('/uploadVnfNetworkData', csp.checkAuth, dbRoutes.checkDB, upload.sin } ); -router.post('/uploadVmNetworks', csp.checkAuth, dbRoutes.checkDB, upload.single('filename'), function(req, res){ +router.post('/uploadVmNetworks', csp.checkAuth, upload.single('filename'), function(req, res){ var msgArray = new Array(); var privilegeObj = req.session.loggedInAdmin; @@ -967,7 +967,7 @@ router.post('/uploadVmNetworks', csp.checkAuth, dbRoutes.checkDB, upload.single( } ); -router.post('/uploadVnfProfile', csp.checkAuth, dbRoutes.checkDB, upload.single('filename'), function(req, res){ +router.post('/uploadVnfProfile', csp.checkAuth, upload.single('filename'), function(req, res){ var msgArray = new Array(); var privilegeObj = req.session.loggedInAdmin; @@ -1092,7 +1092,7 @@ console.log('result='+JSON.stringify(result)); } ); -router.post('/uploadVnfNetworks', csp.checkAuth, dbRoutes.checkDB, upload.single('filename'), function(req, res){ +router.post('/uploadVnfNetworks', csp.checkAuth, upload.single('filename'), function(req, res){ var msgArray = new Array(); var privilegeObj = req.session.loggedInAdmin; @@ -1214,7 +1214,7 @@ router.post('/uploadVnfNetworks', csp.checkAuth, dbRoutes.checkDB, upload.single } } ); -router.post('/uploadVmProfile', csp.checkAuth, dbRoutes.checkDB, upload.single('filename'), function(req, res){ +router.post('/uploadVmProfile', csp.checkAuth, upload.single('filename'), function(req, res){ var msgArray = new Array(); var privilegeObj = req.session.loggedInAdmin; diff --git a/admportal/server/router/routes/odl.js b/admportal/server/router/routes/odl.js index fba646fa..3882afcc 100644 --- a/admportal/server/router/routes/odl.js +++ b/admportal/server/router/routes/odl.js @@ -23,7 +23,7 @@ var options = { }; // Connection to OpenDaylight -Odl = require('./Odl'); +OdlInterface = require('./OdlInterface'); function handleResult(err, response_str, res) { if (err) { @@ -44,7 +44,7 @@ function handleResult(err, response_str, res) { // calls restconf to get information router.get('/listWklst', csp.checkAuth, function(req, res) { options.strictSSL = true; // used to test SSL certificate - Odl.Get('/restconf/config/L3SDN-API:services',options, handleResult,req,res); + OdlInterface.Get('/restconf/config/L3SDN-API:services',options, handleResult,req,res); }); router.get('/pageWklst', csp.checkAuth, function(req,res) { @@ -102,7 +102,7 @@ router.post('/update_vr_lan_interface', function(req,res){ }; var tasks = []; tasks.push(function(callback){ - Odl.put_vr_lan_interface('/restconf/config/L3SDN-API:services/layer3-service-list/' + OdlInterface.put_vr_lan_interface('/restconf/config/L3SDN-API:services/layer3-service-list/' + svc_instance_id + '/service-data/vr-lan/', options, callback); }); @@ -136,36 +136,36 @@ router.get('/svc-topology-operation', function(req, res) { + '"svc-instance-id":"'+ req.query['svc-instance-id']+ '"' + ',' + '"svc-aic-site-id":"'+ req.query['svc-aic-site-id']+ '"' +' } }'; - Odl.Post('/restconf/operations/L3SDN-API:svc-topology-operation', options, formData, handleResult, res); + OdlInterface.Post('/restconf/operations/L3SDN-API:svc-topology-operation', options, formData, handleResult, res); }); // delete request router.get('/wklist-delete', function(req, res) { //console.dir(req.query); - Odl.Delete('/restconf/config/L3SDN-API:l3sdn-api-worklist/requests/'+req.query['request'], options, handleResult, res); + OdlInterface.Delete('/restconf/config/L3SDN-API:l3sdn-api-worklist/requests/'+req.query['request'], options, handleResult, res); }); // get request router.get('/getid',function(req, res) { //console.dir(req.query); - Odl.GetID('/restconf/config/L3SDN-API:l3sdn-api-worklist/requests/'+req.query['request'], options, res); + OdlInterface.GetID('/restconf/config/L3SDN-API:l3sdn-api-worklist/requests/'+req.query['request'], options, res); }); router.get('/getvnf', function(req,res) { //console.log("/getvnf "+req.query); - Odl.GetVNF('/restconf/config/L3SDN-API:l3sdn-api-worklist/requests/'+req.query['request']+'/vnf/',options,req,res); + OdlInterface.GetVNF('/restconf/config/L3SDN-API:l3sdn-api-worklist/requests/'+req.query['request']+'/vnf/',options,req,res); }); router.get('/getvrlan', function(req,res) { var vrtasks = []; var reqstr = encodeURIComponent(req.query['request']); vrtasks.push(function(callback) { - Odl.GetVRlan('/restconf/config/L3SDN-API:services/layer3-service-list/'+reqstr+'/service-data/vr-lan/',options,callback); + OdlInterface.GetVRlan('/restconf/config/L3SDN-API:services/layer3-service-list/'+reqstr+'/service-data/vr-lan/',options,callback); }); async.series(vrtasks, function(err,result){ var msgArray = new Array(); if(err){ msgArray.push(err); - Odl.Get('/restconf/config/L3SDN-API:services',options, handleResult,res); + OdlInterface.Get('/restconf/config/L3SDN-API:services',options, handleResult,res); //res.render("pages/err", //{result:{code:'error', msg:"Unable to get vr-lan information: "+ String(err) }}); return; @@ -230,7 +230,7 @@ router.get('/getClusterStatus', function(req,res) { urlArray.forEach(function(request){ urltasks.push(function(callback) { - Odl.GetClusterStatus(request,callback); + OdlInterface.GetClusterStatus(request,callback); }); }); async.series(urltasks, function(err,result){ diff --git a/admportal/server/router/routes/preload.js b/admportal/server/router/routes/preload.js index 1a63ec0e..fd41bb44 100644 --- a/admportal/server/router/routes/preload.js +++ b/admportal/server/router/routes/preload.js @@ -35,9 +35,6 @@ var options = { strictSSL: false }; -// Connection to OpenDaylight -Odl = require('./Odl'); - // multer 1.1 var unixTime = moment().unix(); var storage = multer.diskStorage({ @@ -60,7 +57,7 @@ var upload = multer({ } }); -router.post('/uploadVnfCsv', csp.checkAuth, dbRoutes.checkDB, upload.array('filename'), function(req, res) +router.post('/uploadVnfCsv', csp.checkAuth, upload.array('filename'), function(req, res) { console.log('files:'+ JSON.stringify(req.files,null,4)); @@ -91,7 +88,7 @@ router.post('/uploadVnfCsv', csp.checkAuth, dbRoutes.checkDB, upload.array('file }); -router.post('/uploadNetworkCsv', csp.checkAuth, dbRoutes.checkDB, upload.array('filename'), function(req, res) +router.post('/uploadNetworkCsv', csp.checkAuth, upload.array('filename'), function(req, res) { console.log('files:'+ JSON.stringify(req.files,null,4)); diff --git a/admportal/server/router/routes/root.js b/admportal/server/router/routes/root.js index f586892b..b314d7db 100644 --- a/admportal/server/router/routes/root.js +++ b/admportal/server/router/routes/root.js @@ -5,7 +5,7 @@ var dbRoutes = require('./dbRoutes.js'); var sla = require('./sla'); var os = require('os'); var async = require('async'); -var Odl = require('./Odl'); +var OdlInterface = require('./OdlInterface'); var properties = require(process.env.SDNC_CONFIG_DIR + '/admportal.json'); @@ -67,7 +67,7 @@ router.get('/test', function(req,res){ }); function createFunctionObj( loptions ) { - return function(callback) { Odl.Healthcheck(loptions,callback); }; + return function(callback) { OdlInterface.Healthcheck(loptions,callback); }; } router.get('/mytree', function(req,res) { @@ -76,13 +76,13 @@ router.get('/mytree', function(req,res) { router.get('/setuplogin', function(req,res) { res.render('pages/setuplogin'); }); -router.post('/formSetupLogin', dbRoutes.checkDB, function(req,res) { +router.post('/formSetupLogin', function(req,res) { dbRoutes.saveSetupLogin(req,res); }); -router.post('/formSignUp', dbRoutes.checkDB, function(req,res) { +router.post('/formSignUp', function(req,res) { dbRoutes.saveUser(req,res); }); -router.post('/formlogin', csp.login, dbRoutes.checkDB, function(req,res) { +router.post('/formlogin', csp.login, function(req,res) { }); router.get('/login', function(req,res) { res.render('pages/login'); diff --git a/admportal/server/router/routes/sla.js b/admportal/server/router/routes/sla.js index 92fa846b..10d64334 100644 --- a/admportal/server/router/routes/sla.js +++ b/admportal/server/router/routes/sla.js @@ -57,11 +57,11 @@ router.use(multer({ // GET -router.get('/listSLA', csp.checkAuth, dbRoutes.checkDB, function(req,res) { +router.get('/listSLA', csp.checkAuth, function(req,res) { dbRoutes.listSLA(req,res,{code:'', msg:''} ); }); -router.get('/activate', csp.checkAuth, dbRoutes.checkDB, function(req,res){ +router.get('/activate', csp.checkAuth, function(req,res){ var _module = req.query.module; var rpc = req.query.rpc; @@ -82,7 +82,7 @@ router.get('/activate', csp.checkAuth, dbRoutes.checkDB, function(req,res){ }); }); -router.get('/deactivate', csp.checkAuth, dbRoutes.checkDB, function(req,res){ +router.get('/deactivate', csp.checkAuth, function(req,res){ var _module = req.query.module; var rpc = req.query.rpc; @@ -102,7 +102,7 @@ router.get('/deactivate', csp.checkAuth, dbRoutes.checkDB, function(req,res){ }); }); -router.get('/deleteDG', csp.checkAuth, dbRoutes.checkDB, function(req,res){ +router.get('/deleteDG', csp.checkAuth, function(req,res){ var _module = req.query.module; var rpc = req.query.rpc; @@ -122,7 +122,7 @@ router.get('/deleteDG', csp.checkAuth, dbRoutes.checkDB, function(req,res){ }); }); -router.post('/dgUpload', dbRoutes.checkDB, upload.single('filename'), function(req, res, next){ +router.post('/dgUpload', upload.single('filename'), function(req, res, next){ if(req.file.originalname){ if (req.file.originalname == 0) { @@ -188,7 +188,7 @@ router.post('/dgUpload', dbRoutes.checkDB, upload.single('filename'), function(r // POST -router.post('/upload', csp.checkAuth, dbRoutes.checkDB, upload.single('filename'), function(req, res, next){ +router.post('/upload', csp.checkAuth, upload.single('filename'), function(req, res, next){ console.log('file:'+ JSON.stringify(req.file)); @@ -257,7 +257,7 @@ console.log('file:'+ JSON.stringify(req.file)); } }); -router.get('/printAsXml', csp.checkAuth, dbRoutes.checkDB, function(req,res){ +router.get('/printAsXml', csp.checkAuth, function(req,res){ try { //dbRoutes.checkSvcLogic(req,res); @@ -309,7 +309,7 @@ router.get('/printAsXml', csp.checkAuth, dbRoutes.checkDB, function(req,res){ }); -router.get('/printAsGv', csp.checkAuth, dbRoutes.checkDB, function(req,res){ +router.get('/printAsGv', csp.checkAuth, function(req,res){ try { //dbRoutes.checkSvcLogic(req,res); diff --git a/admportal/server/router/routes/user.js b/admportal/server/router/routes/user.js index 116bf932..40d3437c 100644 --- a/admportal/server/router/routes/user.js +++ b/admportal/server/router/routes/user.js @@ -26,11 +26,11 @@ router.use(bodyParser.urlencoded({ router.get('/listUsers', csp.checkAuth, function(req,res) { dbRoutes.listUsers(req,res, {user:req.session.loggedInAdmin,code:'', msg:''} ); }); -router.get('/deleteUser', csp.checkAuth, dbRoutes.checkDB, function(req,res) { +router.get('/deleteUser', csp.checkAuth, function(req,res) { dbRoutes.deleteUser(req,res, {code:'', msg:''} ); }); -//router.get('/activate', csp.checkAuth, dbRoutes.checkDB, function(req,res){ +//router.get('/activate', csp.checkAuth, function(req,res){ //var _module = req.query.module; //var rpc = req.query.rpc; @@ -40,7 +40,7 @@ router.get('/deleteUser', csp.checkAuth, dbRoutes.checkDB, function(req,res) { //dbRoutes.activate(req,res,_module,rpc,version,mode); //}); -//router.get('/deactivate', csp.checkAuth, dbRoutes.checkDB, function(req,res){ +//router.get('/deactivate', csp.checkAuth, function(req,res){ //var _module = req.query.module; //var rpc = req.query.rpc; @@ -50,7 +50,7 @@ router.get('/deleteUser', csp.checkAuth, dbRoutes.checkDB, function(req,res) { //dbRoutes.deactivate(req,res,_module,rpc,version,mode); //}); -//router.get('/deleteDG', csp.checkAuth, dbRoutes.checkDB, function(req,res){ +//router.get('/deleteDG', csp.checkAuth, function(req,res){ //var _module = req.query.module; //var rpc = req.query.rpc; @@ -94,14 +94,14 @@ parser.onend = function () { // POST -router.post('/updateUser', csp.checkAuth, dbRoutes.checkDB, function(req,res,next){ +router.post('/updateUser', csp.checkAuth, function(req,res,next){ dbRoutes.updateUser(req,res,{code:'',msg:''}); }); -router.post('/addUser', csp.checkAuth, dbRoutes.checkDB, function(req,res) { +router.post('/addUser', csp.checkAuth, function(req,res) { dbRoutes.addUser(req,res, {code:'', msg:''} ); }); -//router.post('/upload', csp.checkAuth, dbRoutes.checkDB, function(req, res, next){ +//router.post('/upload', csp.checkAuth, function(req, res, next){ /* logger.debug("upload"); -- cgit 1.2.3-korg