Changeset 7907
- Timestamp:
- 11/09/11 19:12:25 (19 months ago)
- Location:
- luci/trunk/applications/luci-olsr/luasrc
- Files:
-
- 2 added
- 9 modified
-
controller/olsr.lua (modified) (2 diffs)
-
tools (added)
-
tools/olsr.lua (added)
-
view/status-olsr/hna.htm (modified) (2 diffs)
-
view/status-olsr/interfaces.htm (modified) (2 diffs)
-
view/status-olsr/mid.htm (modified) (2 diffs)
-
view/status-olsr/neighbors.htm (modified) (2 diffs)
-
view/status-olsr/overview.htm (modified) (6 diffs)
-
view/status-olsr/routes.htm (modified) (2 diffs)
-
view/status-olsr/smartgw.htm (modified) (3 diffs)
-
view/status-olsr/topology.htm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
luci/trunk/applications/luci-olsr/luasrc/controller/olsr.lua
r7362 r7907 92 92 end 93 93 94 function action_neigh() 94 local function compare_links(a, b) 95 local c = tonumber(a.Cost) 96 local d = tonumber(b.Cost) 97 98 if not c or c == 0 then 99 return false 100 end 101 102 if not d or d == 0 then 103 return true 104 end 105 return c < d 106 end 107 108 function action_neigh(json) 95 109 local data = fetch_txtinfo("links") 96 110 … … 100 114 end 101 115 102 local function compare(a, b) 103 local c = tonumber(a.Cost) 104 local d = tonumber(b.Cost) 105 106 if not c or c == 0 then 107 return false 108 end 109 110 if not d or d == 0 then 111 return true 112 end 113 114 return c < d 115 end 116 117 table.sort(data.Links, compare) 116 table.sort(data.Links, compare_links) 118 117 119 118 luci.template.render("status-olsr/neighbors", {links=data.Links}) -
luci/trunk/applications/luci-olsr/luasrc/view/status-olsr/hna.htm
r6619 r7907 3 3 Copyright 2008 Steven Barth <steven@midlink.org> 4 4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> 5 Copyright 2011 Manuel Munz <freifunk at somakoma dot de> 5 6 6 7 Licensed under the Apache License, Version 2.0 (the "License"); … … 13 14 14 15 -%> 16 <% 17 local i = 1 18 %> 19 15 20 <%+header%> 21 16 22 <h2><a id="content" name="content"><%:Active host net announcements%></a></h2> 17 <p><%:Overview of currently active OLSR host net announcements%></p> 18 <br /> 19 <table class="smalltext" cellspacing="0" cellpadding="6"> 20 <tr> 21 <th><%:Announced network%></th> 22 <th><%:OLSR gateway%></th> 23 </tr> 24 <% for k, route in ipairs(routes) do %> 25 <tr> 26 <td><%=route.Destination%></td> 27 <td> 28 <a href="http://<%=route.Gateway%>/cgi-bin-status.html"><%=route.Gateway%></a> 29 <% if route.Hostname then %> 30 / <a href="http://<%=route.Hostname%>/cgi-bin-status.html"><%=route.Hostname%></a> 31 <% end %> 32 </td> 33 </tr> 34 <% end %> 35 </table> 36 <br /> 23 24 <fieldset class="cbi-section"> 25 <legend><%:Overview of currently active OLSR host net announcements%></legend> 26 <table class="cbi-section-table"> 27 <tr class="cbi-section-table-titles"> 28 <th class="cbi-section-table-cell"><%:Announced network%></th> 29 <th class="cbi-section-table-cell"><%:OLSR gateway%></th> 30 </tr> 31 32 <% for k, route in ipairs(routes) do %> 33 34 <tr class="cbi-section-table-row cbi-rowstyle-<%=i%>"> 35 <td class="cbi-section-table-cell"><%=route.Destination%></td> 36 <td class="cbi-section-table-cell"> 37 <a href="http://<%=route.Gateway%>/cgi-bin-status.html"><%=route.Gateway%></a> 38 <% if route.Hostname then %> 39 / <a href="http://<%=route.Hostname%>/cgi-bin-status.html"><%=route.Hostname%></a> 40 <% end %> 41 </td> 42 </tr> 43 44 <% if i == 1 then i = 0 elseif i == 0 then i = 1 end 45 end %> 46 </table> 47 </fieldset> 37 48 <%+footer%> -
luci/trunk/applications/luci-olsr/luasrc/view/status-olsr/interfaces.htm
r6653 r7907 3 3 Copyright 2008 Steven Barth <steven@midlink.org> 4 4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> 5 Copyright 201 0Manuel Munz <freifunk at somakoma dot de>5 Copyright 2011 Manuel Munz <freifunk at somakoma dot de> 6 6 7 7 Licensed under the Apache License, Version 2.0 (the "License"); … … 14 14 15 15 -%> 16 17 <% 18 local i = 1 19 %> 20 16 21 <%+header%> 22 17 23 <h2><a id="content" name="content"><%:Interfaces%></a></h2> 18 <p><%:Overview of interfaces where OLSR is running%></p>19 <br />20 <table class="smalltext" cellspacing="0" cellpadding="6">21 <tr>22 <th><%:Interface%></th>23 <th><%:State%></th>24 <th><%:MTU%></th>25 <th><%:WLAN%></th>26 <th><%:Source address%></th>27 <th><%:Netmask%></th>28 <th><%:Broadcast address%></th>29 </tr>30 24 31 <% for k, i in ipairs(iface) do %> 32 <tr> 33 <td><%=i.Name%></td> 34 <td><%=i.State%></td> 35 <td><%=i.MTU%></td> 36 <td><%=i.WLAN%></td> 37 <td><%=i["Src-Adress"]%></td> 38 <td><%=i.Mask%></td> 39 <td><%=i["Dst-Adress"]%></td> 40 </tr> 41 <% end %> 25 <fieldset class="cbi-section"> 26 <legend><%:Overview of interfaces where OLSR is running%></legend> 42 27 43 </table> 44 <br /> 28 <table class="cbi-section-table"> 29 <tr> 30 <th class="cbi-section-table-cell"><%:Interface%></th> 31 <th class="cbi-section-table-cell"><%:State%></th> 32 <th class="cbi-section-table-cell"><%:MTU%></th> 33 <th class="cbi-section-table-cell"><%:WLAN%></th> 34 <th class="cbi-section-table-cell"><%:Source address%></th> 35 <th class="cbi-section-table-cell"><%:Netmask%></th> 36 <th class="cbi-section-table-cell"><%:Broadcast address%></th> 37 </tr> 38 39 <% for k, iface in ipairs(iface) do %> 40 41 <tr class="cbi-section-table-row cbi-rowstyle-<%=i%>"> 42 <td class="cbi-section-table-cell"><%=iface.Name%></td> 43 <td class="cbi-section-table-cell"><%=iface.State%></td> 44 <td class="cbi-section-table-cell"><%=iface.MTU%></td> 45 <td class="cbi-section-table-cell"><%=iface.WLAN%></td> 46 <td class="cbi-section-table-cell"><%=iface["Src-Adress"]%></td> 47 <td class="cbi-section-table-cell"><%=iface.Mask%></td> 48 <td class="cbi-section-table-cell"><%=iface["Dst-Adress"]%></td> 49 </tr> 50 <% if i == 1 then i = 0 elseif i == 0 then i = 1 end 51 end %> 52 </table> 53 </fieldset> 45 54 <%+footer%> -
luci/trunk/applications/luci-olsr/luasrc/view/status-olsr/mid.htm
r5448 r7907 3 3 Copyright 2008 Steven Barth <steven@midlink.org> 4 4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> 5 Copyright 2011 Manuel Munz <freifunk at somakoma dot de> 5 6 6 7 Licensed under the Apache License, Version 2.0 (the "License"); … … 13 14 14 15 -%> 16 <% 17 local i = 1 18 %> 19 15 20 <%+header%> 16 21 <h2><a id="content" name="content"><%:Active MID announcements%></a></h2> 17 <p><%:Overview of known multiple interface announcements%></p> 18 <br /> 19 <table class="smalltext" cellspacing="0" cellpadding="6"> 20 <tr> 21 <th><%:OLSR node%></th> 22 <th><%:Secondary OLSR interfaces%></th> 23 </tr> 24 <% for k, mid in ipairs(mids) do %> 25 <tr> 26 <td><a href="http://<%=mid["IP address"]%>"><%=mid["IP address"]%></a></td> 27 <td><%=mid.Aliases%></td> 28 </tr> 29 <% end %> 30 </table> 31 <br /> 22 23 <fieldset class="cbi-section"> 24 <legend><%:Overview of known multiple interface announcements%></legend> 25 <table class="cbi-section-table"> 26 <tr class="cbi-section-table-titles"> 27 <th class="cbi-section-table-cell"><%:OLSR node%></th> 28 <th class="cbi-section-table-cell" ><%:Secondary OLSR interfaces%></th> 29 </tr> 30 31 <% for k, mid in ipairs(mids) do %> 32 33 <tr class="cbi-section-table-row cbi-rowstyle-<%=i%>"> 34 <td class="cbi-section-table-cell"><a href="http://<%=mid["IP address"]%>/cgi-bin-status.html"><%=mid["IP address"]%></a></td> 35 <td class="cbi-section-table-cell"><%=mid.Aliases%></td> 36 </tr> 37 38 <% if i == 1 then i = 0 elseif i == 0 then i = 1 end 39 end %> 40 </table> 41 </fieldset> 32 42 <%+footer%> -
luci/trunk/applications/luci-olsr/luasrc/view/status-olsr/neighbors.htm
r6663 r7907 3 3 Copyright 2008 Steven Barth <steven@midlink.org> 4 4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> 5 5 Copyright 2011 Manuel Munz <freifunk at somakoma dot de> 6 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 7 8 you may not use this file except in compliance with the License. … … 10 11 http://www.apache.org/licenses/LICENSE-2.0 11 12 12 $Id: index.htm 6619 2010-12-05 15:02:44Z soma $ 13 -%> 13 14 14 -%> 15 <% 16 local olsrtools = require "luci.tools.olsr" 17 18 if luci.http.formvalue("status") == "1" then 19 local rv = {} 20 local i = 1 21 22 for k, link in ipairs(links) do 23 link.Cost = tonumber(link.Cost) or 0 24 local color = olsrtools.etx_color(link.Cost) 25 defaultgw_color = "" 26 if link.defaultgw == 1 then 27 defaultgw_color = "#ffff99" 28 end 29 30 rv[#rv+1] = { 31 rip = link["Remote IP"], 32 hn = link["Hostname"], 33 lip = link["Local IP"], 34 dev = link["Local Device"], 35 lq = link.LQ, 36 nlq = link.NLQ, 37 cost = string.format("%.3f", link.Cost), 38 color = color, 39 rs = i, 40 dfgcolor = defaultgw_color 41 } 42 if i == 1 then i = 0 elseif i == 0 then i = 1 end 43 end 44 luci.http.prepare_content("application/json") 45 luci.http.write_json(rv) 46 return 47 end 48 %> 49 15 50 <%+header%> 51 52 <script type="text/javascript" src="<%=resource%>/cbi.js"></script> 53 <script type="text/javascript">//<![CDATA[ 54 55 XHR.poll(10 , '<%=REQUEST_URI%>', { status: 1 }, 56 function(x, info) 57 { 58 var nt = document.getElementById('olsr_neigh_table'); 59 if (nt) 60 { 61 var s = ''; 62 for (var idx = 0; idx < info.length; idx++) 63 { 64 var neigh = info[idx]; 65 66 s += String.format( 67 '<tr class="cbi-section-table-row cbi-rowstyle-%s">' + 68 '<td class="cbi-section-table-cell" style="background-color:%s"><a href="http://%s/cgi-bin-status.html">%s</a></td>', 69 neigh.rs, neigh.dfgcolor, neigh.rip, neigh.rip 70 ); 71 if (neigh.hn) { 72 s += String.format( 73 '<td class="cbi-section-table-cell" style="background-color:%s"><a href="http://%s/cgi-bin-status.html">%s</a></td>', 74 neigh.dfgcolor, neigh.hn, neigh.hn 75 ); 76 } 77 else { 78 s += String.format( 79 '<td class="cbi-section-table-cell" style="background-color:%s">?</td>', 80 neigh.dfgcolor 81 ); 82 } 83 s += String.format( 84 '<td class="cbi-section-table-cell" style="background-color:%s">%s</td>' + 85 '<td class="cbi-section-table-cell" style="background-color:%s">%s</td>' + 86 '<td class="cbi-section-table-cell" style="background-color:%s">%s</td>' + 87 '<td class="cbi-section-table-cell" style="background-color:%s">%s</td>' + 88 '<td class="cbi-section-table-cell" style="background-color:%s">%s</td>' + 89 '</tr>', 90 91 neigh.dfgcolor, neigh.lip, neigh.dfgcolor, neigh.dev, neigh.dfgcolor, neigh.lq, neigh.dfgcolor, neigh.nlq, neigh.color, neigh.cost || '?' 92 ); 93 } 94 95 nt.innerHTML = s; 96 } 97 } 98 ); 99 //]]></script> 100 101 16 102 <h2><a id="content" name="content"><%:OLSR connections%></a></h2> 17 <p><%:Overview of currently established OLSR connections%></p> 103 104 <fieldset class="cbi-section"> 105 <legend><%:Overview of currently established OLSR connections%></legend> 106 107 <table class="cbi-section-table"> 108 <tr class="cbi-section-table-titles"> 109 <th class="cbi-section-table-cell"><%:Neighbour IP%></th> 110 <th class="cbi-section-table-cell"><%:Hostname%></th> 111 <th class="cbi-section-table-cell"><%:Local interface IP%></th> 112 <th class="cbi-section-table-cell"><%:Device%></th> 113 <th class="cbi-section-table-cell">LQ</th> 114 <th class="cbi-section-table-cell">NLQ</th> 115 <th class="cbi-section-table-cell">ETX</th> 116 </tr> 117 118 119 <tbody id="olsr_neigh_table"> 120 <% local i = 1 121 for k, link in ipairs(links) do 122 link.Cost = tonumber(link.Cost) or 0 123 color = olsrtools.etx_color(link.Cost) 124 125 defaultgw_color = "" 126 if link.defaultgw == 1 then 127 defaultgw_color = "#ffff99" 128 end 129 %> 130 131 <tr class="cbi-section-table-row cbi-rowstyle-<%=i%>"> 132 <td class="cbi-section-table-cell" style="background-color:<%=defaultgw_color%>"><a href="http://<%=link["Remote IP"]%>/cgi-bin-status.html"><%=link["Remote IP"]%></a></td> 133 <td class="cbi-section-table-cell" style="background-color:<%=defaultgw_color%>"><a href="http://<%=link["Hostname"]%>/cgi-bin-status.html"><%=link["Hostname"]%></a></td> 134 <td class="cbi-section-table-cell" style="background-color:<%=defaultgw_color%>"><%=link["Local IP"]%></td> 135 <td class="cbi-section-table-cell" style="background-color:<%=defaultgw_color%>"><%=link["Local Device"]%></td> 136 <td class="cbi-section-table-cell" style="background-color:<%=defaultgw_color%>"><%=link.LQ%></td> 137 <td class="cbi-section-table-cell" style="background-color:<%=defaultgw_color%>"><%=link.NLQ%></td> 138 <td class="cbi-section-table-cell" style="background-color:<%=color%>"><%=string.format("%.3f", link.Cost)%></td> 139 </tr> 140 <% 141 if i == 1 then i = 0 elseif i == 0 then i = 1 end 142 end %> 143 </tbody> 144 </table> 18 145 <br /> 19 <table class="smalltext" cellspacing="0" cellpadding="6">20 <tr>21 <th><%:Neighbour IP%></th>22 <th><%:Hostname%></th>23 <th><%:Local interface IP%></th>24 <th><%:Device%></th>25 <th>LQ</th>26 <th>NLQ</th>27 <th>ETX</th>28 </tr>29 <% for k, link in ipairs(links) do30 local color = "#bb3333"31 146 32 link.Cost = tonumber(link.Cost) or 033 if link.Cost == 0 then34 color = "#bb3333"35 elseif link.Cost < 4 then36 color = "#00cc00"37 elseif link.Cost < 10 then38 color = "#ffcb05"39 elseif link.Cost < 100 then40 color = "#ff6600"41 end42 43 defaultgw_color = ""44 if link.defaultgw == 1 then45 defaultgw_color = "#ffff99"46 end47 %>48 <tr>49 <td style="background-color:<%=defaultgw_color%>"><a href="http://<%=link["Remote IP"]%>/cgi-bin-status.html"><%=link["Remote IP"]%></a></td>50 <td style="background-color:<%=defaultgw_color%>"><a href="http://<%=link["Hostname"]%>/cgi-bin-status.html"><%=link["Hostname"]%></a></td>51 <td style="background-color:<%=defaultgw_color%>"><%=link["Local IP"]%></td>52 <td style="background-color:<%=defaultgw_color%>"><%=link["Local Device"]%></td>53 <td style="background-color:<%=defaultgw_color%>"><%=link.LQ%></td>54 <td style="background-color:<%=defaultgw_color%>"><%=link.NLQ%></td>55 <td style="background-color:<%=color%>"><%=string.format("%.3f", link.Cost)%></td>56 </tr>57 <% end %>58 </table>59 <br />60 147 <h3><%:Legend%>:</h3> 61 148 <ul> 62 <li><strong>LQ: </strong><%:Success rate of packages received from the neighbour%></li>63 <li><strong>NLQ: </strong><%:Success rate of packages sent to the neighbour%></li>64 <li><strong>ETX: </strong><%:Expected retransmission count%></li>149 <li><strong>LQ: </strong><%:Success rate of packages received from the neighbour%></li> 150 <li><strong>NLQ: </strong><%:Success rate of packages sent to the neighbour%></li> 151 <li><strong>ETX: </strong><%:Expected retransmission count%></li> 65 152 </ul> 153 </fieldset> 66 154 <%+footer%> -
luci/trunk/applications/luci-olsr/luasrc/view/status-olsr/overview.htm
r6742 r7907 3 3 Copyright 2008 Steven Barth <steven@midlink.org> 4 4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> 5 Copyright 201 0Manuel Munz <freifunk at somakoma dot de>5 Copyright 2011 Manuel Munz <freifunk at somakoma dot de> 6 6 7 7 Licensed under the Apache License, Version 2.0 (the "License"); … … 70 70 local meshfactor = string.format("%.2f", nr_topo / nr_nodes) 71 71 72 if luci.http.formvalue("status") == "1" then 73 rv = { 74 nr_neighbors = nr_neigbors, 75 neighbors = neighbors, 76 interfaces = interfaces, 77 nr_ifaces = nr_ifaces, 78 nr_links = nr_links, 79 nr_topo = nr_topo, 80 nr_nodes = nr_nodes, 81 meshfactor = meshfactor 82 } 83 luci.http.prepare_content("application/json") 84 luci.http.write_json(rv) 85 return 86 end 87 88 72 89 local ipv = luci.model.uci.cursor():get_first("olsrd", "olsrd", "IpVersion", "4") 73 90 … … 105 122 106 123 <%+header%> 124 125 <script type="text/javascript" src="<%=resource%>/cbi.js"></script> 126 <script type="text/javascript">//<![CDATA[ 127 128 XHR.poll(30, '<%=REQUEST_URI%>', { status: 1 }, 129 function(x, info) 130 { 131 var e; 132 133 if (e = document.getElementById('nr_neighbors')) 134 e.innerHTML = info.nr_neighbors; 135 136 if (e = document.getElementById('neighbors')) 137 e.innerHTML = info.neighbors; 138 139 if (e = document.getElementById('nr_ifaces')) 140 e.innerHTML = info.nr_ifaces; 141 142 if (e = document.getElementById('interfaces')) 143 e.innerHTML = info.interfaces; 144 145 if (e = document.getElementById('nr_links')) 146 e.innerHTML = info.nr_links; 147 148 if (e = document.getElementById('nr_topo')) 149 e.innerHTML = info.nr_topo; 150 151 if (e = document.getElementById('nr_nodes')) 152 e.innerHTML = info.nr_nodes; 153 154 if (e = document.getElementById('meshfactor')) 155 e.innerHTML = info.meshfactor; 156 } 157 ); 158 //]]></script> 159 160 107 161 <h2><a id="content" name="content">OLSR <%:Overview%></a></h2> 108 162 … … 112 166 <div class="cbi-value-field"> 113 167 <div style="width: 6em; float:left;"> 114 <a href="<%=luci.dispatcher.build_url("freifunk", "olsr", "interfaces")%>"><%=nr_ifaces%></a> 168 <a href="<%=luci.dispatcher.build_url("freifunk", "olsr", "interfaces")%>"> 169 <span id="nr_ifaces"> 170 <%=nr_ifaces%></a> 171 <span> 115 172 </div> 116 173 <div style="padding-left: 6em;"> 117 <%=interfaces%> 174 <span id="interfaces"> 175 <%=interfaces%> 176 </span> 118 177 </div> 119 178 </div> … … 123 182 <div class="cbi-value-field"> 124 183 <div style="width: 6em; float:left;"> 125 <a href="<%=luci.dispatcher.build_url("freifunk", "olsr", "neighbors")%>"><%=nr_neigh%></a> 184 <a href="<%=luci.dispatcher.build_url("freifunk", "olsr", "neighbors")%>"> 185 <span id="nr_neigh"> 186 <%=nr_neigh%></a> 187 </span> 126 188 </div> 127 189 <div style="padding-left: 6em;"> 128 <%=neighbors%> 190 <span id="neighbors"> 191 <%=neighbors%> 192 </span> 129 193 </div> 130 194 </div> … … 132 196 133 197 <div class="cbi-value"><label class="cbi-value-title"><%:Nodes%></label> 134 <div class="cbi-value-field"><a href="<%=luci.dispatcher.build_url("freifunk", "olsr", "topology")%>"><%=nr_nodes%></a> 198 <div class="cbi-value-field"><a href="<%=luci.dispatcher.build_url("freifunk", "olsr", "topology")%>"> 199 <span id="nr_nodes"> 200 <%=nr_nodes%></a> 201 </span> 135 202 </div> 136 203 </div> 137 204 138 205 <div class="cbi-value"><label class="cbi-value-title"><%:HNA%></label> 139 <div class="cbi-value-field"><a href="<%=luci.dispatcher.build_url("freifunk", "olsr", "hna")%>"><%=nr_hna%></a> 206 <div class="cbi-value-field"><a href="<%=luci.dispatcher.build_url("freifunk", "olsr", "hna")%>"> 207 <span id="nr_hna"> 208 <%=nr_hna%></a> 209 </span> 140 210 </div> 141 211 </div> 142 212 143 213 <div class="cbi-value"><label class="cbi-value-title"><%:Links total%></label> 144 <div class="cbi-value-field"><a href="<%=luci.dispatcher.build_url("freifunk", "olsr", "topology")%>"><%=nr_topo%></a> 214 <div class="cbi-value-field"><a href="<%=luci.dispatcher.build_url("freifunk", "olsr", "topology")%>"> 215 <span id="nr_topo"> 216 <%=nr_topo%></a> 217 </span> 145 218 </div> 146 219 </div> 147 220 148 221 <div class="cbi-value"><label class="cbi-value-title"><%:Links per node (average)%></label> 149 <div class="cbi-value-field"><%=meshfactor%> 222 <div class="cbi-value-field"> 223 <span id="meshfactor"> 224 <%=meshfactor%> 225 </span> 150 226 </div> 151 227 </div> -
luci/trunk/applications/luci-olsr/luasrc/view/status-olsr/routes.htm
r6619 r7907 3 3 Copyright 2008 Steven Barth <steven@midlink.org> 4 4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> 5 Copyright 2011 Manuel Munz <freifunk at somakoma dot de> 5 6 6 7 Licensed under the Apache License, Version 2.0 (the "License"); … … 9 10 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 -%> 11 13 12 $Id$ 14 <% 13 15 14 -%> 16 local olsrtools = require "luci.tools.olsr" 17 local i = 1 18 19 if luci.http.formvalue("status") == "1" then 20 local rv = {} 21 for k, route in ipairs(routes) do 22 rv[#rv+1] = { 23 hostname = route.Hostname, 24 dest = route.Destination, 25 gw = route["Gateway IP"], 26 interface = route.Interface, 27 metric = route.Metric, 28 etx = tonumber(route.ETX), 29 color = olsrtools.etx_color(tonumber(route.ETX)), 30 rs = i 31 } 32 if i == 1 then i = 0 elseif i == 0 then i = 1 end 33 end 34 luci.http.prepare_content("application/json") 35 luci.http.write_json(rv) 36 return 37 end 38 39 %> 40 15 41 <%+header%> 42 43 <script type="text/javascript" src="<%=resource%>/cbi.js"></script> 44 <script type="text/javascript">//<![CDATA[ 45 46 XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 }, 47 function(x, info) 48 { 49 50 var rt = document.getElementById('olsrd_routes'); 51 if (rt) 52 { 53 var s = ''; 54 for (var idx = 0; idx < info.length; idx++) 55 { 56 var route = info[idx]; 57 58 s += String.format( 59 '<tr class="cbi-section-table-row cbi-rowstyle-%s">' + 60 '<td class="cbi-section-table-cell">%s</td>' + 61 '<td class="cbi-section-table-cell">' + 62 '<a href="http://%s/cgi-bin-status.html">%s</a>', 63 route.rs, route.dest, route.gw, route.gw 64 ) 65 66 if (route.hostname) 67 { 68 s += String.format( 69 ' / <a href="http://%s/cgi-bin-status.html">%s</a>', 70 route.hostname, route.hostname || '?' 71 ); 72 } 73 s += String.format( 74 '</td>' + 75 '<td class="cbi-section-table-cell">%s</td>' + 76 '<td class="cbi-section-table-cell">%s</td>' + 77 '<td class="cbi-section-table-cell" style="background-color:%s">%s</td>' + 78 '</tr>', 79 route.interface, route.metric, route.color, route.etx || '?' 80 ); 81 } 82 } 83 rt.innerHTML = s; 84 85 } 86 ); 87 //]]></script> 88 89 90 16 91 <h2><a id="content" name="content"><%:Known OLSR routes%></a></h2> 17 <p><%:Overview of currently known routes to other OLSR nodes%></p>18 <br />19 <table class="smalltext" cellspacing="0" cellpadding="6">20 <tr>21 <th><%:Announced network%></th>22 <th><%:OLSR gateway%></th>23 <th><%:Interface%></th>24 <th><%:Metric%></th>25 <th>ETX</th>26 </tr>27 <% for k, route in ipairs(routes) do28 local color = "#bb3333"29 92 30 route.ETX = tonumber(route.ETX) 31 if route.ETX == 0 then 32 color = "#bb3333" 33 elseif route.ETX < 4 then 34 color = "#00cc00" 35 elseif route.ETX < 10 then 36 color = "#ffcb05" 37 elseif route.ETX < 100 then 38 color = "#ff6600" 39 end 40 %> 41 <tr> 42 <td><%=route.Destination%></td> 43 <td> 44 <a href="http://<%=route["Gateway IP"]%>/cgi-bin-status.html"><%=route["Gateway IP"]%></a> 45 <% if route.Hostname then %> 46 / <a href="http://<%=route.Hostname%>/cgi-bin-status.html"><%=route.Hostname%></a> 47 <% end %> 48 </td> 49 <td><%=route.Interface%></td> 50 <td><%=route.Metric%></td> 51 <td style="background-color:<%=color%>"><%=string.format("%.3f", tonumber(route.ETX) or 0)%></td> 52 </tr> 53 <% end %> 93 <fieldset class="cbi-section"> 94 <legend><%:Overview of currently known routes to other OLSR nodes%></legend> 95 96 <table class="cbi-section-table"> 97 <tr class="cbi-section-table-titles"> 98 <th class="cbi-section-table-cell"><%:Announced network%></th> 99 <th class="cbi-section-table-cell"><%:OLSR gateway%></th> 100 <th class="cbi-section-table-cell"><%:Interface%></th> 101 <th class="cbi-section-table-cell"><%:Metric%></th> 102 <th class="cbi-section-table-cell">ETX</th> 103 </tr> 104 105 <tbody id="olsrd_routes"> 106 107 <% for k, route in ipairs(routes) do 108 color = olsrtools.etx_color(tonumber(route.ETX)) 109 %> 110 111 <tr class="cbi-section-table-row cbi-rowstyle-<%=i%>"> 112 <td class="cbi-section-table-cell"><%=route.Destination%></td> 113 <td class="cbi-section-table-cell"> 114 <a href="http://<%=route["Gateway IP"]%>/cgi-bin-status.html"><%=route["Gateway IP"]%></a> 115 <% if route.Hostname then %> 116 / <a href="http://<%=route.Hostname%>/cgi-bin-status.html"><%=route.Hostname%></a> 117 <% end %> 118 </td> 119 <td class="cbi-section-table-cell"><%=route.Interface%></td> 120 <td class="cbi-section-table-cell"><%=route.Metric%></td> 121 <td class="cbi-section-table-cell" style="background-color:<%=color%>"><%=string.format("%.3f", tonumber(route.ETX) or 0)%></td> 122 </tr> 123 <% 124 if i == 1 then i = 0 elseif i == 0 then i = 1 end 125 end %> 126 </tbody> 54 127 </table> 55 <br /> 128 129 </fieldset> 56 130 <%+footer%> -
luci/trunk/applications/luci-olsr/luasrc/view/status-olsr/smartgw.htm
r6866 r7907 3 3 Copyright 2008 Steven Barth <steven@midlink.org> 4 4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> 5 Copyright 201 0Manuel Munz <freifunk at somakoma dot de>5 Copyright 2011 Manuel Munz <freifunk at somakoma dot de> 6 6 7 7 Licensed under the Apache License, Version 2.0 (the "License"); … … 13 13 14 14 <% 15 local i = 1 15 16 require("luci.model.uci") 16 17 local uci = luci.model.uci.cursor_state() … … 24 25 25 26 <h2><a id="content" name="content"><%:SmartGW announcements%></a></h2> 27 26 28 <% if has_smartgw then %> 27 <p><%:Overview of smart gateways in this network%></p>28 <br />29 <table class="smalltext" cellspacing="0" cellpadding="6">30 <tr>31 <th><%:Gateway%></th>32 <th><%:Status%></th>33 <th><%:ETX%></th>34 <th><%:Hops%></th>35 <th><%:Uplink%></th>36 <th><%:Downlink%></th>37 <th><%:IPv4%></th>38 <th><%:IPv6%></th>39 <th><%:Prefix%></th>40 29 41 </tr> 42 <% for k, gw in ipairs(gws) do %> 43 <tr> 44 <td><a href="http://<%=gw["Gateway IP"]%>/cgi-bin-status.html"><%=gw["Gateway IP"]%></a></td> 45 <td><%=gw.Status%></td> 46 <td><%=gw.ETX%></td> 47 <td><%=gw.Hopcnt%></td> 48 <td><%=gw.Uplink%></td> 49 <td><%=gw.Downlnk%></td> 50 <td><%=gw.IPv4%></td> 51 <td><%=gw.IPv6%></td> 52 <td><%=gw.Prefix%></td> 53 </tr> 54 <% end %> 55 </table> 56 <br /> 30 <fieldset class="cbi-section"> 31 <legend><%:Overview of smart gateways in this network%></legend> 32 <table class="cbi-section-table"> 33 <tr class="cbi-section-table-titles"> 34 <th class="cbi-section-table-cell"><%:Gateway%></th> 35 <th class="cbi-section-table-cell"><%:Status%></th> 36 <th class="cbi-section-table-cell"><%:ETX%></th> 37 <th class="cbi-section-table-cell"><%:Hops%></th> 38 <th class="cbi-section-table-cell"><%:Uplink%></th> 39 <th class="cbi-section-table-cell"><%:Downlink%></th> 40 <th class="cbi-section-table-cell"><%:IPv4%></th> 41 <th class="cbi-section-table-cell"><%:IPv6%></th> 42 <th class="cbi-section-table-cell"><%:Prefix%></th> 43 44 </tr> 45 46 <% for k, gw in ipairs(gws) do %> 47 48 <tr class="cbi-section-table-row cbi-rowstyle-<%=i%>"> 49 <td class="cbi-section-table-cell"><a href="http://<%=gw["Gateway IP"]%>/cgi-bin-status.html"><%=gw["Gateway IP"]%></a></td> 50 <td class="cbi-section-table-cell"><%=gw.Status%></td> 51 <td class="cbi-section-table-cell"><%=gw.ETX%></td> 52 <td class="cbi-section-table-cell"><%=gw.Hopcnt%></td> 53 <td class="cbi-section-table-cell"><%=gw.Uplink%></td> 54 <td class="cbi-section-table-cell"><%=gw.Downlnk%></td> 55 <td class="cbi-section-table-cell"><%=gw.IPv4%></td> 56 <td class="cbi-section-table-cell"><%=gw.IPv6%></td> 57 <td class="cbi-section-table-cell"><%=gw.Prefix%></td> 58 </tr> 59 60 <% if i == 1 then i = 0 elseif i == 0 then i = 1 end 61 end %> 62 </table> 63 </fieldset> 57 64 58 65 <% else %> 59 <%:SmartGateway is not configured on this system.%> 66 67 <%:SmartGateway is not configured on this system.%> 68 60 69 <% end %> 70 61 71 <%+footer%> -
luci/trunk/applications/luci-olsr/luasrc/view/status-olsr/topology.htm
r5448 r7907 3 3 Copyright 2008 Steven Barth <steven@midlink.org> 4 4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> 5 Copyright 2011 Manuel Munz <freifunk at somakoma dot de> 5 6 6 7 Licensed under the Apache License, Version 2.0 (the "License"); … … 13 14 14 15 -%> 16 <% 17 local i = 1 18 local olsrtools = require "luci.tools.olsr" 19 %> 20 15 21 <%+header%> 16 22 <h2><a id="content" name="content"><%:Active OLSR nodes%></a></h2> 17 <p><%:Overview of currently known OLSR nodes%></p> 18 <br /> 19 <table class="smalltext" cellspacing="0" cellpadding="6"> 20 <tr> 21 <th><%:OLSR node%></th> 22 <th><%:Last hop%></th> 23 <th>LQ</th> 24 <th>ILQ</th> 25 <th>ETX</th> 26 </tr> 27 <% for k, route in ipairs(routes) do 28 %> 29 <tr> 30 <td><a href="http://<%=route["Dest. IP"]%>"><%=route["Dest. IP"]%></a></td> 31 <td><a href="http://<%=route["Last hop IP"]%>"><%=route["Last hop IP"]%></a></td> 32 <td><%=route.LQ%></td> 33 <td><%=route.NLQ%></td> 34 <td><%=string.format("%.3f", tonumber(route.Cost) or 0)%></td> 35 </tr> 36 <% end %> 37 </table> 38 <br /> 23 24 <fieldset class="cbi-section"> 25 <legend><%:Overview of currently known OLSR nodes%></legend> 26 <table class="cbi-section-table"> 27 <tr class="cbi-section-table-titles"> 28 <th class="cbi-section-table-cell"><%:OLSR node%></th> 29 <th class="cbi-section-table-cell"><%:Last hop%></th> 30 <th class="cbi-section-table-cell"><%:LQ%></th> 31 <th class="cbi-section-table-cell"><%:NLQ%></th> 32 <th class="cbi-section-table-cell"><%:ETX%></th> 33 </tr> 34 35 <% for k, route in ipairs(routes) do 36 local cost = string.format("%.3f", tonumber(route.Cost) or 0) 37 local color = olsrtools.etx_color(tonumber(cost)) 38 %> 39 40 <tr class="cbi-section-table-row cbi-rowstyle-<%=i%>"> 41 <td class="cbi-section-table-cell"><a href="http://<%=route["Dest. IP"]%>/cgi-bin-status.html"><%=route["Dest. IP"]%></a></td> 42 <td class="cbi-section-table-cell"><a href="http://<%=route["Last hop IP"]%>/cgi-bin-status.html"><%=route["Last hop IP"]%></a></td> 43 <td class="cbi-section-table-cell"><%=route.LQ%></td> 44 <td class="cbi-section-table-cell"><%=route.NLQ%></td> 45 <td class="cbi-section-table-cell" style="background-color:<%=color%>"><%=cost%></td> 46 </tr> 47 48 <% if i == 1 then i = 0 elseif i == 0 then i = 1 end 49 end %> 50 </table> 51 </fieldset> 52 39 53 <%+footer%>
