Code Review
/
transportpce.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Adapt TransportPCE code to Sulfur
[transportpce.git]
/
olm
/
src
/
main
/
java
/
org
/
opendaylight
/
transportpce
/
olm
/
power
/
PowerMgmtImpl.java
diff --git
a/olm/src/main/java/org/opendaylight/transportpce/olm/power/PowerMgmtImpl.java
b/olm/src/main/java/org/opendaylight/transportpce/olm/power/PowerMgmtImpl.java
index 9f993bbb5b1f2e4674531d5da981e478dbe0dfe3..280484fdf6e3b4ae3396f5120a5fa069e09d4dea 100644
(file)
--- a/
olm/src/main/java/org/opendaylight/transportpce/olm/power/PowerMgmtImpl.java
+++ b/
olm/src/main/java/org/opendaylight/transportpce/olm/power/PowerMgmtImpl.java
@@
-23,13
+23,14
@@
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfa
import org.opendaylight.transportpce.olm.util.OlmUtils;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerSetupInput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerTurndownInput;
import org.opendaylight.transportpce.olm.util.OlmUtils;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerSetupInput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerTurndownInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220
114
.OpenroadmNodeVersion;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220
114
.mapping.Mapping;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220
114
.mapping.MappingKey;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220
114
.network.Nodes;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220
316
.OpenroadmNodeVersion;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220
316
.mapping.Mapping;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220
316
.mapping.MappingKey;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220
316
.network.Nodes;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.OpticalControlMode;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.Interface;
import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev161014.Interface1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.OpticalControlMode;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.Interface;
import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev161014.Interface1;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@
-181,7
+182,7
@@
public class PowerMgmtImpl implements PowerMgmt {
spanLossTx);
return false;
}
spanLossTx);
return false;
}
-
BigDecimal powerValue = getRdmPowerValue(spanLossTx, input
);
+
Decimal64 powerValue = Decimal64.valueOf(getRdmPowerValue(spanLossTx, input)
);
try {
if (!crossConnect.setPowerLevel(nodeId, OpticalControlMode.Power.getName(), powerValue,
connectionNumber)) {
try {
if (!crossConnect.setPowerLevel(nodeId, OpticalControlMode.Power.getName(), powerValue,
connectionNumber)) {
@@
-302,7
+303,7
@@
public class PowerMgmtImpl implements PowerMgmt {
}
return interfaceOpt.get()
.augmentation(Interface1.class)
}
return interfaceOpt.get()
.augmentation(Interface1.class)
- .getOts().getSpanLossTransmit().getValue();
+ .getOts().getSpanLossTransmit().getValue()
.decimalValue()
;
case 2:
Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019
.interfaces.grp.Interface> interfaceOpt1 =
case 2:
Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019
.interfaces.grp.Interface> interfaceOpt1 =
@@
-320,7
+321,7
@@
public class PowerMgmtImpl implements PowerMgmt {
return interfaceOpt1.get()
.augmentation(org.opendaylight.yang.gen.v1.http.org
.openroadm.optical.transport.interfaces.rev181019.Interface1.class)
return interfaceOpt1.get()
.augmentation(org.opendaylight.yang.gen.v1.http.org
.openroadm.optical.transport.interfaces.rev181019.Interface1.class)
- .getOts().getSpanLossTransmit().getValue();
+ .getOts().getSpanLossTransmit().getValue()
.decimalValue()
;
// TODO no case 3 ?
default:
return null;
// TODO no case 3 ?
default:
return null;
@@
-383,33
+384,30
@@
public class PowerMgmtImpl implements PowerMgmt {
} else {
powerValue = spanLossTx.subtract(BigDecimal.valueOf(9));
}
} else {
powerValue = spanLossTx.subtract(BigDecimal.valueOf(9));
}
- // target-output-power yang precision is 2, so we limit here to 2
- powerValue = powerValue.setScale(2, RoundingMode.CEILING);
- LOG.info("P1[50GHz]={} dBm for spanloss {} based on OpenROADM-5.0 specs power target mask", powerValue,
- spanLossTx);
+ BigDecimal mcWidth = new BigDecimal(50);
// we work at constant power spectral density (50 GHz channel width @-20dBm=37.5GHz)
// 87.5 GHz channel width @-20dBm=75GHz
if (input.getMcWidth() != null) {
// we work at constant power spectral density (50 GHz channel width @-20dBm=37.5GHz)
// 87.5 GHz channel width @-20dBm=75GHz
if (input.getMcWidth() != null) {
- // Units of MC-w
di
th are in GHz, meaning it should be 40/50/87.5GHz
+ // Units of MC-w
id
th are in GHz, meaning it should be 40/50/87.5GHz
// TODO: Should we validate this units before proceeding?
// TODO: Should we validate this units before proceeding?
- LOG.debug("Input Grid size is {}",input.getMcWidth().getValue());
+ LOG.debug("Input Grid size is {}",
input.getMcWidth().getValue());
// We round-off the mc-width to the nearest grid-value based on the granularity of 12.5 GHz
double nbrMcSlots = Math.ceil(input.getMcWidth().getValue().doubleValue() / MC_WIDTH_GRAN);
LOG.debug("Nearest (ceil) number of slots {}", nbrMcSlots);
// We round-off the mc-width to the nearest grid-value based on the granularity of 12.5 GHz
double nbrMcSlots = Math.ceil(input.getMcWidth().getValue().doubleValue() / MC_WIDTH_GRAN);
LOG.debug("Nearest (ceil) number of slots {}", nbrMcSlots);
-
BigDecimal
mcWidth = new BigDecimal(MC_WIDTH_GRAN * nbrMcSlots);
- LOG.
info
("Given mc-width={}, Rounded mc-width={}", input.getMcWidth().getValue(), mcWidth);
+ mcWidth = new BigDecimal(MC_WIDTH_GRAN * nbrMcSlots);
+ LOG.
debug
("Given mc-width={}, Rounded mc-width={}", input.getMcWidth().getValue(), mcWidth);
BigDecimal logVal = mcWidth.divide(new BigDecimal(50));
double pdsVal = 10 * Math.log10(logVal.doubleValue());
// Addition of PSD value will give Pin[87.5 GHz]
BigDecimal logVal = mcWidth.divide(new BigDecimal(50));
double pdsVal = 10 * Math.log10(logVal.doubleValue());
// Addition of PSD value will give Pin[87.5 GHz]
- powerValue = powerValue.add(new BigDecimal(pdsVal, new MathContext(3,
- RoundingMode.HALF_EVEN)));
- LOG.info("P1[{}GHz]={} dB will be used for OSNR calculation", mcWidth, powerValue);
+ powerValue = powerValue.add(new BigDecimal(pdsVal, new MathContext(3, RoundingMode.HALF_EVEN)));
}
// FIXME compliancy with OpenROADM MSA and approximations used -- should be addressed with powermask update
// cf JIRA ticket https://jira.opendaylight.org/browse/TRNSPRTPCE-494
}
// FIXME compliancy with OpenROADM MSA and approximations used -- should be addressed with powermask update
// cf JIRA ticket https://jira.opendaylight.org/browse/TRNSPRTPCE-494
- LOG.info("The power value is {} for spanloss {}", powerValue, spanLossTx);
+ powerValue = powerValue.setScale(2, RoundingMode.CEILING);
+ // target-output-power yang precision is 2, so we limit here to 2
+ LOG.info("The power value is P1[{}GHz]={} dB for spanloss {}", mcWidth, powerValue, spanLossTx);
return powerValue;
}
return powerValue;
}
@@
-447,8
+445,8
@@
public class PowerMgmtImpl implements PowerMgmt {
input.getNodes().get(i).getSrcTp(), destTpId, spectralSlotName);
try {
if (destTpId.toUpperCase(Locale.getDefault()).contains("DEG")) {
input.getNodes().get(i).getSrcTp(), destTpId, spectralSlotName);
try {
if (destTpId.toUpperCase(Locale.getDefault()).contains("DEG")) {
- if (!crossConnect.setPowerLevel(nodeId, OpticalControlMode.Power.getName(),
new BigDecimal(-60),
- connectionNumber)) {
+ if (!crossConnect.setPowerLevel(nodeId, OpticalControlMode.Power.getName(),
+
Decimal64.valueOf("-60"),
connectionNumber)) {
LOG.warn("Power down failed for Roadm-connection: {}", connectionNumber);
return false;
}
LOG.warn("Power down failed for Roadm-connection: {}", connectionNumber);
return false;
}