+
+ // Verify the path with GNPy
+ AToZDirection atoz = rc.getAtoZDirection();
+ ZToADirection ztoa = rc.getZtoADirection();
+ ConnectToGnpyServer connectToGnpy = new ConnectToGnpyServer();
+
+ // Verify that the GNPy server exists
+ if (connectToGnpy.isGnpyURLExist()) {
+ LOG.info("Gnpy instance is connected T-PCE");
+ GnpyUtilitiesImpl gnpy = new GnpyUtilitiesImpl(networkTransaction, input);
+ if (gnpy.verifyComputationByGnpy(atoz, ztoa, pceHardConstraints)) {
+ LOG.info("The path is feasible according to Gnpy");
+ setPathDescription(new PathDescriptionBuilder().setAToZDirection(atoz).setZToADirection(ztoa));
+ }
+ else {
+ LOG.info("The path is not feasible according to Gnpy");
+ HardConstraints gnpyPathAsHC = null;
+ gnpyPathAsHC = gnpy.askNewPathFromGnpy(atoz, ztoa, gnpyPathAsHC, pceHardConstraints);
+ if (gnpyPathAsHC != null) {
+ LOG.info("GNPy succeed to find another path");
+ // Compute the path
+ PathComputationRequestInput inputFromGnpy = new PathComputationRequestInputBuilder()
+ .setServiceName(input.getServiceName())
+ .setHardConstraints(gnpyPathAsHC)
+ .setSoftConstraints(input.getSoftConstraints())
+ .setPceMetric(PceMetric.HopCount)
+ .setServiceAEnd(input.getServiceAEnd())
+ .setServiceZEnd(input.getServiceZEnd())
+ .build();
+ PceConstraintsCalc constraintsGnpy = new PceConstraintsCalc(inputFromGnpy, networkTransaction);
+ PceConstraints gnpyHardConstraints = constraintsGnpy.getPceHardConstraints();
+ PceConstraints gnpySoftConstraints = constraintsGnpy.getPceSoftConstraints();
+ pathComputationWithConstraints(gnpyHardConstraints, gnpySoftConstraints);
+ atoz = rc.getAtoZDirection();
+ ztoa = rc.getZtoADirection();
+ setPathDescription(new PathDescriptionBuilder().setAToZDirection(atoz).setZToADirection(ztoa));
+ if (gnpy.verifyComputationByGnpy(atoz, ztoa, pceHardConstraints)) {
+ LOG.info("In pathComputation: the new path computed by GNPy is valid");
+ setPathDescription(new PathDescriptionBuilder().setAToZDirection(atoz).setZToADirection(ztoa));
+ this.success = true;
+ this.message = "Path is calculated by GNPy ";
+ this.responseCode = ResponseCodes.RESPONSE_OK;
+ } else {
+ LOG.info("In pathComputation: the new path computed by GNPy is not valid");
+ this.success = false;
+ this.message = "No path available ";
+ this.responseCode = ResponseCodes.RESPONSE_FAILED;
+ }
+ } else {
+ LOG.info("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();
+ } else {
+ LOG.info("in PCESendingPceRPCs: Cannot connect to GNPy!!");
+ setPathDescription(new PathDescriptionBuilder().setAToZDirection(atoz).setZToADirection(ztoa));
+ LOG.info("In pathComputation Graph is Found");