From d8f86cfb64c852ea883a4411c49bda6b91cc23f0 Mon Sep 17 00:00:00 2001 From: rameshiyer27 Date: Tue, 19 Aug 2025 11:42:32 +0100 Subject: [PATCH] Add Migration remove element test case in CSIT Issue-ID: POLICY-5439 Change-Id: I5c69210ba44b9bb30faae804ac53541f092b540d Signed-off-by: rameshiyer27 --- compose/compose.acm.scale.yml | 4 +-- .../tests/data/ac-definition-migration-from.yaml | 37 +++++++++++++++++++++ .../tests/data/ac-instance-migration-fail.yaml | 25 ++++++++++++++ .../tests/data/ac-instance-migration-from.yaml | 30 +++++++++++++++++ csit/resources/tests/data/ac-instance-timeout.yaml | 30 +++++++++++++++++ csit/resources/tests/policy-clamp-test.robot | 38 +++++++++++++++++++++- 6 files changed, 161 insertions(+), 3 deletions(-) diff --git a/compose/compose.acm.scale.yml b/compose/compose.acm.scale.yml index 8e725951..50193351 100644 --- a/compose/compose.acm.scale.yml +++ b/compose/compose.acm.scale.yml @@ -29,7 +29,7 @@ services: - apex-pdp - kafka - jaeger - - policy-clamp-ac-pf-ppnt-replica + - policy-clamp-ac-pf-ppnt - policy-clamp-ac-sim-ppnt-1 - policy-clamp-ac-sim-ppnt-2 expose: @@ -65,7 +65,7 @@ services: '-c', 'java -jar /app/app.jar', 'apex-pdp', '6969', 'kafka', '9092', - 'policy-clamp-ac-pf-ppnt-replica', '6969', + 'policy-clamp-ac-pf-ppnt', '6969', 'policy-clamp-ac-sim-ppnt-1', '6969', 'policy-clamp-ac-sim-ppnt-2', '6969', ] diff --git a/csit/resources/tests/data/ac-definition-migration-from.yaml b/csit/resources/tests/data/ac-definition-migration-from.yaml index f866bd48..f732f3cc 100644 --- a/csit/resources/tests/data/ac-definition-migration-from.yaml +++ b/csit/resources/tests/data/ac-definition-migration-from.yaml @@ -108,6 +108,29 @@ node_types: type: map description: The configuration entities the Automation Composition Element is managing and their associated REST requests + org.onap.policy.clamp.acm.SimAutomationCompositionElement2: + version: 1.0.0 + derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement + properties: + baseUrl: + type: string + required: true + description: The base URL to be prepended to each path, identifies the host for the REST endpoints. + metadata: + sensitive: true + httpHeaders: + type: map + required: false + entry_schema: + type: string + description: HTTP headers to send on REST requests + configurationEntities: + type: map + required: true + entry_schema: + type: map + description: The configuration entities the Automation Composition Element is managing and their associated REST requests + topology_template: node_templates: @@ -156,6 +179,18 @@ topology_template: prepare: [0,2] migrate: [0,2] + onap.policy.clamp.ac.element.Sim_Sink2AutomationCompositionElement: + version: 1.2.3 + type: org.onap.policy.clamp.acm.SimAutomationCompositionElement2 + type_version: 1.0.0 + description: Automation composition element for the http requests of AC Element Sink microservice + properties: + provider: ONAP + startPhase: 0 + stage: + prepare: [ 0,3 ] + migrate: [ 0,3 ] + onap.policy.clamp.ac.element.AutomationCompositionDefinition: version: 1.2.3 type: org.onap.policy.clamp.acm.AutomationComposition @@ -170,3 +205,5 @@ topology_template: version: 1.2.3 - name: onap.policy.clamp.ac.element.Sim_SinkAutomationCompositionElement version: 1.2.3 + - name: onap.policy.clamp.ac.element.Sim_Sink2AutomationCompositionElement + version: 1.2.3 diff --git a/csit/resources/tests/data/ac-instance-migration-fail.yaml b/csit/resources/tests/data/ac-instance-migration-fail.yaml index 1e6bd78c..4ba7a3d2 100644 --- a/csit/resources/tests/data/ac-instance-migration-fail.yaml +++ b/csit/resources/tests/data/ac-instance-migration-fail.yaml @@ -97,3 +97,28 @@ elements: body: '{ "receiverId": { "name": "onap.policy.clamp.ac.sink", "version": "1.0.0" }, "timerMs": 20000, "elementType": "SINK", "topicParameterGroup": { "server": "message-router", "listenerTopic": "POLICY_UPDATE_MSG", "publisherTopic": "AC_ELEMENT_MSG", "fetchTimeout": 15000, "topicCommInfrastructure": "dmaap" } }' expectedResponse: 201 myParameterToUpdate: text + + 709c62b3-8918-41b9-a747-d21eb79c6c38: + id: 709c62b3-8918-41b9-a747-d21eb79c6c38 + definition: + name: onap.policy.clamp.ac.element.Sim_Sink2AutomationCompositionElement + version: 1.2.3 + description: Sink Automation Composition Element for the Demo + properties: + baseUrl: http://address:30803 + httpHeaders: + Content-Type: application/json + Authorization: Basic YWNtVXNlcjp6YiFYenRHMzQ= + configurationEntities: + - configurationEntityId: + name: onap.policy.clamp.ac.sink2 + version: 1.0.0 + restSequence: + - restRequestId: + name: request4 + version: 1.0.1 + httpMethod: POST + path: /onap/policy/clamp/acelement/v2/activate + body: '{ "receiverId": { "name": "onap.policy.clamp.ac.sink2", "version": "1.0.0" }, "timerMs": 20000, "elementType": "SINK", "topicParameterGroup": { "server": "message-router", "listenerTopic": "POLICY_UPDATE_MSG", "publisherTopic": "AC_ELEMENT_MSG", "fetchTimeout": 15000, "topicCommInfrastructure": "dmaap" } }' + expectedResponse: 201 + myParameterToUpdate: TEXTPLACEHOLDER diff --git a/csit/resources/tests/data/ac-instance-migration-from.yaml b/csit/resources/tests/data/ac-instance-migration-from.yaml index ee9cc819..25f8a1cd 100644 --- a/csit/resources/tests/data/ac-instance-migration-from.yaml +++ b/csit/resources/tests/data/ac-instance-migration-from.yaml @@ -110,3 +110,33 @@ elements: body: '{ "receiverId": { "name": "onap.policy.clamp.ac.sink", "version": "1.0.0" }, "timerMs": 20000, "elementType": "SINK", "topicParameterGroup": { "server": "message-router", "listenerTopic": "POLICY_UPDATE_MSG", "publisherTopic": "AC_ELEMENT_MSG", "fetchTimeout": 15000, "topicCommInfrastructure": "dmaap" } }' expectedResponse: 201 myParameterToUpdate: TEXTPLACEHOLDER + + 709c62b3-8918-41b9-a747-d21eb79c6c38: + id: 709c62b3-8918-41b9-a747-d21eb79c6c38 + definition: + name: onap.policy.clamp.ac.element.Sim_Sink2AutomationCompositionElement + version: 1.2.3 + description: Sink Automation Composition Element for the Demo + properties: + deployTimeoutMs: 200000 + undeployTimeoutMs: 150000 + updateTimeoutMs: 200000 + migrateTimeoutMs: 200000 + deleteTimeoutMs: 100000 + baseUrl: http://address:30803 + httpHeaders: + Content-Type: application/json + Authorization: Basic YWNtVXNlcjp6YiFYenRHMzQ= + configurationEntities: + - configurationEntityId: + name: onap.policy.clamp.ac.sink2 + version: 1.0.0 + restSequence: + - restRequestId: + name: request4 + version: 1.0.1 + httpMethod: POST + path: /onap/policy/clamp/acelement/v2/activate + body: '{ "receiverId": { "name": "onap.policy.clamp.ac.sink2", "version": "1.0.0" }, "timerMs": 20000, "elementType": "SINK", "topicParameterGroup": { "server": "message-router", "listenerTopic": "POLICY_UPDATE_MSG", "publisherTopic": "AC_ELEMENT_MSG", "fetchTimeout": 15000, "topicCommInfrastructure": "dmaap" } }' + expectedResponse: 201 + myParameterToUpdate: TEXTPLACEHOLDER diff --git a/csit/resources/tests/data/ac-instance-timeout.yaml b/csit/resources/tests/data/ac-instance-timeout.yaml index 64331154..39b461c9 100644 --- a/csit/resources/tests/data/ac-instance-timeout.yaml +++ b/csit/resources/tests/data/ac-instance-timeout.yaml @@ -110,3 +110,33 @@ elements: body: '{ "receiverId": { "name": "onap.policy.clamp.ac.sink", "version": "1.0.0" }, "timerMs": 20000, "elementType": "SINK", "topicParameterGroup": { "server": "message-router", "listenerTopic": "POLICY_UPDATE_MSG", "publisherTopic": "AC_ELEMENT_MSG", "fetchTimeout": 15000, "topicCommInfrastructure": "dmaap" } }' expectedResponse: 201 myParameterToUpdate: text + + 709c62b3-8918-41b9-a747-d21eb79c6c38: + id: 709c62b3-8918-41b9-a747-d21eb79c6c38 + definition: + name: onap.policy.clamp.ac.element.Sim_Sink2AutomationCompositionElement + version: 1.2.3 + description: Sink Automation Composition Element for the Demo + properties: + deployTimeoutMs: 200 + undeployTimeoutMs: 150 + updateTimeoutMs: 200 + migrateTimeoutMs: 200 + deleteTimeoutMs: 100 + baseUrl: http://address:30803 + httpHeaders: + Content-Type: application/json + Authorization: Basic YWNtVXNlcjp6YiFYenRHMzQ= + configurationEntities: + - configurationEntityId: + name: onap.policy.clamp.ac.sink2 + version: 1.0.0 + restSequence: + - restRequestId: + name: request4 + version: 1.0.1 + httpMethod: POST + path: /onap/policy/clamp/acelement/v2/activate + body: '{ "receiverId": { "name": "onap.policy.clamp.ac.sink2", "version": "1.0.0" }, "timerMs": 20000, "elementType": "SINK", "topicParameterGroup": { "server": "message-router", "listenerTopic": "POLICY_UPDATE_MSG", "publisherTopic": "AC_ELEMENT_MSG", "fetchTimeout": 15000, "topicCommInfrastructure": "dmaap" } }' + expectedResponse: 201 + myParameterToUpdate: TEXTPLACEHOLDER diff --git a/csit/resources/tests/policy-clamp-test.robot b/csit/resources/tests/policy-clamp-test.robot index 14261b4c..8c58c2ed 100644 --- a/csit/resources/tests/policy-clamp-test.robot +++ b/csit/resources/tests/policy-clamp-test.robot @@ -231,7 +231,7 @@ DeleteUndeployedInstantiateAutomationComposition ${postjson}= Get file ${CURDIR}/data/${instantiationfile} ${tmpInstanceId}= MakeJsonInstantiateAutomationComposition ${compositionId} ${postjson} DeleteAutomationComposition ${compositionId} ${tmpInstanceId} - Wait Until Keyword Succeeds 2 min 5 sec VerifyUninstantiated ${compositionId} + Wait Until Keyword Succeeds 3 min 5 sec VerifyUninstantiated ${compositionId} InstantiateAutomationComposition [Documentation] Instantiate automation composition. @@ -251,6 +251,7 @@ InstantiateAutomationCompositionTimeout DeployAutomationCompositionTimeout [Documentation] Deploy automation composition timeout. SetParticipantSimTimeout + SetParticipantSim2Timeout ${postjson}= Get file ${CURDIR}/data/DeployAC.json ChangeStatusAutomationComposition ${compositionFromId} ${instanceTimeoutId} ${postjson} Wait Until Keyword Succeeds 5 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceTimeoutId} TIMEOUT @@ -258,6 +259,7 @@ DeployAutomationCompositionTimeout DeleteAutomationCompositionTimeout [Documentation] Delete automation composition timeout. SetParticipantSimSuccess + SetParticipantSim2Success UndeployAndDeleteAutomationComposition ${compositionFromId} ${instanceTimeoutId} InstantiateAutomationCompositionMigrationFrom @@ -270,6 +272,7 @@ InstantiateAutomationCompositionMigrationFrom FailPrepareAutomationCompositionMigrationFrom [Documentation] Fail Prepare automation composition migration. SetParticipantSimFail + SetParticipantSim2Fail ${postjson}= Get file ${CURDIR}/data/PrepareAC.json ChangeStatusAutomationComposition ${compositionFromId} ${instanceMigrationId} ${postjson} Wait Until Keyword Succeeds 2 min 5 sec VerifyStateChangeResult ${compositionFromId} ${instanceMigrationId} FAILED @@ -277,6 +280,7 @@ FailPrepareAutomationCompositionMigrationFrom PrepareAutomationCompositionMigrationFrom [Documentation] Prepare automation composition migration. SetParticipantSimSuccess + SetParticipantSim2Success ${postjson}= Get file ${CURDIR}/data/PrepareAC.json ChangeStatusAutomationComposition ${compositionFromId} ${instanceMigrationId} ${postjson} Wait Until Keyword Succeeds 10 min 5 sec VerifySubStatus ${compositionFromId} ${instanceMigrationId} @@ -429,6 +433,7 @@ AutomationCompositionMigrationTo VerifyParticipantSim ${instanceMigrationId} TextForMigration VerifyMigratedElementsRuntime ${compositionToId} ${instanceMigrationId} VerifyMigratedElementsSim ${instanceMigrationId} + VerifyRemovedElementsSim ${instanceMigrationId} FailAutomationCompositionMigration [Documentation] Fail Migration of an automation composition. @@ -689,6 +694,15 @@ VerifyMigratedElementsSim Should Match Regexp ${respstring} Sim_NewAutomationCompositionElement Should Not Match Regexp ${respstring} Sim_SinkAutomationCompositionElement +VerifyRemovedElementsSim + [Arguments] ${theInstanceId} + [Documentation] Query on Participant Simulator 2 + ${auth}= ParticipantAuth + ${resp}= MakeGetRequest participant ${HTTP_PARTICIPANT_SIM2_IP} /onap/policy/simparticipant/v2/instances/${theInstanceId} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + ${respstring} Convert To String ${resp.json()} + Should Not Match Regexp ${respstring} Sim_Sink2AutomationCompositionElement + VerifyRollbackElementsSim [Arguments] ${theInstanceId} [Documentation] Query on Participant Simulator @@ -732,6 +746,13 @@ SetParticipantSimFail ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} Should Be Equal As Strings ${resp.status_code} 200 +SetParticipantSim2Fail + [Documentation] Set Participant Simulator2 Fail. + ${auth}= ParticipantAuth + ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesFail.json + ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM2_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + SetParticipantSimSuccess [Documentation] Set Participant Simulator Success. ${auth}= ParticipantAuth @@ -739,6 +760,13 @@ SetParticipantSimSuccess ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} Should Be Equal As Strings ${resp.status_code} 200 +SetParticipantSim2Success + [Documentation] Set Participant Simulator Success. + ${auth}= ParticipantAuth + ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesSuccess.json + ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM2_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + SetParticipantSimTimeout [Documentation] Set Participant Simulator Timeout. ${auth}= ParticipantAuth @@ -746,6 +774,13 @@ SetParticipantSimTimeout ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM1_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} Should Be Equal As Strings ${resp.status_code} 200 +SetParticipantSim2Timeout + [Documentation] Set Participant Simulator Timeout. + ${auth}= ParticipantAuth + ${postjson}= Get file ${CURDIR}/data/SettingSimPropertiesTimeout.json + ${resp}= MakeJsonPutRequest participant ${HTTP_PARTICIPANT_SIM2_IP} /onap/policy/simparticipant/v2/parameters ${postjson} ${auth} + Should Be Equal As Strings ${resp.status_code} 200 + SetParticipantSimDelay [Documentation] Set Participant Simulator Delay. ${auth}= ParticipantAuth @@ -900,3 +935,4 @@ VerifyHttpInTraces ${resp}= GET On Session jaeger /api/traces params=${params} expected_status=200 Log Received response from jaeger ${resp.text} RETURN ${resp} + -- 2.16.6