86b20c50181509991c4f55312c6d0f6871d6bfe1
[integration/test.git] / test / csit / suites / controller / AD_SAL_Apps_OF10 / 020__static_route.txt
1 *** Settings ***
2 Documentation     Test suite for Static Route
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_route1
13 ${key}            staticRoute
14 ${REST_CONTEXT}    /controller/nb/v2/staticroute
15 ${REST_CONTEXT_HT}    /controller/nb/v2/hosttracker
16
17 *** Test Cases ***
18 Add a static route
19     [Documentation]    Add a static route, list to validate the result.
20     [Tags]    apps
21     ${body}    Create Dictionary    name    ${name}    prefix    192.168.1.0/24    nextHop
22     ...    10.0.0.2
23     ${resp}    RequestsLibrary.Put    session    ${REST_CONTEXT}/${CONTAINER}/route/${name}    data=${body}
24     Should Be Equal As Strings    ${resp.status_code}    201
25     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}/${CONTAINER}/routes
26     Should Be Equal As Strings    ${resp.status_code}    200    Response status code error
27     ${result}    To JSON    ${resp.content}
28     ${content}    Get From Dictionary    ${result}    ${key}
29     List Should Contain Value    ${content}    ${body}
30     Sleep    30
31     #    This works locally but NOT in OpenDaylight
32     #Check flow in flow stats
33     #    [Documentation]    Show flow stats and validate result
34     #    [Tags]    apps
35     #    ${resp}    Get    session    ${REST_CONTEXT_ST}/${CONTAINER}/flow
36     #    Should Be Equal As Strings    ${resp.status_code}    200
37     #    Log    ${resp.content}
38     #    Should Contain X Times    ${resp.content}    10.0.0.2    3
39
40 Remove a static route
41     [Documentation]    Remove a static route, list to validate the result.
42     [Tags]    apps
43     ${body}    Create Dictionary    name    ${name}    prefix    192.168.1.0/24    nextHop
44     ...    10.0.0.2
45     ${resp}    RequestsLibrary.Delete    session    ${REST_CONTEXT}/${CONTAINER}/route/${name}
46     Should Be Equal As Strings    ${resp.status_code}    204
47     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}/${CONTAINER}/routes
48     Should Be Equal As Strings    ${resp.status_code}    200
49     ${result}    To JSON    ${resp.content}
50     ${content}    Get From Dictionary    ${result}    ${key}
51     List Should Not Contain Value    ${content}    ${body}