diff options
author | Daniel Rose <dr695h@att.com> | 2019-08-22 12:46:09 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-08-22 12:46:09 +0000 |
commit | 1f8a4cafe133c19c730701dbcc370cac9a7a7b0c (patch) | |
tree | 7f1028c6822f080ff5b69493fac15b1645da7ae1 /tests | |
parent | cb3218e5d11a586a935c0c4394ba4f7e5775ae0e (diff) | |
parent | f7f3bf3b67f8c32291ea57f7a083dfd1436d0ee7 (diff) |
Merge "Adjust SDC-DCAE-DS to integration test changes"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/sdc-dcae-d/dcaed/asdc_interface.robot | 141 | ||||
-rwxr-xr-x | tests/sdc-dcae-d/dcaed/assets/catalog_service_monitoring.jinja (renamed from tests/sdc-dcae-d/dcaed/assets/catalog_service.jinja) | 0 | ||||
-rw-r--r-- | tests/sdc-dcae-d/dcaed/assets/dcae_component_microservice.jinja (renamed from tests/sdc-dcae-d/dcaed/assets/component_catalog_resource.jinja) | 0 | ||||
-rw-r--r-- | tests/sdc-dcae-d/dcaed/common.robot | 8 | ||||
-rw-r--r-- | tests/sdc-dcae-d/dcaed/monitoring_configuration_service_test.robot | 80 | ||||
-rw-r--r-- | tests/sdc-dcae-d/dcaed/sdc_dcaed_interface.robot (renamed from tests/sdc-dcae-d/dcaed/dcaed_interface.robot) | 27 | ||||
-rwxr-xr-x | tests/sdc-dcae-d/dcaed/sdc_interface.robot | 175 |
7 files changed, 213 insertions, 218 deletions
diff --git a/tests/sdc-dcae-d/dcaed/asdc_interface.robot b/tests/sdc-dcae-d/dcaed/asdc_interface.robot deleted file mode 100644 index 2310522d..00000000 --- a/tests/sdc-dcae-d/dcaed/asdc_interface.robot +++ /dev/null @@ -1,141 +0,0 @@ -*** Settings *** -Library Collections -Library OperatingSystem -Library RequestsLibrary -Library ONAPLibrary.Utilities -Library ONAPLibrary.Templating WITH NAME Templating -Library ONAPLibrary.SDC WITH NAME SDC - -Resource common.robot - -***Variables *** -${ASDC_CATALOG_SERVICES_PATH} /sdc2/rest/v1/catalog/services -${ASDC_CATALOG_RESOURCES_PATH} /sdc2/rest/v1/catalog/resources -${ASDC_CATALOG_LIFECYCLE_PATH} /lifecycleState -${ASDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} /resourceInstance -${ASDC_CATALOG_SERVICE_DISTRIBUTION_STATE_PATH} /distribution-state -${ASDC_DISTRIBUTION_STATE_APPROVE_PATH} /approve - -${SDC_CATALOG_RESOURCE_TEMPLATE} component_catalog_resource.jinja -${SDC_CATALOG_SERVICE_TEMPLATE} catalog_service.jinja -${SDC_ARTIFACT_UPLOAD_TEMPLATE} artifact_upload.jinja -${SDC_USER_REMARKS_TEMPLATE} user_remarks.jinja -${SDC_RESOURCE_INSTANCE_TEMPLATE} resource_instance.jinja - -${ASDC_BE_ENDPOINT} http://localhost:8080 - -*** Keywords *** - -Create Catalog Resource Data - [Documentation] Creates and returns data for ASDC Catalog Resource - [Arguments] ${resource_name} ${vendor_name} - ${map}= Create Dictionary resource_name=${resource_name} vendor_name=${vendor_name} - Templating.Create Environment sdc_catalog_resource ${ASSETS_DIR} - ${data}= Templating.Apply Template sdc_catalog_resource ${SDC_CATALOG_RESOURCE_TEMPLATE} ${map} - [Return] ${data} - -Post ASDC Resource Request Unauthenticated - [Documentation] Makes unauthenticated Post request for ASDC Catalog resource and returns its unique id - [Arguments] ${data} - ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_RESOURCES_PATH} ${data} ${ASDC_DESIGNER_USER_ID} - Should Be Equal As Strings ${resp.status_code} 201 - [Return] ${resp.json()['uniqueId']} - -# Based on testsuite/robot/resources/sdc_interface.robot's 'Setup SDC Catalog Resource Deployment Artifact Properties' keyword -Add Tosca Artifact To Resource - [Documentation] Add Tosca artifacts to given resource id - [Arguments] ${artifact} ${vf_id} - ${blueprint_data} OperatingSystem.Get File ${ASSETS_DIR}${artifact}.yaml - ${payloadData}= Base64 Encode ${blueprint_data} - ${dict}= Create Dictionary artifactLabel=${artifact} artifactName=${artifact}.yaml artifactType=DCAE_TOSCA artifactGroupType=DEPLOYMENT description=${artifact}.yaml payloadData=${payloadData} - Templating.Create Environment sdc_artifact_upload ${ASSETS_DIR} - ${data}= Templating.Apply Template sdc_artifact_upload ${SDC_ARTIFACT_UPLOAD_TEMPLATE} ${dict} - # POST artifactUpload to resource - ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_RESOURCES_PATH}/${vf_id}/artifacts ${data} ${ASDC_DESIGNER_USER_ID} - Should Be Equal As Strings ${resp.status_code} 200 - [Return] ${resp} - -# Directly copied from testsuite/robot/resources/sdc_interface.robot -Certify ASDC Catalog Resource - [Documentation] Certifies an ASDC Catalog Resource by its id and returns the new id - [Arguments] ${catalog_resource_id} ${user_id}=${ASDC_TESTER_USER_ID} - ${map}= Create Dictionary user_remarks=Robot remarks - Templating.Create Environment sdc_user_remarks ${ASSETS_DIR} - ${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map} - ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certify ${data} ${user_id} - Should Be Equal As Strings ${resp.status_code} 200 - [Return] ${resp.json()['uniqueId']} ${resp.json()['uuid']} - -Add Catalog Service For Monitoring Template - [Documentation] Creates an ASDC Catalog Service for Monitoring Template with given name - [Arguments] ${service_name} - ${map}= Create Dictionary service_name=${service_name} - Templating.Create Environment sdc_catalog_service ${ASSETS_DIR} - ${data}= Templating.Apply Template sdc_catalog_service ${SDC_CATALOG_SERVICE_TEMPLATE} ${map} - ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_SERVICES_PATH} ${data} ${ASDC_DESIGNER_USER_ID} - Should Be Equal As Strings ${resp.status_code} 201 - [Return] ${resp.json()['uniqueId']} ${resp.json()['uuid']} - -# Based on testsuite/robot/resources/sdc_interface.robot's 'Add SDC Resource Instance' keyword -Add ASDC Resource Instance - [Documentation] Creates an ASDC Resource Instance and returns its id - [Arguments] ${catalog_service_id} ${catalog_resource_id} ${catalog_resource_name} ${xoffset}=${0} ${yoffset}=${0} ${resourceType}=VF - ${milli_timestamp}= Generate Timestamp - ${xoffset}= Set Variable ${xoffset+306} - ${yoffset}= Set Variable ${yoffset+248} - ${map}= Create Dictionary catalog_resource_id=${catalog_resource_id} catalog_resource_name=${catalog_resource_name} milli_timestamp=${milli_timestamp} posX=${xoffset} posY=${yoffset} originType=${resourceType} - Templating.Create Environment sdc_resource_instance ${ASSETS_DIR} - ${data}= Templating.Apply Template sdc_resource_instance ${SDC_RESOURCE_INSTANCE_TEMPLATE} ${map} - ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} ${data} ${ASDC_DESIGNER_USER_ID} - Should Be Equal As Strings ${resp.status_code} 201 - [Return] ${resp.json()['uniqueId']} ${resp.json()['name']} - -# All the following methods are adjusted from sdc_interface.robot - -Checkin ASDC Catalog Service - [Documentation] Checks in an ASDC Catalog Service by its id - [Arguments] ${catalog_service_id} - ${map}= Create Dictionary user_remarks=Robot remarks - Templating.Create Environment sdc_user_remarks ${ASSETS_DIR} - ${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map} - ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/checkin ${data} ${ASDC_DESIGNER_USER_ID} - - Should Be Equal As Strings ${resp.status_code} 200 - [Return] ${resp.json()} - -Request Certify ASDC Catalog Service - [Documentation] Requests certification of an ASDC Catalog Service by its id - [Arguments] ${catalog_service_id} - ${map}= Create Dictionary user_remarks=Robot remarks - Templating.Create Environment sdc_user_remarks ${ASSETS_DIR} - ${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map} - ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certificationRequest ${data} ${ASDC_DESIGNER_USER_ID} - Should Be Equal As Strings ${resp.status_code} 200 - [Return] ${resp.json()} - -Start Certify ASDC Catalog Service - [Documentation] Start certification of an ASDC Catalog Service by its id - [Arguments] ${catalog_service_id} - ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/startCertification ${None} ${ASDC_TESTER_USER_ID} - Should Be Equal As Strings ${resp.status_code} 200 - [Return] ${resp.json()} - -Certify ASDC Catalog Service - [Documentation] Certifies an ASDC Catalog Service by its id and returns the new id - [Arguments] ${catalog_service_id} - ${map}= Create Dictionary user_remarks=Robot remarks - Templating.Create Environment sdc_user_remarks ${ASSETS_DIR} - ${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map} - ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certify ${data} ${ASDC_TESTER_USER_ID} - Should Be Equal As Strings ${resp.status_code} 200 - [Return] ${resp.json()['uniqueId']} - -Approve ASDC Catalog Service - [Documentation] Approves an ASDC Catalog Service by its id - [Arguments] ${catalog_service_id} - ${map}= Create Dictionary user_remarks=Robot remarks - Templating.Create Environment sdc_user_remarks ${ASSETS_DIR} - ${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map} - ${resp}= SDC.Run Post Request ${ASDC_BE_ENDPOINT} ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_SERVICE_DISTRIBUTION_STATE_PATH}${ASDC_DISTRIBUTION_STATE_APPROVE_PATH} ${data} ${ASDC_GOVERNOR_USER_ID} - Should Be Equal As Strings ${resp.status_code} 200 - [Return] ${resp.json()} diff --git a/tests/sdc-dcae-d/dcaed/assets/catalog_service.jinja b/tests/sdc-dcae-d/dcaed/assets/catalog_service_monitoring.jinja index 3cd326e4..3cd326e4 100755 --- a/tests/sdc-dcae-d/dcaed/assets/catalog_service.jinja +++ b/tests/sdc-dcae-d/dcaed/assets/catalog_service_monitoring.jinja diff --git a/tests/sdc-dcae-d/dcaed/assets/component_catalog_resource.jinja b/tests/sdc-dcae-d/dcaed/assets/dcae_component_microservice.jinja index a3661b36..a3661b36 100644 --- a/tests/sdc-dcae-d/dcaed/assets/component_catalog_resource.jinja +++ b/tests/sdc-dcae-d/dcaed/assets/dcae_component_microservice.jinja diff --git a/tests/sdc-dcae-d/dcaed/common.robot b/tests/sdc-dcae-d/dcaed/common.robot index d1e8c74b..5b85570f 100644 --- a/tests/sdc-dcae-d/dcaed/common.robot +++ b/tests/sdc-dcae-d/dcaed/common.robot @@ -1,9 +1,9 @@ *** Variables *** -${ASDC_DESIGNER_USER_ID} cs0008 -${ASDC_TESTER_USER_ID} jm0007 -${ASDC_GOVERNOR_USER_ID} gv0001 -${ASDC_OPS_USER_ID} op0001 +${SDC_DESIGNER_USER_ID} cs0008 +${SDC_TESTER_USER_ID} jm0007 +${SDC_GOVERNOR_USER_ID} gv0001 +${SDC_OPS_USER_ID} op0001 ${GLOBAL_APPLICATION_ID} robot diff --git a/tests/sdc-dcae-d/dcaed/monitoring_configuration_service_test.robot b/tests/sdc-dcae-d/dcaed/monitoring_configuration_service_test.robot index 9a4bbc60..1941e357 100644 --- a/tests/sdc-dcae-d/dcaed/monitoring_configuration_service_test.robot +++ b/tests/sdc-dcae-d/dcaed/monitoring_configuration_service_test.robot @@ -1,78 +1,22 @@ *** Settings *** -Library ONAPLibrary.Utilities - -Resource asdc_interface.robot -Resource dcaed_interface.robot +Resource sdc_interface.robot +Resource sdc_dcaed_interface.robot *** Test Cases *** +# This test case implements the steps described in +# https://wiki.onap.org/display/DW/How+to+Create+a+Service+with+a+Monitoring+Configuration+using+SDC Create Service With Monitoring Configuration Test - [Tags] dcaed - [Documentation] Create a service with a monitoring configuration - - ... this test case implements the steps described in - ... https://wiki.onap.org/display/DW/How+to+Create+a+Service+with+a+Monitoring+Configuration+using+SDC - ... excluding distribution of the service + [Tags] sdc-dcae-d + [Documentation] Create a service with a monitoring configuration - ${unique_postfix}= Generate Unique Postfix + ${unique_postfix}= sdc_interface.Generate Unique Postfix ${test_vf_name}= Set Variable TestVF_${unique_postfix} ${test_cs_name}= Set Variable TestService_${unique_postfix} ${test_vfcmt_name}= Set Variable TestVFCMT_${unique_postfix} ${test_mc_name}= Set Variable TestMC_${unique_postfix} - ${cert_vf_unique_id} ${cert_vf_uuid} Onboard DCAE Microservice ${test_vf_name} - ${cert_vfcmt_uuid} Create Monitoring Template ${test_vfcmt_name} ${cert_vf_uuid} - ${cs_unique_id} Create Monitoring Configuration ${test_cs_name} ${cert_vf_unique_id} ${test_vf_name} ${cert_vfcmt_uuid} ${test_mc_name} - Approve Service ${cs_unique_id} - -*** Keywords *** -Generate Unique Postfix - [Documentation] Create and return unique postfix to be used in various unique names - ${tmp_id} = Generate Timestamp - ${tmp_str} = Convert To String ${tmp_id} - [return] ${tmp_str} - -Onboard DCAE Microservice - [Documentation] Create DCAE Microservice with a given name, add Tosca artifacts to it and certify it - ... Return the unique_id and uuid of the certified VF - [Arguments] ${test_vf_name} - ${data}= asdc_interface.Create Catalog Resource Data ${test_vf_name} TestVendor - ${vf_unique_id}= asdc_interface.Post ASDC Resource Request Unauthenticated ${data} - - asdc_interface.Add Tosca Artifact to Resource template ${vf_unique_id} - asdc_interface.Add Tosca Artifact to Resource translate ${vf_unique_id} - asdc_interface.Add Tosca Artifact to Resource schema ${vf_unique_id} - - ${cert_vf_unique_id} ${cert_vf_uuid} asdc_interface.Certify ASDC Catalog Resource ${vf_unique_id} ${ASDC_DESIGNER_USER_ID} - [return] ${cert_vf_unique_id} ${cert_vf_uuid} - -Create Monitoring Template - [Documentation] Create a new monitoring template containing the DCAE VF, certify it and return the uuid - [Arguments] ${vfcmt_name} ${vf_uuid} - ${vfcmt_uuid} dcaed_interface.Add VFCMT To DCAE-DS ${vfcmt_name} - dcaed_interface.Save Composition ${vfcmt_uuid} ${vf_uuid} - - # Note that certification is not instructed in - # https://wiki.onap.org/display/DW/How+to+Create+a+Service+with+a+Monitoring+Configuration+using+SDC - # due to limitations of GUI so this test case goes beyond the instructions at this certification step - - ${cert_vfcmt_uuid} dcaed_interface.Certify VFCMT ${vfcmt_uuid} - [return] ${cert_vfcmt_uuid} - -Create Monitoring Configuration - [Documentation] Create a monitoring configuration for a given service based on a previously created VFCMT - ... Return the unique_id of the created catalog service for the monitoring configuration - [Arguments] ${service_name} ${vf_unique_id} ${vf_name} ${vfcmt_uuid} ${mc_name} - ${cs_unique_id} ${cs_uuid} asdc_interface.Add Catalog Service For Monitoring Template ${service_name} - ${vfi_uuid} ${vfi_name} asdc_interface.Add ASDC Resource Instance ${cs_unique_id} ${vf_unique_id} ${vf_name} - ${mc_uuid} dcaed_interface.Add Monitoring Configuration To DCAE-DS ${vfcmt_uuid} ${cs_uuid} ${vfi_name} ${mc_name} - dcaed_interface.Submit Monitoring Configuration To DCAE-DS ${mc_uuid} ${cs_uuid} ${vfi_name} - [return] ${cs_unique_id} - -Approve Service - [Documentation] Perform the required steps to certify and approve the given ASDC catalog service - [Arguments] ${cs_unique_id} - asdc_interface.Checkin ASDC Catalog Service ${cs_unique_id} - asdc_interface.Request Certify ASDC Catalog Service ${cs_unique_id} - asdc_interface.Start Certify ASDC Catalog Service ${cs_unique_id} - ${cert_cs_unique_id}= asdc_interface.Certify ASDC Catalog Service ${cs_unique_id} - asdc_interface.Approve ASDC Catalog Service ${cert_cs_unique_id} - + ${cert_vf_unique_id} ${cert_vf_uuid} sdc_interface.Onboard DCAE Microservice ${test_vf_name} + ${cert_vfcmt_uuid} sdc_dcaed_interface.Create Monitoring Template ${test_vfcmt_name} ${cert_vf_uuid} + ${cs_unique_id} ${cs_uuid} ${vfi_name} sdc_interface.Create Monitoring Configuration ${test_cs_name} ${cert_vf_unique_id} ${test_vf_name} + sdc_dcaed_interface.Create Monitoring Configuration To DCAE-DS ${cert_vfcmt_uuid} ${cs_uuid} ${vfi_name} ${test_mc_name} + sdc_interface.Certify And Approve SDC Catalog Service ${cs_unique_id} diff --git a/tests/sdc-dcae-d/dcaed/dcaed_interface.robot b/tests/sdc-dcae-d/dcaed/sdc_dcaed_interface.robot index 481210d1..6f95ebc5 100644 --- a/tests/sdc-dcae-d/dcaed/dcaed_interface.robot +++ b/tests/sdc-dcae-d/dcaed/sdc_dcaed_interface.robot @@ -14,6 +14,16 @@ ${DCAE_MONITORING_CONFIGURATION_TEMPLATE} dcae_monitoring_configuration.jinja ${DCAE_BE_ENDPOINT} http://localhost:8082 *** Keywords *** +Create Monitoring Template + [Documentation] Create a new monitoring template containing the DCAE VF, certify it and return the uuid + [Arguments] ${vfcmt_name} ${vf_uuid} + ${vfcmt_uuid} Add VFCMT To DCAE-DS ${vfcmt_name} + Save Composition ${vfcmt_uuid} ${vf_uuid} + # Note that certification is not instructed in + # https://wiki.onap.org/display/DW/How+to+Create+a+Service+with+a+Monitoring+Configuration+using+SDC + # due to limitations of GUI so this test case goes beyond the instructions at this certification step + ${cert_vfcmt_uuid} Certify VFCMT ${vfcmt_uuid} + [return] ${cert_vfcmt_uuid} Add VFCMT To DCAE-DS [Documentation] Create VFCMT with the given name and return its uuid @@ -21,7 +31,7 @@ Add VFCMT To DCAE-DS ${map}= Create Dictionary vfcmtName=${vfcmt_name} description=VFCMT created by robot Create Environment create_vfcmt ${ASSETS_DIR} ${data}= Apply Template create_vfcmt ${DCAE_VFCMT_TEMPLATE} ${map} - ${resp}= SDC.Run Post Request ${DCAE_BE_ENDPOINT} ${DCAE_PATH}/createVFCMT ${data} ${ASDC_DESIGNER_USER_ID} + ${resp}= SDC.Run Post Request ${DCAE_BE_ENDPOINT} ${DCAE_PATH}/createVFCMT ${data} ${SDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()['uuid']} @@ -30,27 +40,34 @@ Save Composition ${map}= Create Dictionary cid=${vfcmt_uuid} vf_id=${vf_uuid} Create Environment dcae_composition ${ASSETS_DIR} ${data}= Apply Template dcae_composition ${DCAE_COMPOSITION_TEMPLATE} ${map} - ${resp}= SDC.Run Post Request ${DCAE_BE_ENDPOINT} ${DCAE_PATH}/saveComposition/${vfcmt_uuid} ${data} ${ASDC_DESIGNER_USER_ID} + ${resp}= SDC.Run Post Request ${DCAE_BE_ENDPOINT} ${DCAE_PATH}/saveComposition/${vfcmt_uuid} ${data} ${SDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 Certify VFCMT [Arguments] ${vfcmt_uuid} - ${resp}= SDC.Run Put Request ${DCAE_BE_ENDPOINT} ${DCAE_PATH}/certify/vfcmt/${vfcmt_uuid} ${None} ${ASDC_DESIGNER_USER_ID} + ${resp}= SDC.Run Put Request ${DCAE_BE_ENDPOINT} ${DCAE_PATH}/certify/vfcmt/${vfcmt_uuid} ${None} ${SDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()['uuid']} +Create Monitoring Configuration To DCAE-DS + [Documentation] Create a monitoring configuration to DCAE-DS using SDC Catalog Service uuid, + ... VFMCT uuid and instance name and monitoring configuration name + [Arguments] ${vfcmt_uuid} ${cs_uuid} ${vfi_name} ${mc_name} + ${mc_uuid} Add Monitoring Configuration To DCAE-DS ${vfcmt_uuid} ${cs_uuid} ${vfi_name} ${mc_name} + Submit Monitoring Configuration To DCAE-DS ${mc_uuid} ${cs_uuid} ${vfi_name} + Add Monitoring Configuration To DCAE-DS [Arguments] ${vfcmt_uuid} ${cs_uuid} ${vfi_name} ${mc_name} ${map}= Create Dictionary template_uuid=${vfcmt_uuid} service_uuid=${cs_uuid} vfi_name=${vfi_name} name=${mc_name} Create Environment dcae_monitoring_configuration ${ASSETS_DIR} ${data}= Apply Template dcae_monitoring_configuration ${DCAE_MONITORING_CONFIGURATION_TEMPLATE} ${map} - ${resp}= SDC.Run Post Request ${DCAE_BE_ENDPOINT} ${DCAE_PATH}/importMC ${data} ${ASDC_DESIGNER_USER_ID} + ${resp}= SDC.Run Post Request ${DCAE_BE_ENDPOINT} ${DCAE_PATH}/importMC ${data} ${SDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()['vfcmt']['uuid']} Submit Monitoring Configuration To DCAE-DS [Arguments] ${mc_uuid} ${cs_uuid} ${vfi_name} ${url_vfi_name} url_encode_string ${vfi_name} - ${resp}= SDC.Run Post Request ${DCAE_BE_ENDPOINT} ${DCAE_PATH}${DCAE_CREATE_BLUEPRINT_PATH}/${mc_uuid}/${cs_uuid}/${url_vfi_name} ${None} ${ASDC_DESIGNER_USER_ID} + ${resp}= SDC.Run Post Request ${DCAE_BE_ENDPOINT} ${DCAE_PATH}${DCAE_CREATE_BLUEPRINT_PATH}/${mc_uuid}/${cs_uuid}/${url_vfi_name} ${None} ${SDC_DESIGNER_USER_ID} Should Be Equal As Strings ${resp.status_code} 200 diff --git a/tests/sdc-dcae-d/dcaed/sdc_interface.robot b/tests/sdc-dcae-d/dcaed/sdc_interface.robot new file mode 100755 index 00000000..c1ceca44 --- /dev/null +++ b/tests/sdc-dcae-d/dcaed/sdc_interface.robot @@ -0,0 +1,175 @@ +*** Settings *** +Library Collections +Library OperatingSystem +Library RequestsLibrary +Library ONAPLibrary.Utilities +Library ONAPLibrary.Templating WITH NAME Templating +Library ONAPLibrary.SDC WITH NAME SDC + +Resource common.robot + +***Variables *** +${SDC_CATALOG_SERVICES_PATH} /sdc2/rest/v1/catalog/services +${SDC_CATALOG_RESOURCES_PATH} /sdc2/rest/v1/catalog/resources +${SDC_CATALOG_LIFECYCLE_PATH} /lifecycleState +${SDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} /resourceInstance +${SDC_CATALOG_SERVICE_DISTRIBUTION_STATE_PATH} /distribution-state +${SDC_DISTRIBUTION_STATE_APPROVE_PATH} /approve + +${SDC_DCAE_COMPONENT_MICROSERVICE_TEMPLATE} dcae_component_microservice.jinja +${SDC_CATALOG_SERVICE_MONITORING_TEMPLATE} catalog_service_monitoring.jinja +${SDC_ARTIFACT_UPLOAD_TEMPLATE} artifact_upload.jinja +${SDC_USER_REMARKS_TEMPLATE} user_remarks.jinja +${SDC_RESOURCE_INSTANCE_TEMPLATE} resource_instance.jinja + +${SDC_BE_ENDPOINT} http://localhost:8080 + +*** Keywords *** +Onboard DCAE Microservice + [Documentation] Create DCAE Microservice with a given name, add Tosca artifacts to it and certify it + ... Return the unique_id and uuid of the certified VF + [Arguments] ${test_vf_name} + ${data}= Create SDC Catalog Resource For DCAE Component MicroService Data ${test_vf_name} TestVendor + ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH} ${data} ${SDC_DESIGNER_USER_ID} + Should Be Equal As Strings ${resp.status_code} 201 + + ${vf_unique_id}= Set Variable ${resp.json()['uniqueId']} + + Add Tosca Artifact to Resource template ${vf_unique_id} + Add Tosca Artifact to Resource translate ${vf_unique_id} + Add Tosca Artifact to Resource schema ${vf_unique_id} + + ${cert_vf_unique_id} ${cert_vf_uuid} Certify SDC Catalog Resource ${vf_unique_id} ${SDC_DESIGNER_USER_ID} + [return] ${cert_vf_unique_id} ${cert_vf_uuid} + +Create SDC Catalog Resource For DCAE Component MicroService Data + [Documentation] Creates and returns data for DCAE Component MicroService SDC Catalog Resource + [Arguments] ${resource_name} ${vendor_name} + ${map}= Create Dictionary resource_name=${resource_name} vendor_name=${vendor_name} + Templating.Create Environment sdc_dcaed ${ASSETS_DIR} + ${data}= Templating.Apply Template sdc_dcaed ${SDC_DCAE_COMPONENT_MICROSERVICE_TEMPLATE} ${map} + [Return] ${data} + +# Based on testsuite/robot/resources/sdc_interface.robot's 'Setup SDC Catalog Resource Deployment Artifact Properties' keyword +Add Tosca Artifact To Resource + [Documentation] Add Tosca artifacts to given resource id + [Arguments] ${artifact} ${vf_id} + ${blueprint_data} OperatingSystem.Get File ${ASSETS_DIR}${artifact}.yaml + ${payloadData}= Base64 Encode ${blueprint_data} + ${dict}= Create Dictionary artifactLabel=${artifact} artifactName=${artifact}.yaml artifactType=DCAE_TOSCA artifactGroupType=DEPLOYMENT description=${artifact}.yaml payloadData=${payloadData} + Templating.Create Environment sdc_artifact_upload ${ASSETS_DIR} + ${data}= Templating.Apply Template sdc_artifact_upload ${SDC_ARTIFACT_UPLOAD_TEMPLATE} ${dict} + # POST artifactUpload to resource + ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH}/${vf_id}/artifacts ${data} ${SDC_DESIGNER_USER_ID} + Should Be Equal As Strings ${resp.status_code} 200 + [Return] ${resp} + +Add Catalog Service For Monitoring Template + [Documentation] Creates SDC Catalog Service for Monitoring Template with given name + [Arguments] ${service_name} + ${map}= Create Dictionary service_name=${service_name} + Templating.Create Environment sdc_catalog_service ${ASSETS_DIR} + ${data}= Templating.Apply Template sdc_catalog_service ${SDC_CATALOG_SERVICE_MONITORING_TEMPLATE} ${map} + ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH} ${data} ${SDC_DESIGNER_USER_ID} + Should Be Equal As Strings ${resp.status_code} 201 + [Return] ${resp.json()['uniqueId']} ${resp.json()['uuid']} + +Generate Unique Postfix + [Documentation] Create and return unique postfix to be used in various unique names + ${tmp_id} = Generate Timestamp + ${tmp_str} = Convert To String ${tmp_id} + [return] ${tmp_str} + +# Directly copied from testsuite/robot/resources/sdc_interface.robot +Certify SDC Catalog Resource + [Documentation] Certifies an SDC Catalog Resource by its id and returns the new id + [Arguments] ${catalog_resource_id} ${user_id}=${SDC_TESTER_USER_ID} + ${map}= Create Dictionary user_remarks=Robot remarks + Templating.Create Environment sdc_user_remarks ${ASSETS_DIR} + ${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map} + ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${SDC_CATALOG_LIFECYCLE_PATH}/certify ${data} ${user_id} + Should Be Equal As Strings ${resp.status_code} 200 + [Return] ${resp.json()['uniqueId']} ${resp.json()['uuid']} + +# Based on testsuite/robot/resources/sdc_interface.robot's 'Add SDC Resource Instance' keyword +Add SDC Resource Instance + [Documentation] Creates an SDC Resource Instance and returns its id + [Arguments] ${catalog_service_id} ${catalog_resource_id} ${catalog_resource_name} ${xoffset}=${0} ${yoffset}=${0} ${resourceType}=VF + ${milli_timestamp}= Generate Timestamp + ${xoffset}= Set Variable ${xoffset+306} + ${yoffset}= Set Variable ${yoffset+248} + ${map}= Create Dictionary catalog_resource_id=${catalog_resource_id} catalog_resource_name=${catalog_resource_name} milli_timestamp=${milli_timestamp} posX=${xoffset} posY=${yoffset} originType=${resourceType} + Templating.Create Environment sdc_resource_instance ${ASSETS_DIR} + ${data}= Templating.Apply Template sdc_resource_instance ${SDC_RESOURCE_INSTANCE_TEMPLATE} ${map} + ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} ${data} ${SDC_DESIGNER_USER_ID} + Should Be Equal As Strings ${resp.status_code} 201 + [Return] ${resp.json()['uniqueId']} ${resp.json()['name']} + +Create Monitoring Configuration + [Documentation] Create a monitoring configuration for a given service based on a previously created VFCMT + ... Return the unique_id and uuid of the created catalog service for the monitoring configuration + ... and the name of the related VFCMT instance + [Arguments] ${service_name} ${vf_unique_id} ${vf_name} + ${cs_unique_id} ${cs_uuid} Add Catalog Service For Monitoring Template ${service_name} + ${vfi_uuid} ${vfi_name} Add SDC Resource Instance ${cs_unique_id} ${vf_unique_id} ${vf_name} + [return] ${cs_unique_id} ${cs_uuid} ${vfi_name} + +Certify And Approve SDC Catalog Service + [Documentation] Perform the required steps to certify and approve the given SDC catalog service + [Arguments] ${cs_unique_id} + + Checkin SDC Catalog Service ${cs_unique_id} + Request Certify SDC Catalog Service ${cs_unique_id} + Start Certify SDC Catalog Service ${cs_unique_id} + ${cert_cs_unique_id}= Certify SDC Catalog Service ${cs_unique_id} + Approve SDC Catalog Service ${cert_cs_unique_id} + +# All the following methods are adjusted from sdc_interface.robot + +Checkin SDC Catalog Service + [Documentation] Checks in an SDC Catalog Service by its id + [Arguments] ${catalog_service_id} + ${map}= Create Dictionary user_remarks=Robot remarks + Templating.Create Environment sdc_user_remarks ${ASSETS_DIR} + ${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map} + ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_LIFECYCLE_PATH}/checkin ${data} ${SDC_DESIGNER_USER_ID} + + Should Be Equal As Strings ${resp.status_code} 200 + [Return] ${resp.json()} + +Request Certify SDC Catalog Service + [Documentation] Requests certification of an SDC Catalog Service by its id + [Arguments] ${catalog_service_id} + ${map}= Create Dictionary user_remarks=Robot remarks + Templating.Create Environment sdc_user_remarks ${ASSETS_DIR} + ${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map} + ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_LIFECYCLE_PATH}/certificationRequest ${data} ${SDC_DESIGNER_USER_ID} + Should Be Equal As Strings ${resp.status_code} 200 + [Return] ${resp.json()} + +Start Certify SDC Catalog Service + [Documentation] Start certification of an SDC Catalog Service by its id + [Arguments] ${catalog_service_id} + ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_LIFECYCLE_PATH}/startCertification ${None} ${SDC_TESTER_USER_ID} + Should Be Equal As Strings ${resp.status_code} 200 + [Return] ${resp.json()} + +Certify SDC Catalog Service + [Documentation] Certifies an SDC Catalog Service by its id and returns the new id + [Arguments] ${catalog_service_id} + ${map}= Create Dictionary user_remarks=Robot remarks + Templating.Create Environment sdc_user_remarks ${ASSETS_DIR} + ${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map} + ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_LIFECYCLE_PATH}/certify ${data} ${SDC_TESTER_USER_ID} + Should Be Equal As Strings ${resp.status_code} 200 + [Return] ${resp.json()['uniqueId']} + +Approve SDC Catalog Service + [Documentation] Approves an SDC Catalog Service by its id + [Arguments] ${catalog_service_id} + ${map}= Create Dictionary user_remarks=Robot remarks + Templating.Create Environment sdc_user_remarks ${ASSETS_DIR} + ${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map} + ${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_SERVICE_DISTRIBUTION_STATE_PATH}${SDC_DISTRIBUTION_STATE_APPROVE_PATH} ${data} ${SDC_GOVERNOR_USER_ID} + Should Be Equal As Strings ${resp.status_code} 200 + [Return] ${resp.json()} |