diff options
-rw-r--r-- | robot/resources/aai/aai_interface.robot | 22 | ||||
-rw-r--r-- | robot/resources/dcae_interface.robot | 26 | ||||
-rw-r--r-- | robot/resources/demo_preload.robot | 132 | ||||
-rw-r--r-- | robot/resources/openstack/keystone_interface.robot | 1 | ||||
-rw-r--r-- | robot/resources/test_templates/vnf_orchestration_test_template.robot | 4 | ||||
-rw-r--r-- | robot/resources/vid/vid_interface.robot | 2 | ||||
-rw-r--r-- | robot/testsuites/demo.robot | 37 | ||||
-rw-r--r-- | version.properties | 2 |
8 files changed, 176 insertions, 50 deletions
diff --git a/robot/resources/aai/aai_interface.robot b/robot/resources/aai/aai_interface.robot index 11979f0b..49f98f0c 100644 --- a/robot/resources/aai/aai_interface.robot +++ b/robot/resources/aai/aai_interface.robot @@ -1,7 +1,8 @@ *** Settings *** Documentation The main interface for interacting with A&AI. It handles low level stuff like managing the http request library and A&AI required fields Library RequestsLibrary -Library UUID +Library UUID +Library HTTPUtils Resource ../global_properties.robot *** Variables *** @@ -11,12 +12,13 @@ ${VERSIONED_INDEX_PATH} /aai/v8 *** Keywords *** Run A&AI Health Check [Documentation] Runs an A&AI health check - ${resp}= Run A&AI Get Request ${AAI_HEALTH_PATH} + ${resp}= Run A&AI Get Request ${AAI_HEALTH_PATH} Should Be Equal As Strings ${resp.status_code} 200 Run A&AI Get Request [Documentation] Runs an A&AI get request [Arguments] ${data_path} + Disable Warnings ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD} ${session}= Create Session aai ${GLOBAL_AAI_SERVER_URL} auth=${auth} ${uuid}= Generate UUID @@ -24,10 +26,11 @@ Run A&AI Get Request ${resp}= Get Request aai ${data_path} headers=${headers} Log Received response from aai ${resp.text} [Return] ${resp} - + Run A&AI Put Request [Documentation] Runs an A&AI put request [Arguments] ${data_path} ${data} + Disable Warnings ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD} ${session}= Create Session aai ${GLOBAL_AAI_SERVER_URL} auth=${auth} ${uuid}= Generate UUID @@ -39,6 +42,7 @@ Run A&AI Put Request Run A&AI Post Request [Documentation] Runs an A&AI Post request [Arguments] ${data_path} ${data} + Disable Warnings ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD} ${session}= Create Session aai ${GLOBAL_AAI_SERVER_URL} auth=${auth} ${uuid}= Generate UUID @@ -46,10 +50,11 @@ Run A&AI Post Request ${resp}= Post Request aai ${data_path} data=${data} headers=${headers} Log Received response from aai ${resp.text} [Return] ${resp} - + Run A&AI Delete Request [Documentation] Runs an A&AI delete request [Arguments] ${data_path} ${resource_version} + Disable Warnings ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD} ${session}= Create Session aai ${GLOBAL_AAI_SERVER_URL} auth=${auth} ${uuid}= Generate UUID @@ -59,15 +64,14 @@ Run A&AI Delete Request [Return] ${resp} Delete A&AI Entity - [Documentation] Deletes an entity in A&AI + [Documentation] Deletes an entity in A&AI [Arguments] ${uri} - ${get_resp}= Run A&AI Get Request ${VERSIONED_INDEX PATH}${uri} + ${get_resp}= Run A&AI Get Request ${VERSIONED_INDEX PATH}${uri} Run Keyword If '${get_resp.status_code}' == '200' Delete A&AI Entity Exists ${uri} ${get_resp.json()['resource-version']} Delete A&AI Entity Exists [Documentation] Deletes an A&AI entity - [Arguments] ${uri} ${resource_version_id} + [Arguments] ${uri} ${resource_version_id} ${put_resp}= Run A&AI Delete Request ${VERSIONED_INDEX PATH}${uri} ${resource_version_id} - Should Be Equal As Strings ${put_resp.status_code} 204 + Should Be Equal As Strings ${put_resp.status_code} 204 -
\ No newline at end of file diff --git a/robot/resources/dcae_interface.robot b/robot/resources/dcae_interface.robot index 1c1ba44a..e023a7e6 100644 --- a/robot/resources/dcae_interface.robot +++ b/robot/resources/dcae_interface.robot @@ -1,7 +1,7 @@ *** Settings *** Documentation The main interface for interacting with DCAE. It handles low level stuff like managing the http request library and DCAE required fields Library RequestsLibrary -Library UUID +Library UUID Library OperatingSystem Library Collections Resource global_properties.robot @@ -18,40 +18,40 @@ Run DCAE Health Check ${session}= Create Session dcae ${GLOBAL_DCAE_SERVER} auth=${auth} ${uuid}= Generate UUID ${data}= OperatingSystem.Get File ${DCAE_HEALTH_CHECK_BODY} - ${headers}= Create Dictionary action=getTable Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} + ${headers}= Create Dictionary X-ECOMP-Client-Version=ONAP-R2 action=getTable Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} ${resp}= Put Request dcae ${DCAE_HEALTH_CHECK_PATH} data=${data} headers=${headers} Log Received response from dcae ${resp.json()} Should Be Equal As Strings ${resp.status_code} 200 Check DCAE Results ${resp.json()} - + Check DCAE Results [Documentation] Parse DCAE JSON response and make sure all rows have healthTestStatus=GREEN [Arguments] ${json} @{rows}= Get From Dictionary ${json['returns']} rows @{headers}= Get From Dictionary ${json['returns']} columns - + # Retrieve column names from headers ${columns}= Create List :for ${header} in @{headers} - \ ${colName}= Get From Dictionary ${header} colName + \ ${colName}= Get From Dictionary ${header} colName \ Append To List ${columns} ${colName} - - # Process each row making sure status=GREEN + + # Process each row making sure status=GREEN :for ${row} in @{rows} \ ${cells}= Get From Dictionary ${row} cells - \ ${dict}= Make A Dictionary ${cells} ${columns} + \ ${dict}= Make A Dictionary ${cells} ${columns} \ Dictionary Should Contain Item ${dict} healthTestStatus GREEN - + Make A Dictionary [Documentation] Given a list of column names and a list of dictionaries, map columname=value [Arguments] ${columns} ${names} ${valuename}=value ${dict}= Create Dictionary - ${collength}= Get Length ${columns} - ${namelength}= Get Length ${names} + ${collength}= Get Length ${columns} + ${namelength}= Get Length ${names} :for ${index} in range 0 ${collength} \ ${name}= Evaluate ${names}[${index}] \ ${valued}= Evaluate ${columns}[${index}] \ ${value}= Get From Dictionary ${valued} ${valueName} - \ Set To Dictionary ${dict} ${name} ${value} - [Return] ${dict}
\ No newline at end of file + \ Set To Dictionary ${dict} ${name} ${value} + [Return] ${dict}
\ No newline at end of file diff --git a/robot/resources/demo_preload.robot b/robot/resources/demo_preload.robot index 02e4ce69..00671baa 100644 --- a/robot/resources/demo_preload.robot +++ b/robot/resources/demo_preload.robot @@ -10,6 +10,7 @@ Library Collections Library OperatingSystem Library HttpLibrary.HTTP Library ExtendedSelenium2Library +Library RequestsLibrary *** Variables *** @@ -22,20 +23,27 @@ ${FILE_CACHE} /share/ Load Customer And Models [Documentation] Use openECOMP to Orchestrate a service. [Arguments] ${customer_name} + Load Customer ${customer_name} + Load Models ${customer_name} + +Load Customer + [Documentation] Use openECOMP to Orchestrate a service. + [Arguments] ${customer_name} Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone Set Test Variable ${CUSTOMER_NAME} ${customer_name} - ${status} ${value}= Run Keyword And Ignore Error Distribute Model vFW demoVFW - ${status} ${value}= Run Keyword And Ignore Error Distribute Model vLB demoVLB - ## MSO polling is 60 second intervals - Sleep 60s ${region}= Get Openstack Region Create Customer For VNF Demo ${CUSTOMER_NAME} ${CUSTOMER_NAME} INFRA ${GLOBAL_AAI_CLOUD_OWNER} ${region} ${TENANT_ID} +Load Models + [Documentation] Use openECOMP to Orchestrate a service. + [Arguments] ${customer_name} + Set Test Variable ${CUSTOMER_NAME} ${customer_name} + ${status} ${value}= Run Keyword And Ignore Error Distribute Model vFW demoVFW + ${status} ${value}= Run Keyword And Ignore Error Distribute Model vLB demoVLB + Distribute Model [Arguments] ${service} ${modelName} ${service_model_type} ${vnf_type} ${vf_modules}= Model Distribution For Directory ${service} ${modelName} - ${jsonString}= Evaluate json.dumps(${vf_modules}) json - OperatingSystem.Create File ${FILE_CACHE}${service}${VF_MODULES_NAME} ${jsonString} Create Customer For VNF Demo [Documentation] Create demo customer for the demo @@ -44,32 +52,38 @@ Create Customer For VNF Demo ${arguments}= Create Dictionary subscriber_name=${customer_name} global_customer_id=${customer_id} subscriber_type=${customer_type} cloud_owner=${clouder_owner} cloud_region_id=${cloud_region_id} tenant_id=${tenant_id} Set To Dictionary ${arguments} service1=vFW service2=vLB ${data}= Fill JSON Template ${data_template} ${arguments} - ${put_resp}= Run A&AI Put Request ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} ${data} + ${put_resp}= Run A&AI Put Request ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} ${data} ${status_string}= Convert To String ${put_resp.status_code} Should Match Regexp ${status_string} ^(201|412)$ Create Service If Not Exists vFW Create Service If Not Exists vLB - -Preload Demo +Preload User Model + [Documentation] Preload the demo data for the passed VNF with the passed module name [Arguments] ${vnf_name} ${vf_module_name} - ${vf_modules}= Create List + # Go to A&AI and get information about the VNF we need to preload ${status} ${generic_vnf}= Run Keyword And Ignore Error Get Service Instance ${vnf_name} Run Keyword If '${status}' == 'FAIL' FAIL VNF Name: ${vnf_name} is not found. ${vnf_type}= Set Variable ${generic_vnf['vnf-type']} ${relationships}= Set Variable ${generic_vnf['relationship-list']['relationship']} ${relationship_data}= Get Relationship Data ${relationships} + ${customer_id}= Catenate :for ${r} in @{relationship_data} \ ${service}= Set Variable If '${r['relationship-key']}' == 'service-subscription.service-type' ${r['relationship-value']} ${service} \ ${service_instance_id}= Set Variable If '${r['relationship-key']}' == 'service-instance.service-instance-id' ${r['relationship-value']} ${service_instance_id} - ${data}= OperatingSystem.Get File ${FILE_CACHE}${service}${VF_MODULES_NAME} - ${vf_modules}= Evaluate json.loads('''${data}''') json + \ ${customer_id}= Set Variable If '${r['relationship-key']}' == 'customer.global-customer-id' ${r['relationship-value']} ${customer_id} + ${invariantUUID}= Get Persona Model Id ${service_instance_id} ${service} ${customer_id} + + # We still need the vf module names. We can get them from VID using the persona_model_id (invariantUUID) from A&AI + Setup Browser + Login To VID GUI + ${vf_modules}= Get Module Names from VID ${invariantUUID} Log ${generic_vnf} Log ${service_instance_id},${vnf_name},${vnf_type},${vf_module_name},${vf_modules},${service} - Setup Browser Preload Vnf ${service_instance_id} ${vnf_name} ${vnf_type} ${vf_module_name} ${vf_modules} ${service} demo [Teardown] Close All Browsers + Get Relationship Data [Arguments] ${relationships} :for ${r} in @{relationships} @@ -83,6 +97,58 @@ Get Service Instance Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} +Get Persona Model Id + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${service_instance_id} ${service_type} ${customer_id} + ${resp}= Run A&AI Get Request ${INDEX PATH}${CUSTOMER SPEC PATH}${customer_id}${SERVICE SUBSCRIPTIONS}${service_type}${SERVICE INSTANCE}${service_instance_id} + ${persona_model_id}= Get From DIctionary ${resp.json()['service-instance'][0]} persona-model-id + [Return] ${persona_model_id} + + +Get Model UUID from VID + [Documentation] Must use UI since rest call get redirect to portal and get DNS error + ... Search all services and match on the invariantUUID + [Arguments] ${invariantUUID} + Go To ${GLOBAL_VID_SERVER}${VID_ENV}/rest/models/services + ${resp}= Get Text xpath=//body/pre + ${json}= To Json ${resp} + :for ${dict} in @{json} + \ ${uuid}= Get From DIctionary ${dict} uuid + \ ${inv}= Get From DIctionary ${dict} invariantUUID + \ Return From Keyword If "${invariantUUID}" == "${inv}" ${uuid} + [Return] "" + + +Get Module Names from VID + [Documentation] Must use UI since rest call get redirect to portal and get DNS error + ... Given the invariantUUID of the model, mock up the vf_modules list passed to Preload VNF + [Arguments] ${invariantUUID} + ${id}= Get Model UUID from VID ${invariantUUID} + Go To ${GLOBAL_VID_SERVER}${VID_ENV}/rest/models/services/${id} + ${resp}= Get Text xpath=//body/pre + ${json}= To Json ${resp} + ${modules}= Create List + ${vnfs}= Get From Dictionary ${json} vnfs + ${keys}= Get Dictionary Keys ${vnfs} + :for ${key} in @{keys} + \ Add VFModule ${vnfs['${key}']} ${modules} + [Return] ${modules} + +Add VFModule + [Documentation] Dig the vf module names from the VID service model + [Arguments] ${vnf} ${modules} + ${vfModules}= Get From Dictionary ${vnf} vfModules + ${keys}= Get Dictionary Keys ${vfModules} + :for ${key} in @{keys} + \ ${module}= Get From Dictionary ${vfModules} ${key} + \ ${dict}= Create Dictionary name=${module['name']} + \ Append to List ${modules} ${dict} + + + + + + APPC Mount Point [Arguments] ${vf_module_name} Run Openstack Auth Request auth @@ -94,3 +160,43 @@ APPC Mount Point ${vpg_public_ip}= Get Server Ip ${server_list} ${stack_info} vpg_name_0 network_name=public ${vpg_oam_ip}= Get From Dictionary ${stack_info} vpg_private_ip_1 ${appc}= Create Mount Point In APPC ${vpg_name_0} ${vpg_oam_ip} + +Instantiate VNF + [Arguments] ${service} + Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone + ${vf_module_name} ${service}= Orchestrate VNF DemoCust ${service} ${service} ${TENANT_NAME} + Save For Delete + Log to Console Customer Name=${CUSTOMER_NAME} + Log to Console VNF Module Name=${vf_module_name} + +Save For Delete + [Documentation] Create a variable file to be loaded for save for delete + ${dict}= Create Dictionary + Set To Dictionary ${dict} TENANT_NAME=${TENANT_NAME} + Set To Dictionary ${dict} TENANT_ID=${TENANT_ID} + Set To Dictionary ${dict} CUSTOMER_NAME=${CUSTOMER_NAME} + Set To Dictionary ${dict} STACK_NAME=${STACK_NAME} + Set To Dictionary ${dict} SERVICE=${SERVICE} + Set To Dictionary ${dict} VVG_SERVER_ID=${VVG_SERVER_ID} + Set To Dictionary ${dict} SERVICE_INSTANCE_ID=${SERVICE_INSTANCE_ID} + + Set To Dictionary ${dict} VLB_CLOSED_LOOP_DELETE=${VLB_CLOSED_LOOP_DELETE} + Set To Dictionary ${dict} VLB_CLOSED_LOOP_VNF_ID=${VLB_CLOSED_LOOP_VNF_ID} + + Set To Dictionary ${dict} CATALOG_SERVICE_ID=${CATALOG_SERVICE_ID} + + ${vars}= Catenate + ${keys}= Get Dictionary Keys ${dict} + :for ${key} in @{keys} + \ ${value}= Get From Dictionary ${dict} ${key} + \ ${vars}= Catenate ${vars}${key} = "${value}"\n + + ${comma}= Catenate + ${vars}= Catenate ${vars}CATALOG_RESOURCE_IDS = [ + :for ${id} in @{CATALOG_RESOURCE_IDS} + \ ${vars}= Catenate ${vars}${comma} "${id}" + \ ${comma}= Catenate , + ${vars}= Catenate ${vars}]\n + OperatingSystem.Create File ${FILE_CACHE}/${STACK_NAME}.py ${vars} + + diff --git a/robot/resources/openstack/keystone_interface.robot b/robot/resources/openstack/keystone_interface.robot index 63f72451..6bf1d1e7 100644 --- a/robot/resources/openstack/keystone_interface.robot +++ b/robot/resources/openstack/keystone_interface.robot @@ -29,6 +29,7 @@ Run Openstack Auth Request ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} Log Sending authenticate post request ${data_path} with headers ${headers} and data ${data} ${resp}= Post Request keystone ${data_path} data=${data} headers=${headers} + Should Be True 200 <= ${resp.status_code} < 300 Save Openstack Auth ${alias} ${resp.text} Log Received response from keystone ${resp.text} diff --git a/robot/resources/test_templates/vnf_orchestration_test_template.robot b/robot/resources/test_templates/vnf_orchestration_test_template.robot index 9138c94b..ed847c21 100644 --- a/robot/resources/test_templates/vnf_orchestration_test_template.robot +++ b/robot/resources/test_templates/vnf_orchestration_test_template.robot @@ -165,8 +165,4 @@ Teardown Stack Clean A&AI Inventory [Documentation] Clean up Tenant in A&AI, Create Customer, Create Service and related relationships - :FOR ${region} IN @{REGIONS} - \ Delete Tenant ${TENANT_ID} ${GLOBAL_AAI_CLOUD_OWNER} ${region} - \ Delete Cloud Region ${TENANT_ID} ${GLOBAL_AAI_CLOUD_OWNER} ${region} Delete Customer ${CUSTOMER_NAME} - Delete Service If Exists ${SERVICE} diff --git a/robot/resources/vid/vid_interface.robot b/robot/resources/vid/vid_interface.robot index 1a450711..cb625d47 100644 --- a/robot/resources/vid/vid_interface.robot +++ b/robot/resources/vid/vid_interface.robot @@ -11,7 +11,7 @@ Resource ../browser_setup.robot *** Variables *** ${VID_ENV} /vid ${VID_LOGIN_URL} ${GLOBAL_VID_SERVER}${VID_ENV}/login_external.htm -${VID_HEALTHCHECK_PATH} ${VID_ENV}/api/users +${VID_HEALTHCHECK_PATH} ${VID_ENV}/api/v2/users ${VID_HOME_URL} ${GLOBAL_VID_SERVER}${VID_ENV}/vidhome.htm *** Keywords *** diff --git a/robot/testsuites/demo.robot b/robot/testsuites/demo.robot index 5c8f415b..74a78d45 100644 --- a/robot/testsuites/demo.robot +++ b/robot/testsuites/demo.robot @@ -1,25 +1,44 @@ *** Settings *** Documentation Executes the VNF Orchestration Test cases including setup and teardown ... - +Library Collections Resource ../resources/demo_preload.robot *** Variables *** ${VNF_NAME} DemoVNF ${MODULE_NAME} DemoModuleName -*** Test Cases *** +*** Test Cases *** Initialize Customer And Models - [Tags] InitDemo - Load Customer And Models Demonstration + [Tags] InitDemo + Load Customer And Models Demonstration + +Initialize Customer + [Tags] InitCustomer + Load Customer Demonstration + +Initialize Models + [Tags] InitDistribution + Load Models Demonstration Preload VNF - [Tags] PreloadDemo - Preload Demo ${VNF_NAME} ${MODULE_NAME} - + [Tags] PreloadDemo + Preload User Model ${VNF_NAME} ${MODULE_NAME} + Create APPC Mount Point - [Tags] APPCMountPointDemo - APPC Mount Point ${MODULE_NAME} + [Tags] APPCMountPointDemo + APPC Mount Point ${MODULE_NAME} +Instantiate VFW + [Tags] instantiateVFW + Instantiate VNF vFW +Delete Instantiated VNF + [Documentation] This test assumes all necessary variables are loaded via the variable file create in Save For Delete + ... The Teardown VNF needs to be in the teardown step of the test case... + [Tags] deleteVNF + Setup Browser + Login To VID GUI + Delete VNF + [Teardown] Teardown VNF diff --git a/version.properties b/version.properties index 51f0d0d1..443775ff 100644 --- a/version.properties +++ b/version.properties @@ -11,4 +11,4 @@ base_version=${major}.${minor}.${patch} # Release must be completed with git revision # in Jenkins release_version=${base_version} snapshot_version=${base_version}-SNAPSHOT -tags="latest" +tags=latest ${major}.${minor}-STAGING-latest |