Skip to content

Commit

Permalink
ethernet: T6306: add support for EVPN MH uplink/core tracking
Browse files Browse the repository at this point in the history
When all the underlay links go down the PE no longer has access to the VxLAN
+overlay.

To prevent blackholing of traffic the server/ES links are protodowned on the PE.
A link can be setup for uplink tracking via the following configuration:

set interfaces ethernet eth0 evpn uplink
  • Loading branch information
c-po committed May 11, 2024
1 parent 7925402 commit 5565f27
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 6 deletions.
8 changes: 8 additions & 0 deletions interface-definitions/include/interface/evpn-mh-uplink.xml.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!-- include start from interface/evpn-mh-uplink.xml.i -->
<leafNode name="uplink">
<properties>
<help>Uplink to the VXLAN core</help>
<valueless/>
</properties>
</leafNode>
<!-- include end -->
7 changes: 1 addition & 6 deletions interface-definitions/interfaces_bonding.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,7 @@
</constraint>
</properties>
</leafNode>
<leafNode name="uplink">
<properties>
<help>Uplink to the VXLAN core</help>
<valueless/>
</properties>
</leafNode>
#include <include/interface/evpn-mh-uplink.xml.i>
</children>
</node>
<leafNode name="hash-policy">
Expand Down
8 changes: 8 additions & 0 deletions interface-definitions/interfaces_ethernet.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@
<defaultValue>auto</defaultValue>
</leafNode>
#include <include/interface/eapol.xml.i>
<node name="evpn">
<properties>
<help>EVPN Multihoming</help>
</properties>
<children>
#include <include/interface/evpn-mh-uplink.xml.i>
</children>
</node>
#include <include/interface/hw-id.xml.i>
#include <include/interface/ipv4-options.xml.i>
#include <include/interface/ipv6-options.xml.i>
Expand Down
10 changes: 10 additions & 0 deletions smoketest/scripts/cli/test_interfaces_ethernet.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,5 +354,15 @@ def test_ethtool_flow_control(self):
out = loads(out)
self.assertFalse(out[0]['autonegotiate'])

def test_ethtool_evpn_uplink_tarcking(self):
for interface in self._interfaces:
self.cli_set(self._base_path + [interface, 'evpn', 'uplink'])

self.cli_commit()

for interface in self._interfaces:
frrconfig = self.getFRRconfig(f'interface {interface}', daemon='zebra')
self.assertIn(f' evpn mh uplink', frrconfig)

if __name__ == '__main__':
unittest.main(verbosity=2)
17 changes: 17 additions & 0 deletions src/conf_mode/interfaces_ethernet.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@
from vyos.pki import load_certificate
from vyos.pki import wrap_private_key
from vyos.template import render
from vyos.template import render_to_string
from vyos.utils.process import call
from vyos.utils.dict import dict_search
from vyos.utils.dict import dict_to_paths_values
from vyos.utils.dict import dict_set
from vyos.utils.dict import dict_delete
from vyos.utils.file import write_file
from vyos import ConfigError
from vyos import frr
from vyos import airbag
airbag.enable()

Expand Down Expand Up @@ -389,6 +391,10 @@ def generate(ethernet):

write_file(ca_cert_file_path, '\n'.join(ca_chains))

ethernet['frr_zebra_config'] = ''
if 'deleted' not in ethernet:
ethernet['frr_zebra_config'] = render_to_string('frr/evpn.mh.frr.j2', ethernet)

return None

def apply(ethernet):
Expand All @@ -407,6 +413,17 @@ def apply(ethernet):

call(f'systemctl {eapol_action} wpa_supplicant-wired@{ifname}')

zebra_daemon = 'zebra'
# Save original configuration prior to starting any commit actions
frr_cfg = frr.FRRConfig()

# The route-map used for the FIB (zebra) is part of the zebra daemon
frr_cfg.load_configuration(zebra_daemon)
frr_cfg.modify_section(f'^interface {ifname}', stop_pattern='^exit', remove_stop_mark=True)
if 'frr_zebra_config' in ethernet:
frr_cfg.add_before(frr.default_add_before, ethernet['frr_zebra_config'])
frr_cfg.commit_configuration(zebra_daemon)

if __name__ == '__main__':
try:
c = get_config()
Expand Down

0 comments on commit 5565f27

Please sign in to comment.