Add get cm handles by modules to open api 20/125120/5
authorniamhcore <niamh.core@est.tech>
Tue, 19 Oct 2021 10:07:02 +0000 (11:07 +0100)
committerniamhcore <niamh.core@est.tech>
Wed, 20 Oct 2021 10:46:21 +0000 (11:46 +0100)
Issue-ID: CPS-644
Signed-off-by: niamhcore <niamh.core@est.tech>
Change-Id: I228782027cafcf59843ff4b8de1dd5ea3988ddba

cps-ncmp-rest/docs/openapi/components.yaml
cps-ncmp-rest/docs/openapi/ncmp.yml
cps-ncmp-rest/docs/openapi/openapi.yml
cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java

index d35919d..1f55ce1 100644 (file)
@@ -19,6 +19,7 @@
 
 components:
   schemas:
+    # Common Schemas
     ErrorMessage:
       type: object
       title: Error
@@ -30,6 +31,7 @@ components:
         details:
           type: string
 
+    # Request Schemas
     RestDmiPluginRegistration:
       type: object
       properties:
@@ -65,6 +67,51 @@ components:
             type: string
             example: system-001
 
+    Conditions:
+      type: object
+      properties:
+        conditions:
+          $ref: '#/components/schemas/ConditionsData'
+    ConditionsData:
+      type: array
+      items:
+        type: object
+        $ref: '#/components/schemas/ConditionProperties'
+    ConditionProperties:
+      properties:
+        name:
+          type: string
+          example: hasAllModules
+        conditionParameters:
+          $ref: '#/components/schemas/ConditionParameters'
+    ConditionParameters:
+      type: array
+      items:
+        type: object
+        $ref: '#/components/schemas/ConditionParameter'
+    ConditionParameter:
+        properties:
+          moduleName:
+            type: string
+            example: someModuleName
+
+    #Response Schemas
+    CmHandles:
+      type: object
+      properties:
+        cmHandles:
+          $ref: '#/components/schemas/CmHandleProperties'
+    CmHandleProperties:
+      type: array
+      items:
+        type: object
+        $ref: '#/components/schemas/CmHandleProperty'
+    CmHandleProperty:
+      properties:
+        cmHandleId:
+          type: string
+          example: someCmHandleId
+
   parameters:
     cmHandleInPath:
       name: cm-handle
index 52245c3..9e3560a 100755 (executable)
@@ -283,4 +283,31 @@ fetchModuleReferencesByCmHandle:
       403:
         $ref: 'components.yaml#/components/responses/Forbidden'
       404:
-        $ref: 'components.yaml#/components/responses/NotFound'
\ No newline at end of file
+        $ref: 'components.yaml#/components/responses/NotFound'
+
+executeCmHandleSearch:
+  post:
+    description: Execute cm handle searches using 'hasAllModules' condition to get all cm handles for the given module names
+    tags:
+      - network-cm-proxy
+    summary: Execute cm handle search using the available conditions
+    operationId: executeCmHandleSearch
+    requestBody:
+      required: true
+      content:
+        application/json:
+          schema:
+            $ref: 'components.yaml#/components/schemas/Conditions'
+    responses:
+      200:
+        description: OK
+        content:
+          application/json:
+            schema:
+              $ref: 'components.yaml#/components/schemas/CmHandles'
+      400:
+        $ref: 'components.yaml#/components/responses/BadRequest'
+      401:
+        $ref: 'components.yaml#/components/responses/Unauthorized'
+      403:
+        $ref: 'components.yaml#/components/responses/Forbidden'
\ No newline at end of file
index 69c2a11..64a74c5 100755 (executable)
@@ -45,4 +45,7 @@ paths:
     $ref: 'ncmp.yml#/resourceDataForPassthroughRunning'
 
   /v1/ch/{cm-handle}/modules:
-    $ref: 'ncmp.yml#/fetchModuleReferencesByCmHandle'
\ No newline at end of file
+    $ref: 'ncmp.yml#/fetchModuleReferencesByCmHandle'
+
+  /v1/ch/searches:
+    $ref: 'ncmp.yml#/executeCmHandleSearch'
\ No newline at end of file
index 9b15a78..14f33d1 100755 (executable)
@@ -29,6 +29,8 @@ import javax.validation.Valid;
 import javax.validation.constraints.NotNull;
 import org.onap.cps.ncmp.api.NetworkCmProxyDataService;
 import org.onap.cps.ncmp.rest.api.NetworkCmProxyApi;
+import org.onap.cps.ncmp.rest.model.CmHandles;
+import org.onap.cps.ncmp.rest.model.Conditions;
 import org.onap.cps.spi.FetchDescendantsOption;
 import org.onap.cps.spi.model.DataNode;
 import org.onap.cps.spi.model.ModuleReference;
@@ -193,6 +195,11 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
         return new ResponseEntity<>(HttpStatus.CREATED);
     }
 
+    @Override
+    public ResponseEntity<CmHandles> executeCmHandleSearch(final Conditions conditions) {
+        return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+    }
+
     @Override
     public ResponseEntity<Object> getModuleReferencesByCmHandle(final String cmHandle) {
         final Collection<ModuleReference>