From 74b8508e83bce683cba0fb4c6e988535752a392e Mon Sep 17 00:00:00 2001 From: HuangXin Date: Thu, 24 Sep 2020 18:23:10 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E8=BF=AA=E6=99=AE=E6=B5=A9?= =?UTF-8?q?=E7=80=9A=E8=AE=BE=E5=A4=87=E5=A4=84=E7=BD=AE=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E5=89=8D=EF=BC=8C=E6=A3=80=E6=9F=A5=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E6=98=AF=E5=90=A6=E6=94=AF=E6=8C=81=E6=94=B9=E5=A4=84?= =?UTF-8?q?=E7=BD=AE=E8=83=BD=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ability/impl/DpTechAbilityImpl.java | 10 +++++ .../ability/impl/HaoHanAbilityImpl.java | 38 ++++++++++++------- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/dispose/ability/impl/DpTechAbilityImpl.java b/src/main/java/com/dispose/ability/impl/DpTechAbilityImpl.java index 4b1e168f..c628deb7 100644 --- a/src/main/java/com/dispose/ability/impl/DpTechAbilityImpl.java +++ b/src/main/java/com/dispose/ability/impl/DpTechAbilityImpl.java @@ -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()); diff --git a/src/main/java/com/dispose/ability/impl/HaoHanAbilityImpl.java b/src/main/java/com/dispose/ability/impl/HaoHanAbilityImpl.java index 651bd522..62757220 100644 --- a/src/main/java/com/dispose/ability/impl/HaoHanAbilityImpl.java +++ b/src/main/java/com/dispose/ability/impl/HaoHanAbilityImpl.java @@ -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 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()); } /**