Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ethernet: T6306: add support for EVPN MH uplink/core tracking (backport #3447) #3449

Merged
merged 1 commit into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading