move SO code to python for easier reuse 70/91970/1
authorDR695H <dr695h@att.com>
Wed, 24 Jul 2019 20:40:42 +0000 (16:40 -0400)
committerDR695H <dr695h@att.com>
Wed, 24 Jul 2019 20:40:42 +0000 (16:40 -0400)
Issue-ID: TEST-179
Change-Id: I23db38db7810fc298df66dbde023a6ec559d46e8
Signed-off-by: DR695H <dr695h@att.com>
robot/assets/templates/so/cloud_config_v3.jinja [deleted file]
robot/assets/templates/so/create_cloud_config.jinja
robot/resources/global_properties.robot
robot/resources/so_interface.robot [deleted file]
robot/testsuites/create-cloud-config.robot
robot/testsuites/demo.robot
robot/testsuites/health-check.robot

diff --git a/robot/assets/templates/so/cloud_config_v3.jinja b/robot/assets/templates/so/cloud_config_v3.jinja
deleted file mode 100644 (file)
index dfd3fbb..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-{
-  "id": "{{site_name}}",
-  "region_id": "{{region_id}}",
-  "aic_version": "2.5", 
-  "clli": "{{clli}}",   
-  "identityService": {
-       "identity_url": "{{identity_url}}",  
-       "mso_id": "{{mso_id}}", 
-    "mso_pass": "{{mso_pass}}",   
-    "admin_tenant": "{{admin_tenant}}", 
-    "member_role": "{{member_role}}", 
-    "tenant_meta_data": true,
-    "id": "{{identity_id}}", 
-    "identity_server_type": "{{identity_server_type}}",     
-    "identity_authentication_type": "{{authentication_type}}",
-    "project_domain_name": "{{project_domain_name}}",
-    "user_domain_name": "{{user_domain_name}}"
-  } 
-}
\ No newline at end of file
index 2e73dad..957141e 100644 (file)
     "id": "{{identity_id}}", 
     "identity_server_type": "{{identity_server_type}}",     
     "identity_authentication_type": "{{authentication_type}}"
+    {% if project_domain_name %}
+               ,"project_domain_name": "{{project_domain_name}}"
+       {% endif %}
+    {% if user_domain_name %}
+               ,"user_domain_name": "{{user_domain_name}}"
+       {% endif %}     
   } 
 }
\ No newline at end of file
index 1a4fa0c..7ccb09c 100644 (file)
@@ -44,4 +44,7 @@ ${GLOBAL_SO_OPENSTACK_ENDPOINT}     ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJ
 ${GLOBAL_SO_REQDB_ENDPOINT}     ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_REQDB_IP_ADDR}:${GLOBAL_MSO_REQDB_SERVER_PORT}
 ${GLOBAL_SO_SDNC_ENDPOINT}     ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_SDNC_IP_ADDR}:${GLOBAL_MSO_SDNC_SERVER_PORT}
 ${GLOBAL_SO_VFC_ENDPOINT}     ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_VFC_IP_ADDR}:${GLOBAL_MSO_VFC_SERVER_PORT}
-${GLOBAL_SO_VNFM_ENDPOINT}     ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_VNFM_IP_ADDR}:${GLOBAL_MSO_VNFM_SERVER_PORT}
\ No newline at end of file
+${GLOBAL_SO_VNFM_ENDPOINT}     ${GLOBAL_MSO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_VNFM_IP_ADDR}:${GLOBAL_MSO_VNFM_SERVER_PORT}
+${GLOBAL_SO_HEALTH_CHECK_PATH}    /manage/health
+${GLOBAL_SO_CLOUD_CONFIG_PATH}    /cloudSite
+${GLOBAL_SO_CLOUD_CONFIG_TEMPLATE}         robot/assets/templates/so/create_cloud_config.jinja
\ No newline at end of file
diff --git a/robot/resources/so_interface.robot b/robot/resources/so_interface.robot
deleted file mode 100644 (file)
index 7c0e647..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-*** Settings ***
-Documentation     The main interface for interacting with MSO. It handles low level stuff like managing the http request library and MSO required fields
-Library           ONAPLibrary.SO    WITH NAME    SO
-Library           ONAPLibrary.Templating    WITH NAME    Templating
-
-Resource          global_properties.robot
-*** Variables ***
-${SO_HEALTH_CHECK_PATH}    /manage/health
-${CLOUD_CONFIG_PATH}    /cloudSite
-${SO_ADD_CLOUD_CONFIG}=   robot/assets/templates/so/create_cloud_config.template
-${SO_ADD_CLOUD_CONFIG_V3}=   robot/assets/templates/so/cloud_config_v3.template
-
-*** Keywords ***
-Run SO Global Health Check
-    SO.Run Get Request    ${GLOBAL_SO_APIHAND_ENDPOINT}    ${SO_HEALTH_CHECK_PATH}
-    SO.Run Get Request    ${GLOBAL_SO_ASDCHAND_ENDPOINT}    ${SO_HEALTH_CHECK_PATH}
-    SO.Run Get Request    ${GLOBAL_SO_BPMN_ENDPOINT}    ${SO_HEALTH_CHECK_PATH}
-    SO.Run Get Request    ${GLOBAL_SO_CATDB_ENDPOINT}    ${SO_HEALTH_CHECK_PATH}
-    SO.Run Get Request    ${GLOBAL_SO_OPENSTACK_ENDPOINT}    ${SO_HEALTH_CHECK_PATH}
-    SO.Run Get Request    ${GLOBAL_SO_REQDB_ENDPOINT}    ${SO_HEALTH_CHECK_PATH}
-    SO.Run Get Request    ${GLOBAL_SO_SDNC_ENDPOINT}    ${SO_HEALTH_CHECK_PATH}
-    SO.Run Get Request    ${GLOBAL_SO_VFC_ENDPOINT}    ${SO_HEALTH_CHECK_PATH}
-    SO.Run Get Request    ${GLOBAL_SO_VNFM_ENDPOINT}    ${SO_HEALTH_CHECK_PATH}
-
-Get Cloud Configuration
-    [Documentation]    Gets cloud configuration in SO
-    [Arguments]    ${site_name}
-    ${auth}=  Create List  ${GLOBAL_MSO_CATDB_USERNAME}    ${GLOBAL_MSO_PASSWORD}
-    ${get_resp}=    SO.Run Get Request    ${GLOBAL_SO_CATDB_ENDPOINT}    ${CLOUD_CONFIG_PATH}/${site_name}   auth=${auth} 
-    Should Be Equal As Strings  ${get_resp.status_code}     200
-    
-Create Cloud Configuration
-    [Documentation]    Creates a cloud configuration in SO, so it knows how to talk to an openstack cloud
-    [Arguments]    ${site_name}    ${region_id}   ${clli}   ${identity_id}   ${identity_url}   ${mso_id}    ${mso_pass}    ${admin_tenant}    ${member_role}    ${identity_server_type}    ${authentication_type}    
-    ${arguments}=    Create Dictionary     site_name=${site_name}  region_id=${region_id}  clli=${clli}    identity_id=${identity_id}    identity_url=${identity_url}    mso_id=${mso_id}    mso_pass=${mso_pass}    admin_tenant=${admin_tenant}   member_role=${member_role}     identity_server_type=${identity_server_type}     authentication_type=${authentication_type}
-    Templating.Create Environment    so    ${GLOBAL_TEMPLATE_FOLDER}
-    ${data}=   Templating.Apply Template    so    ${SO_ADD_CLOUD_CONFIG}     ${arguments}
-    ${auth}=  Create List  ${GLOBAL_MSO_CATDB_USERNAME}    ${GLOBAL_MSO_PASSWORD}
-    ${get_resp}=   SO.Run Put Request   ${GLOBAL_SO_CATDB_ENDPOINT}    ${CLOUD_CONFIG_PATH}/${site_name}   ${data}    auth=${auth}     
-    ${get_resp}=    Run Keyword If    '${get_resp.status_code}'=='404'    Update Cloud Configuration    ${site_name}    ${region_id}   ${clli}   ${identity_id}   ${identity_url}   ${mso_id}    ${mso_pass}    ${admin_tenant}    ${member_role}    ${identity_server_type}    ${authentication_type}
-    Should Be Equal As Strings  ${get_resp.status_code}     200
-
-Create Cloud Configuration v3
-    [Documentation]    Creates a cloud configuration in SO, so it knows how to talk to an openstack cloud
-    [Arguments]    ${site_name}    ${region_id}   ${clli}   ${identity_id}   ${identity_url}   ${mso_id}    ${mso_pass}    ${admin_tenant}    ${member_role}    ${identity_server_type}    ${authentication_type}    ${project_domain_name}    ${user_domain_Name}
-    ${arguments}=    Create Dictionary     site_name=${site_name}  region_id=${region_id}  clli=${clli}    identity_id=${identity_id}    identity_url=${identity_url}    mso_id=${mso_id}    mso_pass=${mso_pass}    admin_tenant=${admin_tenant}   member_role=${member_role}     identity_server_type=${identity_server_type}     authentication_type=${authentication_type}    project_domain_name=${project_domain_name}    user_domain_name=${user_domain_name}
-    Log    ${arguments}
-    Templating.Create Environment    so    ${GLOBAL_TEMPLATE_FOLDER}
-    ${data}=   Templating.Apply Template    so    ${SO_ADD_CLOUD_CONFIG_V3}     ${arguments}
-    ${auth}=  Create List  ${GLOBAL_MSO_CATDB_USERNAME}    ${GLOBAL_MSO_PASSWORD}
-    ${get_resp}=   SO.Run Post Request   ${GLOBAL_SO_CATDB_ENDPOINT}    ${CLOUD_CONFIG_PATH}   ${data}    auth=${auth} 
-    ${status_string}=    Convert To String    ${get_resp.status_code}
-    Should Match Regexp    ${status_string}    ^(201|200)$
-
-Update Cloud Configuration
-    [Documentation]    Updates a cloud configuration in SO
-    [Arguments]    ${site_name}    ${region_id}   ${clli}   ${identity_id}   ${identity_url}   ${mso_id}    ${mso_pass}    ${admin_tenant}    ${member_role}    ${identity_server_type}    ${authentication_type}
-    ${arguments}=    Create Dictionary     site_name=${site_name}  region_id=${region_id}  clli=${clli}    identity_id=${identity_id}    identity_url=${identity_url}    mso_id=${mso_id}    mso_pass=${mso_pass}    admin_tenant=${admin_tenant}   member_role=${member_role}     identity_server_type=${identity_server_type}     authentication_type=${authentication_type}
-    Templating.Create Environment    so    ${GLOBAL_TEMPLATE_FOLDER}
-    ${data}=    Templating.Apply Template    so    ${SO_ADD_CLOUD_CONFIG}     ${arguments}
-    ${auth}=  Create List  ${GLOBAL_MSO_CATDB_USERNAME}    ${GLOBAL_MSO_PASSWORD}
-    ${get_resp}=   SO.Run Put Request   ${GLOBAL_SO_CATDB_ENDPOINT}    ${CLOUD_CONFIG_PATH}/${site_name}   ${data}    auth=${auth} 
-    Should Be Equal As Strings  ${get_resp.status_code}     200
-    [Return]   ${get_resp}
\ No newline at end of file
index 385f6ec..636609c 100644 (file)
@@ -2,8 +2,7 @@
 Documentation    SO Cloud Config Test Cases
 Test Timeout    1 minute
 
-
-Resource          ../resources/so_interface.robot
+Library           ONAPLibrary.SO    WITH NAME    SO
 Resource          ../resources/aai/create_tenant.robot
 
 
@@ -11,7 +10,9 @@ Resource          ../resources/aai/create_tenant.robot
 Create Cloud Config Test
     [TAGS]    mso    cloudconfig
     # Run Create Cloud Configuration    RegionOne   RegionOne   RegionOne    DEFAULT_KEYSTONE    identify_url:http://10.12.25.2:5000/v2.0    mso_id:demo  mso_pass:encrypted_password  admin_tenant:1e097c6713e74fd7ac8e4295e605ee1e    member_role:admin    identity_server_type:KEYSTONE    identity_authentication_type:USERNAME_PASSWORD
-    Create Cloud Configuration    ${GLOBAL_INJECTED_REGION}   ${GLOBAL_INJECTED_REGION}  ${GLOBAL_INJECTED_REGION}   DEFAULT_KEYSTONE    ${GLOBAL_INJECTED_KEYSTONE}/${GLOBAL_INJECTED_OPENSTACK_KEYSTONE_API_VERSION}    ${GLOBAL_INJECTED_OPENSTACK_USERNAME}   ${GLOBAL_INJECTED_OPENSTACK_API_KEY}    ${GLOBAL_INJECTED_OPENSTACK_TENANT_ID}     admin    KEYSTONE    USERNAME_PASSWORD 
+    ${arguments}=    Create Dictionary     site_name=${GLOBAL_INJECTED_REGION}  region_id=${GLOBAL_INJECTED_REGION}  clli=${GLOBAL_INJECTED_REGION}    identity_id=DEFAULT_KEYSTONE    identity_url=${GLOBAL_INJECTED_KEYSTONE}/${GLOBAL_INJECTED_OPENSTACK_KEYSTONE_API_VERSION}    mso_id=${GLOBAL_INJECTED_OPENSTACK_USERNAME}    mso_pass=${GLOBAL_INJECTED_OPENSTACK_API_KEY}    admin_tenant=${GLOBAL_INJECTED_OPENSTACK_TENANT_ID}   member_role=admin     identity_server_type=KEYSTONE_V3     authentication_type=USERNAME_PASSWORD   
+    ${auth}=  Create List  ${GLOBAL_MSO_CATDB_USERNAME}    ${GLOBAL_MSO_PASSWORD}
+    SO.Upsert Cloud Configuration    ${GLOBAL_SO_CATDB_ENDPOINT}    ${GLOBAL_SO_CLOUD_CONFIG_PATH}    ${GLOBAL_TEMPLATE_FOLDER}    ${GLOBAL_SO_CLOUD_CONFIG_TEMPLATE}    ${arguments}    auth=${auth}
 
 Create Cloud Config RegionThree V3 Test
     [TAGS]    mso    cloudconfig  cloudconfigv3
@@ -22,10 +23,14 @@ Create Cloud Config RegionThree V3 Test
     ...  In Windriver/Intel test labs the os_region_id's are all set to "RegionOne"
     ...  clli by testing team convention is same as onap site_name
     ...  KEYSTONE URL should end in /v3 SO will put /auth when KEYSTONE_V3 is the identity_server_type
-    Create Cloud Configuration v3    ${GLOBAL_INJECTED_REGION_THREE}   ${GLOBAL_INJECTED_REGION}  ${GLOBAL_INJECTED_REGION_THREE}   REGION_THREE_KEYSTONE    ${GLOBAL_INJECTED_KEYSTONE_REGION_THREE}/${GLOBAL_INJECTED_OPENSTACK_KEYSTONE_API_VERSION_REGION_THREE}     ${GLOBAL_INJECTED_OPENSTACK_USERNAME_REGION_THREE}   ${GLOBAL_INJECTED_OPENSTACK_MSO_ENCRYPTED_PASSWORD_REGION_THREE}    ${GLOBAL_INJECTED_OPENSTACK_TENANT_ID_REGION_THREE}     admin    KEYSTONE_V3    USERNAME_PASSWORD  ${GLOBAL_INJECTED_OPENSTACK_PROJECT_DOMAIN_REGION_THREE}  ${GLOBAL_INJECTED_OPENSTACK_USER_DOMAIN_REGION_THREE}
+    ${arguments}=    Create Dictionary     site_name=${GLOBAL_INJECTED_REGION_THREE}  region_id=${GLOBAL_INJECTED_REGION}  clli=${GLOBAL_INJECTED_REGION_THREE}    identity_id=REGION_THREE_KEYSTONE    identity_url=${GLOBAL_INJECTED_KEYSTONE_REGION_THREE}/${GLOBAL_INJECTED_OPENSTACK_KEYSTONE_API_VERSION_REGION_THREE}    mso_id=${GLOBAL_INJECTED_OPENSTACK_USERNAME_REGION_THREE}    mso_pass=${GLOBAL_INJECTED_OPENSTACK_MSO_ENCRYPTED_PASSWORD_REGION_THREE}    admin_tenant=${GLOBAL_INJECTED_OPENSTACK_TENANT_ID_REGION_THREE}   member_role=admin     identity_server_type=KEYSTONE_V3     authentication_type=USERNAME_PASSWORD    project_domain_name=${GLOBAL_INJECTED_OPENSTACK_PROJECT_DOMAIN_REGION_THREE}    user_domain_name=${GLOBAL_INJECTED_OPENSTACK_USER_DOMAIN_REGION_THREE}     
+    ${auth}=  Create List  ${GLOBAL_MSO_CATDB_USERNAME}    ${GLOBAL_MSO_PASSWORD}
+    SO.Upsert Cloud Configuration    ${GLOBAL_SO_CATDB_ENDPOINT}    ${GLOBAL_SO_CLOUD_CONFIG_PATH}    ${GLOBAL_TEMPLATE_FOLDER}    ${GLOBAL_SO_CLOUD_CONFIG_TEMPLATE}    ${arguments}    auth=${auth}
     Inventory Tenant If Not Exists    CloudOwner   ${GLOBAL_INJECTED_REGION_THREE}  SharedNode  OwnerType  v1  CloudZone  ${GLOBAL_INJECTED_OPENSTACK_TENANT_ID_REGION_THREE}  ${GLOBAL_INJECTED_OPENSTACK_PROJECT_DOMAIN_REGION_THREE}
 
 
 Get Cloud Config Test
     [TAGS]    mso    cloudconfig
-    Get Cloud Configuration    ${GLOBAL_INJECTED_REGION}   
+    ${auth}=  Create List  ${GLOBAL_MSO_CATDB_USERNAME}    ${GLOBAL_MSO_PASSWORD}
+    ${get_resp}=    SO.Get Cloud Configuration    ${GLOBAL_SO_CATDB_ENDPOINT}    ${GLOBAL_SO_CLOUD_CONFIG_PATH}        ${GLOBAL_INJECTED_REGION}   auth=${auth} 
+    Should Be Equal As Strings  ${get_resp.status_code}     200
\ No newline at end of file
index 3297621..75a9f16 100644 (file)
@@ -1,10 +1,10 @@
 *** Settings ***
 Documentation    Executes the VNF Orchestration Test cases including setup and teardown
-...
+
+Library           ONAPLibrary.SO    WITH NAME    SO
 Library   Collections
 Resource         ../resources/demo_preload.robot
 Resource         ../resources/asdc_interface.robot
-Resource         ../resources/so_interface.robot
 
 *** Variables ***
 
@@ -31,7 +31,9 @@ Initialize Customer And Models
 
 Initialize SO Openstack Identity For V3
     [Tags]   InitDemo
-    Run Keyword If    '${GLOBAL_INJECTED_OPENSTACK_KEYSTONE_API_VERSION}'=='v3'     Create Cloud Configuration v3    ${GLOBAL_INJECTED_REGION}   ${GLOBAL_INJECTED_REGION}  ${GLOBAL_INJECTED_REGION}   DEFAULT_KEYSTONE  ${GLOBAL_INJECTED_KEYSTONE}/${GLOBAL_INJECTED_OPENSTACK_KEYSTONE_API_VERSION}     ${GLOBAL_INJECTED_OPENSTACK_USERNAME}   ${GLOBAL_INJECTED_OPENSTACK_SO_ENCRYPTED_PASSWORD}    ${GLOBAL_INJECTED_OPENSTACK_TENANT_ID}     admin    KEYSTONE_V3    USERNAME_PASSWORD  ${GLOBAL_INJECTED_OPENSTACK_DOMAIN_ID}  ${GLOBAL_INJECTED_OPENSTACK_USER_DOMAIN}
+    ${arguments}=    Create Dictionary     site_name=${GLOBAL_INJECTED_REGION}  region_id=${GLOBAL_INJECTED_REGION}  clli=${GLOBAL_INJECTED_REGION}    identity_id=DEFAULT_KEYSTONE    identity_url=${GLOBAL_INJECTED_KEYSTONE}/${GLOBAL_INJECTED_OPENSTACK_KEYSTONE_API_VERSION}    mso_id=${GLOBAL_INJECTED_OPENSTACK_USERNAME}    mso_pass=${GLOBAL_INJECTED_OPENSTACK_SO_ENCRYPTED_PASSWORD}    admin_tenant=${GLOBAL_INJECTED_OPENSTACK_TENANT_ID}   member_role=admin     identity_server_type=KEYSTONE_V3     authentication_type=USERNAME_PASSWORD    project_domain_name=${GLOBAL_INJECTED_OPENSTACK_DOMAIN_ID}    user_domain_name=${GLOBAL_INJECTED_OPENSTACK_USER_DOMAIN}   
+    ${auth}=  Create List  ${GLOBAL_MSO_CATDB_USERNAME}    ${GLOBAL_MSO_PASSWORD}
+    Run Keyword If    '${GLOBAL_INJECTED_OPENSTACK_KEYSTONE_API_VERSION}'=='v3'     SO.Upsert Cloud Configuration    ${GLOBAL_SO_CATDB_ENDPOINT}    ${GLOBAL_SO_CLOUD_CONFIG_PATH}    ${GLOBAL_TEMPLATE_FOLDER}    ${GLOBAL_SO_CLOUD_CONFIG_TEMPLATE}    ${arguments}    auth=${auth}
 
 Initialize Customer
     [Tags]   InitCustomer
index b7c1735..2202d30 100644 (file)
@@ -8,7 +8,7 @@ Resource          ../resources/sdngc_interface.robot
 Resource          ../resources/aai/aai_interface.robot
 Resource          ../resources/vid/vid_interface.robot
 Resource          ../resources/policy_interface.robot
-Resource          ../resources/so_interface.robot
+Library           ONAPLibrary.SO    WITH NAME    SO
 Resource          ../resources/asdc_interface.robot
 Resource          ../resources/appc_interface.robot
 Resource          ../resources/portal_interface.robot
@@ -198,8 +198,15 @@ Basic SDNC Health Check
 
 Basic SO Health Check
     [Tags]    health    core   health-so
-    Run SO Global Health Check
-
+    SO.Run Get Request    ${GLOBAL_SO_APIHAND_ENDPOINT}    ${GLOBAL_SO_HEALTH_CHECK_PATH}
+    SO.Run Get Request    ${GLOBAL_SO_ASDCHAND_ENDPOINT}    ${GLOBAL_SO_HEALTH_CHECK_PATH}
+    SO.Run Get Request    ${GLOBAL_SO_BPMN_ENDPOINT}    ${GLOBAL_SO_HEALTH_CHECK_PATH}
+    SO.Run Get Request    ${GLOBAL_SO_CATDB_ENDPOINT}    ${GLOBAL_SO_HEALTH_CHECK_PATH}
+    SO.Run Get Request    ${GLOBAL_SO_OPENSTACK_ENDPOINT}    ${GLOBAL_SO_HEALTH_CHECK_PATH}
+    SO.Run Get Request    ${GLOBAL_SO_REQDB_ENDPOINT}    ${GLOBAL_SO_HEALTH_CHECK_PATH}
+    SO.Run Get Request    ${GLOBAL_SO_SDNC_ENDPOINT}    ${GLOBAL_SO_HEALTH_CHECK_PATH}
+    SO.Run Get Request    ${GLOBAL_SO_VFC_ENDPOINT}    ${GLOBAL_SO_HEALTH_CHECK_PATH}
+    SO.Run Get Request    ${GLOBAL_SO_VNFM_ENDPOINT}    ${GLOBAL_SO_HEALTH_CHECK_PATH}
 Basic UseCaseUI API Health Check
     [Tags]    health    api    medium   health-uui
     Run MSB Get Request    /iui/usecaseui/