topology.htm 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <%#
  2. Copyright 2008 Steven Barth <steven@midlink.org>
  3. Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
  4. Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
  5. Licensed to the public under the Apache License 2.0.
  6. -%>
  7. <%
  8. local i = 1
  9. local olsrtools = require "luci.tools.olsr"
  10. %>
  11. <%+header%>
  12. <h2 name="content"><%:Active OLSR nodes%></h2>
  13. <div id="togglebuttons"></div>
  14. <fieldset class="cbi-section">
  15. <legend><%:Overview of currently known OLSR nodes%></legend>
  16. <table class="cbi-section-table">
  17. <tr class="cbi-section-table-titles">
  18. <th class="cbi-section-table-cell"><%:OLSR node%></th>
  19. <th class="cbi-section-table-cell"><%:Last hop%></th>
  20. <th class="cbi-section-table-cell"><%:LQ%></th>
  21. <th class="cbi-section-table-cell"><%:NLQ%></th>
  22. <th class="cbi-section-table-cell"><%:ETX%></th>
  23. </tr>
  24. <% for k, route in ipairs(routes) do
  25. local cost = string.format("%.3f", tonumber(route.tcEdgeCost/1024) or 0)
  26. local color = olsrtools.etx_color(tonumber(cost))
  27. local lq = string.format("%.3f", tonumber(route.linkQuality) or 0)
  28. local nlq = string.format("%.3f", tonumber(route.neighborLinkQuality) or 0)
  29. %>
  30. <tr class="cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=route.proto%>">
  31. <% if route.proto == "6" then %>
  32. <td class="cbi-section-table-cell"><a href="http://[<%=route.destinationIP%>]/cgi-bin-status.html"><%=route.destinationIP%></a></td>
  33. <td class="cbi-section-table-cell"><a href="http://[<%=route.lastHopIP%>]/cgi-bin-status.html"><%=route.lastHopIP%></a></td>
  34. <% else %>
  35. <td class="cbi-section-table-cell"><a href="http://<%=route.destinationIP%>/cgi-bin-status.html"><%=route.destinationIP%></a></td>
  36. <td class="cbi-section-table-cell"><a href="http://<%=route.lastHopIP%>/cgi-bin-status.html"><%=route.lastHopIP%></a></td>
  37. <%end%>
  38. <td class="cbi-section-table-cell"><%=lq%></td>
  39. <td class="cbi-section-table-cell"><%=nlq%></td>
  40. <td class="cbi-section-table-cell" style="background-color:<%=color%>"><%=cost%></td>
  41. </tr>
  42. <% i = ((i % 2) + 1)
  43. end %>
  44. </table>
  45. <%+status-olsr/legend%>
  46. </fieldset>
  47. <%+status-olsr/common_js%>
  48. <%+footer%>