summaryrefslogtreecommitdiff
path: root/src/conf_mode/protocols_pim.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-11-13 12:54:25 +0100
committerChristian Breunig <christian@breunig.cc>2023-11-13 22:19:32 +0100
commitbc83fb097719f5c4c803808572f690fbc367b9e5 (patch)
treef77b6db0ac6b784f75c75d70dd68e50e1e968eb2 /src/conf_mode/protocols_pim.py
parent45ea9ed72ee11809f69619a40ae243df562de39f (diff)
downloadvyos-1x-bc83fb097719f5c4c803808572f690fbc367b9e5.tar.gz
vyos-1x-bc83fb097719f5c4c803808572f690fbc367b9e5.zip
igmp: T5736: migrate "protocols igmp" to "protocols pim"
IGMP and PIM are two different but related things. FRR has both combined in pimd. As we use get_config_dict() and FRR reload it is better to have both centrally stored under the same CLI node (as FRR does, too) to just "fire and forget" the commit to the daemon. "set protocols igmp interface eth1" -> "set protocols pim interface eth1 igmp"
Diffstat (limited to 'src/conf_mode/protocols_pim.py')
-rwxr-xr-xsrc/conf_mode/protocols_pim.py34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/conf_mode/protocols_pim.py b/src/conf_mode/protocols_pim.py
index 89db69b87..fbe95c404 100755
--- a/src/conf_mode/protocols_pim.py
+++ b/src/conf_mode/protocols_pim.py
@@ -93,22 +93,24 @@ def verify(pim):
if 'interface' not in pim:
raise ConfigError('PIM require defined interfaces!')
- if dict_search('rp.address', pim) == None:
- raise ConfigError('PIM rendezvous point needs to be defined!')
-
- # Check unique multicast groups
- unique = []
- for address, address_config in pim['rp']['address'].items():
- if 'group' not in address_config:
- raise ConfigError(f'PIM rendezvous point group should be defined for "{address}"!')
-
- # Check if it is a multicast group
- for gr_addr in address_config['group']:
- if not IPv4Network(gr_addr).is_multicast:
- raise ConfigError(f'PIM rendezvous point group "{gr_addr}" is not a multicast group!')
- if gr_addr in unique:
- raise ConfigError('PIM rendezvous point group must be unique!')
- unique.append(gr_addr)
+ if 'rp' in pim:
+ if 'address' not in pim['rp']:
+ raise ConfigError('PIM rendezvous point needs to be defined!')
+
+ # Check unique multicast groups
+ unique = []
+ pim_base_error = 'PIM rendezvous point group'
+ for address, address_config in pim['rp']['address'].items():
+ if 'group' not in address_config:
+ raise ConfigError(f'{pim_base_error} should be defined for "{address}"!')
+
+ # Check if it is a multicast group
+ for gr_addr in address_config['group']:
+ if not IPv4Network(gr_addr).is_multicast:
+ raise ConfigError(f'{pim_base_error} "{gr_addr}" is not a multicast group!')
+ if gr_addr in unique:
+ raise ConfigError(f'{pim_base_error} must be unique!')
+ unique.append(gr_addr)
def generate(pim):
if not pim or 'deleted' in pim: