From: sourabh_sourabh Date: Wed, 12 Mar 2025 15:45:52 +0000 (+0000) Subject: Batch fetch all CM-handles for faster data job X-Git-Tag: 3.6.2~42 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=5157f49e4c9b2be38d0c287d4c5ee35a6222160e;p=cps.git Batch fetch all CM-handles for faster data job This optimizes the write data job for the use-case where most there will be many write operations affecting many CM-handles. It works by fetching ALL CM-handles into memory. Issue-ID: CPS-2692 Change-Id: I3a51a9f799ff7521a2a3736440482538de6aa204 Signed-off-by: sourabh_sourabh --- diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/datajobs/WriteRequestExaminer.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/datajobs/WriteRequestExaminer.java index 429a3790d4..f200aa2ad7 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/datajobs/WriteRequestExaminer.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/datajobs/WriteRequestExaminer.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2024 Nordix Foundation + * Copyright (C) 2024-2025 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,8 +21,8 @@ package org.onap.cps.ncmp.impl.datajobs; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import lombok.RequiredArgsConstructor; @@ -31,7 +31,9 @@ import org.onap.cps.ncmp.api.datajobs.models.DataJobWriteRequest; import org.onap.cps.ncmp.api.datajobs.models.DmiWriteOperation; import org.onap.cps.ncmp.api.datajobs.models.ProducerKey; import org.onap.cps.ncmp.api.datajobs.models.WriteOperation; -import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle; +import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle; +import org.onap.cps.ncmp.impl.dmi.DmiServiceNameResolver; +import org.onap.cps.ncmp.impl.inventory.ParameterizedCmHandleQueryService; import org.onap.cps.ncmp.impl.models.RequiredDmiService; import org.onap.cps.ncmp.impl.utils.AlternateIdMatcher; import org.springframework.stereotype.Service; @@ -42,6 +44,7 @@ import org.springframework.stereotype.Service; public class WriteRequestExaminer { private final AlternateIdMatcher alternateIdMatcher; + private final ParameterizedCmHandleQueryService parameterizedCmHandleQueryService; private static final String PATH_SEPARATOR = "/"; /** @@ -52,25 +55,35 @@ public class WriteRequestExaminer { * @return {@code Map} map of Dmi Write Operations per Producer Key */ public Map> splitDmiWriteOperationsFromRequest( - final String dataJobId, - final DataJobWriteRequest dataJobWriteRequest) { + final String dataJobId, final DataJobWriteRequest dataJobWriteRequest) { final Map> dmiWriteOperationsPerProducerKey = new HashMap<>(); + final Map cmHandlePerAlternateId = getAllNcmpServiceCmHandlesWithoutProperties(); for (final WriteOperation writeOperation : dataJobWriteRequest.data()) { - examineWriteOperation(dataJobId, dmiWriteOperationsPerProducerKey, writeOperation); + examineWriteOperation(dataJobId, dmiWriteOperationsPerProducerKey, writeOperation, cmHandlePerAlternateId); } return dmiWriteOperationsPerProducerKey; } + private Map getAllNcmpServiceCmHandlesWithoutProperties() { + final Map ncmpServiceCmHandles = new HashMap<>(); + for (final NcmpServiceCmHandle ncmpServiceCmHandle + : parameterizedCmHandleQueryService.getAllCmHandlesWithoutProperties()) { + ncmpServiceCmHandles.put(ncmpServiceCmHandle.getAlternateId(), ncmpServiceCmHandle); + } + return ncmpServiceCmHandles; + } + private void examineWriteOperation(final String dataJobId, final Map> dmiWriteOperationsPerProducerKey, - final WriteOperation writeOperation) { + final WriteOperation writeOperation, + final Map cmHandlePerAlternateId) { log.debug("data job id for write operation is: {}", dataJobId); - final YangModelCmHandle yangModelCmHandle = alternateIdMatcher - .getYangModelCmHandleByLongestMatchingAlternateId(writeOperation.path(), PATH_SEPARATOR); + final NcmpServiceCmHandle ncmpServiceCmHandle = alternateIdMatcher + .getCmHandleByLongestMatchingAlternateId(writeOperation.path(), PATH_SEPARATOR, cmHandlePerAlternateId); - final DmiWriteOperation dmiWriteOperation = createDmiWriteOperation(writeOperation, yangModelCmHandle); + final DmiWriteOperation dmiWriteOperation = createDmiWriteOperation(writeOperation, ncmpServiceCmHandle); - final ProducerKey producerKey = createProducerKey(yangModelCmHandle); + final ProducerKey producerKey = createProducerKey(ncmpServiceCmHandle); final List dmiWriteOperations; if (dmiWriteOperationsPerProducerKey.containsKey(producerKey)) { dmiWriteOperations = dmiWriteOperationsPerProducerKey.get(producerKey); @@ -81,27 +94,20 @@ public class WriteRequestExaminer { dmiWriteOperations.add(dmiWriteOperation); } - private ProducerKey createProducerKey(final YangModelCmHandle yangModelCmHandle) { - return new ProducerKey(yangModelCmHandle.resolveDmiServiceName(RequiredDmiService.DATA), - yangModelCmHandle.getDataProducerIdentifier()); + private ProducerKey createProducerKey(final NcmpServiceCmHandle ncmpServiceCmHandle) { + final String dmiDataServiceName = + DmiServiceNameResolver.resolveDmiServiceName(RequiredDmiService.DATA, ncmpServiceCmHandle); + return new ProducerKey(dmiDataServiceName, ncmpServiceCmHandle.getDataProducerIdentifier()); } private DmiWriteOperation createDmiWriteOperation(final WriteOperation writeOperation, - final YangModelCmHandle yangModelCmHandle) { + final NcmpServiceCmHandle ncmpServiceCmHandle) { return new DmiWriteOperation( writeOperation.path(), writeOperation.op(), - yangModelCmHandle.getModuleSetTag(), + ncmpServiceCmHandle.getModuleSetTag(), writeOperation.value(), writeOperation.operationId(), - getPrivatePropertiesFromDataNode(yangModelCmHandle)); + Collections.emptyMap()); // TODO: Private properties will be removed as part of CPS-2693. } - - private Map getPrivatePropertiesFromDataNode(final YangModelCmHandle yangModelCmHandle) { - final Map cmHandleDmiProperties = new LinkedHashMap<>(); - yangModelCmHandle.getDmiProperties() - .forEach(dmiProperty -> cmHandleDmiProperties.put(dmiProperty.getName(), dmiProperty.getValue())); - return cmHandleDmiProperties; - } - } diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryService.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryService.java index 3db4920d3e..fc8884433c 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryService.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryService.java @@ -75,4 +75,14 @@ public interface ParameterizedCmHandleQueryService { * @return collection of cm handles */ Collection getAllCmHandles(); + + /** + * Retrieves all {@code NcmpServiceCmHandle} instances without their associated properties. + * This method fetches the relevant data nodes from the inventory persistence layer and + * converts them into {@code NcmpServiceCmHandle} objects. Only the handles are returned, + * without any additional properties. + * + * @return a collection of {@code NcmpServiceCmHandle} instances without properties. + */ + Collection getAllCmHandlesWithoutProperties(); } diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceImpl.java index 4c1032efad..c44234d28c 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceImpl.java @@ -97,7 +97,16 @@ public class ParameterizedCmHandleQueryServiceImpl implements ParameterizedCmHan @Override public Collection getAllCmHandles() { - final DataNode dataNode = inventoryPersistence.getDataNode(NCMP_DMI_REGISTRY_PARENT).iterator().next(); + return toNcmpServiceCmHandles(inventoryPersistence.getDataNode(NCMP_DMI_REGISTRY_PARENT)); + } + + @Override + public Collection getAllCmHandlesWithoutProperties() { + return toNcmpServiceCmHandles(inventoryPersistence.getDataNode(NCMP_DMI_REGISTRY_PARENT, DIRECT_CHILDREN_ONLY)); + } + + private Collection toNcmpServiceCmHandles(final Collection dataNodes) { + final DataNode dataNode = dataNodes.iterator().next(); return dataNode.getChildDataNodes().stream().map(this::createNcmpServiceCmHandle).collect(Collectors.toSet()); } diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/utils/AlternateIdMatcher.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/utils/AlternateIdMatcher.java index 750a5050f2..b8e4e7feda 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/utils/AlternateIdMatcher.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/utils/AlternateIdMatcher.java @@ -20,12 +20,12 @@ package org.onap.cps.ncmp.impl.utils; +import java.util.Map; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; -import org.onap.cps.ncmp.api.exceptions.CmHandleNotFoundException; +import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle; import org.onap.cps.ncmp.exceptions.NoAlternateIdMatchFoundException; import org.onap.cps.ncmp.impl.inventory.InventoryPersistence; -import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle; import org.onap.cps.utils.CpsValidator; import org.springframework.stereotype.Service; @@ -37,24 +37,26 @@ public class AlternateIdMatcher { private final CpsValidator cpsValidator; /** - * Get yang model cm handle that matches longest alternate id by removing elements + * Get cm handle that matches longest alternate id by removing elements * (as defined by the separator string) from right to left. * If alternate id contains a hash then all elements after that hash are ignored. * - * @param alternateId alternate ID - * @param separator a string that separates each element from the next. - * @return yang model cm handle + * @param alternateId alternate ID + * @param separator a string that separates each element from the next. + * @param cmHandlePerAlternateId all CM-handles by alternate ID + * @return ncmp service cm handle */ - public YangModelCmHandle getYangModelCmHandleByLongestMatchingAlternateId(final String alternateId, - final String separator) { + public NcmpServiceCmHandle getCmHandleByLongestMatchingAlternateId( + final String alternateId, final String separator, + final Map cmHandlePerAlternateId) { final String[] splitPath = alternateId.split("#", 2); String bestMatch = splitPath[0]; while (StringUtils.isNotEmpty(bestMatch)) { - try { - return inventoryPersistence.getYangModelCmHandleByAlternateId(bestMatch); - } catch (final CmHandleNotFoundException ignored) { - bestMatch = getParentPath(bestMatch, separator); + final NcmpServiceCmHandle ncmpServiceCmHandle = cmHandlePerAlternateId.get(bestMatch); + if (ncmpServiceCmHandle != null) { + return ncmpServiceCmHandle; } + bestMatch = getParentPath(bestMatch, separator); } throw new NoAlternateIdMatchFoundException(alternateId); } diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/datajobs/WriteRequestExaminerSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/datajobs/WriteRequestExaminerSpec.groovy index 6aa84d1c7f..d051927b3d 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/datajobs/WriteRequestExaminerSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/datajobs/WriteRequestExaminerSpec.groovy @@ -23,24 +23,27 @@ package org.onap.cps.ncmp.impl.datajobs import org.onap.cps.ncmp.api.datajobs.models.DataJobWriteRequest import org.onap.cps.ncmp.api.datajobs.models.WriteOperation import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle -import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle +import org.onap.cps.ncmp.impl.inventory.ParameterizedCmHandleQueryService import org.onap.cps.ncmp.impl.utils.AlternateIdMatcher import spock.lang.Specification class WriteRequestExaminerSpec extends Specification { def mockAlternateIdMatcher = Mock(AlternateIdMatcher) - def objectUnderTest = new WriteRequestExaminer(mockAlternateIdMatcher) + def mockParameterizedCmHandleQueryService = Mock(ParameterizedCmHandleQueryService) + def objectUnderTest = new WriteRequestExaminer(mockAlternateIdMatcher, mockParameterizedCmHandleQueryService) def setup() { - def ch1 = new YangModelCmHandle(id: 'ch1', dmiServiceName: 'dmiA', dataProducerIdentifier: 'p1', dmiProperties: []) - def ch2 = new YangModelCmHandle(id: 'ch2', dmiServiceName: 'dmiA', dataProducerIdentifier: 'p1', dmiProperties: []) - def ch3 = new YangModelCmHandle(id: 'ch3', dmiServiceName: 'dmiA', dataProducerIdentifier: 'p2', dmiProperties: []) - def ch4 = new YangModelCmHandle(id: 'ch4', dmiServiceName: 'dmiB', dataProducerIdentifier: 'p1', dmiProperties: []) - mockAlternateIdMatcher.getYangModelCmHandleByLongestMatchingAlternateId('fdn1', '/') >> ch1 - mockAlternateIdMatcher.getYangModelCmHandleByLongestMatchingAlternateId('fdn2', '/') >> ch2 - mockAlternateIdMatcher.getYangModelCmHandleByLongestMatchingAlternateId('fdn3', '/') >> ch3 - mockAlternateIdMatcher.getYangModelCmHandleByLongestMatchingAlternateId('fdn4', '/') >> ch4 + def ch1 = new NcmpServiceCmHandle(cmHandleId: 'ch1', dmiServiceName: 'dmiA', moduleSetTag: 'someModuleSetTag', alternateId: 'fdn1', dataProducerIdentifier: 'p1') + def ch2 = new NcmpServiceCmHandle(cmHandleId: 'ch2', dmiServiceName: 'dmiA', moduleSetTag: 'someModuleSetTag', alternateId: 'fdn2', dataProducerIdentifier: 'p1') + def ch3 = new NcmpServiceCmHandle(cmHandleId: 'ch3', dmiServiceName: 'dmiA', moduleSetTag: 'someModuleSetTag', alternateId: 'fdn3', dataProducerIdentifier: 'p2') + def ch4 = new NcmpServiceCmHandle(cmHandleId: 'ch4', dmiServiceName: 'dmiB', moduleSetTag: 'someModuleSetTag', alternateId: 'fdn4', dataProducerIdentifier: 'p1') + def cmHandlePerAlternateId = ['fdn1': ch1, 'fdn2': ch2, 'fdn3': ch3, 'fdn4': ch4] + mockAlternateIdMatcher.getCmHandleByLongestMatchingAlternateId('fdn1', '/', cmHandlePerAlternateId) >> ch1 + mockAlternateIdMatcher.getCmHandleByLongestMatchingAlternateId('fdn2', '/', cmHandlePerAlternateId) >> ch2 + mockAlternateIdMatcher.getCmHandleByLongestMatchingAlternateId('fdn3', '/', cmHandlePerAlternateId) >> ch3 + mockAlternateIdMatcher.getCmHandleByLongestMatchingAlternateId('fdn4', '/', cmHandlePerAlternateId) >> ch4 + mockParameterizedCmHandleQueryService.getAllCmHandlesWithoutProperties() >> [ch1, ch2, ch3, ch4] } def 'Create a map of dmi write requests per producer key with #scenario.'() { @@ -83,9 +86,9 @@ class WriteRequestExaminerSpec extends Specification { def 'Validate the creation of a ProducerKey with correct dmiservicename.'() { given: 'yangModelCmHandles with service name: "#dmiServiceName" and data service name: "#dataServiceName"' - def yangModelCmHandle = YangModelCmHandle.toYangModelCmHandle(dmiServiceName, dataServiceName, '', new NcmpServiceCmHandle(cmHandleId: 'cm-handle-id-1'), '', '', 'dpi1') + def ncmpServiceCmHandle = new NcmpServiceCmHandle(dmiServiceName: dmiServiceName, dmiDataServiceName: dataServiceName, dataProducerIdentifier: 'dpi1') when: 'the ProducerKey is created' - def result = objectUnderTest.createProducerKey(yangModelCmHandle).toString() + def result = objectUnderTest.createProducerKey(ncmpServiceCmHandle).toString() then: 'we get the ProducerKey with the correct service name' assert result == expectedProducerKey where: 'the following services are registered' diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/utils/AlternateIdMatcherSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/utils/AlternateIdMatcherSpec.groovy index b59dd1a55f..098e88a644 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/utils/AlternateIdMatcherSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/utils/AlternateIdMatcherSpec.groovy @@ -20,7 +20,7 @@ package org.onap.cps.ncmp.impl.utils -import org.onap.cps.ncmp.api.exceptions.CmHandleNotFoundException +import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle import org.onap.cps.ncmp.exceptions.NoAlternateIdMatchFoundException import org.onap.cps.ncmp.impl.inventory.InventoryPersistence import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle @@ -37,16 +37,12 @@ class AlternateIdMatcherSpec extends Specification { def objectUnderTest = new AlternateIdMatcher(mockInventoryPersistence, new CpsValidatorImpl()) - def setup() { - given: 'cm handle in the registry with alternate id /a/b' - mockInventoryPersistence.getYangModelCmHandleByAlternateId('/a/b') >> new YangModelCmHandle() - and: 'no other cm handle' - mockInventoryPersistence.getYangModelCmHandleByAlternateId(_) >> { throw new CmHandleNotFoundException('') } - } - def 'Finding longest alternate id matches.'() { + given: 'a cm handle with alternate id /a/b in the cached map of all cm handles' + def ch1 = new NcmpServiceCmHandle(cmHandleId: 'ch1', alternateId: '/a/b') + def cmHandlePerAlternateId = ['/a/b': ch1] expect: 'querying for alternate id a matching result found' - assert objectUnderTest.getYangModelCmHandleByLongestMatchingAlternateId(targetAlternateId, '/') != null + assert objectUnderTest.getCmHandleByLongestMatchingAlternateId(targetAlternateId, '/', cmHandlePerAlternateId) != null where: 'the following parameters are used' scenario | targetAlternateId 'exact match' | '/a/b' @@ -61,7 +57,7 @@ class AlternateIdMatcherSpec extends Specification { def 'Attempt to find longest alternate id match without any matches.'() { when: 'attempt to find alternateId' - objectUnderTest.getYangModelCmHandleByLongestMatchingAlternateId(targetAlternateId, '/') + objectUnderTest.getCmHandleByLongestMatchingAlternateId(targetAlternateId, '/', [:]) then: 'no alternate id match found exception thrown' def thrown = thrown(NoAlternateIdMatchFoundException) and: 'the exception has the relevant details from the error response' 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 deleted file mode 100644 index cd2fc6ed7e..0000000000 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/CmHandleQueryByAlternateIdPerfTest.groovy +++ /dev/null @@ -1,55 +0,0 @@ -/* - * ============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 org.onap.cps.integration.ResourceMeter -import org.onap.cps.integration.performance.base.NcmpPerfTestBase -import org.onap.cps.ncmp.impl.utils.AlternateIdMatcher - -import java.util.stream.Collectors - -import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DATASPACE_NAME -import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DMI_REGISTRY_ANCHOR -import static org.onap.cps.api.parameters.FetchDescendantsOption.OMIT_DESCENDANTS - -class CmHandleQueryByAlternateIdPerfTest extends NcmpPerfTestBase { - - AlternateIdMatcher objectUnderTest - ResourceMeter resourceMeter = new ResourceMeter() - - def setup() { objectUnderTest = alternateIdMatcher } - - 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.getYangModelCmHandleByLongestMatchingAlternateId(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(NCMP_DATASPACE_NAME, 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('Look up cm-handle by longest match alternate-id', 1, durationInSeconds, 300, resourceMeter.getTotalMemoryUsageInMB()) - } -} diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/WriteDataJobPerfTest.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/WriteDataJobPerfTest.groovy index 27ff155471..c71426032d 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/WriteDataJobPerfTest.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/performance/ncmp/WriteDataJobPerfTest.groovy @@ -27,6 +27,7 @@ import org.onap.cps.ncmp.api.datajobs.models.DataJobMetadata import org.onap.cps.ncmp.api.datajobs.models.DataJobWriteRequest import org.onap.cps.ncmp.api.datajobs.models.WriteOperation import org.springframework.beans.factory.annotation.Autowired +import spock.lang.Ignore /** * This test does not depend on common performance test data. Hence it just extends the integration spec base. @@ -49,21 +50,18 @@ class WriteDataJobPerfTest extends CpsIntegrationSpecBase { return new DataJobWriteRequest(writeOperations) } + @Ignore // CPS-2691 def 'Performance test for writeDataJob method'() { - given: 'register 1,000 cm handles (with alternative ids)' - registerSequenceOfCmHandlesWithManyModuleReferencesButDoNotWaitForReady(DMI1_URL, 'tagA', 1000, 1, ModuleNameStrategy.UNIQUE, { it -> "/SubNetwork=Europe/SubNetwork=Ireland/MeContext=MyRadioNode${it}/ManagedElement=MyManagedElement${it}" }) - def authorization = 'my authorization header' - def numberOfWriteOperations = 1000 - def dataJobWriteRequest = populateDataJobWriteRequests(numberOfWriteOperations) - def myDataJobMetadata = new DataJobMetadata('d1', '', '') - def dataJobId = 'my-data-job-id' + given: 'register 10_000 cm handles (with alternative ids)' + registerSequenceOfCmHandlesWithManyModuleReferencesButDoNotWaitForReady(DMI1_URL, 'tagA', 10_000, 1, ModuleNameStrategy.UNIQUE, { it -> "/SubNetwork=Europe/SubNetwork=Ireland/MeContext=MyRadioNode${it}/ManagedElement=MyManagedElement${it}" }) + def dataJobWriteRequest = populateDataJobWriteRequests(10_000) when: 'sending a write job to NCMP with dynamically generated write operations' resourceMeter.start() - dataJobService.writeDataJob(authorization, dataJobId, myDataJobMetadata, dataJobWriteRequest) + dataJobService.writeDataJob('', '', new DataJobMetadata('d1', '', ''), dataJobWriteRequest) resourceMeter.stop() then: 'record the result. Not asserted, just recorded in See https://lf-onap.atlassian.net/browse/CPS-2691' println "*** CPS-2691 Execution time: ${resourceMeter.totalTimeInSeconds} seconds" cleanup: 'deregister test cm handles' - deregisterSequenceOfCmHandles(DMI1_URL, 1000, 1) + deregisterSequenceOfCmHandles(DMI1_URL, 10_000, 1) } }