Update Robot Framework format - step 2
[integration/test.git] / csit / suites / alto / basic / 020_simple_IRD.robot
1 *** Settings ***
2 Documentation       Test suite for ALTO simple IRD (Information Resource Dictionary)
3
4 Library             RequestsLibrary
5 Library             ../../../libraries/ALTO/AltoParser.py
6 Variables           ../../../variables/Variables.py
7 Variables           ../../../variables/alto/Variables.py
8 Resource            ${CURDIR}/../../../libraries/TemplatedRequests.robot
9
10 Suite Setup         Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
11 Suite Teardown      Delete All Sessions
12
13
14 *** Variables ***
15 ${THE_FIRST_IRD_RESOURCE_ID}        hello
16 ${THE_SECOND_IRD_RESOURCE_ID}       world
17 ${RESOURCE_IN_FIRST_IRD}            test-model-networkmap
18 ${RESOURCE_IN_SECOND_IRD}           test-model-filtered-costmap
19 ${BASE_URL}                         ${EMPTY}
20 ${RANDOM_CONTEXT_ID}                ${EMPTY}
21
22
23 *** Test Cases ***
24 Check the simple IRD information
25     [Documentation]    Get the default IRD information
26     Wait Until Keyword Succeeds    20s    2s    Check GET Response Code Equals 200    /${ALTO_SIMPLE_IRD_INFO}
27     ${resp}    RequestsLibrary.Get Request    session    /${ALTO_SIMPLE_IRD_INFO}
28     ${context_id}    ${BASE_URL}    Get Basic Info    ${resp.content}
29     Set Suite Variable    ${BASE_URL}
30     Set Suite Variable    ${RANDOM_CONTEXT_ID}    ${context_id}
31     Wait Until Keyword Succeeds
32     ...    20s
33     ...    2s
34     ...    Check GET Response Code Equals 200
35     ...    /${RESOURCE_POOL_BASE}/${context_id}
36
37 Create two IRDs
38     [Documentation]    Create two IRDs and verify their existence
39     Create An IRD    ${DEFAULT_CONTEXT_ID}    ${THE_FIRST_IRD_RESOURCE_ID}
40     Wait Until Keyword Succeeds
41     ...    5s
42     ...    1s
43     ...    Check GET Response Code Equals 200
44     ...    /${ALTO_OPERATIONAL_IRD_INSTANCE}/${THE_FIRST_IRD_RESOURCE_ID}
45     Create An IRD    ${DEFAULT_CONTEXT_ID}    ${THE_SECOND_IRD_RESOURCE_ID}
46     Wait Until Keyword Succeeds
47     ...    5s
48     ...    1s
49     ...    Check GET Response Code Equals 200
50     ...    /${ALTO_OPERATIONAL_IRD_INSTANCE}/${THE_SECOND_IRD_RESOURCE_ID}
51
52 Add one IRD configuration entry in one IRD instance
53     [Documentation]    Add one IRD configuration entry in an IRD whose name is hello. Link IRD entry to one existed resource.
54     Wait Until Keyword Succeeds
55     ...    5s
56     ...    1s
57     ...    Add An IRD Configuration Entry
58     ...    ${THE_FIRST_IRD_RESOURCE_ID}
59     ...    ${DEFAULT_CONTEXT_ID}
60     ...    ${RESOURCE_IN_FIRST_IRD}
61     ...    ${BASE_URL}
62     Wait Until Keyword Succeeds
63     ...    5s
64     ...    1s
65     ...    Add An IRD Configuration Entry
66     ...    ${THE_SECOND_IRD_RESOURCE_ID}
67     ...    ${DEFAULT_CONTEXT_ID}
68     ...    ${RESOURCE_IN_SECOND_IRD}
69     ...    ${BASE_URL}
70
71
72 *** Keywords ***
73 Check GET Response Code Equals 200
74     [Arguments]    ${uri_without_ip_port}
75     ${resp}    RequestsLibrary.Get Request    session    ${uri_without_ip_port}
76     Should Be True    ${resp.status_code}==200
77
78 Create An IRD
79     [Arguments]    ${context_id}    ${IRD_id}
80     ${body}    Set Variable
81     ...    {"ird-instance-configuration":{"entry-context":"/alto-resourcepool:context[alto-resourcepool:context-id='${context_id}']","instance-id":"${IRD_id}"}}
82     ${resp}    RequestsLibrary.Put Request    session    /${ALTO_CONFIG_IRD_INSTANCE_CONFIG}/${IRD_id}    data=${body}
83     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
84
85 Add An IRD Configuration Entry
86     [Arguments]    ${IRD_id}    ${context_id}    ${resource_id}    ${base_url}
87     ${body}    Set Variable
88     ...    {"ird-configuration-entry":{"entry-id":"${resource_id}","instance":"/alto-resourcepool:context[alto-resourcepool:context-id='${context_id}']/alto-resourcepool:resource[alto-resourcepool:resource-id='${resource_id}']","path":"${base_url}/${resource_id}"}}
89     ${resp}    RequestsLibrary.Put Request
90     ...    session
91     ...    /${ALTO_CONFIG_IRD_INSTANCE_CONFIG}/${IRD_id}/ird-configuration-entry/${resource_id}
92     ...    data=${body}
93     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}