public class PceCalculation {
/* Logging. */
private static final Logger LOG = LoggerFactory.getLogger(PceCalculation.class);
- private NetworkTransactionService networkTransactionService = null;
+ private NetworkTransactionService networkTransactionService;
///////////// data parsed from Input/////////////////
private PathComputationRequestInput input;
printNodesInfo(allPceNodes);
returnStructure.setRC(ResponseCodes.RESPONSE_OK);
- return;
}
private boolean parseInput() {
List<Link> links = this.allLinks.stream()
.filter(x -> x.getSource().getSourceNode().getValue().contains(pceNode.getNodeId().getValue()))
.collect(Collectors.toList());
- if (links.size() > 0) {
+ if (!links.isEmpty()) {
this.aendPceNode = pceNode;
}
}
List<Link> links = this.allLinks.stream()
.filter(x -> x.getDestination().getDestNode().getValue().contains(pceNode.getNodeId().getValue()))
.collect(Collectors.toList());
- if (links.size() > 0) {
+ if (!links.isEmpty()) {
this.zendPceNode = pceNode;
}
}
allPceNodes.put(pceNode.getNodeId(), pceNode);
LOG.debug("validateNode: node is saved {}", pceNode.getNodeId().getValue());
- return;
}
@SuppressWarnings("fallthrough")
}
allPceNodes.put(pceOtnNode.getNodeId(), pceOtnNode);
LOG.info("validateOtnNode: node {} is saved", node.getNodeId().getValue());
- return;
}
private ConstraintTypes validateNodeConstraints(PceNode pcenode) {
}
return false;
case "100GE":
- if (mapping.getSupportedInterfaceCapability().contains(IfOCH.class)
- || mapping.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.class)) {
- return true;
- } else {
- return false;
- }
+ return mapping.getSupportedInterfaceCapability().contains(IfOCH.class)
+ || mapping.getSupportedInterfaceCapability().contains(IfOCHOTU4ODU4.class);
default:
return true;
}
if (!State.InService.equals(node11.getOperationalState())) {
this.valid = false;
LOG.error("initWLlist: XPDR node {} is OOS/degraded", this);
- return;
}
break;
default:
if (!isValid()) {
return;
}
+ this.valid = false;
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);
List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
.node.TerminationPoint> allTps = new ArrayList<>(nodeTp.nonnullTerminationPoint().values());
if (allTps.isEmpty()) {
- this.valid = false;
LOG.error("initXndrTps: XPONDER TerminationPoint list is empty for node {}", this);
return;
}
- this.valid = false;
for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
.node.TerminationPoint tp : allTps) {
TerminationPoint1 cntp1 = tp.augmentation(TerminationPoint1.class);
}
if (!State.InService.equals(cntp1.getOperationalState())) {
LOG.warn("initXndrTps: XPONDER tp = {} is OOS/degraded", tp.getTpId().getValue());
- this.valid = false;
continue;
}
org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev211210.TerminationPoint1 nttp1 = tp
if (nttp1 != null && nttp1.getXpdrNetworkAttributes().getWavelength() != null) {
this.usedXpndrNWTps.add(tp.getTpId().getValue());
LOG.debug("initXndrTps: XPONDER tp = {} is used", tp.getTpId().getValue());
- } else {
- this.valid = true;
+ continue;
}
// find Client of this network TP
- String client;
org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.TerminationPoint1 tpceTp1 =
tp.augmentation(org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123
.TerminationPoint1.class);
if (tpceTp1 != null) {
- client = tpceTp1.getAssociatedConnectionMapPort();
+ String client = tpceTp1.getAssociatedConnectionMapPort();
if (client != null) {
this.clientPerNwTp.put(tp.getTpId().getValue(), client);
this.valid = true;
} else {
LOG.error("Service Format {} not managed yet", serviceFormat.getName());
}
+ } else {
+ this.valid = true;
}
}
if (!isValid()) {
break;
}
LOG.debug("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, tp);
- return null;
- }
- LOG.debug("getRdmSrgClient: client PP {} for CP {} found !", client, tp);
- return client.get();
- } else {
+ if (this.availableSrgPp.isEmpty()) {
LOG.error("getRdmSrgClient: SRG TerminationPoint PP list is not available for node {}", this);
return null;
}
+ final OpenroadmTpType openType = srgType;
+ Optional<String> client = this.availableSrgPp.entrySet()
+ .stream().filter(pp -> pp.getValue().getName().equals(openType.getName()))
+ .map(Map.Entry::getKey).min(new SortPortsByName());
+ if (client.isEmpty()) {
+ LOG.error("getRdmSrgClient: ROADM {} doesn't have PP Client for CP {}", this, tp);
+ return null;
+ }
+ LOG.debug("getRdmSrgClient: client PP {} for CP {} found !", client, tp);
+ return client.get();
}
public void validateAZxponder(String anodeId, String znodeId, ServiceFormat serviceFormat) {
- if (!isValid()) {
- return;
- }
- if (this.nodeType != OpenroadmNodeType.XPONDER) {
+ if (!isValid() || this.nodeType != OpenroadmNodeType.XPONDER) {
return;
}
// Detect A and Z
<port-name>C1</port-name>
</destination>
</connection-map>
+ <connection-map>
+ <connection-map-number>3</connection-map-number>
+ <source>
+ <port-name>C1</port-name>
+ <circuit-pack-name>1/1/3-PLUG-CLIENT</circuit-pack-name>
+ </source>
+ <destination>
+ <circuit-pack-name>1/1/4-PLUG-NET</circuit-pack-name>
+ <port-name>L1</port-name>
+ </destination>
+ </connection-map>
+ <connection-map>
+ <connection-map-number>4</connection-map-number>
+ <source>
+ <port-name>L1</port-name>
+ <circuit-pack-name>1/1/4-PLUG-NET</circuit-pack-name>
+ </source>
+ <destination>
+ <circuit-pack-name>1/1/3-PLUG-CLIENT</circuit-pack-name>
+ <port-name>C1</port-name>
+ </destination>
+ </connection-map>
<odu-switching-pools>
<switching-pool-number>1</switching-pool-number>
<switching-pool-type>blocking</switching-pool-type>
<port-name>C1</port-name>
</destination>
</connection-map>
+ <connection-map>
+ <connection-map-number>3</connection-map-number>
+ <source>
+ <port-name>C1</port-name>
+ <circuit-pack-name>1/1/3-PLUG-CLIENT</circuit-pack-name>
+ </source>
+ <destination>
+ <circuit-pack-name>1/1/4-PLUG-NET</circuit-pack-name>
+ <port-name>L1</port-name>
+ </destination>
+ </connection-map>
+ <connection-map>
+ <connection-map-number>4</connection-map-number>
+ <source>
+ <port-name>L1</port-name>
+ <circuit-pack-name>1/1/4-PLUG-NET</circuit-pack-name>
+ </source>
+ <destination>
+ <circuit-pack-name>1/1/3-PLUG-CLIENT</circuit-pack-name>
+ <port-name>C1</port-name>
+ </destination>
+ </connection-map>
<odu-switching-pools>
<switching-pool-number>1</switching-pool-number>
<switching-pool-type>blocking</switching-pool-type>
class TransportPCE400GPortMappingTesting(unittest.TestCase):
processes = None
- NETWORK2_CHECK_DICT = {"logical-connection-point": "XPDR3-NETWORK1",
+ NETWORK1_CHECK_DICT = {"logical-connection-point": "XPDR3-NETWORK1",
"supporting-port": "L1",
"supported-interface-capability": [
"org-openroadm-port-types:if-otsi-otsigroup"
def test_05_get_portmapping_network1(self):
response = test_utils_rfc8040.portmapping_request("XPDR-A2", "XPDR3-NETWORK1")
self.assertEqual(response["status_code"], requests.codes.ok)
- self.NETWORK2_CHECK_DICT["supporting-otucn"] = "XPDR3-NETWORK1-OTUC1"
- self.NETWORK2_CHECK_DICT["lcp-hash-val"] = "FDvaQIf2Z08="
+ self.NETWORK1_CHECK_DICT["supporting-otucn"] = "XPDR3-NETWORK1-OTUC1"
+ self.NETWORK1_CHECK_DICT["lcp-hash-val"] = "FDvaQIf2Z08="
+ self.NETWORK1_CHECK_DICT["connection-map-lcp"] = "XPDR3-CLIENT1"
self.assertIn(
- self.NETWORK2_CHECK_DICT,
+ self.NETWORK1_CHECK_DICT,
response["mapping"])
def test_06_get_portmapping_network1(self):
response = test_utils_rfc8040.portmapping_request("XPDR-C2", "XPDR3-NETWORK1")
self.assertEqual(response["status_code"], requests.codes.ok)
- self.NETWORK2_CHECK_DICT["supporting-otucn"] = "XPDR3-NETWORK1-OTUC1"
- self.NETWORK2_CHECK_DICT["lcp-hash-val"] = "AJpkaVmZKJk5"
+ self.NETWORK1_CHECK_DICT["supporting-otucn"] = "XPDR3-NETWORK1-OTUC1"
+ self.NETWORK1_CHECK_DICT["lcp-hash-val"] = "AJpkaVmZKJk5"
+ self.NETWORK1_CHECK_DICT["connection-map-lcp"] = "XPDR3-CLIENT1"
self.assertIn(
- self.NETWORK2_CHECK_DICT,
+ self.NETWORK1_CHECK_DICT,
response["mapping"])
def test_07_check_interface_otsi(self):
]},
response["output"]["node-interface"][1])
# Update the network dict variable for mpdr
- self.NETWORK2_CHECK_DICT["logical-connection-point"] = "XPDR2-NETWORK1"
- self.NETWORK2_CHECK_DICT["supporting-circuit-pack-name"] = "1/2/2-PLUG-NET"
- self.NETWORK2_CHECK_DICT["port-qual"] = "switch-network"
- self.NETWORK2_CHECK_DICT["xponder-type"] = "mpdr"
- self.NETWORK2_CHECK_DICT["lcp-hash-val"] = "LY9PxYJqUbw="
+ self.NETWORK1_CHECK_DICT["logical-connection-point"] = "XPDR2-NETWORK1"
+ self.NETWORK1_CHECK_DICT["supporting-circuit-pack-name"] = "1/2/2-PLUG-NET"
+ self.NETWORK1_CHECK_DICT["port-qual"] = "switch-network"
+ self.NETWORK1_CHECK_DICT["xponder-type"] = "mpdr"
+ self.NETWORK1_CHECK_DICT["lcp-hash-val"] = "LY9PxYJqUbw="
def test_33_get_portmapping_network1(self):
response = test_utils_rfc8040.portmapping_request("XPDR-A2", "XPDR2-NETWORK1")
self.assertEqual(response["status_code"], requests.codes.ok)
- self.NETWORK2_CHECK_DICT["supporting-otucn"] = "XPDR2-NETWORK1-OTUC2"
+ self.NETWORK1_CHECK_DICT["supporting-otucn"] = "XPDR2-NETWORK1-OTUC2"
+ del self.NETWORK1_CHECK_DICT["connection-map-lcp"]
self.assertIn(
- self.NETWORK2_CHECK_DICT,
+ self.NETWORK1_CHECK_DICT,
response["mapping"])
def test_34_check_interface_otsi(self):
})
self.assertEqual(response["status_code"], requests.codes.ok)
self.assertIn("Request processed", response["output"]["result"])
- del self.NETWORK2_CHECK_DICT["supporting-otucn"]
+ del self.NETWORK1_CHECK_DICT["supporting-otucn"]
def test_38_check_no_interface_otuc2(self):
response = test_utils_rfc8040.check_node_attribute_request("XPDR-A2", "interface", "XPDR2-NETWORK1-OTUC2")