REM:
1. 删除无用的单元测试文件
2. 设备任务externId字段修改为字符串类型
3. 更新数据库初始化脚本
4. 更新Restful公共接口
5. 增加亿阳处置设备
This commit is contained in:
HuangXin 2020-09-29 11:31:15 +08:00
parent 240e2fb721
commit f55c06a626
25 changed files with 890 additions and 340 deletions

View File

@ -17,7 +17,6 @@ public interface DisposeAbility {
/** /**
* Init device env. * Init device env.
*
* @param urlPath the url path * @param urlPath the url path
* @param username the username * @param username the username
* @param password the password * @param password the password
@ -34,10 +33,10 @@ public interface DisposeAbility {
* @param duration the duration * @param duration the duration
* @return the mul return type * @return the mul return type
*/ */
MulReturnType<ErrorCode, Long> runDispose(String ip, DisposeCapacityType capType, MulReturnType<ErrorCode, String> runDispose(String ip, DisposeCapacityType capType,
@Nullable NetflowDirection nfDirection, @Nullable NetflowDirection nfDirection,
@Nullable Integer attackType, @Nullable Integer attackType,
@Nullable Long duration); @Nullable Long duration);
/** /**
* Stop dispose mul return type. * Stop dispose mul return type.
@ -52,7 +51,7 @@ public interface DisposeAbility {
MulReturnType<ErrorCode, Long> stopDispose(String ip, DisposeCapacityType capType, MulReturnType<ErrorCode, Long> stopDispose(String ip, DisposeCapacityType capType,
@Nullable NetflowDirection nfDirection, @Nullable NetflowDirection nfDirection,
@Nullable Integer attackType, @Nullable Integer attackType,
@Nullable Long taskId); @Nullable String taskId);
/** /**
* Gets ability device fireware. * Gets ability device fireware.

View File

@ -55,7 +55,6 @@ public class DpTechAbilityImpl implements DisposeAbility {
/** /**
* Init device env. * Init device env.
*
* @param urlPath the url path * @param urlPath the url path
* @param username the username * @param username the username
* @param password the password * @param password the password
@ -105,10 +104,10 @@ public class DpTechAbilityImpl implements DisposeAbility {
* @return the mul return type * @return the mul return type
*/ */
@Override @Override
public MulReturnType<ErrorCode, Long> runDispose(String ip, DisposeCapacityType capType, public MulReturnType<ErrorCode, String> runDispose(String ip, DisposeCapacityType capType,
NetflowDirection nfDirection, NetflowDirection nfDirection,
Integer attackType, Integer attackType,
Long duration) { Long duration) {
ErrorCode err = ErrorCode.ERR_OK; ErrorCode err = ErrorCode.ERR_OK;
try { try {
@ -156,7 +155,7 @@ public class DpTechAbilityImpl implements DisposeAbility {
DisposeCapacityType capType, DisposeCapacityType capType,
NetflowDirection nfDirection, NetflowDirection nfDirection,
Integer attackType, Integer attackType,
Long taskId) { String taskId) {
ErrorCode err = ErrorCode.ERR_OK; ErrorCode err = ErrorCode.ERR_OK;
try { try {
@ -216,17 +215,17 @@ public class DpTechAbilityImpl implements DisposeAbility {
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("DpTech") .vendor("DpTech")
.model("UMC") .model("UMC")
.firmware("Unknown") .firmware("Unknown")
.os("Windows Server") .os("Windows Server")
.kernel("Windows") .kernel("Windows")
.arch("x86_64") .arch("x86_64")
.version("5.7.31") .version("5.7.31")
.memory(-1) .memory(-1)
.freeMemory(-1) .freeMemory(-1)
.cpuUsed(-1) .cpuUsed(-1)
.build()); .build());
} }
/** /**

View File

@ -8,7 +8,7 @@ import com.dispose.pojo.po.MulReturnType;
import com.dispose.pojo.vo.DeviceFirewareInfo; import com.dispose.pojo.vo.DeviceFirewareInfo;
import com.haohan.dispose.common.HaoHanStartCleanResp; import com.haohan.dispose.common.HaoHanStartCleanResp;
import com.haohan.dispose.common.HaoHanStopCleanResp; import com.haohan.dispose.common.HaoHanStopCleanResp;
import com.haohan.dispose.protocol.RestfulInterface; import com.haohan.dispose.protocol.HaoHanInterface;
import inet.ipaddr.IPAddress; import inet.ipaddr.IPAddress;
import inet.ipaddr.IPAddressString; import inet.ipaddr.IPAddressString;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -32,7 +32,7 @@ public class HaoHanAbilityImpl implements DisposeAbility {
/** /**
* The Restful interface. * The Restful interface.
*/ */
private final RestfulInterface restfulInterface = new RestfulInterface(); private final HaoHanInterface restfulInterface = new HaoHanInterface();
/** /**
* The Url root path. * The Url root path.
*/ */
@ -61,10 +61,10 @@ public class HaoHanAbilityImpl implements DisposeAbility {
* @return the mul return type * @return the mul return type
*/ */
@Override @Override
public MulReturnType<ErrorCode, Long> runDispose(String ip, DisposeCapacityType capType, public MulReturnType<ErrorCode, String> runDispose(String ip, DisposeCapacityType capType,
@Nullable NetflowDirection nfDirection, @Nullable NetflowDirection nfDirection,
@Nullable Integer attackType, @Nullable Integer attackType,
@Nullable Long duration) { @Nullable Long duration) {
try { try {
log.info("++++Begging Haohan Start Cleanup Task: {}", ip); log.info("++++Begging Haohan Start Cleanup Task: {}", ip);
@ -93,7 +93,7 @@ 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, String.valueOf(resp.getCleanTaskId()));
} catch (Exception ex) { } catch (Exception ex) {
log.error("----Exception Haohan Start Cleanup Task: {}, {}, {}", ip, nfDirection, duration); log.error("----Exception Haohan Start Cleanup Task: {}, {}, {}", ip, nfDirection, duration);
return new MulReturnType<>(ErrorCode.ERR_SYSTEMEXCEPTION, null); return new MulReturnType<>(ErrorCode.ERR_SYSTEMEXCEPTION, null);
@ -114,7 +114,7 @@ public class HaoHanAbilityImpl implements DisposeAbility {
public MulReturnType<ErrorCode, Long> stopDispose(String ip, DisposeCapacityType capType, public MulReturnType<ErrorCode, Long> stopDispose(String ip, DisposeCapacityType capType,
@Nullable NetflowDirection nfDirection, @Nullable NetflowDirection nfDirection,
@Nullable Integer attackType, @Nullable Integer attackType,
@Nullable Long taskId) { @Nullable String taskId) {
try { try {
log.debug("++++Begging Haohan Stop Cleanup Task: {}", taskId); log.debug("++++Begging Haohan Stop Cleanup Task: {}", taskId);
@ -127,7 +127,8 @@ public class HaoHanAbilityImpl implements DisposeAbility {
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,
Integer.parseInt(taskId),
DISPOSE_PLATFORM_NAME); DISPOSE_PLATFORM_NAME);
if (resp == null) { if (resp == null) {
@ -169,17 +170,17 @@ public class HaoHanAbilityImpl implements DisposeAbility {
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());
} }
/** /**

View File

@ -22,7 +22,6 @@ public class VirtualAbilityImpl implements DisposeAbility {
/** /**
* Init device env. * Init device env.
*
* @param urlPath the url path * @param urlPath the url path
* @param username the username * @param username the username
* @param password the password * @param password the password
@ -47,9 +46,9 @@ public class VirtualAbilityImpl implements DisposeAbility {
* @return the mul return type * @return the mul return type
*/ */
@Override @Override
public MulReturnType<ErrorCode, Long> runDispose(String ip, DisposeCapacityType capType, public MulReturnType<ErrorCode, String> runDispose(String ip, DisposeCapacityType capType,
@Nullable NetflowDirection nfDirection, @Nullable NetflowDirection nfDirection,
@Nullable Integer attackType, @Nullable Long duration) { @Nullable Integer attackType, @Nullable Long duration) {
return new MulReturnType<>(ErrorCode.ERR_OK, null); return new MulReturnType<>(ErrorCode.ERR_OK, null);
} }
@ -66,7 +65,7 @@ public class VirtualAbilityImpl implements DisposeAbility {
@Override @Override
public MulReturnType<ErrorCode, Long> stopDispose(String ip, DisposeCapacityType capType, public MulReturnType<ErrorCode, Long> stopDispose(String ip, DisposeCapacityType capType,
@Nullable NetflowDirection nfDirection, @Nullable NetflowDirection nfDirection,
@Nullable Integer attackType, @Nullable Long taskId) { @Nullable Integer attackType, @Nullable String taskId) {
return new MulReturnType<>(ErrorCode.ERR_OK, null); return new MulReturnType<>(ErrorCode.ERR_OK, null);
} }

View File

@ -0,0 +1,199 @@
package com.dispose.ability.impl;
import com.dispose.ability.DisposeAbility;
import com.dispose.common.DisposeCapacityType;
import com.dispose.common.ErrorCode;
import com.dispose.common.NetflowDirection;
import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO;
import com.dispose.pojo.po.MulReturnType;
import com.dispose.pojo.vo.DeviceFirewareInfo;
import com.dispose.yiyang.dispose.common.YiYangLoginRsp;
import com.dispose.yiyang.dispose.protocol.YiYangInterface;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
/**
* The type Yi yang ability.
*
* @author <huangxin@cmhi.chinamoblie.com>
*/
@Slf4j
public class YiYangAbilityImpl implements DisposeAbility {
/**
* The Restful interface.
*/
private final YiYangInterface restfulInterface = new YiYangInterface();
/**
* The Url root path.
*/
@Getter
@Setter
private String urlRootPath;
/**
* The Username.
*/
@Getter
@Setter
private String username;
/**
* The Password.
*/
@Getter
@Setter
private String password;
/**
* The Token.
*/
private String token;
/**
* Init device env.
*
* @param urlPath the url path
* @param username the username
* @param password the password
*/
@Override
public void initDeviceEnv(String urlPath, String username, String password) {
this.urlRootPath = urlPath;
this.username = username;
this.password = password;
restfulInterface.setParams(1, 0);
upgradeToken();
}
/**
* Run dispose mul return type.
*
* @param ip the ip
* @param capType the cap type
* @param nfDirection the nf direction
* @param attackType the attack type
* @param duration the duration
* @return the mul return type
*/
@Override
public MulReturnType<ErrorCode, String> runDispose(String ip, DisposeCapacityType capType,
@Nullable NetflowDirection nfDirection,
@Nullable Integer attackType, @Nullable Long duration) {
return null;
}
/**
* Stop dispose mul return type.
*
* @param ip the ip
* @param capType the cap type
* @param nfDirection the nf direction
* @param attackType the attack type
* @param taskId the task id
* @return the mul return type
*/
@Override
public MulReturnType<ErrorCode, Long> stopDispose(String ip, DisposeCapacityType capType,
@Nullable NetflowDirection nfDirection,
@Nullable Integer attackType, @Nullable String taskId) {
return null;
}
/**
* Gets ability device fireware.
*
* @return the ability device fireware
*/
@Override
public MulReturnType<ErrorCode, DeviceFirewareInfo> getAbilityDeviceFireware() {
return new MulReturnType<>(ErrorCode.ERR_OK,
DeviceFirewareInfo.builder()
.vendor("YiYang")
.model("Unknown")
.firmware("Unknown")
.os("Linux Server")
.kernel("Linux")
.arch("x86_64")
.version("Unknown")
.memory(-1)
.freeMemory(-1)
.cpuUsed(-1)
.build());
}
/**
* To device attack type long.
*
* @param ddosAttackTypeMask the ddos attack type mask
* @return the long
*/
@Override
public Long toDeviceAttackType(Long ddosAttackTypeMask) {
return ddosAttackTypeMask;
}
/**
* Gets device link status.
*
* @return the device link status
*/
@Override
public boolean getDeviceLinkStatus() {
try {
if (token == null || token.length() == 0) {
return false;
}
ErrorCode err = restfulInterface.getLinkStatus(urlRootPath, token);
if (err == ErrorCode.ERR_LOGOUT) {
err = restfulInterface.getLinkStatus(urlRootPath, token);
}
return err == ErrorCode.ERR_OK;
} catch (Exception ex) {
log.error(ex.getMessage());
}
return false;
}
/**
* Gets dispose device protect object.
*/
@Override
public void getDisposeDeviceProtectObject() {
}
/**
* Is carry protect ip boolean.
*
* @param ipAddr the ip addr
* @return the boolean
*/
@Override
public boolean isCarryProtectIp(String ipAddr) {
return true;
}
/**
* Upgrade token.
*/
private void upgradeToken() {
try {
ProtocolRespDTO<YiYangLoginRsp> logInfo = restfulInterface.login(urlRootPath, username, password);
if (logInfo != null && logInfo.getMsgContent().getStatus() == ErrorCode.ERR_OK.getCode()) {
this.token = logInfo.getMsgContent().getToken();
}
} catch (Exception ignored) {
}
}
}

View File

@ -7,31 +7,48 @@ package com.dispose.common;
*/ */
public enum DisposeDeviceType implements BaseEnum { public enum DisposeDeviceType implements BaseEnum {
/** /**
* Dptech umc dispose device type. * The Dptech umc.
*/ */
DPTECH_UMC(0, "迪普UMC管理平台"), DPTECH_UMC(0, "迪普UMC管理平台"),
/** /**
* Haohan platform dispose device type. * The Haohan platform.
*/ */
HAOHAN_PLATFORM(1, "浩瀚处置设备"), HAOHAN_PLATFORM(1, "浩瀚处置设备"),
/** /**
* Virtual dispose dispose device type. * Yiyang platform dispose device type.
*/
YIYANG_PLATFORM(2, "亿阳处置设备"),
/**
* The Virtual dispose.
*/ */
VIRTUAL_DISPOSE(999, "虚拟处置设备"); VIRTUAL_DISPOSE(999, "虚拟处置设备");
/**
* The Code.
*/
private final int code; private final int code;
/**
* The Readme.
*/
private final String readme; private final String readme;
/**
* Instantiates a new Dispose device type.
*
* @param code the code
* @param readme the readme
*/
DisposeDeviceType(int code, String readme) { DisposeDeviceType(int code, String readme) {
this.code = code; this.code = code;
this.readme = readme; this.readme = readme;
} }
/** /**
* Gets code. * Gets value.
* *
* @return the code * @return the value
*/ */
@Override @Override
public Integer getValue() { public Integer getValue() {
@ -39,9 +56,9 @@ public enum DisposeDeviceType implements BaseEnum {
} }
/** /**
* Gets readme. * Gets description.
* *
* @return the readme * @return the description
*/ */
@Override @Override
public String getDescription() { public String getDescription() {

View File

@ -272,8 +272,9 @@ public enum ErrorCode {
case ERR_INPUTMISS: case ERR_INPUTMISS:
return HttpServletResponse.SC_BAD_REQUEST; return HttpServletResponse.SC_BAD_REQUEST;
case ERR_UNSUPPORT: case ERR_UNSUPPORT:
case ERR_UNKNOWNINTERFACE:
return HttpServletResponse.SC_METHOD_NOT_ALLOWED; return HttpServletResponse.SC_METHOD_NOT_ALLOWED;
case ERR_UNKNOWNINTERFACE:
return HttpServletResponse.SC_NOT_FOUND;
default: default:
return HttpServletResponse.SC_INTERNAL_SERVER_ERROR; return HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
} }

View File

@ -117,7 +117,7 @@ public interface DeviceTaskManager {
* @param externId the extern id * @param externId the extern id
* @return the task extern id * @return the task extern id
*/ */
boolean setTaskExternId(Long id, Long externId); boolean setTaskExternId(Long id, String externId);
/** /**
* Gets task by id. * Gets task by id.

View File

@ -269,7 +269,7 @@ public class DeviceTaskManagerImpl implements DeviceTaskManager {
* @return the task extern id * @return the task extern id
*/ */
@Override @Override
public boolean setTaskExternId(Long id, Long externId) { public boolean setTaskExternId(Long id, String externId) {
return deviceTaskMapper.changeExternId(id, externId) == 1; return deviceTaskMapper.changeExternId(id, externId) == 1;
} }

View File

@ -143,5 +143,5 @@ public interface DeviceTaskMapper {
* @return the int * @return the int
*/ */
int changeExternId(@Param("id") Long id, int changeExternId(@Param("id") Long id,
@Param("externId") Long externId); @Param("externId") String externId);
} }

View File

@ -78,7 +78,7 @@ public class DeviceTask implements Serializable {
/** /**
* The Extern id. * The Extern id.
*/ */
private Long externId; private String externId;
/** /**
* The Err retry. * The Err retry.
*/ */

View File

@ -0,0 +1,153 @@
package com.dispose.restful;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import com.dispose.common.ConstValue;
import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMethod;
import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
/**
* The type Restful interface.
*
* @author <huangxin@cmhi.chinamoblie.com>
*/
@Slf4j
public class RestfulInterface {
/**
* The constant OBJECT_MAPPER.
*/
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
/**
* Post json string.
*
* @param url the url
* @param header the header
* @param body the body
* @return the string
*/
private static String postJson(String url, Map<String, String> header, String body) {
return HttpRequest.post(url).header(Header.CONTENT_TYPE, "application/json").addHeaders(header).body(body)
.execute().body();
}
/**
* Gets json.
*
* @param url the url
* @param header the header
* @return the json
*/
private static String getJson(String url, Map<String, String> header) {
return HttpRequest.get(url).header(Header.CONTENT_TYPE, "application/json").addHeaders(header)
.execute().body();
}
/**
* Protocol run t.
*
* @param <T> the type parameter
* @param <E> the type parameter
* @param url the url
* @param obj the obj
* @param outType the out type
* @return the t
*/
public static <T, E> T protocolRun(String url, E obj, Class<T> outType) {
try {
Map<String, String> httpHeadMap = new HashMap<>(2);
httpHeadMap.put(String.valueOf(Header.CONNECTION), "keep-alive");
httpHeadMap.put(String.valueOf(Header.ACCEPT), "*/*");
String svrResp = postJson(url, httpHeadMap, OBJECT_MAPPER.writeValueAsString(obj));
if (svrResp == null) {
log.debug("Server return null: {}", url);
return null;
}
return OBJECT_MAPPER.readValue(svrResp, outType);
} catch (JsonProcessingException e) {
log.debug("System exception: ", e);
return null;
}
}
/**
* Base pro run protocol resp dto.
*
* @param <T> the type parameter
* @param <E> the type parameter
* @param url the url
* @param token the token
* @param obj the obj
* @param subClass the sub class
* @param reqType the req type
* @return the protocol resp dto
*/
public static <T, E> ProtocolRespDTO<T> baseProRun(String url, String token, E obj, Class<T> subClass,
RequestMethod reqType) {
try {
String svrResp = null;
Map<String, String> httpHeadMap = new HashMap<>(2);
httpHeadMap.put(String.valueOf(Header.CONNECTION), "keep-alive");
httpHeadMap.put(String.valueOf(Header.ACCEPT), "*/*");
if (token != null && token.length() > 0) {
httpHeadMap.put(String.valueOf(Header.AUTHORIZATION), ConstValue.STRING_HTTP_AUTH_HEAD + token);
}
switch (reqType) {
case GET:
svrResp = getJson(url, httpHeadMap);
break;
case POST:
svrResp = postJson(url, httpHeadMap, OBJECT_MAPPER.writeValueAsString(obj));
break;
default:
log.error("Unknown method: {}", reqType);
break;
}
if (svrResp == null) {
log.debug("Server return null: {}", url);
return null;
}
return OBJECT_MAPPER.readValue(svrResp,
new TypeReference<ProtocolRespDTO<T>>() {
@Override
public Type getType() {
return createRespType(subClass);
}
});
} catch (JsonProcessingException e) {
log.debug("System exception: ", e);
return null;
}
}
/**
* Create resp type type.
*
* @param <T> the type parameter
* @param c the c
* @return the type
*/
private static <T> Type createRespType(Class<T> c) {
Type[] types = new Type[1];
types[0] = c;
return ParameterizedTypeImpl.make(ProtocolRespDTO.class, types,
ProtocolRespDTO.class.getDeclaringClass());
}
}

View File

@ -59,7 +59,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
* @param disposeTask the dispose task * @param disposeTask the dispose task
*/ */
private void virtualDeviceTaskRun(AbilityInfo ai, DeviceTask deviceTask, DisposeTask disposeTask) { private void virtualDeviceTaskRun(AbilityInfo ai, DeviceTask deviceTask, DisposeTask disposeTask) {
MulReturnType<ErrorCode, Long> ret; MulReturnType<ErrorCode, String> ret;
// 设置任务状态为启动中 // 设置任务状态为启动中
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(deviceTask.getId(), DisposeTaskStatus.TASK_STARTING); deviceTaskManager.changeDisposeDeviceTaskInfoStatus(deviceTask.getId(), DisposeTaskStatus.TASK_STARTING);
@ -119,7 +119,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
* @param disposeTask the dispose task * @param disposeTask the dispose task
*/ */
private void haoHanDeviceTaskRun(AbilityInfo ai, DeviceTask deviceTask, DisposeTask disposeTask) { private void haoHanDeviceTaskRun(AbilityInfo ai, DeviceTask deviceTask, DisposeTask disposeTask) {
MulReturnType<ErrorCode, Long> ret; MulReturnType<ErrorCode, String> ret;
// 重试错误次数过多 // 重试错误次数过多
if (deviceTask.getErrRetry() >= DisposeConfigValue.CALL_ERROR_RETRY_TIMES) { if (deviceTask.getErrRetry() >= DisposeConfigValue.CALL_ERROR_RETRY_TIMES) {
@ -202,7 +202,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
* @param disposeTask the dispose task * @param disposeTask the dispose task
*/ */
private void dpTechDeviceTaskRun(AbilityInfo ai, DeviceTask deviceTask, DisposeTask disposeTask) { private void dpTechDeviceTaskRun(AbilityInfo ai, DeviceTask deviceTask, DisposeTask disposeTask) {
MulReturnType<ErrorCode, Long> ret; MulReturnType<ErrorCode, String> ret;
// 设置任务状态为启动中 // 设置任务状态为启动中
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(deviceTask.getId(), DisposeTaskStatus.TASK_STARTING); deviceTaskManager.changeDisposeDeviceTaskInfoStatus(deviceTask.getId(), DisposeTaskStatus.TASK_STARTING);
@ -568,12 +568,12 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
@Scheduled(fixedDelay = 1000) @Scheduled(fixedDelay = 1000)
public void scheduleRunnerThread() { public void scheduleRunnerThread() {
// 处理处置任务数据 // 处理处置任务数据
//disposeTaskManagerSchedule(); disposeTaskManagerSchedule();
// 处置设备启动任务 // 处置设备启动任务
//deviceTaskRunnerSchedule(); deviceTaskRunnerSchedule();
// 处置设备停止任务 // 处置设备停止任务
//deviceTaskStopSchedule(); deviceTaskStopSchedule();
} }
} }

View File

@ -4,6 +4,7 @@ import com.dispose.ability.DisposeAbility;
import com.dispose.ability.impl.DpTechAbilityImpl; import com.dispose.ability.impl.DpTechAbilityImpl;
import com.dispose.ability.impl.HaoHanAbilityImpl; import com.dispose.ability.impl.HaoHanAbilityImpl;
import com.dispose.ability.impl.VirtualAbilityImpl; import com.dispose.ability.impl.VirtualAbilityImpl;
import com.dispose.ability.impl.YiYangAbilityImpl;
import com.dispose.common.DisposeCapacityType; import com.dispose.common.DisposeCapacityType;
import com.dispose.common.ErrorCode; import com.dispose.common.ErrorCode;
import com.dispose.common.HttpType; import com.dispose.common.HttpType;
@ -111,6 +112,9 @@ public class DisposeAbilityRouterServiceImpl implements DisposeAbilityRouterServ
case HAOHAN_PLATFORM: case HAOHAN_PLATFORM:
db = new HaoHanAbilityImpl(); db = new HaoHanAbilityImpl();
break; break;
case YIYANG_PLATFORM:
db = new YiYangAbilityImpl();
break;
case VIRTUAL_DISPOSE: case VIRTUAL_DISPOSE:
db = new VirtualAbilityImpl(); db = new VirtualAbilityImpl();
break; break;

View File

@ -0,0 +1,24 @@
package com.dispose.yiyang.dispose.common;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* The type Yi yang base resp status.
*
* @author <huangxin@cmhi.chinamoblie.com>
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class YiYangBaseResp {
/**
* The Status.
*/
private Integer status;
/**
* The Message.
*/
private String message;
}

View File

@ -0,0 +1,26 @@
package com.dispose.yiyang.dispose.common;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* The type Yi yang login req.
*
* @author <huangxin@cmhi.chinamoblie.com>
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class YiYangLoginReq {
/**
* The User name.
*/
private String userName;
/**
* The Password.
*/
private String password;
}

View File

@ -0,0 +1,42 @@
package com.dispose.yiyang.dispose.common;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* The type Yi yang login rsp.
*
* @author <huangxin@cmhi.chinamoblie.com>
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({"userName", "token", "logTime", "expireTime", "status", "message"})
public class YiYangLoginRsp extends YiYangBaseResp {
/**
* The User name.
*/
private String userName;
/**
* The Token.
*/
private String token;
/**
* The Log time.
*/
private Long logTime;
/**
* The Expire time.
*/
private Long expireTime;
}

View File

@ -0,0 +1,91 @@
package com.dispose.yiyang.dispose.protocol;
import com.dispose.common.ErrorCode;
import com.dispose.pojo.dto.protocol.base.BaseProtocolDTO;
import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO;
import com.dispose.restful.RestfulInterface;
import com.dispose.yiyang.dispose.common.YiYangBaseResp;
import com.dispose.yiyang.dispose.common.YiYangLoginReq;
import com.dispose.yiyang.dispose.common.YiYangLoginRsp;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletResponse;
/**
* The type Yi yang interface.
*
* @author <huangxin@cmhi.chinamoblie.com>
*/
public class YiYangInterface {
/**
* The Ver.
*/
private int ver;
/**
* The Crypto type.
*/
private int cryptoType;
/**
* Sets params.
*
* @param ver the ver
* @param cryptoType the crypto type
*/
public void setParams(int ver, int cryptoType) {
this.ver = ver;
this.cryptoType = cryptoType;
}
/**
* Login protocol resp dto.
*
* @param baseUrlPath the base url path
* @param username the username
* @param password the password
* @return the protocol resp dto
*/
public ProtocolRespDTO<YiYangLoginRsp> login(String baseUrlPath, String username, String password) {
BaseProtocolDTO<YiYangLoginReq> reqInfo = new BaseProtocolDTO<>();
reqInfo.setMsgContent(YiYangLoginReq.builder()
.userName(username)
.password(password)
.build());
reqInfo.setCryptoType(this.cryptoType);
reqInfo.setVer(this.ver);
reqInfo.setTimeStamp(System.currentTimeMillis());
return RestfulInterface.baseProRun(baseUrlPath + "dispose_device/auth/login",
null,
reqInfo,
YiYangLoginRsp.class,
RequestMethod.POST);
}
/**
* Gets link status.
*
* @param baseUrlPath the base url path
* @param token the token
* @return the link status
*/
public ErrorCode getLinkStatus(String baseUrlPath, String token) {
ProtocolRespDTO<YiYangBaseResp> rspInfo = RestfulInterface.baseProRun(baseUrlPath + "dispose_device/information/linkstatus",
token,
null,
YiYangBaseResp.class,
RequestMethod.GET);
if(rspInfo != null && rspInfo.getMsgContent() != null) {
if(rspInfo.getCode() == HttpServletResponse.SC_UNAUTHORIZED) {
return ErrorCode.ERR_LOGOUT;
} else if(rspInfo.getMsgContent().getStatus() == ErrorCode.ERR_OK.getCode()) {
return ErrorCode.ERR_OK;
}
}
return ErrorCode.ERR_UNKNOWNCMD;
}
}

View File

@ -1,10 +1,7 @@
package com.haohan.dispose.protocol; package com.haohan.dispose.protocol;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import com.dispose.common.ErrorCode; import com.dispose.common.ErrorCode;
import com.fasterxml.jackson.core.JsonProcessingException; import com.dispose.restful.RestfulInterface;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.haohan.dispose.common.HaoHanGetCleanTaskNetflowInfoReq; import com.haohan.dispose.common.HaoHanGetCleanTaskNetflowInfoReq;
import com.haohan.dispose.common.HaoHanGetCleanTaskNetflowInfoResp; import com.haohan.dispose.common.HaoHanGetCleanTaskNetflowInfoResp;
import com.haohan.dispose.common.HaoHanGetCleanTaskStatusReq; import com.haohan.dispose.common.HaoHanGetCleanTaskStatusReq;
@ -18,67 +15,17 @@ import com.haohan.dispose.common.HaoHanStopCleanResp;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
* The type Restful interface. * The type Hao han interface.
* *
* @author <huangxin@cmhi.chinamoblie.com> * @author <huangxin@cmhi.chinamoblie.com>
*/ */
@Slf4j @Slf4j
public class RestfulInterface { public class HaoHanInterface {
/**
* The constant OBJECT_MAPPER.
*/
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
/**
* Post json string.
*
* @param url the url
* @param header the header
* @param body the body
* @return the string
*/
private static String postJson(String url, Map<String, String> header, String body) {
return HttpRequest.post(url).header(Header.CONTENT_TYPE, "application/json").addHeaders(header).body(body)
.execute().body();
}
/**
* Protocol run t.
*
* @param <T> the type parameter
* @param <E> the type parameter
* @param url the url
* @param obj the obj
* @param outType the out type
* @return the t
*/
private <T, E> T protocolRun(String url, E obj, Class<T> outType) {
try {
Map<String, String> httpHeadMap = new HashMap<>(2);
httpHeadMap.put(String.valueOf(Header.CONNECTION), "keep-alive");
httpHeadMap.put(String.valueOf(Header.ACCEPT), "*/*");
String svrResp = postJson(url, httpHeadMap, OBJECT_MAPPER.writeValueAsString(obj));
if (svrResp == null) {
log.debug("Server return null: {}", url);
return null;
}
return OBJECT_MAPPER.readValue(svrResp, outType);
} catch (JsonProcessingException e) {
log.debug("System exception: ", e);
return null;
}
}
/** /**
* Gets clean task status. * Gets clean task status.
* *
@ -87,9 +34,9 @@ public class RestfulInterface {
* @return the clean task status * @return the clean task status
*/ */
public HaoHanGetCleanTaskStatusResp getCleanTaskStatus(String baseUrlPath, Integer taskId) { public HaoHanGetCleanTaskStatusResp getCleanTaskStatus(String baseUrlPath, Integer taskId) {
return protocolRun(baseUrlPath + "/getCleanTaskState", return RestfulInterface.protocolRun(baseUrlPath + "/getCleanTaskState",
HaoHanGetCleanTaskStatusReq.builder().cleanTaskId(taskId).build(), HaoHanGetCleanTaskStatusReq.builder().cleanTaskId(taskId).build(),
HaoHanGetCleanTaskStatusResp.class); HaoHanGetCleanTaskStatusResp.class);
} }
/** /**
@ -102,7 +49,7 @@ public class RestfulInterface {
* @return the hao han start clean resp * @return the hao han start clean resp
*/ */
public HaoHanStartCleanResp startClean(String baseUrlPath, String ipAddr, int times, String readme) { public HaoHanStartCleanResp startClean(String baseUrlPath, String ipAddr, int times, String readme) {
HaoHanStartCleanResp svrResp = protocolRun(baseUrlPath + "/sendTow", HaoHanStartCleanResp svrResp = RestfulInterface.protocolRun(baseUrlPath + "/sendTow",
new HaoHanStartCleanReq(ipAddr, times, readme), new HaoHanStartCleanReq(ipAddr, times, readme),
HaoHanStartCleanResp.class); HaoHanStartCleanResp.class);
@ -158,7 +105,7 @@ public class RestfulInterface {
* @return the hao han stop clean resp * @return the hao han stop clean resp
*/ */
public HaoHanStopCleanResp stopClean(String baseUrlPath, Integer taskId, String readme) { public HaoHanStopCleanResp stopClean(String baseUrlPath, Integer taskId, String readme) {
return protocolRun(baseUrlPath + "/delTow", return RestfulInterface.protocolRun(baseUrlPath + "/delTow",
new HaoHanStopCleanReq(taskId, readme), new HaoHanStopCleanReq(taskId, readme),
HaoHanStopCleanResp.class); HaoHanStopCleanResp.class);
} }
@ -171,7 +118,7 @@ public class RestfulInterface {
* @return the cleaning netflow * @return the cleaning netflow
*/ */
public HaoHanGetCleaningNetflowInfoResp getCleaningNetflow(String baseUrlPath, String readme) { public HaoHanGetCleaningNetflowInfoResp getCleaningNetflow(String baseUrlPath, String readme) {
return protocolRun(baseUrlPath + "/allIpFlow", return RestfulInterface.protocolRun(baseUrlPath + "/allIpFlow",
new HaoHanGetCleaningNetflowInfoReq(readme), new HaoHanGetCleaningNetflowInfoReq(readme),
HaoHanGetCleaningNetflowInfoResp.class); HaoHanGetCleaningNetflowInfoResp.class);
} }
@ -184,7 +131,7 @@ public class RestfulInterface {
* @return the clean task netflow * @return the clean task netflow
*/ */
public HaoHanGetCleanTaskNetflowInfoResp getCleanTaskNetflow(String baseUrlPath, Integer taskId) { public HaoHanGetCleanTaskNetflowInfoResp getCleanTaskNetflow(String baseUrlPath, Integer taskId) {
return protocolRun(baseUrlPath + "/cleanTaskFlow", return RestfulInterface.protocolRun(baseUrlPath + "/cleanTaskFlow",
new HaoHanGetCleanTaskNetflowInfoReq(taskId), new HaoHanGetCleanTaskNetflowInfoReq(taskId),
HaoHanGetCleanTaskNetflowInfoResp.class HaoHanGetCleanTaskNetflowInfoResp.class
); );

View File

@ -21,109 +21,134 @@ SET FOREIGN_KEY_CHECKS = 0;
-- Table structure for device_task -- Table structure for device_task
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `device_task`; DROP TABLE IF EXISTS `device_task`;
CREATE TABLE `device_task` ( CREATE TABLE `device_task`
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '任务信息唯一标识符', (
`taskId` int(11) UNSIGNED NOT NULL COMMENT '处置任务唯一标识符', `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '任务信息唯一标识符',
`deviceId` int(10) UNSIGNED NOT NULL COMMENT '处置设备唯一标识符', `taskId` int(11) UNSIGNED NOT NULL COMMENT '处置任务唯一标识符',
`beginTime` timestamp(0) NULL DEFAULT NULL COMMENT '任务开始时间', `deviceId` int(10) UNSIGNED NOT NULL COMMENT '处置设备唯一标识符',
`endTime` timestamp(0) NULL DEFAULT NULL COMMENT '任务结束时间', `beginTime` timestamp(0) NULL DEFAULT NULL COMMENT '任务开始时间',
`taskAttackType` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '需要处置的攻击类型', `endTime` timestamp(0) NULL DEFAULT NULL COMMENT '任务结束时间',
`execAttackTypeIn` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '已经执行处置的攻击类型(Input)', `taskAttackType` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '需要处置的攻击类型',
`attackTypeStatusIn` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '执行的攻击类型状态(Input)', `execAttackTypeIn` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '已经执行处置的攻击类型(Input)',
`execAttackTypeOut` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '已经执行处置的攻击类型(Output)', `attackTypeStatusIn` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '执行的攻击类型状态(Input)',
`attackTypeStatusOut` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '执行的攻击类型状态(Input)', `execAttackTypeOut` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '已经执行处置的攻击类型(Output)',
`externId` int(11) NULL DEFAULT NULL COMMENT '扩展任务ID', `attackTypeStatusOut` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '执行的攻击类型状态(Input)',
`errRetry` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '调用失败重试次数', `externId` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '扩展任务ID',
`status` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '任务状态', `errRetry` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '调用失败重试次数',
PRIMARY KEY (`id`) USING BTREE, `status` int(10) NOT NULL DEFAULT 0 COMMENT '任务状态',
INDEX `task_info_ibfk_1`(`taskId`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
INDEX `task_info_ibfk_2`(`deviceId`) USING BTREE, INDEX `task_info_ibfk_1` (`taskId`) USING BTREE,
CONSTRAINT `device_task_ibfk_1` FOREIGN KEY (`taskId`) REFERENCES `dispose_task` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, INDEX `task_info_ibfk_2` (`deviceId`) USING BTREE,
CONSTRAINT `device_task_ibfk_2` FOREIGN KEY (`deviceId`) REFERENCES `dispose_device` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION CONSTRAINT `device_task_ibfk_1` FOREIGN KEY (`taskId`) REFERENCES `dispose_task` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 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_capacity -- Table structure for dispose_capacity
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `dispose_capacity`; DROP TABLE IF EXISTS `dispose_capacity`;
CREATE TABLE `dispose_capacity` ( CREATE TABLE `dispose_capacity`
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '设备处置能力唯一标识符', (
`deviceId` int(11) UNSIGNED NOT NULL COMMENT '设备ID', `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '设备处置能力唯一标识符',
`capacityType` int(8) NOT NULL COMMENT '处置能力:\r\n0清洗\r\n1高防 \r\n2路由黑洞 \r\n3检测\r\n4WAF封堵\r\n', `deviceId` int(11) UNSIGNED NOT NULL COMMENT '设备ID',
`objectType` int(8) NOT NULL COMMENT '处置对象类型:\r\n0IP\r\n1域名 \r\n2URL', `capacityType` int(8) NOT NULL COMMENT '处置能力:\r\n0清洗\r\n1高防 \r\n2路由黑洞 \r\n3检测\r\n4WAF封堵\r\n',
`ipType` int(8) NOT NULL DEFAULT 3 COMMENT 'IP 地址类型:\r\n1 << 0支持IPV4\r\n1 << 1支持IPV6', `objectType` int(8) NOT NULL COMMENT '处置对象类型:\r\n0IP\r\n1域名 \r\n2URL',
`protectIp` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '该处置能力能够处置的IP', `ipType` int(8) NOT NULL DEFAULT 3 COMMENT 'IP 地址类型:\r\n1 << 0支持IPV4\r\n1 << 1支持IPV6',
`reserveNetflow` int(11) NULL DEFAULT NULL COMMENT '清洗能力储备流量值,单位(G)', `protectIp` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '该处置能力能够处置的IP',
PRIMARY KEY (`id`) USING BTREE, `reserveNetflow` int(11) NULL DEFAULT NULL COMMENT '清洗能力储备流量值,单位(G)',
INDEX `id`(`deviceId`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
CONSTRAINT `dispose_capacity_ibfk_1` FOREIGN KEY (`deviceId`) REFERENCES `dispose_device` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION INDEX `id` (`deviceId`) USING BTREE,
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 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 -- Table structure for dispose_device
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `dispose_device`; DROP TABLE IF EXISTS `dispose_device`;
CREATE TABLE `dispose_device` ( 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', `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '设备唯一标识符',
`ipPort` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '端口', `ipAddr` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '设备IP地址, IPv4/IPv6',
`deviceType` int(11) NOT NULL DEFAULT 0 COMMENT '能力节点类型0迪普UMC平台1浩瀚设备', `ipPort` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '端口',
`areaCode` int(11) NOT NULL COMMENT '设备物理位置区域码', `deviceType` int(11) NOT NULL DEFAULT 0 COMMENT '能力节点类型0迪普UMC平台1浩瀚设备',
`deviceName` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备名称', `areaCode` int(11) NOT NULL COMMENT '设备物理位置区域码',
`manufacturer` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生产厂商', `deviceName` varchar(256) 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 '型号', `manufacturer` 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 '软件版本', `model` 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 '系统管理用户名', `version` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '软件版本',
`password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '系统管理密码', `userName` 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路径', `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '系统管理密码',
`urlType` int(11) NOT NULL DEFAULT 0 COMMENT 'URL类型: 0: HTTP, 1: HTTPS', `urlPath` 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 '' COMMENT '备注', `urlType` int(11) NOT NULL DEFAULT 0 COMMENT 'URL类型: 0: HTTP, 1: HTTPS',
`status` int(11) NOT NULL DEFAULT 0 COMMENT '状态0正常1锁定2禁用 3删除', `readme` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '备注',
PRIMARY KEY (`id`) USING BTREE, `status` int(11) NOT NULL DEFAULT 0 COMMENT '状态0正常1锁定2禁用 3删除',
INDEX `ipAddr`(`ipAddr`) USING BTREE PRIMARY KEY (`id`) USING BTREE,
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 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 -- Table structure for dispose_task
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `dispose_task`; DROP TABLE IF EXISTS `dispose_task`;
CREATE TABLE `dispose_task` ( CREATE TABLE `dispose_task`
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '处置任务唯一标识符', (
`deviceId` int(10) NOT NULL COMMENT '处置设备唯一标识符', `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '处置任务唯一标识符',
`accountId` int(10) UNSIGNED NOT NULL COMMENT '用户唯一标识符', `deviceId` int(10) NOT NULL COMMENT '处置设备唯一标识符',
`disposeCapacity` int(11) NOT NULL COMMENT '处置能力类型0清洗 1高防 2黑洞 3检测', `accountId` int(10) UNSIGNED NOT NULL COMMENT '用户唯一标识符',
`disposeObject` varchar(4096) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '处置对象', `disposeCapacity` int(11) NOT NULL COMMENT '处置能力类型0清洗 1高防 2黑洞 3检测',
`objectType` int(8) NOT NULL COMMENT '处置对象类型:\r\n0IP\r\n1域名 \r\n2URL', `disposeObject` varchar(4096) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '处置对象',
`createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '开始时间', `objectType` int(8) NOT NULL COMMENT '处置对象类型:\r\n0IP\r\n1域名 \r\n2URL',
`planEndTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '计划结束时间', `createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '开始时间',
`endTime` timestamp(0) NULL DEFAULT '1970-01-02 00:00:00' COMMENT '实际结束时间', `planEndTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '计划结束时间',
`flowDirection` int(11) NOT NULL DEFAULT 2 COMMENT '流量方向, 0流入1流出2双向', `endTime` timestamp(0) NULL DEFAULT '1970-01-02 00:00:00' COMMENT '实际结束时间',
`attackType` bigint(20) UNSIGNED NOT NULL DEFAULT 18446744073709551615 COMMENT '攻击类型默认0 全部攻击', `flowDirection` int(11) NOT NULL DEFAULT 2 COMMENT '流量方向, 0流入1流出2双向',
`flowBandWidth` int(10) UNSIGNED NULL DEFAULT 1024 COMMENT '攻击流量占用带宽(MB)', `attackType` bigint(20) UNSIGNED NOT NULL DEFAULT 18446744073709551615 COMMENT '攻击类型默认0 全部攻击',
`currentStatus` int(11) NOT NULL DEFAULT 0 COMMENT '状态0停止。1启动', `flowBandWidth` int(10) UNSIGNED NULL DEFAULT 1024 COMMENT '攻击流量占用带宽(MB)',
PRIMARY KEY (`id`) USING BTREE, `currentStatus` int(11) NOT NULL DEFAULT 0 COMMENT '状态0停止。1启动',
INDEX `dispose_task_device_capacity_id_fk`(`disposeCapacity`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
INDEX `dispose_task_user_account_id_fk`(`accountId`) USING BTREE INDEX `dispose_task_device_capacity_id_fk` (`disposeCapacity`) USING BTREE,
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; 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 -- Table structure for user_account
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `user_account`; DROP TABLE IF EXISTS `user_account`;
CREATE TABLE `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 '用户名', `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '账户唯一编号',
`password` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码', `username` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
`createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `password` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
`operators` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '操作员', `createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`lastLoginTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '最后一次成功登录时间', `operators` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '操作员',
`token` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '用户token', `lastLoginTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '最后一次成功登录时间',
`lastAccess` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '最后一次访问时间戳', `token` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '用户token',
`lockTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '账户锁定时间', `lastAccess` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '最后一次访问时间戳',
`pwdErrTimes` int(10) NOT NULL DEFAULT 0 COMMENT '密码错误次数', `lockTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '账户锁定时间',
`status` int(11) NULL DEFAULT 0 COMMENT '账户状态', `pwdErrTimes` int(10) NOT NULL DEFAULT 0 COMMENT '密码错误次数',
PRIMARY KEY (`id`) USING BTREE, `status` int(11) NULL DEFAULT 0 COMMENT '账户状态',
UNIQUE INDEX `USERNAME`(`username`) USING BTREE PRIMARY KEY (`id`) USING BTREE,
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 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; SET FOREIGN_KEY_CHECKS = 1;

View File

@ -21,26 +21,31 @@ SET FOREIGN_KEY_CHECKS = 0;
-- Table structure for device_task -- Table structure for device_task
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `device_task`; DROP TABLE IF EXISTS `device_task`;
CREATE TABLE `device_task` ( CREATE TABLE `device_task`
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '任务信息唯一标识符', (
`taskId` int(11) UNSIGNED NOT NULL COMMENT '处置任务唯一标识符', `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '任务信息唯一标识符',
`deviceId` int(10) UNSIGNED NOT NULL COMMENT '处置设备唯一标识符', `taskId` int(11) UNSIGNED NOT NULL COMMENT '处置任务唯一标识符',
`beginTime` timestamp(0) NULL DEFAULT NULL COMMENT '任务开始时间', `deviceId` int(10) UNSIGNED NOT NULL COMMENT '处置设备唯一标识符',
`endTime` timestamp(0) NULL DEFAULT NULL COMMENT '任务结束时间', `beginTime` timestamp(0) NULL DEFAULT NULL COMMENT '任务开始时间',
`taskAttackType` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '需要处置的攻击类型', `endTime` timestamp(0) NULL DEFAULT NULL COMMENT '任务结束时间',
`execAttackTypeIn` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '已经执行处置的攻击类型(Input)', `taskAttackType` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '需要处置的攻击类型',
`attackTypeStatusIn` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '执行的攻击类型状态(Input)', `execAttackTypeIn` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '已经执行处置的攻击类型(Input)',
`execAttackTypeOut` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '已经执行处置的攻击类型(Output)', `attackTypeStatusIn` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '执行的攻击类型状态(Input)',
`attackTypeStatusOut` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '执行的攻击类型状态(Input)', `execAttackTypeOut` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '已经执行处置的攻击类型(Output)',
`externId` int(11) NULL DEFAULT NULL COMMENT '扩展任务ID', `attackTypeStatusOut` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '执行的攻击类型状态(Input)',
`errRetry` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '调用失败重试次数', `externId` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '扩展任务ID',
`status` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '任务状态', `errRetry` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '调用失败重试次数',
PRIMARY KEY (`id`) USING BTREE, `status` int(10) NOT NULL DEFAULT 0 COMMENT '任务状态',
INDEX `task_info_ibfk_1`(`taskId`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
INDEX `task_info_ibfk_2`(`deviceId`) USING BTREE, INDEX `task_info_ibfk_1` (`taskId`) USING BTREE,
CONSTRAINT `device_task_ibfk_1` FOREIGN KEY (`taskId`) REFERENCES `dispose_task` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, INDEX `task_info_ibfk_2` (`deviceId`) USING BTREE,
CONSTRAINT `device_task_ibfk_2` FOREIGN KEY (`deviceId`) REFERENCES `dispose_device` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION CONSTRAINT `device_task_ibfk_1` FOREIGN KEY (`taskId`) REFERENCES `dispose_task` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 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;
-- ---------------------------- -- ----------------------------
-- Records of device_task -- Records of device_task
@ -50,115 +55,157 @@ CREATE TABLE `device_task` (
-- Table structure for dispose_capacity -- Table structure for dispose_capacity
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `dispose_capacity`; DROP TABLE IF EXISTS `dispose_capacity`;
CREATE TABLE `dispose_capacity` ( CREATE TABLE `dispose_capacity`
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '设备处置能力唯一标识符', (
`deviceId` int(11) UNSIGNED NOT NULL COMMENT '设备ID', `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '设备处置能力唯一标识符',
`capacityType` int(8) NOT NULL COMMENT '处置能力:\r\n0清洗\r\n1高防 \r\n2路由黑洞 \r\n3检测\r\n4WAF封堵\r\n', `deviceId` int(11) UNSIGNED NOT NULL COMMENT '设备ID',
`objectType` int(8) NOT NULL COMMENT '处置对象类型:\r\n0IP\r\n1域名 \r\n2URL', `capacityType` int(8) NOT NULL COMMENT '处置能力:\r\n0清洗\r\n1高防 \r\n2路由黑洞 \r\n3检测\r\n4WAF封堵\r\n',
`ipType` int(8) NOT NULL DEFAULT 3 COMMENT 'IP 地址类型:\r\n1 << 0支持IPV4\r\n1 << 1支持IPV6', `objectType` int(8) NOT NULL COMMENT '处置对象类型:\r\n0IP\r\n1域名 \r\n2URL',
`protectIp` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '该处置能力能够处置的IP', `ipType` int(8) NOT NULL DEFAULT 3 COMMENT 'IP 地址类型:\r\n1 << 0支持IPV4\r\n1 << 1支持IPV6',
`reserveNetflow` int(11) NULL DEFAULT NULL COMMENT '清洗能力储备流量值,单位(G)', `protectIp` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '该处置能力能够处置的IP',
PRIMARY KEY (`id`) USING BTREE, `reserveNetflow` int(11) NULL DEFAULT NULL COMMENT '清洗能力储备流量值,单位(G)',
INDEX `id`(`deviceId`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
CONSTRAINT `dispose_capacity_ibfk_1` FOREIGN KEY (`deviceId`) REFERENCES `dispose_device` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION INDEX `id` (`deviceId`) USING BTREE,
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; 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;
-- ---------------------------- -- ----------------------------
-- Records of dispose_capacity -- Records of dispose_capacity
-- ---------------------------- -- ----------------------------
INSERT INTO `dispose_capacity` VALUES (1, 1, 0, 1, 3, '0.0.0.0', 10); INSERT INTO `dispose_capacity`
INSERT INTO `dispose_capacity` VALUES (2, 1, 1, 7, 3, '', NULL); VALUES (1, 1, 0, 1, 3, '0.0.0.0', 10);
INSERT INTO `dispose_capacity` VALUES (3, 1, 2, 7, 3, '0.0.0.0', NULL); INSERT INTO `dispose_capacity`
INSERT INTO `dispose_capacity` VALUES (4, 1, 3, 1, 3, '0.0.0.0', NULL); VALUES (2, 1, 1, 7, 3, '', NULL);
INSERT INTO `dispose_capacity`
VALUES (3, 1, 2, 7, 3, '0.0.0.0', NULL);
INSERT INTO `dispose_capacity`
VALUES (4, 1, 3, 1, 3, '0.0.0.0', NULL);
INSERT INTO `dispose_capacity` VALUES (5, 2, 0, 1, 3, '0.0.0.0', 10); INSERT INTO `dispose_capacity`
INSERT INTO `dispose_capacity` VALUES (6, 3, 0, 1, 3, '0.0.0.0', 10); VALUES (5, 2, 0, 1, 3, '0.0.0.0', 10);
INSERT INTO `dispose_capacity` VALUES (7, 4, 0, 1, 3, '0.0.0.0', 10); INSERT INTO `dispose_capacity`
VALUES (6, 3, 0, 1, 3, '0.0.0.0', 10);
INSERT INTO `dispose_capacity`
VALUES (7, 4, 0, 1, 3, '0.0.0.0', 10);
-- ---------------------------- -- ----------------------------
-- Table structure for dispose_device -- Table structure for dispose_device
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `dispose_device`; DROP TABLE IF EXISTS `dispose_device`;
CREATE TABLE `dispose_device` ( 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', `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '设备唯一标识符',
`ipPort` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '端口', `ipAddr` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '设备IP地址, IPv4/IPv6',
`deviceType` int(11) NOT NULL DEFAULT 0 COMMENT '能力节点类型0迪普UMC平台1浩瀚设备', `ipPort` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '端口',
`areaCode` int(11) NOT NULL COMMENT '设备物理位置区域码', `deviceType` int(11) NOT NULL DEFAULT 0 COMMENT '能力节点类型0迪普UMC平台1浩瀚设备',
`deviceName` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备名称', `areaCode` int(11) NOT NULL COMMENT '设备物理位置区域码',
`manufacturer` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生产厂商', `deviceName` varchar(256) 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 '型号', `manufacturer` 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 '软件版本', `model` 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 '系统管理用户名', `version` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '软件版本',
`password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '系统管理密码', `userName` 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路径', `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '系统管理密码',
`urlType` int(11) NOT NULL DEFAULT 0 COMMENT 'URL类型: 0: HTTP, 1: HTTPS', `urlPath` 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 '' COMMENT '备注', `urlType` int(11) NOT NULL DEFAULT 0 COMMENT 'URL类型: 0: HTTP, 1: HTTPS',
`status` int(11) NOT NULL DEFAULT 0 COMMENT '状态0正常1锁定2禁用 3删除', `readme` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '备注',
PRIMARY KEY (`id`) USING BTREE, `status` int(11) NOT NULL DEFAULT 0 COMMENT '状态0正常1锁定2禁用 3删除',
INDEX `ipAddr`(`ipAddr`) USING BTREE PRIMARY KEY (`id`) USING BTREE,
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; INDEX `ipAddr` (`ipAddr`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 1
CHARACTER SET = utf8
COLLATE = utf8_general_ci
ROW_FORMAT = Dynamic;
-- ---------------------------- -- ----------------------------
-- Records of dispose_device -- Records of dispose_device
-- ---------------------------- -- ----------------------------
INSERT INTO `dispose_device` VALUES (1, '127.0.0.1', '', 999, 0, '虚拟处置设备', 'Virtual Dispose Device', 'CMCC', 'V0.0.1', '1', '', '', 0, '持续集成单元测试用虚拟设备', 0); INSERT INTO `dispose_device`
INSERT INTO `dispose_device` VALUES (2, '127.0.0.1', '1000', 999, 0, '虚拟处置设备', 'Virtual Dispose Device', 'CMCC', 'V0.0.1', '1', '', '', 0, '持续集成单元测试用虚拟设备', 0); VALUES (1, '127.0.0.1', '', 999, 0, '虚拟处置设备', 'Virtual Dispose Device', 'CMCC', 'V0.0.1', '1', '', '', 0,
INSERT INTO `dispose_device` VALUES (3, '127.0.0.1', '1001', 999, 0, '虚拟处置设备', 'Virtual Dispose Device', 'CMCC', 'V0.0.1', '0', '', '', 0, '持续集成单元测试用虚拟设备', 0); '持续集成单元测试用虚拟设备', 0);
INSERT INTO `dispose_device` VALUES (4, '127.0.0.1', '1002', 999, 0, '虚拟处置设备', 'Virtual Dispose Device', 'CMCC', 'V0.0.1', '0', '', '', 0, '持续集成单元测试用虚拟设备', 0); INSERT INTO `dispose_device`
VALUES (2, '127.0.0.1', '1000', 999, 0, '虚拟处置设备', 'Virtual Dispose Device', 'CMCC', 'V0.0.1', '1', '', '', 0,
'持续集成单元测试用虚拟设备', 0);
INSERT INTO `dispose_device`
VALUES (3, '127.0.0.1', '1001', 999, 0, '虚拟处置设备', 'Virtual Dispose Device', 'CMCC', 'V0.0.1', '0', '', '', 0,
'持续集成单元测试用虚拟设备', 0);
INSERT INTO `dispose_device`
VALUES (4, '127.0.0.1', '1002', 999, 0, '虚拟处置设备', 'Virtual Dispose Device', 'CMCC', 'V0.0.1', '0', '', '', 0,
'持续集成单元测试用虚拟设备', 0);
-- ---------------------------- -- ----------------------------
-- Table structure for dispose_task -- Table structure for dispose_task
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `dispose_task`; DROP TABLE IF EXISTS `dispose_task`;
CREATE TABLE `dispose_task` ( CREATE TABLE `dispose_task`
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '处置任务唯一标识符', (
`deviceId` int(10) NOT NULL COMMENT '处置设备唯一标识符', `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '处置任务唯一标识符',
`accountId` int(10) UNSIGNED NOT NULL COMMENT '用户唯一标识符', `deviceId` int(10) NOT NULL COMMENT '处置设备唯一标识符',
`disposeCapacity` int(11) NOT NULL COMMENT '处置能力类型0清洗 1高防 2黑洞 3检测', `accountId` int(10) UNSIGNED NOT NULL COMMENT '用户唯一标识符',
`disposeObject` varchar(4096) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '处置对象', `disposeCapacity` int(11) NOT NULL COMMENT '处置能力类型0清洗 1高防 2黑洞 3检测',
`objectType` int(8) NOT NULL COMMENT '处置对象类型:\r\n0IP\r\n1域名 \r\n2URL', `disposeObject` varchar(4096) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '处置对象',
`createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '开始时间', `objectType` int(8) NOT NULL COMMENT '处置对象类型:\r\n0IP\r\n1域名 \r\n2URL',
`planEndTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '计划结束时间', `createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '开始时间',
`endTime` timestamp(0) NULL DEFAULT '1970-01-02 00:00:00' COMMENT '实际结束时间', `planEndTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '计划结束时间',
`flowDirection` int(11) NOT NULL DEFAULT 2 COMMENT '流量方向, 0流入1流出2双向', `endTime` timestamp(0) NULL DEFAULT '1970-01-02 00:00:00' COMMENT '实际结束时间',
`attackType` bigint(20) UNSIGNED NOT NULL DEFAULT 18446744073709551615 COMMENT '攻击类型默认0 全部攻击', `flowDirection` int(11) NOT NULL DEFAULT 2 COMMENT '流量方向, 0流入1流出2双向',
`flowBandWidth` int(10) UNSIGNED NULL DEFAULT 1024 COMMENT '攻击流量占用带宽(MB)', `attackType` bigint(20) UNSIGNED NOT NULL DEFAULT 18446744073709551615 COMMENT '攻击类型默认0 全部攻击',
`currentStatus` int(11) NOT NULL DEFAULT 0 COMMENT '状态0停止。1启动', `flowBandWidth` int(10) UNSIGNED NULL DEFAULT 1024 COMMENT '攻击流量占用带宽(MB)',
PRIMARY KEY (`id`) USING BTREE, `currentStatus` int(11) NOT NULL DEFAULT 0 COMMENT '状态0停止。1启动',
INDEX `dispose_task_device_capacity_id_fk`(`disposeCapacity`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
INDEX `dispose_task_user_account_id_fk`(`accountId`) USING BTREE INDEX `dispose_task_device_capacity_id_fk` (`disposeCapacity`) USING BTREE,
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; 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;
-- ---------------------------- -- ----------------------------
-- Records of dispose_task -- Records of dispose_task
-- ---------------------------- -- ----------------------------
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`
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); 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 -- Table structure for user_account
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `user_account`; DROP TABLE IF EXISTS `user_account`;
CREATE TABLE `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 '用户名', `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '账户唯一编号',
`password` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码', `username` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
`createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `password` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
`operators` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '操作员', `createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`lastLoginTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '最后一次成功登录时间', `operators` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '操作员',
`token` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '用户token', `lastLoginTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '最后一次成功登录时间',
`lastAccess` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '最后一次访问时间戳', `token` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '用户token',
`lockTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '账户锁定时间', `lastAccess` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '最后一次访问时间戳',
`pwdErrTimes` int(10) NOT NULL DEFAULT 0 COMMENT '密码错误次数', `lockTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '账户锁定时间',
`status` int(11) NULL DEFAULT 0 COMMENT '账户状态', `pwdErrTimes` int(10) NOT NULL DEFAULT 0 COMMENT '密码错误次数',
PRIMARY KEY (`id`) USING BTREE, `status` int(11) NULL DEFAULT 0 COMMENT '账户状态',
UNIQUE INDEX `USERNAME`(`username`) USING BTREE PRIMARY KEY (`id`) USING BTREE,
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; UNIQUE INDEX `USERNAME` (`username`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 1
CHARACTER SET = utf8
COLLATE = utf8_general_ci
ROW_FORMAT = Dynamic;
-- ---------------------------- -- ----------------------------
-- Records of user_account -- Records of user_account
-- ---------------------------- -- ----------------------------
INSERT INTO `user_account` VALUES (1, 'admin', 'c3855e6b6bb120450f160ba91134522868f89d36062f2061ebeefd80817e1d58', '1970-01-02 00:00:00', '', '2020-09-11 00:34:16', 'c02094875da6d6b60a5ac7f056d40066a85005569bf7ce8ff03a50963651f931', '2020-09-11 00:34:16', '1970-01-02 00:00:00', 0, 0); INSERT INTO `user_account`
VALUES (1, 'admin', 'c3855e6b6bb120450f160ba91134522868f89d36062f2061ebeefd80817e1d58', '1970-01-02 00:00:00', '',
'2020-09-11 00:34:16', 'c02094875da6d6b60a5ac7f056d40066a85005569bf7ce8ff03a50963651f931',
'2020-09-11 00:34:16', '1970-01-02 00:00:00', 0, 0);
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;

View File

@ -562,4 +562,8 @@ public class demo {
log.info("Src: {}", plainText); log.info("Src: {}", plainText);
log.info("AES256: {}", new String(encode)); log.info("AES256: {}", new String(encode));
} }
@Test
public void codeDebug() {
}
} }

View File

@ -262,7 +262,7 @@ public class DeviceTaskMapperTest extends InitTestEnvironment {
// change extern id. // change extern id.
for (long i = 223L; i <= 230L; i++) { for (long i = 223L; i <= 230L; i++) {
int result = deviceTaskMapper.changeExternId(deviceTask.getId(), i); int result = deviceTaskMapper.changeExternId(deviceTask.getId(), String.valueOf(i));
Assert.assertEquals(result, 1); Assert.assertEquals(result, 1);
Assert.assertEquals(String.valueOf(i), String.valueOf(deviceTaskMapper.getTaskInfoById(deviceTask.getId()).getExternId())); Assert.assertEquals(String.valueOf(i), String.valueOf(deviceTaskMapper.getTaskInfoById(deviceTask.getId()).getExternId()));
} }

View File

@ -1,14 +0,0 @@
package com.dispose.test.qa;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.wildfly.common.Assert;
@Slf4j
public class DemoTest2 {
@Test
public void t1_demo() {
log.error("++++++++++++++++++++++com.dispose.test.qa.DemoTest2.t1_demo");
Assert.assertFalse(false);
}
}

View File

@ -1,14 +0,0 @@
package com.dispose.test.qa.impl;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.wildfly.common.Assert;
@Slf4j
public class DemoTest {
@Test
public void t1_demo() {
log.error("++++++++++++++++++++++com.dispose.test.qa.DemoTest.t1_demo");
Assert.assertTrue(true);
}
}