本文整理汇总了Java中es.tid.util.UtilsFunctions类的典型用法代码示例。如果您正苦于以下问题:Java UtilsFunctions类的具体用法?Java UtilsFunctions怎么用?Java UtilsFunctions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UtilsFunctions类属于es.tid.util包,在下文中一共展示了UtilsFunctions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: sendRequest
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
private void sendRequest(DataOutputStream out, PCEPMessage telinkconf) {
try
{
if (out==null)
System.out.println("El out es null!!!");
else{
log.info("Sending request to VNTM");
log.info("telinkconf::"+telinkconf.toString());
out.write(telinkconf.getBytes());
out.flush();
}
} catch (IOException e)
{
log.info(UtilsFunctions.exceptionToString(e));
}
}
开发者ID:telefonicaid,项目名称:netphony-gmpls-emulator,代码行数:17,代码来源:StatefulPCEPSession.java
示例2: telnetInformPCE
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
private void telnetInformPCE(String sourceSwitchID, String destSwitchID, Integer source_interface, Integer destination_interface)
{
try
{
log.info("Calling PCE to add link by telnet");
Socket connectionToTheServer = new Socket("localhost", 6666);
OutputStream out = connectionToTheServer.getOutputStream();
PrintStream ps = new PrintStream(out, true);
ps.println("add xifi link");
BufferedReader br = new BufferedReader(new InputStreamReader(connectionToTheServer.getInputStream()));
log.info(br.readLine());
log.info("commmand::"+sourceSwitchID+"-"+destSwitchID+"-"+source_interface+"-" + destination_interface);
ps.println(sourceSwitchID+"-"+destSwitchID+"-"+source_interface+"-" + destination_interface);
//ps.println("10:00:2c:59:e5:66:ed:00:19-10:00:2c:59:e5:5e:2b:00:19-2-4");
connectionToTheServer.close();
}
catch (Exception e)
{
log.info(UtilsFunctions.exceptionToString(e));
}
}
开发者ID:telefonicaid,项目名称:netphony-gmpls-emulator,代码行数:25,代码来源:VNTMSession.java
示例3: sendPCEPMessage
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
synchronized public void sendPCEPMessage(PCEPMessage msg){
try {
msg.encode();
} catch (PCEPProtocolViolationException e1) {
// TODO Auto-generated catch block
log.info(UtilsFunctions.exceptionToString(e1));
}
try {
log.info("Sending message ::"+msg);
out.write(msg.getBytes());
out.flush();
log.info("Sending message finish");
} catch (IOException e) {
log.info(UtilsFunctions.exceptionToString(e));
log.warn("Error sending msg: " + e.getMessage());
}
}
开发者ID:telefonicaid,项目名称:netphony-pce,代码行数:19,代码来源:ClientRequestManager.java
示例4: sendRequest
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
private void sendRequest(DataOutputStream out, PCEPMessage reportconf) {
try
{
if (out==null)
System.out.println("El out es null!!!");
else{
log.info("Sending request to VNTM");
log.info("reportconf::"+reportconf.toString());
out.write(reportconf.getBytes());
out.flush();
}
} catch (IOException e)
{
log.info(UtilsFunctions.exceptionToString(e));
}
}
开发者ID:telefonicaid,项目名称:netphony-pce,代码行数:17,代码来源:PCEPClientSession.java
示例5: addnewLSP
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
/**
* Method to create a new TE LSP initiated in this node
* @param destinationId IP AddreStart LSP Errorss of the destination of the LSP
* @param bw Bandwidth requested
* @param bidirectional bidirectional
* @param OFcode
* @throws LSPCreationException
*/
public long addnewLSP(Inet4Address destinationId, float bw, boolean bidirectional, int OFcode) throws LSPCreationException{
log.info("Adding New LSP to "+destinationId);
//FIXME: mirar esto
//meter structura --> RequestedLSPinformation --> Dependiente de cada tecnologia
//meter campo con el estado del LSP e ir cambiandolo
LSPTE lsp = new LSPTE(this.getIdNewLSP(), localIP, destinationId, bidirectional, OFcode, bw, PathStateParameters.creatingLPS);
LSPList.put(new LSPKey(localIP, lsp.getIdLSP()), lsp);
ReentrantLock lock= new ReentrantLock();
Condition lspEstablished =lock.newCondition();
//log.info("Metemos en Lock list con ID: "+lsp.getIdLSP());
lockList.put(lsp.getIdLSP(), lock);
conditionList.put(lsp.getIdLSP(), lspEstablished);
/*log.info("Size lockList : "+lockList.size());
log.info("Size conditionList : "+conditionList.size());*/
timeIni = System.nanoTime();
log.info("Start to establish path: "+System.nanoTime());
try{
startLSP(lsp);
}catch(LSPCreationException e){
log.info("Start LSP Error!");
conditionList.remove(lsp.getIdLSP());
lockList.remove(lsp.getIdLSP());
LSPList.remove(lsp.getIdLSP());
log.info(UtilsFunctions.exceptionToString(e));
throw e;
}
return lsp.getIdLSP();
}
开发者ID:telefonicaid,项目名称:netphony-gmpls-emulator,代码行数:37,代码来源:LSPManager.java
示例6: sleep
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
private void sleep(int s)
{
try
{
Thread.currentThread().sleep(s);
}
catch (InterruptedException e)
{
log.info(UtilsFunctions.exceptionToString(e));
}
}
开发者ID:telefonicaid,项目名称:netphony-gmpls-emulator,代码行数:12,代码来源:VNTMSession.java
示例7: replyOK
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
protected void replyOK()
{
try
{
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().println("<html><body><p>Everything OK</p></body></html>");
}
catch (IOException e)
{
log.info(UtilsFunctions.exceptionToString(e));
}
}
开发者ID:telefonicaid,项目名称:netphony-abno,代码行数:13,代码来源:Workflow.java
示例8: replyError
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
/**
* This is really replying Internal Server Error (500)
*/
protected void replyError()
{
try
{
response.setHeader("Content-Type", "application/json");
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
catch (IOException e)
{
log.info(UtilsFunctions.exceptionToString(e));
}
}
开发者ID:telefonicaid,项目名称:netphony-abno,代码行数:16,代码来源:Workflow.java
示例9: replyClientError
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
/**
* This is really replying Client Server Error (400)
* The request sent by the client was syntactically incorrect.
*/
protected void replyClientError()
{
try
{
response.setHeader("Content-Type", "application/json");
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
}
catch (IOException e)
{
log.info(UtilsFunctions.exceptionToString(e));
}
}
开发者ID:telefonicaid,项目名称:netphony-abno,代码行数:17,代码来源:Workflow.java
示例10: reply
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
/**
* @param code : code that will be sent
*/
protected void reply(int code)
{
try
{
response.setStatus(code);
response.getWriter().println("<html><body><p>Code :"+code+" </p></body></html>");
}
catch (IOException e)
{
log.info(UtilsFunctions.exceptionToString(e));
}
}
开发者ID:telefonicaid,项目名称:netphony-abno,代码行数:16,代码来源:Workflow.java
示例11: replyMessage
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
/**
*
* @param message : message
*/
protected void replyMessage(String message)
{
//response.setHeader("Content-Type", "text/plain");
response.setHeader("Content-Type", "application/json");
try
{
response.getWriter().println(message);
//response.getWriter().println("<html><body><p>Code :"+message+" </p></body></html>");
}
catch (IOException e)
{
log.info(UtilsFunctions.exceptionToString(e));
}
}
开发者ID:telefonicaid,项目名称:netphony-abno,代码行数:19,代码来源:Workflow.java
示例12: calculatePath
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
public PCEPResponse calculatePath(String ipSourceString, String ipDestString) {
this.log.info("** PCE **");
this.log.info("Calculating cost between " + ipSourceString + " and " + ipDestString);
try
{
Inet4Address ipSource = (Inet4Address)Inet4Address.getByName(ipSourceString);
Inet4Address ipDest = (Inet4Address)Inet4Address.getByName(ipDestString);
PCEPRequest p_r = new PCEPRequest();
Request req = new Request();
p_r.addRequest(req);
RequestParameters rp = new RequestParameters();
rp.setPbit(true);
req.setRequestParameters(rp);
rp.setRequestID(PCCPCEPSession.getNewReqIDCounter());
EndPointsIPv4 ep = new EndPointsIPv4();
req.setEndPoints(ep);
ep.setSourceIP(ipSource);
ep.setDestIP(ipDest);
ObjectiveFunction of = new ObjectiveFunction();
of.setOFcode(this.ofCode);
req.setObjectiveFunction(of);
/*float bw = 100.0F;
Bandwidth bandwidth = new Bandwidth();
bandwidth.setBw(bw);
req.setBandwidth(bandwidth);
*/
PCEPResponse pr = this.crm.newRequest(p_r);
this.log.info("Response from PCE " + pr.toString());
return pr;
}
catch (Exception e) {
this.log.info("Exception");
this.log.info(UtilsFunctions.exceptionToString(e));
}return null;
}
开发者ID:telefonicaid,项目名称:netphony-abno,代码行数:38,代码来源:Path_Computation.java
示例13: createInitAndSend
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
private void createInitAndSend(EroAndIP EaIP)
{
PCEPInitiate pInit = new PCEPInitiate();
LinkedList<PCEPIntiatedLSP> pcepIntiatedLSPList = new LinkedList<PCEPIntiatedLSP>();
PCEPIntiatedLSP pILSP = new PCEPIntiatedLSP();
LSP lsp = new LSP();
SRP rsp = new SRP();
ExplicitRouteObject ero_lsp = EaIP.ero;
pILSP.setLsp(lsp);
pILSP.setRsp(rsp);
pILSP.setEro(ero_lsp);
pcepIntiatedLSPList.add(pILSP);
try
{
pInit.encode();
Socket clientSocket;
clientSocket = new Socket(EaIP.address, 2222);
DataOutputStream out_to_node = new DataOutputStream(clientSocket.getOutputStream());
out_to_node.write(pInit.getBytes());
out_to_node.flush();
}
catch (Exception e)
{
log.info(UtilsFunctions.exceptionToString(e));
}
}
开发者ID:telefonicaid,项目名称:netphony-pce,代码行数:33,代码来源:ComputingResponse.java
示例14: newRequest
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
public PCEPMessage newRequest( PCEPMessage pcreq, long maxTimeMs)
{
log.info("New Request. Request:"+pcreq.toString());
Object object_lock = new Object();
long idRequest = generateRandomID();
Long idReqLong = new Long(idRequest);
long timeIni = System.nanoTime();
locks.put(idReqLong, object_lock);
sendPCEPMessage(pcreq);
synchronized (object_lock)
{
try
{
log.info("ESPERAREMOS "+maxTimeMs);
object_lock.wait(maxTimeMs);
}
catch (InterruptedException e)
{
UtilsFunctions.exceptionToString(e);
}
}
long timeIni2=System.nanoTime();
double reqTime_ms=(timeIni2-timeIni)/1000000;
log.debug("Request or timeout");
PCEPMessage resp = responses.remove(new Long(idRequest));
if (resp==null)
{
log.warn("NO RESPONSE!!!!! me deshago del lock... con idReqLong "+idRequest);
locks.remove(idReqLong);
}
return resp;
}
开发者ID:telefonicaid,项目名称:netphony-pce,代码行数:37,代码来源:ClientRequestManager.java
示例15: initiate
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
public PCEPMessage initiate ( PCEPInitiate pcini, long maxTimeMs)
{
log.info("Sending Initiate:"+pcini.toString());
byte[] LSPname=pcini.getPcepIntiatedLSPList().get(0).getLsp().getSymbolicPathNameTLV_tlv().getSymbolicPathNameID();
long idIni=pcini.getPcepIntiatedLSPList().get(0).getRsp().getSRP_ID_number();
System.out.println("Sending with id " +idIni);
Long idReqLong=new Long(idIni);
long timeIni=System.nanoTime();
//System.out.println("id ini es "+)
Semaphore semapohore=new Semaphore(0);
semaphores.put(idIni, semapohore);
sendPCEPMessage(pcini);
try
{
semapohore.tryAcquire(maxTimeMs,TimeUnit.MILLISECONDS);
}
catch (InterruptedException e)
{
UtilsFunctions.exceptionToString(e);
}
long timeIni2=System.nanoTime();
//log.info("Response "+pr.toString());
double reqTime_ms=(timeIni2-timeIni)/1000000;
log.debug("Time: "+reqTime_ms );
PCEPMessage resp=responsesInit.remove(new Long(idIni));
if (resp==null){
log.warn("NO RESPONSE!!!!! me deshago del lock... con idIni "+idIni);
locks.remove(idReqLong);
}
return resp;
}
开发者ID:telefonicaid,项目名称:netphony-pce,代码行数:36,代码来源:ClientRequestManager.java
示例16: parseControllerFile
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
public static void parseControllerFile(String controllerFile, ArrayList<String> ips, ArrayList<String> ports, ArrayList<String> types)
{
try
{
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
File confFile = new File(controllerFile);
Document doc = builder.parse(confFile);
NodeList list_nodes_Edges = doc.getElementsByTagName("controller");
for (int i = 0; i < list_nodes_Edges.getLength(); i++)
{
Element nodes_servers = (Element) list_nodes_Edges.item(i);
String ip = UtilsFunctions.getCharacterDataFromElement((Element) nodes_servers.getElementsByTagName("ip").item(0));
String port = UtilsFunctions.getCharacterDataFromElement((Element) nodes_servers.getElementsByTagName("port").item(0));
String type = UtilsFunctions.getCharacterDataFromElement((Element) nodes_servers.getElementsByTagName("type").item(0));
ips.add(ip);
ports.add(port);
types.add(type);
System.out.print("Adding controller with IP: " + ip + " and port: " + port + "and type: " + type);
}
}
catch (Exception e)
{
System.out.print(UtilsFunctions.exceptionToString(e));
}
}
开发者ID:telefonicaid,项目名称:netphony-pce,代码行数:30,代码来源:TopologyManager.java
示例17: notifyLPSEstablished
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
public void notifyLPSEstablished(long lspId, Inet4Address src){
//Lo pongo al principio de momento porque al final de la funcion nunca llega.
//No se si es un bug
log.info("is Stateful??::" +isStateful);
//if PCC is stateful the new LSP must be notified to the PCE
if (isStateful)
{
log.info("LSPList: "+LSPList.size()+" "+(new LSPKey(src, lspId)).toString());
this.getNextdataBaseVersion();
notiLSP.notify(LSPList.get(new LSPKey(src, lspId)), true, true, false, false, getPCESession().getOut());
}
Lock lock;
Condition lspEstablished;
LSPTE lsp;
timeEnd = System.nanoTime();
log.info("Time to Procces RSVP Resv Mssg in Node (ms): "+((timeEnd_Node-timeIni_Node)/1000000));
log.info("LSP total Time (ms): "+((timeEnd-timeIni)/1000000));
try {
lock=lockList.get(lspId);
lspEstablished=conditionList.get(lspId);
lsp=LSPList.get(new LSPKey(src, lspId));
}catch (Exception e){
log.info(UtilsFunctions.exceptionToString(e));
return;
}
//Comento esto y la linea de abajo esto porque peta y estas que se porque
log.info("lspId::" + lspId);
lock.lock();
try
{
lspEstablished.signalAll();
} finally {
log.info("notifyLSPEstablished lockList.remove");
lockList.remove(lspId);
conditionList.remove(lspId);
lock.unlock();
}
}
开发者ID:telefonicaid,项目名称:netphony-gmpls-emulator,代码行数:42,代码来源:LSPManager.java
示例18: IPFromDataPath
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
private Inet4Address IPFromDataPath(String switchID)
{
Inet4Address int4a = null;
log.info("switchID:" + switchID);
try
{
/*
* [RouterInfoPM]->00:00:66:64:22:a0:c0:48
[RouterInfoPM]->10:00:2c:59:e5:66:ed:00
[RouterInfoPM]->00:00:1e:7c:02:77:44:41
[RouterInfoPM]->10:00:2c:59:e5:5e:2b:00
*/
if (switchID.equals("00:00:66:64:22:a0:c0:48"))
{
int4a = (Inet4Address) InetAddress.getByName("10.0.0.1");
}
else if (switchID.equals("10:00:2c:59:e5:66:ed:00"))
{
int4a = (Inet4Address) InetAddress.getByName("10.0.0.2");
}
else if (switchID.equals("00:00:1e:7c:02:77:44:41"))
{
int4a = (Inet4Address) InetAddress.getByName("10.0.0.3");
}
else if (switchID.equals("10:00:2c:59:e5:5e:2b:00"))
{
int4a = (Inet4Address) InetAddress.getByName("10.0.0.4");
}
else
{
log.info("BOOM BOOM Error");
}
}
catch (UnknownHostException e)
{
log.info(UtilsFunctions.exceptionToString(e));
}
log.info("switchID:" + int4a);
return int4a;
}
开发者ID:telefonicaid,项目名称:netphony-gmpls-emulator,代码行数:43,代码来源:VNTMSession.java
示例19: createPCEPRequest
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
private PCEPRequest createPCEPRequest(PCEPInitiate pceInit)
{
PCEPRequest p_r = new PCEPRequest();
try
{
P2MPEndPointsDataPathID eD = (P2MPEndPointsDataPathID)pceInit.getPcepIntiatedLSPList().get(0).getEndPoint();
String source = eD.getSourceDatapathID();
Request req = new Request();
p_r.addRequest(req);
RequestParameters rp= new RequestParameters();
rp.setPbit(true);
rp.setNbit(true);
req.setRequestParameters(rp);
rp.setRequestID(EmulatedPCCPCEPSession.getNewReqIDCounter());
P2MPEndPointsDataPathID ep=new P2MPEndPointsDataPathID();
req.setEndPoints(ep);
ep.setLeafType(1);
ep.setSourceDatapathID(source);
for (int i=0; i < eD.getDestDatapathIDList().size(); i++)
{
ep.getDestDatapathIDList().add(eD.getDestDatapathIDList().get(i));
}
ObjectiveFunction of=new ObjectiveFunction();
of.setOFcode(1004);
req.setObjectiveFunction(of);
BandwidthRequested bandwidth = new BandwidthRequested();
bandwidth.setBw(100);
req.setBandwidth(bandwidth);
return p_r;
}
catch(Exception e)
{
log.info("Exception");
log.info(UtilsFunctions.exceptionToString(e));
return null;
}
}
开发者ID:telefonicaid,项目名称:netphony-gmpls-emulator,代码行数:46,代码来源:VNTMSession.java
示例20: respondABNO
import es.tid.util.UtilsFunctions; //导入依赖的package包/类
private void respondABNO(Socket socket, DataInputStream in)
{
try
{
byte[] salida2=null;
int counter=0;
while ((counter<200)&&(salida2==null)){
salida2=this.readMsg2(in);
if (PCEPMessage.getMessageType(salida2)!=PCEPMessageTypes.MESSAGE_REPORT){
salida2=null;
System.out.println("No Report");
in = new DataInputStream(socket.getInputStream());
}
Thread.currentThread().sleep(1000);
counter++;
}
//PCEPReport pcepReport = new PCEPReport(salida2);
log.info("Ouput(Sending Report):"+salida2.toString());
if ((out== null)||(salida2==null))
{
System.out.println("No se crea bien el out");
}
else{
PCEPReport pceprep=new PCEPReport(salida2);
if (idToDelete==-1){
this.oPtable.put((long)oPcounter.incrementAndGet(), new OpTable("ABNOController", vntmparams.getPMAddress(), String.valueOf(vntmparams.getPMPort()), pceprep.getStateReportList().get(0).getLSP().getLspId(), null));
pceprep.getStateReportList().get(0).getLSP().setLspId((int)oPcounter.get());
System.out.println("VNTM: Guardamos con la id="+oPcounter.get());
} else {
this.oPtable.remove(idToDelete);
pceprep.getStateReportList().get(0).getLSP().setLspId((int)idToDelete);
}
log.info("Sending PCEP message");
pceprep.encode();
this.out.write(pceprep.getBytes());
this.out.flush();
this.printOPTable();
}
}
catch (Exception e)
{
log.info(UtilsFunctions.exceptionToString(e));
}
}
开发者ID:telefonicaid,项目名称:netphony-gmpls-emulator,代码行数:46,代码来源:VNTMSession.java
注:本文中的es.tid.util.UtilsFunctions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论