move the main so interface to use onaplibrary
[testsuite.git] / robot / resources / vid / create_service_instance.robot
1 *** Settings ***
2 Documentation     Creates VID Service Instance
3
4 Library             SeleniumLibrary
5 Library           ONAPLibrary.Utilities
6 Library         String
7 Library        DateTime
8 Library        ONAPLibrary.SO    WITH NAME    SO
9
10 Resource          ../global_properties.robot
11 Resource          vid_interface.robot
12
13 *** Keywords ***
14 Create VID Service Instance
15     [Documentation]    Creates a service instance using VID
16     [Arguments]    ${customer_name}  ${service_model_type}    ${service_type}     ${service_name}  ${project_name}  ${owning_entity}
17     Wait Until Keyword Succeeds    180s    15s    Wait For Model    ${service_model_type}
18     Press Key    xpath=//tr[td/span/text() = '${service_model_type}']/td/button[text() = 'Deploy' and not(@disabled)]    \\13
19     ${uuid}=    Generate UUID4
20     Wait Until Page Contains Element    xpath=//input[@parameter-name='Instance Name']    ${GLOBAL_VID_UI_TIMEOUT_LONG}
21     Wait Until Element Is Visible    xpath=//input[@parameter-name='Instance Name']    ${GLOBAL_VID_UI_TIMEOUT_LONG}
22     Click On Element When Visible    //select[@prompt='Select Subscriber Name']
23     Select From List When Enabled    //select[@prompt='Select Subscriber Name']    ${customer_name}   timeout=${GLOBAL_VID_UI_TIMEOUT_LONG}
24     Select From List When Enabled    //select[@prompt='Select Service Type']     ${service_type}   timeout=${GLOBAL_VID_UI_TIMEOUT_LONG}
25     Select From List When Enabled    //select[@prompt='Select Project Name']     ${project_name}   timeout=${GLOBAL_VID_UI_TIMEOUT_LONG}
26     Select From List When Enabled    //select[@prompt='Select Owning Entity']     ${owning_entity}   timeout=${GLOBAL_VID_UI_TIMEOUT_LONG}
27     Capture Page Screenshot
28     Page Should Contain Element         //input[@parameter-name='Instance Name']        limit=1
29     Set Focus To Element   //input[@parameter-name='Instance Name']
30     Wait Until Keyword Succeeds   120s  5s    Input Text When Enabled    //input[@parameter-name='Instance Name']    ${service_name}   timeout=${GLOBAL_VID_UI_TIMEOUT_LONG}
31     Capture Page Screenshot
32     Click On Button When Enabled    //div[@class = 'buttonRow']/button[text() = 'Confirm']
33         Wait Until Element Contains    xpath=//pre[@class= 'log ng-binding']    requestState    timeout=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
34         Wait Until Page Contains    "requestState": "COMPLETE"   timeout= ${GLOBAL_VID_UI_TIMEOUT_LONG}
35     ${response text}=    Get Text    xpath=//pre[@class = 'log ng-binding']
36     Click On Button When Enabled    //div[@class = 'buttonRow']/button[text() = 'Close']
37     ${request_id}=    Parse Request Id    ${response text}
38     ${service_instance_id}=    Parse Instance Id     ${response text}
39     ${auth}=    Create List  ${GLOBAL_MSO_USERNAME}    ${GLOBAL_MSO_PASSWORD}
40     SO.Run Polling Get Request    ${GLOBAL_SO_ENDPOINT}    ${GLOBAL_MSO_STATUS_PATH}${request_id}    auth=${auth}
41     [return]    ${service_instance_id}
42
43 Wait For Model
44     [Documentation]   Distributed model may not yet be available. Kepp trying until it shows up.
45     [Arguments]   ${service_model_type}
46     # Need to refresh browser json data Home -> Browse Service Models cycle does that
47     Go To VID Home
48     Go To VID Browse Service Models
49     Page Should Contain Element    xpath=//div/h1[text() = 'Browse SDC Service Models']
50     Wait Until Page Contains Element    xpath=//button[text() = 'Deploy']    ${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
51     Input Text When Enabled    //input[@ng-model='searchString']    ${service_model_type}
52     Wait Until Element Is Visible    xpath=//tr[td/span/text() = '${service_model_type}']/td/button[contains(text(),'Deploy')]    ${GLOBAL_VID_UI_TIMEOUT_SHORT}
53
54 Delete Service Instance By GUI
55     [Arguments]    ${service_instance_id}
56     Click On Element When Visible    xpath=//a/span[@class='glyphicon glyphicon-remove']
57     Click On Button When Enabled    xpath=//div[@class='buttonRow']/button[@ngx-enabled='true']
58     Wait Until Element Contains    xpath=//div[@ng-controller='deletionDialogController']//div[@ng-controller= 'msoCommitController']/pre[@class = 'log ng-binding']   requestId    timeout=${GLOBAL_VID_UI_TIMEOUT_LONG}
59     ${response text}=    Get Text    xpath=//div[@ng-controller='deletionDialogController']//div[@ng-controller= 'msoCommitController']/pre[@class = 'log ng-binding']
60     ${request_id}=    Parse Request Id     ${response text}
61     ${auth}=    Create List  ${GLOBAL_MSO_USERNAME}    ${GLOBAL_MSO_PASSWORD}
62     SO.Run Polling Get Request    ${GLOBAL_SO_ENDPOINT}    ${GLOBAL_MSO_STATUS_PATH}${request_id}    auth=${auth}
63
64 Search Service Instance
65     [Arguments]    ${service_instance_id}
66     Click Link       xpath=//div[@heading = 'Search for Existing Service Instances']/a
67     Input Text When Enabled    //input[@name='selectedServiceInstance']    ${service_instance_id}
68     Click On Button When Enabled    //button[text() = 'Submit']