All Downloads are FREE. Search and download functionalities are using the official Maven repository.

es.tid.pce.client.multiLayer.AutomaticTesterMLNetwork Maven / Gradle / Ivy

The newest version!

package es.tid.pce.client.multiLayer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import es.tid.emulator.node.transport.EmulatedPCCPCEPSession;
import es.tid.pce.client.ClientRequestManager;
import es.tid.pce.client.tester.InformationRequest;



/**
 * Testeador de caminos 
 * @author Marta Cuaresma Saturio
 *
 */
public class AutomaticTesterMLNetwork {

	private static EmulatedPCCPCEPSession PCEsession;
	private static ClientRequestManager crm;
	private static Logger log;
	private static long monitoringIdNumber = 1;
	private static InformationRequest informationRequest;
	/*Variable used for counter how many requests there are*/
	/**
	 * @param args
	 */
	public static void main(String[] args) {
//FIXME: THIS CLASS DIDNT WORK WITH THE ACTUAL INFORMATIONREQUEST CLASS, UNCOMMENT IT WHEN NECESSARY @Ayk		
//		/*If there are arguments, read the PCEServerPort and ipPCE*/
//	
//		if (args.length < 1) {
//			System.out.println("Usage: ClientTester ");
//			return;
//		}
//		  
//		FileHandler fh;
//		FileHandler fh2;
//		Logger log=LoggerFactory.getLogger("PCCClient");
//		try {
//			fh=new FileHandler("PCCClient.log");
//			fh2=new FileHandler("PCEPClientParser.log");
//			//fh.setFormatter(new SimpleFormatter());
//				
//			log.addHandler(fh);
//			log.setLevel(Level.ALL);
//			Logger log2=LoggerFactory.getLogger("PCEPParser");
//			log2.addHandler(fh2);
//			log2.setLevel(Level.ALL);
//		} catch (Exception e1) {
//			// TODO Auto-generated catch block
//			e1.printStackTrace();
//			System.exit(1);
//		}
//		String readFile = args[0];
//		informationRequest = new InformationRequest();
//		informationRequest.readFile(readFile);
//		PCEsession = new PCCPCEPSession(informationRequest.getPCCPCEPsessionParams().getIpPCEList().get(0), informationRequest.getPCCPCEPsessionParams().getPCEServerPortList().get(0),false, new PCEPSessionsInformation());
//		PCEsession.start();
//		PCCPCEPSession PCEsessionVNTM = new PCCPCEPSession("localhost", 4000,false, new PCEPSessionsInformation());
//		PCEsessionVNTM.start();
//		
//		MersenneTwister mt = new MersenneTwister(informationRequest.getSeed());
//	    boolean PCMonReqBool=false;
//		/*BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//
//		try {
//			 br.readLine();
//		} catch (IOException ioe) {
//			System.out.println("IO error trying to read your command");
//			System.exit(1);
//		}*/
//		/*Fichero que guarda las estadisticas cada cierto tiempo*/
//		FileWriter pw_file = null;		
//	    PrintWriter pw = null;
//		/*Fichero que guarda todas las estadisticas*/
//	    FileWriter apw_file = null;
//		PrintWriter apw = null;
//		if (informationRequest.getFileStatistics() == null ){
//			System.out.println("Not included file Statistics in .xml");
//			System.out.println("We create the file '/root/tester/Statistics.txt'");
//			try {
//				pw_file = new FileWriter("/root/tester/Statistics.txt");
//				pw = new PrintWriter(pw_file);
//			} catch (IOException e) {
//				// TODO Auto-generated catch block
//				e.printStackTrace();
//			}
//		}else {
//			try{
//			pw_file = new FileWriter(informationRequest.getFileStatistics());
//			pw = new PrintWriter(pw_file);
//
//			if (informationRequest.getPrintRequestTime() == true){
//				apw_file = new FileWriter("/root/tester/AllRequestTimeStatistics.txt");
//				apw = new PrintWriter(apw_file);
//			}
//		} catch (Exception e) {
//			
//			e.printStackTrace();
//		}
//	}
//	Timer timer=new Timer();
//	Timer planificationTimer = new Timer();
//	Timer printStatisticsTimer = new Timer(); 
//	   
//	AutomaticTesterStatistics stats= new AutomaticTesterStatistics(informationRequest.getLoad());
//	stats.setPrintRequestTime(informationRequest.getPrintRequestTime());
//
//	AutomaticTesterManagementSever atms= new AutomaticTesterManagementSever(PCEsession,PCEsessionVNTM,timer,printStatisticsTimer ,planificationTimer,stats,pw,apw, informationRequest,pw_file, apw_file);
//	atms.start();
//	MersenneTwister mersenneTwisterSendRequest = new MersenneTwister(informationRequest.getSeed()+10);
//	MersenneTwister mersenneTwisterConnectionTime = new MersenneTwister(informationRequest.getSeed()+20);
//	/*Creo mi testeador*/
//	if (informationRequest.getIsExponential()){
//		PrintStatistics printStatistics = new PrintStatistics(stats);
//		printStatisticsTimer.schedule(printStatistics,0,10000);
//
//		   //			if (PCMonReqBool){
//		   //				PCEPMonReq p_m_r= createMonRequestMessage(i);
//		   //				AutomaticTesterNetworkTask task = new AutomaticTesterNetworkTask(p_m_r,PCEsession,PCMonReqBool);
//		   //				timer=new Timer();
//		   //				timer.schedule(task, 0,timeProcessingList.get(i));}
//		   //			else{
//
//		 //  double lambdaSendRequest = 1/(informationRequest.getMeanTimeBetweenRequestList().get(0));
//		 //  double lambdaConnectionTime = 1/(informationRequest.getMeanConectionTimeList().get(0));
//		double lambdaSendRequest = 1/(informationRequest.getMeanTimeBetweenRequest());
//		double lambdaConnectionTime = 1/(informationRequest.getMeanConectionTime());
//		System.out.println("Lambda Send Request "+ lambdaSendRequest);
//		System.out.println("Lambda Connection Time "+ lambdaConnectionTime);
//		Exponential expSendRequest = new Exponential(lambdaSendRequest, mersenneTwisterSendRequest);
//		Exponential connectionTime = new Exponential(lambdaConnectionTime, mersenneTwisterConnectionTime);
//		double timeNextReqD=expSendRequest.nextDouble(); 
//		long timeNextReq =(long)timeNextReqD;
//		if (informationRequest.isRandom() == true){
//			AutomaticTesterMLNetworkRandomTask task = new AutomaticTesterMLNetworkRandomTask(expSendRequest,connectionTime, timer,planificationTimer, PCEsession.crm,PCEsessionVNTM,stats,pw, apw,mt);
//			timer.schedule(task, timeNextReq+2000);
//		}else{
//			for (int i=0;i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy