2 * Copyright © 2018 Orange, Inc. 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.tapi.validation.checks;
10 import org.opendaylight.transportpce.servicehandler.validation.checks.ComplianceCheckResult;
11 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.ServiceType;
12 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.create.connectivity.service.input.ConnectivityConstraint;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
16 public final class ConnConstraintCheck {
18 private static final Logger LOG = LoggerFactory.getLogger(ConnConstraintCheck.class);
20 private ConnConstraintCheck() {
23 public static boolean checkString(String value) {
24 return ((value != null) && (value.compareTo("") != 0));
27 public static ComplianceCheckResult check(ConnectivityConstraint cc) {
28 boolean result = true;
31 if (!cc.getServiceType().equals(ServiceType.POINTTOPOINTCONNECTIVITY)) {
33 message = "Service-Type is not Point-to-Point";
34 } else if (!checkString(cc.getServiceLevel())) {
36 message = "Service-Level is not set";
39 return new ComplianceCheckResult(result, message);