From bc83fb097719f5c4c803808572f690fbc367b9e5 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Mon, 13 Nov 2023 12:54:25 +0100 Subject: 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" --- src/conf_mode/protocols_pim.py | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'src/conf_mode/protocols_pim.py') 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: -- cgit v1.2.3