OCT
REM: 1. 增加迪普设备启动处置任务功能 2. 重构配置文件,全局变量初始化方式 3. 移除重复的处置类型
This commit is contained in:
parent
cb1ccfca88
commit
4868b1abf8
|
@ -1,6 +1,5 @@
|
|||
package com.dispose.ability;
|
||||
|
||||
import com.dispose.common.DDoSAttackType;
|
||||
import com.dispose.common.DisposeCapacityType;
|
||||
import com.dispose.common.ErrorCode;
|
||||
import com.dispose.common.NetflowDirection;
|
||||
|
@ -14,7 +13,7 @@ import javax.annotation.Nullable;
|
|||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public interface DisposeAbility<T> {
|
||||
public interface DisposeAbility {
|
||||
|
||||
/**
|
||||
* Init device env.
|
||||
|
@ -35,9 +34,9 @@ public interface DisposeAbility<T> {
|
|||
* @param duration the duration
|
||||
* @return the mul return type
|
||||
*/
|
||||
T runDispose(String ip, DisposeCapacityType capType,
|
||||
MulReturnType<ErrorCode, Long> runDispose(String ip, DisposeCapacityType capType,
|
||||
@Nullable NetflowDirection nfDirection,
|
||||
@Nullable DDoSAttackType attackType,
|
||||
@Nullable Integer attackType,
|
||||
@Nullable Long duration);
|
||||
|
||||
/**
|
||||
|
@ -50,9 +49,9 @@ public interface DisposeAbility<T> {
|
|||
* @param taskId the task id
|
||||
* @return the mul return type
|
||||
*/
|
||||
T stopDispose(String ip, DisposeCapacityType capType,
|
||||
MulReturnType<ErrorCode, Long> stopDispose(String ip, DisposeCapacityType capType,
|
||||
@Nullable NetflowDirection nfDirection,
|
||||
@Nullable DDoSAttackType attackType,
|
||||
@Nullable Integer attackType,
|
||||
@Nullable Long taskId);
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package com.dispose.ability.impl;
|
||||
|
||||
import com.dispose.ability.DeviceDisposeAbility;
|
||||
import com.dispose.ability.DisposeAbility;
|
||||
import com.dispose.ability.DisposeTaskCallback;
|
||||
import com.dispose.common.DDoSAttackType;
|
||||
import com.dispose.common.CommonEnumHandler;
|
||||
import com.dispose.common.DisposeCapacityType;
|
||||
import com.dispose.common.DpTechAttackType;
|
||||
import com.dispose.common.DpTechConfigValue;
|
||||
|
@ -22,21 +20,18 @@ import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
|
|||
import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
|
||||
import org.apache.wss4j.dom.WSConstants;
|
||||
import org.apache.wss4j.dom.handler.WSHandlerConstants;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.xml.ws.BindingProvider;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* The type Dp tech ability.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class DpTechAbilityImpl implements DisposeAbility<ErrorCode>, DeviceDisposeAbility<ErrorCode> {
|
||||
public class DpTechAbilityImpl implements DisposeAbility {
|
||||
/**
|
||||
* The Clean type port.
|
||||
*/
|
||||
|
@ -94,29 +89,35 @@ public class DpTechAbilityImpl implements DisposeAbility<ErrorCode>, DeviceDispo
|
|||
* @return the mul return type
|
||||
*/
|
||||
@Override
|
||||
public ErrorCode runDispose(String ip, DisposeCapacityType capType,
|
||||
NetflowDirection nfDirection,
|
||||
DDoSAttackType attackType,
|
||||
Long duration) {
|
||||
public MulReturnType<ErrorCode, Long> runDispose(String ip, DisposeCapacityType capType,
|
||||
NetflowDirection nfDirection,
|
||||
Integer attackType,
|
||||
Long duration) {
|
||||
ErrorCode err = ErrorCode.ERR_OK;
|
||||
|
||||
try {
|
||||
log.info("++++Begging DPTech Start Cleanup Task: {}, {}, {} ", ip, attackType, nfDirection);
|
||||
|
||||
NtcRequestResultInfo ret = cleanTypePort.startAbnormalTaskForUMC(ip, attackType.getValue(),
|
||||
NtcRequestResultInfo ret = cleanTypePort.startAbnormalTaskForUMC(ip, attackType,
|
||||
nfDirection.getValue());
|
||||
|
||||
if (ret.getResultRetVal() != 0) {
|
||||
err = ErrorCode.ERR_CALLDEVICE;
|
||||
log.error("----Error DPTech Start Cleanup Task: {}, {}, {}, {}", ip, nfDirection,
|
||||
CommonEnumHandler.codeOf(DpTechAttackType.class, attackType),
|
||||
ret.getResultInfo().getValue());
|
||||
} else {
|
||||
log.error("----Finish DPTech Start Cleanup Task: {} status {}", ip, err);
|
||||
log.info("----Finish DPTech Start Cleanup Task: {}, {}, {}, {}", ip, nfDirection,
|
||||
CommonEnumHandler.codeOf(DpTechAttackType.class, attackType),
|
||||
ret.getResultInfo().getValue());
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
err = ErrorCode.ERR_SYSTEMEXCEPTION;
|
||||
log.error("----Exception Error DPTech Start Cleanup Task: {}", ip);
|
||||
log.error("----Exception DPTech Start Cleanup Task: {}, {}, {}", ip, nfDirection,
|
||||
CommonEnumHandler.codeOf(DpTechAttackType.class, attackType));
|
||||
}
|
||||
|
||||
return err;
|
||||
return new MulReturnType<>(err, null);
|
||||
}
|
||||
|
||||
|
||||
|
@ -131,31 +132,36 @@ public class DpTechAbilityImpl implements DisposeAbility<ErrorCode>, DeviceDispo
|
|||
* @return the mul return type
|
||||
*/
|
||||
@Override
|
||||
public ErrorCode stopDispose(String ip,
|
||||
DisposeCapacityType capType,
|
||||
NetflowDirection nfDirection,
|
||||
DDoSAttackType attackType,
|
||||
Long taskId) {
|
||||
public MulReturnType<ErrorCode, Long> stopDispose(String ip,
|
||||
DisposeCapacityType capType,
|
||||
NetflowDirection nfDirection,
|
||||
Integer attackType,
|
||||
Long taskId) {
|
||||
ErrorCode err = ErrorCode.ERR_OK;
|
||||
|
||||
try {
|
||||
log.info("++++Begging DPTech Stop Cleanup Task: {}, {}, {} ", ip, attackType, nfDirection);
|
||||
|
||||
NtcRequestResultInfo ret = cleanTypePort.stopAbnormalTaskForUMC(ip, attackType.getValue(),
|
||||
NtcRequestResultInfo ret = cleanTypePort.stopAbnormalTaskForUMC(ip, attackType,
|
||||
nfDirection.getValue());
|
||||
|
||||
if (ret.getResultRetVal() != 0) {
|
||||
err = ErrorCode.ERR_CALLDEVICE;
|
||||
log.error("----Finish DPTech Stop Cleanup Task: {} status {}", ip, err);
|
||||
log.error("----Error DPTech Stop Cleanup Task: {}, {}, {}, {}", ip, nfDirection,
|
||||
CommonEnumHandler.codeOf(DpTechAttackType.class, attackType),
|
||||
ret.getResultInfo().getValue());
|
||||
} else {
|
||||
log.info("----Finish DPTech Stop Cleanup Task: {} status {}", ip, err);
|
||||
log.info("----Finish DPTech Stop Cleanup Task: {}, {}, {}, {}", ip, nfDirection,
|
||||
CommonEnumHandler.codeOf(DpTechAttackType.class, attackType),
|
||||
ret.getResultInfo().getValue());
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
err = ErrorCode.ERR_SYSTEMEXCEPTION;
|
||||
log.error("----Exception Error DPTech Stop Cleanup Task: {}", ip);
|
||||
log.error("----Exception DPTech Stop Cleanup Task: {}, {}, {}", ip, nfDirection,
|
||||
CommonEnumHandler.codeOf(DpTechAttackType.class, attackType));
|
||||
}
|
||||
|
||||
return err;
|
||||
return new MulReturnType<>(err, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -208,52 +214,4 @@ public class DpTechAbilityImpl implements DisposeAbility<ErrorCode>, DeviceDispo
|
|||
public Long toDeviceAttackType(Long ddosAttackTypeMask) {
|
||||
return DpTechAttackType.formDdosAttackTypeMaks(ddosAttackTypeMask);
|
||||
}
|
||||
|
||||
/**
|
||||
* Device dispose exec error code.
|
||||
*
|
||||
* @param callback the callback
|
||||
* @param capType the cap type
|
||||
* @param ipAddr the ip addr
|
||||
* @param args the args
|
||||
* @return the error code
|
||||
*/
|
||||
@Override
|
||||
public ErrorCode deviceDisposeExec(DisposeTaskCallback callback, DisposeCapacityType capType, String ipAddr,
|
||||
Object... args) {
|
||||
CompletableFuture.supplyAsync(() -> runDispose(ipAddr, capType, (NetflowDirection) args[0],
|
||||
(DDoSAttackType) args[1], null))
|
||||
.whenComplete((v, ex) -> {
|
||||
if (ex != null) {
|
||||
callback.upgradeStatusCallback(ErrorCode.ERR_SYSTEMEXCEPTION);
|
||||
} else {
|
||||
callback.upgradeStatusCallback(v);
|
||||
}
|
||||
});
|
||||
|
||||
return ErrorCode.ERR_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Device dispose stop error code.
|
||||
*
|
||||
* @param callback the callback
|
||||
* @param capType the cap type
|
||||
* @param args the args
|
||||
* @return the error code
|
||||
*/
|
||||
@Override
|
||||
public ErrorCode deviceDisposeStop(DisposeTaskCallback callback, DisposeCapacityType capType, Object... args) {
|
||||
CompletableFuture.supplyAsync(() -> stopDispose((String) args[0], capType, (NetflowDirection) args[1],
|
||||
(DDoSAttackType) args[2], null))
|
||||
.whenComplete((v, ex) -> {
|
||||
if (ex != null) {
|
||||
callback.upgradeStatusCallback(ErrorCode.ERR_SYSTEMEXCEPTION);
|
||||
} else {
|
||||
callback.upgradeStatusCallback(v);
|
||||
}
|
||||
});
|
||||
|
||||
return ErrorCode.ERR_OK;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package com.dispose.ability.impl;
|
||||
|
||||
import com.dispose.ability.DeviceDisposeAbility;
|
||||
import com.dispose.ability.DisposeAbility;
|
||||
import com.dispose.ability.DisposeTaskCallback;
|
||||
import com.dispose.common.DDoSAttackType;
|
||||
import com.dispose.common.DisposeCapacityType;
|
||||
import com.dispose.common.ErrorCode;
|
||||
import com.dispose.common.NetflowDirection;
|
||||
|
@ -24,8 +21,7 @@ import javax.annotation.Nullable;
|
|||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class HaoHanAbilityImpl implements DisposeAbility<MulReturnType<ErrorCode, Long>>,
|
||||
DeviceDisposeAbility<MulReturnType<ErrorCode, Long>> {
|
||||
public class HaoHanAbilityImpl implements DisposeAbility {
|
||||
|
||||
/**
|
||||
* The constant DISPOSE_PLATFORM_NAME.
|
||||
|
@ -65,7 +61,7 @@ public class HaoHanAbilityImpl implements DisposeAbility<MulReturnType<ErrorCode
|
|||
@Override
|
||||
public MulReturnType<ErrorCode, Long> runDispose(String ip, DisposeCapacityType capType,
|
||||
@Nullable NetflowDirection nfDirection,
|
||||
@Nullable DDoSAttackType attackType,
|
||||
@Nullable Integer attackType,
|
||||
@Nullable Long duration) {
|
||||
log.info("++++Begging Haohan Start Cleanup Task: {}", ip);
|
||||
|
||||
|
@ -104,7 +100,7 @@ public class HaoHanAbilityImpl implements DisposeAbility<MulReturnType<ErrorCode
|
|||
@Override
|
||||
public MulReturnType<ErrorCode, Long> stopDispose(String ip, DisposeCapacityType capType,
|
||||
@Nullable NetflowDirection nfDirection,
|
||||
@Nullable DDoSAttackType attackType,
|
||||
@Nullable Integer attackType,
|
||||
@Nullable Long taskId) {
|
||||
log.info("++++Begging Haohan Stop Cleanup Task: {}", taskId);
|
||||
|
||||
|
@ -167,50 +163,4 @@ public class HaoHanAbilityImpl implements DisposeAbility<MulReturnType<ErrorCode
|
|||
public Long toDeviceAttackType(Long ddosAttackTypeMask) {
|
||||
return ddosAttackTypeMask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Device dispose exec mul return type.
|
||||
*
|
||||
* @param capType the cap type
|
||||
* @param ipAddr the ip addr
|
||||
* @param duration the duration
|
||||
* @return the mul return type
|
||||
*/
|
||||
@Override
|
||||
public MulReturnType<ErrorCode, Long> deviceDisposeExec(DisposeTaskCallback callback,
|
||||
DisposeCapacityType capType,
|
||||
String ipAddr,
|
||||
Object... duration) {
|
||||
MulReturnType<ErrorCode, Long> ret = runDispose(ipAddr,
|
||||
capType,
|
||||
null,
|
||||
DDoSAttackType.ALL_ATTACKS,
|
||||
(long) duration[0]);
|
||||
|
||||
callback.upgradeStatusCallback(ret.getFirstParam());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Device dispose stop mul return type.
|
||||
*
|
||||
* @param capType the cap type
|
||||
* @param taskId the task id
|
||||
* @return the mul return type
|
||||
*/
|
||||
@Override
|
||||
public MulReturnType<ErrorCode, Long> deviceDisposeStop(DisposeTaskCallback callback,
|
||||
DisposeCapacityType capType,
|
||||
Object... taskId) {
|
||||
MulReturnType<ErrorCode, Long> ret = stopDispose(null,
|
||||
null,
|
||||
null,
|
||||
DDoSAttackType.ALL_ATTACKS,
|
||||
(long) taskId[0]);
|
||||
|
||||
callback.upgradeStatusCallback(ret.getFirstParam());
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package com.dispose.ability.impl;
|
||||
|
||||
import com.dispose.ability.DeviceDisposeAbility;
|
||||
import com.dispose.ability.DisposeAbility;
|
||||
import com.dispose.ability.DisposeTaskCallback;
|
||||
import com.dispose.common.DDoSAttackType;
|
||||
import com.dispose.common.DisposeCapacityType;
|
||||
import com.dispose.common.ErrorCode;
|
||||
import com.dispose.common.NetflowDirection;
|
||||
|
@ -17,7 +14,7 @@ import javax.annotation.Nullable;
|
|||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public class VirtualAbilityImpl implements DisposeAbility<ErrorCode>, DeviceDisposeAbility<ErrorCode> {
|
||||
public class VirtualAbilityImpl implements DisposeAbility {
|
||||
/**
|
||||
* Init device env.
|
||||
*
|
||||
|
@ -41,10 +38,10 @@ public class VirtualAbilityImpl implements DisposeAbility<ErrorCode>, DeviceDisp
|
|||
* @return the mul return type
|
||||
*/
|
||||
@Override
|
||||
public ErrorCode runDispose(String ip, DisposeCapacityType capType,
|
||||
public MulReturnType<ErrorCode, Long> runDispose(String ip, DisposeCapacityType capType,
|
||||
@Nullable NetflowDirection nfDirection,
|
||||
@Nullable DDoSAttackType attackType, @Nullable Long duration) {
|
||||
return ErrorCode.ERR_OK;
|
||||
@Nullable Integer attackType, @Nullable Long duration) {
|
||||
return new MulReturnType<>(ErrorCode.ERR_OK, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,10 +55,10 @@ public class VirtualAbilityImpl implements DisposeAbility<ErrorCode>, DeviceDisp
|
|||
* @return the mul return type
|
||||
*/
|
||||
@Override
|
||||
public ErrorCode stopDispose(String ip, DisposeCapacityType capType,
|
||||
public MulReturnType<ErrorCode, Long> stopDispose(String ip, DisposeCapacityType capType,
|
||||
@Nullable NetflowDirection nfDirection,
|
||||
@Nullable DDoSAttackType attackType, @Nullable Long taskId) {
|
||||
return ErrorCode.ERR_OK;
|
||||
@Nullable Integer attackType, @Nullable Long taskId) {
|
||||
return new MulReturnType<>(ErrorCode.ERR_OK, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,46 +103,4 @@ public class VirtualAbilityImpl implements DisposeAbility<ErrorCode>, DeviceDisp
|
|||
public Long toDeviceAttackType(Long ddosAttackTypeMask) {
|
||||
return ddosAttackTypeMask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Device dispose exec error code.
|
||||
*
|
||||
* @param capType the cap type
|
||||
* @param ipAddr the ip addr
|
||||
* @param duration the duration
|
||||
* @return the error code
|
||||
*/
|
||||
@Override
|
||||
public ErrorCode deviceDisposeExec(DisposeTaskCallback callback, DisposeCapacityType capType, String ipAddr,
|
||||
Object... duration) {
|
||||
ErrorCode ret = runDispose(ipAddr,
|
||||
capType,
|
||||
null,
|
||||
DDoSAttackType.ALL_ATTACKS,
|
||||
null);
|
||||
|
||||
callback.upgradeStatusCallback(ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Device dispose stop error code.
|
||||
*
|
||||
* @param capType the cap type
|
||||
* @param taskId the task id
|
||||
* @return the error code
|
||||
*/
|
||||
@Override
|
||||
public ErrorCode deviceDisposeStop(DisposeTaskCallback callback, DisposeCapacityType capType, Object... taskId) {
|
||||
ErrorCode ret = stopDispose(null,
|
||||
capType,
|
||||
null,
|
||||
DDoSAttackType.ALL_ATTACKS,
|
||||
null);
|
||||
|
||||
callback.upgradeStatusCallback(ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,27 +6,24 @@ package com.dispose.common;
|
|||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public enum DisposeCapacityType implements BaseEnum {
|
||||
//1.清洗,2.压制,3.高防
|
||||
/**
|
||||
* The Cleanup.
|
||||
*/
|
||||
CLEANUP(0, "清洗能力"),
|
||||
/**
|
||||
* Blackhool dispose capacity type.
|
||||
*/
|
||||
BLACKHOOL(1, "压制能力"),
|
||||
/**
|
||||
* The Hidepend.
|
||||
*/
|
||||
HIDEPEND(1, "高防能力"),
|
||||
/**
|
||||
* The Blackhool.
|
||||
*/
|
||||
BLACKHOOL(2, "黑洞能力"),
|
||||
HIDEPEND(2, "高防能力"),
|
||||
/**
|
||||
* The Detecive.
|
||||
*/
|
||||
DETECIVE(3, "检测能力"),
|
||||
|
||||
/**
|
||||
* Blocking dispose capacity type.
|
||||
*/
|
||||
BLOCKING(4, "封堵");
|
||||
;
|
||||
|
||||
/**
|
||||
* The Code.
|
||||
|
@ -49,9 +46,9 @@ public enum DisposeCapacityType implements BaseEnum {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets code.
|
||||
* Gets value.
|
||||
*
|
||||
* @return the code
|
||||
* @return the value
|
||||
*/
|
||||
@Override
|
||||
public Integer getValue() {
|
||||
|
@ -59,12 +56,13 @@ public enum DisposeCapacityType implements BaseEnum {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets readme.
|
||||
* Gets description.
|
||||
*
|
||||
* @return the readme
|
||||
* @return the description
|
||||
*/
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return this.readme;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,6 +109,24 @@ public enum DpTechAttackType implements BaseEnum {
|
|||
.distinct().toArray(DpTechAttackType[]::new));
|
||||
}
|
||||
|
||||
/**
|
||||
* Mask to ddos attack type list.
|
||||
*
|
||||
* @param attackTypeMask the attack type mask
|
||||
* @return the list
|
||||
*/
|
||||
public static List<DpTechAttackType> maskToDdosAttackType(Long attackTypeMask) {
|
||||
List<DpTechAttackType> attackTypes = new ArrayList<>();
|
||||
|
||||
for(DpTechAttackType t : DpTechAttackType.values()) {
|
||||
if((((long)1 << t.getValue()) & attackTypeMask) != 0) {
|
||||
attackTypes.add(t);
|
||||
}
|
||||
}
|
||||
|
||||
return attackTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* From ddos attack type value stream.
|
||||
*
|
||||
|
@ -223,4 +241,13 @@ public enum DpTechAttackType implements BaseEnum {
|
|||
public String getDescription() {
|
||||
return this.readme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets attack type mask.
|
||||
*
|
||||
* @return the attack type mask
|
||||
*/
|
||||
public Long getAttackTypeMask() {
|
||||
return (long)1 << this.code;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@ public class DpTechConfigValue {
|
|||
/**
|
||||
* The constant SOAP_CONNECT_TIMEOUT.
|
||||
*/
|
||||
public static volatile int SOAP_CONNECT_TIMEOUT_SECOND = 60;
|
||||
public static volatile long SOAP_CONNECT_TIMEOUT_SECOND = 60;
|
||||
/**
|
||||
* The constant SOAP_RECEIVE_TIMEOUT.
|
||||
*/
|
||||
public static volatile int SOAP_RECEIVE_TIMEOUT_SECOND = 60;
|
||||
public static volatile long SOAP_RECEIVE_TIMEOUT_SECOND = 60;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
package com.dispose.config;
|
||||
|
||||
import com.dispose.common.AuthConfigValue;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* The type Auth configure.
|
||||
*
|
||||
|
@ -14,14 +19,24 @@ import org.springframework.stereotype.Component;
|
|||
@Setter
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "auth")
|
||||
@Configuration
|
||||
public class AuthConfigure {
|
||||
/**
|
||||
* The Token timeout minute.
|
||||
*/
|
||||
private String tokenTimeoutMinute;
|
||||
private Long tokenTimeoutMinute;
|
||||
|
||||
/**
|
||||
* The Verify request token.
|
||||
*/
|
||||
private String verifyRequestToken;
|
||||
private Boolean verifyRequestToken;
|
||||
|
||||
/**
|
||||
* Init global value.
|
||||
*/
|
||||
@PostConstruct
|
||||
private void initGlobalValue() {
|
||||
AuthConfigValue.TOKEN_EXPIRED_TIME_MS = Optional.ofNullable(tokenTimeoutMinute).orElse((long) 30 * 60 * 1000);
|
||||
AuthConfigValue.VERIFY_REQUEST_TOKEN = Optional.ofNullable(verifyRequestToken).orElse(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
package com.dispose.config;
|
||||
|
||||
import com.dispose.common.DisposeConfigValue;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* The type Dispose configure.
|
||||
*
|
||||
|
@ -14,29 +19,38 @@ import org.springframework.stereotype.Component;
|
|||
@Setter
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "dispose")
|
||||
@Configuration
|
||||
public class DisposeConfigure {
|
||||
/**
|
||||
* The Call error retry times.
|
||||
*/
|
||||
public Integer callErrorRetryTimes;
|
||||
/**
|
||||
* The Check protocol timeout.
|
||||
*/
|
||||
private String checkProtocolTimeout;
|
||||
|
||||
private Boolean checkProtocolTimeout;
|
||||
/**
|
||||
* The Split char.
|
||||
*/
|
||||
private String splitChar;
|
||||
|
||||
/**
|
||||
* The Request timeout second.
|
||||
*/
|
||||
private String requestTimeoutSecond;
|
||||
|
||||
private Long requestTimeoutSecond;
|
||||
/**
|
||||
* The Used privacy protect.
|
||||
*/
|
||||
private String usedPrivacyProtect;
|
||||
private Boolean usedPrivacyProtect;
|
||||
|
||||
/**
|
||||
* The Call error retry times.
|
||||
* Init global value.
|
||||
*/
|
||||
public String callErrorRetryTimes;
|
||||
@PostConstruct
|
||||
private void initGlobalValue() {
|
||||
DisposeConfigValue.REQUEST_TIMEOUT_MS = Optional.ofNullable(requestTimeoutSecond).orElse((long) 5 * 1000);
|
||||
DisposeConfigValue.CHECK_PROTO_REQUEST_TIMEOUT = Optional.ofNullable(checkProtocolTimeout).orElse(true);
|
||||
DisposeConfigValue.USED_PRIVACY_PROTECT = Optional.ofNullable(usedPrivacyProtect).orElse(true);
|
||||
DisposeConfigValue.CALL_ERROR_RETRY_TIMES = Optional.ofNullable(callErrorRetryTimes).orElse(5);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
package com.dispose.config;
|
||||
|
||||
import com.dispose.common.DpTechConfigValue;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* The type Dp tech configure.
|
||||
*
|
||||
|
@ -14,14 +19,26 @@ import org.springframework.stereotype.Component;
|
|||
@Setter
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "dptech")
|
||||
@Configuration
|
||||
public class DpTechConfigure {
|
||||
/**
|
||||
* The Soap conn timeout.
|
||||
* The Soap conn timeout second.
|
||||
*/
|
||||
private String soapConnTimeoutSecond;
|
||||
private Integer soapConnTimeoutSecond;
|
||||
|
||||
/**
|
||||
* The Soap recv timeout.
|
||||
* The Soap recv timeout second.
|
||||
*/
|
||||
private String soapRecvTimeoutSecond;
|
||||
private Integer soapRecvTimeoutSecond;
|
||||
|
||||
|
||||
/**
|
||||
* Init global value.
|
||||
*/
|
||||
@PostConstruct
|
||||
private void initGlobalValue() {
|
||||
DpTechConfigValue.SOAP_CONNECT_TIMEOUT_SECOND = Optional.ofNullable(soapConnTimeoutSecond).orElse(50) * 1000;
|
||||
DpTechConfigValue.SOAP_RECEIVE_TIMEOUT_SECOND = Optional.ofNullable(soapRecvTimeoutSecond).orElse(50) * 1000;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,24 @@ public interface DeviceTaskManager {
|
|||
*/
|
||||
boolean setExecAttackType(Long id, NetflowDirection nf, Long attackTypeMask);
|
||||
|
||||
/**
|
||||
* Exec attack type clean bit.
|
||||
*
|
||||
* @param id the id
|
||||
* @param nf the nf
|
||||
* @param bit the bit
|
||||
*/
|
||||
void execAttackTypeCleanBit(Long id, NetflowDirection nf, Integer bit);
|
||||
|
||||
/**
|
||||
* Exec attack type set bit.
|
||||
*
|
||||
* @param id the id
|
||||
* @param nf the nf
|
||||
* @param bit the bit
|
||||
*/
|
||||
void execAttackTypeSetBit(Long id, NetflowDirection nf, Integer bit);
|
||||
|
||||
/**
|
||||
* Sets attack type status.
|
||||
*
|
||||
|
@ -58,6 +76,24 @@ public interface DeviceTaskManager {
|
|||
*/
|
||||
boolean setAttackTypeStatus(Long id, NetflowDirection nf, Long attackTypeMask);
|
||||
|
||||
/**
|
||||
* Attack type status clean bit.
|
||||
*
|
||||
* @param id the id
|
||||
* @param nf the nf
|
||||
* @param bit the bit
|
||||
*/
|
||||
void attackTypeStatusCleanBit(Long id, NetflowDirection nf, Integer bit);
|
||||
|
||||
/**
|
||||
* Attack type status set bit.
|
||||
*
|
||||
* @param id the id
|
||||
* @param nf the nf
|
||||
* @param bit the bit
|
||||
*/
|
||||
void attackTypeStatusSetBit(Long id, NetflowDirection nf, Integer bit);
|
||||
|
||||
/**
|
||||
* Sets task err retry times.
|
||||
*
|
||||
|
@ -75,4 +111,12 @@ public interface DeviceTaskManager {
|
|||
* @return the task extern id
|
||||
*/
|
||||
boolean setTaskExternId(Long id, Long externId);
|
||||
|
||||
/**
|
||||
* Gets task by id.
|
||||
*
|
||||
* @param id the id
|
||||
* @return the task by id
|
||||
*/
|
||||
DeviceTask getTaskById(Long id);
|
||||
}
|
||||
|
|
|
@ -41,10 +41,10 @@ public class DeviceTaskManagerImpl implements DeviceTaskManager {
|
|||
}
|
||||
|
||||
return deviceTaskMapper.addNewTaskInfo(DeviceTask.builder()
|
||||
.taskId(taskId)
|
||||
.deviceId(deviceId)
|
||||
.taskAttackType(attackTypeMask)
|
||||
.build()) == 1;
|
||||
.taskId(taskId)
|
||||
.deviceId(deviceId)
|
||||
.taskAttackType(attackTypeMask)
|
||||
.build()) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -81,17 +81,79 @@ public class DeviceTaskManagerImpl implements DeviceTaskManager {
|
|||
public boolean setExecAttackType(Long id, NetflowDirection nf, Long attackTypeMask) {
|
||||
int ret = 0;
|
||||
|
||||
if(nf != NetflowDirection.DIRECTION_IN) {
|
||||
if (nf != NetflowDirection.DIRECTION_IN) {
|
||||
ret = deviceTaskMapper.changeExecAttackTypeOutValue(id, attackTypeMask);
|
||||
}
|
||||
|
||||
if(nf != NetflowDirection.DIRECTION_OUT) {
|
||||
ret = deviceTaskMapper.changeAttackTypeStatusInValue(id, attackTypeMask);
|
||||
if (nf != NetflowDirection.DIRECTION_OUT) {
|
||||
ret = deviceTaskMapper.changeExecAttackTypeInValue(id, attackTypeMask);
|
||||
}
|
||||
|
||||
return ret == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exec attack type clean bit.
|
||||
*
|
||||
* @param id the id
|
||||
* @param nf the nf
|
||||
* @param bit the bit
|
||||
*/
|
||||
@Override
|
||||
public void execAttackTypeCleanBit(Long id, NetflowDirection nf, Integer bit) {
|
||||
Long execAttackTypeMask;
|
||||
long bitMask = (long)1 << bit;
|
||||
|
||||
DeviceTask devTask = deviceTaskMapper.getTaskInfoById(id);
|
||||
|
||||
if (devTask == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (nf != NetflowDirection.DIRECTION_IN) {
|
||||
execAttackTypeMask = devTask.getExecAttackTypeOut();
|
||||
execAttackTypeMask &= ~bitMask;
|
||||
setExecAttackType(id, NetflowDirection.DIRECTION_OUT, execAttackTypeMask);
|
||||
}
|
||||
|
||||
if (nf != NetflowDirection.DIRECTION_OUT) {
|
||||
execAttackTypeMask = devTask.getExecAttackTypeIn();
|
||||
execAttackTypeMask &= ~bitMask;
|
||||
setExecAttackType(id, NetflowDirection.DIRECTION_IN, execAttackTypeMask);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Exec attack type set bit.
|
||||
*
|
||||
* @param id the id
|
||||
* @param nf the nf
|
||||
* @param bit the bit
|
||||
*/
|
||||
@Override
|
||||
public void execAttackTypeSetBit(Long id, NetflowDirection nf, Integer bit) {
|
||||
Long execAttackTypeMask;
|
||||
long bitMask = (long)1 << bit;
|
||||
|
||||
DeviceTask devTask = deviceTaskMapper.getTaskInfoById(id);
|
||||
|
||||
if (devTask == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (nf != NetflowDirection.DIRECTION_IN) {
|
||||
execAttackTypeMask = devTask.getExecAttackTypeOut();
|
||||
execAttackTypeMask |= bitMask;
|
||||
setExecAttackType(id, NetflowDirection.DIRECTION_OUT, execAttackTypeMask);
|
||||
}
|
||||
|
||||
if (nf != NetflowDirection.DIRECTION_OUT) {
|
||||
execAttackTypeMask = devTask.getExecAttackTypeIn();
|
||||
execAttackTypeMask |= bitMask;
|
||||
setExecAttackType(id, NetflowDirection.DIRECTION_IN, execAttackTypeMask);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets attack type status.
|
||||
*
|
||||
|
@ -104,17 +166,79 @@ public class DeviceTaskManagerImpl implements DeviceTaskManager {
|
|||
public boolean setAttackTypeStatus(Long id, NetflowDirection nf, Long attackTypeMask) {
|
||||
int ret = 0;
|
||||
|
||||
if(nf != NetflowDirection.DIRECTION_IN) {
|
||||
if (nf != NetflowDirection.DIRECTION_IN) {
|
||||
ret = deviceTaskMapper.changeAttackTypeStatusOutValue(id, attackTypeMask);
|
||||
}
|
||||
|
||||
if(nf != NetflowDirection.DIRECTION_OUT) {
|
||||
if (nf != NetflowDirection.DIRECTION_OUT) {
|
||||
ret = deviceTaskMapper.changeAttackTypeStatusInValue(id, attackTypeMask);
|
||||
}
|
||||
|
||||
return ret == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attack type status clean bit.
|
||||
*
|
||||
* @param id the id
|
||||
* @param nf the nf
|
||||
* @param bit the bit
|
||||
*/
|
||||
@Override
|
||||
public void attackTypeStatusCleanBit(Long id, NetflowDirection nf, Integer bit) {
|
||||
Long attackTypeStatusMask;
|
||||
long bitMask = (long)1 << bit;
|
||||
|
||||
DeviceTask devTask = deviceTaskMapper.getTaskInfoById(id);
|
||||
|
||||
if (devTask == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (nf != NetflowDirection.DIRECTION_IN) {
|
||||
attackTypeStatusMask = devTask.getAttackTypeStatusOut();
|
||||
attackTypeStatusMask &= ~bitMask;
|
||||
setAttackTypeStatus(id, NetflowDirection.DIRECTION_OUT, attackTypeStatusMask);
|
||||
}
|
||||
|
||||
if (nf != NetflowDirection.DIRECTION_OUT) {
|
||||
attackTypeStatusMask = devTask.getAttackTypeStatusIn();
|
||||
attackTypeStatusMask &= ~bitMask;
|
||||
setAttackTypeStatus(id, NetflowDirection.DIRECTION_IN, attackTypeStatusMask);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attack type status set bit.
|
||||
*
|
||||
* @param id the id
|
||||
* @param nf the nf
|
||||
* @param bit the bit
|
||||
*/
|
||||
@Override
|
||||
public void attackTypeStatusSetBit(Long id, NetflowDirection nf, Integer bit) {
|
||||
Long attackTypeStatusMask;
|
||||
long bitMask = (long)1 << bit;
|
||||
|
||||
DeviceTask devTask = deviceTaskMapper.getTaskInfoById(id);
|
||||
|
||||
if (devTask == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (nf != NetflowDirection.DIRECTION_IN) {
|
||||
attackTypeStatusMask = devTask.getAttackTypeStatusOut();
|
||||
attackTypeStatusMask |= bitMask;
|
||||
setAttackTypeStatus(id, NetflowDirection.DIRECTION_OUT, attackTypeStatusMask);
|
||||
}
|
||||
|
||||
if (nf != NetflowDirection.DIRECTION_OUT) {
|
||||
attackTypeStatusMask = devTask.getAttackTypeStatusIn();
|
||||
attackTypeStatusMask |= bitMask;
|
||||
setAttackTypeStatus(id, NetflowDirection.DIRECTION_IN, attackTypeStatusMask);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets task err retry times.
|
||||
*
|
||||
|
@ -138,4 +262,15 @@ public class DeviceTaskManagerImpl implements DeviceTaskManager {
|
|||
public boolean setTaskExternId(Long id, Long externId) {
|
||||
return deviceTaskMapper.changeExternId(id, externId) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets task by id.
|
||||
*
|
||||
* @param id the id
|
||||
* @return the task by id
|
||||
*/
|
||||
@Override
|
||||
public DeviceTask getTaskById(Long id) {
|
||||
return deviceTaskMapper.getTaskInfoById(id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,14 @@ public interface DeviceTaskMapper {
|
|||
*/
|
||||
List<DeviceTask> getTaskInfoByTaskId(@Param("taskId") Long taskId);
|
||||
|
||||
/**
|
||||
* Gets task info by id.
|
||||
*
|
||||
* @param id the id
|
||||
* @return the task info by id
|
||||
*/
|
||||
DeviceTask getTaskInfoById(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* Add new task info list int.
|
||||
*
|
||||
|
@ -90,7 +98,7 @@ public interface DeviceTaskMapper {
|
|||
* @return the int
|
||||
*/
|
||||
int changeExecAttackTypeOutValue(@Param("id") Long id,
|
||||
@Param("attackTypeValue") Long attackTypeValue);
|
||||
@Param("attackTypeValue") Long attackTypeValue);
|
||||
|
||||
/**
|
||||
* Change attack type status in value int.
|
||||
|
@ -100,7 +108,7 @@ public interface DeviceTaskMapper {
|
|||
* @return the int
|
||||
*/
|
||||
int changeAttackTypeStatusInValue(@Param("id") Long id,
|
||||
@Param("attackStatsValue") Long attackStatsValue);
|
||||
@Param("attackStatsValue") Long attackStatsValue);
|
||||
|
||||
/**
|
||||
* Change attack type status out value int.
|
||||
|
@ -110,7 +118,7 @@ public interface DeviceTaskMapper {
|
|||
* @return the int
|
||||
*/
|
||||
int changeAttackTypeStatusOutValue(@Param("id") Long id,
|
||||
@Param("attackTypeValue") Long attackStatsValue);
|
||||
@Param("attackStatsValue") Long attackStatsValue);
|
||||
|
||||
/**
|
||||
* Change err retry int.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package com.dispose.service.impl;
|
||||
|
||||
import com.dispose.ability.impl.HaoHanAbilityImpl;
|
||||
import com.dispose.ability.impl.VirtualAbilityImpl;
|
||||
import com.dispose.common.DisposeConfigValue;
|
||||
import com.dispose.common.DisposeTaskStatus;
|
||||
import com.dispose.common.DpTechAttackType;
|
||||
import com.dispose.common.ErrorCode;
|
||||
import com.dispose.common.Helper;
|
||||
import com.dispose.common.NetflowDirection;
|
||||
import com.dispose.manager.DeviceTaskManager;
|
||||
import com.dispose.manager.DisposeTaskManager;
|
||||
import com.dispose.pojo.entity.DeviceTask;
|
||||
import com.dispose.pojo.entity.DisposeTask;
|
||||
import com.dispose.pojo.po.AbilityInfo;
|
||||
import com.dispose.pojo.po.MulReturnType;
|
||||
|
@ -95,12 +95,118 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
|||
deviceTaskManager.getNewDisposeDeviceTaskInfo().forEach(v -> {
|
||||
DisposeTask task = disposeTaskManager.getDisposeTaskById(v.getTaskId());
|
||||
assert task != null;
|
||||
log.info("Run task {}", task);
|
||||
log.info("Run task {}, {}", task, v);
|
||||
|
||||
MulReturnType<ErrorCode, Long> ret;
|
||||
AbilityInfo ai = disposeAbilityRouterService.getAbilityDevice(task.getDeviceId());
|
||||
|
||||
switch (ai.getDev().getDeviceType()) {
|
||||
case DPTECH_UMC:
|
||||
// 设置任务状态为启动中
|
||||
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(v.getId(), DisposeTaskStatus.TASK_STARTING);
|
||||
|
||||
// 遍历设备攻击类型
|
||||
for (DpTechAttackType t : DpTechAttackType.maskToDdosAttackType(v.getTaskAttackType())) {
|
||||
// 入方向
|
||||
if (task.getFlowDirection() != NetflowDirection.DIRECTION_IN) {
|
||||
// 已经启动过的任务不再重复启动
|
||||
if ((v.getExecAttackTypeOut() & t.getAttackTypeMask()) != 0) {
|
||||
continue;
|
||||
}
|
||||
// 设置启动任务攻击类型状态
|
||||
deviceTaskManager.execAttackTypeSetBit(v.getId(), NetflowDirection.DIRECTION_OUT,
|
||||
t.getValue());
|
||||
// 调用迪普设备启动处置任务
|
||||
ret = ai.getDb().runDispose(task.getDisposeIp(), task.getDisposeCapacity(),
|
||||
NetflowDirection.DIRECTION_OUT, t.getValue(), null);
|
||||
|
||||
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
|
||||
// 标志启动成功
|
||||
deviceTaskManager.attackTypeStatusSetBit(v.getId(), NetflowDirection.DIRECTION_OUT,
|
||||
t.getValue());
|
||||
|
||||
log.info("DPTECH_UMC setup task {}, {} succeed: {}", t,
|
||||
NetflowDirection.DIRECTION_OUT, v);
|
||||
|
||||
deviceTaskManager.setTaskErrRetryTimes(v.getId(), 0);
|
||||
} else if (v.getErrRetry() < DisposeConfigValue.CALL_ERROR_RETRY_TIMES * 10) {
|
||||
// 设置该任务为新任务,待下次重试启动
|
||||
// 记录任务出错重试次数
|
||||
v.setErrRetry(v.getErrRetry() + 1);
|
||||
deviceTaskManager.setTaskErrRetryTimes(v.getId(), v.getErrRetry());
|
||||
//清除任务攻击类型启动标志
|
||||
deviceTaskManager.execAttackTypeCleanBit(v.getId(), NetflowDirection.DIRECTION_OUT,
|
||||
t.getValue());
|
||||
log.error("DPTECH_UMC setup task {}, {} times {} error: {}", t,
|
||||
NetflowDirection.DIRECTION_OUT, v.getErrRetry(), v);
|
||||
} else {
|
||||
log.info("DPTECH_UMC setup task {}, {} error {}: {}", t,
|
||||
NetflowDirection.DIRECTION_OUT, ret.getFirstParam(), v);
|
||||
}
|
||||
}
|
||||
|
||||
// 出方向
|
||||
if (task.getFlowDirection() != NetflowDirection.DIRECTION_OUT) {
|
||||
// 已经启动过的任务不再重复启动
|
||||
if ((v.getExecAttackTypeIn() & t.getAttackTypeMask()) != 0) {
|
||||
continue;
|
||||
}
|
||||
// 设置启动任务攻击类型状态
|
||||
deviceTaskManager.execAttackTypeSetBit(v.getId(), NetflowDirection.DIRECTION_IN,
|
||||
t.getValue());
|
||||
// 调用迪普设备启动处置任务
|
||||
ret = ai.getDb().runDispose(task.getDisposeIp(), task.getDisposeCapacity(),
|
||||
NetflowDirection.DIRECTION_IN, t.getValue(), null);
|
||||
|
||||
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
|
||||
// 标志启动成功
|
||||
deviceTaskManager.attackTypeStatusSetBit(v.getId(), NetflowDirection.DIRECTION_IN,
|
||||
t.getValue());
|
||||
|
||||
log.info("DPTECH_UMC setup task {}, {} succeed: {}", t,
|
||||
NetflowDirection.DIRECTION_IN, v);
|
||||
|
||||
deviceTaskManager.setTaskErrRetryTimes(v.getId(), 0);
|
||||
} else if (v.getErrRetry() < DisposeConfigValue.CALL_ERROR_RETRY_TIMES * 10) {
|
||||
// 设置该任务为新任务,待下次重试启动
|
||||
// 记录任务出错重试次数
|
||||
v.setErrRetry(v.getErrRetry() + 1);
|
||||
deviceTaskManager.setTaskErrRetryTimes(v.getId(), v.getErrRetry());
|
||||
//清除任务攻击类型启动标志
|
||||
deviceTaskManager.execAttackTypeCleanBit(v.getId(), NetflowDirection.DIRECTION_IN,
|
||||
t.getValue());
|
||||
log.error("DPTECH_UMC setup task {}, {} times {} error: {}", t,
|
||||
NetflowDirection.DIRECTION_IN, v.getErrRetry(), v);
|
||||
} else {
|
||||
log.info("DPTECH_UMC setup task {}, {} error {}: {}", t,
|
||||
NetflowDirection.DIRECTION_IN, ret.getFirstParam(), v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean taskSetupSuccessed = true;
|
||||
DeviceTask devTask = deviceTaskManager.getTaskById(v.getId());
|
||||
|
||||
if (task.getFlowDirection() != NetflowDirection.DIRECTION_IN) {
|
||||
if (!devTask.getExecAttackTypeOut().equals(devTask.getTaskAttackType())
|
||||
|| !devTask.getExecAttackTypeOut().equals(devTask.getAttackTypeStatusOut())) {
|
||||
taskSetupSuccessed = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (task.getFlowDirection() != NetflowDirection.DIRECTION_OUT) {
|
||||
if (!devTask.getExecAttackTypeIn().equals(devTask.getTaskAttackType())
|
||||
|| !devTask.getExecAttackTypeIn().equals(devTask.getAttackTypeStatusIn())) {
|
||||
taskSetupSuccessed = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (taskSetupSuccessed) {
|
||||
// 更改处置任务状态为处置中
|
||||
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(v.getId(),
|
||||
DisposeTaskStatus.TASK_STARTED);
|
||||
log.info("DPTECH_UMC setup task succeed: {}", v);
|
||||
}
|
||||
break;
|
||||
|
||||
case HAOHAN_PLATFORM:
|
||||
|
@ -109,40 +215,35 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
|||
// 设置启动任务攻击类型状态
|
||||
deviceTaskManager.setExecAttackType(v.getId(), NetflowDirection.DIRECTION_BI,
|
||||
v.getTaskAttackType());
|
||||
// 调用设备处置能力
|
||||
MulReturnType<ErrorCode, Long> ret = ((HaoHanAbilityImpl) ai.getDb()).deviceDisposeExec(
|
||||
errorCode -> {
|
||||
// 启动处置任务成功
|
||||
if (errorCode == ErrorCode.ERR_OK) {
|
||||
// 设置攻击类型任务启动结果
|
||||
deviceTaskManager.setAttackTypeStatus(v.getId(),
|
||||
task.getFlowDirection(), v.getTaskAttackType());
|
||||
// 更改处置任务状态为处置中
|
||||
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(v.getId(),
|
||||
DisposeTaskStatus.TASK_STARTED);
|
||||
log.info("HAOHAN_PLATFORM setup task succeed: {}", v);
|
||||
} else if (v.getErrRetry() < DisposeConfigValue.CALL_ERROR_RETRY_TIMES) {
|
||||
// 设置该任务为新任务,待下次重试启动
|
||||
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(v.getId(),
|
||||
DisposeTaskStatus.TASK_NEW);
|
||||
// 记录任务出错重试次数
|
||||
deviceTaskManager.setTaskErrRetryTimes(v.getId(), v.getErrRetry() + 1);
|
||||
log.error("HAOHAN_PLATFORM setup task times {} error {}: {}",
|
||||
v.getErrRetry(), errorCode, v);
|
||||
} else {
|
||||
// 任务出错,不在重试,当做失败任务处理
|
||||
deviceTaskManager.setAttackTypeStatus(v.getId(),
|
||||
task.getFlowDirection(), ~v.getTaskAttackType());
|
||||
log.error("HAOHAN_PLATFORM setup task error {}: {}", errorCode, v);
|
||||
}
|
||||
},
|
||||
task.getDisposeCapacity(),
|
||||
task.getDisposeIp(),
|
||||
|
||||
ret = ai.getDb().runDispose(task.getDisposeIp(), task.getDisposeCapacity(), null, null,
|
||||
(long) Helper.getTimestampDiffNow(task.getPlanEndTime()));
|
||||
|
||||
// 启动任务成功,保存浩瀚任务ID到数据库
|
||||
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
|
||||
// 设置攻击类型任务启动结果
|
||||
deviceTaskManager.setAttackTypeStatus(v.getId(),
|
||||
task.getFlowDirection(), v.getTaskAttackType());
|
||||
// 更改处置任务状态为处置中
|
||||
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(v.getId(),
|
||||
DisposeTaskStatus.TASK_STARTED);
|
||||
|
||||
// 记录浩瀚设备返回的任务ID
|
||||
deviceTaskManager.setTaskExternId(v.getId(), ret.getSecondParam());
|
||||
|
||||
log.info("HAOHAN_PLATFORM setup task succeed: {}, device taskId {}", v, ret.getSecondParam());
|
||||
} else if (v.getErrRetry() < DisposeConfigValue.CALL_ERROR_RETRY_TIMES) {
|
||||
// 设置该任务为新任务,待下次重试启动
|
||||
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(v.getId(),
|
||||
DisposeTaskStatus.TASK_NEW);
|
||||
// 记录任务出错重试次数
|
||||
deviceTaskManager.setTaskErrRetryTimes(v.getId(), v.getErrRetry() + 1);
|
||||
log.error("HAOHAN_PLATFORM setup task times {} error {}: {}", v.getErrRetry(),
|
||||
ret.getSecondParam(), v);
|
||||
} else {
|
||||
// 任务出错,不在重试,当做失败任务处理
|
||||
deviceTaskManager.setAttackTypeStatus(v.getId(),
|
||||
task.getFlowDirection(), ~v.getTaskAttackType());
|
||||
log.error("HAOHAN_PLATFORM setup task error {}: {}", ret.getFirstParam(), v);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -153,26 +254,23 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
|||
deviceTaskManager.setExecAttackType(v.getId(), NetflowDirection.DIRECTION_BI,
|
||||
v.getTaskAttackType());
|
||||
|
||||
((VirtualAbilityImpl) ai.getDb()).deviceDisposeExec(
|
||||
errorCode -> {
|
||||
// 启动处置任务成功
|
||||
if (errorCode == ErrorCode.ERR_OK) {
|
||||
// 设置攻击类型任务启动结果
|
||||
deviceTaskManager.setAttackTypeStatus(v.getId(),
|
||||
task.getFlowDirection(), v.getTaskAttackType());
|
||||
// 更改处置任务状态为处置中
|
||||
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(v.getId(),
|
||||
DisposeTaskStatus.TASK_STARTED);
|
||||
log.info("VIRTUAL_DISPOSE setup task succeed: {}", v);
|
||||
} else {
|
||||
// 任务出错,不在重试,当做失败任务处理
|
||||
deviceTaskManager.setAttackTypeStatus(v.getId(),
|
||||
task.getFlowDirection(), ~v.getTaskAttackType());
|
||||
log.error("VIRTUAL_DISPOSE setup task error {}: {}", errorCode, v);
|
||||
}
|
||||
},
|
||||
task.getDisposeCapacity(),
|
||||
task.getDisposeIp());
|
||||
// 调用设备执行处置任务
|
||||
ret = ai.getDb().runDispose(task.getDisposeIp(), task.getDisposeCapacity(), null, null, null);
|
||||
|
||||
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
|
||||
// 设置攻击类型任务启动结果
|
||||
deviceTaskManager.setAttackTypeStatus(v.getId(),
|
||||
task.getFlowDirection(), v.getTaskAttackType());
|
||||
// 更改处置任务状态为处置中
|
||||
deviceTaskManager.changeDisposeDeviceTaskInfoStatus(v.getId(),
|
||||
DisposeTaskStatus.TASK_STARTED);
|
||||
log.info("VIRTUAL_DISPOSE setup task succeed: {}", v);
|
||||
} else {
|
||||
// 任务出错,不在重试,当做失败任务处理
|
||||
deviceTaskManager.setAttackTypeStatus(v.getId(),
|
||||
task.getFlowDirection(), ~v.getTaskAttackType());
|
||||
log.error("VIRTUAL_DISPOSE setup task error {}: {}", ret.getFirstParam(), v);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
package com.dispose.setup;
|
||||
|
||||
import com.dispose.common.AuthConfigValue;
|
||||
import com.dispose.common.DisposeConfigValue;
|
||||
import com.dispose.common.DpTechConfigValue;
|
||||
import com.dispose.common.ErrorCode;
|
||||
import com.dispose.config.AuthConfigure;
|
||||
import com.dispose.config.DisposeConfigure;
|
||||
import com.dispose.config.DpTechConfigure;
|
||||
import com.dispose.pojo.po.MulReturnType;
|
||||
import com.dispose.pojo.vo.DeviceFirewareInfo;
|
||||
import com.dispose.service.DisposeAbilityRouterService;
|
||||
|
@ -25,24 +19,6 @@ import javax.annotation.Resource;
|
|||
@Component
|
||||
@Slf4j
|
||||
public class SystemInitial implements CommandLineRunner {
|
||||
/**
|
||||
* The Dispose configure.
|
||||
*/
|
||||
@Resource
|
||||
DisposeConfigure disposeConfigure;
|
||||
|
||||
/**
|
||||
* The Auth configure.
|
||||
*/
|
||||
@Resource
|
||||
AuthConfigure authConfigure;
|
||||
|
||||
/**
|
||||
* The Dp tech configure.
|
||||
*/
|
||||
@Resource
|
||||
DpTechConfigure dpTechConfigure;
|
||||
|
||||
/**
|
||||
* The Dispose ability router service.
|
||||
*/
|
||||
|
@ -50,62 +26,8 @@ public class SystemInitial implements CommandLineRunner {
|
|||
private DisposeAbilityRouterService disposeAbilityRouterService;
|
||||
|
||||
/**
|
||||
* Load configure.
|
||||
* Sets ability device.
|
||||
*/
|
||||
private void loadConfigure() {
|
||||
|
||||
try {
|
||||
AuthConfigValue.TOKEN_EXPIRED_TIME_MS = Long.parseLong(authConfigure.getTokenTimeoutMinute()) * 60 * 1000;
|
||||
} catch (Exception ex) {
|
||||
log.error("load TOKEN_EXPIRED_TIME_MS configure error: {}", ex.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
AuthConfigValue.VERIFY_REQUEST_TOKEN = Boolean.parseBoolean(authConfigure.getVerifyRequestToken());
|
||||
} catch (Exception ex) {
|
||||
log.error("load VERIFY_REQUEST_TOKEN configure error: {}", ex.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
DpTechConfigValue.SOAP_CONNECT_TIMEOUT_SECOND =
|
||||
Integer.parseInt(dpTechConfigure.getSoapConnTimeoutSecond());
|
||||
} catch (Exception ex) {
|
||||
log.error("load SOAP_CONNECT_TIMEOUT_SECOND configure error: {}", ex.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
DpTechConfigValue.SOAP_RECEIVE_TIMEOUT_SECOND =
|
||||
Integer.parseInt(dpTechConfigure.getSoapRecvTimeoutSecond());
|
||||
} catch (Exception ex) {
|
||||
log.error("load SOAP_RECEIVE_TIMEOUT_SECOND configure error: {}", ex.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
DisposeConfigValue.REQUEST_TIMEOUT_MS = Integer.parseInt(disposeConfigure.getRequestTimeoutSecond()) * 1000;
|
||||
} catch (Exception ex) {
|
||||
log.error("load REQUEST_TIMEOUT_MS configure error: {}", ex.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
DisposeConfigValue.CHECK_PROTO_REQUEST_TIMEOUT =
|
||||
Boolean.parseBoolean(disposeConfigure.getCheckProtocolTimeout());
|
||||
} catch (Exception ex) {
|
||||
log.error("load CHECK_PROTO_REQUEST_TIMEOUT configure error: {}", ex.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
DisposeConfigValue.USED_PRIVACY_PROTECT = Boolean.parseBoolean(disposeConfigure.getUsedPrivacyProtect());
|
||||
} catch (Exception ex) {
|
||||
log.error("load USED_PRIVACY_PROTECT configure error: {}", ex.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
DisposeConfigValue.CALL_ERROR_RETRY_TIMES = Integer.parseInt(disposeConfigure.getCallErrorRetryTimes());
|
||||
} catch (Exception ex) {
|
||||
log.error("load CALL_ERROR_RETRY_TIMES configure error: {}", ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Async("bizExecutor")
|
||||
public void setupAbilityDevice() {
|
||||
disposeAbilityRouterService.getAllAbilityDevices().forEach(v -> {
|
||||
|
@ -118,7 +40,6 @@ public class SystemInitial implements CommandLineRunner {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run.
|
||||
*
|
||||
|
@ -126,9 +47,6 @@ public class SystemInitial implements CommandLineRunner {
|
|||
*/
|
||||
@Override
|
||||
public void run(String... args) {
|
||||
// 系统初始化入口
|
||||
loadConfigure();
|
||||
|
||||
// 初始化处置能力设备
|
||||
setupAbilityDevice();
|
||||
}
|
||||
|
|
|
@ -39,6 +39,12 @@
|
|||
${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()})
|
||||
</insert>
|
||||
|
||||
<select id="getTaskInfoById" resultMap="device_task">
|
||||
SELECT *
|
||||
FROM device_task
|
||||
WHERE id = #{id, jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<select id="getTaskInfoByTaskId" resultMap="device_task">
|
||||
SELECT *
|
||||
FROM device_task
|
||||
|
@ -48,7 +54,8 @@
|
|||
<select id="getNewTaskInfos" resultMap="device_task">
|
||||
SELECT *
|
||||
FROM device_task
|
||||
WHERE status = ${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()}
|
||||
WHERE status = ${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()} OR
|
||||
status = ${@com.dispose.common.DisposeTaskStatus@TASK_STARTING.getValue()}
|
||||
</select>
|
||||
|
||||
<select id="getTaskByDetails" resultMap="device_task">
|
||||
|
|
|
@ -1,11 +1,26 @@
|
|||
package com.dispose.test.controller;
|
||||
|
||||
import com.dispose.common.*;
|
||||
import com.dispose.common.ConstValue;
|
||||
import com.dispose.common.DisposeCapacityType;
|
||||
import com.dispose.common.DisposeDeviceType;
|
||||
import com.dispose.common.DisposeObjectType;
|
||||
import com.dispose.common.ErrorCode;
|
||||
import com.dispose.common.HttpType;
|
||||
import com.dispose.common.IpAddrType;
|
||||
import com.dispose.common.ObjectStatus;
|
||||
import com.dispose.common.ProtoCryptoType;
|
||||
import com.dispose.mapper.DisposeDeviceMapper;
|
||||
import com.dispose.pojo.dto.protocol.base.IdArraysReq;
|
||||
import com.dispose.pojo.dto.protocol.base.ProtocolReqDTO;
|
||||
import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO;
|
||||
import com.dispose.pojo.dto.protocol.device.manager.*;
|
||||
import com.dispose.pojo.dto.protocol.device.manager.AddCapacityInfo;
|
||||
import com.dispose.pojo.dto.protocol.device.manager.AddDeviceInfo;
|
||||
import com.dispose.pojo.dto.protocol.device.manager.AddDeviceReq;
|
||||
import com.dispose.pojo.dto.protocol.device.manager.AddDeviceRet;
|
||||
import com.dispose.pojo.dto.protocol.device.manager.AddDeviceRsp;
|
||||
import com.dispose.pojo.dto.protocol.device.manager.DeviceInfoRsp;
|
||||
import com.dispose.pojo.dto.protocol.device.manager.GetDeviceReq;
|
||||
import com.dispose.pojo.dto.protocol.device.manager.GetDeviceRsp;
|
||||
import com.dispose.pojo.entity.DisposeDevice;
|
||||
import com.dispose.pojo.po.MulReturnType;
|
||||
import com.dispose.test.Global.InitTestEnvironment;
|
||||
|
@ -27,7 +42,6 @@ import org.springframework.test.web.servlet.MockMvc;
|
|||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -85,7 +99,7 @@ public class DisposeDeviceManagerControllerTest extends InitTestEnvironment {
|
|||
.build());
|
||||
|
||||
newCapList.add(AddCapacityInfo.builder()
|
||||
.capacityType(DisposeCapacityType.BLOCKING.getValue())
|
||||
.capacityType(DisposeCapacityType.BLACKHOOL.getValue())
|
||||
.objectType(DisposeObjectType.URL.getValue())
|
||||
.ipType(IpAddrType.IPV4_IPV6.getValue())
|
||||
.protectIp("")
|
||||
|
|
|
@ -166,4 +166,15 @@ public class demo {
|
|||
Long ret = DDoSAttackType.getTypeMaskFromAttackType(new DDoSAttackType[] {DDoSAttackType.ALL_ATTACKS});
|
||||
log.debug("Ret: 0x{}", Long.toHexString(ret).toUpperCase());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ipBelong() {
|
||||
// for(int i = 1; i <= 255; i++) {
|
||||
// log.info("112.13.117.{} : {}", i,
|
||||
// HttpRequest.get("http://172.28.72.32:8888/ip/112.13.117." + i).execute().body());
|
||||
// log.info("112.13.119.{} : {}", i,
|
||||
// HttpRequest.get("http://172.28.72.32:8888/ip/112.13.119." + i).execute().body());
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class DPTechInterfaceTestCase extends InitTestEnvironment {
|
|||
*/
|
||||
@Test
|
||||
public void t1_runDisposeTest() {
|
||||
DisposeAbility<ErrorCode> db;
|
||||
DisposeAbility db;
|
||||
|
||||
DisposeDevice dev = DisposeDevice.builder()
|
||||
.ipAddr("10.88.77.15")
|
||||
|
@ -84,10 +84,10 @@ public class DPTechInterfaceTestCase extends InitTestEnvironment {
|
|||
// 初始化设备
|
||||
db.initDeviceEnv(url, dev.getUserName(), dev.getPassword());
|
||||
|
||||
ErrorCode ret = db.runDispose("192.168.3.5", DisposeCapacityType.CLEANUP,
|
||||
NetflowDirection.DIRECTION_BI, DDoSAttackType.ALL_ATTACKS, -1L);
|
||||
MulReturnType<ErrorCode, Long> ret = db.runDispose("192.168.3.5", DisposeCapacityType.CLEANUP,
|
||||
NetflowDirection.DIRECTION_BI, DDoSAttackType.ALL_ATTACKS.getValue(), -1L);
|
||||
|
||||
Assert.assertEquals(ret, ErrorCode.ERR_OK);
|
||||
Assert.assertEquals(ret.getFirstParam(), ErrorCode.ERR_OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ public class DPTechInterfaceTestCase extends InitTestEnvironment {
|
|||
*/
|
||||
@Test
|
||||
public void t2_stopDisposeTest() {
|
||||
DisposeAbility<ErrorCode> db;
|
||||
DisposeAbility db;
|
||||
|
||||
DisposeDevice dev = DisposeDevice.builder()
|
||||
.ipAddr("10.88.77.15")
|
||||
|
@ -126,10 +126,10 @@ public class DPTechInterfaceTestCase extends InitTestEnvironment {
|
|||
db.initDeviceEnv(url, dev.getUserName(), dev.getPassword());
|
||||
|
||||
Assert.assertTrue(db.getDeviceLinkStatus());
|
||||
ErrorCode ret = db.stopDispose("192.168.3.5", DisposeCapacityType.CLEANUP,
|
||||
NetflowDirection.DIRECTION_BI, DDoSAttackType.ALL_ATTACKS, -1L);
|
||||
MulReturnType<ErrorCode, Long> ret = db.stopDispose("192.168.3.5", DisposeCapacityType.CLEANUP,
|
||||
NetflowDirection.DIRECTION_BI, DDoSAttackType.ALL_ATTACKS.getValue(), -1L);
|
||||
|
||||
Assert.assertEquals(ret, ErrorCode.ERR_OK);
|
||||
Assert.assertEquals(ret.getFirstParam(), ErrorCode.ERR_OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ public class DPTechInterfaceTestCase extends InitTestEnvironment {
|
|||
*/
|
||||
@Test
|
||||
public void t3_getAbilityDeviceFirewareTest() {
|
||||
DisposeAbility<ErrorCode> db;
|
||||
DisposeAbility db;
|
||||
|
||||
DisposeDevice dev = DisposeDevice.builder()
|
||||
.ipAddr("10.88.77.15")
|
||||
|
|
|
@ -53,7 +53,7 @@ public class HAOHanInterfaceTestCast extends InitTestEnvironment {
|
|||
*/
|
||||
@Test
|
||||
public void t1_runDisposeTest() {
|
||||
DisposeAbility<MulReturnType<ErrorCode, Long>> db;
|
||||
DisposeAbility db;
|
||||
|
||||
DisposeDevice dev = DisposeDevice.builder()
|
||||
.ipAddr("10.88.77.88")
|
||||
|
@ -95,7 +95,7 @@ public class HAOHanInterfaceTestCast extends InitTestEnvironment {
|
|||
*/
|
||||
@Test
|
||||
public void t2_stopDisposeTest() {
|
||||
DisposeAbility<MulReturnType<ErrorCode, Long>> db;
|
||||
DisposeAbility db;
|
||||
|
||||
DisposeDevice dev = DisposeDevice.builder()
|
||||
.ipAddr("10.88.77.88")
|
||||
|
@ -138,7 +138,7 @@ public class HAOHanInterfaceTestCast extends InitTestEnvironment {
|
|||
*/
|
||||
@Test
|
||||
public void t3_getAbilityDeviceFirewareTest() {
|
||||
DisposeAbility<? extends MulReturnType<ErrorCode, Long>> db;
|
||||
DisposeAbility db;
|
||||
|
||||
DisposeDevice dev = DisposeDevice.builder()
|
||||
.ipAddr("10.88.77.88")
|
||||
|
|
|
@ -105,7 +105,7 @@ public class DisposeCapacityMapperTest {
|
|||
newCapList.add(DisposeCapacity.builder()
|
||||
.deviceId(deviceId)
|
||||
.ipType(IpAddrType.IPV4_IPV6)
|
||||
.capacityType(DisposeCapacityType.BLOCKING)
|
||||
.capacityType(DisposeCapacityType.BLACKHOOL)
|
||||
.objectType(DisposeObjectType.IP)
|
||||
.protectIp("")
|
||||
.build());
|
||||
|
@ -150,7 +150,7 @@ public class DisposeCapacityMapperTest {
|
|||
newCapList.add(DisposeCapacity.builder()
|
||||
.deviceId(deviceId)
|
||||
.ipType(IpAddrType.IPV4_IPV6)
|
||||
.capacityType(DisposeCapacityType.BLOCKING)
|
||||
.capacityType(DisposeCapacityType.BLACKHOOL)
|
||||
.objectType(DisposeObjectType.IP)
|
||||
.protectIp("")
|
||||
.build());
|
||||
|
@ -184,7 +184,7 @@ public class DisposeCapacityMapperTest {
|
|||
newCapList.add(DisposeCapacity.builder()
|
||||
.deviceId(deviceId)
|
||||
.ipType(IpAddrType.IPV4_IPV6)
|
||||
.capacityType(DisposeCapacityType.BLOCKING)
|
||||
.capacityType(DisposeCapacityType.BLACKHOOL)
|
||||
.objectType(DisposeObjectType.IP)
|
||||
.protectIp("")
|
||||
.build());
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package com.dispose.test.service;
|
||||
|
||||
import com.dispose.common.*;
|
||||
import com.dispose.common.DisposeDeviceType;
|
||||
import com.dispose.common.ErrorCode;
|
||||
import com.dispose.common.HttpType;
|
||||
import com.dispose.common.ObjectStatus;
|
||||
import com.dispose.mapper.DisposeDeviceMapper;
|
||||
import com.dispose.pojo.entity.DisposeDevice;
|
||||
import com.dispose.pojo.po.MulReturnType;
|
||||
|
|
Loading…
Reference in New Issue