diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/sdc/dcaed/__init__.robot | 2 | ||||
-rw-r--r-- | tests/sdc/dcaed/asdc_interface.robot | 161 | ||||
-rwxr-xr-x | tests/sdc/dcaed/assets/artifact_upload.template | 8 | ||||
-rwxr-xr-x | tests/sdc/dcaed/assets/catalog_service.template | 42 | ||||
-rw-r--r-- | tests/sdc/dcaed/assets/component_catalog_resource.template | 41 | ||||
-rw-r--r-- | tests/sdc/dcaed/assets/create_vfcmt.template | 4 | ||||
-rw-r--r-- | tests/sdc/dcaed/assets/dcae_composition.template | 849 | ||||
-rwxr-xr-x | tests/sdc/dcaed/assets/dcae_monitoring_configuration.template | 11 | ||||
-rw-r--r-- | tests/sdc/dcaed/assets/resource_instance.template | 10 | ||||
-rwxr-xr-x | tests/sdc/dcaed/assets/schema.yaml | 551 | ||||
-rwxr-xr-x | tests/sdc/dcaed/assets/template.yaml | 117 | ||||
-rwxr-xr-x | tests/sdc/dcaed/assets/translate.yaml | 147 | ||||
-rw-r--r-- | tests/sdc/dcaed/assets/user_remarks.template | 1 | ||||
-rw-r--r-- | tests/sdc/dcaed/common.robot | 11 | ||||
-rw-r--r-- | tests/sdc/dcaed/dcaed_interface.robot | 76 | ||||
-rw-r--r-- | tests/sdc/dcaed/json_templater.robot | 20 | ||||
-rw-r--r-- | tests/sdc/dcaed/monitoring_configuration_service_test.robot | 78 |
17 files changed, 2129 insertions, 0 deletions
diff --git a/tests/sdc/dcaed/__init__.robot b/tests/sdc/dcaed/__init__.robot new file mode 100644 index 00000000..fc9392d3 --- /dev/null +++ b/tests/sdc/dcaed/__init__.robot @@ -0,0 +1,2 @@ +*** Settings *** +Documentation Sdc - dcaed diff --git a/tests/sdc/dcaed/asdc_interface.robot b/tests/sdc/dcaed/asdc_interface.robot new file mode 100644 index 00000000..88053e88 --- /dev/null +++ b/tests/sdc/dcaed/asdc_interface.robot @@ -0,0 +1,161 @@ +*** Settings *** +Library Collections +Library OperatingSystem +Library RequestsLibrary +Library ONAPLibrary.Utilities + +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 + +${ASDC_CATALOG_RESOURCE_TEMPLATE} ${ASSETS_DIR}component_catalog_resource.template +${ASDC_CATALOG_SERVICE_TEMPLATE} ${ASSETS_DIR}catalog_service.template +${ASDC_ARTIFACT_UPLOAD_TEMPLATE} ${ASSETS_DIR}artifact_upload.template +${ASDC_USER_REMARKS_TEMPLATE} ${ASSETS_DIR}user_remarks.template +${DCAE_VFCMT_TEMPLATE} ${ASSETS_DIR}create_vfcmt.template +${DCAE_COMPOSITION_TEMPLATE} ${ASSETS_DIR}dcae_composition.template +${DCAE_MONITORING_CONFIGURATION_TEMPLATE} ${ASSETS_DIR}dcae_monitoring_configuration.template +${ASDC_RESOURCE_INSTANCE_TEMPLATE} ${ASSETS_DIR}resource_instance.template + +${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} + ${data}= json_templater.Fill JSON Template File ${ASDC_CATALOG_RESOURCE_TEMPLATE} ${map} + [Return] ${data} + +# Based on testsuite/robot/resources/asdc_interface.robot's 'Post ASDC Resource Request' keyword +Post ASDC Resource Request Unauthenticated + [Documentation] Makes unauthenticated Post request for ASDC Catalog resource and returns its unique id + [Arguments] ${data} + ${resp}= Run ASDC Post Request Unauthenticated ${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/asdc_interface.robot's 'Run ASDC Post Request' keyword +Run ASDC Post Request Unauthenticated + [Documentation] Runs an ASDC Post request without authentication and returns the HTTP response + [Arguments] ${data_path} ${data} ${user}=${ASDC_DESIGNER_USER_ID} ${MY_ASDC_BE_ENDPOINT}=${ASDC_BE_ENDPOINT} + Log Creating session ${MY_ASDC_BE_ENDPOINT} + ${session}= Create Session asdc ${MY_ASDC_BE_ENDPOINT} + ${uuid}= Generate UUID4 + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json USER_ID=${user} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} + ${resp}= Post Request asdc ${data_path} data=${data} headers=${headers} + Log Received response from asdc ${resp.text} + [Return] ${resp} + +# Based on testsuite/robot/resources/asdc_interface.robot's 'Run ASDC MD5 Post Request' keyword +Run ASDC MD5 Post Request Unauthenticated + [Documentation] Runs an ASDC post request with MD5 Checksum header without authentication and returns the HTTP response + [Arguments] ${data_path} ${data} ${user}=${ASDC_DESIGNER_USER_ID} ${MY_ASDC_BE_ENDPOINT}=${ASDC_BE_ENDPOINT} + Log Creating session ${MY_ASDC_BE_ENDPOINT} + ${session}= Create Session asdc ${MY_ASDC_BE_ENDPOINT} + ${uuid}= Generate UUID4 + ${data_string}= Evaluate json.dumps(${data}) json + ${md5checksum}= Evaluate md5.new('''${data_string}''').hexdigest() modules=md5 + ${base64md5checksum}= Evaluate base64.b64encode("${md5checksum}") modules=base64 + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json USER_ID=${user} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} Content-MD5=${base64md5checksum} + ${resp}= Post Request asdc ${data_path} data=${data} headers=${headers} + Log Received response from asdc: ${resp.text} + [Return] ${resp} + +# Based on testsuite/robot/resources/asdc_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}= Evaluate base64.b64encode('''${blueprint_data}'''.encode('utf-8')) modules=base64 + ${dict}= Create Dictionary artifactLabel=${artifact} artifactName=${artifact}.yaml artifactType=DCAE_TOSCA artifactGroupType=DEPLOYMENT description=${artifact}.yaml payloadData=${payloadData} + ${data}= Fill JSON Template File ${ASDC_ARTIFACT_UPLOAD_TEMPLATE} ${dict} + # POST artifactUpload to resource + ${resp}= Run ASDC MD5 Post Request Unauthenticated ${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/asdc_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 + ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map} + ${resp}= Run ASDC Post Request Unauthenticated ${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} + ${data}= Fill JSON Template File ${ASDC_CATALOG_SERVICE_TEMPLATE} ${map} + ${resp}= Run ASDC Post Request Unauthenticated ${ASDC_CATALOG_SERVICES_PATH} ${data} + Should Be Equal As Strings ${resp.status_code} 201 + [Return] ${resp.json()['uniqueId']} ${resp.json()['uuid']} + +# Based on testsuite/robot/resources/asdc_interface.robot's 'Add ASDC 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} + ${data}= Fill JSON Template File ${ASDC_RESOURCE_INSTANCE_TEMPLATE} ${map} + ${resp}= Run ASDC Post Request Unauthenticated ${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']} + +# Adjusted from asdc_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 + ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map} + ${resp}= Run ASDC Post Request Unauthenticated ${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 + ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map} + ${resp}= Run ASDC Post Request Unauthenticated ${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}= Run ASDC Post Request Unauthenticated ${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 + ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map} + ${resp}= Run ASDC Post Request Unauthenticated ${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 + ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map} + ${resp}= Run ASDC Post Request Unauthenticated ${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/dcaed/assets/artifact_upload.template b/tests/sdc/dcaed/assets/artifact_upload.template new file mode 100755 index 00000000..9be6ca04 --- /dev/null +++ b/tests/sdc/dcaed/assets/artifact_upload.template @@ -0,0 +1,8 @@ +{ + "artifactLabel":"${artifactLabel}", + "artifactName": "${artifactName}", + "artifactType": "${artifactType}", + "artifactGroupType": "${artifactGroupType}", + "description": "${description}", + "payloadData": "${payloadData}" +} diff --git a/tests/sdc/dcaed/assets/catalog_service.template b/tests/sdc/dcaed/assets/catalog_service.template new file mode 100755 index 00000000..56085025 --- /dev/null +++ b/tests/sdc/dcaed/assets/catalog_service.template @@ -0,0 +1,42 @@ +{ + "artifacts": {}, + "toscaArtifacts": {}, + "contactId": "cs0008", + "categories": [ + { + "name": "Network L4+", + "normalizedName": "network l4+", + "uniqueId": "serviceNewCategory.network l4+", + "icons": [ + "network_l_4" + ], + "subcategories": null, + "version": null, + "ownerId": null, + "empty": false, + "type": null + } + ], + "description": "Created by robot for monitoring template", + "icon": "defaulticon", + "componentInstancesProperties": {}, + "componentInstancesAttributes": {}, + "name": "${service_name}", + "tags": [ + "robot-ete", + "${service_name}" + ], + "capabilities": {}, + "requirements": {}, + "deploymentArtifacts": {}, + "componentType": "SERVICE", + "projectCode": "123456", + "componentInstances": [], + "properties": [], + "attributes": [], + "forwardingPaths": {}, + "ecompGeneratedNaming": true, + "serviceApiArtifacts": {}, + "instantiationType": "A-la-carte", + "environmentContext": "General_Revenue-Bearing" +} diff --git a/tests/sdc/dcaed/assets/component_catalog_resource.template b/tests/sdc/dcaed/assets/component_catalog_resource.template new file mode 100644 index 00000000..cb6c402c --- /dev/null +++ b/tests/sdc/dcaed/assets/component_catalog_resource.template @@ -0,0 +1,41 @@ +{ + "artifacts": {}, + "toscaArtifacts": {}, + "contactId": "cs0008", + "categories": [ + { + "name": "DCAE Component", + "normalizedName": "dcaecomponent", + "uniqueId": "resourceNewCategory.dcaecomponent", + "subcategories": [ + { + "name": "Microservice", + "normalizedName": "microservice", + "uniqueId": "resourceNewCategory.dcaecomponent.microservice", + "icons": [ + "dcae_microservice" + ] + } + ] + } + ], + "description": "virtual function", + "icon": "defaulticon", + "componentInstancesProperties": {}, + "componentInstancesAttributes": {}, + "name": "${resource_name}", + "tags": [ + "${resource_name}" + ], + "capabilities": {}, + "requirements": {}, + "deploymentArtifacts": {}, + "componentType": "RESOURCE", + "vendorName": "${vendor_name}", + "vendorRelease": "1.0", + "componentInstances": [], + "properties": [], + "attributes": [], + "groups": [], + "resourceType": "VF" +} diff --git a/tests/sdc/dcaed/assets/create_vfcmt.template b/tests/sdc/dcaed/assets/create_vfcmt.template new file mode 100644 index 00000000..19ce2117 --- /dev/null +++ b/tests/sdc/dcaed/assets/create_vfcmt.template @@ -0,0 +1,4 @@ +{ +"name":"${vfcmtName}", +"description":"${description}" +} diff --git a/tests/sdc/dcaed/assets/dcae_composition.template b/tests/sdc/dcaed/assets/dcae_composition.template new file mode 100644 index 00000000..81be7893 --- /dev/null +++ b/tests/sdc/dcaed/assets/dcae_composition.template @@ -0,0 +1,849 @@ +{ + "cid": "${cid}", + "flowType": "TCA Hi Lo", + "inputs": [], + "nodes": [ + { + "capabilities": [ + { + "name": "feature", + "type": { + "id": "template.yaml/tosca.capabilities.Node", + "name": "tosca.capabilities.Node" + } + } + ], + "description": "/sdc/v1/catalog/resources/${vf_id}/toscaModel/", + "id": "${vf_id}", + "name": "tca-docker", + "ndata": { + "label": "tca-docker", + "name": "n.1559041944060.0", + "ports": [], + "px": 364, + "py": 437, + "radius": 30, + "x": 365, + "y": 438 + }, + "nid": "n.1559041944060.0", + "properties": [ + { + "default": 10000, + "name": "cpu_period", + "required": true, + "type": "integer" + }, + { + "default": 30000, + "name": "cpu_quota", + "required": true, + "type": "integer" + }, + { + "default": 256, + "name": "cpu_shares", + "required": true, + "type": "integer" + }, + { + "name": "image", + "required": true, + "type": "string" + }, + { + "assignment": { + "value": { + "get_property": [ + "SELF", + "composition", + "location_id" + ] + } + }, + "name": "location_id", + "required": true, + "type": "string", + "value": { + "get_property": [ + "SELF", + "composition", + "location_id" + ] + } + }, + { + "default": "500m", + "name": "mem_limit", + "required": true, + "type": "string" + }, + { + "default": "on-failure", + "name": "restart_policy.Name", + "required": true, + "type": "string" + }, + { + "default": 3, + "name": "restart_policy.max_retry_counts", + "required": true, + "type": "integer" + }, + { + "name": "service_component_type", + "required": true, + "type": "string" + } + ], + "requirements": [ + { + "capability": { + "id": "template.yaml/dcae.capabilities.dmmap.topic", + "name": "dcae.capabilities.dmmap.topic" + }, + "name": "stream_subscribe_0", + "node": "topic0", + "relationship": { + "type": "dcae.relationships.subscribe_to_events" + } + }, + { + "capability": { + "id": "template.yaml/dcae.capabilities.dmmap.topic", + "name": "dcae.capabilities.dmmap.topic" + }, + "name": "stream_publish_0", + "node": "topic1", + "relationship": { + "type": "dcae.relationships.publish_events" + } + }, + { + "capability": { + "id": "template.yaml/dcae.capabilities.dockerHost", + "name": "dcae.capabilities.dockerHost" + }, + "name": "host", + "relationship": { + "type": "dcae.relationships.component_contained_in" + } + }, + { + "capability": { + "id": "template.yaml/dcae.capabilities.composition.host", + "name": "dcae.capabilities.composition.host" + }, + "name": "composition" + }, + { + "capability": { + "id": "template.yaml/tosca.capabilities.Node", + "name": "tosca.capabilities.Node" + }, + "name": "dependency", + "node": "tosca.nodes.Root", + "occurrences": [ + 0, + "UNBOUNDED" + ], + "relationship": { + "type": "tosca.relationships.DependsOn" + } + } + ], + "type": { + "name": "tosca.dcae.nodes.dockerApp.tca-docker" + }, + "typeinfo": { + "capabilities": [ + { + "name": "feature", + "type": { + "id": "${vf_id}/tosca.capabilities.Node", + "name": "tosca.capabilities.Node" + } + } + ], + "hierarchy": [ + { + "id": "${vf_id}/tosca.dcae.nodes.dockerApp", + "name": "tosca.dcae.nodes.dockerApp" + }, + { + "id": "${vf_id}/tosca.dcae.nodes.Root", + "name": "tosca.dcae.nodes.Root" + }, + { + "description": "The TOSCA Node Type all other TOSCA base Node Types derive from", + "id": "${vf_id}/tosca.nodes.Root", + "name": "tosca.nodes.Root" + } + ], + "id": "${vf_id}/tosca.dcae.nodes.dockerApp.tca-docker", + "itemId": "${vf_id}/tosca.dcae.nodes.dockerApp.tca-docker", + "name": "tosca.dcae.nodes.dockerApp.tca-docker", + "requirements": [ + { + "capability": { + "id": "${vf_id}/dcae.capabilities.dmmap.topic", + "name": "dcae.capabilities.dmmap.topic" + }, + "id": "${vf_id}/stream_subscribe_0", + "name": "stream_subscribe_0", + "node": { + "id": "${vf_id}/dcae.capabilities.dmmap.topic", + "name": "dcae.capabilities.dmmap.topic" + }, + "relationship": { + "type": "dcae.relationships.subscribe_to_events" + } + }, + { + "capability": { + "id": "${vf_id}/dcae.capabilities.dmmap.topic", + "name": "dcae.capabilities.dmmap.topic" + }, + "id": "${vf_id}/stream_publish_0", + "name": "stream_publish_0", + "node": { + "id": "${vf_id}/dcae.capabilities.dmmap.topic", + "name": "dcae.capabilities.dmmap.topic" + }, + "relationship": { + "type": "dcae.relationships.publish_events" + } + }, + { + "capability": { + "id": "${vf_id}/dcae.capabilities.dockerHost", + "name": "dcae.capabilities.dockerHost" + }, + "id": "${vf_id}/host", + "name": "host", + "node": { + "id": "${vf_id}/dcae.capabilities.dockerHost", + "name": "dcae.capabilities.dockerHost" + }, + "relationship": { + "type": "dcae.relationships.component_contained_in" + } + }, + { + "capability": { + "id": "${vf_id}/dcae.capabilities.composition.host", + "name": "dcae.capabilities.composition.host" + }, + "id": "${vf_id}/composition", + "name": "composition", + "node": { + "id": "${vf_id}/dcae.capabilities.composition.host", + "name": "dcae.capabilities.composition.host" + } + }, + { + "capability": { + "id": "${vf_id}/tosca.capabilities.Node", + "name": "tosca.capabilities.Node" + }, + "id": "${vf_id}/dependency", + "name": "dependency", + "node": { + "id": "${vf_id}/tosca.capabilities.Node", + "name": "tosca.capabilities.Node" + }, + "occurrences": [ + 0, + "UNBOUNDED" + ], + "relationship": { + "type": "tosca.relationships.DependsOn" + } + } + ] + } + }, + { + "capabilities": [ + { + "name": "topic", + "properties": [ + { + "assignment": { + "value": { + "get_property": [ + "SELF", + "aaf_password" + ] + } + }, + "name": "aaf_password", + "type": "string" + }, + { + "assignment": { + "value": { + "get_property": [ + "SELF", + "aaf_username" + ] + } + }, + "name": "aaf_username", + "type": "string" + }, + { + "assignment": { + "value": { + "get_property": [ + "SELF", + "client_role" + ] + } + }, + "name": "client_role", + "type": "string" + }, + { + "assignment": { + "value": { + "get_property": [ + "SELF", + "location" + ] + } + }, + "name": "location", + "type": "string" + }, + { + "assignment": { + "value": { + "get_property": [ + "SELF", + "node_name" + ] + } + }, + "name": "node_name", + "type": "string" + }, + { + "assignment": { + "value": { + "get_property": [ + "SELF", + "topic_name" + ] + } + }, + "name": "topic_name", + "type": "string" + } + ], + "type": { + "id": "template.yaml/dcae.capabilities.dmmap.topic", + "name": "dcae.capabilities.dmmap.topic" + } + }, + { + "name": "feature", + "type": { + "id": "template.yaml/tosca.capabilities.Node", + "name": "tosca.capabilities.Node" + } + } + ], + "description": "/sdc/v1/catalog/resources/${vf_id}/toscaModel/", + "id": "${vf_id}", + "name": "topic0", + "ndata": { + "label": "topic0", + "name": "n.1559041944077.1", + "ports": [], + "px": 414, + "py": 430.9243296300162, + "radius": 30, + "x": 415, + "y": 431.9243296300162 + }, + "nid": "n.1559041944077.1", + "properties": [ + { + "assignment": { + "value": { + "get_input": "topic0_aaf_password" + } + }, + "name": "aaf_password", + "type": "string", + "value": { + "get_input": "topic0_aaf_password" + } + }, + { + "assignment": { + "value": { + "get_input": "topic0_aaf_username" + } + }, + "name": "aaf_username", + "type": "string", + "value": { + "get_input": "topic0_aaf_username" + } + }, + { + "assignment": { + "value": { + "get_input": "topic0_client_role" + } + }, + "name": "client_role", + "type": "string", + "value": { + "get_input": "topic0_client_role" + } + }, + { + "assignment": { + "value": { + "get_property": [ + "SELF", + "composition", + "location_id" + ] + } + }, + "name": "location", + "type": "string", + "value": { + "get_property": [ + "SELF", + "composition", + "location_id" + ] + } + }, + { + "assignment": { + "value": "__GET_NODE_NAME__" + }, + "name": "node_name", + "type": "string", + "value": "__GET_NODE_NAME__" + }, + { + "assignment": { + "value": "" + }, + "name": "topic_name", + "type": "string" + } + ], + "requirements": [ + { + "capability": { + "id": "template.yaml/dcae.capabilities.composition.host", + "name": "dcae.capabilities.composition.host" + }, + "name": "composition" + }, + { + "capability": { + "id": "template.yaml/tosca.capabilities.Node", + "name": "tosca.capabilities.Node" + }, + "name": "dependency", + "node": "tosca.nodes.Root", + "occurrences": [ + 0, + "UNBOUNDED" + ], + "relationship": { + "type": "tosca.relationships.DependsOn" + } + } + ], + "type": { + "name": "tosca.dcae.nodes.dmaap.topic" + }, + "typeinfo": { + "capabilities": [ + { + "name": "topic", + "type": { + "id": "${vf_id}/dcae.capabilities.dmmap.topic", + "name": "dcae.capabilities.dmmap.topic" + } + }, + { + "name": "feature", + "type": { + "id": "${vf_id}/tosca.capabilities.Node", + "name": "tosca.capabilities.Node" + } + } + ], + "hierarchy": [ + { + "id": "${vf_id}/tosca.dcae.nodes.Root", + "name": "tosca.dcae.nodes.Root" + }, + { + "description": "The TOSCA Node Type all other TOSCA base Node Types derive from", + "id": "${vf_id}/tosca.nodes.Root", + "name": "tosca.nodes.Root" + } + ], + "id": "${vf_id}/tosca.dcae.nodes.dmaap.topic", + "itemId": "${vf_id}/tosca.dcae.nodes.dmaap.topic", + "name": "tosca.dcae.nodes.dmaap.topic", + "requirements": [ + { + "capability": { + "id": "${vf_id}/dcae.capabilities.composition.host", + "name": "dcae.capabilities.composition.host" + }, + "id": "${vf_id}/composition", + "name": "composition", + "node": { + "id": "${vf_id}/dcae.capabilities.composition.host", + "name": "dcae.capabilities.composition.host" + } + }, + { + "capability": { + "id": "${vf_id}/tosca.capabilities.Node", + "name": "tosca.capabilities.Node" + }, + "id": "${vf_id}/dependency", + "name": "dependency", + "node": { + "id": "${vf_id}/tosca.capabilities.Node", + "name": "tosca.capabilities.Node" + }, + "occurrences": [ + 0, + "UNBOUNDED" + ], + "relationship": { + "type": "tosca.relationships.DependsOn" + } + } + ] + } + }, + { + "capabilities": [ + { + "name": "topic", + "properties": [ + { + "assignment": { + "value": { + "get_property": [ + "SELF", + "aaf_password" + ] + } + }, + "name": "aaf_password", + "type": "string" + }, + { + "assignment": { + "value": { + "get_property": [ + "SELF", + "aaf_username" + ] + } + }, + "name": "aaf_username", + "type": "string" + }, + { + "assignment": { + "value": { + "get_property": [ + "SELF", + "client_role" + ] + } + }, + "name": "client_role", + "type": "string" + }, + { + "assignment": { + "value": { + "get_property": [ + "SELF", + "location" + ] + } + }, + "name": "location", + "type": "string" + }, + { + "assignment": { + "value": { + "get_property": [ + "SELF", + "node_name" + ] + } + }, + "name": "node_name", + "type": "string" + }, + { + "assignment": { + "value": { + "get_property": [ + "SELF", + "topic_name" + ] + } + }, + "name": "topic_name", + "type": "string" + } + ], + "type": { + "id": "template.yaml/dcae.capabilities.dmmap.topic", + "name": "dcae.capabilities.dmmap.topic" + } + }, + { + "name": "feature", + "type": { + "id": "template.yaml/tosca.capabilities.Node", + "name": "tosca.capabilities.Node" + } + } + ], + "description": "/sdc/v1/catalog/resources/${vf_id}/toscaModel/", + "id": "${vf_id}", + "name": "topic1", + "ndata": { + "label": "topic1", + "name": "n.1559041944083.2", + "ports": [], + "px": 464, + "py": 451.6297431929615, + "radius": 30, + "x": 465, + "y": 452.6297431929615 + }, + "nid": "n.1559041944083.2", + "properties": [ + { + "assignment": { + "value": { + "get_input": "topic1_aaf_password" + } + }, + "name": "aaf_password", + "type": "string", + "value": { + "get_input": "topic1_aaf_password" + } + }, + { + "assignment": { + "value": { + "get_input": "topic1_aaf_username" + } + }, + "name": "aaf_username", + "type": "string", + "value": { + "get_input": "topic1_aaf_username" + } + }, + { + "assignment": { + "value": { + "get_input": "topic1_client_role" + } + }, + "name": "client_role", + "type": "string", + "value": { + "get_input": "topic1_client_role" + } + }, + { + "assignment": { + "value": { + "get_property": [ + "SELF", + "composition", + "location_id" + ] + } + }, + "name": "location", + "type": "string", + "value": { + "get_property": [ + "SELF", + "composition", + "location_id" + ] + } + }, + { + "assignment": { + "value": "__GET_NODE_NAME__" + }, + "name": "node_name", + "type": "string", + "value": "__GET_NODE_NAME__" + }, + { + "assignment": { + "value": "" + }, + "name": "topic_name", + "type": "string" + } + ], + "requirements": [ + { + "capability": { + "id": "template.yaml/dcae.capabilities.composition.host", + "name": "dcae.capabilities.composition.host" + }, + "name": "composition" + }, + { + "capability": { + "id": "template.yaml/tosca.capabilities.Node", + "name": "tosca.capabilities.Node" + }, + "name": "dependency", + "node": "tosca.nodes.Root", + "occurrences": [ + 0, + "UNBOUNDED" + ], + "relationship": { + "type": "tosca.relationships.DependsOn" + } + } + ], + "type": { + "name": "tosca.dcae.nodes.dmaap.topic" + }, + "typeinfo": { + "capabilities": [ + { + "name": "topic", + "type": { + "id": "${vf_id}/dcae.capabilities.dmmap.topic", + "name": "dcae.capabilities.dmmap.topic" + } + }, + { + "name": "feature", + "type": { + "id": "${vf_id}/tosca.capabilities.Node", + "name": "tosca.capabilities.Node" + } + } + ], + "hierarchy": [ + { + "id": "${vf_id}/tosca.dcae.nodes.Root", + "name": "tosca.dcae.nodes.Root" + }, + { + "description": "The TOSCA Node Type all other TOSCA base Node Types derive from", + "id": "${vf_id}/tosca.nodes.Root", + "name": "tosca.nodes.Root" + } + ], + "id": "${vf_id}/tosca.dcae.nodes.dmaap.topic", + "itemId": "${vf_id}/tosca.dcae.nodes.dmaap.topic", + "name": "tosca.dcae.nodes.dmaap.topic", + "requirements": [ + { + "capability": { + "id": "${vf_id}/dcae.capabilities.composition.host", + "name": "dcae.capabilities.composition.host" + }, + "id": "${vf_id}/composition", + "name": "composition", + "node": { + "id": "${vf_id}/dcae.capabilities.composition.host", + "name": "dcae.capabilities.composition.host" + } + }, + { + "capability": { + "id": "${vf_id}/tosca.capabilities.Node", + "name": "tosca.capabilities.Node" + }, + "id": "${vf_id}/dependency", + "name": "dependency", + "node": { + "id": "${vf_id}/tosca.capabilities.Node", + "name": "tosca.capabilities.Node" + }, + "occurrences": [ + 0, + "UNBOUNDED" + ], + "relationship": { + "type": "tosca.relationships.DependsOn" + } + } + ] + } + } + ], + "outputs": [], + "relations": [ + { + "meta": { + "n1": "n.1559041944060.0", + "n2": "n.1559041944077.1", + "p1": "stream_subscribe_0", + "p2": "topic", + "relationship": [ + "tca-docker", + null, + "stream_subscribe_0" + ] + }, + "n1": "n.1559041944060.0", + "n2": "n.1559041944077.1", + "name1": "tca-docker", + "name2": "topic0", + "rid": "lnk.1559041944098.3" + }, + { + "meta": { + "n1": "n.1559041944060.0", + "n2": "n.1559041944083.2", + "p1": "stream_publish_0", + "p2": "topic", + "relationship": [ + "tca-docker", + null, + "stream_publish_0" + ] + }, + "n1": "n.1559041944060.0", + "n2": "n.1559041944083.2", + "name1": "tca-docker", + "name2": "topic1", + "rid": "lnk.1559041944104.4" + } + ], + "version": 0 +} diff --git a/tests/sdc/dcaed/assets/dcae_monitoring_configuration.template b/tests/sdc/dcaed/assets/dcae_monitoring_configuration.template new file mode 100755 index 00000000..f42e4685 --- /dev/null +++ b/tests/sdc/dcaed/assets/dcae_monitoring_configuration.template @@ -0,0 +1,11 @@ +{ + "name": "${name}", + "description": "Created by robot", + "templateUuid": "${template_uuid}", + "vfiName": "${vfi_name}", + "serviceUuid": "${service_uuid}", + "contextType": "SERVICE", + "flowType": "TCA Hi Lo", + "cloneVFCMT": true, + "updateFlowType": false +} diff --git a/tests/sdc/dcaed/assets/resource_instance.template b/tests/sdc/dcaed/assets/resource_instance.template new file mode 100644 index 00000000..18cf34c7 --- /dev/null +++ b/tests/sdc/dcaed/assets/resource_instance.template @@ -0,0 +1,10 @@ +{ + "uniqueId": "${catalog_resource_id}${milli_timestamp}", + "posX": ${posX}, + "posY": ${posY}, + "name": "${catalog_resource_name}", + "componentVersion": "1.0", + "originType": "${originType}", + "icon": "defaulticon", + "componentUid": "${catalog_resource_id}" +} diff --git a/tests/sdc/dcaed/assets/schema.yaml b/tests/sdc/dcaed/assets/schema.yaml new file mode 100755 index 00000000..7024a35c --- /dev/null +++ b/tests/sdc/dcaed/assets/schema.yaml @@ -0,0 +1,551 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +capability_types: + dcae.capabilities.cdapHost: + derived_from: tosca.capabilities.Root + dcae.capabilities.composition.host: + derived_from: tosca.capabilities.Root + properties: + location_id: + type: string + service_id: + type: string + dcae.capabilities.dmmap.feed: + derived_from: tosca.capabilities.Root + properties: + feed_name: + type: string + location: + type: string + node_name: + type: string + dcae.capabilities.dmmap.topic: + derived_from: tosca.capabilities.Root + properties: + aaf_password: + type: string + aaf_username: + type: string + client_role: + type: string + location: + type: string + node_name: + type: string + topic_name: + type: string + dcae.capabilities.dockerHost: + derived_from: tosca.capabilities.Root + dcae.capabilities.policy: + derived_from: tosca.capabilities.Root + dcae.capabilities.service.provide: + derived_from: tosca.capabilities.Root + properties: + request_format: + type: string + request_version: + type: string + response_format: + type: string + response_version: + type: string + service_endpoint: + type: string + service_name: + type: string + verb: + type: string + dcae.capabilities.stream.subscribe: + derived_from: tosca.capabilities.Root + properties: + format: + type: string + route: + type: string + version: + type: string +relationship_types: + cloudify.relationships.depends_on: + derived_from: tosca.relationships.Root + dcae.relationships.component_contained_in: + derived_from: tosca.relationships.Root + dcae.relationships.publish_events: + derived_from: tosca.relationships.Root + dcae.relationships.publish_files: + derived_from: tosca.relationships.Root + dcae.relationships.rework_connected_to: + derived_from: tosca.relationships.Root + dcae.relationships.subscribe_to_events: + derived_from: tosca.relationships.Root + dcae.relationships.subscribe_to_files: + derived_from: tosca.relationships.Root +node_types: + cloudify.dcae.nodes.Root: + derived_from: tosca.nodes.Root + dcae.nodes.ContainerizedComponent: + derived_from: cloudify.dcae.nodes.Root + properties: + application_config: + required: true + type: map + docker_config: + type: map + image: + required: true + type: string + dcae.nodes.ContainerizedServiceComponent: + attributes: + service_component_name: + type: string + derived_from: dcae.nodes.ContainerizedComponent + properties: + location_id: + required: true + type: string + service_component_type: + required: true + type: string + dcae.nodes.ContainerizedServiceComponentUsingDmaap: + derived_from: dcae.nodes.ContainerizedServiceComponent + properties: + streams_publishes: + type: list + streams_subscribes: + type: list + dcae.nodes.DockerContainerForComponents: + attributes: + service_component_name: + type: string + derived_from: cloudify.dcae.nodes.Root + interfaces: + cloudify.interfaces.lifecycle: + start: + inputs: + host_config: + type: map + stop: + inputs: + cleanup_image: + type: boolean + type: tosca.interfaces.Root + properties: + application_config: + required: true + type: map + docker_config: + type: map + image: + required: true + type: string + location_id: + required: true + type: string + service_component_type: + required: true + type: string + requirements: + - host: + capability: dcae.capabilities.dockerHost + relationship: dcae.relationships.component_contained_in + dcae.nodes.DockerContainerForComponentsUsingDmaap: + derived_from: dcae.nodes.DockerContainerForComponents + properties: + application_config: + required: true + type: map + docker_config: + type: map + image: + required: true + type: string + location_id: + required: true + type: string + service_component_type: + required: true + type: string + streams_publishes: + type: list + streams_subscribes: + type: list + attributes: + service_component_name: + type: string + requirements: + - host: + capability: dcae.capabilities.dockerHost + relationship: dcae.relationships.component_contained_in + - stream_subscribe_0: + capability: dcae.capabilities.dmmap.topic + relationship: dcae.relationships.subscribe_to_events + - stream_publish_0: + capability: dcae.capabilities.dmmap.topic + relationship: dcae.relationships.publish_events + interfaces: + cloudify.interfaces.lifecycle: + start: + inputs: + host_config: + type: map + stop: + inputs: + cleanup_image: + type: boolean + type: tosca.interfaces.Root + dcae.nodes.ExistingFeed: + capabilities: + feed: + type: dcae.capabilities.dmmap.feed + derived_from: cloudify.dcae.nodes.Root + properties: + feed_id: + type: string + dcae.nodes.ExistingTopic: + capabilities: + topic: + type: dcae.capabilities.dmmap.topic + derived_from: cloudify.dcae.nodes.Root + properties: + fqtn: + type: string + dcae.nodes.ExternalTargetFeed: + capabilities: + feed: + type: dcae.capabilities.dmmap.feed + derived_from: cloudify.dcae.nodes.Root + properties: + url: + type: string + username: + type: string + userpw: + type: string + dcae.nodes.Feed: + capabilities: + feed: + type: dcae.capabilities.dmmap.feed + derived_from: cloudify.dcae.nodes.Root + properties: + feed_name: + type: string + dcae.nodes.MicroService.cdap: + attributes: + service_component_name: + type: string + derived_from: cloudify.dcae.nodes.Root + interfaces: + cloudify.interfaces.lifecycle: + create: + inputs: + connected_broker_dns_name: + type: string + type: tosca.interfaces.Root + properties: + app_config: + required: false + type: map + app_preferences: + required: false + type: map + artifact_name: + required: false + type: string + artifact_version: + required: false + type: string + connections: + required: false + type: map + jar_url: + type: string + namespace: + required: false + type: string + program_preferences: + required: false + type: list + programs: + required: false + type: list + service_component_type: + type: string + service_endpoints: + required: false + type: list + streamname: + required: false + type: string + requirements: + - host: + capability: dcae.capabilities.cdapHost + relationship: dcae.relationships.component_contained_in + dcae.nodes.SelectedDockerHost: + capabilities: + host: + type: dcae.capabilities.dockerHost + derived_from: cloudify.dcae.nodes.Root + properties: + docker_host_override: + type: string + location_id: + required: true + type: string + dcae.nodes.Topic: + capabilities: + topic: + type: dcae.capabilities.dmmap.topic + derived_from: cloudify.dcae.nodes.Root + properties: + topic_name: + type: string + dcae.nodes.composition.virtual: + capabilities: + host: + type: dcae.capabilities.composition.host + derived_from: tosca.nodes.Root + properties: + location_id: + required: true + type: string + service_id: + required: true + type: string + dcae.nodes.policies: + capabilities: + policy: + type: dcae.capabilities.policy + derived_from: cloudify.dcae.nodes.Root + properties: + policy_filter: + type: map + dcae.nodes.policy: + capabilities: + policy: + type: dcae.capabilities.policy + derived_from: cloudify.dcae.nodes.Root + properties: + policy_id: + required: true + type: string + policy.nodes.Root: + derived_from: tosca.nodes.Root + properties: + policyDescription: + required: false + type: string + policyName: + required: true + type: string + policyScope: + required: true + type: string + policyVersion: + required: true + type: string + tosca.dcae.nodes.Root: + derived_from: tosca.nodes.Root + tosca.dcae.nodes.cdapApp: + attributes: + service_component_name: + type: string + derived_from: tosca.dcae.nodes.Root + properties: + connected_broker_dns_name: + default: cdap_broker + required: true + type: string + jar_url: + required: true + type: string + service_component_type: + required: true + type: string + requirements: + - host: + capability: dcae.capabilities.cdapHost + relationship: dcae.relationships.component_contained_in + tosca.dcae.nodes.dmaap.existingFeed: + capabilities: + feed: + type: dcae.capabilities.dmmap.feed + derived_from: tosca.dcae.nodes.Root + properties: + feed_id: + type: string + location: + type: string + node_name: + type: string + requirements: + - composition: + capability: dcae.capabilities.composition.host + tosca.dcae.nodes.dmaap.existingTopic: + capabilities: + topic: + type: dcae.capabilities.dmmap.topic + derived_from: tosca.dcae.nodes.Root + properties: + aaf_password: + type: string + aaf_username: + type: string + client_role: + type: string + fqtn: + type: string + location: + type: string + node_name: + type: string + requirements: + - composition: + capability: dcae.capabilities.composition.host + tosca.dcae.nodes.dmaap.externalTargetFeed: + capabilities: + feed: + type: dcae.capabilities.dmmap.feed + derived_from: tosca.dcae.nodes.Root + properties: + location: + type: string + node_name: + type: string + url: + type: string + username: + type: string + userpw: + type: string + requirements: + - composition: + capability: dcae.capabilities.composition.host + tosca.dcae.nodes.dmaap.feed: + capabilities: + feed: + type: dcae.capabilities.dmmap.feed + derived_from: tosca.dcae.nodes.Root + properties: + feed_name: + type: string + location: + type: string + node_name: + type: string + requirements: + - composition: + capability: dcae.capabilities.composition.host + tosca.dcae.nodes.dmaap.topic: + capabilities: + topic: + type: dcae.capabilities.dmmap.topic + derived_from: tosca.dcae.nodes.Root + properties: + aaf_password: + type: string + aaf_username: + type: string + client_role: + type: string + location: + type: string + node_name: + type: string + topic_name: + type: string + requirements: + - composition: + capability: dcae.capabilities.composition.host + tosca.dcae.nodes.dockerApp: + attributes: + service_component_name: + type: string + derived_from: tosca.dcae.nodes.Root + properties: + cpu_period: + default: 10000 + required: true + type: integer + cpu_quota: + default: 30000 + required: true + type: integer + cpu_shares: + default: 256 + required: true + type: integer + image: + required: true + type: string + location_id: + required: true + type: string + mem_limit: + default: 500m + required: true + type: string + restart_policy.Name: + default: on-failure + required: true + type: string + restart_policy.max_retry_counts: + default: 3 + required: true + type: integer + service_component_type: + required: true + type: string + requirements: + - host: + capability: dcae.capabilities.dockerHost + relationship: dcae.relationships.component_contained_in + - composition: + capability: dcae.capabilities.composition.host + tosca.dcae.nodes.dockerApp.tca-docker: + derived_from: tosca.dcae.nodes.dockerApp + requirements: + - stream_subscribe_0: + capability: dcae.capabilities.dmmap.topic + relationship: dcae.relationships.subscribe_to_events + - stream_publish_0: + capability: dcae.capabilities.dmmap.topic + relationship: dcae.relationships.publish_events + tosca.dcae.nodes.dockerHost: + capabilities: + host: + type: dcae.capabilities.dockerHost + derived_from: tosca.dcae.nodes.Root + properties: + docker_host_override: + type: string + location_id: + required: true + type: string + requirements: + - composition: + capability: dcae.capabilities.composition.host + tosca.dcae.nodes.policies: + capabilities: + policy: + type: dcae.capabilities.policy + derived_from: tosca.dcae.nodes.Root + properties: + configAttributes: + type: string + configName: + type: string + onapName: + type: string + policyName: + type: string + unique: + type: boolean + tosca.dcae.nodes.policy: + capabilities: + policy: + type: dcae.capabilities.policy + derived_from: tosca.dcae.nodes.Root + properties: + policy_id: + required: true + type: string + policy_name: + type: string diff --git a/tests/sdc/dcaed/assets/template.yaml b/tests/sdc/dcaed/assets/template.yaml new file mode 100755 index 00000000..5a03da76 --- /dev/null +++ b/tests/sdc/dcaed/assets/template.yaml @@ -0,0 +1,117 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: tca-docker +imports: +- schema: schema.yaml +topology_template: + inputs: + topic0_aaf_password: + type: string + topic0_aaf_username: + type: string + topic0_client_role: + type: string + topic1_aaf_password: + type: string + topic1_aaf_username: + type: string + topic1_client_role: + type: string + node_templates: + tca-docker: + type: tosca.dcae.nodes.dockerApp.tca-docker + properties: + location_id: + get_property: + - SELF + - composition + - location_id + requirements: + - stream_subscribe_0: topic0 + - stream_publish_0: topic1 + topic0: + type: tosca.dcae.nodes.dmaap.topic + properties: + aaf_password: + get_input: topic0_aaf_password + aaf_username: + get_input: topic0_aaf_username + client_role: + get_input: topic0_client_role + location: + get_property: + - SELF + - composition + - location_id + node_name: __GET_NODE_NAME__ + topic_name: '' + capabilities: + topic: + properties: + aaf_password: + get_property: + - SELF + - aaf_password + aaf_username: + get_property: + - SELF + - aaf_username + client_role: + get_property: + - SELF + - client_role + location: + get_property: + - SELF + - location + node_name: + get_property: + - SELF + - node_name + topic_name: + get_property: + - SELF + - topic_name + topic1: + type: tosca.dcae.nodes.dmaap.topic + properties: + aaf_password: + get_input: topic1_aaf_password + aaf_username: + get_input: topic1_aaf_username + client_role: + get_input: topic1_client_role + location: + get_property: + - SELF + - composition + - location_id + node_name: __GET_NODE_NAME__ + topic_name: '' + capabilities: + topic: + properties: + aaf_password: + get_property: + - SELF + - aaf_password + aaf_username: + get_property: + - SELF + - aaf_username + client_role: + get_property: + - SELF + - client_role + location: + get_property: + - SELF + - location + node_name: + get_property: + - SELF + - node_name + topic_name: + get_property: + - SELF + - topic_name diff --git a/tests/sdc/dcaed/assets/translate.yaml b/tests/sdc/dcaed/assets/translate.yaml new file mode 100755 index 00000000..5515dc2c --- /dev/null +++ b/tests/sdc/dcaed/assets/translate.yaml @@ -0,0 +1,147 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: tca-docker_translate +imports: +- schema: schema.yaml +topology_template: + inputs: + cpu_period: + type: integer + default: 10000 + cpu_quota: + type: integer + default: 30000 + cpu_shares: + type: integer + default: 256 + image: + type: string + location_id: + type: string + mem_limit: + type: string + default: 500m + restart_policy.Name: + type: string + default: on-failure + restart_policy.max_retry_counts: + type: integer + default: 3 + service_component_type: + type: string + substitution_mappings: + node_type: tosca.dcae.nodes.dockerApp.tca-docker + capabilities: {} + requirements: + host: + - tca-docker + - host + stream_publish_0: + - tca-docker + - stream_publish_0 + stream_subscribe_0: + - tca-docker + - stream_subscribe_0 + node_templates: + tca-docker: + type: dcae.nodes.DockerContainerForComponentsUsingDmaap + properties: + application_config: + services_calls: {} + streams_publishes: + tca_handle_out: + aaf_password: + get_property: + - SELF + - stream_publish_0 + - aaf_password + aaf_username: + get_property: + - SELF + - stream_publish_0 + - aaf_username + dmaap_info: + concat: + - '<<' + - get_property: + - SELF + - stream_publish_0 + - node_name + - '>>' + type: message_router + streams_subscribes: + tca_handle_in: + aaf_password: + get_property: + - SELF + - stream_subscribe_0 + - aaf_password + aaf_username: + get_property: + - SELF + - stream_subscribe_0 + - aaf_username + dmaap_info: + concat: + - '<<' + - get_property: + - SELF + - stream_subscribe_0 + - node_name + - '>>' + type: message_router + docker_config: + healthcheck: + endpoint: / + interval: 15s + timeout: 1s + type: https + ports: + - 11011:11011 + image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.deployments.tca-cdap-container:1.1.0 + location_id: + get_input: location_id + service_component_type: tca-docker + streams_publishes: + - client_role: + get_property: + - SELF + - stream_publish_0 + - client_role + location: + get_property: + - SELF + - stream_publish_0 + - location + name: + get_property: + - SELF + - stream_publish_0 + - node_name + type: message_router + streams_subscribes: + - client_role: + get_property: + - SELF + - stream_subscribe_0 + - client_role + location: + get_property: + - SELF + - stream_subscribe_0 + - location + name: + get_property: + - SELF + - stream_subscribe_0 + - node_name + type: message_router + interfaces: + cloudify.interfaces.lifecycle: + type: tosca.interfaces.Root + start: + inputs: + host_config: null + stop: + inputs: + cleanup_image: null diff --git a/tests/sdc/dcaed/assets/user_remarks.template b/tests/sdc/dcaed/assets/user_remarks.template new file mode 100644 index 00000000..465115e6 --- /dev/null +++ b/tests/sdc/dcaed/assets/user_remarks.template @@ -0,0 +1 @@ +{"userRemarks":"${user_remarks}"}
\ No newline at end of file diff --git a/tests/sdc/dcaed/common.robot b/tests/sdc/dcaed/common.robot new file mode 100644 index 00000000..3cb73ff4 --- /dev/null +++ b/tests/sdc/dcaed/common.robot @@ -0,0 +1,11 @@ +*** Variables *** + +${ASDC_DESIGNER_USER_ID} cs0008 +${ASDC_TESTER_USER_ID} jm0007 +${ASDC_GOVERNOR_USER_ID} gv0001 +${ASDC_OPS_USER_ID} op0001 + +${GLOBAL_APPLICATION_ID} robot + +${ASSETS_DIR} %{WORKSPACE}/tests/sdc/dcaed/assets/ + diff --git a/tests/sdc/dcaed/dcaed_interface.robot b/tests/sdc/dcaed/dcaed_interface.robot new file mode 100644 index 00000000..76401a86 --- /dev/null +++ b/tests/sdc/dcaed/dcaed_interface.robot @@ -0,0 +1,76 @@ +*** Settings *** +Library json +Library eteutils/HTTPUtils.py +Library ONAPLibrary.Utilities + +Resource json_templater.robot +Resource common.robot + +*** Variables *** +${DCAE_PATH} /dcae +${DCAE_CREATE_BLUEPRINT_PATH} /SERVICE/createBluePrint +${DCAE_VFCMT_TEMPLATE} ${ASSETS_DIR}create_vfcmt.template +${DCAE_COMPOSITION_TEMPLATE} ${ASSETS_DIR}dcae_composition.template +${DCAE_MONITORING_CONFIGURATION_TEMPLATE} ${ASSETS_DIR}dcae_monitoring_configuration.template +${DCAE_BE_ENDPOINT} http://localhost:8082 + +*** Keywords *** + +Add VFCMT To DCAE-DS + [Documentation] Create VFCMT with the given name and return its uuid + [Arguments] ${vfcmt_name} + ${map}= Create Dictionary vfcmtName=${vfcmt_name} description=VFCMT created by robot + ${data}= Fill JSON Template File ${DCAE_VFCMT_TEMPLATE} ${map} + ${resp}= Run DCAE-DS Post Request ${DCAE_PATH}/createVFCMT ${data} ${ASDC_DESIGNER_USER_ID} + Should Be Equal As Strings ${resp.status_code} 200 + [Return] ${resp.json()['uuid']} + +Run DCAE-DS Post Request + [Documentation] Runs a DCAE-DS post request + [Arguments] ${data_path} ${data} ${user}=${ASDC_DESIGNER_USER_ID} ${MY_DCAE_BE_ENDPOINT}=${DCAE_BE_ENDPOINT} + Log Creating session ${MY_DCAE_BE_ENDPOINT} + ${session}= Create Session sdc_dcae_ds ${MY_DCAE_BE_ENDPOINT} + ${uuid}= Generate UUID4 + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json USER_ID=${user} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} + ${resp}= Post Request sdc_dcae_ds ${data_path} data=${data} headers=${headers} + Log Received response from DCAE-BE: ${resp.text} + [Return] ${resp} + +Run DCAE-DS Put Request + [Documentation] Runs a DCAE-DS put request + [Arguments] ${data_path} ${user}=${ASDC_DESIGNER_USER_ID} ${MY_DCAE_BE_ENDPOINT}=${DCAE_BE_ENDPOINT} + Log Creating session ${MY_DCAE_BE_ENDPOINT} + ${session}= Create Session sdc_dcae_ds ${MY_DCAE_BE_ENDPOINT} + ${uuid}= Generate UUID4 + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json USER_ID=${user} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} + ${resp}= Put Request sdc_dcae_ds ${data_path} headers=${headers} + Log Received response from DCAE-BE: ${resp.text} + [Return] ${resp} + +Save Composition + [Arguments] ${vfcmt_uuid} ${vf_uuid} + ${map}= Create Dictionary cid=${vfcmt_uuid} vf_id=${vf_uuid} + ${data}= Fill JSON Template File ${DCAE_COMPOSITION_TEMPLATE} ${map} + ${resp}= Run DCAE-DS Post Request ${DCAE_PATH}/saveComposition/${vfcmt_uuid} ${data} ${ASDC_DESIGNER_USER_ID} + Should Be Equal As Strings ${resp.status_code} 200 + +Certify VFCMT + [Arguments] ${vfcmt_uuid} + ${resp}= Run DCAE-DS Put Request ${DCAE_PATH}/certify/vfcmt/${vfcmt_uuid} + Should Be Equal As Strings ${resp.status_code} 200 + [Return] ${resp.json()['uuid']} + +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} + ${data}= Fill JSON Template File ${DCAE_MONITORING_CONFIGURATION_TEMPLATE} ${map} + ${resp}= Run DCAE-DS Post Request ${DCAE_PATH}/importMC ${data} ${ASDC_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} HTTPUtils.url_encode_string ${vfi_name} + ${resp}= Run DCAE-DS Post Request ${DCAE_PATH}${DCAE_CREATE_BLUEPRINT_PATH}/${mc_uuid}/${cs_uuid}/${url_vfi_name} ${None} ${ASDC_DESIGNER_USER_ID} + Should Be Equal As Strings ${resp.status_code} 200 + diff --git a/tests/sdc/dcaed/json_templater.robot b/tests/sdc/dcaed/json_templater.robot new file mode 100644 index 00000000..884c8f97 --- /dev/null +++ b/tests/sdc/dcaed/json_templater.robot @@ -0,0 +1,20 @@ +*** Settings *** +Documentation This resource is filling out json string templates and returning the json back +Library RequestsLibrary +Library eteutils/StringTemplater.py +Library OperatingSystem + +*** Keywords *** +Fill JSON Template + [Documentation] Runs substitution on template to return a filled in json + [Arguments] ${json} ${arguments} + ${returned_string}= Template String ${json} ${arguments} + ${returned_json}= To Json ${returned_string} + [Return] ${returned_json} + +Fill JSON Template File + [Documentation] Runs substitution on template to return a filled in json + [Arguments] ${json_file} ${arguments} + ${json}= OperatingSystem.Get File ${json_file} + ${returned_json}= Fill JSON Template ${json} ${arguments} + [Return] ${returned_json} diff --git a/tests/sdc/dcaed/monitoring_configuration_service_test.robot b/tests/sdc/dcaed/monitoring_configuration_service_test.robot new file mode 100644 index 00000000..9a4bbc60 --- /dev/null +++ b/tests/sdc/dcaed/monitoring_configuration_service_test.robot @@ -0,0 +1,78 @@ +*** Settings *** +Library ONAPLibrary.Utilities + +Resource asdc_interface.robot +Resource dcaed_interface.robot + +*** Test Cases *** +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 + + ${unique_postfix}= 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} + |