summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-09-20 13:53:55 +0200
committerChristian Poessinger <christian@poessinger.com>2020-09-20 14:46:26 +0200
commit993f6873c02f3f79013acedfe61ce705bdb3a4d0 (patch)
treeac1b93a2eada6091b9274cdd934aa35baac0a61f
parent0a21905786d31e759416dd335d87726f9ed46ffa (diff)
downloadvyos-1x-993f6873c02f3f79013acedfe61ce705bdb3a4d0.tar.gz
vyos-1x-993f6873c02f3f79013acedfe61ce705bdb3a4d0.zip
wwan: ifconfig: T2905: sync CLI nodes in dialup interfaces
Both PPPoE and WWAN interfaces are dialer interfaces handled by ppp, but use different CLI nodes for the same functionality. PPPoE has "connect-on-demand" to initiate an "on-demand" dialing and WWAN uses "ondemand" for this purpose. Rename WWAN "ondemand" node to "connect-on-demand".
-rw-r--r--data/templates/wwan/peer.tmpl2
-rw-r--r--interface-definitions/include/interface-dial-on-demand.xml.i6
-rw-r--r--interface-definitions/interfaces-pppoe.xml.in7
-rw-r--r--interface-definitions/interfaces-wirelessmodem.xml.in7
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_wirelessmodem.py2
-rwxr-xr-xsrc/migration-scripts/interfaces/12-to-1314
6 files changed, 24 insertions, 14 deletions
diff --git a/data/templates/wwan/peer.tmpl b/data/templates/wwan/peer.tmpl
index aa759f741..e23881bf8 100644
--- a/data/templates/wwan/peer.tmpl
+++ b/data/templates/wwan/peer.tmpl
@@ -21,7 +21,7 @@ noauth
crtscts
lock
persist
-{{ "demand" if ondemand is defined }}
+{{ "demand" if connect_on_demand is defined }}
connect '/usr/sbin/chat -v -t6 -f /etc/ppp/peers/chat.{{ ifname }}'
diff --git a/interface-definitions/include/interface-dial-on-demand.xml.i b/interface-definitions/include/interface-dial-on-demand.xml.i
new file mode 100644
index 000000000..c14ddf6f5
--- /dev/null
+++ b/interface-definitions/include/interface-dial-on-demand.xml.i
@@ -0,0 +1,6 @@
+<leafNode name="connect-on-demand">
+ <properties>
+ <help>Establishment connection automatically when traffic is sent</help>
+ <valueless/>
+ </properties>
+</leafNode>
diff --git a/interface-definitions/interfaces-pppoe.xml.in b/interface-definitions/interfaces-pppoe.xml.in
index 8a6c61312..b6208e0b9 100644
--- a/interface-definitions/interfaces-pppoe.xml.in
+++ b/interface-definitions/interfaces-pppoe.xml.in
@@ -42,12 +42,7 @@
</leafNode>
</children>
</node>
- <leafNode name="connect-on-demand">
- <properties>
- <help>Automatic establishment of PPPOE connection when traffic is sent</help>
- <valueless/>
- </properties>
- </leafNode>
+ #include <include/interface-dial-on-demand.xml.i>
<leafNode name="default-route">
<properties>
<help>Default route insertion behaviour (default: auto)</help>
diff --git a/interface-definitions/interfaces-wirelessmodem.xml.in b/interface-definitions/interfaces-wirelessmodem.xml.in
index d375b808d..96604ff00 100644
--- a/interface-definitions/interfaces-wirelessmodem.xml.in
+++ b/interface-definitions/interfaces-wirelessmodem.xml.in
@@ -80,12 +80,7 @@
<valueless/>
</properties>
</leafNode>
- <leafNode name="ondemand">
- <properties>
- <help>Only dial when traffic is available</help>
- <valueless/>
- </properties>
- </leafNode>
+ #include <include/interface-dial-on-demand.xml.i>
</children>
</tagNode>
</children>
diff --git a/smoketest/scripts/cli/test_interfaces_wirelessmodem.py b/smoketest/scripts/cli/test_interfaces_wirelessmodem.py
index 40cd03b93..efc9c0e98 100755
--- a/smoketest/scripts/cli/test_interfaces_wirelessmodem.py
+++ b/smoketest/scripts/cli/test_interfaces_wirelessmodem.py
@@ -43,7 +43,7 @@ class WWANInterfaceTest(unittest.TestCase):
def test_wlm_1(self):
for interface in self._interfaces:
self.session.set(base_path + [interface, 'no-peer-dns'])
- self.session.set(base_path + [interface, 'ondemand'])
+ self.session.set(base_path + [interface, 'connect-on-demand'])
# check validate() - APN must be configure
with self.assertRaises(ConfigSessionError):
diff --git a/src/migration-scripts/interfaces/12-to-13 b/src/migration-scripts/interfaces/12-to-13
index 17d1d0b0a..f866ca9a6 100755
--- a/src/migration-scripts/interfaces/12-to-13
+++ b/src/migration-scripts/interfaces/12-to-13
@@ -17,6 +17,8 @@
# - T2903: Change vif-s ethertype from numeric number to literal
# - 0x88a8 -> 802.1ad
# - 0x8100 -> 802.1q
+# - T2905: Change WWAN "ondemand" node to "connect-on-demand" to have identical
+# CLI nodes for both types of dialer interfaces
from sys import exit, argv
from vyos.configtree import ConfigTree
@@ -32,6 +34,9 @@ if __name__ == '__main__':
config = ConfigTree(config_file)
+ #
+ # T2903
+ #
for type in config.list_nodes(['interfaces']):
for interface in config.list_nodes(['interfaces', type]):
if not config.exists(['interfaces', type, interface, 'vif-s']):
@@ -48,6 +53,15 @@ if __name__ == '__main__':
config.set(base_path + ['protocol'], value=protocol)
config.delete(base_path + ['ethertype'])
+ #
+ # T2905
+ #
+ wwan_base = ['interfaces', 'wirelessmodem']
+ if config.exists(wwan_base):
+ for interface in config.list_nodes(wwan_base):
+ if config.exists(wwan_base + [interface, 'ondemand']):
+ config.rename(wwan_base + [interface, 'ondemand'], 'connect-on-demand')
+
try:
with open(file_name, 'w') as f:
f.write(config.to_string())