GIT restructure - Adding project folders and features
[integration/test.git] / test / csit / suites / controller / AD_SAL_Apps_OF10 / 030__subnet_gateway.txt
1 *** Settings ***
2 Documentation     Test suite for Subnet Gateway
3 Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTPORT}    auth=${AUTH}    headers=${HEADERS}
4 Suite Teardown    Delete All Sessions
5 Library           SSHLibrary
6 Library           Collections
7 Library           ../../../libraries/RequestsLibrary.py
8 Library           ../../../libraries/Common.py
9 Variables         ../../../variables/Variables.py
10
11 *** Variables ***
12 ${name}           test
13 ${key}            subnetConfig
14 ${REST_CONTEXT}    /controller/nb/v2/subnetservice
15 ${REST_CONTEXT_HT}    /controller/nb/v2/hosttracker
16
17 *** Test Cases ***
18 List Subnets
19     [Documentation]    List subnets and verify default is there
20     [Tags]    apps
21     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}/${CONTAINER}/subnets
22     Should Be Equal As Strings    ${resp.status_code}    200
23     ${result}    To JSON    ${resp.content}
24     ${subnet}    Get From Dictionary    ${result}    ${key}
25     ${content}    Get From List    ${subnet}    0
26     Dictionary Should Contain Value    ${content}    0.0.0.0/0
27
28 Ping h1 to h4
29     [Documentation]    Ping h1 to h4, verify no packet loss
30     [Tags]    apps
31     Write    h1 ping -w 6 h4
32     Sleep    6
33     Write    h4 ping -w 6 h1
34     Sleep    6
35     ${result}    Read
36     Should Contain    ${result}    64 bytes
37
38 List hosts
39     [Documentation]    List hosts and verify h1 and h4
40     [Tags]    apps
41     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT_HT}/${CONTAINER}/hosts/active
42     Should Be Equal As Strings    ${resp.status_code}    200
43     Should Contain    ${resp.content}    10.0.0.1
44     Should Contain    ${resp.content}    10.0.0.4
45
46 Add a subnet
47     [Documentation]    Add a subnet, list to validate the result.
48     [Tags]    apps
49     ${body}    Create Dictionary    name    ${name}    subnet    11.0.0.254/8
50     ${resp}    RequestsLibrary.Put    session    ${REST_CONTEXT}/${CONTAINER}/subnet/${name}    data=${body}
51     Should Be Equal As Strings    ${resp.status_code}    201
52     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}/${CONTAINER}/subnets
53     Should Be Equal As Strings    ${resp.status_code}    200
54     ${result}    To JSON    ${resp.content}
55     ${content}    Get From Dictionary    ${result}    ${key}
56     List Should Contain Value    ${content}    ${body}
57
58 Remove a subnet
59     [Documentation]    Remove a subnet, list to validate the result.
60     [Tags]    apps
61     ${body}    Create Dictionary    name    ${name}    subnet    11.0.0.254/8
62     ${resp}    RequestsLibrary.Delete    session    ${REST_CONTEXT}/${CONTAINER}/subnet/${name}
63     Should Be Equal As Strings    ${resp.status_code}    204
64     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}/${CONTAINER}/subnets
65     Should Be Equal As Strings    ${resp.status_code}    200
66     ${result}    To JSON    ${resp.content}
67     ${content}    Get From Dictionary    ${result}    ${key}
68     List Should Not Contain Value    ${content}    ${body}