Few PortMapping log messages were redundant and needed to be realigned.
They were fixed previously but this created new string for the words
"create" and "update" and "found".
Sonar complains they are used multiples times.
Since these words are shared among all PortMappingVersion*** classes,
migrating them to constants in the PortMappingUtils class is preferable.
JIRA: TRNSPRTPCE-355 TRNSPRTPCE-356
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: I71a5e8eb654256004f11d10e9f3d3273d79bcede
"- cannot find port config under LLDP";
public static final String CONMAP_ISSUE_LOGMSG =
"{} : connection-map analysis for source {} and dest (CP+port) {} - no entry found for source in LCP map";
+ public static final String CREATE = "create";
public static final String CREATE_MAPPING_DATA_LOGMSG =
"{} : OpenROADM version {} node - Creating Mapping Data";
public static final String DEVICE_HAS_LOGMSG =
"{} : device has {} {}";
public static final String FETCH_CONNECTIONPORT_LOGMSG =
"{} : fetching connection-port {} at circuit-pack {}";
+ public static final String FOUND = "found";
public static final String GETTING_CONPORT_LOGMSG =
"{} : getting connection-ports for degree number {}";
public static final String GETTING_CP_LOGMSG =
"{} : unable to create MC capabilities";
public static final String UNSUPPORTED_DIR_LOGMSG =
"{} : port {} on {} - unsupported Direction {}";
+ public static final String UPDATE = "update";
public static final String UPDATE_MAPPING_LOGMSG =
"{} : Updating old mapping data {} for {} by new mapping data {}";
public static final String XPDR_LIST_IN_CONF_LOGMSG =
// Get TTP port mapping
if (!createTtpPortMapping(nodeId, deviceInfo, portMapList)) {
// return false if mapping creation for TTP's failed
- LOG.warn(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, "create", "TTP's");
+ LOG.warn(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, PortMappingUtils.CREATE, "TTP's");
return false;
}
// Get PP port mapping
if (!createPpPortMapping(nodeId, deviceInfo, portMapList)) {
// return false if mapping creation for PP's failed
- LOG.warn(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, "create", "PP's");
+ LOG.warn(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, PortMappingUtils.CREATE, "PP's");
return false;
}
break;
case Xpdr:
if (!createXpdrPortMapping(nodeId, portMapList)) {
- LOG.warn(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, "create", "Xponder");
+ LOG.warn(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, PortMappingUtils.CREATE, "Xponder");
return false;
}
break;
default:
LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG,
- nodeId, "create", deviceInfo.getNodeType() + " - unknown nodetype");
+ nodeId, PortMappingUtils.CREATE, deviceInfo.getNodeType() + " - unknown nodetype");
break;
}
public boolean updateMapping(String nodeId, Mapping oldMapping) {
if (nodeId == null) {
- LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG, "node id null" , "update", "a null value");
+ LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG, "node id null" , PortMappingUtils.UPDATE, "a null value");
return false;
}
if (oldMapping == null) {
- LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, "update", "a null value");
+ LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, PortMappingUtils.UPDATE, "a null value");
return false;
}
InstanceIdentifier<Ports> portId = InstanceIdentifier.create(OrgOpenroadmDevice.class)
return true;
} catch (InterruptedException | ExecutionException e) {
LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG,
- nodeId, "update", oldMapping.getLogicalConnectionPoint(), e);
+ nodeId, PortMappingUtils.UPDATE, oldMapping.getLogicalConnectionPoint(), e);
return false;
}
}
}
OrgOpenroadmDevice device = deviceObject.get();
if (device.getCircuitPacks() == null) {
- LOG.warn(PortMappingUtils.MISSING_CP_LOGMSG, nodeId, "found");
+ LOG.warn(PortMappingUtils.MISSING_CP_LOGMSG, nodeId, PortMappingUtils.FOUND);
return false;
}
// Variable to keep track of number of line ports
for (CircuitPacks cp : circuitPackList) {
String circuitPackName = cp.getCircuitPackName();
if (cp.getPorts() == null) {
- LOG.warn(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, "found", circuitPackName);
+ LOG.warn(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, PortMappingUtils.FOUND, circuitPackName);
continue;
}
List<Ports> portList = new ArrayList<>(cp.nonnullPorts().values());
return new ArrayList<>();
}
if (circuitPackObject.get().getPorts() == null) {
- LOG.warn(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, "found", circuitPackName);
+ LOG.warn(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, PortMappingUtils.FOUND, circuitPackName);
return new ArrayList<>();
}
return new ArrayList<>(circuitPackObject.get().nonnullPorts().values());
// Get TTP port mapping
if (!createTtpPortMapping(nodeId, deviceInfo, portMapList)) {
// return false if mapping creation for TTP's failed
- LOG.warn(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, "create", "TTP's");
+ LOG.warn(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, PortMappingUtils.CREATE, "TTP's");
return false;
}
// Get PP port mapping
if (!createPpPortMapping(nodeId, deviceInfo, portMapList)) {
// return false if mapping creation for PP's failed
- LOG.warn(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, "create", "PP's");
+ LOG.warn(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, PortMappingUtils.CREATE, "PP's");
return false;
}
// Get MC capabilities
break;
case Xpdr:
if (!createXpdrPortMapping(nodeId, portMapList)) {
- LOG.warn(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, "create", "Xponder");
+ LOG.warn(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, PortMappingUtils.CREATE, "Xponder");
return false;
}
break;
default:
LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG,
- nodeId, "create", deviceInfo.getNodeType() + " - unknown nodetype");
+ nodeId, PortMappingUtils.CREATE, deviceInfo.getNodeType() + " - unknown nodetype");
break;
}
public boolean updateMapping(String nodeId, Mapping oldMapping) {
if (nodeId == null) {
- LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG, "node id null" , "update", "a null value");
+ LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG, "node id null" , PortMappingUtils.UPDATE, "a null value");
return false;
}
if (oldMapping == null) {
- LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, "update", "a null value");
+ LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, PortMappingUtils.UPDATE, "a null value");
return false;
}
InstanceIdentifier<Ports> portId = InstanceIdentifier.create(OrgOpenroadmDevice.class)
return true;
} catch (InterruptedException | ExecutionException e) {
LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG,
- nodeId, "update", oldMapping.getLogicalConnectionPoint(), e);
+ nodeId, PortMappingUtils.UPDATE, oldMapping.getLogicalConnectionPoint(), e);
return false;
}
}
}
OrgOpenroadmDevice device = deviceObject.get();
if (device.getCircuitPacks() == null) {
- LOG.warn(PortMappingUtils.MISSING_CP_LOGMSG, nodeId, "found");
+ LOG.warn(PortMappingUtils.MISSING_CP_LOGMSG, nodeId, PortMappingUtils.FOUND);
return false;
}
for (CircuitPacks cp : circuitPackList) {
String circuitPackName = cp.getCircuitPackName();
if (cp.getPorts() == null) {
- LOG.warn(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, "found", circuitPackName);
+ LOG.warn(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, PortMappingUtils.FOUND, circuitPackName);
continue;
}
List<Ports> portList = new ArrayList<>(cp.nonnullPorts().values());
}
}
} else {
- LOG.info(PortMappingUtils.XPDR_LIST_IN_CONF_LOGMSG, nodeId, "found");
+ LOG.info(PortMappingUtils.XPDR_LIST_IN_CONF_LOGMSG, nodeId, PortMappingUtils.FOUND);
for (Xponder xponder : deviceObject.get().nonnullXponder().values()) {
// Variables to keep track of number of line ports and client ports
int line = 1;
return new ArrayList<>();
}
if (circuitPackObject.get().getPorts() == null) {
- LOG.warn(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, "found", circuitPackName);
+ LOG.warn(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, PortMappingUtils.FOUND, circuitPackName);
return new ArrayList<>();
}
return new ArrayList<>(circuitPackObject.get().nonnullPorts().values());
// Get TTP port mapping
if (!createTtpPortMapping(nodeId, deviceInfo, portMapList)) {
// return false if mapping creation for TTP's failed
- LOG.warn(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, "create", "TTP's");
+ LOG.warn(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, PortMappingUtils.CREATE, "TTP's");
return false;
}
// Get PP port mapping
if (!createPpPortMapping(nodeId, deviceInfo, portMapList)) {
// return false if mapping creation for PP's failed
- LOG.warn(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, "create", "PP's");
+ LOG.warn(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, PortMappingUtils.CREATE, "PP's");
return false;
}
// Get MC capabilities
break;
case Xpdr:
if (!createXpdrPortMapping(nodeId, portMapList)) {
- LOG.warn(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, "create", "Xponder");
+ LOG.warn(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, PortMappingUtils.CREATE, "Xponder");
return false;
}
// In the case of 7.1 models, even XPDR advertizes mc-capabilities,
break;
default:
LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG,
- nodeId, "create", deviceInfo.getNodeType() + " - unknown nodetype");
+ nodeId, PortMappingUtils.CREATE, deviceInfo.getNodeType() + " - unknown nodetype");
break;
}
public boolean updateMapping(String nodeId, Mapping oldMapping) {
if (nodeId == null) {
- LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG, "node id null" , "update", "a null value");
+ LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG, "node id null" , PortMappingUtils.UPDATE, "a null value");
return false;
}
if (oldMapping == null) {
- LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, "update", "a null value");
+ LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, PortMappingUtils.UPDATE, "a null value");
return false;
}
InstanceIdentifier<Ports> portId = InstanceIdentifier.create(OrgOpenroadmDevice.class)
return true;
} catch (InterruptedException | ExecutionException e) {
LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG,
- nodeId, "update", oldMapping.getLogicalConnectionPoint(), e);
+ nodeId, PortMappingUtils.UPDATE, oldMapping.getLogicalConnectionPoint(), e);
return false;
}
}
}
OrgOpenroadmDevice device = deviceObject.get();
if (device.getCircuitPacks() == null) {
- LOG.warn(PortMappingUtils.MISSING_CP_LOGMSG, nodeId, "found");
+ LOG.warn(PortMappingUtils.MISSING_CP_LOGMSG, nodeId, PortMappingUtils.FOUND);
return false;
}
for (CircuitPacks cp : circuitPackList) {
String circuitPackName = cp.getCircuitPackName();
if (cp.getPorts() == null) {
- LOG.warn(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, "found", circuitPackName);
+ LOG.warn(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, PortMappingUtils.FOUND, circuitPackName);
continue;
}
List<Ports> portList = new ArrayList<>(cp.nonnullPorts().values());
}
}
} else {
- LOG.info(PortMappingUtils.XPDR_LIST_IN_CONF_LOGMSG, nodeId, "found");
+ LOG.info(PortMappingUtils.XPDR_LIST_IN_CONF_LOGMSG, nodeId, PortMappingUtils.FOUND);
for (Xponder xponder : deviceObject.get().nonnullXponder().values()) {
// Variables to keep track of number of line ports and client ports
int line = 1;
return new ArrayList<>();
}
if (circuitPackObject.get().getPorts() == null) {
- LOG.warn(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, "found", circuitPackName);
+ LOG.warn(PortMappingUtils.NO_PORT_ON_CP_LOGMSG, nodeId, PortMappingUtils.FOUND, circuitPackName);
return new ArrayList<>();
}
return new ArrayList<>(circuitPackObject.get().nonnullPorts().values());