5 Library RequestsLibrary
10 Variables ../variables/Variables.py
11 Resource ./Utils.robot
14 ${vlan_topo} sudo mn --controller=remote,ip=${CONTROLLER} --custom vlan_vtn_test.py --topo vlantopo
18 [Documentation] Download the VTN Coordinator from Controller VM
19 Log Download the VTN Coordinator bz2 file
20 SSHLibrary.Open_Connection ${CONTROLLER}
21 SSHLibrary.Login_With_Public_Key ${CONTROLLER_USER} ${USER_HOME}/.ssh/${SSH_KEY} any
22 ${VTNC_FILENAME}= Catenate SEPARATOR=/ ${WORKSPACE} vtn_coordinator.tar.bz2
23 SSHLibrary.Get_File ${WORKSPACE}/${BUNDLEFOLDER}/externalapps/*vtn-coordinator*-bin.tar.bz2 ${VTNC_FILENAME}
24 SSHLibrary.Close_Connection
25 SSHLibrary.Open_Connection ${MININET}
26 SSHLibrary.Login_With_Public_Key ${MININET_USER} ${USER_HOME}/.ssh/${SSH_KEY} any
27 SSHLibrary.Put_File ${VTNC_FILENAME} /tmp
28 SSHLibrary.Close_Connection
31 [Documentation] Download and startup the VTN Coordinator.
32 Log Start the VTN Coordinator
34 ${vtnc_conn_id}= Open Connection ${MININET} prompt=${DEFAULT_LINUX_PROMPT} timeout=30s
35 Set Suite Variable ${vtnc_conn_id}
36 Login With Public Key ${MININET_USER} ${USER_HOME}/.ssh/${SSH_KEY} any
37 ${VTNC_FILENAME}= Catenate SEPARATOR=/ ${WORKSPACE} vtn_coordinator.tar.bz2
38 Execute Command tar -C/ -jxvf ${VTNC_FILENAME}
39 Execute Command /usr/local/vtn/sbin/db_setup
40 Execute Command /usr/local/vtn/bin/vtn_start
41 Execute Command /usr/local/vtn/bin/unc_dmctl status
42 Execute Command /usr/local/vtn/sbin/db_setup
43 Execute Command sed -i 's/odcdrv_ping_interval = 30/odcdrv_ping_interval = 10/g' /usr/local/vtn/modules/odcdriver.conf
44 Execute Command sed -i 's/physical_attributes_read_interval = 40/physical_attributes_read_interval = 15/g' /usr/local/vtn/modules/vtndrvintf.conf
45 Execute Command /usr/local/vtn/bin/vtn_start
46 Execute Command /usr/local/vtn/bin/unc_dmctl status
47 Execute Command /usr/local/vtn/bin/drvodc_control loglevel trace
48 Execute Command /usr/local/vtn/bin/lgcnw_control loglevel trace
52 [Documentation] Exit the Launch Test
53 Log Stop the Launch Test
56 [Documentation] Start the VTNCo Test
57 Create Session session http://${MININET}:8083 headers=${VTNC_HEADERS}
60 [Documentation] Exit the VtnCo Test
63 Get Coordinator Version
64 [Documentation] Get API version for testing
65 ${resp} RequestsLibrary.Get session ${VTNWEBAPI}/api_version
66 Should Be Equal As Strings ${resp.status_code} 200
69 [Arguments] ${ctrlname} ${ctrlip}
70 [Documentation] Create a controller
71 ${controllerinfo} Create Dictionary controller_id=${ctrlname} type=odc ipaddr=${CONTROLLER} version=1.0
72 ${controllercreate} Create Dictionary controller=${controllerinfo}
73 ${controllercreate_json}= json.dumps ${controllercreate}
74 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${CTRLS_CREATE} data=${controllercreate_json}
75 Should Be Equal As Strings ${resp.status_code} 201
78 [Arguments] ${ctrlname}
79 [Documentation] Delete a Controller
80 ${resp} RequestsLibrary.Delete session ${VTNWEBAPI}/${CTRLS}/${ctrlname}.json
81 Should Be Equal As Strings ${resp.status_code} 204
84 [Arguments] ${ctrlname} ${ctrlip} ${desc}
85 [Documentation] Update controller
86 ${controllerinfo} Create Dictionary description=${desc} ipaddr=${ctrlip} version=1.0
87 ${controllerupdate} Create Dictionary controller=${controllerinfo}
88 ${controllerupdate_json}= json.dumps ${controllerupdate}
89 ${resp} RequestsLibrary.Put session ${VTNWEBAPI}/${CTRLS}/${ctrlname}.json data=${controllerupdate_json}
90 Should Be Equal As Strings ${resp.status_code} 204
93 [Arguments] ${ctrlname}
94 [Documentation] Trigger Manual Audit
95 ${auditinfo} Create Dictionary force=false real-network_audit=false
96 ${auditupdate} Create Dictionary audit=${auditinfo}
97 ${auditupdate_json}= json.dumps ${auditupdate}
98 ${resp} RequestsLibrary.Put session ${VTNWEBAPI}/${CTRLS}/${ctrlname}/audit.json data=${auditupdate_json}
99 Should Be Equal As Strings ${resp.status_code} 204
101 Check Controller Status
102 [Arguments] ${ctrlname} ${stat}
103 [Documentation] Get controller status
104 ${resp} RequestsLibrary.Get session ${VTNWEBAPI}/${CTRLS}/${ctrlname}.json
105 ${contents} To JSON ${resp.content}
106 ${controllerblock} Get From Dictionary ${contents} controller
107 ${status} Get From Dictionary ${controllerblock} operstatus
108 Should Be Equal As Strings ${status} ${stat}
111 [Arguments] ${vtnname} ${vtndescription}
112 [Documentation] Create VTN in Coordinator
113 ${vtninfo} Create Dictionary vtn_name=${vtnname} description=${vtndescription}
114 ${vtncreate} Create Dictionary vtn=${vtninfo}
115 ${vtncreate_json}= json.dumps ${vtncreate}
116 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${VTNS_CREATE} data=${vtncreate_json}
117 Should Be Equal As Strings ${resp.status_code} 201
120 [Arguments] ${vtnname}
121 [Documentation] Delete a VTN Created
122 ${resp} RequestsLibrary.Delete session ${VTNWEBAPI}/${VTNS}/${vtnname}.json
123 Should Be Equal As Strings ${resp.status_code} 204
126 [Arguments] ${vtnname} ${vbrname} ${ctrlname}
127 [Documentation] Create VBR for VTN in Coordinator
128 ${vbrinfo} Create Dictionary vbr_name=${vbrname} controller_id=${ctrlname} domain_id=(DEFAULT)
129 ${vbrcreate} Create Dictionary vbridge=${vbrinfo}
130 ${vbrcreate_json}= json.dumps ${vbrcreate}
131 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS_CREATE} data=${vbrcreate_json}
132 Should Be Equal As Strings ${resp.status_code} 201
135 [Arguments] ${vtnname} ${vbrname} ${vbrifname} ${ifdescription} ${retcode}
136 [Documentation] Create VBR Interface in VBR
137 ${vbrifinfo} Create Dictionary if_name=${vbrifname} description=${ifdescription}
138 ${vbrifcreate} Create Dictionary interface=${vbrifinfo}
139 ${vbrifcreate_json}= json.dumps ${vbrifcreate}
140 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VBRIFS_CREATE} data=${vbrifcreate_json}
141 Should Be Equal As Strings ${resp.status_code} ${retcode}
143 Define Portmap for VBRIF
144 [Arguments] ${vtnname} ${vbrname} ${vbrifname} ${logical_port_id}
145 [Documentation] Map Interface to a logical port
146 ${logical_port_info} Create Dictionary logical_port_id=${logical_port_id}
147 ${portmapdefine} Create Dictionary portmap=${logical_port_info}
148 ${portmapdefine_json}= json.dumps ${portmapdefine}
149 ${resp} RequestsLibrary.Put session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VBRIFS}/${vbrifname}/${PORTMAP_CREATE} data=${portmapdefine_json}
150 Should Be Equal As Strings ${resp.status_code} 204
153 [Arguments] ${flowlistname} ${ipversion}
154 [Documentation] Create FLOWLIST in Coordinator
155 ${flowlistinfo} Create Dictionary fl_name=${flowlistname} ip_version=${ipversion}
156 ${flowlistcreate} Create Dictionary flowlist=${flowlistinfo}
157 ${flowlistcreate_json}= json.dumps ${flowlistcreate}
158 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${FLOWLISTS_CREATE} data=${flowlistcreate_json}
159 Should Be Equal As Strings ${resp.status_code} 201
162 [Arguments] ${flowlistname}
163 [Documentation] Create Flowlistentry for Coordinator
164 ${flowlistentryinfo} Create Dictionary seqnum=233 macethertype=0x800 ipdstaddr=10.0.0.1 ipdstaddrprefix=32 ipsrcaddr=10.0.0.3
165 ... ipsrcaddrprefix=32 ipproto=1
166 ${flowlistentrycreate} Create Dictionary flowlistentry=${flowlistentryinfo}
167 ${flowlistentrycreate_json}= json.dumps ${flowlistentrycreate}
168 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${FLOWLISTS}/${flowlistname}/${FLOWLISTENTRIES_CREATE} data=${flowlistentrycreate_json}
169 Should Be Equal As Strings ${resp.status_code} 201
171 Create FLOWLISTENTRY_ANY in FLOWLIST
172 [Arguments] ${flowlistname}
173 [Documentation] Create Flowlistentry_any for Coordinator
174 ${flowlistentryinfo} Create Dictionary seqnum=1
175 ${flowlistentrycreate} Create Dictionary flowlistentry=${flowlistentryinfo}
176 ${flowlistentrycreate_json}= json.dumps ${flowlistentrycreate}
177 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${FLOWLISTS}/${flowlistname}/${FLOWLISTENTRIES_CREATE} data=${flowlistentrycreate_json}
178 Should Be Equal As Strings ${resp.status_code} 201
180 Create VBRIF in FLOWFILTER
181 [Arguments] ${vtnname} ${vbrname} ${vbrifname} ${ff_type}
182 [Documentation] create vbridge interface flowfilter
183 ${flowfilters_info} Create Dictionary ff_type=${ff_type}
184 ${flowfiltersdefine} Create Dictionary flowfilter=${flowfilters_info}
185 ${flowfiltersdefine_json}= json.dumps ${flowfiltersdefine}
186 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VBRIFS}/${vbrifname}/${FLOWFILTERS_CREATE} data=${flowfiltersdefine_json}
187 Should Be Equal As Strings ${resp.status_code} 201
189 Create FLOWFILTERENTRY DROP In VBRIFFLOWFILTER
190 [Arguments] ${vtnname} ${vbrname} ${vbrifname} ${actiontype}
191 [Documentation] create domonstration with pass actiontype
192 ${flowfilterentryinfo} Create Dictionary seqnum=233 fl_name=Flowlist1 action_type=${actiontype} priority=3 dscp=55
193 ${flowfilterentrycreate} Create Dictionary flowfilterentry=${flowfilterentryinfo}
194 ${flowfilterentrycreate_json}= json.dumps ${flowfilterentrycreate}
195 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VBRIFS}/${vbrifname}/${FLOWFILTERS}/${FLOWFILTERENTRIES_CREATE} data=${flowfilterentrycreate_json}
196 Should Be Equal As Strings ${resp.status_code} 201
198 Create FLOWFILTERENTRY PASS In VBRIFFLOWFILTER
199 [Arguments] ${vtnname} ${vbrname} ${vbrifname} ${actiontype} ${seqnum}
200 [Documentation] create domonstration with pass actiontype
201 ${flowfilterentryinfo} Create Dictionary fl_name=Flowlist1 action_type=${actiontype} priority=3 dscp=55
202 ${flowfilterentrycreate} Create Dictionary flowfilterentry=${flowfilterentryinfo}
203 ${flowfilterentrycreate_json}= json.dumps ${flowfilterentrycreate}
204 ${resp} RequestsLibrary.Put session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VBRIFS}/${vbrifname}/${FLOWFILTERS}/${FLOWFILTERS_UPDATE}/${seqnum} data=${flowfilterentrycreate_json}
205 Should Be Equal As Strings ${resp.status_code} 204
207 Create FLOWFILTER in VBR
208 [Arguments] ${vtnname} ${vbrname} ${ff_type}
209 [Documentation] create vtn flowfilter
210 ${flowfilters_info} Create Dictionary ff_type=${ff_type}
211 ${flowfiltersdefine} Create Dictionary flowfilter=${flowfilters_info}
212 ${flowfiltersdefine_json}= json.dumps ${flowfiltersdefine}
213 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${FLOWFILTERS_CREATE} data=${flowfiltersdefine_json}
214 Should Be Equal As Strings ${resp.status_code} 201
216 Create FLOWFILTERENTRY PASS in VBRFLOWFILTER
217 [Arguments] ${vtnname} ${vbrname} ${actiontype}
218 [Documentation] create domonstration with pass actiontype
219 ${flowfilterentryinfo} Create Dictionary seqnum=233 fl_name=Flowlist1 action_type=${actiontype} priority=3 dscp=55
220 ${flowfilterentryinfo_1} Create Dictionary vnode_name=${vbrname} fl_name=Flowlist1 direction=in
221 ${flowfilterentrycreate} Create Dictionary flowfilterentry=${flowfilterentryinfo}
222 ${flowfilterentrycreate_json}= json.dumps ${flowfilterentrycreate}
223 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${FLOWFILTERS}/${FLOWFILTERENTRIES_CREATE} data=${flowfilterentrycreate_json}
224 Should Be Equal As Strings ${resp.status_code} 201
226 Create FLOWFILTER in VTN
227 [Arguments] ${vtnname} ${ff_type}
228 [Documentation] create vtn flowfilter
229 ${flowfilters_info} Create Dictionary ff_type=${ff_type}
230 ${flowfiltersdefine} Create Dictionary flowfilter=${flowfilters_info}
231 ${flowfiltersdefine_json}= json.dumps ${flowfiltersdefine}
232 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${VTNS}/${vtnname}/${FLOWFILTERS_CREATE} data=${flowfiltersdefine_json}
233 Should Be Equal As Strings ${resp.status_code} 201
235 Create FLOWFILTERENTRY PASS in VTNFLOWFILTER
236 [Arguments] ${vtnname} ${actiontype}
237 [Documentation] create domonstration with pass actiontype
238 ${flowfilterentryinfo} Create Dictionary seqnum=233 fl_name=Flowlist1 action_type=${actiontype} priority=3 dscp=55
239 ${flowfilterentrycreate} Create Dictionary flowfilterentry=${flowfilterentryinfo}
240 ${flowfilterentrycreate_json}= json.dumps ${flowfilterentrycreate}
241 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${VTNS}/${vtnname}/${FLOWFILTERS}/${FLOWFILTERENTRIES_CREATE} data=${flowfilterentrycreate_json}
242 Should Be Equal As Strings ${resp.status_code} 201
244 Create VLANMAP in VBRIDGE
245 [Arguments] ${vtnname} ${vbrname} ${vlanid}
246 [Documentation] Create VLANMAP for VBRIDGE in Coordinator
247 ${vlaninfo} Create Dictionary vlan_id=${vlanid}
248 ${vlancreate} Create Dictionary vlanmap=${vlaninfo}
249 ${vlancreate_json}= json.dumps ${vlancreate}
250 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VLANMAP_CREATE } data=${vlancreate_json}
251 Should Be Equal As Strings ${resp.status_code} 201
254 [Documentation] This will start mininet with custom topology on both the Virtual Machines
255 Start Mininet ${MININET} ${vlan_topo} ${CURDIR}/${CREATE_VLAN_TOPOLOGY_FILE_PATH}
258 [Arguments] ${flowlistname}
259 [Documentation] Delete a Flowlist
260 ${resp} RequestsLibrary.Delete session ${VTNWEBAPI}/${FLOWLISTS}/${flowlistname}.json
261 Should Be Equal As Strings ${resp.status_code} 204
264 [Arguments] ${host1} ${host2}
265 [Documentation] Ping hosts to check connectivity
266 Write ${host1} ping -c 4 ${host2}
267 ${result} Read Until mininet>
268 Should Contain ${result} 64 bytes
271 [Arguments] ${ctrlname} ${switch_id}
272 [Documentation] Get switch
273 ${resp} RequestsLibrary.Get session ${VTNWEBAPI}/${CTRLS}/${ctrlname}/${SW}/${switch_id}.json
274 ${contents} To JSON ${resp.content}
275 ${switchblock} Get From Dictionary ${contents} switch
276 ${status} Get From Dictionary ${switchblock} switch_id
277 Should Be Equal As Strings ${status} ${switch_id}
280 [Arguments] ${ctrlname} ${switch_id}
281 [Documentation] Get switch
282 ${resp} RequestsLibrary.Get session ${VTNWEBAPI}/${CTRLS}/${ctrlname}/${SW}/${switch_id}/${PORTS}
283 Should Be Equal As Strings ${resp.status_code} 200