summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-12-08 09:11:35 +0100
committerChristian Breunig <christian@breunig.cc>2024-12-16 22:24:50 +0100
commit13baad691410009d1e5f7e6f6bf5afe72afd2f73 (patch)
tree90cdf1e9e95debfb0717122b23b8cfaaffa19487
parent3c79477adf3cd4f4efb302b58542ddd668b562ac (diff)
downloadvyos-1x-13baad691410009d1e5f7e6f6bf5afe72afd2f73.tar.gz
vyos-1x-13baad691410009d1e5f7e6f6bf5afe72afd2f73.zip
multicast: T6746: flatten CLI by merging "multicast route" to "mroute" CLI tagNode
This will save an entire level for the configuration and there is no need for a parent "multicast" node, as it will only have "route" as tagNode below. Move set protocols static multicast route <x.x.x.x/y> to: * set protocols static mroute <x.x.x.x/y>
-rw-r--r--data/templates/frr/staticd.frr.j28
-rw-r--r--interface-definitions/protocols_static.xml.in79
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_static.py4
-rw-r--r--src/tests/test_initial_setup.py4
4 files changed, 43 insertions, 52 deletions
diff --git a/data/templates/frr/staticd.frr.j2 b/data/templates/frr/staticd.frr.j2
index c662b7650..227807c62 100644
--- a/data/templates/frr/staticd.frr.j2
+++ b/data/templates/frr/staticd.frr.j2
@@ -128,15 +128,13 @@ exit-vrf
{% endif %}
!
{# Multicast route #}
-{% if multicast is vyos_defined %}
+{% if mroute is vyos_defined %}
{% set ip_prefix = 'ip m' %}
{# IPv4 multicast routing #}
-{% if multicast.route is vyos_defined %}
-{% for prefix, prefix_config in multicast.route.items() %}
+{% for prefix, prefix_config in mroute.items() %}
{{ static_routes(ip_prefix, prefix, prefix_config) }}
{# j2lint: disable=jinja-statements-delimeter #}
-{%- endfor %}
-{% endif %}
+{%- endfor %}
{% endif %}
!
{% if route_map is vyos_defined %}
diff --git a/interface-definitions/protocols_static.xml.in b/interface-definitions/protocols_static.xml.in
index 407e56553..d8e0ee56b 100644
--- a/interface-definitions/protocols_static.xml.in
+++ b/interface-definitions/protocols_static.xml.in
@@ -11,62 +11,55 @@
<priority>480</priority>
</properties>
<children>
- <node name="multicast">
+ <tagNode name="mroute">
<properties>
- <help>Multicast static route</help>
+ <help>Static IPv4 route for Multicast RIB</help>
+ <valueHelp>
+ <format>ipv4net</format>
+ <description>Network</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-prefix"/>
+ </constraint>
</properties>
<children>
- <tagNode name="route">
+ <tagNode name="next-hop">
+ <properties>
+ <help>Next-hop IPv4 router address</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>Next-hop router address</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-address"/>
+ </constraint>
+ </properties>
+ <children>
+ #include <include/generic-disable-node.xml.i>
+ #include <include/static/static-route-distance.xml.i>
+ </children>
+ </tagNode>
+ <tagNode name="interface">
<properties>
- <help>Configure static unicast route into MRIB for multicast RPF lookup</help>
+ <help>Next-hop IPv4 router interface</help>
+ <completionHelp>
+ <script>${vyos_completion_dir}/list_interfaces</script>
+ </completionHelp>
<valueHelp>
- <format>ipv4net</format>
- <description>Network</description>
+ <format>txt</format>
+ <description>Gateway interface name</description>
</valueHelp>
<constraint>
- <validator name="ip-prefix"/>
+ #include <include/constraint/interface-name.xml.i>
</constraint>
</properties>
<children>
- <tagNode name="next-hop">
- <properties>
- <help>Next-hop IPv4 router address</help>
- <valueHelp>
- <format>ipv4</format>
- <description>Next-hop router address</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-address"/>
- </constraint>
- </properties>
- <children>
- #include <include/generic-disable-node.xml.i>
- #include <include/static/static-route-distance.xml.i>
- </children>
- </tagNode>
- <tagNode name="interface">
- <properties>
- <help>Next-hop IPv4 router interface</help>
- <completionHelp>
- <script>${vyos_completion_dir}/list_interfaces</script>
- </completionHelp>
- <valueHelp>
- <format>txt</format>
- <description>Gateway interface name</description>
- </valueHelp>
- <constraint>
- #include <include/constraint/interface-name.xml.i>
- </constraint>
- </properties>
- <children>
- #include <include/generic-disable-node.xml.i>
- #include <include/static/static-route-distance.xml.i>
- </children>
- </tagNode>
+ #include <include/generic-disable-node.xml.i>
+ #include <include/static/static-route-distance.xml.i>
</children>
</tagNode>
</children>
- </node>
+ </tagNode>
#include <include/route-map.xml.i>
#include <include/static/static-route.xml.i>
#include <include/static/static-route6.xml.i>
diff --git a/smoketest/scripts/cli/test_protocols_static.py b/smoketest/scripts/cli/test_protocols_static.py
index 980bc6e7f..086235086 100755
--- a/smoketest/scripts/cli/test_protocols_static.py
+++ b/smoketest/scripts/cli/test_protocols_static.py
@@ -528,7 +528,7 @@ class TestProtocolsStatic(VyOSUnitTestSHIM.TestCase):
def test_04_static_multicast(self):
for route, route_config in multicast_routes.items():
if 'next_hop' in route_config:
- base = base_path + ['multicast', 'route', route]
+ base = base_path + ['mroute', route]
for next_hop, next_hop_config in route_config['next_hop'].items():
self.cli_set(base + ['next-hop', next_hop])
if 'distance' in next_hop_config:
@@ -537,7 +537,7 @@ class TestProtocolsStatic(VyOSUnitTestSHIM.TestCase):
self.cli_set(base + ['next-hop', next_hop, 'disable'])
if 'interface' in route_config:
- base = base_path + ['multicast', 'route', route]
+ base = base_path + ['mroute', route]
for next_hop, next_hop_config in route_config['interface'].items():
self.cli_set(base + ['interface', next_hop])
if 'distance' in next_hop_config:
diff --git a/src/tests/test_initial_setup.py b/src/tests/test_initial_setup.py
index 4cd5fb169..7737f9df5 100644
--- a/src/tests/test_initial_setup.py
+++ b/src/tests/test_initial_setup.py
@@ -92,8 +92,8 @@ class TestInitialSetup(TestCase):
vis.set_default_gateway(self.config, '192.0.2.1')
self.assertTrue(self.config.exists(['protocols', 'static', 'route', '0.0.0.0/0', 'next-hop', '192.0.2.1']))
- self.assertTrue(self.xml.is_tag(['protocols', 'static', 'multicast', 'route', '0.0.0.0/0', 'next-hop']))
- self.assertTrue(self.xml.is_tag(['protocols', 'static', 'multicast', 'route']))
+ self.assertTrue(self.xml.is_tag(['protocols', 'static', 'mroute', '0.0.0.0/0', 'next-hop']))
+ self.assertTrue(self.xml.is_tag(['protocols', 'static', 'mroute']))
if __name__ == "__main__":
unittest.main()