Skip to content

Commit

Permalink
T7118: Added the ability to redistribute NHRP routes to other protocols
Browse files Browse the repository at this point in the history
Added the ability to redistribute NHRP routes to:
OSPF
BGP
Babel
RIP
IS-IS
  • Loading branch information
aapostoliuk committed Feb 26, 2025
1 parent 4ce3b92 commit 46caac5
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 9 deletions.
6 changes: 6 additions & 0 deletions interface-definitions/include/babel/redistribute-common.xml.i
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
<valueless/>
</properties>
</leafNode>
<leafNode name="nhrp">
<properties>
<help>Redistribute NHRP routes</help>
<valueless/>
</properties>
</leafNode>
<leafNode name="openfabric">
<properties>
<help>OpenFabric Routing Protocol</help>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
#include <include/bgp/afi-redistribute-metric-route-map.xml.i>
</children>
</node>
<node name="nhrp">
<properties>
<help>Redistribute NHRP routes into BGP</help>
</properties>
<children>
#include <include/bgp/afi-redistribute-metric-route-map.xml.i>
</children>
</node>
<node name="static">
<properties>
<help>Redistribute static routes into BGP</help>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,14 @@
#include <include/isis/redistribute-level-1-2.xml.i>
</children>
</node>
<node name="nhrp">
<properties>
<help>Redistribute NHRP routes into IS-IS</help>
</properties>
<children>
#include <include/isis/redistribute-level-1-2.xml.i>
</children>
</node>
<node name="ospf">
<properties>
<help>Redistribute OSPF routes into IS-IS</help>
Expand Down
10 changes: 10 additions & 0 deletions interface-definitions/include/ospf/protocol-common-config.xml.i
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,16 @@
#include <include/route-map.xml.i>
</children>
</node>
<node name="nhrp">
<properties>
<help>Redistribute NHRP routes</help>
</properties>
<children>
#include <include/ospf/metric.xml.i>
#include <include/ospf/metric-type.xml.i>
#include <include/route-map.xml.i>
</children>
</node>
<node name="rip">
<properties>
<help>Redistribute RIP routes</help>
Expand Down
8 changes: 8 additions & 0 deletions interface-definitions/protocols_rip.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,14 @@
#include <include/rip/redistribute.xml.i>
</children>
</node>
<node name="nhrp">
<properties>
<help>Redistribute NHRP routes</help>
</properties>
<children>
#include <include/rip/redistribute.xml.i>
</children>
</node>
<node name="ospf">
<properties>
<help>Redistribute OSPF routes</help>
Expand Down
4 changes: 2 additions & 2 deletions smoketest/scripts/cli/test_protocols_babel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
# Copyright (C) 2024 VyOS maintainers and contributors
# Copyright (C) 2024-2025 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
Expand Down Expand Up @@ -72,7 +72,7 @@ def test_01_basic(self):
self.assertIn(f' babel smoothing-half-life {smoothing_half_life}', frrconfig)

def test_02_redistribute(self):
ipv4_protos = ['bgp', 'connected', 'isis', 'kernel', 'ospf', 'rip', 'static']
ipv4_protos = ['bgp', 'connected', 'isis', 'kernel', 'nhrp', 'ospf', 'rip', 'static']
ipv6_protos = ['bgp', 'connected', 'isis', 'kernel', 'ospfv3', 'ripng', 'static']

self.cli_set(base_path + ['interface', self._interfaces[0], 'enable-timestamps'])
Expand Down
4 changes: 4 additions & 0 deletions smoketest/scripts/cli/test_protocols_bgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,10 @@ def test_bgp_04_afi_ipv4(self):
'metric' : '400',
'route_map' : 'redistr-ipv4-kernel',
},
'nhrp': {
'metric': '400',
'route_map': 'redistr-ipv4-nhrp',
},
'ospf' : {
'metric' : '500',
'route_map' : 'redistr-ipv4-ospf',
Expand Down
9 changes: 6 additions & 3 deletions smoketest/scripts/cli/test_protocols_isis.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_isis_01_redistribute(self):
route_map = 'EXPORT-ISIS'
rule = '10'
metric_style = 'transition'

redistribute = ['babel', 'bgp', 'connected', 'kernel', 'nhrp', 'ospf', 'rip', 'static']
self.cli_set(['policy', 'prefix-list', prefix_list, 'rule', rule, 'action', 'permit'])
self.cli_set(['policy', 'prefix-list', prefix_list, 'rule', rule, 'prefix', '203.0.113.0/24'])
self.cli_set(['policy', 'route-map', route_map, 'rule', rule, 'action', 'permit'])
Expand All @@ -80,7 +80,9 @@ def test_isis_01_redistribute(self):
with self.assertRaises(ConfigSessionError):
self.cli_commit()

self.cli_set(base_path + ['redistribute', 'ipv4', 'connected', 'level-2', 'route-map', route_map])
for proto in redistribute:
self.cli_set(base_path + ['redistribute', 'ipv4', proto, 'level-2', 'route-map', route_map])

self.cli_set(base_path + ['metric-style', metric_style])
self.cli_set(base_path + ['log-adjacency-changes'])

Expand All @@ -92,7 +94,8 @@ def test_isis_01_redistribute(self):
self.assertIn(f' net {net}', tmp)
self.assertIn(f' metric-style {metric_style}', tmp)
self.assertIn(f' log-adjacency-changes', tmp)
self.assertIn(f' redistribute ipv4 connected level-2 route-map {route_map}', tmp)
for proto in redistribute:
self.assertIn(f' redistribute ipv4 {proto} level-2 route-map {route_map}', tmp)

for interface in self._interfaces:
tmp = self.getFRRconfig(f'interface {interface}', endsection='^exit')
Expand Down
4 changes: 2 additions & 2 deletions smoketest/scripts/cli/test_protocols_ospf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
# Copyright (C) 2021-2024 VyOS maintainers and contributors
# Copyright (C) 2021-2025 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
Expand Down Expand Up @@ -255,7 +255,7 @@ def test_ospf_06_neighbor(self):
def test_ospf_07_redistribute(self):
metric = '15'
metric_type = '1'
redistribute = ['babel', 'bgp', 'connected', 'isis', 'kernel', 'rip', 'static']
redistribute = ['babel', 'bgp', 'connected', 'isis', 'kernel', 'nhrp', 'rip', 'static']

for protocol in redistribute:
self.cli_set(base_path + ['redistribute', protocol, 'metric', metric])
Expand Down
4 changes: 2 additions & 2 deletions smoketest/scripts/cli/test_protocols_rip.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
# Copyright (C) 2021-2023 VyOS maintainers and contributors
# Copyright (C) 2021-2025 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
Expand Down Expand Up @@ -82,7 +82,7 @@ def test_rip_01_parameters(self):
interfaces = Section.interfaces('ethernet')
neighbors = ['1.2.3.4', '1.2.3.5', '1.2.3.6']
networks = ['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16']
redistribute = ['bgp', 'connected', 'isis', 'kernel', 'ospf', 'static']
redistribute = ['bgp', 'connected', 'isis', 'kernel', 'nhrp', 'ospf', 'static']
timer_garbage = '888'
timer_timeout = '1000'
timer_update = '90'
Expand Down

0 comments on commit 46caac5

Please sign in to comment.