diff options
Diffstat (limited to 'robot/resources/aai')
-rw-r--r-- | robot/resources/aai/aai_interface.robot | 58 | ||||
-rw-r--r-- | robot/resources/aai/create_customer.robot | 41 | ||||
-rw-r--r-- | robot/resources/aai/create_service.robot | 75 | ||||
-rw-r--r-- | robot/resources/aai/create_tenant.robot | 79 | ||||
-rw-r--r-- | robot/resources/aai/network.robot | 42 | ||||
-rw-r--r-- | robot/resources/aai/service_instance.robot | 82 | ||||
-rw-r--r-- | robot/resources/aai/volume_group.robot | 31 |
7 files changed, 408 insertions, 0 deletions
diff --git a/robot/resources/aai/aai_interface.robot b/robot/resources/aai/aai_interface.robot new file mode 100644 index 00000000..43451809 --- /dev/null +++ b/robot/resources/aai/aai_interface.robot @@ -0,0 +1,58 @@ +*** 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 +Resource ../global_properties.robot + +*** Variables *** +${AAI_HEALTH_PATH} /aai/util/echo?action=long + +*** Keywords *** +Run A&AI Health Check + [Documentation] Runs an A&AI health check + ${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} + ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD} + ${session}= Create Session aai ${GLOBAL_AAI_SERVER_URL} auth=${auth} + ${uuid}= Generate UUID + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} + ${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} + ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD} + ${session}= Create Session aai ${GLOBAL_AAI_SERVER_URL} auth=${auth} + ${uuid}= Generate UUID + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} + ${resp}= Put Request aai ${data_path} data=${data} headers=${headers} + Log Received response from aai ${resp.text} + [Return] ${resp} + +Run A&AI Post Request + [Documentation] Runs an A&AI Post request + [Arguments] ${data_path} ${data} + ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD} + ${session}= Create Session aai ${GLOBAL_AAI_SERVER_URL} auth=${auth} + ${uuid}= Generate UUID + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} + ${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} + ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD} + ${session}= Create Session aai ${GLOBAL_AAI_SERVER_URL} auth=${auth} + ${uuid}= Generate UUID + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} + ${resp}= Delete Request aai ${data_path}?resource-version=${resource_version} headers=${headers} + Log Received response from aai ${resp.text} + [Return] ${resp}
\ No newline at end of file diff --git a/robot/resources/aai/create_customer.robot b/robot/resources/aai/create_customer.robot new file mode 100644 index 00000000..7ebda39d --- /dev/null +++ b/robot/resources/aai/create_customer.robot @@ -0,0 +1,41 @@ +*** Settings *** +Documentation Create A&AI Customer API. +... +... Create A&AI Customer API + +Resource aai_interface.robot +Resource ../json_templater.robot +Library Collections +Library OperatingSystem + + +*** Variables *** +${INDEX PATH} /aai/v8 +${ROOT_CUSTOMER_PATH} /business/customers/customer/ +${SYSTEM USER} robot-ete +${A&AI ADD CUSTOMER BODY} robot/assets/templates/aai/add_customer.template + +*** 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} + ${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 *** +Delete Customer + [Documentation] Deletes a customer in A&AI + [Arguments] ${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 *** +Delete Customer Exists + [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 diff --git a/robot/resources/aai/create_service.robot b/robot/resources/aai/create_service.robot new file mode 100644 index 00000000..38aef3f6 --- /dev/null +++ b/robot/resources/aai/create_service.robot @@ -0,0 +1,75 @@ +*** Settings *** +Documentation Create A&AI Customer API. +... +... Create A&AI Customer API + +Resource ../json_templater.robot +Resource aai_interface.robot +Library OperatingSystem +Library Collections +Library UUID + + + +*** Variables *** +${INDEX PATH} /aai/v8 +${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 *** +Create Service If Not Exists + [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} + Run Keyword If '${status}' == 'FAIL' Create Service ${service_type} + +Create Service + [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} + ${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 + [Arguments] ${service_type} + ${dict}= Get Services + ${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 + [Arguments] ${dict} + ${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} + Should Be Equal As Strings ${resp.status_code} 204 + + +Get Services + [Documentation] Creates a service in A&AI + ${resp}= Run A&AI Get Request ${INDEX PATH}${ROOT_SERVICE_PATH} + ${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()} + [Return] ${dict} + +Update Service Dictionary + [Arguments] ${dict} ${json} + ${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} + Log ${dict} + + diff --git a/robot/resources/aai/create_tenant.robot b/robot/resources/aai/create_tenant.robot new file mode 100644 index 00000000..da21ac92 --- /dev/null +++ b/robot/resources/aai/create_tenant.robot @@ -0,0 +1,79 @@ +*** 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 *** +${INDEX PATH} /aai/v8 +${ROOT_TENANT_PATH} /cloud-infrastructure/cloud-regions/cloud-region/ + +${SYSTEM USER} robot-ete +${AAI_ADD_TENANT_BODY}= robot/assets/templates/aai/add_tenant_body.template + +*** Keywords *** +Inventory Tenant If Not Exists + [Documentation] Creates a service in A&AI if it doesn't exist + [Arguments] ${cloud_owner} ${cloud_region_id} ${cloud_type} ${owner_defined_type} ${cloud_region_version} ${cloud_zone} ${tenant_id} ${tenant_name} + ${dict}= Get Tenants ${cloud_owner} ${cloud_region_id} + ${status} ${value}= Run Keyword And Ignore Error Dictionary Should Contain Key ${dict} ${tenant_id} + Run Keyword If '${status}' == 'FAIL' Inventory Tenant ${cloud_owner} ${cloud_region_id} ${cloud_type} ${owner_defined_type} ${cloud_region_version} ${cloud_zone} ${tenant_id} ${tenant_name} + +Inventory Tenant + [Documentation] Inventorys a Tenant in A&AI + [Arguments] ${cloud_owner} ${cloud_region_id} ${cloud_type} ${owner_defined_type} ${cloud_region_version} ${cloud_zone} ${tenant_id} ${tenant_name} + ${data_template}= OperatingSystem.Get File ${AAI_ADD_TENANT_BODY} + ${arguments}= Create Dictionary cloud_owner=${cloud_owner} cloud_region_id=${cloud_region_id} cloud_type=${cloud_type} owner_defined_type=${owner_defined_type} cloud_region_version=${cloud_region_version} cloud_zone=${cloud_zone} tenant_id=${tenant_id} tenant_name=${tenant_name} + ${data}= Fill JSON Template ${data_template} ${arguments} + ${put_resp}= Run A&AI Put Request ${INDEX PATH}${ROOT_TENANT_PATH}${cloud_owner}/${cloud_region_id} ${data} + Should Be Equal As Strings ${put_resp.status_code} 201 + [Return] ${put_resp.status_code} + +Delete Tenant + [Documentation] Removes both Tenant + [Arguments] ${tenant_id} ${cloud_owner} ${cloud_region_id} + ${get_resp}= Run A&AI Get Request ${INDEX PATH}${ROOT_TENANT_PATH}${cloud_owner}/${cloud_region_id}/tenants/tenant/${tenant_id} + Run Keyword If '${get_resp.status_code}' == '200' Delete Tenant Exists ${tenant_id} ${cloud_owner} ${cloud_region_id} ${get_resp.json()['resource-version']} + +Delete Tenant Exists + [Arguments] ${tenant_id} ${cloud_owner} ${cloud_region_id} ${resource_version} + ${put_resp}= Run A&AI Delete Request ${INDEX PATH}${ROOT_TENANT_PATH}${cloud_owner}/${cloud_region_id}/tenants/tenant/${tenant_id} ${resource_version} + Should Be Equal As Strings ${put_resp.status_code} 204 + +Delete Cloud Region + [Documentation] Removes both Tenant and Cloud Region in A&AI + [Arguments] ${tenant_id} ${cloud_owner} ${cloud_region_id} + ${get_resp}= Run A&AI Get Request ${INDEX PATH}${ROOT_TENANT_PATH}${cloud_owner}/${cloud_region_id} + Run Keyword If '${get_resp.status_code}' == '200' Delete Cloud Region Exists ${tenant_id} ${cloud_owner} ${cloud_region_id} ${get_resp.json()['resource-version']} + +Delete Cloud Region Exists + [Arguments] ${tenant_id} ${cloud_owner} ${cloud_region_id} ${resource_version} + ${put_resp}= Run A&AI Delete Request ${INDEX PATH}${ROOT_TENANT_PATH}${cloud_owner}/${cloud_region_id} ${resource_version} + Should Be Equal As Strings ${put_resp.status_code} 204 + +Get Tenants + [Documentation] Return list of tenants for this cloud owner/region + [Arguments] ${cloud_owner} ${cloud_region_id} + ${resp}= Run A&AI Get Request ${INDEX PATH}${ROOT_TENANT_PATH}${cloud_owner}/${cloud_region_id}/tenants + ${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 Tenant Dictionary ${dict} ${resp.json()} + [Return] ${dict} + +Update Tenant Dictionary + [Arguments] ${dict} ${json} + ${list}= Evaluate ${json}['tenant'] + :for ${map} in @{list} + \ ${status} ${tenant_id}= Run Keyword And Ignore Error Get From Dictionary ${map} tenant-id + \ Run Keyword If '${status}' == 'PASS' Set To Dictionary ${dict} ${tenant_id}=${map} + Log ${dict} + + + +
\ No newline at end of file diff --git a/robot/resources/aai/network.robot b/robot/resources/aai/network.robot new file mode 100644 index 00000000..a42461e2 --- /dev/null +++ b/robot/resources/aai/network.robot @@ -0,0 +1,42 @@ +*** Settings *** +Documentation Validate A&AI Serivce Instance +... +... Validate A&AI Serivce Instance + +Resource aai_interface.robot +Library Collections +Library OperatingSystem +Library RequestsLibrary +Library JSONUtils +Library HttpLibrary.HTTP + +Resource ../json_templater.robot + +*** Variables *** +${INDEX PATH} /aai/v8 +${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 + +*** Keywords *** +Validate Network + [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 *** +Create Network + [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 diff --git a/robot/resources/aai/service_instance.robot b/robot/resources/aai/service_instance.robot new file mode 100644 index 00000000..c9fdadd6 --- /dev/null +++ b/robot/resources/aai/service_instance.robot @@ -0,0 +1,82 @@ +*** Settings *** +Documentation Validate A&AI Serivce Instance +... +... Validate A&AI Serivce Instance + +Resource aai_interface.robot +Library Collections +Library OperatingSystem +Library RequestsLibrary +Library JSONUtils +Library HttpLibrary.HTTP +Library StringTemplater +Resource ../json_templater.robot +Resource ../stack_validation/validate_vlb.robot +Resource ../stack_validation/validate_vfw.robot +Resource ../stack_validation/validate_vvg.robot + +*** Variables *** +${INDEX PATH} /aai/v8 +${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-id= +${SERVCE INSTANCE TEMPLATE} robot/assets/templates/aai/service_subscription.template + +${GENERIC_VNF_PATH_TEMPLATE} /network/generic-vnfs/generic-vnf/\${vnf_id}/vf-modules/vf-module/\${vf_module_id} +${VLB_CLOSED_LOOP_HACK_BODY} robot/assets/templates/aai/vlb_closed_loop_hack.template + +*** Keywords *** +Validate Service Instance + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${service_instance_name} ${service_type} ${customer_name} + ${cust_resp}= Run A&AI Get Request ${INDEX PATH}/business/customers?subscriber-name=${customer_name} + ${resp}= Run A&AI Get Request ${INDEX PATH}${CUSTOMER SPEC PATH}${cust_resp.json()['customer'][0]['global-customer-id']}${SERVICE SUBSCRIPTIONS}${service_type}${SERVICE INSTANCE}${service_instance_name} + Dictionary Should Contain Value ${resp.json()['service-instance'][0]} ${service_instance_name} + Dictionary Should Contain Key ${resp.json()['service-instance'][0]} persona-model-id + Dictionary Should Contain Key ${resp.json()['service-instance'][0]} persona-model-version + +Validate Generic VNF + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${vnf_name} ${vnf_type} ${service_instance_id} + ${generic_vnf}= Run A&AI Get Request ${INDEX PATH}/network/generic-vnfs/generic-vnf?vnf-name=${vnf_name} + Dictionary Should Contain Value ${generic_vnf.json()} ${vnf_name} + ${returned_vnf_type}= Get From Dictionary ${generic_vnf.json()} vnf-type + Should Contain ${returned_vnf_type} ${vnf_type} + [Return] ${generic_vnf.json()} + +VLB Closed Loop Hack + [Arguments] ${service} ${generic_vnf} ${closedloop_vf_module} + Return From Keyword If '${service}' != 'vLB' + ${vnf_id}= Get From Dictionary ${generic_vnf} vnf-id + ${vf_modules}= Get From Dictionary ${generic_vnf} vf-modules + ${list}= Get From Dictionary ${vf_modules} vf-module + ${vfmodule}= Get From List ${list} 0 + ${persona_model_id}= Get From Dictionary ${closedloop_vf_module} invariantUUID + ${persona_model_version}= Get From Dictionary ${closedloop_vf_module} version + ${dict}= Create Dictionary vnf_id=${vnf_id} vf_module_id=dummy persona_model_id=${persona_model_id} persona_model_version=${persona_model_version} + ${datapath}= Template String ${GENERIC_VNF_PATH_TEMPLATE} ${dict} + ${data}= Fill JSON Template File ${VLB_CLOSED_LOOP_HACK_BODY} ${dict} + ${put_resp}= Run A&AI Put Request ${INDEX PATH}${datapath} ${data} + ${status_string}= Convert To String ${put_resp.status_code} + Should Match Regexp ${status_string} ^(201|412)$ + + +Validate VF Module + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${vf_module_name} ${stack_type} + Run Keyword If '${stack_type}'=='vLB' Validate vLB Stack ${vf_module_name} + Run Keyword If '${stack_type}'=='vFW' Validate Firewall Stack ${vf_module_name} + Run Keyword If '${stack_type}'=='vVG' Validate vVG Stack ${vf_module_name} + +*** Keywords *** +Create AAI Service Instance + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${customer_id} ${service_type} ${service_instance_id} ${service_instance_name} + ${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}/{service_type} ${json_string} + Should Be Equal As Strings ${put_resp.status_code} 201 + [Return] ${put_resp.status_code} + +
\ No newline at end of file diff --git a/robot/resources/aai/volume_group.robot b/robot/resources/aai/volume_group.robot new file mode 100644 index 00000000..95822011 --- /dev/null +++ b/robot/resources/aai/volume_group.robot @@ -0,0 +1,31 @@ +*** Settings *** +Documentation Validate A&AI Serivce Instance +... +... Validate A&AI Serivce Instance + +Resource aai_interface.robot +Library Collections +Library OperatingSystem +Library RequestsLibrary +Library JSONUtils +Library HttpLibrary.HTTP + +Resource ../json_templater.robot + +*** Variables *** +${INDEX PATH} /aai/v8 +${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 + +*** 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 |