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.create.connectivity.service.input.TopologyConstraint;
12 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory;
15 public final class TopoConstraintCheck {
17 private static final Logger LOG = LoggerFactory.getLogger(TopoConstraintCheck.class);
19 private TopoConstraintCheck() {
22 public static boolean checkString(String value) {
23 return ((value != null) && (value.compareTo("") != 0));
26 public static ComplianceCheckResult check(TopologyConstraint tc) {
27 boolean result = true;
29 LOG.info("tc = {}", tc.toString());
30 if (tc.getAvoidTopology() == null || tc.getExcludeLink() == null || tc.getExcludeNode() == null || tc
31 .getExcludePath() == null || tc.getIncludeLink() == null || tc.getIncludeNode() == null || tc
32 .getIncludePath() == null || tc.getIncludeTopology() == null || tc
33 .getPreferredTransportLayer() == null) {
34 LOG.info("tc is null");
36 message = "Topology constraints are not managet yet";
37 } else if (tc.getAvoidTopology().isEmpty() || tc.getExcludeLink().isEmpty() || tc.getExcludeNode().isEmpty()
39 .getExcludePath().isEmpty() || tc.getIncludeLink().isEmpty() || tc.getIncludeNode().isEmpty() || tc
40 .getIncludePath().isEmpty() || tc.getIncludeTopology().isEmpty() || tc.getPreferredTransportLayer()
43 message = "Topology constraints are not managet yet";
46 return new ComplianceCheckResult(result, message);