summaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/config/util_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/pkg/config/util_test.go')
-rw-r--r--internal/pkg/config/util_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/internal/pkg/config/util_test.go b/internal/pkg/config/util_test.go
index a34b02f4..62fe1c1c 100644
--- a/internal/pkg/config/util_test.go
+++ b/internal/pkg/config/util_test.go
@@ -30,3 +30,29 @@ func TestDetectConfigFileType(t *testing.T) {
assert.Equal("yaml", detectConfigFileType("bgpd.yml", "xxx"))
assert.Equal("json", detectConfigFileType("bgpd.json", "xxx"))
}
+
+func TestIsAfiSafiChanged(t *testing.T) {
+ v4 := AfiSafi{
+ Config: AfiSafiConfig{
+ AfiSafiName: AFI_SAFI_TYPE_IPV4_UNICAST,
+ },
+ }
+ v6 := AfiSafi{
+ Config: AfiSafiConfig{
+ AfiSafiName: AFI_SAFI_TYPE_IPV6_UNICAST,
+ },
+ }
+ old := []AfiSafi{v4}
+ new := []AfiSafi{v4}
+ assert.False(t, isAfiSafiChanged(old, new))
+
+ new = append(new, v6)
+ assert.True(t, isAfiSafiChanged(old, new))
+
+ new = []AfiSafi{v6}
+ assert.True(t, isAfiSafiChanged(old, new))
+ v4ap := v4
+ v4ap.AddPaths.Config.Receive = true
+ new = []AfiSafi{v4ap}
+ assert.True(t, isAfiSafiChanged(old, new))
+}