@@ -263,5 +263,70 @@ var _ = ginkgo.Describe("Session", func() {
263
263
ginkgo .Entry ("IPV4" , ipfamily .IPv4 ),
264
264
ginkgo .Entry ("IPV6" , ipfamily .IPv6 ),
265
265
)
266
+
267
+ ginkgo .DescribeTable ("Establishes sessions with dynamicASN" , func (family ipfamily.Family ) {
268
+ frrs := config .ContainersForVRF (infra .FRRContainers , "" )
269
+ neighbors := []frrk8sv1beta1.Neighbor {}
270
+
271
+ for _ , f := range frrs {
272
+ addresses := f .AddressesForFamily (family )
273
+ ebgpMultihop := false
274
+ if f .NeighborConfig .MultiHop && f .NeighborConfig .ASN != f .RouterConfig .ASN {
275
+ ebgpMultihop = true
276
+ }
277
+
278
+ dynamicASN := frrk8sv1beta1 .InternalASNMode
279
+ if f .RouterConfig .ASN != infra .FRRK8sASN {
280
+ dynamicASN = frrk8sv1beta1 .ExternalASNMode
281
+ }
282
+
283
+ for _ , address := range addresses {
284
+ neighbors = append (neighbors , frrk8sv1beta1.Neighbor {
285
+ DynamicASN : dynamicASN ,
286
+ Address : address ,
287
+ Password : f .RouterConfig .Password ,
288
+ Port : & f .RouterConfig .BGPPort ,
289
+ EBGPMultiHop : ebgpMultihop ,
290
+ })
291
+ }
292
+ }
293
+
294
+ config := frrk8sv1beta1.FRRConfiguration {
295
+ ObjectMeta : metav1.ObjectMeta {
296
+ Name : "test" ,
297
+ Namespace : k8s .FRRK8sNamespace ,
298
+ },
299
+ Spec : frrk8sv1beta1.FRRConfigurationSpec {
300
+ BGP : frrk8sv1beta1.BGPConfig {
301
+ Routers : []frrk8sv1beta1.Router {
302
+ {
303
+ ASN : infra .FRRK8sASN ,
304
+ VRF : "" ,
305
+ Neighbors : neighbors ,
306
+ },
307
+ },
308
+ },
309
+ },
310
+ }
311
+
312
+ ginkgo .By ("pairing with nodes" )
313
+ for _ , c := range frrs {
314
+ err := frrcontainer .PairWithNodes (cs , c , family )
315
+ Expect (err ).NotTo (HaveOccurred ())
316
+ }
317
+
318
+ err := updater .Update ([]corev1.Secret {}, config )
319
+ Expect (err ).NotTo (HaveOccurred ())
320
+
321
+ nodes , err := k8s .Nodes (cs )
322
+ Expect (err ).NotTo (HaveOccurred ())
323
+
324
+ for _ , c := range frrs {
325
+ ValidateFRRPeeredWithNodes (nodes , c , family )
326
+ }
327
+ },
328
+ ginkgo .Entry ("IPV4" , ipfamily .IPv4 ),
329
+ ginkgo .Entry ("IPV6" , ipfamily .IPv6 ),
330
+ )
266
331
})
267
332
})
0 commit comments