diff --git a/nfv/nfv-client/nfv_client/openstack/openstack.py b/nfv/nfv-client/nfv_client/openstack/openstack.py index 2adfb7af..8ccf5f18 100755 --- a/nfv/nfv-client/nfv_client/openstack/openstack.py +++ b/nfv/nfv-client/nfv_client/openstack/openstack.py @@ -59,7 +59,7 @@ def get_token(auth_uri, project_name, project_domain_name, username, password, "domain": {"name": project_domain_name} }}}}) - request_info.data = payload + request_info.data = payload.encode() request = urllib.request.urlopen(request_info, timeout=30) # Identity API v3 returns token id in X-Subject-Token diff --git a/nfv/nfv-client/nfv_client/openstack/rest_api.py b/nfv/nfv-client/nfv_client/openstack/rest_api.py index 6d7056e4..eb1fd337 100755 --- a/nfv/nfv-client/nfv_client/openstack/rest_api.py +++ b/nfv/nfv-client/nfv_client/openstack/rest_api.py @@ -32,7 +32,7 @@ def request(token_id, method, api_cmd, api_cmd_headers=None, request_info.add_header(header_type, header_value) if api_cmd_payload is not None: - request_info.data = api_cmd_payload + request_info.data = api_cmd_payload.encode() url_request = urllib.request.urlopen(request_info, timeout=timeout_in_secs) diff --git a/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/openstack/openstack.py b/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/openstack/openstack.py index 0848495a..0cd1030e 100755 --- a/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/openstack/openstack.py +++ b/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/openstack/openstack.py @@ -58,7 +58,7 @@ def get_token(directory): "name": directory.auth_project, "domain": {"name": directory.auth_project_domain_name} }}}}) - request_info.data = payload + request_info.data = payload.encode() # WARNING: Any change to the timeout must be reflected in the config.ini # file for the nfvi plugins. diff --git a/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/openstack/rest_api.py b/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/openstack/rest_api.py index d44e10c6..20da1a9c 100755 --- a/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/openstack/rest_api.py +++ b/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/openstack/rest_api.py @@ -309,7 +309,7 @@ def _rest_api_request(token_id, method, api_cmd, api_cmd_headers, request_info.add_header(header_type, header_value) if api_cmd_payload is not None: - request_info.data = api_cmd_payload + request_info.data = api_cmd_payload.encode() DLOG.verbose("Rest-API method=%s, api_cmd=%s, api_cmd_headers=%s, " "api_cmd_payload=%s" % (method, api_cmd, api_cmd_headers, diff --git a/nfv/nfv-vim/nfv_vim/api/openstack/_openstack.py b/nfv/nfv-vim/nfv_vim/api/openstack/_openstack.py index 5861f01a..3b5c9027 100755 --- a/nfv/nfv-vim/nfv_vim/api/openstack/_openstack.py +++ b/nfv/nfv-vim/nfv_vim/api/openstack/_openstack.py @@ -53,7 +53,7 @@ def validate_token(directory, admin_token, token_id): } }}) - request_info.data = payload + request_info.data = payload.encode() request = urllib.request.urlopen(request_info) # Identity API v3 returns token id in X-Subject-Token @@ -114,7 +114,7 @@ def get_token(directory): "name": directory.auth_project, "domain": {"name": directory.auth_project_domain_name} }}}}) - request_info.data = payload + request_info.data = payload.encode() request = urllib.request.urlopen(request_info) # Identity API v3 returns token id in X-Subject-Token diff --git a/nfv/nfv-vim/nfv_vim/api/openstack/_rest_api.py b/nfv/nfv-vim/nfv_vim/api/openstack/_rest_api.py index 8c5c4239..c23c7a7e 100755 --- a/nfv/nfv-vim/nfv_vim/api/openstack/_rest_api.py +++ b/nfv/nfv-vim/nfv_vim/api/openstack/_rest_api.py @@ -35,7 +35,7 @@ def rest_api_request(token, method, url, headers=None, body=None): request_info.add_header("X-Auth-Token", token.get_id()) if body is not None and '' != body: - request_info.data = body + request_info.data = body.encode() # Enable Debug # handler = urllib.request.HTTPHandler(debuglevel=1)