Sample integration test
[integration/test.git] / test / csit / suites / openflowplugin / AD_SAL_Apps_OF13 / 010__host_tracker.txt
1 *** Settings ***
2 Documentation     Test suite for Host Tracker
3 Suite Setup       Create Session   session   http://${CONTROLLER}:${RESTPORT}   auth=${AUTH}   headers=${HEADERS}
4 Suite Teardown    Delete All Sessions
5 Library           Collections
6 Library           ../../../libraries/RequestsLibrary.py
7 Library           ../../../libraries/Common.py
8 Variables         ../../../variables/Variables.py
9
10 *** Variables ***
11 ${name}           10.0.1.4
12 ${key}            hostConfig
13 ${REST_CONTEXT}    /controller/nb/v2/hosttracker
14 ${REST_CONTEXT_ST}    /controller/nb/v2/statistics
15 ${FLOW}           "10.0.1.4"
16
17 *** Test Cases ***
18 Add a host
19     [Documentation]    Add a host, list to validate the result.
20     [Tags]    apps
21     ${body}    Create Dictionary    nodeType    OF    dataLayerAddress    5e:bf:79:84:10:a6    vlan
22     ...    1    nodeId    00:00:00:00:00:00:00:03    nodeConnectorId    2    networkAddress
23     ...    10.0.1.4    staticHost    ${True}    nodeConnectorType    OF
24     ${resp}    Put    session    ${REST_CONTEXT}/${CONTAINER}/address/${name}    data=${body}
25     Should Be Equal As Strings    ${resp.status_code}    201
26     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/hosts/active
27     Should Be Equal As Strings    ${resp.status_code}    200 
28     ${result}    To JSON    ${resp.content}
29     ${content}    Get From Dictionary    ${result}    ${key}
30     List Should Contain Value    ${content}    ${body} 
31 Check flow in flow stats
32     [Documentation]    Show flow stats and validate result
33     [Tags]   apps
34     Sleep   30
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}    ${FLOW}   3
39 Remove a host
40     [Documentation]    Remove a host, list to validate the result.
41     [Tags]    apps
42     ${body}    Create Dictionary    nodeType    OF    dataLayerAddress    5e:bf:79:84:10:a6    vlan
43     ...    1    nodeId    00:00:00:00:00:00:00:03    nodeConnectorId    2    networkAddress
44     ...    10.0.1.4    staticHost    ${True}    nodeConnectorType    OF
45     ${resp}    Delete    session    ${REST_CONTEXT}/${CONTAINER}/address/${name}
46     Should Be Equal As Strings    ${resp.status_code}    204
47     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/hosts/inactive
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}
52 Check flow is not in flow stats
53     [Documentation]    Show flow stats and validate result
54     [Tags]    apps
55     Sleep    30
56     ${resp}    Get    session    ${REST_CONTEXT_ST}/${CONTAINER}/flow
57     Should Be Equal As Strings    ${resp.status_code}    200 
58     Log    ${resp.content}
59     Should Not Contain    ${resp.content}    ${FLOW}
60