2 Documentation Test suite 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.
25 Wait Until Keyword Succeeds 30s 2s Ensure All Nodes Are In Response ${REST_CONTEXT_1} ${node_list}
26 ${resp} RequestsLibrary.Get session ${REST_CONTEXT_1}
28 Should Be Equal As Strings ${resp.status_code} 200
29 Should Contain ${resp.content} ${topology1}
32 [Documentation] List all the links in the topology.
33 ${body1} Create Dictionary dest-node=openflow:1 dest-tp=openflow:1:2
34 ${body2} Create Dictionary source-node=openflow:3 source-tp=openflow:3:3
35 ${link2} Create Dictionary link-id=openflow:3:3 destination=${body1} source=${body2}
36 ${body1} Create Dictionary dest-node=openflow:1 dest-tp=openflow:1:1
37 ${body2} Create Dictionary source-node=openflow:2 source-tp=openflow:2:3
38 ${link1} Create Dictionary link-id=openflow:2:3 destination=${body1} source=${body2}
39 ${body1} Create Dictionary dest-node=openflow:3 dest-tp=openflow:3:3
40 ${body2} Create Dictionary source-node=openflow:1 source-tp=openflow:1:2
41 ${link4} Create Dictionary link-id=openflow:1:2 destination=${body1} source=${body2}
42 ${body1} Create Dictionary dest-node=openflow:2 dest-tp=openflow:2:3
43 ${body2} Create Dictionary source-node=openflow:1 source-tp=openflow:1:1
44 ${link3} Create Dictionary link-id=openflow:1:1 destination=${body1} source=${body2}
45 ${links} Create List ${link1} ${link2} ${link3} ${link4}
46 Wait Until Keyword Succeeds 30s 2s Verify Links ${links}
49 [Documentation] Add a link, list to validate the result.
50 ${body1} Create Dictionary dest-node=openflow:3 dest-tp=openflow:3:1
51 ${body2} Create Dictionary source-node=openflow:2 source-tp=openflow:2:1
52 ${body3} Create Dictionary link-id=userlink destination=${body1} source=${body2}
53 ${links} Create List ${body3}
54 ${body} Create Dictionary link=${links}
55 ${resp} RequestsLibrary.Put session ${REST_CONTEXT_3} data=${body}
56 Should Be Equal As Strings ${resp.status_code} 200
57 ${resp} RequestsLibrary.Get session ${REST_CONTEXT_3}
58 Should Be Equal As Strings ${resp.status_code} 200
59 ${result} To JSON ${resp.content}
60 ${link} Get From Dictionary ${result} link
61 Lists Should be Equal ${link} ${links}
64 [Documentation] Remove a link, list to validate the result.
65 ${resp} RequestsLibrary.Delete session ${REST_CONTEXT_3}
66 Should Be Equal As Strings ${resp.status_code} 200
67 ${resp} RequestsLibrary.Get session ${REST_CONTEXT_3}
68 Should Be Equal As Strings ${resp.status_code} 404
72 [Arguments] ${expected_links}
73 ${resp} RequestsLibrary.Get session ${REST_CONTEXT_2}
75 Should Be Equal As Strings ${resp.status_code} 200
76 ${result} To JSON ${resp.content}
78 ${content} Get From Dictionary ${result} topology
79 ${topology} Get From List ${content} 0
80 ${link} Get From Dictionary ${topology} link
82 Lists Should be Equal ${link} ${expected_links}