Debian Codegraph @

tests/units/anta_tests/routing/test_isis.py

raw symbols SCIP
1 # Copyright (c) 2023-2026 Arista Networks, Inc.
2 # Use of this source code is governed by the Apache License 2.0
3 # that can be found in the LICENSE file.
4 """Tests for anta.tests.routing.ospf.py."""
5
6 # pylint: disable=too-many-lines
7
8 from __future__ import annotations
9
10 import sys
11 from typing import TYPE_CHECKING, Any
12
13 import pytest
14
15 from anta.models import AntaTest
16 from anta.result_manager.models import AntaTestStatus
17 from anta.tests.routing.isis import (
18 VerifyISISGracefulRestart,
19 VerifyISISInterfaceMode,
20 VerifyISISNeighborCount,
21 VerifyISISNeighborState,
22 VerifyISISSegmentRoutingAdjacencySegments,
23 VerifyISISSegmentRoutingDataplane,
24 VerifyISISSegmentRoutingTunnels,
25 )
26 from tests.units.anta_tests import test
27
28 if TYPE_CHECKING:
29 from tests.units.anta_tests import AntaUnitTestData
30
31 DATA: AntaUnitTestData = {
32 (VerifyISISNeighborState, "success-default-vrf"): {
33 "eos_data": [
34 {
35 "vrfs": {
36 "default": {
37 "isisInstances": {
38 "CORE-ISIS": {
39 "neighbors": {
40 "0168.0000.0111": {
41 "adjacencies": [
42 {
43 "hostname": "s1-p01",
44 "circuitId": "83",
45 "interfaceName": "Ethernet1",
46 "state": "up",
47 "lastHelloTime": 1713688408,
48 "routerIdV4": "1.0.0.111",
49 }
50 ]
51 },
52 "0168.0000.0112": {
53 "adjacencies": [
54 {
55 "hostname": "s1-p02",
56 "circuitId": "87",
57 "interfaceName": "Ethernet2",
58 "state": "up",
59 "lastHelloTime": 1713688405,
60 "routerIdV4": "1.0.0.112",
61 }
62 ]
63 },
64 }
65 }
66 }
67 },
68 "customer": {
69 "isisInstances": {
70 "CORE-ISIS": {
71 "neighbors": {
72 "0168.0000.0112": {
73 "adjacencies": [
74 {
75 "hostname": "s1-p02",
76 "circuitId": "87",
77 "interfaceName": "Ethernet2",
78 "state": "down",
79 "lastHelloTime": 1713688405,
80 "routerIdV4": "1.0.0.112",
81 }
82 ]
83 }
84 }
85 }
86 }
87 },
88 }
89 }
90 ],
91 "expected": {"result": AntaTestStatus.SUCCESS},
92 },
93 (VerifyISISNeighborState, "success-multiple-vrfs"): {
94 "eos_data": [
95 {
96 "vrfs": {
97 "default": {
98 "isisInstances": {
99 "CORE-ISIS": {
100 "neighbors": {
101 "0168.0000.0111": {
102 "adjacencies": [
103 {
104 "hostname": "s1-p01",
105 "circuitId": "83",
106 "interfaceName": "Ethernet1",
107 "state": "up",
108 "lastHelloTime": 1713688408,
109 "routerIdV4": "1.0.0.111",
110 }
111 ]
112 }
113 }
114 }
115 }
116 },
117 "customer": {
118 "isisInstances": {
119 "CORE-ISIS": {
120 "neighbors": {
121 "0168.0000.0112": {
122 "adjacencies": [
123 {
124 "hostname": "s1-p02",
125 "circuitId": "87",
126 "interfaceName": "Ethernet2",
127 "state": "up",
128 "lastHelloTime": 1713688405,
129 "routerIdV4": "1.0.0.112",
130 }
131 ]
132 }
133 }
134 }
135 }
136 },
137 }
138 }
139 ],
140 "inputs": {"check_all_vrfs": True},
141 "expected": {"result": AntaTestStatus.SUCCESS},
142 },
143 (VerifyISISNeighborState, "failure"): {
144 "eos_data": [
145 {
146 "vrfs": {
147 "default": {
148 "isisInstances": {
149 "CORE-ISIS": {
150 "neighbors": {
151 "0168.0000.0111": {
152 "adjacencies": [
153 {
154 "hostname": "s1-p01",
155 "circuitId": "83",
156 "interfaceName": "Ethernet1",
157 "state": "down",
158 "lastHelloTime": 1713688408,
159 "routerIdV4": "1.0.0.111",
160 }
161 ]
162 },
163 "0168.0000.0112": {
164 "adjacencies": [
165 {
166 "hostname": "s1-p02",
167 "circuitId": "87",
168 "interfaceName": "Ethernet2",
169 "state": "up",
170 "lastHelloTime": 1713688405,
171 "routerIdV4": "1.0.0.112",
172 }
173 ]
174 },
175 }
176 }
177 }
178 }
179 }
180 }
181 ],
182 "expected": {
183 "result": AntaTestStatus.FAILURE,
184 "messages": ["Instance: CORE-ISIS VRF: default Interface: Ethernet1 - Incorrect adjacency state - Expected: up Actual: down"],
185 },
186 },
187 (VerifyISISNeighborState, "skipped-not-configured"): {
188 "eos_data": [{"vrfs": {}}],
189 "expected": {"result": AntaTestStatus.SKIPPED, "messages": ["IS-IS not configured"]},
190 },
191 (VerifyISISNeighborState, "failure-multiple-vrfs"): {
192 "eos_data": [
193 {
194 "vrfs": {
195 "default": {
196 "isisInstances": {
197 "CORE-ISIS": {
198 "neighbors": {
199 "0168.0000.0111": {
200 "adjacencies": [
201 {
202 "hostname": "s1-p01",
203 "circuitId": "83",
204 "interfaceName": "Ethernet1",
205 "state": "up",
206 "lastHelloTime": 1713688408,
207 "routerIdV4": "1.0.0.111",
208 }
209 ]
210 }
211 }
212 }
213 }
214 },
215 "customer": {
216 "isisInstances": {
217 "CORE-ISIS": {
218 "neighbors": {
219 "0168.0000.0112": {
220 "adjacencies": [
221 {
222 "hostname": "s1-p02",
223 "circuitId": "87",
224 "interfaceName": "Ethernet2",
225 "state": "down",
226 "lastHelloTime": 1713688405,
227 "routerIdV4": "1.0.0.112",
228 }
229 ]
230 }
231 }
232 }
233 }
234 },
235 }
236 }
237 ],
238 "inputs": {"check_all_vrfs": True},
239 "expected": {
240 "result": AntaTestStatus.FAILURE,
241 "messages": ["Instance: CORE-ISIS VRF: customer Interface: Ethernet2 - Incorrect adjacency state - Expected: up Actual: down"],
242 },
243 },
244 (VerifyISISNeighborState, "skipped-no-neighbor-detected"): {
245 "eos_data": [{"vrfs": {"default": {"isisInstances": {"CORE-ISIS": {"neighbors": {}}}}, "customer": {"isisInstances": {"CORE-ISIS": {"neighbors": {}}}}}}],
246 "inputs": {"check_all_vrfs": True},
247 "expected": {"result": AntaTestStatus.SKIPPED, "messages": ["No IS-IS neighbor detected"]},
248 },
249 (VerifyISISNeighborCount, "success-default-vrf"): {
250 "eos_data": [
251 {
252 "vrfs": {
253 "default": {
254 "isisInstances": {
255 "CORE-ISIS": {
256 "interfaces": {
257 "Loopback0": {
258 "enabled": True,
259 "intfLevels": {
260 "2": {
261 "ipv4Metric": 10,
262 "sharedSecretProfile": "",
263 "isisAdjacencies": [],
264 "passive": True,
265 "v4Protection": "disabled",
266 "v6Protection": "disabled",
267 }
268 },
269 "areaProxyBoundary": False,
270 },
271 "Ethernet1": {
272 "intfLevels": {
273 "2": {
274 "ipv4Metric": 10,
275 "numAdjacencies": 1,
276 "linkId": "84",
277 "sharedSecretProfile": "",
278 "isisAdjacencies": [],
279 "passive": False,
280 "v4Protection": "link",
281 "v6Protection": "disabled",
282 }
283 },
284 "interfaceSpeed": 1000,
285 "areaProxyBoundary": False,
286 },
287 "Ethernet2": {
288 "enabled": True,
289 "intfLevels": {
290 "2": {
291 "ipv4Metric": 10,
292 "numAdjacencies": 1,
293 "linkId": "88",
294 "sharedSecretProfile": "",
295 "isisAdjacencies": [],
296 "passive": False,
297 "v4Protection": "link",
298 "v6Protection": "disabled",
299 }
300 },
301 "interfaceSpeed": 1000,
302 "areaProxyBoundary": False,
303 },
304 }
305 }
306 }
307 }
308 }
309 }
310 ],
311 "inputs": {"interfaces": [{"name": "Ethernet1", "level": 2, "count": 1}, {"name": "Ethernet2", "level": 2, "count": 1}]},
312 "expected": {"result": AntaTestStatus.SUCCESS},
313 },
314 (VerifyISISNeighborCount, "success-multiple-VRFs"): {
315 "eos_data": [
316 {
317 "vrfs": {
318 "default": {
319 "isisInstances": {
320 "CORE-ISIS": {
321 "interfaces": {
322 "Loopback0": {
323 "enabled": True,
324 "intfLevels": {
325 "2": {
326 "ipv4Metric": 10,
327 "sharedSecretProfile": "",
328 "isisAdjacencies": [],
329 "passive": True,
330 "v4Protection": "disabled",
331 "v6Protection": "disabled",
332 }
333 },
334 "areaProxyBoundary": False,
335 },
336 "Ethernet1": {
337 "intfLevels": {
338 "2": {
339 "ipv4Metric": 10,
340 "numAdjacencies": 1,
341 "linkId": "84",
342 "sharedSecretProfile": "",
343 "isisAdjacencies": [],
344 "passive": False,
345 "v4Protection": "link",
346 "v6Protection": "disabled",
347 }
348 },
349 "interfaceSpeed": 1000,
350 "areaProxyBoundary": False,
351 },
352 "Ethernet2": {
353 "enabled": True,
354 "intfLevels": {
355 "2": {
356 "ipv4Metric": 10,
357 "numAdjacencies": 1,
358 "linkId": "88",
359 "sharedSecretProfile": "",
360 "isisAdjacencies": [],
361 "passive": False,
362 "v4Protection": "link",
363 "v6Protection": "disabled",
364 }
365 },
366 "interfaceSpeed": 1000,
367 "areaProxyBoundary": False,
368 },
369 }
370 }
371 }
372 },
373 "PROD": {
374 "isisInstances": {
375 "PROD-ISIS": {
376 "interfaces": {
377 "Ethernet3": {
378 "enabled": True,
379 "intfLevels": {
380 "1": {
381 "ipv4Metric": 10,
382 "numAdjacencies": 1,
383 "linkId": "88",
384 "sharedSecretProfile": "",
385 "isisAdjacencies": [],
386 "passive": False,
387 "v4Protection": "link",
388 "v6Protection": "disabled",
389 }
390 },
391 "interfaceSpeed": 1000,
392 "areaProxyBoundary": False,
393 }
394 }
395 }
396 }
397 },
398 }
399 }
400 ],
401 "inputs": {
402 "interfaces": [
403 {"name": "Ethernet1", "level": 2, "count": 1},
404 {"name": "Ethernet2", "level": 2, "count": 1},
405 {"name": "Ethernet3", "vrf": "PROD", "level": 1, "count": 1},
406 ]
407 },
408 "expected": {"result": AntaTestStatus.SUCCESS},
409 },
410 (VerifyISISNeighborCount, "skipped-not-configured"): {
411 "eos_data": [{"vrfs": {}}],
412 "inputs": {"interfaces": [{"name": "Ethernet1", "level": 2, "count": 1}]},
413 "expected": {"result": AntaTestStatus.SKIPPED, "messages": ["IS-IS not configured"]},
414 },
415 (VerifyISISNeighborCount, "failure-interface-not-configured"): {
416 "eos_data": [
417 {
418 "vrfs": {
419 "default": {
420 "isisInstances": {
421 "CORE-ISIS": {
422 "interfaces": {
423 "Ethernet1": {
424 "intfLevels": {
425 "2": {
426 "ipv4Metric": 10,
427 "numAdjacencies": 0,
428 "linkId": "84",
429 "sharedSecretProfile": "",
430 "isisAdjacencies": [],
431 "passive": False,
432 "v4Protection": "link",
433 "v6Protection": "disabled",
434 }
435 },
436 "interfaceSpeed": 1000,
437 "areaProxyBoundary": False,
438 }
439 }
440 }
441 }
442 }
443 }
444 }
445 ],
446 "inputs": {"interfaces": [{"name": "Ethernet2", "level": 2, "count": 1}]},
447 "expected": {"result": AntaTestStatus.FAILURE, "messages": ["Interface: Ethernet2 VRF: default Level: 2 - Not configured"]},
448 },
449 (VerifyISISNeighborCount, "success-interface-is-in-wrong-vrf"): {
450 "eos_data": [
451 {
452 "vrfs": {
453 "default": {
454 "isisInstances": {
455 "CORE-ISIS": {
456 "interfaces": {
457 "Ethernet1": {
458 "intfLevels": {
459 "2": {
460 "ipv4Metric": 10,
461 "numAdjacencies": 1,
462 "linkId": "84",
463 "sharedSecretProfile": "",
464 "isisAdjacencies": [],
465 "passive": False,
466 "v4Protection": "link",
467 "v6Protection": "disabled",
468 }
469 },
470 "interfaceSpeed": 1000,
471 "areaProxyBoundary": False,
472 }
473 }
474 }
475 }
476 },
477 "PROD": {
478 "isisInstances": {
479 "PROD-ISIS": {
480 "interfaces": {
481 "Ethernet2": {
482 "enabled": True,
483 "intfLevels": {
484 "1": {
485 "ipv4Metric": 10,
486 "numAdjacencies": 1,
487 "linkId": "88",
488 "sharedSecretProfile": "",
489 "isisAdjacencies": [],
490 "passive": False,
491 "v4Protection": "link",
492 "v6Protection": "disabled",
493 }
494 },
495 "interfaceSpeed": 1000,
496 "areaProxyBoundary": False,
497 }
498 }
499 }
500 }
501 },
502 }
503 }
504 ],
505 "inputs": {"interfaces": [{"name": "Ethernet2", "level": 2, "count": 1}, {"name": "Ethernet1", "vrf": "PROD", "level": 1, "count": 1}]},
506 "expected": {
507 "result": AntaTestStatus.FAILURE,
508 "messages": ["Interface: Ethernet2 VRF: default Level: 2 - Not configured", "Interface: Ethernet1 VRF: PROD Level: 1 - Not configured"],
509 },
510 },
511 (VerifyISISNeighborCount, "failure-wrong-count"): {
512 "eos_data": [
513 {
514 "vrfs": {
515 "default": {
516 "isisInstances": {
517 "CORE-ISIS": {
518 "interfaces": {
519 "Ethernet1": {
520 "intfLevels": {
521 "2": {
522 "ipv4Metric": 10,
523 "numAdjacencies": 3,
524 "linkId": "84",
525 "sharedSecretProfile": "",
526 "isisAdjacencies": [],
527 "passive": False,
528 "v4Protection": "link",
529 "v6Protection": "disabled",
530 }
531 },
532 "interfaceSpeed": 1000,
533 "areaProxyBoundary": False,
534 }
535 }
536 }
537 }
538 }
539 }
540 }
541 ],
542 "inputs": {"interfaces": [{"name": "Ethernet1", "level": 2, "count": 1}]},
543 "expected": {"result": AntaTestStatus.FAILURE, "messages": ["Interface: Ethernet1 VRF: default Level: 2 - Neighbor count mismatch - Expected: 1 Actual: 3"]},
544 },
545 (VerifyISISInterfaceMode, "success-default-vrf"): {
546 "eos_data": [
547 {
548 "vrfs": {
549 "default": {
550 "isisInstances": {
551 "CORE-ISIS": {
552 "interfaces": {
553 "Loopback0": {
554 "enabled": True,
555 "index": 2,
556 "snpa": "0:0:0:0:0:0",
557 "mtu": 65532,
558 "interfaceAddressFamily": "ipv4",
559 "interfaceType": "loopback",
560 "intfLevels": {
561 "2": {
562 "ipv4Metric": 10,
563 "sharedSecretProfile": "",
564 "isisAdjacencies": [],
565 "passive": True,
566 "v4Protection": "disabled",
567 "v6Protection": "disabled",
568 }
569 },
570 "areaProxyBoundary": False,
571 },
572 "Ethernet1": {
573 "enabled": True,
574 "index": 132,
575 "snpa": "P2P",
576 "interfaceType": "point-to-point",
577 "intfLevels": {
578 "2": {
579 "ipv4Metric": 10,
580 "numAdjacencies": 1,
581 "linkId": "84",
582 "sharedSecretProfile": "",
583 "isisAdjacencies": [],
584 "passive": False,
585 "v4Protection": "link",
586 "v6Protection": "disabled",
587 }
588 },
589 "interfaceSpeed": 1000,
590 "areaProxyBoundary": False,
591 },
592 "Ethernet2": {
593 "enabled": True,
594 "interfaceType": "broadcast",
595 "intfLevels": {
596 "2": {
597 "ipv4Metric": 10,
598 "numAdjacencies": 0,
599 "sharedSecretProfile": "",
600 "isisAdjacencies": [],
601 "passive": True,
602 "v4Protection": "disabled",
603 "v6Protection": "disabled",
604 }
605 },
606 "interfaceSpeed": 1000,
607 "areaProxyBoundary": False,
608 },
609 }
610 }
611 }
612 }
613 }
614 }
615 ],
616 "inputs": {
617 "interfaces": [
618 {"name": "Loopback0", "mode": "passive"},
619 {"name": "Ethernet2", "mode": "passive"},
620 {"name": "Ethernet1", "mode": "point-to-point", "vrf": "default"},
621 ]
622 },
623 "expected": {"result": AntaTestStatus.SUCCESS},
624 },
625 (VerifyISISInterfaceMode, "success-multiple-VRFs"): {
626 "eos_data": [
627 {
628 "vrfs": {
629 "default": {
630 "isisInstances": {
631 "CORE-ISIS": {
632 "interfaces": {
633 "Loopback0": {
634 "enabled": True,
635 "index": 2,
636 "snpa": "0:0:0:0:0:0",
637 "mtu": 65532,
638 "interfaceAddressFamily": "ipv4",
639 "interfaceType": "loopback",
640 "intfLevels": {
641 "2": {
642 "ipv4Metric": 10,
643 "sharedSecretProfile": "",
644 "isisAdjacencies": [],
645 "passive": True,
646 "v4Protection": "disabled",
647 "v6Protection": "disabled",
648 }
649 },
650 "areaProxyBoundary": False,
651 },
652 "Ethernet1": {
653 "enabled": True,
654 "index": 132,
655 "snpa": "P2P",
656 "interfaceType": "point-to-point",
657 "intfLevels": {
658 "2": {
659 "ipv4Metric": 10,
660 "numAdjacencies": 1,
661 "linkId": "84",
662 "sharedSecretProfile": "",
663 "isisAdjacencies": [],
664 "passive": False,
665 "v4Protection": "link",
666 "v6Protection": "disabled",
667 }
668 },
669 "interfaceSpeed": 1000,
670 "areaProxyBoundary": False,
671 },
672 }
673 }
674 }
675 },
676 "PROD": {
677 "isisInstances": {
678 "PROD-ISIS": {
679 "interfaces": {
680 "Ethernet4": {
681 "enabled": True,
682 "index": 132,
683 "snpa": "P2P",
684 "interfaceType": "point-to-point",
685 "intfLevels": {
686 "2": {
687 "ipv4Metric": 10,
688 "numAdjacencies": 1,
689 "linkId": "84",
690 "sharedSecretProfile": "",
691 "isisAdjacencies": [],
692 "passive": False,
693 "v4Protection": "link",
694 "v6Protection": "disabled",
695 }
696 },
697 "interfaceSpeed": 1000,
698 "areaProxyBoundary": False,
699 },
700 "Ethernet5": {
701 "enabled": True,
702 "interfaceType": "broadcast",
703 "intfLevels": {
704 "2": {
705 "ipv4Metric": 10,
706 "numAdjacencies": 0,
707 "sharedSecretProfile": "",
708 "isisAdjacencies": [],
709 "passive": True,
710 "v4Protection": "disabled",
711 "v6Protection": "disabled",
712 }
713 },
714 "interfaceSpeed": 1000,
715 "areaProxyBoundary": False,
716 },
717 }
718 }
719 }
720 },
721 }
722 }
723 ],
724 "inputs": {
725 "interfaces": [
726 {"name": "Loopback0", "mode": "passive"},
727 {"name": "Ethernet1", "mode": "point-to-point", "vrf": "default"},
728 {"name": "Ethernet4", "mode": "point-to-point", "vrf": "PROD"},
729 {"name": "Ethernet5", "mode": "passive", "vrf": "PROD"},
730 ]
731 },
732 "expected": {"result": AntaTestStatus.SUCCESS},
733 },
734 (VerifyISISInterfaceMode, "failure-interface-not-passive"): {
735 "eos_data": [
736 {
737 "vrfs": {
738 "default": {
739 "isisInstances": {
740 "CORE-ISIS": {
741 "interfaces": {
742 "Loopback0": {
743 "enabled": True,
744 "index": 2,
745 "snpa": "0:0:0:0:0:0",
746 "mtu": 65532,
747 "interfaceAddressFamily": "ipv4",
748 "interfaceType": "loopback",
749 "intfLevels": {
750 "2": {
751 "ipv4Metric": 10,
752 "sharedSecretProfile": "",
753 "isisAdjacencies": [],
754 "passive": True,
755 "v4Protection": "disabled",
756 "v6Protection": "disabled",
757 }
758 },
759 "areaProxyBoundary": False,
760 },
761 "Ethernet1": {
762 "enabled": True,
763 "index": 132,
764 "snpa": "P2P",
765 "interfaceType": "point-to-point",
766 "intfLevels": {
767 "2": {
768 "ipv4Metric": 10,
769 "numAdjacencies": 1,
770 "linkId": "84",
771 "sharedSecretProfile": "",
772 "isisAdjacencies": [],
773 "passive": False,
774 "v4Protection": "link",
775 "v6Protection": "disabled",
776 }
777 },
778 "interfaceSpeed": 1000,
779 "areaProxyBoundary": False,
780 },
781 "Ethernet2": {
782 "enabled": True,
783 "interfaceType": "point-to-point",
784 "intfLevels": {
785 "2": {
786 "ipv4Metric": 10,
787 "numAdjacencies": 0,
788 "sharedSecretProfile": "",
789 "isisAdjacencies": [],
790 "passive": False,
791 "v4Protection": "disabled",
792 "v6Protection": "disabled",
793 }
794 },
795 "interfaceSpeed": 1000,
796 "areaProxyBoundary": False,
797 },
798 }
799 }
800 }
801 }
802 }
803 }
804 ],
805 "inputs": {
806 "interfaces": [
807 {"name": "Loopback0", "mode": "passive"},
808 {"name": "Ethernet2", "mode": "passive"},
809 {"name": "Ethernet1", "mode": "point-to-point", "vrf": "default"},
810 ]
811 },
812 "expected": {"result": AntaTestStatus.FAILURE, "messages": ["Interface: Ethernet2 VRF: default Level: 2 - Not running in passive mode"]},
813 },
814 (VerifyISISInterfaceMode, "failure-interface-not-point-to-point"): {
815 "eos_data": [
816 {
817 "vrfs": {
818 "default": {
819 "isisInstances": {
820 "CORE-ISIS": {
821 "interfaces": {
822 "Loopback0": {
823 "enabled": True,
824 "index": 2,
825 "snpa": "0:0:0:0:0:0",
826 "mtu": 65532,
827 "interfaceAddressFamily": "ipv4",
828 "interfaceType": "loopback",
829 "intfLevels": {
830 "2": {
831 "ipv4Metric": 10,
832 "sharedSecretProfile": "",
833 "isisAdjacencies": [],
834 "passive": True,
835 "v4Protection": "disabled",
836 "v6Protection": "disabled",
837 }
838 },
839 "areaProxyBoundary": False,
840 },
841 "Ethernet1": {
842 "enabled": True,
843 "index": 132,
844 "snpa": "P2P",
845 "interfaceType": "broadcast",
846 "intfLevels": {
847 "2": {
848 "ipv4Metric": 10,
849 "numAdjacencies": 1,
850 "linkId": "84",
851 "sharedSecretProfile": "",
852 "isisAdjacencies": [],
853 "passive": False,
854 "v4Protection": "link",
855 "v6Protection": "disabled",
856 }
857 },
858 "interfaceSpeed": 1000,
859 "areaProxyBoundary": False,
860 },
861 "Ethernet2": {
862 "enabled": True,
863 "interfaceType": "broadcast",
864 "intfLevels": {
865 "2": {
866 "ipv4Metric": 10,
867 "numAdjacencies": 0,
868 "sharedSecretProfile": "",
869 "isisAdjacencies": [],
870 "passive": True,
871 "v4Protection": "disabled",
872 "v6Protection": "disabled",
873 }
874 },
875 "interfaceSpeed": 1000,
876 "areaProxyBoundary": False,
877 },
878 }
879 }
880 }
881 }
882 }
883 }
884 ],
885 "inputs": {
886 "interfaces": [
887 {"name": "Loopback0", "mode": "passive"},
888 {"name": "Ethernet2", "mode": "passive"},
889 {"name": "Ethernet1", "mode": "point-to-point", "vrf": "default"},
890 ]
891 },
892 "expected": {
893 "result": AntaTestStatus.FAILURE,
894 "messages": ["Interface: Ethernet1 VRF: default Level: 2 - Incorrect interface mode - Expected: point-to-point Actual: broadcast"],
895 },
896 },
897 (VerifyISISInterfaceMode, "failure-interface-wrong-vrf"): {
898 "eos_data": [
899 {
900 "vrfs": {
901 "fake_vrf": {
902 "isisInstances": {
903 "CORE-ISIS": {
904 "interfaces": {
905 "Loopback0": {
906 "enabled": True,
907 "index": 2,
908 "snpa": "0:0:0:0:0:0",
909 "mtu": 65532,
910 "interfaceAddressFamily": "ipv4",
911 "interfaceType": "loopback",
912 "intfLevels": {
913 "2": {
914 "ipv4Metric": 10,
915 "sharedSecretProfile": "",
916 "isisAdjacencies": [],
917 "passive": True,
918 "v4Protection": "disabled",
919 "v6Protection": "disabled",
920 }
921 },
922 "areaProxyBoundary": False,
923 },
924 "Ethernet1": {
925 "enabled": True,
926 "index": 132,
927 "snpa": "P2P",
928 "interfaceType": "point-to-point",
929 "intfLevels": {
930 "2": {
931 "ipv4Metric": 10,
932 "numAdjacencies": 1,
933 "linkId": "84",
934 "sharedSecretProfile": "",
935 "isisAdjacencies": [],
936 "passive": False,
937 "v4Protection": "link",
938 "v6Protection": "disabled",
939 }
940 },
941 "interfaceSpeed": 1000,
942 "areaProxyBoundary": False,
943 },
944 "Ethernet2": {
945 "enabled": True,
946 "interfaceType": "broadcast",
947 "intfLevels": {
948 "2": {
949 "ipv4Metric": 10,
950 "numAdjacencies": 0,
951 "sharedSecretProfile": "",
952 "isisAdjacencies": [],
953 "passive": True,
954 "v4Protection": "disabled",
955 "v6Protection": "disabled",
956 }
957 },
958 "interfaceSpeed": 1000,
959 "areaProxyBoundary": False,
960 },
961 }
962 }
963 }
964 }
965 }
966 }
967 ],
968 "inputs": {
969 "interfaces": [
970 {"name": "Loopback0", "mode": "passive"},
971 {"name": "Ethernet2", "mode": "passive"},
972 {"name": "Ethernet1", "mode": "point-to-point", "vrf": "default"},
973 ]
974 },
975 "expected": {
976 "result": AntaTestStatus.FAILURE,
977 "messages": [
978 "Interface: Loopback0 VRF: default Level: 2 - Not configured",
979 "Interface: Ethernet2 VRF: default Level: 2 - Not configured",
980 "Interface: Ethernet1 VRF: default Level: 2 - Not configured",
981 ],
982 },
983 },
984 (VerifyISISInterfaceMode, "skipped-not-configured"): {
985 "eos_data": [{"vrfs": {}}],
986 "inputs": {
987 "interfaces": [
988 {"name": "Loopback0", "mode": "passive"},
989 {"name": "Ethernet2", "mode": "passive"},
990 {"name": "Ethernet1", "mode": "point-to-point", "vrf": "default"},
991 ]
992 },
993 "expected": {"result": AntaTestStatus.SKIPPED, "messages": ["IS-IS not configured"]},
994 },
995 (VerifyISISInterfaceMode, "failure-multiple-VRFs"): {
996 "eos_data": [
997 {
998 "vrfs": {
999 "default": {
1000 "isisInstances": {
1001 "CORE-ISIS": {
1002 "interfaces": {
1003 "Loopback0": {
1004 "enabled": True,
1005 "index": 2,
1006 "snpa": "0:0:0:0:0:0",
1007 "mtu": 65532,
1008 "interfaceAddressFamily": "ipv4",
1009 "interfaceType": "loopback",
1010 "intfLevels": {
1011 "2": {
1012 "ipv4Metric": 10,
1013 "sharedSecretProfile": "",
1014 "isisAdjacencies": [],
1015 "passive": True,
1016 "v4Protection": "disabled",
1017 "v6Protection": "disabled",
1018 }
1019 },
1020 "areaProxyBoundary": False,
1021 },
1022 "Ethernet1": {
1023 "enabled": True,
1024 "index": 132,
1025 "snpa": "P2P",
1026 "interfaceType": "broadcast",
1027 "intfLevels": {
1028 "2": {
1029 "ipv4Metric": 10,
1030 "numAdjacencies": 1,
1031 "linkId": "84",
1032 "sharedSecretProfile": "",
1033 "isisAdjacencies": [],
1034 "passive": False,
1035 "v4Protection": "link",
1036 "v6Protection": "disabled",
1037 }
1038 },
1039 "interfaceSpeed": 1000,
1040 "areaProxyBoundary": False,
1041 },
1042 }
1043 }
1044 }
1045 },
1046 "PROD": {
1047 "isisInstances": {
1048 "PROD-ISIS": {
1049 "interfaces": {
1050 "Ethernet4": {
1051 "enabled": True,
1052 "index": 132,
1053 "snpa": "P2P",
1054 "interfaceType": "broadcast",
1055 "intfLevels": {
1056 "2": {
1057 "ipv4Metric": 10,
1058 "numAdjacencies": 1,
1059 "linkId": "84",
1060 "sharedSecretProfile": "",
1061 "isisAdjacencies": [],
1062 "passive": False,
1063 "v4Protection": "link",
1064 "v6Protection": "disabled",
1065 }
1066 },
1067 "interfaceSpeed": 1000,
1068 "areaProxyBoundary": False,
1069 },
1070 "Ethernet5": {
1071 "enabled": True,
1072 "interfaceType": "broadcast",
1073 "intfLevels": {
1074 "2": {
1075 "ipv4Metric": 10,
1076 "numAdjacencies": 0,
1077 "sharedSecretProfile": "",
1078 "isisAdjacencies": [],
1079 "passive": False,
1080 "v4Protection": "disabled",
1081 "v6Protection": "disabled",
1082 }
1083 },
1084 "interfaceSpeed": 1000,
1085 "areaProxyBoundary": False,
1086 },
1087 }
1088 }
1089 }
1090 },
1091 }
1092 }
1093 ],
1094 "inputs": {
1095 "interfaces": [
1096 {"name": "Loopback0", "mode": "passive"},
1097 {"name": "Ethernet1", "mode": "point-to-point", "vrf": "default"},
1098 {"name": "Ethernet4", "mode": "point-to-point", "vrf": "PROD"},
1099 {"name": "Ethernet5", "mode": "passive", "vrf": "PROD"},
1100 ]
1101 },
1102 "expected": {
1103 "result": AntaTestStatus.FAILURE,
1104 "messages": [
1105 "Interface: Ethernet1 VRF: default Level: 2 - Incorrect interface mode - Expected: point-to-point Actual: broadcast",
1106 "Interface: Ethernet4 VRF: PROD Level: 2 - Incorrect interface mode - Expected: point-to-point Actual: broadcast",
1107 "Interface: Ethernet5 VRF: PROD Level: 2 - Not running in passive mode",
1108 ],
1109 },
1110 },
1111 (VerifyISISSegmentRoutingAdjacencySegments, "skipped-not-configured"): {
1112 "eos_data": [{"vrfs": {}}],
1113 "inputs": {"instances": [{"name": "CORE-ISIS", "vrf": "default", "segments": [{"interface": "Ethernet2", "address": "10.0.1.3", "sid_origin": "dynamic"}]}]},
1114 "expected": {"result": AntaTestStatus.SKIPPED, "messages": ["IS-IS not configured"]},
1115 },
1116 (VerifyISISSegmentRoutingAdjacencySegments, "success"): {
1117 "eos_data": [
1118 {
1119 "vrfs": {
1120 "default": {
1121 "isisInstances": {
1122 "CORE-ISIS": {
1123 "dataPlane": "MPLS",
1124 "routerId": "1.0.0.11",
1125 "systemId": "0168.0000.0011",
1126 "hostname": "s1-pe01",
1127 "adjSidAllocationMode": "SrOnly",
1128 "adjSidPoolBase": 116384,
1129 "adjSidPoolSize": 16384,
1130 "adjacencySegments": [
1131 {
1132 "ipAddress": "10.0.1.3",
1133 "localIntf": "Ethernet2",
1134 "sid": 116384,
1135 "lan": False,
1136 "sidOrigin": "dynamic",
1137 "protection": "unprotected",
1138 "flags": {"b": False, "v": True, "l": True, "f": False, "s": False},
1139 "level": 2,
1140 },
1141 {
1142 "ipAddress": "10.0.1.1",
1143 "localIntf": "Ethernet1",
1144 "sid": 116385,
1145 "lan": False,
1146 "sidOrigin": "dynamic",
1147 "protection": "unprotected",
1148 "flags": {"b": False, "v": True, "l": True, "f": False, "s": False},
1149 "level": 2,
1150 },
1151 ],
1152 "receivedGlobalAdjacencySegments": [],
1153 "misconfiguredAdjacencySegments": [],
1154 }
1155 }
1156 }
1157 }
1158 }
1159 ],
1160 "inputs": {"instances": [{"name": "CORE-ISIS", "vrf": "default", "segments": [{"interface": "Ethernet2", "address": "10.0.1.3", "sid_origin": "dynamic"}]}]},
1161 "expected": {"result": AntaTestStatus.SUCCESS},
1162 },
1163 (VerifyISISSegmentRoutingAdjacencySegments, "failure-segment-not-found"): {
1164 "eos_data": [
1165 {
1166 "vrfs": {
1167 "default": {
1168 "isisInstances": {
1169 "CORE-ISIS": {
1170 "dataPlane": "MPLS",
1171 "routerId": "1.0.0.11",
1172 "systemId": "0168.0000.0011",
1173 "hostname": "s1-pe01",
1174 "adjSidAllocationMode": "SrOnly",
1175 "adjSidPoolBase": 116384,
1176 "adjSidPoolSize": 16384,
1177 "adjacencySegments": [
1178 {
1179 "ipAddress": "10.0.1.3",
1180 "localIntf": "Ethernet2",
1181 "sid": 116384,
1182 "lan": False,
1183 "sidOrigin": "dynamic",
1184 "protection": "unprotected",
1185 "flags": {"b": False, "v": True, "l": True, "f": False, "s": False},
1186 "level": 2,
1187 },
1188 {
1189 "ipAddress": "10.0.1.1",
1190 "localIntf": "Ethernet1",
1191 "sid": 116385,
1192 "lan": False,
1193 "sidOrigin": "dynamic",
1194 "protection": "unprotected",
1195 "flags": {"b": False, "v": True, "l": True, "f": False, "s": False},
1196 "level": 2,
1197 },
1198 ],
1199 "receivedGlobalAdjacencySegments": [],
1200 "misconfiguredAdjacencySegments": [],
1201 }
1202 }
1203 }
1204 }
1205 }
1206 ],
1207 "inputs": {
1208 "instances": [
1209 {
1210 "name": "CORE-ISIS",
1211 "vrf": "default",
1212 "segments": [
1213 {"interface": "Ethernet2", "address": "10.0.1.3", "sid_origin": "dynamic"},
1214 {"interface": "Ethernet3", "address": "10.0.1.2", "sid_origin": "dynamic"},
1215 ],
1216 }
1217 ]
1218 },
1219 "expected": {
1220 "result": AntaTestStatus.FAILURE,
1221 "messages": ["Instance: CORE-ISIS VRF: default Local Intf: Ethernet3 Adj IP Address: 10.0.1.2 - Adjacency segment not found"],
1222 },
1223 },
1224 (VerifyISISSegmentRoutingAdjacencySegments, "failure-no-segments-incorrect-instance"): {
1225 "eos_data": [
1226 {
1227 "vrfs": {
1228 "default": {
1229 "isisInstances": {
1230 "CORE-ISIS": {
1231 "dataPlane": "MPLS",
1232 "routerId": "1.0.0.11",
1233 "systemId": "0168.0000.0011",
1234 "hostname": "s1-pe01",
1235 "adjSidAllocationMode": "SrOnly",
1236 "adjSidPoolBase": 116384,
1237 "adjSidPoolSize": 16384,
1238 "adjacencySegments": [
1239 {
1240 "ipAddress": "10.0.1.3",
1241 "localIntf": "Ethernet2",
1242 "sid": 116384,
1243 "lan": False,
1244 "sidOrigin": "dynamic",
1245 "protection": "unprotected",
1246 "flags": {"b": False, "v": True, "l": True, "f": False, "s": False},
1247 "level": 2,
1248 },
1249 {
1250 "ipAddress": "10.0.1.1",
1251 "localIntf": "Ethernet1",
1252 "sid": 116385,
1253 "lan": False,
1254 "sidOrigin": "dynamic",
1255 "protection": "unprotected",
1256 "flags": {"b": False, "v": True, "l": True, "f": False, "s": False},
1257 "level": 2,
1258 },
1259 ],
1260 "receivedGlobalAdjacencySegments": [],
1261 "misconfiguredAdjacencySegments": [],
1262 }
1263 }
1264 }
1265 }
1266 }
1267 ],
1268 "inputs": {
1269 "instances": [
1270 {
1271 "name": "CORE-ISIS2",
1272 "vrf": "default",
1273 "segments": [
1274 {"interface": "Ethernet2", "address": "10.0.1.3", "sid_origin": "dynamic"},
1275 {"interface": "Ethernet3", "address": "10.0.1.2", "sid_origin": "dynamic"},
1276 ],
1277 }
1278 ]
1279 },
1280 "expected": {"result": AntaTestStatus.FAILURE, "messages": ["Instance: CORE-ISIS2 VRF: default - No adjacency segments found"]},
1281 },
1282 (VerifyISISSegmentRoutingAdjacencySegments, "failure-incorrect-segment-level"): {
1283 "eos_data": [
1284 {
1285 "vrfs": {
1286 "default": {
1287 "isisInstances": {
1288 "CORE-ISIS": {
1289 "dataPlane": "MPLS",
1290 "routerId": "1.0.0.11",
1291 "systemId": "0168.0000.0011",
1292 "hostname": "s1-pe01",
1293 "adjSidAllocationMode": "SrOnly",
1294 "adjSidPoolBase": 116384,
1295 "adjSidPoolSize": 16384,
1296 "adjacencySegments": [
1297 {
1298 "ipAddress": "10.0.1.3",
1299 "localIntf": "Ethernet2",
1300 "sid": 116384,
1301 "lan": False,
1302 "sidOrigin": "dynamic",
1303 "protection": "unprotected",
1304 "flags": {"b": False, "v": True, "l": True, "f": False, "s": False},
1305 "level": 2,
1306 }
1307 ],
1308 "receivedGlobalAdjacencySegments": [],
1309 "misconfiguredAdjacencySegments": [],
1310 }
1311 }
1312 }
1313 }
1314 }
1315 ],
1316 "inputs": {
1317 "instances": [
1318 {"name": "CORE-ISIS", "vrf": "default", "segments": [{"interface": "Ethernet2", "address": "10.0.1.3", "sid_origin": "dynamic", "level": 1}]}
1319 ]
1320 },
1321 "expected": {
1322 "result": AntaTestStatus.FAILURE,
1323 "messages": ["Instance: CORE-ISIS VRF: default Local Intf: Ethernet2 Adj IP Address: 10.0.1.3 - Incorrect IS-IS level - Expected: 1 Actual: 2"],
1324 },
1325 },
1326 (VerifyISISSegmentRoutingAdjacencySegments, "failure-incorrect-sid-origin"): {
1327 "eos_data": [
1328 {
1329 "vrfs": {
1330 "default": {
1331 "isisInstances": {
1332 "CORE-ISIS": {
1333 "dataPlane": "MPLS",
1334 "routerId": "1.0.0.11",
1335 "systemId": "0168.0000.0011",
1336 "hostname": "s1-pe01",
1337 "adjSidAllocationMode": "SrOnly",
1338 "adjSidPoolBase": 116384,
1339 "adjSidPoolSize": 16384,
1340 "adjacencySegments": [
1341 {
1342 "ipAddress": "10.0.1.3",
1343 "localIntf": "Ethernet2",
1344 "sid": 116384,
1345 "lan": False,
1346 "sidOrigin": "configured",
1347 "protection": "unprotected",
1348 "flags": {"b": False, "v": True, "l": True, "f": False, "s": False},
1349 "level": 2,
1350 }
1351 ],
1352 "receivedGlobalAdjacencySegments": [],
1353 "misconfiguredAdjacencySegments": [],
1354 }
1355 }
1356 }
1357 }
1358 }
1359 ],
1360 "inputs": {
1361 "instances": [
1362 {"name": "CORE-ISIS", "vrf": "default", "segments": [{"interface": "Ethernet2", "address": "10.0.1.3", "sid_origin": "dynamic", "level": 2}]}
1363 ]
1364 },
1365 "expected": {
1366 "result": AntaTestStatus.FAILURE,
1367 "messages": [
1368 "Instance: CORE-ISIS VRF: default Local Intf: Ethernet2 Adj IP Address: 10.0.1.3 - Incorrect SID origin - Expected: dynamic Actual: configured"
1369 ],
1370 },
1371 },
1372 (VerifyISISSegmentRoutingDataplane, "success"): {
1373 "eos_data": [
1374 {
1375 "vrfs": {
1376 "default": {"isisInstances": {"CORE-ISIS": {"dataPlane": "MPLS", "routerId": "1.0.0.11", "systemId": "0168.0000.0011", "hostname": "s1-pe01"}}}
1377 }
1378 }
1379 ],
1380 "inputs": {"instances": [{"name": "CORE-ISIS", "vrf": "default", "dataplane": "MPLS"}]},
1381 "expected": {"result": AntaTestStatus.SUCCESS},
1382 },
1383 (VerifyISISSegmentRoutingDataplane, "failure-incorrect-dataplane"): {
1384 "eos_data": [
1385 {
1386 "vrfs": {
1387 "default": {"isisInstances": {"CORE-ISIS": {"dataPlane": "MPLS", "routerId": "1.0.0.11", "systemId": "0168.0000.0011", "hostname": "s1-pe01"}}}
1388 }
1389 }
1390 ],
1391 "inputs": {"instances": [{"name": "CORE-ISIS", "vrf": "default", "dataplane": "unset"}]},
1392 "expected": {
1393 "result": AntaTestStatus.FAILURE,
1394 "messages": ["Instance: CORE-ISIS VRF: default - Data-plane not correctly configured - Expected: UNSET Actual: MPLS"],
1395 },
1396 },
1397 (VerifyISISSegmentRoutingDataplane, "failure-instance-not-configured"): {
1398 "eos_data": [
1399 {
1400 "vrfs": {
1401 "default": {"isisInstances": {"CORE-ISIS": {"dataPlane": "MPLS", "routerId": "1.0.0.11", "systemId": "0168.0000.0011", "hostname": "s1-pe01"}}}
1402 }
1403 }
1404 ],
1405 "inputs": {"instances": [{"name": "CORE-ISIS2", "vrf": "default", "dataplane": "unset"}]},
1406 "expected": {"result": AntaTestStatus.FAILURE, "messages": ["Instance: CORE-ISIS2 VRF: default - Not configured"]},
1407 },
1408 (VerifyISISSegmentRoutingDataplane, "skipped-not-configured"): {
1409 "eos_data": [{"vrfs": {}}],
1410 "inputs": {"instances": [{"name": "CORE-ISIS", "vrf": "default", "dataplane": "unset"}]},
1411 "expected": {"result": AntaTestStatus.SKIPPED, "messages": ["IS-IS not configured"]},
1412 },
1413 (VerifyISISSegmentRoutingTunnels, "runs successfully"): {
1414 "eos_data": [
1415 {
1416 "entries": {
1417 "3": {
1418 "endpoint": "1.0.0.122/32",
1419 "vias": [
1420 {"type": "ip", "nexthop": "10.0.1.1", "interface": "Ethernet1", "labels": ["900021"]},
1421 {"type": "ip", "nexthop": "10.0.1.3", "interface": "Ethernet2", "labels": ["900021"]},
1422 ],
1423 },
1424 "31": {
1425 "endpoint": "1.0.0.13/32",
1426 "vias": [
1427 {"type": "ip", "nexthop": "10.0.1.1", "interface": "Ethernet1", "labels": ["900021"]},
1428 {"type": "ip", "nexthop": "10.0.1.3", "interface": "Ethernet2", "labels": ["900021"]},
1429 ],
1430 },
1431 "32": {
1432 "endpoint": "1.0.0.122/32",
1433 "vias": [
1434 {"type": "ip", "nexthop": "10.0.1.1", "interface": "Ethernet1", "labels": ["900021"]},
1435 {"type": "ip", "nexthop": "10.0.1.3", "interface": "Ethernet2", "labels": ["900021"]},
1436 ],
1437 },
1438 "2": {"endpoint": "1.0.0.111/32", "vias": [{"type": "tunnel", "tunnelId": {"type": "TI-LFA", "index": 4}, "labels": ["3"]}]},
1439 }
1440 }
1441 ],
1442 "inputs": {
1443 "entries": [
1444 {"endpoint": "1.0.0.122/32"},
1445 {"endpoint": "1.0.0.13/32", "vias": [{"type": "ip"}]},
1446 {"endpoint": "1.0.0.111/32", "vias": [{"type": "tunnel", "tunnel_id": "ti-lfa"}]},
1447 {
1448 "endpoint": "1.0.0.122/32",
1449 "vias": [{"interface": "Ethernet1", "nexthop": "10.0.1.1"}, {"type": "ip", "interface": "Ethernet2", "nexthop": "10.0.1.3"}],
1450 },
1451 ]
1452 },
1453 "expected": {"result": AntaTestStatus.SUCCESS},
1454 },
1455 (VerifyISISSegmentRoutingTunnels, "is skipped if not entry founf in EOS"): {
1456 "eos_data": [{"entries": {}}],
1457 "inputs": {"entries": [{"endpoint": "1.0.0.122/32"}]},
1458 "expected": {"result": AntaTestStatus.SKIPPED, "messages": ["IS-IS-SR not configured"]},
1459 },
1460 (VerifyISISSegmentRoutingTunnels, "runs successfully only endpoint"): {
1461 "eos_data": [{"entries": {"2": {"endpoint": "1.0.0.111/32", "vias": [{"type": "tunnel", "tunnelId": {"type": "TI-LFA", "index": 4}, "labels": ["3"]}]}}}],
1462 "inputs": {"entries": [{"endpoint": "1.0.0.122/32"}]},
1463 "expected": {"result": AntaTestStatus.FAILURE, "messages": ["Endpoint: 1.0.0.122/32 - Tunnel not found"]},
1464 },
1465 (VerifyISISSegmentRoutingTunnels, "fails with incorrect tunnel type"): {
1466 "eos_data": [
1467 {
1468 "entries": {
1469 "3": {
1470 "endpoint": "1.0.0.122/32",
1471 "vias": [
1472 {"type": "ip", "nexthop": "10.0.1.1", "interface": "Ethernet1", "labels": ["900021"]},
1473 {"type": "ip", "nexthop": "10.0.1.3", "interface": "Ethernet2", "labels": ["900021"]},
1474 ],
1475 },
1476 "31": {
1477 "endpoint": "1.0.0.13/32",
1478 "vias": [
1479 {"type": "ip", "nexthop": "10.0.1.1", "interface": "Ethernet1", "labels": ["900021"]},
1480 {"type": "ip", "nexthop": "10.0.1.3", "interface": "Ethernet2", "labels": ["900021"]},
1481 ],
1482 },
1483 "32": {
1484 "endpoint": "1.0.0.122/32",
1485 "vias": [
1486 {"type": "ip", "nexthop": "10.0.1.1", "interface": "Ethernet1", "labels": ["900021"]},
1487 {"type": "ip", "nexthop": "10.0.1.3", "interface": "Ethernet2", "labels": ["900021"]},
1488 ],
1489 },
1490 "2": {"endpoint": "1.0.0.111/32", "vias": [{"type": "tunnel", "tunnelId": {"type": "TI-LFA", "index": 4}, "labels": ["3"]}]},
1491 }
1492 }
1493 ],
1494 "inputs": {"entries": [{"endpoint": "1.0.0.122/32"}, {"endpoint": "1.0.0.13/32", "vias": [{"type": "tunnel"}]}]},
1495 "expected": {"result": AntaTestStatus.FAILURE, "messages": ["Endpoint: 1.0.0.13/32 Type: tunnel - Tunnel is incorrect"]},
1496 },
1497 (VerifyISISSegmentRoutingTunnels, "fails with incorrect nexthop interface"): {
1498 "eos_data": [
1499 {
1500 "entries": {
1501 "3": {
1502 "endpoint": "1.0.0.122/32",
1503 "vias": [
1504 {"type": "ip", "nexthop": "10.0.1.1", "interface": "Ethernet1", "labels": ["900021"]},
1505 {"type": "ip", "nexthop": "10.0.1.3", "interface": "Ethernet2", "labels": ["900021"]},
1506 ],
1507 },
1508 "31": {
1509 "endpoint": "1.0.0.13/32",
1510 "vias": [
1511 {"type": "ip", "nexthop": "10.0.1.1", "interface": "Ethernet1", "labels": ["900021"]},
1512 {"type": "ip", "nexthop": "10.0.1.3", "interface": "Ethernet2", "labels": ["900021"]},
1513 ],
1514 },
1515 "32": {
1516 "endpoint": "1.0.0.122/32",
1517 "vias": [
1518 {"type": "ip", "nexthop": "10.0.1.1", "interface": "Ethernet1", "labels": ["900021"]},
1519 {"type": "ip", "nexthop": "10.0.1.3", "interface": "Ethernet2", "labels": ["900021"]},
1520 ],
1521 },
1522 "2": {"endpoint": "1.0.0.111/32", "vias": [{"type": "tunnel", "tunnelId": {"type": "TI-LFA", "index": 4}, "labels": ["3"]}]},
1523 }
1524 }
1525 ],
1526 "inputs": {
1527 "entries": [
1528 {"endpoint": "1.0.0.122/32"},
1529 {"endpoint": "1.0.0.13/32", "vias": [{"type": "ip"}]},
1530 {
1531 "endpoint": "1.0.0.122/32",
1532 "vias": [{"type": "ip", "interface": "Ethernet1", "nexthop": "10.0.1.2"}, {"type": "ip", "interface": "Ethernet2", "nexthop": "10.0.1.3"}],
1533 },
1534 ]
1535 },
1536 "expected": {
1537 "result": AntaTestStatus.FAILURE,
1538 "messages": ["Endpoint: 1.0.0.122/32 Next-hop: 10.0.1.2 Type: ip Interface: Ethernet1 - Tunnel is incorrect"],
1539 },
1540 },
1541 (VerifyISISSegmentRoutingTunnels, "fails with incorrect nexthop"): {
1542 "eos_data": [
1543 {
1544 "entries": {
1545 "3": {
1546 "endpoint": "1.0.0.122/32",
1547 "vias": [
1548 {"type": "ip", "nexthop": "10.0.1.1", "interface": "Ethernet1", "labels": ["900021"]},
1549 {"type": "ip", "nexthop": "10.0.1.3", "interface": "Ethernet2", "labels": ["900021"]},
1550 ],
1551 },
1552 "31": {
1553 "endpoint": "1.0.0.13/32",
1554 "vias": [
1555 {"type": "ip", "nexthop": "10.0.1.1", "interface": "Ethernet1", "labels": ["900021"]},
1556 {"type": "ip", "nexthop": "10.0.1.3", "interface": "Ethernet2", "labels": ["900021"]},
1557 ],
1558 },
1559 "32": {
1560 "endpoint": "1.0.0.122/32",
1561 "vias": [
1562 {"type": "ip", "nexthop": "10.0.1.1", "interface": "Ethernet1", "labels": ["900021"]},
1563 {"type": "ip", "nexthop": "10.0.1.3", "interface": "Ethernet2", "labels": ["900021"]},
1564 ],
1565 },
1566 "2": {"endpoint": "1.0.0.111/32", "vias": [{"type": "tunnel", "tunnelId": {"type": "TI-LFA", "index": 4}, "labels": ["3"]}]},
1567 }
1568 }
1569 ],
1570 "inputs": {
1571 "entries": [
1572 {"endpoint": "1.0.0.122/32"},
1573 {"endpoint": "1.0.0.13/32", "vias": [{"type": "ip"}]},
1574 {
1575 "endpoint": "1.0.0.122/32",
1576 "vias": [{"type": "ip", "interface": "Ethernet4", "nexthop": "10.0.1.1"}, {"type": "ip", "interface": "Ethernet2", "nexthop": "10.0.1.3"}],
1577 },
1578 ]
1579 },
1580 "expected": {
1581 "result": AntaTestStatus.FAILURE,
1582 "messages": ["Endpoint: 1.0.0.122/32 Next-hop: 10.0.1.1 Type: ip Interface: Ethernet4 - Tunnel is incorrect"],
1583 },
1584 },
1585 (VerifyISISSegmentRoutingTunnels, "fails with incorrect interface"): {
1586 "eos_data": [
1587 {
1588 "entries": {
1589 "3": {
1590 "endpoint": "1.0.0.122/32",
1591 "vias": [
1592 {"type": "ip", "nexthop": "10.0.1.1", "interface": "Ethernet1", "labels": ["900021"]},
1593 {"type": "ip", "nexthop": "10.0.1.3", "interface": "Ethernet2", "labels": ["900021"]},
1594 ],
1595 },
1596 "31": {
1597 "endpoint": "1.0.0.13/32",
1598 "vias": [
1599 {"type": "ip", "nexthop": "10.0.1.1", "interface": "Ethernet1", "labels": ["900021"]},
1600 {"type": "ip", "nexthop": "10.0.1.3", "interface": "Ethernet2", "labels": ["900021"]},
1601 ],
1602 },
1603 "32": {
1604 "endpoint": "1.0.0.122/32",
1605 "vias": [
1606 {"type": "ip", "nexthop": "10.0.1.1", "interface": "Ethernet1", "labels": ["900021"]},
1607 {"type": "ip", "nexthop": "10.0.1.3", "interface": "Ethernet2", "labels": ["900021"]},
1608 ],
1609 },
1610 "2": {"endpoint": "1.0.0.111/32", "vias": [{"type": "tunnel", "tunnelId": {"type": "TI-LFA", "index": 4}, "labels": ["3"]}]},
1611 }
1612 }
1613 ],
1614 "inputs": {
1615 "entries": [
1616 {"endpoint": "1.0.0.122/32"},
1617 {"endpoint": "1.0.0.13/32", "vias": [{"type": "ip"}]},
1618 {
1619 "endpoint": "1.0.0.122/32",
1620 "vias": [{"type": "ip", "interface": "Ethernet1", "nexthop": "10.0.1.2"}, {"type": "ip", "interface": "Ethernet2", "nexthop": "10.0.1.3"}],
1621 },
1622 ]
1623 },
1624 "expected": {
1625 "result": AntaTestStatus.FAILURE,
1626 "messages": ["Endpoint: 1.0.0.122/32 Next-hop: 10.0.1.2 Type: ip Interface: Ethernet1 - Tunnel is incorrect"],
1627 },
1628 },
1629 (VerifyISISSegmentRoutingTunnels, "fails with incorrect tunnel ID type"): {
1630 "eos_data": [
1631 {
1632 "entries": {
1633 "3": {
1634 "endpoint": "1.0.0.122/32",
1635 "vias": [
1636 {"type": "ip", "nexthop": "10.0.1.1", "interface": "Ethernet1", "labels": ["900021"]},
1637 {"type": "ip", "nexthop": "10.0.1.3", "interface": "Ethernet2", "labels": ["900021"]},
1638 ],
1639 },
1640 "31": {
1641 "endpoint": "1.0.0.13/32",
1642 "vias": [
1643 {"type": "ip", "nexthop": "10.0.1.1", "interface": "Ethernet1", "labels": ["900021"]},
1644 {"type": "ip", "nexthop": "10.0.1.3", "interface": "Ethernet2", "labels": ["900021"]},
1645 ],
1646 },
1647 "32": {
1648 "endpoint": "1.0.0.122/32",
1649 "vias": [
1650 {"type": "ip", "nexthop": "10.0.1.1", "interface": "Ethernet1", "labels": ["900021"]},
1651 {"type": "ip", "nexthop": "10.0.1.3", "interface": "Ethernet2", "labels": ["900021"]},
1652 ],
1653 },
1654 "2": {"endpoint": "1.0.0.111/32", "vias": [{"type": "tunnel", "tunnelId": {"type": "unset", "index": 4}, "labels": ["3"]}]},
1655 }
1656 }
1657 ],
1658 "inputs": {
1659 "entries": [
1660 {"endpoint": "1.0.0.122/32"},
1661 {"endpoint": "1.0.0.13/32", "vias": [{"type": "ip"}]},
1662 {"endpoint": "1.0.0.111/32", "vias": [{"type": "tunnel", "tunnel_id": "ti-lfa"}]},
1663 ]
1664 },
1665 "expected": {"result": AntaTestStatus.FAILURE, "messages": ["Endpoint: 1.0.0.111/32 Type: tunnel Tunnel ID: ti-lfa - Tunnel is incorrect"]},
1666 },
1667 (VerifyISISSegmentRoutingTunnels, "skipped with ISIS-SR not running"): {
1668 "eos_data": [{"entries": {}}],
1669 "inputs": {
1670 "entries": [
1671 {"endpoint": "1.0.0.122/32"},
1672 {"endpoint": "1.0.0.13/32", "vias": [{"type": "ip"}]},
1673 {"endpoint": "1.0.0.111/32", "vias": [{"type": "tunnel", "tunnel_id": "unset"}]},
1674 ]
1675 },
1676 "expected": {"result": AntaTestStatus.SKIPPED, "messages": ["IS-IS-SR not configured"]},
1677 },
1678 (VerifyISISGracefulRestart, "success"): {
1679 "eos_data": [
1680 {
1681 "vrfs": {
1682 "default": {
1683 "isisInstances": {
1684 "1": {"gracefulRestart": "enabled", "gracefulRestartHelper": "enabled"},
1685 "2": {"gracefulRestart": "enabled", "gracefulRestartHelper": "disabled"},
1686 }
1687 },
1688 "test": {
1689 "isisInstances": {
1690 "11": {"gracefulRestart": "disabled", "gracefulRestartHelper": "enabled"},
1691 "12": {"gracefulRestart": "enabled", "gracefulRestartHelper": "disabled"},
1692 }
1693 },
1694 }
1695 }
1696 ],
1697 "inputs": {
1698 "instances": [
1699 {"vrf": "default", "name": "1", "graceful_restart": True},
1700 {"vrf": "default", "name": "2", "graceful_restart": True, "graceful_restart_helper": False},
1701 {"vrf": "test", "name": "11"},
1702 {"vrf": "test", "name": "12", "graceful_restart": True, "graceful_restart_helper": False},
1703 ]
1704 },
1705 "expected": {"result": AntaTestStatus.SUCCESS},
1706 },
1707 (VerifyISISGracefulRestart, "failure-isis-not-configured"): {
1708 "eos_data": [{"vrfs": {}}],
1709 "inputs": {"instances": [{"vrf": "default", "name": "1", "graceful_restart": True}]},
1710 "expected": {"result": AntaTestStatus.SKIPPED, "messages": ["IS-IS not configured"]},
1711 },
1712 (VerifyISISGracefulRestart, "failure-isis-instance-not-found"): {
1713 "eos_data": [{"vrfs": {"default": {"isisInstances": {"2": {"gracefulRestart": "enabled", "gracefulRestartHelper": "enabled"}}}}}],
1714 "inputs": {"instances": [{"vrf": "default", "name": "1", "graceful_restart": True}]},
1715 "expected": {"result": AntaTestStatus.FAILURE, "messages": ["Instance: 1 VRF: default - Not configured"]},
1716 },
1717 (VerifyISISGracefulRestart, "failure-graceful-restart-disabled"): {
1718 "eos_data": [
1719 {
1720 "vrfs": {
1721 "default": {
1722 "isisInstances": {
1723 "1": {"gracefulRestart": "disabled", "gracefulRestartHelper": "enabled"},
1724 "2": {"gracefulRestart": "enabled", "gracefulRestartHelper": "enabled"},
1725 }
1726 },
1727 "test": {
1728 "isisInstances": {
1729 "11": {"gracefulRestart": "enabled", "gracefulRestartHelper": "enabled"},
1730 "12": {"gracefulRestart": "enabled", "gracefulRestartHelper": "disabled"},
1731 }
1732 },
1733 }
1734 }
1735 ],
1736 "inputs": {
1737 "instances": [
1738 {"vrf": "default", "name": "1", "graceful_restart": True},
1739 {"vrf": "default", "name": "2", "graceful_restart": True},
1740 {"vrf": "test", "name": "11"},
1741 {"vrf": "test", "name": "12", "graceful_restart": True, "graceful_restart_helper": False},
1742 ]
1743 },
1744 "expected": {
1745 "result": AntaTestStatus.FAILURE,
1746 "messages": [
1747 "Instance: 1 VRF: default - Incorrect graceful restart state - Expected: enabled Actual: disabled",
1748 "Instance: 11 VRF: test - Incorrect graceful restart state - Expected: disabled Actual: enabled",
1749 ],
1750 },
1751 },
1752 (VerifyISISGracefulRestart, "failure-graceful-restart-helper-disabled"): {
1753 "eos_data": [
1754 {
1755 "vrfs": {
1756 "default": {"isisInstances": {"1": {"gracefulRestart": "disabled", "gracefulRestartHelper": "disabled"}}},
1757 "test": {"isisInstances": {"11": {"gracefulRestart": "disabled", "gracefulRestartHelper": "enabled"}}},
1758 }
1759 }
1760 ],
1761 "inputs": {"instances": [{"vrf": "default", "name": "1"}, {"vrf": "test", "name": "11", "graceful_restart_helper": False}]},
1762 "expected": {
1763 "result": AntaTestStatus.FAILURE,
1764 "messages": [
1765 "Instance: 1 VRF: default - Incorrect graceful restart helper state - Expected: enabled Actual: disabled",
1766 "Instance: 11 VRF: test - Incorrect graceful restart helper state - Expected: disabled Actual: enabled",
1767 ],
1768 },
1769 },
1770 }