REM:
1. 修正缓存防护对象
This commit is contained in:
HuangXin 2021-01-19 09:44:58 +08:00
parent 4f8e64b7e0
commit 20c56c79ba
1 changed files with 9 additions and 9 deletions

View File

@ -55,7 +55,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
/** /**
* The Obj prefix. * The Obj prefix.
*/ */
private final String OBJ_PREFIX = "CMHI"; private final String objectPrefix = "CMHI";
/** /**
* The All cleanup devices. * The All cleanup devices.
*/ */
@ -526,7 +526,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
// UMC 同步到处置平台 // UMC 同步到处置平台
dpBypassManager.getProtectObject().values().forEach(v -> { dpBypassManager.getProtectObject().values().forEach(v -> {
String serviceId = v.getProtectName() String serviceId = v.getProtectName()
.replace(OBJ_PREFIX + "_", "") .replace(objectPrefix + "_", "")
.replace("_" + IpAddrType.IPV4.getDescription(), "") .replace("_" + IpAddrType.IPV4.getDescription(), "")
.replace("_" + IpAddrType.IPV6.getDescription(), ""); .replace("_" + IpAddrType.IPV6.getDescription(), "");
@ -551,9 +551,9 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
*/ */
private String getProtectObjectName(String serviceId, IpAddrType ipAddrType) { private String getProtectObjectName(String serviceId, IpAddrType ipAddrType) {
if (IpAddrType.IPV4.equals(ipAddrType) || IpAddrType.IPV6.equals(ipAddrType)) { if (IpAddrType.IPV4.equals(ipAddrType) || IpAddrType.IPV6.equals(ipAddrType)) {
return OBJ_PREFIX + "_" + serviceId + "_" + ipAddrType.getDescription(); return objectPrefix + "_" + serviceId + "_" + ipAddrType.getDescription();
} else { } else {
return OBJ_PREFIX + "_" + serviceId; return objectPrefix + "_" + serviceId;
} }
} }
@ -565,7 +565,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
* @return the traction strategy name * @return the traction strategy name
*/ */
private String getTractionStrategyName(String objName, String disposeIp) { private String getTractionStrategyName(String objName, String disposeIp) {
return OBJ_PREFIX + "_" + disposeIp + "_" + objName; return objectPrefix + "_" + disposeIp + "_" + objName;
} }
/** /**
@ -595,7 +595,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
ret.getBypassManualTractionStrategyForService().forEach(k -> { ret.getBypassManualTractionStrategyForService().forEach(k -> {
String policyName = k.getPolicyName().getValue(); String policyName = k.getPolicyName().getValue();
// 非法名称的旁路牵引策略 // 非法名称的旁路牵引策略
if (!policyName.startsWith(OBJ_PREFIX)) { if (!policyName.startsWith(objectPrefix)) {
NtcRequestResultInfo rsp = NtcRequestResultInfo rsp =
getCleanTypePort().delBypassManualTractionStrategyForUMC(policyName); getCleanTypePort().delBypassManualTractionStrategyForUMC(policyName);
@ -656,7 +656,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
String objName = k.getProtectionTargetName().getValue(); String objName = k.getProtectionTargetName().getValue();
// 只处理CMHI相关对象和模板 // 只处理CMHI相关对象和模板
if (objName.startsWith(OBJ_PREFIX)) { if (objName.startsWith(objectPrefix)) {
DpProtectionStrategyInfo obj; DpProtectionStrategyInfo obj;
// 缓存中不存在改关联关系 // 缓存中不存在改关联关系
@ -729,7 +729,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
ret.getProtectionObjectDataForService().forEach(k -> { ret.getProtectionObjectDataForService().forEach(k -> {
String objName = k.getProtectionName().getValue(); String objName = k.getProtectionName().getValue();
// 删除非法的防护对象 // 删除非法的防护对象
if (!objName.startsWith(OBJ_PREFIX)) { if (!objName.startsWith(objectPrefix)) {
log.error("!!!!Found Unexpect Protection Object [{}, {}], Deleted it.", log.error("!!!!Found Unexpect Protection Object [{}, {}], Deleted it.",
objName, objName,
k.getIpSegment().getValue()); k.getIpSegment().getValue());
@ -991,7 +991,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
for (String v : k.getIpSegment().values()) { for (String v : k.getIpSegment().values()) {
if (Helper.ipInRange(v, ipAddr)) { if (Helper.ipInRange(v, ipAddr)) {
// 将查找到的防护对象添加到缓存中 // 将查找到的防护对象添加到缓存中
disposeObjectCache.put(k.getProtectName(), k.getProtectName()); disposeObjectCache.put(ipAddr, k.getProtectName());
return true; return true;
} }
} }