5 Library RequestsLibrary
10 Variables ../variables/Variables.py
11 Resource ./Utils.robot
14 ${vlan_topo} sudo mn --controller=remote,ip=${ODL_SYSTEM_IP} --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 ${ODL_SYSTEM_IP}
21 SSHLibrary.Login_With_Public_Key ${ODL_SYSTEM_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 ${TOOLS_SYSTEM_IP}
26 SSHLibrary.Login_With_Public_Key ${TOOLS_SYSTEM_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}= SSHLibrary.Open Connection ${ODL_SYSTEM_IP} prompt=${DEFAULT_LINUX_PROMPT} timeout=30s
35 Set Suite Variable ${vtnc_conn_id}
36 SSHLibrary.Login_With_Public_Key ${ODL_SYSTEM_USER} ${USER_HOME}/.ssh/${SSH_KEY} any
37 SSHLibrary.Execute Command sudo mkdir -p /usr/local/vtn
38 SSHLibrary.Execute Command sudo chown jenkins /usr/local/vtn
39 SSHLibrary.Execute Command sudo yum install -q -y http://yum.postgresql.org/9.3/redhat/rhel-7-x86_64/pgdg-centos93-9.3-1.noarch.rpm
40 SSHLibrary.Execute Command sudo yum install -q -y postgresql93-libs postgresql93 postgresql93-server postgresql93-contrib postgresql93-odbc-09.03.0400
41 SSHLibrary.Execute Command tar -C/ -jxvf ${WORKSPACE}/${BUNDLEFOLDER}/externalapps/*vtn-coordinator*-bin.tar.bz2
42 SSHLibrary.Execute Command /usr/local/vtn/sbin/db_setup
43 SSHLibrary.Execute Command /usr/local/vtn/bin/vtn_start
44 SSHLibrary.Execute Command /usr/local/vtn/bin/unc_dmctl status
45 SSHLibrary.Execute Command /usr/local/vtn/sbin/db_setup
46 SSHLibrary.Execute Command sed -i 's/odcdrv_ping_interval = 30/odcdrv_ping_interval = 10/g' /usr/local/vtn/modules/odcdriver.conf
47 SSHLibrary.Execute Command sed -i 's/physical_attributes_read_interval = 40/physical_attributes_read_interval = 15/g' /usr/local/vtn/modules/vtndrvintf.conf
48 SSHLibrary.Execute Command /usr/local/vtn/bin/vtn_start
49 SSHLibrary.Execute Command /usr/local/vtn/bin/unc_dmctl status
50 SSHLibrary.Execute Command /usr/local/vtn/bin/drvodc_control loglevel trace
51 SSHLibrary.Execute Command /usr/local/vtn/bin/lgcnw_control loglevel trace
52 SSHLibrary.Execute Command exit
55 [Documentation] Exit the Launch Test
56 Log Stop the Launch Test
59 [Documentation] Start the VTNCo Test
60 Create Session session http://${ODL_SYSTEM_IP}:8083 headers=${VTNC_HEADERS}
63 [Documentation] Exit the VtnCo Test
66 Get Coordinator Version
67 [Documentation] Get API version for testing
68 ${resp} RequestsLibrary.Get Request session ${VTNWEBAPI}/api_version
69 Should Be Equal As Strings ${resp.status_code} 200
72 [Arguments] ${ctrlname} ${ctrlip}
73 [Documentation] Create a controller
74 ${controllerinfo} Create Dictionary controller_id=${ctrlname} type=odc ipaddr=${ctrlip} version=1.0
75 ${controllercreate} Create Dictionary controller=${controllerinfo}
76 ${controllercreate_json}= json.dumps ${controllercreate}
77 ${resp} RequestsLibrary.Post Request session ${VTNWEBAPI}/${CTRLS_CREATE} data=${controllercreate_json}
78 Should Be Equal As Strings ${resp.status_code} 201
81 [Arguments] ${ctrlname}
82 [Documentation] Delete a Controller
83 ${resp} RequestsLibrary.Delete Request session ${VTNWEBAPI}/${CTRLS}/${ctrlname}.json
84 Should Be Equal As Strings ${resp.status_code} 204
87 [Arguments] ${ctrlname} ${ctrlip} ${desc}
88 [Documentation] Update controller
89 ${controllerinfo} Create Dictionary description=${desc} ipaddr=${ctrlip} version=1.0
90 ${controllerupdate} Create Dictionary controller=${controllerinfo}
91 ${controllerupdate_json}= json.dumps ${controllerupdate}
92 ${resp} RequestsLibrary.Put Request session ${VTNWEBAPI}/${CTRLS}/${ctrlname}.json data=${controllerupdate_json}
93 Should Be Equal As Strings ${resp.status_code} 204
96 [Arguments] ${ctrlname}
97 [Documentation] Trigger Manual Audit
98 ${auditinfo} Create Dictionary force=false real-network_audit=false
99 ${auditupdate} Create Dictionary audit=${auditinfo}
100 ${auditupdate_json}= json.dumps ${auditupdate}
101 ${resp} RequestsLibrary.Put Request session ${VTNWEBAPI}/${CTRLS}/${ctrlname}/audit.json data=${auditupdate_json}
102 Should Be Equal As Strings ${resp.status_code} 204
104 Check Controller Status
105 [Arguments] ${ctrlname} ${stat}
106 [Documentation] Get controller status
107 ${resp} RequestsLibrary.Get Request session ${VTNWEBAPI}/${CTRLS}/${ctrlname}.json
108 ${contents} To JSON ${resp.content}
109 ${controllerblock} Get From Dictionary ${contents} controller
110 ${status} Get From Dictionary ${controllerblock} operstatus
111 Should Be Equal As Strings ${status} ${stat}
114 [Arguments] ${vtnname} ${vtndescription}
115 [Documentation] Create VTN in Coordinator
116 ${vtninfo} Create Dictionary vtn_name=${vtnname} description=${vtndescription}
117 ${vtncreate} Create Dictionary vtn=${vtninfo}
118 ${vtncreate_json}= json.dumps ${vtncreate}
119 ${resp} RequestsLibrary.Post Request session ${VTNWEBAPI}/${VTNS_CREATE} data=${vtncreate_json}
120 Should Be Equal As Strings ${resp.status_code} 201
123 [Arguments] ${vtnname}
124 [Documentation] Delete a VTN Created
125 ${resp} RequestsLibrary.Delete Request session ${VTNWEBAPI}/${VTNS}/${vtnname}.json
126 Should Be Equal As Strings ${resp.status_code} 204
129 [Arguments] ${vtnname} ${vbrname} ${ctrlname}
130 [Documentation] Create VBR for VTN in Coordinator
131 ${vbrinfo} Create Dictionary vbr_name=${vbrname} controller_id=${ctrlname} domain_id=(DEFAULT)
132 ${vbrcreate} Create Dictionary vbridge=${vbrinfo}
133 ${vbrcreate_json}= json.dumps ${vbrcreate}
134 ${resp} RequestsLibrary.Post Request session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS_CREATE} data=${vbrcreate_json}
135 Run Keyword If '${vbrname}' == 'Vbr_audit' Should Be Equal As Strings ${resp.status_code} 202
136 ... ELSE Should Be Equal As Strings ${resp.status_code} 201
139 [Arguments] ${vtnname} ${vbrname} ${vbrifname} ${ifdescription} ${retcode}
140 [Documentation] Create VBR Interface in VBR
141 ${vbrifinfo} Create Dictionary if_name=${vbrifname} description=${ifdescription}
142 ${vbrifcreate} Create Dictionary interface=${vbrifinfo}
143 ${vbrifcreate_json}= json.dumps ${vbrifcreate}
144 ${resp} RequestsLibrary.Post Request session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VBRIFS_CREATE} data=${vbrifcreate_json}
145 Should Be Equal As Strings ${resp.status_code} ${retcode}
147 Define Portmap for VBRIF
148 [Arguments] ${vtnname} ${vbrname} ${vbrifname} ${logical_port_id}
149 [Documentation] Map Interface to a logical port
150 ${logical_port_info} Create Dictionary logical_port_id=${logical_port_id}
151 ${portmapdefine} Create Dictionary portmap=${logical_port_info}
152 ${portmapdefine_json}= json.dumps ${portmapdefine}
153 ${resp} RequestsLibrary.Put Request session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VBRIFS}/${vbrifname}/${PORTMAP_CREATE} data=${portmapdefine_json}
154 Should Be Equal As Strings ${resp.status_code} 204
157 [Arguments] ${flowlistname} ${ipversion}
158 [Documentation] Create FLOWLIST in Coordinator
159 ${flowlistinfo} Create Dictionary fl_name=${flowlistname} ip_version=${ipversion}
160 ${flowlistcreate} Create Dictionary flowlist=${flowlistinfo}
161 ${flowlistcreate_json}= json.dumps ${flowlistcreate}
162 ${resp} RequestsLibrary.Post Request session ${VTNWEBAPI}/${FLOWLISTS_CREATE} data=${flowlistcreate_json}
163 Should Be Equal As Strings ${resp.status_code} 201
166 [Arguments] ${flowlistname}
167 [Documentation] Create Flowlistentry for Coordinator
168 ${flowlistentryinfo} Create Dictionary seqnum=233 macethertype=0x800 ipdstaddr=10.0.0.1 ipdstaddrprefix=32 ipsrcaddr=10.0.0.3
169 ... ipsrcaddrprefix=32 ipproto=1
170 ${flowlistentrycreate} Create Dictionary flowlistentry=${flowlistentryinfo}
171 ${flowlistentrycreate_json}= json.dumps ${flowlistentrycreate}
172 ${resp} RequestsLibrary.Post Request session ${VTNWEBAPI}/${FLOWLISTS}/${flowlistname}/${FLOWLISTENTRIES_CREATE} data=${flowlistentrycreate_json}
173 Should Be Equal As Strings ${resp.status_code} 201
175 Create FLOWLISTENTRY_ANY in FLOWLIST
176 [Arguments] ${flowlistname}
177 [Documentation] Create Flowlistentry_any for Coordinator
178 ${flowlistentryinfo} Create Dictionary seqnum=1
179 ${flowlistentrycreate} Create Dictionary flowlistentry=${flowlistentryinfo}
180 ${flowlistentrycreate_json}= json.dumps ${flowlistentrycreate}
181 ${resp} RequestsLibrary.Post Request session ${VTNWEBAPI}/${FLOWLISTS}/${flowlistname}/${FLOWLISTENTRIES_CREATE} data=${flowlistentrycreate_json}
182 Should Be Equal As Strings ${resp.status_code} 201
184 Create VBRIF in FLOWFILTER
185 [Arguments] ${vtnname} ${vbrname} ${vbrifname} ${ff_type}
186 [Documentation] create vbridge interface flowfilter
187 ${flowfilters_info} Create Dictionary ff_type=${ff_type}
188 ${flowfiltersdefine} Create Dictionary flowfilter=${flowfilters_info}
189 ${flowfiltersdefine_json}= json.dumps ${flowfiltersdefine}
190 ${resp} RequestsLibrary.Post Request session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VBRIFS}/${vbrifname}/${FLOWFILTERS_CREATE} data=${flowfiltersdefine_json}
191 Should Be Equal As Strings ${resp.status_code} 201
193 Create FLOWFILTERENTRY DROP In VBRIFFLOWFILTER
194 [Arguments] ${vtnname} ${vbrname} ${vbrifname} ${actiontype}
195 [Documentation] create domonstration with pass actiontype
196 ${flowfilterentryinfo} Create Dictionary seqnum=233 fl_name=Flowlist1 action_type=${actiontype} priority=3 dscp=55
197 ${flowfilterentrycreate} Create Dictionary flowfilterentry=${flowfilterentryinfo}
198 ${flowfilterentrycreate_json}= json.dumps ${flowfilterentrycreate}
199 ${resp} RequestsLibrary.Post Request session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VBRIFS}/${vbrifname}/${FLOWFILTERS}/${FLOWFILTERENTRIES_CREATE} data=${flowfilterentrycreate_json}
200 Should Be Equal As Strings ${resp.status_code} 201
202 Create FLOWFILTERENTRY PASS In VBRIFFLOWFILTER
203 [Arguments] ${vtnname} ${vbrname} ${vbrifname} ${actiontype} ${seqnum}
204 [Documentation] create domonstration with pass actiontype
205 ${flowfilterentryinfo} Create Dictionary fl_name=Flowlist1 action_type=${actiontype} priority=3 dscp=55
206 ${flowfilterentrycreate} Create Dictionary flowfilterentry=${flowfilterentryinfo}
207 ${flowfilterentrycreate_json}= json.dumps ${flowfilterentrycreate}
208 ${resp} RequestsLibrary.Put Request session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VBRIFS}/${vbrifname}/${FLOWFILTERS}/${FLOWFILTERS_UPDATE}/${seqnum} data=${flowfilterentrycreate_json}
209 Should Be Equal As Strings ${resp.status_code} 204
211 Create FLOWFILTER in VBR
212 [Arguments] ${vtnname} ${vbrname} ${ff_type}
213 [Documentation] create vtn flowfilter
214 ${flowfilters_info} Create Dictionary ff_type=${ff_type}
215 ${flowfiltersdefine} Create Dictionary flowfilter=${flowfilters_info}
216 ${flowfiltersdefine_json}= json.dumps ${flowfiltersdefine}
217 ${resp} RequestsLibrary.Post Request session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${FLOWFILTERS_CREATE} data=${flowfiltersdefine_json}
218 Should Be Equal As Strings ${resp.status_code} 201
220 Create FLOWFILTERENTRY PASS in VBRFLOWFILTER
221 [Arguments] ${vtnname} ${vbrname} ${actiontype}
222 [Documentation] create domonstration with pass actiontype
223 ${flowfilterentryinfo} Create Dictionary seqnum=233 fl_name=Flowlist1 action_type=${actiontype} priority=3 dscp=55
224 ${flowfilterentryinfo_1} Create Dictionary vnode_name=${vbrname} fl_name=Flowlist1 direction=in
225 ${flowfilterentrycreate} Create Dictionary flowfilterentry=${flowfilterentryinfo}
226 ${flowfilterentrycreate_json}= json.dumps ${flowfilterentrycreate}
227 ${resp} RequestsLibrary.Post Request session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${FLOWFILTERS}/${FLOWFILTERENTRIES_CREATE} data=${flowfilterentrycreate_json}
228 Should Be Equal As Strings ${resp.status_code} 201
230 Create FLOWFILTER in VTN
231 [Arguments] ${vtnname} ${ff_type}
232 [Documentation] create vtn flowfilter
233 ${flowfilters_info} Create Dictionary ff_type=${ff_type}
234 ${flowfiltersdefine} Create Dictionary flowfilter=${flowfilters_info}
235 ${flowfiltersdefine_json}= json.dumps ${flowfiltersdefine}
236 ${resp} RequestsLibrary.Post Request session ${VTNWEBAPI}/${VTNS}/${vtnname}/${FLOWFILTERS_CREATE} data=${flowfiltersdefine_json}
237 Should Be Equal As Strings ${resp.status_code} 201
239 Create FLOWFILTERENTRY PASS in VTNFLOWFILTER
240 [Arguments] ${vtnname} ${actiontype}
241 [Documentation] create domonstration with pass actiontype
242 ${flowfilterentryinfo} Create Dictionary seqnum=233 fl_name=Flowlist1 action_type=${actiontype} priority=3 dscp=55
243 ${flowfilterentrycreate} Create Dictionary flowfilterentry=${flowfilterentryinfo}
244 ${flowfilterentrycreate_json}= json.dumps ${flowfilterentrycreate}
245 ${resp} RequestsLibrary.Post Request session ${VTNWEBAPI}/${VTNS}/${vtnname}/${FLOWFILTERS}/${FLOWFILTERENTRIES_CREATE} data=${flowfilterentrycreate_json}
246 Should Be Equal As Strings ${resp.status_code} 201
248 Create VLANMAP in VBRIDGE
249 [Arguments] ${vtnname} ${vbrname} ${vlanid}
250 [Documentation] Create VLANMAP for VBRIDGE in Coordinator
251 ${vlaninfo} Create Dictionary vlan_id=${vlanid}
252 ${vlancreate} Create Dictionary vlanmap=${vlaninfo}
253 ${vlancreate_json}= json.dumps ${vlancreate}
254 ${resp} RequestsLibrary.Post Request session ${VTNWEBAPI}/${VTNS}/${vtnname}/${VBRS}/${vbrname}/${VLANMAP_CREATE } data=${vlancreate_json}
255 Should Be Equal As Strings ${resp.status_code} 201
258 [Documentation] This will start mininet with custom topology on both the Virtual Machines
259 Install Package On Ubuntu System vlan
260 Start Mininet ${TOOLS_SYSTEM_IP} ${vlan_topo} ${CURDIR}/${CREATE_VLAN_TOPOLOGY_FILE_PATH}
263 [Arguments] ${flowlistname}
264 [Documentation] Delete a Flowlist
265 ${resp} RequestsLibrary.Delete Request session ${VTNWEBAPI}/${FLOWLISTS}/${flowlistname}.json
266 Should Be Equal As Strings ${resp.status_code} 204
269 [Arguments] ${host1} ${host2}
270 [Documentation] Ping hosts to check connectivity
271 Write ${host1} ping -c 1 ${host2}
272 ${result} Read Until mininet>
273 Should Contain ${result} 64 bytes
276 [Arguments] ${ctrlname} ${switch_id}
277 [Documentation] Get switch
278 ${resp} RequestsLibrary.Get Request session ${VTNWEBAPI}/${CTRLS}/${ctrlname}/${SW}/${switch_id}.json
279 ${contents} To JSON ${resp.content}
280 ${switchblock} Get From Dictionary ${contents} switch
281 ${status} Get From Dictionary ${switchblock} switch_id
282 Should Be Equal As Strings ${status} ${switch_id}
285 [Arguments] ${ctrlname} ${switch_id}
286 [Documentation] Get switch
287 ${resp} RequestsLibrary.Get Request session ${VTNWEBAPI}/${CTRLS}/${ctrlname}/${SW}/${switch_id}/${PORTS}
288 Should Be Equal As Strings ${resp.status_code} 200