2 * Copyright © 2023 Fujitsu Network Communications, 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
9 package org.opendaylight.transportpce.servicehandler.validation;
11 import org.opendaylight.transportpce.common.OperationResult;
12 import org.opendaylight.transportpce.servicehandler.CatalogInput;
13 import org.opendaylight.transportpce.servicehandler.validation.checks.ComplianceCheckResult;
14 import org.opendaylight.transportpce.servicehandler.validation.checks.ServicehandlerComplianceCheck;
15 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.RpcActions;
16 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.sdnc.request.header.SdncRequestHeader;
17 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.openroadm.operational.modes.to.catalog.input.OperationalModeInfo;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
21 public final class CatalogValidation {
23 private CatalogValidation() {
26 private static final Logger LOG = LoggerFactory.getLogger(CatalogValidation.class);
28 public static OperationResult validateORCatalogRequest(CatalogInput input, RpcActions rpcActions) {
30 * -OR request header and operational mode info compliance are verified.
32 LOG.debug("checking OR Catalog Compliance ...");
33 SdncRequestHeader sdncRequestHeader = input.getSdncRequestHeader();
34 OperationalModeInfo operationalModeInfo = input.getOperationalModeInfo();
35 ComplianceCheckResult serviceHandlerCheckResult = ServicehandlerComplianceCheck.checkORCatalog(
36 sdncRequestHeader, operationalModeInfo, rpcActions, true);
37 if (!serviceHandlerCheckResult.hasPassed()) {
38 return OperationResult.failed(serviceHandlerCheckResult.getMessage());
40 LOG.debug("Catalog OR request compliant !");
41 return OperationResult.ok("Validation successful.");
44 public static OperationResult validateSpecificCatalogRequest(CatalogInput input, RpcActions rpcActions) {
46 * -Specific request header and operational mode info compliance are verified.
48 LOG.debug("checking specific Catalog Compliance ...");
49 SdncRequestHeader sdncRequestHeader = input.getSdncRequestHeader();
50 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210
51 .add.specific.operational.modes.to.catalog.input.OperationalModeInfo operationalModeInfoSpecific
52 = input.getOperationalModeInfoSpecific();
53 ComplianceCheckResult serviceHandlerCheckResult = ServicehandlerComplianceCheck.checkSpecificCatalog(
54 sdncRequestHeader, operationalModeInfoSpecific, rpcActions, true);
55 if (!serviceHandlerCheckResult.hasPassed()) {
56 return OperationResult.failed(serviceHandlerCheckResult.getMessage());
58 LOG.debug("Catalog specific request compliant !");
59 return OperationResult.ok("Validation successful.");