+ private static void populateTreeMap(Map<Integer, NodeIdPair> treeMap, Resource rsrc, String sortId,
+ String direction) {
+ String resourceType = rsrc.implementedInterface().getSimpleName();
+ LOG.info("Inside {} {}", direction, resourceType);
+ switch (resourceType) {
+ case TERMINATION_POINT:
+ TerminationPoint tp = (TerminationPoint) rsrc;
+ LOG.info(" TP is {} {}", tp.getTpId(), tp.getTpNodeId());
+ String tpID = tp.getTpId();
+
+ //TODO: do not rely on ID to be in certain format
+ if (tpID.contains("CTP") || tpID.contains("CP")) {
+ return;
+ }
+ String nodeID = "";
+ if (tpID.contains(StringConstants.TTP_TOKEN)) {
+ nodeID = tp.getTpNodeId().split("-DEG")[0];
+ } else if (tpID.contains(StringConstants.PP_TOKEN)) {
+ nodeID = tp.getTpNodeId().split("-SRG")[0];
+ } else if (tpID.contains(StringConstants.NETWORK_TOKEN)
+ || tpID.contains(StringConstants.CLIENT_TOKEN) || tpID.isEmpty()) {
+ nodeID = tp.getTpNodeId().split("-XPDR")[0];
+ } else {
+ return;
+ }
+ int id = Integer.parseInt(sortId);
+ treeMap.put(id, new NodeIdPair(nodeID, tpID));
+ return;
+ case LINK:
+ LOG.info("The type is link");
+ return;
+ default:
+ LOG.info("The type is not identified: {}", resourceType);
+ return;
+ }
+ }
+