74fa06e87bd607dcde99f78ee79d4ca21e10179f
[integration/test.git] / tools / Robot_Tool / suites / base / container_manager.txt
1 *** Settings ***
2 Documentation     Test suite for the container manager module.
3 Suite Teardown    Delete All Sessions
4 Library           Collections
5 Library           RequestsLibrary
6 Library           ../../libraries/Common.py
7 Variables         ../../variables/Variables.py
8
9 *** Variables ***
10 ${name}           test_container1
11 @{nodeconnectors}    OF|1@OF|00:00:00:00:00:00:00:01    OF|23@OF|00:00:00:00:00:00:20:21
12 ${key}            containerConfig
13 ${REST_CONTEXT}    /controller/nb/v2/containermanager
14
15 *** Test Cases ***
16 Add a container
17     [Documentation]    Add a container, list to validate the result.
18     [Tags]    add
19     ${flowspecs}    Convert To List    ${EMPTY}
20     ${body}    Create Dictionary    container=${name}    flowSpecs=${flowspecs}    staticVlan=10
21     ...     nodeConnectors=${nodeconnectors}
22     ${headers}    Create Dictionary    Content-Type=application/json
23     Create Session    session    http://${CONTROLLER}:8080    headers=${headers}    auth=${auth}
24     ${resp}    Put    session    ${REST_CONTEXT}/container/${name}    data=${body}
25     Should Be Equal As Strings    ${resp.status_code}    201    Response status code error
26     ${resp}    Get    session    ${REST_CONTEXT}/containers
27     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
28     ${result}    To JSON    ${resp.content}
29     ${content}    Get From Dictionary    ${result}    ${key}
30     List Should Contain Value    ${content}    ${body}
31
32 Remove a container
33     [Documentation]    Remove a container, list to validate the result.
34     [Tags]    remove
35     ${flowspecs}    Convert To List    ${EMPTY}
36     ${body}    Create Dictionary    container=${name}    flowSpecs=${flowspecs}    staticVlan=10
37     ...     nodeConnectors=${nodeconnectors}
38     ${headers}    Create Dictionary    Content-Type=application/json
39     Create Session    session    http://${CONTROLLER}:8080    headers=${headers}    auth=${auth}
40     ${resp}    Delete    session    ${REST_CONTEXT}/container/${name}
41     Should Be Equal As Strings    ${resp.status_code}    204    Response status code error
42     ${resp}    Get    session    ${REST_CONTEXT}/containers
43     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
44     ${result}    To JSON    ${resp.content}
45     ${content}    Get From Dictionary    ${result}    ${key}
46     List Should Not Contain Value    ${content}    ${body}