-
Notifications
You must be signed in to change notification settings - Fork 2.9k
luci-proto-openthread: add protocol support for the border router #8942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LorbusChris
wants to merge
1
commit into
openwrt:master
Choose a base branch
from
LorbusChris:luci-proto-openthread
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,13 @@ | ||
| # This is free software, licensed under the Apache License, Version 2.0 . | ||
|
|
||
| include $(TOPDIR)/rules.mk | ||
|
|
||
| LUCI_TITLE:=Support for the Thread border router protocol | ||
| LUCI_DEPENDS:=+openthread-br | ||
|
|
||
| PKG_MAINTAINER:=Christian Glombek <c.glombek@cosa.systems> | ||
| PKG_LICENSE:=Apache-2.0 | ||
|
|
||
| include ../../luci.mk | ||
|
|
||
| # call BuildPackage - OpenWrt buildroot signature | ||
97 changes: 97 additions & 0 deletions
97
protocols/luci-proto-openthread/htdocs/luci-static/resources/protocol/openthread.js
This file contains hidden or 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,97 @@ | ||
| 'use strict'; | ||
| 'require form'; | ||
| 'require network'; | ||
| 'require tools.widgets as widgets'; | ||
|
|
||
| // The Thread radio is a tun-like netdev with no DEVTYPE in sysfs, so the | ||
| // generic Device class falls back to the ethernet icon. Own the device | ||
| // instances (same pattern as luci-proto-relay) so the interface list shows | ||
| // a wireless icon and a meaningful type. | ||
| var ThreadDevice = { | ||
| getType: function() { | ||
| return 'wifi'; | ||
| }, | ||
|
|
||
| getTypeI18n: function() { | ||
| return _('Thread Radio'); | ||
| } | ||
| }; | ||
|
|
||
| function threadDev(proto, name) { | ||
| var m = name ? name.match(/^([^:/]+)/) : null; | ||
| return m ? network.instantiateDevice(m[1], proto, ThreadDevice) : null; | ||
| } | ||
|
|
||
| network.registerErrorCode('MISSING_BACKBONE_NETWORK', _('Backbone network is not configured')); | ||
| network.registerErrorCode('MISSING_BACKBONE_IFNAME', _('Unable to determine the backbone network device')); | ||
| network.registerErrorCode('MISSING_DEVICE', _('Thread network device is not configured')); | ||
| network.registerErrorCode('MISSING_RADIO_URL', _('Radio URL is not configured')); | ||
| network.registerErrorCode('MISSING_SVC_MDNSD', _('The mdnsd service is not running')); | ||
| network.registerErrorCode('MISSING_UBUS_OBJ', _('Unable to reach the otbr ubus object')); | ||
|
|
||
| return network.registerProtocol('openthread', { | ||
|
LorbusChris marked this conversation as resolved.
|
||
| getI18n: function() { | ||
| return _('Thread'); | ||
| }, | ||
|
|
||
| getDevice: function() { | ||
| return threadDev(this, this._get('device')); | ||
| }, | ||
|
|
||
| getL2Device: function() { | ||
| return threadDev(this, this._ubus('device')); | ||
| }, | ||
|
|
||
| getL3Device: function() { | ||
| return threadDev(this, this._ubus('l3_device')); | ||
| }, | ||
|
|
||
| getPackageName: function() { | ||
| return 'openthread-br'; | ||
| }, | ||
|
|
||
| renderFormOptions: function(s) { | ||
| var o; | ||
|
|
||
| o = s.taboption('general', widgets.NetworkSelect, 'backbone_network', | ||
| _('Backbone network'), | ||
| _('The network whose interface carries mDNS, TREL and border routing for the Thread mesh; usually the LAN.')); | ||
| o.exclude = s.section; | ||
| o.nocreate = true; | ||
| o.rmempty = false; | ||
|
|
||
| // no_device makes this protocol virtual, so the stock device picker | ||
| // is inactive here -- and an inactive picker deletes the option on | ||
| // save. Aliasing an own option onto `device` keeps the field | ||
| // editable and, through the sibling-alias guard in | ||
| // AbstractValue.remove(), stops the picker from unsetting it. | ||
| o = s.taboption('general', form.Value, '_thread_device', | ||
| _('Thread network device'), | ||
| _('Name of the network device otbr-agent creates for the Thread interface.')); | ||
| o.ucioption = 'device'; | ||
| o.rmempty = false; | ||
| o.placeholder = 'wpan0'; | ||
|
LorbusChris marked this conversation as resolved.
|
||
|
|
||
| o = s.taboption('general', form.Value, 'radio_url', | ||
| _('Radio URL'), | ||
| _('How otbr-agent reaches the 802.15.4 radio.')); | ||
| o.rmempty = false; | ||
| o.placeholder = 'spinel+hdlc+uart:///dev/ttyACM0?uart-baudrate=460800'; | ||
|
LorbusChris marked this conversation as resolved.
|
||
|
|
||
| o = s.taboption('advanced', form.Value, 'dataset', | ||
| _('Operational dataset'), | ||
| _('Hex-encoded active operational dataset committed at startup. Usually left empty: the network is formed or joined from the OpenThread application instead.')); | ||
| o.optional = true; | ||
| o.datatype = 'hexstring'; | ||
|
LorbusChris marked this conversation as resolved.
|
||
| o.password = true; | ||
|
|
||
| o = s.taboption('advanced', form.DynamicList, 'prefix', | ||
| _('On-mesh prefixes'), | ||
| _('Prefixes announced to the Thread network.')); | ||
| o.optional = true; | ||
|
|
||
| o = s.taboption('advanced', form.Flag, 'verbose', | ||
| _('Verbose logging')); | ||
| o.optional = true; | ||
| } | ||
| }); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.