X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ves-agent%2Fsrc%2Fmain%2Fjava%2Forg%2Fcommscope%2Ftr069adapter%2Fvesagent%2Fservice%2FVesAgentServiceHelper.java;h=aac9bba6e7cd7cc63ff632b94a3d4e023715f1ba;hb=bfb65ab24d6ce7db221c5f52689a8efd8873fb1a;hp=2a30b7d994c60e7e75f82288b5b8b569132f2874;hpb=76744e810f35c84ecbd1d9998e361052466e9483;p=oam%2Ftr069-adapter.git diff --git a/ves-agent/src/main/java/org/commscope/tr069adapter/vesagent/service/VesAgentServiceHelper.java b/ves-agent/src/main/java/org/commscope/tr069adapter/vesagent/service/VesAgentServiceHelper.java index 2a30b7d..aac9bba 100644 --- a/ves-agent/src/main/java/org/commscope/tr069adapter/vesagent/service/VesAgentServiceHelper.java +++ b/ves-agent/src/main/java/org/commscope/tr069adapter/vesagent/service/VesAgentServiceHelper.java @@ -97,14 +97,7 @@ public class VesAgentServiceHelper { .equalsIgnoreCase(VesAgentConstants.REMOVE_HEART_BEAT_TIMER_VAL))) { return false; } - if (null != countDownTimer - && !countDownTimer.equalsIgnoreCase(VesAgentConstants.COUNT_DOWN_TIMER_ZERO)) { - if (null == heartBeatPeriod || heartBeatPeriod.equalsIgnoreCase(existingHeartBeatPeriod)) { - String exceptionReason = "Can't change timer value if heartbeat value is same"; - throw new VesAgentException(VesAgentConstants.INVALID_PARAMETER_VALUE, exceptionReason); - } - - } + validateTimers(heartBeatPeriod, countDownTimer, existingHeartBeatPeriod); if (!VesAgentUtils.isNullOrEmpty(heartBeatPeriod)) { attrJsonMap.put(VesAgentConstants.HEART_BEAT_PERIOD, heartBeatPeriod); @@ -117,6 +110,23 @@ public class VesAgentServiceHelper { return true; } + private void validateTimers(String heartBeatPeriod, String countDownTimer, + String existingHeartBeatPeriod) throws VesAgentException { + if (null != countDownTimer + && !countDownTimer.equalsIgnoreCase(VesAgentConstants.COUNT_DOWN_TIMER_ZERO)) { + validateHeartBeatPeriod(heartBeatPeriod, existingHeartBeatPeriod); + + } + } + + private void validateHeartBeatPeriod(String heartBeatPeriod, String existingHeartBeatPeriod) + throws VesAgentException { + if (null == heartBeatPeriod || heartBeatPeriod.equalsIgnoreCase(existingHeartBeatPeriod)) { + String exceptionReason = "Can't change timer value if heartbeat value is same"; + throw new VesAgentException(VesAgentConstants.INVALID_PARAMETER_VALUE, exceptionReason); + } + } + public void processHeartBeatSetRequest(DeviceRPCRequest deviceRPCRequest, String heartBeatPeriod, String countDownTimer) throws VesAgentException {