DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Validate A&AI Serivce Instance |
| 3 | ... |
| 4 | ... Validate A&AI Serivce Instance |
| 5 | |
| 6 | Resource aai_interface.robot |
| 7 | Library Collections |
| 8 | Library OperatingSystem |
| 9 | Library RequestsLibrary |
DR695H | 7aca1a4 | 2019-06-03 17:08:34 -0400 | [diff] [blame] | 10 | Library ONAPLibrary.JSON |
DR695H | 3bb6cf4 | 2019-06-20 15:04:04 -0400 | [diff] [blame] | 11 | Library ONAPLibrary.Templating |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 12 | Resource ../stack_validation/validate_vlb.robot |
| 13 | Resource ../stack_validation/validate_vfw.robot |
| 14 | Resource ../stack_validation/validate_vvg.robot |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 15 | Resource ../aai/aai_interface.robot |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 16 | |
| 17 | *** Variables *** |
Jerry Flood | 8a6b0b5 | 2017-11-12 15:44:21 -0500 | [diff] [blame] | 18 | ${INDEX PATH} /aai/v11 |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 19 | ${GENERIC_QUERY_PATH} /search/generic-query? |
| 20 | ${SYSTEM USER} robot-ete |
| 21 | ${CUSTOMER SPEC PATH} /business/customers/customer/ |
| 22 | ${SERVICE SUBSCRIPTIONS} /service-subscriptions/service-subscription/ |
| 23 | ${SERVICE INSTANCE} /service-instances?service-instance-id= |
DR695H | 3bb6cf4 | 2019-06-20 15:04:04 -0400 | [diff] [blame] | 24 | ${SERVCE INSTANCE TEMPLATE} aai/service_subscription.jinja |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 25 | |
| 26 | ${GENERIC_VNF_PATH_TEMPLATE} /network/generic-vnfs/generic-vnf/\${vnf_id}/vf-modules/vf-module/\${vf_module_id} |
jf9860 | de6a6e2 | 2017-03-04 13:14:09 -0500 | [diff] [blame] | 27 | ${GENERIC_VNF_QUERY_TEMPLATE} /network/generic-vnfs/generic-vnf/\${vnf_id}/vf-modules/vf-module?vf-module-name=\${vf_module_name} |
DR695H | 3bb6cf4 | 2019-06-20 15:04:04 -0400 | [diff] [blame] | 28 | ${VLB_CLOSED_LOOP_HACK_BODY} aai/vlb_closed_loop_hack.jinja |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 29 | |
| 30 | #*************** Test Case Variables ************* |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 31 | ${VLB_CLOSED_LOOP_DELETE} |
jf9860 | de6a6e2 | 2017-03-04 13:14:09 -0500 | [diff] [blame] | 32 | ${VLB_CLOSED_LOOP_VNF_ID} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 33 | |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 34 | *** Keywords *** |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 35 | Validate Service Instance |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 36 | [Documentation] Query and Validates A&AI Service Instance |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 37 | [Arguments] ${service_instance_name} ${service_type} ${customer_name} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 38 | ${cust_resp}= Run A&AI Get Request ${INDEX PATH}/business/customers?subscriber-name=${customer_name} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 39 | ${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} |
| 40 | Dictionary Should Contain Value ${resp.json()['service-instance'][0]} ${service_instance_name} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 41 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 42 | Validate Generic VNF |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 43 | [Documentation] Query and Validates A&AI Service Instance |
| 44 | [Arguments] ${vnf_name} ${vnf_type} ${service_instance_id} |
| 45 | ${generic_vnf}= Run A&AI Get Request ${INDEX PATH}/network/generic-vnfs/generic-vnf?vnf-name=${vnf_name} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 46 | Dictionary Should Contain Value ${generic_vnf.json()} ${vnf_name} |
| 47 | ${returned_vnf_type}= Get From Dictionary ${generic_vnf.json()} vnf-type |
| 48 | Should Contain ${returned_vnf_type} ${vnf_type} |
Jerry Flood | fe79d7f | 2017-11-22 17:32:18 -0500 | [diff] [blame] | 49 | ${vnf_id}= Get From Dictionary ${generic_vnf.json()} vnf-id |
| 50 | ${generic_vnf}= Run A&AI Get Request ${INDEX PATH}/network/generic-vnfs/generic-vnf/${vnf_id}?depth=all |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 51 | [Return] ${generic_vnf.json()} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 52 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 53 | VLB Closed Loop Hack |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 54 | [Arguments] ${service} ${generic_vnf} ${closedloop_vf_module} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 55 | Return From Keyword If '${service}' != 'vLB' |
| 56 | ${vnf_id}= Get From Dictionary ${generic_vnf} vnf-id |
| 57 | ${vf_modules}= Get From Dictionary ${generic_vnf} vf-modules |
| 58 | ${list}= Get From Dictionary ${vf_modules} vf-module |
| 59 | ${vfmodule}= Get From List ${list} 0 |
| 60 | ${persona_model_id}= Get From Dictionary ${closedloop_vf_module} invariantUUID |
| 61 | ${persona_model_version}= Get From Dictionary ${closedloop_vf_module} version |
jf9860 | de6a6e2 | 2017-03-04 13:14:09 -0500 | [diff] [blame] | 62 | ${dummy}= Catenate dummy_${vnf_id} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 63 | ${dict}= Create Dictionary vnf_id=${vnf_id} vf_module_id=${dummy} persona_model_id=${persona_model_id} persona_model_version=${persona_model_version} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 64 | ${datapath}= Template String ${GENERIC_VNF_PATH_TEMPLATE} ${dict} |
DR695H | 3bb6cf4 | 2019-06-20 15:04:04 -0400 | [diff] [blame] | 65 | Create Environment aai ${GLOBAL_TEMPLATE_FOLDER} |
| 66 | ${data}= Apply Template aai ${VLB_CLOSED_LOOP_HACK_BODY} ${dict} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 67 | ${put_resp}= Run A&AI Put Request ${INDEX PATH}${datapath} ${data} |
| 68 | ${status_string}= Convert To String ${put_resp.status_code} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 69 | Should Match Regexp ${status_string} ^(201|412)$ |
| 70 | Set Test Variable ${VLB_CLOSED_LOOP_DELETE} ${datapath} |
| 71 | Set Test Variable ${VLB_CLOSED_LOOP_VNF_ID} ${vnf_id} |
jf9860 | de6a6e2 | 2017-03-04 13:14:09 -0500 | [diff] [blame] | 72 | |
| 73 | |
| 74 | VLB Closed Loop Hack Update |
| 75 | [Documentation] Update the A&AI vDNS scaling vf module to have persona-model-version 1 rather than 1.0 |
| 76 | [Arguments] ${stack_name} |
| 77 | ${dict}= Create Dictionary vnf_id=${VLB_CLOSED_LOOP_VNF_ID} vf_module_name=${stack_name} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 78 | ${query}= Template String ${GENERIC_VNF_QUERY_TEMPLATE} ${dict} |
jf9860 | de6a6e2 | 2017-03-04 13:14:09 -0500 | [diff] [blame] | 79 | ${get_resp}= Run A&AI Get Request ${INDEX_PATH}${query} |
| 80 | ${json}= Set Variable ${get_resp.json()} |
| 81 | Set to Dictionary ${json} persona-model-version 1 |
| 82 | ${vf_module_id}= Get From Dictionary ${json} vf-module-id |
| 83 | Set to Dictionary ${dict} vf_module_id=${vf_module_id} |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 84 | ${uri}= Template String ${GENERIC_VNF_PATH_TEMPLATE} ${dict} |
jf9860 | de6a6e2 | 2017-03-04 13:14:09 -0500 | [diff] [blame] | 85 | ${resp}= Run A&AI Put Request ${INDEX_PATH}${uri} ${json} |
| 86 | ${get_resp}= Run A&AI Get Request ${INDEX_PATH}${query} |
| 87 | |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 88 | |
| 89 | Teardown VLB Closed Loop Hack |
| 90 | Return From Keyword If ' ${VLB_CLOSED_LOOP_DELETE}' == '' |
| 91 | Delete A&AI Entity ${VLB_CLOSED_LOOP_DELETE} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 92 | |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 93 | |
| 94 | Validate VF Module |
| 95 | [Documentation] Query and Validates A&AI Service Instance |
| 96 | [Arguments] ${vf_module_name} ${stack_type} |
| 97 | Run Keyword If '${stack_type}'=='vLB' Validate vLB Stack ${vf_module_name} |
| 98 | Run Keyword If '${stack_type}'=='vFW' Validate Firewall Stack ${vf_module_name} |
| 99 | Run Keyword If '${stack_type}'=='vVG' Validate vVG Stack ${vf_module_name} |
| 100 | |
| 101 | *** Keywords *** |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 102 | Create AAI Service Instance |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 103 | [Documentation] Query and Validates A&AI Service Instance |
| 104 | [Arguments] ${customer_id} ${service_type} ${service_instance_id} ${service_instance_name} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 105 | ${json_string}= Catenate { "service-type": "VDNS" , "service-subscriptions":[{"service-instance-id":"instanceid123","service-instance-name":"VDNS"}]} |
| 106 | ${put_resp}= Run A&AI Put Request ${INDEX PATH}${CUSTOMER SPEC PATH}${CUSTOMER ID}${SERVICE SUBSCRIPTIONS}/{service_type} ${json_string} |
| 107 | Should Be Equal As Strings ${put_resp.status_code} 201 |
jf9860 | 99c6329 | 2017-03-09 15:28:42 -0500 | [diff] [blame] | 108 | [Return] ${put_resp.status_code} |
| 109 | |