parent
495a73c005
commit
73ff082065
|
@ -61,7 +61,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
|||
/**
|
||||
* The Object prefix.
|
||||
*/
|
||||
private final String objectPrefix = "C";
|
||||
private final String objectPrefix = "H";
|
||||
/**
|
||||
* The Dp bypass manager.
|
||||
*/
|
||||
|
@ -270,12 +270,12 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
|||
* @return the ip segment format
|
||||
*/
|
||||
private String getIpV6SegmentFormat(String ipSegment) {
|
||||
if(ipSegment.contains(ConstValue.IPV6_SEGMENT_SPILT)){
|
||||
if (ipSegment.contains(ConstValue.IPV6_SEGMENT_SPILT)) {
|
||||
return ipSegment;
|
||||
}
|
||||
|
||||
//如果输入格式为IP-IP,则返回值为null
|
||||
if(ipSegment.contains(ConstValue.IPV6_ERR_SEGMENT_SPILT)){
|
||||
if (ipSegment.contains(ConstValue.IPV6_ERR_SEGMENT_SPILT)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -501,10 +501,10 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
|||
if (!k.contains(":")) {
|
||||
ipV4.add(ipV4Idx++ + "_" + getIpSegmentFormat(k));
|
||||
} else {
|
||||
if(getIpV6SegmentFormat(k) == null){
|
||||
if (getIpV6SegmentFormat(k) == null) {
|
||||
log.error("!!!!ipV6:{} format error", k);
|
||||
return;
|
||||
}else{
|
||||
} else {
|
||||
ipV6.add(ipV6Idx++ + "_" + getIpV6SegmentFormat(k));
|
||||
}
|
||||
}
|
||||
|
@ -524,19 +524,22 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
|||
for (Map.Entry<IpAddrType, String> entry : ipSegment.entrySet()) {
|
||||
String protectName = getProtectObjectName(v.getServiceId(), entry.getKey());
|
||||
|
||||
// 防护对象存在
|
||||
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);
|
||||
//只处理CMHY前缀的防护对象
|
||||
if (protectName.startsWith(objectPrefix)) {
|
||||
// 防护对象存在
|
||||
if (dpBypassManager.getProtectObject().containsKey(protectName)) {
|
||||
//进一步判断关联模板是都正确,防护IP段是否发生变化
|
||||
protectionObjExist(entry, protectName, template, ipV4, ipV6, ipSegment);
|
||||
} else {
|
||||
log.error("!!!!Add Protection Object {} Error: {}", protectName, err.getMsg());
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -604,7 +607,6 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// 更新防护对象
|
||||
if (upgradeIpSegment) {
|
||||
err = upgradeProtectObject(protectName,
|
||||
|
@ -734,18 +736,8 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
|||
if (ret != null && ret.getBypassManualTractionStrategyForService().size() > 0) {
|
||||
ret.getBypassManualTractionStrategyForService().forEach(k -> {
|
||||
String policyName = k.getPolicyName().getValue();
|
||||
// 非法名称的旁路牵引策略
|
||||
if (!policyName.startsWith(objectPrefix)) {
|
||||
NtcRequestResultInfo rsp =
|
||||
getCleanTypePort().delBypassManualTractionStrategyForUMC(policyName);
|
||||
|
||||
if (rsp.getResultRetVal() == 0) {
|
||||
log.debug("Remove Traction Strategy {} Succeed", policyName);
|
||||
} else {
|
||||
log.error("!!!!Remove Traction Strategy {} Error: {}", policyName, rsp.getResultInfo()
|
||||
.getValue());
|
||||
}
|
||||
} else {
|
||||
// 非法名称的旁路牵引策略-因UMC平台共享,不能删除第三方的方璐手动牵引策略
|
||||
if (policyName.startsWith(objectPrefix)) {
|
||||
DpTractionStrategy obj;
|
||||
|
||||
if (dpBypassManager.getTractionStrategyName().containsKey(policyName)) {
|
||||
|
@ -863,20 +855,9 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
|||
|
||||
ret.getProtectionObjectDataForService().forEach(k -> {
|
||||
String objName = k.getProtectionName().getValue();
|
||||
// 删除非法的防护对象
|
||||
if (!objName.startsWith(objectPrefix)) {
|
||||
log.error("!!!!Found Unexpect Protection Object [{}, {}], Deleted it.",
|
||||
objName,
|
||||
k.getIpSegment().getValue());
|
||||
|
||||
NtcRequestResultInfo rsp = getCleanTypePort().deleteProtectionObjectForUMC(objName);
|
||||
|
||||
if (rsp.getResultRetVal() == 0) {
|
||||
log.warn("!!!!Remove Protection Object {} Succeed", objName);
|
||||
} else {
|
||||
log.error("!!!!Remove Protection Object {} Error: {}", objName, rsp.getResultInfo().getValue());
|
||||
}
|
||||
} else {
|
||||
// 只处理CMHY相关对象,不可对UMC上的非杭研防护对象进行删除
|
||||
if (objName.startsWith(objectPrefix)) {
|
||||
DpProtectObject obj;
|
||||
|
||||
if (dpBypassManager.getProtectObject().containsKey(objName)) {
|
||||
|
@ -918,7 +899,6 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
|||
rsp.getResultInfo().getValue());
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// 判断是否需要更新IP段信息
|
||||
|
|
Loading…
Reference in New Issue