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
163 [Arguments] ${flowlistname}
164 [Documentation] Create Flowlistentry for Coordinator
165 ${flowlistentryinfo} Create Dictionary seqnum=233 macethertype=0x800 ipdstaddr=10.0.0.1 ipdstaddrprefix=32 ipsrcaddr=10.0.0.3 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
181 Create VBRIF in FLOWFILTER
182 [Arguments] ${vtnname} ${vbrname} ${vbrifname} ${ff_type}
183 [Documentation] create vbridge interface flowfilter
184 ${flowfilters_info} Create Dictionary ff_type=${ff_type}
185 ${flowfiltersdefine} Create Dictionary flowfilter=${flowfilters_info}
186 ${flowfiltersdefine_json}= json.dumps ${flowfiltersdefine}
187 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VBRIFS}/${vbrifname}/${FLOWFILTERS_CREATE} data=${flowfiltersdefine_json}
188 Should Be Equal As Strings ${resp.status_code} 201
190 Create FLOWFILTERENTRY DROP In VBRIFFLOWFILTER
191 [Arguments] ${vtnname} ${vbrname} ${vbrifname} ${actiontype}
192 [Documentation] create domonstration with pass actiontype
193 ${flowfilterentryinfo} Create Dictionary seqnum=233 fl_name=Flowlist1 action_type=${actiontype} priority=3 dscp=55
194 ${flowfilterentrycreate} Create Dictionary flowfilterentry=${flowfilterentryinfo}
195 ${flowfilterentrycreate_json}= json.dumps ${flowfilterentrycreate}
196 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VBRIFS}/${vbrifname}/${FLOWFILTERS}/${FLOWFILTERENTRIES_CREATE} data=${flowfilterentrycreate_json}
197 Should Be Equal As Strings ${resp.status_code} 201
199 Create FLOWFILTERENTRY PASS In VBRIFFLOWFILTER
200 [Arguments] ${vtnname} ${vbrname} ${vbrifname} ${actiontype} ${seqnum}
201 [Documentation] create domonstration with pass actiontype
202 ${flowfilterentryinfo} Create Dictionary fl_name=Flowlist1 action_type=${actiontype} priority=3 dscp=55
203 ${flowfilterentrycreate} Create Dictionary flowfilterentry=${flowfilterentryinfo}
204 ${flowfilterentrycreate_json}= json.dumps ${flowfilterentrycreate}
205 ${resp} RequestsLibrary.Put session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VBRIFS}/${vbrifname}/${FLOWFILTERS}/${FLOWFILTERS_UPDATE}/${seqnum} data=${flowfilterentrycreate_json}
206 Should Be Equal As Strings ${resp.status_code} 204
208 Create FLOWFILTER in VBR
209 [Arguments] ${vtnname} ${vbrname} ${ff_type}
210 [Documentation] create vtn flowfilter
211 ${flowfilters_info} Create Dictionary ff_type=${ff_type}
212 ${flowfiltersdefine} Create Dictionary flowfilter=${flowfilters_info}
213 ${flowfiltersdefine_json}= json.dumps ${flowfiltersdefine}
214 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${FLOWFILTERS_CREATE} data=${flowfiltersdefine_json}
215 Should Be Equal As Strings ${resp.status_code} 201
217 Create FLOWFILTERENTRY PASS in VBRFLOWFILTER
218 [Arguments] ${vtnname} ${vbrname} ${actiontype}
219 [Documentation] create domonstration with pass actiontype
220 ${flowfilterentryinfo} Create Dictionary seqnum=233 fl_name=Flowlist1 action_type=${actiontype} priority=3 dscp=55
221 ${flowfilterentryinfo_1} Create Dictionary vnode_name=${vbrname} fl_name=Flowlist1 direction=in
222 ${flowfilterentrycreate} Create Dictionary flowfilterentry=${flowfilterentryinfo}
223 ${flowfilterentrycreate_json}= json.dumps ${flowfilterentrycreate}
224 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${FLOWFILTERS}/${FLOWFILTERENTRIES_CREATE} data=${flowfilterentrycreate_json}
225 Should Be Equal As Strings ${resp.status_code} 201
227 Create FLOWFILTER in VTN
228 [Arguments] ${vtnname} ${ff_type}
229 [Documentation] create vtn flowfilter
230 ${flowfilters_info} Create Dictionary ff_type=${ff_type}
231 ${flowfiltersdefine} Create Dictionary flowfilter=${flowfilters_info}
232 ${flowfiltersdefine_json}= json.dumps ${flowfiltersdefine}
233 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${VTNS}/${vtnname}/${FLOWFILTERS_CREATE} data=${flowfiltersdefine_json}
234 Should Be Equal As Strings ${resp.status_code} 201
236 Create FLOWFILTERENTRY PASS in VTNFLOWFILTER
237 [Arguments] ${vtnname} ${actiontype}
238 [Documentation] create domonstration with pass actiontype
239 ${flowfilterentryinfo} Create Dictionary seqnum=233 fl_name=Flowlist1 action_type=${actiontype} priority=3 dscp=55
240 ${flowfilterentrycreate} Create Dictionary flowfilterentry=${flowfilterentryinfo}
241 ${flowfilterentrycreate_json}= json.dumps ${flowfilterentrycreate}
242 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${VTNS}/${vtnname}/${FLOWFILTERS}/${FLOWFILTERENTRIES_CREATE} data=${flowfilterentrycreate_json}
243 Should Be Equal As Strings ${resp.status_code} 201
246 Create VLANMAP in VBRIDGE
247 [Arguments] ${vtnname} ${vbrname} ${vlanid}
248 [Documentation] Create VLANMAP for VBRIDGE in Coordinator
249 ${vlaninfo} Create Dictionary vlan_id=${vlanid}
250 ${vlancreate} Create Dictionary vlanmap=${vlaninfo}
251 ${vlancreate_json}= json.dumps ${vlancreate}
252 ${resp} RequestsLibrary.Post session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VLANMAP_CREATE } data=${vlancreate_json}
253 Should Be Equal As Strings ${resp.status_code} 201
256 [Documentation] This will start mininet with custom topology on both the Virtual Machines
257 Start Mininet ${MININET} ${vlan_topo} ${CURDIR}/${CREATE_VLAN_TOPOLOGY_FILE_PATH}
261 [Arguments] ${flowlistname}
262 [Documentation] Delete a Flowlist
263 ${resp} RequestsLibrary.Delete session ${VTNWEBAPI}/${FLOWLISTS}/${flowlistname}.json
264 Should Be Equal As Strings ${resp.status_code} 204
267 [Arguments] ${host1} ${host2}
268 [Documentation] Ping hosts to check connectivity
269 Write ${host1} ping -c 4 ${host2}
270 ${result} Read Until mininet>
271 Should Contain ${result} 64 bytes
274 [Arguments] ${ctrlname} ${switch_id}
275 [Documentation] Get switch
276 ${resp} RequestsLibrary.Get session ${VTNWEBAPI}/${CTRLS}/${ctrlname}/${SW}/${switch_id}.json
277 ${contents} To JSON ${resp.content}
278 ${switchblock} Get From Dictionary ${contents} switch
279 ${status} Get From Dictionary ${switchblock} switch_id
280 Should Be Equal As Strings ${status} ${switch_id}
283 [Arguments] ${ctrlname} ${switch_id}
284 [Documentation] Get switch
285 ${resp} RequestsLibrary.Get session ${VTNWEBAPI}/${CTRLS}/${ctrlname}/${SW}/${switch_id}/${PORTS}
286 Should Be Equal As Strings ${resp.status_code} 200