REM:
1. 迪普手动旁路牵引策略IPv6不需要关联模板
This commit is contained in:
HuangXin 2021-01-27 16:01:43 +08:00
parent da189c151f
commit 327877a6d7
1 changed files with 41 additions and 21 deletions

View File

@ -143,6 +143,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
}
}
if (!skipIpV6ProtectStrategy(objName)) {
// 解除关联的防护模板
for (DpProtectionStrategyInfo v : dpBypassManager.getProtectStrategy().values()) {
// 如果防护对象关联了防护策略模板那么解除该防护策略模板
@ -153,7 +154,8 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
break;
}
ret = getCleanTypePort().disableProtectionStrategyTemplateForUMC(objName, v.getProtectStrategyName());
ret = getCleanTypePort().disableProtectionStrategyTemplateForUMC(objName,
v.getProtectStrategyName());
if (ret.getResultRetVal() == 0) {
log.debug("Disable Protection Strategy Template {} Succeed", objName);
@ -167,6 +169,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
break;
}
}
}
// 删除防护对象
ret = getCleanTypePort().deleteProtectionObjectForUMC(objName);
@ -217,7 +220,6 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
if (ret.getResultRetVal() == 0) {
log.debug("Add Protection Object {} Succeed", objName);
} else {
log.error("!!!!Add Protection Object {}, {}, {} Error: {}", objName, ipSegment, ipType,
ret.getResultInfo().getValue());
@ -412,6 +414,10 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
private ErrorCode associationProtectionTemplate(String objName, String newTemplate, String oldTemplate) {
NtcRequestResultInfo ret;
if (skipIpV6ProtectStrategy(objName)) {
return ErrorCode.ERR_OK;
}
// 如果关联了旧的防护模板先解除关联
if (oldTemplate != null
&& TemplateConfigure.UMC_TEMPLATE.stream().anyMatch(m -> m.getName().equals(oldTemplate))) {
@ -495,7 +501,9 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
// 判断关联模板是否正确
if (dpBypassManager.getProtectStrategy().containsKey(protectName)) {
// 已经关联防护模板
String temp = dpBypassManager.getProtectStrategy().get(protectName).getProtectStrategyName();
String temp = dpBypassManager.getProtectStrategy()
.get(protectName)
.getProtectStrategyName();
// 如果关联模板有变更
if (!temp.equals(template)) {
// 重新关联防护模板
@ -506,6 +514,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
associationProtectionTemplate(protectName, template, null);
}
boolean upgradeIpSegment = false;
// 判断防护IP段是否有变化
@ -601,6 +610,17 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
}
}
/**
* Skip ip v 6 protect strategy boolean.
*
* @param projectObjName the project obj name
* @return the boolean
*/
private boolean skipIpV6ProtectStrategy(String projectObjName) {
String prefix = objectPrefix + "6" + "_";
return projectObjName.startsWith(prefix);
}
/**
* Gets user service id.
*