From ef2242e8e5c278c201ad825f4037668c86934443 Mon Sep 17 00:00:00 2001
From: Christian Poessinger <christian@poessinger.com>
Date: Mon, 6 Dec 2021 19:59:33 +0100
Subject: bfd: T4054: bugfix missing profile assignment to peer

---
 src/conf_mode/protocols_bfd.py | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'src')

diff --git a/src/conf_mode/protocols_bfd.py b/src/conf_mode/protocols_bfd.py
index 6981d0db1..caef61b3f 100755
--- a/src/conf_mode/protocols_bfd.py
+++ b/src/conf_mode/protocols_bfd.py
@@ -84,6 +84,11 @@ def verify(bfd):
                 if 'source' in peer_config and 'interface' in peer_config['source']:
                     raise ConfigError('Multihop and source interface cannot be used together')
 
+            if 'profile' in peer_config:
+                profile_name = peer_config['profile']
+                if 'profile' not in bfd or profile_name not in bfd['profile']:
+                    raise ConfigError(f'BFD profile "{profile_name}" does not exist!')
+
             if 'vrf' in peer_config:
                 verify_vrf(peer_config)
 
-- 
cgit v1.2.3