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. * The Object prefix.
*/ */
private final String objectPrefix = "CMHI"; private final String objectPrefix = "C";
/** /**
* The All cleanup devices. * The All cleanup devices.
*/ */
@ -63,7 +63,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
/** /**
* The Dp bypass manager. * The Dp bypass manager.
*/ */
private DpBypassManager dpBypassManager = DpBypassManager.builder() private final DpBypassManager dpBypassManager = DpBypassManager.builder()
.protectObject(new Hashtable<>()) .protectObject(new Hashtable<>())
.protectStrategy(new Hashtable<>()) .protectStrategy(new Hashtable<>())
.tractionStrategyName(new Hashtable<>()) .tractionStrategyName(new Hashtable<>())
@ -137,7 +137,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
dpBypassManager.getTractionStrategyName().remove(v.getPolicyName()); dpBypassManager.getTractionStrategyName().remove(v.getPolicyName());
} else { } else {
log.info("!!!!Remove Traction Strategy {} Error: {}", v.getPolicyName(), log.info("!!!!Remove Traction Strategy {} Error: {}", v.getPolicyName(),
ret.getResultInfo().getValue()); ret.getResultInfo().getValue());
return ErrorCode.ERR_CALLDEVICE; return ErrorCode.ERR_CALLDEVICE;
} }
} }
@ -161,7 +161,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
dpBypassManager.getProtectStrategy().remove(objName); dpBypassManager.getProtectStrategy().remove(objName);
} else { } else {
log.error("!!!!Disable Protection Strategy Template {} Error: {}", objName, log.error("!!!!Disable Protection Strategy Template {} Error: {}", objName,
ret.getResultInfo().getValue()); ret.getResultInfo().getValue());
return ErrorCode.ERR_CALLDEVICE; return ErrorCode.ERR_CALLDEVICE;
} }
break; break;
@ -177,7 +177,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
dpBypassManager.getProtectObject().remove(objName); dpBypassManager.getProtectObject().remove(objName);
} else { } else {
log.error("!!!!Delete Protection Object {} Error: {}", objName, log.error("!!!!Delete Protection Object {} Error: {}", objName,
ret.getResultInfo().getValue()); ret.getResultInfo().getValue());
return ErrorCode.ERR_CALLDEVICE; return ErrorCode.ERR_CALLDEVICE;
} }
@ -209,18 +209,18 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
// 创建对象 // 创建对象
NtcRequestResultInfo ret = getCleanTypePort() NtcRequestResultInfo ret = getCleanTypePort()
.addProtectionObjectForUMC("", .addProtectionObjectForUMC("",
allCleanupDevices, allCleanupDevices,
objName, objName,
ipSegment, ipSegment,
ipType, ipType,
0); 0);
if (ret.getResultRetVal() == 0) { if (ret.getResultRetVal() == 0) {
log.debug("Add Protection Object {} Succeed", objName); log.debug("Add Protection Object {} Succeed", objName);
} else { } else {
log.error("!!!!Add Protection Object {}, {}, {} Error: {}", objName, ipSegment, ipType, log.error("!!!!Add Protection Object {}, {}, {} Error: {}", objName, ipSegment, ipType,
ret.getResultInfo().getValue()); ret.getResultInfo().getValue());
return ErrorCode.ERR_CALLDEVICE; return ErrorCode.ERR_CALLDEVICE;
} }
@ -231,7 +231,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
log.debug("{} Link Protection Strategy Template {} Succeed", objName, template); log.debug("{} Link Protection Strategy Template {} Succeed", objName, template);
} else { } else {
log.error("!!!!{} Link Protection Strategy Template {} Error: {}", objName, template, log.error("!!!!{} Link Protection Strategy Template {} Error: {}", objName, template,
ret.getResultInfo().getValue()); ret.getResultInfo().getValue());
return ErrorCode.ERR_CALLDEVICE; return ErrorCode.ERR_CALLDEVICE;
} }
@ -280,14 +280,14 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
// 创建旁路手动牵引策略 // 创建旁路手动牵引策略
ret = getCleanTypePort().addBypassManualTractionStrategyForUMC(tractionName, ret = getCleanTypePort().addBypassManualTractionStrategyForUMC(tractionName,
objName, objName,
getIpSegmentFormat(disposeObject)); getIpSegmentFormat(disposeObject));
if (ret.getResultRetVal() == 0) { if (ret.getResultRetVal() == 0) {
log.debug("----Finish Create Traction Strategy {} Succeed", tractionName); log.debug("----Finish Create Traction Strategy {} Succeed", tractionName);
return ErrorCode.ERR_OK; return ErrorCode.ERR_OK;
} else { } else {
log.error("----Create Traction Strategy Error: {}, {}, {}, {}", tractionName, log.error("----Create Traction Strategy Error: {}, {}, {}, {}", tractionName,
objName, disposeObject, ret.getResultInfo().getValue()); objName, disposeObject, ret.getResultInfo().getValue());
return ErrorCode.ERR_CALLDEVICE; return ErrorCode.ERR_CALLDEVICE;
} }
} }
@ -316,7 +316,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
if (ret.getResultRetVal() != 0) { if (ret.getResultRetVal() != 0) {
err = ErrorCode.ERR_CALLDEVICE; err = ErrorCode.ERR_CALLDEVICE;
log.error("----Error Start Traction Strategy: {}, {}, {}", objName, disposeObject, log.error("----Error Start Traction Strategy: {}, {}, {}", objName, disposeObject,
ret.getResultInfo().getValue()); ret.getResultInfo().getValue());
} else { } else {
log.debug("----Finish Start Traction Strategy: {}, {}", objName, disposeObject); log.debug("----Finish Start Traction Strategy: {}, {}", objName, disposeObject);
} }
@ -392,7 +392,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
return ErrorCode.ERR_OK; return ErrorCode.ERR_OK;
} else { } else {
log.error("!!!!Remove Traction Strategy {} Error: {}", tractionName, log.error("!!!!Remove Traction Strategy {} Error: {}", tractionName,
ret.getResultInfo().getValue()); ret.getResultInfo().getValue());
return ErrorCode.ERR_CALLDEVICE; return ErrorCode.ERR_CALLDEVICE;
} }
} }
@ -421,7 +421,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
log.debug("Disable Protection Strategy Template {} Succeed", objName); log.debug("Disable Protection Strategy Template {} Succeed", objName);
} else { } else {
log.error("!!!!Disable Protection Strategy Template {} Error: {}", objName, log.error("!!!!Disable Protection Strategy Template {} Error: {}", objName,
ret.getResultInfo().getValue()); ret.getResultInfo().getValue());
return ErrorCode.ERR_CALLDEVICE; return ErrorCode.ERR_CALLDEVICE;
} }
@ -437,7 +437,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
log.debug("{} Link Protection Strategy Template {} Succeed", objName, newTemplate); log.debug("{} Link Protection Strategy Template {} Succeed", objName, newTemplate);
} else { } else {
log.error("!!!!{} Link Protection Strategy Template {} Error: {}", objName, newTemplate, log.error("!!!!{} Link Protection Strategy Template {} Error: {}", objName, newTemplate,
ret.getResultInfo().getValue()); ret.getResultInfo().getValue());
return ErrorCode.ERR_CALLDEVICE; return ErrorCode.ERR_CALLDEVICE;
} }
@ -461,7 +461,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
// 未找到合适的模板 // 未找到合适的模板
if (TemplateConfigure.UMC_TEMPLATE.stream().noneMatch(m -> m.getName().equals(template))) { if (TemplateConfigure.UMC_TEMPLATE.stream().noneMatch(m -> m.getName().equals(template))) {
log.error("!!!!{} Can't Math Template: {}, {} From {}", v.getServiceId(), v.getServiceType(), log.error("!!!!{} Can't Math Template: {}, {} From {}", v.getServiceId(), v.getServiceType(),
v.getServiceBandwidth(), TemplateConfigure.UMC_TEMPLATE); v.getServiceBandwidth(), TemplateConfigure.UMC_TEMPLATE);
return; return;
} }
@ -538,9 +538,9 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
// 更新防护对象 // 更新防护对象
if (upgradeIpSegment) { if (upgradeIpSegment) {
err = upgradeProtectObject(protectName, err = upgradeProtectObject(protectName,
ipSegment.get(t), ipSegment.get(t),
IpAddrType.IPV4.equals(t) ? 0 : 1, IpAddrType.IPV4.equals(t) ? 0 : 1,
template); template);
if (err == ErrorCode.ERR_OK) { if (err == ErrorCode.ERR_OK) {
log.debug("upgrade Protection Object {} Succeed", protectName); log.debug("upgrade Protection Object {} Succeed", protectName);
} else { } else {
@ -549,9 +549,9 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
} }
} else { } else {
err = createProtectObject(protectName, err = createProtectObject(protectName,
ipSegment.get(t), ipSegment.get(t),
IpAddrType.IPV4.equals(t) ? 0 : 1, IpAddrType.IPV4.equals(t) ? 0 : 1,
template); template);
if (err == ErrorCode.ERR_OK) { if (err == ErrorCode.ERR_OK) {
log.debug("Add Protection Object {} Succeed", protectName); log.debug("Add Protection Object {} Succeed", protectName);
} else { } else {
@ -596,8 +596,10 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
* @return the protect object name * @return the protect object name
*/ */
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)) {
return objectPrefix + "_" + serviceId + "_" + ipAddrType.getDescription(); return objectPrefix + "4" + "_" + serviceId;
} else if (IpAddrType.IPV6.equals(ipAddrType)) {
return objectPrefix + "6" + "_" + serviceId;
} else { } else {
return objectPrefix + "_" + serviceId; return objectPrefix + "_" + serviceId;
} }
@ -725,7 +727,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
log.debug("----Finish DPTech Get All Protection Strategy Association Relation"); log.debug("----Finish DPTech Get All Protection Strategy Association Relation");
} catch (Exception ex) { } catch (Exception ex) {
log.error("----Exception DPTech Get All Protection Strategy Association Relation: {}", 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)) { 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());
NtcRequestResultInfo rsp = getCleanTypePort().deleteProtectionObjectForUMC(objName); NtcRequestResultInfo rsp = getCleanTypePort().deleteProtectionObjectForUMC(objName);
@ -820,7 +822,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
log.warn("!!!!Remove Exception Protection IpSegment {}, {} Succeed", objName, v); log.warn("!!!!Remove Exception Protection IpSegment {}, {} Succeed", objName, v);
} else { } else {
log.warn("!!!!Remove Exception Protection IpSegment {}, {} Error: {}", objName, v, 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) { if (err != ErrorCode.ERR_OK) {
log.error("----Error DPTech Start Cleanup Task, Create Traction Strategy Error: {}, {}, {}", log.error("----Error DPTech Start Cleanup Task, Create Traction Strategy Error: {}, {}, {}",
protectObjName, disposeObject, err); protectObjName, disposeObject, err);
return new MulReturnType<>(ErrorCode.ERR_CALLDEVICE, null); return new MulReturnType<>(ErrorCode.ERR_CALLDEVICE, null);
} }
@ -904,7 +906,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
if (err != ErrorCode.ERR_OK) { if (err != ErrorCode.ERR_OK) {
log.error("----Error DPTech Start Cleanup Task, Start Traction Strategy Error: {}, {}, {}", log.error("----Error DPTech Start Cleanup Task, Start Traction Strategy Error: {}, {}, {}",
protectObjName, disposeObject, err); protectObjName, disposeObject, err);
return new MulReturnType<>(ErrorCode.ERR_CALLDEVICE, null); return new MulReturnType<>(ErrorCode.ERR_CALLDEVICE, null);
} }
@ -953,7 +955,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
if (err != ErrorCode.ERR_OK) { if (err != ErrorCode.ERR_OK) {
log.error("----Error DPTech Stop Cleanup Task, Stop Traction Strategy Error: {}, {}", disposeObject, log.error("----Error DPTech Stop Cleanup Task, Stop Traction Strategy Error: {}, {}", disposeObject,
err); err);
return new MulReturnType<>(err, null); return new MulReturnType<>(err, null);
} }
@ -963,7 +965,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
if (err != ErrorCode.ERR_OK) { if (err != ErrorCode.ERR_OK) {
log.error("----Error DPTech Stop Cleanup Task, Clean Traction Strategy Error: {}, {}", 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.NotBlank;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
/** /**
* The type User svr info. * The type User svr info.
@ -26,6 +27,7 @@ public class UserSvrInfo {
* The Business id. * The Business id.
*/ */
@NotBlank(message = "businessId 客户业务ID能为空", groups = ValidGroups.AddUserInfoValid.class) @NotBlank(message = "businessId 客户业务ID能为空", groups = ValidGroups.AddUserInfoValid.class)
@Size(min = 1, max = 13, message = "businessId 字符串长度为 [1, 13]", groups = ValidGroups.AddUserInfoValid.class)
private String businessId; private String businessId;
/** /**
* The Business type. * The Business type.