Code Review
/
transportpce.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Technical debt - Fix PCE sonar issues
[transportpce.git]
/
tests
/
transportpce_tests
/
1.2.1
/
test_gnpy.py
diff --git
a/tests/transportpce_tests/1.2.1/test_gnpy.py
b/tests/transportpce_tests/1.2.1/test_gnpy.py
index 20e7d7578a63cfa44f1972cc85932177db8e8140..09812bd8d2fc2e2d8f72012fc08ad703bd6c8aae 100644
(file)
--- a/
tests/transportpce_tests/1.2.1/test_gnpy.py
+++ b/
tests/transportpce_tests/1.2.1/test_gnpy.py
@@
-9,8
+9,10
@@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+# pylint: disable=no-member
+# pylint: disable=too-many-public-methods
+
import unittest
import unittest
-import json
import os
import sys
import time
import os
import sys
import time
@@
-20,13
+22,6
@@
from common import test_utils
class TransportGNPYtesting(unittest.TestCase):
class TransportGNPYtesting(unittest.TestCase):
- @classmethod
- def __init_logfile(cls):
- GNPY_LOGFILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),
- "..", "..", "transportpce_tests", "gnpy.log")
- if os.path.isfile(GNPY_LOFGILE):
- os.remove(GNPY_LOFGILE)
-
topo_cllinet_data = None
topo_ordnet_data = None
topo_ordtopo_data = None
topo_cllinet_data = None
topo_ordnet_data = None
topo_ordtopo_data = None
@@
-34,6
+29,7
@@
class TransportGNPYtesting(unittest.TestCase):
@classmethod
def setUpClass(cls):
@classmethod
def setUpClass(cls):
+ # pylint: disable=bare-except
try:
sample_files_parsed = False
TOPO_CLLINET_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),
try:
sample_files_parsed = False
TOPO_CLLINET_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),
@@
-68,6
+64,7
@@
class TransportGNPYtesting(unittest.TestCase):
@classmethod
def tearDownClass(cls):
@classmethod
def tearDownClass(cls):
+ # pylint: disable=not-an-iterable
for process in cls.processes:
test_utils.shutdown_process(process)
print("all processes killed")
for process in cls.processes:
test_utils.shutdown_process(process)
print("all processes killed")
@@
-105,12
+102,12
@@
class TransportGNPYtesting(unittest.TestCase):
self.assertEqual(res['output']['configuration-response-common'][
'response-message'],
'Path is calculated by PCE')
self.assertEqual(res['output']['configuration-response-common'][
'response-message'],
'Path is calculated by PCE')
- self.assertEqual(res['output']['gnpy-response'][0]['path-dir'],
- 'A-to-Z')
- self.assertEqual(res['output']['gnpy-response'][0]['feasibility'], True)
self.assertEqual(res['output']['gnpy-response'][1]['path-dir'],
self.assertEqual(res['output']['gnpy-response'][1]['path-dir'],
- '
Z-to-A
')
+ '
A-to-Z
')
self.assertEqual(res['output']['gnpy-response'][1]['feasibility'], True)
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)
# Path computed by PCE is not feasible by GNPy and GNPy cannot find
time.sleep(5)
# Path computed by PCE is not feasible by GNPy and GNPy cannot find
@@
-124,7
+121,8
@@
class TransportGNPYtesting(unittest.TestCase):
{"include_": {"ordered-hops": [
{"hop-number": "0", "hop-type": {"node-id": "OpenROADM-2"}},
{"hop-number": "1", "hop-type": {"node-id": "OpenROADM-3"}},
{"include_": {"ordered-hops": [
{"hop-number": "0", "hop-type": {"node-id": "OpenROADM-2"}},
{"hop-number": "1", "hop-type": {"node-id": "OpenROADM-3"}},
- {"hop-number": "2", "hop-type": {"node-id": "OpenROADM-4"}}]}})
+ {"hop-number": "2", "hop-type": {"node-id": "OpenROADM-4"}}]}
+ })
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual(res['output']['configuration-response-common'][
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual(res['output']['configuration-response-common'][
@@
-132,13
+130,13
@@
class TransportGNPYtesting(unittest.TestCase):
self.assertEqual(res['output']['configuration-response-common'][
'response-message'],
'No path available by PCE and GNPy ')
self.assertEqual(res['output']['configuration-response-common'][
'response-message'],
'No path available by PCE and GNPy ')
- self.assertEqual(res['output']['gnpy-response'][
0
]['path-dir'],
+ self.assertEqual(res['output']['gnpy-response'][
1
]['path-dir'],
'A-to-Z')
'A-to-Z')
- self.assertEqual(res['output']['gnpy-response'][
0
]['feasibility'],
+ self.assertEqual(res['output']['gnpy-response'][
1
]['feasibility'],
False)
False)
- self.assertEqual(res['output']['gnpy-response'][
1
]['path-dir'],
+ self.assertEqual(res['output']['gnpy-response'][
0
]['path-dir'],
'Z-to-A')
'Z-to-A')
- self.assertEqual(res['output']['gnpy-response'][
1
]['feasibility'],
+ self.assertEqual(res['output']['gnpy-response'][
0
]['feasibility'],
False)
time.sleep(5)
False)
time.sleep(5)
@@
-151,7
+149,8
@@
class TransportGNPYtesting(unittest.TestCase):
"service-format": "Ethernet", "clli": "Node5"},
{"include_": {"ordered-hops": [
{"hop-number": "0", "hop-type": {"node-id": "OpenROADM-2"}},
"service-format": "Ethernet", "clli": "Node5"},
{"include_": {"ordered-hops": [
{"hop-number": "0", "hop-type": {"node-id": "OpenROADM-2"}},
- {"hop-number": "1", "hop-type": {"node-id": "OpenROADM-3"}}]}})
+ {"hop-number": "1", "hop-type": {"node-id": "OpenROADM-3"}}]}
+ })
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual(res['output']['configuration-response-common'][
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual(res['output']['configuration-response-common'][
@@
-159,12
+158,12
@@
class TransportGNPYtesting(unittest.TestCase):
self.assertEqual(res['output']['configuration-response-common'][
'response-message'],
'Path is calculated by GNPy')
self.assertEqual(res['output']['configuration-response-common'][
'response-message'],
'Path is calculated by GNPy')
- self.assertEqual(res['output']['gnpy-response'][0]['path-dir'],
- 'A-to-Z')
- self.assertEqual(res['output']['gnpy-response'][0]['feasibility'], True)
self.assertEqual(res['output']['gnpy-response'][1]['path-dir'],
self.assertEqual(res['output']['gnpy-response'][1]['path-dir'],
- '
Z-to-A
')
+ '
A-to-Z
')
self.assertEqual(res['output']['gnpy-response'][1]['feasibility'], True)
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)
# Not found path by PCE and GNPy cannot find another one
time.sleep(5)
# Not found path by PCE and GNPy cannot find another one
@@
-178,7
+177,8
@@
class TransportGNPYtesting(unittest.TestCase):
{"hop-number": "0", "hop-type": {"node-id": "OpenROADM-2"}},
{"hop-number": "1", "hop-type": {"node-id": "OpenROADM-3"}},
{"hop-number": "2", "hop-type": {"node-id": "OpenROADM-4"}},
{"hop-number": "0", "hop-type": {"node-id": "OpenROADM-2"}},
{"hop-number": "1", "hop-type": {"node-id": "OpenROADM-3"}},
{"hop-number": "2", "hop-type": {"node-id": "OpenROADM-4"}},
- {"hop-number": "3", "hop-type": {"node-id": "OpenROADM-3"}}]}})
+ {"hop-number": "3", "hop-type": {"node-id": "OpenROADM-3"}}]}
+ })
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual(res['output']['configuration-response-common'][
self.assertEqual(response.status_code, requests.codes.ok)
res = response.json()
self.assertEqual(res['output']['configuration-response-common'][