Developing lightweight computation at the DSG edge

Commit 6b407980 authored by p4u's avatar p4u
Browse files

Added HNAs in Neighbours tab

parent c192d07e
......@@ -112,6 +112,7 @@ function action_neighbours()
local desc = nil
local orig = nil
local name = ""
local ipv4 = ""
for _,o in ipairs(orig_list) do
orig = bmx6json.get("originators/"..o.name) or {}
......@@ -123,7 +124,15 @@ function action_neighbours()
name = o.name
end
table.insert(originators,{name=name,orig=orig,desc=desc})
for _,h in ipairs(desc.DESC_ADV.extensions[2].HNA6_EXTENSION) do
if h ~= nil and string.find(h.address,"::ffff:") then
ipv4=string.gsub(h.address,"::ffff:","")
end
end
table.insert(originators,{name=name,ipv4=ipv4,orig=orig,desc=desc})
end
luci.template.render("bmx6/neighbours", {originators=originators})
......
......@@ -40,7 +40,8 @@
<table>
<tr>
<th scope="col">Name</th>
<th scope="col">IP</th>
<th scope="col">IPv4</th>
<th scope="col">IPv6</th>
<th scope="col">Via Dev</th>
<th scope="col">Via IP</th>
<th scope="col">Routes</th>
......@@ -50,10 +51,10 @@
</tr>
<% for i,o in ipairs(originators) do %>
<% if #o.orig.viaIp > 2 then %>
<tr>
<td><%=o.name%></td>
<td><%=o.orig.primaryIp%></td>
<td><a href="http://<%=o.ipv4%>"><%=o.ipv4%></a></td>
<td><a href="http://[<%=o.orig.primaryIp%>]"><%=o.orig.primaryIp%></a></td>
<td><%=o.orig.viaDev%></td>
<td><%=o.orig.viaIp%></td>
<td><%=o.orig.routes%></td>
......@@ -61,9 +62,26 @@
<td><%=o.orig.lastDesc%></td>
<td><%=o.orig.lastRef%></td>
</tr>
<%end%>
<%end%>
</table>
<table>
<tr>
<th scope="col">Node</th>
<th scope="col">Announced networks</th>
</tr>
<% for i,o in ipairs(originators) do %>
<tr>
<td><%=o.name%></td>
<td>
<% for j,h in ipairs(o.desc.DESC_ADV.extensions[2].HNA6_EXTENSION) do %>
<%=h.address%>&nbsp;&nbsp;&nbsp;&nbsp;
<% end %>
</td>
</tr>
<% end %>
</table>
<br />
<%+footer%>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment