summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/templates/frr/ripd.frr.j26
-rw-r--r--interface-definitions/include/rip/access-list.xml.i (renamed from interface-definitions/include/rip/rip-access-list.xml.i)2
-rw-r--r--interface-definitions/include/rip/access-list6.xml.i (renamed from interface-definitions/include/rip/rip-access-list6.xml.i)2
-rw-r--r--interface-definitions/include/rip/default-information.xml.i (renamed from interface-definitions/include/rip/rip-default-information.xml.i)2
-rw-r--r--interface-definitions/include/rip/default-metric.xml.i (renamed from interface-definitions/include/rip/rip-default-metric.xml.i)2
-rw-r--r--interface-definitions/include/rip/interface.xml.i (renamed from interface-definitions/include/rip/rip-interface.xml.i)2
-rw-r--r--interface-definitions/include/rip/prefix-list.xml.i (renamed from interface-definitions/include/rip/rip-prefix-list.xml.i)2
-rw-r--r--interface-definitions/include/rip/prefix-list6.xml.i (renamed from interface-definitions/include/rip/rip-prefix-list6.xml.i)2
-rw-r--r--interface-definitions/include/rip/redistribute.xml.i (renamed from interface-definitions/include/rip/rip-redistribute.xml.i)2
-rw-r--r--interface-definitions/include/rip/timers.xml.i (renamed from interface-definitions/include/rip/rip-timers.xml.i)2
-rw-r--r--interface-definitions/include/rip/version.xml.i19
-rw-r--r--interface-definitions/protocols-rip.xml.in62
-rw-r--r--interface-definitions/protocols-ripng.xml.in26
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_rip.py9
-rwxr-xr-xsrc/conf_mode/protocols_rip.py17
15 files changed, 103 insertions, 54 deletions
diff --git a/data/templates/frr/ripd.frr.j2 b/data/templates/frr/ripd.frr.j2
index e884ed85f..e9e484cc2 100644
--- a/data/templates/frr/ripd.frr.j2
+++ b/data/templates/frr/ripd.frr.j2
@@ -32,6 +32,12 @@ interface {{ iface }}
{% if iface_config.split_horizon.poison_reverse is vyos_defined %}
ip rip split-horizon poisoned-reverse
{% endif %}
+{% if iface_config.receive.version is vyos_defined %}
+ ip rip receive version {{ iface_config.receive.version }}
+{% endif %}
+{% if iface_config.send.version is vyos_defined %}
+ ip rip send version {{ iface_config.send.version }}
+{% endif %}
exit
!
{% endfor %}
diff --git a/interface-definitions/include/rip/rip-access-list.xml.i b/interface-definitions/include/rip/access-list.xml.i
index 00ee9b736..8799aa9c3 100644
--- a/interface-definitions/include/rip/rip-access-list.xml.i
+++ b/interface-definitions/include/rip/access-list.xml.i
@@ -1,4 +1,4 @@
-<!-- include start from rip/rip-access-list.xml.i -->
+<!-- include start from rip/access-list.xml.i -->
<node name="access-list">
<properties>
<help>Access-list</help>
diff --git a/interface-definitions/include/rip/rip-access-list6.xml.i b/interface-definitions/include/rip/access-list6.xml.i
index 9e4298bc0..732135253 100644
--- a/interface-definitions/include/rip/rip-access-list6.xml.i
+++ b/interface-definitions/include/rip/access-list6.xml.i
@@ -1,4 +1,4 @@
-<!-- include start from rip/rip-access-list.xml.i -->
+<!-- include start from rip/access-list.xml.i -->
<node name="access-list">
<properties>
<help>Access-list</help>
diff --git a/interface-definitions/include/rip/rip-default-information.xml.i b/interface-definitions/include/rip/default-information.xml.i
index 28c540c26..957fb3a8d 100644
--- a/interface-definitions/include/rip/rip-default-information.xml.i
+++ b/interface-definitions/include/rip/default-information.xml.i
@@ -1,4 +1,4 @@
-<!-- include start from rip/rip-default-information.xml.i -->
+<!-- include start from rip/default-information.xml.i -->
<node name="default-information">
<properties>
<help>Control distribution of default route</help>
diff --git a/interface-definitions/include/rip/rip-default-metric.xml.i b/interface-definitions/include/rip/default-metric.xml.i
index 297af5af8..c0f1f9b61 100644
--- a/interface-definitions/include/rip/rip-default-metric.xml.i
+++ b/interface-definitions/include/rip/default-metric.xml.i
@@ -1,4 +1,4 @@
-<!-- include start from rip/rip-default-metric.xml.i -->
+<!-- include start from rip/default-metric.xml.i -->
<leafNode name="default-metric">
<properties>
<help>Metric of redistributed routes</help>
diff --git a/interface-definitions/include/rip/rip-interface.xml.i b/interface-definitions/include/rip/interface.xml.i
index dd3bddd4f..baeceac1c 100644
--- a/interface-definitions/include/rip/rip-interface.xml.i
+++ b/interface-definitions/include/rip/interface.xml.i
@@ -1,4 +1,4 @@
-<!-- include start from rip/rip-interface.xml.i -->
+<!-- include start from rip/interface.xml.i -->
<tagNode name="interface">
<properties>
<help>Interface name</help>
diff --git a/interface-definitions/include/rip/rip-prefix-list.xml.i b/interface-definitions/include/rip/prefix-list.xml.i
index 2569a2a09..8e806aa35 100644
--- a/interface-definitions/include/rip/rip-prefix-list.xml.i
+++ b/interface-definitions/include/rip/prefix-list.xml.i
@@ -1,4 +1,4 @@
-<!-- include start from rip/rip-prefix-list.xml.i -->
+<!-- include start from rip/prefix-list.xml.i -->
<node name="prefix-list">
<properties>
<help>Prefix-list</help>
diff --git a/interface-definitions/include/rip/rip-prefix-list6.xml.i b/interface-definitions/include/rip/prefix-list6.xml.i
index fcf1499e0..84b6846fe 100644
--- a/interface-definitions/include/rip/rip-prefix-list6.xml.i
+++ b/interface-definitions/include/rip/prefix-list6.xml.i
@@ -1,4 +1,4 @@
-<!-- include start from rip/rip-prefix-list.xml.i -->
+<!-- include start from rip/prefix-list.xml.i -->
<node name="prefix-list">
<properties>
<help>Prefix-list</help>
diff --git a/interface-definitions/include/rip/rip-redistribute.xml.i b/interface-definitions/include/rip/redistribute.xml.i
index d7a79b007..34154a526 100644
--- a/interface-definitions/include/rip/rip-redistribute.xml.i
+++ b/interface-definitions/include/rip/redistribute.xml.i
@@ -1,4 +1,4 @@
-<!-- include start from rip/rip-redistribute.xml.i -->
+<!-- include start from rip/redistribute.xml.i -->
<leafNode name="metric">
<properties>
<help>Metric for redistributed routes</help>
diff --git a/interface-definitions/include/rip/rip-timers.xml.i b/interface-definitions/include/rip/timers.xml.i
index 129d9ed23..771a6700e 100644
--- a/interface-definitions/include/rip/rip-timers.xml.i
+++ b/interface-definitions/include/rip/timers.xml.i
@@ -1,4 +1,4 @@
-<!-- include start from rip/rip-timers.xml.i -->
+<!-- include start from rip/timers.xml.i -->
<node name="timers">
<properties>
<help>RIPng timer values</help>
diff --git a/interface-definitions/include/rip/version.xml.i b/interface-definitions/include/rip/version.xml.i
new file mode 100644
index 000000000..f7d3eab0d
--- /dev/null
+++ b/interface-definitions/include/rip/version.xml.i
@@ -0,0 +1,19 @@
+<!-- include start from rip/version.xml.i -->
+<leafNode name="version">
+ <properties>
+ <help>RIP protocol version</help>
+ <valueHelp>
+ <format>1</format>
+ <description>RIPv1</description>
+ </valueHelp>
+ <valueHelp>
+ <format>2</format>
+ <description>RIPv2</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-2"/>
+ </constraint>
+ </properties>
+ <defaultValue>2</defaultValue>
+</leafNode>
+<!-- include end -->
diff --git a/interface-definitions/protocols-rip.xml.in b/interface-definitions/protocols-rip.xml.in
index ed2153ff2..2195b0316 100644
--- a/interface-definitions/protocols-rip.xml.in
+++ b/interface-definitions/protocols-rip.xml.in
@@ -20,14 +20,14 @@
</constraint>
</properties>
</leafNode>
- #include <include/rip/rip-default-information.xml.i>
- #include <include/rip/rip-default-metric.xml.i>
+ #include <include/rip/default-information.xml.i>
+ #include <include/rip/default-metric.xml.i>
<node name="distribute-list">
<properties>
<help>Filter networks in routing updates</help>
</properties>
<children>
- #include <include/rip/rip-access-list.xml.i>
+ #include <include/rip/access-list.xml.i>
<tagNode name="interface">
<properties>
<help>Apply filtering to an interface</help>
@@ -43,14 +43,14 @@
</constraint>
</properties>
<children>
- #include <include/rip/rip-access-list.xml.i>
- #include <include/rip/rip-prefix-list.xml.i>
+ #include <include/rip/access-list.xml.i>
+ #include <include/rip/prefix-list.xml.i>
</children>
</tagNode>
- #include <include/rip/rip-prefix-list.xml.i>
+ #include <include/rip/prefix-list.xml.i>
</children>
</node>
- #include <include/rip/rip-interface.xml.i>
+ #include <include/rip/interface.xml.i>
<tagNode name="interface">
<children>
<node name="authentication">
@@ -98,6 +98,22 @@
<constraintErrorMessage>Password must be 16 characters or less</constraintErrorMessage>
</properties>
</leafNode>
+ </children>
+ </node>
+ <node name="receive">
+ <properties>
+ <help>Advertisement reception</help>
+ </properties>
+ <children>
+ #include <include/rip/version.xml.i>
+ </children>
+ </node>
+ <node name="send">
+ <properties>
+ <help>Advertisement transmission</help>
+ </properties>
+ <children>
+ #include <include/rip/version.xml.i>
</children>
</node>
</children>
@@ -166,7 +182,7 @@
<help>Redistribute BGP routes</help>
</properties>
<children>
- #include <include/rip/rip-redistribute.xml.i>
+ #include <include/rip/redistribute.xml.i>
</children>
</node>
<node name="connected">
@@ -174,7 +190,7 @@
<help>Redistribute connected routes</help>
</properties>
<children>
- #include <include/rip/rip-redistribute.xml.i>
+ #include <include/rip/redistribute.xml.i>
</children>
</node>
<node name="isis">
@@ -182,7 +198,7 @@
<help>Redistribute IS-IS routes</help>
</properties>
<children>
- #include <include/rip/rip-redistribute.xml.i>
+ #include <include/rip/redistribute.xml.i>
</children>
</node>
<node name="kernel">
@@ -190,7 +206,7 @@
<help>Redistribute kernel routes</help>
</properties>
<children>
- #include <include/rip/rip-redistribute.xml.i>
+ #include <include/rip/redistribute.xml.i>
</children>
</node>
<node name="ospf">
@@ -198,7 +214,7 @@
<help>Redistribute OSPF routes</help>
</properties>
<children>
- #include <include/rip/rip-redistribute.xml.i>
+ #include <include/rip/redistribute.xml.i>
</children>
</node>
<node name="static">
@@ -206,7 +222,7 @@
<help>Redistribute static routes</help>
</properties>
<children>
- #include <include/rip/rip-redistribute.xml.i>
+ #include <include/rip/redistribute.xml.i>
</children>
</node>
</children>
@@ -224,25 +240,9 @@
<multi/>
</properties>
</leafNode>
- #include <include/rip/rip-timers.xml.i>
+ #include <include/rip/timers.xml.i>
#include <include/route-map.xml.i>
- <leafNode name="version">
- <properties>
- <help>RIP protocol version</help>
- <valueHelp>
- <format>u32:1</format>
- <description>RIPv1</description>
- </valueHelp>
- <valueHelp>
- <format>u32:2</format>
- <description>RIPv2</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-2"/>
- </constraint>
- </properties>
- <defaultValue>2</defaultValue>
- </leafNode>
+ #include <include/rip/version.xml.i>
</children>
</node>
</children>
diff --git a/interface-definitions/protocols-ripng.xml.in b/interface-definitions/protocols-ripng.xml.in
index fe7411e65..d7e4b2514 100644
--- a/interface-definitions/protocols-ripng.xml.in
+++ b/interface-definitions/protocols-ripng.xml.in
@@ -21,14 +21,14 @@
<multi/>
</properties>
</leafNode>
- #include <include/rip/rip-default-information.xml.i>
- #include <include/rip/rip-default-metric.xml.i>
+ #include <include/rip/default-information.xml.i>
+ #include <include/rip/default-metric.xml.i>
<node name="distribute-list">
<properties>
<help>Filter networks in routing updates</help>
</properties>
<children>
- #include <include/rip/rip-access-list6.xml.i>
+ #include <include/rip/access-list6.xml.i>
<tagNode name="interface">
<properties>
<help>Apply filtering to an interface</help>
@@ -44,14 +44,14 @@
</constraint>
</properties>
<children>
- #include <include/rip/rip-access-list6.xml.i>
- #include <include/rip/rip-prefix-list6.xml.i>
+ #include <include/rip/access-list6.xml.i>
+ #include <include/rip/prefix-list6.xml.i>
</children>
</tagNode>
- #include <include/rip/rip-prefix-list6.xml.i>
+ #include <include/rip/prefix-list6.xml.i>
</children>
</node>
- #include <include/rip/rip-interface.xml.i>
+ #include <include/rip/interface.xml.i>
<leafNode name="network">
<properties>
<help>RIPng network</help>
@@ -88,7 +88,7 @@
<help>Redistribute BGP routes</help>
</properties>
<children>
- #include <include/rip/rip-redistribute.xml.i>
+ #include <include/rip/redistribute.xml.i>
</children>
</node>
<node name="connected">
@@ -96,7 +96,7 @@
<help>Redistribute connected routes</help>
</properties>
<children>
- #include <include/rip/rip-redistribute.xml.i>
+ #include <include/rip/redistribute.xml.i>
</children>
</node>
<node name="kernel">
@@ -104,7 +104,7 @@
<help>Redistribute kernel routes</help>
</properties>
<children>
- #include <include/rip/rip-redistribute.xml.i>
+ #include <include/rip/redistribute.xml.i>
</children>
</node>
<node name="ospfv3">
@@ -112,7 +112,7 @@
<help>Redistribute OSPFv3 routes</help>
</properties>
<children>
- #include <include/rip/rip-redistribute.xml.i>
+ #include <include/rip/redistribute.xml.i>
</children>
</node>
<node name="static">
@@ -120,7 +120,7 @@
<help>Redistribute static routes</help>
</properties>
<children>
- #include <include/rip/rip-redistribute.xml.i>
+ #include <include/rip/redistribute.xml.i>
</children>
</node>
</children>
@@ -139,7 +139,7 @@
</properties>
</leafNode>
#include <include/route-map.xml.i>
- #include <include/rip/rip-timers.xml.i>
+ #include <include/rip/timers.xml.i>
</children>
</node>
</children>
diff --git a/smoketest/scripts/cli/test_protocols_rip.py b/smoketest/scripts/cli/test_protocols_rip.py
index ee882943b..8c100d537 100755
--- a/smoketest/scripts/cli/test_protocols_rip.py
+++ b/smoketest/scripts/cli/test_protocols_rip.py
@@ -160,8 +160,12 @@ class TestProtocolsRIP(VyOSUnitTestSHIM.TestCase):
def test_rip_03_version(self):
version = '1'
+ interface = 'eth0'
self.cli_set(base_path + ['version', version])
+ self.cli_set(base_path + ['interface', interface, 'send', 'version', version])
+ self.cli_set(base_path + ['interface', interface, 'receive', 'version', version])
+
# commit changes
self.cli_commit()
@@ -169,5 +173,10 @@ class TestProtocolsRIP(VyOSUnitTestSHIM.TestCase):
frrconfig = self.getFRRconfig('router rip')
self.assertIn(f'version {version}', frrconfig)
+ frrconfig = self.getFRRconfig(f'interface {interface}')
+ self.assertIn(f' ip rip receive version {version}', frrconfig)
+ self.assertIn(f' ip rip send version {version}', frrconfig)
+
+
if __name__ == '__main__':
unittest.main(verbosity=2)
diff --git a/src/conf_mode/protocols_rip.py b/src/conf_mode/protocols_rip.py
index a76c1ce76..e29b23765 100755
--- a/src/conf_mode/protocols_rip.py
+++ b/src/conf_mode/protocols_rip.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2021 VyOS maintainers and contributors
+# Copyright (C) 2021-2022 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -56,9 +56,24 @@ def get_config(config=None):
# We have gathered the dict representation of the CLI, but there are default
# options which we need to update into the dictionary retrived.
default_values = defaults(base)
+
+ # T2665: we can not blend in default values of tagNodes - delete and add
+ # individual values later on ...
+ if 'interface' in default_values:
+ del default_values['interface']
# merge in remaining default values
rip = dict_merge(default_values, rip)
+ # T2665: add individual per interface defaults
+
+ # T2665: blend in per interface defaults
+ if 'interface' in rip:
+ default_values = defaults(base + ['interface'])
+ for interface in rip['interface']:
+ # merge in default values
+ rip['interface'][interface] = dict_merge(default_values,
+ rip['interface'][interface])
+
# We also need some additional information from the config, prefix-lists
# and route-maps for instance. They will be used in verify().
#