Fix validation northbound cm handle searches 85/141385/2
authorToineSiebelink <toine.siebelink@est.tech>
Wed, 25 Jun 2025 12:22:38 +0000 (13:22 +0100)
committerToineSiebelink <toine.siebelink@est.tech>
Wed, 25 Jun 2025 13:48:00 +0000 (14:48 +0100)
- Renamed related methods and Enum using terms north (client facing) and southbound (dmi) for more clarity
- Northbound Cm Handle search was using the wrong Enum for validation (this caused the issue)
- Grouped and ordered renamed methods in facade impl
- Enums also had the wrong values: unsupported values in one and missing values in the other
  (southbound can/should support all possible queries, no reason not too)
TODO (separate subtasks and commits)
- Update RTD documentation to properly describe options in each ifc
- Update Postman collection to have cleared separation between north and southbound interfaces

Issue-ID: CPS-2864
Change-Id: I6523b368e504b5e99dde794e7e716193d2cadf23
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
12 files changed:
cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryController.java
cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy
cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryControllerSpec.groovy
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/NetworkCmProxyInventoryFacade.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/NetworkCmProxyInventoryFacadeImpl.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/ParameterizedCmHandleQueryServiceImpl.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/models/NorthboundCmHandleQuerySupportedConditions.java [moved from cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/models/CmHandleQueryConditions.java with 71% similarity]
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/models/SouthboundCmHandleQuerySupportedConditions.java [moved from cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/models/InventoryQueryConditions.java with 67% similarity]
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/NetworkCmProxyInventoryFacadeSpec.groovy
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/models/NorthboundCmHandleQuerySupportedConditionsSpec.groovy [moved from cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/models/CmHandleQueryConditionsSpec.groovy with 70% similarity]
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/models/SouthboundCmHandleQuerySupportedConditionsSpec.groovy [moved from cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/models/InventoryQueryConditionsSpec.groovy with 63% similarity]

index 258b884..fd4ced3 100644 (file)
@@ -266,9 +266,9 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
         final CmHandleQueryApiParameters cmHandleQueryApiParameters =
                 deprecationHelper.mapOldConditionProperties(cmHandleQueryParameters);
         final List<RestOutputCmHandle> restOutputCmHandles =
-                networkCmProxyInventoryFacade.executeCmHandleSearch(cmHandleQueryApiParameters)
-                        .map(handle -> restOutputCmHandleMapper
-                                .toRestOutputCmHandle(handle, false)).collectList().block();
+                networkCmProxyInventoryFacade.northboundCmHandleSearch(cmHandleQueryApiParameters)
+                        .map(ncmpServiceCmHandle -> restOutputCmHandleMapper
+                                .toRestOutputCmHandle(ncmpServiceCmHandle, false)).collectList().block();
         return ResponseEntity.ok(restOutputCmHandles);
     }
 
@@ -288,7 +288,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
         final CmHandleQueryApiParameters cmHandleQueryApiParameters =
                 jsonObjectMapper.convertToValueType(cmHandleQueryParameters, CmHandleQueryApiParameters.class);
         final Collection<String> cmHandleIds
-            = networkCmProxyInventoryFacade.executeCmHandleIdSearch(cmHandleQueryApiParameters, outputAlternateId);
+            = networkCmProxyInventoryFacade.northboundCmHandleIdSearch(cmHandleQueryApiParameters, outputAlternateId);
         return ResponseEntity.ok(List.copyOf(cmHandleIds));
     }
 
index 3a5102c..055ac7e 100644 (file)
@@ -75,7 +75,7 @@ public class NetworkCmProxyInventoryController implements NetworkCmProxyInventor
                 .toCmHandleQueryServiceParameters(cmHandleQueryParameters);
 
         final Collection<String> cmHandleIds = networkCmProxyInventoryFacade
-                .executeParameterizedCmHandleIdSearch(cmHandleQueryServiceParameters, outputAlternateId);
+                .southboundCmHandleIdSearch(cmHandleQueryServiceParameters, outputAlternateId);
         return ResponseEntity.ok(List.copyOf(cmHandleIds));
     }
 
@@ -94,9 +94,9 @@ public class NetworkCmProxyInventoryController implements NetworkCmProxyInventor
                 deprecationHelper.mapOldConditionProperties(cmHandleQueryParameters);
         final boolean includeCmHandlePropertiesParameter = Boolean.TRUE.equals(includeCmHandlePropertiesInQuery);
         final List<RestOutputCmHandle> restOutputCmHandles =
-                networkCmProxyInventoryFacade.executeCmHandleInventorySearch(cmHandleQueryApiParameters)
-                        .map(ncmpServiceCmHandle -> restOutputCmHandleMapper
-                            .toRestOutputCmHandle(ncmpServiceCmHandle, includeCmHandlePropertiesParameter))
+                networkCmProxyInventoryFacade.southboundCmHandleSearch(cmHandleQueryApiParameters)
+                        .map(handle -> restOutputCmHandleMapper
+                                .toRestOutputCmHandle(handle, includeCmHandlePropertiesParameter))
                         .collectList().block();
         return ResponseEntity.ok(restOutputCmHandles);
     }
index ce7ef1f..022bc13 100644 (file)
@@ -272,7 +272,7 @@ class NetworkCmProxyControllerSpec extends Specification {
         and: 'the inventory facade returns two cm handles'
             def ncmpServiceCmHandle1 = new NcmpServiceCmHandle(cmHandleId: 'ch-1')
             def ncmpServiceCmHandle2 = new NcmpServiceCmHandle(cmHandleId: 'ch-2')
-            mockNetworkCmProxyInventoryFacade.executeCmHandleSearch(_) >> Flux.fromIterable([ncmpServiceCmHandle1, ncmpServiceCmHandle2])
+            mockNetworkCmProxyInventoryFacade.northboundCmHandleSearch(_) >> Flux.fromIterable([ncmpServiceCmHandle1, ncmpServiceCmHandle2])
         and: 'mapper converts cm handles without private properties'
             def restHandle1 = new RestOutputCmHandle(cmHandle: 'rest ch-1')
             def restHandle2 = new RestOutputCmHandle(cmHandle: 'rest ch-2')
@@ -342,7 +342,7 @@ class NetworkCmProxyControllerSpec extends Specification {
         when: 'the searches api is invoked'
             mvc.perform(post(searchesEndpoint).contentType(MediaType.APPLICATION_JSON).content(jsonString))
         then: 'the request was still accepted and forwarded to the correct services'
-            1 * mockNetworkCmProxyInventoryFacade.executeCmHandleSearch(_) >> Flux.fromIterable([new NcmpServiceCmHandle()])
+            1 * mockNetworkCmProxyInventoryFacade.northboundCmHandleSearch(_) >> Flux.fromIterable([new NcmpServiceCmHandle()])
             1 * mockRestOutputCmHandleMapper.toRestOutputCmHandle(_, _) >> new RestOutputCmHandle(cmHandle: 'some cm handle')
     }
 
@@ -350,7 +350,7 @@ class NetworkCmProxyControllerSpec extends Specification {
         given: 'an endpoint and json data'
             def searchesEndpoint = "$ncmpBasePathV1/ch/id-searches"
         and: 'the service method is invoked with module names and returns cm handle ids'
-            1 * mockNetworkCmProxyInventoryFacade.executeCmHandleIdSearch(_, _) >> ['ch-1', 'ch-2']
+            1 * mockNetworkCmProxyInventoryFacade.northboundCmHandleIdSearch(_, _) >> ['ch-1', 'ch-2']
         when: 'the searches api is invoked'
             def response = mvc.perform(post(searchesEndpoint).contentType(MediaType.APPLICATION_JSON).content('{}')).andReturn().response
         then: 'cm handle ids are returned'
index 366d1af..90cbc84 100644 (file)
@@ -124,7 +124,7 @@ class NetworkCmProxyInventoryControllerSpec extends Specification {
         and: 'the mapper service returns a converted object'
             ncmpRestInputMapper.toCmHandleQueryServiceParameters(_) >> cmHandleQueryServiceParameters
         and: 'the service returns the desired results'
-            mockNetworkCmProxyInventoryFacade.executeParameterizedCmHandleIdSearch(cmHandleQueryServiceParameters, _) >> serviceMockResponse
+            mockNetworkCmProxyInventoryFacade.southboundCmHandleIdSearch(cmHandleQueryServiceParameters, _) >> serviceMockResponse
         when: 'post request is performed & search is called with the given request parameters'
             def response = mvc.perform(
                     post("$ncmpBasePathV1/ch/searches")
@@ -147,7 +147,7 @@ class NetworkCmProxyInventoryControllerSpec extends Specification {
         and: 'the mapper service returns a converted object'
             ncmpRestInputMapper.toCmHandleQueryServiceParameters(_) >> cmHandleQueryServiceParameters
         and: 'the service returns the desired results'
-            mockNetworkCmProxyInventoryFacade.executeParameterizedCmHandleIdSearch(cmHandleQueryServiceParameters, _) >> serviceMockResponse
+            mockNetworkCmProxyInventoryFacade.southboundCmHandleIdSearch(cmHandleQueryServiceParameters, _) >> serviceMockResponse
         when: 'post request is performed & search is called with the given request parameters'
             def response = mvc.perform(
                     post("$ncmpBasePathV1/ch/searches")
@@ -168,7 +168,7 @@ class NetworkCmProxyInventoryControllerSpec extends Specification {
         given: 'the mapper service returns a converted object'
             ncmpRestInputMapper.toCmHandleQueryServiceParameters(_) >> cmHandleQueryServiceParameters
         and: 'the service returns the desired results'
-            mockNetworkCmProxyInventoryFacade.executeParameterizedCmHandleIdSearch(cmHandleQueryServiceParameters) >> []
+            mockNetworkCmProxyInventoryFacade.southboundCmHandleIdSearch(cmHandleQueryServiceParameters) >> []
         when: 'post request is performed & search is called with the given request parameters'
             def response = mvc.perform(
                     post("$ncmpBasePathV1/ch/searches")
@@ -274,7 +274,7 @@ class NetworkCmProxyInventoryControllerSpec extends Specification {
             String jsonString = TestUtils.getResourceFileContent('cm-handle-search-by-dmi-service.json')
         and: 'a cm handle is returned'
             def ncmpServiceCmHandle = new NcmpServiceCmHandle(additionalProperties: ['someName': 'my dmi'])
-            mockNetworkCmProxyInventoryFacade.executeCmHandleInventorySearch(_) >> Flux.fromIterable([ncmpServiceCmHandle])
+            mockNetworkCmProxyInventoryFacade.southboundCmHandleSearch(_) >> Flux.fromIterable([ncmpServiceCmHandle])
         and: 'the mapper is requested to convert the object with additional properties'
             mockRestOutputCmHandleMapper.toRestOutputCmHandle(ncmpServiceCmHandle, true) >> new RestOutputCmHandle()
         when: 'the endpoint is invoked'
index 615264a..baaa0f7 100644 (file)
@@ -61,9 +61,9 @@ public interface NetworkCmProxyInventoryFacade {
      *                                       cm handle id (false) or alternate id (true)
      * @return                               collection of cm handle references
      */
-    Collection<String> executeParameterizedCmHandleIdSearch(final CmHandleQueryServiceParameters
+    Collection<String> southboundCmHandleIdSearch(final CmHandleQueryServiceParameters
                                                                   cmHandleQueryServiceParameters,
-                                                            final boolean outputAlternateId);
+                                                  final boolean outputAlternateId);
 
     /**
      * Retrieve module references for the given cm handle reference.
@@ -99,7 +99,7 @@ public interface NetworkCmProxyInventoryFacade {
      * @param cmHandleQueryApiParameters cm handle query parameters
      * @return cm handle objects as a reactive stream (flux)
      */
-    Flux<NcmpServiceCmHandle> executeCmHandleSearch(final CmHandleQueryApiParameters cmHandleQueryApiParameters);
+    Flux<NcmpServiceCmHandle> northboundCmHandleSearch(final CmHandleQueryApiParameters cmHandleQueryApiParameters);
 
     /**
      * Retrieve cm handle ids for the given query parameters.
@@ -108,8 +108,8 @@ public interface NetworkCmProxyInventoryFacade {
      * @param outputAlternateId boolean for cm handle reference type either cmHandleId (false) or AlternateId (true)
      * @return cm handle ids
      */
-    Collection<String> executeCmHandleIdSearch(final CmHandleQueryApiParameters cmHandleQueryApiParameters,
-                                               final boolean outputAlternateId);
+    Collection<String> northboundCmHandleIdSearch(final CmHandleQueryApiParameters cmHandleQueryApiParameters,
+                                                  final boolean outputAlternateId);
 
     /**
      * Set the data sync enabled flag, along with the data sync state
@@ -150,6 +150,6 @@ public interface NetworkCmProxyInventoryFacade {
      * @param cmHandleQueryApiParameters cm handle query parameters
      * @return cm handle objects as a reactive stream (flux)
      */
-    Flux<NcmpServiceCmHandle> executeCmHandleInventorySearch(final CmHandleQueryApiParameters
+    Flux<NcmpServiceCmHandle> southboundCmHandleSearch(final CmHandleQueryApiParameters
                                                                      cmHandleQueryApiParameters);
 }
index 0c20aee..f630dfa 100644 (file)
@@ -44,8 +44,8 @@ import org.onap.cps.ncmp.impl.inventory.CmHandleQueryService;
 import org.onap.cps.ncmp.impl.inventory.CmHandleRegistrationService;
 import org.onap.cps.ncmp.impl.inventory.InventoryPersistence;
 import org.onap.cps.ncmp.impl.inventory.ParameterizedCmHandleQueryService;
-import org.onap.cps.ncmp.impl.inventory.models.CmHandleQueryConditions;
-import org.onap.cps.ncmp.impl.inventory.models.InventoryQueryConditions;
+import org.onap.cps.ncmp.impl.inventory.models.NorthboundCmHandleQuerySupportedConditions;
+import org.onap.cps.ncmp.impl.inventory.models.SouthboundCmHandleQuerySupportedConditions;
 import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle;
 import org.onap.cps.ncmp.impl.inventory.trustlevel.TrustLevelManager;
 import org.onap.cps.ncmp.impl.utils.AlternateIdMatcher;
@@ -77,14 +77,6 @@ public class NetworkCmProxyInventoryFacadeImpl implements NetworkCmProxyInventor
         return cmHandleQueryService.getCmHandleReferencesByDmiPluginIdentifier(dmiPluginIdentifier, outputAlternateId);
     }
 
-    @Override
-    public Collection<String> executeParameterizedCmHandleIdSearch(
-        final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final boolean outputAlternateId) {
-        validateCmHandleQueryParameters(cmHandleQueryServiceParameters, InventoryQueryConditions.ALL_CONDITION_NAMES);
-
-        return parameterizedCmHandleQueryService.queryCmHandleIdsForInventory(cmHandleQueryServiceParameters,
-            outputAlternateId);
-    }
 
     @Override
     public Collection<ModuleReference> getYangResourcesModuleReferences(final String cmHandleReference) {
@@ -119,30 +111,42 @@ public class NetworkCmProxyInventoryFacadeImpl implements NetworkCmProxyInventor
     }
 
     @Override
-    public Flux<NcmpServiceCmHandle> executeCmHandleSearch(
-            final CmHandleQueryApiParameters cmHandleQueryApiParameters) {
+    public Collection<String> northboundCmHandleIdSearch(final CmHandleQueryApiParameters cmHandleQueryApiParameters,
+                                                         final boolean outputAlternateId) {
+        final CmHandleQueryServiceParameters cmHandleQueryServiceParameters = jsonObjectMapper.convertToValueType(
+            cmHandleQueryApiParameters, CmHandleQueryServiceParameters.class);
+        validateCmHandleQueryParameters(cmHandleQueryServiceParameters,
+            NorthboundCmHandleQuerySupportedConditions.CONDITION_NAMES);
+        return parameterizedCmHandleQueryService.queryCmHandleReferenceIds(cmHandleQueryServiceParameters,
+            outputAlternateId);
+    }
+
+    @Override
+    public Flux<NcmpServiceCmHandle> northboundCmHandleSearch(
+        final CmHandleQueryApiParameters cmHandleQueryApiParameters) {
         final CmHandleQueryServiceParameters cmHandleQueryServiceParameters =
                 jsonObjectMapper.convertToValueType(cmHandleQueryApiParameters, CmHandleQueryServiceParameters.class);
-        validateCmHandleQueryParameters(cmHandleQueryServiceParameters, CmHandleQueryConditions.ALL_CONDITION_NAMES);
+        validateCmHandleQueryParameters(cmHandleQueryServiceParameters,
+            NorthboundCmHandleQuerySupportedConditions.CONDITION_NAMES);
         return parameterizedCmHandleQueryService.queryCmHandles(cmHandleQueryServiceParameters);
     }
 
     @Override
-    public Flux<NcmpServiceCmHandle> executeCmHandleInventorySearch(
+    public Flux<NcmpServiceCmHandle> southboundCmHandleSearch(
             final CmHandleQueryApiParameters cmHandleQueryApiParameters) {
         final CmHandleQueryServiceParameters cmHandleQueryServiceParameters =
                 jsonObjectMapper.convertToValueType(cmHandleQueryApiParameters, CmHandleQueryServiceParameters.class);
-        validateCmHandleQueryParameters(cmHandleQueryServiceParameters, CmHandleQueryConditions.ALL_CONDITION_NAMES);
+        validateCmHandleQueryParameters(cmHandleQueryServiceParameters,
+            SouthboundCmHandleQuerySupportedConditions.CONDITION_NAMES);
         return parameterizedCmHandleQueryService.queryInventoryForCmHandles(cmHandleQueryServiceParameters);
     }
 
     @Override
-    public Collection<String> executeCmHandleIdSearch(final CmHandleQueryApiParameters cmHandleQueryApiParameters,
-                                                      final boolean outputAlternateId) {
-        final CmHandleQueryServiceParameters cmHandleQueryServiceParameters = jsonObjectMapper.convertToValueType(
-            cmHandleQueryApiParameters, CmHandleQueryServiceParameters.class);
-        validateCmHandleQueryParameters(cmHandleQueryServiceParameters, CmHandleQueryConditions.ALL_CONDITION_NAMES);
-        return parameterizedCmHandleQueryService.queryCmHandleReferenceIds(cmHandleQueryServiceParameters,
+    public Collection<String> southboundCmHandleIdSearch(
+        final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final boolean outputAlternateId) {
+        validateCmHandleQueryParameters(cmHandleQueryServiceParameters,
+            SouthboundCmHandleQuerySupportedConditions.CONDITION_NAMES);
+        return parameterizedCmHandleQueryService.queryCmHandleIdsForInventory(cmHandleQueryServiceParameters,
             outputAlternateId);
     }
 
index c0fd13f..68d97fb 100644 (file)
@@ -22,10 +22,10 @@ package org.onap.cps.ncmp.impl.inventory;
 
 import static org.onap.cps.ncmp.impl.inventory.CmHandleQueryParametersValidator.validateCpsPathConditionProperties;
 import static org.onap.cps.ncmp.impl.inventory.CmHandleQueryParametersValidator.validateModuleNameConditionProperties;
-import static org.onap.cps.ncmp.impl.inventory.models.CmHandleQueryConditions.HAS_ALL_MODULES;
-import static org.onap.cps.ncmp.impl.inventory.models.CmHandleQueryConditions.HAS_ALL_PROPERTIES;
-import static org.onap.cps.ncmp.impl.inventory.models.CmHandleQueryConditions.WITH_CPS_PATH;
-import static org.onap.cps.ncmp.impl.inventory.models.CmHandleQueryConditions.WITH_TRUST_LEVEL;
+import static org.onap.cps.ncmp.impl.inventory.models.NorthboundCmHandleQuerySupportedConditions.HAS_ALL_MODULES;
+import static org.onap.cps.ncmp.impl.inventory.models.NorthboundCmHandleQuerySupportedConditions.HAS_ALL_PROPERTIES;
+import static org.onap.cps.ncmp.impl.inventory.models.NorthboundCmHandleQuerySupportedConditions.WITH_CPS_PATH;
+import static org.onap.cps.ncmp.impl.inventory.models.NorthboundCmHandleQuerySupportedConditions.WITH_TRUST_LEVEL;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -40,8 +40,8 @@ import org.onap.cps.api.model.ConditionProperties;
 import org.onap.cps.cpspath.parser.PathParsingException;
 import org.onap.cps.ncmp.api.inventory.models.CmHandleQueryServiceParameters;
 import org.onap.cps.ncmp.api.inventory.models.NcmpServiceCmHandle;
-import org.onap.cps.ncmp.impl.inventory.models.InventoryQueryConditions;
 import org.onap.cps.ncmp.impl.inventory.models.PropertyType;
+import org.onap.cps.ncmp.impl.inventory.models.SouthboundCmHandleQuerySupportedConditions;
 import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle;
 import org.onap.cps.ncmp.impl.inventory.trustlevel.TrustLevelManager;
 import org.onap.cps.ncmp.impl.utils.YangDataConverter;
@@ -96,7 +96,7 @@ public class ParameterizedCmHandleQueryServiceImpl implements ParameterizedCmHan
             final CmHandleQueryServiceParameters cmHandleQueryServiceParameters, final boolean outputAlternateId) {
         final Map<String, String> dmiPropertyQueryPairs =
                 getPropertyPairs(cmHandleQueryServiceParameters.getCmHandleQueryParameters(),
-                        InventoryQueryConditions.CM_HANDLE_WITH_DMI_PLUGIN.getName());
+                        SouthboundCmHandleQuerySupportedConditions.WITH_DMI_SERVICE.getConditionName());
         if (dmiPropertyQueryPairs.isEmpty()) {
             return NO_QUERY_TO_EXECUTE;
         }
@@ -114,7 +114,7 @@ public class ParameterizedCmHandleQueryServiceImpl implements ParameterizedCmHan
 
         final Map<String, String> additionalPropertyQueryPairs =
                 getPropertyPairs(cmHandleQueryServiceParameters.getCmHandleQueryParameters(),
-                        InventoryQueryConditions.HAS_ALL_ADDITIONAL_PROPERTIES.getName());
+                        SouthboundCmHandleQuerySupportedConditions.HAS_ALL_ADDITIONAL_PROPERTIES.getConditionName());
 
         if (additionalPropertyQueryPairs.isEmpty()) {
             return NO_QUERY_TO_EXECUTE;
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2022-2023 Nordix Foundation
+ *  Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -23,22 +23,22 @@ package org.onap.cps.ncmp.impl.inventory.models;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.stream.Collectors;
+import lombok.AllArgsConstructor;
 import lombok.Getter;
 
 @Getter
-public enum CmHandleQueryConditions {
-    HAS_ALL_PROPERTIES("hasAllProperties"),
+@AllArgsConstructor
+
+public enum NorthboundCmHandleQuerySupportedConditions {
     HAS_ALL_MODULES("hasAllModules"),
+    HAS_ALL_PROPERTIES("hasAllProperties"),
     WITH_CPS_PATH("cmHandleWithCpsPath"),
-    WITH_TRUST_LEVEL("cmHandleWithTrustLevel"),
-    WITH_DMI_SERVICE("cmHandleWithDmiPlugin");
+    WITH_TRUST_LEVEL("cmHandleWithTrustLevel");
 
-    public static final Collection<String> ALL_CONDITION_NAMES = Arrays.stream(CmHandleQueryConditions.values())
-        .map(CmHandleQueryConditions::getConditionName).collect(Collectors.toList());
+    public static final Collection<String> CONDITION_NAMES =
+        Arrays.stream(NorthboundCmHandleQuerySupportedConditions.values())
+        .map(NorthboundCmHandleQuerySupportedConditions::getConditionName).collect(Collectors.toList());
 
     private final String conditionName;
 
-    CmHandleQueryConditions(final String conditionName) {
-        this.conditionName = conditionName;
-    }
 }
@@ -1,6 +1,6 @@
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2022 Nordix Foundation
+ *  Copyright (C) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -28,16 +28,18 @@ import lombok.Getter;
 
 @Getter
 @AllArgsConstructor
-public enum InventoryQueryConditions {
-
+public enum SouthboundCmHandleQuerySupportedConditions {
+    HAS_ALL_MODULES("hasAllModules"),
     HAS_ALL_PROPERTIES("hasAllProperties"),
     HAS_ALL_ADDITIONAL_PROPERTIES("hasAllAdditionalProperties"),
-    CM_HANDLE_WITH_DMI_PLUGIN("cmHandleWithDmiPlugin"),
-    WITH_CPS_PATH("cmHandleWithCpsPath");
+    WITH_CPS_PATH("cmHandleWithCpsPath"),
+    WITH_DMI_SERVICE("cmHandleWithDmiPlugin"),
+    WITH_TRUST_LEVEL("cmHandleWithTrustLevel");
 
-    public static final List<String> ALL_CONDITION_NAMES = Arrays.stream(InventoryQueryConditions.values())
-        .map(InventoryQueryConditions::getName).collect(Collectors.toList());
+    public static final List<String> CONDITION_NAMES =
+        Arrays.stream(SouthboundCmHandleQuerySupportedConditions.values())
+        .map(SouthboundCmHandleQuerySupportedConditions::getConditionName).collect(Collectors.toList());
 
-    private final String name;
+    private final String conditionName;
 
 }
index ff771c1..520d4e9 100644 (file)
@@ -64,7 +64,7 @@ class NetworkCmProxyInventoryFacadeSpec extends Specification {
             1 * mockCmHandleRegistrationService.updateDmiRegistration(dmiPluginRegistration)
     }
 
-    def 'Execute cm handle reference search for inventory'() {
+    def 'Execute southbound handle reference search (dmi)'() {
         given: 'a ConditionApiProperties object'
             def conditionProperties = new ConditionProperties()
             conditionProperties.conditionName = 'hasAllProperties'
@@ -74,7 +74,7 @@ class NetworkCmProxyInventoryFacadeSpec extends Specification {
         and: 'the system returns an set of cmHandle ids'
             mockParameterizedCmHandleQueryService.queryCmHandleIdsForInventory(*_) >> [ 'cmHandle1', 'cmHandle2' ]
         when: 'executing the search'
-            def result = objectUnderTest.executeParameterizedCmHandleIdSearch(cmHandleQueryServiceParameters, false)
+            def result = objectUnderTest.southboundCmHandleIdSearch(cmHandleQueryServiceParameters, false)
         then: 'the result returns the correct 2 elements'
             assert result.size() == 2
             assert result.contains('cmHandle1')
@@ -198,7 +198,7 @@ class NetworkCmProxyInventoryFacadeSpec extends Specification {
             'Cm Handle Reference as alternate-id' | 'some-alternate-id'
     }
 
-    def 'Execute cm handle reference search'() {
+    def 'Execute northbound cm handle reference search'() {
         given: 'valid CmHandleQueryApiParameters input'
             def cmHandleQueryApiParameters = new CmHandleQueryApiParameters()
             def conditionApiProperties = new ConditionApiProperties()
@@ -209,8 +209,8 @@ class NetworkCmProxyInventoryFacadeSpec extends Specification {
             mockParameterizedCmHandleQueryService.queryCmHandleReferenceIds(
                 spiedJsonObjectMapper.convertToValueType(cmHandleQueryApiParameters, CmHandleQueryServiceParameters.class), false)
                 >> ['cm-handle-id-1']
-        when: 'execute cm handle search is called'
-            def result = objectUnderTest.executeCmHandleIdSearch(cmHandleQueryApiParameters, false)
+        when: 'cm handle id search is called'
+            def result = objectUnderTest.northboundCmHandleIdSearch(cmHandleQueryApiParameters, false)
         then: 'result is the same collection as returned by the CPS Data Service'
             assert result == ['cm-handle-id-1']
     }
@@ -241,7 +241,7 @@ class NetworkCmProxyInventoryFacadeSpec extends Specification {
             'Cm Handle Reference as alternate-id' | 'some-alternate-id'
     }
 
-    def 'Execute cm handle search'() {
+    def 'Execute northbound cm handle search'() {
         given: 'valid CmHandleQueryApiParameters input'
             def cmHandleQueryApiParameters = new CmHandleQueryApiParameters()
             def conditionApiProperties = new ConditionApiProperties()
@@ -253,8 +253,8 @@ class NetworkCmProxyInventoryFacadeSpec extends Specification {
                 spiedJsonObjectMapper.convertToValueType(cmHandleQueryApiParameters, CmHandleQueryServiceParameters.class))
                 >> Flux.fromIterable([new NcmpServiceCmHandle(cmHandleId: 'ch-0', currentTrustLevel: TrustLevel.COMPLETE),
                                       new NcmpServiceCmHandle(cmHandleId: 'ch-1', currentTrustLevel: TrustLevel.COMPLETE)])
-        when: 'execute cm handle search is called'
-            def result = objectUnderTest.executeCmHandleSearch(cmHandleQueryApiParameters).collectList().block()
+        when: 'the cm handle search is called'
+            def result = objectUnderTest.northboundCmHandleSearch(cmHandleQueryApiParameters).collectList().block()
         then: 'result consists of the two cm handles returned by the CPS Data Service'
             assert result.size() == 2
             assert result[0].cmHandleId == 'ch-0'
@@ -264,7 +264,7 @@ class NetworkCmProxyInventoryFacadeSpec extends Specification {
             assert result[1].currentTrustLevel == TrustLevel.COMPLETE
     }
 
-    def 'Execute cm handle reference search with a valid condition name'() {
+    def 'Execute southbound cm handle reference search with a valid condition name'() {
         given: 'a valid API parameter with a supported condition'
             def apiParams = new CmHandleQueryApiParameters(
                     cmHandleQueryParameters: [
@@ -278,7 +278,7 @@ class NetworkCmProxyInventoryFacadeSpec extends Specification {
             mockParameterizedCmHandleQueryService.queryInventoryForCmHandles(_)
                     >> Flux.fromIterable([new NcmpServiceCmHandle(cmHandleId: 'cm handle from the query service')])
         when: 'executing the cm handle search'
-            def result = objectUnderTest.executeCmHandleInventorySearch(apiParams).collectList().block()
+            def result = objectUnderTest.southboundCmHandleSearch(apiParams).collectList().block()
         then: 'the result returns the cm handle from the query service'
             assert result.size() == 1
             assert result[0].cmHandleId == 'cm handle from the query service'
@@ -292,7 +292,7 @@ class NetworkCmProxyInventoryFacadeSpec extends Specification {
                     ]
             )
         when: 'executing the search'
-            objectUnderTest.executeCmHandleInventorySearch(apiParams).collectList().block()
+            objectUnderTest.southboundCmHandleSearch(apiParams).collectList().block()
         then: 'a data validation exception will be thrown'
             def exception = thrown(DataValidationException)
             assert exception.message == 'Invalid Query Parameter.'
@@ -1,6 +1,6 @@
 /*
  * ============LICENSE_START========================================================
- * Copyright (c) 2022 Nordix Foundation.
+ * Copyright (c) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -23,16 +23,15 @@ package org.onap.cps.ncmp.impl.inventory.models
 
 import spock.lang.Specification
 
-class CmHandleQueryConditionsSpec extends Specification {
+class NorthboundCmHandleQuerySupportedConditionsSpec extends Specification {
 
-    def 'CmHandle query condition names.'() {
-        expect: '5 conditions with the correct names'
-            assert CmHandleQueryConditions.ALL_CONDITION_NAMES.size() == 5
-            assert CmHandleQueryConditions.ALL_CONDITION_NAMES.containsAll('hasAllProperties',
+    def 'Northbound cm handle query condition names.'() {
+        expect: '4 conditions with the correct names'
+            assert NorthboundCmHandleQuerySupportedConditions.CONDITION_NAMES.size() == 4
+            assert NorthboundCmHandleQuerySupportedConditions.CONDITION_NAMES.containsAll('hasAllProperties',
                                                                            'hasAllModules',
                                                                            'cmHandleWithCpsPath',
-                                                                           'cmHandleWithDmiPlugin',
-                                                                            'cmHandleWithTrustLevel')
+                                                                           'cmHandleWithTrustLevel')
     }
 
 }
@@ -1,6 +1,6 @@
 /*
  * ============LICENSE_START========================================================
- * Copyright (c) 2022-2024 Nordix Foundation.
+ * Copyright (c) 2022-2025 OpenInfra Foundation Europe. All rights reserved.
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -22,14 +22,16 @@ package org.onap.cps.ncmp.impl.inventory.models
 
 import spock.lang.Specification
 
-class InventoryQueryConditionsSpec extends Specification {
+class SouthboundCmHandleQuerySupportedConditionsSpec extends Specification {
 
-    def 'Inventory query condition names.'() {
-        expect: '4 conditions with the correct names'
-            assert InventoryQueryConditions.ALL_CONDITION_NAMES.size() == 4
-            assert InventoryQueryConditions.ALL_CONDITION_NAMES.containsAll('hasAllProperties',
+    def 'Southbound cm handle query condition names.'() {
+        expect: '6 conditions with the correct names'
+            assert SouthboundCmHandleQuerySupportedConditions.CONDITION_NAMES.size() == 6
+            assert SouthboundCmHandleQuerySupportedConditions.CONDITION_NAMES.containsAll('hasAllModules',
+                                                                            'hasAllProperties',
                                                                             'hasAllAdditionalProperties',
+                                                                            'cmHandleWithCpsPath',
                                                                             'cmHandleWithDmiPlugin',
-                                                                            'cmHandleWithCpsPath')
+                                                                            'cmHandleWithTrustLevel')
     }
 }