diff --git a/frontend/src/resultsView.js b/frontend/src/resultsView.js
index 273f847..aba6522 100644
--- a/frontend/src/resultsView.js
+++ b/frontend/src/resultsView.js
@@ -24,24 +24,24 @@ const resultTemplate = (result, havePeerColumn) => html`
${result.med} |
${result.local_pref} |
- ${result?.resolved_nexthop?.ReverseDns !== undefined
- ? html`${result?.resolved_nexthop?.ReverseDns}`
+ ${result?.nexthop_resolved?.ReverseDns !== undefined
+ ? html`${result?.nexthop_resolved?.ReverseDns}`
: html`${result.nexthop}`}
|
${result.state} |
`;
-const resultsTemplate = (query, results, done) => html`
+const resultsTemplate = (query, routeResults, done) => html`
${searchTemplate(query)}
- ${results.length > 0 ? html`
+ ${routeResults.length > 0 ? html`
Router |
- ${results.some(result => result.peer_address) ? html`Peer | ` : ``}
+ ${routeResults.some(result => result.peer_address) ? html`Peer | ` : ``}
Prefix |
AS Path |
Communities |
@@ -53,7 +53,7 @@ const resultsTemplate = (query, results, done) => html`
- ${results.map(result => resultTemplate(result, results.some(result => result.peer_address)))}
+ ${routeResults.map(result => resultTemplate(result, routeResults.some(result => result.peer_address)))}
` : ''}
@@ -75,17 +75,25 @@ const errorTemplate = (query, data) => html`
const processResults = (results) => {
+ const routeResults = results.filter(r => !!r.Route).map(r => r.Route);
+ console.log(results);
+ const dnsResults = results.filter(r => !!r.ReverseDns).map(r => r.ReverseDns);
+
+ console.log(dnsResults);
+ const dnsMap = Object.fromEntries(dnsResults.map(r => [r.nexthop, { nexthop_resolved: r.nexthop_resolved }]));
+ console.log(dnsMap);
+
// stage 1, combine pre- and post-policy adj-in tables
// start out with PostPolicy
const preAndPostPolicy = {};
const preAndPostPolicyKey = route => `${route.from_client}:${route.peer_address}:${route.net}`;
- for (let route of results) {
+ for (let route of routeResults) {
if (route.table === "PostPolicyAdjIn") {
preAndPostPolicy[preAndPostPolicyKey(route)] = route;
}
}
// add routes which are _only_ in PrePolicy => have not been accepted
- for (let route of results) {
+ for (let route of routeResults) {
if (route.table === "PrePolicyAdjIn") {
const key = preAndPostPolicyKey(route);
if (!preAndPostPolicy[key]) {
@@ -100,7 +108,7 @@ const processResults = (results) => {
for (let route of Object.values(preAndPostPolicy)) {
all[allKey(route)] = route;
}
- for (let route of results) {
+ for (let route of routeResults) {
if (route.table === "LocRib" && route.state === "Accepted") {
const key = allKey(route);
if (all[key])
@@ -109,7 +117,7 @@ const processResults = (results) => {
all[key] = route;
}
}
- for (let route of results) {
+ for (let route of routeResults) {
if (route.table === "LocRib" && route.state === "Active") {
const key = allKey(route);
if (all[key])
@@ -118,7 +126,7 @@ const processResults = (results) => {
all[key] = route;
}
}
- for (let route of results) {
+ for (let route of routeResults) {
if (route.table === "LocRib" && route.state === "Selected") {
const key = allKey(route);
if (all[key])
@@ -143,6 +151,14 @@ const processResults = (results) => {
if (res !== 0) return res;
return 0;
});
+
+ // add resolved nexthop data
+ for (const result of newResults) {
+ if (result.nexthop in dnsMap) {
+ Object.assign(result, dnsMap[result.nexthop])
+ }
+ }
+
return newResults;
};