From 8a6b0b5aeab216617ff95757709afcb94952ffd6 Mon Sep 17 00:00:00 2001 From: Jerry Flood Date: Sun, 12 Nov 2017 15:44:21 -0500 Subject: [PATCH] Update A&AI api to v11 and create complex Issue: TEST-34 Change-Id: Ibac7f78390f517e3d3876ec0adff97d1136b2f28 Signed-off-by: Jerry Flood --- .../assets/templates/aai/add_complex_body.template | 42 +++++++++++++ robot/resources/aai/aai_interface.robot | 2 +- robot/resources/aai/create_complex.robot | 71 ++++++++++++++++++++++ robot/resources/aai/create_customer.robot | 30 ++++----- robot/resources/aai/create_service.robot | 40 ++++++------ robot/resources/aai/create_tenant.robot | 2 +- robot/resources/aai/create_zone.robot | 2 +- robot/resources/aai/network.robot | 25 ++++---- robot/resources/aai/service_instance.robot | 2 +- robot/resources/aai/volume_group.robot | 13 ++-- robot/resources/global_properties.robot | 3 + .../vnf_orchestration_test_template.robot | 2 + 12 files changed, 175 insertions(+), 59 deletions(-) create mode 100644 robot/assets/templates/aai/add_complex_body.template create mode 100644 robot/resources/aai/create_complex.robot diff --git a/robot/assets/templates/aai/add_complex_body.template b/robot/assets/templates/aai/add_complex_body.template new file mode 100644 index 00000000..136a620b --- /dev/null +++ b/robot/assets/templates/aai/add_complex_body.template @@ -0,0 +1,42 @@ + { + "complex-name": "${complex_name}", + "physical-location-id": "${physical_location_id}", + "data-center-code": "example-data-center-code-val-5556", + "identity-url": "example-identity-url-val-56898", + "physical-location-type": "example-physical-location-type-val-7608", + "street1": "example-street1-val-34205", + "street2": "example-street2-val-99210", + "city": "example-city-val-27150", + "state": "example-state-val-59487", + "postal-code": "example-postal-code-val-68871", + "country": "example-country-val-94173", + "region": "example-region-val-13893", + "latitude": "example-latitude-val-89101", + "longitude": "example-longitude-val-66229", + "elevation": "example-elevation-val-30253", + "lata": "example-lata-val-46073", + "relationship-list": { + "relationship": [ + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "${cloud_owner}" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "${region}" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type", + "property-value": "${owner_defined_type}" + } + ] + } + ] + } + } diff --git a/robot/resources/aai/aai_interface.robot b/robot/resources/aai/aai_interface.robot index 790fa66f..b72103d0 100644 --- a/robot/resources/aai/aai_interface.robot +++ b/robot/resources/aai/aai_interface.robot @@ -7,7 +7,7 @@ Resource ../global_properties.robot *** Variables *** ${AAI_HEALTH_PATH} /aai/util/echo?action=long -${VERSIONED_INDEX_PATH} /aai/v8 +${VERSIONED_INDEX_PATH} /aai/v11 ${AAI_FRONTEND_ENDPOINT} ${GLOBAL_AAI_SERVER_PROTOCOL}://${GLOBAL_INJECTED_AAI1_IP_ADDR}:${GLOBAL_AAI_SERVER_PORT} diff --git a/robot/resources/aai/create_complex.robot b/robot/resources/aai/create_complex.robot new file mode 100644 index 00000000..e1cc2271 --- /dev/null +++ b/robot/resources/aai/create_complex.robot @@ -0,0 +1,71 @@ +*** Settings *** +Documentation Create A&AI Customer API. +... +... Create A&AI Customer API + +Resource ../json_templater.robot +Resource aai_interface.robot +Library OperatingSystem +Library Collections + + + +*** Variables *** +${COMPLEX_INDEX_PATH} /aai/v11 +${ROOT_COMPLEXES_PATH} /cloud-infrastructure/complexes +${ROOT_COMPLEX_PATH} /cloud-infrastructure/complexes/complex + +${SYSTEM USER} robot-ete +${AAI_ADD_COMPLEX_BODY}= robot/assets/templates/aai/add_complex_body.template + +*** Keywords *** +Inventory Complex If Not Exists + [Documentation] Creates a service in A&AI if it doesn't exist + [Arguments] ${complex_name} ${physical_location_id} ${cloud_owner} ${region} ${owner_defined_type} + ${get_resp}= Run A&AI Get Request ${COMPLEX_INDEX_PATH}${ROOT_COMPLEX_PATH}/${physical_location_id} + Return From Keyword If '${get_resp.status_code}' == '200' + Inventory Complex ${complex_name} ${physical_location_id} ${cloud_owner} ${region} ${owner_defined_type} + +Inventory Complex + [Documentation] Inventorys a COmplex in A&AI + [Arguments] ${complex_name} ${physical_location_id} ${cloud_owner} ${region} ${owner_defined_type} + ${arguments}= Create Dictionary complex_name=${complex_name} + Set To Dictionary ${arguments} physical_location_id=${physical_location_id} + Set To Dictionary ${arguments} cloud_owner=${cloud_owner} + Set To Dictionary ${arguments} region=${region} + Set To Dictionary ${arguments} owner_defined_type=${owner_defined_type} + ${data}= Fill JSON Template File ${AAI_ADD_COMPLEX_BODY} ${arguments} + ${put_resp}= Run A&AI Put Request ${COMPLEX_INDEX_PATH}${ROOT_COMPLEX_PATH}/${physical_location_id} ${data} + ${status_string}= Convert To String ${put_resp.status_code} + Should Match Regexp ${status_string} ^(201|200)$ + +Delete Complex If Exists + [Documentation] Removes a complex + [Arguments] ${physical_location_id} + ${get_resp}= Run A&AI Get Request ${COMPLEX_INDEX_PATH}${ROOT_COMPLEX_PATH}/${physical_location_id} + Run Keyword If '${get_resp.status_code}' == '200' Delete Zone Exists ${physical_location_id} ${get_resp.json()} + +Delete Complex + [Arguments] ${physical_location_id} ${json} + ${resource_version}= Catenate ${json['resource-version']} + ${put_resp}= Run A&AI Delete Request ${COMPLEX_INDEX_PATH}${ROOT_COMPLEX_PATH}/${physical_location_id} ${resource_version} + Should Be Equal As Strings ${put_resp.status_code} 204 + +Get Complex + [Documentation] Return a complex + [Arguments] ${physical_location_id} + ${resp}= Run A&AI Get Request ${COMPLEX_INDEX_PATH}${ROOT_COMPLEX_PATH}/${physical_location_id} + Should Be Equal As Strings ${resp.status_code} 200 + [Return] ${resp.json()} + +Get Complexes + [Documentation] Return all complexes + [Arguments] + ${resp}= Run A&AI Get Request ${COMPLEX_INDEX_PATH}${ROOT_COMPLEXES_PATH} + Should Be Equal As Strings ${resp.status_code} 200 + Log ${resp.json()} + [Return] ${resp.json()} + + + + diff --git a/robot/resources/aai/create_customer.robot b/robot/resources/aai/create_customer.robot index 7ebda39d..fec58843 100644 --- a/robot/resources/aai/create_customer.robot +++ b/robot/resources/aai/create_customer.robot @@ -10,32 +10,32 @@ Library OperatingSystem *** Variables *** -${INDEX PATH} /aai/v8 +${INDEX PATH} /aai/v11 ${ROOT_CUSTOMER_PATH} /business/customers/customer/ ${SYSTEM USER} robot-ete ${A&AI ADD CUSTOMER BODY} robot/assets/templates/aai/add_customer.template -*** Keywords *** +*** Keywords *** Create Customer - [Documentation] Creates a customer in A&AI - [Arguments] ${customer_name} ${customer_id} ${customer_type} ${service_type} ${clouder_owner} ${cloud_region_id} ${tenant_id} - ${data_template}= OperatingSystem.Get File ${A&AI ADD CUSTOMER BODY} - ${arguments}= Create Dictionary subscriber_name=${customer_name} global_customer_id=${customer_id} subscriber_type=${customer_type} cloud_owner1=${clouder_owner} cloud_region_id1=${cloud_region_id} tenant_id1=${tenant_id} service1=${service_type} - ${data}= Fill JSON Template ${data_template} ${arguments} + [Documentation] Creates a customer in A&AI + [Arguments] ${customer_name} ${customer_id} ${customer_type} ${service_type} ${clouder_owner} ${cloud_region_id} ${tenant_id} + ${data_template}= OperatingSystem.Get File ${A&AI ADD CUSTOMER BODY} + ${arguments}= Create Dictionary subscriber_name=${customer_name} global_customer_id=${customer_id} subscriber_type=${customer_type} cloud_owner1=${clouder_owner} cloud_region_id1=${cloud_region_id} tenant_id1=${tenant_id} service1=${service_type} + ${data}= Fill JSON Template ${data_template} ${arguments} ${put_resp}= Run A&AI Put Request ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} ${data} Should Be Equal As Strings ${put_resp.status_code} 201 [Return] ${put_resp.status_code} -*** Keywords *** +*** Keywords *** Delete Customer - [Documentation] Deletes a customer in A&AI + [Documentation] Deletes a customer in A&AI [Arguments] ${customer_id} - ${get_resp}= Run A&AI Get Request ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} + ${get_resp}= Run A&AI Get Request ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} Run Keyword If '${get_resp.status_code}' == '200' Delete Customer Exists ${customer_id} ${get_resp.json()['resource-version']} - -*** Keywords *** + +*** Keywords *** Delete Customer Exists - [Documentation] Deletes a customer in A&AI - [Arguments] ${customer_id} ${resource_version_id} + [Documentation] Deletes a customer in A&AI + [Arguments] ${customer_id} ${resource_version_id} ${put_resp}= Run A&AI Delete Request ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} ${resource_version_id} - Should Be Equal As Strings ${put_resp.status_code} 204 + Should Be Equal As Strings ${put_resp.status_code} 204 diff --git a/robot/resources/aai/create_service.robot b/robot/resources/aai/create_service.robot index 38aef3f6..bcf14e3d 100644 --- a/robot/resources/aai/create_service.robot +++ b/robot/resources/aai/create_service.robot @@ -12,56 +12,56 @@ Library UUID *** Variables *** -${INDEX PATH} /aai/v8 +${INDEX PATH} /aai/v11 ${ROOT_SERVICE_PATH} /service-design-and-creation/services ${SYSTEM USER} robot-ete ${AAI_ADD_SERVICE_BODY}= robot/assets/templates/aai/add_service_body.template -*** Keywords *** +*** Keywords *** Create Service If Not Exists - [Documentation] Creates a service in A&AI if it doesn't exist + [Documentation] Creates a service in A&AI if it doesn't exist [Arguments] ${service_type} ${dict}= Get Services - ${status} ${value}= Run Keyword And Ignore Error Dictionary Should Contain Key ${dict} ${service_type} + ${status} ${value}= Run Keyword And Ignore Error Dictionary Should Contain Key ${dict} ${service_type} Run Keyword If '${status}' == 'FAIL' Create Service ${service_type} - + Create Service - [Documentation] Creates a service in A&AI + [Documentation] Creates a service in A&AI [Arguments] ${service_type} - ${uuid}= Generate UUID - ${data_template}= OperatingSystem.Get File ${AAI_ADD_SERVICE_BODY} - ${arguments}= Create Dictionary service_type=${service_type} UUID=${uuid} + ${uuid}= Generate UUID + ${data_template}= OperatingSystem.Get File ${AAI_ADD_SERVICE_BODY} + ${arguments}= Create Dictionary service_type=${service_type} UUID=${uuid} ${data}= Fill JSON Template ${data_template} ${arguments} ${fullpath}= Catenate ${INDEX PATH}${ROOT_SERVICE_PATH}/service/${uuid} ${put_resp}= Run A&AI Put Request ${fullpath} ${data} Should Be Equal As Strings ${put_resp.status_code} 201 [Return] ${put_resp.status_code} - + Delete Service If Exists - [Documentation] Deletes a service in A&AI if it exists + [Documentation] Deletes a service in A&AI if it exists [Arguments] ${service_type} ${dict}= Get Services - ${status} ${value}= Run Keyword And Ignore Error Dictionary Should Contain Key ${dict} ${service_type} + ${status} ${value}= Run Keyword And Ignore Error Dictionary Should Contain Key ${dict} ${service_type} Run Keyword If '${status}' == 'PASS' Delete Service ${dict['${service_type}']} Delete Service - [Documentation] Delete passed service in A&AI + [Documentation] Delete passed service in A&AI [Arguments] ${dict} - ${uuid}= Get From Dictionary ${dict} service-id + ${uuid}= Get From Dictionary ${dict} service-id ${resource_version}= Get From Dictionary ${dict} resource-version ${fullpath}= Catenate ${INDEX PATH}${ROOT_SERVICE_PATH}/service/${uuid} - ${resp}= Run A&AI Delete Request ${fullpath} ${resource_version} + ${resp}= Run A&AI Delete Request ${fullpath} ${resource_version} Should Be Equal As Strings ${resp.status_code} 204 - + Get Services - [Documentation] Creates a service in A&AI + [Documentation] Creates a service in A&AI ${resp}= Run A&AI Get Request ${INDEX PATH}${ROOT_SERVICE_PATH} - ${dict}= Create Dictionary + ${dict}= Create Dictionary ${status} ${value}= Run Keyword And Ignore Error Should Be Equal As Strings ${resp.status_code} 200 - Run Keyword If '${status}' == 'PASS' Update Service Dictionary ${dict} ${resp.json()} + Run Keyword If '${status}' == 'PASS' Update Service Dictionary ${dict} ${resp.json()} [Return] ${dict} Update Service Dictionary @@ -69,7 +69,7 @@ Update Service Dictionary ${list}= Evaluate ${json}['service'] :for ${map} in @{list} \ ${status} ${service_type}= Run Keyword And Ignore Error Get From Dictionary ${map} service-description - \ Run Keyword If '${status}' == 'PASS' Set To Dictionary ${dict} ${service_type}=${map} + \ Run Keyword If '${status}' == 'PASS' Set To Dictionary ${dict} ${service_type}=${map} Log ${dict} diff --git a/robot/resources/aai/create_tenant.robot b/robot/resources/aai/create_tenant.robot index 756882e7..95f1c25a 100644 --- a/robot/resources/aai/create_tenant.robot +++ b/robot/resources/aai/create_tenant.robot @@ -11,7 +11,7 @@ Library Collections *** Variables *** -${INDEX PATH} /aai/v8 +${INDEX PATH} /aai/v11 ${ROOT_TENANT_PATH} /cloud-infrastructure/cloud-regions/cloud-region/ ${SYSTEM USER} robot-ete diff --git a/robot/resources/aai/create_zone.robot b/robot/resources/aai/create_zone.robot index 995db3ee..09d6ea6e 100644 --- a/robot/resources/aai/create_zone.robot +++ b/robot/resources/aai/create_zone.robot @@ -48,7 +48,7 @@ Delete Zone Exists Get Zone [Documentation] Return zone - [Arguments] ${zone_id} + [Arguments] ${zone_id} ${resp}= Run A&AI Get Request ${ZONE_INDEX_PATH}${ROOT_ZONE_PATH}/${zone_id} Should Be Equal As Strings ${resp.status_code} 200 [Return] ${resp.json()} diff --git a/robot/resources/aai/network.robot b/robot/resources/aai/network.robot index a42461e2..6bda4e27 100644 --- a/robot/resources/aai/network.robot +++ b/robot/resources/aai/network.robot @@ -13,30 +13,29 @@ Library HttpLibrary.HTTP Resource ../json_templater.robot *** Variables *** -${INDEX PATH} /aai/v8 +${INDEX PATH} /aai/v11 ${GENERIC_QUERY_PATH} /search/generic-query? ${SYSTEM USER} robot-ete ${CUSTOMER SPEC PATH} /business/customers/customer/ ${SERVICE SUBSCRIPTIONS} /service-subscriptions/service-subscription/ ${SERVICE INSTANCE} /service-instances?service-instance-name= -${SERVCE INSTANCE TEMPLATE} robot/assets/templates/aai/service_subscription.template +${SERVCE INSTANCE TEMPLATE} robot/assets/templates/aai/service_subscription.template -*** Keywords *** +*** Keywords *** Validate Network - [Documentation] Query and Validates A&AI Service Instance - [Arguments] ${service_instance_name} ${service_type} ${customer_id} + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${service_instance_name} ${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_name} Dictionary Should Contain Value ${resp.json()['service-instance'][0]} ${service_instance_name} - - -*** Keywords *** + + +*** Keywords *** Create Network - [Documentation] Query and Validates A&AI Service Instance - [Arguments] ${CUSTOMER ID} + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${CUSTOMER ID} ${json_string}= Catenate { "service-type": "VDNS" , "service-subscriptions":[{"service-instance-id":"instanceid123","service-instance-name":"VDNS"}]} ${put_resp}= Run A&AI Put Request ${INDEX PATH}${CUSTOMER SPEC PATH}${CUSTOMER ID}${SERVICE SUBSCRIPTIONS}/VDNS ${json_string} Should Be Equal As Strings ${put_resp.status_code} 201 - [Return] ${put_resp.status_code} - - \ No newline at end of file + [Return] ${put_resp.status_code} + diff --git a/robot/resources/aai/service_instance.robot b/robot/resources/aai/service_instance.robot index f2cf7d80..34ab1eab 100644 --- a/robot/resources/aai/service_instance.robot +++ b/robot/resources/aai/service_instance.robot @@ -17,7 +17,7 @@ Resource ../stack_validation/validate_vvg.robot Resource ../aai/aai_interface.robot *** Variables *** -${INDEX PATH} /aai/v8 +${INDEX PATH} /aai/v11 ${GENERIC_QUERY_PATH} /search/generic-query? ${SYSTEM USER} robot-ete ${CUSTOMER SPEC PATH} /business/customers/customer/ diff --git a/robot/resources/aai/volume_group.robot b/robot/resources/aai/volume_group.robot index 95822011..40674a5e 100644 --- a/robot/resources/aai/volume_group.robot +++ b/robot/resources/aai/volume_group.robot @@ -13,19 +13,18 @@ Library HttpLibrary.HTTP Resource ../json_templater.robot *** Variables *** -${INDEX PATH} /aai/v8 +${INDEX PATH} /aai/v11 ${GENERIC_QUERY_PATH} /search/generic-query? ${SYSTEM USER} robot-ete ${CUSTOMER SPEC PATH} /business/customers/customer/ ${SERVICE SUBSCRIPTIONS} /service-subscriptions/service-subscription/ ${SERVICE INSTANCE} /service-instances?service-instance-name= -${SERVCE INSTANCE TEMPLATE} robot/assets/templates/aai/service_subscription.template +${SERVCE INSTANCE TEMPLATE} robot/assets/templates/aai/service_subscription.template -*** Keywords *** -Validate Volume Group - [Arguments] ${service_instance_name} ${service_type} ${customer_id} +*** Keywords *** +Validate Volume Group + [Arguments] ${service_instance_name} ${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_name} Dictionary Should Contain Value ${resp.json()['service-instance'][0]} ${service_instance_name} - - \ No newline at end of file + diff --git a/robot/resources/global_properties.robot b/robot/resources/global_properties.robot index 6d82042a..ac91d24b 100644 --- a/robot/resources/global_properties.robot +++ b/robot/resources/global_properties.robot @@ -20,6 +20,9 @@ ${GLOBAL_OPENSTACK_GLANCE_SERVICE_TYPE} image ${GLOBAL_OPENSTACK_KEYSTONE_SERVICE_TYPE} identity ${GLOBAL_OPENSTACK_STACK_DEPLOYMENT_TIMEOUT} 600s ${GLOBAL_AAI_CLOUD_OWNER} CloudOwner +${GLOBAL_AAI_CLOUD_OWNER_DEFINED_TYPE} OwnerType +${GLOBAL_AAI_COMPLEX_NAME} clli1 +${GLOBAL_AAI_PHYSICAL_LOCATION_ID} clli1 ${GLOBAL_BUILD_NUMBER} 0 ${GLOBAL_VID_UI_TIMEOUT_SHORT} 20s ${GLOBAL_VID_UI_TIMEOUT_MEDIUM} 60s diff --git a/robot/resources/test_templates/vnf_orchestration_test_template.robot b/robot/resources/test_templates/vnf_orchestration_test_template.robot index 1d293ec5..ceba3a7a 100644 --- a/robot/resources/test_templates/vnf_orchestration_test_template.robot +++ b/robot/resources/test_templates/vnf_orchestration_test_template.robot @@ -11,6 +11,7 @@ Resource model_test_template.robot Resource ../aai/create_zone.robot Resource ../aai/create_customer.robot +Resource ../aai/create_complex.robot Resource ../aai/create_tenant.robot Resource ../aai/create_service.robot Resource ../openstack/neutron_interface.robot @@ -91,6 +92,7 @@ Setup Orchestrate VNF :FOR ${region} IN @{REGIONS} \ Inventory Tenant If Not Exists ${cloud_owner} ${region} ${cloud_type} ${owner_defined_type} ${cloud_region_version} ${cloud_zone} ${TENANT_ID} ${TENANT_NAME} Inventory Zone If Not Exists + Inventory Complex If Not Exists ${GLOBAL_AAI_COMPLEX_NAME} ${GLOBAL_AAI_PHYSICAL_LOCATION_ID} ${GLOBAL_AAI_CLOUD_OWNER} ${GLOBAL_INJECTED_REGION} ${GLOBAL_AAI_CLOUD_OWNER_DEFINED_TYPE} Log Orchestrate VNF setup complete Initialize Tenant From Openstack -- 2.16.6