luci/applications/luci-app-dawn/luasrc/model/cbi/dawn/dawn_network.lua
Polynomialdivision 9707acf72f luci-app-dawn: add luci app for dawn
Dawn is a decentralized WiFi controller.
Just install dawn and the APs will find each other via umdns. They
periodically exchange information about connected clients, wireless
statistics and other needed information. With that, the daemon load
balances clients between different APs through association control.

Luci-app-dawn is the graphical user interface.
It allows to:
- Configure dawn
- View Wireless Network Overview
- View Hearing Map

The hearing map is the list of all probe requests seen from a client
from all APs that are running the controller.

Signed-off-by: Nick Hainke <vincent@systemli.org>
2020-04-02 11:12:01 +02:00

92 lines
No EOL
2.4 KiB
Lua

m = Map("Network Overview", translate("Network Overview"))
m.pageaction = false
s = m:section(NamedSection, "__networkoverview__")
function s.render(self, sid)
local tpl = require "luci.template"
local json = require "luci.json"
local utl = require "luci.util"
tpl.render_string([[
<table class="table" style="border: 1px solid grey;">
<thead style="background-color: grey; color: white;">
<tr>
<th>SSID</th>
<th>MAC</th>
<th>Channel Utilization</th>
<th>Frequency</th>
<th>Stations</th>
<th>HT Sup</th>
<th>VHT Sup</th>
</tr>
</thead>
<tbody>
<%
local status = require "luci.tools.ieee80211"
local utl = require "luci.util"
local sys = require "luci.sys"
local hosts = sys.net.host_hints()
local stat = utl.ubus("dawn", "get_network", { })
local name, macs
for name, macs in pairs(stat) do
local mac, data
for mac, data in pairs(macs) do
%>
<tr class="center">
<td><%= name %></td>
<td><%= mac %></td>
<td><%= "%.2f" %(data.channel_utilization / 2.55) %> %</td>
<td><%= "%.3f" %( data.freq / 1000 ) %> GHz (Channel: <%= "%d" %( status.frequency_to_channel(data.freq) ) %>)</td>
<td><%= "%d" %data.num_sta %></td>
<td><%= (data.ht_support == true) and "available" or "not available" %></td>
<td><%= (data.vht_support == true) and "available" or "not available" %></td>
</tr>
<tr>
<td colspan="7"><hr></td>
</tr>
<tr>
<td colspan="2" class="center"><strong>Clients</strong></td>
<td colspan="4">
<table class="table" style="border: 1px solid grey;">
<thead style="background-color: grey; color: white;">
<tr>
<th>MAC</th>
<th>HT</th>
<th>VHT</th>
<th>Signal</th>
</tr>
</thead>
<tbody>
<%
local mac2, data2
for clientmac, clientvals in pairs(data) do
if (type(clientvals) == "table") then
%>
<tr class="center">
<td><%= clientmac %></td>
<td><%= (clientvals.ht == true) and "available" or "not available" %></td>
<td><%= (clientvals.vht == true) and "available" or "not available" %></td>
<td><%= "%d" %clientvals.signal %></td>
</tr>
<%
end
end
%>
</tbody>
</table>
</tr>
<tr>
<td colspan="7"><hr></td>
</tr>
<%
end
%>
<%
end
%>
</tbody>
</table>
]])
end
return m