diff --git a/pom.xml b/pom.xml
index 9405fd2c..eb071355 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,7 +18,7 @@
com.dispose
phoenix_ddos_handle
- 2.0.0
+ 2.0.1
phoenix_ddos_handle
Dispose Platform
diff --git a/src/main/java/com/dispose/controller/DisposeTaskController.java b/src/main/java/com/dispose/controller/DisposeTaskController.java
index 5a836a0f..268a37f8 100644
--- a/src/main/java/com/dispose/controller/DisposeTaskController.java
+++ b/src/main/java/com/dispose/controller/DisposeTaskController.java
@@ -4,6 +4,7 @@ import com.dispose.common.CommonEnumHandler;
import com.dispose.common.DDoSAttackType;
import com.dispose.common.DisposeCapacityType;
import com.dispose.common.DisposeConfigValue;
+import com.dispose.common.DisposeObjectType;
import com.dispose.common.ErrorCode;
import com.dispose.common.Helper;
import com.dispose.common.NetflowDirection;
@@ -96,30 +97,31 @@ public class DisposeTaskController {
// 构造处置任务参数
DisposeTask task = DisposeTask.builder()
- .deviceId(Long.parseLong(Optional.ofNullable(req.getId()).orElse("-1")))
- .accountId(userAccountService.getUserIdByAuthHead(Objects.requireNonNull(headers.get("Authorization"))
- .get(0)))
- .disposeCapacity(CommonEnumHandler.codeOf(DisposeCapacityType.class,
- req.getType()))
- .disposeIp(Helper.ipAddressNormalize(req.getDisposeIp()))
- .planEndTime(String.valueOf(req.getDisposeTime()))
- .flowDirection(CommonEnumHandler.codeOf(NetflowDirection.class,
- Optional.ofNullable(req.getFlowDirection())
- .orElse(2)))
- .attackType(DDoSAttackType.getTypeMaskFromAttackType(
- Optional.ofNullable(req.getAttackType())
- .orElse(new Integer[]{DDoSAttackType.ALL_ATTACKS.getValue()})))
- .flowBandWidth(Optional.ofNullable(req.getFlowBandwidth())
- .orElse(DisposeConfigValue.DEFAULT_DISPOSE_BANDWIDTH))
- .build();
+ .deviceId(Long.parseLong(Optional.ofNullable(req.getId()).orElse("-1")))
+ .accountId(userAccountService.getUserIdByAuthHead(Objects.requireNonNull(headers.get("Authorization"))
+ .get(0)))
+ .disposeCapacity(CommonEnumHandler.codeOf(DisposeCapacityType.class,
+ req.getType()))
+ .disposeObject(Helper.ipAddressNormalize(req.getDisposeIp()))
+ .objectType(DisposeObjectType.IP)
+ .planEndTime(String.valueOf(req.getDisposeTime()))
+ .flowDirection(CommonEnumHandler.codeOf(NetflowDirection.class,
+ Optional.ofNullable(req.getFlowDirection())
+ .orElse(2)))
+ .attackType(DDoSAttackType.getTypeMaskFromAttackType(
+ Optional.ofNullable(req.getAttackType())
+ .orElse(new Integer[]{DDoSAttackType.ALL_ATTACKS.getValue()})))
+ .flowBandWidth(Optional.ofNullable(req.getFlowBandwidth())
+ .orElse(DisposeConfigValue.DEFAULT_DISPOSE_BANDWIDTH))
+ .build();
// 创建处置任务
MulReturnType ret = disposeTaskService.createTask(task);
// 设置返回消息
TaskStartRsp rspInfo = TaskStartRsp.builder()
- .disposeIp(task.getDisposeIp())
- .build();
+ .disposeIp(task.getDisposeObject())
+ .build();
rspInfo.setStatus(ret.getFirstParam().getCode());
rspInfo.setMessage(new String[]{ret.getFirstParam().getMsg()});
@@ -157,40 +159,41 @@ public class DisposeTaskController {
DisposeCapacityType capType = CommonEnumHandler.codeOf(DisposeCapacityType.class, req.getType());
String endTime = String.valueOf(req.getDisposeTime());
NetflowDirection netDir = CommonEnumHandler.codeOf(NetflowDirection.class,
- Optional.ofNullable(req.getFlowDirection()).orElse(2));
+ Optional.ofNullable(req.getFlowDirection()).orElse(2));
Long attackType = DDoSAttackType.getTypeMaskFromAttackType(Optional.ofNullable(req.getAttackType())
- .orElse(new Integer[]{DDoSAttackType.ALL_ATTACKS.getValue()}));
+ .orElse(new Integer[]{DDoSAttackType.ALL_ATTACKS.getValue()}));
Integer flowBand = Optional.ofNullable(req.getFlowBandwidth())
- .orElse(DisposeConfigValue.DEFAULT_DISPOSE_BANDWIDTH);
+ .orElse(DisposeConfigValue.DEFAULT_DISPOSE_BANDWIDTH);
TaskStartMulRsp mulRsp = TaskStartMulRsp.builder()
- .items(new ArrayList<>())
- .build();
+ .items(new ArrayList<>())
+ .build();
for (String ip : req.getMulDisposeIp()) {
// 构造处置任务参数
DisposeTask task = DisposeTask.builder()
- .deviceId(devId)
- .accountId(aId)
- .disposeCapacity(capType)
- .disposeIp(Helper.ipAddressNormalize(ip))
- .planEndTime(endTime)
- .flowDirection(netDir)
- .attackType(attackType)
- .flowBandWidth(flowBand)
- .build();
+ .deviceId(devId)
+ .accountId(aId)
+ .disposeCapacity(capType)
+ .disposeObject(Helper.ipAddressNormalize(ip))
+ .objectType(DisposeObjectType.IP)
+ .planEndTime(endTime)
+ .flowDirection(netDir)
+ .attackType(attackType)
+ .flowBandWidth(flowBand)
+ .build();
// 创建处置任务
MulReturnType ret = disposeTaskService.createTask(task);
// 设置返回消息
TaskStartRsp rspInfo = TaskStartRsp.builder()
- .disposeIp(ip)
- .build();
+ .disposeIp(ip)
+ .build();
// 启动任务成功
if (ret.getFirstParam() == ErrorCode.ERR_OK ||
- ret.getFirstParam() == ErrorCode.ERR_TASKRUNNING) {
+ ret.getFirstParam() == ErrorCode.ERR_TASKRUNNING) {
rspInfo.setTaskId(ret.getSecondParam().getId().toString());
rspInfo.setExpireTime(ret.getSecondParam().getPlanEndTime());
}
@@ -231,13 +234,13 @@ public class DisposeTaskController {
// 停止成功
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
rspInfo.setDisposeDevice(ret.getSecondParam().getDeviceTask().stream()
- .map(DeviceTask::getDeviceId)
- .map(String::valueOf)
- .toArray(String[]::new));
+ .map(DeviceTask::getDeviceId)
+ .map(String::valueOf)
+ .toArray(String[]::new));
rspInfo.setType(ret.getSecondParam().getDisposeCapacity().getValue());
- rspInfo.setDisposeIp(ret.getSecondParam().getDisposeIp());
+ rspInfo.setDisposeIp(ret.getSecondParam().getDisposeObject());
rspInfo.setLeftTime(String.valueOf(Math.abs(
- Helper.getTimestampDiffNow(ret.getSecondParam().getPlanEndTime())) / 60));
+ Helper.getTimestampDiffNow(ret.getSecondParam().getPlanEndTime())) / 60));
}
rspInfo.setTaskId(tId);
@@ -260,26 +263,27 @@ public class DisposeTaskController {
@ResponseBody
@ApiOperation("获取处置任务")
public ProtocolRespDTO getAllDisposeTask(
- @Validated(ValidGroups.ProtocolCommonValid.class)
- @RequestBody ProtocolReqDTO mr
+ @Validated(ValidGroups.ProtocolCommonValid.class)
+ @RequestBody ProtocolReqDTO mr
) {
GetTaskRsp rspInfo = GetTaskRsp.builder().build();
List getTaskDetail = new ArrayList<>();
//获取TaskId列表
- List reqTaskIds = Arrays.stream(Optional.ofNullable(mr.getMsgContent().getTaskId()).orElse(new String[]{})).
- map(Long::parseLong).collect(Collectors.toList());
+ List reqTaskIds = Arrays.stream(Optional.ofNullable(mr.getMsgContent().getTaskId())
+ .orElse(new String[]{})).
+ map(Long::parseLong).collect(Collectors.toList());
//获取所有可用处置任务
List taskList = disposeTaskService.getAllDisposeTask();
List idArray = taskList.stream().filter(v -> reqTaskIds.size() == 0 || reqTaskIds.contains(v.getId()))
- .map(DisposeTask::getId).collect(Collectors.toList());
+ .map(DisposeTask::getId).collect(Collectors.toList());
if (idArray.size() > 0) {
MulReturnType, List> ret =
- disposeTaskService.getPageDisposeTask(idArray,
- mr.getMsgContent().getStartPage(),
- mr.getMsgContent().getPageSize());
+ disposeTaskService.getPageDisposeTask(idArray,
+ mr.getMsgContent().getStartPage(),
+ mr.getMsgContent().getPageSize());
// 分页信息
rspInfo.setCurPageNumber(ret.getFirstParam().getPageNum());
@@ -289,29 +293,29 @@ public class DisposeTaskController {
ret.getSecondParam().forEach(v -> {
GetTaskDetail taskDetail = GetTaskDetail.builder()
- .taskId(String.valueOf(v.getId()))
- .accountId(String.valueOf(v.getAccountId()))
- .disposeCapacity(v.getDisposeCapacity().getValue())
- .disposeIp(v.getDisposeIp())
- .createTime(v.getCreateTime())
- .planEndTime(v.getPlanEndTime())
- .endTime(v.getEndTime())
- .flowDirection(v.getFlowDirection().getValue())
- .attackType(v.getAttackType().toString())
- .flowBandWidth(v.getFlowBandWidth())
- .currentStatus(v.getCurrentStatus().getValue())
- .deviceTask(new ArrayList<>())
- .build();
+ .taskId(String.valueOf(v.getId()))
+ .accountId(String.valueOf(v.getAccountId()))
+ .disposeCapacity(v.getDisposeCapacity().getValue())
+ .disposeIp(v.getDisposeObject())
+ .createTime(v.getCreateTime())
+ .planEndTime(v.getPlanEndTime())
+ .endTime(v.getEndTime())
+ .flowDirection(v.getFlowDirection().getValue())
+ .attackType(v.getAttackType().toString())
+ .flowBandWidth(v.getFlowBandWidth())
+ .currentStatus(v.getCurrentStatus().getValue())
+ .deviceTask(new ArrayList<>())
+ .build();
taskDetail.setStatus(ErrorCode.ERR_OK.getCode());
taskDetail.setMessage(new String[]{ErrorCode.ERR_OK.getMsg()});
v.getDeviceTask().forEach(k -> {
GetDeviceTaskDetail deviceTaskDetail = GetDeviceTaskDetail.builder()
- .devTaskId(String.valueOf(k.getId()))
- .devId(String.valueOf(k.getDeviceId()))
- .externId(String.valueOf(k.getExternId()))
- .status(k.getStatus())
- .build();
+ .devTaskId(String.valueOf(k.getId()))
+ .devId(String.valueOf(k.getDeviceId()))
+ .externId(String.valueOf(k.getExternId()))
+ .status(k.getStatus())
+ .build();
taskDetail.getDeviceTask().add(deviceTaskDetail);
});
@@ -322,19 +326,19 @@ public class DisposeTaskController {
// 设置不存在taskId的错误码
if (reqTaskIds.stream().anyMatch(v -> taskList.stream().noneMatch(k -> k.getId().equals(v)))) {
reqTaskIds.stream()
- .filter(v -> taskList.stream().noneMatch(k -> k.getId().equals(v)))
- .forEach(v -> {
- GetTaskDetail td = GetTaskDetail.builder().build();
- td.setTaskId(String.valueOf(v));
- td.setStatus(ErrorCode.ERR_NOSUCHTASK.getCode());
- td.setMessage(new String[]{ErrorCode.ERR_NOSUCHTASK.getMsg()});
- getTaskDetail.add(td);
- });
+ .filter(v -> taskList.stream().noneMatch(k -> k.getId().equals(v)))
+ .forEach(v -> {
+ GetTaskDetail td = GetTaskDetail.builder().build();
+ td.setTaskId(String.valueOf(v));
+ td.setStatus(ErrorCode.ERR_NOSUCHTASK.getCode());
+ td.setMessage(new String[]{ErrorCode.ERR_NOSUCHTASK.getMsg()});
+ getTaskDetail.add(td);
+ });
}
// 对返回的信息按照TaskID排序
rspInfo.setItems(getTaskDetail.stream().sorted(Comparator.comparing(GetTaskDetail::getTaskId))
- .collect(Collectors.toList()));
+ .collect(Collectors.toList()));
return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo);
}
diff --git a/src/main/java/com/dispose/mapper/DisposeTaskMapper.java b/src/main/java/com/dispose/mapper/DisposeTaskMapper.java
index 2dd352bb..97c68227 100644
--- a/src/main/java/com/dispose/mapper/DisposeTaskMapper.java
+++ b/src/main/java/com/dispose/mapper/DisposeTaskMapper.java
@@ -72,14 +72,14 @@ public interface DisposeTaskMapper {
/**
* Gets running task.
*
- * @param deviceId the device id
- * @param capType the cap type
- * @param disposeIp the dispose ip
+ * @param deviceId the device id
+ * @param capType the cap type
+ * @param disposeObject the dispose object
* @return the running task
*/
DisposeTask getRunningTask(@Param("deviceId") Long deviceId,
@Param("capType") DisposeCapacityType capType,
- @Param("disposeIp") String disposeIp);
+ @Param("disposeObject") String disposeObject);
/**
* Gets new task.
diff --git a/src/main/java/com/dispose/pojo/entity/DisposeTask.java b/src/main/java/com/dispose/pojo/entity/DisposeTask.java
index ef2acc04..b3f5aa7b 100644
--- a/src/main/java/com/dispose/pojo/entity/DisposeTask.java
+++ b/src/main/java/com/dispose/pojo/entity/DisposeTask.java
@@ -1,6 +1,7 @@
package com.dispose.pojo.entity;
import com.dispose.common.DisposeCapacityType;
+import com.dispose.common.DisposeObjectType;
import com.dispose.common.DisposeTaskStatus;
import com.dispose.common.NetflowDirection;
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -56,9 +57,13 @@ public class DisposeTask implements Serializable {
*/
private DisposeCapacityType disposeCapacity;
/**
- * The Dispose ip.
+ * The Dispose object.
*/
- private String disposeIp;
+ private String disposeObject;
+ /**
+ * The Object type.
+ */
+ private DisposeObjectType objectType;
/**
* The Create time.
*/
@@ -88,7 +93,7 @@ public class DisposeTask implements Serializable {
*/
private DisposeTaskStatus currentStatus;
/**
- * The Task info.
+ * The Device task.
*/
private List deviceTask;
}
diff --git a/src/main/java/com/dispose/service/impl/DeviceTaskManagerServiceImpl.java b/src/main/java/com/dispose/service/impl/DeviceTaskManagerServiceImpl.java
index 6993bbb9..77178085 100644
--- a/src/main/java/com/dispose/service/impl/DeviceTaskManagerServiceImpl.java
+++ b/src/main/java/com/dispose/service/impl/DeviceTaskManagerServiceImpl.java
@@ -68,7 +68,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
deviceTask.getTaskAttackType());
// 调用设备执行处置任务
- ret = ai.getDb().runDispose(disposeTask.getDisposeIp(), disposeTask.getDisposeCapacity(), null, null, null);
+ ret = ai.getDb().runDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(), null, null, null);
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
// 设置攻击类型任务启动结果
@@ -97,7 +97,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
MulReturnType ret;
// 调用设备执行处置任务
- ret = ai.getDb().stopDispose(disposeTask.getDisposeIp(), disposeTask.getDisposeCapacity(), null, null, null);
+ ret = ai.getDb().stopDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(), null, null, null);
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
deviceTaskManager.setAttackTypeStatus(deviceTask.getId(),disposeTask.getFlowDirection(), 0L);
@@ -132,7 +132,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
deviceTaskManager.setExecAttackType(deviceTask.getId(), NetflowDirection.DIRECTION_BI,
deviceTask.getTaskAttackType());
- ret = ai.getDb().runDispose(disposeTask.getDisposeIp(), disposeTask.getDisposeCapacity(), null, null,
+ ret = ai.getDb().runDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(), null, null,
(long) -(Helper.getTimestampDiffNow(disposeTask.getPlanEndTime()) / 60));
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
@@ -175,7 +175,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
MulReturnType ret;
// 停止处置任务
- ret = ai.getDb().stopDispose(disposeTask.getDisposeIp(), disposeTask.getDisposeCapacity(), null, null,
+ ret = ai.getDb().stopDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(), null, null,
deviceTask.getExternId());
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
@@ -219,7 +219,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
deviceTaskManager.execAttackTypeSetBit(deviceTask.getId(), NetflowDirection.DIRECTION_OUT,
t.getValue());
// 调用迪普设备启动处置任务
- ret = ai.getDb().runDispose(disposeTask.getDisposeIp(), disposeTask.getDisposeCapacity(),
+ ret = ai.getDb().runDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(),
NetflowDirection.DIRECTION_OUT, t.getValue(), null);
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
@@ -256,7 +256,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
deviceTaskManager.execAttackTypeSetBit(deviceTask.getId(), NetflowDirection.DIRECTION_IN,
t.getValue());
// 调用迪普设备启动处置任务
- ret = ai.getDb().runDispose(disposeTask.getDisposeIp(), disposeTask.getDisposeCapacity(),
+ ret = ai.getDb().runDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(),
NetflowDirection.DIRECTION_IN, t.getValue(), null);
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
@@ -331,7 +331,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
// 出方向
if (disposeTask.getFlowDirection() != NetflowDirection.DIRECTION_IN) {
// 调用迪普设备停止处置任务
- ret = ai.getDb().stopDispose(disposeTask.getDisposeIp(), disposeTask.getDisposeCapacity(),
+ ret = ai.getDb().stopDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(),
NetflowDirection.DIRECTION_OUT, t.getValue(), null);
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
@@ -357,7 +357,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
// 入方向
if (disposeTask.getFlowDirection() != NetflowDirection.DIRECTION_OUT) {
// 调用迪普设备启动处置任务
- ret = ai.getDb().stopDispose(disposeTask.getDisposeIp(), disposeTask.getDisposeCapacity(),
+ ret = ai.getDb().stopDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(),
NetflowDirection.DIRECTION_IN, t.getValue(), null);
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
@@ -421,7 +421,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
// 清理过期任务
for (DisposeTask v : disposeTaskManager.getExpiredTasks()) {
log.info("Task {} {} {} is expired, expect finished at {}",
- v.getId(), v.getDisposeCapacity(), v.getDisposeIp(), v.getPlanEndTime());
+ v.getId(), v.getDisposeCapacity(), v.getDisposeObject(), v.getPlanEndTime());
// 设置任务状态,过期任务不再为设备创建处置任务
disposeTaskManager.changeDisposeTaskStatus(v.getId(), DisposeTaskStatus.TASK_EXPIRED);
}
@@ -438,7 +438,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
// 当前设备是否支持该处置能力
.filter(c -> c.getDev().getDevCapacity().stream().anyMatch(m -> m.getCapacityType() == v
.getDisposeCapacity()))
- .filter(c -> c.getDb().isCarryProtectIp(v.getDisposeIp()))
+ .filter(c -> c.getDb().isCarryProtectIp(v.getDisposeObject()))
.forEach(d -> {
log.info("Add dispose task for device: {}", d.getDev());
@@ -467,7 +467,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
AbilityInfo ai = disposeAbilityRouterService.getAbilityDevice(v.getDeviceId());
// 对处置IP生成一个唯一的操作标识符
- String taskStartKey = task.getDisposeIp() + "Start" + ai.getDev().getDeviceType().getDescription();
+ String taskStartKey = task.getDisposeObject() + "Start" + ai.getDev().getDeviceType().getDescription();
if (taskCache.containsKey(taskStartKey)) {
continue;
@@ -526,7 +526,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
AbilityInfo ai = disposeAbilityRouterService.getAbilityDevice(v.getDeviceId());
// 对处置IP生成一个唯一的操作标识符
- String taskStopKey = task.getDisposeIp() + "Stop" + ai.getDev().getDeviceType().getDescription();
+ String taskStopKey = task.getDisposeObject() + "Stop" + ai.getDev().getDeviceType().getDescription();
if (taskCache.containsKey(taskStopKey)) {
continue;
@@ -568,12 +568,12 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
@Scheduled(fixedDelay = 1000)
public void scheduleRunnerThread() {
// 处理处置任务数据
- disposeTaskManagerSchedule();
+ //disposeTaskManagerSchedule();
// 处置设备启动任务
- deviceTaskRunnerSchedule();
+ //deviceTaskRunnerSchedule();
// 处置设备停止任务
- deviceTaskStopSchedule();
+ //deviceTaskStopSchedule();
}
}
diff --git a/src/main/java/com/dispose/service/impl/DisposeTaskServiceImpl.java b/src/main/java/com/dispose/service/impl/DisposeTaskServiceImpl.java
index 5ea30ce1..592875f4 100644
--- a/src/main/java/com/dispose/service/impl/DisposeTaskServiceImpl.java
+++ b/src/main/java/com/dispose/service/impl/DisposeTaskServiceImpl.java
@@ -41,14 +41,14 @@ public class DisposeTaskServiceImpl implements DisposeTaskService {
@Override
public MulReturnType createTask(DisposeTask task) {
DisposeTask exitTask = disposeTaskManager.getDisposeTask(task.getDeviceId(),
- task.getDisposeIp(), task.getDisposeCapacity());
+ task.getDisposeObject(), task.getDisposeCapacity());
if (exitTask != null) {
return new MulReturnType<>(ErrorCode.ERR_TASKRUNNING, exitTask);
}
ErrorCode err = disposeAbilityRouterService.verifyDisposeCapacity(
- task.getDeviceId(), task.getDisposeIp(), task.getDisposeCapacity()
+ task.getDeviceId(), task.getDisposeObject(), task.getDisposeCapacity()
);
if (err != ErrorCode.ERR_OK) {
diff --git a/src/main/resources/db/data.sql b/src/main/resources/db/data.sql
index cab569d4..a685b837 100644
--- a/src/main/resources/db/data.sql
+++ b/src/main/resources/db/data.sql
@@ -1,8 +1,8 @@
-- ----------------------------
-- Records of dispose_device
-- ----------------------------
-INSERT INTO `dispose_device` VALUES (1, '10.88.77.15', '', 0, 0, '中移杭研实验室迪普清洗设备', 'DPTech', 'UMC', '5.7.13', 'admin', 'UMCAdministrator', 'UMC/service/AbnormalFlowCleaningService', 0, '实验室测试设备', 0);
--- INSERT INTO `dispose_device` VALUES (2, '10.88.77.88:18080', 1, 1, 0, '中移杭研实验室浩瀚清洗设备', 'HaoHan', 'Unknown', 'Unknown', '', '', 'http://%s/DDoSClean/clean', '实验室测试设备', 0);
+-- INSERT INTO `dispose_device` VALUES (1, '10.88.77.88:18080', 1, 1, 0, '中移杭研实验室浩瀚清洗设备', 'HaoHan', 'Unknown', 'Unknown', '', '', 'http://%s/DDoSClean/clean', '实验室测试设备', 0);
+-- INSERT INTO `dispose_device` VALUES (2, '10.88.77.15', 0, 1, 0, '中移杭研实验室迪普清洗设备', 'DPTech', 'UMC', 'B5.2.27.7', 'admin', 'UMCAdministrator', 'http://%s/UMC/service/AbnormalFlowCleaningService', '实验室测试设备', 0);
-- id, deviceId, capacityType, objectType, ipType, protectIp, reserveNetflow
diff --git a/src/main/resources/db/schema.sql b/src/main/resources/db/schema.sql
index 8e403add..5eb90434 100644
--- a/src/main/resources/db/schema.sql
+++ b/src/main/resources/db/schema.sql
@@ -1,117 +1,129 @@
/*
Navicat Premium Data Transfer
+ Source Server : 测试环境MySQL服务器
Source Server Type : MySQL
- Source Server Version : 50723
+ Source Server Version : 50731
+ Source Host : 10.88.77.65:33061
+ Source Schema : ci_dispose_v2
Target Server Type : MySQL
- Target Server Version : 50723
+ Target Server Version : 50731
File Encoding : 65001
- Date: 29/06/2020 14:32:25
+ Date: 11/09/2020 00:46:15
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
--- Table structure for task_info
+-- Table structure for device_task
-- ----------------------------
-DROP TABLE IF EXISTS `task_info`;
-CREATE TABLE `task_info`
-(
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '任务信息唯一标识符',
- `taskId` int(10) UNSIGNED NOT NULL COMMENT '处置任务唯一标识符',
- `deviceId` int(10) UNSIGNED NOT NULL COMMENT '处置设备唯一标识符',
- `beginTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '任务开始时间',
- `endTime` timestamp(0) NULL DEFAULT NULL COMMENT '任务结束时间',
- `externId` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '扩展ID(供浩瀚处置任务使用)',
- `status` int(10) NOT NULL DEFAULT 0 COMMENT '任务状态',
- PRIMARY KEY (`id`) USING BTREE,
- INDEX `task_info_ibfk_1` (`taskId`) USING BTREE,
- INDEX `task_info_ibfk_2` (`deviceId`) USING BTREE,
- CONSTRAINT `task_info_ibfk_1` FOREIGN KEY (`taskId`) REFERENCES `dispose_task` (`id`) ON DELETE NO ACTION ON UPDATE RESTRICT,
- CONSTRAINT `task_info_ibfk_2` FOREIGN KEY (`deviceId`) REFERENCES `dispose_device` (`id`) ON DELETE NO ACTION ON UPDATE RESTRICT
-) ENGINE = InnoDB
- AUTO_INCREMENT = 1
- CHARACTER SET = utf8
- COLLATE = utf8_general_ci
- ROW_FORMAT = Dynamic;
+DROP TABLE IF EXISTS `device_task`;
+CREATE TABLE `device_task` (
+ `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '任务信息唯一标识符',
+ `taskId` int(11) UNSIGNED NOT NULL COMMENT '处置任务唯一标识符',
+ `deviceId` int(10) UNSIGNED NOT NULL COMMENT '处置设备唯一标识符',
+ `beginTime` timestamp(0) NULL DEFAULT NULL COMMENT '任务开始时间',
+ `endTime` timestamp(0) NULL DEFAULT NULL COMMENT '任务结束时间',
+ `taskAttackType` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '需要处置的攻击类型',
+ `execAttackTypeIn` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '已经执行处置的攻击类型(Input)',
+ `attackTypeStatusIn` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '执行的攻击类型状态(Input)',
+ `execAttackTypeOut` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '已经执行处置的攻击类型(Output)',
+ `attackTypeStatusOut` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '执行的攻击类型状态(Input)',
+ `externId` int(11) NULL DEFAULT NULL COMMENT '扩展任务ID',
+ `errRetry` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '调用失败重试次数',
+ `status` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '任务状态',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `task_info_ibfk_1`(`taskId`) USING BTREE,
+ INDEX `task_info_ibfk_2`(`deviceId`) USING BTREE,
+ CONSTRAINT `device_task_ibfk_1` FOREIGN KEY (`taskId`) REFERENCES `dispose_task` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ CONSTRAINT `device_task_ibfk_2` FOREIGN KEY (`deviceId`) REFERENCES `dispose_device` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
--- Table structure for dispose_task
+-- Table structure for dispose_capacity
-- ----------------------------
-DROP TABLE IF EXISTS `dispose_task`;
-CREATE TABLE `dispose_task`
-(
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '处置任务唯一标识符',
- `deviceId` int(10) NOT NULL COMMENT '处置设备唯一标识符',
- `accountId` int(10) UNSIGNED NOT NULL COMMENT '用户唯一标识符',
- `type` int(11) UNSIGNED NOT NULL COMMENT '处置能力类型:0:清洗 1:高防 2:黑洞 3:检测',
- `disposeIp` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '处置IP',
- `createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '开始时间',
- `planEndTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '计划结束时间',
- `endTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '实际结束时间',
- `flowDirection` int(11) NULL DEFAULT 2 COMMENT '流量方向, 0:流入;1:流出;2:双向',
- `attackType` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '攻击类型,默认0, 全部攻击',
- `flowBandWidth` int(10) UNSIGNED NULL DEFAULT 1024 COMMENT '攻击流量占用带宽',
- `currentStatus` int(11) NOT NULL DEFAULT 0 COMMENT '状态,0:新建;1:运行中;2:停止;3:停止;4:删除',
- PRIMARY KEY (`id`) USING BTREE,
- INDEX `dispose_task_device_capacity_id_fk` (`type`) USING BTREE,
- INDEX `dispose_task_user_account_id_fk` (`accountId`) USING BTREE,
- CONSTRAINT `dispose_task_ibfk_1` FOREIGN KEY (`accountId`) REFERENCES `user_account` (`id`) ON DELETE NO ACTION ON UPDATE RESTRICT
-) ENGINE = InnoDB
- AUTO_INCREMENT = 1
- CHARACTER SET = utf8
- COLLATE = utf8_general_ci
- ROW_FORMAT = Dynamic;
+DROP TABLE IF EXISTS `dispose_capacity`;
+CREATE TABLE `dispose_capacity` (
+ `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '设备处置能力唯一标识符',
+ `deviceId` int(11) UNSIGNED NOT NULL COMMENT '设备ID',
+ `capacityType` int(8) NOT NULL COMMENT '处置能力:\r\n0:清洗\r\n1:高防 \r\n2:路由黑洞 \r\n3:检测\r\n4:WAF封堵\r\n',
+ `objectType` int(8) NOT NULL COMMENT '处置对象类型:\r\n0:IP\r\n1:域名 \r\n2:URL',
+ `ipType` int(8) NOT NULL DEFAULT 3 COMMENT 'IP 地址类型:\r\n1 << 0:支持IPV4\r\n1 << 1:支持IPV6',
+ `protectIp` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '该处置能力能够处置的IP',
+ `reserveNetflow` int(11) NULL DEFAULT NULL COMMENT '清洗能力储备流量值,单位(G)',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `id`(`deviceId`) USING BTREE,
+ CONSTRAINT `dispose_capacity_ibfk_1` FOREIGN KEY (`deviceId`) REFERENCES `dispose_device` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for dispose_device
-- ----------------------------
DROP TABLE IF EXISTS `dispose_device`;
-CREATE TABLE `dispose_device`
-(
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '设备唯一标识符',
- `ipAddr` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备IP地址, IPv4/IPv6',
- `type` int(11) NOT NULL DEFAULT 0 COMMENT '能力节点类型,0:迪普UMC平台,1:浩瀚设备',
- `areaCode` int(11) NULL DEFAULT NULL COMMENT '设备物理位置区域码',
- `name` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备名称',
- `manufacturer` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生产厂商',
- `model` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '型号',
- `version` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '软件版本',
- `userName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '系统管理用户名',
- `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '系统管理密码',
- `url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'URL类型',
- `readme` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
- `status` int(11) NOT NULL DEFAULT 0 COMMENT '状态,0:正常, 1:删除',
- PRIMARY KEY (`id`) USING BTREE,
- UNIQUE INDEX `ipAddr` (`ipAddr`) USING BTREE
-) ENGINE = InnoDB
- AUTO_INCREMENT = 1
- CHARACTER SET = utf8
- COLLATE = utf8_general_ci
- ROW_FORMAT = Dynamic;
+CREATE TABLE `dispose_device` (
+ `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '设备唯一标识符',
+ `ipAddr` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '设备IP地址, IPv4/IPv6',
+ `ipPort` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '端口',
+ `deviceType` int(11) NOT NULL DEFAULT 0 COMMENT '能力节点类型,0:迪普UMC平台,1:浩瀚设备',
+ `areaCode` int(11) NOT NULL COMMENT '设备物理位置区域码',
+ `deviceName` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备名称',
+ `manufacturer` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生产厂商',
+ `model` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '型号',
+ `version` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '软件版本',
+ `userName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '系统管理用户名',
+ `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '系统管理密码',
+ `urlPath` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'URL路径',
+ `urlType` int(11) NOT NULL DEFAULT 0 COMMENT 'URL类型: 0: HTTP, 1: HTTPS',
+ `readme` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '备注',
+ `status` int(11) NOT NULL DEFAULT 0 COMMENT '状态,0:正常,1:锁定,2:禁用, 3:删除',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `ipAddr`(`ipAddr`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Table structure for dispose_task
+-- ----------------------------
+DROP TABLE IF EXISTS `dispose_task`;
+CREATE TABLE `dispose_task` (
+ `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '处置任务唯一标识符',
+ `deviceId` int(10) NOT NULL COMMENT '处置设备唯一标识符',
+ `accountId` int(10) UNSIGNED NOT NULL COMMENT '用户唯一标识符',
+ `disposeCapacity` int(11) NOT NULL COMMENT '处置能力类型:0:清洗 1:高防 2:黑洞 3:检测',
+ `disposeObject` varchar(4096) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '处置对象',
+ `objectType` int(8) NOT NULL COMMENT '处置对象类型:\r\n0:IP\r\n1:域名 \r\n2:URL',
+ `createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '开始时间',
+ `planEndTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '计划结束时间',
+ `endTime` timestamp(0) NULL DEFAULT '1970-01-02 00:00:00' COMMENT '实际结束时间',
+ `flowDirection` int(11) NOT NULL DEFAULT 2 COMMENT '流量方向, 0:流入;1:流出;2:双向',
+ `attackType` bigint(20) UNSIGNED NOT NULL DEFAULT 18446744073709551615 COMMENT '攻击类型,默认0, 全部攻击',
+ `flowBandWidth` int(10) UNSIGNED NULL DEFAULT 1024 COMMENT '攻击流量占用带宽(MB)',
+ `currentStatus` int(11) NOT NULL DEFAULT 0 COMMENT '状态,0:停止。1:启动',
+ PRIMARY KEY (`id`) USING BTREE,
+ INDEX `dispose_task_device_capacity_id_fk`(`disposeCapacity`) USING BTREE,
+ INDEX `dispose_task_user_account_id_fk`(`accountId`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Table structure for user_account
-- ----------------------------
DROP TABLE IF EXISTS `user_account`;
-CREATE TABLE `user_account`
-(
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '账户唯一编号',
- `username` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
- `password` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
- `lastLoginTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后一次成功登录时间',
- `lockTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '账户锁定时间',
- `status` int(11) NULL DEFAULT NULL COMMENT '账户状态',
- PRIMARY KEY (`id`) USING BTREE,
- UNIQUE INDEX `USERNAME` (`username`) USING BTREE
-) ENGINE = InnoDB
- AUTO_INCREMENT = 1
- CHARACTER SET = utf8
- COLLATE = utf8_general_ci
- ROW_FORMAT = Dynamic;
-
+CREATE TABLE `user_account` (
+ `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '账户唯一编号',
+ `username` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
+ `password` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
+ `createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
+ `operators` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '操作员',
+ `lastLoginTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '最后一次成功登录时间',
+ `token` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '用户token',
+ `lastAccess` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '最后一次访问时间戳',
+ `lockTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '账户锁定时间',
+ `pwdErrTimes` int(10) NOT NULL DEFAULT 0 COMMENT '密码错误次数',
+ `status` int(11) NULL DEFAULT 0 COMMENT '账户状态',
+ PRIMARY KEY (`id`) USING BTREE,
+ UNIQUE INDEX `USERNAME`(`username`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
diff --git a/src/main/resources/mappers/DisposeTask.xml b/src/main/resources/mappers/DisposeTask.xml
index 14e82295..19813b2d 100644
--- a/src/main/resources/mappers/DisposeTask.xml
+++ b/src/main/resources/mappers/DisposeTask.xml
@@ -6,7 +6,8 @@
-
+
+
@@ -103,7 +104,7 @@
FROM dispose_task dt LEFT JOIN device_task ti on dt.id = ti.taskId
WHERE
dt.disposeCapacity = #{capType} AND
- dt.disposeIp = #{disposeIp} AND
+ dt.disposeObject = #{disposeObject} AND
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_FINISHED.getValue()} AND
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_CANCELED.getValue()} AND
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_EXPIRED.getValue()} AND
@@ -130,10 +131,10 @@
- INSERT IGNORE INTO dispose_task(deviceId, accountId, disposeCapacity, disposeIp,
+ INSERT IGNORE INTO dispose_task(deviceId, accountId, disposeCapacity, disposeObject, objectType,
planEndTime, flowDirection, attackType, flowBandWidth,
currentStatus)
- VALUES (#{deviceId}, #{accountId}, #{disposeCapacity}, #{disposeIp},
+ VALUES (#{deviceId}, #{accountId}, #{disposeCapacity}, #{disposeObject}, #{objectType},
date_add(now(), interval #{planEndTime} MINUTE), #{flowDirection}, #{attackType},
#{flowBandWidth}, ${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()})
diff --git a/src/main/resources/test_db/unit_test.sql b/src/main/resources/test_db/unit_test.sql
index 27a1825f..623e9489 100644
--- a/src/main/resources/test_db/unit_test.sql
+++ b/src/main/resources/test_db/unit_test.sql
@@ -116,7 +116,8 @@ CREATE TABLE `dispose_task` (
`deviceId` int(10) NOT NULL COMMENT '处置设备唯一标识符',
`accountId` int(10) UNSIGNED NOT NULL COMMENT '用户唯一标识符',
`disposeCapacity` int(11) NOT NULL COMMENT '处置能力类型:0:清洗 1:高防 2:黑洞 3:检测',
- `disposeIp` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '处置IP',
+ `disposeObject` varchar(4096) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '处置对象',
+ `objectType` int(8) NOT NULL COMMENT '处置对象类型:\r\n0:IP\r\n1:域名 \r\n2:URL',
`createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '开始时间',
`planEndTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '计划结束时间',
`endTime` timestamp(0) NULL DEFAULT '1970-01-02 00:00:00' COMMENT '实际结束时间',
@@ -132,8 +133,8 @@ CREATE TABLE `dispose_task` (
-- ----------------------------
-- Records of dispose_task
-- ----------------------------
-INSERT INTO `dispose_task` VALUES (1, -1, 1, 0, '192.168.10.1', CURRENT_TIMESTAMP, date_add(now(), interval 60 MINUTE), null, 2, 8796093022207, 1024, 0);
-INSERT INTO `dispose_task` VALUES (2, -1, 1, 0, '192.168.10.2', CURRENT_TIMESTAMP, date_add(now(), interval 60 MINUTE), null, 2, 8796093022207, 1024, 0);
+INSERT INTO `dispose_task` VALUES (1, -1, 1, 0, '192.168.10.1', 1, CURRENT_TIMESTAMP, date_add(now(), interval 60 MINUTE), null, 2, 8796093022207, 1024, 0);
+INSERT INTO `dispose_task` VALUES (2, -1, 1, 0, '192.168.10.2', 1, CURRENT_TIMESTAMP, date_add(now(), interval 60 MINUTE), null, 2, 8796093022207, 1024, 0);
-- ----------------------------
-- Table structure for user_account
diff --git a/src/test/java/com/dispose/test/dev/controller/DisposeTaskControllerTest.java b/src/test/java/com/dispose/test/dev/controller/DisposeTaskControllerTest.java
index 0a0600e1..0e558321 100644
--- a/src/test/java/com/dispose/test/dev/controller/DisposeTaskControllerTest.java
+++ b/src/test/java/com/dispose/test/dev/controller/DisposeTaskControllerTest.java
@@ -144,7 +144,7 @@ public class DisposeTaskControllerTest extends InitTestEnvironment {
disposeTaskMapper.selectAll().forEach(v -> {
if (v.getDeviceId().equals(Long.valueOf(req.getId())) &&
- v.getDisposeIp().equals(req.getDisposeIp()) &&
+ v.getDisposeObject().equals(req.getDisposeIp()) &&
v.getAttackType().equals((long) DDoSAttackType.ACK_FLOOD.getValue())) {
Assert.assertEquals(Long.valueOf(rspInfo.getMsgContent().getTaskId()), v.getId());
}
@@ -164,7 +164,7 @@ public class DisposeTaskControllerTest extends InitTestEnvironment {
TaskStartReq req = TaskStartReq.builder()
.id(String.valueOf(disposeTask.getDeviceId()))
.type(disposeTask.getDisposeCapacity().getValue())
- .disposeIp(disposeTask.getDisposeIp())
+ .disposeIp(disposeTask.getDisposeObject())
.disposeTime(60)
.flowDirection(NetflowDirection.DIRECTION_IN.getValue())
.attackType(new Integer[]{DDoSAttackType.ACK_FLOOD.getValue()})
diff --git a/src/test/java/com/dispose/test/dev/manager/DisposeTaskManagerTest.java b/src/test/java/com/dispose/test/dev/manager/DisposeTaskManagerTest.java
index e1d4548e..c52eb0b1 100644
--- a/src/test/java/com/dispose/test/dev/manager/DisposeTaskManagerTest.java
+++ b/src/test/java/com/dispose/test/dev/manager/DisposeTaskManagerTest.java
@@ -2,6 +2,7 @@ package com.dispose.test.dev.manager;
import com.dispose.common.DDoSAttackType;
import com.dispose.common.DisposeCapacityType;
+import com.dispose.common.DisposeObjectType;
import com.dispose.common.DisposeTaskStatus;
import com.dispose.common.ErrorCode;
import com.dispose.common.NetflowDirection;
@@ -75,7 +76,7 @@ public class DisposeTaskManagerTest extends InitTestEnvironment {
@Test
public void a1_disposeIpRunning() {
disposeTaskMapper.selectAll().forEach(v -> {
- DisposeTask runningResult = disposeTaskManager.getDisposeTask(v.getDeviceId(), v.getDisposeIp(),
+ DisposeTask runningResult = disposeTaskManager.getDisposeTask(v.getDeviceId(), v.getDisposeObject(),
v.getDisposeCapacity());
log.info("runningResult-->{}", runningResult);
@@ -178,7 +179,8 @@ public class DisposeTaskManagerTest extends InitTestEnvironment {
.deviceId(dId)
.accountId(uId)
.disposeCapacity(DisposeCapacityType.CLEANUP)
- .disposeIp("192.168.0.1")
+ .disposeObject("192.168.0.1")
+ .objectType(DisposeObjectType.IP)
.planEndTime("30")
.flowDirection(NetflowDirection.DIRECTION_BI)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new DDoSAttackType[]{DDoSAttackType.ALL_ATTACKS}))
diff --git a/src/test/java/com/dispose/test/dev/mapper/DisposeTaskMapperTest.java b/src/test/java/com/dispose/test/dev/mapper/DisposeTaskMapperTest.java
index f194b7fc..f9904c1e 100644
--- a/src/test/java/com/dispose/test/dev/mapper/DisposeTaskMapperTest.java
+++ b/src/test/java/com/dispose/test/dev/mapper/DisposeTaskMapperTest.java
@@ -2,6 +2,7 @@ package com.dispose.test.dev.mapper;
import com.dispose.common.DDoSAttackType;
import com.dispose.common.DisposeCapacityType;
+import com.dispose.common.DisposeObjectType;
import com.dispose.common.DisposeTaskStatus;
import com.dispose.common.NetflowDirection;
import com.dispose.mapper.DisposeDeviceMapper;
@@ -76,7 +77,8 @@ public class DisposeTaskMapperTest extends InitTestEnvironment {
.deviceId(dId)
.accountId(uId)
.disposeCapacity(DisposeCapacityType.CLEANUP)
- .disposeIp("192.168.0.1")
+ .disposeObject("192.168.0.1")
+ .objectType(DisposeObjectType.IP)
.planEndTime("30")
.flowDirection(NetflowDirection.DIRECTION_BI)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new DDoSAttackType[]{DDoSAttackType.ALL_ATTACKS}))
diff --git a/src/test/java/com/dispose/test/dev/service/DeviceTaskManagerServiceTest.java b/src/test/java/com/dispose/test/dev/service/DeviceTaskManagerServiceTest.java
index 1ac1cd9e..a7ee324c 100644
--- a/src/test/java/com/dispose/test/dev/service/DeviceTaskManagerServiceTest.java
+++ b/src/test/java/com/dispose/test/dev/service/DeviceTaskManagerServiceTest.java
@@ -2,6 +2,7 @@ package com.dispose.test.dev.service;
import com.dispose.common.DDoSAttackType;
import com.dispose.common.DisposeCapacityType;
+import com.dispose.common.DisposeObjectType;
import com.dispose.common.ErrorCode;
import com.dispose.common.NetflowDirection;
import com.dispose.manager.DisposeDeviceManager;
@@ -98,7 +99,8 @@ public class DeviceTaskManagerServiceTest extends InitTestEnvironment {
.deviceId(dId)
.accountId(uId)
.disposeCapacity(DisposeCapacityType.CLEANUP)
- .disposeIp("192.168.0.1")
+ .disposeObject("192.168.0.1")
+ .objectType(DisposeObjectType.IP)
.planEndTime("30")
.flowDirection(NetflowDirection.DIRECTION_BI)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new DDoSAttackType[]{DDoSAttackType.ALL_ATTACKS}))
diff --git a/src/test/java/com/dispose/test/dev/service/DisposeTaskServiceTest.java b/src/test/java/com/dispose/test/dev/service/DisposeTaskServiceTest.java
index 532e5f1c..649d4929 100644
--- a/src/test/java/com/dispose/test/dev/service/DisposeTaskServiceTest.java
+++ b/src/test/java/com/dispose/test/dev/service/DisposeTaskServiceTest.java
@@ -3,6 +3,7 @@ package com.dispose.test.dev.service;
import com.dispose.common.DDoSAttackType;
import com.dispose.common.DisposeCapacityType;
import com.dispose.common.DisposeConfigValue;
+import com.dispose.common.DisposeObjectType;
import com.dispose.common.DisposeTaskStatus;
import com.dispose.common.ErrorCode;
import com.dispose.common.NetflowDirection;
@@ -99,7 +100,8 @@ public class DisposeTaskServiceTest extends InitTestEnvironment {
.deviceId(disposeDeviceManager.getAllNormalDisposeDevices().get(0).getId())
.accountId(1L)
.disposeCapacity(DisposeCapacityType.CLEANUP)
- .disposeIp("192.168.5.2")
+ .disposeObject("192.168.5.2")
+ .objectType(DisposeObjectType.IP)
.planEndTime("30")
.flowDirection(NetflowDirection.DIRECTION_IN)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new Integer[]{DDoSAttackType.ALL_ATTACKS.getValue()}))
@@ -124,7 +126,7 @@ public class DisposeTaskServiceTest extends InitTestEnvironment {
Assert.assertEquals(result.getFirstParam().getCode(), ErrorCode.ERR_TASKRUNNING.getCode());
Assert.assertEquals(result.getSecondParam().getId(), disposeTaskManager.getDisposeTask(newTask.getDeviceId(),
- newTask.getDisposeIp(), newTask.getDisposeCapacity()).getId());
+ newTask.getDisposeObject(), newTask.getDisposeCapacity()).getId());
});
}
@@ -137,7 +139,8 @@ public class DisposeTaskServiceTest extends InitTestEnvironment {
.deviceId(disposeDeviceManager.getAllNormalDisposeDevices().get(0).getId())
.accountId(1L)
.disposeCapacity(DisposeCapacityType.CLEANUP)
- .disposeIp("192.168.5.2")
+ .disposeObject("192.168.5.2")
+ .objectType(DisposeObjectType.IP)
.planEndTime("30")
.flowDirection(NetflowDirection.DIRECTION_IN)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new Integer[]{DDoSAttackType.ALL_ATTACKS.getValue()}))
@@ -175,7 +178,8 @@ public class DisposeTaskServiceTest extends InitTestEnvironment {
.deviceId(disposeDeviceManager.getAllNormalDisposeDevices().get(0).getId())
.accountId(1L)
.disposeCapacity(DisposeCapacityType.CLEANUP)
- .disposeIp("192.168.10.2")
+ .disposeObject("192.168.10.2")
+ .objectType(DisposeObjectType.IP)
.planEndTime("60")
.flowDirection(NetflowDirection.DIRECTION_IN)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new Integer[]{DDoSAttackType.ALL_ATTACKS.getValue()}))
diff --git a/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskList.java b/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskList.java
index 4df6ca76..52b417d4 100644
--- a/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskList.java
+++ b/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskList.java
@@ -2,6 +2,7 @@ package com.dispose.test.testcase.qa.v200;
import com.dispose.common.DDoSAttackType;
import com.dispose.common.DisposeCapacityType;
+import com.dispose.common.DisposeObjectType;
import com.dispose.common.ErrorCode;
import com.dispose.common.NetflowDirection;
import com.dispose.pojo.dto.protocol.task.GetTaskRsp;
@@ -100,7 +101,8 @@ public class P2TaskList {
.deviceId(1L)
.accountId(1L)
.disposeCapacity(DisposeCapacityType.CLEANUP)
- .disposeIp("192.168.0." + i)
+ .disposeObject("192.168.0." + i)
+ .objectType(DisposeObjectType.IP)
.planEndTime("60")
.flowDirection(NetflowDirection.DIRECTION_BI)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new DDoSAttackType[]{DDoSAttackType.ALL_ATTACKS}))