2 Documentation Test suite for Host Tracker
3 Suite Setup Create Session session http://${CONTROLLER}:8080 auth=${AUTH} headers=${HEADERS}
4 Suite Teardown Delete All Sessions
6 Library ../../../libraries/RequestsLibrary.py
7 Library ../../../libraries/Common.py
8 Variables ../../../variables/Variables.py
13 ${REST_CONTEXT} /controller/nb/v2/hosttracker
14 ${REST_CONTEXT_ST} /controller/nb/v2/statistics
19 [Documentation] Add a host, list to validate the result.
21 ${body} Create Dictionary nodeType MD_SAL dataLayerAddress 5e:bf:79:84:10:a6 vlan
22 ... 1 nodeId openflow:3 nodeConnectorId openflow:3:2 networkAddress
23 ... 10.0.1.4 staticHost ${True} nodeConnectorType MD_SAL
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
35 ${resp} Get session ${REST_CONTEXT_ST}/${CONTAINER}/flow
36 Should Be Equal As Strings ${resp.status_code} 200
38 Should Contain X Times ${resp.content} ${FLOW} 3
40 [Documentation] Remove a host, list to validate the result.
42 ${body} Create Dictionary nodeType MD_SAL dataLayerAddress 5e:bf:79:84:10:a6 vlan
43 ... 1 nodeId openflow:3 nodeConnectorId openflow:3:2 networkAddress
44 ... 10.0.1.4 staticHost ${True} nodeConnectorType MD_SAL
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
56 ${resp} Get session ${REST_CONTEXT_ST}/${CONTAINER}/flow
57 Should Be Equal As Strings ${resp.status_code} 200
59 Should Not Contain ${resp.content} ${FLOW}