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;
* Operations class for DMI data.
*/
@Component
+@Slf4j
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)
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)
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());
+ }
+ }
+
}
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
yangModelCmHandle.dmiServiceName = dmiServiceName
yangModelCmHandle.dmiProperties = dmiProperties
yangModelCmHandle.id = cmHandleId
+ yangModelCmHandle.compositeState = new CompositeState()
+ yangModelCmHandle.compositeState.cmHandleState = CmHandleState.READY
mockInventoryPersistence.getYangModelCmHandle(cmHandleId) >> yangModelCmHandle
}
}
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
:depth: 2
..
-.. ========================
-.. * * * JAKARTA * * *
-.. ========================
+.. ====================
+.. * * * KOHN * * *
+.. ====================
+
+Version: 3.1.0 (not released yet)
+=================================
+
+Release Data
+------------
-Version: 3.1.0
-==============
+--------------------------------------+--------------------------------------------------------+
| **CPS Project** | |
| | |
| **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 |
| | |
+--------------------------------------+--------------------------------------------------------+
--------
- `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
==============