import java.util.Map;
import java.util.Set;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev210528.NodeIdType;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.common.constraints.LinkIdentifier;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.common.constraints.LinkIdentifierKey;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.CoRouting;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.CoRoutingBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.Distance;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.DistanceBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.Diversity;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.DiversityBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.Exclude;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.ExcludeBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.HopCount;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.HopCountBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.Include;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.IncludeBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.Latency;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.LatencyBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.TEMetric;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.TEMetricBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.co.routing.ServiceIdentifierList;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.co.routing.ServiceIdentifierListKey;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.HardConstraints;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.HardConstraintsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.SoftConstraints;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.SoftConstraintsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.common.constraints.LinkIdentifier;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.CoRouting;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.CoRoutingBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.Distance;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.DistanceBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.Diversity;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.DiversityBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.Exclude;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.ExcludeBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.HopCount;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.HopCountBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.Include;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.IncludeBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.Latency;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.LatencyBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.TEMetric;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.TEMetricBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.co.routing.ServiceIdentifierList;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.constraints.co.routing.ServiceIdentifierListKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.routing.constraints.HardConstraints;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.routing.constraints.HardConstraintsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.routing.constraints.SoftConstraints;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.routing.constraints.SoftConstraintsBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
-import org.opendaylight.yangtools.yang.common.Uint8;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
SoftConstraintsBuilder softConstraintsBuilder = new SoftConstraintsBuilder(softConstraints);
if (hardConstraints.getCustomerCode() != null && !hardConstraints.getCustomerCode().isEmpty()) {
if (softConstraintsBuilder.getCustomerCode() == null
- || softConstraintsBuilder.getCustomerCode().isEmpty()) {
+ || softConstraintsBuilder.getCustomerCode().isEmpty()) {
softConstraintsBuilder.setCustomerCode(hardConstraints.getCustomerCode());
} else {
- List<String> updatedCustomerCode = new ArrayList<>(softConstraintsBuilder.getCustomerCode());
+ Set<String> updatedCustomerCode = new HashSet<>(softConstraintsBuilder.getCustomerCode());
updatedCustomerCode.addAll(hardConstraints.getCustomerCode());
softConstraintsBuilder.setCustomerCode(updatedCustomerCode);
}
}
if (hardConstraints.getOperationalMode() != null && !hardConstraints.getOperationalMode().isEmpty()) {
if (softConstraintsBuilder.getOperationalMode() == null
- || softConstraintsBuilder.getOperationalMode().isEmpty()) {
+ || softConstraintsBuilder.getOperationalMode().isEmpty()) {
softConstraintsBuilder.setOperationalMode(hardConstraints.getOperationalMode());
} else {
- List<String> updatedOperationalMode = new ArrayList<>(softConstraintsBuilder.getOperationalMode());
+ Set<String> updatedOperationalMode = new HashSet<>(softConstraintsBuilder.getOperationalMode());
updatedOperationalMode.addAll(hardConstraints.getOperationalMode());
softConstraintsBuilder.setOperationalMode(updatedOperationalMode);
}
if (includeBldr.getNodeId() == null) {
includeBldr.setNodeId(hard.getNodeId());
} else {
- Set<NodeIdType> nodeIdList = new HashSet<>(includeBldr.getNodeId());
+ List<NodeIdType> nodeIdList = new ArrayList<>(includeBldr.getNodeId());
nodeIdList.addAll(hard.getNodeId());
includeBldr.setNodeId(new ArrayList<>(nodeIdList));
}
if (includeBldr.getSite() == null) {
includeBldr.setSite(hard.getSite());
} else {
- Set<String> siteList = new HashSet<>(includeBldr.getSite());
+ List<String> siteList = new ArrayList<>(includeBldr.getSite());
siteList.addAll(hard.getSite());
includeBldr.setSite(new ArrayList<>(siteList));
}
if (includeBldr.getSrlgId() == null) {
includeBldr.setSrlgId(hard.getSrlgId());
} else {
- Set<Uint32> srlgList = new HashSet<>(includeBldr.getSrlgId());
+ List<Uint32> srlgList = new ArrayList<>(includeBldr.getSrlgId());
srlgList.addAll(hard.getSrlgId());
includeBldr.setSrlgId(new ArrayList<>(srlgList));
}
if (includeBldr.getSupportingServiceName() == null) {
includeBldr.setSupportingServiceName(hard.getSupportingServiceName());
} else {
- Set<String> serviceList = new HashSet<>(includeBldr.getSupportingServiceName());
+ List<String> serviceList = new ArrayList<>(includeBldr.getSupportingServiceName());
serviceList.addAll(hard.getSupportingServiceName());
includeBldr.setSupportingServiceName(new ArrayList<>(serviceList));
}
if (includeBldr.getLinkIdentifier() == null) {
includeBldr.setLinkIdentifier(hard.getLinkIdentifier());
} else {
- Map<LinkIdentifierKey, LinkIdentifier> linkList = new HashMap<>(includeBldr.getLinkIdentifier());
- linkList.putAll(hard.getLinkIdentifier());
+ List<LinkIdentifier> linkList = new ArrayList<>(includeBldr.getLinkIdentifier());
+ linkList.addAll(hard.getLinkIdentifier());
includeBldr.setLinkIdentifier(linkList);
}
}
if (excludeBldr.getNodeId() == null) {
excludeBldr.setNodeId(hard.getNodeId());
} else {
- Set<NodeIdType> nodeIdList = new HashSet<>(excludeBldr.getNodeId());
+ List<NodeIdType> nodeIdList = new ArrayList<>(excludeBldr.getNodeId());
nodeIdList.addAll(hard.getNodeId());
excludeBldr.setNodeId(new ArrayList<>(nodeIdList));
}
if (excludeBldr.getSite() == null) {
excludeBldr.setSite(hard.getSite());
} else {
- Set<String> siteList = new HashSet<>(excludeBldr.getSite());
+ List<String> siteList = new ArrayList<>(excludeBldr.getSite());
siteList.addAll(hard.getSite());
excludeBldr.setSite(new ArrayList<>(siteList));
}
if (excludeBldr.getSrlgId() == null) {
excludeBldr.setSrlgId(hard.getSrlgId());
} else {
- Set<Uint32> srlgList = new HashSet<>(excludeBldr.getSrlgId());
+ List<Uint32> srlgList = new ArrayList<>(excludeBldr.getSrlgId());
srlgList.addAll(hard.getSrlgId());
excludeBldr.setSrlgId(new ArrayList<>(srlgList));
}
if (excludeBldr.getSupportingServiceName() == null) {
excludeBldr.setSupportingServiceName(hard.getSupportingServiceName());
} else {
- Set<String> serviceList = new HashSet<>(excludeBldr.getSupportingServiceName());
+ List<String> serviceList = new ArrayList<>(excludeBldr.getSupportingServiceName());
serviceList.addAll(hard.getSupportingServiceName());
excludeBldr.setSupportingServiceName(new ArrayList<>(serviceList));
}
if (excludeBldr.getLinkIdentifier() == null) {
excludeBldr.setLinkIdentifier(hard.getLinkIdentifier());
} else {
- Map<LinkIdentifierKey, LinkIdentifier> linkList = new HashMap<>(excludeBldr.getLinkIdentifier());
- linkList.putAll(hard.getLinkIdentifier());
+ List<LinkIdentifier> linkList = new ArrayList<>(excludeBldr.getLinkIdentifier());
+ linkList.addAll(hard.getLinkIdentifier());
excludeBldr.setLinkIdentifier(linkList);
}
}
DiversityBuilder diversityBldr = soft == null ? new DiversityBuilder() : new DiversityBuilder(soft);
Map<
- org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.diversity.existing.service
+ org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.diversity.existing.service
.constraints.ServiceIdentifierListKey,
- org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.diversity.existing.service
+ org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.diversity.existing.service
.constraints.ServiceIdentifierList> sil =
diversityBldr.getServiceIdentifierList() == null
? new HashMap<>()
: new HashMap<>(diversityBldr.getServiceIdentifierList());
- if (!hard.getServiceIdentifierList().isEmpty()) {
+ if (!hard.nonnullServiceIdentifierList().isEmpty()) {
sil.putAll(hard.getServiceIdentifierList());
diversityBldr.setServiceIdentifierList(sil);
}
if (soft == null) {
return new HopCountBuilder(hard).build();
}
- String maxWdmHc = null;
- if (soft.getMaxWdmHopCount() != null && hard.getMaxWdmHopCount() != null) {
- maxWdmHc = soft.getMaxWdmHopCount().intValue() <= hard.getMaxWdmHopCount().intValue()
- ? soft.getMaxWdmHopCount().toString()
- : hard.getMaxWdmHopCount().toString();
- } else if (hard.getMaxWdmHopCount() != null) {
- maxWdmHc = hard.getMaxWdmHopCount().toString();
- } else if (soft.getMaxWdmHopCount() != null) {
- maxWdmHc = soft.getMaxWdmHopCount().toString();
- }
- String maxOtnHc = null;
- if (soft.getMaxOtnHopCount() != null && hard.getMaxOtnHopCount() != null) {
- maxOtnHc = soft.getMaxOtnHopCount().intValue() <= hard.getMaxOtnHopCount().intValue()
- ? soft.getMaxOtnHopCount().toString()
- : hard.getMaxOtnHopCount().toString();
- } else if (hard.getMaxOtnHopCount() != null) {
- maxOtnHc = hard.getMaxOtnHopCount().toString();
- } else if (soft.getMaxOtnHopCount() != null) {
- maxOtnHc = soft.getMaxOtnHopCount().toString();
- }
HopCountBuilder hcBldr = new HopCountBuilder();
- if (maxWdmHc != null) {
- hcBldr.setMaxWdmHopCount(Uint8.valueOf(maxWdmHc));
- }
- if (maxOtnHc != null) {
- hcBldr.setMaxWdmHopCount(Uint8.valueOf(maxOtnHc));
+ if (soft.getMaxWdmHopCount() == null) {
+ if (hard.getMaxWdmHopCount() != null) {
+ hcBldr.setMaxWdmHopCount(hard.getMaxWdmHopCount());
+ }
+ } else {
+ hcBldr.setMaxWdmHopCount(
+ hard.getMaxWdmHopCount() == null
+ || soft.getMaxWdmHopCount().intValue() <= hard.getMaxWdmHopCount().intValue()
+ ? soft.getMaxWdmHopCount()
+ : hard.getMaxWdmHopCount());
+ }
+ if (soft.getMaxOtnHopCount() == null) {
+ if (hard.getMaxOtnHopCount() != null) {
+ hcBldr.setMaxOtnHopCount(hard.getMaxOtnHopCount());
+ }
+ } else {
+ hcBldr.setMaxOtnHopCount(
+ hard.getMaxOtnHopCount() == null
+ || soft.getMaxOtnHopCount().intValue() <= hard.getMaxOtnHopCount().intValue()
+ ? soft.getMaxOtnHopCount()
+ : hard.getMaxOtnHopCount());
}
return hcBldr.build();
}
if (soft == null) {
return new TEMetricBuilder(hard).build();
}
- String maxWdmTem = null;
- if (soft.getMaxWdmTEMetric() != null && hard.getMaxWdmTEMetric() != null) {
- maxWdmTem = soft.getMaxWdmTEMetric().intValue() <= hard.getMaxWdmTEMetric().intValue()
- ? soft.getMaxWdmTEMetric().toString()
- : hard.getMaxWdmTEMetric().toString();
- } else if (hard.getMaxWdmTEMetric() != null) {
- maxWdmTem = hard.getMaxWdmTEMetric().toString();
- } else if (soft.getMaxWdmTEMetric() != null) {
- maxWdmTem = soft.getMaxWdmTEMetric().toString();
- }
- String maxOtnTem = null;
- if (soft.getMaxOtnTEMetric() != null && hard.getMaxOtnTEMetric() != null) {
- maxOtnTem = soft.getMaxOtnTEMetric().intValue() <= hard.getMaxOtnTEMetric().intValue()
- ? soft.getMaxOtnTEMetric().toString()
- : hard.getMaxOtnTEMetric().toString();
- } else if (hard.getMaxOtnTEMetric() != null) {
- maxOtnTem = hard.getMaxOtnTEMetric().toString();
- } else if (soft.getMaxOtnTEMetric() != null) {
- maxOtnTem = soft.getMaxOtnTEMetric().toString();
- }
TEMetricBuilder temBldr = new TEMetricBuilder();
- if (maxWdmTem != null) {
- temBldr.setMaxWdmTEMetric(Uint32.valueOf(maxWdmTem));
- }
- if (maxOtnTem != null) {
- temBldr.setMaxOtnTEMetric(Uint32.valueOf(maxOtnTem));
+ if (soft.getMaxWdmTEMetric() == null) {
+ if (hard.getMaxWdmTEMetric() != null) {
+ temBldr.setMaxWdmTEMetric(hard.getMaxWdmTEMetric());
+ }
+ } else {
+ temBldr.setMaxWdmTEMetric(
+ hard.getMaxWdmTEMetric() == null
+ || soft.getMaxWdmTEMetric().intValue() <= hard.getMaxWdmTEMetric().intValue()
+ ? soft.getMaxWdmTEMetric()
+ : hard.getMaxWdmTEMetric());
+ }
+ if (soft.getMaxOtnTEMetric() == null) {
+ if (hard.getMaxOtnTEMetric() != null) {
+ temBldr.setMaxOtnTEMetric(hard.getMaxWdmTEMetric());
+ }
+ } else {
+ temBldr.setMaxOtnTEMetric(
+ hard.getMaxOtnTEMetric() == null
+ || soft.getMaxOtnTEMetric().intValue() <= hard.getMaxOtnTEMetric().intValue()
+ ? soft.getMaxOtnTEMetric()
+ : hard.getMaxOtnTEMetric());
}
return temBldr.build();
}