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
16 ${REST_CONTEXT_1} /restconf/operational/network-topology:network-topology
17 ${REST_CONTEXT_2} /restconf/operational/network-topology:network-topology/topology/flow:1
18 ${REST_CONTEXT_3} /restconf/config/network-topology:network-topology/topology/flow:1/link/userlink
22 [Documentation] Get RESTCONF Topology and validate the result.
24 ${resp} Get session ${REST_CONTEXT_1}
25 Should Be Equal As Strings ${resp.status_code} 200
27 Should Contain ${resp.content} ${topology1}
30 [Documentation] List all the links in the topology.
32 ${body1} Create Dictionary dest-node=openflow:1 dest-tp=openflow:1:2
33 ${body2} Create Dictionary source-node=openflow:3 source-tp=openflow:3:3
34 ${link2} Create Dictionary link-id=openflow:3:3 destination=${body1} source=${body2}
35 ${body1} Create Dictionary dest-node=openflow:1 dest-tp=openflow:1:1
36 ${body2} Create Dictionary source-node=openflow:2 source-tp=openflow:2:3
37 ${link1} Create Dictionary link-id=openflow:2:3 destination=${body1} source=${body2}
38 ${body1} Create Dictionary dest-node=openflow:3 dest-tp=openflow:3:3
39 ${body2} Create Dictionary source-node=openflow:1 source-tp=openflow:1:2
40 ${link4} Create Dictionary link-id=openflow:1:2 destination=${body1} source=${body2}
41 ${body1} Create Dictionary dest-node=openflow:2 dest-tp=openflow:2:3
42 ${body2} Create Dictionary source-node=openflow:1 source-tp=openflow:1:1
43 ${link3} Create Dictionary link-id=openflow:1:1 destination=${body1} source=${body2}
44 ${links} Create List ${link1} ${link2} ${link3} ${link4}
45 ${resp} Get session ${REST_CONTEXT_2}
46 Should Be Equal As Strings ${resp.status_code} 200
47 ${result} To JSON ${resp.content}
48 ${content} Get From Dictionary ${result} topology
49 ${topology} Get From List ${content} 0
50 ${link} Get From Dictionary ${topology} link
52 Lists Should be Equal ${link} ${links}
55 [Documentation] Add a link, list to validate the result.
57 ${body1} Create Dictionary dest-node=openflow:3 dest-tp=openflow:3:1
58 ${body2} Create Dictionary source-node=openflow:2 source-tp=openflow:2:1
59 ${body3} Create Dictionary link-id=userlink destination=${body1} source=${body2}
60 ${links} Create List ${body3}
61 ${body} Create Dictionary link=${links}
62 ${resp} Put session ${REST_CONTEXT_3} data=${body}
63 Should Be Equal As Strings ${resp.status_code} 200
64 ${resp} Get session ${REST_CONTEXT_3}
65 Should Be Equal As Strings ${resp.status_code} 200
66 ${result} To JSON ${resp.content}
67 ${link} Get From Dictionary ${result} link
68 Lists Should be Equal ${link} ${links}
72 [Documentation] Remove a link, list to validate the result.
74 ${resp} Delete session ${REST_CONTEXT_3}
75 Should Be Equal As Strings ${resp.status_code} 200
76 ${resp} Get session ${REST_CONTEXT_3}
77 Should Be Equal As Strings ${resp.status_code} 404