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

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