This commit is contained in:
crusader 2018-09-17 15:08:33 +09:00
parent b4dd4b4f13
commit 9eab480c8a

View File

@ -162,151 +162,26 @@ export class HomePageComponent implements OnInit, OnDestroy {
this.nodes = []; this.nodes = [];
this.links = []; this.links = [];
this.zoneNode = new Node('192.168.1.0/24'); this.zoneNode = new Node(this.zone.network);
this.zoneNode.group = 'zone'; this.zoneNode.group = 'zone';
this.zoneNode.target = this.zone; this.zoneNode.target = this.zone;
this.zoneNode.fx = this.discoveryContainerWidth / 2; this.zoneNode.fx = this.discoveryContainerWidth / 2;
this.zoneNode.fy = this.discoveryContainerHeight / 2; this.zoneNode.fy = this.discoveryContainerHeight / 2;
this.zoneNode.r = 60; this.zoneNode.r = 60;
const hostNode = new Node('192.168.1.1');
hostNode.group = 'host';
hostNode.target = {
metaIPType: toMetaIPType(MetaIPTypeEnum.V4),
name: 'Host1',
address: '192.168.1.1',
mac: '44:8a:5b:f1:f1:f3',
osType: 'UNKNOWN',
hostType: 'HOST',
hostVendor: 'UNKNOWN',
hostModel: 'UNKNOWN',
zone: this.zone,
};
hostNode.r = 40;
const hostNode2 = new Node('192.168.1.2');
hostNode2.group = 'host';
hostNode2.target = {
metaIPType: toMetaIPType(MetaIPTypeEnum.V4),
name: 'Host2',
address: '192.168.1.2',
mac: '44:8a:5b:f1:f1:f3',
osType: 'UNKNOWN',
hostType: 'HOST',
hostVendor: 'UNKNOWN',
hostModel: 'UNKNOWN',
zone: this.zone,
};
hostNode2.r = 40;
const hostNode3 = new Node('192.168.1.3');
hostNode3.group = 'host';
hostNode3.target = {
metaIPType: toMetaIPType(MetaIPTypeEnum.V4),
name: 'Host2',
address: '192.168.1.3',
mac: '44:8a:5b:f1:f1:f3',
osType: 'UNKNOWN',
hostType: 'HOST',
hostVendor: 'UNKNOWN',
hostModel: 'UNKNOWN',
zone: this.zone,
};
hostNode3.r = 40;
const serviceNode1 = new Node('192.168.1.1-10-HTTP');
serviceNode1.target = {
metaCryptoType: toMetaCryptoType(MetaCryptoTypeEnum.NONE),
key: 'HTTP',
name: 'Apache',
serviceType: 'WEB',
serviceVendor: 'Apache',
serviceVersion: 'UNKNOWN',
};
serviceNode1.group = 'service';
serviceNode1.r = 30;
const serviceNode2 = new Node('192.168.1.1-20-HTTP');
serviceNode2.target = {
metaCryptoType: toMetaCryptoType(MetaCryptoTypeEnum.NONE),
key: 'HTTP',
name: 'Apache',
serviceType: 'WEB',
serviceVendor: 'Apache',
serviceVersion: 'UNKNOWN',
};
serviceNode2.group = 'service';
serviceNode2.r = 30;
const serviceNode3 = new Node('192.168.1.1-30-HTTP');
serviceNode3.target = {
metaCryptoType: toMetaCryptoType(MetaCryptoTypeEnum.NONE),
key: 'HTTP',
name: 'Apache',
serviceType: 'WEB',
serviceVendor: 'Apache',
serviceVersion: 'UNKNOWN',
};
serviceNode3.group = 'service';
serviceNode3.r = 30;
const serviceNode31 = new Node('192.168.1.3-10-HTTP');
serviceNode31.target = {
metaCryptoType: toMetaCryptoType(MetaCryptoTypeEnum.NONE),
key: 'HTTP',
name: 'Apache',
serviceType: 'WEB',
serviceVendor: 'Apache',
serviceVersion: 'UNKNOWN',
};
serviceNode31.group = 'service';
serviceNode31.r = 30;
const serviceNode32 = new Node('192.168.1.3-20-HTTP');
serviceNode32.target = {
metaCryptoType: toMetaCryptoType(MetaCryptoTypeEnum.NONE),
key: 'HTTP',
name: 'Apache',
serviceType: 'WEB',
serviceVendor: 'Apache',
serviceVersion: 'UNKNOWN',
};
serviceNode32.group = 'service';
serviceNode32.r = 30;
this.nodes.push( this.nodes.push(
this.zoneNode, this.zoneNode,
hostNode,
hostNode2,
hostNode3,
serviceNode1,
serviceNode2,
serviceNode3,
serviceNode31,
serviceNode32,
); );
this.links.push( this.links.push(
new Link(this.zoneNode, hostNode),
new Link(this.zoneNode, hostNode2),
new Link(this.zoneNode, hostNode3),
new Link(hostNode, serviceNode1),
new Link(hostNode, serviceNode2),
new Link(hostNode, serviceNode3),
new Link(hostNode3, serviceNode31),
new Link(hostNode3, serviceNode32),
); );
this.simulationRestart(true); // this.setTestData();
// this.simulationRestart(true);
// this.probeService.send('DiscoveryService.DiscoverHost', requesterID, this.zone, this.discoverHost); this.simulationRestart();
this.probeService.send('DiscoveryService.DiscoverHost', requesterID, this.zone, this.discoverHost);
} }
simulationInit() { simulationInit() {
@ -850,4 +725,139 @@ export class HomePageComponent implements OnInit, OnDestroy {
} }
this.selectedNode = foundNode; this.selectedNode = foundNode;
} }
private setTestData() {
const hostNode = new Node('192.168.1.1');
hostNode.group = 'host';
hostNode.target = {
metaIPType: toMetaIPType(MetaIPTypeEnum.V4),
name: 'Host1',
address: '192.168.1.1',
mac: '44:8a:5b:f1:f1:f3',
osType: 'UNKNOWN',
hostType: 'HOST',
hostVendor: 'UNKNOWN',
hostModel: 'UNKNOWN',
zone: this.zone,
};
hostNode.r = 40;
const hostNode2 = new Node('192.168.1.2');
hostNode2.group = 'host';
hostNode2.target = {
metaIPType: toMetaIPType(MetaIPTypeEnum.V4),
name: 'Host2',
address: '192.168.1.2',
mac: '44:8a:5b:f1:f1:f3',
osType: 'UNKNOWN',
hostType: 'HOST',
hostVendor: 'UNKNOWN',
hostModel: 'UNKNOWN',
zone: this.zone,
};
hostNode2.r = 40;
const hostNode3 = new Node('192.168.1.3');
hostNode3.group = 'host';
hostNode3.target = {
metaIPType: toMetaIPType(MetaIPTypeEnum.V4),
name: 'Host2',
address: '192.168.1.3',
mac: '44:8a:5b:f1:f1:f3',
osType: 'UNKNOWN',
hostType: 'HOST',
hostVendor: 'UNKNOWN',
hostModel: 'UNKNOWN',
zone: this.zone,
};
hostNode3.r = 40;
const serviceNode1 = new Node('192.168.1.1-10-HTTP');
serviceNode1.target = {
metaCryptoType: toMetaCryptoType(MetaCryptoTypeEnum.NONE),
key: 'HTTP',
name: 'Apache',
serviceType: 'WEB',
serviceVendor: 'Apache',
serviceVersion: 'UNKNOWN',
};
serviceNode1.group = 'service';
serviceNode1.r = 30;
const serviceNode2 = new Node('192.168.1.1-20-HTTP');
serviceNode2.target = {
metaCryptoType: toMetaCryptoType(MetaCryptoTypeEnum.NONE),
key: 'HTTP',
name: 'Apache',
serviceType: 'WEB',
serviceVendor: 'Apache',
serviceVersion: 'UNKNOWN',
};
serviceNode2.group = 'service';
serviceNode2.r = 30;
const serviceNode3 = new Node('192.168.1.1-30-HTTP');
serviceNode3.target = {
metaCryptoType: toMetaCryptoType(MetaCryptoTypeEnum.NONE),
key: 'HTTP',
name: 'Apache',
serviceType: 'WEB',
serviceVendor: 'Apache',
serviceVersion: 'UNKNOWN',
};
serviceNode3.group = 'service';
serviceNode3.r = 30;
const serviceNode31 = new Node('192.168.1.3-10-HTTP');
serviceNode31.target = {
metaCryptoType: toMetaCryptoType(MetaCryptoTypeEnum.NONE),
key: 'HTTP',
name: 'Apache',
serviceType: 'WEB',
serviceVendor: 'Apache',
serviceVersion: 'UNKNOWN',
};
serviceNode31.group = 'service';
serviceNode31.r = 30;
const serviceNode32 = new Node('192.168.1.3-20-HTTP');
serviceNode32.target = {
metaCryptoType: toMetaCryptoType(MetaCryptoTypeEnum.NONE),
key: 'HTTP',
name: 'Apache',
serviceType: 'WEB',
serviceVendor: 'Apache',
serviceVersion: 'UNKNOWN',
};
serviceNode32.group = 'service';
serviceNode32.r = 30;
this.nodes.push(
hostNode,
hostNode2,
hostNode3,
serviceNode1,
serviceNode2,
serviceNode3,
serviceNode31,
serviceNode32,
);
this.links.push(
new Link(this.zoneNode, hostNode),
new Link(this.zoneNode, hostNode2),
new Link(this.zoneNode, hostNode3),
new Link(hostNode, serviceNode1),
new Link(hostNode, serviceNode2),
new Link(hostNode, serviceNode3),
new Link(hostNode3, serviceNode31),
new Link(hostNode3, serviceNode32),
);
}
} }