TEST-4 Re-factor openstack region variable

Change-Id: Iad9ef0555dbbd921e261bfa2a63806100bcf7c83
Signed-off-by: jf9860 <jf9860@att.com>
diff --git a/robot/resources/test_templates/closedloop_test_template.robot b/robot/resources/test_templates/closedloop_test_template.robot
index e3f7327..e5a5ca9 100644
--- a/robot/resources/test_templates/closedloop_test_template.robot
+++ b/robot/resources/test_templates/closedloop_test_template.robot
@@ -25,9 +25,9 @@
 # Max nslookup requests per second before triggering event.
 ${VLBPOLICYRATE}    20
 
-${CONFIG_POLICY_NAME}    vFirewall    
-${CONFIG_POLICY_TYPE}    Unknown    
-${OPS_POLICY_NAME}    
+${CONFIG_POLICY_NAME}    vFirewall
+${CONFIG_POLICY_TYPE}    Unknown
+${OPS_POLICY_NAME}
 ${OPS_POLICY_TYPE}    BRMS_PARAM
 
 # VFW low threshold
@@ -45,32 +45,33 @@
 ${Expected_Threshold_3}    200
 ${Expected_Direction_3}    GREATER_OR_EQUAL
 
-${DNSSCALINGSTACK}    
+#********** Test Case Variables ************
+${DNSSCALINGSTACK}
 
 *** Keywords ***
 VFW Policy
     Log    Suite name ${SUITE NAME} ${TEST NAME} ${PREV TEST NAME}
     Initialize VFW Policy
-    ${stackname}=   Orchestrate VNF vFW closedloop 
+    ${stackname}=   Orchestrate VNF vFW closedloop
     Policy Check Firewall Stack    ${stackname}    ${VFWPOLICYRATE}
-    
+
 
 VDNS Policy
     Initialize VDNS Policy
     ${stackname}=   Orchestrate VNF vDNS closedloop
     ${dnsscaling}=   Policy Check vLB Stack    ${stackname}    ${VLBPOLICYRATE}
     Set Test Variable   ${DNSSCALINGSTACK}   ${dnsscaling}
-      
+
 Initialize VFW Policy
 #    Create Config Policy
 #    Push Config Policy    ${CONFIG_POLICY_NAME}    ${CONFIG_POLICY_TYPE}
 #    Create Ops Policy
-#    Push Ops Policy    ${OPS_POLICY_NAME}    ${OPS_POLICY_TYPE} 
+#    Push Ops Policy    ${OPS_POLICY_NAME}    ${OPS_POLICY_TYPE}
      Get Configs VFW Policy
-     
+
 Initialize VDNS Policy
     Get Configs VDNS Policy
-      
+
 Get Configs VFW Policy
     [Documentation]    Get Config Policy for VFW
     ${getconfigpolicy}=    Catenate    .*${CONFIG_POLICY_NAME}*
@@ -78,26 +79,26 @@
     ${output} =     Fill JSON Template File     ${GECONFIG_VFW_TEMPLATE}    ${configpolicy_name}
     ${get_resp} =    Run Policy Get Configs Request    ${RESOURCE_PATH_GET_CONFIG}   ${output}
 	Should Be Equal As Strings 	${get_resp.status_code} 	200
-	
+
 	${json}=    Parse Json    ${get_resp.content}
     ${config}=    Parse Json    ${json[0]["config"]}
-       
-    # Extract object1 from Array  
+
+    # Extract object1 from Array
     ${severity}=    Get Variable Value      ${config["content"]["thresholds"][0]["severity"]}
-    Should Be Equal    ${severity}    ${Expected_Severity_1}  
+    Should Be Equal    ${severity}    ${Expected_Severity_1}
     ${Thresold_Value}=    Get Variable Value      ${config["content"]["thresholds"][0]["thresholdValue"]}
-    Should Be Equal   ${Thresold_Value}    ${Expected_Threshold_1} 
+    Should Be Equal   ${Thresold_Value}    ${Expected_Threshold_1}
     ${direction}=    Get Variable Value      ${config["content"]["thresholds"][0]["direction"]}
-    Should Be Equal   ${direction}    ${Expected_Direction_1} 
-    
+    Should Be Equal   ${direction}    ${Expected_Direction_1}
+
     # Extract object2 from Array
     ${severity_1}=    Get Variable Value      ${config["content"]["thresholds"][1]["severity"]}
-    Should Be Equal    ${severity_1}    ${Expected_Severity_2}  
+    Should Be Equal    ${severity_1}    ${Expected_Severity_2}
     ${Thresold_Value_1}=    Get Variable Value      ${config["content"]["thresholds"][1]["thresholdValue"]}
-    Should Be Equal   ${Thresold_Value_1}    ${Expected_Threshold_2} 
+    Should Be Equal   ${Thresold_Value_1}    ${Expected_Threshold_2}
     ${direction_1}=    Get Variable Value      ${config["content"]["thresholds"][1]["direction"]}
-    Should Be Equal   ${direction_1}    ${Expected_Direction_2}   
-    
+    Should Be Equal   ${direction_1}    ${Expected_Direction_2}
+
 Get Configs VDNS Policy
     [Documentation]    Get Config Policy for VDNS
     ${getconfigpolicy}=    Catenate    .*vLoadBalancer*
@@ -107,26 +108,26 @@
 	Should Be Equal As Strings 	${get_resp.status_code} 	200
     ${json}=    Parse Json    ${get_resp.content}
     ${config}=    Parse Json    ${json[0]["config"]}
-       
-    # Extract object1 from Array  
+
+    # Extract object1 from Array
     ${severity}=    Get Variable Value      ${config["content"]["thresholds"][0]["severity"]}
-    Should Be Equal    ${severity}    ${Expected_Severity_3}  
+    Should Be Equal    ${severity}    ${Expected_Severity_3}
     ${Thresold_Value}=    Get Variable Value      ${config["content"]["thresholds"][0]["thresholdValue"]}
-    Should Be Equal   ${Thresold_Value}    ${Expected_Threshold_3} 
+    Should Be Equal   ${Thresold_Value}    ${Expected_Threshold_3}
     ${direction}=    Get Variable Value      ${config["content"]["thresholds"][0]["direction"]}
-    Should Be Equal   ${direction}    ${Expected_Direction_3} 
+    Should Be Equal   ${direction}    ${Expected_Direction_3}
 
 Teardown Closed Loop
     [Documentation]   Tear down a closed loop test case
-    Terminate All Processes 
-    Teardown VNF   
-    Log     Teardown complete  
+    Terminate All Processes
+    Teardown VNF
+    Log     Teardown complete
 
 Create Config Policy
-    [Documentation]    Create Config Policy 
-    ${randompolicyname} =     Create Policy Name  
+    [Documentation]    Create Config Policy
+    ${randompolicyname} =     Create Policy Name
     ${policyname1}=    Catenate   com.${randompolicyname}
-    ${CONFIG_POLICY_NAME}=    Set Test Variable    ${policyname1}            
+    ${CONFIG_POLICY_NAME}=    Set Test Variable    ${policyname1}
     ${configpolicy}=    Create Dictionary    policy_name=${CONFIG_POLICY_NAME}
     ${output} =     Fill JSON Template File     ${CREATE_CONFIG_TEMPLATE}    ${configpolicy}
     ${put_resp} =    Run Policy Put Request    ${RESOURCE_PATH_CREATE}  ${output}
@@ -134,27 +135,27 @@
 
  Create Policy Name
      [Documentation]    Generate Policy Name
-     [Arguments]    ${prefix}=ETE_ 
+     [Arguments]    ${prefix}=ETE_
      ${random}=    Generate Random String    15    [LOWER][NUMBERS]
      ${policyname}=    Catenate    ${prefix}${random}
      [Return]    ${policyname}
-     
+
 Create Ops Policy
-	[Documentation]    Create Opertional Policy 
-   	${randompolicyname} =     Create Policy Name  
+	[Documentation]    Create Opertional Policy
+   	${randompolicyname} =     Create Policy Name
 	${policyname1}=    Catenate   com.${randompolicyname}
-	${OPS_POLICY_NAME}=    Set Test Variable    ${policyname1}            
+	${OPS_POLICY_NAME}=    Set Test Variable    ${policyname1}
  	${dict}=     Create Dictionary    policy_name=${OPS_POLICY_NAME}
  	#${NEWPOLICY1}=     Create Dictionary    policy_name=com.${OPS_POLICY_NAME}
 	${output} =     Fill JSON Template File     ${CREATE_OPS_TEMPLATE}    ${dict}
     ${put_resp} =    Run Policy Put Request    ${RESOURCE_PATH_CREATE}  ${output}
     Log    ${put_resp}
     Should Be Equal As Strings 	${put_resp.status_code} 	200
-	    
+
 Push Ops Policy
     [Documentation]    Push Ops Policy
     [Arguments]    ${policyname}    ${policytype}
-    ${dict}=     Create Dictionary     policy_name=${policyname}    policy_type=${policytype} 
+    ${dict}=     Create Dictionary     policy_name=${policyname}    policy_type=${policytype}
 	${output} =     Fill JSON Template     ${PUSH_POLICY_TEMPLATE}     ${dict}
     ${put_resp} =    Run Policy Put Request    ${RESOURCE_PATH_CREATE_PUSH}  ${output}
     Should Be Equal As Strings 	${put_resp.status_code} 	200
@@ -162,40 +163,40 @@
 Push Config Policy
     [Documentation]    Push Config Policy
     [Arguments]    ${policyname}    ${policytype}
-    ${dict}=     Create Dictionary     policy_name=${policyname}    policy_type=${policytype} 
+    ${dict}=     Create Dictionary     policy_name=${policyname}    policy_type=${policytype}
 	${output} =     Fill JSON Template     ${PUSH_POLICY_TEMPLATE}     ${dict}
     ${put_resp} =    Run Policy Put Request    ${RESOURCE_PATH_CREATE_PUSH}  ${output}
     Should Be Equal As Strings 	${put_resp.status_code} 	200
- 
-	    
+
+
 Delete Config Policy
     [Documentation]    Delete Config Policy
     [Arguments]    ${policy_name}
     ${policyname3}=    Catenate   com.Config_BRMS_Param_${policyname}.1.xml
-    ${dict}=     Create Dictionary     policy_name=${policyname3} 
+    ${dict}=     Create Dictionary     policy_name=${policyname3}
 	${output} =     Fill JSON Template     ${DEL_POLICY_TEMPLATE}     ${dict}
     ${put_resp} =    Run Policy Delete Request    ${RESOURCE_PATH_CREATE_DELETE}  ${output}
-    Should Be Equal As Strings 	${put_resp.status_code} 	200	    
-	    
+    Should Be Equal As Strings 	${put_resp.status_code} 	200
+
 Delete Ops Policy
     [Documentation]    Delete Ops Policy
     [Arguments]    ${policy_name}
     ${policyname3}=    Catenate   com.Config_MS_com.vFirewall.1.xml
-    ${dict}=     Create Dictionary     policy_name=${policyname3} 
+    ${dict}=     Create Dictionary     policy_name=${policyname3}
 	${output} =     Fill JSON Template     ${DEL_POLICY_TEMPLATE}     ${dict}
     ${put_resp} =    Run Policy Delete Request    ${RESOURCE_PATH_CREATE_DELETE}  ${output}
-    Should Be Equal As Strings 	${put_resp.status_code} 	200	
-	    
+    Should Be Equal As Strings 	${put_resp.status_code} 	200
+
 Orchestrate VNF vFW closedloop
 	[Documentation]    VNF Orchestration for vFW
-	Log    VNF Orchestration flow TEST NAME=${TEST NAME} 
-	Setup Orchestrate VNF    ${GLOBAL_AAI_CLOUD_OWNER}    ${GLOBAL_OPENSTACK_SERVICE_REGION}    SharedNode    OwnerType    v1    CloudZone    
-	${stack_name}    ${service}=  Orchestrate VNF   ETE_CLP    vFW      vFW             ${GLOBAL_OPENSTACK_SERVICE_REGION}    ${TENANT_NAME}    
-	[Return]  ${stack_name}  
-      
+	Log    VNF Orchestration flow TEST NAME=${TEST NAME}
+	Setup Orchestrate VNF    ${GLOBAL_AAI_CLOUD_OWNER}    SharedNode    OwnerType    v1    CloudZone
+	${stack_name}    ${service}=  Orchestrate VNF   ETE_CLP    vFW      vFW   ${TENANT_NAME}
+	[Return]  ${stack_name}
+
  Orchestrate VNF vDNS closedloop
 	[Documentation]    VNF Orchestration for vLB
-	Log    VNF Orchestration flow TEST NAME=${TEST NAME} 
-	Setup Orchestrate VNF    ${GLOBAL_AAI_CLOUD_OWNER}    ${GLOBAL_OPENSTACK_SERVICE_REGION}    SharedNode    OwnerType    v1    CloudZone    
-	${stack_name}    ${service}=  Orchestrate VNF   ETE_CLP    vLB      vLB             ${GLOBAL_OPENSTACK_SERVICE_REGION}    ${TENANT_NAME}    
-	[Return]  ${stack_name}  
+	Log    VNF Orchestration flow TEST NAME=${TEST NAME}
+	Setup Orchestrate VNF    ${GLOBAL_AAI_CLOUD_OWNER}   SharedNode    OwnerType    v1    CloudZone
+	${stack_name}    ${service}=  Orchestrate VNF   ETE_CLP    vLB      vLB   ${TENANT_NAME}
+	[Return]  ${stack_name}
diff --git a/robot/resources/test_templates/model_test_template.robot b/robot/resources/test_templates/model_test_template.robot
index e97984d..add942d 100644
--- a/robot/resources/test_templates/model_test_template.robot
+++ b/robot/resources/test_templates/model_test_template.robot
@@ -2,7 +2,7 @@
 Documentation     The main interface for interacting with ASDC. It handles low level stuff like managing the http request library and DCAE required fields
 Library           OperatingSystem
 Library            ArchiveLibrary
-Library           Collections   
+Library           Collections
 Resource          ../asdc_interface.robot
 
 Variables       ../../assets/service_mappings.py
@@ -17,8 +17,9 @@
 ${SCALING_DIRECTORY}    dns_scaling
 ${ASDC_ZIP_DIRECTORY}    ${ASDC_ASSETS_DIRECTORY}/temp
 
-${CATALOG_RESOURCE_IDS}    
-${CATALOG_SERVICE_ID}   
+#***************** Test Case Variables *********************
+${CATALOG_RESOURCE_IDS}
+${CATALOG_SERVICE_ID}
 
 *** Keywords ***
 
@@ -28,30 +29,29 @@
     ${ziplist}=    Create List
     :for   ${directory}    in    @{directory_list}
     \    ${zip}=    Catenate    ${ASDC_ZIP_DIRECTORY}/${directory}.zip
-    \    ${folder}=    Catenate    ${ASDC_ASSETS_DIRECTORY}/${directory}         
+    \    ${folder}=    Catenate    ${ASDC_ASSETS_DIRECTORY}/${directory}
     \    OperatingSystem.Create Directory    ${ASDC_ASSETS_DIRECTORY}/temp
     \    Create Zip From Files In Directory        ${folder}    ${zip}
-    \    Append To List    ${ziplist}    ${zip}    
+    \    Append To List    ${ziplist}    ${zip}
     ${catalog_service_name}    ${catalog_resource_name}    ${vf_modules}    ${catalog_resource_ids}   ${catalog_service_id}   Distribute Model From ASDC    ${ziplist}    ${catalog_service_name}
     Set Test Variable   ${CATALOG_RESOURCE_IDS}   ${catalog_resource_ids}
     Set Test Variable   ${CATALOG_SERVICE_ID}   ${catalog_service_id}
-    [Return]    ${catalog_service_name}    ${catalog_resource_name}    ${vf_modules}        
-             
+    [Return]    ${catalog_service_name}    ${catalog_resource_name}    ${vf_modules}
+
 
 
 
 Teardown Model Distribution
     [Documentation]    Clean up at the end of the test
-    Log   ${CATALOG_SERVICE_ID} ${CATALOG_RESOURCE_IDS}  
-    Teardown Models    ${CATALOG_SERVICE_ID}   ${CATALOG_RESOURCE_IDS}    
-        
+    Log   ${CATALOG_SERVICE_ID} ${CATALOG_RESOURCE_IDS}
+    Teardown Models    ${CATALOG_SERVICE_ID}   ${CATALOG_RESOURCE_IDS}
+
 Teardown Models
     [Documentation]    Clean up at the end of the test
     [Arguments]     ${catalog_service_id}    ${catalog_resource_ids}
     Return From Keyword If    '${catalog_service_id}' == ''
     :for    ${catalog_resource_id}   in   @{catalog_resource_ids}
-    \   ${resourece_json}=   Mark ASDC Catalog Resource Inactive    ${catalog_resource_id}    
+    \   ${resourece_json}=   Mark ASDC Catalog Resource Inactive    ${catalog_resource_id}
     ${service_json}=   Mark ASDC Catalog Service Inactive    ${catalog_service_id}
     ${services_json}=   Delete Inactive ASDC Catalog Services
     ${resources_json}=    Delete Inactive ASDC Catalog Resources
-                     
\ No newline at end of file
diff --git a/robot/resources/test_templates/vnf_orchestration_test_template.robot b/robot/resources/test_templates/vnf_orchestration_test_template.robot
index 8c64895..9de590b 100644
--- a/robot/resources/test_templates/vnf_orchestration_test_template.robot
+++ b/robot/resources/test_templates/vnf_orchestration_test_template.robot
@@ -25,6 +25,7 @@
 
 *** Variables ***
 
+#**************** TEST CASE VARIABLES **************************
 ${TENANT_NAME}
 ${TENANT_ID}
 ${REGIONS}
@@ -38,7 +39,8 @@
 
 Orchestrate VNF
     [Documentation]   Use openECOMP to Orchestrate a service.
-    [Arguments]    ${customer_name}    ${service}    ${product_family}    ${lcp_region}    ${tenant}
+    [Arguments]    ${customer_name}    ${service}    ${product_family}    ${tenant}
+    ${lcp_region}=   Get Openstack Region
     ${uuid}=    Generate UUID
     Set Test Variable    ${CUSTOMER_NAME}    ${customer_name}_${uuid}
     Set Test Variable    ${SERVICE}    ${service}
@@ -48,7 +50,7 @@
     ${vf_module_name}=    Catenate    Vfmodule_Ete_Name${uuid}
     ${service_model_type}     ${vnf_type}    ${vf_modules} =    Model Distribution For Directory    ${service}
     Run Keyword If   '${service}' == 'vVG'    Create VVG Server    ${uuid}
-    Create Customer For VNF    ${CUSTOMER_NAME}    ${CUSTOMER_NAME}    INFRA    ${service_type}    ${GLOBAL_AAI_CLOUD_OWNER}    ${GLOBAL_OPENSTACK_SERVICE_REGION}
+    Create Customer For VNF    ${CUSTOMER_NAME}    ${CUSTOMER_NAME}    INFRA    ${service_type}    ${GLOBAL_AAI_CLOUD_OWNER}
     Setup Browser
     Login To VID GUI
     ${service_instance_id}=    Create VID Service Instance    ${customer_name}    ${service_model_type}    ${service}     ${service_name}
@@ -68,7 +70,8 @@
 Create Customer For VNF
     [Documentation]    VNF Orchestration Test setup....
     ...                Create Tenant if not exists, Create Customer, Create Service and related relationships
-    [Arguments]    ${customer_name}    ${customer_id}    ${customer_type}    ${service_type}    ${cloud_owner}  ${cloud_region_id}
+    [Arguments]    ${customer_name}    ${customer_id}    ${customer_type}    ${service_type}    ${cloud_owner}
+    ${cloud_region_id}=   Get Openstack Region
     ${resp}=    Create Customer    ${customer_name}    ${customer_id}    ${customer_type}    ${service_type}   ${cloud_owner}  ${cloud_region_id}    ${TENANT_ID}
 	Should Be Equal As Strings 	${resp} 	201
     Create Service If Not Exists    ${service_type}
@@ -76,7 +79,7 @@
 Setup Orchestrate VNF
     [Documentation]    Called before each test case to ensure tenant and region data
     ...                required by the Orchstrate VNF exists in A&AI
-    [Arguments]        ${cloud_owner}  ${cloud_region_id}   ${cloud_type}    ${owner_defined_type}    ${cloud_region_version}    ${cloud_zone}
+    [Arguments]        ${cloud_owner}  ${cloud_type}    ${owner_defined_type}    ${cloud_region_version}    ${cloud_zone}
     Initialize Tenant From Openstack
     Initialize Regions From Openstack
     :FOR    ${region}    IN    @{REGIONS}
@@ -120,9 +123,10 @@
 
 Teardown VNF
     [Documentation]    Called at the end of a test case to tear down the VNF created by Orchestrate VNF
+    ${lcp_region}=   Get Openstack Region
     Teardown VVG Server
     Run Keyword If   '${TEST STATUS}' == 'PASS'   Teardown VLB Closed Loop Hack
-    Run Keyword If   '${TEST STATUS}' == 'PASS'   Teardown VID   ${SERVICE_INSTANCE_ID}   ${GLOBAL_OPENSTACK_SERVICE_REGION}   ${TENANT_ID}
+    Run Keyword If   '${TEST STATUS}' == 'PASS'   Teardown VID   ${SERVICE_INSTANCE_ID}   ${lcp_region}   ${TENANT_ID}
     Run Keyword If   '${TEST STATUS}' == 'PASS'   Teardown Model Distribution
     Run Keyword If   '${TEST STATUS}' == 'PASS'   Clean A&AI Inventory
     Close All Browsers