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