X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=pce%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fpce%2FPceSendingPceRPCs.java;h=52d6901bd654d131d7cbbd299ca179b5b45c7900;hb=bc9a08be9d7cdeb30ecffd3c82ddd656a3a23043;hp=76fb7144f7808cd2a90f5c9e010fa0fe4641fccf;hpb=3b1ac780f9fed4cddd3076a245746d48f74a6181;p=transportpce.git diff --git a/pce/src/main/java/org/opendaylight/transportpce/pce/PceSendingPceRPCs.java b/pce/src/main/java/org/opendaylight/transportpce/pce/PceSendingPceRPCs.java index 76fb7144f..52d6901bd 100644 --- a/pce/src/main/java/org/opendaylight/transportpce/pce/PceSendingPceRPCs.java +++ b/pce/src/main/java/org/opendaylight/transportpce/pce/PceSendingPceRPCs.java @@ -8,6 +8,7 @@ package org.opendaylight.transportpce.pce; +import org.opendaylight.mdsal.binding.dom.codec.spi.BindingDOMCodecServices; import org.opendaylight.transportpce.common.ResponseCodes; import org.opendaylight.transportpce.common.network.NetworkTransactionService; import org.opendaylight.transportpce.pce.constraints.PceConstraints; @@ -22,8 +23,8 @@ import org.opendaylight.transportpce.pce.networkanalyzer.PceResult; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.PathComputationRequestInput; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.PathComputationRequestInputBuilder; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.service.path.rpc.result.PathDescriptionBuilder; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.AToZDirection; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.ZToADirection; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev200629.path.description.AToZDirection; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev200629.path.description.ZToADirection; import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev171017.RoutingConstraintsSp.PceMetric; import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev171017.routing.constraints.sp.HardConstraints; import org.slf4j.Logger; @@ -58,6 +59,7 @@ public class PceSendingPceRPCs { private Boolean success; private String message; private String responseCode; + private BindingDOMCodecServices bindingDOMCodecServices; public PceSendingPceRPCs() { setPathDescription(null); @@ -66,12 +68,13 @@ public class PceSendingPceRPCs { } public PceSendingPceRPCs(PathComputationRequestInput input, - NetworkTransactionService networkTransaction) { + NetworkTransactionService networkTransaction, BindingDOMCodecServices bindingDOMCodecServices) { setPathDescription(null); // TODO compliance check to check that input is not empty this.input = input; this.networkTransaction = networkTransaction; + this.bindingDOMCodecServices = bindingDOMCodecServices; } public void cancelResourceReserve() { @@ -81,7 +84,7 @@ public class PceSendingPceRPCs { // sleep for 10s Thread.sleep(10000); } catch (InterruptedException e) { - LOG.error(e.toString()); + LOG.error("in PCESendingPceRPC: ",e); } success = true; LOG.info("cancelResourceReserve ..."); @@ -95,7 +98,7 @@ public class PceSendingPceRPCs { rc = nwAnalizer.getReturnStructure(); String serviceType = nwAnalizer.getServiceType(); if (!rc.getStatus()) { - LOG.error("In pathComputationWithConstraints, nwAnalizer: result = {}", rc.toString()); + LOG.error("In pathComputationWithConstraints, nwAnalizer: result = {}", rc); return; } LOG.info("PceGraph ..."); @@ -120,7 +123,7 @@ public class PceSendingPceRPCs { } if (!rc.getStatus()) { - LOG.error("In pathComputationWithConstraints, graph.calcPath: result = {}", rc.toString()); + LOG.error("In pathComputationWithConstraints, graph.calcPath: result = {}", rc); return; } } @@ -129,8 +132,7 @@ public class PceSendingPceRPCs { description.buildDescriptions(); rc = description.getReturnStructure(); if (!rc.getStatus()) { - LOG.error("In pathComputationWithConstraints, description: result = {}", rc.toString()); - return; + LOG.error("In pathComputationWithConstraints, description: result = {}", rc); } } @@ -155,7 +157,8 @@ public class PceSendingPceRPCs { try { ConnectToGnpyServer connectToGnpy = new ConnectToGnpyServer(); if (connectToGnpy.isGnpyURLExist()) { - GnpyUtilitiesImpl gnpy = new GnpyUtilitiesImpl(networkTransaction, input); + GnpyUtilitiesImpl gnpy = new GnpyUtilitiesImpl(networkTransaction, input, + bindingDOMCodecServices); if (rc.getStatus() && gnpyToCheckFeasiblity(atoz,ztoa,gnpy)) { setPathDescription(new PathDescriptionBuilder().setAToZDirection(atoz).setZToADirection(ztoa)); return; @@ -163,19 +166,16 @@ public class PceSendingPceRPCs { callGnpyToComputeNewPath(gnpy); } else { setPathDescription(new PathDescriptionBuilder().setAToZDirection(atoz).setZToADirection(ztoa)); - return; } } catch (GnpyException e) { LOG.error("Exception raised by GNPy {}",e.getMessage()); setPathDescription(new PathDescriptionBuilder().setAToZDirection(atoz).setZToADirection(ztoa)); - return; } - return; } private boolean gnpyToCheckFeasiblity(AToZDirection atoz, ZToADirection ztoa, GnpyUtilitiesImpl gnpy) - throws GnpyException, Exception { + throws GnpyException { //Call GNPy for path verification if (gnpy.verifyComputationByGnpy(atoz, ztoa, pceHardConstraints)) { @@ -187,12 +187,12 @@ public class PceSendingPceRPCs { return false; } - private void callGnpyToComputeNewPath(GnpyUtilitiesImpl gnpy) throws GnpyException, Exception { + private void callGnpyToComputeNewPath(GnpyUtilitiesImpl gnpy) throws GnpyException { //Call GNPy in the case of non feasibility LOG.info("In pceSendingPceRPC: the path is not feasible according to Gnpy"); HardConstraints gnpyPathAsHC = null; - gnpyPathAsHC = gnpy.askNewPathFromGnpy(gnpyPathAsHC, pceHardConstraints); + gnpyPathAsHC = gnpy.askNewPathFromGnpy(pceHardConstraints); if (gnpyPathAsHC == null) { LOG.info("In pceSendingPceRPC: GNPy failed to find another path"); this.success = false;