OCT
REM: 1. 设备数据库增加用户名,密码,接口URL 2. 新增设备接口需要填入登录接口信息 3. 重构根据IP和类型查找处置设备接口 4. 更新数据库创建脚本 5. 更新数据库初始化数据脚本
This commit is contained in:
parent
cd865e79e2
commit
82b391b77a
|
@ -31,27 +31,6 @@ public class ConstValue {
|
|||
public static final long TOKEN_EXPIRED_TIME_MS = TOKEN_TIMEOUT_MS;
|
||||
}
|
||||
|
||||
/**
|
||||
* The type Soap wrapper const.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public static class SoapWrapperConst {
|
||||
/**
|
||||
* The constant NAMESPACE_URI.
|
||||
*/
|
||||
public static final String NAMESPACE_URI = "http://%s/UMC/service/AbnormalFlowCleaningService";
|
||||
/**
|
||||
* The constant USER_NAME.
|
||||
*/
|
||||
//public static final String SERVICE_ADDRESS = "http://10.88.77.15/UMC/service/AbnormalFlowCleaningService?wsdl";
|
||||
public static final String USER_NAME = "admin";
|
||||
/**
|
||||
* The constant PASSWORD.
|
||||
*/
|
||||
public static final String PASSWORD = "UMCAdministrator";
|
||||
}
|
||||
|
||||
/**
|
||||
* The type Protocol.
|
||||
*
|
||||
|
|
|
@ -29,9 +29,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* The type Dispose node manager controller.
|
||||
|
@ -94,6 +92,9 @@ public class DisposeNodeManagerController {
|
|||
.manufacturer(v.getManufacturer())
|
||||
.model(v.getModel())
|
||||
.version(v.getVersion())
|
||||
.userName(v.getUserName())
|
||||
.password(v.getPassword())
|
||||
.url(v.getUrl())
|
||||
.build();
|
||||
MulReturnType<ErrorCode, String> ret;
|
||||
try {
|
||||
|
|
|
@ -2,10 +2,10 @@ package com.dispose.dispose;
|
|||
|
||||
import com.dispose.common.DisposeDeviceType;
|
||||
import com.dispose.common.GlobalVar;
|
||||
import com.dispose.common.IPAddrType;
|
||||
import com.dispose.dispose.impl.DpTechImpl;
|
||||
import com.dispose.dispose.impl.HaoHanImpl;
|
||||
import com.dispose.dispose.impl.VirtualDeviceImpl;
|
||||
import com.dispose.pojo.entity.DisposeDevice;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
@ -22,16 +22,9 @@ public class DeviceRouter {
|
|||
return devType + "_" + ipAddr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Device router factory dispose entry manager.
|
||||
*
|
||||
* @param devType the dev type
|
||||
* @param ipAddr the ip addr
|
||||
* @param ipType the ip type
|
||||
* @return the dispose entry manager
|
||||
*/
|
||||
public static DisposeEntryManager deviceRouterFactory(int devType, String ipAddr, IPAddrType ipType) {
|
||||
String mapKey = getMapKey(devType, ipAddr);
|
||||
public static DisposeEntryManager deviceRouterFactory(DisposeDevice device) {
|
||||
|
||||
String mapKey = getMapKey(device.getType(), device.getIpAddr());
|
||||
|
||||
// 判断缓存中是否创建过对象,如果创建过直接从缓存中获取
|
||||
if (DEVICE_CACHE_MAP.containsKey(mapKey)) {
|
||||
|
@ -41,13 +34,13 @@ public class DeviceRouter {
|
|||
// 第一次访问创建新对象并缓存
|
||||
if (GlobalVar.USED_VIRTUAL_DISPOSE_MODE) {
|
||||
// 虚拟设备,供调试业务使用
|
||||
dev = new VirtualDeviceImpl(ipAddr);
|
||||
} else if (devType == DisposeDeviceType.DPTECH_UMC.getCode()) {
|
||||
dev = new VirtualDeviceImpl(device);
|
||||
} else if (device.getType() == DisposeDeviceType.DPTECH_UMC.getCode()) {
|
||||
// 迪普设备
|
||||
dev = new DpTechImpl(ipAddr);
|
||||
} else if (devType == DisposeDeviceType.HAOHAN_PLATFORM.getCode()) {
|
||||
dev = new DpTechImpl(device);
|
||||
} else if (device.getType() == DisposeDeviceType.HAOHAN_PLATFORM.getCode()) {
|
||||
// 浩瀚设备
|
||||
dev = new HaoHanImpl(ipAddr);
|
||||
dev = new HaoHanImpl(device);
|
||||
}
|
||||
|
||||
if (dev != null) {
|
||||
|
@ -57,7 +50,7 @@ public class DeviceRouter {
|
|||
}
|
||||
|
||||
// 始终返回一个虚拟设备作为默认设备
|
||||
DisposeEntryManager dev = new VirtualDeviceImpl(ipAddr);
|
||||
DisposeEntryManager dev = new VirtualDeviceImpl(device);
|
||||
DEVICE_CACHE_MAP.put(mapKey, dev);
|
||||
return dev;
|
||||
}
|
||||
|
@ -69,7 +62,18 @@ public class DeviceRouter {
|
|||
* @param ipAddr the ip addr
|
||||
* @return the dispose entry manager
|
||||
*/
|
||||
public static DisposeEntryManager deviceRouterFactory(int devType, String ipAddr) {
|
||||
return deviceRouterFactory(devType, ipAddr, IPAddrType.IPV4_TYPE);
|
||||
public static DisposeEntryManager getDeviceRouterFactory(int devType, String ipAddr) {
|
||||
|
||||
String mapKey = getMapKey(devType, ipAddr);
|
||||
|
||||
// 判断缓存中是否创建过对象,如果创建过直接从缓存中获取
|
||||
if (DEVICE_CACHE_MAP.containsKey(mapKey)) {
|
||||
return DEVICE_CACHE_MAP.get(mapKey);
|
||||
} else {
|
||||
// 始终返回一个虚拟设备作为默认设备
|
||||
DisposeEntryManager dev = new VirtualDeviceImpl(DisposeDevice.builder().build());
|
||||
DEVICE_CACHE_MAP.put(mapKey, dev);
|
||||
return dev;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
package com.dispose.dispose.impl;
|
||||
|
||||
import com.dispose.common.ConstValue;
|
||||
import com.dispose.common.DeviceCapacity;
|
||||
import com.dispose.common.DpTechAttackType;
|
||||
import com.dispose.common.ErrorCode;
|
||||
import com.dispose.common.GlobalVar;
|
||||
import com.dispose.common.IPAddrType;
|
||||
import com.dispose.config.DisposeConfigure;
|
||||
import com.dispose.dispose.DisposeEntryManager;
|
||||
import com.dispose.dispose.po.DeviceInfo;
|
||||
import com.dispose.interceptor.SoapPasswordCallbackHandler;
|
||||
import com.dispose.pojo.entity.DisposeDevice;
|
||||
import com.dispose.pojo.po.DisposeDeviceCapacity;
|
||||
import com.dispose.pojo.po.MulReturnType;
|
||||
import com.dptech.dispose.AbnormalFlowCleaningServicePortType;
|
||||
import com.dptech.dispose.ArrayOfProtectionObjectDataForService;
|
||||
import com.dptech.dispose.NtcRequestResultInfo;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.cxf.endpoint.Client;
|
||||
import org.apache.cxf.frontend.ClientProxy;
|
||||
|
@ -26,6 +25,7 @@ import org.apache.wss4j.dom.WSConstants;
|
|||
import org.apache.wss4j.dom.handler.WSHandlerConstants;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.xml.ws.BindingProvider;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
@ -38,37 +38,44 @@ import java.util.Map;
|
|||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
public class DpTechImpl implements DisposeEntryManager {
|
||||
private final AbnormalFlowCleaningServicePortType cleanTypePort;
|
||||
|
||||
private String password;
|
||||
|
||||
@Resource
|
||||
private DisposeConfigure disposeConfigure;
|
||||
|
||||
/**
|
||||
* Instantiates a new Dp tech.
|
||||
*
|
||||
* @param ipAddr the ip addr
|
||||
* @param dev the dev
|
||||
*/
|
||||
public DpTechImpl(String ipAddr) {
|
||||
public DpTechImpl(DisposeDevice dev) {
|
||||
JaxWsProxyFactoryBean jaxWsProxyFactoryBean = new JaxWsProxyFactoryBean();
|
||||
jaxWsProxyFactoryBean.setServiceClass(AbnormalFlowCleaningServicePortType.class);
|
||||
jaxWsProxyFactoryBean.setAddress(String.format(ConstValue.SoapWrapperConst.NAMESPACE_URI, ipAddr));
|
||||
jaxWsProxyFactoryBean.setAddress(String.format(dev.getUrl(), dev.getIpAddr()));
|
||||
|
||||
this.setPassword(dev.getPassword());
|
||||
|
||||
//WS-Security Head
|
||||
Map<String, Object> outProps = new HashMap<>();
|
||||
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
|
||||
|
||||
// 配置用户名,密码类型
|
||||
outProps.put(WSHandlerConstants.USER, ConstValue.SoapWrapperConst.USER_NAME);
|
||||
outProps.put(WSHandlerConstants.USER, dev.getUserName());
|
||||
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
|
||||
// 注册密码处理回调函数
|
||||
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, SoapPasswordCallbackHandler.class.getName());
|
||||
|
||||
// 添加WSSecure头部验证信息
|
||||
jaxWsProxyFactoryBean.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
|
||||
|
||||
this.cleanTypePort = (AbnormalFlowCleaningServicePortType) jaxWsProxyFactoryBean.create();
|
||||
|
||||
Map<String, Object> ctx = ((BindingProvider) this.cleanTypePort).getRequestContext();
|
||||
ctx.put("password", dev.getPassword());
|
||||
ctx.put("username", dev.getUserName());
|
||||
|
||||
// 配置连接,访问超时时间
|
||||
Client proxy = ClientProxy.getClient(this.cleanTypePort);
|
||||
HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
|
||||
|
@ -80,16 +87,6 @@ public class DpTechImpl implements DisposeEntryManager {
|
|||
conduit.setClient(policy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new Dp tech.
|
||||
*
|
||||
* @param ipAddr the ip addr
|
||||
* @param type the type
|
||||
*/
|
||||
public DpTechImpl(String ipAddr, IPAddrType type) {
|
||||
this(ipAddr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets version.
|
||||
*
|
||||
|
@ -259,7 +256,7 @@ public class DpTechImpl implements DisposeEntryManager {
|
|||
for (int d : new int[]{0, 1}) {
|
||||
// 遍历所有攻击类型的清洗任务
|
||||
for (DpTechAttackType t : DpTechAttackType.values()) {
|
||||
NtcRequestResultInfo ret = cleanTypePort.stopAbnormalTaskForUMC(ipAddr, t.getCode(), d);
|
||||
cleanTypePort.stopAbnormalTaskForUMC(ipAddr, t.getCode(), d);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@ package com.dispose.dispose.impl;
|
|||
import com.dispose.common.DeviceCapacity;
|
||||
import com.dispose.common.ErrorCode;
|
||||
import com.dispose.common.Http;
|
||||
import com.dispose.common.IPAddrType;
|
||||
import com.dispose.dispose.DisposeEntryManager;
|
||||
import com.dispose.dispose.po.DeviceInfo;
|
||||
import com.dispose.pojo.entity.DisposeDevice;
|
||||
import com.dispose.pojo.po.DisposeDeviceCapacity;
|
||||
import com.dispose.pojo.po.MulReturnType;
|
||||
import com.dispose.pojo.vo.haohan.CleanReq;
|
||||
|
@ -34,21 +34,10 @@ public class HaoHanImpl implements DisposeEntryManager {
|
|||
/**
|
||||
* Instantiates a new Hao han.
|
||||
*
|
||||
* @param ipAddr the ip addr
|
||||
* @param dev the dev
|
||||
*/
|
||||
public HaoHanImpl(String ipAddr) {
|
||||
this(ipAddr, IPAddrType.IPV4_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new Hao han.
|
||||
*
|
||||
* @param ipAddr the ip addr
|
||||
* @param type the type
|
||||
*/
|
||||
public HaoHanImpl(String ipAddr, IPAddrType type) {
|
||||
//http://10.88.77.88:18080/DDoSClean/clean/cleanTaskFlow
|
||||
deviceAddress = "http://" + ipAddr + "/DDoSClean/clean";
|
||||
public HaoHanImpl(DisposeDevice dev) {
|
||||
deviceAddress = String.format(dev.getUrl(), dev.getIpAddr());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,9 +3,9 @@ package com.dispose.dispose.impl;
|
|||
import com.dispose.common.DeviceCapacity;
|
||||
import com.dispose.common.ErrorCode;
|
||||
import com.dispose.common.GlobalVar;
|
||||
import com.dispose.common.IPAddrType;
|
||||
import com.dispose.dispose.DisposeEntryManager;
|
||||
import com.dispose.dispose.po.DeviceInfo;
|
||||
import com.dispose.pojo.entity.DisposeDevice;
|
||||
import com.dispose.pojo.po.DisposeDeviceCapacity;
|
||||
import com.dispose.pojo.po.MulReturnType;
|
||||
|
||||
|
@ -18,22 +18,13 @@ import java.util.List;
|
|||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public class VirtualDeviceImpl implements DisposeEntryManager {
|
||||
/**
|
||||
* Instantiates a new Virtual device.
|
||||
*
|
||||
* @param ipAddr the ip addr
|
||||
*/
|
||||
public VirtualDeviceImpl(String ipAddr) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new Virtual device.
|
||||
*
|
||||
* @param ipAddr the ip addr
|
||||
* @param type the type
|
||||
* @param dev the dev
|
||||
*/
|
||||
public VirtualDeviceImpl(String ipAddr, IPAddrType type) {
|
||||
public VirtualDeviceImpl(DisposeDevice dev) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
package com.dispose.interceptor;
|
||||
|
||||
import com.dispose.common.ConstValue;
|
||||
import org.apache.wss4j.common.ext.WSPasswordCallback;
|
||||
|
||||
import javax.security.auth.callback.Callback;
|
||||
import javax.security.auth.callback.CallbackHandler;
|
||||
|
||||
/**
|
||||
* The type Soap password callback handler.
|
||||
*
|
||||
* @author <huangxin@cmhi.chinamoblie.com>
|
||||
*/
|
||||
public class SoapPasswordCallbackHandler implements CallbackHandler {
|
||||
/**
|
||||
* Handle.
|
||||
*
|
||||
* @param callbacks the callbacks
|
||||
*/
|
||||
@Override
|
||||
public void handle(Callback[] callbacks) {
|
||||
// DPTech SOAP接口WSSecure头部密码填充
|
||||
WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
|
||||
pc.setPassword(ConstValue.SoapWrapperConst.PASSWORD);
|
||||
}
|
||||
}
|
|
@ -51,10 +51,11 @@ public class UserAccountCacheManagerImpl implements UserAccountCacheManager {
|
|||
if (username == null || username.length() == 0) {
|
||||
log.error("User {} not logged in", username);
|
||||
return ErrorCode.ERR_LOGOUT;
|
||||
} else if (ConstValue.SoapWrapperConst.USER_NAME.equals(username)) {
|
||||
// admin 用户具有操作权限
|
||||
return ErrorCode.ERR_OK;
|
||||
}
|
||||
// else if (ConstValue.SoapWrapperConst.USER_NAME.equals(username)) {
|
||||
// // admin 用户具有操作权限
|
||||
// return ErrorCode.ERR_OK;
|
||||
// }
|
||||
|
||||
log.error("User {} not enough permissions", username);
|
||||
return ErrorCode.ERR_PERMISSION;
|
||||
|
|
|
@ -55,9 +55,10 @@ public interface TaskInfoMapper extends Mapper<TaskInfo>, MySqlMapper<TaskInfo>
|
|||
@Param("status") Long status);
|
||||
|
||||
/**
|
||||
* get task info status.
|
||||
* Gets task info current status.
|
||||
*
|
||||
* @param id the id
|
||||
* @param id the id
|
||||
* @return the task info current status
|
||||
*/
|
||||
int getTaskInfoCurrentStatus(Long id);
|
||||
}
|
||||
|
|
|
@ -54,6 +54,12 @@ public class DisposeDevice implements Serializable {
|
|||
|
||||
private String version;
|
||||
|
||||
private String userName;
|
||||
|
||||
private String password;
|
||||
|
||||
private String url;
|
||||
|
||||
private String readme;
|
||||
|
||||
private Integer status;
|
||||
|
|
|
@ -24,6 +24,9 @@ public class NewNodeInfo {
|
|||
private String name;
|
||||
private String manufacturer;
|
||||
private String model;
|
||||
private String userName;
|
||||
private String password;
|
||||
private String url;
|
||||
private String version;
|
||||
private String readme;
|
||||
}
|
||||
|
|
|
@ -62,9 +62,10 @@ public class DisposeNodeManagerImpl implements DisposeNodeManager {
|
|||
|
||||
devList.forEach(v -> {
|
||||
// 对每个设备进行初始化
|
||||
DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(v.getType(),
|
||||
v.getIpAddr(), IPAddrType.getIpAddrType(v.getIpAddr()));
|
||||
//DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(v.getType(),
|
||||
// v.getIpAddr(), IPAddrType.getIpAddrType(v.getIpAddr()));
|
||||
|
||||
DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(v);
|
||||
// 链接状态
|
||||
v.setLinkStatus(dp.getDeviceLinkStatus() ? 1 : 0);
|
||||
// 版本信息
|
||||
|
@ -145,8 +146,7 @@ public class DisposeNodeManagerImpl implements DisposeNodeManager {
|
|||
|
||||
try {
|
||||
// 获取处置设备硬件访问接口
|
||||
dp = DeviceRouter.deviceRouterFactory(dev.getType(),
|
||||
dev.getIpAddr(), IPAddrType.getIpAddrType(dev.getIpAddr()));
|
||||
dp = DeviceRouter.getDeviceRouterFactory(dev.getType(), dev.getIpAddr());
|
||||
|
||||
// 判断设备是否在线
|
||||
if (!dp.getDeviceLinkStatus()) {
|
||||
|
|
|
@ -53,22 +53,6 @@ public class TaskServiceImpl implements TaskService {
|
|||
@Resource
|
||||
private TaskInfoMapper taskInfoMapper;
|
||||
|
||||
private List<DisposeEntryManager> getDisposeDeviceHandle(String disposeIp, int devCapType) {
|
||||
List<DisposeEntryManager> devEntry = new ArrayList<>();
|
||||
|
||||
List<DisposeDevice> dev = getDisposeNode(disposeIp, devCapType);
|
||||
|
||||
// 判断是否有支持处置该IP的能力
|
||||
if (dev.size() == 0) {
|
||||
log.info("No dispose device handle: disposeIp:{}, devCapType:{}", disposeIp, devCapType);
|
||||
return devEntry;
|
||||
}
|
||||
|
||||
dev.forEach(v -> devEntry.add(DeviceRouter.deviceRouterFactory(v.getType(), v.getIpAddr())));
|
||||
|
||||
return devEntry;
|
||||
}
|
||||
|
||||
private List<DisposeDevice> getDisposeNode(String disposeIp, int devCapType) {
|
||||
DeviceCapacity cap;
|
||||
|
||||
|
@ -208,7 +192,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
taskCacheManager.upgradeTaskStatus(taskId, DisposeTaskStatus.TASK_RUNNING.getCode());
|
||||
|
||||
dev.forEach(k -> {
|
||||
DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(k.getType(), k.getIpAddr());
|
||||
DisposeEntryManager dp = DeviceRouter.getDeviceRouterFactory(k.getType(), k.getIpAddr());
|
||||
|
||||
// 异步启动处置任务
|
||||
CompletableFuture.supplyAsync(() -> dp.runDispose(task.getDisposeIp(), DeviceCapacity.values()[task.getType()], planDuration))
|
||||
|
@ -268,11 +252,11 @@ public class TaskServiceImpl implements TaskService {
|
|||
}
|
||||
|
||||
dev.forEach(k -> {
|
||||
DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(k.getType(), k.getIpAddr());
|
||||
DisposeEntryManager dp = DeviceRouter.getDeviceRouterFactory(k.getType(), k.getIpAddr());
|
||||
|
||||
List<TaskInfo> TaskInfoList = taskInfoMapper.getTaskInfo(taskId, k.getId());
|
||||
List<TaskInfo> taskInfoList = taskInfoMapper.getTaskInfo(taskId, k.getId());
|
||||
|
||||
TaskInfoList.forEach(t -> {
|
||||
taskInfoList.forEach(t -> {
|
||||
if (t.getExternId() == null) {
|
||||
t.setExternId(-1L);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.dispose.task;
|
||||
|
||||
import com.dispose.common.IPAddrType;
|
||||
import com.dispose.dispose.DeviceRouter;
|
||||
import com.dispose.dispose.DisposeEntryManager;
|
||||
import com.dispose.pojo.entity.DisposeDevice;
|
||||
|
@ -31,9 +30,7 @@ public class DeviceManagerTask {
|
|||
List<DisposeDevice> devList = disposeNodeManager.getAllDisposeDevice();
|
||||
|
||||
devList.forEach(v -> {
|
||||
DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(v.getType(),
|
||||
v.getIpAddr(),
|
||||
IPAddrType.getIpAddrType(v.getIpAddr()));
|
||||
DisposeEntryManager dp = DeviceRouter.getDeviceRouterFactory(v.getType(), v.getIpAddr());
|
||||
// 自动更新设备心跳状态
|
||||
v.setLinkStatus(dp.getDeviceLinkStatus() ? 1 : 0);
|
||||
// 自动读取设备系统版本信息
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
-- ----------------------------
|
||||
-- Records of dispose_device
|
||||
-- ----------------------------
|
||||
INSERT INTO `dispose_device` VALUES (1, '10.88.77.15', 0, 0, '中移杭研实验室迪普清洗设备', 'DPTech', 'UMC', '5.7.13', '实验室测试设备', 0);
|
||||
INSERT INTO `dispose_device` VALUES (2, '10.88.77.88:18080', 1, 0, '中移杭研实验室浩瀚清洗设备', 'HaoHan', 'Unknown', 'Unknown', '实验室测试设备', 0);
|
||||
INSERT INTO `dispose_device` VALUES (1, '10.88.77.88:18080', 1, 0, '中移杭研实验室浩瀚清洗设备', 'HaoHan', 'Unknown', 'Unknown', '', '', 'http://%s/DDoSClean/clean', '实验室测试设备', 0);
|
||||
INSERT INTO `dispose_device` VALUES (2, '10.88.77.15', 0, 0, '中移杭研实验室迪普清洗设备', 'DPTech', 'UMC', '5.7.13', 'admin', 'UMCAdministrator', 'http://%s/UMC/service/AbnormalFlowCleaningService', '实验室测试设备', 0);
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
|
|
|
@ -28,6 +28,9 @@ CREATE TABLE `dispose_device`
|
|||
`manufacturer` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生产厂商',
|
||||
`model` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '型号',
|
||||
`version` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '软件版本',
|
||||
`userName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '系统管理用户名',
|
||||
`password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '系统管理密码',
|
||||
`url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'URL类型',
|
||||
`readme` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
|
||||
`status` int(11) NOT NULL DEFAULT 0 COMMENT '状态,0:正常, 1:删除',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
INSERT IGNORE INTO
|
||||
dispose_device(ipAddr, type,
|
||||
areaCode, name, manufacturer,
|
||||
model, version, readme, status)
|
||||
model, version, userName, password, url, readme, status)
|
||||
VALUES
|
||||
(#{ipAddr}, #{type},
|
||||
#{areaCode}, #{name}, #{manufacturer},
|
||||
#{model}, #{version}, #{readme}, 0)
|
||||
#{model}, #{version}, #{userName}, #{password}, #{url}, #{readme}, 0)
|
||||
</insert>
|
||||
|
||||
<select id="getDeviceByIp" resultType="com.dispose.pojo.entity.DisposeDevice" parameterType="java.lang.String">
|
||||
|
@ -42,12 +42,4 @@
|
|||
WHERE
|
||||
dispose_device.ipAddr = #{ipAddr}
|
||||
</delete>
|
||||
<delete id="delDisposeDeviceById" parameterType="java.lang.Long">
|
||||
DELETE
|
||||
dispose_device
|
||||
FROM
|
||||
dispose_device
|
||||
WHERE
|
||||
dispose_device.id = #{id}
|
||||
</delete>
|
||||
</mapper>
|
|
@ -49,7 +49,7 @@ public class DPTechInterfaceTestCase extends InitTestEnvironment {
|
|||
|
||||
try {
|
||||
DisposeEntryManager dp =
|
||||
DeviceRouter.deviceRouterFactory(DisposeDeviceType.DPTECH_UMC.getCode(), "10.88.77.15");
|
||||
DeviceRouter.getDeviceRouterFactory(DisposeDeviceType.DPTECH_UMC.getCode(), "10.88.77.15");
|
||||
|
||||
List<DetectionObjectDataForService> detDevs = dp.getAllDetectionObject();
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class DPTechInterfaceTestCase extends InitTestEnvironment {
|
|||
|
||||
try {
|
||||
DisposeEntryManager dp =
|
||||
DeviceRouter.deviceRouterFactory(DisposeDeviceType.DPTECH_UMC.getCode(), "10.88.77.15");
|
||||
DeviceRouter.getDeviceRouterFactory(DisposeDeviceType.DPTECH_UMC.getCode(), "10.88.77.15");
|
||||
|
||||
String proDevs = dp.getProtectDevices();
|
||||
|
||||
|
@ -91,7 +91,7 @@ public class DPTechInterfaceTestCase extends InitTestEnvironment {
|
|||
|
||||
try {
|
||||
DisposeEntryManager dp =
|
||||
DeviceRouter.deviceRouterFactory(DisposeDeviceType.DPTECH_UMC.getCode(), "10.88.77.15");
|
||||
DeviceRouter.getDeviceRouterFactory(DisposeDeviceType.DPTECH_UMC.getCode(), "10.88.77.15");
|
||||
|
||||
List<ProtectionObjectDataForService> proObjs = dp.getAllProtectionObject();
|
||||
|
||||
|
@ -110,7 +110,7 @@ public class DPTechInterfaceTestCase extends InitTestEnvironment {
|
|||
@Test
|
||||
public void t4_getLinkStatus() {
|
||||
|
||||
DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(DisposeDeviceType.DPTECH_UMC.getCode(),
|
||||
DisposeEntryManager dp = DeviceRouter.getDeviceRouterFactory(DisposeDeviceType.DPTECH_UMC.getCode(),
|
||||
"10.88.77.15");
|
||||
|
||||
Assert.assertTrue(dp.getDeviceLinkStatus());
|
||||
|
@ -124,7 +124,7 @@ public class DPTechInterfaceTestCase extends InitTestEnvironment {
|
|||
@Test
|
||||
public void t5_getDeviceCapacity() throws JsonProcessingException {
|
||||
|
||||
DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(DisposeDeviceType.DPTECH_UMC.getCode(),
|
||||
DisposeEntryManager dp = DeviceRouter.getDeviceRouterFactory(DisposeDeviceType.DPTECH_UMC.getCode(),
|
||||
"10.88.77.15");
|
||||
|
||||
List<DisposeDeviceCapacity> capList = dp.getDeviceCapacity();
|
||||
|
@ -136,7 +136,7 @@ public class DPTechInterfaceTestCase extends InitTestEnvironment {
|
|||
|
||||
@Test
|
||||
public void t6_runDisposeTest() {
|
||||
DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(DisposeDeviceType.DPTECH_UMC.getCode(),
|
||||
DisposeEntryManager dp = DeviceRouter.getDeviceRouterFactory(DisposeDeviceType.DPTECH_UMC.getCode(),
|
||||
"10.88.77.15");
|
||||
|
||||
Assert.assertEquals(dp.runDispose("192.168.3.5", DeviceCapacity.CLEANUP, -1L).getFirstParam(), ErrorCode.ERR_OK);
|
||||
|
@ -144,7 +144,7 @@ public class DPTechInterfaceTestCase extends InitTestEnvironment {
|
|||
|
||||
@Test
|
||||
public void t7_stopDisposeTest() {
|
||||
DisposeEntryManager dp = DeviceRouter.deviceRouterFactory(DisposeDeviceType.DPTECH_UMC.getCode(),
|
||||
DisposeEntryManager dp = DeviceRouter.getDeviceRouterFactory(DisposeDeviceType.DPTECH_UMC.getCode(),
|
||||
"10.88.77.15");
|
||||
|
||||
Assert.assertEquals(dp.stopDispose("192.168.3.5", DeviceCapacity.CLEANUP, -1L).getFirstParam(), ErrorCode.ERR_OK);
|
||||
|
|
Loading…
Reference in New Issue