This commit is contained in:
crusader 2018-06-11 23:47:34 +09:00
parent bad18b3c8f
commit b3d2ab3dfc
4 changed files with 23 additions and 21 deletions

View File

@ -50,7 +50,7 @@
<dependency>
<groupId>com.loafle.overflow</groupId>
<artifactId>commons-java</artifactId>
<version>1.0.38-SNAPSHOT</version>
<version>1.0.43-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -24,7 +24,6 @@ import com.loafle.overflow.model.meta.MetaPortType;
import com.loafle.overflow.model.meta.MetaTargetHostType;
import com.loafle.overflow.model.meta.MetaTargetZoneType;
import com.loafle.overflow.model.noauthprobe.NoAuthProbeDescription;
import com.loafle.overflow.model.noauthprobe.NoAuthProbeDescriptionNetwork;
import com.loafle.overflow.service.central.infra.InfraService;
import com.loafle.overflow.service.central.probe.ProbeService;
@ -273,22 +272,24 @@ public class CentralInfraService implements InfraService {
public InfraHost registByNoAuthProbe(Long probeID, NoAuthProbeDescription noAuthProbeDescription)
throws OverflowException {
NoAuthProbeDescriptionNetwork networkInfo = noAuthProbeDescription.getNetwork();
InfraHostIP infraHostIP = new InfraHostIP();
// FIXME getting IPType from networkInfo
infraHostIP.setMetaIPType(new MetaIPType((short) 1));
infraHostIP.setAddress(networkInfo.getAddress());
infraHostIP.setMac(networkInfo.getMacAddress());
List<InfraHostIP> infraHostIPs = new ArrayList<>();
infraHostIPs.add(infraHostIP);
// NoAuthProbeDescriptionNetwork networkInfo = noAuthProbeDescription.getNetwork();
// InfraHostIP infraHostIP = new InfraHostIP();
// // FIXME getting IPType from networkInfo
// infraHostIP.setMetaIPType(new MetaIPType((short) 1));
// infraHostIP.setAddress(networkInfo.getAddress());
// infraHostIP.setMac(networkInfo.getMacAddress());
// List<InfraHostIP> infraHostIPs = new ArrayList<>();
// infraHostIPs.add(infraHostIP);
InfraHost infraHost = new InfraHost();
infraHost.setProbe(new Probe(probeID));
infraHost.setMetaInfraType(MetaInfraType.Enum.HOST.to());
infraHost.setMetaTargetHostType(new MetaTargetHostType(1));
infraHost.setInfraHostIPs(infraHostIPs);
// InfraHost infraHost = new InfraHost();
// infraHost.setProbe(new Probe(probeID));
// infraHost.setMetaInfraType(MetaInfraType.Enum.HOST.to());
// infraHost.setMetaTargetHostType(new MetaTargetHostType(1));
// infraHost.setInfraHostIPs(infraHostIPs);
return this.infraDAO.save(infraHost);
// return this.infraDAO.save(infraHost);
return null;
}
@Override

View File

@ -135,13 +135,13 @@ public class CentralNoAuthProbeService implements NoAuthProbeService {
probe.setTargetCount(0);
probe.setMetaProbeStatus(new MetaProbeStatus((short) 1));
String name = noAuthProbeDescription.getHost().getName();
String name = noAuthProbeDescription.getInfraHost().getInfraHostOS().getName();
name += " probe";
probe.setName(name);
String addrStr = noAuthProbeDescription.getNetwork().getAddress();
String[] addrArr = addrStr.split("\\|");
probe.setCidr(addrArr[0]);
// String addrStr = noAuthProbeDescription.getNetwork().getAddress();
// String[] addrArr = addrStr.split("\\|");
// probe.setCidr(addrArr[0]);
return this.probeService.regist(probe);
}

View File

@ -946,7 +946,8 @@ INSERT INTO public.infra_host_ip (id, infra_host_id, meta_ip_type_id, "address",
INSERT INTO public.infra_host_port (id, infra_host_id, meta_port_type_id, port) VALUES (1, 2, 1, 5432);
INSERT INTO public.infra_host_machine (id, infra_host_id, meta) VALUES (1, 2, '{"vendor": "Micro-Star International Co., Ltd.", "product": "GP60 2QF (To be filled by O.E.M.)", "version": "REV:1.0", "serial": "9S716GH21875ZF1000339"}');
INSERT INTO public.infra_host_os (id, infra_host_id, meta) VALUES (1, 2, '{"vendor": "Ubuntu"}');
INSERT INTO public.infra_host_os (id, infra_host_id, os, platform, platform_family, platform_version, kernel_version, host_id) VALUES (1, 2, 'linux', 'ubuntu', 'debian', '', '4.4.0-93-generic', '03000200-0400-0500-0006-000700080009');
INSERT INTO public.infra_host_application (id, infra_host_id, "name") VALUES (1, 2, 'Apache Httpd');
INSERT INTO public.infra_host_application (id, infra_host_id, "name") VALUES (2, 2, 'PostgreSQL');