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 |
| 10 | Library JSONUtils |
| 11 | Library HttpLibrary.HTTP |
| 12 | Library StringTemplater |
| 13 | Resource ../json_templater.robot |
| 14 | Resource ../stack_validation/validate_vlb.robot |
| 15 | Resource ../stack_validation/validate_vfw.robot |
| 16 | Resource ../stack_validation/validate_vvg.robot |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 17 | Resource ../aai/aai_interface.robot |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 18 | |
| 19 | *** Variables *** |
| 20 | ${INDEX PATH} /aai/v8 |
| 21 | ${GENERIC_QUERY_PATH} /search/generic-query? |
| 22 | ${SYSTEM USER} robot-ete |
| 23 | ${CUSTOMER SPEC PATH} /business/customers/customer/ |
| 24 | ${SERVICE SUBSCRIPTIONS} /service-subscriptions/service-subscription/ |
| 25 | ${SERVICE INSTANCE} /service-instances?service-instance-id= |
| 26 | ${SERVCE INSTANCE TEMPLATE} robot/assets/templates/aai/service_subscription.template |
| 27 | |
| 28 | ${GENERIC_VNF_PATH_TEMPLATE} /network/generic-vnfs/generic-vnf/\${vnf_id}/vf-modules/vf-module/\${vf_module_id} |
| 29 | ${VLB_CLOSED_LOOP_HACK_BODY} robot/assets/templates/aai/vlb_closed_loop_hack.template |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 30 | ${VLB_CLOSED_LOOP_DELETE} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 31 | |
| 32 | *** Keywords *** |
| 33 | Validate Service Instance |
| 34 | [Documentation] Query and Validates A&AI Service Instance |
| 35 | [Arguments] ${service_instance_name} ${service_type} ${customer_name} |
| 36 | ${cust_resp}= Run A&AI Get Request ${INDEX PATH}/business/customers?subscriber-name=${customer_name} |
| 37 | ${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} |
| 38 | Dictionary Should Contain Value ${resp.json()['service-instance'][0]} ${service_instance_name} |
| 39 | Dictionary Should Contain Key ${resp.json()['service-instance'][0]} persona-model-id |
| 40 | Dictionary Should Contain Key ${resp.json()['service-instance'][0]} persona-model-version |
| 41 | |
| 42 | Validate Generic VNF |
| 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} |
| 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} |
| 49 | [Return] ${generic_vnf.json()} |
| 50 | |
| 51 | VLB Closed Loop Hack |
| 52 | [Arguments] ${service} ${generic_vnf} ${closedloop_vf_module} |
| 53 | Return From Keyword If '${service}' != 'vLB' |
| 54 | ${vnf_id}= Get From Dictionary ${generic_vnf} vnf-id |
| 55 | ${vf_modules}= Get From Dictionary ${generic_vnf} vf-modules |
| 56 | ${list}= Get From Dictionary ${vf_modules} vf-module |
| 57 | ${vfmodule}= Get From List ${list} 0 |
| 58 | ${persona_model_id}= Get From Dictionary ${closedloop_vf_module} invariantUUID |
| 59 | ${persona_model_version}= Get From Dictionary ${closedloop_vf_module} version |
| 60 | ${dict}= Create Dictionary vnf_id=${vnf_id} vf_module_id=dummy persona_model_id=${persona_model_id} persona_model_version=${persona_model_version} |
| 61 | ${datapath}= Template String ${GENERIC_VNF_PATH_TEMPLATE} ${dict} |
| 62 | ${data}= Fill JSON Template File ${VLB_CLOSED_LOOP_HACK_BODY} ${dict} |
| 63 | ${put_resp}= Run A&AI Put Request ${INDEX PATH}${datapath} ${data} |
| 64 | ${status_string}= Convert To String ${put_resp.status_code} |
jf9860 | 75010a4 | 2017-02-22 16:52:54 -0500 | [diff] [blame] | 65 | Should Match Regexp ${status_string} ^(201|412)$ |
| 66 | Set Test Variable ${VLB_CLOSED_LOOP_DELETE} ${datapath} |
| 67 | |
| 68 | Teardown VLB Closed Loop Hack |
| 69 | Return From Keyword If ' ${VLB_CLOSED_LOOP_DELETE}' == '' |
| 70 | Delete A&AI Entity ${VLB_CLOSED_LOOP_DELETE} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 71 | |
| 72 | |
| 73 | Validate VF Module |
| 74 | [Documentation] Query and Validates A&AI Service Instance |
| 75 | [Arguments] ${vf_module_name} ${stack_type} |
| 76 | Run Keyword If '${stack_type}'=='vLB' Validate vLB Stack ${vf_module_name} |
| 77 | Run Keyword If '${stack_type}'=='vFW' Validate Firewall Stack ${vf_module_name} |
| 78 | Run Keyword If '${stack_type}'=='vVG' Validate vVG Stack ${vf_module_name} |
| 79 | |
| 80 | *** Keywords *** |
| 81 | Create AAI Service Instance |
| 82 | [Documentation] Query and Validates A&AI Service Instance |
| 83 | [Arguments] ${customer_id} ${service_type} ${service_instance_id} ${service_instance_name} |
| 84 | ${json_string}= Catenate { "service-type": "VDNS" , "service-subscriptions":[{"service-instance-id":"instanceid123","service-instance-name":"VDNS"}]} |
| 85 | ${put_resp}= Run A&AI Put Request ${INDEX PATH}${CUSTOMER SPEC PATH}${CUSTOMER ID}${SERVICE SUBSCRIPTIONS}/{service_type} ${json_string} |
| 86 | Should Be Equal As Strings ${put_resp.status_code} 201 |
| 87 | [Return] ${put_resp.status_code} |
| 88 | |
| 89 | |