2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the 'License');
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an 'AS IS' BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.cps.integration.performance.ncmp
23 import org.onap.cps.integration.ResourceMeter
24 import org.onap.cps.integration.base.CpsIntegrationSpecBase
27 * This test does not depend on common performance test data. Hence it just extends the integration spec base.
29 class AlternateIdPerfTest extends CpsIntegrationSpecBase {
31 def resourceMeter = new ResourceMeter()
33 def NETWORK_SIZE = 10_000
34 def altIdPrefix = '/a=1/b=2/c=3/'
37 registerSequenceOfCmHandlesWithManyModuleReferencesButDoNotWaitForReady(DMI1_URL, 'tagA', NETWORK_SIZE, 1, altIdPrefix)
41 deregisterSequenceOfCmHandles(DMI1_URL, NETWORK_SIZE, 1)
44 def 'Alternate Id Lookup Performance.'() {
45 when: 'perform a 1,000 lookups by alternate id'
48 networkCmProxyInventoryFacade.getNcmpServiceCmHandle("${altIdPrefix}alt=${it}")
51 then: 'record the result. Not asserted, just recorded in See https://lf-onap.atlassian.net/browse/CPS-2605'
52 println "*** CPS-2605 Execution time: ${resourceMeter.totalTimeInSeconds} ms"
55 def 'Alternate Id Longest Match Performance.'() {
56 given: 'an offset at 90% of the network size, so matches are not at the start...'
57 def offset = (int) (0.9 * NETWORK_SIZE)
58 when: 'perform a 100 longest matches'
61 def target = "${altIdPrefix}alt=${it + offset}/d=4/e=5/f=6/g=7"
62 alternateIdMatcher.getCmHandleIdByLongestMatchingAlternateId(target, "/")
65 then: 'record the result. Not asserted, just recorded in See https://lf-onap.atlassian.net/browse/CPS-2743?focusedCommentId=83220'
66 println "*** CPS-2743 Execution time: ${resourceMeter.totalTimeInSeconds} ms"