blob: 31a4a610684a46c2662a3d980b170931485e1107 [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001*** Settings ***
2Documentation Validate A&AI Serivce Instance
3...
4... Validate A&AI Serivce Instance
5
6Resource aai_interface.robot
7Library Collections
8Library OperatingSystem
9Library RequestsLibrary
10Library JSONUtils
11Library HttpLibrary.HTTP
12Library StringTemplater
13Resource ../json_templater.robot
14Resource ../stack_validation/validate_vlb.robot
15Resource ../stack_validation/validate_vfw.robot
16Resource ../stack_validation/validate_vvg.robot
jf986075010a42017-02-22 16:52:54 -050017Resource ../aai/aai_interface.robot
DR695Hccff30b2017-02-17 18:44:24 -050018
19*** Variables ***
Jerry Flood8a6b0b52017-11-12 15:44:21 -050020${INDEX PATH} /aai/v11
DR695Hccff30b2017-02-17 18:44:24 -050021${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=
jf986099c63292017-03-09 15:28:42 -050026${SERVCE INSTANCE TEMPLATE} robot/assets/templates/aai/service_subscription.template
DR695Hccff30b2017-02-17 18:44:24 -050027
28${GENERIC_VNF_PATH_TEMPLATE} /network/generic-vnfs/generic-vnf/\${vnf_id}/vf-modules/vf-module/\${vf_module_id}
jf9860de6a6e22017-03-04 13:14:09 -050029${GENERIC_VNF_QUERY_TEMPLATE} /network/generic-vnfs/generic-vnf/\${vnf_id}/vf-modules/vf-module?vf-module-name=\${vf_module_name}
DR695Hccff30b2017-02-17 18:44:24 -050030${VLB_CLOSED_LOOP_HACK_BODY} robot/assets/templates/aai/vlb_closed_loop_hack.template
jf986099c63292017-03-09 15:28:42 -050031
32#*************** Test Case Variables *************
jf986075010a42017-02-22 16:52:54 -050033${VLB_CLOSED_LOOP_DELETE}
jf9860de6a6e22017-03-04 13:14:09 -050034${VLB_CLOSED_LOOP_VNF_ID}
DR695Hccff30b2017-02-17 18:44:24 -050035
jf986099c63292017-03-09 15:28:42 -050036*** Keywords ***
DR695Hccff30b2017-02-17 18:44:24 -050037Validate Service Instance
jf986099c63292017-03-09 15:28:42 -050038 [Documentation] Query and Validates A&AI Service Instance
DR695Hccff30b2017-02-17 18:44:24 -050039 [Arguments] ${service_instance_name} ${service_type} ${customer_name}
jf986099c63292017-03-09 15:28:42 -050040 ${cust_resp}= Run A&AI Get Request ${INDEX PATH}/business/customers?subscriber-name=${customer_name}
DR695Hccff30b2017-02-17 18:44:24 -050041 ${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}
42 Dictionary Should Contain Value ${resp.json()['service-instance'][0]} ${service_instance_name}
Jerry Flood80ff9852017-08-11 06:47:14 -040043 #Dictionary Should Contain Key ${resp.json()['service-instance'][0]} persona-model-id
44 #Dictionary Should Contain Key ${resp.json()['service-instance'][0]} persona-model-version
jf986099c63292017-03-09 15:28:42 -050045
DR695Hccff30b2017-02-17 18:44:24 -050046Validate Generic VNF
jf986099c63292017-03-09 15:28:42 -050047 [Documentation] Query and Validates A&AI Service Instance
48 [Arguments] ${vnf_name} ${vnf_type} ${service_instance_id}
49 ${generic_vnf}= Run A&AI Get Request ${INDEX PATH}/network/generic-vnfs/generic-vnf?vnf-name=${vnf_name}
DR695Hccff30b2017-02-17 18:44:24 -050050 Dictionary Should Contain Value ${generic_vnf.json()} ${vnf_name}
51 ${returned_vnf_type}= Get From Dictionary ${generic_vnf.json()} vnf-type
52 Should Contain ${returned_vnf_type} ${vnf_type}
Jerry Floodfe79d7f2017-11-22 17:32:18 -050053 ${vnf_id}= Get From Dictionary ${generic_vnf.json()} vnf-id
54 ${generic_vnf}= Run A&AI Get Request ${INDEX PATH}/network/generic-vnfs/generic-vnf/${vnf_id}?depth=all
DR695Hccff30b2017-02-17 18:44:24 -050055 [Return] ${generic_vnf.json()}
jf986099c63292017-03-09 15:28:42 -050056
DR695Hccff30b2017-02-17 18:44:24 -050057VLB Closed Loop Hack
jf986099c63292017-03-09 15:28:42 -050058 [Arguments] ${service} ${generic_vnf} ${closedloop_vf_module}
DR695Hccff30b2017-02-17 18:44:24 -050059 Return From Keyword If '${service}' != 'vLB'
60 ${vnf_id}= Get From Dictionary ${generic_vnf} vnf-id
61 ${vf_modules}= Get From Dictionary ${generic_vnf} vf-modules
62 ${list}= Get From Dictionary ${vf_modules} vf-module
63 ${vfmodule}= Get From List ${list} 0
64 ${persona_model_id}= Get From Dictionary ${closedloop_vf_module} invariantUUID
65 ${persona_model_version}= Get From Dictionary ${closedloop_vf_module} version
jf9860de6a6e22017-03-04 13:14:09 -050066 ${dummy}= Catenate dummy_${vnf_id}
jf986099c63292017-03-09 15:28:42 -050067 ${dict}= Create Dictionary vnf_id=${vnf_id} vf_module_id=${dummy} persona_model_id=${persona_model_id} persona_model_version=${persona_model_version}
DR695Hccff30b2017-02-17 18:44:24 -050068 ${datapath}= Template String ${GENERIC_VNF_PATH_TEMPLATE} ${dict}
jf986099c63292017-03-09 15:28:42 -050069 ${data}= Fill JSON Template File ${VLB_CLOSED_LOOP_HACK_BODY} ${dict}
DR695Hccff30b2017-02-17 18:44:24 -050070 ${put_resp}= Run A&AI Put Request ${INDEX PATH}${datapath} ${data}
71 ${status_string}= Convert To String ${put_resp.status_code}
jf986099c63292017-03-09 15:28:42 -050072 Should Match Regexp ${status_string} ^(201|412)$
73 Set Test Variable ${VLB_CLOSED_LOOP_DELETE} ${datapath}
74 Set Test Variable ${VLB_CLOSED_LOOP_VNF_ID} ${vnf_id}
jf9860de6a6e22017-03-04 13:14:09 -050075
76
77VLB Closed Loop Hack Update
78 [Documentation] Update the A&AI vDNS scaling vf module to have persona-model-version 1 rather than 1.0
79 [Arguments] ${stack_name}
80 ${dict}= Create Dictionary vnf_id=${VLB_CLOSED_LOOP_VNF_ID} vf_module_name=${stack_name}
jf986099c63292017-03-09 15:28:42 -050081 ${query}= Template String ${GENERIC_VNF_QUERY_TEMPLATE} ${dict}
jf9860de6a6e22017-03-04 13:14:09 -050082 ${get_resp}= Run A&AI Get Request ${INDEX_PATH}${query}
83 ${json}= Set Variable ${get_resp.json()}
84 Set to Dictionary ${json} persona-model-version 1
85 ${vf_module_id}= Get From Dictionary ${json} vf-module-id
86 Set to Dictionary ${dict} vf_module_id=${vf_module_id}
jf986099c63292017-03-09 15:28:42 -050087 ${uri}= Template String ${GENERIC_VNF_PATH_TEMPLATE} ${dict}
jf9860de6a6e22017-03-04 13:14:09 -050088 ${resp}= Run A&AI Put Request ${INDEX_PATH}${uri} ${json}
89 ${get_resp}= Run A&AI Get Request ${INDEX_PATH}${query}
90
jf986075010a42017-02-22 16:52:54 -050091
92Teardown VLB Closed Loop Hack
93 Return From Keyword If ' ${VLB_CLOSED_LOOP_DELETE}' == ''
94 Delete A&AI Entity ${VLB_CLOSED_LOOP_DELETE}
DR695Hccff30b2017-02-17 18:44:24 -050095
jf986099c63292017-03-09 15:28:42 -050096
97Validate VF Module
98 [Documentation] Query and Validates A&AI Service Instance
99 [Arguments] ${vf_module_name} ${stack_type}
100 Run Keyword If '${stack_type}'=='vLB' Validate vLB Stack ${vf_module_name}
101 Run Keyword If '${stack_type}'=='vFW' Validate Firewall Stack ${vf_module_name}
102 Run Keyword If '${stack_type}'=='vVG' Validate vVG Stack ${vf_module_name}
103
104*** Keywords ***
DR695Hccff30b2017-02-17 18:44:24 -0500105Create AAI Service Instance
jf986099c63292017-03-09 15:28:42 -0500106 [Documentation] Query and Validates A&AI Service Instance
107 [Arguments] ${customer_id} ${service_type} ${service_instance_id} ${service_instance_name}
DR695Hccff30b2017-02-17 18:44:24 -0500108 ${json_string}= Catenate { "service-type": "VDNS" , "service-subscriptions":[{"service-instance-id":"instanceid123","service-instance-name":"VDNS"}]}
109 ${put_resp}= Run A&AI Put Request ${INDEX PATH}${CUSTOMER SPEC PATH}${CUSTOMER ID}${SERVICE SUBSCRIPTIONS}/{service_type} ${json_string}
110 Should Be Equal As Strings ${put_resp.status_code} 201
jf986099c63292017-03-09 15:28:42 -0500111 [Return] ${put_resp.status_code}
112