From 3778a0e87f0d508fa8c6e057b7ccaf1a1fbc57a6 Mon Sep 17 00:00:00 2001 From: "guillaume.lambert" Date: Thu, 2 Sep 2021 14:23:44 +0200 Subject: [PATCH] Fix GNPy functional tests "A-to-Z" and "Z-to-A" items have been swapped in arrays returned by the PCE computation API during the updates to handle high rates. GNPy functional test must support any order. JIRA: TRNSPRTPCE-403 Signed-off-by: guillaume.lambert Change-Id: If4db8598366bd1387d05dd65220beda589dbb4c1 --- .../with_docker/test01_gnpy.py | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/tests/transportpce_tests/with_docker/test01_gnpy.py b/tests/transportpce_tests/with_docker/test01_gnpy.py index 57d8935bd..103e06f08 100644 --- a/tests/transportpce_tests/with_docker/test01_gnpy.py +++ b/tests/transportpce_tests/with_docker/test01_gnpy.py @@ -114,12 +114,14 @@ class TransportGNPYtesting(unittest.TestCase): self.assertEqual(res['output']['configuration-response-common'][ 'response-message'], 'Path is calculated by PCE') - self.assertEqual(res['output']['gnpy-response'][1]['path-dir'], - 'A-to-Z') - self.assertEqual(res['output']['gnpy-response'][1]['feasibility'], True) - self.assertEqual(res['output']['gnpy-response'][0]['path-dir'], - 'Z-to-A') + self.assertIn('A-to-Z', + [res['output']['gnpy-response'][0]['path-dir'], + res['output']['gnpy-response'][1]['path-dir']]) + self.assertIn('Z-to-A', + [res['output']['gnpy-response'][0]['path-dir'], + res['output']['gnpy-response'][1]['path-dir']]) self.assertEqual(res['output']['gnpy-response'][0]['feasibility'], True) + self.assertEqual(res['output']['gnpy-response'][1]['feasibility'], True) time.sleep(5) # Path computed by PCE is not feasible by GNPy and GNPy cannot find @@ -142,14 +144,16 @@ class TransportGNPYtesting(unittest.TestCase): self.assertEqual(res['output']['configuration-response-common'][ 'response-message'], 'No path available by PCE and GNPy ') - self.assertEqual(res['output']['gnpy-response'][1]['path-dir'], - 'A-to-Z') - self.assertEqual(res['output']['gnpy-response'][1]['feasibility'], - False) - self.assertEqual(res['output']['gnpy-response'][0]['path-dir'], - 'Z-to-A') + self.assertIn('A-to-Z', + [res['output']['gnpy-response'][0]['path-dir'], + res['output']['gnpy-response'][1]['path-dir']]) + self.assertIn('Z-to-A', + [res['output']['gnpy-response'][0]['path-dir'], + res['output']['gnpy-response'][1]['path-dir']]) self.assertEqual(res['output']['gnpy-response'][0]['feasibility'], False) + self.assertEqual(res['output']['gnpy-response'][1]['feasibility'], + False) time.sleep(5) # #PCE cannot find a path while GNPy finds a feasible one @@ -170,11 +174,13 @@ class TransportGNPYtesting(unittest.TestCase): self.assertEqual(res['output']['configuration-response-common'][ 'response-message'], 'Path is calculated by GNPy') - self.assertEqual(res['output']['gnpy-response'][1]['path-dir'], - 'A-to-Z') + self.assertIn('A-to-Z', + [res['output']['gnpy-response'][0]['path-dir'], + res['output']['gnpy-response'][1]['path-dir']]) + self.assertIn('Z-to-A', + [res['output']['gnpy-response'][0]['path-dir'], + res['output']['gnpy-response'][1]['path-dir']]) self.assertEqual(res['output']['gnpy-response'][1]['feasibility'], True) - self.assertEqual(res['output']['gnpy-response'][0]['path-dir'], - 'Z-to-A') self.assertEqual(res['output']['gnpy-response'][0]['feasibility'], True) time.sleep(5) -- 2.36.6