2 Documentation Test suite for RESTCONF Topology
3 Suite Setup Create Session session http://${CONTROLLER}:${RESTCONFPORT} 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
9 Resource ../../../libraries/Utils.txt
16 @{node_list} openflow:1 openflow:2 openflow:3
18 ${REST_CONTEXT_1} /restconf/operational/network-topology:network-topology
19 ${REST_CONTEXT_2} /restconf/operational/network-topology:network-topology/topology/flow:1
20 ${REST_CONTEXT_3} /restconf/config/network-topology:network-topology/topology/flow:1/link/userlink
24 [Documentation] Get RESTCONF Topology and validate the result.
26 Wait Until Keyword Succeeds 30s 2s Ensure All Nodes Are In Response ${REST_CONTEXT_1} ${node_list}
27 ${resp} Get session ${REST_CONTEXT_1}
28 Should Be Equal As Strings ${resp.status_code} 200
30 Should Contain ${resp.content} ${topology1}
33 [Documentation] List all the links in the topology.
35 ${body1} Create Dictionary dest-node=openflow:1 dest-tp=openflow:1:2
36 ${body2} Create Dictionary source-node=openflow:3 source-tp=openflow:3:3
37 ${link2} Create Dictionary link-id=openflow:3:3 destination=${body1} source=${body2}
38 ${body1} Create Dictionary dest-node=openflow:1 dest-tp=openflow:1:1
39 ${body2} Create Dictionary source-node=openflow:2 source-tp=openflow:2:3
40 ${link1} Create Dictionary link-id=openflow:2:3 destination=${body1} source=${body2}
41 ${body1} Create Dictionary dest-node=openflow:3 dest-tp=openflow:3:3
42 ${body2} Create Dictionary source-node=openflow:1 source-tp=openflow:1:2
43 ${link4} Create Dictionary link-id=openflow:1:2 destination=${body1} source=${body2}
44 ${body1} Create Dictionary dest-node=openflow:2 dest-tp=openflow:2:3
45 ${body2} Create Dictionary source-node=openflow:1 source-tp=openflow:1:1
46 ${link3} Create Dictionary link-id=openflow:1:1 destination=${body1} source=${body2}
47 ${links} Create List ${link1} ${link2} ${link3} ${link4}
48 Wait Until Keyword Succeeds 30s 2s Verify Links ${links}
51 [Documentation] Add a link, list to validate the result.
53 ${body1} Create Dictionary dest-node=openflow:3 dest-tp=openflow:3:1
54 ${body2} Create Dictionary source-node=openflow:2 source-tp=openflow:2:1
55 ${body3} Create Dictionary link-id=userlink destination=${body1} source=${body2}
56 ${links} Create List ${body3}
57 ${body} Create Dictionary link=${links}
58 ${resp} Put session ${REST_CONTEXT_3} data=${body}
59 Should Be Equal As Strings ${resp.status_code} 200
60 ${resp} Get session ${REST_CONTEXT_3}
61 Should Be Equal As Strings ${resp.status_code} 200
62 ${result} To JSON ${resp.content}
63 ${link} Get From Dictionary ${result} link
64 Lists Should be Equal ${link} ${links}
67 [Documentation] Remove a link, list to validate the result.
69 ${resp} Delete session ${REST_CONTEXT_3}
70 Should Be Equal As Strings ${resp.status_code} 200
71 ${resp} Get session ${REST_CONTEXT_3}
72 Should Be Equal As Strings ${resp.status_code} 404
76 [Arguments] ${expected_links}
77 ${resp} Get session ${REST_CONTEXT_2}
79 Should Be Equal As Strings ${resp.status_code} 200
80 ${result} To JSON ${resp.content}
82 ${content} Get From Dictionary ${result} topology
83 ${topology} Get From List ${content} 0
84 ${link} Get From Dictionary ${topology} link
86 Lists Should be Equal ${link} ${expected_links}