2 * Copyright © 2017 AT&T and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.transportpce.pce;
10 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev171017.PathComputationRequestInput;
11 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory;
15 * Class to check RPCs Compliancy.
17 public final class PceComplianceCheck {
19 private static final Logger LOG = LoggerFactory.getLogger(PceComplianceCheck.class);
22 * Check if a String is not
23 * null and not equal to ''.
25 * @param value String value
26 * @return true if String ok
29 public static boolean checkString(String value) {
30 return (value != null) && (value.compareTo("") != 0);
33 public static PceComplianceCheckResult check(PathComputationRequestInput input) {
35 Boolean result = true;
37 if (!checkString(input.getServiceName())) {
39 message = "Service Name is not set";
42 if (!checkString(input.getServiceHandlerHeader().getRequestId())) {
44 message = "ServiceHandlerHeader Request-ID is not set";
51 return new PceComplianceCheckResult(result, message);
54 private PceComplianceCheck() {