2 Documentation Test suite for RESTCONF Topology
3 Suite Setup Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
4 Suite Teardown Delete All Sessions
6 Library RequestsLibrary
7 Library ../../../libraries/Common.py
8 Variables ../../../variables/Variables.py
9 Resource ../../../libraries/Utils.robot
12 @{node_list} openflow:1 openflow:2 openflow:3
16 [Documentation] Get RESTCONF Topology and validate the result.
17 Wait Until Keyword Succeeds 10s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API} ${node_list}
18 ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_TOPO_API}
22 [Documentation] List all the links in the topology.
23 ${body1} Create Dictionary dest-node=openflow:1 dest-tp=openflow:1:2
24 ${body2} Create Dictionary source-node=openflow:3 source-tp=openflow:3:3
25 ${link2} Create Dictionary link-id=openflow:3:3 destination=${body1} source=${body2}
26 Set Suite Variable ${link2}
27 ${body1} Create Dictionary dest-node=openflow:1 dest-tp=openflow:1:1
28 ${body2} Create Dictionary source-node=openflow:2 source-tp=openflow:2:3
29 ${link1} Create Dictionary link-id=openflow:2:3 destination=${body1} source=${body2}
30 Set Suite Variable ${link1}
31 ${body1} Create Dictionary dest-node=openflow:3 dest-tp=openflow:3:3
32 ${body2} Create Dictionary source-node=openflow:1 source-tp=openflow:1:2
33 ${link4} Create Dictionary link-id=openflow:1:2 destination=${body1} source=${body2}
34 Set Suite Variable ${link4}
35 ${body1} Create Dictionary dest-node=openflow:2 dest-tp=openflow:2:3
36 ${body2} Create Dictionary source-node=openflow:1 source-tp=openflow:1:1
37 ${link3} Create Dictionary link-id=openflow:1:1 destination=${body1} source=${body2}
38 Set Suite Variable ${link3}
39 ${links} Create List ${link1} ${link2} ${link3} ${link4}
40 Wait Until Keyword Succeeds 10s 2s Verify Links ${links}
43 [Documentation] Take link s1-s2 down
46 ${links} Create List ${link2} ${link4}
47 # increasing the WUKS timeout to 60s to see if the CI environment might just be taking
48 # longer for this test with the lithium redesign plugin
49 Wait Until Keyword Succeeds 60s 2s Verify Links ${links}
50 # shot in the dark. maybe the "link s1 s2 down" really didn't take the link(s) down?
51 # hopefully this output below will show that.
52 Write sh ovs-vsctl find Interface name="s1-eth1"
53 ${output}= Read Until mininet>
55 Write sh ovs-vsctl find Interface name="s1-eth2"
56 ${output}= Read Until mininet>
60 [Documentation] Take link s1-s2 up
63 ${links} Create List ${link1} ${link2} ${link3} ${link4}
64 Wait Until Keyword Succeeds 10s 2s Verify Links ${links}
67 [Documentation] Remove port s2-eth2
69 Write sh ovs-vsctl del-port s2 s2-eth2
71 @{list} Create List openflow:2:2
72 Wait Until Keyword Succeeds 10s 2s Check For Elements Not At URI ${OPERATIONAL_TOPO_API} ${list}
75 [Documentation] Add port s2-eth2, new id 5
77 Write sh ovs-vsctl add-port s2 s2-eth2
79 @{list} Create List openflow:2:5
80 Wait Until Keyword Succeeds 10s 2s Check For Elements At URI ${OPERATIONAL_TOPO_API} ${list}
84 [Arguments] ${expected_links}
85 ${resp} RequestsLibrary.Get Request session ${OPERATIONAL_TOPO_API}/topology/flow:1
87 Should Be Equal As Strings ${resp.status_code} 200
88 ${result} To JSON ${resp.content}
90 ${content} Get From Dictionary ${result} topology
91 ${topology} Get From List ${content} 0
92 ${link} Get From Dictionary ${topology} link
94 Lists Should be Equal ${link} ${expected_links}