6 Variables ../variables/Variables.py
7 Library RequestsLibrary
14 [Arguments] ${start} ${stop} ${step}
15 [Documentation] Will find out max switches starting from ${start} till reaching ${stop} and in steps defined by ${step}
16 ${max-switches} Set Variable ${0}
17 ${start} Convert to Integer ${start}
18 ${stop} Convert to Integer ${stop}
19 ${step} Convert to Integer ${step}
20 : FOR ${switches} IN RANGE ${start} ${stop+1} ${step}
21 \ Start Mininet Linear ${switches}
22 \ ${status} ${result} Run Keyword And Ignore Error Verify Controller Is Not Dead ${CONTROLLER}
23 \ Exit For Loop If '${status}' == 'FAIL'
24 \ ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds ${switches*2} 10s
25 \ ... Check Every Switch ${switches}
26 \ Exit For Loop If '${status}' == 'FAIL'
27 \ ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds ${switches*2} 10s
28 \ ... Check Linear Topology ${switches}
29 \ Exit For Loop If '${status}' == 'FAIL'
31 \ ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds ${switches*2} 10s
32 \ ... Check No Switches ${switches}
33 \ Exit For Loop If '${status}' == 'FAIL'
34 \ ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds ${switches*2} 10s
35 \ ... Check No Topology ${switches}
36 \ Exit For Loop If '${status}' == 'FAIL'
37 \ ${max-switches} Convert To String ${switches}
38 [Return] ${max-switches}
41 [Arguments] ${begin} ${stop} ${step}
42 [Documentation] Will find out max hosts starting from ${begin} till reaching ${stop} and in steps defined by ${step}
43 ${max-hosts} Set Variable ${0}
44 ${stop} Convert to Integer ${stop}
45 ${step} Convert to Integer ${step}
46 : FOR ${hosts} IN RANGE ${begin} ${stop+1} ${step}
47 \ Start Mininet With One Switch And ${hosts} hosts
48 \ ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds 120s 30s
49 \ ... Check Every Switch ${1}
50 \ Exit For Loop If '${status}' == 'FAIL'
51 \ @{host_list}= Get Mininet Hosts
52 \ ${status}= Ping All Hosts @{host_list}
53 \ Exit For Loop If ${status} != ${0}
54 \ ${status} ${result} Run Keyword And Ignore Error Verify Controller Is Not Dead ${CONTROLLER}
55 \ Exit For Loop If '${status}' == 'FAIL'
56 \ ${status} ${result} Run Keyword And Ignore Error Wait Until Keyword Succeeds 120s 30s
57 \ ... Check Number Of Hosts ${hosts}
58 \ Exit For Loop If '${status}' == 'FAIL'
60 \ ${status} ${result} Run Keyword And Ignore Error Check No Switches ${1}
61 \ Exit For Loop If '${status}' == 'FAIL'
62 \ ${status} ${result} Run Keyword And Ignore Error Check No Hosts
63 \ Exit For Loop If '${status}' == 'FAIL'
64 \ ${max-hosts} Convert To String ${hosts}
68 [Documentation] Get all the hosts from mininet
69 ${host_list}= Create List
71 ${out}= Read Until mininet>
72 @{words}= Split String ${out} ${SPACE}
73 :FOR ${item} IN @{words}
74 \ ${h}= Get Lines Matching Regexp ${item.rstrip()} .*h[0-9]*s.
75 \ Run Keyword If '${h}' != '${EMPTY}' Append To List ${host_list} ${h}
79 [Arguments] @{host_list}
80 [Documentation] Do one round of ping from one host to all other hosts in mininet
81 ${source}= Get From List ${host_list} ${0}
82 : FOR ${h} IN @{host_list}
83 \ ${status}= Ping Two Hosts ${source} ${h} 1
84 \ Exit For Loop If ${status}!=${0}
87 Start Mininet With One Switch And ${hosts} hosts
88 [Documentation] Start mininet with one switch and ${hosts} hosts
89 Log Starting mininet with one switch and ${hosts} hosts
90 Log To Console Starting mininet with one switch and ${hosts} hosts
91 ${mininet_conn_id}= Open Connection ${MININET} prompt=${linux_prompt} timeout=${hosts*3}
92 Set Suite Variable ${mininet_conn_id}
93 Login With Public Key ${MININET_USER} ${USER_HOME}/.ssh/id_rsa any
94 Write sudo mn --controller=remote,ip=${CONTROLLER} --topo linear,1,${hosts} --switch ovsk,protocols=OpenFlow13
99 [Documentation] Check number of hosts in inventory
100 ${resp} RequestsLibrary.Get session ${OPERATIONAL_TOPO_API}
101 Log Check number of hosts in inventory
102 Log To Console Check number of hosts in inventory
103 Should Be Equal As Strings ${resp.status_code} 200
104 ${count}= Get Count ${resp.content} "node-id":"host:
105 Should Be Equal As Integers ${count} ${hosts}
108 [Arguments] ${host1} ${host2} ${pingcount}=2 ${connection_index}=${EMPTY} ${connection_alias}=${EMPTY}
109 [Documentation] Ping between mininet hosts. Must be used only after a mininet session is in place.Returns non zero value if there is 100% packet loss.
110 Run Keyword If '${connection_index}' != '${EMPTY}' Switch Connection ${connection_index}
111 Run Keyword If '${connection_alias}' != '${EMPTY}' Switch Connection ${connection_alias}
112 Write ${host1} ping -c ${pingcount} ${host2}
113 ${out}= Read Until mininet>
114 ${ret}= Get Lines Matching Regexp ${out} .*100% packet loss.*
115 ${len}= Get Length ${ret}
119 [Documentation] Check if all hosts are deleted from inventory
120 ${resp} RequestsLibrary.Get session ${OPERATIONAL_TOPO_API}
121 Log To Console Checking no hosts are present in operational database
122 Log Checking no hosts are present in operational database
123 Should Be Equal As Strings ${resp.status_code} 200
124 Should Not Contain ${resp.content} "node-id":"host:
127 [Arguments] ${switches}
128 [Documentation] Start mininet linear topology with ${switches} nodes
129 Log To Console Starting mininet linear ${switches}
130 ${mininet_conn_id}= Open Connection ${MININET} prompt=${linux_prompt} timeout=${switches*3}
131 Set Suite Variable ${mininet_conn_id}
132 Login With Public Key ${MININET_USER} ${USER_HOME}/.ssh/id_rsa any
133 Write sudo mn --controller=remote,ip=${CONTROLLER} --topo linear,${switches} --switch ovsk,protocols=OpenFlow13
138 [Arguments] ${switches}
139 [Documentation] Check all switches and stats in operational inventory
140 : FOR ${switch} IN RANGE 1 ${switches+1}
141 \ ${resp} RequestsLibrary.Get session /restconf/operational/opendaylight-inventory:nodes/node/openflow:${switch}
142 \ Log To Console Checking Switch ${switch}
143 \ Should Be Equal As Strings ${resp.status_code} 200
144 \ Should Contain ${resp.content} flow-capable-node-connector-statistics
145 \ Should Contain ${resp.content} flow-table-statistics
147 Check Linear Topology
148 [Arguments] ${switches}
149 [Documentation] Check Linear topology given ${switches}
150 ${resp} RequestsLibrary.Get session /restconf/operational/network-topology:network-topology/
151 Log To Console Checking Topology
152 Should Be Equal As Strings ${resp.status_code} 200
153 : FOR ${switch} IN RANGE 1 ${switches+1}
154 \ Should Contain ${resp.content} "node-id":"openflow:${switch}"
155 \ Should Contain ${resp.content} "tp-id":"openflow:${switch}:1"
156 \ Should Contain ${resp.content} "tp-id":"openflow:${switch}:2"
157 \ Should Contain ${resp.content} "source-tp":"openflow:${switch}:2"
158 \ Should Contain ${resp.content} "dest-tp":"openflow:${switch}:2"
159 \ ${edge} Evaluate ${switch}==1 or ${switch}==${switches}
160 \ Run Keyword Unless ${edge} Should Contain ${resp.content} "tp-id":"openflow:${switch}:3"
161 \ Run Keyword Unless ${edge} Should Contain ${resp.content} "source-tp":"openflow:${switch}:3"
162 \ Run Keyword Unless ${edge} Should Contain ${resp.content} "dest-tp":"openflow:${switch}:3"
165 [Arguments] ${switches}
166 [Documentation] Check no switch is in inventory
167 ${resp} RequestsLibrary.Get session ${OPERATIONAL_NODES_API}
168 Log To Console Checking No Switches
169 Should Be Equal As Strings ${resp.status_code} 200
170 : FOR ${switch} IN RANGE 1 ${switches+1}
171 \ Should Not Contain ${resp.content} openflow:${switch}
174 [Arguments] ${switches}
175 [Documentation] Check no switch is in topology
176 ${resp} RequestsLibrary.Get session ${OPERATIONAL_TOPO_API}
177 Log To Console Checking No Topology
178 Should Be Equal As Strings ${resp.status_code} 200
179 : FOR ${switch} IN RANGE 1 ${switches+1}
180 \ Should Not Contain ${resp.content} openflow:${switch}
183 [Documentation] Stop mininet
184 Log To Console Stopping Mininet
185 Switch Connection ${mininet_conn_id}
188 Read Until ${linux_prompt}
191 Scalability Suite Teardown