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;
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;
private Boolean success;
private String message;
private String responseCode;
+ private BindingDOMCodecServices bindingDOMCodecServices;
public PceSendingPceRPCs() {
setPathDescription(null);
}
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() {
// sleep for 10s
Thread.sleep(10000);
} catch (InterruptedException e) {
- LOG.error(e.toString());
+ LOG.error("in PCESendingPceRPC: ",e);
}
success = true;
LOG.info("cancelResourceReserve ...");
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 ...");
}
if (!rc.getStatus()) {
- LOG.error("In pathComputationWithConstraints, graph.calcPath: result = {}", rc.toString());
+ LOG.error("In pathComputationWithConstraints, graph.calcPath: result = {}", rc);
return;
}
}
description.buildDescriptions();
rc = description.getReturnStructure();
if (!rc.getStatus()) {
- LOG.error("In pathComputationWithConstraints, description: result = {}", rc.toString());
- return;
+ LOG.error("In pathComputationWithConstraints, description: result = {}", rc);
}
}
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;
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)) {
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;