summaryrefslogtreecommitdiffstats
path: root/utils/webseal-simulator
diff options
context:
space:
mode:
authorTal Gitelman <tg851x@intl.att.com>2017-09-10 20:06:45 +0300
committerTal Gitelman <tg851x@intl.att.com>2017-09-10 20:06:45 +0300
commit004829c34aaf326bc3a7307a94cd058018d45a25 (patch)
tree08496dc0983d7ee1775030c8e99ec66743b1a714 /utils/webseal-simulator
parenta4887b5b7e287218476e2da09d371552bf970ccc (diff)
pom.xml fixes for entire SDC
Change-Id: Ia4db900502b27e162fd9c6e69a797082a8c240f7 Issue-ID:SDC-273 Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'utils/webseal-simulator')
0 files changed, 0 insertions, 0 deletions
30'>130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
exports.listSLA =  function(settings,req,res) {
try{
	var mysql = require('mysql');

	//console.dir(settings);
 
	var connection = mysql.createConnection(
    	{
      	host     : settings.dbHost,
        port     : settings.dbPort,
        user     : settings.dbUser,
        password : settings.dbPassword,
        database : settings.dbName
       });

        var rows=[];

	var sqlQuery = "SELECT module,rpc,version,mode,active FROM SVC_LOGIC";
	//console.log("sqlQuery:" + sqlQuery);
         connection.query(sqlQuery, function(err, rows) {
            if(!err) {
                if ( rows.length > 0 )
                {
                        res.send({ 'rows': rows,'dbHost':settings.dbHost } );
                }else{
                        res.send({'rows': [],'dbHost':settings.dbHost});
                }
            } else {
			console.log("error:" + err);
            	    res.send({error: "Connection to DB failed.",'dbHost':settings.dbHost});
            }
		//console.dir(rows);
		connection.end();
        }); //end query
}catch(error){
	console.log(error);
        res.send({'error': "Connection to DB failed.",'dbHost':settings.dbHost});
}
}

exports.listCurrentDGs =  function(settings,req,res) {
	var _module = req.query.module;
	var rpc = req.query.rpc;
	console.log("_module:" + _module);
	console.log("rpc:" + rpc);
try{
	var mysql = require('mysql');

	//console.dir(settings);
 
	var connection = mysql.createConnection(
    	{
      	host     : settings.dbHost,
        port     : settings.dbPort,
        user     : settings.dbUser,
        password : settings.dbPassword,
        database : settings.dbName
       });

        var rows=[];

	var sqlQuery = "SELECT module,rpc,version,mode,active FROM SVC_LOGIC where module ='" + _module + "' and rpc ='" + rpc + "'";
	console.log("sqlQuery:" + sqlQuery);
         connection.query(sqlQuery, function(err, rows) {
            if(!err) {
                if ( rows.length > 0 )
                {
                        res.send({ 'rows': rows,'dbHost':settings.dbHost } );
                }else{
                        res.send({'rows': [],'dbHost':settings.dbHost});
                }
            } else {
			console.log("error:" + err);
            	    res.send({error: "Connection to DB failed.",'dbHost':settings.dbHost});
            }
		//console.dir(rows);
		connection.end();
        }); //end query
}catch(error){
	console.log(error);
        res.send({'error': "Connection to DB failed.",'dbHost':settings.dbHost});
}
}

exports.activateDG = function(settings,req,res){
	var _module = req.query.module;
	var rpc = req.query.rpc;
	var version = req.query.version;
	var mode = req.query.mode;
	var displayOnlyCurrent = req.query.displayOnlyCurrent;

try{
	var mysql = require('mysql');
 
	var connection = mysql.createConnection(
    	{
      	host     : settings.dbHost,
        port     : settings.dbPort,
        user     : settings.dbUser,
        password : settings.dbPassword,
        database : settings.dbName
       });

        var rows=[];

	var updateStmt = "UPDATE SVC_LOGIC SET active=\'Y\' WHERE module=\'"
                        + _module + "' AND rpc=\'"
                        + rpc + "' AND version=\'"
                        +  version + "' AND mode=\'"
                        +  mode + "'";

         connection.query(updateStmt, function(err, result) {
		var nextUpdateStmt = "UPDATE SVC_LOGIC SET active=\'N\' WHERE module=\'"
                        + _module + "' AND rpc=\'"
                        + rpc + "' AND version !=\'"
                        +  version + "'";
         	connection.query(nextUpdateStmt, function(err, result) {
			var query = "SELECT module,rpc,version,mode,active FROM SVC_LOGIC";
			if(displayOnlyCurrent == 'true'){
				query = "SELECT module,rpc,version,mode,active FROM SVC_LOGIC WHERE module=\'"
					+  _module + "' and rpc=\'" + rpc + "'";
			}
         		connection.query(query, function(err, rows) {
            			if(!err) {
                			if ( rows.length > 0 )
                			{
                        			res.send({ 'rows': rows,'dbHost':settings.dbHost } );
                			}else{
                        			res.send({'rows': [],'dbHost':settings.dbHost});
                			}
            			} else {
            	    			res.send({'error': "Connection to DB failed.",'dbHost':settings.dbHost});
            			}
				connection.end();
        		}); //end query
        	}); //end query
       	}); //end query
}catch(error){
        res.send({'error': "Connection to DB failed.",'dbHost':settings.dbHost});
}
}


exports.deActivateDG = function(settings,req,res){

	var _module = req.query.module;
	var rpc = req.query.rpc;
	var version = req.query.version;
	var mode = req.query.mode;
	var displayOnlyCurrent = req.query.displayOnlyCurrent;

try{
	var mysql = require('mysql');
 
	var connection = mysql.createConnection(
    	{
      	host     : settings.dbHost,
        port     : settings.dbPort,
        user     : settings.dbUser,
        password : settings.dbPassword,
        database : settings.dbName
       });

        var rows=[];

	var updateStmt = "UPDATE SVC_LOGIC SET active=\'N\' WHERE module=\'"
                        + _module + "' AND rpc=\'"
                        + rpc + "' AND version=\'"
                        +  version + "' AND mode=\'"
                        +  mode + "'";

         connection.query(updateStmt, function(err, result) {
		var query = "SELECT module,rpc,version,mode,active FROM SVC_LOGIC";
		if(displayOnlyCurrent == 'true'){
			query = "SELECT module,rpc,version,mode,active FROM SVC_LOGIC WHERE module=\'"
				+  _module + "' and rpc=\'" + rpc + "'";
		}
         	connection.query(query, function(err, rows) {
            	if(!err) {
                	if ( rows.length > 0 )
                	{
                        	res.send({ 'rows': rows,'dbHost':settings.dbHost } );
                	}else{
                        	res.send({'rows': [],'dbHost':settings.dbHost});
                	}
            	} else {
            	    	res.send({'error': "Connection to DB failed.",'dbHost':settings.dbHost});
            	}
		connection.end();
        	}); //end query
       	}); //end query
}catch(error){
        res.send({'error': "Connection to DB failed.",'dbHost':settings.dbHost});
}
}

exports.deleteDG = function(settings,req,res){

	var _module = req.query.module;
	var rpc = req.query.rpc;
	var version = req.query.version;
	var mode = req.query.mode;
	var displayOnlyCurrent = req.query.displayOnlyCurrent;

try{
	var mysql = require('mysql');
 
	var connection = mysql.createConnection(
    	{
      	host     : settings.dbHost,
        port     : settings.dbPort,
        user     : settings.dbUser,
        password : settings.dbPassword,
        database : settings.dbName
       });

        var rows=[];

	var deleteStmt = "DELETE FROM SVC_LOGIC  WHERE module=\'"
                        + _module + "' AND rpc=\'"
                        + rpc + "' AND version=\'"
                        +  version + "' AND mode=\'"
                        +  mode + "'";
	 console.log(deleteStmt);

         connection.query(deleteStmt, function(err, result) {
		var query = "SELECT module,rpc,version,mode,active FROM SVC_LOGIC";
		if(displayOnlyCurrent == 'true'){
			query = "SELECT module,rpc,version,mode,active FROM SVC_LOGIC WHERE module=\'"
				+  _module + "' and rpc=\'" + rpc + "'";
		}
         	connection.query(query, function(err, rows) {
            	if(!err) {
                	if ( rows.length > 0 )
                	{
                        	res.send({ 'rows': rows,'dbHost':settings.dbHost } );
                	}else{
                        	res.send({'rows': [],'dbHost':settings.dbHost});
                	}
            	} else {
            	    	res.send({'error': "Connection to DB failed.",'dbHost':settings.dbHost});
            	}
		connection.end();
        	}); //end query
       	}); //end query
}catch(error){
        res.send({'error': "Connection to DB failed.",'dbHost':settings.dbHost});
}
}