Updates for cloud_config, SDC health, VID timing 69/71169/1
authorBrian Freeman <bf1936@att.com>
Wed, 24 Oct 2018 17:25:22 +0000 (12:25 -0500)
committerBrian Freeman <bf1936@att.com>
Wed, 24 Oct 2018 17:28:33 +0000 (12:28 -0500)
Based on contribution from Steve Smokowski

Issue-ID: INT-621
Change-Id: I82828397bc0b9701fb0fa90123ac4cdd3b8d327d
Signed-off-by: Brian Freeman <bf1936@att.com>
robot/assets/templates/so/create_cloud_config.template [new file with mode: 0644]
robot/resources/asdc_interface.robot
robot/resources/so/create_cloud_config.robot [new file with mode: 0644]
robot/resources/so_interface.robot
robot/resources/vid/create_vid_vnf.robot
robot/testsuites/create-cloud-config.robot [new file with mode: 0644]

diff --git a/robot/assets/templates/so/create_cloud_config.template b/robot/assets/templates/so/create_cloud_config.template
new file mode 100644 (file)
index 0000000..969a8b0
--- /dev/null
@@ -0,0 +1,17 @@
+{
+  "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}"
+  } 
+}
index 8a5aa3f..c49f942 100644 (file)
@@ -80,11 +80,13 @@ Distribute Model From ASDC
 
 Loop Over Check Catalog Service Distributed
     [Arguments]    ${catalog_service_id}
-    # SO watchdog timeout is 300 seconds
-    : FOR     ${CHECK_INDEX}  IN RANGE   15
-    \   ${status}   ${_} =   Run Keyword And Ignore Error     Check Catalog Service Distributed    ${catalog_service_id}
+    # SO watchdog timeout is 300 seconds need buffer
+    ${dist_status}=   Set Variable    FAIL
+    : FOR     ${CHECK_INDEX}  IN RANGE   20
+    \   ${status}   ${_} =   Run Keyword And Ignore Error     Check Catalog Service Distributed    ${catalog_service_id}    ${dist_status}
     \   Sleep     20s
     \   Return From Keyword If   '${status}'=='PASS'
+    \   Exit For Loop If   '${dist_status}'=='EXIT'
     Should Be Equal As Strings  ${status}   PASS 
 
 Setup ASDC Catalog Resource
@@ -398,7 +400,7 @@ Get Catalog Service Distribution
     [Return]    ${resp.json()}
 Check Catalog Service Distributed
     [Documentation]    gets an asdc catalog Service distrbution
-    [Arguments]    ${catalog_service_uuid}
+    [Arguments]    ${catalog_service_uuid}    ${dist_status}
     ${dist_resp}=    Get Catalog Service Distribution    ${catalog_service_uuid}
     Should Be Equal As Strings         ${dist_resp['distributionStatusOfServiceList'][0]['deployementStatus']}         Distributed
     ${det_resp}=    Get Catalog Service Distribution Details    ${dist_resp['distributionStatusOfServiceList'][0]['distributionID']}
@@ -411,6 +413,8 @@ Check Catalog Service Distributed
     \    ${SO_COMPLETE}   Set Variable If   (('${ELEMENT['status']}' == 'DISTRIBUTION_COMPLETE_OK')) or ('${SO_COMPLETE}'=='TRUE')  TRUE
     \    Exit For Loop If   ('${SO_COMPLETE}'=='TRUE')
     \    Exit For Loop If   ('${ELEMENT['status']}' == 'DISTRIBUTION_COMPLETE_ERROR')
+    \    ${dist_status}=  Set Variable If   (('${ELEMENT['status']}' == 'COMPONENT_DONE_ERROR') and ('${ELEMENT['omfComponentID']}' == 'aai-ml'))  EXIT
+    \    Exit For Loop If   (('${ELEMENT['status']}' == 'COMPONENT_DONE_ERROR') and ('${ELEMENT['omfComponentID']}' == 'aai-ml'))
     Should Be True   ( '${SO_COMPLETE}'=='TRUE')   SO Test
 Get Catalog Service Distribution Details
     [Documentation]    gets an asdc catalog Service distrbution details
@@ -424,13 +428,14 @@ Run ASDC Health Check
     ${uuid}=    Generate UUID
     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
     ${resp}=   Get Request     asdc    ${ASDC_HEALTH_CHECK_PATH}     headers=${headers}
+    # only test for HTTP 200 to determine SDC Health. SDC_DE_HEALTH is informational
     Should Be Equal As Strings         ${resp.status_code}     200    SDC DOWN
     ${SDC_DE_HEALTH}=    Catenate   DOWN
     @{ITEMS}=    Copy List    ${resp.json()['componentsInfo']}
     :FOR    ${ELEMENT}    IN    @{ITEMS}
     \    Log    ${ELEMENT['healthCheckStatus']}
     \    ${SDC_DE_HEALTH}  Set Variable If   (('DE' in '${ELEMENT['healthCheckComponent']}') and ('${ELEMENT['healthCheckStatus']}' == 'UP')) or ('${SDC_DE_HEALTH}'=='UP')  UP
-    Should Be Equal As Strings    ${SDC_DE_HEALTH}     UP     SDC_DE DOWN
+    Log Console   SDC DMaaP Interface Health: ${SDC_DE_HEALTH}
 Run ASDC Get Request
     [Documentation]    Runs an ASDC get request
     [Arguments]    ${data_path}    ${user}=${ASDC_DESIGNER_USER_ID}  ${MY_ASDC_BE_ENDPOINT}=${ASDC_BE_ENDPOINT}
diff --git a/robot/resources/so/create_cloud_config.robot b/robot/resources/so/create_cloud_config.robot
new file mode 100644 (file)
index 0000000..be57812
--- /dev/null
@@ -0,0 +1,42 @@
+*** Settings ***
+Documentation    Create Cloud Config
+
+Resource    ../json_templater.robot
+Resource    ../so_interface.robot
+Library    OperatingSystem
+Library    Collections
+
+
+*** Variables ***
+${CLOUD_CONFIG_PATH}    /cloudSite
+
+${SYSTEM USER}    robot-ete
+${SO_ADD_CLOUD_CONFIG}=   robot/assets/templates/so/create_cloud_config.template
+
+*** Keywords ***
+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}
+    ${data}=   Fill JSON Template File    ${SO_ADD_CLOUD_CONFIG}     ${arguments}
+    ${get_resp}=    Run SO Catalog Post request    ${CLOUD_CONFIG_PATH}/${site_name}     ${data}
+    
+    ${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
+
+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}
+    ${data}=    Fill JSON Template File    ${SO_ADD_CLOUD_CONFIG}     ${arguments}
+    ${get_resp}=    Run SO Catalog Put request    ${CLOUD_CONFIG_PATH}/${site_name}     ${data}
+    Should Be Equal As Strings  ${get_resp.status_code}     200
+    [Return]   ${get_resp}
+
+Get Cloud Configuration
+    [Documentation]    Gets cloud configuration in SO
+    [Arguments]    ${site_name}    
+    ${get_resp}=    Run MSO Catalog Get request    ${CLOUD_CONFIG_PATH}/${site_name}
+    Should Be Equal As Strings  ${get_resp.status_code}     200
+
+
index 23ab941..0378caf 100644 (file)
@@ -113,6 +113,30 @@ Run MSO Post request
        Log    Received response from mso ${resp.text}
        [Return]  ${resp}
 
+Run SO Catalog Post request
+    [Documentation]    Runs an SO post request
+    [Arguments]  ${data_path}  ${data}   ${so_port}=
+    ${auth}=  Create List  ${GLOBAL_MSO_CATDB_USERNAME}    ${GLOBAL_MSO_PASSWORD}
+    Log    Creating session ${SO_CATDB_ENDPOINT}
+    ${session}=    Create Session       so_catdb     ${SO_CATDB_ENDPOINT}    auth=${auth}
+    ${uuid}=    Generate UUID
+    ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
+    ${resp}=        Post Request    so_catdb     ${data_path}     data=${data}   headers=${headers}
+    Log    Received response from so_catdb ${resp.text}
+    [Return]  ${resp}
+
+Run SO Catalog Put request
+    [Documentation]    Runs an SO put request
+    [Arguments]  ${data_path}  ${data}   ${so_port}=
+    ${auth}=  Create List  ${GLOBAL_MSO_CATDB_USERNAME}    ${GLOBAL_MSO_PASSWORD}
+    Log    Creating session ${SO_CATDB_ENDPOINT}
+    ${session}=    Create Session       so_catdb     ${SO_CATDB_ENDPOINT}    auth=${auth}
+    ${uuid}=    Generate UUID
+    ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}
+    ${resp}=        Put Request    so_catdb     ${data_path}     data=${data}   headers=${headers}
+    Log    Received response from so_catdb ${resp.text}
+    [Return]  ${resp}
+
 Run MSO Delete request
     [Documentation]    Runs an MSO Delete request
     [Arguments]  ${data_path}  ${data}
index 5997b07..fe0d3e1 100644 (file)
@@ -109,6 +109,8 @@ Create VID VNF module
     Input Text           xpath=//input[@parameter-id='instanceName']    ${vf_module_name}
     Select From List By Label    xpath=//select[@parameter-id='lcpRegion']    ${lcp_region}
     Select From List By Label    xpath=//select[@parameter-id='tenant']    ${tenant}
+    Wait Until Element Is Visible    xpath=//input[@parameter-id='sdncPreload']       ${GLOBAL_VID_UI_TIMEOUT_SHORT}
+    Wait Until Element Is Enabled    xpath=//input[@parameter-id='sdncPreload']       ${GLOBAL_VID_UI_TIMEOUT_SHORT}
     Select Checkbox    xpath=//input[@parameter-id='sdncPreload']
     Click Element    button=Confirm
        Wait Until Element Contains    xpath=//pre[@class = 'log ng-binding']    requestState    timeout=${GLOBAL_VID_UI_TIMEOUT_LONG}
diff --git a/robot/testsuites/create-cloud-config.robot b/robot/testsuites/create-cloud-config.robot
new file mode 100644 (file)
index 0000000..3c1277c
--- /dev/null
@@ -0,0 +1,17 @@
+*** Settings ***
+Documentation    SO Cloud Config Test Cases
+Test Timeout    1 minute
+
+
+Resource          ../resources/so/create_cloud_config.robot
+
+
+*** Test Cases ***
+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 
+
+Get Cloud Config Test
+    [TAGS]    mso    cloudconfig
+    Get Cloud Configuration    ${GLOBAL_INJECTED_REGION}