Test Failed
Pull Request — master (#68)
by Arturo
02:18
created

TestResultsEdges.paths_between_all_users()   F

Complexity

Conditions 16

Size

Total Lines 32
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 16
eloc 25
nop 5
dl 0
loc 32
rs 2.4
c 0
b 0
f 0

How to fix   Complexity   

Complexity

Complex classes like build.tests.integration.test_results_edges.TestResultsEdges.paths_between_all_users() often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

1
"""Module to test the KytosGraph in graph.py."""
2
from itertools import combinations
3
4
# Core modules to import
5
from kytos.core.link import Link
6
7
# module under test
8
from tests.integration.test_results import TestResults
9
10
11
class TestResultsEdges(TestResults):
12
    """Tests for the graph class.
13
14
    Tests to see if reflexive searches and impossible searches
15
    show correct results.
16
    """
17
18
    def test_path1(self):
19
        """Tests paths between all users using unconstrained path algorithm."""
20
        combos = combinations(["User1", "User2", "User3", "User4"], 2)
21
        self.initializer()
22
23
        valid = True
24
        for point_a, point_b in combos:
25
            results = self.get_path(point_a, point_b)
26
            if not results:
27
                valid = False
28
                break
29
30
        self.assertNotEqual(valid, False)
31
32
    def test_path12(self):
33
        """Tests paths between all users using unconstrained path algorithm."""
34
        combos = combinations(["User1", "User2", "User3", "User4", "User5"], 2)
35
        self.initializer()
36
37
        valid = True
38
        for point_a, point_b in combos:
39
            results = self.get_path(point_a, point_b)
40
            if not results:
41
                valid = False
42
                break
43
44
        self.assertEqual(valid, False)
45
46
    def test_path2(self):
47
        """Tests paths between all users using constrained path algorithm,
48
        with no constraints set.
49
        """
50
        combos = combinations(["User1", "User2", "User3", "User4"], 2)
51
        self.initializer()
52
53
        for point_a, point_b in combos:
54
            results = self.get_path_constrained(point_a, point_b)
55
            self.assertNotEqual(results, [])
56
57
    def paths_between_all_users(self, item, base=None, flexible=None, metrics=None):
58
        combos = combinations(["User1", "User2", "User3", "User4"], 2)
59
        self.initializer()
60
61
        # if base is not None:
62
        #     value = {my_key: my_val for (my_key, my_val) in base.items()}
63
        #     # base.update(value)
64
65
        valid = True
66
        for point_a, point_b in combos:
67
            if base is not None and flexible is None:
68
                results = self.get_path_constrained(
69
                    point_a, point_b, base=base)
70
                for result in results:
71
                    for path in result["paths"]:
72
                        if item in path:
73
                            valid = False
74
75
            elif base is None and flexible is not None:
76
                results = self.get_path_constrained(
77
                    point_a, point_b, flexible=flexible)
78
                for result in results:
79
                    if metrics is not None:
80
                        if metrics in result["metrics"]:
81
                            for path in result["paths"]:
82
                                if item in path:
83
                                    valid = False
84
                    else:
85
                        for path in result["paths"]:
86
                            if item in path:
87
                                valid = False
88
        return valid
89
90
    def test_path3_1(self):
91
        """Tests paths between all users using constrained path algorithm,
92
        with the ownership constraint set to B.
93
        """
94
        self.assertTrue(self.paths_between_all_users("S4:1", {'ownership': "B"}))
95
96
    def test_path3_2(self):
97
        """Tests paths between all users using constrained path algorithm,
98
        with the ownership constraint set to B.
99
        """
100
        self.assertTrue(self.paths_between_all_users("S5:2", {'ownership': "B"}))
101
102
    def test_path3_3(self):
103
        """Tests paths between all users using constrained path algorithm,
104
        with the ownership constraint set to B.
105
        """
106
        self.assertTrue(self.paths_between_all_users("S4:2", {'ownership': "B"}))
107
108
    def test_path3_4(self):
109
        """Tests paths between all users using constrained path algorithm,
110
        with the ownership constraint set to B.
111
        """
112
        self.assertTrue(self.paths_between_all_users("User1:2", {'ownership': "B"}))
113
114
    def test_path3_5(self):
115
        """Tests paths between all users using constrained path algorithm,
116
        with the ownership constraint set to B.
117
        """
118
        self.assertTrue(self.paths_between_all_users("S5:4", {'ownership': "B"}))
119
120
    def test_path3_6(self):
121
        """Tests paths between all users using constrained path algorithm,
122
        with the ownership constraint set to B.
123
        """
124
        self.assertTrue(self.paths_between_all_users("S6:2", {'ownership': "B"}))
125
126
    def test_path3_7(self):
127
        """Tests paths between all users using constrained path algorithm,
128
        with the ownership constraint set to B.
129
        """
130
        self.assertTrue(self.paths_between_all_users("S6:5", {'ownership': "B"}))
131
132
    def test_path3_8(self):
133
        """Tests paths between all users using constrained path algorithm,
134
        with the ownership constraint set to B.
135
        """
136
        self.assertTrue(self.paths_between_all_users("S10:1", {'ownership': "B"}))
137
138
    def test_path3_9(self):
139
        """Tests paths between all users using constrained path algorithm,
140
        with the ownership constraint set to B.
141
        """
142
        self.assertTrue(self.paths_between_all_users("S8:6", {'ownership': "B"}))
143
144
    def test_path3_1_0(self):
145
        """Tests paths between all users using constrained path algorithm,
146
        with the ownership constraint set to B.
147
        """
148
        self.assertTrue(self.paths_between_all_users("S10:2", {'ownership': "B"}))
149
150
    def test_path3_1_1(self):
151
        """Tests paths between all users using constrained path algorithm,
152
        with the ownership constraint set to B.
153
        """
154
        self.assertTrue(self.paths_between_all_users("S10:3", {'ownership': "B"}))
155
156
    def test_path3_1_2(self):
157
        """Tests paths between all users using constrained path algorithm,
158
        with the ownership constraint set to B.
159
        """
160
        self.assertTrue(self.paths_between_all_users("User2:1", {'ownership': "B"}))
161
162
    def test_path4_1(self):
163
        """Tests paths between all users using constrained path algorithm,
164
        with the reliability constraint set to 3.
165
        """
166
        self.assertTrue(self.paths_between_all_users("S4:1", {'reliability': 3}))
167
168
    def test_path4_2(self):
169
        """Tests paths between all users using constrained path algorithm,
170
        with the reliability constraint set to 3.
171
        """
172
        self.assertTrue(self.paths_between_all_users("S5:2", {'reliability': 3}))
173
174
    def test_path4_3(self):
175
        """Tests paths between all users using constrained path algorithm,
176
        with the reliability constraint set to 3.
177
        """
178
        self.assertTrue(self.paths_between_all_users("S5:3", {'reliability': 3}))
179
180
    def test_path4_4(self):
181
        """Tests paths between all users using constrained path algorithm,
182
        with the reliability constraint set to 3.
183
        """
184
        self.assertTrue(self.paths_between_all_users("S6:1", {'reliability': 3}))
185
186
    def test_path5_1(self):
187
        """Tests paths between all users using constrained path algorithm,
188
        with the reliability constraint set to 3.
189
        """
190
        self.assertTrue(self.paths_between_all_users("S3:1", {'bandwidth': 100}))
191
192
    def test_path5_2(self):
193
        """Tests paths between all users using constrained path algorithm,
194
        with the reliability constraint set to 3.
195
        """
196
        self.assertTrue(self.paths_between_all_users("S5:1", {'bandwidth': 100}))
197
198
    def test_path5_3(self):
199
        """Tests paths between all users using constrained path algorithm,
200
        with the reliability constraint set to 3.
201
        """
202
        self.assertTrue(self.paths_between_all_users("User1:4", {'bandwidth': 100}))
203
204
    def test_path5_4(self):
205
        """Tests paths between all users using constrained path algorithm,
206
        with the reliability constraint set to 3.
207
        """
208
        self.assertTrue(self.paths_between_all_users("User4:3", {'bandwidth': 100}))
209
210
    def test_path6_1(self):
211
        """Tests paths between all users using constrained path algorithm,
212
        with the delay constraint set to 50.
213
        """
214
        self.assertTrue(self.paths_between_all_users("S1:1", {'delay': 50}))
215
216
    def test_path6_2(self):
217
        """Tests paths between all users using constrained path algorithm,
218
        with the delay constraint set to 50.
219
        """
220
        self.assertTrue(self.paths_between_all_users("S2:1", {'delay': 50}))
221
222
    def test_path6_3(self):
223
        """Tests paths between all users using constrained path algorithm,
224
        with the delay constraint set to 50.
225
        """
226
        self.assertTrue(self.paths_between_all_users("S3:1", {'delay': 50}))
227
228
    def test_path6_4(self):
229
        """Tests paths between all users using constrained path algorithm,
230
        with the delay constraint set to 50.
231
        """
232
        self.assertTrue(self.paths_between_all_users("S5:1", {'delay': 50}))
233
234
    def test_path6_5(self):
235
        """Tests paths between all users using constrained path algorithm,
236
        with the delay constraint set to 50.
237
        """
238
        self.assertTrue(self.paths_between_all_users("S4:2", {'delay': 50}))
239
240
    def test_path6_6(self):
241
        """Tests paths between all users using constrained path algorithm,
242
        with the delay constraint set to 50.
243
        """
244
        self.assertTrue(self.paths_between_all_users("User1:2", {'delay': 50}))
245
246
    def test_path6_7(self):
247
        """Tests paths between all users using constrained path algorithm,
248
        with the delay constraint set to 50.
249
        """
250
        self.assertTrue(self.paths_between_all_users("S5:5", {'delay': 50}))
251
252
    def test_path6_8(self):
253
        """Tests paths between all users using constrained path algorithm,
254
        with the delay constraint set to 50.
255
        """
256
        self.assertTrue(self.paths_between_all_users("S8:2", {'delay': 50}))
257
258
    def test_path6_9(self):
259
        """Tests paths between all users using constrained path algorithm,
260
        with the delay constraint set to 50.
261
        """
262
        self.assertTrue(self.paths_between_all_users("S5:6", {'delay': 50}))
263
264
    def test_path6_1_0(self):
265
        """Tests paths between all users using constrained path algorithm,
266
        with the delay constraint set to 50.
267
        """
268
        self.assertTrue(self.paths_between_all_users("User1:3", {'delay': 50}))
269
270
    def test_path6_1_1(self):
271
        """Tests paths between all users using constrained path algorithm,
272
        with the delay constraint set to 50.
273
        """
274
        self.assertTrue(self.paths_between_all_users("S6:3", {'delay': 50}))
275
276
    def test_path6_1_2(self):
277
        """Tests paths between all users using constrained path algorithm,
278
        with the delay constraint set to 50.
279
        """
280
        self.assertTrue(self.paths_between_all_users("S9:1", {'delay': 50}))
281
282
    def test_path6_1_3(self):
283
        """Tests paths between all users using constrained path algorithm,
284
        with the delay constraint set to 50.
285
        """
286
        self.assertTrue(self.paths_between_all_users("S6:4", {'delay': 50}))
287
288
    def test_path6_1_4(self):
289
        """Tests paths between all users using constrained path algorithm,
290
        with the delay constraint set to 50.
291
        """
292
        self.assertTrue(self.paths_between_all_users("S9:2", {'delay': 50}))
293
294
    def test_path6_1_5(self):
295
        """Tests paths between all users using constrained path algorithm,
296
        with the delay constraint set to 50.
297
        """
298
        self.assertTrue(self.paths_between_all_users("S6:5", {'delay': 50}))
299
300
    def test_path6_1_6(self):
301
        """Tests paths between all users using constrained path algorithm,
302
        with the delay constraint set to 50.
303
        """
304
        self.assertTrue(self.paths_between_all_users("S6:5", {'delay': 50}))
305
306
    def test_path6_1_7(self):
307
        """Tests paths between all users using constrained path algorithm,
308
        with the delay constraint set to 50.
309
        """
310
        self.assertTrue(self.paths_between_all_users("S10:1", {'delay': 50}))
311
312
    def test_path6_1_8(self):
313
        """Tests paths between all users using constrained path algorithm,
314
        with the delay constraint set to 50.
315
        """
316
        self.assertTrue(self.paths_between_all_users("S8:5", {'delay': 50}))
317
318
    def test_path6_1_9(self):
319
        """Tests paths between all users using constrained path algorithm,
320
        with the delay constraint set to 50.
321
        """
322
        self.assertTrue(self.paths_between_all_users("S9:4", {'delay': 50}))
323
324
    def test_path6_2_0(self):
325
        """Tests paths between all users using constrained path algorithm,
326
        with the delay constraint set to 50.
327
        """
328
        self.assertTrue(self.paths_between_all_users("User1:4", {'delay': 50}))
329
330
    def test_path6_2_1(self):
331
        """Tests paths between all users using constrained path algorithm,
332
        with the delay constraint set to 50.
333
        """
334
        self.assertTrue(self.paths_between_all_users("User4:3", {'delay': 50}))
335
336
    def test_path7_1(self):
337
        """Tests paths between all users using constrained path algorithm,
338
        with the delay constraint set to 50, the bandwidth constraint set
339
        to 100, the reliability constraint set to 3, and the ownership
340
        constraint set to 'B'
341
        """
342
        # delay = 50
343
        self.assertTrue(self.paths_between_all_users("S1:1", {'delay': 50,
344
                                                              'bandwidth': 100,
345
                                                              'ownership': "B"}))
346
347
    def test_path7_2(self):
348
        """Tests paths between all users using constrained path algorithm,
349
        with the delay constraint set to 50, the bandwidth constraint set
350
        to 100, the reliability constraint set to 3, and the ownership
351
        constraint set to 'B'
352
        """
353
        # delay = 50
354
        self.assertTrue(self.paths_between_all_users("S2:1", {'delay': 50,
355
                                                              'bandwidth': 100,
356
                                                              'ownership': "B"}))
357
358
    def test_path7_3(self):
359
        """Tests paths between all users using constrained path algorithm,
360
        with the delay constraint set to 50, the bandwidth constraint set
361
        to 100, the reliability constraint set to 3, and the ownership
362
        constraint set to 'B'
363
        """
364
        # delay = 50
365
        self.assertTrue(self.paths_between_all_users("S3:1", {'delay': 50,
366
                                                              'bandwidth': 100,
367
                                                              'ownership': "B"}))
368
369
    def test_path7_4(self):
370
        """Tests paths between all users using constrained path algorithm,
371
        with the delay constraint set to 50, the bandwidth constraint set
372
        to 100, the reliability constraint set to 3, and the ownership
373
        constraint set to 'B'
374
        """
375
        # delay = 50
376
        self.assertTrue(self.paths_between_all_users("S5:1", {'delay': 50,
377
                                                              'bandwidth': 100,
378
                                                              'ownership': "B"}))
379
380
    def test_path7_5(self):
381
        """Tests paths between all users using constrained path algorithm,
382
        with the delay constraint set to 50, the bandwidth constraint set
383
        to 100, the reliability constraint set to 3, and the ownership
384
        constraint set to 'B'
385
        """
386
        # delay = 50
387
        self.assertTrue(self.paths_between_all_users("S4:2", {'delay': 50,
388
                                                              'bandwidth': 100,
389
                                                              'ownership': "B"}))
390
391
    def test_path7_6(self):
392
        """Tests paths between all users using constrained path algorithm,
393
        with the delay constraint set to 50, the bandwidth constraint set
394
        to 100, the reliability constraint set to 3, and the ownership
395
        constraint set to 'B'
396
        """
397
        # delay = 50
398
        self.assertTrue(self.paths_between_all_users("User1:2", {'delay': 50,
399
                                                                 'bandwidth': 100,
400
                                                                 'ownership': "B"}))
401
402
    def test_path7_7(self):
403
        """Tests paths between all users using constrained path algorithm,
404
        with the delay constraint set to 50, the bandwidth constraint set
405
        to 100, the reliability constraint set to 3, and the ownership
406
        constraint set to 'B'
407
        """
408
        # delay = 50
409
        self.assertTrue(self.paths_between_all_users("S5:5", {'delay': 50,
410
                                                              'bandwidth': 100,
411
                                                              'ownership': "B"}))
412
413
    def test_path7_8(self):
414
        """Tests paths between all users using constrained path algorithm,
415
        with the delay constraint set to 50, the bandwidth constraint set
416
        to 100, the reliability constraint set to 3, and the ownership
417
        constraint set to 'B'
418
        """
419
        # delay = 50
420
        self.assertTrue(self.paths_between_all_users("S8:2", {'delay': 50,
421
                                                              'bandwidth': 100,
422
                                                              'ownership': "B"}))
423
424
    def test_path7_9(self):
425
        """Tests paths between all users using constrained path algorithm,
426
        with the delay constraint set to 50, the bandwidth constraint set
427
        to 100, the reliability constraint set to 3, and the ownership
428
        constraint set to 'B'
429
        """
430
        # delay = 50
431
        self.assertTrue(self.paths_between_all_users("S5:6", {'delay': 50,
432
                                                              'bandwidth': 100,
433
                                                              'ownership': "B"}))
434
435
    def test_path7_1_0(self):
436
        """Tests paths between all users using constrained path algorithm,
437
        with the delay constraint set to 50, the bandwidth constraint set
438
        to 100, the reliability constraint set to 3, and the ownership
439
        constraint set to 'B'
440
        """
441
        # delay = 50
442
        self.assertTrue(self.paths_between_all_users("User1:3", {'delay': 50,
443
                                                                 'bandwidth': 100,
444
                                                                 'ownership': "B"}))
445
446
    def test_path7_1_1(self):
447
        """Tests paths between all users using constrained path algorithm,
448
        with the delay constraint set to 50, the bandwidth constraint set
449
        to 100, the reliability constraint set to 3, and the ownership
450
        constraint set to 'B'
451
        """
452
        # delay = 50
453
        self.assertTrue(self.paths_between_all_users("S6:3", {'delay': 50,
454
                                                              'bandwidth': 100,
455
                                                              'ownership': "B"}))
456
457
    def test_path7_1_2(self):
458
        """Tests paths between all users using constrained path algorithm,
459
        with the delay constraint set to 50, the bandwidth constraint set
460
        to 100, the reliability constraint set to 3, and the ownership
461
        constraint set to 'B'
462
        """
463
        # delay = 50
464
        self.assertTrue(self.paths_between_all_users("S9:1", {'delay': 50,
465
                                                              'bandwidth': 100,
466
                                                              'ownership': "B"}))
467
468
    def test_path7_1_3(self):
469
        """Tests paths between all users using constrained path algorithm,
470
        with the delay constraint set to 50, the bandwidth constraint set
471
        to 100, the reliability constraint set to 3, and the ownership
472
        constraint set to 'B'
473
        """
474
        # delay = 50
475
        self.assertTrue(self.paths_between_all_users("S6:4", {'delay': 50,
476
                                                              'bandwidth': 100,
477
                                                              'ownership': "B"}))
478
479
    def test_path7_1_4(self):
480
        """Tests paths between all users using constrained path algorithm,
481
        with the delay constraint set to 50, the bandwidth constraint set
482
        to 100, the reliability constraint set to 3, and the ownership
483
        constraint set to 'B'
484
        """
485
        # delay = 50
486
        self.assertTrue(self.paths_between_all_users("S9:2", {'delay': 50,
487
                                                              'bandwidth': 100,
488
                                                              'ownership': "B"}))
489
490
    def test_path7_1_5(self):
491
        """Tests paths between all users using constrained path algorithm,
492
        with the delay constraint set to 50, the bandwidth constraint set
493
        to 100, the reliability constraint set to 3, and the ownership
494
        constraint set to 'B'
495
        """
496
        # delay = 50
497
        self.assertTrue(self.paths_between_all_users("S6:5", {'delay': 50,
498
                                                              'bandwidth': 100,
499
                                                              'ownership': "B"}))
500
501
    def test_path7_1_6(self):
502
        """Tests paths between all users using constrained path algorithm,
503
        with the delay constraint set to 50, the bandwidth constraint set
504
        to 100, the reliability constraint set to 3, and the ownership
505
        constraint set to 'B'
506
        """
507
        # delay = 50
508
        self.assertTrue(self.paths_between_all_users("S10:1", {'delay': 50,
509
                                                               'bandwidth': 100,
510
                                                               'ownership': "B"}))
511
512
    def test_path7_1_7(self):
513
        """Tests paths between all users using constrained path algorithm,
514
        with the delay constraint set to 50, the bandwidth constraint set
515
        to 100, the reliability constraint set to 3, and the ownership
516
        constraint set to 'B'
517
        """
518
        # delay = 50
519
        self.assertTrue(self.paths_between_all_users("S8:5", {'delay': 50,
520
                                                              'bandwidth': 100,
521
                                                              'ownership': "B"}))
522
523
    def test_path7_1_8(self):
524
        """Tests paths between all users using constrained path algorithm,
525
        with the delay constraint set to 50, the bandwidth constraint set
526
        to 100, the reliability constraint set to 3, and the ownership
527
        constraint set to 'B'
528
        """
529
        # delay = 50
530
        self.assertTrue(self.paths_between_all_users("S9:4", {'delay': 50,
531
                                                              'bandwidth': 100,
532
                                                              'ownership': "B"}))
533
534
    def test_path7_1_9(self):
535
        """Tests paths between all users using constrained path algorithm,
536
        with the delay constraint set to 50, the bandwidth constraint set
537
        to 100, the reliability constraint set to 3, and the ownership
538
        constraint set to 'B'
539
        """
540
        # delay = 50
541
        self.assertTrue(self.paths_between_all_users("User1:4", {'delay': 50,
542
                                                                 'bandwidth': 100,
543
                                                                 'ownership': "B"}))
544
545
    def test_path7_2_0(self):
546
        """Tests paths between all users using constrained path algorithm,
547
        with the delay constraint set to 50, the bandwidth constraint set
548
        to 100, the reliability constraint set to 3, and the ownership
549
        constraint set to 'B'
550
        """
551
        # delay = 50
552
        self.assertTrue(self.paths_between_all_users("User4:3", {'delay': 50,
553
                                                                 'bandwidth': 100,
554
                                                                 'ownership': "B"}))
555
556
    def test_path7_2_1(self):
557
        """Tests paths between all users using constrained path algorithm,
558
        with the delay constraint set to 50, the bandwidth constraint set
559
        to 100, the reliability constraint set to 3, and the ownership
560
        constraint set to 'B'
561
        """
562
        # bandwidth = 100
563
        self.assertTrue(self.paths_between_all_users("S3:1", {'delay': 50,
564
                                                              'bandwidth': 100,
565
                                                              'ownership': "B"}))
566
567
    def test_path7_2_2(self):
568
        """Tests paths between all users using constrained path algorithm,
569
        with the delay constraint set to 50, the bandwidth constraint set
570
        to 100, the reliability constraint set to 3, and the ownership
571
        constraint set to 'B'
572
        """
573
        # bandwidth = 100
574
        self.assertTrue(self.paths_between_all_users("S5:1", {'delay': 50,
575
                                                              'bandwidth': 100,
576
                                                              'ownership': "B"}))
577
578
    def test_path7_2_3(self):
579
        """Tests paths between all users using constrained path algorithm,
580
        with the delay constraint set to 50, the bandwidth constraint set
581
        to 100, the reliability constraint set to 3, and the ownership
582
        constraint set to 'B'
583
        """
584
        # bandwidth = 100
585
        self.assertTrue(self.paths_between_all_users("User1:4", {'delay': 50,
586
                                                                 'bandwidth': 100,
587
                                                                 'ownership': "B"}))
588
589
    def test_path7_2_4(self):
590
        """Tests paths between all users using constrained path algorithm,
591
        with the delay constraint set to 50, the bandwidth constraint set
592
        to 100, the reliability constraint set to 3, and the ownership
593
        constraint set to 'B'
594
        """
595
        # bandwidth = 100
596
        self.assertTrue(self.paths_between_all_users("User4:3", {'delay': 50,
597
                                                                 'bandwidth': 100,
598
                                                                 'ownership': "B"}))
599
600
    def test_path7_2_5(self):
601
        """Tests paths between all users using constrained path algorithm,
602
        with the delay constraint set to 50, the bandwidth constraint set
603
        to 100, the reliability constraint set to 3, and the ownership
604
        constraint set to 'B'
605
        """
606
        # reliability = 3
607
        self.assertTrue(self.paths_between_all_users("S4:1", {'delay': 50,
608
                                                              'bandwidth': 100,
609
                                                              'ownership': "B"}))
610
611
    def test_path7_2_6(self):
612
        """Tests paths between all users using constrained path algorithm,
613
        with the delay constraint set to 50, the bandwidth constraint set
614
        to 100, the reliability constraint set to 3, and the ownership
615
        constraint set to 'B'
616
        """
617
        # reliability = 3
618
        self.assertTrue(self.paths_between_all_users("S5:2", {'delay': 50,
619
                                                              'bandwidth': 100,
620
                                                              'ownership': "B"}))
621
622
    def test_path7_2_7(self):
623
        """Tests paths between all users using constrained path algorithm,
624
        with the delay constraint set to 50, the bandwidth constraint set
625
        to 100, the reliability constraint set to 3, and the ownership
626
        constraint set to 'B'
627
        """
628
        # reliability = 3
629
        self.assertTrue(self.paths_between_all_users("S5:3", {'delay': 50,
630
                                                              'bandwidth': 100,
631
                                                              'ownership': "B"}))
632
633
    def test_path7_2_8(self):
634
        """Tests paths between all users using constrained path algorithm,
635
        with the delay constraint set to 50, the bandwidth constraint set
636
        to 100, the reliability constraint set to 3, and the ownership
637
        constraint set to 'B'
638
        """
639
        # reliability = 3
640
        self.assertTrue(self.paths_between_all_users("S6:1", {'delay': 50,
641
                                                              'bandwidth': 100,
642
                                                              'ownership': "B"}))
643
644
    def test_path7_2_9(self):
645
        """Tests paths between all users using constrained path algorithm,
646
        with the delay constraint set to 50, the bandwidth constraint set
647
        to 100, the reliability constraint set to 3, and the ownership
648
        constraint set to 'B'
649
        """
650
        # ownership = "B"
651
        self.assertTrue(self.paths_between_all_users("S4:1", {'delay': 50,
652
                                                              'bandwidth': 100,
653
                                                              'ownership': "B"}))
654
655
    def test_path7_3_0(self):
656
        """Tests paths between all users using constrained path algorithm,
657
        with the delay constraint set to 50, the bandwidth constraint set
658
        to 100, the reliability constraint set to 3, and the ownership
659
        constraint set to 'B'
660
        """
661
        # ownership = "B"
662
        self.assertTrue(self.paths_between_all_users("S5:2", {'delay': 50,
663
                                                              'bandwidth': 100,
664
                                                              'ownership': "B"}))
665
666
    def test_path7_3_1(self):
667
        """Tests paths between all users using constrained path algorithm,
668
        with the delay constraint set to 50, the bandwidth constraint set
669
        to 100, the reliability constraint set to 3, and the ownership
670
        constraint set to 'B'
671
        """
672
        # ownership = "B"
673
        self.assertTrue(self.paths_between_all_users("S4:2", {'delay': 50,
674
                                                              'bandwidth': 100,
675
                                                              'ownership': "B"}))
676
677
    def test_path7_3_2(self):
678
        """Tests paths between all users using constrained path algorithm,
679
        with the delay constraint set to 50, the bandwidth constraint set
680
        to 100, the reliability constraint set to 3, and the ownership
681
        constraint set to 'B'
682
        """
683
        # ownership = "B"
684
        self.assertTrue(self.paths_between_all_users("User1:2", {'delay': 50,
685
                                                                 'bandwidth': 100,
686
                                                                 'ownership': "B"}))
687
688
    def test_path7_3_3(self):
689
        """Tests paths between all users using constrained path algorithm,
690
        with the delay constraint set to 50, the bandwidth constraint set
691
        to 100, the reliability constraint set to 3, and the ownership
692
        constraint set to 'B'
693
        """
694
        # ownership = "B"
695
        self.assertTrue(self.paths_between_all_users("S5:4", {'delay': 50,
696
                                                              'bandwidth': 100,
697
                                                              'ownership': "B"}))
698
699
    def test_path7_3_4(self):
700
        """Tests paths between all users using constrained path algorithm,
701
        with the delay constraint set to 50, the bandwidth constraint set
702
        to 100, the reliability constraint set to 3, and the ownership
703
        constraint set to 'B'
704
        """
705
        # ownership = "B"
706
        self.assertTrue(self.paths_between_all_users("S6:2", {'delay': 50,
707
                                                              'bandwidth': 100,
708
                                                              'ownership': "B"}))
709
710
    def test_path7_3_5(self):
711
        """Tests paths between all users using constrained path algorithm,
712
        with the delay constraint set to 50, the bandwidth constraint set
713
        to 100, the reliability constraint set to 3, and the ownership
714
        constraint set to 'B'
715
        """
716
        # ownership = "B"
717
        self.assertTrue(self.paths_between_all_users("S6:5", {'delay': 50,
718
                                                              'bandwidth': 100,
719
                                                              'ownership': "B"}))
720
721
    def test_path7_3_6(self):
722
        """Tests paths between all users using constrained path algorithm,
723
        with the delay constraint set to 50, the bandwidth constraint set
724
        to 100, the reliability constraint set to 3, and the ownership
725
        constraint set to 'B'
726
        """
727
        # ownership = "B"
728
        self.assertTrue(self.paths_between_all_users("S10:1", {'delay': 50,
729
                                                               'bandwidth': 100,
730
                                                               'ownership': "B"}))
731
732
    def test_path7_3_7(self):
733
        """Tests paths between all users using constrained path algorithm,
734
        with the delay constraint set to 50, the bandwidth constraint set
735
        to 100, the reliability constraint set to 3, and the ownership
736
        constraint set to 'B'
737
        """
738
        # ownership = "B"
739
        self.assertTrue(self.paths_between_all_users("S8:6", {'delay': 50,
740
                                                              'bandwidth': 100,
741
                                                              'ownership': "B"}))
742
743
    def test_path7_3_8(self):
744
        """Tests paths between all users using constrained path algorithm,
745
        with the delay constraint set to 50, the bandwidth constraint set
746
        to 100, the reliability constraint set to 3, and the ownership
747
        constraint set to 'B'
748
        """
749
        # ownership = "B"
750
        self.assertTrue(self.paths_between_all_users("S10:2", {'delay': 50,
751
                                                               'bandwidth': 100,
752
                                                               'ownership': "B"}))
753
754
    def test_path7_3_9(self):
755
        """Tests paths between all users using constrained path algorithm,
756
        with the delay constraint set to 50, the bandwidth constraint set
757
        to 100, the reliability constraint set to 3, and the ownership
758
        constraint set to 'B'
759
        """
760
        # ownership = "B"
761
        self.assertTrue(self.paths_between_all_users("S10:3", {'delay': 50,
762
                                                               'bandwidth': 100,
763
                                                               'ownership': "B"}))
764
765
    def test_path7_4_0(self):
766
        """Tests paths between all users using constrained path algorithm,
767
        with the delay constraint set to 50, the bandwidth constraint set
768
        to 100, the reliability constraint set to 3, and the ownership
769
        constraint set to 'B'
770
        """
771
        # ownership = "B"
772
        self.assertTrue(self.paths_between_all_users("User2:1", {'delay': 50,
773
                                                                 'bandwidth': 100,
774
                                                                 'ownership': "B"}))
775
776
    def test_path8_1(self):
777
        """Tests paths between all users using constrained path algorithm,
778
        with the delay constraint set to 50, the bandwidth constraint
779
        set to 100, the reliability constraint set to 3, and the ownership
780
        constraint set to 'B'
781
782
        Tests conducted with flexibility enabled
783
        """
784
        # delay = 50
785
        self.assertTrue(self.paths_between_all_users("S1:1", flexible={'delay': 50,
786
                                                                       'bandwidth': 100,
787
                                                                       'reliability': 3,
788
                                                                       'ownership': "B"},
789
                                                     metrics='delay'))
790
791
    def test_path8_2(self):
792
        """Tests paths between all users using constrained path algorithm,
793
        with the delay constraint set to 50, the bandwidth constraint
794
        set to 100, the reliability constraint set to 3, and the ownership
795
        constraint set to 'B'
796
797
        Tests conducted with flexibility enabled
798
        """
799
        # delay = 50
800
        self.assertTrue(self.paths_between_all_users("S2:1", flexible={'delay': 50,
801
                                                                       'bandwidth': 100,
802
                                                                       'reliability': 3,
803
                                                                       'ownership': "B"},
804
                                                     metrics='delay'))
805
806
    def test_path8_3(self):
807
        """Tests paths between all users using constrained path algorithm,
808
        with the delay constraint set to 50, the bandwidth constraint
809
        set to 100, the reliability constraint set to 3, and the ownership
810
        constraint set to 'B'
811
812
        Tests conducted with flexibility enabled
813
        """
814
        # delay = 50
815
        self.assertTrue(self.paths_between_all_users("S3:1", flexible={'delay': 50,
816
                                                                       'bandwidth': 100,
817
                                                                       'reliability': 3,
818
                                                                       'ownership': "B"},
819
                                                     metrics='delay'))
820
821
    def test_path8_4(self):
822
        """Tests paths between all users using constrained path algorithm,
823
        with the delay constraint set to 50, the bandwidth constraint
824
        set to 100, the reliability constraint set to 3, and the ownership
825
        constraint set to 'B'
826
827
        Tests conducted with flexibility enabled
828
        """
829
        # delay = 50
830
        self.assertTrue(self.paths_between_all_users("S5:1", flexible={'delay': 50,
831
                                                                       'bandwidth': 100,
832
                                                                       'reliability': 3,
833
                                                                       'ownership': "B"},
834
                                                     metrics='delay'))
835
836
    def test_path8_5(self):
837
        """Tests paths between all users using constrained path algorithm,
838
        with the delay constraint set to 50, the bandwidth constraint
839
        set to 100, the reliability constraint set to 3, and the ownership
840
        constraint set to 'B'
841
842
        Tests conducted with flexibility enabled
843
        """
844
        # delay = 50
845
        self.assertTrue(self.paths_between_all_users("S4:2", flexible={'delay': 50,
846
                                                                       'bandwidth': 100,
847
                                                                       'reliability': 3,
848
                                                                       'ownership': "B"},
849
                                                     metrics='delay'))
850
851
    def test_path8_6(self):
852
        """Tests paths between all users using constrained path algorithm,
853
        with the delay constraint set to 50, the bandwidth constraint
854
        set to 100, the reliability constraint set to 3, and the ownership
855
        constraint set to 'B'
856
857
        Tests conducted with flexibility enabled
858
        """
859
        # delay = 50
860
        self.assertTrue(self.paths_between_all_users("User1:2", flexible={'delay': 50,
861
                                                                          'bandwidth': 100,
862
                                                                          'reliability': 3,
863
                                                                          'ownership': "B"},
864
                                                     metrics='delay'))
865
866
    def test_path8_7(self):
867
        """Tests paths between all users using constrained path algorithm,
868
        with the delay constraint set to 50, the bandwidth constraint
869
        set to 100, the reliability constraint set to 3, and the ownership
870
        constraint set to 'B'
871
872
        Tests conducted with flexibility enabled
873
        """
874
        # delay = 50
875
        self.assertTrue(self.paths_between_all_users("S5:5", flexible={'delay': 50,
876
                                                                       'bandwidth': 100,
877
                                                                       'reliability': 3,
878
                                                                       'ownership': "B"},
879
                                                     metrics='delay'))
880
881
    def test_path8_8(self):
882
        """Tests paths between all users using constrained path algorithm,
883
        with the delay constraint set to 50, the bandwidth constraint
884
        set to 100, the reliability constraint set to 3, and the ownership
885
        constraint set to 'B'
886
887
        Tests conducted with flexibility enabled
888
        """
889
        # delay = 50
890
        self.assertTrue(self.paths_between_all_users("S8:2", flexible={'delay': 50,
891
                                                                       'bandwidth': 100,
892
                                                                       'reliability': 3,
893
                                                                       'ownership': "B"},
894
                                                     metrics='delay'))
895
896
    def test_path8_9(self):
897
        """Tests paths between all users using constrained path algorithm,
898
        with the delay constraint set to 50, the bandwidth constraint
899
        set to 100, the reliability constraint set to 3, and the ownership
900
        constraint set to 'B'
901
902
        Tests conducted with flexibility enabled
903
        """
904
        # delay = 50
905
        self.assertTrue(self.paths_between_all_users("S5:6", flexible={'delay': 50,
906
                                                                       'bandwidth': 100,
907
                                                                       'reliability': 3,
908
                                                                       'ownership': "B"},
909
                                                     metrics='delay'))
910
911
    def test_path8_1_0(self):
912
        """Tests paths between all users using constrained path algorithm,
913
        with the delay constraint set to 50, the bandwidth constraint
914
        set to 100, the reliability constraint set to 3, and the ownership
915
        constraint set to 'B'
916
917
        Tests conducted with flexibility enabled
918
        """
919
        # delay = 50
920
        self.assertTrue(self.paths_between_all_users("User1:3", flexible={'delay': 50,
921
                                                                          'bandwidth': 100,
922
                                                                          'reliability': 3,
923
                                                                          'ownership': "B"},
924
                                                     metrics='delay'))
925
926
    def test_path8_1_1(self):
927
        """Tests paths between all users using constrained path algorithm,
928
        with the delay constraint set to 50, the bandwidth constraint
929
        set to 100, the reliability constraint set to 3, and the ownership
930
        constraint set to 'B'
931
932
        Tests conducted with flexibility enabled
933
        """
934
        # delay = 50
935
        self.assertTrue(self.paths_between_all_users("S6:3", flexible={'delay': 50,
936
                                                                       'bandwidth': 100,
937
                                                                       'reliability': 3,
938
                                                                       'ownership': "B"},
939
                                                     metrics='delay'))
940
941
    def test_path8_1_2(self):
942
        """Tests paths between all users using constrained path algorithm,
943
        with the delay constraint set to 50, the bandwidth constraint
944
        set to 100, the reliability constraint set to 3, and the ownership
945
        constraint set to 'B'
946
947
        Tests conducted with flexibility enabled
948
        """
949
        # delay = 50
950
        self.assertTrue(self.paths_between_all_users("S9:1", flexible={'delay': 50,
951
                                                                       'bandwidth': 100,
952
                                                                       'reliability': 3,
953
                                                                       'ownership': "B"},
954
                                                     metrics='delay'))
955
956
    def test_path8_1_3(self):
957
        """Tests paths between all users using constrained path algorithm,
958
        with the delay constraint set to 50, the bandwidth constraint
959
        set to 100, the reliability constraint set to 3, and the ownership
960
        constraint set to 'B'
961
962
        Tests conducted with flexibility enabled
963
        """
964
        # delay = 50
965
        self.assertTrue(self.paths_between_all_users("S6:4", flexible={'delay': 50,
966
                                                                       'bandwidth': 100,
967
                                                                       'reliability': 3,
968
                                                                       'ownership': "B"},
969
                                                     metrics='delay'))
970
971
    def test_path8_1_4(self):
972
        """Tests paths between all users using constrained path algorithm,
973
        with the delay constraint set to 50, the bandwidth constraint
974
        set to 100, the reliability constraint set to 3, and the ownership
975
        constraint set to 'B'
976
977
        Tests conducted with flexibility enabled
978
        """
979
        # delay = 50
980
        self.assertTrue(self.paths_between_all_users("S9:2", flexible={'delay': 50,
981
                                                                       'bandwidth': 100,
982
                                                                       'reliability': 3,
983
                                                                       'ownership': "B"},
984
                                                     metrics='delay'))
985
986
    def test_path8_1_5(self):
987
        """Tests paths between all users using constrained path algorithm,
988
        with the delay constraint set to 50, the bandwidth constraint
989
        set to 100, the reliability constraint set to 3, and the ownership
990
        constraint set to 'B'
991
992
        Tests conducted with flexibility enabled
993
        """
994
        # delay = 50
995
        self.assertTrue(self.paths_between_all_users("S6:5", flexible={'delay': 50,
996
                                                                       'bandwidth': 100,
997
                                                                       'reliability': 3,
998
                                                                       'ownership': "B"},
999
                                                     metrics='delay'))
1000
1001
    def test_path8_1_6(self):
1002
        """Tests paths between all users using constrained path algorithm,
1003
        with the delay constraint set to 50, the bandwidth constraint
1004
        set to 100, the reliability constraint set to 3, and the ownership
1005
        constraint set to 'B'
1006
1007
        Tests conducted with flexibility enabled
1008
        """
1009
        # delay = 50
1010
        self.assertTrue(self.paths_between_all_users("S10:1", flexible={'delay': 50,
1011
                                                                        'bandwidth': 100,
1012
                                                                        'reliability': 3,
1013
                                                                        'ownership': "B"},
1014
                                                     metrics='delay'))
1015
1016
    def test_path8_1_7(self):
1017
        """Tests paths between all users using constrained path algorithm,
1018
        with the delay constraint set to 50, the bandwidth constraint
1019
        set to 100, the reliability constraint set to 3, and the ownership
1020
        constraint set to 'B'
1021
1022
        Tests conducted with flexibility enabled
1023
        """
1024
        # delay = 50
1025
        self.assertTrue(self.paths_between_all_users("S8:5", flexible={'delay': 50,
1026
                                                                       'bandwidth': 100,
1027
                                                                       'reliability': 3,
1028
                                                                       'ownership': "B"},
1029
                                                     metrics='delay'))
1030
1031
    def test_path8_1_8(self):
1032
        """Tests paths between all users using constrained path algorithm,
1033
        with the delay constraint set to 50, the bandwidth constraint
1034
        set to 100, the reliability constraint set to 3, and the ownership
1035
        constraint set to 'B'
1036
1037
        Tests conducted with flexibility enabled
1038
        """
1039
        # delay = 50
1040
        self.assertTrue(self.paths_between_all_users("S9:4", flexible={'delay': 50,
1041
                                                                       'bandwidth': 100,
1042
                                                                       'reliability': 3,
1043
                                                                       'ownership': "B"},
1044
                                                     metrics='delay'))
1045
1046
    def test_path8_1_9(self):
1047
        """Tests paths between all users using constrained path algorithm,
1048
        with the delay constraint set to 50, the bandwidth constraint
1049
        set to 100, the reliability constraint set to 3, and the ownership
1050
        constraint set to 'B'
1051
1052
        Tests conducted with flexibility enabled
1053
        """
1054
        # delay = 50
1055
        self.assertTrue(self.paths_between_all_users("User1:4", flexible={'delay': 50,
1056
                                                                          'bandwidth': 100,
1057
                                                                          'reliability': 3,
1058
                                                                          'ownership': "B"},
1059
                                                     metrics='delay'))
1060
1061
    def test_path8_2_0(self):
1062
        """Tests paths between all users using constrained path algorithm,
1063
        with the delay constraint set to 50, the bandwidth constraint
1064
        set to 100, the reliability constraint set to 3, and the ownership
1065
        constraint set to 'B'
1066
1067
        Tests conducted with flexibility enabled
1068
        """
1069
        # delay = 50
1070
        self.assertTrue(self.paths_between_all_users("User4:3", flexible={'delay': 50,
1071
                                                                          'bandwidth': 100,
1072
                                                                          'reliability': 3,
1073
                                                                          'ownership': "B"},
1074
                                                     metrics='delay'))
1075
1076
    def test_path8_2_1(self):
1077
        """Tests paths between all users using constrained path algorithm,
1078
        with the delay constraint set to 50, the bandwidth constraint
1079
        set to 100, the reliability constraint set to 3, and the ownership
1080
        constraint set to 'B'
1081
1082
        Tests conducted with flexibility enabled
1083
        """
1084
        # bandwidth = 100
1085
        self.assertTrue(self.paths_between_all_users("S3:1", flexible={'delay': 50,
1086
                                                                       'bandwidth': 100,
1087
                                                                       'reliability': 3,
1088
                                                                       'ownership': "B"},
1089
                                                     metrics='bandwidth'))
1090
1091
    def test_path8_2_2(self):
1092
        """Tests paths between all users using constrained path algorithm,
1093
        with the delay constraint set to 50, the bandwidth constraint
1094
        set to 100, the reliability constraint set to 3, and the ownership
1095
        constraint set to 'B'
1096
1097
        Tests conducted with flexibility enabled
1098
        """
1099
        # bandwidth = 100
1100
        self.assertTrue(self.paths_between_all_users("S5:1", flexible={'delay': 50,
1101
                                                                       'bandwidth': 100,
1102
                                                                       'reliability': 3,
1103
                                                                       'ownership': "B"},
1104
                                                     metrics='bandwidth'))
1105
1106
    def test_path8_2_3(self):
1107
        """Tests paths between all users using constrained path algorithm,
1108
        with the delay constraint set to 50, the bandwidth constraint
1109
        set to 100, the reliability constraint set to 3, and the ownership
1110
        constraint set to 'B'
1111
1112
        Tests conducted with flexibility enabled
1113
        """
1114
        # bandwidth = 100
1115
        self.assertTrue(self.paths_between_all_users("User1:4", flexible={'delay': 50,
1116
                                                                          'bandwidth': 100,
1117
                                                                          'reliability': 3,
1118
                                                                          'ownership': "B"},
1119
                                                     metrics='bandwidth'))
1120
1121
    def test_path8_2_4(self):
1122
        """Tests paths between all users using constrained path algorithm,
1123
        with the delay constraint set to 50, the bandwidth constraint
1124
        set to 100, the reliability constraint set to 3, and the ownership
1125
        constraint set to 'B'
1126
1127
        Tests conducted with flexibility enabled
1128
        """
1129
        # bandwidth = 100
1130
        self.assertTrue(self.paths_between_all_users("User4:3", flexible={'delay': 50,
1131
                                                                          'bandwidth': 100,
1132
                                                                          'reliability': 3,
1133
                                                                          'ownership': "B"},
1134
                                                     metrics='bandwidth'))
1135
1136
    def test_path8_2_5(self):
1137
        """Tests paths between all users using constrained path algorithm,
1138
        with the delay constraint set to 50, the bandwidth constraint
1139
        set to 100, the reliability constraint set to 3, and the ownership
1140
        constraint set to 'B'
1141
1142
        Tests conducted with flexibility enabled
1143
        """
1144
        # reliability = 3
1145
        self.assertTrue(self.paths_between_all_users("S4:1", flexible={'delay': 50,
1146
                                                                       'bandwidth': 100,
1147
                                                                       'reliability': 3,
1148
                                                                       'ownership': "B"},
1149
                                                     metrics='reliability'))
1150
1151
    def test_path8_2_6(self):
1152
        """Tests paths between all users using constrained path algorithm,
1153
        with the delay constraint set to 50, the bandwidth constraint
1154
        set to 100, the reliability constraint set to 3, and the ownership
1155
        constraint set to 'B'
1156
1157
        Tests conducted with flexibility enabled
1158
        """
1159
        # reliability = 3
1160
        self.assertTrue(self.paths_between_all_users("S5:2", flexible={'delay': 50,
1161
                                                                       'bandwidth': 100,
1162
                                                                       'reliability': 3,
1163
                                                                       'ownership': "B"},
1164
                                                     metrics='reliability'))
1165
1166
    def test_path8_2_7(self):
1167
        """Tests paths between all users using constrained path algorithm,
1168
        with the delay constraint set to 50, the bandwidth constraint
1169
        set to 100, the reliability constraint set to 3, and the ownership
1170
        constraint set to 'B'
1171
1172
        Tests conducted with flexibility enabled
1173
        """
1174
        # reliability = 3
1175
        self.assertTrue(self.paths_between_all_users("S5:3", flexible={'delay': 50,
1176
                                                                       'bandwidth': 100,
1177
                                                                       'reliability': 3,
1178
                                                                       'ownership': "B"},
1179
                                                     metrics='reliability'))
1180
1181
    def test_path8_2_8(self):
1182
        """Tests paths between all users using constrained path algorithm,
1183
        with the delay constraint set to 50, the bandwidth constraint
1184
        set to 100, the reliability constraint set to 3, and the ownership
1185
        constraint set to 'B'
1186
1187
        Tests conducted with flexibility enabled
1188
        """
1189
        # reliability = 3
1190
        self.assertTrue(self.paths_between_all_users("S6:1", flexible={'delay': 50,
1191
                                                                       'bandwidth': 100,
1192
                                                                       'reliability': 3,
1193
                                                                       'ownership': "B"},
1194
                                                     metrics='reliability'))
1195
1196
    def test_path8_2_9(self):
1197
        """Tests paths between all users using constrained path algorithm,
1198
        with the delay constraint set to 50, the bandwidth constraint
1199
        set to 100, the reliability constraint set to 3, and the ownership
1200
        constraint set to 'B'
1201
1202
        Tests conducted with flexibility enabled
1203
        """
1204
        # ownership = "B"
1205
        self.assertTrue(self.paths_between_all_users("S4:1", flexible={'delay': 50,
1206
                                                                       'bandwidth': 100,
1207
                                                                       'reliability': 3,
1208
                                                                       'ownership': "B"}))
1209
1210
    def test_path8_3_0(self):
1211
        """Tests paths between all users using constrained path algorithm,
1212
        with the delay constraint set to 50, the bandwidth constraint
1213
        set to 100, the reliability constraint set to 3, and the ownership
1214
        constraint set to 'B'
1215
1216
        Tests conducted with flexibility enabled
1217
        """
1218
        # ownership = "B"
1219
        self.assertTrue(self.paths_between_all_users("S5:2", flexible={'delay': 50,
1220
                                                                       'bandwidth': 100,
1221
                                                                       'reliability': 3,
1222
                                                                       'ownership': "B"}))
1223
1224
    def test_path8_3_1(self):
1225
        """Tests paths between all users using constrained path algorithm,
1226
        with the delay constraint set to 50, the bandwidth constraint
1227
        set to 100, the reliability constraint set to 3, and the ownership
1228
        constraint set to 'B'
1229
1230
        Tests conducted with flexibility enabled
1231
        """
1232
        # ownership = "B"
1233
        self.assertTrue(self.paths_between_all_users("S4:2", flexible={'delay': 50,
1234
                                                                       'bandwidth': 100,
1235
                                                                       'reliability': 3,
1236
                                                                       'ownership': "B"}))
1237
1238
    def test_path8_3_2(self):
1239
        """Tests paths between all users using constrained path algorithm,
1240
        with the delay constraint set to 50, the bandwidth constraint
1241
        set to 100, the reliability constraint set to 3, and the ownership
1242
        constraint set to 'B'
1243
1244
        Tests conducted with flexibility enabled
1245
        """
1246
        # ownership = "B"
1247
        self.assertTrue(self.paths_between_all_users("User1:2", flexible={'delay': 50,
1248
                                                                          'bandwidth': 100,
1249
                                                                          'reliability': 3,
1250
                                                                          'ownership': "B"}))
1251
1252
    def test_path8_3_3(self):
1253
        """Tests paths between all users using constrained path algorithm,
1254
        with the delay constraint set to 50, the bandwidth constraint
1255
        set to 100, the reliability constraint set to 3, and the ownership
1256
        constraint set to 'B'
1257
1258
        Tests conducted with flexibility enabled
1259
        """
1260
        # ownership = "B"
1261
        self.assertTrue(self.paths_between_all_users("S5:4", flexible={'delay': 50,
1262
                                                                       'bandwidth': 100,
1263
                                                                       'reliability': 3,
1264
                                                                       'ownership': "B"}))
1265
1266
    def test_path8_3_4(self):
1267
        """Tests paths between all users using constrained path algorithm,
1268
        with the delay constraint set to 50, the bandwidth constraint
1269
        set to 100, the reliability constraint set to 3, and the ownership
1270
        constraint set to 'B'
1271
1272
        Tests conducted with flexibility enabled
1273
        """
1274
        # ownership = "B"
1275
        self.assertTrue(self.paths_between_all_users("S6:2", flexible={'delay': 50,
1276
                                                                       'bandwidth': 100,
1277
                                                                       'reliability': 3,
1278
                                                                       'ownership': "B"}))
1279
1280
    def test_path8_3_5(self):
1281
        """Tests paths between all users using constrained path algorithm,
1282
        with the delay constraint set to 50, the bandwidth constraint
1283
        set to 100, the reliability constraint set to 3, and the ownership
1284
        constraint set to 'B'
1285
1286
        Tests conducted with flexibility enabled
1287
        """
1288
        # ownership = "B"
1289
        self.assertTrue(self.paths_between_all_users("S6:5", flexible={'delay': 50,
1290
                                                                       'bandwidth': 100,
1291
                                                                       'reliability': 3,
1292
                                                                       'ownership': "B"}))
1293
1294
    def test_path8_3_6(self):
1295
        """Tests paths between all users using constrained path algorithm,
1296
        with the delay constraint set to 50, the bandwidth constraint
1297
        set to 100, the reliability constraint set to 3, and the ownership
1298
        constraint set to 'B'
1299
1300
        Tests conducted with flexibility enabled
1301
        """
1302
        # ownership = "B"
1303
        self.assertTrue(self.paths_between_all_users("S10:1", flexible={'delay': 50,
1304
                                                                        'bandwidth': 100,
1305
                                                                        'reliability': 3,
1306
                                                                        'ownership': "B"}))
1307
1308
    def test_path8_3_7(self):
1309
        """Tests paths between all users using constrained path algorithm,
1310
        with the delay constraint set to 50, the bandwidth constraint
1311
        set to 100, the reliability constraint set to 3, and the ownership
1312
        constraint set to 'B'
1313
1314
        Tests conducted with flexibility enabled
1315
        """
1316
        # ownership = "B"
1317
        self.assertTrue(self.paths_between_all_users("S8:6", flexible={'delay': 50,
1318
                                                                       'bandwidth': 100,
1319
                                                                       'reliability': 3,
1320
                                                                       'ownership': "B"}))
1321
1322
    def test_path8_3_8(self):
1323
        """Tests paths between all users using constrained path algorithm,
1324
        with the delay constraint set to 50, the bandwidth constraint
1325
        set to 100, the reliability constraint set to 3, and the ownership
1326
        constraint set to 'B'
1327
1328
        Tests conducted with flexibility enabled
1329
        """
1330
        # ownership = "B"
1331
        self.assertTrue(self.paths_between_all_users("S10:2", flexible={'delay': 50,
1332
                                                                        'bandwidth': 100,
1333
                                                                        'reliability': 3,
1334
                                                                        'ownership': "B"}))
1335
1336
    def test_path8_3_9(self):
1337
        """Tests paths between all users using constrained path algorithm,
1338
        with the delay constraint set to 50, the bandwidth constraint
1339
        set to 100, the reliability constraint set to 3, and the ownership
1340
        constraint set to 'B'
1341
1342
        Tests conducted with flexibility enabled
1343
        """
1344
        # ownership = "B"
1345
        self.assertTrue(self.paths_between_all_users("S10:3", flexible={'delay': 50,
1346
                                                                        'bandwidth': 100,
1347
                                                                        'reliability': 3,
1348
                                                                        'ownership': "B"}))
1349
1350
    def test_path8_4_0(self):
1351
        """Tests paths between all users using constrained path algorithm,
1352
        with the delay constraint set to 50, the bandwidth constraint
1353
        set to 100, the reliability constraint set to 3, and the ownership
1354
        constraint set to 'B'
1355
1356
        Tests conducted with flexibility enabled
1357
        """
1358
        # ownership = "B"
1359
        self.assertTrue(self.paths_between_all_users("User2:1", flexible={'delay': 50,
1360
                                                                          'bandwidth': 100,
1361
                                                                          'reliability': 3,
1362
                                                                          'ownership': "B"}))
1363
1364
    # def test_path8(self):
1365
    #     """Tests paths between all users using constrained path algorithm,
1366
    #     with the delay constraint set to 50, the bandwidth constraint
1367
    #     set to 100, the reliability constraint set to 3, and the ownership
1368
    #     constraint set to 'B'
1369
    #
1370
    #     Tests conducted with flexibility enabled
1371
    #     """
1372
    #     combos = combinations(["User1", "User2", "User3", "User4"], 2)
1373
    #     self.initializer()
1374
    #
1375
    #     for point_a, point_b in combos:
1376
    #         results = self.get_path_constrained(
1377
    #             point_a, point_b, flexible=dict(delay=50, bandwidth=100,
1378
    #                                             reliability=3,
1379
    #                                             ownership="B"))
1380
    #         for result in results:
1381
    #             # delay = 50 checks
1382
    #             # if "delay" in result["metrics"]:
1383
    #             #     for path in result["paths"]:
1384
    #             # self.assertNotIn("S1:1", path)
1385
    #             # self.assertNotIn("S2:1", path)
1386
    #             # self.assertNotIn("S3:1", path)
1387
    #             # self.assertNotIn("S5:1", path)
1388
    #             # self.assertNotIn("S4:2", path)
1389
    #             # self.assertNotIn("User1:2", path)
1390
    #             # self.assertNotIn("S5:5", path)
1391
    #             # self.assertNotIn("S8:2", path)
1392
    #             # self.assertNotIn("S5:6", path)
1393
    #             # self.assertNotIn("User1:3", path)
1394
    #             # self.assertNotIn("S6:3", path)
1395
    #             # self.assertNotIn("S9:1", path)
1396
    #             # self.assertNotIn("S6:4", path)
1397
    #             # self.assertNotIn("S9:2", path)
1398
    #             # self.assertNotIn("S6:5", path)
1399
    #             # self.assertNotIn("S10:1", path)
1400
    #             # self.assertNotIn("S8:5", path)
1401
    #             # self.assertNotIn("S9:4", path)
1402
    #             # self.assertNotIn("User1:4", path)
1403
    #             # self.assertNotIn("User4:3", path)
1404
    #
1405
    #             # bandwidth = 100 checks
1406
    #             # if "bandwidth" in result["metrics"]:
1407
    #             #     for path in result["paths"]:
1408
    #             #         # self.assertNotIn("S3:1", path)
1409
    #             #         # self.assertNotIn("S5:1", path)
1410
    #             #         # self.assertNotIn("User1:4", path)
1411
    #             #         self.assertNotIn("User4:3", path)
1412
    #
1413
    #             # # reliability = 3 checks
1414
    #             # if "reliability" in result["metrics"]:
1415
    #             #     for path in result["paths"]:
1416
    #             #         # self.assertNotIn("S4:1", path)
1417
    #             #         # self.assertNotIn("S5:2", path)
1418
    #             #         # self.assertNotIn("S5:3", path)
1419
    #             #         # self.assertNotIn("S6:1", path)
1420
    #
1421
    #             # ownership = "B" checks
1422
    #             if "ownership" in result["metrics"]:
1423
    #                 for path in result["paths"]:
1424
    #                     # self.assertNotIn("S4:1", path)
1425
    #                     # self.assertNotIn("S5:2", path)
1426
    #                     # self.assertNotIn("S4:2", path)
1427
    #                     # self.assertNotIn("User1:2", path)
1428
    #                     # self.assertNotIn("S5:4", path)
1429
    #                     # self.assertNotIn("S6:2", path)
1430
    #                     # self.assertNotIn("S6:5", path)
1431
    #                     # self.assertNotIn("S10:1", path)
1432
    #                     # self.assertNotIn("S8:6", path)
1433
    #                     # self.assertNotIn("S10:2", path)
1434
    #                     # self.assertNotIn("S10:3", path)
1435
    #                     self.assertNotIn("User2:1", path)
1436
1437
    def test_path9(self):
1438
        """Tests paths between all users using constrained path algorithm,
1439
        with the delay constraint set to 50, the bandwidth constraint
1440
        set to 100, the reliability constraint set to 3, and the ownership
1441
        constraint set to 'B'
1442
1443
        Tests conducted with all but ownership flexible
1444
        """
1445
        combos = combinations(["User1", "User2", "User3", "User4"], 2)
1446
        self.initializer()
1447
1448
        for point_a, point_b in combos:
1449
            results = self.get_path_constrained(point_a, point_b,
1450
                                                base={"ownership": "B"},
1451
                                                flexible={"delay": 50,
1452
                                                          "bandwidth": 100,
1453
                                                          "reliability": 3})
1454
            for result in results:
1455
                # delay = 50 checks
1456
                if "delay" in result["metrics"]:
1457
                    for path in result["paths"]:
1458
                        self.assertNotIn("S1:1", path)
1459
                        self.assertNotIn("S2:1", path)
1460
                        self.assertNotIn("S3:1", path)
1461
                        self.assertNotIn("S5:1", path)
1462
                        self.assertNotIn("S4:2", path)
1463
                        self.assertNotIn("User1:2", path)
1464
                        self.assertNotIn("S5:5", path)
1465
                        self.assertNotIn("S8:2", path)
1466
                        self.assertNotIn("S5:6", path)
1467
                        self.assertNotIn("User1:3", path)
1468
                        self.assertNotIn("S6:3", path)
1469
                        self.assertNotIn("S9:1", path)
1470
                        self.assertNotIn("S6:4", path)
1471
                        self.assertNotIn("S9:2", path)
1472
                        self.assertNotIn("S6:5", path)
1473
                        self.assertNotIn("S10:1", path)
1474
                        self.assertNotIn("S8:5", path)
1475
                        self.assertNotIn("S9:4", path)
1476
                        self.assertNotIn("User1:4", path)
1477
                        self.assertNotIn("User4:3", path)
1478
1479
                # bandwidth = 100 checks
1480
                if "bandwidth" in result["metrics"]:
1481
                    for path in result["paths"]:
1482
                        self.assertNotIn("S3:1", path)
1483
                        self.assertNotIn("S5:1", path)
1484
                        self.assertNotIn("User1:4", path)
1485
                        self.assertNotIn("User4:3", path)
1486
1487
                # reliability = 3 checks
1488
                if "reliability" in result["metrics"]:
1489
                    for path in result["paths"]:
1490
                        self.assertNotIn("S4:1", path)
1491
                        self.assertNotIn("S5:2", path)
1492
                        self.assertNotIn("S5:3", path)
1493
                        self.assertNotIn("S6:1", path)
1494
1495
                # ownership = "B" checks
1496
                self.assertIn("ownership", result["metrics"])
1497
                for path in result["paths"]:
1498
                    self.assertNotIn("S4:1", path)
1499
                    self.assertNotIn("S5:2", path)
1500
                    self.assertNotIn("S4:2", path)
1501
                    self.assertNotIn("User1:2", path)
1502
                    self.assertNotIn("S5:4", path)
1503
                    self.assertNotIn("S6:2", path)
1504
                    self.assertNotIn("S6:5", path)
1505
                    self.assertNotIn("S10:1", path)
1506
                    self.assertNotIn("S8:6", path)
1507
                    self.assertNotIn("S10:2", path)
1508
                    self.assertNotIn("S10:3", path)
1509
                    self.assertNotIn("User2:1", path)
1510
1511
    def test_path10(self):
1512
        """Tests that TypeError is generated by get_path_constrained
1513
1514
        Tests with ownership using an int type rather than string
1515
        """
1516
        self.initializer()
1517
1518
        with self.assertRaises(TypeError):
1519
            self.get_path_constrained(
1520
                "User1", "User2", base={"ownership": 1})
1521
1522
    @staticmethod
1523
    def generate_topology():
1524
        """Generates a predetermined topology"""
1525
        switches = {}
1526
        interfaces = {}
1527
        links = {}
1528
1529
        TestResults.create_switch("S1", switches)
1530
        TestResults.add_interfaces(2, switches["S1"], interfaces)
1531
1532
        TestResults.create_switch("S2", switches)
1533
        TestResults.add_interfaces(2, switches["S2"], interfaces)
1534
1535
        TestResults.create_switch("S3", switches)
1536
        TestResults.add_interfaces(6, switches["S3"], interfaces)
1537
1538
        TestResults.create_switch("S4", switches)
1539
        TestResults.add_interfaces(2, switches["S4"], interfaces)
1540
1541
        TestResults.create_switch("S5", switches)
1542
        TestResults.add_interfaces(6, switches["S5"], interfaces)
1543
1544
        TestResults.create_switch("S6", switches)
1545
        TestResults.add_interfaces(5, switches["S6"], interfaces)
1546
1547
        TestResults.create_switch("S7", switches)
1548
        TestResults.add_interfaces(2, switches["S7"], interfaces)
1549
1550
        TestResults.create_switch("S8", switches)
1551
        TestResults.add_interfaces(8, switches["S8"], interfaces)
1552
1553
        TestResults.create_switch("S9", switches)
1554
        TestResults.add_interfaces(4, switches["S9"], interfaces)
1555
1556
        TestResults.create_switch("S10", switches)
1557
        TestResults.add_interfaces(3, switches["S10"], interfaces)
1558
1559
        TestResults.create_switch("S11", switches)
1560
        TestResults.add_interfaces(3, switches["S11"], interfaces)
1561
1562
        TestResults.create_switch("User1", switches)
1563
        TestResults.add_interfaces(4, switches["User1"], interfaces)
1564
1565
        TestResults.create_switch("User2", switches)
1566
        TestResults.add_interfaces(2, switches["User2"], interfaces)
1567
1568
        TestResults.create_switch("User3", switches)
1569
        TestResults.add_interfaces(2, switches["User3"], interfaces)
1570
1571
        TestResults.create_switch("User4", switches)
1572
        TestResults.add_interfaces(3, switches["User4"], interfaces)
1573
1574
        TestResultsEdges._fill_links(links, interfaces)
1575
1576
        TestResultsEdges._add_metadata_to_links(links)
1577
1578
        return switches, links
1579
1580
    @staticmethod
1581
    def _add_metadata_to_links(links):
1582
        links["S1:1<->S2:1"].extend_metadata(
1583
            {"reliability": 5, "bandwidth": 100, "delay": 105})
1584
1585
        links["S1:2<->User1:1"].extend_metadata(
1586
            {"reliability": 5, "bandwidth": 100, "delay": 1})
1587
1588
        links["S2:2<->User4:1"].extend_metadata(
1589
            {"reliability": 5, "bandwidth": 100, "delay": 10})
1590
1591
        links["S3:1<->S5:1"].extend_metadata(
1592
            {"reliability": 5, "bandwidth": 10, "delay": 112})
1593
1594
        links["S3:2<->S7:1"].extend_metadata(
1595
            {"reliability": 5, "bandwidth": 100, "delay": 1})
1596
1597
        links["S3:3<->S8:1"].extend_metadata(
1598
            {"reliability": 5, "bandwidth": 100, "delay": 1})
1599
1600
        links["S3:4<->S11:1"].extend_metadata(
1601
            {"reliability": 3, "bandwidth": 100, "delay": 6})
1602
1603
        links["S3:5<->User3:1"].extend_metadata(
1604
            {"reliability": 5, "bandwidth": 100, "delay": 1})
1605
1606
        links["S3:6<->User4:2"].extend_metadata(
1607
            {"reliability": 5, "bandwidth": 100, "delay": 10})
1608
1609
        links["S4:1<->S5:2"].extend_metadata(
1610
            {"reliability": 1, "bandwidth": 100, "delay": 30,
1611
             "ownership": "A"})
1612
1613
        links["S4:2<->User1:2"].extend_metadata(
1614
            {"reliability": 3, "bandwidth": 100, "delay": 110,
1615
             "ownership": "A"})
1616
1617
        links["S5:3<->S6:1"].extend_metadata(
1618
            {"reliability": 1, "bandwidth": 100, "delay": 40})
1619
1620
        links["S5:4<->S6:2"].extend_metadata(
1621
            {"reliability": 3, "bandwidth": 100, "delay": 40,
1622
             "ownership": "A"})
1623
1624
        links["S5:5<->S8:2"].extend_metadata(
1625
            {"reliability": 5, "bandwidth": 100, "delay": 112})
1626
1627
        links["S5:6<->User1:3"].extend_metadata(
1628
            {"reliability": 3, "bandwidth": 100, "delay": 60})
1629
1630
        links["S6:3<->S9:1"].extend_metadata(
1631
            {"reliability": 3, "bandwidth": 100, "delay": 60})
1632
1633
        links["S6:4<->S9:2"].extend_metadata(
1634
            {"reliability": 5, "bandwidth": 100, "delay": 62})
1635
1636
        links["S6:5<->S10:1"].extend_metadata(
1637
            {"bandwidth": 100, "delay": 108, "ownership": "A"})
1638
1639
        links["S7:2<->S8:3"].extend_metadata(
1640
            {"reliability": 5, "bandwidth": 100, "delay": 1})
1641
1642
        links["S8:4<->S9:3"].extend_metadata(
1643
            {"reliability": 3, "bandwidth": 100, "delay": 32})
1644
1645
        links["S8:5<->S9:4"].extend_metadata(
1646
            {"reliability": 3, "bandwidth": 100, "delay": 110})
1647
1648
        links["S8:6<->S10:2"].extend_metadata(
1649
            {"reliability": 5, "bandwidth": 100, "ownership": "A"})
1650
1651
        links["S8:7<->S11:2"].extend_metadata(
1652
            {"reliability": 3, "bandwidth": 100, "delay": 7})
1653
1654
        links["S8:8<->User3:2"].extend_metadata(
1655
            {"reliability": 5, "bandwidth": 100, "delay": 1})
1656
1657
        links["S10:3<->User2:1"].extend_metadata(
1658
            {"reliability": 3, "bandwidth": 100, "delay": 10,
1659
             "ownership": "A"})
1660
1661
        links["S11:3<->User2:2"].extend_metadata(
1662
            {"reliability": 3, "bandwidth": 100, "delay": 6})
1663
1664
        links["User1:4<->User4:3"].extend_metadata(
1665
            {"reliability": 5, "bandwidth": 10, "delay": 105})
1666
1667
    @staticmethod
1668
    def _fill_links(links, interfaces):
1669
        links["S1:1<->S2:1"] = Link(interfaces["S1:1"], interfaces["S2:1"])
1670
1671
        links["S1:2<->User1:1"] = Link(interfaces["S1:2"], interfaces["User1:1"])
1672
1673
        links["S2:2<->User4:1"] = Link(interfaces["S2:2"], interfaces["User4:1"])
1674
1675
        links["S3:1<->S5:1"] = Link(interfaces["S3:1"], interfaces["S5:1"])
1676
1677
        links["S3:2<->S7:1"] = Link(interfaces["S3:2"], interfaces["S7:1"])
1678
1679
        links["S3:3<->S8:1"] = Link(interfaces["S3:3"], interfaces["S8:1"])
1680
1681
        links["S3:4<->S11:1"] = Link(interfaces["S3:4"], interfaces["S11:1"])
1682
1683
        links["S3:5<->User3:1"] = Link(interfaces["S3:5"], interfaces["User3:1"])
1684
1685
        links["S3:6<->User4:2"] = Link(interfaces["S3:6"], interfaces["User4:2"])
1686
1687
        links["S4:1<->S5:2"] = Link(interfaces["S4:1"], interfaces["S5:2"])
1688
1689
        links["S4:2<->User1:2"] = Link(interfaces["S4:2"], interfaces["User1:2"])
1690
1691
        links["S5:3<->S6:1"] = Link(interfaces["S5:3"], interfaces["S6:1"])
1692
1693
        links["S5:4<->S6:2"] = Link(interfaces["S5:4"], interfaces["S6:2"])
1694
1695
        links["S5:5<->S8:2"] = Link(interfaces["S5:5"], interfaces["S8:2"])
1696
1697
        links["S5:6<->User1:3"] = Link(interfaces["S5:6"], interfaces["User1:3"])
1698
1699
        links["S6:3<->S9:1"] = Link(interfaces["S6:3"], interfaces["S9:1"])
1700
1701
        links["S6:4<->S9:2"] = Link(interfaces["S6:4"], interfaces["S9:2"])
1702
1703
        links["S6:5<->S10:1"] = Link(interfaces["S6:5"], interfaces["S10:1"])
1704
1705
        links["S7:2<->S8:3"] = Link(interfaces["S7:2"], interfaces["S8:3"])
1706
1707
        links["S8:4<->S9:3"] = Link(interfaces["S8:4"], interfaces["S9:3"])
1708
1709
        links["S8:5<->S9:4"] = Link(interfaces["S8:5"], interfaces["S9:4"])
1710
1711
        links["S8:6<->S10:2"] = Link(interfaces["S8:6"], interfaces["S10:2"])
1712
1713
        links["S8:7<->S11:2"] = Link(interfaces["S8:7"], interfaces["S11:2"])
1714
1715
        links["S8:8<->User3:2"] = Link(interfaces["S8:8"], interfaces["User3:2"])
1716
1717
        links["S10:3<->User2:1"] = Link(interfaces["S10:3"], interfaces["User2:1"])
1718
1719
        links["S11:3<->User2:2"] = Link(interfaces["S11:3"], interfaces["User2:2"])
1720
1721
        links["User1:4<->User4:3"] = Link(interfaces["User1:4"], interfaces["User4:3"])
1722