@@ -843,6 +843,88 @@ func TestConversion(t *testing.T) {
843
843
expected : nil ,
844
844
err : fmt .Errorf ("multiple local prefs specified for prefix %s" , "192.0.4.0/24" ),
845
845
},
846
+ {
847
+ name : "One neighbor, trying to set samelocalPrefs for different prefix entries" ,
848
+ fromK8s : []v1beta1.FRRConfiguration {
849
+ {
850
+ Spec : v1beta1.FRRConfigurationSpec {
851
+ BGP : v1beta1.BGPConfig {
852
+ Routers : []v1beta1.Router {
853
+ {
854
+ ASN : 65040 ,
855
+ ID : "192.0.2.20" ,
856
+ Neighbors : []v1beta1.Neighbor {
857
+ {
858
+ ASN : 65041 ,
859
+ Address : "192.0.2.21" ,
860
+ ToAdvertise : v1beta1.Advertise {
861
+ Allowed : v1beta1.AllowedOutPrefixes {
862
+ Prefixes : []string {"192.0.2.0/24" , "10.0.0.0/24" },
863
+ Mode : v1beta1 .AllowRestricted ,
864
+ },
865
+ PrefixesWithLocalPref : []v1beta1.LocalPrefPrefixes {
866
+ {
867
+ Prefixes : []string {"10.0.0.0/24" },
868
+ LocalPref : 100 ,
869
+ },
870
+ {
871
+ Prefixes : []string {"192.0.2.0/24" },
872
+ LocalPref : 100 ,
873
+ },
874
+ },
875
+ },
876
+ },
877
+ },
878
+ Prefixes : []string {"192.0.2.0/24" , "10.0.0.0/24" },
879
+ },
880
+ },
881
+ },
882
+ },
883
+ },
884
+ },
885
+ secrets : map [string ]v1.Secret {},
886
+ expected : nil ,
887
+ err : fmt .Errorf ("a not nil error" ),
888
+ },
889
+ {
890
+ name : "One neighbor, trying to set samelocalPrefs for a prefix twice" ,
891
+ fromK8s : []v1beta1.FRRConfiguration {
892
+ {
893
+ Spec : v1beta1.FRRConfigurationSpec {
894
+ BGP : v1beta1.BGPConfig {
895
+ Routers : []v1beta1.Router {
896
+ {
897
+ ASN : 65040 ,
898
+ ID : "192.0.2.20" ,
899
+ Neighbors : []v1beta1.Neighbor {
900
+ {
901
+ ASN : 65041 ,
902
+ Address : "192.0.2.21" ,
903
+ ToAdvertise : v1beta1.Advertise {
904
+ Allowed : v1beta1.AllowedOutPrefixes {
905
+ Prefixes : []string {"192.0.2.0/24" , "192.0.2.0/24" },
906
+ Mode : v1beta1 .AllowRestricted ,
907
+ },
908
+ PrefixesWithLocalPref : []v1beta1.LocalPrefPrefixes {
909
+ {
910
+ Prefixes : []string {"192.0.2.0/24" , "192.0.2.0/24" },
911
+ LocalPref : 100 ,
912
+ },
913
+ },
914
+ },
915
+ },
916
+ },
917
+ Prefixes : []string {"192.0.2.0/24" },
918
+ },
919
+ },
920
+ },
921
+ },
922
+ },
923
+ },
924
+ secrets : map [string ]v1.Secret {},
925
+ expected : nil ,
926
+ err : fmt .Errorf ("a not nil error" ),
927
+ },
846
928
{
847
929
name : "Neighbor with ToReceiveAll" ,
848
930
fromK8s : []v1beta1.FRRConfiguration {
0 commit comments