REM:
1. 修改代码规范告警
This commit is contained in:
chenlinghy 2021-03-18 09:36:15 +08:00
parent 4038c75cb5
commit e7f557862f
1 changed files with 117 additions and 92 deletions

View File

@ -455,6 +455,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
return ErrorCode.ERR_OK; return ErrorCode.ERR_OK;
} }
/** /**
* Sync dp tech device info. * Sync dp tech device info.
*/ */
@ -501,6 +502,36 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
// 防护对象存在 // 防护对象存在
if (dpBypassManager.getProtectObject().containsKey(protectName)) { if (dpBypassManager.getProtectObject().containsKey(protectName)) {
//进一步判断关联模板是都正确防护IP段是否发生变化
protectionObjExist(entry, protectName, template, ipV4, ipV6, ipSegment);
} else {
err = createProtectObject(protectName,
ipSegment.get(entry.getKey()),
IpAddrType.IPV4.equals(entry.getKey()) ? 0 : 1,
template);
if (err == ErrorCode.ERR_OK) {
log.debug("Add Protection Object {} Succeed", protectName);
} else {
log.error("!!!!Add Protection Object {} Error: {}", protectName, err.getMsg());
}
}
}
});
// UMC 同步到处置平台
umcSynDisPlatform();
}
/**
* 防护对象存在的情况
*/
private void protectionObjExist(Map.Entry<IpAddrType, String> entry, String protectName, String template,
List<String> ipV4, List<String> ipV6, HashMap<IpAddrType, String> ipSegment) {
ErrorCode err;
// 防护对象存在
DpProtectObject dp = dpBypassManager.getProtectObject().get(protectName); DpProtectObject dp = dpBypassManager.getProtectObject().get(protectName);
// 判断关联模板是否正确 // 判断关联模板是否正确
@ -549,6 +580,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
} }
} }
// 更新防护对象 // 更新防护对象
if (upgradeIpSegment) { if (upgradeIpSegment) {
err = upgradeProtectObject(protectName, err = upgradeProtectObject(protectName,
@ -561,20 +593,13 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
log.error("!!!!upgrade Protection Object {} Error: {}", protectName, err.getMsg()); log.error("!!!!upgrade Protection Object {} Error: {}", protectName, err.getMsg());
} }
} }
} else {
err = createProtectObject(protectName,
ipSegment.get(entry.getKey()),
IpAddrType.IPV4.equals(entry.getKey()) ? 0 : 1,
template);
if (err == ErrorCode.ERR_OK) {
log.debug("Add Protection Object {} Succeed", protectName);
} else {
log.error("!!!!Add Protection Object {} Error: {}", protectName, err.getMsg());
} }
}
}
});
/**
* UMC 同步到处置平台
*/
private void umcSynDisPlatform() {
// UMC 同步到处置平台 // UMC 同步到处置平台
ArrayList<String> protectNames = new ArrayList<>(); ArrayList<String> protectNames = new ArrayList<>();
@ -594,9 +619,9 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
log.error("!!!!Remove Protect Object Error: {}", protectName); log.error("!!!!Remove Protect Object Error: {}", protectName);
} }
} }
}
}
}
}
/** /**
* Gets protect object name. * Gets protect object name.