parent
ec838d467e
commit
ef440833a8
|
@ -65,6 +65,7 @@ public class HaoHanAbilityImpl implements DisposeAbility {
|
||||||
@Nullable NetflowDirection nfDirection,
|
@Nullable NetflowDirection nfDirection,
|
||||||
@Nullable Integer attackType,
|
@Nullable Integer attackType,
|
||||||
@Nullable Long duration) {
|
@Nullable Long duration) {
|
||||||
|
try {
|
||||||
log.info("++++Begging Haohan Start Cleanup Task: {}", ip);
|
log.info("++++Begging Haohan Start Cleanup Task: {}", ip);
|
||||||
|
|
||||||
if (capType != DisposeCapacityType.CLEANUP) {
|
if (capType != DisposeCapacityType.CLEANUP) {
|
||||||
|
@ -77,7 +78,8 @@ public class HaoHanAbilityImpl implements DisposeAbility {
|
||||||
duration = -1L;
|
duration = -1L;
|
||||||
}
|
}
|
||||||
|
|
||||||
HaoHanStartCleanResp resp = restfulInterface.startClean(this.urlRootPath, ip, Math.max(duration.intValue(), 0),
|
HaoHanStartCleanResp resp = restfulInterface.startClean(this.urlRootPath, ip,
|
||||||
|
Math.max(duration.intValue(), 0),
|
||||||
DISPOSE_PLATFORM_NAME);
|
DISPOSE_PLATFORM_NAME);
|
||||||
|
|
||||||
if (resp == null) {
|
if (resp == null) {
|
||||||
|
@ -92,6 +94,10 @@ public class HaoHanAbilityImpl implements DisposeAbility {
|
||||||
|
|
||||||
log.debug("----Finish Haohan Start Cleanup Task: {}", ip);
|
log.debug("----Finish Haohan Start Cleanup Task: {}", ip);
|
||||||
return new MulReturnType<>(ErrorCode.ERR_OK, (long) resp.getCleanTaskId());
|
return new MulReturnType<>(ErrorCode.ERR_OK, (long) resp.getCleanTaskId());
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("----Exception Haohan Start Cleanup Task: {}, {}, {}", ip, nfDirection, duration);
|
||||||
|
return new MulReturnType<>(ErrorCode.ERR_SYSTEMEXCEPTION, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,6 +115,7 @@ public class HaoHanAbilityImpl implements DisposeAbility {
|
||||||
@Nullable NetflowDirection nfDirection,
|
@Nullable NetflowDirection nfDirection,
|
||||||
@Nullable Integer attackType,
|
@Nullable Integer attackType,
|
||||||
@Nullable Long taskId) {
|
@Nullable Long taskId) {
|
||||||
|
try {
|
||||||
log.debug("++++Begging Haohan Stop Cleanup Task: {}", taskId);
|
log.debug("++++Begging Haohan Stop Cleanup Task: {}", taskId);
|
||||||
|
|
||||||
if (capType != DisposeCapacityType.CLEANUP) {
|
if (capType != DisposeCapacityType.CLEANUP) {
|
||||||
|
@ -130,6 +137,10 @@ public class HaoHanAbilityImpl implements DisposeAbility {
|
||||||
|
|
||||||
log.debug("----Finish Haohan Stop Cleanup Task: {}", taskId);
|
log.debug("----Finish Haohan Stop Cleanup Task: {}", taskId);
|
||||||
return new MulReturnType<>(ErrorCode.ERR_OK, null);
|
return new MulReturnType<>(ErrorCode.ERR_OK, null);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("----Exception Haohan Stop Cleanup Task: {}, {}, {}", ip, nfDirection, taskId);
|
||||||
|
return new MulReturnType<>(ErrorCode.ERR_SYSTEMEXCEPTION, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -139,8 +150,14 @@ public class HaoHanAbilityImpl implements DisposeAbility {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean getDeviceLinkStatus() {
|
public boolean getDeviceLinkStatus() {
|
||||||
|
try {
|
||||||
// 获取任务信息接口调用成功认为设备心跳正常
|
// 获取任务信息接口调用成功认为设备心跳正常
|
||||||
return (restfulInterface.getCleanTaskStatus(this.urlRootPath, -1) != null);
|
return (restfulInterface.getCleanTaskStatus(this.urlRootPath, -1) != null);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.dispose.manager.impl;
|
||||||
|
|
||||||
import com.dispose.common.ErrorCode;
|
import com.dispose.common.ErrorCode;
|
||||||
import com.dispose.common.HttpType;
|
import com.dispose.common.HttpType;
|
||||||
|
import com.dispose.common.IpAddrType;
|
||||||
import com.dispose.common.ObjectStatus;
|
import com.dispose.common.ObjectStatus;
|
||||||
import com.dispose.manager.DisposeDeviceManager;
|
import com.dispose.manager.DisposeDeviceManager;
|
||||||
import com.dispose.mapper.DisposeCapacityMapper;
|
import com.dispose.mapper.DisposeCapacityMapper;
|
||||||
|
@ -77,7 +78,12 @@ public class DisposeDeviceManagerImpl implements DisposeDeviceManager {
|
||||||
|
|
||||||
// 添加设备能力信息
|
// 添加设备能力信息
|
||||||
if (err == ErrorCode.ERR_OK) {
|
if (err == ErrorCode.ERR_OK) {
|
||||||
dev.getDevCapacity().forEach(v -> v.setDeviceId(dev.getId()));
|
dev.getDevCapacity().forEach(v -> {
|
||||||
|
v.setDeviceId(dev.getId());
|
||||||
|
if (v.getIpType() == null) {
|
||||||
|
v.setIpType(IpAddrType.IPV4_IPV6);
|
||||||
|
}
|
||||||
|
});
|
||||||
disposeCapacityMapper.addNewDisposeCapacity(dev.getDevCapacity());
|
disposeCapacityMapper.addNewDisposeCapacity(dev.getDevCapacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +176,12 @@ public class DisposeDeviceManagerImpl implements DisposeDeviceManager {
|
||||||
Long devId = tDev.getId();
|
Long devId = tDev.getId();
|
||||||
|
|
||||||
if (tDev.getDevCapacity().size() != 0) {
|
if (tDev.getDevCapacity().size() != 0) {
|
||||||
tDev.getDevCapacity().forEach(v -> v.setDeviceId(devId));
|
tDev.getDevCapacity().forEach(v -> {
|
||||||
|
v.setDeviceId(dev.getId());
|
||||||
|
if (v.getIpType() == null) {
|
||||||
|
v.setIpType(IpAddrType.IPV4_IPV6);
|
||||||
|
}
|
||||||
|
});
|
||||||
disposeCapacityMapper.addNewDisposeCapacity(tDev.getDevCapacity());
|
disposeCapacityMapper.addNewDisposeCapacity(tDev.getDevCapacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue