Refactor OLM PowerMgmtImpl class 00/97100/11
authorguillaume.lambert <guillaume.lambert@orange.com>
Mon, 9 Aug 2021 10:06:27 +0000 (12:06 +0200)
committerguillaume.lambert <guillaume.lambert@orange.com>
Tue, 24 Aug 2021 15:28:02 +0000 (17:28 +0200)
commit0ba980813e95dc5ee014de8a3487b6a3aa1acffe
tree4f68027d42a936424474700b974436e0edd5d87d
parent78d3b1a9eabb43aa0e7733ea0bc0a729f80060b6
Refactor OLM PowerMgmtImpl class

The former implementation of OLM Power management ignored some spotbugs
warnings and triggered many alarms in SonarCloud, mainly about
commented-out lines of code and the SetPower method.
This method had 280 lines and its cyclomatic complexity was 43.
Current Sonar rules warns methods with more than 75 lines of code
and a cyclomatic complexity of 10.

As a consequence
- remove commented-out lines of code
- fix SpotBugs warnings and remove annotations to ignore them
- split the SetPower method into several pieces
- rework and optimize the code
- add TODO and FIXME comments for some parts of the code
  that may need to be reconsidered in the future

JIRA: TRNSPRTPCE-211 TRNSPRTPCE-494
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: Iae5644f66cd6de6e17f81de3cd61dcb546ac2dd1
olm/src/main/java/org/opendaylight/transportpce/olm/power/PowerMgmtImpl.java