summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Märdian <lukas.maerdian@canonical.com>2020-12-16 18:19:46 +0100
committerAndrej Shadura <andrewsh@debian.org>2021-01-05 19:28:50 +0100
commit4ee24b7dff18df604268472f7753bd94a26ae53e (patch)
treed25a2acafc6b5c55b4ef9c5bfde99c2eb1bb66d6
parentd7913e024f9905210c8ac66e0408a39fb3e8edad (diff)
parse: fix 'networkmanager:' backend options for modem connections (#179)
The COMMON_BACKEND_HANDLERS have been forgotten for modem connections apparently. Add them to allow the definition of the special networkmanager: mapping, used for NetworkManager integration. We do not (yet) use that information (like uuid) in the current implementation. But reading YAML via NetworkManager will be broken if the networkmanager: mapping is not accepted. Gbp-Pq: Name 0002-parse-fix-networkmanager-backend-options-for-modem-c.patch
-rw-r--r--src/parse.c1
-rw-r--r--tests/generator/test_modems.py29
2 files changed, 30 insertions, 0 deletions
diff --git a/src/parse.c b/src/parse.c
index 033c657..f1f6a6f 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -2222,6 +2222,7 @@ static const mapping_entry_handler vlan_def_handlers[] = {
static const mapping_entry_handler modem_def_handlers[] = {
COMMON_LINK_HANDLERS,
+ COMMON_BACKEND_HANDLERS,
{"apn", YAML_SCALAR_NODE, handle_netdef_str, NULL, netdef_offset(modem_params.apn)},
{"auto-config", YAML_SCALAR_NODE, handle_netdef_bool, NULL, netdef_offset(modem_params.auto_config)},
{"device-id", YAML_SCALAR_NODE, handle_netdef_str, NULL, netdef_offset(modem_params.device_id)},
diff --git a/tests/generator/test_modems.py b/tests/generator/test_modems.py
index 027aa65..ca68ddc 100644
--- a/tests/generator/test_modems.py
+++ b/tests/generator/test_modems.py
@@ -372,3 +372,32 @@ method=ignore
'''})
self.assert_networkd({})
self.assert_nm_udev(None)
+
+ def test_modem_nm_integration(self):
+ self.generate('''network:
+ version: 2
+ renderer: NetworkManager
+ modems:
+ mobilephone:
+ auto-config: true
+ networkmanager:
+ uuid: b22d8f0f-3f34-46bd-ac28-801fa87f1eb6''')
+ self.assert_nm({'mobilephone': '''[connection]
+id=netplan-mobilephone
+type=gsm
+interface-name=mobilephone
+
+[gsm]
+auto-config=true
+
+[ethernet]
+wake-on-lan=0
+
+[ipv4]
+method=link-local
+
+[ipv6]
+method=ignore
+'''})
+ self.assert_networkd({})
+ self.assert_nm_udev(None)