aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/vnf/ims/ixia
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-06-14 21:20:59 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2018-06-14 21:46:14 +0200
commit7f2d7515e068c2ba072d4f3b4cf0997e06ae8460 (patch)
treea067dcdd08c3e11a1e820ccb0f9fdef866e70e69 /functest/opnfv_tests/vnf/ims/ixia
parent09d6e6feef33fa47bca440a096894b851b1ebca5 (diff)
Support py3 in uncovered packages
It has to be noted that cloudify_rest_client doesn't support py3 then next unit tests vs cloudify-based testcases would be excluded. Change-Id: I0b0e64929d1238665c778ce51fd6abd5ccf06b6c Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/opnfv_tests/vnf/ims/ixia')
-rw-r--r--functest/opnfv_tests/vnf/ims/ixia/utils/IxChassisUtils.py14
-rw-r--r--functest/opnfv_tests/vnf/ims/ixia/utils/IxLoadUtils.py6
-rw-r--r--functest/opnfv_tests/vnf/ims/ixia/utils/IxRestUtils.py7
3 files changed, 15 insertions, 12 deletions
diff --git a/functest/opnfv_tests/vnf/ims/ixia/utils/IxChassisUtils.py b/functest/opnfv_tests/vnf/ims/ixia/utils/IxChassisUtils.py
index 973e0264d..301a0c7bc 100644
--- a/functest/opnfv_tests/vnf/ims/ixia/utils/IxChassisUtils.py
+++ b/functest/opnfv_tests/vnf/ims/ixia/utils/IxChassisUtils.py
@@ -55,7 +55,7 @@ class ChassisRestAPI:
headers=urlHeadersJson)
logger.debug(response)
logger.debug(content)
- except Exception, e:
+ except Exception as e:
raise Exception('Got an error code: ', e)
return content
@@ -74,7 +74,7 @@ class ChassisRestAPI:
(response, content) = h.request(loginUrl, 'POST',
body=payload,
headers=urlHeadersJson)
- except Exception, e:
+ except Exception as e:
raise Exception('Got an error code: ', e)
return content
@@ -95,7 +95,7 @@ class ChassisRestAPI:
(response, content) = h.request(url, 'POST',
json.dumps(payload),
headers=urlHeadersJson)
- except Exception, e:
+ except Exception as e:
raise Exception('Got an error code: ', e)
return content
@@ -111,9 +111,9 @@ class ChassisRestAPI:
(response, content) = h.request(url, 'PATCH',
json.dumps(payload),
urlHeadersJson)
- except Exception, e:
+ except Exception as e:
- # print (response, content)
+ # print((response, content))
raise Exception('Got an error code: ', e)
return content
@@ -127,7 +127,7 @@ class ChassisRestAPI:
disable_ssl_certificate_validation=True)
(response, content) = h.request(url, 'DELETE', '', urlHeadersJson)
logger.debug('DELETE: ' + url)
- except Exception, e:
+ except Exception as e:
raise Exception('Got an error code: ', e)
if response.status not in okStates:
raise TestFailedError(json.loads(content)['error'])
@@ -142,7 +142,7 @@ class ChassisRestAPI:
disable_ssl_certificate_validation=True)
logger.debug('GET: ' + url)
(response, content) = h.request(url, 'GET', '', urlHeadersJson)
- except Exception, e:
+ except Exception as e:
raise Exception('Got an error code: ', e)
if response.status not in okStates:
raise TestFailedError(json.loads(content)['error'])
diff --git a/functest/opnfv_tests/vnf/ims/ixia/utils/IxLoadUtils.py b/functest/opnfv_tests/vnf/ims/ixia/utils/IxLoadUtils.py
index bc71a38cf..93da2018c 100644
--- a/functest/opnfv_tests/vnf/ims/ixia/utils/IxLoadUtils.py
+++ b/functest/opnfv_tests/vnf/ims/ixia/utils/IxLoadUtils.py
@@ -70,7 +70,7 @@ def waitForActionToFinish(connection, replyObj, actionUrl):
if actionStatusObj.status == kActionStatusError:
errorMsg += actionStatusObj.error
- print errorMsg
+ print(errorMsg)
sys.exit(1)
else:
@@ -172,13 +172,13 @@ def uploadFile(connection, url, fileName, uploadPath, overwrite=True):
with open(fileName, 'rb') as f:
resp = requests.post(url, data=f, params=params,
headers=headers)
- except requests.exceptions.ConnectionError, e:
+ except requests.exceptions.ConnectionError as e:
raise Exception('Upload file failed. Received connection error. \
One common cause for this error is the size of the \
file to be uploaded.The web server sets a limit of 1GB\
for the uploaded file size. \
Received the following error: %s' % str(e))
- except IOError, e:
+ except IOError as e:
raise Exception('Upload file failed. Received IO error: %s'
% str(e))
except Exception:
diff --git a/functest/opnfv_tests/vnf/ims/ixia/utils/IxRestUtils.py b/functest/opnfv_tests/vnf/ims/ixia/utils/IxRestUtils.py
index 41c23dc53..9148dd20a 100644
--- a/functest/opnfv_tests/vnf/ims/ixia/utils/IxRestUtils.py
+++ b/functest/opnfv_tests/vnf/ims/ixia/utils/IxRestUtils.py
@@ -7,10 +7,13 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
-from urlparse import urljoin
import requests
+import six
+from six.moves.urllib.parse import urljoin
+
+
def getConnection(server, port):
"""
Gets a Connection instance, that will be used to
@@ -180,7 +183,7 @@ class WebObject(object):
"""
self.jsonOptions = {}
- for (key, value) in entries.iteritems():
+ for (key, value) in six.iteritems(entries):
webObj = _WebObject(value)
self.jsonOptions[key] = webObj
self.__dict__[key] = webObj