Change most of LOG messages of PCE from Info to Debug level.
JIRA: TRNSPRTPCE-570
Signed-off-by: Gilles Thouenon <gilles.thouenon@orange.com>
Change-Id: I1b2626b605f263ec62c534c453a1d211053c56eb
import java.util.ArrayList;
import java.util.List;
+import java.util.StringJoiner;
import org.opendaylight.transportpce.pce.networkanalyzer.PceOpticalNode;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.PceMetric;
import org.slf4j.Logger;
return name;
}
+ @Override
+ public String toString() {
+ return new StringJoiner(", ", ResourcePair.class.getSimpleName() + "[", "]")
+ .add("type=" + type)
+ .add("name='" + name + "'")
+ .toString();
+ }
}
public List<ResourcePair> getListToInclude() {
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
import org.jgrapht.GraphPath;
import org.jgrapht.alg.shortestpath.KShortestSimplePaths;
import org.jgrapht.alg.shortestpath.PathValidator;
private List<PceLink> shortestPathAtoZ = null;
// for path calculation
- List<GraphPath<String, PceGraphEdge>> allWPaths = null;
+ Map<Integer, GraphPath<String, PceGraphEdge>> allWPaths = null;
private List<PceLink> pathAtoZ = new ArrayList<>();
populateWithLinks(weightedGraph);
if (!runKgraphs(weightedGraph)) {
- LOG.info("In calcPath : pceResult {}", pceResult);
+ LOG.error("In calcPath : pceResult {}", pceResult);
return false;
}
-
// validate found paths
pceResult.setRC(ResponseCodes.RESPONSE_FAILED);
- for (GraphPath<String, PceGraphEdge> path : allWPaths) {
+ for (Entry<Integer, GraphPath<String, PceGraphEdge>> entry : allWPaths.entrySet()) {
+ GraphPath<String, PceGraphEdge> path = entry.getValue();
+ LOG.info("validating path n° {} - {}", entry.getKey(), path.getVertexList());
PostAlgoPathValidator papv = new PostAlgoPathValidator();
pceResult = papv.checkPath(path, allPceNodes, pceResult, pceHardConstraints, serviceType);
- LOG.info("In calcPath after PostAlgoPathValidator {} {}",
- pceResult.getResponseCode(), ResponseCodes.RESPONSE_OK);
+ if (ResponseCodes.RESPONSE_OK.equals(pceResult.getResponseCode())) {
+ LOG.info("Path is validated");
+ } else {
+ LOG.warn("Path not validated - cause: {}", pceResult.getLocalCause());
+ }
if (!pceResult.getResponseCode().equals(ResponseCodes.RESPONSE_OK)) {
LOG.warn("In calcPath: post algo validations DROPPED the path {}", path);
case StringConstants.SERVICE_TYPE_OTUC4:
case StringConstants.SERVICE_TYPE_400GE:
case StringConstants.SERVICE_TYPE_OTU4:
- LOG.info(
+ LOG.debug(
"In calcPath Path FOUND path for wl [{}], min Freq assignment {}, max Freq assignment {},"
+ " hops {}, distance per metrics {}, path AtoZ {}",
pceResult.getResultWavelength(), pceResult.getMinFreq(), pceResult.getMaxFreq(),
break;
default:
- LOG.info(
+ LOG.debug(
"In calcPath Path FOUND path for hops {}, distance per metrics {}, path AtoZ {}",
pathAtoZ.size(), path.getWeight(), pathAtoZ);
break;
// KShortestPaths on weightedGraph
KShortestSimplePaths<String, PceGraphEdge> swp =
new KShortestSimplePaths<>(weightedGraph, mhopsPerPath, wpv);
- allWPaths = swp.getPaths(apceNode.getNodeId().getValue(), zpceNode.getNodeId().getValue(), kpathsToBring);
+ List<GraphPath<String, PceGraphEdge>> weightedPathList = swp
+ .getPaths(apceNode.getNodeId().getValue(), zpceNode.getNodeId().getValue(), kpathsToBring);
+ allWPaths = IntStream
+ .range(0, weightedPathList.size())
+ .boxed()
+ .collect(Collectors.toMap(Function.identity(), weightedPathList::get));
if (allWPaths.isEmpty()) {
LOG.info(" In runKgraphs : algorithm didn't find any path");
}
// debug print
- for (GraphPath<String, PceGraphEdge> path : allWPaths) {
- LOG.debug("path Weight: {} : {}", path.getWeight(), path.getVertexList());
- }
-
+ allWPaths
+ .forEach((k, v) -> LOG.info("path n° {} - weight: {} - path: {}", k, v.getWeight(), v.getVertexList()));
return true;
}
return pceResult;
}
if (spectrumAssignment.getFlexGrid()) {
- LOG.info("Spectrum assignment flexgrid mode");
+ LOG.debug("Spectrum assignment flexgrid mode");
pceResult.setResultWavelength(GridConstant.IRRELEVANT_WAVELENGTH_NUMBER);
} else {
- LOG.info("Spectrum assignment fixedgrid mode");
+ LOG.debug("Spectrum assignment fixedgrid mode");
pceResult.setResultWavelength(
GridUtils.getWaveLengthIndexFromSpectrumAssigment(spectrumAssignment.getBeginIndex()
.toJava()));
}
pceResult.setMinFreq(GridUtils.getStartFrequencyFromIndex(spectrumAssignment.getBeginIndex().toJava()));
pceResult.setMaxFreq(GridUtils.getStopFrequencyFromIndex(spectrumAssignment.getStopIndex().toJava()));
- LOG.info("In PostAlgoPathValidator: spectrum assignment found {} {}", spectrumAssignment, path);
+ LOG.debug("In PostAlgoPathValidator: spectrum assignment found {} {}", spectrumAssignment, path);
// Check the OSNR
if (!checkOSNR(path)) {
// Check the inclusion if it is defined in the hard constraints
private boolean checkInclude(GraphPath<String, PceGraphEdge> path, PceConstraints pceHardConstraintsInput) {
- List<ResourcePair> listToInclude = pceHardConstraintsInput.getListToInclude();
+ List<ResourcePair> listToInclude = pceHardConstraintsInput.getListToInclude()
+ .stream().sorted((rp1, rp2) -> rp1.getName().compareTo(rp2.getName()))
+ .collect(Collectors.toList());
if (listToInclude.isEmpty()) {
return true;
}
private Map<String, Uint16> chooseTribPort(GraphPath<String,
PceGraphEdge> path, Map<NodeId, PceNode> allPceNodes, Map<String, List<Uint16>> tribSlotMap, int nbSlot) {
- LOG.info("In choosetribPort: edgeList = {} ", path.getEdgeList());
+ LOG.debug("In choosetribPort: edgeList = {} ", path.getEdgeList());
Map<String, Uint16> tribPortMap = new HashMap<>();
for (PceGraphEdge edge : path.getEdgeList()) {
private Map<String, List<Uint16>> chooseTribSlot(GraphPath<String,
PceGraphEdge> path, Map<NodeId, PceNode> allPceNodes, int nbSlot) {
- LOG.info("In choosetribSlot: edgeList = {} ", path.getEdgeList());
+ LOG.debug("In choosetribSlot: edgeList = {} ", path.getEdgeList());
Map<String, List<Uint16>> tribSlotMap = new HashMap<>();
for (PceGraphEdge edge : path.getEdgeList()) {
Arrays.fill(freqMap, (byte) GridConstant.AVAILABLE_SLOT_VALUE);
BitSet result = BitSet.valueOf(freqMap);
boolean isFlexGrid = true;
- LOG.info("Processing path {} with length {}", path, path.getLength());
+ LOG.debug("Processing path {} with length {}", path, path.getLength());
BitSet pceNodeFreqMap;
for (PceGraphEdge edge : path.getEdgeList()) {
- LOG.info("Processing source {} ", edge.link().getSourceId());
+ LOG.debug("Processing source {} ", edge.link().getSourceId());
if (allPceNodes.containsKey(edge.link().getSourceId())) {
PceNode pceNode = allPceNodes.get(edge.link().getSourceId());
- LOG.info("Processing PCE node {}", pceNode);
+ LOG.debug("Processing PCE node {}", pceNode);
if (StringConstants.OPENROADM_DEVICE_VERSION_1_2_1.equals(pceNode.getVersion())) {
- LOG.info("Node {}: version is {} and slot width granularity is {} -> fixed grid mode",
+ LOG.debug("Node {}: version is {} and slot width granularity is {} -> fixed grid mode",
pceNode.getNodeId(), pceNode.getVersion(), pceNode.getSlotWidthGranularity());
isFlexGrid = false;
}
public ListenableFuture<RpcResult<PathComputationRequestOutput>>
pathComputationRequest(PathComputationRequestInput input) {
LOG.info("RPC path computation request received");
+ LOG.debug("input parameters are : input = {}", input.toString());
PathComputationRequestOutput output = null;
try {
output = this.pathComputationService.pathComputationRequest(input).get();
public void retrievePceNetwork() {
- LOG.info("In PceCalculation retrieveNetwork: ");
+ LOG.debug("In PceCalculation retrieveNetwork");
if (!readMdSal()) {
returnStructure.setRC(ResponseCodes.RESPONSE_FAILED);
input.getServiceAEnd().getTxDirection().getPort().getPortName())
: null);
- LOG.info("parseInput: A and Z :[{}] and [{}]", anodeId, znodeId);
+ LOG.debug("parseInput: A and Z :[{}] and [{}]", anodeId, znodeId);
getAZnodeId();
case StringConstants.SERVICE_TYPE_OTUC2:
case StringConstants.SERVICE_TYPE_OTUC3:
case StringConstants.SERVICE_TYPE_OTUC4:
- LOG.info("readMdSal: network {}", NetworkUtils.OVERLAY_NETWORK_ID);
+ LOG.debug("readMdSal: network {}", NetworkUtils.OVERLAY_NETWORK_ID);
nwInstanceIdentifier = InstanceIdentifier.builder(Networks.class)
.child(Network.class, new NetworkKey(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID))).build();
break;
case StringConstants.SERVICE_TYPE_ODUC4:
case StringConstants.SERVICE_TYPE_10GE:
case StringConstants.SERVICE_TYPE_1GE:
- LOG.info("readMdSal: network {}", NetworkUtils.OTN_NETWORK_ID);
+ LOG.debug("readMdSal: network {}", NetworkUtils.OTN_NETWORK_ID);
nwInstanceIdentifier = InstanceIdentifier.builder(Networks.class)
.child(Network.class, new NetworkKey(new NetworkId(NetworkUtils.OTN_NETWORK_ID))).build();
break;
}
private boolean validateLink(Link link) {
- LOG.info("validateLink: link {} ", link);
+ LOG.debug("validateLink: link {} ", link);
NodeId sourceId = link.getSource().getSourceNode();
NodeId destId = link.getDestination().getDestNode();
}
private void validateNode(Node node) {
- LOG.info("validateNode: node {} ", node);
+ LOG.debug("validateNode: node {} ", node);
// PceNode will be used in Graph algorithm
Node1 node1 = node.augmentation(Node1.class);
if (node1 == null) {
deviceNodeId = node.getNodeId().getValue();
}
- LOG.info("Device node id {} for {}", deviceNodeId, node);
+ LOG.debug("Device node id {} for {}", deviceNodeId, node);
PceOpticalNode pceNode = new PceOpticalNode(deviceNodeId, this.serviceType, portMapping, node, nodeType,
mappingUtils.getOpenRoadmVersion(deviceNodeId), getSlotWidthGranularity(deviceNodeId, node.getNodeId()),
getCentralFreqGranularity(deviceNodeId, node.getNodeId()));
pceNode.initFrequenciesBitSet();
if (!pceNode.isValid()) {
- LOG.warn(" validateNode: Node is ignored");
+ LOG.debug(" validateNode: Node {} is ignored", node.getNodeId().getValue());
return;
}
if (validateNodeConstraints(pceNode).equals(ConstraintTypes.HARD_EXCLUDE)) {
return ConstraintTypes.NONE;
}
if (pceHardConstraints.getExcludeSupNodes().contains(pcenode.getSupNetworkNodeId())) {
- LOG.info("validateNodeConstraints: {}", pcenode.getNodeId().getValue());
+ LOG.debug("validateNodeConstraints: {}", pcenode.getNodeId().getValue());
return ConstraintTypes.HARD_EXCLUDE;
}
if (pceHardConstraints.getExcludeCLLI().contains(pcenode.getSupClliNodeId())) {
- LOG.info("validateNodeConstraints: {}", pcenode.getNodeId().getValue());
+ LOG.debug("validateNodeConstraints: {}", pcenode.getNodeId().getValue());
return ConstraintTypes.HARD_EXCLUDE;
}
return ConstraintTypes.NONE;
List<Long> constraints = new ArrayList<>(pceHardConstraints.getExcludeSRLG());
constraints.retainAll(link.getsrlgList());
if (!constraints.isEmpty()) {
- LOG.info("validateLinkConstraints: {}", link.getLinkId().getValue());
+ LOG.debug("validateLinkConstraints: {}", link.getLinkId().getValue());
return ConstraintTypes.HARD_EXCLUDE;
}
pceNode.initXndrTps(input.getServiceAEnd().getServiceFormat());
break;
default:
- LOG.warn("endPceNode: Node {} is not SRG or XPONDER !", nodeId);
+ LOG.debug("endPceNode: Node {} is not SRG or XPONDER !", nodeId);
return false;
}
}
allPceLinks.put(linkId, pceOtnLink);
source.addOutgoingLink(pceOtnLink);
- LOG.info("validateLink: OTN-LINK added to allPceLinks {}", pceOtnLink);
+ LOG.debug("validateLink: OTN-LINK added to allPceLinks {}", pceOtnLink);
break;
default:
LOG.warn("validateLink: link type is not supported {}", pceOtnLink);
private static void printNodesInfo(Map<NodeId, PceNode> allPceNodes) {
allPceNodes.forEach(((nodeId, pceNode) -> {
- LOG.info("In printNodes in node {} : outgoing links {} ", pceNode.getNodeId().getValue(),
+ LOG.debug("In printNodes in node {} : outgoing links {} ", pceNode.getNodeId().getValue(),
pceNode.getOutgoingLinks());
}));
}
private static final double LOWER_BOUND_OSNR = 0.1;
public PceLink(Link link, PceNode source, PceNode dest) {
- LOG.info("PceLink: : PceLink start ");
+ LOG.debug("PceLink: : PceLink start ");
this.linkId = link.getLinkId();
return 1L;
}
tmp += entry.getValue().getSRLGLength().doubleValue() / CELERITY;
- LOG.info("In PceLink: The latency of link {} == {}", link.getLinkId(), tmp);
+ LOG.debug("In PceLink: The latency of link {} == {}", link.getLinkId(), tmp);
}
return (long) Math.ceil(tmp);
}
if ((this.availableBandwidth >= neededBW)
&& ((neededType == null) || (neededType.equals(otnLinkType)))) {
- LOG.info("PceLink: Selected Link {} has available bandwidth and is eligible for {} creation ",
+ LOG.debug("PceLink: Selected Link {} has available bandwidth and is eligible for {} creation ",
linkId, serviceType);
}
if (!isValid()) {
return;
}
- LOG.info("initSrgTpList: getting SRG tps from ROADM node {}", this.nodeId);
+ LOG.debug("initSrgTpList: getting SRG tps from ROADM node {}", this.nodeId);
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1 nodeTp =
this.node.augmentation(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
.ietf.network.topology.rev180226.Node1.class);
.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev211210
.TerminationPoint1.class);
OpenroadmTpType type = cntp1.getTpType();
- LOG.info("type = {} for tp {}", type.getName(), tp);
+ LOG.debug("type = {} for tp {}", type.getName(), tp);
switch (type) {
case SRGTXRXCP:
case SRGRXCP:
case SRGTXCP:
if (State.InService.equals(cntp1.getOperationalState())) {
- LOG.info("initSrgTpList: adding SRG-CP tp = {} ", tp.getTpId().getValue());
+ LOG.debug("initSrgTpList: adding SRG-CP tp = {} ", tp.getTpId().getValue());
this.availableSrgCp.put(tp.getTpId().getValue(), cntp1.getTpType());
}
break;
case SRGRXPP:
case SRGTXPP:
case SRGTXRXPP:
- LOG.info("initSrgTpList: SRG-PP tp = {} found", tp.getTpId().getValue());
+ LOG.debug("initSrgTpList: SRG-PP tp = {} found", tp.getTpId().getValue());
if (isTerminationPointAvailable(nttp1)) {
- LOG.info("initSrgTpList: adding SRG-PP tp '{}'", tp.getTpId().getValue());
+ LOG.debug("initSrgTpList: adding SRG-PP tp '{}'", tp.getTpId().getValue());
this.availableSrgPp.put(tp.getTpId().getValue(), cntp1.getTpType());
if (State.InService.equals(cntp1.getOperationalState())) {
- LOG.info("initSrgTpList: adding SRG-PP tp '{}'", tp.getTpId().getValue());
+ LOG.debug("initSrgTpList: adding SRG-PP tp '{}'", tp.getTpId().getValue());
this.availableSrgPp.put(tp.getTpId().getValue(), cntp1.getTpType());
}
} else {
this.valid = false;
return;
}
- LOG.info("initSrgTpList: availableSrgPp size = {} && availableSrgCp size = {} in {}",
+ LOG.debug("initSrgTpList: availableSrgPp size = {} && availableSrgCp size = {} in {}",
this.availableSrgPp.size(), this.availableSrgCp.size(), this);
}
}
public void initXndrTps(ServiceFormat serviceFormat) {
- LOG.info("PceNod: initXndrTps for node : {}", this.nodeId);
+ LOG.debug("PceNod: initXndrTps for node : {}", this.nodeId);
if (!isValid()) {
return;
}
.node.TerminationPoint tp : allTps) {
TerminationPoint1 cntp1 = tp.augmentation(TerminationPoint1.class);
if (cntp1.getTpType() != OpenroadmTpType.XPONDERNETWORK) {
- LOG.warn("initXndrTps: {} is not an Xponder network port", cntp1.getTpType().getName());
+ LOG.debug("initXndrTps: {} is not an Xponder network port", cntp1.getTpType().getName());
continue;
}
if (!isTpWithGoodCapabilities(tp)) {
.TerminationPoint1.class);
if (nttp1 != null && nttp1.getXpdrNetworkAttributes().getWavelength() != null) {
this.usedXpndrNWTps.add(tp.getTpId().getValue());
- LOG.info("initXndrTps: XPONDER tp = {} is used", tp.getTpId().getValue());
+ LOG.debug("initXndrTps: XPONDER tp = {} is used", tp.getTpId().getValue());
} else {
this.valid = true;
}
@Override
public String getRdmSrgClient(String tp, String direction) {
- LOG.info("getRdmSrgClient: Getting PP client for tp '{}' on node : {}", tp, this.nodeId);
+ LOG.debug("getRdmSrgClient: Getting PP client for tp '{}' on node : {}", tp, this.nodeId);
OpenroadmTpType srgType = null;
OpenroadmTpType cpType = this.availableSrgCp.get(tp);
if (cpType == null) {
}
switch (cpType) {
case SRGTXRXCP:
- LOG.info("getRdmSrgClient: Getting BI Directional PP port ...");
+ LOG.debug("getRdmSrgClient: Getting BI Directional PP port ...");
// Take the first-element in the available PP key set
if (availableSrgPp.entrySet().iterator().next().getKey()
// and check if the port is bidirectional
}
break;
case SRGTXCP:
- LOG.info("getRdmSrgClient: Getting UNI Rx PP port ...");
+ LOG.debug("getRdmSrgClient: Getting UNI Rx PP port ...");
srgType = OpenroadmTpType.SRGRXPP;
break;
case SRGRXCP:
- LOG.info("getRdmSrgClient: Getting UNI Tx PP port ...");
+ LOG.debug("getRdmSrgClient: Getting UNI Tx PP port ...");
srgType = OpenroadmTpType.SRGTXPP;
break;
default:
break;
}
- LOG.info("getRdmSrgClient: Getting client PP for CP '{}'", tp);
+ LOG.debug("getRdmSrgClient: Getting client PP for CP '{}'", tp);
if (!this.availableSrgPp.isEmpty()) {
Optional<String> client = null;
final OpenroadmTpType openType = srgType;
LOG.error("getRdmSrgClient: ROADM {} doesn't have PP Client for CP {}", this, tp);
return null;
}
- LOG.info("getRdmSrgClient: client PP {} for CP {} found !", client, tp);
+ LOG.debug("getRdmSrgClient: client PP {} for CP {} found !", client, tp);
return client.get();
} else {
LOG.error("getRdmSrgClient: SRG TerminationPoint PP list is not available for node {}", this);
}
public void initXndrTps(String mode) {
- LOG.info("PceOtnNode: initXndrTps for node {}", this.nodeId.getValue());
+ LOG.debug("PceOtnNode: initXndrTps for node {}", this.nodeId.getValue());
this.availableXponderTp.clear();
this.modeType = mode;
List<TerminationPoint> allTps =
case XPONDERNETWORK:
String notCreatedServiceType = xpdrNetTpCreation(ontTp1);
if (notCreatedServiceType == null) {
- LOG.info("TP {} of XPONDER {} is validated",
+ LOG.debug("TP {} of XPONDER {} is validated",
tp.getTpId().getValue(),
node.getNodeId().getValue());
this.availableXpdrNWTps.add(tp.getTpId());
continue;
}
if (checkClientTp(ontTp1)) {
- LOG.info("TP {} of XPONDER {} is validated",
+ LOG.debug("TP {} of XPONDER {} is validated",
tp.getTpId(),
node.getNodeId().getValue());
this.availableXpdrClientTps.add(tp.getTpId());
private boolean checkTpForOdtuTermination(TerminationPoint1 ontTp1) {
for (SupportedInterfaceCapability sic :
ontTp1.getTpSupportedInterfaces().getSupportedInterfaceCapability().values()) {
- LOG.info("in checkTpForOduTermination - sic = {}", sic.getIfCapType());
+ LOG.debug("in checkTpForOduTermination - sic = {}", sic.getIfCapType());
if ((sic.getIfCapType().equals(IfOCHOTU4ODU4.class)
|| sic.getIfCapType().equals(IfOtsiOtsigroup.class))
&& (ontTp1.getXpdrTpPortConnectionAttributes() == null
} else if (OpenroadmNodeType.SWITCH.equals(this.nodeType)) {
initXndrTps(INTERMEDIATE_MODETYPE);
} else {
- LOG.info("validateAZxponder: XPONDER is ignored == {}", nodeId.getValue());
+ LOG.warn("validateAZxponder: XPONDER is ignored == {}", nodeId.getValue());
valid = false;
}
}
// Validate switch for use as an intermediate XPONDER on the path
initXndrTps(INTERMEDIATE_MODETYPE);
if (this.valid) {
- LOG.info("validateIntermediateSwitch: Switch usable for transit == {}", nodeId.getValue());
+ LOG.debug("validateIntermediateSwitch: Switch usable for transit == {}", nodeId.getValue());
} else {
LOG.debug("validateIntermediateSwitch: Switch unusable for transit == {}", nodeId.getValue());
}
@Override
public ListenableFuture<PathComputationRequestOutput> pathComputationRequest(PathComputationRequestInput input) {
- LOG.info("pathComputationRequest");
+ LOG.debug("input parameters are : input = {}", input.toString());
return executor.submit(new Callable<PathComputationRequestOutput>() {
@Override