# 2.3 deleting VNFFGs
- for sfp in instanceDict['sfps']:
+ for sfp in instanceDict.get('sfps', ()):
vimthread_affected[sfp["datacenter_tenant_id"]] = None
datacenter_key = (sfp["datacenter_id"], sfp["datacenter_tenant_id"])
if datacenter_key not in myvims:
task_index += 1
db_vim_actions.append(db_vim_action)
- for sf in instanceDict['sfs']:
+ for sf in instanceDict.get('sfs', ()):
vimthread_affected[sf["datacenter_tenant_id"]] = None
datacenter_key = (sf["datacenter_id"], sf["datacenter_tenant_id"])
if datacenter_key not in myvims:
task_index += 1
db_vim_actions.append(db_vim_action)
- for sfi in instanceDict['sfis']:
+ for sfi in instanceDict.get('sfis', ()):
vimthread_affected[sfi["datacenter_tenant_id"]] = None
datacenter_key = (sfi["datacenter_id"], sfi["datacenter_tenant_id"])
if datacenter_key not in myvims:
self.cur.execute(cmd)
instance_dict['sfps'] = self.cur.fetchall()
- for sfp in instance_dict['sfps']:
- #instance_sfs
- cmd = "SELECT uuid,vim_sf_id,sce_rsp_hop_id,datacenter_id,"\
- "datacenter_tenant_id,status,error_msg,vim_info"\
- " FROM instance_sfs" \
- " WHERE instance_scenario_id='{}' ORDER BY created_at".format(instance_dict['uuid']) # TODO: replace instance_scenario_id with instance_sfp_id
- self.logger.debug(cmd)
- self.cur.execute(cmd)
- instance_dict['sfs'] = self.cur.fetchall()
+ # for sfp in instance_dict['sfps']:
+ #instance_sfs
+ cmd = "SELECT uuid,vim_sf_id,sce_rsp_hop_id,datacenter_id,"\
+ "datacenter_tenant_id,status,error_msg,vim_info"\
+ " FROM instance_sfs" \
+ " WHERE instance_scenario_id='{}' ORDER BY created_at".format(instance_dict['uuid']) # TODO: replace instance_scenario_id with instance_sfp_id
+ self.logger.debug(cmd)
+ self.cur.execute(cmd)
+ instance_dict['sfs'] = self.cur.fetchall()
- for sf in instance_dict['sfs']:
- #instance_sfis
- cmd = "SELECT uuid,vim_sfi_id,sce_rsp_hop_id,datacenter_id,"\
- "datacenter_tenant_id,status,error_msg,vim_info"\
- " FROM instance_sfis" \
- " WHERE instance_scenario_id='{}' ORDER BY created_at".format(instance_dict['uuid']) # TODO: replace instance_scenario_id with instance_sf_id
- self.logger.debug(cmd)
- self.cur.execute(cmd)
- instance_dict['sfis'] = self.cur.fetchall()
+ #for sf in instance_dict['sfs']:
+ #instance_sfis
+ cmd = "SELECT uuid,vim_sfi_id,sce_rsp_hop_id,datacenter_id,"\
+ "datacenter_tenant_id,status,error_msg,vim_info"\
+ " FROM instance_sfis" \
+ " WHERE instance_scenario_id='{}' ORDER BY created_at".format(instance_dict['uuid']) # TODO: replace instance_scenario_id with instance_sf_id
+ self.logger.debug(cmd)
+ self.cur.execute(cmd)
+ instance_dict['sfis'] = self.cur.fetchall()
# for sfi in instance_dict['sfi']:
#instance_classifications
__date__ = "$22-sep-2017 23:59:59$"
import vimconn
-import json
+# import json
import logging
import netaddr
import time
self.logger.debug("Getting network from VIM filter: '%s'", str(filter_dict))
try:
self._reload_connection()
- if self.api_version3 and "tenant_id" in filter_dict:
- filter_dict['project_id'] = filter_dict.pop('tenant_id') #TODO check
- net_dict = self.neutron.list_networks(**filter_dict)
+ filter_dict_os = filter_dict.copy()
+ if self.api_version3 and "tenant_id" in filter_dict_os:
+ filter_dict_os['project_id'] = filter_dict_os.pop('tenant_id') #T ODO check
+ net_dict = self.neutron.list_networks(**filter_dict_os)
net_list = net_dict["networks"]
self.__net_os2mano(net_list)
return net_list
self.logger.debug("Getting image list from VIM filter: '%s'", str(filter_dict))
try:
self._reload_connection()
- filter_dict_os=filter_dict.copy()
+ filter_dict_os = filter_dict.copy()
#First we filter by the available filter fields: name, id. The others are removed.
- filter_dict_os.pop('checksum',None)
+ filter_dict_os.pop('checksum', None)
image_list = self.nova.images.findall(**filter_dict_os)
if len(image_list) == 0:
return []
for image in image_list:
try:
image_class = self.glance.images.get(image.id)
- if 'checksum' not in filter_dict or image_class['checksum']==filter_dict.get('checksum'):
+ if 'checksum' not in filter_dict or image_class['checksum'] == filter_dict.get('checksum'):
filtered_list.append(image_class.copy())
except gl1Exceptions.HTTPNotFound:
pass
self.logger.debug("Getting Classifications from VIM filter: '%s'",
str(filter_dict))
try:
+ filter_dict_os = filter_dict.copy()
self._reload_connection()
- if self.api_version3 and "tenant_id" in filter_dict:
- filter_dict['project_id'] = filter_dict.pop('tenant_id')
+ if self.api_version3 and "tenant_id" in filter_dict_os:
+ filter_dict_os['project_id'] = filter_dict_os.pop('tenant_id')
classification_dict = self.neutron.list_sfc_flow_classifiers(
- **filter_dict)
- classification_list = cliassification_dict["flow_classifiers"]
+ **filter_dict_os)
+ classification_list = classification_dict["flow_classifiers"]
self.__classification_os2mano(classification_list)
return classification_list
except (neExceptions.ConnectionFailed, ksExceptions.ClientException,
"VIM filter: '%s'", str(filter_dict))
try:
self._reload_connection()
- if self.api_version3 and "tenant_id" in filter_dict:
- filter_dict['project_id'] = filter_dict.pop('tenant_id')
- sfi_dict = self.neutron.list_sfc_port_pairs(**filter_dict)
+ filter_dict_os = filter_dict.copy()
+ if self.api_version3 and "tenant_id" in filter_dict_os:
+ filter_dict_os['project_id'] = filter_dict_os.pop('tenant_id')
+ sfi_dict = self.neutron.list_sfc_port_pairs(**filter_dict_os)
sfi_list = sfi_dict["port_pairs"]
self.__sfi_os2mano(sfi_list)
return sfi_list
str(filter_dict))
try:
self._reload_connection()
- if self.api_version3 and "tenant_id" in filter_dict:
- filter_dict['project_id'] = filter_dict.pop('tenant_id')
- sf_dict = self.neutron.list_sfc_port_pair_groups(**filter_dict)
+ filter_dict_os = filter_dict.copy()
+ if self.api_version3 and "tenant_id" in filter_dict_os:
+ filter_dict_os['project_id'] = filter_dict_os.pop('tenant_id')
+ sf_dict = self.neutron.list_sfc_port_pair_groups(**filter_dict_os)
sf_list = sf_dict["port_pair_groups"]
self.__sf_os2mano(sf_list)
return sf_list
"'%s'", str(filter_dict))
try:
self._reload_connection()
- if self.api_version3 and "tenant_id" in filter_dict:
- filter_dict['project_id'] = filter_dict.pop('tenant_id')
- sfp_dict = self.neutron.list_sfc_port_chains(**filter_dict)
+ filter_dict_os = filter_dict.copy()
+ if self.api_version3 and "tenant_id" in filter_dict_os:
+ filter_dict_os['project_id'] = filter_dict_os.pop('tenant_id')
+ sfp_dict = self.neutron.list_sfc_port_chains(**filter_dict_os)
sfp_list = sfp_dict["port_chains"]
self.__sfp_os2mano(sfp_list)
return sfp_list