Add tests for add/remove elements in migration 05/138605/2
authorrameshiyer27 <ramesh.murugan.iyer@est.tech>
Mon, 29 Jul 2024 14:43:06 +0000 (15:43 +0100)
committerRamesh Murugan Iyer <ramesh.murugan.iyer@est.tech>
Thu, 1 Aug 2024 09:32:29 +0000 (09:32 +0000)
Issue-ID: POLICY-4917
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: If42e834954e19f4fe21642be042caea6da10d33e

compose/export-ports.sh
csit/resources/tests/data/ac-definition-migration-to.yaml
csit/resources/tests/data/ac-instance-migration-to.yaml
csit/resources/tests/policy-clamp-test.robot

index aa97f49..6eaaedb 100755 (executable)
 # SPDX-License-Identifier: Apache-2.0
 # ============LICENSE_END=========================================================
 
-if $(docker images | grep -q "onap\/policy-api")
+if $(docker images | grep -q "^onap\/policy-api")
 then
     export CONTAINER_LOCATION=$(
         docker images |
-        grep onap/policy-api |
+        grep "^onap/policy-api" |
         head -1 |
         sed 's/onap\/policy-api.*$//'
     )
index efc550b..5a5b57e 100644 (file)
@@ -128,7 +128,7 @@ topology_template:
         provider: ONAP
         startPhase: 0
 
-    onap.policy.clamp.ac.element.Sim_SinkAutomationCompositionElement:
+    onap.policy.clamp.ac.element.Sim_NewAutomationCompositionElement:
       version: 1.2.4
       type: org.onap.policy.clamp.acm.SimAutomationCompositionElement
       type_version: 1.0.0
@@ -149,5 +149,5 @@ topology_template:
             version: 1.2.4
           - name: onap.policy.clamp.ac.element.Sim_BridgeAutomationCompositionElement
             version: 1.2.4
-          - name: onap.policy.clamp.ac.element.Sim_SinkAutomationCompositionElement
+          - name: onap.policy.clamp.ac.element.Sim_NewAutomationCompositionElement
             version: 1.2.4
index 65b684a..68a31a5 100644 (file)
@@ -47,10 +47,10 @@ elements:
         - configurationEntityId:
           myParameterToUpdate: TEXTPLACEHOLDER
 
-  709c62b3-8918-41b9-a747-d21eb79c6c36:
-    id: 709c62b3-8918-41b9-a747-d21eb79c6c36
+  709c62b3-8918-41b9-a747-d21eb79c6c37:
+    id: 709c62b3-8918-41b9-a747-d21eb79c6c37
     definition:
-      name: onap.policy.clamp.ac.element.Sim_SinkAutomationCompositionElement
+      name: onap.policy.clamp.ac.element.Sim_NewAutomationCompositionElement
       version: 1.2.4
     description: Sink Automation Composition Element for the Demo
     properties:
index 3f158c6..72c5672 100644 (file)
@@ -304,6 +304,8 @@ AutomationCompositionMigrationTo
      Wait Until Keyword Succeeds    2 min    5 sec    VerifyDeployStatus  ${compositionToId}  ${instanceMigrationId}  DEPLOYED
      VerifyPropertiesUpdated  ${compositionToId}  ${instanceMigrationId}  TextForMigration
      VerifyParticipantSim  ${instanceMigrationId}  TextForMigration
+     VerifyMigratedElementsRuntime  ${compositionToId}  ${instanceMigrationId}
+     VerifyMigratedElementsSim  ${instanceMigrationId}
 
 UnDeployAutomationComposition
      [Documentation]  UnDeploy automation composition.
@@ -535,6 +537,33 @@ VerifyPropertiesUpdated
      ${respstring}   Convert To String   ${resp.json()}
      Run Keyword If  ${resp.status_code}==200  Should Match Regexp  ${respstring}  ${textToFind}
 
+VerifyMigratedElementsRuntime
+     [Arguments]  ${compositionToId}  ${theInstanceId}
+     [Documentation]  Verify the Instance elements after Migration
+     ${auth}=    Create List    runtimeUser    zb!XztG34
+     Log    Creating session http://${POLICY_RUNTIME_ACM_IP}
+     ${session}=    Create Session      policy  http://${POLICY_RUNTIME_ACM_IP}   auth=${auth}
+     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
+     ${resp}=   GET On Session     policy  /onap/policy/clamp/acm/v2/compositions/${compositionToId}/instances/${theInstanceId}     headers=${headers}
+     Should Be Equal As Strings    ${resp.status_code}     200
+     ${respstring}   Convert To String   ${resp.json()}
+     Should Match Regexp  ${respstring}  Sim_NewAutomationCompositionElement
+     Should Not Match Regexp  ${respstring}  Sim_SinkAutomationCompositionElement
+
+VerifyMigratedElementsSim
+     [Arguments]  ${theInstanceId}
+     [Documentation]  Query on Participant Simulator
+     ${auth}=    Create List    participantUser    zb!XztG34
+     Log    Creating session http://${POLICY_PARTICIPANT_SIM_IP}
+     ${session}=    Create Session      ACM  http://${POLICY_PARTICIPANT_SIM_IP}   auth=${auth}
+     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
+     ${resp}=   GET On Session     ACM  /onap/policy/simparticipant/v2/instances/${theInstanceId}     headers=${headers}
+     Log    Received response from participant {resp.text}
+     Should Be Equal As Strings    ${resp.status_code}     200
+     ${respstring}   Convert To String   ${resp.json()}
+     Should Match Regexp  ${respstring}  Sim_NewAutomationCompositionElement
+     Should Not Match Regexp  ${respstring}  Sim_SinkAutomationCompositionElement
+
 VerifyParticipantSim
      [Arguments]  ${theInstanceId}  ${textToFind}
      [Documentation]  Query on Participant Simulator