Catalog RPC Implementation 63/104963/4
authorRoshan Joyce <roshan.joyce@fujitsu.com>
Fri, 17 Mar 2023 12:01:36 +0000 (17:31 +0530)
committerRoshan Joyce <roshan.joyce@fujitsu.com>
Thu, 23 Mar 2023 16:59:29 +0000 (16:59 +0000)
JIRA: TRNSPRTPCE-714
Signed-off-by: Roshan Joyce <roshan.joyce@fujitsu.com>
Change-Id: I9fe5b5c00d0145ceabd2edb7961f1f3e46065fee

15 files changed:
lighty/src/main/java/io/lighty/controllers/tpce/module/TransportPCEImpl.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/CatalogInput.java [new file with mode: 0644]
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/ModelMappingUtils.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/catalog/CatalogDataStoreOperations.java [new file with mode: 0644]
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/catalog/CatalogDataStoreOperationsImpl.java [new file with mode: 0644]
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/catalog/CatalogMapper.java [new file with mode: 0644]
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImpl.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerProvider.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/utils/CatalogDataUtils.java [new file with mode: 0644]
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/validation/CatalogValidation.java [new file with mode: 0644]
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/validation/checks/ServicehandlerComplianceCheck.java
servicehandler/src/main/resources/OSGI-INF/blueprint/servicehandler-blueprint.xml
servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImplTest.java
servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerProviderTest.java
tapi/src/test/java/org/opendaylight/transportpce/tapi/connectivity/TapiConnectivityImplTest.java

index 0505c1269937e8b108bc9d342591089e5bb1c61b..889c7f410754a30e35307f8291495ed7df003bd3 100644 (file)
@@ -12,6 +12,8 @@ import io.lighty.core.controller.api.LightyServices;
 import java.util.Arrays;
 import java.util.List;
 import org.opendaylight.mdsal.binding.api.NotificationService;
 import java.util.Arrays;
 import java.util.List;
 import org.opendaylight.mdsal.binding.api.NotificationService;
+import org.opendaylight.transportpce.servicehandler.catalog.CatalogDataStoreOperations;
+import org.opendaylight.transportpce.servicehandler.catalog.CatalogDataStoreOperationsImpl;
 import org.opendaylight.transportpce.common.crossconnect.CrossConnect;
 import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl;
 import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl121;
 import org.opendaylight.transportpce.common.crossconnect.CrossConnect;
 import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl;
 import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl121;
@@ -199,15 +201,17 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP
             lightyServices.getBindingNotificationPublishService(), serviceDataStoreOperations);
         NetworkModelListenerImpl networkModelListenerImpl = new NetworkModelListenerImpl(
                 lightyServices.getBindingNotificationPublishService(), serviceDataStoreOperations);
             lightyServices.getBindingNotificationPublishService(), serviceDataStoreOperations);
         NetworkModelListenerImpl networkModelListenerImpl = new NetworkModelListenerImpl(
                 lightyServices.getBindingNotificationPublishService(), serviceDataStoreOperations);
+        CatalogDataStoreOperations catalogDataStoreOperations = new CatalogDataStoreOperationsImpl(
+                lightyServices.getBindingDataBroker());
         ServicehandlerImpl servicehandler = new ServicehandlerImpl(lightyServices.getBindingDataBroker(),
             pathComputationService, rendererServiceOperations, lightyServices.getBindingNotificationPublishService(),
         ServicehandlerImpl servicehandler = new ServicehandlerImpl(lightyServices.getBindingDataBroker(),
             pathComputationService, rendererServiceOperations, lightyServices.getBindingNotificationPublishService(),
-            pceListenerImpl, rendererListenerImpl, networkModelListenerImpl, serviceDataStoreOperations);
+            pceListenerImpl, rendererListenerImpl, networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         ServiceListener serviceListener = new ServiceListener(servicehandler, serviceDataStoreOperations,
                 lightyServices.getBindingNotificationPublishService());
         servicehandlerProvider = new ServicehandlerProvider(lightyServices.getBindingDataBroker(),
                 lightyServices.getRpcProviderService(), lightyServices.getNotificationService(),
                 serviceDataStoreOperations, pceListenerImpl, serviceListener, rendererListenerImpl,
         ServiceListener serviceListener = new ServiceListener(servicehandler, serviceDataStoreOperations,
                 lightyServices.getBindingNotificationPublishService());
         servicehandlerProvider = new ServicehandlerProvider(lightyServices.getBindingDataBroker(),
                 lightyServices.getRpcProviderService(), lightyServices.getNotificationService(),
                 serviceDataStoreOperations, pceListenerImpl, serviceListener, rendererListenerImpl,
-                networkModelListenerImpl, servicehandler);
+                networkModelListenerImpl, servicehandler, catalogDataStoreOperations);
         if (activateTapi) {
             LOG.info("Creating tapi beans ...");
             TapiLink tapiLink = new TapiLink(networkTransaction);
         if (activateTapi) {
             LOG.info("Creating tapi beans ...");
             TapiLink tapiLink = new TapiLink(networkTransaction);
diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/CatalogInput.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/CatalogInput.java
new file mode 100644 (file)
index 0000000..75735e0
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright © 2022 Fujitsu Network Communications, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.servicehandler;
+
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.sdnc.request.header.SdncRequestHeader;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddOpenroadmOperationalModesToCatalogInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddSpecificOperationalModesToCatalogInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.openroadm.operational.modes.to.catalog.input.OperationalModeInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CatalogInput {
+
+    private static final Logger LOG = LoggerFactory.getLogger(CatalogInput.class);
+    private SdncRequestHeader sdncRequestHeader;
+    private OperationalModeInfo operationalModeInfo;
+
+    private org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.specific.operational.modes
+            .to.catalog.input.OperationalModeInfo operationalModeInfoSpecific;
+
+    public CatalogInput(AddOpenroadmOperationalModesToCatalogInput addORToCatalogInput) {
+        LOG.info("CatalogInput AddOpenroadmOperationalModesToCatalogInput");
+        setSdncRequestHeader(addORToCatalogInput.getSdncRequestHeader());
+        setOperationalModeInfo(addORToCatalogInput.getOperationalModeInfo());
+    }
+
+    public CatalogInput(AddSpecificOperationalModesToCatalogInput addSpecificToCatalogInput) {
+        LOG.info("CatalogInput AddSpecificOperationalModesToCatalogInput");
+        setSdncRequestHeader(addSpecificToCatalogInput.getSdncRequestHeader());
+        setOperationalModeInfoSpecific(addSpecificToCatalogInput.getOperationalModeInfo());
+    }
+
+    public SdncRequestHeader getSdncRequestHeader() {
+        return sdncRequestHeader;
+    }
+
+    public void setSdncRequestHeader(SdncRequestHeader sdncRequestHeader) {
+        this.sdncRequestHeader = sdncRequestHeader;
+    }
+
+    public OperationalModeInfo getOperationalModeInfo() {
+        return operationalModeInfo;
+    }
+
+    public void setOperationalModeInfo(OperationalModeInfo operationalModeInfo) {
+        this.operationalModeInfo = operationalModeInfo;
+    }
+
+    public org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.specific.operational.modes
+            .to.catalog.input.OperationalModeInfo getOperationalModeInfoSpecific() {
+        return operationalModeInfoSpecific;
+    }
+
+    public void setOperationalModeInfoSpecific(org.opendaylight.yang.gen.v1.http.org.openroadm
+                                                       .service.rev211210.add.specific.operational.modes
+                                                       .to.catalog.input.OperationalModeInfo
+                                                       operationalModeInfoSpecific) {
+        this.operationalModeInfoSpecific = operationalModeInfoSpecific;
+    }
+}
index 7ef1bab194177f298809ca0f4e12f9983232c7fc..59ee4570d902b1e5f96f74b95787471a0da06759 100644 (file)
@@ -46,6 +46,12 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev21092
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.OTUflex;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.OduRateIdentity;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.OtuRateIdentity;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.OTUflex;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.OduRateIdentity;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.OtuRateIdentity;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddOpenroadmOperationalModesToCatalogInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddOpenroadmOperationalModesToCatalogOutput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddOpenroadmOperationalModesToCatalogOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddSpecificOperationalModesToCatalogInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddSpecificOperationalModesToCatalogOutput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddSpecificOperationalModesToCatalogOutputBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateInput;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateOutput;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateOutputBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateInput;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateOutput;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateOutputBuilder;
@@ -632,4 +638,45 @@ public final class ModelMappingUtils {
         }
         return new int[] { endPos - maxLen, endPos };
     }
         }
         return new int[] { endPos - maxLen, endPos };
     }
+
+    public static ListenableFuture<RpcResult<AddOpenroadmOperationalModesToCatalogOutput>>
+        addOpenroadmServiceReply(AddOpenroadmOperationalModesToCatalogInput input, String finalAck,
+                                 String message,String responseCode) {
+        return RpcResultBuilder
+            .success(
+                new AddOpenroadmOperationalModesToCatalogOutputBuilder()
+                    .setConfigurationResponseCommon(
+                        new ConfigurationResponseCommonBuilder()
+                                .setAckFinalIndicator(finalAck)
+                                .setResponseMessage(message)
+                            .setResponseCode(responseCode)
+                                .setRequestId(
+                                        input.getSdncRequestHeader() == null
+                                                ? null
+                                                : input.getSdncRequestHeader().getRequestId())
+                            .build())
+                    .build())
+            .buildFuture();
+    }
+
+    public static ListenableFuture<RpcResult<AddSpecificOperationalModesToCatalogOutput>>
+        addSpecificOpenroadmServiceReply(AddSpecificOperationalModesToCatalogInput input, String finalAck,
+                                         String message,String responseCode) {
+        return RpcResultBuilder
+                .success(
+                        new AddSpecificOperationalModesToCatalogOutputBuilder()
+                                .setConfigurationResponseCommon(
+                                        new ConfigurationResponseCommonBuilder()
+                                                .setAckFinalIndicator(finalAck)
+                                                .setResponseMessage(message)
+                                                .setResponseCode(responseCode)
+                                                .setRequestId(
+                                                        input.getSdncRequestHeader() == null
+                                                                ? null
+                                                                : input.getSdncRequestHeader().getRequestId())
+                                                .build())
+                                .build())
+                .buildFuture();
+    }
+
 }
 }
diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/catalog/CatalogDataStoreOperations.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/catalog/CatalogDataStoreOperations.java
new file mode 100644 (file)
index 0000000..6a0d01d
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright © 2023 Fujitsu Network Communications, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.servicehandler.catalog;
+
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.OpenroadmOperationalModes;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.SpecificOperationalModes;
+
+/**
+ * Store operational mode catalog into MDSAL .
+ */
+public interface CatalogDataStoreOperations {
+
+    /**
+     * Store OpenroadmOperationalModes object in the config data store.
+     */
+    void addOpenroadmOperationalModesToCatalog(OpenroadmOperationalModes objToSave);
+
+    /**
+     * Store SpecificOperationalModes object in the config data store.
+     */
+    void addSpecificOperationalModesToCatalog(SpecificOperationalModes objToSave);
+
+}
diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/catalog/CatalogDataStoreOperationsImpl.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/catalog/CatalogDataStoreOperationsImpl.java
new file mode 100644 (file)
index 0000000..4a6c534
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright © 2023 Fujitsu Network Communications, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.servicehandler.catalog;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.transportpce.common.Timeouts;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.OpenroadmOperationalModes;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.SpecificOperationalModes;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OperationalModeCatalog;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CatalogDataStoreOperationsImpl implements CatalogDataStoreOperations {
+    private static final Logger LOG = LoggerFactory.getLogger(CatalogDataStoreOperationsImpl.class);
+
+    private DataBroker dataBroker;
+
+    public CatalogDataStoreOperationsImpl(DataBroker dataBroker) {
+        this.dataBroker = dataBroker;
+    }
+
+    /**
+     * Store OpenroadmOperationalModes object in the config data store.
+     */
+    @Override
+    public void addOpenroadmOperationalModesToCatalog(OpenroadmOperationalModes objToSave) {
+        LOG.info("Inside addOpenroadmOperationalModesToCatalog method of CatalogDataStoreOperationsImpl");
+        try {
+            InstanceIdentifier<OpenroadmOperationalModes> instanceIdentifier =
+                InstanceIdentifier.create(OperationalModeCatalog.class).child(OpenroadmOperationalModes.class);
+            WriteTransaction writeTransaction = this.dataBroker.newWriteOnlyTransaction();
+            writeTransaction.merge(LogicalDatastoreType.CONFIGURATION, instanceIdentifier , objToSave);
+            writeTransaction.commit().get(Timeouts.DATASTORE_WRITE, TimeUnit.MILLISECONDS);
+        } catch (TimeoutException | InterruptedException | ExecutionException e) {
+            LOG.warn("Warning addOpenroadmOperationalModesToCatalog CatalogDataStoreOperationsImpl");
+        }
+    }
+
+    /**
+     * Store SpecificOperationalModes object in the config data store.
+     */
+    @Override
+    public void addSpecificOperationalModesToCatalog(SpecificOperationalModes objToSave) {
+        LOG.info("Inside addSpecificOperationalModesToCatalog method of CatalogDataStoreOperationsImpl");
+        try {
+            InstanceIdentifier<SpecificOperationalModes> instanceIdentifier = InstanceIdentifier
+                    .create(OperationalModeCatalog.class).child(SpecificOperationalModes.class);
+            WriteTransaction writeTransaction = this.dataBroker.newWriteOnlyTransaction();
+            writeTransaction.merge(LogicalDatastoreType.CONFIGURATION, instanceIdentifier , objToSave);
+            writeTransaction.commit().get(Timeouts.DATASTORE_WRITE, TimeUnit.MILLISECONDS);
+        } catch (TimeoutException | InterruptedException | ExecutionException e) {
+            LOG.warn("Warning addSpecificOperationalModesToCatalog CatalogDataStoreOperationsImpl");
+        }
+    }
+}
diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/catalog/CatalogMapper.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/catalog/CatalogMapper.java
new file mode 100644 (file)
index 0000000..b6d2fc8
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ * Copyright © 2023 Fujitsu Network Communications, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.servicehandler.catalog;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.OpenroadmOperationalModes;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.OpenroadmOperationalModesBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.SpecificOperationalModes;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.SpecificOperationalModesBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.openroadm.operational.modes.AmplifiersBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.openroadm.operational.modes.GridParametersBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.openroadm.operational.modes.RoadmsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.openroadm.operational.modes.XpondersPluggablesBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.openroadm.operational.modes.xponders.pluggables.XponderPluggableOpenroadmOperationalModeBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.specific.operational.modes.SpecificOperationalModeBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.roadm.add.parameters.Add;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.roadm.drop.parameters.Drop;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.roadm.express.parameters.Express;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddOpenroadmOperationalModesToCatalogInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddSpecificOperationalModesToCatalogInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.openroadm.operational.modes.to.catalog.input.OperationalModeInfo;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.openroadm.operational.modes.to.catalog.input.operational.mode.info.xponders.pluggables.XponderPluggableOpenroadmOperationalMode;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.openroadm.operational.modes.to.catalog.input.operational.mode.info.xponders.pluggables.XponderPluggableOpenroadmOperationalModeKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.specific.operational.modes.to.catalog.input.operational.mode.info.specific.operational.modes.SpecificOperationalMode;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.specific.operational.modes.to.catalog.input.operational.mode.info.specific.operational.modes.SpecificOperationalModeKey;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public final class CatalogMapper {
+    private static final Logger LOG = LoggerFactory.getLogger(CatalogMapper.class);
+
+    private CatalogMapper() {
+    }
+
+    static SpecificOperationalModesBuilder specificObjBuilder = new SpecificOperationalModesBuilder();
+
+    static OpenroadmOperationalModesBuilder objBuilder = new OpenroadmOperationalModesBuilder();
+
+    /**
+     * Preparation of SpecificOperationalModes object which will be stored in the config data store
+     * and returning the same.
+     */
+    public static SpecificOperationalModes createSpecificModesToSave(AddSpecificOperationalModesToCatalogInput input) {
+        LOG.info("Inside createSpecificModesToSave method of CatalogMapper");
+        org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.specific.operational.modes.to.catalog
+                .input.operational.mode.info.SpecificOperationalModes specificModesFromInput =
+                input.getOperationalModeInfo().getSpecificOperationalModes();
+        saveSpecificOperationalModes(specificModesFromInput);
+        return specificObjBuilder.build();
+    }
+
+    /**
+     * Preparation of OpenroadmOperationalModes object which will be stored in the config data store
+     * and returning the same.
+     */
+    public static OpenroadmOperationalModes createORModesToSave(AddOpenroadmOperationalModesToCatalogInput input) {
+        LOG.info("Inside createORModesToSave method of CatalogMapper");
+        OperationalModeInfo modesFromInput = input.getOperationalModeInfo();
+
+        saveGridParameters(modesFromInput);
+        saveXpondersPlugabbles(modesFromInput);
+        saveRoadms(modesFromInput);
+        saveAmplifiers(modesFromInput);
+
+        return objBuilder.build();
+    }
+
+    /**
+     * Preparation of Amplifiers for OpenroadmOperationalModes object.
+     */
+    private static void saveAmplifiers(OperationalModeInfo modesFromInput) {
+        objBuilder.setAmplifiers(
+                new AmplifiersBuilder()
+                        .setAmplifier(modesFromInput.getAmplifiers().getAmplifier())
+                        .build());
+    }
+
+    /**
+     * Preparation of Grid Parameters for OpenroadmOperationalModes object.
+     */
+    private static void saveGridParameters(OperationalModeInfo modesFromInput) {
+        objBuilder.setGridParameters(new GridParametersBuilder(modesFromInput.getGridParameters()).build());
+    }
+
+    /**
+     * Preparation of Xponders Pluggables for OpenroadmOperationalModes object.
+     */
+    private static void saveXpondersPlugabbles(OperationalModeInfo modesFromInput) {
+        Map<XponderPluggableOpenroadmOperationalModeKey, XponderPluggableOpenroadmOperationalMode> map =
+                modesFromInput.getXpondersPluggables().getXponderPluggableOpenroadmOperationalMode();
+        Iterator<Map.Entry<XponderPluggableOpenroadmOperationalModeKey, XponderPluggableOpenroadmOperationalMode>> itr =
+                map.entrySet().iterator();
+
+        XpondersPluggablesBuilder xpondersPluggablesBuilder = new XpondersPluggablesBuilder();
+        Map<org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210
+                .operational.mode.catalog.openroadm.operational.modes.xponders.pluggables
+                .XponderPluggableOpenroadmOperationalModeKey,
+                org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210
+                        .operational.mode.catalog.openroadm.operational.modes.xponders.pluggables
+                        .XponderPluggableOpenroadmOperationalMode> mapFinal = new HashMap<>();
+
+        while (itr.hasNext()) {
+            Map.Entry<XponderPluggableOpenroadmOperationalModeKey, XponderPluggableOpenroadmOperationalMode> entry =
+                    itr.next();
+
+            XponderPluggableOpenroadmOperationalModeBuilder
+                    modeBuilder  = new XponderPluggableOpenroadmOperationalModeBuilder(entry.getValue());
+
+            org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog
+                    .openroadm.operational.modes.xponders.pluggables.XponderPluggableOpenroadmOperationalModeKey
+                    key = new org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210
+                    .operational.mode.catalog.openroadm.operational.modes.xponders.pluggables
+                    .XponderPluggableOpenroadmOperationalModeKey(entry.getKey().toString());
+
+            modeBuilder.setOpenroadmOperationalModeId(entry.getValue().getOpenroadmOperationalModeId());
+            org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode
+                    .catalog.openroadm.operational.modes.xponders.pluggables.XponderPluggableOpenroadmOperationalMode
+                    mode = modeBuilder.build();
+            mapFinal.put(key, mode);
+            xpondersPluggablesBuilder.setXponderPluggableOpenroadmOperationalMode(mapFinal);
+            objBuilder.setXpondersPluggables(xpondersPluggablesBuilder
+                    .setXponderPluggableOpenroadmOperationalMode(mapFinal).build());
+        }
+    }
+
+    /**
+     * Preparation of Roadms for OpenroadmOperationalModes object.
+     */
+    private static void saveRoadms(OperationalModeInfo modesFromInput) {
+        Add add = modesFromInput.getRoadms().getAdd();
+        Drop drop = modesFromInput.getRoadms().getDrop();
+        Express express = modesFromInput.getRoadms().getExpress();
+        RoadmsBuilder roadmsBuilder = new RoadmsBuilder().setAdd(add).setDrop(drop).setExpress(express);
+        objBuilder.setRoadms(roadmsBuilder.build());
+    }
+
+    /**
+     * Preparation of Specific Operational Modes for SpecificOperationalModes object.
+     */
+    private static  void saveSpecificOperationalModes(org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210
+                                                              .add.specific.operational.modes.to.catalog.input
+                                                              .operational.mode.info.SpecificOperationalModes
+                                                              specificModesFromInput) {
+        Map<SpecificOperationalModeKey, SpecificOperationalMode> map =
+                specificModesFromInput.getSpecificOperationalMode();
+        Iterator<Map.Entry<SpecificOperationalModeKey, SpecificOperationalMode>> itr = map.entrySet().iterator();
+
+        Map<org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog
+                .specific.operational.modes.SpecificOperationalModeKey, org.opendaylight.yang.gen.v1.http.org.openroadm
+                .operational.mode.catalog.rev211210.operational.mode.catalog.specific.operational.modes
+                .SpecificOperationalMode> mapFinal = new HashMap<>();
+
+        while (itr.hasNext()) {
+            Map.Entry<SpecificOperationalModeKey, SpecificOperationalMode> entry = itr.next();
+
+            SpecificOperationalModeBuilder specificModeBuilder = new SpecificOperationalModeBuilder();
+            specificModeBuilder.fieldsFrom(entry.getValue());
+
+            org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog
+                    .specific.operational.modes.SpecificOperationalModeKey specificModeKey = new org.opendaylight.yang
+                    .gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.specific
+                    .operational.modes.SpecificOperationalModeKey(entry.getKey().toString());
+
+            specificModeBuilder.setOperationalModeId(entry.getValue().getOperationalModeId());
+            specificModeBuilder.setConfigurableOutputPower(true);
+            org.opendaylight.yang.gen.v1.http.org.openroadm
+                    .operational.mode.catalog.rev211210.operational.mode.catalog.specific.operational.modes
+                    .SpecificOperationalMode specificMode = specificModeBuilder.build();
+            mapFinal.put(specificModeKey, specificMode);
+            specificObjBuilder.setSpecificOperationalMode(mapFinal);
+        }
+    }
+}
index 7d3d4f9edb7bcfde39b2cdc32d83bfd4100a121a..e6793094dfc6ac2512c7da5dc3d48ded898ccece 100644 (file)
@@ -19,15 +19,19 @@ import org.opendaylight.transportpce.common.OperationResult;
 import org.opendaylight.transportpce.common.ResponseCodes;
 import org.opendaylight.transportpce.pce.service.PathComputationService;
 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
 import org.opendaylight.transportpce.common.ResponseCodes;
 import org.opendaylight.transportpce.pce.service.PathComputationService;
 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
+import org.opendaylight.transportpce.servicehandler.CatalogInput;
 import org.opendaylight.transportpce.servicehandler.DowngradeConstraints;
 import org.opendaylight.transportpce.servicehandler.ModelMappingUtils;
 import org.opendaylight.transportpce.servicehandler.ServiceInput;
 import org.opendaylight.transportpce.servicehandler.DowngradeConstraints;
 import org.opendaylight.transportpce.servicehandler.ModelMappingUtils;
 import org.opendaylight.transportpce.servicehandler.ServiceInput;
+import org.opendaylight.transportpce.servicehandler.catalog.CatalogDataStoreOperations;
+import org.opendaylight.transportpce.servicehandler.catalog.CatalogMapper;
 import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
 import org.opendaylight.transportpce.servicehandler.service.PCEServiceWrapper;
 import org.opendaylight.transportpce.servicehandler.service.RendererServiceWrapper;
 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
 import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
 import org.opendaylight.transportpce.servicehandler.service.PCEServiceWrapper;
 import org.opendaylight.transportpce.servicehandler.service.RendererServiceWrapper;
 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
+import org.opendaylight.transportpce.servicehandler.validation.CatalogValidation;
 import org.opendaylight.transportpce.servicehandler.validation.ServiceCreateValidation;
 import org.opendaylight.transportpce.servicehandler.validation.checks.ComplianceCheckResult;
 import org.opendaylight.transportpce.servicehandler.validation.checks.ServicehandlerComplianceCheck;
 import org.opendaylight.transportpce.servicehandler.validation.ServiceCreateValidation;
 import org.opendaylight.transportpce.servicehandler.validation.checks.ComplianceCheckResult;
 import org.opendaylight.transportpce.servicehandler.validation.checks.ServicehandlerComplianceCheck;
@@ -39,6 +43,8 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev2
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.configuration.response.common.ConfigurationResponseCommon;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.sdnc.request.header.SdncRequestHeaderBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.configuration.response.common.ConfigurationResponseCommon;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.sdnc.request.header.SdncRequestHeaderBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.OpenroadmOperationalModes;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev211210.operational.mode.catalog.SpecificOperationalModes;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.HardConstraints;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.SoftConstraints;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddOpenroadmOperationalModesToCatalogInput;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.HardConstraints;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.SoftConstraints;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddOpenroadmOperationalModesToCatalogInput;
@@ -135,6 +141,8 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
     private static final String SERVICE_FEASIBILITY_CHECK_MSG = "serviceFeasibilityCheck: {}";
     private static final String SERVICE_DELETE_MSG = "serviceDelete: {}";
     private static final String SERVICE_CREATE_MSG = "serviceCreate: {}";
     private static final String SERVICE_FEASIBILITY_CHECK_MSG = "serviceFeasibilityCheck: {}";
     private static final String SERVICE_DELETE_MSG = "serviceDelete: {}";
     private static final String SERVICE_CREATE_MSG = "serviceCreate: {}";
+    private static final String ADD_OR_TO_CATALOG_MSG = "addORToCatalog: {}";
+    private static final String ADD_SPECIFIC_TO_CATALOG_MSG = "addSpecificToCatalog: {}";
 
     private DataBroker db;
     private ServiceDataStoreOperations serviceDataStoreOperations;
 
     private DataBroker db;
     private ServiceDataStoreOperations serviceDataStoreOperations;
@@ -144,14 +152,17 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
     private RendererListenerImpl rendererListenerImpl;
     private NetworkModelListenerImpl networkModelListenerImpl;
     private NotificationPublishService notificationPublishService;
     private RendererListenerImpl rendererListenerImpl;
     private NetworkModelListenerImpl networkModelListenerImpl;
     private NotificationPublishService notificationPublishService;
+    private CatalogDataStoreOperations catalogDataStoreOperations;
 
     //TODO: remove private request fields as they are in global scope
 
     public ServicehandlerImpl(DataBroker databroker, PathComputationService pathComputationService,
             RendererServiceOperations rendererServiceOperations, NotificationPublishService notificationPublishService,
             PceListenerImpl pceListenerImpl, RendererListenerImpl rendererListenerImpl,
 
     //TODO: remove private request fields as they are in global scope
 
     public ServicehandlerImpl(DataBroker databroker, PathComputationService pathComputationService,
             RendererServiceOperations rendererServiceOperations, NotificationPublishService notificationPublishService,
             PceListenerImpl pceListenerImpl, RendererListenerImpl rendererListenerImpl,
-            NetworkModelListenerImpl networkModelListenerImpl, ServiceDataStoreOperations serviceDataStoreOperations) {
+            NetworkModelListenerImpl networkModelListenerImpl, ServiceDataStoreOperations serviceDataStoreOperations,
+                              CatalogDataStoreOperations catalogDataStoreOperations) {
         this.db = databroker;
         this.db = databroker;
+        this.catalogDataStoreOperations = catalogDataStoreOperations;
         this.serviceDataStoreOperations = serviceDataStoreOperations;
         this.pceServiceWrapper = new PCEServiceWrapper(pathComputationService, notificationPublishService);
         this.rendererServiceWrapper = new RendererServiceWrapper(rendererServiceOperations, notificationPublishService);
         this.serviceDataStoreOperations = serviceDataStoreOperations;
         this.pceServiceWrapper = new PCEServiceWrapper(pathComputationService, notificationPublishService);
         this.rendererServiceWrapper = new RendererServiceWrapper(rendererServiceOperations, notificationPublishService);
@@ -172,6 +183,8 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
         public static final String SERVICE_NON_COMPLIANT;
         public static final String RENDERER_DELETE_FAILED;
         public static final String ABORT_VALID_FAILED;
         public static final String SERVICE_NON_COMPLIANT;
         public static final String RENDERER_DELETE_FAILED;
         public static final String ABORT_VALID_FAILED;
+        public static final String ABORT_OR_TO_CATALOG_FAILED;
+        public static final String ABORT_SPECIFIC_TO_CATALOG_FAILED;
 
         // Static blocks are generated once and spare memory.
         static {
 
         // Static blocks are generated once and spare memory.
         static {
@@ -182,6 +195,8 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
             SERVICE_NON_COMPLIANT = "non-compliant service";
             RENDERER_DELETE_FAILED = "Renderer service delete failed";
             ABORT_VALID_FAILED = "Aborting: validation of service create request failed";
             SERVICE_NON_COMPLIANT = "non-compliant service";
             RENDERER_DELETE_FAILED = "Renderer service delete failed";
             ABORT_VALID_FAILED = "Aborting: validation of service create request failed";
+            ABORT_OR_TO_CATALOG_FAILED = "Aborting: validation of add OR to catalog request failed";
+            ABORT_SPECIFIC_TO_CATALOG_FAILED = "Aborting: validation of add Specific to catalog request failed";
         }
 
         public static String serviceInDS(String serviceName) {
         }
 
         public static String serviceInDS(String serviceName) {
@@ -787,17 +802,71 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
     }
 
     @Override
     }
 
     @Override
+    /**
+     * Implementation of the RPC to set OR  operational modes in the catalog of the controller.
+     * Semantics of the RPC is such that the information in the input replaces the full content
+     * of the OR operational modes catalog in the config data store. Incremental changes to the
+     * catalog, if required, must be done via individual PUT/POST/DELETE RESTconf APIs.
+     *
+     * @param input AddOpenroadmOperationalModesToCatalogInput to be added to Catalog
+     * @return Result of the request
+     */
     public ListenableFuture<RpcResult<AddOpenroadmOperationalModesToCatalogOutput>>
     public ListenableFuture<RpcResult<AddOpenroadmOperationalModesToCatalogOutput>>
-            addOpenroadmOperationalModesToCatalog(AddOpenroadmOperationalModesToCatalogInput input) {
-        // TODO Auto-generated method stub
-        return null;
+        addOpenroadmOperationalModesToCatalog(AddOpenroadmOperationalModesToCatalogInput input) {
+
+        LOG.info("RPC addOpenroadmOperationalModesToCatalog in progress");
+        LOG.debug(" Input openRoadm {}", input);
+        // Validation
+        OperationResult validationResult = CatalogValidation.validateORCatalogRequest(
+                new CatalogInput(input), RpcActions.FillCatalogWithOrOperationalModes);
+        if (! validationResult.isSuccess()) {
+            LOG.warn(ADD_OR_TO_CATALOG_MSG, LogMessages.ABORT_OR_TO_CATALOG_FAILED);
+            return ModelMappingUtils.addOpenroadmServiceReply(
+                    input, ResponseCodes.FINAL_ACK_YES,
+                    validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
+        }
+        LOG.info(" Request System Id {} " ,input.getSdncRequestHeader().getRequestSystemId());
+        LOG.info(" Rpc Action {} " ,input.getSdncRequestHeader().getRpcAction());
+
+        OpenroadmOperationalModes objToSave = CatalogMapper.createORModesToSave(input);
+        catalogDataStoreOperations.addOpenroadmOperationalModesToCatalog(objToSave);
+        LOG.info("RPC addOpenroadmOperationalModesToCatalog Completed");
+        return ModelMappingUtils.addOpenroadmServiceReply(input, ResponseCodes.FINAL_ACK_YES,
+                validationResult.getResultMessage(), ResponseCodes.RESPONSE_OK);
     }
 
     @Override
     }
 
     @Override
+    /**
+     * Implementation of the RPC to set specific operational modes in the catalog of the controller.
+     * Semantics of the RPC is such that the information in the input replaces the full content
+     * of the specific operational modes catalog in the config data store. Incremental changes to the
+     * catalog, if required, must be done via individual PUT/POST/DELETE RESTconf APIs.
+     *
+     * @param input AddSpecificOperationalModesToCatalogInput to be added to Catalog
+     * @return Result of the request
+     */
     public ListenableFuture<RpcResult<AddSpecificOperationalModesToCatalogOutput>> addSpecificOperationalModesToCatalog(
             AddSpecificOperationalModesToCatalogInput input) {
     public ListenableFuture<RpcResult<AddSpecificOperationalModesToCatalogOutput>> addSpecificOperationalModesToCatalog(
             AddSpecificOperationalModesToCatalogInput input) {
-        // TODO Auto-generated method stub
-        return null;
+
+        LOG.info("RPC addSpecificOperationalModesToCatalog in progress");
+        LOG.debug(" Input openSpecificRoadm {}", input);
+        // Validation
+        OperationResult validationResult = CatalogValidation.validateSpecificCatalogRequest(
+                new CatalogInput(input), RpcActions.FillCatalogWithSpecificOperationalModes);
+        if (! validationResult.isSuccess()) {
+            LOG.warn(ADD_SPECIFIC_TO_CATALOG_MSG, LogMessages.ABORT_SPECIFIC_TO_CATALOG_FAILED);
+            return ModelMappingUtils.addSpecificOpenroadmServiceReply(
+                    input, ResponseCodes.FINAL_ACK_YES,
+                    validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
+        }
+        LOG.info(" Request System Id {} " ,input.getSdncRequestHeader().getRequestSystemId());
+        LOG.info(" Rpc Action {} " ,input.getSdncRequestHeader().getRpcAction());
+
+        SpecificOperationalModes objToSave = CatalogMapper.createSpecificModesToSave(input);
+        catalogDataStoreOperations.addSpecificOperationalModesToCatalog(objToSave);
+        LOG.info("RPC addSpecificOperationalModesToCatalog Completed");
+        return ModelMappingUtils.addSpecificOpenroadmServiceReply(input, ResponseCodes.FINAL_ACK_YES,
+                validationResult.getResultMessage(), ResponseCodes.RESPONSE_OK);
     }
 
     @Override
     }
 
     @Override
@@ -806,3 +875,4 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
         return null;
     }
 }
         return null;
     }
 }
+
index 379296038f85ed463703a7ad40961b0acf4a347a..b77e18eaa7f941a17ddb4491644585ae0963720a 100644 (file)
@@ -13,6 +13,7 @@ import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
 import org.opendaylight.mdsal.binding.api.NotificationService;
 import org.opendaylight.mdsal.binding.api.RpcProviderService;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.mdsal.binding.api.NotificationService;
 import org.opendaylight.mdsal.binding.api.RpcProviderService;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.transportpce.servicehandler.catalog.CatalogDataStoreOperations;
 import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
@@ -51,6 +52,7 @@ public class ServicehandlerProvider {
     private ListenerRegistration<TransportpceNetworkmodelListener> networkmodellistenerRegistration;
     private ObjectRegistration<OrgOpenroadmServiceService> rpcRegistration;
     private ServiceDataStoreOperations serviceDataStoreOperations;
     private ListenerRegistration<TransportpceNetworkmodelListener> networkmodellistenerRegistration;
     private ObjectRegistration<OrgOpenroadmServiceService> rpcRegistration;
     private ServiceDataStoreOperations serviceDataStoreOperations;
+    private CatalogDataStoreOperations catalogDataStoreOperations;
     private PceListenerImpl pceListenerImpl;
     private ServiceListener serviceListener;
     private RendererListenerImpl rendererListenerImpl;
     private PceListenerImpl pceListenerImpl;
     private ServiceListener serviceListener;
     private RendererListenerImpl rendererListenerImpl;
@@ -60,7 +62,8 @@ public class ServicehandlerProvider {
     public ServicehandlerProvider(final DataBroker dataBroker, RpcProviderService rpcProviderService,
             NotificationService notificationService, ServiceDataStoreOperations serviceDataStoreOperations,
             PceListenerImpl pceListenerImpl, ServiceListener serviceListener, RendererListenerImpl rendererListenerImpl,
     public ServicehandlerProvider(final DataBroker dataBroker, RpcProviderService rpcProviderService,
             NotificationService notificationService, ServiceDataStoreOperations serviceDataStoreOperations,
             PceListenerImpl pceListenerImpl, ServiceListener serviceListener, RendererListenerImpl rendererListenerImpl,
-            NetworkModelListenerImpl networkModelListenerImpl, ServicehandlerImpl servicehandler) {
+            NetworkModelListenerImpl networkModelListenerImpl, ServicehandlerImpl servicehandler,
+                                  CatalogDataStoreOperations catalogDataStoreOperations) {
         this.dataBroker = dataBroker;
         this.rpcService = rpcProviderService;
         this.notificationService = notificationService;
         this.dataBroker = dataBroker;
         this.rpcService = rpcProviderService;
         this.notificationService = notificationService;
@@ -71,6 +74,7 @@ public class ServicehandlerProvider {
         this.rendererListenerImpl = rendererListenerImpl;
         this.networkModelListenerImpl = networkModelListenerImpl;
         this.servicehandler = servicehandler;
         this.rendererListenerImpl = rendererListenerImpl;
         this.networkModelListenerImpl = networkModelListenerImpl;
         this.servicehandler = servicehandler;
+        this.catalogDataStoreOperations = catalogDataStoreOperations;
     }
 
     /**
     }
 
     /**
diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/utils/CatalogDataUtils.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/utils/CatalogDataUtils.java
new file mode 100644 (file)
index 0000000..00367ca
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright © 2022 Fujitsu Network Communications, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.servicehandler.utils;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.RpcActions;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.sdnc.request.header.SdncRequestHeaderBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddOpenroadmOperationalModesToCatalogInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddOpenroadmOperationalModesToCatalogInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddSpecificOperationalModesToCatalogInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddSpecificOperationalModesToCatalogInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.openroadm.operational.modes.to.catalog.input.OperationalModeInfoBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.openroadm.operational.modes.to.catalog.input.operational.mode.info.AmplifiersBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.openroadm.operational.modes.to.catalog.input.operational.mode.info.GridParametersBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.openroadm.operational.modes.to.catalog.input.operational.mode.info.RoadmsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.openroadm.operational.modes.to.catalog.input.operational.mode.info.XpondersPluggablesBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.openroadm.operational.modes.to.catalog.input.operational.mode.info.xponders.pluggables.XponderPluggableOpenroadmOperationalMode;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.openroadm.operational.modes.to.catalog.input.operational.mode.info.xponders.pluggables.XponderPluggableOpenroadmOperationalModeBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.openroadm.operational.modes.to.catalog.input.operational.mode.info.xponders.pluggables.XponderPluggableOpenroadmOperationalModeKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.specific.operational.modes.to.catalog.input.operational.mode.info.SpecificOperationalModesBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.specific.operational.modes.to.catalog.input.operational.mode.info.specific.operational.modes.SpecificOperationalMode;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.specific.operational.modes.to.catalog.input.operational.mode.info.specific.operational.modes.SpecificOperationalModeBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.specific.operational.modes.to.catalog.input.operational.mode.info.specific.operational.modes.SpecificOperationalModeKey;
+
+public final class CatalogDataUtils {
+
+    private CatalogDataUtils() {
+
+    }
+
+    public static AddOpenroadmOperationalModesToCatalogInput buildAddORToCatalogInput() {
+        Map<XponderPluggableOpenroadmOperationalModeKey, XponderPluggableOpenroadmOperationalMode> map = new
+                HashMap<>();
+        XponderPluggableOpenroadmOperationalModeBuilder modeBuilder = new
+                XponderPluggableOpenroadmOperationalModeBuilder();
+        XponderPluggableOpenroadmOperationalModeKey key = new
+                XponderPluggableOpenroadmOperationalModeKey("testOROperationalMode");
+        modeBuilder.setOpenroadmOperationalModeId(key.toString());
+        map.put(key, modeBuilder.build());
+        XpondersPluggablesBuilder xpondersPluggablesBuilder = new XpondersPluggablesBuilder()
+                .setXponderPluggableOpenroadmOperationalMode(map);
+
+        AddOpenroadmOperationalModesToCatalogInputBuilder builtInput = new
+                AddOpenroadmOperationalModesToCatalogInputBuilder()
+                .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("load-OM-Catalog")
+                        .setRequestSystemId("appname").setRpcAction(RpcActions.FillCatalogWithOrOperationalModes)
+                        .build()).setOperationalModeInfo(new OperationalModeInfoBuilder().setGridParameters(new
+                        GridParametersBuilder().build()).setXpondersPluggables(xpondersPluggablesBuilder
+                        .build()).setRoadms(new RoadmsBuilder().build()).setAmplifiers(new AmplifiersBuilder()
+                        .build()).build());
+        return builtInput.build();
+    }
+
+    public static AddSpecificOperationalModesToCatalogInput buildAddSpecificToCatalogInput() {
+
+        Map<SpecificOperationalModeKey, SpecificOperationalMode> map = new HashMap<>();
+        SpecificOperationalModeKey key = new SpecificOperationalModeKey("testSpecificOperationalMode");
+        SpecificOperationalModeBuilder modeBuilder = new SpecificOperationalModeBuilder();
+        modeBuilder.setOperationalModeId(key.toString());
+        map.put(key, modeBuilder.build());
+        SpecificOperationalModesBuilder specificOperationalModesBuilder = new SpecificOperationalModesBuilder()
+                .setSpecificOperationalMode(map);
+
+        AddSpecificOperationalModesToCatalogInputBuilder builtInput = new
+                AddSpecificOperationalModesToCatalogInputBuilder()
+                .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("load-specific-OM-Catalog")
+                        .setRequestSystemId("test").setRpcAction(RpcActions.FillCatalogWithSpecificOperationalModes)
+                        .build()).setOperationalModeInfo(new org.opendaylight.yang.gen.v1.http.org.openroadm.service
+                        .rev211210.add.specific.operational.modes.to.catalog.input.OperationalModeInfoBuilder()
+                        .setSpecificOperationalModes(specificOperationalModesBuilder.build()).build());
+        return builtInput.build();
+    }
+}
\ No newline at end of file
diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/validation/CatalogValidation.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/validation/CatalogValidation.java
new file mode 100644 (file)
index 0000000..246252e
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright © 2022 Fujitsu Network Communications, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.transportpce.servicehandler.validation;
+
+import org.opendaylight.transportpce.common.OperationResult;
+import org.opendaylight.transportpce.servicehandler.CatalogInput;
+import org.opendaylight.transportpce.servicehandler.validation.checks.ComplianceCheckResult;
+import org.opendaylight.transportpce.servicehandler.validation.checks.ServicehandlerComplianceCheck;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.RpcActions;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.sdnc.request.header.SdncRequestHeader;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.openroadm.operational.modes.to.catalog.input.OperationalModeInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public final class CatalogValidation {
+
+    private CatalogValidation() {
+    }
+
+    private static final Logger LOG = LoggerFactory.getLogger(CatalogValidation.class);
+
+    public static OperationResult validateORCatalogRequest(CatalogInput input, RpcActions rpcActions) {
+        /*
+         * -OR request header and operational mode info compliance are verified.
+         */
+        LOG.debug("checking OR Catalog Compliance ...");
+        SdncRequestHeader sdncRequestHeader = input.getSdncRequestHeader();
+        OperationalModeInfo operationalModeInfo = input.getOperationalModeInfo();
+        ComplianceCheckResult  serviceHandlerCheckResult = ServicehandlerComplianceCheck.checkORCatalog(
+                sdncRequestHeader, operationalModeInfo, rpcActions, true);
+        if (serviceHandlerCheckResult.hasPassed()) {
+            LOG.debug("Catalog OR request compliant !");
+        } else {
+            return OperationResult.failed(serviceHandlerCheckResult.getMessage());
+        }
+        return OperationResult.ok("Validation successful.");
+    }
+
+    public static OperationResult validateSpecificCatalogRequest(CatalogInput input, RpcActions rpcActions) {
+        /*
+         * -Specific request header and operational mode info compliance are verified.
+         */
+        LOG.debug("checking specific Catalog Compliance ...");
+        SdncRequestHeader sdncRequestHeader = input.getSdncRequestHeader();
+        org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.specific.operational.modes
+                .to.catalog.input.OperationalModeInfo operationalModeInfoSpecific = input
+                .getOperationalModeInfoSpecific();
+        ComplianceCheckResult  serviceHandlerCheckResult = ServicehandlerComplianceCheck.checkSpecificCatalog(
+                sdncRequestHeader, operationalModeInfoSpecific, rpcActions, true);
+        if (serviceHandlerCheckResult.hasPassed()) {
+            LOG.debug("Catalog specific request compliant !");
+        } else {
+            return OperationResult.failed(serviceHandlerCheckResult.getMessage());
+        }
+        return OperationResult.ok("Validation successful.");
+    }
+}
\ No newline at end of file
index 85b8a1d08c9ffef2d029bf27278c308618306ea6..f59a3e7d64cddd8357c3a024d6ed810611f5c725 100644 (file)
@@ -10,6 +10,9 @@ package org.opendaylight.transportpce.servicehandler.validation.checks;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.ConnectionType;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.RpcActions;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.sdnc.request.header.SdncRequestHeader;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.ConnectionType;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.RpcActions;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.sdnc.request.header.SdncRequestHeader;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.add.openroadm.operational.modes.to.catalog.input.OperationalModeInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Class for checking service sdnc-request-header compliance.
 
 /**
  * Class for checking service sdnc-request-header compliance.
@@ -17,6 +20,8 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev2
  */
 public final class ServicehandlerComplianceCheck {
 
  */
 public final class ServicehandlerComplianceCheck {
 
+    private static final Logger LOG = LoggerFactory.getLogger(ServicehandlerComplianceCheck.class);
+
     // This is class is public so that these messages can be accessed from Junit (avoid duplications).
     public static final class LogMessages {
 
     // This is class is public so that these messages can be accessed from Junit (avoid duplications).
     public static final class LogMessages {
 
@@ -26,6 +31,12 @@ public final class ServicehandlerComplianceCheck {
         public static final String RPCACTION_NOT_SET;
         public static final String HEADER_NOT_SET;
 
         public static final String RPCACTION_NOT_SET;
         public static final String HEADER_NOT_SET;
 
+        public static final String CATALOG_REQUESTID_NOT_SET;
+        public static final String CATALOG_HEADER_NOT_SET;
+        public static final String CATALOG_REQUESTSYSTEMID_NOT_SET;
+        public static final String CATALOG_RPCACTION_NOT_SET;
+        public static final String CATALOG_OPERATIONAL_MODE_INFO_NOT_SET;
+
         // Static blocks are generated once and spare memory.
         static {
             SERVICENAME_NOT_SET = "Service Name (common-id for Temp service) is not set";
         // Static blocks are generated once and spare memory.
         static {
             SERVICENAME_NOT_SET = "Service Name (common-id for Temp service) is not set";
@@ -33,6 +44,11 @@ public final class ServicehandlerComplianceCheck {
             REQUESTID_NOT_SET = "Service sdncRequestHeader 'request-id' is not set";
             RPCACTION_NOT_SET = "Service sdncRequestHeader 'rpc-action' is not set";
             HEADER_NOT_SET = "Service sdncRequestHeader is not set";
             REQUESTID_NOT_SET = "Service sdncRequestHeader 'request-id' is not set";
             RPCACTION_NOT_SET = "Service sdncRequestHeader 'rpc-action' is not set";
             HEADER_NOT_SET = "Service sdncRequestHeader is not set";
+            CATALOG_REQUESTID_NOT_SET = "sdnc-request-header 'request-id' is not set";
+            CATALOG_REQUESTSYSTEMID_NOT_SET = "sdnc-request-header 'request-system-id' is not set";
+            CATALOG_HEADER_NOT_SET = "sdnc-request-header is not set";
+            CATALOG_RPCACTION_NOT_SET = "sdnc-request-header 'rpc-action' is not set";
+            CATALOG_OPERATIONAL_MODE_INFO_NOT_SET = "operational-mode-info is not set";
         }
 
         public static String rpcactionsDiffers(RpcActions action1, RpcActions action2) {
         }
 
         public static String rpcactionsDiffers(RpcActions action1, RpcActions action2) {
@@ -40,6 +56,12 @@ public final class ServicehandlerComplianceCheck {
                 "Service sdncRequestHeader rpc-action '" + action1.name() + "' not equal to '" + action2.name() + "'";
         }
 
                 "Service sdncRequestHeader rpc-action '" + action1.name() + "' not equal to '" + action2.name() + "'";
         }
 
+        public static String catalogRpcactionsDiffers(RpcActions action1, RpcActions action2) {
+            return
+                    "Catalog sdnc-request-header rpc-action '" + action1.name() + "' not equal to '" + action2.name()
+                            + "'";
+        }
+
         private LogMessages() {
         }
     }
         private LogMessages() {
         }
     }
@@ -101,6 +123,61 @@ public final class ServicehandlerComplianceCheck {
         return new ComplianceCheckResult(true, "");
     }
 
         return new ComplianceCheckResult(true, "");
     }
 
+    public static ComplianceCheckResult checkORCatalog(SdncRequestHeader sdncRequestHeader,
+                                                       OperationalModeInfo operationalModeInfo, RpcActions action,
+                                                       Boolean sdncRequest) {
+
+        ComplianceCheckResult result = sdncRequestHeaderValidate(sdncRequest, sdncRequestHeader, action);
+        if (result.getMessage().contains("sdnc-request-header")) {
+            return new ComplianceCheckResult(false,result.getMessage());
+        }
+        if (operationalModeInfo == null) {
+            return new ComplianceCheckResult(false, LogMessages.CATALOG_OPERATIONAL_MODE_INFO_NOT_SET);
+        }
+
+        return new ComplianceCheckResult(true, "");
+    }
+
+    public static ComplianceCheckResult checkSpecificCatalog(SdncRequestHeader sdncRequestHeader, org.opendaylight.yang
+            .gen.v1.http.org.openroadm.service.rev211210.add.specific.operational.modes.to.catalog.input
+            .OperationalModeInfo operationalModeInfoSpecific, RpcActions action, Boolean sdncRequest) {
+
+        ComplianceCheckResult result = sdncRequestHeaderValidate(sdncRequest, sdncRequestHeader, action);
+        if (result.getMessage().contains("sdnc-request-header")) {
+            return new ComplianceCheckResult(false,result.getMessage());
+        }
+        if (operationalModeInfoSpecific == null) {
+            return new ComplianceCheckResult(false, LogMessages.CATALOG_OPERATIONAL_MODE_INFO_NOT_SET);
+        }
+        return new ComplianceCheckResult(true, "");
+    }
+
+    public static ComplianceCheckResult sdncRequestHeaderValidate(Boolean sdncRequest, SdncRequestHeader
+            sdncRequestHeader, RpcActions action) {
+        if (sdncRequest) {
+            if (sdncRequestHeader == null) {
+                return new ComplianceCheckResult(false, LogMessages.CATALOG_HEADER_NOT_SET);
+            }
+            RpcActions serviceAction = sdncRequestHeader.getRpcAction();
+            String requestId = sdncRequestHeader.getRequestId();
+            String requestSystemId = sdncRequestHeader.getRequestSystemId();
+            if (!checkString(requestId)) {
+                return new ComplianceCheckResult(false, LogMessages.CATALOG_REQUESTID_NOT_SET);
+            }
+            if (!checkString(requestSystemId)) {
+                return new ComplianceCheckResult(false, LogMessages.CATALOG_REQUESTSYSTEMID_NOT_SET);
+            }
+            if (serviceAction == null) {
+                return new ComplianceCheckResult(false, LogMessages.CATALOG_RPCACTION_NOT_SET);
+            }
+            if (serviceAction.compareTo(action) != 0) {
+                return new ComplianceCheckResult(false, LogMessages.catalogRpcactionsDiffers(serviceAction, action));
+            }
+        }
+        return new ComplianceCheckResult(true, "");
+    }
+
+
     private ServicehandlerComplianceCheck() {
     }
 
     private ServicehandlerComplianceCheck() {
     }
 
index 1de4c6a4eb7c7a0815c2ff65d1c498c322cdab25..6b4b3eaabd662217386f5ac7767e4d0dde9dc54a 100644 (file)
@@ -34,6 +34,10 @@ Author: Martial Coulibaly <martial.coulibaly@gfi.com> on behalf of Orange
         <argument ref="dataBroker"/>
       </bean>
 
         <argument ref="dataBroker"/>
       </bean>
 
+    <bean id="catalogDatastoreOperation" class="org.opendaylight.transportpce.servicehandler.catalog.CatalogDataStoreOperationsImpl">
+        <argument ref="dataBroker"/>
+    </bean>
+
     <bean id="pceListener" class="org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl">
         <argument ref="rendererServiceOperations" />
         <argument ref="pathComputationService" />
     <bean id="pceListener" class="org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl">
         <argument ref="rendererServiceOperations" />
         <argument ref="pathComputationService" />
@@ -67,6 +71,7 @@ Author: Martial Coulibaly <martial.coulibaly@gfi.com> on behalf of Orange
         <argument ref="rendererListener" />
         <argument ref="networkModelListener" />
         <argument ref="serviceDatastoreOperation" />
         <argument ref="rendererListener" />
         <argument ref="networkModelListener" />
         <argument ref="serviceDatastoreOperation" />
+        <argument ref="catalogDatastoreOperation" />
     </bean>
 
     <bean id="provider"
     </bean>
 
     <bean id="provider"
@@ -81,10 +86,15 @@ Author: Martial Coulibaly <martial.coulibaly@gfi.com> on behalf of Orange
         <argument ref="rendererListener" />
         <argument ref="networkModelListener" />
         <argument ref="serviceHandlerImpl" />
         <argument ref="rendererListener" />
         <argument ref="networkModelListener" />
         <argument ref="serviceHandlerImpl" />
+        <argument ref="catalogDatastoreOperation" />
     </bean>
 
     <service ref="serviceHandlerImpl"
         interface="org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OrgOpenroadmServiceService"/>
     <service ref="serviceDatastoreOperation"
         interface="org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations"/>
     </bean>
 
     <service ref="serviceHandlerImpl"
         interface="org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OrgOpenroadmServiceService"/>
     <service ref="serviceDatastoreOperation"
         interface="org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations"/>
+    <service ref="catalogDatastoreOperation"
+             interface="org.opendaylight.transportpce.servicehandler.catalog.CatalogDataStoreOperations"/>
+
 </blueprint>
 </blueprint>
+
index 1806f20e6de2a486c3b1930414e1a46a76550205..40fdc03a1cc668f534bdfaa898a8119fd1b7bb49 100644 (file)
@@ -22,6 +22,7 @@ import java.util.Optional;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Executors;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Executors;
+import org.junit.Assert;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
@@ -32,17 +33,26 @@ import org.opendaylight.transportpce.common.ResponseCodes;
 import org.opendaylight.transportpce.pce.service.PathComputationService;
 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
 import org.opendaylight.transportpce.servicehandler.ServiceInput;
 import org.opendaylight.transportpce.pce.service.PathComputationService;
 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
 import org.opendaylight.transportpce.servicehandler.ServiceInput;
+import org.opendaylight.transportpce.servicehandler.catalog.CatalogDataStoreOperations;
+import org.opendaylight.transportpce.servicehandler.catalog.CatalogDataStoreOperationsImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperationsImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperationsImpl;
+import org.opendaylight.transportpce.servicehandler.utils.CatalogDataUtils;
 import org.opendaylight.transportpce.servicehandler.utils.ServiceDataUtils;
 import org.opendaylight.transportpce.test.AbstractTest;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRequestOutputBuilder;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRerouteRequestOutputBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.configuration.response.common.ConfigurationResponseCommonBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
 import org.opendaylight.transportpce.servicehandler.utils.ServiceDataUtils;
 import org.opendaylight.transportpce.test.AbstractTest;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRequestOutputBuilder;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRerouteRequestOutputBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.configuration.response.common.ConfigurationResponseCommonBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddOpenroadmOperationalModesToCatalogInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddOpenroadmOperationalModesToCatalogInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddOpenroadmOperationalModesToCatalogOutput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddSpecificOperationalModesToCatalogInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddSpecificOperationalModesToCatalogInputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddSpecificOperationalModesToCatalogOutput;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateInput;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateInputBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateOutput;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateInput;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateInputBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateOutput;
@@ -97,6 +107,7 @@ public class ServicehandlerImplTest extends AbstractTest {
     private NetworkModelListenerImpl networkModelListenerImpl;
 
     private ServiceDataStoreOperations serviceDataStoreOperations;
     private NetworkModelListenerImpl networkModelListenerImpl;
 
     private ServiceDataStoreOperations serviceDataStoreOperations;
+    private CatalogDataStoreOperations catalogDataStoreOperations;
     private ServiceCreateInput serviceCreateInput;
     private ServiceDeleteInput serviceDeleteInput;
     private ServiceReconfigureInput serviceReconfigureInput;
     private ServiceCreateInput serviceCreateInput;
     private ServiceDeleteInput serviceDeleteInput;
     private ServiceReconfigureInput serviceReconfigureInput;
@@ -111,6 +122,7 @@ public class ServicehandlerImplTest extends AbstractTest {
         executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUM_THREADS));
         endSignal = new CountDownLatch(1);
         this.serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(getNewDataBroker());
         executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUM_THREADS));
         endSignal = new CountDownLatch(1);
         this.serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(getNewDataBroker());
+        this.catalogDataStoreOperations = new CatalogDataStoreOperationsImpl(getNewDataBroker());
         serviceCreateInput = ServiceDataUtils.buildServiceCreateInput();
         serviceDeleteInput = ServiceDataUtils.buildServiceDeleteInput();
         serviceReconfigureInput = ServiceDataUtils.buildServiceReconfigureInput();
         serviceCreateInput = ServiceDataUtils.buildServiceCreateInput();
         serviceDeleteInput = ServiceDataUtils.buildServiceDeleteInput();
         serviceReconfigureInput = ServiceDataUtils.buildServiceReconfigureInput();
@@ -122,7 +134,7 @@ public class ServicehandlerImplTest extends AbstractTest {
     void createServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                     rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
     void createServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                     rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                    networkModelListenerImpl, serviceDataStoreOperations);
+                    networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         ListenableFuture<RpcResult<ServiceCreateOutput>> result = servicehandlerImpl
             .serviceCreate(new ServiceCreateInputBuilder().build());
         result.addListener(() -> endSignal.countDown(), executorService);
         ListenableFuture<RpcResult<ServiceCreateOutput>> result = servicehandlerImpl
             .serviceCreate(new ServiceCreateInputBuilder().build());
         result.addListener(() -> endSignal.countDown(), executorService);
@@ -143,7 +155,7 @@ public class ServicehandlerImplTest extends AbstractTest {
                                 .build()));
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
                                 .build()));
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDSOperations);
+                networkModelListenerImpl, serviceDSOperations, catalogDataStoreOperations);
         ListenableFuture<RpcResult<ServiceCreateOutput>> result = servicehandlerImpl.serviceCreate(serviceCreateInput);
         result.addListener(() -> endSignal.countDown(), executorService);
 
         ListenableFuture<RpcResult<ServiceCreateOutput>> result = servicehandlerImpl.serviceCreate(serviceCreateInput);
         result.addListener(() -> endSignal.countDown(), executorService);
 
@@ -159,7 +171,7 @@ public class ServicehandlerImplTest extends AbstractTest {
         when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
         when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDataStoreOperations);
+                networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         ListenableFuture<RpcResult<ServiceCreateOutput>> result = servicehandlerImpl.serviceCreate(serviceCreateInput);
         result.addListener(() -> endSignal.countDown(), executorService);
 
         ListenableFuture<RpcResult<ServiceCreateOutput>> result = servicehandlerImpl.serviceCreate(serviceCreateInput);
         result.addListener(() -> endSignal.countDown(), executorService);
 
@@ -173,7 +185,7 @@ public class ServicehandlerImplTest extends AbstractTest {
     void deleteServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
     void deleteServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDataStoreOperations);
+                networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(
                 new ServiceDeleteInputBuilder()
                         .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder()
         ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(
                 new ServiceDeleteInputBuilder()
                         .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder()
@@ -193,7 +205,7 @@ public class ServicehandlerImplTest extends AbstractTest {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
                         notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
                         notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
-                        serviceDataStoreOperations);
+                        serviceDataStoreOperations, catalogDataStoreOperations);
         ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(serviceDeleteInput);
         result.addListener(() -> endSignal.countDown(), executorService);
 
         ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(serviceDeleteInput);
         result.addListener(() -> endSignal.countDown(), executorService);
 
@@ -208,7 +220,7 @@ public class ServicehandlerImplTest extends AbstractTest {
         when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
         when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDataStoreOperations);
+                networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         serviceDataStoreOperations.createService(serviceCreateInput);
         ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(serviceDeleteInput);
         result.addListener(() -> endSignal.countDown(), executorService);
         serviceDataStoreOperations.createService(serviceCreateInput);
         ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(serviceDeleteInput);
         result.addListener(() -> endSignal.countDown(), executorService);
@@ -224,7 +236,7 @@ public class ServicehandlerImplTest extends AbstractTest {
     void serviceFeasibilityCheckShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
     void serviceFeasibilityCheckShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDataStoreOperations);
+                networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
                 servicehandlerImpl.serviceFeasibilityCheck(new ServiceFeasibilityCheckInputBuilder().build());
         result.addListener(() -> endSignal.countDown(), executorService);
         ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
                 servicehandlerImpl.serviceFeasibilityCheck(new ServiceFeasibilityCheckInputBuilder().build());
         result.addListener(() -> endSignal.countDown(), executorService);
@@ -241,7 +253,7 @@ public class ServicehandlerImplTest extends AbstractTest {
         when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
         when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDataStoreOperations);
+                networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
                 servicehandlerImpl.serviceFeasibilityCheck(ServiceDataUtils.buildServiceFeasibilityCheckInput());
         result.addListener(() -> endSignal.countDown(), executorService);
         ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
                 servicehandlerImpl.serviceFeasibilityCheck(ServiceDataUtils.buildServiceFeasibilityCheckInput());
         result.addListener(() -> endSignal.countDown(), executorService);
@@ -256,7 +268,7 @@ public class ServicehandlerImplTest extends AbstractTest {
     void serviceReconfigureShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
     void serviceReconfigureShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDataStoreOperations);
+                networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         ListenableFuture<RpcResult<ServiceReconfigureOutput>> result =
                 servicehandlerImpl.serviceReconfigure(new ServiceReconfigureInputBuilder().setServiceName("").build());
         result.addListener(() -> endSignal.countDown(), executorService);
         ListenableFuture<RpcResult<ServiceReconfigureOutput>> result =
                 servicehandlerImpl.serviceReconfigure(new ServiceReconfigureInputBuilder().setServiceName("").build());
         result.addListener(() -> endSignal.countDown(), executorService);
@@ -270,7 +282,7 @@ public class ServicehandlerImplTest extends AbstractTest {
         //action -> service reconfigure
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
         //action -> service reconfigure
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDataStoreOperations);
+                networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         ListenableFuture<RpcResult<ServiceReconfigureOutput>> result = servicehandlerImpl.serviceReconfigure(
                 serviceReconfigureInput);
 
         ListenableFuture<RpcResult<ServiceReconfigureOutput>> result = servicehandlerImpl.serviceReconfigure(
                 serviceReconfigureInput);
 
@@ -286,7 +298,7 @@ public class ServicehandlerImplTest extends AbstractTest {
         //create service to reconfigure
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
         //create service to reconfigure
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDataStoreOperations);
+                networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         serviceDataStoreOperations.createService(serviceCreateInput);
 
         //service reconfigure test action
         serviceDataStoreOperations.createService(serviceCreateInput);
 
         //service reconfigure test action
@@ -302,7 +314,7 @@ public class ServicehandlerImplTest extends AbstractTest {
     void serviceReRestorationShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
     void serviceReRestorationShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDataStoreOperations);
+                networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         ListenableFuture<RpcResult<ServiceRestorationOutput>> result = servicehandlerImpl
             .serviceRestoration(new ServiceRestorationInputBuilder().setServiceName("").build());
         result.addListener(() -> endSignal.countDown(), executorService);
         ListenableFuture<RpcResult<ServiceRestorationOutput>> result = servicehandlerImpl
             .serviceRestoration(new ServiceRestorationInputBuilder().setServiceName("").build());
         result.addListener(() -> endSignal.countDown(), executorService);
@@ -316,7 +328,7 @@ public class ServicehandlerImplTest extends AbstractTest {
         //action -> service restore
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
         //action -> service restore
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDataStoreOperations);
+                networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         ListenableFuture<RpcResult<ServiceRestorationOutput>> result = servicehandlerImpl.serviceRestoration(
                 serviceRestorationInput);
 
         ListenableFuture<RpcResult<ServiceRestorationOutput>> result = servicehandlerImpl.serviceRestoration(
                 serviceRestorationInput);
 
@@ -332,7 +344,7 @@ public class ServicehandlerImplTest extends AbstractTest {
         //create service to restore
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
         //create service to restore
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDataStoreOperations);
+                networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         serviceDataStoreOperations.createService(serviceCreateInput);
 
         //service Restoration test action
         serviceDataStoreOperations.createService(serviceCreateInput);
 
         //service Restoration test action
@@ -348,7 +360,7 @@ public class ServicehandlerImplTest extends AbstractTest {
     void serviceRerouteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
     void serviceRerouteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDataStoreOperations);
+                networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         ListenableFuture<RpcResult<ServiceRerouteOutput>> result =
                 servicehandlerImpl.serviceReroute(new ServiceRerouteInputBuilder().setServiceName("").build());
         result.addListener(() -> endSignal.countDown(), executorService);
         ListenableFuture<RpcResult<ServiceRerouteOutput>> result =
                 servicehandlerImpl.serviceReroute(new ServiceRerouteInputBuilder().setServiceName("").build());
         result.addListener(() -> endSignal.countDown(), executorService);
@@ -365,7 +377,7 @@ public class ServicehandlerImplTest extends AbstractTest {
         //action -> service reconfigure
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
         //action -> service reconfigure
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDataStoreOperations);
+                networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         ListenableFuture<RpcResult<ServiceRerouteOutput>> result = servicehandlerImpl
             .serviceReroute(serviceRerouteInput);
 
         ListenableFuture<RpcResult<ServiceRerouteOutput>> result = servicehandlerImpl
             .serviceReroute(serviceRerouteInput);
 
@@ -439,7 +451,7 @@ public class ServicehandlerImplTest extends AbstractTest {
         serviceDataStoreOperations.createService(serviceCreateInput);
         ListenableFuture<RpcResult<ServiceRerouteOutput>> result =  new ServicehandlerImpl(getNewDataBroker(),
                 pathComputationService, rendererServiceOperations, notificationPublishService, pceListenerImpl,
         serviceDataStoreOperations.createService(serviceCreateInput);
         ListenableFuture<RpcResult<ServiceRerouteOutput>> result =  new ServicehandlerImpl(getNewDataBroker(),
                 pathComputationService, rendererServiceOperations, notificationPublishService, pceListenerImpl,
-                rendererListenerImpl, networkModelListenerImpl, serviceDataStoreOperations)
+                rendererListenerImpl, networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations)
                 .serviceReroute(serviceRerouteInput);
         result.addListener(() -> endSignal.countDown(), executorService);
 
                 .serviceReroute(serviceRerouteInput);
         result.addListener(() -> endSignal.countDown(), executorService);
 
@@ -454,7 +466,7 @@ public class ServicehandlerImplTest extends AbstractTest {
     void tempServiceDeleteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
     void tempServiceDeleteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDataStoreOperations);
+                networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         ListenableFuture<RpcResult<TempServiceDeleteOutput>> result =
                 servicehandlerImpl.tempServiceDelete(new TempServiceDeleteInputBuilder().setCommonId("").build());
         result.addListener(() -> endSignal.countDown(), executorService);
         ListenableFuture<RpcResult<TempServiceDeleteOutput>> result =
                 servicehandlerImpl.tempServiceDelete(new TempServiceDeleteInputBuilder().setCommonId("").build());
         result.addListener(() -> endSignal.countDown(), executorService);
@@ -474,7 +486,7 @@ public class ServicehandlerImplTest extends AbstractTest {
     void tempServiceDeleteShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
     void tempServiceDeleteShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDataStoreOperations);
+                networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         ListenableFuture<RpcResult<TempServiceDeleteOutput>> result = servicehandlerImpl.tempServiceDelete(
                 ServiceDataUtils.buildTempServiceDeleteInput());
         result.addListener(() -> endSignal.countDown(), executorService);
         ListenableFuture<RpcResult<TempServiceDeleteOutput>> result = servicehandlerImpl.tempServiceDelete(
                 ServiceDataUtils.buildTempServiceDeleteInput());
         result.addListener(() -> endSignal.countDown(), executorService);
@@ -492,7 +504,7 @@ public class ServicehandlerImplTest extends AbstractTest {
         //create temp service to delete in the temp delete action
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
         //create temp service to delete in the temp delete action
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDataStoreOperations);
+                networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         TempServiceCreateInput createInput = ServiceDataUtils.buildTempServiceCreateInput();
         serviceDataStoreOperations.createTempService(createInput);
 
         TempServiceCreateInput createInput = ServiceDataUtils.buildTempServiceCreateInput();
         serviceDataStoreOperations.createTempService(createInput);
 
@@ -510,7 +522,7 @@ public class ServicehandlerImplTest extends AbstractTest {
     void tempServiceCreateShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
     void tempServiceCreateShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDataStoreOperations);
+                networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
         ListenableFuture<RpcResult<TempServiceCreateOutput>> result =
                 servicehandlerImpl.tempServiceCreate(new TempServiceCreateInputBuilder().build());
         result.addListener(() -> endSignal.countDown(), executorService);
         ListenableFuture<RpcResult<TempServiceCreateOutput>> result =
                 servicehandlerImpl.tempServiceCreate(new TempServiceCreateInputBuilder().build());
         result.addListener(() -> endSignal.countDown(), executorService);
@@ -528,7 +540,7 @@ public class ServicehandlerImplTest extends AbstractTest {
 
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
 
         ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
                 rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-                networkModelListenerImpl, serviceDataStoreOperations);
+                networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
 
         ListenableFuture<RpcResult<TempServiceCreateOutput>> result = servicehandlerImpl.tempServiceCreate(
                 ServiceDataUtils.buildTempServiceCreateInput());
 
         ListenableFuture<RpcResult<TempServiceCreateOutput>> result = servicehandlerImpl.tempServiceCreate(
                 ServiceDataUtils.buildTempServiceCreateInput());
@@ -539,4 +551,66 @@ public class ServicehandlerImplTest extends AbstractTest {
             ResponseCodes.RESPONSE_OK,
             result.get().getResult().getConfigurationResponseCommon().getResponseCode());
     }
             ResponseCodes.RESPONSE_OK,
             result.get().getResult().getConfigurationResponseCommon().getResponseCode());
     }
+
+    @Test
+    public void addOpenroadmOperationalModesToCatalogShouldBeFailedWithEmptyInput() throws ExecutionException,
+            InterruptedException {
+        ServicehandlerImpl servicehandlerImpl =
+                new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
+                        serviceDataStoreOperations,catalogDataStoreOperations);
+        ListenableFuture<RpcResult<AddOpenroadmOperationalModesToCatalogOutput>> result = servicehandlerImpl
+                .addOpenroadmOperationalModesToCatalog(new AddOpenroadmOperationalModesToCatalogInputBuilder().build());
+        RpcResult<AddOpenroadmOperationalModesToCatalogOutput> rpcResult = result.get();
+        Assert.assertEquals(
+                ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon()
+                        .getResponseCode());
+    }
+
+    @Test
+    public void addSpecificOperationalModesToCatalogShouldBeFailedWithEmptyInput() throws ExecutionException,
+            InterruptedException {
+        ServicehandlerImpl servicehandlerImpl =
+                new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
+                        serviceDataStoreOperations,catalogDataStoreOperations);
+        ListenableFuture<RpcResult<AddSpecificOperationalModesToCatalogOutput>> result = servicehandlerImpl
+                .addSpecificOperationalModesToCatalog(new AddSpecificOperationalModesToCatalogInputBuilder().build());
+        RpcResult<AddSpecificOperationalModesToCatalogOutput> rpcResult = result.get();
+        Assert.assertEquals(
+                ResponseCodes.RESPONSE_FAILED, rpcResult.getResult().getConfigurationResponseCommon()
+                        .getResponseCode());
+    }
+
+    @Test
+    public void addOpenroadmOperationalModesToCatalogShouldBeSuccessfulWhenAddORToCatalog() throws ExecutionException,
+            InterruptedException {
+        AddOpenroadmOperationalModesToCatalogInput input = CatalogDataUtils.buildAddORToCatalogInput();
+
+        ServicehandlerImpl servicehandlerImpl =
+                new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
+                        serviceDataStoreOperations,catalogDataStoreOperations);
+        ListenableFuture<RpcResult<AddOpenroadmOperationalModesToCatalogOutput>> result = servicehandlerImpl
+                .addOpenroadmOperationalModesToCatalog(input);
+        RpcResult<AddOpenroadmOperationalModesToCatalogOutput> rpcResult = result.get();
+        Assert.assertEquals(
+                ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
+    }
+
+    @Test
+    public void addSpecificOperationalModesToCatalogShouldBeSuccessfulWhenAddSpecificToCatalog() throws
+            ExecutionException, InterruptedException {
+        AddSpecificOperationalModesToCatalogInput input = CatalogDataUtils.buildAddSpecificToCatalogInput();
+
+        ServicehandlerImpl servicehandlerImpl =
+                new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
+                        serviceDataStoreOperations,catalogDataStoreOperations);
+        ListenableFuture<RpcResult<AddSpecificOperationalModesToCatalogOutput>> result = servicehandlerImpl
+                .addSpecificOperationalModesToCatalog(input);
+        RpcResult<AddSpecificOperationalModesToCatalogOutput> rpcResult = result.get();
+        Assert.assertEquals(
+                ResponseCodes.RESPONSE_OK, rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
+    }
 }
\ No newline at end of file
 }
\ No newline at end of file
index b6da6dd72e5e91cd7036bd9573efe6852462cb7a..d7ed6b725bc28793724eca2706e43a6abb85a968 100644 (file)
@@ -16,6 +16,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.Mock;
 import org.mockito.junit.jupiter.MockitoExtension;
 import org.opendaylight.mdsal.binding.api.RpcProviderService;
 import org.mockito.Mock;
 import org.mockito.junit.jupiter.MockitoExtension;
 import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.transportpce.servicehandler.catalog.CatalogDataStoreOperations;
 import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
@@ -31,6 +32,8 @@ public class ServicehandlerProviderTest  extends AbstractTest {
     @Mock
     ServiceDataStoreOperations serviceDataStoreOperations;
     @Mock
     @Mock
     ServiceDataStoreOperations serviceDataStoreOperations;
     @Mock
+    CatalogDataStoreOperations catalogDataStoreOperations;
+    @Mock
     PceListenerImpl pceListenerImpl;
     @Mock
     ServiceListener serviceListener;
     PceListenerImpl pceListenerImpl;
     @Mock
     ServiceListener serviceListener;
@@ -47,7 +50,7 @@ public class ServicehandlerProviderTest  extends AbstractTest {
         ServicehandlerProvider provider =  new ServicehandlerProvider(
                 getDataBroker(), rpcProviderRegistry,
                 getNotificationService() , serviceDataStoreOperations, pceListenerImpl, serviceListener,
         ServicehandlerProvider provider =  new ServicehandlerProvider(
                 getDataBroker(), rpcProviderRegistry,
                 getNotificationService() , serviceDataStoreOperations, pceListenerImpl, serviceListener,
-                rendererListenerImpl, networkModelListenerImpl, servicehandler);
+                rendererListenerImpl, networkModelListenerImpl, servicehandler, catalogDataStoreOperations);
 
         provider.init();
 
 
         provider.init();
 
index bb0ae8789630a0ecdca6eb9cd47fc25b85b09abb..1da08b825b2749bfd33a27113eecc7042ddd85c3 100644 (file)
@@ -31,6 +31,8 @@ import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
 import org.opendaylight.transportpce.pce.service.PathComputationService;
 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
 import org.opendaylight.transportpce.pce.service.PathComputationService;
 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
+import org.opendaylight.transportpce.servicehandler.catalog.CatalogDataStoreOperations;
+import org.opendaylight.transportpce.servicehandler.catalog.CatalogDataStoreOperationsImpl;
 import org.opendaylight.transportpce.servicehandler.impl.ServicehandlerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
 import org.opendaylight.transportpce.servicehandler.impl.ServicehandlerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
@@ -85,6 +87,7 @@ public class TapiConnectivityImplTest extends AbstractTest {
 
     private static final Logger LOG = LoggerFactory.getLogger(TapiConnectivityImplTest.class);
     private static ServiceDataStoreOperations serviceDataStoreOperations;
 
     private static final Logger LOG = LoggerFactory.getLogger(TapiConnectivityImplTest.class);
     private static ServiceDataStoreOperations serviceDataStoreOperations;
+    public static CatalogDataStoreOperations catalogDataStoreOperations;
     private static TapiContext tapiContext;
     private static TopologyUtils topologyUtils;
     private static ConnectivityUtils connectivityUtils;
     private static TapiContext tapiContext;
     private static TopologyUtils topologyUtils;
     private static ConnectivityUtils connectivityUtils;
@@ -112,6 +115,7 @@ public class TapiConnectivityImplTest extends AbstractTest {
         networkTransactionService = new NetworkTransactionImpl(getDataBroker());
         tapilink = new TapiLink(networkTransactionService);
         serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(getDataStoreContextUtil().getDataBroker());
         networkTransactionService = new NetworkTransactionImpl(getDataBroker());
         tapilink = new TapiLink(networkTransactionService);
         serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(getDataStoreContextUtil().getDataBroker());
+        catalogDataStoreOperations = new CatalogDataStoreOperationsImpl(getDataStoreContextUtil().getDataBroker());
         tapiContext = new TapiContext(networkTransactionService);
         topologyUtils = new TopologyUtils(networkTransactionService, getDataStoreContextUtil().getDataBroker(),
             tapilink);
         tapiContext = new TapiContext(networkTransactionService);
         topologyUtils = new TopologyUtils(networkTransactionService, getDataStoreContextUtil().getDataBroker(),
             tapilink);
@@ -127,7 +131,7 @@ public class TapiConnectivityImplTest extends AbstractTest {
     void createConnServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
             rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
     void createConnServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
             rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-            networkModelListenerImpl, serviceDataStoreOperations);
+            networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
 
         TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
             tapipceListenerImpl, tapirendererListenerImpl);
 
         TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
             tapipceListenerImpl, tapirendererListenerImpl);
@@ -152,7 +156,7 @@ public class TapiConnectivityImplTest extends AbstractTest {
             throws ExecutionException, InterruptedException {
         OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
             rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
             throws ExecutionException, InterruptedException {
         OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
             rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-            networkModelListenerImpl, serviceDataStoreOperations);
+            networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
 
         CreateConnectivityServiceInput input = TapiConnectivityDataUtils.buildConnServiceCreateInput();
         when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
 
         CreateConnectivityServiceInput input = TapiConnectivityDataUtils.buildConnServiceCreateInput();
         when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
@@ -178,7 +182,7 @@ public class TapiConnectivityImplTest extends AbstractTest {
     void deleteConnServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
             rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
     void deleteConnServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
             rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-            networkModelListenerImpl, serviceDataStoreOperations);
+            networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
 
         TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
             tapipceListenerImpl, tapirendererListenerImpl);
 
         TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
             tapipceListenerImpl, tapirendererListenerImpl);
@@ -203,7 +207,7 @@ public class TapiConnectivityImplTest extends AbstractTest {
         DeleteConnectivityServiceInput input = TapiConnectivityDataUtils.buildConnServiceDeleteInput1();
         OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
             rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
         DeleteConnectivityServiceInput input = TapiConnectivityDataUtils.buildConnServiceDeleteInput1();
         OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
             rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-            networkModelListenerImpl, serviceDataStoreOperations);
+            networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
 
         TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
             tapipceListenerImpl, tapirendererListenerImpl);
 
         TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
             tapipceListenerImpl, tapirendererListenerImpl);
@@ -228,7 +232,7 @@ public class TapiConnectivityImplTest extends AbstractTest {
 
         OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
             rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
 
         OrgOpenroadmServiceService serviceHandler = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
             rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
-            networkModelListenerImpl, serviceDataStoreOperations);
+            networkModelListenerImpl, serviceDataStoreOperations, catalogDataStoreOperations);
 
         TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
             tapipceListenerImpl, tapirendererListenerImpl);
 
         TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
             tapipceListenerImpl, tapirendererListenerImpl);