REM:
1. 修改迪普防护对象名称字符串长度要求
This commit is contained in:
HuangXin 2021-01-25 10:50:57 +08:00
parent 1165e7e690
commit 20ba8158a2
2 changed files with 40 additions and 36 deletions

View File

@ -54,7 +54,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
/**
* The Object prefix.
*/
private final String objectPrefix = "CMHI";
private final String objectPrefix = "C";
/**
* The All cleanup devices.
*/
@ -63,7 +63,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
/**
* The Dp bypass manager.
*/
private DpBypassManager dpBypassManager = DpBypassManager.builder()
private final DpBypassManager dpBypassManager = DpBypassManager.builder()
.protectObject(new Hashtable<>())
.protectStrategy(new Hashtable<>())
.tractionStrategyName(new Hashtable<>())
@ -137,7 +137,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
dpBypassManager.getTractionStrategyName().remove(v.getPolicyName());
} else {
log.info("!!!!Remove Traction Strategy {} Error: {}", v.getPolicyName(),
ret.getResultInfo().getValue());
ret.getResultInfo().getValue());
return ErrorCode.ERR_CALLDEVICE;
}
}
@ -161,7 +161,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
dpBypassManager.getProtectStrategy().remove(objName);
} else {
log.error("!!!!Disable Protection Strategy Template {} Error: {}", objName,
ret.getResultInfo().getValue());
ret.getResultInfo().getValue());
return ErrorCode.ERR_CALLDEVICE;
}
break;
@ -177,7 +177,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
dpBypassManager.getProtectObject().remove(objName);
} else {
log.error("!!!!Delete Protection Object {} Error: {}", objName,
ret.getResultInfo().getValue());
ret.getResultInfo().getValue());
return ErrorCode.ERR_CALLDEVICE;
}
@ -209,18 +209,18 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
// 创建对象
NtcRequestResultInfo ret = getCleanTypePort()
.addProtectionObjectForUMC("",
allCleanupDevices,
objName,
ipSegment,
ipType,
0);
allCleanupDevices,
objName,
ipSegment,
ipType,
0);
if (ret.getResultRetVal() == 0) {
log.debug("Add Protection Object {} Succeed", objName);
} else {
log.error("!!!!Add Protection Object {}, {}, {} Error: {}", objName, ipSegment, ipType,
ret.getResultInfo().getValue());
ret.getResultInfo().getValue());
return ErrorCode.ERR_CALLDEVICE;
}
@ -231,7 +231,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
log.debug("{} Link Protection Strategy Template {} Succeed", objName, template);
} else {
log.error("!!!!{} Link Protection Strategy Template {} Error: {}", objName, template,
ret.getResultInfo().getValue());
ret.getResultInfo().getValue());
return ErrorCode.ERR_CALLDEVICE;
}
@ -280,14 +280,14 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
// 创建旁路手动牵引策略
ret = getCleanTypePort().addBypassManualTractionStrategyForUMC(tractionName,
objName,
getIpSegmentFormat(disposeObject));
objName,
getIpSegmentFormat(disposeObject));
if (ret.getResultRetVal() == 0) {
log.debug("----Finish Create Traction Strategy {} Succeed", tractionName);
return ErrorCode.ERR_OK;
} else {
log.error("----Create Traction Strategy Error: {}, {}, {}, {}", tractionName,
objName, disposeObject, ret.getResultInfo().getValue());
objName, disposeObject, ret.getResultInfo().getValue());
return ErrorCode.ERR_CALLDEVICE;
}
}
@ -316,7 +316,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
if (ret.getResultRetVal() != 0) {
err = ErrorCode.ERR_CALLDEVICE;
log.error("----Error Start Traction Strategy: {}, {}, {}", objName, disposeObject,
ret.getResultInfo().getValue());
ret.getResultInfo().getValue());
} else {
log.debug("----Finish Start Traction Strategy: {}, {}", objName, disposeObject);
}
@ -392,7 +392,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
return ErrorCode.ERR_OK;
} else {
log.error("!!!!Remove Traction Strategy {} Error: {}", tractionName,
ret.getResultInfo().getValue());
ret.getResultInfo().getValue());
return ErrorCode.ERR_CALLDEVICE;
}
}
@ -421,7 +421,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
log.debug("Disable Protection Strategy Template {} Succeed", objName);
} else {
log.error("!!!!Disable Protection Strategy Template {} Error: {}", objName,
ret.getResultInfo().getValue());
ret.getResultInfo().getValue());
return ErrorCode.ERR_CALLDEVICE;
}
@ -437,7 +437,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
log.debug("{} Link Protection Strategy Template {} Succeed", objName, newTemplate);
} else {
log.error("!!!!{} Link Protection Strategy Template {} Error: {}", objName, newTemplate,
ret.getResultInfo().getValue());
ret.getResultInfo().getValue());
return ErrorCode.ERR_CALLDEVICE;
}
@ -461,7 +461,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
// 未找到合适的模板
if (TemplateConfigure.UMC_TEMPLATE.stream().noneMatch(m -> m.getName().equals(template))) {
log.error("!!!!{} Can't Math Template: {}, {} From {}", v.getServiceId(), v.getServiceType(),
v.getServiceBandwidth(), TemplateConfigure.UMC_TEMPLATE);
v.getServiceBandwidth(), TemplateConfigure.UMC_TEMPLATE);
return;
}
@ -538,9 +538,9 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
// 更新防护对象
if (upgradeIpSegment) {
err = upgradeProtectObject(protectName,
ipSegment.get(t),
IpAddrType.IPV4.equals(t) ? 0 : 1,
template);
ipSegment.get(t),
IpAddrType.IPV4.equals(t) ? 0 : 1,
template);
if (err == ErrorCode.ERR_OK) {
log.debug("upgrade Protection Object {} Succeed", protectName);
} else {
@ -549,9 +549,9 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
}
} else {
err = createProtectObject(protectName,
ipSegment.get(t),
IpAddrType.IPV4.equals(t) ? 0 : 1,
template);
ipSegment.get(t),
IpAddrType.IPV4.equals(t) ? 0 : 1,
template);
if (err == ErrorCode.ERR_OK) {
log.debug("Add Protection Object {} Succeed", protectName);
} else {
@ -596,8 +596,10 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
* @return the protect object name
*/
private String getProtectObjectName(String serviceId, IpAddrType ipAddrType) {
if (IpAddrType.IPV4.equals(ipAddrType) || IpAddrType.IPV6.equals(ipAddrType)) {
return objectPrefix + "_" + serviceId + "_" + ipAddrType.getDescription();
if (IpAddrType.IPV4.equals(ipAddrType)) {
return objectPrefix + "4" + "_" + serviceId;
} else if (IpAddrType.IPV6.equals(ipAddrType)) {
return objectPrefix + "6" + "_" + serviceId;
} else {
return objectPrefix + "_" + serviceId;
}
@ -725,7 +727,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
log.debug("----Finish DPTech Get All Protection Strategy Association Relation");
} catch (Exception ex) {
log.error("----Exception DPTech Get All Protection Strategy Association Relation: {}",
ex.getMessage());
ex.getMessage());
}
}
@ -771,8 +773,8 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
// 删除非法的防护对象
if (!objName.startsWith(objectPrefix)) {
log.error("!!!!Found Unexpect Protection Object [{}, {}], Deleted it.",
objName,
k.getIpSegment().getValue());
objName,
k.getIpSegment().getValue());
NtcRequestResultInfo rsp = getCleanTypePort().deleteProtectionObjectForUMC(objName);
@ -820,7 +822,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
log.warn("!!!!Remove Exception Protection IpSegment {}, {} Succeed", objName, v);
} else {
log.warn("!!!!Remove Exception Protection IpSegment {}, {} Error: {}", objName, v,
rsp.getResultInfo().getValue());
rsp.getResultInfo().getValue());
}
}
@ -895,7 +897,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
if (err != ErrorCode.ERR_OK) {
log.error("----Error DPTech Start Cleanup Task, Create Traction Strategy Error: {}, {}, {}",
protectObjName, disposeObject, err);
protectObjName, disposeObject, err);
return new MulReturnType<>(ErrorCode.ERR_CALLDEVICE, null);
}
@ -904,7 +906,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
if (err != ErrorCode.ERR_OK) {
log.error("----Error DPTech Start Cleanup Task, Start Traction Strategy Error: {}, {}, {}",
protectObjName, disposeObject, err);
protectObjName, disposeObject, err);
return new MulReturnType<>(ErrorCode.ERR_CALLDEVICE, null);
}
@ -953,7 +955,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
if (err != ErrorCode.ERR_OK) {
log.error("----Error DPTech Stop Cleanup Task, Stop Traction Strategy Error: {}, {}", disposeObject,
err);
err);
return new MulReturnType<>(err, null);
}
@ -963,7 +965,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
if (err != ErrorCode.ERR_OK) {
log.error("----Error DPTech Stop Cleanup Task, Clean Traction Strategy Error: {}, {}",
disposeObject, err);
disposeObject, err);
}
}

View File

@ -11,6 +11,7 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
/**
* The type User svr info.
@ -26,6 +27,7 @@ public class UserSvrInfo {
* The Business id.
*/
@NotBlank(message = "businessId 客户业务ID能为空", groups = ValidGroups.AddUserInfoValid.class)
@Size(min = 1, max = 13, message = "businessId 字符串长度为 [1, 13]", groups = ValidGroups.AddUserInfoValid.class)
private String businessId;
/**
* The Business type.