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
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 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} RequestsLibrary.Put session ${REST_CONTEXT}/${CONTAINER}/address/${name} data=${body}
25 Should Be Equal As Strings ${resp.status_code} 201
26 ${resp} RequestsLibrary.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}
32 Check flow in flow stats
33 [Documentation] Show flow stats and validate result
36 ${resp} RequestsLibrary.Get session ${REST_CONTEXT_ST}/${CONTAINER}/flow
37 Should Be Equal As Strings ${resp.status_code} 200
39 Should Contain X Times ${resp.content} ${FLOW} 3
42 [Documentation] Remove a host, list to validate the result.
44 ${body} Create Dictionary nodeType OF dataLayerAddress 5e:bf:79:84:10:a6 vlan
45 ... 1 nodeId 00:00:00:00:00:00:00:03 nodeConnectorId 2 networkAddress
46 ... 10.0.1.4 staticHost ${True} nodeConnectorType OF
47 ${resp} RequestsLibrary.Delete session ${REST_CONTEXT}/${CONTAINER}/address/${name}
48 Should Be Equal As Strings ${resp.status_code} 204
49 ${resp} RequestsLibrary.Get session ${REST_CONTEXT}/${CONTAINER}/hosts/inactive
50 Should Be Equal As Strings ${resp.status_code} 200
51 ${result} To JSON ${resp.content}
52 ${content} Get From Dictionary ${result} ${key}
53 List Should Not Contain Value ${content} ${body}
55 Check flow is not in flow stats
56 [Documentation] Show flow stats and validate result
59 ${resp} RequestsLibrary.Get session ${REST_CONTEXT_ST}/${CONTAINER}/flow
60 Should Be Equal As Strings ${resp.status_code} 200
62 Should Not Contain ${resp.content} ${FLOW}