From edea14a4ed85d5d18d33a2517cb2dc78f2444830 Mon Sep 17 00:00:00 2001 From: Martial COULIBALY Date: Fri, 16 Nov 2018 17:11:03 +0100 Subject: [PATCH] ROADM To ROADM Path Calculation on unidir ports JIRA: TRNSPRTPCE-52 Change-Id: Ied8e96d96d52636c11325c2f2b2b6c8c2eebca6c Signed-off-by: Martial COULIBALY --- .../transportpce/pce/PceCalculation.java | 8 +- .../transportpce/pce/PceNode.java | 194 ++++++++------- tests/transportpce_tests/test_pce.py | 235 ++++++++++++++++-- 3 files changed, 316 insertions(+), 121 deletions(-) diff --git a/pce/src/main/java/org/opendaylight/transportpce/pce/PceCalculation.java b/pce/src/main/java/org/opendaylight/transportpce/pce/PceCalculation.java index 0b19ac993..d9b5f029d 100644 --- a/pce/src/main/java/org/opendaylight/transportpce/pce/PceCalculation.java +++ b/pce/src/main/java/org/opendaylight/transportpce/pce/PceCalculation.java @@ -328,7 +328,7 @@ public class PceCalculation { return false; } if (supNodeId.equals(this.anodeId)) { - if (endPceNode(nodeType, nodeId, pceNode)) { + if (endPceNode(nodeType, nodeId, pceNode, true)) { if (!pceNode.isValid()) { LOG.error("validateNode: There are no available wavelengths in node {}", nodeId.getValue()); return false; @@ -337,7 +337,7 @@ public class PceCalculation { } } if (supNodeId.equals(this.znodeId)) { - if (endPceNode(nodeType, nodeId, pceNode)) { + if (endPceNode(nodeType, nodeId, pceNode, false)) { if (!pceNode.isValid()) { LOG.error("validateNode: There are no available wavelengths in node {}", nodeId.getValue()); return false; @@ -355,11 +355,11 @@ public class PceCalculation { return true; } - private Boolean endPceNode(OpenroadmNodeType openroadmNodeType, NodeId nodeId, PceNode pceNode) { + private Boolean endPceNode(OpenroadmNodeType openroadmNodeType, NodeId nodeId, PceNode pceNode, Boolean aend) { Boolean add = true; switch (openroadmNodeType) { case SRG : - pceNode.initRdmSrgTps(); + pceNode.initRdmSrgTps(aend); this.azSrgs.add(nodeId); break; case XPONDER : diff --git a/pce/src/main/java/org/opendaylight/transportpce/pce/PceNode.java b/pce/src/main/java/org/opendaylight/transportpce/pce/PceNode.java index 6ef46633f..27d8d1c30 100644 --- a/pce/src/main/java/org/opendaylight/transportpce/pce/PceNode.java +++ b/pce/src/main/java/org/opendaylight/transportpce/pce/PceNode.java @@ -9,11 +9,10 @@ package org.opendaylight.transportpce.pce; import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Set; -import java.util.TreeSet; +import java.util.Optional; +import java.util.TreeMap; import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev170929.Node1; import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev170929.TerminationPoint1; @@ -37,9 +36,11 @@ public class PceNode { private final OpenroadmNodeType nodeType; // wavelength calculation per node type private List availableWLindex = new ArrayList(); - private Set availableSrgPp = new TreeSet(); + // private Set availableSrgPp = new TreeSet(); + private Map availableSrgPp = new TreeMap(); + private Map availableSrgCp = new TreeMap(); private List usedXpndrNWTps = new ArrayList(); - private List usedRdmCpTps = new ArrayList(); + private List usedSrgPP = new ArrayList(); private List outgoingLinks = new ArrayList(); private Map clientPerNwTp = new HashMap(); private Map clientPerPpTp = new HashMap(); @@ -54,35 +55,55 @@ public class PceNode { } } - public void initSrgPpList() { + public void initSrgTpList() { this.availableSrgPp.clear(); + this.availableSrgCp.clear(); if (!isValid()) { return; } - LOG.info("getting SRG-PP tps from ROADM node {}", this.nodeId); + LOG.info("initSrgTpList: getting SRG tps from ROADM node {}", this.nodeId); 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 allTps = nodeTp.getTerminationPoint(); + .TerminationPoint> allTps = + nodeTp.getTerminationPoint(); if (allTps == null) { - LOG.error("initXndrTps: ROADM TerminationPoint list is empty for node {}", this.toString()); + LOG.error("initSrgTpList: ROADM TerminationPoint list is empty for node {}", this.toString()); this.valid = false; return; } + boolean used; for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev150608.network.node .TerminationPoint tp : allTps) { + used = true; TerminationPoint1 tp1 = tp.augmentation(TerminationPoint1.class); - if (tp1.getTpType() == OpenroadmTpType.SRGTXRXPP) { - this.availableSrgPp.add(tp.getTpId().getValue()); + try { + List usedWavelengths = tp1.getCpAttributes().getUsedWavelengths(); + if (usedWavelengths.isEmpty()) { + LOG.info("initSrgTpList: SRG-CP tp = {} found", tp.getTpId().getValue()); + used = false; + } + } catch (NullPointerException e) { + LOG.warn("initSrgTpList: 'usedWavelengths' for tp={} is null !", tp.getTpId().getValue()); + used = false; + } + if (!used) { + if (tp1.getTpType().getName().contains("-PP")) { + LOG.info("initSrgTpList: adding tp '{}'", tp1.getTpType()); + this.availableSrgPp.put(tp.getTpId().getValue(), tp1.getTpType()); + } else if (tp1.getTpType().getName().contains("-CP")) { + this.availableSrgCp.put(tp.getTpId().getValue(), tp1.getTpType()); + } } } - if (this.availableSrgPp.isEmpty()) { - LOG.error("initSrgPpList: ROADM SRG PP TerminationPoint list is empty for node {}", this.toString()); + if (this.availableSrgPp.isEmpty() && this.availableSrgCp.isEmpty()) { + LOG.error("initSrgTpList: ROADM SRG TerminationPoint list is empty for node {}", this.toString()); this.valid = false; return; } - LOG.info("initSrgPpList: availableSrgPp size = {} in {}", this.availableSrgPp.size(), this.toString()); + LOG.info("initSrgTpList: availableSrgPp size = {} && availableSrgCp size = {} in {}", this.availableSrgPp + .size(), this.availableSrgCp.size(), this.toString()); return; } @@ -95,7 +116,8 @@ public class PceNode { switch (this.nodeType) { case SRG : List srgAvailableWL = node1.getSrgAttributes().getAvailableWavelengths(); + .AvailableWavelengths> srgAvailableWL = + node1.getSrgAttributes().getAvailableWavelengths(); if (srgAvailableWL == null) { this.valid = false; LOG.error("initWLlist: SRG AvailableWavelengths is empty for node {}", this.toString()); @@ -109,15 +131,14 @@ public class PceNode { break; case DEGREE : List degAvailableWL = - node1.getDegreeAttributes().getAvailableWavelengths(); + .AvailableWavelengths> degAvailableWL = node1.getDegreeAttributes().getAvailableWavelengths(); if (degAvailableWL == null) { this.valid = false; LOG.error("initWLlist: DEG AvailableWavelengths is empty for node {}", this.toString()); return; } for (org.opendaylight.yang.gen.v1.http.org.openroadm.degree.rev170929.degree.node.attributes - .AvailableWavelengths awl : degAvailableWL) { + .AvailableWavelengths awl : degAvailableWL) { this.availableWLindex.add(awl.getIndex()); LOG.debug("initWLlist: DEGREE next = {} in {}", awl.getIndex(), this.toString()); } @@ -157,7 +178,7 @@ public class PceNode { } this.valid = false; for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev150608.network.node - .TerminationPoint tp : allTps) { + .TerminationPoint tp : allTps) { TerminationPoint1 tp1 = tp.augmentation(TerminationPoint1.class); if (tp1.getTpType() == OpenroadmTpType.XPONDERNETWORK) { if (tp1.getXpdrNetworkAttributes().getWavelength() != null) { @@ -182,91 +203,82 @@ public class PceNode { } } - public void initRdmSrgTps() { + public void initRdmSrgTps(Boolean aend) { LOG.info("initRdmSrgTps for node : {}", this.nodeId); - initSrgPpList(); + initSrgTpList(); 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 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 = 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; - } + Optional optTp = null; + OpenroadmTpType srgType = OpenroadmTpType.SRGTXRXPP; + OpenroadmTpType oppositeSrgType = null; + Optional oppositeTp = null; + boolean unidir = false; + optTp = this.availableSrgCp.entrySet().stream().filter(cp -> cp.getValue() == OpenroadmTpType.SRGTXRXCP) + .map(Map.Entry::getKey).findFirst(); + if (!optTp.isPresent()) { + srgType = null; + unidir = true; + LOG.info("UNI Directional ports ..."); + if (aend) { + LOG.info("Tx port ..."); + optTp = this.availableSrgCp.entrySet().stream().filter(cp -> cp.getValue() == OpenroadmTpType.SRGTXCP) + .map(Map.Entry::getKey).findFirst(); + srgType = OpenroadmTpType.SRGRXPP; + oppositeSrgType = OpenroadmTpType.SRGTXPP; + oppositeTp = this.availableSrgCp.entrySet().stream() + .filter(cp -> cp.getValue() == OpenroadmTpType.SRGRXCP).map(Map.Entry::getKey).findFirst(); + } else { + LOG.info("Rx port ..."); + optTp = this.availableSrgCp.entrySet().stream().filter(cp -> cp.getValue() == OpenroadmTpType.SRGRXCP) + .map(Map.Entry::getKey).findFirst(); + srgType = OpenroadmTpType.SRGTXPP; + oppositeSrgType = OpenroadmTpType.SRGRXPP; + oppositeTp = this.availableSrgCp.entrySet().stream() + .filter(cp -> cp.getValue() == OpenroadmTpType.SRGTXCP).map(Map.Entry::getKey).findFirst(); } - 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 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()); + } else { + LOG.info("BI Directional ports ..."); + } + if (optTp.isPresent() && (srgType != null)) { + String tp = optTp.get(); + if (!this.availableSrgPp.isEmpty()) { + LOG.info("finding PP for CP {}", optTp.get()); + Optional client = null; + final OpenroadmTpType openType = srgType; + client = this.availableSrgPp.entrySet().stream().filter(pp -> pp.getValue() == openType) + .map(Map.Entry::getKey).findFirst(); + if (!client.isPresent()) { + LOG.error("initRdmSrgTps: ROADM {} doesn't have defined Client {}", this.toString(), tp); this.valid = false; return; } + if (unidir) { + final OpenroadmTpType oppositeOpType = oppositeSrgType; + String opTp = oppositeTp.get(); + Optional oppositeClient = this.availableSrgPp.entrySet().stream() + .filter(pp -> pp.getValue() == oppositeOpType) + .map(Map.Entry::getKey).findFirst(); + if (!oppositeClient.isPresent()) { + LOG.error("initRdmSrgTps: ROADM {} doesn't have defined opposite Client {}", + this.toString(), tp); + this.valid = false; + return; + } + this.clientPerPpTp.put(opTp, oppositeClient.get()); + LOG.info("initRdmSrgTps: client PP {} for oposite CP {} found !", client, tp); + } + this.valid = true; + this.clientPerPpTp.put(tp, client.get()); + LOG.info("initRdmSrgTps: client PP {} for CP {} found !", client, tp); } } if (!isValid()) { - LOG.error("initRdmSrgTps: SRG doesn't have available wavelengths for node {}", this.toString()); - return; - } - } - - public void initNodeTps() { - if (!isValid()) { + this.valid = false; + LOG.error("initRdmSrgTps: SRG TerminationPoint list is empty for node {}", this.toString()); return; } - switch (this.nodeType) { - case SRG : - initSrgPpList(); - initRdmSrgTps(); - break; - case XPONDER : - initXndrTps(); - break; - default: - this.valid = true; - LOG.warn("initNodeTps: Node TerminationPoints list is not SRG or XPONDER or DEGREE!"); - break; - } } public boolean checkTP(String tp) { @@ -304,7 +316,7 @@ public class PceNode { } public String getRdmSrgClient(String tp) { - LOG.info("Getting ROADM Client PP for CP {}", tp, this.clientPerPpTp.get(tp)); + LOG.info("Getting ROADM Client PP for CP {} : {}", tp, this.clientPerPpTp.get(tp)); return this.clientPerPpTp.get(tp); } diff --git a/tests/transportpce_tests/test_pce.py b/tests/transportpce_tests/test_pce.py index 8d60017be..e45b4f1e3 100644 --- a/tests/transportpce_tests/test_pce.py +++ b/tests/transportpce_tests/test_pce.py @@ -22,20 +22,25 @@ import unittest class TransportPCEtesting(unittest.TestCase): odl_process = None - simple_data = None - complex_data = None + simple_topo_bi_dir_data = None + simple_topo_uni_dir_data = None + complex_topo_uni_dir_data = None restconf_baseurl = "http://localhost:8181/restconf" @classmethod def _get_file(cls): - simple_topology_file = "sample_configs/NW-simple-topology.xml" - if os.path.isfile(simple_topology_file): - with open(simple_topology_file, 'r') as simple_file: - cls.simple_data = simple_file.read(); - complex_topology_file = "sample_configs/NW-for-test-5-4.xml" - if os.path.isfile(complex_topology_file): - with open(complex_topology_file, 'r') as complex_file: - cls.complex_data = complex_file.read(); + topo_bi_dir_file = "sample_configs/honeynode-topo.xml" + if os.path.isfile(topo_bi_dir_file): + with open(topo_bi_dir_file, 'r') as topo_bi_dir: + cls.simple_topo_bi_dir_data = topo_bi_dir.read(); + topo_uni_dir_file = "sample_configs/NW-simple-topology.xml" + if os.path.isfile(topo_uni_dir_file): + with open(topo_uni_dir_file, 'r') as topo_uni_dir: + cls.simple_topo_uni_dir_data = topo_uni_dir.read(); + topo_uni_dir_complex_file = "sample_configs/NW-for-test-5-4.xml" + if os.path.isfile(topo_uni_dir_complex_file): + with open(topo_uni_dir_complex_file, 'r') as topo_uni_dir_complex: + cls.complex_topo_uni_dir_data = topo_uni_dir_complex.read(); @classmethod def __start_odl(cls): @@ -62,11 +67,11 @@ class TransportPCEtesting(unittest.TestCase): def setUp(self): # instruction executed before each test method time.sleep(1) - # Load simple topology - def test_01_load_simple_topology(self): + # Load simple bidirectional topology + def test_01_load_simple_topology_bi(self): url = ("{}/config/ietf-network:network/openroadm-topology" .format(self.restconf_baseurl)) - body = self.simple_data + body = self.simple_topo_bi_dir_data headers = {'content-type': 'application/xml', "Accept": "application/json"} response = requests.request( @@ -77,6 +82,138 @@ class TransportPCEtesting(unittest.TestCase): # Get existing nodeId def test_02_get_nodeId(self): + url = ("{}/config/ietf-network:network/openroadm-topology/node/ROADMA-SRG1" + .format(self.restconf_baseurl)) + headers = {'content-type': 'application/json', + "Accept": "application/json"} + response = requests.request( + "GET", url, headers=headers, auth=('admin', 'admin')) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertEqual( + res['node'][0]['node-id'], 'ROADMA-SRG1') + time.sleep(1) + + # Get existing linkId + def test_03_get_linkId(self): + url = ("{}/config/ietf-network:network/openroadm-topology/link/XPDRA-XPDR1-XPDR1-NETWORK1toROADMA-SRG1-SRG1-PP1-TXRX" + .format(self.restconf_baseurl)) + headers = {'content-type': 'application/json', + "Accept": "application/json"} + response = requests.request( + "GET", url, headers=headers, auth=('admin', 'admin')) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertEqual( + res['ietf-network-topology:link'][0]['link-id'], + 'XPDRA-XPDR1-XPDR1-NETWORK1toROADMA-SRG1-SRG1-PP1-TXRX') + time.sleep(1) + + # Path Computation success + def test_04_path_computation_xpdr_bi(self): + url = ("{}/operations/transportpce-pce:path-computation-request" + .format(self.restconf_baseurl)) + body = {"input": { + "service-name": "service-1", + "resource-reserve": "true", + "pce-metric": "hop-count", + "service-handler-header": { + "request-id": "request-1" + }, + "service-a-end": { + "node-id": "XPDRA", + "service-rate": "0", + "clli": "nodeA" + }, + "service-z-end": { + "node-id": "XPDRC", + "service-rate": "0", + "clli": "nodeC" + } + } + } + headers = {'content-type': 'application/json', + "Accept": "application/json"} + response = requests.request( + "POST", url, data=json.dumps(body), headers=headers, + auth=('admin', 'admin')) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertIn('Path is calculated', + res['output']['configuration-response-common']['response-message']) + time.sleep(5) + + # Path Computation success + def test_05_path_computation_rdm_bi(self): + url = ("{}/operations/transportpce-pce:path-computation-request" + .format(self.restconf_baseurl)) + body = {"input": { + "service-name": "service-1", + "resource-reserve": "true", + "pce-metric": "hop-count", + "service-handler-header": { + "request-id": "request-1" + }, + "service-a-end": { + "node-id": "ROADMA", + "service-rate": "0", + "clli": "nodeA" + }, + "service-z-end": { + "node-id": "ROADMC", + "service-rate": "0", + "clli": "nodeC" + } + } + } + headers = {'content-type': 'application/json', + "Accept": "application/json"} + response = requests.request( + "POST", url, data=json.dumps(body), headers=headers, + auth=('admin', 'admin')) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertIn('Path is calculated', + res['output']['configuration-response-common']['response-message']) + time.sleep(5) + + # Delete topology + def test_06_delete_simple_topology_bi(self): + url = ("{}/config/ietf-network:network/openroadm-topology" + .format(self.restconf_baseurl)) + headers = {'content-type': 'application/xml', + "Accept": "application/json"} + response = requests.request( + "DELETE", url, headers=headers, auth=('admin', 'admin')) + self.assertEqual(response.status_code, requests.codes.ok) + time.sleep(2) + + # Test deleted topology + def test_07_test_topology_simple_bi_deleted(self): + url = ("{}/config/ietf-network:network/openroadm-topology/node/ROADMA-SRG1" + .format(self.restconf_baseurl)) + headers = {'content-type': 'application/json', + "Accept": "application/json"} + response = requests.request( + "GET", url, headers=headers, auth=('admin', 'admin')) + self.assertEqual(response.status_code, 404) + time.sleep(1) + + # Load simple bidirectional topology + def test_08_load_simple_topology_uni(self): + url = ("{}/config/ietf-network:network/openroadm-topology" + .format(self.restconf_baseurl)) + body = self.simple_topo_uni_dir_data + headers = {'content-type': 'application/xml', + "Accept": "application/json"} + response = requests.request( + "PUT", url, data=body, headers=headers, + auth=('admin', 'admin')) + self.assertEqual(response.status_code, 201) + time.sleep(2) + + # Get existing nodeId + def test_09_get_nodeId(self): url = ("{}/config/ietf-network:network/openroadm-topology/node/XPONDER-1-2" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json', @@ -91,7 +228,7 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(1) # Get existing linkId - def test_03_get_linkId(self): + def test_10_get_linkId(self): url = ("{}/config/ietf-network:network/openroadm-topology/link/XPONDER-1-2XPDR-NW1-TX-toOpenROADM-1-2-SRG1-SRG1-PP1-RX" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json', @@ -106,7 +243,7 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(1) # Path Computation success - def test_04_path_computation(self): + def test_11_path_computation_xpdr_uni(self): url = ("{}/operations/transportpce-pce:path-computation-request" .format(self.restconf_baseurl)) body = {"input": { @@ -139,8 +276,54 @@ class TransportPCEtesting(unittest.TestCase): res['output']['configuration-response-common']['response-message']) time.sleep(5) + # Path Computation success + def test_12_path_computation_rdm_uni(self): + url = ("{}/operations/transportpce-pce:path-computation-request" + .format(self.restconf_baseurl)) + body = {"input": { + "service-name": "service1", + "resource-reserve": "true", + "service-handler-header": { + "request-id": "request1" + }, + "service-a-end": { + "service-rate": "0", + "clli": "cll21", + "node-id": "OpenROADM-2-1" + }, + "service-z-end": { + "service-rate": "0", + "clli": "ncli22", + "node-id": "OpenROADM-2-2" + }, + "pce-metric": "hop-count" + } + } + headers = {'content-type': 'application/json', + "Accept": "application/json"} + response = requests.request( + "POST", url, data=json.dumps(body), headers=headers, + auth=('admin', 'admin')) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertIn('Path is calculated', + res['output']['configuration-response-common']['response-message']) + #ZtoA path test + atozList = len(res['output']['response-parameters']['path-description']['aToZ-direction']['aToZ']) + ztoaList = len(res['output']['response-parameters']['path-description']['zToA-direction']['zToA']) + self.assertEqual(atozList,15) + self.assertEqual(ztoaList,15) + for i in range(0,15): + atoz = res['output']['response-parameters']['path-description']['aToZ-direction']['aToZ'][i] + ztoa = res['output']['response-parameters']['path-description']['zToA-direction']['zToA'][i] + if (atoz['id'] == '14'): + self.assertEqual(atoz['resource']['tp-id'], 'SRG1-PP1-TX') + if (ztoa['id'] == '0'): + self.assertEqual(ztoa['resource']['tp-id'], 'SRG1-PP1-RX') + time.sleep(5) + # Delete topology - def test_05_delete_simple_topology(self): + def test_13_delete_simple_topology(self): url = ("{}/config/ietf-network:network/openroadm-topology" .format(self.restconf_baseurl)) headers = {'content-type': 'application/xml', @@ -151,7 +334,7 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(2) # Test deleted topology - def test_06_test_topology_simple_deleted(self): + def test_14_test_topology_simple_deleted(self): url = ("{}/config/ietf-network:network/openroadm-topology/node/XPONDER-1-2" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json', @@ -162,10 +345,10 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(1) # Load simple topology - def test_07_load_complex_topology(self): + def test_15_load_complex_topology(self): url = ("{}/config/ietf-network:network/openroadm-topology" .format(self.restconf_baseurl)) - body = self.complex_data + body = self.complex_topo_uni_dir_data headers = {'content-type': 'application/xml', "Accept": "application/json"} response = requests.request( @@ -175,7 +358,7 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(2) # Get existing nodeId - def test_08_get_nodeId(self): + def test_16_get_nodeId(self): url = ("{}/config/ietf-network:network/openroadm-topology/node/XPONDER-3-2" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json', @@ -190,7 +373,7 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(1) # Test failed path computation - def test_09_fail_path_computation(self): + def test_17_fail_path_computation(self): url = ("{}/operations/transportpce-pce:path-computation-request" .format(self.restconf_baseurl)) body = {"input": { @@ -211,7 +394,7 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(2) # Test1 success path computation - def test_10_success1_path_computation(self): + def test_18_success1_path_computation(self): url = ("{}/operations/transportpce-pce:path-computation-request" .format(self.restconf_baseurl)) body = {"input": { @@ -312,7 +495,7 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(5) # Test2 success path computation with path description - def test_11_success2_path_computation(self): + def test_19_success2_path_computation(self): url = ("{}/operations/transportpce-pce:path-computation-request" .format(self.restconf_baseurl)) body = {"input": { @@ -348,7 +531,7 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(5) # Test3 success path computation with hard-constraints exclude - def test_12_success3_path_computation(self): + def test_20_success3_path_computation(self): url = ("{}/operations/transportpce-pce:path-computation-request" .format(self.restconf_baseurl)) body = {"input": { @@ -389,7 +572,7 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(5) # Delete complex topology - def test_13_delete_complex_topology(self): + def test_21_delete_complex_topology(self): url = ("{}/config/ietf-network:network/openroadm-topology" .format(self.restconf_baseurl)) headers = {'content-type': 'application/xml', @@ -400,7 +583,7 @@ class TransportPCEtesting(unittest.TestCase): time.sleep(2) # Test deleted complex topology - def test_14_test_topology_complex_deleted(self): + def test_22_test_topology_complex_deleted(self): url = ("{}/config/ietf-network:network/openroadm-topology/node/XPONDER-3-2" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json', -- 2.36.6