forked from vyos/vyos-1x
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wwan: T1988: initial XML/Python representation
- Loading branch information
Showing
2 changed files
with
156 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0"?> | ||
<interfaceDefinition> | ||
<node name="interfaces"> | ||
<children> | ||
<tagNode name="wirelessmodem" owner="${vyos_conf_scripts_dir}/interfaces-wirelessmodem.py"> | ||
<properties> | ||
<help>Wireless Modem (WWAN) Interface</help> | ||
<priority>350</priority> | ||
<constraint> | ||
<regex>wlm[0-9]+$</regex> | ||
</constraint> | ||
<constraintErrorMessage>Wireless Modem interface must be named wlmN</constraintErrorMessage> | ||
<valueHelp> | ||
<format>wlmN</format> | ||
<description>Wireless modem interface name</description> | ||
</valueHelp> | ||
</properties> | ||
<children> | ||
<node name="backup"> | ||
<properties> | ||
<help>Insert backup default route</help> | ||
</properties> | ||
<children> | ||
<leafNode name="distance"> | ||
<properties> | ||
<help>Distance backup default route</help> | ||
<valueHelp> | ||
<format>1-255</format> | ||
<description>Distance of the backup route (default: 10) </description> | ||
</valueHelp> | ||
<constraint> | ||
<validator name="numeric" argument="--range 1-255"/> | ||
</constraint> | ||
<constraintErrorMessage>Must be between (1-255)</constraintErrorMessage> | ||
</properties> | ||
</leafNode> | ||
</children> | ||
</node> | ||
#include <include/interface-description.xml.i> | ||
<leafNode name="device"> | ||
<properties> | ||
<help>System device name (default: ttyUSB0)</help> | ||
<valueHelp> | ||
<format>>ttyXXX%lt;</format> | ||
<description>System TTY device name</description> | ||
</valueHelp> | ||
</properties> | ||
</leafNode> | ||
#include <include/interface-disable-link-detect.xml.i> | ||
#include <include/interface-mtu-68-9000.xml.i> | ||
<leafNode name="network"> | ||
<properties> | ||
<help>Carrier network to define dial strings</help> | ||
<completionHelp> | ||
<script>ls /opt/vyatta/share/ppp/network/</script> | ||
</completionHelp> | ||
</properties> | ||
</leafNode> | ||
<leafNode name="no-dns"> | ||
<properties> | ||
<help>Do not use peer supplied DNS server information</help> | ||
</properties> | ||
</leafNode> | ||
<leafNode name="ondemand"> | ||
<properties> | ||
<help>Only dial when traffic is available</help> | ||
</properties> | ||
</leafNode> | ||
</children> | ||
</tagNode> | ||
</children> | ||
</node> | ||
</interfaceDefinition> |
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,83 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Copyright (C) 2020 VyOS maintainers and contributors | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 2 or later as | ||
# published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import os | ||
|
||
from sys import exit | ||
from copy import deepcopy | ||
|
||
from vyos.config import Config | ||
from vyos import ConfigError | ||
|
||
default_config_data = { | ||
'address': [], | ||
'deleted': False, | ||
'description': '', | ||
'disable': False | ||
} | ||
|
||
def get_config(): | ||
wwan = deepcopy(default_config_data) | ||
conf = Config() | ||
|
||
# determine tagNode instance | ||
try: | ||
wwan['intf'] = os.environ['VYOS_TAGNODE_VALUE'] | ||
except KeyError as E: | ||
print("Interface not specified") | ||
|
||
# Check if interface has been removed | ||
if not conf.exists('interfaces wirelessmodem ' + wwan['intf']): | ||
vxlan['deleted'] = True | ||
return vxlan | ||
|
||
# set new configuration level | ||
conf.set_level('interfaces wirelessmodem ' + wwan['intf']) | ||
|
||
tmp = conf.get_config_dict() | ||
|
||
import pprint | ||
pprint.pprint(tmp) | ||
|
||
return wwan | ||
|
||
def verify(wwan): | ||
if wwan is None: | ||
return None | ||
|
||
return None | ||
|
||
def generate(wwan): | ||
if wwan is None: | ||
return None | ||
|
||
return None | ||
|
||
def apply(wwan): | ||
if wwan is None: | ||
return None | ||
|
||
return None | ||
|
||
if __name__ == '__main__': | ||
try: | ||
c = get_config() | ||
verify(c) | ||
generate(c) | ||
apply(c) | ||
except ConfigError as e: | ||
print(e) | ||
exit(1) |