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