From 327877a6d78d4aae33b5312ff0aea9a94fe7a788 Mon Sep 17 00:00:00 2001 From: HuangXin Date: Wed, 27 Jan 2021 16:01:43 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E8=BF=AA=E6=99=AE=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E6=97=81=E8=B7=AF=E7=89=B5=E5=BC=95=E7=AD=96=E7=95=A5?= =?UTF-8?q?IPv6=E4=B8=8D=E9=9C=80=E8=A6=81=E5=85=B3=E8=81=94=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ability/impl/DpTechBypassAbilityImpl.java | 62 ++++++++++++------- 1 file changed, 41 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/dispose/ability/impl/DpTechBypassAbilityImpl.java b/src/main/java/com/dispose/ability/impl/DpTechBypassAbilityImpl.java index d6eb50c7..8864e93a 100644 --- a/src/main/java/com/dispose/ability/impl/DpTechBypassAbilityImpl.java +++ b/src/main/java/com/dispose/ability/impl/DpTechBypassAbilityImpl.java @@ -143,28 +143,31 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl { } } - // 解除关联的防护模板 - for (DpProtectionStrategyInfo v : dpBypassManager.getProtectStrategy().values()) { - // 如果防护对象关联了防护策略模板,那么解除该防护策略模板 - if (v.getProtectTargetName().equals(objName)) { + if (!skipIpV6ProtectStrategy(objName)) { + // 解除关联的防护模板 + for (DpProtectionStrategyInfo v : dpBypassManager.getProtectStrategy().values()) { + // 如果防护对象关联了防护策略模板,那么解除该防护策略模板 + if (v.getProtectTargetName().equals(objName)) { - // 没有关联模板的防护对象 - if (v.getProtectStrategyName().length() == 0) { + // 没有关联模板的防护对象 + if (v.getProtectStrategyName().length() == 0) { + break; + } + + ret = getCleanTypePort().disableProtectionStrategyTemplateForUMC(objName, + v.getProtectStrategyName()); + + if (ret.getResultRetVal() == 0) { + log.debug("Disable Protection Strategy Template {} Succeed", objName); + //解除防护对象与防护模板关联关系,清理缓存信息 + dpBypassManager.getProtectStrategy().remove(objName); + } else { + log.error("!!!!Disable Protection Strategy Template {} Error: {}", objName, + ret.getResultInfo().getValue()); + return ErrorCode.ERR_CALLDEVICE; + } break; } - - ret = getCleanTypePort().disableProtectionStrategyTemplateForUMC(objName, v.getProtectStrategyName()); - - if (ret.getResultRetVal() == 0) { - log.debug("Disable Protection Strategy Template {} Succeed", objName); - //解除防护对象与防护模板关联关系,清理缓存信息 - dpBypassManager.getProtectStrategy().remove(objName); - } else { - log.error("!!!!Disable Protection Strategy Template {} Error: {}", objName, - ret.getResultInfo().getValue()); - return ErrorCode.ERR_CALLDEVICE; - } - break; } } @@ -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. *