TestDeployer.setup_method()   B
last analyzed

Complexity

Conditions 1

Size

Total Lines 115
Code Lines 83

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 22
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 83
nop 1
dl 0
loc 115
ccs 22
cts 22
cp 1
crap 1
rs 7.5563
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
"""Tests for the deployer module."""
2
3 1
from unittest.mock import MagicMock
4
5 1
from collections import Counter
6
7 1
from datetime import datetime, timedelta
8 1
from threading import Lock
9 1
import pytz
10 1
from kytos.core.common import EntityStatus
11 1
from kytos.lib.helpers import get_controller_mock
12 1
from napps.kytos.maintenance.models import MaintenanceWindow as MW
13
14 1
from napps.kytos.maintenance.managers.deployer import (
15
    MaintenanceDeployer,
16
)
17
18 1
class TestDeployer:
19
    """Test of the MaintenanceDeployer class."""
20 1
    def setup_method(self):
21 1
        self.controller = get_controller_mock()
22 1
        self.start = datetime.now(pytz.utc)
23 1
        self.start += timedelta(days=1)
24 1
        self.end = self.start + timedelta(hours=6)
25 1
        self.switches = [
26
            "01:23:45:67:89:ab:cd:ef"
27
        ]
28 1
        self.maintenance = MW(
29
            start=self.start,
30
            end=self.end,
31
            switches=self.switches
32
        )
33
34 1
        self.deployer = MaintenanceDeployer(self.controller, Counter(), Counter(), Counter(), Lock())
35
        # Initialize Switches
36 1
        self.controller.switches = {
37
            '01:23:45:67:89:ab:cd:ef': MagicMock(
38
                id='01:23:45:67:89:ab:cd:ef',
39
                interfaces = {},
40
            ),
41
            '01:23:45:67:65:ab:cd:ef': MagicMock(
42
                id='01:23:45:67:65:ab:cd:ef',
43
                interfaces = {},
44
            ),
45
            '01:23:45:67:66:ab:cd:ef': MagicMock(
46
                id='01:23:45:67:66:ab:cd:ef',
47
                interfaces = {},
48
            ),
49
        }
50
        # Initialize Interfaces
51 1
        self.controller.switches['01:23:45:67:89:ab:cd:ef'].interfaces = {
52
            0: MagicMock(
53
                id = '01:23:45:67:89:ab:cd:ef:0',
54
                switch = self.controller.switches['01:23:45:67:89:ab:cd:ef'],
55
                link = None,
56
            ),
57
            1: MagicMock(
58
                id = '01:23:45:67:89:ab:cd:ef:1',
59
                switch = self.controller.switches['01:23:45:67:89:ab:cd:ef'],
60
                link = None,
61
            ),
62
            2: MagicMock(
63
                id = '01:23:45:67:89:ab:cd:ef:2',
64
                switch = self.controller.switches['01:23:45:67:89:ab:cd:ef'],
65
                link = None,
66
            ),
67
        }
68
69 1
        self.controller.switches['01:23:45:67:65:ab:cd:ef'].interfaces = {
70
            0: MagicMock(
71
                id = '01:23:45:67:65:ab:cd:ef:0',
72
                switch = self.controller.switches['01:23:45:67:65:ab:cd:ef'],
73
                link = None,
74
            ),
75
            1: MagicMock(
76
                id = '01:23:45:67:65:ab:cd:ef:1',
77
                switch = self.controller.switches['01:23:45:67:65:ab:cd:ef'],
78
                link = None,
79
            ),
80
            2: MagicMock(
81
                id = '01:23:45:67:65:ab:cd:ef:2',
82
                switch = self.controller.switches['01:23:45:67:65:ab:cd:ef'],
83
                link = None,
84
            ),
85
        }
86
87 1
        self.controller.switches['01:23:45:67:66:ab:cd:ef'].interfaces = {
88
            0: MagicMock(
89
                id = '01:23:45:67:66:ab:cd:ef:0',
90
                switch = self.controller.switches['01:23:45:67:66:ab:cd:ef'],
91
                link = None,
92
            ),
93
            1: MagicMock(
94
                id = '01:23:45:67:66:ab:cd:ef:1',
95
                switch = self.controller.switches['01:23:45:67:66:ab:cd:ef'],
96
                link = None,
97
            ),
98
            2: MagicMock(
99
                id = '01:23:45:67:66:ab:cd:ef:2',
100
                switch = self.controller.switches['01:23:45:67:66:ab:cd:ef'],
101
                link = None,
102
            ),
103
        }
104
105
        # Initialize Links
106 1
        self.link_1 = MagicMock(
107
            id = 'link_1',
108
            endpoint_a = self.controller.switches['01:23:45:67:89:ab:cd:ef'].interfaces[0],
109
            endpoint_b = self.controller.switches['01:23:45:67:65:ab:cd:ef'].interfaces[0],
110
        )
111 1
        self.controller.switches['01:23:45:67:89:ab:cd:ef'].interfaces[0].link = self.link_1
112 1
        self.controller.switches['01:23:45:67:65:ab:cd:ef'].interfaces[0].link = self.link_1
113
114 1
        self.link_2 = MagicMock(
115
            id = 'link_2',
116
            endpoint_a = self.controller.switches['01:23:45:67:89:ab:cd:ef'].interfaces[1],
117
            endpoint_b = self.controller.switches['01:23:45:67:66:ab:cd:ef'].interfaces[0],
118
        )
119 1
        self.controller.switches['01:23:45:67:89:ab:cd:ef'].interfaces[1].link = self.link_2
120 1
        self.controller.switches['01:23:45:67:66:ab:cd:ef'].interfaces[0].link = self.link_2
121
122 1
        self.link_3 = MagicMock(
123
            id = 'link_3',
124
            endpoint_a = self.controller.switches['01:23:45:67:66:ab:cd:ef'].interfaces[1],
125
            endpoint_b = self.controller.switches['01:23:45:67:66:ab:cd:ef'].interfaces[2],
126
        )
127 1
        self.controller.switches['01:23:45:67:66:ab:cd:ef'].interfaces[1].link = self.link_3
128 1
        self.controller.switches['01:23:45:67:66:ab:cd:ef'].interfaces[2].link = self.link_3
129
130
131 1
        self.controller.links = {
132
            'link_1': self.link_1,
133
            'link_2': self.link_2,
134
            'link_3': self.link_3,
135
        }
136
137 1
    def test_mw_case_1(self):
138
        """Test deploying a maintenance window to switches."""
139 1
        buffer_put_mock = MagicMock()
140 1
        self.controller.buffers.app.put = buffer_put_mock
141 1
        maintenance = self.maintenance.copy(
142
            update = {
143
                'switches': [
144
                    '01:23:45:67:89:ab:cd:ef',
145
                    '01:23:45:67:65:ab:cd:ef'
146
                ],
147
                'interfaces': [],
148
                'links': [],
149
            }
150
        )
151 1
        self.deployer.start_mw(maintenance)
152 1
        args, kwargs = buffer_put_mock.call_args
153 1
        event = args[0]
154 1
        assert event.name == 'topology.interruption.start'
155 1
        assert event.content['type'] == 'maintenance'
156 1
        assert sorted(event.content['switches']) == [
157
            '01:23:45:67:65:ab:cd:ef',
158
            '01:23:45:67:89:ab:cd:ef',
159
        ]
160 1
        assert sorted(event.content['interfaces']) == [
161
            '01:23:45:67:65:ab:cd:ef:0',
162
            '01:23:45:67:65:ab:cd:ef:1',
163
            '01:23:45:67:65:ab:cd:ef:2',
164
            '01:23:45:67:89:ab:cd:ef:0',
165
            '01:23:45:67:89:ab:cd:ef:1',
166
            '01:23:45:67:89:ab:cd:ef:2',
167
        ]
168 1
        assert sorted(event.content['links']) == [
169
            'link_1',
170
            'link_2',
171
        ]
172
173
        # Check whats in maintenance
174
        # Switches
175 1
        assert not self.deployer.switch_not_in_maintenance(self.controller.switches['01:23:45:67:89:ab:cd:ef'])
176 1
        assert not self.deployer.switch_not_in_maintenance(self.controller.switches['01:23:45:67:65:ab:cd:ef'])
177 1
        assert     self.deployer.switch_not_in_maintenance(self.controller.switches['01:23:45:67:66:ab:cd:ef'])
178
        # Interfaces
179 1
        for interface in self.controller.switches['01:23:45:67:89:ab:cd:ef'].interfaces.values():
180 1
            assert not self.deployer.interface_not_in_maintenance(interface)
181 1
        for interface in self.controller.switches['01:23:45:67:65:ab:cd:ef'].interfaces.values():
182 1
            assert not self.deployer.interface_not_in_maintenance(interface)
183 1
        for interface in self.controller.switches['01:23:45:67:66:ab:cd:ef'].interfaces.values():
184 1
            assert     self.deployer.interface_not_in_maintenance(interface)
185
        # Links
186 1
        assert not self.deployer.link_not_in_maintenance(self.link_1)
187 1
        assert not self.deployer.link_not_in_maintenance(self.link_2)
188 1
        assert     self.deployer.link_not_in_maintenance(self.link_3)
189
190 1
        self.deployer.end_mw(maintenance)
191 1
        args, kwargs = buffer_put_mock.call_args
192 1
        event = args[0]
193 1
        assert event.name == 'topology.interruption.end'
194 1
        assert event.content['type'] == 'maintenance'
195 1
        assert sorted(event.content['switches']) == [
196
            '01:23:45:67:65:ab:cd:ef',
197
            '01:23:45:67:89:ab:cd:ef',
198
        ]
199 1
        assert sorted(event.content['interfaces']) == [
200
            '01:23:45:67:65:ab:cd:ef:0',
201
            '01:23:45:67:65:ab:cd:ef:1',
202
            '01:23:45:67:65:ab:cd:ef:2',
203
            '01:23:45:67:89:ab:cd:ef:0',
204
            '01:23:45:67:89:ab:cd:ef:1',
205
            '01:23:45:67:89:ab:cd:ef:2',
206
        ]
207 1
        assert sorted(event.content['links']) == [
208
            'link_1',
209
            'link_2',
210
        ]
211
        # Check whats in maintenance
212
        # Switches
213 1
        assert     self.deployer.switch_not_in_maintenance(self.controller.switches['01:23:45:67:89:ab:cd:ef'])
214 1
        assert     self.deployer.switch_not_in_maintenance(self.controller.switches['01:23:45:67:65:ab:cd:ef'])
215 1
        assert     self.deployer.switch_not_in_maintenance(self.controller.switches['01:23:45:67:66:ab:cd:ef'])
216
        # Interfaces
217 1
        for interface in self.controller.switches['01:23:45:67:89:ab:cd:ef'].interfaces.values():
218 1
            assert     self.deployer.interface_not_in_maintenance(interface)
219 1
        for interface in self.controller.switches['01:23:45:67:65:ab:cd:ef'].interfaces.values():
220 1
            assert     self.deployer.interface_not_in_maintenance(interface)
221 1
        for interface in self.controller.switches['01:23:45:67:66:ab:cd:ef'].interfaces.values():
222 1
            assert     self.deployer.interface_not_in_maintenance(interface)
223
        # Links
224 1
        assert     self.deployer.link_not_in_maintenance(self.link_1)
225 1
        assert     self.deployer.link_not_in_maintenance(self.link_2)
226 1
        assert     self.deployer.link_not_in_maintenance(self.link_3)
227
228 1
    def test_mw_case_2(self):
229
        """Test deploying a maintenance window to interfaces."""
230 1
        buffer_put_mock = MagicMock()
231 1
        self.controller.buffers.app.put = buffer_put_mock
232
        
233 1
        maintenance = self.maintenance.copy(
234
            update = {
235
                'switches': [],
236
                'interfaces': [
237
                    '01:23:45:67:65:ab:cd:ef:0',
238
                    '01:23:45:67:89:ab:cd:ef:0',
239
                    '01:23:45:67:89:ab:cd:ef:1',
240
                ],
241
                'links': [],
242
            }
243
        )
244 1
        self.deployer.start_mw(maintenance)
245 1
        args, kwargs = buffer_put_mock.call_args
246 1
        event = args[0]
247 1
        assert event.name == 'topology.interruption.start'
248 1
        assert event.content['type'] == 'maintenance'
249 1
        assert sorted(event.content['switches']) == []
250 1
        assert sorted(event.content['interfaces']) == [
251
            '01:23:45:67:65:ab:cd:ef:0',
252
            '01:23:45:67:89:ab:cd:ef:0',
253
            '01:23:45:67:89:ab:cd:ef:1',
254
        ]
255 1
        assert sorted(event.content['links']) == [
256
            'link_1',
257
            'link_2',
258
        ]
259
260
        # Check whats in maintenance
261
        # Switches
262 1
        assert     self.deployer.switch_not_in_maintenance(self.controller.switches['01:23:45:67:89:ab:cd:ef'])
263 1
        assert     self.deployer.switch_not_in_maintenance(self.controller.switches['01:23:45:67:65:ab:cd:ef'])
264 1
        assert     self.deployer.switch_not_in_maintenance(self.controller.switches['01:23:45:67:66:ab:cd:ef'])
265
        # Interfaces
266
267 1
        assert not self.deployer.interface_not_in_maintenance(self.controller.switches['01:23:45:67:89:ab:cd:ef'].interfaces[0])
268 1
        assert not self.deployer.interface_not_in_maintenance(self.controller.switches['01:23:45:67:89:ab:cd:ef'].interfaces[1])
269 1
        assert     self.deployer.interface_not_in_maintenance(self.controller.switches['01:23:45:67:89:ab:cd:ef'].interfaces[2])
270
271 1
        assert not self.deployer.interface_not_in_maintenance(self.controller.switches['01:23:45:67:65:ab:cd:ef'].interfaces[0])
272 1
        assert     self.deployer.interface_not_in_maintenance(self.controller.switches['01:23:45:67:65:ab:cd:ef'].interfaces[1])
273 1
        assert     self.deployer.interface_not_in_maintenance(self.controller.switches['01:23:45:67:65:ab:cd:ef'].interfaces[2])
274
275 1
        for interface in self.controller.switches['01:23:45:67:66:ab:cd:ef'].interfaces.values():
276 1
            assert     self.deployer.interface_not_in_maintenance(interface)
277
278
        # Links
279 1
        assert not self.deployer.link_not_in_maintenance(self.link_1)
280 1
        assert not self.deployer.link_not_in_maintenance(self.link_2)
281 1
        assert     self.deployer.link_not_in_maintenance(self.link_3)
282
283 1
        self.deployer.end_mw(maintenance)
284 1
        args, kwargs = buffer_put_mock.call_args
285 1
        event = args[0]
286 1
        assert event.name == 'topology.interruption.end'
287 1
        assert event.content['type'] == 'maintenance'
288 1
        assert sorted(event.content['switches']) == []
289 1
        assert sorted(event.content['switches']) == []
290 1
        assert sorted(event.content['interfaces']) == [
291
            '01:23:45:67:65:ab:cd:ef:0',
292
            '01:23:45:67:89:ab:cd:ef:0',
293
            '01:23:45:67:89:ab:cd:ef:1',
294
        ]
295 1
        assert sorted(event.content['links']) == [
296
            'link_1',
297
            'link_2',
298
        ]
299
        # Check whats in maintenance
300
        # Switches
301 1
        assert     self.deployer.switch_not_in_maintenance(self.controller.switches['01:23:45:67:89:ab:cd:ef'])
302 1
        assert     self.deployer.switch_not_in_maintenance(self.controller.switches['01:23:45:67:65:ab:cd:ef'])
303 1
        assert     self.deployer.switch_not_in_maintenance(self.controller.switches['01:23:45:67:66:ab:cd:ef'])
304
        # Interfaces
305 1
        for interface in self.controller.switches['01:23:45:67:89:ab:cd:ef'].interfaces.values():
306 1
            assert     self.deployer.interface_not_in_maintenance(interface)
307 1
        for interface in self.controller.switches['01:23:45:67:65:ab:cd:ef'].interfaces.values():
308 1
            assert     self.deployer.interface_not_in_maintenance(interface)
309 1
        for interface in self.controller.switches['01:23:45:67:66:ab:cd:ef'].interfaces.values():
310 1
            assert     self.deployer.interface_not_in_maintenance(interface)
311
        # Links
312 1
        assert     self.deployer.link_not_in_maintenance(self.link_1)
313 1
        assert     self.deployer.link_not_in_maintenance(self.link_2)
314 1
        assert     self.deployer.link_not_in_maintenance(self.link_3)
315
316 1
    def test_mw_case_3(self):
317
        """Test deploying a maintenance window to links."""
318 1
        buffer_put_mock = MagicMock()
319 1
        self.controller.buffers.app.put = buffer_put_mock
320 1
        maintenance = self.maintenance.copy(
321
            update = {
322
                'switches': [],
323
                'interfaces': [],
324
                'links': ['link_1', 'link_2'],
325
            }
326
        )
327 1
        self.deployer.start_mw(maintenance)
328 1
        args, kwargs = buffer_put_mock.call_args
329 1
        event = args[0]
330 1
        assert event.name == 'topology.interruption.start'
331 1
        assert event.content['type'] == 'maintenance'
332 1
        assert sorted(event.content['switches']) == []
333 1
        assert sorted(event.content['interfaces']) == []
334 1
        assert sorted(event.content['links']) == [
335
            'link_1',
336
            'link_2',
337
        ]
338
339
        # Check whats in maintenance
340
        # Switches
341 1
        assert     self.deployer.switch_not_in_maintenance(self.controller.switches['01:23:45:67:89:ab:cd:ef'])
342 1
        assert     self.deployer.switch_not_in_maintenance(self.controller.switches['01:23:45:67:65:ab:cd:ef'])
343 1
        assert     self.deployer.switch_not_in_maintenance(self.controller.switches['01:23:45:67:66:ab:cd:ef'])
344
        # Interfaces
345 1
        for interface in self.controller.switches['01:23:45:67:89:ab:cd:ef'].interfaces.values():
346 1
            assert     self.deployer.interface_not_in_maintenance(interface)
347 1
        for interface in self.controller.switches['01:23:45:67:65:ab:cd:ef'].interfaces.values():
348 1
            assert     self.deployer.interface_not_in_maintenance(interface)
349 1
        for interface in self.controller.switches['01:23:45:67:66:ab:cd:ef'].interfaces.values():
350 1
            assert     self.deployer.interface_not_in_maintenance(interface)
351
        # Links
352 1
        assert not self.deployer.link_not_in_maintenance(self.link_1)
353 1
        assert not self.deployer.link_not_in_maintenance(self.link_2)
354 1
        assert     self.deployer.link_not_in_maintenance(self.link_3)
355
356 1
        self.deployer.end_mw(maintenance)
357 1
        args, kwargs = buffer_put_mock.call_args
358 1
        event = args[0]
359 1
        assert event.name == 'topology.interruption.end'
360 1
        assert event.content['type'] == 'maintenance'
361 1
        assert sorted(event.content['switches']) == []
362 1
        assert sorted(event.content['interfaces']) == []
363 1
        assert sorted(event.content['links']) == [
364
            'link_1',
365
            'link_2',
366
        ]
367
        # Check whats in maintenance
368
        # Switches
369 1
        assert     self.deployer.switch_not_in_maintenance(self.controller.switches['01:23:45:67:89:ab:cd:ef'])
370 1
        assert     self.deployer.switch_not_in_maintenance(self.controller.switches['01:23:45:67:65:ab:cd:ef'])
371 1
        assert     self.deployer.switch_not_in_maintenance(self.controller.switches['01:23:45:67:66:ab:cd:ef'])
372
        # Interfaces
373 1
        for interface in self.controller.switches['01:23:45:67:89:ab:cd:ef'].interfaces.values():
374 1
            assert     self.deployer.interface_not_in_maintenance(interface)
375 1
        for interface in self.controller.switches['01:23:45:67:65:ab:cd:ef'].interfaces.values():
376 1
            assert     self.deployer.interface_not_in_maintenance(interface)
377 1
        for interface in self.controller.switches['01:23:45:67:66:ab:cd:ef'].interfaces.values():
378 1
            assert     self.deployer.interface_not_in_maintenance(interface)
379
        # Links
380 1
        assert     self.deployer.link_not_in_maintenance(self.link_1)
381 1
        assert     self.deployer.link_not_in_maintenance(self.link_2)
382 1
        assert     self.deployer.link_not_in_maintenance(self.link_3)
383
384 1
    def test_dev_status(self):
385 1
        switch_1 = MagicMock(
386
            id = 'test-switch-1',
387
            interfaces = {},
388
        )
389 1
        switch_2 = MagicMock(
390
            id = 'test-switch-2',
391
            interfaces = {},
392
        )
393 1
        interface_1 = MagicMock(
394
            id = 'test-interface-1',
395
            switch = switch_1,
396
            link = None,
397
        )
398 1
        switch_1.interfaces[0] = interface_1
399 1
        interface_2 = MagicMock(
400
            id = 'test-interface-2',
401
            switch = switch_2,
402
            link = None,
403
        )
404 1
        switch_2.interfaces[0] = interface_2
405 1
        link = MagicMock(
406
            id = 'test-link',
407
            endpoint_a = interface_1,
408
            endpoint_b = interface_2,
409
        )
410
411
        # No active maintenances
412 1
        assert self.deployer.link_status_func(link) != EntityStatus.DOWN
413 1
        assert self.deployer.interface_status_func(interface_1) != EntityStatus.DOWN
414 1
        assert self.deployer.interface_status_func(interface_2) != EntityStatus.DOWN
415 1
        assert self.deployer.switch_status_func(switch_1) != EntityStatus.DOWN
416 1
        assert self.deployer.switch_status_func(switch_2) != EntityStatus.DOWN
417
418 1
        assert self.deployer.link_status_reason_func(link) == set()
419 1
        assert self.deployer.interface_status_reason_func(interface_1) == set()
420 1
        assert self.deployer.interface_status_reason_func(interface_2) == set()
421 1
        assert self.deployer.switch_status_reason_func(switch_1) == set()
422 1
        assert self.deployer.switch_status_reason_func(switch_2) == set()
423
424
        # Active switch maintenance
425 1
        self.deployer.maintenance_switches['test-switch-1'] = 1
426
427 1
        assert self.deployer.link_status_func(link) == EntityStatus.DOWN
428 1
        assert self.deployer.interface_status_func(interface_1) == EntityStatus.DOWN
429 1
        assert self.deployer.interface_status_func(interface_2) != EntityStatus.DOWN
430 1
        assert self.deployer.switch_status_func(switch_1) == EntityStatus.DOWN
431 1
        assert self.deployer.switch_status_func(switch_2) != EntityStatus.DOWN
432
433 1
        assert self.deployer.link_status_reason_func(link) == {'maintenance'}
434 1
        assert self.deployer.interface_status_reason_func(interface_1) == {'maintenance'}
435 1
        assert self.deployer.interface_status_reason_func(interface_2) == set()
436 1
        assert self.deployer.switch_status_reason_func(switch_1) == {'maintenance'}
437 1
        assert self.deployer.switch_status_reason_func(switch_2) == set()
438
439
        # Active interface maintenance
440 1
        self.deployer.maintenance_switches['test-switch-1'] = 0
441 1
        self.deployer.maintenance_interfaces['test-interface-1'] = 1
442
443 1
        assert self.deployer.link_status_func(link) == EntityStatus.DOWN
444 1
        assert self.deployer.interface_status_func(interface_1) == EntityStatus.DOWN
445 1
        assert self.deployer.interface_status_func(interface_2) != EntityStatus.DOWN
446 1
        assert self.deployer.switch_status_func(switch_1) != EntityStatus.DOWN
447 1
        assert self.deployer.switch_status_func(switch_2) != EntityStatus.DOWN
448
449 1
        assert self.deployer.link_status_reason_func(link) == {'maintenance'}
450 1
        assert self.deployer.interface_status_reason_func(interface_1) == {'maintenance'}
451 1
        assert self.deployer.interface_status_reason_func(interface_2) == set()
452 1
        assert self.deployer.switch_status_reason_func(switch_1) == set()
453 1
        assert self.deployer.switch_status_reason_func(switch_2) == set()
454
455
        # Active link maintenance
456 1
        self.deployer.maintenance_switches['test-switch-1'] = 0
457 1
        self.deployer.maintenance_interfaces['test-interface-1'] = 0
458 1
        self.deployer.maintenance_links['test-link'] = 1
459
460 1
        assert self.deployer.link_status_func(link) == EntityStatus.DOWN
461 1
        assert self.deployer.interface_status_func(interface_1) != EntityStatus.DOWN
462 1
        assert self.deployer.interface_status_func(interface_2) != EntityStatus.DOWN
463 1
        assert self.deployer.switch_status_func(switch_1) != EntityStatus.DOWN
464 1
        assert self.deployer.switch_status_func(switch_2) != EntityStatus.DOWN
465
466 1
        assert self.deployer.link_status_reason_func(link) == {'maintenance'}
467 1
        assert self.deployer.interface_status_reason_func(interface_1) == set()
468 1
        assert self.deployer.interface_status_reason_func(interface_2) == set()
469 1
        assert self.deployer.switch_status_reason_func(switch_1) == set()
470
        assert self.deployer.switch_status_reason_func(switch_2) == set()
471