- public String getRdmSrgClient(String tp, Boolean aend) {
- LOG.info("getRdmSrgClient: Getting PP client for tp '{}' on node : {}", tp, this.nodeId);
- OpenroadmTpType srgType = null;
- OpenroadmTpType cpType = this.availableSrgCp.get(tp);
- if (cpType == null) {
- LOG.error("getRdmSrgClient: tp {} not existed in SRG CPterminationPoint list");
- return null;
- }
- switch (cpType) {
- case SRGTXRXCP:
- LOG.info("getRdmSrgClient: Getting BI Directional PP port ...");
- srgType = OpenroadmTpType.SRGTXRXPP;
- break;
- case SRGTXCP:
- LOG.info("getRdmSrgClient: Getting UNI Rx PP port ...");
- srgType = OpenroadmTpType.SRGRXPP;
- break;
- case SRGRXCP:
- LOG.info("getRdmSrgClient: Getting UNI Tx PP port ...");
- srgType = OpenroadmTpType.SRGTXPP;
- break;
- default:
- break;
- }
- LOG.info("getRdmSrgClient: Getting client PP for CP '{}'", tp);
- if (!this.availableSrgPp.isEmpty()) {
- Optional<String> client = null;
- final OpenroadmTpType openType = srgType;
- client = this.availableSrgPp.entrySet()
- .stream().filter(pp -> pp.getValue().getName().equals(openType.getName()))
- .map(Map.Entry::getKey)
- .sorted(new SortPortsByName())
- .findFirst();
- if (!client.isPresent()) {
- LOG.error("getRdmSrgClient: ROADM {} doesn't have PP Client for CP {}", this.toString(), tp);
- return null;
- }
- LOG.info("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.toString());
- return null;
- }
- }
-
- private String getSupNodeId(Node inputNode) {
- // TODO: supporting IDs exist as a List. this code takes just the
- // first element
- if (MapUtils.getSupNode(inputNode) != null) {
- return MapUtils.getSupNode(inputNode);
- } else {
- LOG.error("getSupNodeId: Empty Supporting node for node: [{}]. Node is ignored", inputNode.getNodeId());
- return "";
- }
- }
-
- private String getClliSupNodeId(Node inputNode) {
- TreeMap<String, String> allSupNodes = new TreeMap<String, String>();
- String tempNetworkSupNodeId = "";
- allSupNodes = MapUtils.getAllSupNode(inputNode);
- if (allSupNodes.get(NetworkUtils.CLLI_NETWORK_ID) == null) {
- LOG.error("getClliSupNodeId: No Supporting node at CLLI layer for node: [{}].", inputNode.getNodeId());
- } else {
- tempNetworkSupNodeId = allSupNodes.get(NetworkUtils.CLLI_NETWORK_ID);
- }
- return tempNetworkSupNodeId;
- }
-
- public String getClliSupNodeId() {
- return clli;
- }
-
- private String getNetworkSupNodeId(Node inputNode) {
- TreeMap<String, String> allSupNodes = new TreeMap<String, String>();
- String tempNetworkSupNodeId = "";
- allSupNodes = MapUtils.getAllSupNode(inputNode);
- if (allSupNodes.get(NetworkUtils.UNDERLAY_NETWORK_ID) == null) {
- LOG.error(
- "getNetworkSupNodeId: No Supporting node at NETWORK layer for node: [{}].", inputNode.getNodeId());
- } else {
- tempNetworkSupNodeId = allSupNodes.get(NetworkUtils.UNDERLAY_NETWORK_ID);
- }
- return tempNetworkSupNodeId;
- }
-
-
- public void validateAZxponder(String anodeId, String znodeId) {
- if (!isValid()) {
- return;
- }
- if (this.nodeType != OpenroadmNodeType.XPONDER) {
- return;
- }
- // Detect A and Z
- if (this.supNetworkNodeId.equals(anodeId) || (this.supNetworkNodeId.equals(znodeId))) {
- LOG.info("validateAZxponder: A or Z node detected == {}", nodeId.getValue());
- initXndrTps();
- return;
- }
- LOG.debug("validateAZxponder: XPONDER is ignored == {}", nodeId.getValue());
- valid = false;
- }
-
- public String getXpdrClient(String tp) {
- return this.clientPerNwTp.get(tp);
- }
-
- public boolean checkTP(String tp) {
- return !(this.usedXpndrNWTps.contains(tp));
- }
-
- public boolean checkWL(long index) {
- return (this.availableWLindex.contains(index));
- }
-
- public boolean isValid() {
- if ((node == null) || (nodeId == null) || (nodeType == null) || (supNetworkNodeId == null) || (clli == null)) {
- LOG.error("PceNode: one of parameters is not populated : nodeId, node type, supporting nodeId");
- valid = false;
- }
- return valid;
- }
-
- public List<Long> getAvailableWLs() {
- return availableWLindex;
- }
-
- public void addOutgoingLink(PceLink outLink) {
- this.outgoingLinks.add(outLink);
- }
-
- public List<PceLink> getOutgoingLinks() {
- return outgoingLinks;
- }
-
- public String getClient(String tp) {
- return clientPerNwTp.get(tp);
- }
-
- public NodeId getNodeId() {
- return nodeId;
- }
-
- public String getSupNodeIdPceNode() {
- return supNodeId;
- }
-
- public String getSupNetworkNodeIdPceNode() {
- return supNetworkNodeId;
- }
-
- public String getCLLI() {
- return clli;
- }
-
- public String toString() {
- return "PceNode type=" + nodeType + " ID=" + nodeId.getValue() + " CLLI=" + clli;
- }
-
- public void printLinksOfNode() {
- LOG.info(" outgoing links of node {} : {} ", nodeId.getValue(), this.getOutgoingLinks().toString());
- }
-
- public Map<String,List<Integer>> getAvailableTribPorts() {
- return tpAvailableTribPort;
- }
-
- public Map<String,List<Integer>> getAvailableTribSlots() {
- return tpAvailableTribSlot;
- }