REM:
1. 迪普浩瀚设备处置接口调用前,检查设备是否支持改处置能力
This commit is contained in:
HuangXin 2020-09-24 18:23:10 +08:00
parent 8e6fab6d5f
commit 74b8508e83
2 changed files with 34 additions and 14 deletions

View File

@ -114,6 +114,11 @@ public class DpTechAbilityImpl implements DisposeAbility {
try {
log.debug("++++Begging DPTech Start Cleanup Task: {}, {}, {} ", ip, attackType, nfDirection);
if (capType != DisposeCapacityType.CLEANUP) {
log.error("----Error DPTech don't support dispose capacity type: {}", capType);
return new MulReturnType<>(ErrorCode.ERR_UNSUPPORT, null);
}
NtcRequestResultInfo ret = cleanTypePort.startAbnormalTaskForUMC(ip, attackType,
nfDirection.getValue());
@ -157,6 +162,11 @@ public class DpTechAbilityImpl implements DisposeAbility {
try {
log.info("++++Begging DPTech Stop Cleanup Task: {}, {}, {} ", ip, attackType, nfDirection);
if (capType != DisposeCapacityType.CLEANUP) {
log.error("----Error DPTech don't support dispose capacity type: {}", capType);
return new MulReturnType<>(ErrorCode.ERR_UNSUPPORT, null);
}
NtcRequestResultInfo ret = cleanTypePort.stopAbnormalTaskForUMC(ip, attackType,
nfDirection.getValue());

View File

@ -67,13 +67,18 @@ public class HaoHanAbilityImpl implements DisposeAbility {
@Nullable Long duration) {
log.info("++++Begging Haohan Start Cleanup Task: {}", ip);
if (capType != DisposeCapacityType.CLEANUP) {
log.error("----Error Haohan don't support dispose capacity type: {}", capType);
return new MulReturnType<>(ErrorCode.ERR_UNSUPPORT, null);
}
// 适配处置时间参数 -1为不限制处置时间
if (duration == null || duration < 0) {
duration = -1L;
}
HaoHanStartCleanResp resp = restfulInterface.startClean(this.urlRootPath, ip, Math.max(duration.intValue(), 0),
DISPOSE_PLATFORM_NAME);
DISPOSE_PLATFORM_NAME);
if (resp == null) {
log.error("----Error Haohan start clean {} server return error", ip);
@ -106,12 +111,17 @@ public class HaoHanAbilityImpl implements DisposeAbility {
@Nullable Long taskId) {
log.debug("++++Begging Haohan Stop Cleanup Task: {}", taskId);
if (capType != DisposeCapacityType.CLEANUP) {
log.error("----Error Haohan don't support dispose capacity type: {}", capType);
return new MulReturnType<>(ErrorCode.ERR_UNSUPPORT, null);
}
if (taskId == null) {
return new MulReturnType<>(ErrorCode.ERR_PARAMS, null);
}
HaoHanStopCleanResp resp = restfulInterface.stopClean(this.urlRootPath, taskId.intValue(),
DISPOSE_PLATFORM_NAME);
DISPOSE_PLATFORM_NAME);
if (resp == null) {
log.error("----Error Haohan stop task{} server return error", taskId);
@ -141,18 +151,18 @@ public class HaoHanAbilityImpl implements DisposeAbility {
@Override
public MulReturnType<ErrorCode, DeviceFirewareInfo> getAbilityDeviceFireware() {
return new MulReturnType<>(ErrorCode.ERR_OK,
DeviceFirewareInfo.builder()
.vendor("HaoHan")
.model("Unknown")
.firmware("Unknown")
.os("Linux Server")
.kernel("Linux")
.arch("x86_64")
.version("Unknown")
.memory(-1)
.freeMemory(-1)
.cpuUsed(-1)
.build());
DeviceFirewareInfo.builder()
.vendor("HaoHan")
.model("Unknown")
.firmware("Unknown")
.os("Linux Server")
.kernel("Linux")
.arch("x86_64")
.version("Unknown")
.memory(-1)
.freeMemory(-1)
.cpuUsed(-1)
.build());
}
/**