+ LOG.error("In pathComputationWithConstraints, description: result = {}", rc);
+ }
+ }
+
+ public void pathComputation() throws Exception {
+
+ PceConstraintsCalc constraints = new PceConstraintsCalc(input, networkTransaction);
+ pceHardConstraints = constraints.getPceHardConstraints();
+ pceSoftConstraints = constraints.getPceSoftConstraints();
+ pathComputationWithConstraints(pceHardConstraints, pceSoftConstraints);
+ this.success = rc.getStatus();
+ this.message = rc.getMessage();
+ this.responseCode = rc.getResponseCode();
+
+ AToZDirection atoz = null;
+ ZToADirection ztoa = null;
+ if (rc.getStatus()) {
+ atoz = rc.getAtoZDirection();
+ ztoa = rc.getZtoADirection();
+ }
+
+ //Connect to Gnpy to check path feasibility and recompute another path in case of path non-feasibility
+ try {
+ if (gnpyConsumer.isAvailable()) {
+ GnpyUtilitiesImpl gnpy = new GnpyUtilitiesImpl(networkTransaction, input,
+ gnpyConsumer);
+ 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));
+ }
+ }
+ catch (GnpyException e) {
+ LOG.error("Exception raised by GNPy {}",e.getMessage());
+ setPathDescription(new PathDescriptionBuilder().setAToZDirection(atoz).setZToADirection(ztoa));
+ }
+ }
+
+ private boolean gnpyToCheckFeasiblity(AToZDirection atoz, ZToADirection ztoa, GnpyUtilitiesImpl gnpy)
+ throws GnpyException {
+
+ //Call GNPy for path verification
+ if (gnpy.verifyComputationByGnpy(atoz, ztoa, pceHardConstraints)) {
+ LOG.info("In pceSendingPceRPC: the path is feasible according to Gnpy");
+ gnpyAtoZ = gnpy.getGnpyAtoZ();
+ gnpyZtoA = gnpy.getGnpyZtoA();
+ return true;
+ }
+ return false;
+ }
+
+ 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(pceHardConstraints);
+ if (gnpyPathAsHC == null) {
+ LOG.info("In pceSendingPceRPC: GNPy failed to find another path");
+ this.success = false;
+ this.message = "No path available by PCE and GNPy ";
+ this.responseCode = ResponseCodes.RESPONSE_FAILED;
+ gnpyAtoZ = gnpy.getGnpyAtoZ();
+ gnpyZtoA = gnpy.getGnpyZtoA();