+ public void initRdmSrgTps() {
+ LOG.info("initRdmSrgTps for node : {}", this.nodeId);
+ initSrgPpList();
+ if (!isValid()) {
+ return;
+ }
+ LOG.info("initRdmSrgTps: getting terminationPoint list for node {}", this.toString());
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev150608.Node1 nodeTp =
+ this.node.augmentation(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology
+ .rev150608.Node1.class);
+ List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev150608.network.node
+ .TerminationPoint> allTps = nodeTp.getTerminationPoint();
+ if (allTps == null) {
+ this.valid = false;
+ LOG.error("initRdmSrgTps: SRG TerminationPoint list is empty for node {}", this.toString());
+ return;
+ }
+ this.valid = false;
+ for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev150608.network.node
+ .TerminationPoint tp : allTps) {
+ TerminationPoint1 tp1 = tp.augmentation(TerminationPoint1.class);
+ if (tp1.getTpType() == OpenroadmTpType.SRGTXRXCP) {
+ try {
+ List<UsedWavelengths> usedWavelengths = tp1.getCpAttributes().getUsedWavelengths();
+ if (!usedWavelengths.isEmpty()) {
+ this.usedRdmCpTps.add(tp.getTpId().getValue());
+ LOG.warn("initRdmSrgTps: SRG-CP tp = {} is used", tp.getTpId().getValue());
+ } else {
+ LOG.info("initRdmSrgTps: SRG-CP tp = {} found", tp.getTpId().getValue());
+ this.valid = true;
+ }
+ } catch (NullPointerException e) {
+ LOG.warn("'usedWavelengths' for tp={} is null !", tp.getTpId().getValue());
+ this.valid = true;
+ }
+ }
+ if (tp1.getTpType() == OpenroadmTpType.SRGTXRXCP) {
+ // Find an available PP of this CP
+ if (!this.availableSrgPp.isEmpty()) {
+ LOG.info("finding PP for CP {}", tp.getTpId().getValue());
+ Iterator<String> iterator = this.availableSrgPp.iterator();
+ while (iterator.hasNext()) {
+ String client = iterator.next();
+ if ((client.equals("")) || (client == null)) {
+ LOG.error("initRdmSrgTps: ROADM {} doesn't have defined Client {}", this.toString(), tp
+ .getTpId().getValue());
+ this.valid = false;
+ } else {
+ this.valid = true;
+ this.clientPerPpTp.put(tp.getTpId().getValue(), client);
+ LOG.info("initRdmSrgTps: client PP {} for CP {} found !", client, tp.getTpId().getValue());
+ iterator.remove();
+ break;
+ }
+ }
+ } else {
+ LOG.error("initRdmSrgTps: ROADM {} doesn't have available PP", this.nodeId.getValue());
+ this.valid = false;
+ return;
+ }
+ }
+ }
+ if (!isValid()) {
+ LOG.error("initRdmSrgTps: SRG doesn't have available wavelengths for node {}", this.toString());
+ return;
+ }
+ }