blob: cbf783fc6980c393f5ea65e69874e2374077d773 [file] [log] [blame]
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001"""
2 Wrapper functions for FuncIntent
3 This functions include Onosclidriver and Mininetclidriver driver functions
4 Author: kelvin@onlab.us
5"""
6import time
7import copy
8import json
9
10def __init__( self ):
11 self.default = ''
12
Jeremy Songster1f39bf02016-01-20 17:17:25 -080013def installHostIntent( main,
Jeremy2f190ca2016-01-29 15:23:57 -080014 name,
15 host1,
16 host2,
17 onosNode=0,
18 ethType="",
19 bandwidth="",
20 lambdaAlloc=False,
21 ipProto="",
22 ipAddresses="",
23 tcp="",
24 sw1="",
Jeremy Songsterff553672016-05-12 17:06:23 -070025 sw2="",
Jeremy Songsterc032f162016-08-04 17:14:49 -070026 setVlan="",
27 encap="" ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -070028 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -080029 Installs a Host Intent
30
kelvin-onlab58dc39e2015-08-06 08:11:09 -070031 Description:
Jeremy Songster1f39bf02016-01-20 17:17:25 -080032 Install a host intent using
33 add-host-intent
34
kelvin-onlab58dc39e2015-08-06 08:11:09 -070035 Steps:
Jeremy Songster1f39bf02016-01-20 17:17:25 -080036 - Fetch host data if not given
37 - Add host intent
38 - Ingress device is the first sender host
39 - Egress devices are the recipient devices
40 - Ports if defined in senders or recipients
41 - MAC address ethSrc loaded from Ingress device
42 - Check intent state with retry
kelvin-onlab58dc39e2015-08-06 08:11:09 -070043 Required:
44 name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
Jeremy Songster1f39bf02016-01-20 17:17:25 -080045 host1 - Dictionary for host1
46 { "name":"h8", "id":"of:0000000000000005/8" }
47 host2 - Dictionary for host2
48 { "name":"h16", "id":"of:0000000000000006/8" }
kelvin-onlab58dc39e2015-08-06 08:11:09 -070049 Optional:
50 onosNode - ONOS node to install the intents in main.CLIs[ ]
51 0 by default so that it will always use the first
52 ONOS node
kelvin-onlab58dc39e2015-08-06 08:11:09 -070053 ethType - Ethernet type eg. IPV4, IPV6
kelvin-onlab58dc39e2015-08-06 08:11:09 -070054 bandwidth - Bandwidth capacity
55 lambdaAlloc - Allocate lambda, defaults to False
56 ipProto - IP protocol
Jeremy Songster1f39bf02016-01-20 17:17:25 -080057 tcp - TCP ports in the same order as the hosts in hostNames
58 """
59
60 assert main, "There is no main variable"
61 assert host1, "You must specify host1"
62 assert host2, "You must specify host2"
63
64 global itemName # The name of this run. Used for logs.
65 itemName = name
66 onosNode = int( onosNode )
67
68 main.log.info( itemName + ": Adding single point to multi point intents" )
Jeremyd9e4eb12016-04-13 12:09:06 -070069 try:
70 if not host1.get( "id" ):
71 main.log.warn( "ID not given for host1 {0}. Loading from main.hostData".format( host1.get( "name" ) ) )
72 main.log.debug( main.hostsData.get( host1.get( "name" ) ) )
73 host1[ "id" ] = main.hostsData.get( host1.get( "name" ) ).get( "id" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -080074
Jeremyd9e4eb12016-04-13 12:09:06 -070075 if not host2.get( "id" ):
76 main.log.warn( "ID not given for host2 {0}. Loading from main.hostData".format( host2.get( "name" ) ) )
77 host2[ "id" ] = main.hostsData.get( host2.get( "name" ) ).get( "id" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -080078
Jeremyd9e4eb12016-04-13 12:09:06 -070079 # Adding point intent
Jeremy Songster832f9e92016-05-05 14:30:49 -070080 vlanId = host1.get( "vlan" )
Jeremyd9e4eb12016-04-13 12:09:06 -070081 intentId = main.CLIs[ onosNode ].addHostIntent( hostIdOne=host1.get( "id" ),
Jeremy Songster832f9e92016-05-05 14:30:49 -070082 hostIdTwo=host2.get( "id" ),
Jeremy Songsterff553672016-05-12 17:06:23 -070083 vlanId=vlanId,
Jeremy Songsterc032f162016-08-04 17:14:49 -070084 setVlan=setVlan,
85 encap=encap )
Jeremyd9e4eb12016-04-13 12:09:06 -070086 except (KeyError, TypeError):
87 errorMsg = "There was a problem loading the hosts data."
88 if intentId:
89 errorMsg += " There was a problem installing host to host intent."
90 main.log.error( errorMsg )
91 return main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -080092
93 # Check intents state
94 if utilities.retry( f=checkIntentState, retValue=main.FALSE,
95 args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
96 return intentId
97 else:
Jeremy2f190ca2016-01-29 15:23:57 -080098 main.log.error( "Host Intent did not install correctly" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -080099 return main.FALSE
100
101def testHostIntent( main,
102 name,
103 intentId,
104 host1,
105 host2,
106 onosNode=0,
107 sw1="s5",
108 sw2="s2",
109 expectedLink=0):
110 """
111 Test a Host Intent
112
113 Description:
114 Test a host intent of given ID between given hosts
115
116 Steps:
117 - Fetch host data if not given
118 - Check Intent State
119 - Check Flow State
120 - Check Connectivity
121 - Check Lack of Connectivity Between Hosts not in the Intent
122 - Reroute
123 - Take Expected Link Down
124 - Check Intent State
125 - Check Flow State
126 - Check Topology
127 - Check Connectivity
128 - Bring Expected Link Up
129 - Check Intent State
130 - Check Flow State
131 - Check Topology
132 - Check Connectivity
133 - Remove Topology
134
135 Required:
136 name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
137 intentId - intent ID to be tested ( and removed )
138 host1 - Dictionary for host1
139 { "name":"h8", "id":"of:0000000000000005/8" }
140 host2 - Dictionary for host2
141 { "name":"h16", "id":"of:0000000000000006/8" }
142 Optional:
143 onosNode - ONOS node to install the intents in main.CLIs[ ]
144 0 by default so that it will always use the first
145 ONOS node
146 sw1 - First switch to bring down & up for rerouting purpose
147 sw2 - Second switch to bring down & up for rerouting purpose
148 expectedLink - Expected link when the switches are down, it should
149 be two links lower than the links before the two
150 switches are down
151
152 """
153
154 # Parameter Validity Check
155 assert main, "There is no main variable"
156 assert host1, "You must specify host1"
157 assert host2, "You must specify host2"
158
159 global itemName
160 itemName = name
161 tempHostsData = {}
162 onosNode = int( onosNode )
163
Jeremy2f190ca2016-01-29 15:23:57 -0800164 main.log.info( itemName + ": Testing Host Intent" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800165
Jeremyd9e4eb12016-04-13 12:09:06 -0700166 try:
167 if not host1.get( "id" ):
168 main.log.warn( "Id not given for host1 {0}. Loading from main.hostData".format( host1.get( "name" ) ) )
169 host1[ "id" ] = main.hostsData.get( host1.get( "name" ) ).get( "location" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800170
Jeremyd9e4eb12016-04-13 12:09:06 -0700171 if not host2.get( "id" ):
172 main.log.warn( "Id not given for host2 {0}. Loading from main.hostData".format( host2.get( "name" ) ) )
173 host2[ "id" ] = main.hostsData.get( host2.get( "name" ) ).get( "location" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800174
Jeremyd9e4eb12016-04-13 12:09:06 -0700175 senderNames = [ host1.get( "name" ), host2.get( "name" ) ]
176 recipientNames = [ host1.get( "name" ), host2.get( "name" ) ]
Jeremy Songster832f9e92016-05-05 14:30:49 -0700177 vlanId = host1.get( "vlan" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800178
Jeremyd9e4eb12016-04-13 12:09:06 -0700179 testResult = main.TRUE
180 except (KeyError, TypeError):
181 main.log.error( "There was a problem loading the hosts data." )
182 return main.FALSE
183
184 main.log.info( itemName + ": Testing Host to Host intents" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800185
186 # Check intent state
187 if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
188 main.assertReturnString += 'Initial Intent State Passed\n'
189 else:
190 main.assertReturnString += 'Initial Intent State Failed\n'
191 testResult = main.FALSE
192
193 # Check flows count in each node
Jeremy03dab012016-04-11 08:59:17 -0700194 if utilities.retry( f=checkFlowsCount, retValue=main.FALSE, args=[ main ], sleep=20, attempts=3 ) and utilities.retry( f=checkFlowsState, retValue=main.FALSE, args=[ main ], sleep=20, attempts=3 ):
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800195 main.assertReturnString += 'Initial Flow State Passed\n'
196 else:
197 main.assertReturnString += 'Intial Flow State Failed\n'
198 testResult = main.FALSE
199
200 # Check Connectivity
Jeremy Songster832f9e92016-05-05 14:30:49 -0700201 if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId ) ):
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800202 main.assertReturnString += 'Initial Ping Passed\n'
203 else:
204 main.assertReturnString += 'Initial Ping Failed\n'
205 testResult = main.FALSE
206
207 # Test rerouting if these variables exist
208 if sw1 and sw2 and expectedLink:
209 # Take link down
210 if utilities.retry( f=link, retValue=main.FALSE, args=( main, sw1, sw2, "down" ) ):
211 main.assertReturnString += 'Link Down Passed\n'
212 else:
213 main.assertReturnString += 'Link Down Failed\n'
214 testResult = main.FALSE
215
216 # Check intent state
217 if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
218 main.assertReturnString += 'Link Down Intent State Passed\n'
219 else:
220 main.assertReturnString += 'Link Down Intent State Failed\n'
221 testResult = main.FALSE
222
223 # Check flows count in each node
Jeremy03dab012016-04-11 08:59:17 -0700224 if utilities.retry( f=checkFlowsCount, retValue=main.FALSE, args=[ main ], sleep=20, attempts=3 ) and utilities.retry( f=checkFlowsState, retValue=main.FALSE, args=[ main ], sleep=20, attempts=3 ):
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800225 main.assertReturnString += 'Link Down Flow State Passed\n'
226 else:
227 main.assertReturnString += 'Link Down Flow State Failed\n'
228 testResult = main.FALSE
229
230 # Check OnosTopology
231 if utilities.retry( f=checkTopology, retValue=main.FALSE, args=( main, expectedLink ) ):
232 main.assertReturnString += 'Link Down Topology State Passed\n'
233 else:
234 main.assertReturnString += 'Link Down Topology State Failed\n'
235 testResult = main.FALSE
236
237 # Check Connection
Jeremy Songster832f9e92016-05-05 14:30:49 -0700238 if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId ) ):
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800239 main.assertReturnString += 'Link Down Pingall Passed\n'
240 else:
241 main.assertReturnString += 'Link Down Pingall Failed\n'
242 testResult = main.FALSE
243
244 # Bring link up
245 if utilities.retry( f=link, retValue=main.FALSE, args=( main, sw1, sw2, "up" ) ):
246 main.assertReturnString += 'Link Up Passed\n'
247 else:
248 main.assertReturnString += 'Link Up Failed\n'
249 testResult = main.FALSE
250
251 # Wait for reroute
252 time.sleep( main.rerouteSleep )
253
254 # Check Intents
255 if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
256 main.assertReturnString += 'Link Up Intent State Passed\n'
257 else:
258 main.assertReturnString += 'Link Up Intent State Failed\n'
259 testResult = main.FALSE
260
261 # Check flows count in each node
Jeremy03dab012016-04-11 08:59:17 -0700262 if utilities.retry( f=checkFlowsCount, retValue=main.FALSE, args=[ main ], sleep=20, attempts=3 ) and utilities.retry( f=checkFlowsState, retValue=main.FALSE, args=[ main ], sleep=20, attempts=3 ):
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800263 main.assertReturnString += 'Link Up Flow State Passed\n'
264 else:
265 main.assertReturnString += 'Link Up Flow State Failed\n'
266 testResult = main.FALSE
267
268 # Check OnosTopology
269 if utilities.retry( f=checkTopology, retValue=main.FALSE, args=( main, main.numLinks ) ):
270 main.assertReturnString += 'Link Up Topology State Passed\n'
271 else:
272 main.assertReturnString += 'Link Up Topology State Failed\n'
273 testResult = main.FALSE
274
275 # Check Connection
Jeremy Songster832f9e92016-05-05 14:30:49 -0700276 if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId ) ):
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800277 main.assertReturnString += 'Link Up Pingall Passed\n'
278 else:
279 main.assertReturnString += 'Link Up Pingall Failed\n'
280 testResult = main.FALSE
281
282 # Remove all intents
283 if utilities.retry( f=removeAllIntents, retValue=main.FALSE, args=( main, [ intentId ] ) ):
284 main.assertReturnString += 'Remove Intents Passed'
285 else:
286 main.assertReturnString += 'Remove Intents Failed'
287 testResult = main.FALSE
288
289 return testResult
290
291def installPointIntent( main,
292 name,
293 senders,
294 recipients,
295 onosNode=0,
296 ethType="",
297 bandwidth="",
298 lambdaAlloc=False,
299 ipProto="",
300 ipSrc="",
301 ipDst="",
302 tcpSrc="",
Jeremy Songsterff553672016-05-12 17:06:23 -0700303 tcpDst="",
Jeremy Songsterc032f162016-08-04 17:14:49 -0700304 setVlan="",
305 encap="" ):
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800306 """
307 Installs a Single to Single Point Intent
308
309 Description:
310 Install a single to single point intent
311
312 Steps:
313 - Fetch host data if not given
314 - Add point intent
315 - Ingress device is the first sender device
316 - Egress device is the first recipient device
317 - Ports if defined in senders or recipients
318 - MAC address ethSrc loaded from Ingress device
319 - Check intent state with retry
320 Required:
321 name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
322 senders - List of host dictionaries i.e.
323 [ { "name":"h8", "device":"of:0000000000000005/8","mac":"00:00:00:00:00:08" } ]
324 recipients - List of host dictionaries i.e.
325 [ { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" } ]
326 Optional:
327 onosNode - ONOS node to install the intents in main.CLIs[ ]
328 0 by default so that it will always use the first
329 ONOS node
330 ethType - Ethernet type eg. IPV4, IPV6
331 bandwidth - Bandwidth capacity
332 lambdaAlloc - Allocate lambda, defaults to False
333 ipProto - IP protocol
334 tcp - TCP ports in the same order as the hosts in hostNames
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700335 sw1 - First switch to bring down & up for rerouting purpose
336 sw2 - Second switch to bring down & up for rerouting purpose
337 expectedLink - Expected link when the switches are down, it should
338 be two links lower than the links before the two
339 switches are down
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700340 """
341
342 assert main, "There is no main variable"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800343 assert senders, "You must specify a sender"
344 assert recipients, "You must specify a recipient"
345 # Assert devices or main.hostsData, "You must specify devices"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700346
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800347 global itemName # The name of this run. Used for logs.
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700348 itemName = name
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700349 onosNode = int( onosNode )
350
Jeremy6f000c62016-02-25 17:02:28 -0800351 main.log.info( itemName + ": Adding point to point intents" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700352
Jeremyd9e4eb12016-04-13 12:09:06 -0700353 try:
354 for sender in senders:
355 if not sender.get( "device" ):
356 main.log.warn( "Device not given for sender {0}. Loading from main.hostData".format( sender.get( "name" ) ) )
357 sender[ "device" ] = main.hostsData.get( sender.get( "name" ) ).get( "location" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800358
Jeremyd9e4eb12016-04-13 12:09:06 -0700359 for recipient in recipients:
360 if not recipient.get( "device" ):
361 main.log.warn( "Device not given for recipient {0}. Loading from main.hostData".format( recipient.get( "name" ) ) )
362 recipient[ "device" ] = main.hostsData.get( recipient.get( "name" ) ).get( "location" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800363
364
Jeremyd9e4eb12016-04-13 12:09:06 -0700365 ingressDevice = senders[ 0 ].get( "device" )
366 egressDevice = recipients[ 0 ].get( "device" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800367
Jeremyd9e4eb12016-04-13 12:09:06 -0700368 portIngress = senders[ 0 ].get( "port", "" )
369 portEgress = recipients[ 0 ].get( "port", "" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800370
Jeremyd9e4eb12016-04-13 12:09:06 -0700371 dstMac = recipients[ 0 ].get( "mac" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800372
Jeremyd9e4eb12016-04-13 12:09:06 -0700373 ipSrc = senders[ 0 ].get( "ip" )
374 ipDst = recipients[ 0 ].get( "ip" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800375
Jeremy Songster832f9e92016-05-05 14:30:49 -0700376 vlanId = senders[ 0 ].get( "vlan" )
377
Jeremyd9e4eb12016-04-13 12:09:06 -0700378 # Adding point intent
379 intentId = main.CLIs[ onosNode ].addPointIntent(
380 ingressDevice=ingressDevice,
381 egressDevice=egressDevice,
382 portIngress=portIngress,
383 portEgress=portEgress,
384 ethType=ethType,
385 ethDst=dstMac,
386 bandwidth=bandwidth,
387 lambdaAlloc=lambdaAlloc,
388 ipProto=ipProto,
389 ipSrc=ipSrc,
390 ipDst=ipDst,
391 tcpSrc=tcpSrc,
Jeremy Songster832f9e92016-05-05 14:30:49 -0700392 tcpDst=tcpDst,
Jeremy Songsterff553672016-05-12 17:06:23 -0700393 vlanId=vlanId,
Jeremy Songsterc032f162016-08-04 17:14:49 -0700394 setVlan=setVlan,
395 encap=encap )
Jeremyd9e4eb12016-04-13 12:09:06 -0700396 except (KeyError, TypeError):
397 errorMsg = "There was a problem loading the hosts data."
398 if intentId:
399 errorMsg += " There was a problem installing Point to Point intent."
400 main.log.error( errorMsg )
401 return main.FALSE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700402
403 # Check intents state
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800404 if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
405 return intentId
acsmarsd4862d12015-10-06 17:57:34 -0700406 else:
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800407 main.log.error( "Point Intent did not install correctly" )
408 return main.FALSE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700409
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700410def pointIntentTcp( main,
411 name,
412 host1,
413 host2,
414 onosNode=0,
415 deviceId1="",
416 deviceId2="",
417 port1="",
418 port2="",
419 ethType="",
420 mac1="",
421 mac2="",
422 bandwidth="",
423 lambdaAlloc=False,
424 ipProto="",
425 ip1="",
426 ip2="",
427 tcp1="",
428 tcp2="",
429 sw1="",
430 sw2="",
431 expectedLink=0 ):
432
433 """
434 Description:
435 Verify add-point-intent only for TCP
436 Steps:
437 - Get device ids | ports
438 - Add point intents
439 - Check intents
440 - Verify flows
441 - Ping hosts
442 - Reroute
443 - Link down
444 - Verify flows
445 - Check topology
446 - Ping hosts
447 - Link up
448 - Verify flows
449 - Check topology
450 - Ping hosts
451 - Remove intents
452 Required:
453 name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
454 host1 - Name of first host
455 host2 - Name of second host
456 Optional:
457 onosNode - ONOS node to install the intents in main.CLIs[ ]
458 0 by default so that it will always use the first
459 ONOS node
460 deviceId1 - ONOS device id of the first switch, the same as the
461 location of the first host eg. of:0000000000000001/1,
462 located at device 1 port 1
463 deviceId2 - ONOS device id of the second switch
464 port1 - The port number where the first host is attached
465 port2 - The port number where the second host is attached
466 ethType - Ethernet type eg. IPV4, IPV6
467 mac1 - Mac address of first host
468 mac2 - Mac address of the second host
469 bandwidth - Bandwidth capacity
470 lambdaAlloc - Allocate lambda, defaults to False
471 ipProto - IP protocol
472 ip1 - IP address of first host
473 ip2 - IP address of second host
474 tcp1 - TCP port of first host
475 tcp2 - TCP port of second host
476 sw1 - First switch to bring down & up for rerouting purpose
477 sw2 - Second switch to bring down & up for rerouting purpose
478 expectedLink - Expected link when the switches are down, it should
479 be two links lower than the links before the two
480 switches are down
481 """
482
483 assert main, "There is no main variable"
484 assert name, "variable name is empty"
485 assert host1 and host2, "You must specify hosts"
486
487 global itemName
488 itemName = name
489 host1 = host1
490 host2 = host2
491 hostNames = [ host1, host2 ]
492 intentsId = []
493
494 iperfResult = main.TRUE
495 intentResult = main.TRUE
496 removeIntentResult = main.TRUE
497 flowResult = main.TRUE
498 topoResult = main.TRUE
499 linkDownResult = main.TRUE
500 linkUpResult = main.TRUE
501 onosNode = int( onosNode )
502
503 # Adding bidirectional point intents
504 main.log.info( itemName + ": Adding point intents" )
505 intent1 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId1,
506 egressDevice=deviceId2,
507 portIngress=port1,
508 portEgress=port2,
509 ethType=ethType,
510 ethSrc=mac1,
511 ethDst=mac2,
512 bandwidth=bandwidth,
513 lambdaAlloc=lambdaAlloc,
514 ipProto=ipProto,
515 ipSrc=ip1,
516 ipDst=ip2,
517 tcpSrc=tcp1,
518 tcpDst="" )
519
520 intent2 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId2,
521 egressDevice=deviceId1,
522 portIngress=port2,
523 portEgress=port1,
524 ethType=ethType,
525 ethSrc=mac2,
526 ethDst=mac1,
527 bandwidth=bandwidth,
528 lambdaAlloc=lambdaAlloc,
529 ipProto=ipProto,
530 ipSrc=ip2,
531 ipDst=ip1,
532 tcpSrc=tcp2,
533 tcpDst="" )
534
535 intent3 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId1,
536 egressDevice=deviceId2,
537 portIngress=port1,
538 portEgress=port2,
539 ethType=ethType,
540 ethSrc=mac1,
541 ethDst=mac2,
542 bandwidth=bandwidth,
543 lambdaAlloc=lambdaAlloc,
544 ipProto=ipProto,
545 ipSrc=ip1,
546 ipDst=ip2,
547 tcpSrc="",
548 tcpDst=tcp2 )
549
550 intent4 = main.CLIs[ onosNode ].addPointIntent( ingressDevice=deviceId2,
551 egressDevice=deviceId1,
552 portIngress=port2,
553 portEgress=port1,
554 ethType=ethType,
555 ethSrc=mac2,
556 ethDst=mac1,
557 bandwidth=bandwidth,
558 lambdaAlloc=lambdaAlloc,
559 ipProto=ipProto,
560 ipSrc=ip2,
561 ipDst=ip1,
562 tcpSrc="",
563 tcpDst=tcp1 )
564 intentsId.append( intent1 )
565 intentsId.append( intent2 )
566 intentsId.append( intent3 )
567 intentsId.append( intent4 )
568
569 # Check intents state
570 time.sleep( main.checkIntentSleep )
571 intentResult = checkIntentState( main, intentsId )
572 # Check flows count in each node
573 checkFlowsCount( main )
574
575 # Check intents state again if first check fails...
576 if not intentResult:
577 intentResult = checkIntentState( main, intentsId )
578
579 # Check flows count in each node
580 checkFlowsCount( main )
581
582 # Verify flows
583 checkFlowsState( main )
584
585 # Run iperf to both host
acsmarsd4862d12015-10-06 17:57:34 -0700586 iperfTemp = main.Mininet1.iperftcp( host1,host2,10 )
587 iperfResult = iperfResult and iperfTemp
588 if iperfTemp:
589 main.assertReturnString += 'Initial Iperf Passed\n'
590 else:
591 main.assertReturnString += 'Initial Iperf Failed\n'
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700592
593 # Test rerouting if these variables exist
594 if sw1 and sw2 and expectedLink:
595 # link down
596 linkDownResult = link( main, sw1, sw2, "down" )
acsmarsd4862d12015-10-06 17:57:34 -0700597
598 if linkDownResult:
599 main.assertReturnString += 'Link Down Passed\n'
600 else:
601 main.assertReturnString += 'Link Down Failed\n'
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700602
603 # Check flows count in each node
604 checkFlowsCount( main )
605 # Verify flows
606 checkFlowsState( main )
607
608 # Check OnosTopology
609 topoResult = checkTopology( main, expectedLink )
acsmarsd4862d12015-10-06 17:57:34 -0700610 if topoResult:
611 main.assertReturnString += 'Link Down Topology State Passed\n'
612 else:
613 main.assertReturnString += 'Link Down Topology State Failed\n'
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700614
615 # Run iperf to both host
acsmarsd4862d12015-10-06 17:57:34 -0700616 iperfTemp = main.Mininet1.iperftcp( host1,host2,10 )
617 iperfResult = iperfResult and iperfTemp
618 if iperfTemp:
619 main.assertReturnString += 'Link Down Iperf Passed\n'
620 else:
621 main.assertReturnString += 'Link Down Iperf Failed\n'
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700622
acsmarsd4862d12015-10-06 17:57:34 -0700623 # Check intent state
624 intentTemp = checkIntentState( main, intentsId )
625 intentResult = intentResult and intentTemp
626 if intentTemp:
627 main.assertReturnString += 'Link Down Intent State Passed\n'
628 else:
629 main.assertReturnString += 'Link Down Intent State Failed\n'
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700630
631 # Checks ONOS state in link down
632 if linkDownResult and topoResult and iperfResult and intentResult:
633 main.log.info( itemName + ": Successfully brought link down" )
634 else:
635 main.log.error( itemName + ": Failed to bring link down" )
636
637 # link up
638 linkUpResult = link( main, sw1, sw2, "up" )
acsmarsd4862d12015-10-06 17:57:34 -0700639 if linkUpTemp:
640 main.assertReturnString += 'Link Up Passed\n'
641 else:
642 main.assertReturnString += 'Link Up Failed\n'
643
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700644 time.sleep( main.rerouteSleep )
645
646 # Check flows count in each node
647 checkFlowsCount( main )
648 # Verify flows
649 checkFlowsState( main )
650
651 # Check OnosTopology
652 topoResult = checkTopology( main, main.numLinks )
653
acsmarsd4862d12015-10-06 17:57:34 -0700654 if topoResult:
655 main.assertReturnString += 'Link Up Topology State Passed\n'
656 else:
657 main.assertReturnString += 'Link Up Topology State Failed\n'
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700658
acsmarsd4862d12015-10-06 17:57:34 -0700659 # Run iperf to both host
660 iperfTemp = main.Mininet1.iperftcp( host1,host2,10 )
661 iperfResult = iperfResult and iperfTemp
662 if iperfTemp:
663 main.assertReturnString += 'Link Up Iperf Passed\n'
664 else:
665 main.assertReturnString += 'Link Up Iperf Failed\n'
666
667 # Check intent state
668 intentTemp = checkIntentState( main, intentsId )
669 intentResult = intentResult and intentTemp
670 if intentTemp:
671 main.assertReturnString += 'Link Down Intent State Passed\n'
672 else:
673 main.assertReturnString += 'Link Down Intent State Failed\n'
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700674
675 # Checks ONOS state in link up
676 if linkUpResult and topoResult and iperfResult and intentResult:
677 main.log.info( itemName + ": Successfully brought link back up" )
678 else:
679 main.log.error( itemName + ": Failed to bring link back up" )
680
681 # Remove all intents
682 removeIntentResult = removeAllIntents( main, intentsId )
acsmarsd4862d12015-10-06 17:57:34 -0700683 if removeIntentResult:
684 main.assertReturnString += 'Remove Intents Passed'
685 else:
686 main.assertReturnString += 'Remove Intents Failed'
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700687
688 stepResult = iperfResult and linkDownResult and linkUpResult \
689 and intentResult and removeIntentResult
690
691 return stepResult
692
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800693def installSingleToMultiIntent( main,
694 name,
695 senders,
696 recipients,
697 onosNode=0,
698 ethType="",
699 bandwidth="",
700 lambdaAlloc=False,
701 ipProto="",
702 ipAddresses="",
703 tcp="",
704 sw1="",
Jeremy Songsterff553672016-05-12 17:06:23 -0700705 sw2="",
Jeremy Songster9385d412016-06-02 17:57:36 -0700706 setVlan="",
Jeremy Songsterc032f162016-08-04 17:14:49 -0700707 partial=False,
708 encap="" ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700709 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800710 Installs a Single to Multi Point Intent
711
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700712 Description:
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800713 Install a single to multi point intent using
714 add-single-to-multi-intent
715
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700716 Steps:
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800717 - Fetch host data if not given
718 - Add single to multi intent
719 - Ingress device is the first sender host
720 - Egress devices are the recipient devices
721 - Ports if defined in senders or recipients
722 - MAC address ethSrc loaded from Ingress device
723 - Check intent state with retry
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700724 Required:
725 name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800726 senders - List of host dictionaries i.e.
727 { "name":"h8", "device":"of:0000000000000005/8","mac":"00:00:00:00:00:08" }
728 recipients - List of host dictionaries i.e.
729 { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" }
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700730 Optional:
731 onosNode - ONOS node to install the intents in main.CLIs[ ]
732 0 by default so that it will always use the first
733 ONOS node
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700734 ethType - Ethernet type eg. IPV4, IPV6
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700735 bandwidth - Bandwidth capacity
736 lambdaAlloc - Allocate lambda, defaults to False
737 ipProto - IP protocol
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700738 tcp - TCP ports in the same order as the hosts in hostNames
739 sw1 - First switch to bring down & up for rerouting purpose
740 sw2 - Second switch to bring down & up for rerouting purpose
741 expectedLink - Expected link when the switches are down, it should
742 be two links lower than the links before the two
743 switches are down
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700744 """
745
746 assert main, "There is no main variable"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800747 assert senders, "You must specify a sender"
748 assert recipients, "You must specify a recipient"
749 # Assert devices or main.hostsData, "You must specify devices"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700750
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800751 global itemName # The name of this run. Used for logs.
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700752 itemName = name
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700753 onosNode = int( onosNode )
754
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700755 main.log.info( itemName + ": Adding single point to multi point intents" )
756
Jeremyd9e4eb12016-04-13 12:09:06 -0700757 try:
758 for sender in senders:
759 if not sender.get( "device" ):
760 main.log.warn( "Device not given for sender {0}. Loading from main.hostData".format( sender.get( "name" ) ) )
761 sender[ "device" ] = main.hostsData.get( sender.get( "name" ) ).get( "location" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700762
Jeremyd9e4eb12016-04-13 12:09:06 -0700763 for recipient in recipients:
764 if not recipient.get( "device" ):
765 main.log.warn( "Device not given for recipient {0}. Loading from main.hostData".format( recipient.get( "name" ) ) )
766 recipient[ "device" ] = main.hostsData.get( recipient.get( "name" ) ).get( "location" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700767
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700768
Jeremyd9e4eb12016-04-13 12:09:06 -0700769 ingressDevice = senders[ 0 ].get( "device" )
770 egressDeviceList = [ x.get( "device" ) for x in recipients if x.get( "device" ) ]
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800771
Jeremyd9e4eb12016-04-13 12:09:06 -0700772 portIngress = senders[ 0 ].get( "port", "" )
773 portEgressList = [ x.get( "port" ) for x in recipients if x.get( "port" ) ]
774 if not portEgressList:
775 portEgressList = None
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800776
Jeremyd9e4eb12016-04-13 12:09:06 -0700777 srcMac = senders[ 0 ].get( "mac" )
Jeremy Songster832f9e92016-05-05 14:30:49 -0700778 vlanId = senders[ 0 ].get( "vlan" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800779
Jeremyd9e4eb12016-04-13 12:09:06 -0700780 # Adding point intent
781 intentId = main.CLIs[ onosNode ].addSinglepointToMultipointIntent(
782 ingressDevice=ingressDevice,
783 egressDeviceList=egressDeviceList,
784 portIngress=portIngress,
785 portEgressList=portEgressList,
786 ethType=ethType,
787 ethSrc=srcMac,
788 bandwidth=bandwidth,
789 lambdaAlloc=lambdaAlloc,
790 ipProto=ipProto,
791 ipSrc="",
792 ipDst="",
793 tcpSrc="",
Jeremy Songster832f9e92016-05-05 14:30:49 -0700794 tcpDst="",
Jeremy Songsterff553672016-05-12 17:06:23 -0700795 vlanId=vlanId,
Jeremy Songster9385d412016-06-02 17:57:36 -0700796 setVlan=setVlan,
Jeremy Songsterc032f162016-08-04 17:14:49 -0700797 partial=partial,
798 encap=encap )
Jeremyd9e4eb12016-04-13 12:09:06 -0700799 except (KeyError, TypeError):
800 errorMsg = "There was a problem loading the hosts data."
801 if intentId:
802 errorMsg += " There was a problem installing Singlepoint to Multipoint intent."
803 main.log.error( errorMsg )
804 return main.FALSE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700805
806 # Check intents state
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800807 if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
808 return intentId
acsmarsd4862d12015-10-06 17:57:34 -0700809 else:
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800810 main.log.error( "Single to Multi Intent did not install correctly" )
811 return main.FALSE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700812
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800813def installMultiToSingleIntent( main,
814 name,
815 senders,
816 recipients,
817 onosNode=0,
818 ethType="",
819 bandwidth="",
820 lambdaAlloc=False,
821 ipProto="",
822 ipAddresses="",
823 tcp="",
824 sw1="",
Jeremy Songsterff553672016-05-12 17:06:23 -0700825 sw2="",
Jeremy Songster9385d412016-06-02 17:57:36 -0700826 setVlan="",
Jeremy Songsterc032f162016-08-04 17:14:49 -0700827 partial=False,
828 encap="" ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700829 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800830 Installs a Multi to Single Point Intent
831
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700832 Description:
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800833 Install a multi to single point intent using
834 add-multi-to-single-intent
835
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700836 Steps:
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800837 - Fetch host data if not given
838 - Add multi to single intent
839 - Ingress devices are the senders devices
840 - Egress device is the first recipient host
841 - Ports if defined in senders or recipients
842 - MAC address ethSrc loaded from Ingress device
843 - Check intent state with retry
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700844 Required:
845 name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800846 senders - List of host dictionaries i.e.
847 [ { "name":"h8", "device":"of:0000000000000005/8","mac":"00:00:00:00:00:08" } ]
848 recipients - List of host dictionaries i.e.
849 [ { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" } ]
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700850 Optional:
851 onosNode - ONOS node to install the intents in main.CLIs[ ]
852 0 by default so that it will always use the first
853 ONOS node
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700854 ethType - Ethernet type eg. IPV4, IPV6
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700855 bandwidth - Bandwidth capacity
856 lambdaAlloc - Allocate lambda, defaults to False
857 ipProto - IP protocol
kelvin-onlab58dc39e2015-08-06 08:11:09 -0700858 tcp - TCP ports in the same order as the hosts in hostNames
859 sw1 - First switch to bring down & up for rerouting purpose
860 sw2 - Second switch to bring down & up for rerouting purpose
861 expectedLink - Expected link when the switches are down, it should
862 be two links lower than the links before the two
863 switches are down
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700864 """
865
866 assert main, "There is no main variable"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800867 assert senders, "You must specify a sender"
868 assert recipients, "You must specify a recipient"
869 # Assert devices or main.hostsData, "You must specify devices"
870
871 global itemName # The name of this run. Used for logs.
872 itemName = name
873 onosNode = int( onosNode )
874
875 main.log.info( itemName + ": Adding mutli to single point intents" )
876
Jeremyd9e4eb12016-04-13 12:09:06 -0700877 try:
878 for sender in senders:
879 if not sender.get( "device" ):
880 main.log.warn( "Device not given for sender {0}. Loading from main.hostData".format( sender.get( "name" ) ) )
881 sender[ "device" ] = main.hostsData.get( sender.get( "name" ) ).get( "location" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800882
Jeremyd9e4eb12016-04-13 12:09:06 -0700883 for recipient in recipients:
884 if not recipient.get( "device" ):
885 main.log.warn( "Device not given for recipient {0}. Loading from main.hostData".format( recipient.get( "name" ) ) )
886 recipient[ "device" ] = main.hostsData.get( recipient.get( "name" ) ).get( "location" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800887
Jeremyd9e4eb12016-04-13 12:09:06 -0700888 ingressDeviceList = [ x.get( "device" ) for x in senders if x.get( "device" ) ]
889 egressDevice = recipients[ 0 ].get( "device" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800890
Jeremyd9e4eb12016-04-13 12:09:06 -0700891 portIngressList = [ x.get( "port" ) for x in senders if x.get( "port" ) ]
892 portEgress = recipients[ 0 ].get( "port", "" )
893 if not portIngressList:
894 portIngressList = None
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800895
Jeremyd9e4eb12016-04-13 12:09:06 -0700896 dstMac = recipients[ 0 ].get( "mac" )
Jeremy Songster832f9e92016-05-05 14:30:49 -0700897 vlanId = senders[ 0 ].get( "vlan" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800898
Jeremyd9e4eb12016-04-13 12:09:06 -0700899 # Adding point intent
900 intentId = main.CLIs[ onosNode ].addMultipointToSinglepointIntent(
901 ingressDeviceList=ingressDeviceList,
902 egressDevice=egressDevice,
903 portIngressList=portIngressList,
904 portEgress=portEgress,
905 ethType=ethType,
906 ethDst=dstMac,
907 bandwidth=bandwidth,
908 lambdaAlloc=lambdaAlloc,
909 ipProto=ipProto,
910 ipSrc="",
911 ipDst="",
912 tcpSrc="",
Jeremy Songster832f9e92016-05-05 14:30:49 -0700913 tcpDst="",
Jeremy Songsterff553672016-05-12 17:06:23 -0700914 vlanId=vlanId,
Jeremy Songster9385d412016-06-02 17:57:36 -0700915 setVlan=setVlan,
Jeremy Songsterc032f162016-08-04 17:14:49 -0700916 partial=partial,
917 encap=encap )
Jeremyd9e4eb12016-04-13 12:09:06 -0700918 except (KeyError, TypeError):
919 errorMsg = "There was a problem loading the hosts data."
920 if intentId:
921 errorMsg += " There was a problem installing Multipoint to Singlepoint intent."
922 main.log.error( errorMsg )
923 return main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800924
925 # Check intents state
926 if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
927 return intentId
928 else:
929 main.log.error( "Multi to Single Intent did not install correctly" )
930 return main.FALSE
931
932def testPointIntent( main,
Jeremye0cb5eb2016-01-27 17:39:09 -0800933 name,
934 intentId,
935 senders,
936 recipients,
937 badSenders={},
938 badRecipients={},
939 onosNode=0,
940 ethType="",
941 bandwidth="",
942 lambdaAlloc=False,
943 ipProto="",
944 ipAddresses="",
945 tcp="",
946 sw1="s5",
947 sw2="s2",
Jeremy Songstere405d3d2016-05-17 11:18:57 -0700948 expectedLink=0,
949 useTCP=False):
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800950 """
951 Test a Point Intent
952
953 Description:
954 Test a point intent
955
956 Steps:
957 - Fetch host data if not given
958 - Check Intent State
959 - Check Flow State
960 - Check Connectivity
961 - Check Lack of Connectivity Between Hosts not in the Intent
962 - Reroute
963 - Take Expected Link Down
964 - Check Intent State
965 - Check Flow State
966 - Check Topology
967 - Check Connectivity
968 - Bring Expected Link Up
969 - Check Intent State
970 - Check Flow State
971 - Check Topology
972 - Check Connectivity
973 - Remove Topology
974
975 Required:
976 name - Type of point intent to add eg. IPV4 | VLAN | Dualstack
977
978 senders - List of host dictionaries i.e.
979 { "name":"h8", "device":"of:0000000000000005/8","mac":"00:00:00:00:00:08" }
980 recipients - List of host dictionaries i.e.
981 { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" }
982 Optional:
983 onosNode - ONOS node to install the intents in main.CLIs[ ]
984 0 by default so that it will always use the first
985 ONOS node
986 ethType - Ethernet type eg. IPV4, IPV6
987 bandwidth - Bandwidth capacity
988 lambdaAlloc - Allocate lambda, defaults to False
989 ipProto - IP protocol
990 tcp - TCP ports in the same order as the hosts in hostNames
991 sw1 - First switch to bring down & up for rerouting purpose
992 sw2 - Second switch to bring down & up for rerouting purpose
993 expectedLink - Expected link when the switches are down, it should
994 be two links lower than the links before the two
995 switches are down
996
997 """
998
999 # Parameter Validity Check
1000 assert main, "There is no main variable"
1001 assert senders, "You must specify a sender"
1002 assert recipients, "You must specify a recipient"
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001003
1004 global itemName
1005 itemName = name
1006 tempHostsData = {}
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001007 onosNode = int( onosNode )
1008
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001009 main.log.info( itemName + ": Testing Point Intent" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001010
Jeremyd9e4eb12016-04-13 12:09:06 -07001011 try:
1012 # Names for scapy
1013 senderNames = [ x.get( "name" ) for x in senders ]
1014 recipientNames = [ x.get( "name" ) for x in recipients ]
1015 badSenderNames = [ x.get( "name" ) for x in badSenders ]
1016 badRecipientNames = [ x.get( "name" ) for x in badRecipients ]
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001017
Jeremyd9e4eb12016-04-13 12:09:06 -07001018 for sender in senders:
1019 if not sender.get( "device" ):
1020 main.log.warn( "Device not given for sender {0}. Loading from main.hostData".format( sender.get( "name" ) ) )
1021 sender[ "device" ] = main.hostsData.get( sender.get( "name" ) ).get( "location" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001022
Jeremyd9e4eb12016-04-13 12:09:06 -07001023 for recipient in recipients:
1024 if not recipient.get( "device" ):
1025 main.log.warn( "Device not given for recipient {0}. Loading from main.hostData".format( recipient.get( "name" ) ) )
1026 recipient[ "device" ] = main.hostsData.get( recipient.get( "name" ) ).get( "location" )
Jeremy Songster832f9e92016-05-05 14:30:49 -07001027 vlanId = senders[ 0 ].get( "vlan" )
Jeremyd9e4eb12016-04-13 12:09:06 -07001028 except (KeyError, TypeError):
1029 main.log.error( "There was a problem loading the hosts data." )
1030 return main.FALSE
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001031
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001032 testResult = main.TRUE
1033 main.log.info( itemName + ": Adding single point to multi point intents" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001034
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001035 # Check intent state
1036 if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
1037 main.assertReturnString += 'Initial Intent State Passed\n'
acsmarsd4862d12015-10-06 17:57:34 -07001038 else:
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001039 main.assertReturnString += 'Initial Intent State Failed\n'
1040 testResult = main.FALSE
1041
1042 # Check flows count in each node
Jeremy03dab012016-04-11 08:59:17 -07001043 if utilities.retry( f=checkFlowsCount, retValue=main.FALSE, args=[ main ], sleep=20, attempts=3 ) and utilities.retry( f=checkFlowsState, retValue=main.FALSE, args=[ main ], sleep=20, attempts=3 ):
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001044 main.assertReturnString += 'Initial Flow State Passed\n'
1045 else:
1046 main.assertReturnString += 'Intial Flow State Failed\n'
1047 testResult = main.FALSE
1048
1049 # Check Connectivity
Jeremy Songstere405d3d2016-05-17 11:18:57 -07001050 if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId, useTCP ), attempts=3, sleep=5 ):
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001051 main.assertReturnString += 'Initial Ping Passed\n'
1052 else:
1053 main.assertReturnString += 'Initial Ping Failed\n'
1054 testResult = main.FALSE
1055
1056 # Check connections that shouldn't work
1057 if badSenderNames:
1058 main.log.info( "Checking that packets from incorrect sender do not go through" )
1059 if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, badSenderNames, recipientNames ), kwargs={ "expectFailure":True } ):
1060 main.assertReturnString += 'Bad Sender Ping Passed\n'
1061 else:
1062 main.assertReturnString += 'Bad Sender Ping Failed\n'
1063 testResult = main.FALSE
1064
1065 if badRecipientNames:
1066 main.log.info( "Checking that packets to incorrect recipients do not go through" )
1067 if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, badRecipientNames ), kwargs={ "expectFailure":True } ):
1068 main.assertReturnString += 'Bad Recipient Ping Passed\n'
1069 else:
1070 main.assertReturnString += 'Bad Recipient Ping Failed\n'
1071 testResult = main.FALSE
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001072
1073 # Test rerouting if these variables exist
1074 if sw1 and sw2 and expectedLink:
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001075 # Take link down
1076 if utilities.retry( f=link, retValue=main.FALSE, args=( main, sw1, sw2, "down" ) ):
acsmarsd4862d12015-10-06 17:57:34 -07001077 main.assertReturnString += 'Link Down Passed\n'
1078 else:
1079 main.assertReturnString += 'Link Down Failed\n'
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001080 testResult = main.FALSE
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001081
acsmarsd4862d12015-10-06 17:57:34 -07001082 # Check intent state
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001083 if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
acsmarsd4862d12015-10-06 17:57:34 -07001084 main.assertReturnString += 'Link Down Intent State Passed\n'
1085 else:
1086 main.assertReturnString += 'Link Down Intent State Failed\n'
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001087 testResult = main.FALSE
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001088
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001089 # Check flows count in each node
Jeremy Songsterc032f162016-08-04 17:14:49 -07001090 if utilities.retry( f=checkFlowsCount, retValue=main.FALSE, args=[ main ], sleep=20, attempts=5 ) and utilities.retry( f=checkFlowsState, retValue=main.FALSE, args=[ main ], sleep=20, attempts=5 ):
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001091 main.assertReturnString += 'Link Down Flow State Passed\n'
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001092 else:
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001093 main.assertReturnString += 'Link Down Flow State Failed\n'
1094 testResult = main.FALSE
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001095
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001096 # Check OnosTopology
1097 if utilities.retry( f=checkTopology, retValue=main.FALSE, args=( main, expectedLink ) ):
1098 main.assertReturnString += 'Link Down Topology State Passed\n'
1099 else:
1100 main.assertReturnString += 'Link Down Topology State Failed\n'
1101 testResult = main.FALSE
1102
1103 # Check Connection
Jeremy Songstere405d3d2016-05-17 11:18:57 -07001104 if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId, useTCP ) ):
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001105 main.assertReturnString += 'Link Down Pingall Passed\n'
1106 else:
1107 main.assertReturnString += 'Link Down Pingall Failed\n'
1108 testResult = main.FALSE
1109
1110 # Bring link up
1111 if utilities.retry( f=link, retValue=main.FALSE, args=( main, sw1, sw2, "up" ) ):
acsmarsd4862d12015-10-06 17:57:34 -07001112 main.assertReturnString += 'Link Up Passed\n'
1113 else:
1114 main.assertReturnString += 'Link Up Failed\n'
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001115 testResult = main.FALSE
acsmarsd4862d12015-10-06 17:57:34 -07001116
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001117 # Wait for reroute
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001118 time.sleep( main.rerouteSleep )
1119
acsmarsd4862d12015-10-06 17:57:34 -07001120 # Check Intents
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001121 if utilities.retry( f=checkIntentState, retValue=main.FALSE, args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
acsmarsd4862d12015-10-06 17:57:34 -07001122 main.assertReturnString += 'Link Up Intent State Passed\n'
1123 else:
1124 main.assertReturnString += 'Link Up Intent State Failed\n'
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001125 testResult = main.FALSE
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001126
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001127 # Check flows count in each node
Jeremy03dab012016-04-11 08:59:17 -07001128 if utilities.retry( f=checkFlowsCount, retValue=main.FALSE, args=[ main ], sleep=20, attempts=3 ) and utilities.retry( f=checkFlowsState, retValue=main.FALSE, args=[ main ], sleep=20, attempts=3 ):
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001129 main.assertReturnString += 'Link Up Flow State Passed\n'
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001130 else:
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001131 main.assertReturnString += 'Link Up Flow State Failed\n'
1132 testResult = main.FALSE
1133
1134 # Check OnosTopology
1135 if utilities.retry( f=checkTopology, retValue=main.FALSE, args=( main, main.numLinks ) ):
1136 main.assertReturnString += 'Link Up Topology State Passed\n'
1137 else:
1138 main.assertReturnString += 'Link Up Topology State Failed\n'
1139 testResult = main.FALSE
1140
1141 # Check Connection
Jeremy Songstere405d3d2016-05-17 11:18:57 -07001142 if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE, args=( main, senderNames, recipientNames, vlanId, useTCP ) ):
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001143 main.assertReturnString += 'Link Up Scapy Packet Received Passed\n'
1144 else:
1145 main.assertReturnString += 'Link Up Scapy Packet Recieved Failed\n'
1146 testResult = main.FALSE
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001147
1148 # Remove all intents
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001149 if utilities.retry( f=removeAllIntents, retValue=main.FALSE, args=( main, [ intentId ] ) ):
acsmarsd4862d12015-10-06 17:57:34 -07001150 main.assertReturnString += 'Remove Intents Passed'
1151 else:
1152 main.assertReturnString += 'Remove Intents Failed'
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001153 testResult = main.FALSE
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001154
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001155 return testResult
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001156
Jeremye0cb5eb2016-01-27 17:39:09 -08001157def testEndPointFail( main,
1158 name,
1159 intentId,
1160 senders,
1161 recipients,
1162 isolatedSenders,
1163 isolatedRecipients,
1164 onosNode=0,
1165 ethType="",
1166 bandwidth="",
1167 lambdaAlloc=False,
1168 ipProto="",
1169 ipAddresses="",
1170 tcp="",
1171 sw1="",
1172 sw2="",
1173 sw3="",
1174 sw4="",
1175 sw5="",
1176 expectedLink1=0,
Jeremy Songster9385d412016-06-02 17:57:36 -07001177 expectedLink2=0,
1178 partial=False ):
Jeremye0cb5eb2016-01-27 17:39:09 -08001179 """
1180 Test Single to Multipoint Topology for Endpoint failures
1181 """
1182
1183 # Parameter Validity Check
1184 assert main, "There is no main variable"
1185 assert senders, "You must specify a sender"
1186 assert recipients, "You must specify a recipient"
1187
1188 global itemName
1189 itemName = name
1190 tempHostsData = {}
1191 onosNode = int( onosNode )
1192
1193 main.log.info( itemName + ": Testing Point Intent" )
1194
Jeremyd9e4eb12016-04-13 12:09:06 -07001195 try:
1196 # Names for scapy
1197 senderNames = [ x.get( "name" ) for x in senders ]
1198 recipientNames = [ x.get( "name" ) for x in recipients ]
1199 isolatedSenderNames = [ x.get( "name" ) for x in isolatedSenders ]
1200 isolatedRecipientNames = [ x.get( "name" ) for x in isolatedRecipients ]
1201 connectedSenderNames = [x.get("name") for x in senders if x.get("name") not in isolatedSenderNames]
1202 connectedRecipientNames = [x.get("name") for x in recipients if x.get("name") not in isolatedRecipientNames]
Jeremye0cb5eb2016-01-27 17:39:09 -08001203
Jeremyd9e4eb12016-04-13 12:09:06 -07001204 for sender in senders:
1205 if not sender.get( "device" ):
1206 main.log.warn( "Device not given for sender {0}. Loading from main.hostData".format( sender.get( "name" ) ) )
1207 sender[ "device" ] = main.hostsData.get( sender.get( "name" ) ).get( "location" )
Jeremye0cb5eb2016-01-27 17:39:09 -08001208
Jeremyd9e4eb12016-04-13 12:09:06 -07001209 for recipient in recipients:
1210 if not recipient.get( "device" ):
1211 main.log.warn( "Device not given for recipient {0}. Loading from\
1212 main.hostData".format( recipient.get( "name" ) ) )
1213 recipient[ "device" ] = main.hostsData.get( recipient.get( "name" ) ).get( "location" )
1214 except (KeyError, TypeError):
1215 main.log.error( "There was a problem loading the hosts data." )
1216 return main.FALSE
Jeremye0cb5eb2016-01-27 17:39:09 -08001217
1218 testResult = main.TRUE
1219 main.log.info( itemName + ": Adding multi point to single point intents" )
1220
1221 # Check intent state
1222 if utilities.retry( f=checkIntentState, retValue=main.FALSE,
1223 args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
1224 main.assertReturnString += 'Initial Intent State Passed\n'
1225 else:
1226 main.assertReturnString += 'Initial Intent State Failed\n'
1227 testResult = main.FALSE
1228
1229 # Check flows count in each node
1230 if utilities.retry( f=checkFlowsCount, retValue=main.FALSE,
Jeremy Songster9385d412016-06-02 17:57:36 -07001231 args=[ main ], attempts=5 ) and utilities.retry( f=checkFlowsState,
1232 retValue=main.FALSE,
1233 args=[ main ], attempts=5 ):
Jeremye0cb5eb2016-01-27 17:39:09 -08001234 main.assertReturnString += 'Initial Flow State Passed\n'
1235 else:
1236 main.assertReturnString += 'Intial Flow State Failed\n'
1237 testResult = main.FALSE
1238
1239 # Check Connectivity
1240 if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE,
1241 args=( main, senderNames, recipientNames ) ):
1242 main.assertReturnString += 'Initial Connectivity Check Passed\n'
1243 else:
1244 main.assertReturnString += 'Initial Connectivity Check Failed\n'
1245 testResult = main.FALSE
1246
1247 # Take two links down
1248 # Take first link down
1249 if utilities.retry( f=link, retValue=main.FALSE, args=( main, sw1, sw2, "down" ) ):
1250 main.assertReturnString += 'Link Down Passed\n'
1251 else:
1252 main.assertReturnString += 'Link Down Failed\n'
1253 testResult = main.FALSE
1254
1255 # Take second link down
1256 if utilities.retry( f=link, retValue=main.FALSE, args=( main, sw3, sw4, "down" ) ):
1257 main.assertReturnString += 'Link Down Passed\n'
1258 else:
1259 main.assertReturnString += 'Link Down Failed\n'
1260 testResult = main.FALSE
1261
1262 # Check intent state
1263 if utilities.retry( f=checkIntentState, retValue=main.FALSE,
1264 args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
1265 main.assertReturnString += 'Link Down Intent State Passed\n'
1266 else:
1267 main.assertReturnString += 'Link Down Intent State Failed\n'
1268 testResult = main.FALSE
1269
1270 # Check flows count in each node
1271 if utilities.retry( f=checkFlowsCount, retValue=main.FALSE,
1272 args=[ main ] ) and utilities.retry( f=checkFlowsState,
1273 retValue=main.FALSE, args=[ main ] ):
1274 main.assertReturnString += 'Link Down Flow State Passed\n'
1275 else:
1276 main.assertReturnString += 'Link Down Flow State Failed\n'
1277 testResult = main.FALSE
1278
1279 # Check OnosTopology
1280 if utilities.retry( f=checkTopology, retValue=main.FALSE, args=( main, expectedLink1 ) ):
1281 main.assertReturnString += 'Link Down Topology State Passed\n'
1282 else:
1283 main.assertReturnString += 'Link Down Topology State Failed\n'
1284 testResult = main.FALSE
1285
1286 # Check Connection
1287 if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE,
1288 args=( main, senderNames, recipientNames ) ):
1289 main.assertReturnString += 'Link Down Connectivity Check Passed\n'
1290 else:
1291 main.assertReturnString += 'Link Down Connectivity Check Failed\n'
1292 testResult = main.FALSE
1293
1294 # Take a third link down to isolate one node
1295 if utilities.retry( f=link, retValue=main.FALSE, args=( main, sw3, sw5, "down" ) ):
1296 main.assertReturnString += 'Isolation link Down Passed\n'
1297 else:
1298 main.assertReturnString += 'Isolation link Down Failed\n'
1299 testResult = main.FALSE
1300
Jeremy Songster9385d412016-06-02 17:57:36 -07001301 if partial:
1302 # Check intent state
1303 if utilities.retry( f=checkIntentState, retValue=main.FALSE,
1304 args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
1305 main.assertReturnString += 'Partial failure isolation link Down Intent State Passed\n'
1306 else:
1307 main.assertReturnString += 'Partial failure isolation link Down Intent State Failed\n'
1308 testResult = main.FALSE
Jeremye0cb5eb2016-01-27 17:39:09 -08001309
Jeremy Songster9385d412016-06-02 17:57:36 -07001310 # Check flows count in each node
1311 if utilities.retry( f=checkFlowsCount, retValue=main.FALSE,
1312 args=[ main ], attempts=5 ) and utilities.retry( f=checkFlowsState,
1313 retValue=main.FALSE,
1314 args=[ main ], attempts=5 ):
1315 main.assertReturnString += 'Partial failure isolation link Down Flow State Passed\n'
1316 else:
1317 main.assertReturnString += 'Partial failure isolation link Down Flow State Failed\n'
1318 testResult = main.FALSE
Jeremye0cb5eb2016-01-27 17:39:09 -08001319
Jeremy Songster9385d412016-06-02 17:57:36 -07001320 # Check OnosTopology
1321 if utilities.retry( f=checkTopology, retValue=main.FALSE, args=( main, expectedLink2 ) ):
1322 main.assertReturnString += 'Partial failure isolation link Down Topology State Passed\n'
1323 else:
1324 main.assertReturnString += 'Partial failure isolation link Down Topology State Failed\n'
1325 testResult = main.FALSE
Jeremye0cb5eb2016-01-27 17:39:09 -08001326
Jeremy Songster9385d412016-06-02 17:57:36 -07001327 # Check Connectivity
1328 # First check connectivity of any isolated senders to recipients
1329 if isolatedSenderNames:
1330 if scapyCheckConnection( main, isolatedSenderNames, recipientNames, None, None, None, None, main.TRUE ):
1331 main.assertReturnString += 'Partial failure isolation link Down Connectivity Check Passed\n'
1332 else:
1333 main.assertReturnString += 'Partial failure isolation link Down Connectivity Check Failed\n'
1334 testResult = main.FALSE
1335
1336 # Next check connectivity of senders to any isolated recipients
1337 if isolatedRecipientNames:
1338 if scapyCheckConnection( main, senderNames, isolatedRecipientNames, None, None, None, None, main.TRUE ):
1339 main.assertReturnString += 'Partial failure isolation link Down Connectivity Check Passed\n'
1340 else:
1341 main.assertReturnString += 'Partial failure isolation link Down Connectivity Check Failed\n'
1342 testResult = main.FALSE
1343
1344 # Next check connectivity of connected senders and recipients
1345 if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE,
1346 args=( main, connectedSenderNames , connectedRecipientNames ) ):
1347 main.assertReturnString += 'Partial failure isolation link Down Connectivity Check Passed\n'
1348 else:
1349 main.assertReturnString += 'Partial failure isolation link Down Connectivity Check Failed\n'
1350 testResult = main.FALSE
1351 else:
1352 # Check intent state
1353 if not utilities.retry( f=checkIntentState, retValue=main.TRUE,
1354 args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
1355 main.assertReturnString += 'Isolation link Down Intent State Passed\n'
1356 else:
1357 main.assertReturnString += 'Isolation link Down Intent State Failed\n'
1358 testResult = main.FALSE
1359
1360 # Check flows count in each node
1361 if utilities.retry( f=checkFlowsCount, retValue=main.FALSE,
1362 args=[ main ], attempts=5 ) and utilities.retry( f=checkFlowsState,
1363 retValue=main.FALSE,
1364 args=[ main ], attempts=5 ):
1365 main.assertReturnString += 'Isolation link Down Flow State Passed\n'
1366 else:
1367 main.assertReturnString += 'Isolation link Down Flow State Failed\n'
1368 testResult = main.FALSE
1369
1370 # Check OnosTopology
1371 if utilities.retry( f=checkTopology, retValue=main.FALSE, args=( main, expectedLink2 ) ):
1372 main.assertReturnString += 'Isolation link Down Topology State Passed\n'
1373 else:
1374 main.assertReturnString += 'Isolation link Down Topology State Failed\n'
1375 testResult = main.FALSE
1376
1377 # Check Connectivity
1378 # First check connectivity of any isolated senders to recipients
1379 if isolatedSenderNames:
1380 if scapyCheckConnection( main, isolatedSenderNames, recipientNames, None, None, None, None, main.TRUE ):
1381 main.assertReturnString += 'Isolation link Down Connectivity Check Passed\n'
1382 else:
1383 main.assertReturnString += 'Isolation link Down Connectivity Check Failed\n'
1384 testResult = main.FALSE
1385
1386 # Next check connectivity of senders to any isolated recipients
1387 if isolatedRecipientNames:
1388 if scapyCheckConnection( main, senderNames, isolatedRecipientNames, None, None, None, None, main.TRUE ):
1389 main.assertReturnString += 'Isolation link Down Connectivity Check Passed\n'
1390 else:
1391 main.assertReturnString += 'Isolation link Down Connectivity Check Failed\n'
1392 testResult = main.FALSE
1393
1394 # Next check connectivity of connected senders and recipients
1395 if utilities.retry( f=scapyCheckConnection, retValue=main.TRUE,
1396 args=( main, connectedSenderNames , connectedRecipientNames, None, None, None, None, main.TRUE ) ):
Jeremye0cb5eb2016-01-27 17:39:09 -08001397 main.assertReturnString += 'Isolation link Down Connectivity Check Passed\n'
1398 else:
1399 main.assertReturnString += 'Isolation link Down Connectivity Check Failed\n'
1400 testResult = main.FALSE
1401
Jeremye0cb5eb2016-01-27 17:39:09 -08001402 # Bring the links back up
1403 # Bring first link up
1404 if utilities.retry( f=link, retValue=main.FALSE, args=( main, sw1, sw2, "up" ) ):
1405 main.assertReturnString += 'Link Up Passed\n'
1406 else:
1407 main.assertReturnString += 'Link Up Failed\n'
1408 testResult = main.FALSE
1409
1410 # Bring second link up
1411 if utilities.retry( f=link, retValue=main.FALSE, args=( main, sw3, sw5, "up" ) ):
1412 main.assertReturnString += 'Link Up Passed\n'
1413 else:
1414 main.assertReturnString += 'Link Up Failed\n'
1415 testResult = main.FALSE
1416
1417 # Bring third link up
1418 if utilities.retry( f=link, retValue=main.FALSE, args=( main, sw3, sw4, "up" ) ):
1419 main.assertReturnString += 'Link Up Passed\n'
1420 else:
1421 main.assertReturnString += 'Link Up Failed\n'
1422 testResult = main.FALSE
1423
1424 # Wait for reroute
1425 time.sleep( main.rerouteSleep )
1426
1427 # Check Intents
1428 if utilities.retry( f=checkIntentState, retValue=main.FALSE,
1429 args=( main, [ intentId ] ), sleep=main.checkIntentSleep ):
1430 main.assertReturnString += 'Link Up Intent State Passed\n'
1431 else:
1432 main.assertReturnString += 'Link Up Intent State Failed\n'
1433 testResult = main.FALSE
1434
1435 # Check flows count in each node
1436 if utilities.retry( f=checkFlowsCount, retValue=main.FALSE,
Jeremy Songster9385d412016-06-02 17:57:36 -07001437 args=[ main ], sleep=5, attempts=5 ) and utilities.retry( f=checkFlowsState,
1438 retValue=main.FALSE,
1439 args=[ main ], sleep=5, attempts=5 ):
Jeremye0cb5eb2016-01-27 17:39:09 -08001440 main.assertReturnString += 'Link Up Flow State Passed\n'
1441 else:
1442 main.assertReturnString += 'Link Up Flow State Failed\n'
1443 testResult = main.FALSE
1444
1445 # Check OnosTopology
1446 if utilities.retry( f=checkTopology, retValue=main.FALSE, args=( main, main.numLinks ) ):
1447 main.assertReturnString += 'Link Up Topology State Passed\n'
1448 else:
1449 main.assertReturnString += 'Link Up Topology State Failed\n'
1450 testResult = main.FALSE
1451
1452 # Check Connection
1453 if utilities.retry( f=scapyCheckConnection, retValue=main.FALSE,
1454 args=( main, senderNames, recipientNames ) ):
1455 main.assertReturnString += 'Link Up Scapy Packet Received Passed\n'
1456 else:
1457 main.assertReturnString += 'Link Up Scapy Packet Recieved Failed\n'
1458 testResult = main.FALSE
1459
1460 # Remove all intents
1461 if utilities.retry( f=removeAllIntents, retValue=main.FALSE, args=( main, [ intentId ] ) ):
1462 main.assertReturnString += 'Remove Intents Passed'
1463 else:
1464 main.assertReturnString += 'Remove Intents Failed'
1465 testResult = main.FALSE
1466
1467 return testResult
1468
1469
kelvin-onlab58dc39e2015-08-06 08:11:09 -07001470def pingallHosts( main, hostList ):
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001471 """
1472 Ping all host in the hosts list variable
1473 """
Jon Halla5cb3412015-08-18 14:08:22 -07001474 main.log.info( "Pinging: " + str( hostList ) )
1475 return main.Mininet1.pingallHosts( hostList )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001476
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001477def fwdPingall( main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001478 """
1479 Use fwd app and pingall to discover all the hosts
1480 """
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001481 activateResult = main.TRUE
1482 appCheck = main.TRUE
1483 getDataResult = main.TRUE
1484 main.log.info( "Activating reactive forwarding app " )
1485 activateResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001486
1487 # Wait for forward app activation to propagate
kelvin-onlab0ad05d12015-07-23 14:21:15 -07001488 time.sleep( main.fwdSleep )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001489
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001490 # Check that forwarding is enabled on all nodes
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001491 for i in range( main.numCtrls ):
1492 appCheck = appCheck and main.CLIs[ i ].appToIDCheck()
1493 if appCheck != main.TRUE:
1494 main.log.warn( main.CLIs[ i ].apps() )
1495 main.log.warn( main.CLIs[ i ].appIDs() )
1496
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001497 # Send pingall in mininet
1498 main.log.info( "Run Pingall" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001499 pingResult = main.Mininet1.pingall( timeout = 600 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001500
1501 main.log.info( "Deactivating reactive forwarding app " )
1502 deactivateResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001503 if activateResult and deactivateResult:
1504 main.log.info( "Successfully used fwd app to discover hosts" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001505 getDataResult = main.TRUE
1506 else:
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001507 main.log.info( "Failed to use fwd app to discover hosts" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001508 getDataResult = main.FALSE
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001509 return getDataResult
1510
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001511def confirmHostDiscovery( main ):
1512 """
1513 Confirms that all ONOS nodes have discovered all scapy hosts
1514 """
1515 import collections
1516 scapyHostCount = len( main.scapyHosts )
1517 hosts = main.topo.getAllHosts( main ) # Get host data from each ONOS node
1518 hostFails = [] # Reset for each failed attempt
1519
1520 # Check for matching hosts on each node
1521 scapyHostIPs = [ x.hostIp for x in main.scapyHosts if x.hostIp != "0.0.0.0" ]
1522 for controller in range( main.numCtrls ):
1523 controllerStr = str( controller + 1 ) # ONOS node number
1524 # Compare Hosts
1525 # Load hosts data for controller node
Jeremyd9e4eb12016-04-13 12:09:06 -07001526 try:
1527 if hosts[ controller ]:
1528 main.log.info( "Hosts discovered" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001529 else:
Jeremyd9e4eb12016-04-13 12:09:06 -07001530 main.log.error( "Problem discovering hosts" )
1531 if hosts[ controller ] and "Error" not in hosts[ controller ]:
1532 try:
1533 hostData = json.loads( hosts[ controller ] )
1534 except ( TypeError, ValueError ):
1535 main.log.error( "Could not load json:" + str( hosts[ controller ] ) )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001536 hostFails.append( controllerStr )
Jeremyd9e4eb12016-04-13 12:09:06 -07001537 else:
1538 onosHostIPs = [ x.get( "ipAddresses" )[ 0 ]
1539 for x in hostData
1540 if len( x.get( "ipAddresses" ) ) > 0 ]
1541 if not set( collections.Counter( scapyHostIPs ) ).issubset( set ( collections.Counter( onosHostIPs ) ) ):
1542 main.log.warn( "Controller {0} only sees nodes with {1} IPs. It should see all of the following: {2}".format( controllerStr, onosHostIPs, scapyHostIPs ) )
1543 hostFails.append( controllerStr )
1544 else:
1545 main.log.error( "Hosts returned nothing or an error." )
1546 hostFails.append( controllerStr )
1547 except IndexError:
1548 main.log.error( "Hosts returned nothing, Failed to discover hosts." )
1549 return main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001550
1551 if hostFails:
1552 main.log.error( "List of failed ONOS Nodes:" + ', '.join(map(str, hostFails )) )
1553 return main.FALSE
1554 else:
1555 return main.TRUE
1556
1557def sendDiscoveryArp( main, hosts=None ):
1558 """
1559 Sends Discovery ARP packets from each host provided
1560 Defaults to each host in main.scapyHosts
1561 """
1562 # Send an arp ping from each host
1563 if not hosts:
1564 hosts = main.scapyHosts
1565 for host in hosts:
1566 pkt = 'Ether( src="{0}")/ARP( psrc="{1}")'.format( host.hostMac ,host.hostIp )
1567 # Send from the VLAN interface if there is one so ONOS discovers the VLAN correctly
1568 iface = None
1569 for interface in host.getIfList():
1570 if '.' in interface:
1571 main.log.debug( "Detected VLAN interface {0}. Sending ARP packet from {0}".format( interface ) )
1572 iface = interface
1573 break
1574 host.sendPacket( packet=pkt, iface=iface )
1575 main.log.info( "Sending ARP packet from {0}".format( host.name ) )
1576
1577def populateHostData( main ):
1578 """
1579 Populates hostsData
1580 """
1581 import json
1582 try:
1583 hostsJson = json.loads( main.CLIs[ 0 ].hosts() )
1584 hosts = main.Mininet1.getHosts().keys()
1585 # TODO: Make better use of new getHosts function
1586 for host in hosts:
1587 main.hostsData[ host ] = {}
1588 main.hostsData[ host ][ 'mac' ] = \
1589 main.Mininet1.getMacAddress( host ).upper()
1590 for hostj in hostsJson:
1591 if main.hostsData[ host ][ 'mac' ] == hostj[ 'mac' ]:
1592 main.hostsData[ host ][ 'id' ] = hostj[ 'id' ]
1593 main.hostsData[ host ][ 'vlan' ] = hostj[ 'vlan' ]
1594 main.hostsData[ host ][ 'location' ] = \
1595 hostj[ 'location' ][ 'elementId' ] + '/' + \
1596 hostj[ 'location' ][ 'port' ]
1597 main.hostsData[ host ][ 'ipAddresses' ] = hostj[ 'ipAddresses' ]
1598 return main.TRUE
Jeremyd9e4eb12016-04-13 12:09:06 -07001599 except ValueError:
1600 main.log.error( "ValueError while populating hostsData" )
1601 return main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001602 except KeyError:
1603 main.log.error( "KeyError while populating hostsData")
1604 return main.FALSE
Jeremyd9e4eb12016-04-13 12:09:06 -07001605 except IndexError:
1606 main.log.error( "IndexError while populating hostsData" )
1607 return main.FALSE
1608 except TypeError:
1609 main.log.error( "TypeError while populating hostsData" )
1610 return main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001611
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001612def checkTopology( main, expectedLink ):
1613 statusResult = main.TRUE
1614 # Check onos topology
1615 main.log.info( itemName + ": Checking ONOS topology " )
1616
1617 for i in range( main.numCtrls ):
Flavio Castro82ee2f62016-06-07 15:04:12 -07001618 statusResult = main.CLIs[ i ].checkStatus( main.numSwitch,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001619 expectedLink )\
1620 and statusResult
1621 if not statusResult:
1622 main.log.error( itemName + ": Topology mismatch" )
1623 else:
1624 main.log.info( itemName + ": Topology match" )
1625 return statusResult
1626
1627def checkIntentState( main, intentsId ):
1628 """
1629 This function will check intent state to make sure all the intents
1630 are in INSTALLED state
1631 """
1632
1633 intentResult = main.TRUE
1634 results = []
1635
1636 main.log.info( itemName + ": Checking intents state" )
1637 # First check of intents
1638 for i in range( main.numCtrls ):
1639 tempResult = main.CLIs[ i ].checkIntentState( intentsId=intentsId )
1640 results.append( tempResult )
1641
1642 expectedState = [ 'INSTALLED', 'INSTALLING' ]
1643
1644 if all( result == main.TRUE for result in results ):
1645 main.log.info( itemName + ": Intents are installed correctly" )
1646 else:
1647 # Wait for at least 5 second before checking the intents again
acsmarsb9a92692015-10-08 16:43:01 -07001648 main.log.error( "Intents are not installed correctly. Waiting 5 sec" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001649 time.sleep( 5 )
1650 results = []
1651 # Second check of intents since some of the intents may be in
1652 # INSTALLING state, they should be in INSTALLED at this time
1653 for i in range( main.numCtrls ):
Jeremy2f190ca2016-01-29 15:23:57 -08001654 tempResult = main.CLIs[ i ].checkIntentState( intentsId=intentsId )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001655 results.append( tempResult )
1656 if all( result == main.TRUE for result in results ):
1657 main.log.info( itemName + ": Intents are installed correctly" )
acsmarsb9a92692015-10-08 16:43:01 -07001658 intentResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001659 else:
1660 main.log.error( itemName + ": Intents are NOT installed correctly" )
1661 intentResult = main.FALSE
1662
1663 return intentResult
1664
1665def checkFlowsState( main ):
1666
1667 main.log.info( itemName + ": Check flows state" )
Jeremy Songsterff553672016-05-12 17:06:23 -07001668 checkFlowsResult = main.CLIs[ 0 ].checkFlowsState( isPENDING=False )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001669 return checkFlowsResult
1670
1671def link( main, sw1, sw2, option):
1672
1673 # link down
1674 main.log.info( itemName + ": Bring link " + option + "between " +
1675 sw1 + " and " + sw2 )
1676 linkResult = main.Mininet1.link( end1=sw1, end2=sw2, option=option )
1677 return linkResult
1678
Jeremy Songstere405d3d2016-05-17 11:18:57 -07001679def scapyCheckConnection( main, senders, recipients, vlanId=None, useTCP=False, packet=None, packetFilter=None, expectFailure=False ):
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001680 """
1681 Checks the connectivity between all given sender hosts and all given recipient hosts
1682 Packet may be specified. Defaults to Ether/IP packet
1683 Packet Filter may be specified. Defaults to Ether/IP from current sender MAC
1684 Todo: Optional packet and packet filter attributes for sender and recipients
1685 Expect Failure when the sender and recipient are not supposed to have connectivity
1686 Timeout of 1 second, returns main.TRUE if the filter is not triggered and kills the filter
1687
1688 """
1689 connectionsFunctional = main.TRUE
1690
1691 if not packetFilter:
1692 packetFilter = 'ether host {}'
Jeremy Songstere405d3d2016-05-17 11:18:57 -07001693 if useTCP:
1694 packetFilter += ' ip proto \\tcp tcp port {}'.format(main.params[ 'SDNIP' ][ 'dstPort' ])
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001695 if expectFailure:
1696 timeout = 1
1697 else:
1698 timeout = 10
1699
1700 for sender in senders:
1701 try:
1702 senderComp = getattr( main, sender )
1703 except AttributeError:
1704 main.log.error( "main has no attribute {}".format( sender ) )
1705 connectionsFunctional = main.FALSE
1706 continue
1707
1708 for recipient in recipients:
1709 # Do not send packets to self since recipient CLI will already be busy
1710 if recipient == sender:
1711 continue
1712 try:
1713 recipientComp = getattr( main, recipient )
1714 except AttributeError:
1715 main.log.error( "main has no attribute {}".format( recipient ) )
1716 connectionsFunctional = main.FALSE
1717 continue
1718
Jeremy Songster832f9e92016-05-05 14:30:49 -07001719 if vlanId:
1720 recipientComp.startFilter( pktFilter = ( "vlan {}".format( vlanId ) + " && " + packetFilter.format( senderComp.hostMac ) ) )
1721 else:
1722 recipientComp.startFilter( pktFilter = packetFilter.format( senderComp.hostMac ) )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001723
1724 if not packet:
Jeremy Songster832f9e92016-05-05 14:30:49 -07001725 if vlanId:
1726 pkt = 'Ether( src="{0}", dst="{2}" )/Dot1Q(vlan={4})/IP( src="{1}", dst="{3}" )'.format(
1727 senderComp.hostMac,
1728 senderComp.hostIp,
1729 recipientComp.hostMac,
1730 recipientComp.hostIp,
1731 vlanId )
1732 else:
1733 pkt = 'Ether( src="{0}", dst="{2}" )/IP( src="{1}", dst="{3}" )'.format(
1734 senderComp.hostMac,
1735 senderComp.hostIp,
1736 recipientComp.hostMac,
1737 recipientComp.hostIp )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001738 else:
1739 pkt = packet
Jeremy Songster832f9e92016-05-05 14:30:49 -07001740 if vlanId:
1741 senderComp.sendPacket( iface=( "{0}-eth0.{1}".format( sender, vlanId ) ), packet = pkt )
1742 else:
1743 senderComp.sendPacket( packet = pkt )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001744
1745 if recipientComp.checkFilter( timeout ):
1746 if expectFailure:
1747 main.log.error( "Packet from {0} successfully received by {1} when it should not have been".format( sender , recipient ) )
1748 connectionsFunctional = main.FALSE
1749 else:
1750 main.log.info( "Packet from {0} successfully received by {1}".format( sender , recipient ) )
1751 else:
1752 recipientComp.killFilter()
1753 if expectFailure:
1754 main.log.info( "As expected, packet from {0} was not received by {1}".format( sender , recipient ) )
1755 else:
1756 main.log.error( "Packet from {0} was not received by {1}".format( sender , recipient ) )
1757 connectionsFunctional = main.FALSE
1758
1759 return connectionsFunctional
1760
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001761def removeAllIntents( main, intentsId ):
1762 """
1763 Remove all intents in the intentsId
1764 """
1765
kelvin-onlab5c706ff2015-07-20 10:56:52 -07001766 onosSummary = []
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001767 removeIntentResult = main.TRUE
1768 # Remove intents
1769 for intent in intentsId:
1770 main.CLIs[ 0 ].removeIntent( intentId=intent, purge=True )
1771
acsmarscfa52272015-08-06 15:21:45 -07001772 time.sleep( main.removeIntentSleep )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001773
kelvin-onlab5c706ff2015-07-20 10:56:52 -07001774 # If there is remianing intents then remove intents should fail
1775 for i in range( main.numCtrls ):
1776 onosSummary.append( json.loads( main.CLIs[ i ].summary() ) )
1777
1778 for summary in onosSummary:
1779 if summary.get( 'intents' ) != 0:
1780 main.log.warn( itemName + ": There are " +
1781 str( summary.get( 'intents' ) ) +
1782 " intents remaining in node " +
1783 str( summary.get( 'node' ) ) +
1784 ", failed to remove all the intents " )
1785 removeIntentResult = main.FALSE
1786
1787 if removeIntentResult:
1788 main.log.info( itemName + ": There are no more intents remaining, " +
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001789 "successfully removed all the intents." )
kelvin-onlab5c706ff2015-07-20 10:56:52 -07001790
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001791 return removeIntentResult
1792
1793def checkFlowsCount( main ):
1794 """
1795 Check flows count in each node
1796 """
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001797 flowsCount = []
1798 main.log.info( itemName + ": Checking flows count in each ONOS node" )
1799 for i in range( main.numCtrls ):
1800 summaryResult = main.CLIs[ i ].summary()
1801 if not summaryResult:
1802 main.log.error( itemName + ": There is something wrong with " +
1803 "summary command" )
1804 return main.FALSE
1805 else:
1806 summaryJson = json.loads( summaryResult )
1807 flowsCount.append( summaryJson.get( 'flows' ) )
1808
1809 if flowsCount:
1810 if all( flows==flowsCount[ 0 ] for flows in flowsCount ):
1811 main.log.info( itemName + ": There are " + str( flowsCount[ 0 ] ) +
1812 " flows in all ONOS node" )
1813 else:
1814 for i in range( main.numCtrls ):
1815 main.log.debug( itemName + ": ONOS node " + str( i ) + " has " +
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001816 str( flowsCount[ i ] ) + " flows" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001817 else:
1818 main.log.error( "Checking flows count failed, check summary command" )
1819 return main.FALSE
1820
1821 return main.TRUE
1822
kelvin-onlab58dc39e2015-08-06 08:11:09 -07001823def checkLeaderChange( leaders1, leaders2 ):
acsmarse6b410f2015-07-17 14:39:34 -07001824 """
1825 Checks for a change in intent partition leadership.
1826
1827 Takes the output of leaders -c in json string format before and after
1828 a potential change as input
1829
1830 Returns main.TRUE if no mismatches are detected
1831 Returns main.FALSE if there is a mismatch or on error loading the input
1832 """
1833 try:
1834 leaders1 = json.loads( leaders1 )
1835 leaders2 = json.loads( leaders2 )
1836 except ( AttributeError, TypeError):
1837 main.log.exception( self.name + ": Object not as expected" )
1838 return main.FALSE
1839 except Exception:
1840 main.log.exception( self.name + ": Uncaught exception!" )
1841 main.cleanup()
1842 main.exit()
1843 main.log.info( "Checking Intent Paritions for Change in Leadership" )
1844 mismatch = False
1845 for dict1 in leaders1:
1846 if "intent" in dict1.get( "topic", [] ):
1847 for dict2 in leaders2:
1848 if dict1.get( "topic", 0 ) == dict2.get( "topic", 0 ) and \
1849 dict1.get( "leader", 0 ) != dict2.get( "leader", 0 ):
1850 mismatch = True
1851 main.log.error( "{0} changed leader from {1} to {2}".\
1852 format( dict1.get( "topic", "no-topic" ),\
1853 dict1.get( "leader", "no-leader" ),\
1854 dict2.get( "leader", "no-leader" ) ) )
1855 if mismatch:
1856 return main.FALSE
1857 else:
1858 return main.TRUE
kelvin-onlab016dce22015-08-10 09:54:11 -07001859
1860def report( main ):
1861 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001862 Report errors/warnings/exceptions
kelvin-onlab016dce22015-08-10 09:54:11 -07001863 """
kelvin-onlab016dce22015-08-10 09:54:11 -07001864 main.ONOSbench.logReport( main.ONOSip[ 0 ],
1865 [ "INFO",
1866 "FOLLOWER",
1867 "WARN",
1868 "flow",
1869 "ERROR",
1870 "Except" ],
1871 "s" )
1872
1873 main.log.info( "ERROR report: \n" )
1874 for i in range( main.numCtrls ):
1875 main.ONOSbench.logReport( main.ONOSip[ i ],
1876 [ "ERROR" ],
1877 "d" )
1878
1879 main.log.info( "EXCEPTIONS report: \n" )
1880 for i in range( main.numCtrls ):
1881 main.ONOSbench.logReport( main.ONOSip[ i ],
1882 [ "Except" ],
1883 "d" )
1884
1885 main.log.info( "WARNING report: \n" )
1886 for i in range( main.numCtrls ):
1887 main.ONOSbench.logReport( main.ONOSip[ i ],
1888 [ "WARN" ],
1889 "d" )