Skip to content

Commit

Permalink
bond: T6709: add EAPoL support
Browse files Browse the repository at this point in the history
(cherry picked from commit 8eeb1bd)
  • Loading branch information
c-po authored and mergify[bot] committed Sep 16, 2024
1 parent d7c4ec6 commit b5f2158
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
1 change: 1 addition & 0 deletions interface-definitions/interfaces_bonding.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include <include/interface/disable.xml.i>
#include <include/interface/vrf.xml.i>
#include <include/interface/mirror.xml.i>
#include <include/interface/eapol.xml.i>
<node name="evpn">
<properties>
<help>EVPN Multihoming</help>
Expand Down
33 changes: 18 additions & 15 deletions smoketest/scripts/cli/base_interfaces_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,8 @@ def test_eapol(self):
if not self._test_eapol:
self.skipTest('not supported')

cfg_dir = '/run/wpa_supplicant'

ca_certs = {
'eapol-server-ca-root': server_ca_root_cert_data,
'eapol-server-ca-intermediate': server_ca_intermediate_cert_data,
Expand Down Expand Up @@ -1274,9 +1276,6 @@ def test_eapol(self):

self.cli_commit()

# Check for running process
self.assertTrue(process_named_running('wpa_supplicant'))

# Validate interface config
for interface in self._interfaces:
tmp = get_wpa_supplicant_value(interface, 'key_mgmt')
Expand All @@ -1289,29 +1288,33 @@ def test_eapol(self):
self.assertEqual('0', tmp)

tmp = get_wpa_supplicant_value(interface, 'ca_cert')
self.assertEqual(f'"/run/wpa_supplicant/{interface}_ca.pem"', tmp)
self.assertEqual(f'"{cfg_dir}/{interface}_ca.pem"', tmp)

tmp = get_wpa_supplicant_value(interface, 'client_cert')
self.assertEqual(f'"/run/wpa_supplicant/{interface}_cert.pem"', tmp)
self.assertEqual(f'"{cfg_dir}/{interface}_cert.pem"', tmp)

tmp = get_wpa_supplicant_value(interface, 'private_key')
self.assertEqual(f'"/run/wpa_supplicant/{interface}_cert.key"', tmp)
self.assertEqual(f'"{cfg_dir}/{interface}_cert.key"', tmp)

mac = read_file(f'/sys/class/net/{interface}/address')
tmp = get_wpa_supplicant_value(interface, 'identity')
self.assertEqual(f'"{mac}"', tmp)

# Check certificate files have the full chain
self.assertEqual(get_certificate_count(interface, 'ca'), 2)
self.assertEqual(get_certificate_count(interface, 'cert'), 3)
# Check certificate files have the full chain
self.assertEqual(get_certificate_count(interface, 'ca'), 2)
self.assertEqual(get_certificate_count(interface, 'cert'), 3)

for name in ca_certs:
self.cli_delete(['pki', 'ca', name])
self.cli_delete(['pki', 'certificate', cert_name])
# Check for running process
self.assertTrue(process_named_running('wpa_supplicant', cmdline=f'-i{interface}'))

# Remove EAPoL configuration
self.cli_delete(self._base_path + [interface, 'eapol'])
# Commit
for interface in self._interfaces:
self.cli_delete(self._base_path + [interface, 'eapol'])

# Commit and check that process is no longer running
self.cli_commit()
# Daemon must no longer be running
self.assertFalse(process_named_running('wpa_supplicant'))

for name in ca_certs:
self.cli_delete(['pki', 'ca', name])
self.cli_delete(['pki', 'certificate', cert_name])
2 changes: 1 addition & 1 deletion smoketest/scripts/cli/test_interfaces_ethernet.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,4 @@ def test_ethtool_evpn_uplink_tarcking(self):
self.assertIn(f' evpn mh uplink', frrconfig)

if __name__ == '__main__':
unittest.main(verbosity=2, failfast=True)
unittest.main(verbosity=2)
4 changes: 3 additions & 1 deletion src/conf_mode/interfaces_bonding.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from vyos.configverify import verify_address
from vyos.configverify import verify_bridge_delete
from vyos.configverify import verify_dhcpv6
from vyos.configverify import verify_eapol
from vyos.configverify import verify_mirror_redirect
from vyos.configverify import verify_mtu_ipv6
from vyos.configverify import verify_vlan_config
Expand Down Expand Up @@ -73,7 +74,7 @@ def get_config(config=None):
else:
conf = Config()
base = ['interfaces', 'bonding']
ifname, bond = get_interface_dict(conf, base)
ifname, bond = get_interface_dict(conf, base, with_pki=True)

# To make our own life easier transfor the list of member interfaces
# into a dictionary - we will use this to add additional information
Expand Down Expand Up @@ -196,6 +197,7 @@ def verify(bond):
verify_dhcpv6(bond)
verify_vrf(bond)
verify_mirror_redirect(bond)
verify_eapol(bond)

# use common function to verify VLAN configuration
verify_vlan_config(bond)
Expand Down

0 comments on commit b5f2158

Please sign in to comment.