From c5e2c25f8968c0f06a9e4e992decc46a4f690868 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Mon, 13 Nov 2023 09:14:38 +0100 Subject: pim: T5733: split out XML definitions to be re-used by pim6 --- interface-definitions/include/pim/bsm.xml.i | 14 ++++++++++++++ interface-definitions/include/pim/dr-priority.xml.i | 14 ++++++++++++++ interface-definitions/include/pim/hello.xml.i | 14 ++++++++++++++ .../include/pim/join-prune-interval.xml.i | 15 +++++++++++++++ interface-definitions/include/pim/keep-alive-timer.xml.i | 15 +++++++++++++++ interface-definitions/include/pim/packets.xml.i | 15 +++++++++++++++ interface-definitions/include/pim/passive.xml.i | 8 ++++++++ .../include/pim/register-suppress-time.xml.i | 14 ++++++++++++++ 8 files changed, 109 insertions(+) create mode 100644 interface-definitions/include/pim/bsm.xml.i create mode 100644 interface-definitions/include/pim/dr-priority.xml.i create mode 100644 interface-definitions/include/pim/hello.xml.i create mode 100644 interface-definitions/include/pim/join-prune-interval.xml.i create mode 100644 interface-definitions/include/pim/keep-alive-timer.xml.i create mode 100644 interface-definitions/include/pim/packets.xml.i create mode 100644 interface-definitions/include/pim/passive.xml.i create mode 100644 interface-definitions/include/pim/register-suppress-time.xml.i (limited to 'interface-definitions/include/pim') diff --git a/interface-definitions/include/pim/bsm.xml.i b/interface-definitions/include/pim/bsm.xml.i new file mode 100644 index 000000000..cc2cf14ca --- /dev/null +++ b/interface-definitions/include/pim/bsm.xml.i @@ -0,0 +1,14 @@ + + + + Do not process bootstrap messages + + + + + + Do not process unicast bootstrap messages + + + + diff --git a/interface-definitions/include/pim/dr-priority.xml.i b/interface-definitions/include/pim/dr-priority.xml.i new file mode 100644 index 000000000..bfda4e257 --- /dev/null +++ b/interface-definitions/include/pim/dr-priority.xml.i @@ -0,0 +1,14 @@ + + + + Designated Router Election Priority + + u32:1-4294967295 + Value of the new DR Priority + + + + + + + diff --git a/interface-definitions/include/pim/hello.xml.i b/interface-definitions/include/pim/hello.xml.i new file mode 100644 index 000000000..0c7601be7 --- /dev/null +++ b/interface-definitions/include/pim/hello.xml.i @@ -0,0 +1,14 @@ + + + + Hello Interval + + u32:1-180 + Hello Interval in seconds + + + + + + + diff --git a/interface-definitions/include/pim/join-prune-interval.xml.i b/interface-definitions/include/pim/join-prune-interval.xml.i new file mode 100644 index 000000000..f7519ad67 --- /dev/null +++ b/interface-definitions/include/pim/join-prune-interval.xml.i @@ -0,0 +1,15 @@ + + + + Join Prune Send Interval + + u32:1-65535 + Interval in seconds + + + + + + 60 + + diff --git a/interface-definitions/include/pim/keep-alive-timer.xml.i b/interface-definitions/include/pim/keep-alive-timer.xml.i new file mode 100644 index 000000000..9e71b7a14 --- /dev/null +++ b/interface-definitions/include/pim/keep-alive-timer.xml.i @@ -0,0 +1,15 @@ + + + + Keep alive Timer + + u32:1-65535 + Keep alive Timer in seconds + + + + + + 210 + + diff --git a/interface-definitions/include/pim/packets.xml.i b/interface-definitions/include/pim/packets.xml.i new file mode 100644 index 000000000..1dc00c971 --- /dev/null +++ b/interface-definitions/include/pim/packets.xml.i @@ -0,0 +1,15 @@ + + + + Packets to process at once + + u32:1-255 + Number of packets + + + + + + 3 + + diff --git a/interface-definitions/include/pim/passive.xml.i b/interface-definitions/include/pim/passive.xml.i new file mode 100644 index 000000000..e4e9ca0b1 --- /dev/null +++ b/interface-definitions/include/pim/passive.xml.i @@ -0,0 +1,8 @@ + + + + Disable sending and receiving PIM control packets on the interface + + + + diff --git a/interface-definitions/include/pim/register-suppress-time.xml.i b/interface-definitions/include/pim/register-suppress-time.xml.i new file mode 100644 index 000000000..80180e9b6 --- /dev/null +++ b/interface-definitions/include/pim/register-suppress-time.xml.i @@ -0,0 +1,14 @@ + + + + Register Suppress Timer + + u32:1-65535 + In seconds + + + + + + + -- cgit v1.2.3 From dd13213ae94f071bc30cc17f5fabef02fbf95939 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Mon, 13 Nov 2023 21:36:31 +0100 Subject: pim: T5733: fix CLI level of global PIM commands --- data/templates/frr/pimd.frr.j2 | 17 +++-- .../include/pim/keep-alive-timer.xml.i | 1 - .../include/policy/prefix-list.xml.i | 14 ++++ interface-definitions/protocols-pim.xml.in | 78 +++++++++------------- op-mode-definitions/show-ip-pim.xml.in | 2 +- smoketest/scripts/cli/test_protocols_pim.py | 54 ++++++++++++++- src/conf_mode/protocols_pim.py | 4 ++ 7 files changed, 110 insertions(+), 60 deletions(-) create mode 100644 interface-definitions/include/policy/prefix-list.xml.i (limited to 'interface-definitions/include/pim') diff --git a/data/templates/frr/pimd.frr.j2 b/data/templates/frr/pimd.frr.j2 index 97c5ff58b..b01fb5ec7 100644 --- a/data/templates/frr/pimd.frr.j2 +++ b/data/templates/frr/pimd.frr.j2 @@ -58,13 +58,13 @@ ip pim ecmp {{ 'rebalance' if ecmp.rebalance is vyos_defined }} ip pim join-prune-interval {{ join_prune_interval }} {% endif %} {% if keep_alive_timer is vyos_defined %} -ip pim rp keep-alive-timer {{ keep_alive_timer }} +ip pim keep-alive-timer {{ keep_alive_timer }} {% endif %} {% if packets is vyos_defined %} ip pim packets {{ packets }} {% endif %} -{% if register_accept_list is vyos_defined %} -ip pim register-accept-list {{ register_accept_list }} +{% if register_accept_list.prefix_list is vyos_defined %} +ip pim register-accept-list {{ register_accept_list.prefix_list }} {% endif %} {% if register_suppress_time is vyos_defined %} ip pim register-suppress-time {{ register_suppress_time }} @@ -76,14 +76,17 @@ ip pim rp {{ address }} {{ group }} {% endfor %} {% endfor %} {% endif %} -{% if send_v6_secondary is vyos_defined %} -ip pim send-v6-secondary +{% if rp.keep_alive_timer is vyos_defined %} +ip pim rp keep-alive-timer {{ rp.keep_alive_timer }} +{% endif %} +{% if no_v6_secondary is vyos_defined %} +no ip pim send-v6-secondary {% endif %} {% if spt_switchover.infinity_and_beyond is vyos_defined %} ip pim spt-switchover infinity-and-beyond {{ 'prefix-list ' ~ spt_switchover.infinity_and_beyond.prefix_list if spt_switchover.infinity_and_beyond.prefix_list is defined }} {% endif %} -{% if ssm is vyos_defined %} -ip pim ssm {{ ssm }} +{% if ssm.prefix_list is vyos_defined %} +ip pim ssm prefix-list {{ ssm.prefix_list }} {% endif %} ! {% if igmp.watermark_warning is vyos_defined %} diff --git a/interface-definitions/include/pim/keep-alive-timer.xml.i b/interface-definitions/include/pim/keep-alive-timer.xml.i index 9e71b7a14..0dd27d6e7 100644 --- a/interface-definitions/include/pim/keep-alive-timer.xml.i +++ b/interface-definitions/include/pim/keep-alive-timer.xml.i @@ -10,6 +10,5 @@ - 210 diff --git a/interface-definitions/include/policy/prefix-list.xml.i b/interface-definitions/include/policy/prefix-list.xml.i new file mode 100644 index 000000000..5d7980ee2 --- /dev/null +++ b/interface-definitions/include/policy/prefix-list.xml.i @@ -0,0 +1,14 @@ + + + + Prefix-list to use + + txt + Prefix-list to apply (IPv4) + + + policy prefix-list + + + + diff --git a/interface-definitions/protocols-pim.xml.in b/interface-definitions/protocols-pim.xml.in index c1fa1b489..bbdb00cae 100644 --- a/interface-definitions/protocols-pim.xml.in +++ b/interface-definitions/protocols-pim.xml.in @@ -130,18 +130,14 @@ #include #include #include - + Only accept registers from a specific source prefix list - - txt - Prefix-list to apply - - - policy prefix-list - - + + #include + + Rendezvous Point @@ -174,50 +170,36 @@ - - - Send v6 secondary addresses - - - - + #include + + + + + Disable IPv6 secondary address in hello packets + + + + + + Send v6 secondary addresses + + + - Send v6 secondary addresses + Never switch to SPT Tree - - - Never switch to SPT Tree - - - - - Prefix-List to control which groups to switch - - txt - Prefix-list to apply - - - policy prefix-list - - - - - + #include - - - Source-Specific Multicast - - policy prefix-list - - - txt - Prefix-list to apply - - - + + + + + Source-Specific Multicast + + + #include diff --git a/op-mode-definitions/show-ip-pim.xml.in b/op-mode-definitions/show-ip-pim.xml.in index 3e0bff064..9deba1f07 100644 --- a/op-mode-definitions/show-ip-pim.xml.in +++ b/op-mode-definitions/show-ip-pim.xml.in @@ -63,7 +63,7 @@ ${vyos_op_scripts_dir}/vtysh_wrapper.sh $@ - + PIM interfaces information diff --git a/smoketest/scripts/cli/test_protocols_pim.py b/smoketest/scripts/cli/test_protocols_pim.py index ef134b195..ccfced138 100755 --- a/smoketest/scripts/cli/test_protocols_pim.py +++ b/smoketest/scripts/cli/test_protocols_pim.py @@ -73,7 +73,55 @@ class TestProtocolsPIM(VyOSUnitTestSHIM.TestCase): self.cli_commit() - def test_02_pim_igmp_proxy(self): + def test_02_pim_advanced(self): + rp = '127.0.0.2' + group = '224.0.0.0/4' + join_prune_interval = '123' + rp_keep_alive_timer = '190' + keep_alive_timer = '180' + packets = '10' + prefix_list = 'pim-test' + register_suppress_time = '300' + + self.cli_set(base_path + ['rp', 'address', rp, 'group', group]) + self.cli_set(base_path + ['rp', 'keep-alive-timer', rp_keep_alive_timer]) + + self.cli_set(base_path + ['ecmp', 'rebalance']) + self.cli_set(base_path + ['join-prune-interval', join_prune_interval]) + self.cli_set(base_path + ['keep-alive-timer', keep_alive_timer]) + self.cli_set(base_path + ['packets', packets]) + self.cli_set(base_path + ['register-accept-list', 'prefix-list', prefix_list]) + self.cli_set(base_path + ['register-suppress-time', register_suppress_time]) + self.cli_set(base_path + ['no-v6-secondary']) + self.cli_set(base_path + ['spt-switchover', 'infinity-and-beyond', 'prefix-list', prefix_list]) + self.cli_set(base_path + ['ssm', 'prefix-list', prefix_list]) + + # check validate() - PIM require defined interfaces! + with self.assertRaises(ConfigSessionError): + self.cli_commit() + + interfaces = Section.interfaces('ethernet') + for interface in interfaces: + self.cli_set(base_path + ['interface', interface]) + + # commit changes + self.cli_commit() + + # Verify FRR pimd configuration + frrconfig = self.getFRRconfig(daemon=PROCESS_NAME) + self.assertIn(f'ip pim rp {rp} {group}', frrconfig) + self.assertIn(f'ip pim rp keep-alive-timer {rp_keep_alive_timer}', frrconfig) + self.assertIn(f'ip pim ecmp rebalance', frrconfig) + self.assertIn(f'ip pim join-prune-interval {join_prune_interval}', frrconfig) + self.assertIn(f'ip pim keep-alive-timer {keep_alive_timer}', frrconfig) + self.assertIn(f'ip pim packets {packets}', frrconfig) + self.assertIn(f'ip pim register-accept-list {prefix_list}', frrconfig) + self.assertIn(f'ip pim register-suppress-time {register_suppress_time}', frrconfig) + self.assertIn(f'no ip pim send-v6-secondary', frrconfig) + self.assertIn(f'ip pim spt-switchover infinity-and-beyond prefix-list {prefix_list}', frrconfig) + self.assertIn(f'ip pim ssm prefix-list {prefix_list}', frrconfig) + + def test_03_pim_igmp_proxy(self): igmp_proxy = ['protocols', 'igmp-proxy'] rp = '127.0.0.1' group = '224.0.0.0/4' @@ -95,7 +143,7 @@ class TestProtocolsPIM(VyOSUnitTestSHIM.TestCase): # commit changes self.cli_commit() - def test_03_igmp(self): + def test_04_igmp(self): watermark_warning = '2000' query_interval = '1000' query_max_response_time = '200' @@ -141,4 +189,4 @@ class TestProtocolsPIM(VyOSUnitTestSHIM.TestCase): self.assertIn(f' ip igmp join {join}', frrconfig) if __name__ == '__main__': - unittest.main(verbosity=2, failfast=True) + unittest.main(verbosity=2) diff --git a/src/conf_mode/protocols_pim.py b/src/conf_mode/protocols_pim.py index fbe95c404..5e6225f6f 100755 --- a/src/conf_mode/protocols_pim.py +++ b/src/conf_mode/protocols_pim.py @@ -25,6 +25,7 @@ from vyos.config import config_dict_merge from vyos.configdict import dict_merge from vyos.configdict import node_changed from vyos.utils.dict import dict_search +from vyos.configverify import verify_interface_exists from vyos.utils.process import process_named_running from vyos.utils.process import call from vyos.template import render_to_string @@ -93,6 +94,9 @@ def verify(pim): if 'interface' not in pim: raise ConfigError('PIM require defined interfaces!') + for interface in pim['interface']: + verify_interface_exists(interface) + if 'rp' in pim: if 'address' not in pim['rp']: raise ConfigError('PIM rendezvous point needs to be defined!') -- cgit v1.2.3 From 64b4cfc71d402222fd6b034336b3588b5986ba24 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Wed, 15 Nov 2023 18:20:39 +0100 Subject: pim: T5733: incorporate feedback from peer review --- interface-definitions/include/pim/dr-priority.xml.i | 4 ++-- interface-definitions/include/pim/join-prune-interval.xml.i | 2 +- interface-definitions/include/pim/register-suppress-time.xml.i | 4 ++-- interface-definitions/protocols-pim.xml.in | 2 +- src/conf_mode/protocols_pim.py | 2 -- 5 files changed, 6 insertions(+), 8 deletions(-) (limited to 'interface-definitions/include/pim') diff --git a/interface-definitions/include/pim/dr-priority.xml.i b/interface-definitions/include/pim/dr-priority.xml.i index bfda4e257..e4b3067c2 100644 --- a/interface-definitions/include/pim/dr-priority.xml.i +++ b/interface-definitions/include/pim/dr-priority.xml.i @@ -1,10 +1,10 @@ - Designated Router Election Priority + Designated router election priority u32:1-4294967295 - Value of the new DR Priority + DR Priority diff --git a/interface-definitions/include/pim/join-prune-interval.xml.i b/interface-definitions/include/pim/join-prune-interval.xml.i index f7519ad67..882787d3f 100644 --- a/interface-definitions/include/pim/join-prune-interval.xml.i +++ b/interface-definitions/include/pim/join-prune-interval.xml.i @@ -1,7 +1,7 @@ - Join Prune Send Interval + Join prune send interval u32:1-65535 Interval in seconds diff --git a/interface-definitions/include/pim/register-suppress-time.xml.i b/interface-definitions/include/pim/register-suppress-time.xml.i index 80180e9b6..919945b52 100644 --- a/interface-definitions/include/pim/register-suppress-time.xml.i +++ b/interface-definitions/include/pim/register-suppress-time.xml.i @@ -1,10 +1,10 @@ - Register Suppress Timer + Register suppress timer u32:1-65535 - In seconds + Timer in seconds diff --git a/interface-definitions/protocols-pim.xml.in b/interface-definitions/protocols-pim.xml.in index 39188398b..4a20c0d9b 100644 --- a/interface-definitions/protocols-pim.xml.in +++ b/interface-definitions/protocols-pim.xml.in @@ -182,7 +182,7 @@ - Send v6 secondary addresses + Shortest-path tree (SPT) switchover diff --git a/src/conf_mode/protocols_pim.py b/src/conf_mode/protocols_pim.py index 5e6225f6f..09c3be8df 100755 --- a/src/conf_mode/protocols_pim.py +++ b/src/conf_mode/protocols_pim.py @@ -22,9 +22,7 @@ from sys import exit from vyos.config import Config from vyos.config import config_dict_merge -from vyos.configdict import dict_merge from vyos.configdict import node_changed -from vyos.utils.dict import dict_search from vyos.configverify import verify_interface_exists from vyos.utils.process import process_named_running from vyos.utils.process import call -- cgit v1.2.3