From 1bb4822dca6113f73e3bc89e2acf15935e6f8e92 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 3 Dec 2014 15:17:05 +0100 Subject: Rework LuCI build system * Rename subdirectories to their repective OpenWrt package names * Make each LuCI module its own standalone package * Deploy a shared luci.mk which is used by each module Makefile Signed-off-by: Jo-Philipp Wich --- .../luasrc/view/status-olsr/common_js.htm | 35 ++++ .../luasrc/view/status-olsr/error_olsr.htm | 17 ++ .../luci-app-olsr/luasrc/view/status-olsr/hna.htm | 129 ++++++++++++ .../luasrc/view/status-olsr/interfaces.htm | 57 ++++++ .../luasrc/view/status-olsr/legend.htm | 24 +++ .../luci-app-olsr/luasrc/view/status-olsr/mid.htm | 58 ++++++ .../luasrc/view/status-olsr/neighbors.htm | 181 +++++++++++++++++ .../luasrc/view/status-olsr/overview.htm | 220 +++++++++++++++++++++ .../luasrc/view/status-olsr/routes.htm | 148 ++++++++++++++ .../luasrc/view/status-olsr/smartgw.htm | 158 +++++++++++++++ .../luasrc/view/status-olsr/topology.htm | 68 +++++++ 11 files changed, 1095 insertions(+) create mode 100644 applications/luci-app-olsr/luasrc/view/status-olsr/common_js.htm create mode 100644 applications/luci-app-olsr/luasrc/view/status-olsr/error_olsr.htm create mode 100644 applications/luci-app-olsr/luasrc/view/status-olsr/hna.htm create mode 100644 applications/luci-app-olsr/luasrc/view/status-olsr/interfaces.htm create mode 100644 applications/luci-app-olsr/luasrc/view/status-olsr/legend.htm create mode 100644 applications/luci-app-olsr/luasrc/view/status-olsr/mid.htm create mode 100644 applications/luci-app-olsr/luasrc/view/status-olsr/neighbors.htm create mode 100644 applications/luci-app-olsr/luasrc/view/status-olsr/overview.htm create mode 100644 applications/luci-app-olsr/luasrc/view/status-olsr/routes.htm create mode 100644 applications/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm create mode 100644 applications/luci-app-olsr/luasrc/view/status-olsr/topology.htm (limited to 'applications/luci-app-olsr/luasrc/view/status-olsr') diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/common_js.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/common_js.htm new file mode 100644 index 0000000000..1ee763e119 --- /dev/null +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/common_js.htm @@ -0,0 +1,35 @@ +<% if has_v4 and has_v6 then %> + +<%end %> diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/error_olsr.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/error_olsr.htm new file mode 100644 index 0000000000..2c872fa5a2 --- /dev/null +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/error_olsr.htm @@ -0,0 +1,17 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +-%> +<%+header%> +

<%:OLSR Daemon%>

+

<%:Unable to connect to the OLSR daemon!%>

+

<%:Make sure that OLSRd is running, the "jsoninfo" plugin is loaded, configured on port 9090 and accepts connections from "127.0.0.1".%>

+<%+footer%> diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/hna.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/hna.htm new file mode 100644 index 0000000000..689bafdfae --- /dev/null +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/hna.htm @@ -0,0 +1,129 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich +Copyright 2011 Manuel Munz + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +-%> + +<% +local i = 1 + +if luci.http.formvalue("status") == "1" then + local rv = {} + for k, hna in ipairs(hna) do + rv[#rv+1] = { + proto = hna["proto"], + destination = hna["destination"], + genmask = hna["genmask"], + gateway = hna["gateway"], + hostname = hna["hostname"], + validityTime = hna["validityTime"] + } + end + luci.http.prepare_content("application/json") + luci.http.write_json(rv) + return +end +%> + +<%+header%> + + + + +

<%:Active host net announcements%>

+ +
+
+ + <%:Overview of currently active OLSR host net announcements%> + + + + + + + + + + + <% for k, route in ipairs(hna) do %> + + + + + <% if hna[k].validityTime then + validity = hna[k].validityTime .. 's' + else + validity = '-' + end %> + + + + + <% i = ((i % 2) + 1) + end %> + +
<%:Announced network%><%:OLSR gateway%><%:Validity Time%>
<%=hna[k].destination%>/<%=hna[k].genmask%> + <% if hna[k].proto == '6' then %> + <%=hna[k].gateway%> + <% else %> + <%=hna[k].gateway%> + <% end %> + <% if hna[k].hostname then %> + / <%=hna[k].hostname%> + <% end %> + <%=validity%>
+
+ +<%+status-olsr/common_js%> +<%+footer%> diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/interfaces.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/interfaces.htm new file mode 100644 index 0000000000..dd1a21ea6d --- /dev/null +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/interfaces.htm @@ -0,0 +1,57 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich +Copyright 2011 Manuel Munz + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +-%> + +<% +local i = 1 +%> + +<%+header%> + +

<%:Interfaces%>

+ +
+ +
+ <%:Overview of interfaces where OLSR is running%> + + + + + + + + + + + + + <% for k, iface in ipairs(iface) do %> + + + + + + + + + + + <% i = ((i % 2) + 1) + end %> +
<%:Interface%><%:State%><%:MTU%><%:WLAN%><%:Source address%><%:Netmask%><%:Broadcast address%>
<%=iface.name%><%=iface.state%><%=iface.olsrMTU%><%=iface.wireless and luci.i18n.translate('yes') or luci.i18n.translate('no')%><%=iface.ipv4Address or iface.ipv6Address%><%=iface.netmask%><%=iface.broadcast or iface.multicast%>
+
+<%+status-olsr/common_js%> +<%+footer%> + + diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/legend.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/legend.htm new file mode 100644 index 0000000000..2f598489dc --- /dev/null +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/legend.htm @@ -0,0 +1,24 @@ +

<%:Legend%>:

+
    +
  • LQ: <%:Success rate of packages received from the neighbour%>
  • +
  • NLQ: <%:Success rate of packages sent to the neighbour%>
  • +
  • ETX: <%:Expected retransmission count%>
  • +
  • +
      +
    • <%:Green%>:<%:Very good (ETX < 2)%>
    • +
    • <%:Yellow%>:<%:Good (2 < ETX < 4)%>
    • +
    • <%:Orange%>:<%:Still usable (4 < ETX < 10)%>
    • +
    • <%:Red%>:<%:Bad (ETX > 10)%>
    • +
    +
  • +
  • SNR: <%:Signal Noise Ratio in dB%>
  • +
  • +
      +
    • <%:Green%>:<%:Very good (SNR > 30)%>
    • +
    • <%:Yellow%>:<%:Good (30 > SNR > 20)%>
    • +
    • <%:Orange%>:<%:Still usable (20 > SNR > 5)%>
    • +
    • <%:Red%>:<%:Bad (SNR < 5)%>
    • +
    +
  • +
+ diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/mid.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/mid.htm new file mode 100644 index 0000000000..ec5caaa953 --- /dev/null +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/mid.htm @@ -0,0 +1,58 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich +Copyright 2011 Manuel Munz + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ + +-%> +<% +local i = 1 +%> + +<%+header%> +

<%:Active MID announcements%>

+ +
+
+ <%:Overview of known multiple interface announcements%> + + + + + + + <% for k, mid in ipairs(mids) do + local aliases = '' + for k,v in ipairs(mid.aliases) do + if aliases == '' then + sep = '' + else + sep = ', ' + end + aliases = v.ipAddress .. sep .. aliases + end + local host = mid.ipAddress + if mid.proto == '6' then + host = '[' .. mid.ipAddress .. ']' + end + %> + + + + + + + <% i = ((i % 2) + 1) + end %> +
<%:OLSR node%><%:Secondary OLSR interfaces%>
<%=mid.ipAddress%><%=aliases%>
+
+<%+status-olsr/common_js%> +<%+footer%> diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/neighbors.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/neighbors.htm new file mode 100644 index 0000000000..daa52831f6 --- /dev/null +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/neighbors.htm @@ -0,0 +1,181 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich +Copyright 2011 Manuel Munz + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +-%> + +<% +local olsrtools = require "luci.tools.olsr" +local i = 1 + +if luci.http.formvalue("status") == "1" then + local rv = {} + for k, link in ipairs(links) do + link.linkCost = tonumber(link.linkCost)/1024 or 0 + if link.linkCost == 4096 then + link.linkCost = 0 + end + local color = olsrtools.etx_color(link.linkCost) + local snr_color = olsrtools.snr_color(link.snr) + defaultgw_color = "" + if link.defaultgw == 1 then + defaultgw_color = "#ffff99" + end + + rv[#rv+1] = { + rip = link.remoteIP, + hn = link.hostname, + lip = link.localIP, + ifn = link.interface, + lq = string.format("%.3f", link.linkQuality), + nlq = string.format("%.3f",link.neighborLinkQuality), + cost = string.format("%.3f", link.linkCost), + snr = link.snr, + signal = link.signal, + noise = link.noise, + color = color, + snr_color = snr_color, + dfgcolor = defaultgw_color, + proto = link.proto + } + end + luci.http.prepare_content("application/json") + luci.http.write_json(rv) + return +end +%> + +<%+header%> + + + + + +

<%:OLSR connections%>

+ +
+ +
+ <%:Overview of currently established OLSR connections%> + + + + + + + + + + + + + + + + + <% local i = 1 + for k, link in ipairs(links) do + link.linkCost = tonumber(link.linkCost)/1024 or 0 + if link.linkCost == 4096 then + link.linkCost = 0 + end + + color = olsrtools.etx_color(link.linkCost) + snr_color = olsrtools.snr_color(link.snr) + + if link.snr == 0 then + link.snr = '?' + end + + defaultgw_color = "" + if link.defaultgw == 1 then + defaultgw_color = "#ffff99" + end + %> + + + <% if link.proto == "6" then %> + + <% else %> + + <% end %> + + + + + + + + + <% + i = ((i % 2) + 1) + end %> + +
<%:Neighbour IP%><%:Hostname%><%:Interface%><%:Local interface IP%>LQNLQETXSNR
<%=link.remoteIP%><%=link.remoteIP%><%=link.hostname%><%=link.interface%><%=link.localIP%><%=string.format("%.3f", link.linkQuality)%><%=string.format("%.3f", link.neighborLinkQuality)%><%=string.format("%.3f", link.linkCost)%><%=link.snr%>
+
+ +<%+status-olsr/legend%> +
+<%+status-olsr/common_js%> +<%+footer%> diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/overview.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/overview.htm new file mode 100644 index 0000000000..6d8eca874a --- /dev/null +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/overview.htm @@ -0,0 +1,220 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich +Copyright 2011 Manuel Munz + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 +-%> + +<% +local ipv = luci.model.uci.cursor():get_first("olsrd", "olsrd", "IpVersion", "4") + +function write_conf(conf, file) + local fs = require "luci.fs" + if fs.access(conf) then + luci.http.header("Content-Disposition", "attachment; filename="..file) + luci.http.prepare_content("text/plain") + luci.http.write(fs.readfile(conf)) + end +end + +conf = luci.http.formvalue() + +if conf.openwrt then + write_conf("/etc/config/olsrd", "olsrd") + return false +end + +if conf.conf_v4 then + write_conf("/var/etc/olsrd.conf.ipv4", "olsrd.conf.ipv4") + return false +end + +if conf.conf_v6 then + write_conf("/var/etc/olsrd.conf.ipv6", "olsrd.conf.ipv6") + return false +end + +if conf.conf then + write_conf("/var/etc/olsrd.conf", "olsrd.conf") + return false +end + +%> + +<%+header%> + + + + + +
+ +

OLSR <%:Overview%>

+ +
+ <%:Network%> + + + + + + + + + + +
<%:Interfaces%> + + - + +
<%:Neighbors%> + + - + +
<%:Nodes%> + + - + +
<%:HNA%> + + - + +
<%:Links total%> + + - + +
<%:Links per node (average)%> + - +
+
+ + +
+ OLSR <%:Configuration%> + + + +
<%:Version%> + - +
<%:Download Config%> + OpenWrt, + <% if ipv == "6and4" then %> + OLSRD IPv4, + OLSRD IPv6 + <% else %> + OLSRD + <% end %> +
+
+ +<%+footer%> diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/routes.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/routes.htm new file mode 100644 index 0000000000..76e1b1078b --- /dev/null +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/routes.htm @@ -0,0 +1,148 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich +Copyright 2011 Manuel Munz + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 +-%> + +<% + +local olsrtools = require "luci.tools.olsr" +local i = 1 + +if luci.http.formvalue("status") == "1" then + local rv = {} + for k, route in ipairs(routes) do + local ETX = string.format("%.3f", tonumber(route.rtpMetricCost)/1024 or 0) + rv[#rv+1] = { + hostname = route.hostname, + dest = route.destination, + genmask = route.genmask, + gw = route.gateway, + interface = route.networkInterface, + metric = route.metric, + etx = ETX, + color = olsrtools.etx_color(tonumber(ETX)) + } + end + luci.http.prepare_content("application/json") + luci.http.write_json(rv) + return +end + +%> + +<%+header%> + + + + + + +

<%:Known OLSR routes%>

+ +
+ +
+<%:Overview of currently known routes to other OLSR nodes%> + + + + + + + + + + + + + + + <% for k, route in ipairs(routes) do + ETX = tonumber(route.rtpMetricCost)/1024 or '0' + color = olsrtools.etx_color(ETX) + %> + + + + + + + + + <% + i = ((i % 2) + 1) + end %> + +
<%:Announced network%><%:OLSR gateway%><%:Interface%><%:Metric%>ETX
<%=route.destination%>/<%=route.genmask%> + <% if route.proto == '6' then %> + <%=route.gateway%> + <% else %> + <%=route.gateway%> + <% end %> + <% if route.hostname then %> + / <%=route.hostname%> + <% end %> + <%=route.networkInterface%><%=route.metric%><%=string.format("%.3f", ETX)%>
+ +<%+status-olsr/legend%> +
+<%+status-olsr/common_js%> +<%+footer%> diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm new file mode 100644 index 0000000000..75d0c1c2fb --- /dev/null +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm @@ -0,0 +1,158 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich +Copyright 2011 Manuel Munz + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 +-%> + +<% +local i = 1 +require("luci.model.uci") +local uci = luci.model.uci.cursor_state() + +uci:foreach("olsrd", "olsrd", function(s) + if s.SmartGateway and s.SmartGateway == "yes" then has_smartgw = true end +end) + + +if luci.http.formvalue("status") == "1" then + local rv = {} + for k, gw in ipairs(gws) do + gw.tcPathCost = tonumber(gw.tcPathCost)/1024 or 0 + if gw.tcPathCost == 4096 then + gw.tcPathCost = 0 + end + + rv[#rv+1] = { + proto = gw.proto, + ipAddress = gw.ipAddress, + status = gw.ipv4Status or gw.ipv6Status, + tcPathCost = string.format("%.3f", gw.tcPathCost), + hopCount = gw.hopCount, + uplinkSpeed = gw.uplinkSpeed, + downlinkSpeed = gw.downlinkSpeed, + v4 = gw.ipv4 and luci.i18n.translate('yes') or luci.i18n.translate('no'), + v6 = gw.ipv6 and luci.i18n.translate('yes') or luci.i18n.translate('no'), + externalPrefix = gw.externalPrefix + } + end + luci.http.prepare_content("application/json") + luci.http.write_json(rv) + return +end +%> + +<%+header%> + + + + + +<%+header%> + +

<%:SmartGW announcements%>

+ +
+ +<% if has_smartgw then %> + +
+ <%:Overview of smart gateways in this network%> + + + + + + + + + + + + + + + + + + <% for k, gw in ipairs(gws) do + + gw.tcPathCost = tonumber(gw.tcPathCost)/1024 or 0 + if gw.tcPathCost == 4096 then + gw.tcPathCost = 0 + end + %> + + + <% if gw.proto == '6' then %> + + <% else %> + + <% end %> + + + + + + + + + + + + <% i = ((i % 2) + 1) + end %> + +
<%:Gateway%><%:Status%><%:ETX%><%:Hops%><%:Uplink%><%:Downlink%><%:IPv4%><%:IPv6%><%:Prefix%>
<%=gw.ipAddress%><%=gw.ipAddress%><%=gw.ipv4Status or gw.ipv6Status or '-' %><%=string.format("%.3f", gw.tcPathCost)%><%=gw.hopCount%><%=gw.uplinkSpeed%><%=gw.downlinkSpeed%><%=gw.ipv4 and luci.i18n.translate('yes') or luci.i18n.translate('no')%><%=gw.ipv6 and luci.i18n.translate('yes') or luci.i18n.translate('no')%><%=gw.externalPrefix%>
+
+ +<% else %> + + <%:SmartGateway is not configured on this system.%> + +<% end %> + +<%+status-olsr/common_js%> +<%+footer%> diff --git a/applications/luci-app-olsr/luasrc/view/status-olsr/topology.htm b/applications/luci-app-olsr/luasrc/view/status-olsr/topology.htm new file mode 100644 index 0000000000..eb3df5ff51 --- /dev/null +++ b/applications/luci-app-olsr/luasrc/view/status-olsr/topology.htm @@ -0,0 +1,68 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich +Copyright 2011 Manuel Munz + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +-%> +<% +local i = 1 +local olsrtools = require "luci.tools.olsr" +%> + +<%+header%> +

<%:Active OLSR nodes%>

+ +
+ +
+ <%:Overview of currently known OLSR nodes%> + + + + + + + + + + <% for k, route in ipairs(routes) do + local cost = string.format("%.3f", tonumber(route.tcEdgeCost/1024) or 0) + local color = olsrtools.etx_color(tonumber(cost)) + local lq = string.format("%.3f", tonumber(route.linkQuality) or 0) + local nlq = string.format("%.3f", tonumber(route.neighborLinkQuality) or 0) + %> + + + + <% if route.proto == "6" then %> + + + + + <% else %> + + + + + <%end%> + + + + + + + <% i = ((i % 2) + 1) + end %> +
<%:OLSR node%><%:Last hop%><%:LQ%><%:NLQ%><%:ETX%>
<%=route.destinationIP%><%=route.lastHopIP%><%=route.destinationIP%><%=route.lastHopIP%><%=lq%><%=nlq%><%=cost%>
+<%+status-olsr/legend%> +
+ +<%+status-olsr/common_js%> +<%+footer%> -- cgit v1.2.3