Merge "[py35] Fix for jenkins-gate-py35 error"

This commit is contained in:
Jenkins 2016-09-14 00:24:07 +00:00 committed by Gerrit Code Review
commit dcd8d9c06f
4 changed files with 18 additions and 11 deletions

View File

@ -363,7 +363,7 @@ class VnffgPluginDbMixin(vnffg.VNFFGPluginBase, db_base.CommonDbMixin):
def _create_nfp_pre(template_db):
template = template_db.template['vnffgd']['topology_template']
nfp_dict = dict()
vnffg_name = template['groups'].keys()[0]
vnffg_name = list(template['groups'].keys())[0]
# we assume only one NFP for initial implementation
nfp_dict['name'] = template['groups'][vnffg_name]['members'][0]
nfp_dict['path_id'] = template['node_templates'][nfp_dict['name']][
@ -431,7 +431,7 @@ class VnffgPluginDbMixin(vnffg.VNFFGPluginBase, db_base.CommonDbMixin):
@staticmethod
def _get_vnffg_property(template_db, vnffg_property):
template = template_db.template['vnffgd']['topology_template']
vnffg_name = template['groups'].keys()[0]
vnffg_name = list(template['groups'].keys())[0]
try:
return template['groups'][vnffg_name]['properties'][vnffg_property]
except KeyError:
@ -461,7 +461,7 @@ class VnffgPluginDbMixin(vnffg.VNFFGPluginBase, db_base.CommonDbMixin):
@staticmethod
def _search_value(search_dict, search_key):
for k, v in search_dict.iteritems():
for k, v in search_dict.items():
if k == search_key:
return v
elif isinstance(v, dict):
@ -557,7 +557,7 @@ class VnffgPluginDbMixin(vnffg.VNFFGPluginBase, db_base.CommonDbMixin):
"policy")
match = dict()
for criteria in policy['criteria']:
for key, val in criteria.iteritems():
for key, val in criteria.items():
if key in MATCH_CRITERIA:
match.update(self._convert_criteria(context, key, val,
vnf_mapping))
@ -591,7 +591,7 @@ class VnffgPluginDbMixin(vnffg.VNFFGPluginBase, db_base.CommonDbMixin):
elif criteria.endswith('_name'):
prefix = criteria[:-5]
vnf_id = vnf_mapping.values()[0]
vnf_id = list(vnf_mapping.values())[0]
new_value = self._vim_resource_name_to_id(context, prefix, value,
vnf_id)
new_name = prefix + "_id"

View File

@ -15,6 +15,7 @@
# under the License.
import os
import six
from keystoneclient.auth.identity import v2
from keystoneclient.auth.identity import v3
@ -208,7 +209,10 @@ class OpenStack_Driver(abstract_vim_driver.VimAbstractDriver):
key_file = os.path.join(CONF.vim_keys.openstack, vim_id)
try:
with open(key_file, 'w') as f:
f.write(fernet_key.decode('utf-8'))
if six.PY2:
f.write(fernet_key.decode('utf-8'))
else:
f.write(fernet_key)
LOG.debug(_('VIM auth successfully stored for vim %s'), vim_id)
except IOError:
raise nfvo.VimKeyNotFoundException(vim_id=vim_id)

View File

@ -174,7 +174,7 @@ class NfvoPlugin(nfvo_db.NfvoPluginDb, vnffg_db.VnffgPluginDbMixin):
else:
self.validate_tosca(template['template']['vnffgd'])
temp = template['template']['vnffgd']['topology_template']
vnffg_name = temp['groups'].keys()[0]
vnffg_name = list(temp['groups'].keys())[0]
nfp_name = temp['groups'][vnffg_name]['members'][0]
path = self._get_nfp_attribute(template['template'], nfp_name,
'path')
@ -209,7 +209,8 @@ class NfvoPlugin(nfvo_db.NfvoPluginDb, vnffg_db.VnffgPluginDbMixin):
# grab the first VNF to check it's VIM type
# we have already checked that all VNFs are in the same VIM
vim_auth = self._get_vim_from_vnf(context,
vnffg_dict['vnf_mapping'].values()[0]
list(vnffg_dict[
'vnf_mapping'].values())[0]
)
# TODO(trozet): figure out what auth info we actually need to pass
# to the driver. Is it a session, or is full vim obj good enough?
@ -265,7 +266,8 @@ class NfvoPlugin(nfvo_db.NfvoPluginDb, vnffg_db.VnffgPluginDbMixin):
sfc['chain'] = chain
sfc['symmetrical'] = new_vnffg['symmetrical']
vim_auth = self._get_vim_from_vnf(context,
vnffg_dict['vnf_mapping'].values()[0]
list(vnffg_dict[
'vnf_mapping'].values())[0]
)
driver_type = vim_auth['type']
try:
@ -309,7 +311,8 @@ class NfvoPlugin(nfvo_db.NfvoPluginDb, vnffg_db.VnffgPluginDbMixin):
fc = super(NfvoPlugin, self).get_classifier(context,
nfp['classifier_id'])
vim_auth = self._get_vim_from_vnf(context,
vnffg_dict['vnf_mapping'].values()[0]
list(vnffg_dict[
'vnf_mapping'].values())[0]
)
driver_type = vim_auth['type']
try:

View File

@ -437,7 +437,7 @@ class DeviceHeat(abstract_driver.DeviceAbstractDriver,
# type: tosca.policy.tacker.Scaling
if 'policies' in vnfd_dict:
for policy_dict in vnfd_dict['policies']:
name, policy = policy_dict.items()[0]
name, policy = list(policy_dict.items())[0]
if policy['type'] == 'tosca.policy.tacker.Scaling':
_convert_to_heat_scaling_policy(policy['properties'],
name)