105889d1bb905dc8b7d98d71bc4761ca2608e526
[transportpce.git] / tapi / src / main / java / org / opendaylight / transportpce / tapi / validation / checks / EndPointCheck.java
1 /*
2  * Copyright © 2018 Orange, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.transportpce.tapi.validation.checks;
9
10 import java.util.List;
11 import org.opendaylight.transportpce.servicehandler.validation.checks.ComplianceCheckResult;
12 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.create.connectivity.service.input.EndPoint;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
15
16 public final class EndPointCheck {
17
18     private static final Logger LOG = LoggerFactory.getLogger(EndPointCheck.class);
19
20     private EndPointCheck() {
21     }
22
23     public static boolean checkString(String value) {
24         return ((value != null) && (value.compareTo("") != 0));
25     }
26
27     public static ComplianceCheckResult check(List<EndPoint> epl) {
28         boolean result = true;
29         String message = "";
30
31         if (epl.isEmpty()) {
32             result = false;
33             message = "Service End-Point must be set";
34         } else {
35             for (EndPoint ep : epl) {
36                 //to do
37                 LOG.info("ep = {}", ep);
38             }
39         }
40
41         return new ComplianceCheckResult(result, message);
42     }
43 }