Skip to content

Commit 1124d3f

Browse files
authored
Merge pull request #4682 from aapostoliuk/T7722-current
isis: T7722: Added interface fast-reroute configuration commands
2 parents 1517192 + 5098fa8 commit 1124d3f

8 files changed

Lines changed: 232 additions & 1 deletion

File tree

data/templates/frr/isisd.frr.j2

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,33 @@ interface {{ iface }}
1616
{% if iface_config.circuit_type is vyos_defined %}
1717
isis circuit-type {{ iface_config.circuit_type }}
1818
{% endif %}
19+
{% if iface_config.fast_reroute.lfa is vyos_defined %}
20+
{% for level, level_config in iface_config.fast_reroute.lfa.items() %}
21+
{% if level_config.enable is vyos_defined %}
22+
isis fast-reroute lfa {{ level | replace('_', '-') }}
23+
{% endif %}
24+
{% if level_config.exclude.interface is vyos_defined %}
25+
{% for excl_if in level_config.exclude.interface %}
26+
isis fast-reroute lfa {{ level | replace('_', '-') }} exclude interface {{ excl_if }}
27+
{% endfor %}
28+
{% endif %}
29+
{% endfor %}
30+
{% endif %}
31+
{% if iface_config.fast_reroute.remote_lfa is vyos_defined %}
32+
{% for level, level_config in iface_config.fast_reroute.remote_lfa.items() %}
33+
{% if level_config.maximum_metric is vyos_defined %}
34+
isis fast-reroute remote-lfa maximum-metric {{ level_config.maximum_metric }} {{ level | replace('_', '-') }}
35+
{% endif %}
36+
{% if level_config.tunnel.mpls_ldp is vyos_defined %}
37+
isis fast-reroute remote-lfa tunnel mpls-ldp {{ level | replace('_', '-') }}
38+
{% endif %}
39+
{% endfor %}
40+
{% endif %}
41+
{% if iface_config.fast_reroute.ti_lfa is vyos_defined %}
42+
{% for level, level_config in iface_config.fast_reroute.ti_lfa.items() %}
43+
isis fast-reroute ti-lfa {{ level | replace('_', '-') }} {{ 'node-protection' if level_config.node_protection is vyos_defined }} {{ 'link-fallback' if level_config.node_protection.link_fallback is vyos_defined }}
44+
{% endfor %}
45+
{% endif %}
1946
{% if iface_config.hello_interval is vyos_defined %}
2047
isis hello-interval {{ iface_config.hello_interval }}
2148
{% endif %}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!-- include start from isis/exclude-interface.xml.i -->
2+
<node name="exclude">
3+
<properties>
4+
<help>Exclude interfaces from fast reroute</help>
5+
</properties>
6+
<children>
7+
#include <include/generic-interface-multi.xml.i>
8+
</children>
9+
</node>
10+
<!-- include end -->
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!-- include start from isis/frr-maxmetric.xml.i -->
2+
<leafNode name="maximum-metric">
3+
<properties>
4+
<help>Limit remote LFA node selection within the metric</help>
5+
<valueHelp>
6+
<format>u32:1-16777215</format>
7+
<description>Metric value</description>
8+
</valueHelp>
9+
<constraint>
10+
<validator name="numeric" argument="--range 1-16777215"/>
11+
</constraint>
12+
</properties>
13+
</leafNode>
14+
<!-- include end -->
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!-- include start from isis/node-protection.xml.i -->
2+
<node name="node-protection">
3+
<properties>
4+
<help>Protect against node failures</help>
5+
</properties>
6+
<children>
7+
<leafNode name="link-fallback">
8+
<properties>
9+
<help>Enable link-protection fallback</help>
10+
<valueless/>
11+
</properties>
12+
</leafNode>
13+
</children>
14+
</node>
15+
<!-- include end -->

interface-definitions/include/isis/protocol-common-config.xml.i

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,96 @@
667667
</constraint>
668668
</properties>
669669
</leafNode>
670+
<node name="fast-reroute">
671+
<properties>
672+
<help>IS-IS fast reroute</help>
673+
</properties>
674+
<children>
675+
<node name="lfa">
676+
<properties>
677+
<help>Enable LFA computation</help>
678+
</properties>
679+
<children>
680+
<node name="level-1">
681+
<properties>
682+
<help> Enable LFA computation for Level 1 only</help>
683+
</properties>
684+
<children>
685+
<leafNode name="enable">
686+
<properties>
687+
<help>Enable LFA</help>
688+
<valueless/>
689+
</properties>
690+
</leafNode>
691+
#include <include/isis/exclude-interface.xml.i>
692+
</children>
693+
</node>
694+
<node name="level-2">
695+
<properties>
696+
<help>Enable LFA computation for Level 2 only</help>
697+
</properties>
698+
<children>
699+
<leafNode name="enable">
700+
<properties>
701+
<help>Enable LFA</help>
702+
<valueless/>
703+
</properties>
704+
</leafNode>
705+
#include <include/isis/exclude-interface.xml.i>
706+
</children>
707+
</node>
708+
</children>
709+
</node>
710+
<node name="remote-lfa">
711+
<properties>
712+
<help>Enable remote LFA computation</help>
713+
</properties>
714+
<children>
715+
<node name="level-1">
716+
<properties>
717+
<help> Enable remote LFA computation for Level 1 only</help>
718+
</properties>
719+
<children>
720+
#include <include/isis/frr-maxmetric.xml.i>
721+
#include <include/isis/remote_lfa_tunnel.xml.i>
722+
</children>
723+
</node>
724+
<node name="level-2">
725+
<properties>
726+
<help>Enable remote LFA computation for Level 2 only</help>
727+
</properties>
728+
<children>
729+
#include <include/isis/frr-maxmetric.xml.i>
730+
#include <include/isis/remote_lfa_tunnel.xml.i>
731+
</children>
732+
</node>
733+
</children>
734+
</node>
735+
<node name="ti-lfa">
736+
<properties>
737+
<help> Enable TI-LFA computation</help>
738+
</properties>
739+
<children>
740+
<node name="level-1">
741+
<properties>
742+
<help>Enable TI-LFA computation for Level 1 only</help>
743+
</properties>
744+
<children>
745+
#include <include/isis/node-protection.xml.i>
746+
</children>
747+
</node>
748+
<node name="level-2">
749+
<properties>
750+
<help>Enable TI-LFA computation for Level 2 only</help>
751+
</properties>
752+
<children>
753+
#include <include/isis/node-protection.xml.i>
754+
</children>
755+
</node>
756+
</children>
757+
</node>
758+
</children>
759+
</node>
670760
<leafNode name="hello-padding">
671761
<properties>
672762
<help>Add padding to IS-IS hello packets</help>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!-- include start from isis/remote_lfa_tunnel.xml.i -->
2+
<node name="tunnel">
3+
<properties>
4+
<help>Enable remote LFA computation using tunnels</help>
5+
</properties>
6+
<children>
7+
<leafNode name="mpls-ldp">
8+
<properties>
9+
<help>Use MPLS LDP tunnel to reach the remote LFA node</help>
10+
<valueless/>
11+
</properties>
12+
</leafNode>
13+
</children>
14+
</node>
15+
<!-- include end -->

smoketest/scripts/cli/test_protocols_isis.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,5 +438,44 @@ def test_isis_11_srv6(self):
438438
# Commit for isis
439439
self.cli_commit()
440440

441+
def test_isis_12_frr_interface_lfa_remotelfa(self):
442+
interface = 'eth0'
443+
rla_metric = '10'
444+
frr_interface_base_path = base_path + ['interface', interface, 'fast-reroute']
445+
self.cli_set(base_path + ['net', net])
446+
self.cli_set(base_path + ['interface', interface])
447+
self.cli_set(frr_interface_base_path + ['lfa', 'level-1', 'enable'])
448+
self.cli_set(frr_interface_base_path + ['lfa', 'level-1', 'exclude',
449+
'interface', interface])
450+
self.cli_set(frr_interface_base_path + ['remote-lfa', 'level-1',
451+
'maximum-metric', rla_metric])
452+
self.cli_set(frr_interface_base_path + ['remote-lfa', 'level-1',
453+
'tunnel', 'mpls-ldp'])
454+
455+
# Commit main ISIS changes
456+
self.cli_commit()
457+
458+
# Verify interface ISIS changes
459+
tmp = self.getFRRconfig(f'interface {interface}', endsection='^exit')
460+
self.assertIn(f' isis fast-reroute lfa level-1', tmp)
461+
self.assertIn(f' isis fast-reroute lfa level-1 exclude interface {interface}', tmp)
462+
self.assertIn(f' isis fast-reroute remote-lfa maximum-metric {rla_metric} level-1', tmp)
463+
self.assertIn(f' isis fast-reroute remote-lfa tunnel mpls-ldp level-1', tmp)
464+
465+
def test_isis_13_frr_interface_tilfa(self):
466+
interface = 'eth0'
467+
frr_interface_base_path = base_path + ['interface', interface, 'fast-reroute']
468+
self.cli_set(base_path + ['net', net])
469+
self.cli_set(base_path + ['interface', interface])
470+
self.cli_set(frr_interface_base_path + ['ti-lfa', 'level-1', 'node-protection',
471+
'link-fallback'])
472+
473+
# Commit main ISIS changes
474+
self.cli_commit()
475+
476+
# Verify interface ISIS changes
477+
tmp = self.getFRRconfig(f'interface {interface}', endsection='^exit')
478+
self.assertIn(f' isis fast-reroute ti-lfa level-1 node-protection link-fallback', tmp)
479+
441480
if __name__ == '__main__':
442481
unittest.main(verbosity=2)

src/conf_mode/protocols_isis.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def verify(config_dict):
6868
if 'interface' not in isis:
6969
raise ConfigError('Interface used for routing updates is mandatory!')
7070

71-
for interface in isis['interface']:
71+
for interface, interface_config in isis['interface'].items():
7272
verify_interface_exists(isis, interface)
7373
# Interface MTU must be >= configured lsp-mtu
7474
mtu = Interface(interface).get_mtu()
@@ -90,6 +90,27 @@ def verify(config_dict):
9090
if 'master' not in tmp or tmp['master'] != vrf:
9191
raise ConfigError(f'Interface "{interface}" is not a member of VRF "{vrf}"!')
9292

93+
# Fast reroute validation
94+
# LFA and TI-LFA of the same level can not be configured on the same interface
95+
# To configure Remote LFA, LFA of the same level should be configured on this interface.
96+
if 'fast_reroute' in interface_config:
97+
isis_frr_config = interface_config['fast_reroute']
98+
levels = ['level_1', 'level_2']
99+
if 'lfa' and 'ti_lfa' in isis_frr_config:
100+
for isis_level in levels:
101+
if ((dict_search(f'lfa.{isis_level}.enable', isis_frr_config) is not None)
102+
and (dict_search(f'ti_lfa.{isis_level}', isis_frr_config) is not None)):
103+
raise ConfigError(
104+
f'LFA and TI-LFA at the "{str(isis_level).replace("_","-")}" '
105+
f'can not be configured on the same interface "{interface}"!')
106+
if 'remote_lfa' in isis_frr_config:
107+
for isis_level in levels:
108+
if ((dict_search(f'remote_lfa.{isis_level}', isis_frr_config) is not None)
109+
and (dict_search(f'lfa.{isis_level}.enable', isis_frr_config) is None)):
110+
raise ConfigError(
111+
f'To configure Remote LFA, LFA at the same level '
112+
f'should be configured on interface "{interface}"!')
113+
93114
# If md5 and plaintext-password set at the same time
94115
for password in ['area_password', 'domain_password']:
95116
if password in isis:

0 commit comments

Comments
 (0)