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

es.tid.pce.client.multiDomain.AutomaticTesterSpainNetworkTask Maven / Gradle / Ivy

The newest version!
package es.tid.pce.client.multiDomain;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Inet4Address;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.TimerTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;

import es.tid.pce.client.ClientRequestManager;
import es.tid.pce.client.PCCPCEPSession;
import es.tid.pce.computingEngine.AlgorithmRule;
import es.tid.pce.computingEngine.MapAlgoRule;
import es.tid.pce.pcep.constructs.Request;
import es.tid.pce.pcep.messages.PCEPMonReq;
import es.tid.pce.pcep.messages.PCEPRequest;
import es.tid.pce.pcep.messages.PCEPResponse;
import es.tid.pce.pcep.objects.EndPointsIPv4;
import es.tid.pce.pcep.objects.Monitoring;
import es.tid.pce.pcep.objects.ObjectiveFunction;
import es.tid.pce.pcep.objects.PccReqId;
import es.tid.pce.pcep.objects.RequestParameters;

public class AutomaticTesterSpainNetworkTask  extends TimerTask {
	private final int portDomainA=4183;
	private final int portDomainB=4184;
	private final int portDomainC=4185;
	private final int portDomainD=4186;
	private final int portDomainE=4187;
	
	private ArrayList source;
	private ArrayList destination;
	private ClientRequestManager crm;
	private int PCEServerPort;
	private Logger log;
	private LinkedList algorithmRuleList;
	
	private static long monitoringIdNumber = 1;
	private PCCPCEPSession ps;
	/*Variable used for counter how many requests there are*/
	private int counter;
	
	AutomaticTesterSpainNetworkTask(PCCPCEPSession ps, int port){

		algorithmRuleList = new LinkedList();
		destination = new ArrayList();
		source  = new ArrayList();
		log=LoggerFactory.getLogger("PCCClient");
		this.crm=ps.crm;
		this.PCEServerPort=port;
		this.ps = ps;
	}
	

	
	@Override
	public void run() {
		log.info("Starting Automatic Client Interface");
		try{
			counter=0;
		     SAXParserFactory factory = SAXParserFactory.newInstance();
		     SAXParser saxParser = factory.newSAXParser();
		     SaxHandler handler = new SaxHandler();

		    
		        
				switch(PCEServerPort){
				case portDomainA:
					saxParser.parse("AutomaticClientTesterA.xml", handler);
					break;
				case portDomainB:
					saxParser.parse("AutomaticClientTesterB.xml", handler);
					break;
				case portDomainC:
					saxParser.parse("AutomaticClientTesterC.xml", handler);
					break;
				case portDomainD:
					saxParser.parse("AutomaticClientTesterD.xml", handler);
					break;
				case portDomainE:
					saxParser.parse("AutomaticClientTesterE.xml", handler);
					break;
				default:
					saxParser.parse("AutomaticClientTester.xml", handler);
					break;

				}

	 } 
	   catch (Exception e) {
	   e.printStackTrace();
	   }     
		System.out.println("Click 1 to start");
		//
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String command = null;

		try {
			command = br.readLine();
		} catch (IOException ioe) {
			System.out.println("IO error trying to read your command");
			System.exit(1);
		}
		boolean PCMonReqBool=true;
		if (command.equals("1")) {
	for (int i=0;i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy