X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=transportpce.git;a=blobdiff_plain;f=servicehandler%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fservicehandler%2Fvalidation%2FServiceCreateValidation.java;h=93f80eca1ae333ba1a440e6aacb2a4d01e36de39;hp=9fa1a07acf4ec53b93d1961bda495f5e0a1272e9;hb=6b6a445c84c2eb1c85d4e48c2d10a89c3d598bc5;hpb=b2abd6707a43df5aea5a271deac8da89158a91a4 diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/validation/ServiceCreateValidation.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/validation/ServiceCreateValidation.java index 9fa1a07ac..93f80eca1 100644 --- a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/validation/ServiceCreateValidation.java +++ b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/validation/ServiceCreateValidation.java @@ -31,61 +31,56 @@ public final class ServiceCreateValidation { * -request header compliancy are verified. */ LOG.debug("checking Service Compliance ..."); - try { - String serviceNmame = input.getServiceName(); - SdncRequestHeader sdncRequestHeader = input.getSdncRequestHeader(); - ConnectionType conType = input.getConnectionType(); - ComplianceCheckResult serviceHandlerCheckResult = ServicehandlerComplianceCheck.check( - serviceNmame, sdncRequestHeader, conType, rpcActions, true, true); - if (serviceHandlerCheckResult.hasPassed()) { - LOG.debug("Service request compliant !"); - } else { - return OperationResult.failed(serviceHandlerCheckResult.getMessage()); - } + String serviceNmame = input.getServiceName(); + SdncRequestHeader sdncRequestHeader = input.getSdncRequestHeader(); + ConnectionType conType = input.getConnectionType(); + ComplianceCheckResult serviceHandlerCheckResult = ServicehandlerComplianceCheck.check( + serviceNmame, sdncRequestHeader, conType, rpcActions, true, true); + if (serviceHandlerCheckResult.hasPassed()) { + LOG.debug("Service request compliant !"); + } else { + return OperationResult.failed(serviceHandlerCheckResult.getMessage()); + } + /* + * If compliant, service-request parameters are verified in order to + * check if there is no missing parameter that prevents calculating + * a path and implement a service. + */ + LOG.debug("checking Tx/Rx Info for AEnd ..."); + ComplianceCheckResult txrxCheckAEnd = ServicehandlerTxRxCheck.check(input.getServiceAEnd(), + ServiceEndpointType.SERVICEAEND); + if (txrxCheckAEnd.hasPassed()) { + LOG.debug("Tx/Rx Info for AEnd checked !"); + } else { + return OperationResult.failed(txrxCheckAEnd.getMessage()); + } + + LOG.debug("checking Tx/Rx Info for ZEnd ..."); + ComplianceCheckResult txrxCheckZEnd = ServicehandlerTxRxCheck.check(input.getServiceZEnd(), + ServiceEndpointType.SERVICEZEND); + if (txrxCheckZEnd.hasPassed()) { + LOG.debug("Tx/Rx Info for ZEnd checked"); /* - * If compliant, service-request parameters are verified in order to - * check if there is no missing parameter that prevents calculating - * a path and implement a service. + * If OK, common-id is verified in order to see if there is + * no routing policy provided. If yes, the routing + * constraints of the policy are recovered and coherency + * with hard/soft constraints provided in the input of the + * RPC. */ - LOG.debug("checking Tx/Rx Info for AEnd ..."); - ComplianceCheckResult txrxCheckAEnd = ServicehandlerTxRxCheck.check(input.getServiceAEnd(), - ServiceEndpointType.SERVICEAEND); - if (txrxCheckAEnd.hasPassed()) { - LOG.debug("Tx/Rx Info for AEnd checked !"); - } else { - return OperationResult.failed(txrxCheckAEnd.getMessage()); - } - - LOG.debug("checking Tx/Rx Info for ZEnd ..."); - ComplianceCheckResult txrxCheckZEnd = ServicehandlerTxRxCheck.check(input.getServiceZEnd(), - ServiceEndpointType.SERVICEZEND); - if (txrxCheckZEnd.hasPassed()) { - LOG.debug("Tx/Rx Info for ZEnd checked"); - /* - * If OK, common-id is verified in order to see if there is - * no routing policy provided. If yes, the routing - * constraints of the policy are recovered and coherency - * with hard/soft constraints provided in the input of the - * RPC. - */ - } else { - return OperationResult.failed(txrxCheckZEnd.getMessage()); - } + } else { + return OperationResult.failed(txrxCheckZEnd.getMessage()); + } - if (input.getCommonId() != null) { - LOG.debug("Common-id specified"); - // Check coherency with hard/soft constraints - if (CheckCoherencyHardSoft.check(input.getHardConstraints(), input.getSoftConstraints())) { - LOG.debug("hard/soft constraints coherent !"); - } else { - return OperationResult.failed("hard/soft constraints are not coherent !"); - } + if (input.getCommonId() != null) { + LOG.debug("Common-id specified"); + // Check coherency with hard/soft constraints + if (CheckCoherencyHardSoft.check(input.getHardConstraints(), input.getSoftConstraints())) { + LOG.debug("hard/soft constraints coherent !"); } else { - LOG.warn("Common-id not specified !"); + return OperationResult.failed("hard/soft constraints are not coherent !"); } - } catch (NullPointerException e) { - LOG.error("one of input parameter is null ",e); - return OperationResult.failed("one of input parameter is null."); + } else { + LOG.warn("Common-id not specified !"); } return OperationResult.ok("Validation successful."); }