Release image version 1.12.2
[testsuite.git] / robot / resources / aai / service_instance.robot
1 *** Settings ***
2 Documentation     Validate A&AI Serivce Instance
3
4 Resource          aai_interface.robot
5 Library    Collections
6 Library    OperatingSystem
7 Library    RequestsLibrary
8 Library    ONAPLibrary.JSON
9 Library    ONAPLibrary.Templating    WITH NAME    Templating
10 Library    ONAPLibrary.AAI    WITH NAME    AAI
11 Resource          ../stack_validation/validate_vlb.robot
12 Resource          ../stack_validation/validate_vfw.robot
13 Resource          ../stack_validation/validate_vvg.robot
14 Resource          ../aai/aai_interface.robot
15
16 *** Variables ***
17 ${INDEX PATH}     /aai/v11
18 ${GENERIC_QUERY_PATH}  /search/generic-query?
19 ${SYSTEM USER}    robot-ete
20 ${CUSTOMER SPEC PATH}    /business/customers/customer/
21 ${SERVICE SUBSCRIPTIONS}    /service-subscriptions/service-subscription/
22 ${SERVICE INSTANCE}    /service-instances?service-instance-id=
23 ${SERVCE INSTANCE TEMPLATE}    aai/service_subscription.jinja
24
25 ${GENERIC_VNF_PATH_TEMPLATE}   /network/generic-vnfs/generic-vnf/\${vnf_id}/vf-modules/vf-module/\${vf_module_id}
26 ${GENERIC_VNF_QUERY_TEMPLATE}   /network/generic-vnfs/generic-vnf/\${vnf_id}/vf-modules/vf-module?vf-module-name=\${vf_module_name}
27
28 *** Keywords ***
29 Validate Service Instance
30     [Documentation]    Query and Validates A&AI Service Instance
31     [Arguments]    ${service_instance_name}    ${service_type}  ${customer_name}
32     ${cust_resp}=    AAI.Run Get Request      ${AAI_FRONTEND_ENDPOINT}    ${INDEX PATH}/business/customers?subscriber-name=${customer_name}        auth=${GLOBAL_AAI_AUTHENTICATION}
33         ${resp}=    AAI.Run Get Request      ${AAI_FRONTEND_ENDPOINT}    ${INDEX PATH}${CUSTOMER SPEC PATH}${cust_resp.json()['customer'][0]['global-customer-id']}${SERVICE SUBSCRIPTIONS}${service_type}${SERVICE INSTANCE}${service_instance_name}        auth=${GLOBAL_AAI_AUTHENTICATION}
34     Dictionary Should Contain Value     ${resp.json()['service-instance'][0]}    ${service_instance_name}
35
36 Validate Generic VNF
37     [Documentation]    Query and Validates A&AI Service Instance
38     [Arguments]    ${vnf_name}  ${vnf_type}    ${service_instance_id}
39     ${generic_vnf}=    AAI.Run Get Request      ${AAI_FRONTEND_ENDPOINT}    ${INDEX PATH}/network/generic-vnfs/generic-vnf?vnf-name=${vnf_name}        auth=${GLOBAL_AAI_AUTHENTICATION}
40     Dictionary Should Contain Value     ${generic_vnf.json()}    ${vnf_name}
41     ${returned_vnf_type}=    Get From Dictionary    ${generic_vnf.json()}    vnf-type
42     Should Contain      ${returned_vnf_type}    ${vnf_type}
43     ${vnf_id}=    Get From Dictionary    ${generic_vnf.json()}    vnf-id
44     ${generic_vnf}=    AAI.Run Get Request      ${AAI_FRONTEND_ENDPOINT}    ${INDEX PATH}/network/generic-vnfs/generic-vnf/${vnf_id}?depth=all        auth=${GLOBAL_AAI_AUTHENTICATION}
45     [Return]    ${generic_vnf.json()}
46
47 Validate VF Module
48     [Documentation]    Query and Validates A&AI Service Instance
49     [Arguments]    ${vf_module_name}    ${stack_type}
50         Run Keyword If    '${stack_type}'=='vLB'    Validate vLB Stack    ${vf_module_name}
51         Run Keyword If    '${stack_type}'=='vFW'    Validate Firewall Stack    ${vf_module_name}
52         Run Keyword If    '${stack_type}'=='vVG'    Validate vVG Stack    ${vf_module_name}