add nameserver checking, add warnings section to view, show host ip if dedicated-public is not used
diff --git a/xos/core/xoslib/dashboards/xosHpc.html b/xos/core/xoslib/dashboards/xosHpc.html
index bdb964d..85c0cbc 100644
--- a/xos/core/xoslib/dashboards/xosHpc.html
+++ b/xos/core/xoslib/dashboards/xosHpc.html
@@ -22,6 +22,8 @@
<div id="contentInner">
+<dic id="warnings"></div>
+
<h2>Request Routers</h2>
<div id="xos-hpc-dns"></div>
diff --git a/xos/core/xoslib/methods/hpcview.py b/xos/core/xoslib/methods/hpcview.py
index 452e4ca..7c4baa9 100644
--- a/xos/core/xoslib/methods/hpcview.py
+++ b/xos/core/xoslib/methods/hpcview.py
@@ -14,6 +14,13 @@
import socket
import time
+NAMESERVERS = ["cdnrr1.opencloud.us",
+ "cdnrr2.opencloud.us",
+ "cdnrr3.opencloud.us",
+ "cdnrr4.opencloud.us",
+ "cdnrr5.opencloud.us",
+ "cdnrr6.opencloud.us"]
+
# This REST API endpoint contains a bunch of misc information that the
# tenant view needs to display
@@ -67,6 +74,13 @@
if (network.template) and (network.template.visibility=="public") and (network.template.translation=="none"):
dnsdemux_has_public_network = True
+ nameservers = {}
+ for nameserver in NAMESERVERS:
+ try:
+ nameservers[nameserver] = {"name": nameserver, "ip": socket.gethostbyname(nameserver), "hit": False}
+ except:
+ nameservers[nameserver] = {"name": nameserver, "ip": "exception", "hit": False}
+
dnsdemux=[]
for sliver in dnsdemux_slice.slivers.all():
if dnsdemux_has_public_network:
@@ -77,10 +91,17 @@
except:
ip = "??? " + sliver.node.name
+ sliver_nameservers = []
+ for ns in nameservers.values():
+ if ns["ip"]==ip:
+ sliver_nameservers.append(ns["name"])
+ ns["hit"]=True
+
dnsdemux.append( {"name": sliver.node.name,
"watcher.DNS.msg": lookup_tag(dnsdemux_service, sliver, "watcher.DNS.msg"),
"watcher.DNS.time": lookup_time(dnsdemux_service, sliver, "watcher.DNS.time"),
- "ip": ip })
+ "ip": ip,
+ "nameservers": sliver_nameservers })
hpc=[]
for sliver in hpc_slice.slivers.all():
@@ -94,7 +115,8 @@
return { "id": pk,
"dnsdemux": dnsdemux,
- "hpc": hpc }
+ "hpc": hpc,
+ "nameservers": nameservers }
class HpcList(APIView):
diff --git a/xos/core/xoslib/static/js/xosHpc.js b/xos/core/xoslib/static/js/xosHpc.js
index 15dc404..220b1d5 100644
--- a/xos/core/xoslib/static/js/xosHpc.js
+++ b/xos/core/xoslib/static/js/xosHpc.js
@@ -18,12 +18,12 @@
$('#xos-hpc-dns').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="dynamic_dnsdemux"></table>' );
var actualEntries = [];
- console.log(dnsdemux);
+ //console.log(dnsdemux);
for (rowkey in dnsdemux) {
row = dnsdemux[rowkey];
- actualEntries.push( [row.name, row.ip, staleCheck(row, "watcher.DNS.time", "watcher.DNS.msg", SC_RR)] );
+ actualEntries.push( [row.name, row.ip, staleCheck(row, "watcher.DNS.time", "watcher.DNS.msg", SC_RR), row.nameservers.join(",")] );
}
console.log(actualEntries);
oTable = $('#dynamic_dnsdemux').dataTable( {
@@ -36,6 +36,7 @@
{ "sTitle": "Node" },
{ "sTitle": "IP Address" },
{ "sTitle": "Record Checker" },
+ { "sTitle": "Nameservers" },
]
} );
}
@@ -44,7 +45,7 @@
$('#xos-hpc-hpc').html( '<table cellpadding="0" cellspacing="0" border="0" class="display" id="dynamic_hpc"></table>' );
var actualEntries = [];
- console.log(dnsdemux);
+ //console.log(dnsdemux);
for (rowkey in dnsdemux) {
row = dnsdemux[rowkey];
@@ -66,10 +67,26 @@
} );
}
+function updateWarnings(data) {
+ nameservers = data.attributes.nameservers;
+ warnings = [];
+ for (rowKey in nameservers) {
+ nameserver = nameservers[rowKey]
+ if (!nameserver.hit) {
+ warnings.push("<B>WARNING:</B> nameserver " + nameserver.name + " does not map to a request router");
+ }
+ }
+
+ console.log(warnings);
+
+ $("#warnings").html(warnings.join("<BR>"));
+}
+
function updateHpcView(data) {
data = data[0];
updateDnsDemuxTable( data.attributes.dnsdemux );
updateHpcTable( data.attributes.hpc );
+ updateWarnings( data );
}
$(document).ready(function(){