From 45ccd394911f8a291baa0039451305b2bbb58201 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 15 May 2024 09:45:09 +0300 Subject: [PATCH] Test if the peer-group inheritance works for neighbors Signed-off-by: Donatas Abraitis --- docs/sources/configuration.md | 7 ++++++- pkg/config/oc/bgp_configs_test.go | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/sources/configuration.md b/docs/sources/configuration.md index ddeac6e3d..3c1d966c1 100644 --- a/docs/sources/configuration.md +++ b/docs/sources/configuration.md @@ -172,11 +172,16 @@ # enabled = true # ttl-min = 255 # 255 means directly connected +[[neighbors]] + [neighbors.config] + peer-group = "my-peer-group" + neighbor-address = "127.0.0.2" + [[peer-groups]] [peer-groups.config] peer-group-name = "my-peer-group" peer-as = 65000 - #send-software-version = true + send-software-version = true [[peer-groups.afi-safis]] [peer-groups.afi-safis.config] afi-safi-name = "ipv4-unicast" diff --git a/pkg/config/oc/bgp_configs_test.go b/pkg/config/oc/bgp_configs_test.go index ed676c469..adda5e18d 100644 --- a/pkg/config/oc/bgp_configs_test.go +++ b/pkg/config/oc/bgp_configs_test.go @@ -110,4 +110,22 @@ func TestConfigExample(t *testing.T) { assert.NoError(v.ReadInConfig()) assert.NoError(v.UnmarshalExact(c)) assert.NoError(setDefaultConfigValuesWithViper(v, c)) + + // Test if we can set the parameters for a peer-group + for _, peerGroup := range c.PeerGroups { + if peerGroup.Config.PeerGroupName != "my-peer-group" { + continue + } + + assert.True(peerGroup.Config.SendSoftwareVersion) + } + + // Test if the peer-group inheritance works for neighbors + for _, neighbor := range c.Neighbors { + if neighbor.Config.PeerGroup != "my-peer-group" { + continue + } + + assert.True(neighbor.Config.SendSoftwareVersion) + } }