parent
4038c75cb5
commit
e7f557862f
|
@ -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.
|
||||||
|
@ -648,7 +673,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
||||||
|
|
||||||
int dpTechMaxNameLen = 16;
|
int dpTechMaxNameLen = 16;
|
||||||
|
|
||||||
if(tsName.length() >= dpTechMaxNameLen) {
|
if (tsName.length() >= dpTechMaxNameLen) {
|
||||||
try {
|
try {
|
||||||
tsName = objectPrefix + "_" + CryptoHelper.md5Encryption(disposeIp).substring(0, 14);
|
tsName = objectPrefix + "_" + CryptoHelper.md5Encryption(disposeIp).substring(0, 14);
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
|
Loading…
Reference in New Issue