2 Documentation     This test template encapsulates the VNF Orchestration use case.
 
   4 Resource        ../vid/create_service_instance.robot
 
   5 Resource        ../vid/vid_interface.robot
 
   6 Resource        ../aai/service_instance.robot
 
   7 Resource        ../vid/create_vid_vnf.robot
 
   8 Resource        ../vid/teardown_vid.robot
 
   9 Resource        ../sdngc_interface.robot
 
  10 Resource        model_test_template.robot
 
  12 Resource        ../aai/create_customer.robot
 
  13 Resource        ../aai/create_tenant.robot
 
  14 Resource        ../aai/create_service.robot
 
  15 Resource        ../openstack/neutron_interface.robot
 
  16 Resource        ../heatbridge.robot
 
  19 Library         OpenstackLibrary
 
  20 Library             ExtendedSelenium2Library
 
  28 #**************** TEST CASE VARIABLES **************************
 
  36 ${SERVICE_INSTANCE_ID}
 
  41     [Documentation]   Use openECOMP to Orchestrate a service.
 
  42     [Arguments]    ${customer_name}    ${service}    ${product_family}    ${tenant}
 
  43     ${lcp_region}=   Get Openstack Region
 
  44     ${uuid}=    Generate UUID
 
  45     Set Test Variable    ${CUSTOMER_NAME}    ${customer_name}_${uuid}
 
  46     Set Test Variable    ${SERVICE}    ${service}
 
  47     ${vnf_name}=    Catenate    Vnf_Ete_Name${uuid}
 
  48     ${service_name}=    Catenate    Service_Ete_Name${uuid}
 
  49     ${service_type}=    Set Variable    ${service}
 
  50     ${vf_module_name}=    Catenate    Vfmodule_Ete_Name${uuid}
 
  51     ${service_model_type}     ${vnf_type}    ${vf_modules} =    Model Distribution For Directory    ${service}
 
  52     Run Keyword If   '${service}' == 'vVG'    Create VVG Server    ${uuid}
 
  53     Create Customer For VNF    ${CUSTOMER_NAME}    ${CUSTOMER_NAME}    INFRA    ${service_type}    ${GLOBAL_AAI_CLOUD_OWNER}
 
  56     ${service_instance_id}=    Create VID Service Instance    ${customer_name}    ${service_model_type}    ${service}     ${service_name}
 
  57     Set Test Variable   ${SERVICE_INSTANCE_ID}   ${service_instance_id}
 
  58     Validate Service Instance    ${service_instance_id}    ${service}      ${customer_name}
 
  59     Create VID VNF    ${service_instance_id}    ${vnf_name}    ${product_family}    ${lcp_region}    ${tenant}    ${vnf_type}
 
  60     ${vf_module_type}   ${closedloop_vf_module}=   Preload Vnf    ${service_instance_id}   ${vnf_name}   ${vnf_type}   ${vf_module_name}    ${vf_modules}    ${service}    ${uuid}
 
  61     ${vf_module_id}=   Create VID VNF module    ${service_instance_id}    ${vf_module_name}    ${lcp_region}    ${tenant}     ${vf_module_type}
 
  62     ${generic_vnf}=   Validate Generic VNF    ${vnf_name}    ${vnf_type}    ${service_instance_id}
 
  63     VLB Closed Loop Hack   ${service}   ${generic_vnf}   ${closedloop_vf_module}
 
  64     Set Test Variable    ${STACK_NAME}   ${vf_module_name}
 
  65     Execute Heatbridge    ${vf_module_name}    ${service_instance_id}    ${service}
 
  66     Validate VF Module      ${vf_module_name}    ${service}
 
  67     [Return]     ${vf_module_name}    ${service}
 
  70 Create Customer For VNF
 
  71     [Documentation]    VNF Orchestration Test setup....
 
  72     ...                Create Tenant if not exists, Create Customer, Create Service and related relationships
 
  73     [Arguments]    ${customer_name}    ${customer_id}    ${customer_type}    ${service_type}    ${cloud_owner}
 
  74     ${cloud_region_id}=   Get Openstack Region
 
  75     ${resp}=    Create Customer    ${customer_name}    ${customer_id}    ${customer_type}    ${service_type}   ${cloud_owner}  ${cloud_region_id}    ${TENANT_ID}
 
  76         Should Be Equal As Strings      ${resp}         201
 
  77     Create Service If Not Exists    ${service_type}
 
  80     [Documentation]    Called before each test case to ensure tenant and region data
 
  81     ...                required by the Orchstrate VNF exists in A&AI
 
  82     [Arguments]        ${cloud_owner}  ${cloud_type}    ${owner_defined_type}    ${cloud_region_version}    ${cloud_zone}
 
  83     Initialize Tenant From Openstack
 
  84     Initialize Regions From Openstack
 
  85     :FOR    ${region}    IN    @{REGIONS}
 
  86     \    Inventory Tenant If Not Exists    ${cloud_owner}  ${region}  ${cloud_type}    ${owner_defined_type}    ${cloud_region_version}    ${cloud_zone}    ${TENANT_ID}    ${TENANT_NAME}
 
  87     Log   Orchestrate VNF setup complete
 
  89 Initialize Tenant From Openstack
 
  90     [Documentation]    Initialize the tenant test variables
 
  91     Run Openstack Auth Request    auth
 
  92     ${tenants}=    Get Current Openstack Tenant     auth
 
  93     ${tenant_name}=    Evaluate    $tenants.get("name")
 
  94     ${tenant_id}=     Evaluate    $tenants.get("id")
 
  95     Set Test Variable   ${TENANT_NAME}   ${tenant_name}
 
  96     Set Test Variable   ${TENANT_ID}     ${tenant_id}
 
  98 Initialize Regions From Openstack
 
  99     [Documentation]    Initialize the regions test variable
 
 100     Run Openstack Auth Request    auth
 
 101     ${regs}=    Get Openstack Regions    auth
 
 102     Set Test Variable   ${REGIONS}     ${regs}
 
 105     [Documentation]    For the VolumeGroup test case, create a server to attach the volume group to be orchestrated.
 
 107     Run Openstack Auth Request    auth
 
 108     ${vvg_server_name}=    Catenate   vVG_${uuid}
 
 109     ${server}=   Add Server For Image Name  auth    ${vvg_server_name}   ${GLOBAL_VVGSERVER_IMAGE}   ${GLOBAL_VVGSERVER_FLAVOR}
 
 110     ${server}=       Get From Dictionary   ${server}   server
 
 111     ${server_id}=    Get From Dictionary   ${server}   id
 
 112     Set Test Variable    ${VVG_SERVER_ID}   ${server_id}
 
 113     ${vvg_params}=    Get VVG Preload Parameters
 
 114     Set To Dictionary   ${vvg_params}   nova_instance   ${server_id}
 
 115     Wait for Server to Be Active    auth    ${server_id}
 
 117 Get VVG Preload Parameters
 
 118     [Documentation]   Get preload parameters for the VVG test case so we can include
 
 119     ...               the nova_instance id of the attached server
 
 120     ${test_dict}=    Get From Dictionary    ${GLOBAL_PRELOAD_PARAMETERS}    Vnf-Orchestration
 
 121     ${vvg_params}   Get From Dictionary    ${test_dict}    vvg_preload.template
 
 122     [Return]    ${vvg_params}
 
 125     [Documentation]    Called at the end of a test case to tear down the VNF created by Orchestrate VNF
 
 126     ${lcp_region}=   Get Openstack Region
 
 128     Run Keyword If   '${TEST STATUS}' == 'PASS'   Teardown VLB Closed Loop Hack
 
 129     Run Keyword If   '${TEST STATUS}' == 'PASS'   Teardown VID   ${SERVICE_INSTANCE_ID}   ${lcp_region}   ${TENANT_ID}
 
 130     Run Keyword If   '${TEST STATUS}' == 'PASS'   Teardown Model Distribution
 
 131     Run Keyword If   '${TEST STATUS}' == 'PASS'   Clean A&AI Inventory
 
 133     Log    Teardown VNF implemented for successful tests only
 
 136     [Documentation]   Teardown the server created as a place to mount the Volume Group.
 
 137     Return From Keyword if   '${VVG_SERVER_ID}' == ''
 
 138     Delete Server   auth   ${VVG_SERVER_ID}
 
 139     Wait for Server To Be Deleted    auth    ${VVG_SERVER_ID}
 
 140     ${vvg_params}=    Get VVG Preload Parameters
 
 141     Remove from Dictionary   ${vvg_params}   nova_instance
 
 142     Log    Teardown VVG Server Completed
 
 145     [Documentation]    OBSOLETE - Called at the end of a test case to tear down the Stack created by Orchestrate VNF
 
 147     Run Openstack Auth Request    auth
 
 148     ${stack_info}=    Get Stack Details    auth    ${stack}
 
 150     ${stack_id}=    Get From Dictionary    ${stack_info}    id
 
 151     ${key_pair_status}   ${keypair_name}=   Run Keyword And Ignore Error   Get From Dictionary    ${stack_info}    key_name
 
 152     Delete Openstack Stack      auth    ${stack}    ${stack_id}
 
 153     Log    Deleted ${stack} ${stack_id}
 
 154     Run Keyword If   '${key_pair_status}' == 'PASS'   Delete Openstack Keypair    auth    ${keypair_name}
 
 155     Teardown VLB Closed Loop Hack
 
 158     [Documentation]    Clean up Tenant in A&AI, Create Customer, Create Service and related relationships
 
 159     Delete Customer    ${CUSTOMER_NAME}