test
This commit is contained in:
parent
0f55757b48
commit
d7d47acf1b
|
@ -1,5 +1,6 @@
|
||||||
package com.loafle.overflow.central.module.infra.service;
|
package com.loafle.overflow.central.module.infra.service;
|
||||||
|
|
||||||
|
|
||||||
import com.loafle.overflow.central.module.infra.dao.InfraHostDAO;
|
import com.loafle.overflow.central.module.infra.dao.InfraHostDAO;
|
||||||
import com.loafle.overflow.core.exception.OverflowException;
|
import com.loafle.overflow.core.exception.OverflowException;
|
||||||
import com.loafle.overflow.model.infra.InfraHost;
|
import com.loafle.overflow.model.infra.InfraHost;
|
||||||
|
@ -27,4 +28,5 @@ public class CentralInfraHostService implements InfraHostService {
|
||||||
public InfraHost readByIp(String ip) throws OverflowException {
|
public InfraHost readByIp(String ip) throws OverflowException {
|
||||||
return this.infraHostDAO.findByIpv4(ip);
|
return this.infraHostDAO.findByIpv4(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
package com.loafle.overflow.central.module.target.service;
|
package com.loafle.overflow.central.module.target.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.loafle.overflow.central.module.infra.service.CentralInfraHostService;
|
||||||
import com.loafle.overflow.central.module.probe.service.CentralProbeService;
|
import com.loafle.overflow.central.module.probe.service.CentralProbeService;
|
||||||
import com.loafle.overflow.central.module.target.dao.TargetDAO;
|
import com.loafle.overflow.central.module.target.dao.TargetDAO;
|
||||||
import com.loafle.overflow.core.exception.OverflowException;
|
import com.loafle.overflow.core.exception.OverflowException;
|
||||||
|
import com.loafle.overflow.model.discovery.Host;
|
||||||
|
import com.loafle.overflow.model.infra.InfraHost;
|
||||||
|
import com.loafle.overflow.model.meta.MetaInfraType;
|
||||||
import com.loafle.overflow.model.probe.Probe;
|
import com.loafle.overflow.model.probe.Probe;
|
||||||
import com.loafle.overflow.model.target.Target;
|
import com.loafle.overflow.model.target.Target;
|
||||||
import com.loafle.overflow.service.central.target.TargetService;
|
import com.loafle.overflow.service.central.target.TargetService;
|
||||||
|
@ -21,6 +27,8 @@ public class CentralTargetService implements TargetService {
|
||||||
private TargetDAO targetDAO;
|
private TargetDAO targetDAO;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CentralProbeService probeService;
|
private CentralProbeService probeService;
|
||||||
|
@Autowired
|
||||||
|
private CentralInfraHostService infraHostService;
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public Target regist(Target target, Probe probe) throws OverflowException {
|
public Target regist(Target target, Probe probe) throws OverflowException {
|
||||||
|
@ -66,4 +74,26 @@ public class CentralTargetService implements TargetService {
|
||||||
}
|
}
|
||||||
return this.targetDAO.save(t);
|
return this.targetDAO.save(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void registDiscoveredTargets(Long probeId, List<Host> hosts, List<Service> services) {
|
||||||
|
/*
|
||||||
|
해당 host의 mac에 해당하는 infraHost가 이미 존재하는지 검사
|
||||||
|
infraHost가 없다면 create
|
||||||
|
infraHost가 있다면 update
|
||||||
|
infraHost.getTarget()이 있어도 무조건 새로운 target으로 연결
|
||||||
|
|
||||||
|
|
||||||
|
for(Host host : hosts) {
|
||||||
|
Target target = new Target();
|
||||||
|
|
||||||
|
MetaInfraType infraType = new MetaInfraType();
|
||||||
|
infraType.setId(2);
|
||||||
|
InfraHost infraHost = new InfraHost();
|
||||||
|
infraHost.setInfraType(infraType);
|
||||||
|
infraHost.setProbe(new Probe(probeId));
|
||||||
|
infraHost.setTarget(target);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user