WIP
parent
48585ea3e1
commit
f8d235309e
|
@ -45,9 +45,6 @@ namespace ln.skyscanner
|
|||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
new testODB().TestCase();
|
||||
return;
|
||||
|
||||
FileLogger fileLogger = new FileLogger("skyscanner.log");
|
||||
fileLogger.MaxLogLevel = LogLevel.INFO;
|
||||
Logger.Default.Backends.Add(fileLogger);
|
||||
|
@ -63,6 +60,8 @@ namespace ln.skyscanner
|
|||
|
||||
private static void Initialize()
|
||||
{
|
||||
SNMPEngine.DefaultEngine.Timeout = 3500;
|
||||
|
||||
//using (ODB odb = new ODB("odb"))
|
||||
//{
|
||||
|
||||
|
|
|
@ -213,6 +213,7 @@ namespace ln.skyscanner.crawl
|
|||
CrawledSubnet sn = CrawledSubnets.Where(subnet => subnet.Network.Equals(network)).FirstOrDefault();
|
||||
if (sn == null)
|
||||
{
|
||||
Logging.Log(LogLevel.INFO, "Crawler adds new subnet: {0}",network);
|
||||
sn = new CrawledSubnet(network);
|
||||
CrawledSubnets.Insert(sn);
|
||||
}
|
||||
|
|
|
@ -90,9 +90,7 @@ namespace ln.skyscanner.entities
|
|||
ip = ip.Host;
|
||||
|
||||
IntfIP _iip = SkyEntities.intfIPCollection.Where((iip) => iip.IP.Host.Equals(ip)).FirstOrDefault();
|
||||
if (_iip != null)
|
||||
return _iip.NetworkInterface.Node;
|
||||
return null;
|
||||
return _iip?.NetworkInterface?.Node;
|
||||
}
|
||||
|
||||
[Unsynced]
|
||||
|
|
|
@ -14,9 +14,10 @@ using ln.skyscanner.crawl;
|
|||
using ln.types.odb;
|
||||
using Newtonsoft.Json;
|
||||
using LiteDB;
|
||||
using ln.logging;
|
||||
namespace ln.skyscanner.entities
|
||||
{
|
||||
public class NetworkInterface : Persistent
|
||||
public class NetworkInterface
|
||||
{
|
||||
[DocumentID]
|
||||
public readonly Guid ID = Guid.NewGuid();
|
||||
|
@ -60,7 +61,11 @@ namespace ln.skyscanner.entities
|
|||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Node.GetHashCode() ^ Name.GetHashCode();
|
||||
if (Node == null)
|
||||
Logging.Log(LogLevel.WARNING, "NetworkInterface without Node detected. ID={2} NodeID={0} Name={1}",NodeID,Name,ID);
|
||||
else
|
||||
return Node.GetHashCode() ^ Name.GetHashCode();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
|
@ -68,7 +73,7 @@ namespace ln.skyscanner.entities
|
|||
if (obj is NetworkInterface)
|
||||
{
|
||||
NetworkInterface networkInterface = obj as NetworkInterface;
|
||||
return Node.Equals(networkInterface.Node) && Name.Equals(networkInterface.Name);
|
||||
return object.Equals(Node,networkInterface.Node) && object.Equals(Name,networkInterface.Name);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -38,10 +38,8 @@ namespace ln.skyscanner.entities
|
|||
|
||||
public string ProductLine { get; set; }
|
||||
|
||||
public IEnumerable<NetworkInterface> Interfaces => Timing.Meassure("Node.Interfaces",
|
||||
() => SkyScanner.Instance.Entities.interfaceCollection.Select("NodeID", ID)
|
||||
);
|
||||
public IEnumerable<CIDR> IPAdresses => Timing.Meassure("Node.IPAddesses", () => Interfaces.SelectMany(intf => intf.IPs).Select((iip)=>iip.IP));
|
||||
public IEnumerable<NetworkInterface> Interfaces => SkyScanner.Instance.Entities.interfaceCollection.Select("NodeID", ID);
|
||||
public IEnumerable<CIDR> IPAdresses => Interfaces.SelectMany(intf => intf.IPs).Select((iip) => iip.IP).Distinct();
|
||||
|
||||
private HashSet<URI> uris = new HashSet<URI>();
|
||||
|
||||
|
|
|
@ -27,7 +27,8 @@ namespace ln.skyscanner.http
|
|||
[Callable]
|
||||
public Node[] GetNodes()
|
||||
{
|
||||
return GlobalNetwork.Nodes.ToArray();
|
||||
Node[] nodes = GlobalNetwork.Nodes.ToArray();
|
||||
return nodes;
|
||||
}
|
||||
|
||||
[Callable]
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<div>
|
||||
<h1>Struktur</h1>
|
||||
<div>
|
||||
<a href="/static/network" onclick="skyapi().loadPage('static/network/index.html'); return false;"><div>Übersicht</div></a>
|
||||
<a href="/static/network/index.html" onclick="skyapi().loadPage('static/network/index.html'); return false;"><div>Übersicht</div></a>
|
||||
</div>
|
||||
<div>
|
||||
<a href="/static/network/hoptable.html" onclick="skyapi().loadPage('static/network/hoptable.html'); return false;"><div>Hop Table</div></a>
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
$.each( node.Interfaces, function(){
|
||||
var intf = this;
|
||||
$.each( intf.IPs, function(){
|
||||
$("#dInterfaces").append( $( "<option value='"+ this +"'>" + this + "[ " + intf.Name + " ]</option>" ) );
|
||||
$("#dInterfaces").append( $( "<option value='"+ this.IP +"'>" + this.IP + "[ " + intf.Name + " ]</option>" ) );
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue