Tidied updated tests.
[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 Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
4 Suite Teardown    Delete All Sessions
5 Library           RequestsLibrary
6 Library           ../../../libraries/ALTO/AltoParser.py
7 Variables         ../../../variables/Variables.py
8 Variables         ../../../variables/alto/Variables.py
9
10 *** Variables ***
11 ${THE_FIRST_IRD_RESOURCE_ID}    hello
12 ${THE_SECOND_IRD_RESOURCE_ID}    world
13 ${RESOURCE_IN_FIRST_IRD}    test-model-networkmap
14 ${RESOURCE_IN_SECOND_IRD}    test-model-filtered-costmap
15 ${BASE_URL}       ${EMPTY}
16 ${RANDOM_CONTEXT_ID}    ${EMPTY}
17
18 *** Test Cases ***
19 Check the simple IRD information
20     [Documentation]    Get the default IRD information
21     Wait Until Keyword Succeeds    5s    1s    Check GET Response Code Equals 200    /${ALTO_SIMPLE_IRD_INFO}
22     ${resp}    RequestsLibrary.Get Request    session    /${ALTO_SIMPLE_IRD_INFO}
23     ${context_id}    ${BASE_URL}    Get Basic Info    ${resp.content}
24     Set Suite Variable    ${BASE_URL}
25     Set Suite Variable    ${RANDOM_CONTEXT_ID}    ${context_id}
26     Wait Until Keyword Succeeds    5s    1s    Check GET Response Code Equals 200    /${RESOURCE_POOL_BASE}/${context_id}
27
28 Create two IRDs
29     [Documentation]    Create two IRDs and verify their existence
30     Create An IRD    ${DEFAULT_CONTEXT_ID}    ${THE_FIRST_IRD_RESOURCE_ID}
31     Wait Until Keyword Succeeds    5s    1s    Check GET Response Code Equals 200    /${ALTO_OPERATIONAL_IRD_INSTANCE}/${THE_FIRST_IRD_RESOURCE_ID}
32     Create An IRD    ${DEFAULT_CONTEXT_ID}    ${THE_SECOND_IRD_RESOURCE_ID}
33     Wait Until Keyword Succeeds    5s    1s    Check GET Response Code Equals 200    /${ALTO_OPERATIONAL_IRD_INSTANCE}/${THE_SECOND_IRD_RESOURCE_ID}
34
35 Add one IRD configuration entry in one IRD instance
36     [Documentation]    Add one IRD configuration entry in an IRD whose name is hello. Link IRD entry to one existed resource.
37     Wait Until Keyword Succeeds    5s    1s    Add An IRD Configuration Entry    ${THE_FIRST_IRD_RESOURCE_ID}    ${DEFAULT_CONTEXT_ID}    ${RESOURCE_IN_FIRST_IRD}
38     ...    ${BASE_URL}
39     Wait Until Keyword Succeeds    5s    1s    Add An IRD Configuration Entry    ${THE_SECOND_IRD_RESOURCE_ID}    ${DEFAULT_CONTEXT_ID}    ${RESOURCE_IN_SECOND_IRD}
40     ...    ${BASE_URL}
41
42 *** Keywords ***
43 Check GET Response Code Equals 200
44     [Arguments]    ${uri_without_ip_port}
45     ${resp}    RequestsLibrary.Get Request    session    ${uri_without_ip_port}
46     Should Be Equal As Strings    ${resp.status_code}    200
47
48 Create An IRD
49     [Arguments]    ${context_id}    ${IRD_id}
50     ${body}    Set Variable    {"ird-instance-configuration":{"entry-context":"/alto-resourcepool:context[alto-resourcepool:context-id='${context_id}']","instance-id":"${IRD_id}"}}
51     ${resp}    RequestsLibrary.Put Request    session    /${ALTO_CONFIG_IRD_INSTANCE_CONFIG}/${IRD_id}    data=${body}
52     Should Be Equal As Strings    ${resp.status_code}    200
53
54 Add An IRD Configuration Entry
55     [Arguments]    ${IRD_id}    ${context_id}    ${resource_id}    ${base_url}
56     ${body}    Set Variable    {"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}"}}
57     ${resp}    RequestsLibrary.Put Request    session    /${ALTO_CONFIG_IRD_INSTANCE_CONFIG}/${IRD_id}/ird-configuration-entry/${resource_id}    data=${body}
58     should Be Equal As Strings    ${resp.status_code}    200