summaryrefslogtreecommitdiffstats
path: root/integration-test
diff options
context:
space:
mode:
Diffstat (limited to 'integration-test')
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy4
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpRestApiSpec.groovy7
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/performance/base/NcmpPerfTestBase.groovy16
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryByAlternateIdPerfTest.groovy53
-rw-r--r--integration-test/src/test/resources/application.yml9
-rw-r--r--integration-test/src/test/resources/data/ncmp-registry/innerCmHandleNode.json24
6 files changed, 106 insertions, 7 deletions
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy
index 44fc258355..6952b2ad37 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/base/CpsIntegrationSpecBase.groovy
@@ -27,6 +27,7 @@ import static org.onap.cps.ncmp.api.impl.ncmppersistence.NcmpPersistence.NCMP_DM
import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter
import okhttp3.mockwebserver.MockWebServer
+import org.onap.cps.ncmp.api.impl.inventory.InventoryPersistence
import org.onap.cps.api.CpsAnchorService
import org.onap.cps.api.CpsDataService
import org.onap.cps.api.CpsDataspaceService
@@ -110,6 +111,9 @@ abstract class CpsIntegrationSpecBase extends Specification {
@Autowired
JsonObjectMapper jsonObjectMapper
+ @Autowired
+ InventoryPersistence inventoryPersistence
+
MockWebServer mockDmiServer = null
DmiDispatcher dmiDispatcher = new DmiDispatcher()
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpRestApiSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpRestApiSpec.groovy
index 950cd65e72..5325f1a86e 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpRestApiSpec.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/NcmpRestApiSpec.groovy
@@ -20,9 +20,6 @@
package org.onap.cps.integration.functional
-import org.onap.cps.integration.base.CpsIntegrationSpecBase
-import org.springframework.http.MediaType
-import spock.util.concurrent.PollingConditions
import static org.hamcrest.Matchers.containsInAnyOrder
import static org.hamcrest.Matchers.hasSize
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
@@ -30,6 +27,10 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
+import org.onap.cps.integration.base.CpsIntegrationSpecBase
+import org.springframework.http.MediaType
+import spock.util.concurrent.PollingConditions
+
class NcmpRestApiSpec extends CpsIntegrationSpecBase {
def 'Register CM Handles using REST API.'() {
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/NcmpPerfTestBase.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/NcmpPerfTestBase.groovy
index 4b39e53273..cbbf1d9be0 100644
--- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/NcmpPerfTestBase.groovy
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/base/NcmpPerfTestBase.groovy
@@ -20,6 +20,9 @@
package org.onap.cps.integration.performance.base
+import static org.onap.cps.ncmp.api.impl.ncmppersistence.NcmpPersistence.NCMP_DATASPACE_NAME
+import static org.onap.cps.ncmp.api.impl.ncmppersistence.NcmpPersistence.NCMP_DMI_REGISTRY_ANCHOR
+
import org.onap.cps.integration.ResourceMeter
import org.onap.cps.spi.FetchDescendantsOption
@@ -60,6 +63,7 @@ class NcmpPerfTestBase extends PerfTestBase {
def createInitialData() {
addRegistryData()
+ addRegistryDataWithAlternateIdAsPath()
addCmSubscriptionData()
}
@@ -79,6 +83,18 @@ class NcmpPerfTestBase extends PerfTestBase {
}
}
+ def addRegistryDataWithAlternateIdAsPath() {
+ def innerNodeJsonTemplate = readResourceDataFile('ncmp-registry/innerCmHandleNode.json')
+ def batchSize = 10
+ for (def i = 0; i < TOTAL_CM_HANDLES; i += batchSize) {
+ def data = '{ "cm-handles": [' + (1..batchSize).collect {
+ innerNodeJsonTemplate.replace('CM_HANDLE_ID_HERE', (it + i).toString())
+ .replace('ALTERNATE_ID_AS_PATH', (it + i).toString())
+ }.join(',') + ']}'
+ cpsDataService.saveListElements(NCMP_DATASPACE_NAME, NCMP_DMI_REGISTRY_ANCHOR, '/dmi-registry', data, now)
+ }
+ }
+
def createCmDataSubscriptionsSchemaSet() {
def modelAsString = readResourceDataFile('cm-data-subscriptions/cm-data-subscriptions@2023-09-21.yang')
cpsModuleService.createSchemaSet(NCMP_PERFORMANCE_TEST_DATASPACE, CM_DATA_SUBSCRIPTIONS_SCHEMA_SET, [registry: modelAsString])
diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryByAlternateIdPerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryByAlternateIdPerfTest.groovy
new file mode 100644
index 0000000000..bbff5a83ff
--- /dev/null
+++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryByAlternateIdPerfTest.groovy
@@ -0,0 +1,53 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2024 Nordix Foundation
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the 'License');
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an 'AS IS' BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.cps.integration.performance.ncmp
+
+import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS
+
+import org.onap.cps.ncmp.api.impl.ncmppersistence.NcmpPersistence
+import org.onap.cps.ncmp.api.impl.inventory.InventoryPersistence
+import org.onap.cps.integration.ResourceMeter
+import org.onap.cps.integration.performance.base.NcmpPerfTestBase
+import java.util.stream.Collectors
+
+class CmHandleQueryByAlternateIdPerfTest extends NcmpPerfTestBase {
+
+ InventoryPersistence objectUnderTest
+ ResourceMeter resourceMeter = new ResourceMeter()
+
+ def setup() { objectUnderTest = inventoryPersistence }
+
+ def 'Query cm handle by longest match alternate id'() {
+ when: 'an alternate id as cps path query'
+ resourceMeter.start()
+ def cpsPath = "/a/b/c/d-5/e/f/g/h/i"
+ def dataNodes = objectUnderTest.getCmHandleDataNodeByLongestMatchAlternateId(cpsPath, '/')
+ and: 'the ids of the result are extracted and converted to xpath'
+ def cpsXpaths = dataNodes.stream().map(dataNode -> "/dmi-registry/cm-handles[@id='${dataNode.leaves.id}']".toString() ).collect(Collectors.toSet())
+ and: 'a single get is executed to get all the parent objects and their descendants'
+ cpsDataService.getDataNodesForMultipleXpaths(NcmpPersistence.NCMP_DATASPACE_NAME, NcmpPersistence.NCMP_DMI_REGISTRY_ANCHOR, cpsXpaths, OMIT_DESCENDANTS)
+ resourceMeter.stop()
+ def durationInSeconds = resourceMeter.getTotalTimeInSeconds()
+ print 'Total time in seconds to query ch handle by alternate id: ' + durationInSeconds
+ then: 'the required operations are performed within required time and memory limit'
+ recordAndAssertResourceUsage('CpsPath Registry attributes Query', 1, durationInSeconds, 300, resourceMeter.getTotalMemoryUsageInMB())
+ }
+}
diff --git a/integration-test/src/test/resources/application.yml b/integration-test/src/test/resources/application.yml
index 6fd3bcae4e..a4b9ea9c40 100644
--- a/integration-test/src/test/resources/application.yml
+++ b/integration-test/src/test/resources/application.yml
@@ -97,10 +97,10 @@ app:
async-m2m:
topic: ${NCMP_ASYNC_M2M_TOPIC:ncmp-async-m2m}
avc:
- subscription-topic: ${NCMP_CM_AVC_SUBSCRIPTION:subscription}
- subscription-forward-topic-prefix: ${NCMP_FORWARD_CM_AVC_SUBSCRIPTION:ncmp-dmi-cm-avc-subscription-}
- subscription-response-topic: ${NCMP_RESPONSE_CM_AVC_SUBSCRIPTION:dmi-ncmp-cm-avc-subscription}
- subscription-outcome-topic: ${NCMP_OUTCOME_CM_AVC_SUBSCRIPTION:subscription-response}
+ cm-subscription-ncmp-in: ${CM_SUBSCRIPTION_NCMP_IN_TOPIC:subscription}
+ cm-subscription-dmi-in: ${CM_SUBSCRIPTION_DMI_IN_TOPIC:ncmp-dmi-cm-avc-subscription}
+ cm-subscription-dmi-out: ${CM_SUBSCRIPTION_DMI_OUT_TOPIC:dmi-ncmp-cm-avc-subscription}
+ cm-subscription-ncmp-out: ${CM_SUBSCRIPTION_NCMP_OUT_TOPIC:subscription-response}
cm-events-topic: ${NCMP_CM_EVENTS_TOPIC:cm-events}
lcm:
events:
@@ -169,6 +169,7 @@ ncmp:
maximumConnectionsPerRoute: 50
maximumConnectionsTotal: 100
idleConnectionEvictionThresholdInSeconds: 5
+ maximumInMemorySizeInMegabytes: 16
auth:
username: dmi
password: dmi
diff --git a/integration-test/src/test/resources/data/ncmp-registry/innerCmHandleNode.json b/integration-test/src/test/resources/data/ncmp-registry/innerCmHandleNode.json
new file mode 100644
index 0000000000..88446c4a0f
--- /dev/null
+++ b/integration-test/src/test/resources/data/ncmp-registry/innerCmHandleNode.json
@@ -0,0 +1,24 @@
+{
+ "id": "cm-handle-CM_HANDLE_ID_HERE",
+ "alternate-id": "/a/b/c/d-ALTERNATE_ID_AS_PATH",
+ "module-set-tag": "my-module-set-tag",
+ "dmi-service-name": "http://ncmp-dmi-plugin-stub:8080",
+ "dmi-data-service-name": "",
+ "dmi-model-service-name": "",
+ "additional-properties": [
+ {
+ "name": "neType",
+ "value": "RadioNode"
+ }
+ ],
+ "state": {
+ "cm-handle-state": "READY",
+ "last-update-time": "2023-03-01T19:18:33.571+0000",
+ "data-sync-enabled": false,
+ "datastores": {
+ "operational": {
+ "sync-state": "NONE_REQUESTED"
+ }
+ }
+ }
+} \ No newline at end of file