1
|
|
|
"""Module to test the KytosGraph in graph.py.""" |
2
|
|
|
from unittest import TestCase |
3
|
|
|
from unittest.mock import Mock |
4
|
|
|
from itertools import combinations |
5
|
|
|
|
6
|
|
|
import networkx as nx |
7
|
|
|
|
8
|
|
|
# module under test |
9
|
|
|
from graph import KytosGraph |
10
|
|
|
|
11
|
|
|
from tests.unit.test_search_results import TestSearchResults |
12
|
|
|
|
13
|
|
|
# Core modules to import |
14
|
|
|
from kytos.core.switch import Switch |
15
|
|
|
from kytos.core.interface import Interface |
16
|
|
|
from kytos.core.link import Link |
17
|
|
|
|
18
|
|
|
class TestSearchResults2(TestSearchResults): |
19
|
|
|
|
20
|
|
|
def test_path1(self): |
21
|
|
|
"""Tests paths between all users using unconstrained path alogrithm.""" |
22
|
|
|
self.setup() |
23
|
|
|
combos = combinations(["User1","User2","User3","User4"],2) |
24
|
|
|
for point_a, point_b in combos: |
25
|
|
|
results = self.get_path(point_a,point_b) |
26
|
|
|
self.assertNotEqual(results, []) |
27
|
|
|
|
28
|
|
|
def test_path2(self): |
29
|
|
|
"""Tests paths between all users using constrained path algorithm, |
30
|
|
|
with no constraints set.""" |
31
|
|
|
self.setup() |
32
|
|
|
combos = combinations(["User1","User2","User3","User4"],2) |
33
|
|
|
for point_a, point_b in combos: |
34
|
|
|
results = self.get_path_constrained(point_a,point_b) |
35
|
|
|
self.assertNotEqual(results, []) |
36
|
|
|
|
37
|
|
|
def test_path3(self): |
38
|
|
|
"""Tests paths between all users using constrained path algorithm, |
39
|
|
|
with the ownership constraint set to B.""" |
40
|
|
|
self.setup() |
41
|
|
|
combos = combinations(["User1","User2","User3","User4"],2) |
42
|
|
|
for point_a, point_b in combos: |
43
|
|
|
results = self.get_path_constrained(point_a, point_b, 0, ownership = "B") |
44
|
|
|
for result in results: |
45
|
|
|
for path in result["paths"]: |
46
|
|
|
self.assertNotIn("S4:1", path) |
47
|
|
|
self.assertNotIn("S5:2", path) |
48
|
|
|
self.assertNotIn("S4:2", path) |
49
|
|
|
self.assertNotIn("User1:2", path) |
50
|
|
|
self.assertNotIn("S5:4", path) |
51
|
|
|
self.assertNotIn("S6:2", path) |
52
|
|
|
self.assertNotIn("S6:5", path) |
53
|
|
|
self.assertNotIn("S10:1", path) |
54
|
|
|
self.assertNotIn("S8:6", path) |
55
|
|
|
self.assertNotIn("S10:2", path) |
56
|
|
|
self.assertNotIn("S10:3", path) |
57
|
|
|
self.assertNotIn("User2:1", path) |
58
|
|
|
|
59
|
|
|
def test_path4(self): |
60
|
|
|
"""Tests paths between all users using constrained path algorithm, |
61
|
|
|
with the reliability constraint set to 3.""" |
62
|
|
|
self.setup() |
63
|
|
|
combos = combinations(["User1","User2","User3","User4"],2) |
64
|
|
|
for point_a, point_b in combos: |
65
|
|
|
results = self.get_path_constrained(point_a, point_b, 0, reliability = 3) |
66
|
|
|
for result in results: |
67
|
|
|
for path in result["paths"]: |
68
|
|
|
self.assertNotIn("S4:1", path) |
69
|
|
|
self.assertNotIn("S5:2", path) |
70
|
|
|
self.assertNotIn("S5:3", path) |
71
|
|
|
self.assertNotIn("S6:1", path) |
72
|
|
|
|
73
|
|
|
def test_path5(self): |
74
|
|
|
"""Tests paths between all users using constrained path algorithm, |
75
|
|
|
with the bandwidth contraint set to 100.""" |
76
|
|
|
self.setup() |
77
|
|
|
combos = combinations(["User1","User2","User3","User4"],2) |
78
|
|
|
for point_a, point_b in combos: |
79
|
|
|
results = self.get_path_constrained(point_a, point_b, 0, bandwidth = 100) |
80
|
|
|
for result in results: |
81
|
|
|
for path in result["paths"]: |
82
|
|
|
self.assertNotIn("S3:1", path) |
83
|
|
|
self.assertNotIn("S5:1", path) |
84
|
|
|
self.assertNotIn("User1:4", path) |
85
|
|
|
self.assertNotIn("User4:3", path) |
86
|
|
|
|
87
|
|
|
def test_path6(self): |
88
|
|
|
"""Tests paths between all users using constrained path algorithm, |
89
|
|
|
with the delay constraint set to 50.""" |
90
|
|
|
self.setup() |
91
|
|
|
combos = combinations(["User1","User2","User3","User4"],2) |
92
|
|
|
for point_a, point_b in combos: |
93
|
|
|
results = self.get_path_constrained(point_a, point_b, 0, delay = 50) |
94
|
|
|
for result in results: |
95
|
|
|
for path in result["paths"]: |
96
|
|
|
self.assertNotIn("S1:1", path) |
97
|
|
|
self.assertNotIn("S2:1", path) |
98
|
|
|
self.assertNotIn("S3:1", path) |
99
|
|
|
self.assertNotIn("S5:1", path) |
100
|
|
|
self.assertNotIn("S4:2", path) |
101
|
|
|
self.assertNotIn("User1:2", path) |
102
|
|
|
self.assertNotIn("S5:5", path) |
103
|
|
|
self.assertNotIn("S8:2", path) |
104
|
|
|
self.assertNotIn("S5:6", path) |
105
|
|
|
self.assertNotIn("User1:3", path) |
106
|
|
|
self.assertNotIn("S6:3", path) |
107
|
|
|
self.assertNotIn("S9:1", path) |
108
|
|
|
self.assertNotIn("S6:4", path) |
109
|
|
|
self.assertNotIn("S9:2", path) |
110
|
|
|
self.assertNotIn("S6:5", path) |
111
|
|
|
self.assertNotIn("S10:1", path) |
112
|
|
|
self.assertNotIn("S8:5", path) |
113
|
|
|
self.assertNotIn("S9:4", path) |
114
|
|
|
self.assertNotIn("User1:4", path) |
115
|
|
|
self.assertNotIn("User4:3", path) |
116
|
|
|
|
117
|
|
|
def test_path7(self): |
118
|
|
|
"""Tests paths between all users using constrained path algorithm, |
119
|
|
|
with the delay constraint set to 50, the bandwidth constraint set to 100, |
120
|
|
|
the reliability contraint set to 3, and the ownership constraint set to 'B' """ |
121
|
|
|
self.setup() |
122
|
|
|
combos = combinations(["User1","User2","User3","User4"],2) |
123
|
|
|
for point_a, point_b in combos: |
124
|
|
|
results = self.get_path_constrained(point_a, point_b, 0, delay = 50, bandwidth = 100, reliability = 3, ownership = "B") |
125
|
|
|
for result in results: |
126
|
|
|
for path in result["paths"]: |
127
|
|
|
# delay = 50 checks |
128
|
|
|
self.assertNotIn("S1:1", path) |
129
|
|
|
self.assertNotIn("S2:1", path) |
130
|
|
|
self.assertNotIn("S3:1", path) |
131
|
|
|
self.assertNotIn("S5:1", path) |
132
|
|
|
self.assertNotIn("S4:2", path) |
133
|
|
|
self.assertNotIn("User1:2", path) |
134
|
|
|
self.assertNotIn("S5:5", path) |
135
|
|
|
self.assertNotIn("S8:2", path) |
136
|
|
|
self.assertNotIn("S5:6", path) |
137
|
|
|
self.assertNotIn("User1:3", path) |
138
|
|
|
self.assertNotIn("S6:3", path) |
139
|
|
|
self.assertNotIn("S9:1", path) |
140
|
|
|
self.assertNotIn("S6:4", path) |
141
|
|
|
self.assertNotIn("S9:2", path) |
142
|
|
|
self.assertNotIn("S6:5", path) |
143
|
|
|
self.assertNotIn("S10:1", path) |
144
|
|
|
self.assertNotIn("S8:5", path) |
145
|
|
|
self.assertNotIn("S9:4", path) |
146
|
|
|
self.assertNotIn("User1:4", path) |
147
|
|
|
self.assertNotIn("User4:3", path) |
148
|
|
|
|
149
|
|
|
# bandwidth = 100 checks |
150
|
|
|
|
151
|
|
|
self.assertNotIn("S3:1", path) |
152
|
|
|
self.assertNotIn("S5:1", path) |
153
|
|
|
self.assertNotIn("User1:4", path) |
154
|
|
|
self.assertNotIn("User4:3", path) |
155
|
|
|
|
156
|
|
|
# reliability = 3 checks |
157
|
|
|
|
158
|
|
|
self.assertNotIn("S4:1", path) |
159
|
|
|
self.assertNotIn("S5:2", path) |
160
|
|
|
self.assertNotIn("S5:3", path) |
161
|
|
|
self.assertNotIn("S6:1", path) |
162
|
|
|
|
163
|
|
|
# ownership = "B" checks |
164
|
|
|
|
165
|
|
|
self.assertNotIn("S4:1", path) |
166
|
|
|
self.assertNotIn("S5:2", path) |
167
|
|
|
self.assertNotIn("S4:2", path) |
168
|
|
|
self.assertNotIn("User1:2", path) |
169
|
|
|
self.assertNotIn("S5:4", path) |
170
|
|
|
self.assertNotIn("S6:2", path) |
171
|
|
|
self.assertNotIn("S6:5", path) |
172
|
|
|
self.assertNotIn("S10:1", path) |
173
|
|
|
self.assertNotIn("S8:6", path) |
174
|
|
|
self.assertNotIn("S10:2", path) |
175
|
|
|
self.assertNotIn("S10:3", path) |
176
|
|
|
self.assertNotIn("User2:1", path) |
177
|
|
|
|
178
|
|
|
def test_path8(self): |
179
|
|
|
"""Tests paths between all users using constrained path algorithm, |
180
|
|
|
with the delay constraint set to 50, the bandwidth constraint set to 100, |
181
|
|
|
the reliability contraint set to 3, and the ownership constraint set to 'B' |
182
|
|
|
|
183
|
|
|
Tests conducted with flexibility enabled""" |
184
|
|
|
self.setup() |
185
|
|
|
combos = combinations(["User1","User2","User3","User4"],2) |
186
|
|
|
for point_a, point_b in combos: |
187
|
|
|
results = self.get_path_constrained(point_a, point_b, 4, delay = 50, bandwidth = 100, reliability = 3, ownership = "B") |
188
|
|
|
for result in results: |
189
|
|
|
# delay = 50 checks |
190
|
|
View Code Duplication |
if "delay" in result["metrics"]: |
|
|
|
|
191
|
|
|
for path in result["paths"]: |
192
|
|
|
self.assertNotIn("S1:1", path) |
193
|
|
|
self.assertNotIn("S2:1", path) |
194
|
|
|
self.assertNotIn("S3:1", path) |
195
|
|
|
self.assertNotIn("S5:1", path) |
196
|
|
|
self.assertNotIn("S4:2", path) |
197
|
|
|
self.assertNotIn("User1:2", path) |
198
|
|
|
self.assertNotIn("S5:5", path) |
199
|
|
|
self.assertNotIn("S8:2", path) |
200
|
|
|
self.assertNotIn("S5:6", path) |
201
|
|
|
self.assertNotIn("User1:3", path) |
202
|
|
|
self.assertNotIn("S6:3", path) |
203
|
|
|
self.assertNotIn("S9:1", path) |
204
|
|
|
self.assertNotIn("S6:4", path) |
205
|
|
|
self.assertNotIn("S9:2", path) |
206
|
|
|
self.assertNotIn("S6:5", path) |
207
|
|
|
self.assertNotIn("S10:1", path) |
208
|
|
|
self.assertNotIn("S8:5", path) |
209
|
|
|
self.assertNotIn("S9:4", path) |
210
|
|
|
self.assertNotIn("User1:4", path) |
211
|
|
|
self.assertNotIn("User4:3", path) |
212
|
|
|
|
213
|
|
|
# bandwidth = 100 checks |
214
|
|
|
if "bandwidth" in result["metrics"]: |
215
|
|
|
for path in result["paths"]: |
216
|
|
|
self.assertNotIn("S3:1", path) |
217
|
|
|
self.assertNotIn("S5:1", path) |
218
|
|
|
self.assertNotIn("User1:4", path) |
219
|
|
|
self.assertNotIn("User4:3", path) |
220
|
|
|
|
221
|
|
|
# reliability = 3 checks |
222
|
|
|
if "reliability" in result["metrics"]: |
223
|
|
|
for path in result["paths"]: |
224
|
|
|
self.assertNotIn("S4:1", path) |
225
|
|
|
self.assertNotIn("S5:2", path) |
226
|
|
|
self.assertNotIn("S5:3", path) |
227
|
|
|
self.assertNotIn("S6:1", path) |
228
|
|
|
|
229
|
|
|
# ownership = "B" checks |
230
|
|
|
if "ownership" in result["metrics"]: |
231
|
|
|
for path in result["paths"]: |
232
|
|
|
self.assertNotIn("S4:1", path) |
233
|
|
|
self.assertNotIn("S5:2", path) |
234
|
|
|
self.assertNotIn("S4:2", path) |
235
|
|
|
self.assertNotIn("User1:2", path) |
236
|
|
|
self.assertNotIn("S5:4", path) |
237
|
|
|
self.assertNotIn("S6:2", path) |
238
|
|
|
self.assertNotIn("S6:5", path) |
239
|
|
|
self.assertNotIn("S10:1", path) |
240
|
|
|
self.assertNotIn("S8:6", path) |
241
|
|
|
self.assertNotIn("S10:2", path) |
242
|
|
|
self.assertNotIn("S10:3", path) |
243
|
|
|
self.assertNotIn("User2:1", path) |
244
|
|
|
|
245
|
|
|
def test_path9(self): |
246
|
|
|
"""Tests paths between all users using constrained path algorithm, |
247
|
|
|
with the delay constraint set to 50, the bandwidth constraint set to 100, |
248
|
|
|
the reliability contraint set to 3, and the ownership constraint set to 'B' |
249
|
|
|
|
250
|
|
|
Tests conducted with all but ownership flexible""" |
251
|
|
|
self.setup() |
252
|
|
|
combos = combinations(["User1","User2","User3","User4"],2) |
253
|
|
|
for point_a, point_b in combos: |
254
|
|
|
results = self.get_path_constrained2(point_a, point_b, {"ownership":"B"}, {"delay": 50, "bandwidth":100, "reliability": 3}) |
255
|
|
|
for result in results: |
256
|
|
|
# delay = 50 checks |
257
|
|
View Code Duplication |
if "delay" in result["metrics"]: |
|
|
|
|
258
|
|
|
for path in result["paths"]: |
259
|
|
|
self.assertNotIn("S1:1", path) |
260
|
|
|
self.assertNotIn("S2:1", path) |
261
|
|
|
self.assertNotIn("S3:1", path) |
262
|
|
|
self.assertNotIn("S5:1", path) |
263
|
|
|
self.assertNotIn("S4:2", path) |
264
|
|
|
self.assertNotIn("User1:2", path) |
265
|
|
|
self.assertNotIn("S5:5", path) |
266
|
|
|
self.assertNotIn("S8:2", path) |
267
|
|
|
self.assertNotIn("S5:6", path) |
268
|
|
|
self.assertNotIn("User1:3", path) |
269
|
|
|
self.assertNotIn("S6:3", path) |
270
|
|
|
self.assertNotIn("S9:1", path) |
271
|
|
|
self.assertNotIn("S6:4", path) |
272
|
|
|
self.assertNotIn("S9:2", path) |
273
|
|
|
self.assertNotIn("S6:5", path) |
274
|
|
|
self.assertNotIn("S10:1", path) |
275
|
|
|
self.assertNotIn("S8:5", path) |
276
|
|
|
self.assertNotIn("S9:4", path) |
277
|
|
|
self.assertNotIn("User1:4", path) |
278
|
|
|
self.assertNotIn("User4:3", path) |
279
|
|
|
|
280
|
|
|
# bandwidth = 100 checks |
281
|
|
|
if "bandwidth" in result["metrics"]: |
282
|
|
|
for path in result["paths"]: |
283
|
|
|
self.assertNotIn("S3:1", path) |
284
|
|
|
self.assertNotIn("S5:1", path) |
285
|
|
|
self.assertNotIn("User1:4", path) |
286
|
|
|
self.assertNotIn("User4:3", path) |
287
|
|
|
|
288
|
|
|
# reliability = 3 checks |
289
|
|
|
if "reliability" in result["metrics"]: |
290
|
|
|
for path in result["paths"]: |
291
|
|
|
self.assertNotIn("S4:1", path) |
292
|
|
|
self.assertNotIn("S5:2", path) |
293
|
|
|
self.assertNotIn("S5:3", path) |
294
|
|
|
self.assertNotIn("S6:1", path) |
295
|
|
|
|
296
|
|
|
# ownership = "B" checks |
297
|
|
|
self.assertIn("ownership", result["metrics"]) |
298
|
|
|
for path in result["paths"]: |
299
|
|
|
self.assertNotIn("S4:1", path) |
300
|
|
|
self.assertNotIn("S5:2", path) |
301
|
|
|
self.assertNotIn("S4:2", path) |
302
|
|
|
self.assertNotIn("User1:2", path) |
303
|
|
|
self.assertNotIn("S5:4", path) |
304
|
|
|
self.assertNotIn("S6:2", path) |
305
|
|
|
self.assertNotIn("S6:5", path) |
306
|
|
|
self.assertNotIn("S10:1", path) |
307
|
|
|
self.assertNotIn("S8:6", path) |
308
|
|
|
self.assertNotIn("S10:2", path) |
309
|
|
|
self.assertNotIn("S10:3", path) |
310
|
|
|
self.assertNotIn("User2:1", path) |
311
|
|
|
|
312
|
|
|
def test_path10(self): |
313
|
|
|
"""Tests that TypeError is generated by get_path_constrained |
314
|
|
|
|
315
|
|
|
Tests with ownership using an int type rather than string""" |
316
|
|
|
self.setup() |
317
|
|
|
with self.assertRaises(TypeError): |
318
|
|
|
self.get_path_constrained2("User1", "User2", {"ownership":1}, None) |
319
|
|
|
|
320
|
|
|
|
321
|
|
|
@staticmethod |
322
|
|
|
def generateTopology(): |
323
|
|
|
"""Generates a predetermined topology""" |
324
|
|
|
switches = {} |
325
|
|
|
interfaces = {} |
326
|
|
|
links = {} |
327
|
|
|
|
328
|
|
|
TestSearchResults.createSwitch("S1", switches) |
329
|
|
|
TestSearchResults.addInterfaces(2, switches["S1"], interfaces) |
330
|
|
|
|
331
|
|
|
TestSearchResults.createSwitch("S2", switches) |
332
|
|
|
TestSearchResults.addInterfaces(2, switches["S2"], interfaces) |
333
|
|
|
|
334
|
|
|
TestSearchResults.createSwitch("S3", switches) |
335
|
|
|
TestSearchResults.addInterfaces(6, switches["S3"], interfaces) |
336
|
|
|
|
337
|
|
|
TestSearchResults.createSwitch("S4", switches) |
338
|
|
|
TestSearchResults.addInterfaces(2, switches["S4"], interfaces) |
339
|
|
|
|
340
|
|
|
TestSearchResults.createSwitch("S5", switches) |
341
|
|
|
TestSearchResults.addInterfaces(6, switches["S5"], interfaces) |
342
|
|
|
|
343
|
|
|
TestSearchResults.createSwitch("S6", switches) |
344
|
|
|
TestSearchResults.addInterfaces(5, switches["S6"], interfaces) |
345
|
|
|
|
346
|
|
|
TestSearchResults.createSwitch("S7", switches) |
347
|
|
|
TestSearchResults.addInterfaces(2, switches["S7"], interfaces) |
348
|
|
|
|
349
|
|
|
TestSearchResults.createSwitch("S8", switches) |
350
|
|
|
TestSearchResults.addInterfaces(8, switches["S8"], interfaces) |
351
|
|
|
|
352
|
|
|
TestSearchResults.createSwitch("S9", switches) |
353
|
|
|
TestSearchResults.addInterfaces(4, switches["S9"], interfaces) |
354
|
|
|
|
355
|
|
|
TestSearchResults.createSwitch("S10", switches) |
356
|
|
|
TestSearchResults.addInterfaces(3, switches["S10"], interfaces) |
357
|
|
|
|
358
|
|
|
TestSearchResults.createSwitch("S11", switches) |
359
|
|
|
TestSearchResults.addInterfaces(3, switches["S11"], interfaces) |
360
|
|
|
|
361
|
|
|
TestSearchResults.createSwitch("User1", switches) |
362
|
|
|
TestSearchResults.addInterfaces(4, switches["User1"], interfaces) |
363
|
|
|
|
364
|
|
|
TestSearchResults.createSwitch("User2", switches) |
365
|
|
|
TestSearchResults.addInterfaces(2, switches["User2"], interfaces) |
366
|
|
|
|
367
|
|
|
TestSearchResults.createSwitch("User3", switches) |
368
|
|
|
TestSearchResults.addInterfaces(2, switches["User3"], interfaces) |
369
|
|
|
|
370
|
|
|
TestSearchResults.createSwitch("User4", switches) |
371
|
|
|
TestSearchResults.addInterfaces(3, switches["User4"], interfaces) |
372
|
|
|
|
373
|
|
|
links["S1:1<->S2:1"] = Link(interfaces["S1:1"], interfaces["S2:1"]) |
374
|
|
|
links["S1:1<->S2:1"].extend_metadata({"reliability": 5, "bandwidth": 100, "delay": 105}) |
375
|
|
|
|
376
|
|
|
links["S1:2<->User1:1"] = Link(interfaces["S1:2"], interfaces["User1:1"]) |
377
|
|
|
links["S1:2<->User1:1"].extend_metadata({"reliability": 5, "bandwidth": 100, "delay": 1}) |
378
|
|
|
|
379
|
|
|
links["S2:2<->User4:1"] = Link(interfaces["S2:2"], interfaces["User4:1"]) |
380
|
|
|
links["S2:2<->User4:1"].extend_metadata({"reliability": 5, "bandwidth": 100, "delay": 10}) |
381
|
|
|
|
382
|
|
|
links["S3:1<->S5:1"] = Link(interfaces["S3:1"], interfaces["S5:1"]) |
383
|
|
|
links["S3:1<->S5:1"].extend_metadata({"reliability": 5, "bandwidth": 10, "delay": 112}) |
384
|
|
|
|
385
|
|
|
links["S3:2<->S7:1"] = Link(interfaces["S3:2"], interfaces["S7:1"]) |
386
|
|
|
links["S3:2<->S7:1"].extend_metadata({"reliability": 5, "bandwidth": 100, "delay": 1}) |
387
|
|
|
|
388
|
|
|
links["S3:3<->S8:1"] = Link(interfaces["S3:3"], interfaces["S8:1"]) |
389
|
|
|
links["S3:3<->S8:1"].extend_metadata({"reliability": 5, "bandwidth": 100, "delay": 1}) |
390
|
|
|
|
391
|
|
|
links["S3:4<->S11:1"] = Link(interfaces["S3:4"], interfaces["S11:1"]) |
392
|
|
|
links["S3:4<->S11:1"].extend_metadata({"reliability": 3, "bandwidth": 100, "delay": 6}) |
393
|
|
|
|
394
|
|
|
links["S3:5<->User3:1"] = Link(interfaces["S3:5"], interfaces["User3:1"]) |
395
|
|
|
links["S3:5<->User3:1"].extend_metadata({"reliability": 5, "bandwidth": 100, "delay": 1}) |
396
|
|
|
|
397
|
|
|
links["S3:6<->User4:2"] = Link(interfaces["S3:6"], interfaces["User4:2"]) |
398
|
|
|
links["S3:6<->User4:2"].extend_metadata({"reliability": 5, "bandwidth": 100, "delay": 10}) |
399
|
|
|
|
400
|
|
|
links["S4:1<->S5:2"] = Link(interfaces["S4:1"], interfaces["S5:2"]) |
401
|
|
|
links["S4:1<->S5:2"].extend_metadata({"reliability": 1, "bandwidth": 100, "delay": 30, "ownership": "A"}) |
402
|
|
|
|
403
|
|
|
links["S4:2<->User1:2"] = Link(interfaces["S4:2"], interfaces["User1:2"]) |
404
|
|
|
links["S4:2<->User1:2"].extend_metadata({"reliability": 3, "bandwidth": 100, "delay": 110, "ownership": "A"}) |
405
|
|
|
|
406
|
|
|
links["S5:3<->S6:1"] = Link(interfaces["S5:3"], interfaces["S6:1"]) |
407
|
|
|
links["S5:3<->S6:1"].extend_metadata({"reliability": 1, "bandwidth": 100, "delay": 40}) |
408
|
|
|
|
409
|
|
|
links["S5:4<->S6:2"] = Link(interfaces["S5:4"], interfaces["S6:2"]) |
410
|
|
|
links["S5:4<->S6:2"].extend_metadata({"reliability": 3, "bandwidth": 100, "delay": 40, "ownership": "A"}) |
411
|
|
|
|
412
|
|
|
links["S5:5<->S8:2"] = Link(interfaces["S5:5"], interfaces["S8:2"]) |
413
|
|
|
links["S5:5<->S8:2"].extend_metadata({"reliability": 5, "bandwidth": 100, "delay": 112}) |
414
|
|
|
|
415
|
|
|
links["S5:6<->User1:3"] = Link(interfaces["S5:6"], interfaces["User1:3"]) |
416
|
|
|
links["S5:6<->User1:3"].extend_metadata({"reliability": 3, "bandwidth": 100, "delay": 60}) |
417
|
|
|
|
418
|
|
|
links["S6:3<->S9:1"] = Link(interfaces["S6:3"], interfaces["S9:1"]) |
419
|
|
|
links["S6:3<->S9:1"].extend_metadata({"reliability": 3,"bandwidth": 100, "delay":60}) |
420
|
|
|
|
421
|
|
|
links["S6:4<->S9:2"] = Link(interfaces["S6:4"], interfaces["S9:2"]) |
422
|
|
|
links["S6:4<->S9:2"].extend_metadata({"reliability": 5,"bandwidth": 100, "delay":62}) |
423
|
|
|
|
424
|
|
|
links["S6:5<->S10:1"] = Link(interfaces["S6:5"], interfaces["S10:1"]) |
425
|
|
|
links["S6:5<->S10:1"].extend_metadata({"bandwidth": 100, "delay":108, "ownership":"A"}) |
426
|
|
|
|
427
|
|
|
links["S7:2<->S8:3"] = Link(interfaces["S7:2"], interfaces["S8:3"]) |
428
|
|
|
links["S7:2<->S8:3"].extend_metadata({"reliability": 5, "bandwidth": 100, "delay": 1}) |
429
|
|
|
|
430
|
|
|
links["S8:4<->S9:3"] = Link(interfaces["S8:4"], interfaces["S9:3"]) |
431
|
|
|
links["S8:4<->S9:3"].extend_metadata({"reliability": 3,"bandwidth": 100, "delay":32}) |
432
|
|
|
|
433
|
|
|
links["S8:5<->S9:4"] = Link(interfaces["S8:5"], interfaces["S9:4"]) |
434
|
|
|
links["S8:5<->S9:4"].extend_metadata({"reliability": 3,"bandwidth": 100, "delay":110}) |
435
|
|
|
|
436
|
|
|
links["S8:6<->S10:2"] = Link(interfaces["S8:6"], interfaces["S10:2"]) |
437
|
|
|
links["S8:6<->S10:2"].extend_metadata({"reliability": 5, "bandwidth": 100, "ownership":"A"}) |
438
|
|
|
|
439
|
|
|
links["S8:7<->S11:2"] = Link(interfaces["S8:7"], interfaces["S11:2"]) |
440
|
|
|
links["S8:7<->S11:2"].extend_metadata({"reliability": 3, "bandwidth": 100, "delay": 7}) |
441
|
|
|
|
442
|
|
|
links["S8:8<->User3:2"] = Link(interfaces["S8:8"], interfaces["User3:2"]) |
443
|
|
|
links["S8:8<->User3:2"].extend_metadata({"reliability": 5, "bandwidth": 100, "delay": 1}) |
444
|
|
|
|
445
|
|
|
links["S10:3<->User2:1"] = Link(interfaces["S10:3"], interfaces["User2:1"]) |
446
|
|
|
links["S10:3<->User2:1"].extend_metadata({"reliability": 3, "bandwidth": 100, "delay": 10, "ownership":"A"}) |
447
|
|
|
|
448
|
|
|
links["S11:3<->User2:2"] = Link(interfaces["S11:3"], interfaces["User2:2"]) |
449
|
|
|
links["S11:3<->User2:2"].extend_metadata({"reliability": 3, "bandwidth": 100, "delay": 6}) |
450
|
|
|
|
451
|
|
|
links["User1:4<->User4:3"] = Link(interfaces["User1:4"], interfaces["User4:3"]) |
452
|
|
|
links["User1:4<->User4:3"].extend_metadata({"reliability": 5, "bandwidth": 10, "delay": 105}) |
453
|
|
|
|
454
|
|
|
return (switches,links) |
455
|
|
|
|