Merge "Publish LCM Events"
authorJoseph Keenan <joseph.keenan@est.tech>
Tue, 21 Jun 2022 09:30:08 +0000 (09:30 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 21 Jun 2022 09:30:08 +0000 (09:30 +0000)
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiDataOperations.java
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/operations/DmiOperationsBaseSpec.groovy
csit/tests/cps-model-sync/cps-model-sync.robot
docs/release-notes.rst

index d409a80..d0e17d4 100644 (file)
@@ -25,11 +25,14 @@ import static org.onap.cps.ncmp.api.impl.operations.DmiOperations.DataStoreEnum.
 import static org.onap.cps.ncmp.api.impl.operations.DmiRequestBody.OperationEnum;
 import static org.onap.cps.ncmp.api.impl.operations.DmiRequestBody.OperationEnum.READ;
 
+import lombok.extern.slf4j.Slf4j;
 import org.onap.cps.ncmp.api.impl.client.DmiRestClient;
 import org.onap.cps.ncmp.api.impl.config.NcmpConfiguration;
 import org.onap.cps.ncmp.api.impl.utils.DmiServiceUrlBuilder;
 import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle;
+import org.onap.cps.ncmp.api.inventory.CmHandleState;
 import org.onap.cps.ncmp.api.inventory.InventoryPersistence;
+import org.onap.cps.spi.exceptions.CpsException;
 import org.onap.cps.utils.CpsValidator;
 import org.onap.cps.utils.JsonObjectMapper;
 import org.springframework.http.ResponseEntity;
@@ -39,6 +42,7 @@ import org.springframework.stereotype.Component;
  * Operations class for DMI data.
  */
 @Component
+@Slf4j
 public class DmiDataOperations extends DmiOperations {
 
     /**
@@ -74,6 +78,8 @@ public class DmiDataOperations extends DmiOperations {
         CpsValidator.validateNameCharacters(cmHandleId);
         final YangModelCmHandle yangModelCmHandle =
                 inventoryPersistence.getYangModelCmHandle(cmHandleId);
+        final CmHandleState cmHandleState = yangModelCmHandle.getCompositeState().getCmHandleState();
+        isCmHandleStateReady(yangModelCmHandle, cmHandleState);
         final DmiRequestBody dmiRequestBody = DmiRequestBody.builder()
             .operation(READ)
             .requestId(requestId)
@@ -106,6 +112,8 @@ public class DmiDataOperations extends DmiOperations {
         CpsValidator.validateNameCharacters(cmHandleId);
         final YangModelCmHandle yangModelCmHandle =
             inventoryPersistence.getYangModelCmHandle(cmHandleId);
+        final CmHandleState cmHandleState = yangModelCmHandle.getCompositeState().getCmHandleState();
+        isCmHandleStateReady(yangModelCmHandle, cmHandleState);
         final DmiRequestBody dmiRequestBody = DmiRequestBody.builder()
             .operation(operation)
             .data(requestData)
@@ -120,4 +128,12 @@ public class DmiDataOperations extends DmiOperations {
         return dmiRestClient.postOperationWithJsonData(dmiUrl, jsonBody, operation);
     }
 
+    private void isCmHandleStateReady(final YangModelCmHandle yangModelCmHandle, final CmHandleState cmHandleState) {
+        if (cmHandleState != CmHandleState.READY) {
+            throw new CpsException("State mismatch exception.", "Cm-Handle not in READY state. "
+                + "cm handle state is "
+                + yangModelCmHandle.getCompositeState().getCmHandleState());
+        }
+    }
+
 }
index 193b94d..3a82ee3 100644 (file)
@@ -25,6 +25,8 @@ import org.onap.cps.ncmp.api.impl.client.DmiRestClient
 import org.onap.cps.ncmp.api.impl.config.NcmpConfiguration
 import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle
 import org.onap.cps.ncmp.api.impl.utils.DmiServiceUrlBuilder
+import org.onap.cps.ncmp.api.inventory.CmHandleState
+import org.onap.cps.ncmp.api.inventory.CompositeState
 import org.onap.cps.ncmp.api.inventory.InventoryPersistence
 import org.spockframework.spring.SpringBean
 import spock.lang.Shared
@@ -57,6 +59,8 @@ abstract class DmiOperationsBaseSpec extends Specification {
         yangModelCmHandle.dmiServiceName = dmiServiceName
         yangModelCmHandle.dmiProperties = dmiProperties
         yangModelCmHandle.id = cmHandleId
+        yangModelCmHandle.compositeState = new CompositeState()
+        yangModelCmHandle.compositeState.cmHandleState = CmHandleState.READY
         mockInventoryPersistence.getYangModelCmHandle(cmHandleId) >> yangModelCmHandle
     }
 }
index ea082b5..8554e26 100644 (file)
@@ -86,4 +86,5 @@ Get modules for registered data node
             IF   "${item['moduleName']}" == "stores"
                 Should Be Equal As Strings              "${item['revision']}"   "2020-09-15"
             END
-        END
+    END
+    Sleep    10
\ No newline at end of file
index a584b58..58dc060 100755 (executable)
@@ -12,12 +12,16 @@ CPS Release Notes
     :depth: 2
 ..
 
-..      ========================
-..      * * *   JAKARTA   * * *
-..      ========================
+..      ====================
+..      * * *   KOHN   * * *
+..      ====================
+
+Version: 3.1.0 (not released yet)
+=================================
+
+Release Data
+------------
 
-Version: 3.1.0
-==============
 +--------------------------------------+--------------------------------------------------------+
 | **CPS Project**                      |                                                        |
 |                                      |                                                        |
@@ -25,10 +29,10 @@ Version: 3.1.0
 | **Docker images**                    | onap/cps-and-ncmp:3.1.0                                |
 |                                      |                                                        |
 +--------------------------------------+--------------------------------------------------------+
-| **Release designation**              | 3.1.0 Jakarta                                          |
+| **Release designation**              | 3.1.0 Kohn                                             |
 |                                      |                                                        |
 +--------------------------------------+--------------------------------------------------------+
-| **Release date**                     |                                                        |
+| **Release date**                     | N/A                                                    |
 |                                      |                                                        |
 +--------------------------------------+--------------------------------------------------------+
 
@@ -36,6 +40,34 @@ Features
 --------
    - `CPS-322 <https://jira.onap.org/browse/CPS-322>`_  Implement additional validation for names and identifiers
 
+..      ========================
+..      * * *   JAKARTA   * * *
+..      ========================
+
+Version: 3.0.1
+==============
+
+Release Data
+------------
+
++--------------------------------------+--------------------------------------------------------+
+| **CPS Project**                      |                                                        |
+|                                      |                                                        |
++--------------------------------------+--------------------------------------------------------+
+| **Docker images**                    | onap/cps-and-ncmp:3.0.1                                |
+|                                      |                                                        |
++--------------------------------------+--------------------------------------------------------+
+| **Release designation**              | 3.0.1 Jakarta                                          |
+|                                      |                                                        |
++--------------------------------------+--------------------------------------------------------+
+| **Release date**                     | 2022 April 28                                          |
+|                                      |                                                        |
++--------------------------------------+--------------------------------------------------------+
+
+Bug Fixes
+---------
+   - `CPS-961 <https://jira.onap.org/browse/CPS-961>`_  Updated ANTLR compiler version to 4.9.2 to be compatible with runtime version
+
 Version: 3.0.0
 ==============