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 { try {
log.debug("++++Begging DPTech Start Cleanup Task: {}, {}, {} ", ip, attackType, nfDirection); 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, NtcRequestResultInfo ret = cleanTypePort.startAbnormalTaskForUMC(ip, attackType,
nfDirection.getValue()); nfDirection.getValue());
@ -157,6 +162,11 @@ public class DpTechAbilityImpl implements DisposeAbility {
try { try {
log.info("++++Begging DPTech Stop Cleanup Task: {}, {}, {} ", ip, attackType, nfDirection); 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, NtcRequestResultInfo ret = cleanTypePort.stopAbnormalTaskForUMC(ip, attackType,
nfDirection.getValue()); nfDirection.getValue());

View File

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