-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature] Added support for modem manager interfaces #167
Closes #167
- Loading branch information
1 parent
b81cfd7
commit bf818a5
Showing
5 changed files
with
202 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import unittest | ||
|
||
from netjsonconfig import OpenWrt | ||
from netjsonconfig.utils import _TabsMixin | ||
|
||
|
||
class TestModemManager(unittest.TestCase, _TabsMixin): | ||
maxDiff = None | ||
|
||
_modemmanager_interface_netjson = { | ||
"interfaces": [ | ||
{ | ||
"name": "wwan0", | ||
"type": "modem-manager", | ||
"apn": "apn.vodafone.com", | ||
"pin": "1234", | ||
"device": "/sys/devices/platform/ahb/1b000000.usb/usb1/1-1", | ||
"username": "user123", | ||
"password": "pwd123456", | ||
"metric": 50, | ||
"iptype": "ipv4v6", | ||
"lowpower": False, | ||
"mtu": 1500, | ||
} | ||
] | ||
} | ||
|
||
_modemmanager_interface_uci = """package network | ||
config interface 'wwan0' | ||
option apn 'apn.vodafone.com' | ||
option device '/sys/devices/platform/ahb/1b000000.usb/usb1/1-1' | ||
option ifname 'wwan0' | ||
option iptype 'ipv4v6' | ||
option lowpower '0' | ||
option metric '50' | ||
option mtu '1500' | ||
option password 'pwd123456' | ||
option pincode '1234' | ||
option proto 'modemmanager' | ||
option username 'user123' | ||
""" | ||
|
||
def test_render_modemmanager_interface(self): | ||
result = OpenWrt(self._modemmanager_interface_netjson).render() | ||
expected = self._tabs(self._modemmanager_interface_uci) | ||
self.assertEqual(result, expected) | ||
|
||
def test_parse_modemmanager_interface(self): | ||
result = OpenWrt(native=self._modemmanager_interface_uci).config | ||
expected = self._modemmanager_interface_netjson | ||
self.assertDictEqual(result, expected) |