2 Documentation Test suite for RESTCONF Topology
5 Library RequestsLibrary
6 Library ../../../libraries/Common.py
7 Variables ../../../variables/Variables.py
8 Resource ../../../variables/openflowplugin/Variables.robot
9 Resource ../../../libraries/Utils.robot
11 Suite Setup Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS}
12 Suite Teardown Delete All Sessions
16 @{node_list} openflow:1 openflow:2 openflow:3
21 [Documentation] Get RESTCONF Topology and validate the result.
22 Wait Until Keyword Succeeds
25 ... Check For Elements At URI
26 ... ${RFC8040_OPERATIONAL_TOPO_API}
28 ${resp} RequestsLibrary.GET On Session session url=${RFC8040_OPERATIONAL_TOPO_API}
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 Set Suite Variable ${link2}
37 ${body1} Create Dictionary dest-node=openflow:1 dest-tp=openflow:1:1
38 ${body2} Create Dictionary source-node=openflow:2 source-tp=openflow:2:3
39 ${link1} Create Dictionary link-id=openflow:2:3 destination=${body1} source=${body2}
40 Set Suite Variable ${link1}
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 Set Suite Variable ${link4}
45 ${body1} Create Dictionary dest-node=openflow:2 dest-tp=openflow:2:3
46 ${body2} Create Dictionary source-node=openflow:1 source-tp=openflow:1:1
47 ${link3} Create Dictionary link-id=openflow:1:1 destination=${body1} source=${body2}
48 Set Suite Variable ${link3}
49 ${links} Create List ${link1} ${link2} ${link3} ${link4}
50 Wait Until Keyword Succeeds 10s 2s Verify Links ${links}
53 [Documentation] Take link s1-s2 down
56 ${links} Create List ${link2} ${link4}
57 # increasing the WUKS timeout to 60s to see if the CI environment might just be taking
58 # longer for this test with the lithium redesign plugin
59 Wait Until Keyword Succeeds 60s 2s Verify Links ${links}
60 # shot in the dark. maybe the "link s1 s2 down" really didn't take the link(s) down?
61 # hopefully this output below will show that.
62 Write sh ovs-vsctl find Interface name="s1-eth1"
63 ${output} Read Until mininet>
65 Write sh ovs-vsctl find Interface name="s1-eth2"
66 ${output} Read Until mininet>
70 [Documentation] Take link s1-s2 up
73 ${links} Create List ${link1} ${link2} ${link3} ${link4}
74 Wait Until Keyword Succeeds 10s 2s Verify Links ${links}
77 [Documentation] Remove port s2-eth2
79 Write sh ovs-vsctl del-port s2 s2-eth2
81 @{list} Create List openflow%3A2%3A2
82 Wait Until Keyword Succeeds
85 ... Check For Elements Not At URI
86 ... ${RFC8040_OPERATIONAL_TOPO_API}
90 [Documentation] Add port s2-eth2, new id 5
92 Write sh ovs-vsctl add-port s2 s2-eth2
94 @{list} Create List openflow%3A2%3A5
95 Wait Until Keyword Succeeds 10s 2s Check For Elements At URI ${RFC8040_OPERATIONAL_TOPO_API} ${list}
100 [Arguments] ${expected_links}
101 ${resp} RequestsLibrary.GET On Session
103 ... url=${RFC8040_OPERATIONAL_TOPO_FLOW1_API}
104 ... expected_status=200
106 ${result} Utils.Json Parse From String ${resp.text}
108 ${content} Get From Dictionary ${result} network-topology:topology
109 ${topology} Get From List ${content} 0
110 ${links} Get From Dictionary ${topology} link
111 FOR ${expected_link} IN @{expected_links}
112 Should Contain ${links} ${expected_link}