REM:
1. 修正迪普设备添加防护对象时,单个IP地址添加不成功问题。
This commit is contained in:
HuangXin 2021-01-20 16:51:21 +08:00
parent f3f9ea13ca
commit 64a3e43245
1 changed files with 10 additions and 13 deletions

View File

@ -239,17 +239,14 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
/**
* Gets traction strategy format.
*
* @param disposeObject the dispose object
* @param ipSegment the dispose object
* @return the traction strategy format
*/
private String getTractionStrategyFormat(String disposeObject) {
// 根据 - / 字符进行分割字符串
String[] ret = disposeObject.replaceAll("/", "-").split("-");
if(ret.length == 0) {
return disposeObject;
private String getIpSegmentFormat(String ipSegment) {
if (!ipSegment.contains("/") && !ipSegment.contains("-")) {
return ipSegment + "-" + ipSegment;
} else {
return ret[0] + "-" + ret[0];
return ipSegment;
}
}
@ -279,7 +276,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
// 创建旁路手动牵引策略
ret = getCleanTypePort().addBypassManualTractionStrategyForUMC(tractionName,
objName,
getTractionStrategyFormat(disposeObject));
getIpSegmentFormat(disposeObject));
if (ret.getResultRetVal() == 0) {
log.debug("----Finish Create Traction Strategy {} Succeed", tractionName);
return ErrorCode.ERR_OK;
@ -466,9 +463,9 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
// 将业务Ip根据IP地址类型进行拆分
for (String k : StringUtils.deleteWhitespace(v.getServiceIp()).split(DisposeConfigValue.SPLIT_CHAR)) {
if (!k.contains(":")) {
ipV4.add(ipV4Idx++ + "_" + k);
ipV4.add(ipV4Idx++ + "_" + getIpSegmentFormat(k));
} else {
ipV6.add(ipV6Idx++ + "_" + k);
ipV6.add(ipV6Idx++ + "_" + getIpSegmentFormat(k));
}
}
@ -1064,6 +1061,6 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
*/
@Override
public Long toDeviceAttackType(Long ddosAttackTypeMask) {
return DpTechAttackType.getTypeMaskFromAttackType(new DpTechAttackType[] {DpTechAttackType.AUTO_ATTACK_TYPE});
return DpTechAttackType.getTypeMaskFromAttackType(new DpTechAttackType[]{DpTechAttackType.AUTO_ATTACK_TYPE});
}
}