Commit d4141f4
authored
sonic: refuse breakouts that claim other ports (#2560)
A detected breakout names its children after the master's lane offsets
-- Ethernet<base + n*lanes_per_child> -- which assumes every slot below
the next master is unused. That holds for every port of every bundled
HWSKU except one: on Accton-AS7726-32X the last 100G port, Ethernet124,
has four lanes, but Ethernet125 and Ethernet126 are independent 10G SFP+
ports occupying two of its four child slots.
Claiming them as children silently reconfigures two working ports. A
breakout_ports entry is authoritative for a port's lanes and speed, and
the PORT table is built from every entry in port_config rather than only
the interfaces present in NetBox, so both ports are rewritten on any
device with that HWSKU: lanes 129 and 128 become 126 and 127, speed
10000 becomes 25000, and the aliases Eth1/33 and Eth1/34 become
Eth1/33/1 and Eth1/34/1, presenting them as breakout sub-ports.
Add _breakout_child_collisions() and refuse before mutating anything, so
the group is dropped whole rather than half-applied and the master keeps
its own configuration. Two of the three detection paths needed it:
- the Eth<module>/<port>/<subport> path, which computes child names
from the master offset and had no check at all;
- the SONiC-name 400G grouping path, likewise.
The SONiC-name standard grouping path already refuses these groups. Its
topology gate skips a group whose intermediate slots are ports in
port_config, which is the same condition this collision test applies. A
comment now records that the gate is load-bearing for correctness and
not only for the native-port misdetection it was written for.
The collision test is that a child name other than the master is itself
a key in port_config. Swept across every master of all nine bundled
HWSKUs at 1x/2x/4x/8x, it flags exactly the three real cases on that one
HWSKU and nothing else, so it needs no per-HWSKU exception list.
The new tests load the .ini files shipped in this repo instead of
building a port_config inline. That is the point: the existing
breakout tests use one- or two-entry port_configs, which cannot
express an occupied child slot, so this class of bug was
structurally unreachable by the suite. The 400G case keeps a
synthetic port_config because no bundled HWSKU has an 8-lane master
with an occupied child slot.
The tests locate the repo root by walking up for the setup.cfg
marker rather than a fixed parent depth, matching how
tests/integration/conftest.py finds it; a hard-coded depth breaks
silently when a test module moves.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Roger Luethi <luethi@osism.tech>1 parent c977639 commit d4141f4
3 files changed
Lines changed: 203 additions & 21 deletions
File tree
- osism/tasks/conductor/sonic
- tests/unit/tasks/conductor/sonic
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
644 | 658 | | |
645 | 659 | | |
646 | 660 | | |
| |||
767 | 781 | | |
768 | 782 | | |
769 | 783 | | |
770 | | - | |
771 | | - | |
772 | | - | |
773 | | - | |
774 | | - | |
775 | | - | |
776 | | - | |
777 | | - | |
778 | 784 | | |
779 | 785 | | |
780 | 786 | | |
| |||
797 | 803 | | |
798 | 804 | | |
799 | 805 | | |
800 | | - | |
801 | | - | |
802 | | - | |
803 | | - | |
804 | | - | |
805 | | - | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
806 | 831 | | |
807 | 832 | | |
808 | 833 | | |
| |||
861 | 886 | | |
862 | 887 | | |
863 | 888 | | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
864 | 907 | | |
865 | 908 | | |
866 | 909 | | |
| |||
869 | 912 | | |
870 | 913 | | |
871 | 914 | | |
872 | | - | |
873 | | - | |
874 | | - | |
875 | | - | |
876 | | - | |
| 915 | + | |
877 | 916 | | |
878 | 917 | | |
879 | 918 | | |
| |||
955 | 994 | | |
956 | 995 | | |
957 | 996 | | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
958 | 1001 | | |
959 | 1002 | | |
960 | 1003 | | |
| |||
963 | 1006 | | |
964 | 1007 | | |
965 | 1008 | | |
966 | | - | |
| 1009 | + | |
967 | 1010 | | |
968 | 1011 | | |
969 | 1012 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
12 | 26 | | |
13 | 27 | | |
14 | 28 | | |
| |||
Lines changed: 126 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
568 | 568 | | |
569 | 569 | | |
570 | 570 | | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
0 commit comments