__author__ = "Alfonso Tierno, Gerardo Garcia, Pablo Montes"
__date__ = "$26-aug-2014 11:09:29$"
-__version__ = "0.5.74-r584"
-version_date = "Jul 2018"
+__version__ = "0.5.75-r585"
+version_date = "Ago 2018"
database_version = 32 # expected database schema version
# edit data
datacenter_id = datacenter['uuid']
- where={'uuid': datacenter['uuid']}
+ where = {'uuid': datacenter['uuid']}
remove_port_mapping = False
new_sdn_port_mapping = None
if "config" in datacenter_descriptor:
if "sdn-port-mapping" in new_config_dict:
remove_port_mapping = True
new_sdn_port_mapping = new_config_dict.pop("sdn-port-mapping")
- #delete null fields
- to_delete=[]
+ # delete null fields
+ to_delete = []
for k in new_config_dict:
- if new_config_dict[k] == None:
+ if new_config_dict[k] is None:
to_delete.append(k)
if k == 'sdn-controller':
remove_port_mapping = True
config_text = '{}'
config_dict = yaml.load(config_text)
config_dict.update(new_config_dict)
- #delete null fields
+ # delete null fields
for k in to_delete:
del config_dict[k]
except Exception as e:
try:
datacenter_sdn_port_mapping_delete(mydb, None, datacenter_id)
except ovimException as e:
- logger.error("Error deleting datacenter-port-mapping " + str(e))
+ raise NfvoException("Error deleting datacenter-port-mapping " + str(e), HTTP_Conflict)
mydb.update_rows('datacenters', datacenter_descriptor, where)
if new_sdn_port_mapping:
try:
datacenter_sdn_port_mapping_set(mydb, None, datacenter_id, new_sdn_port_mapping)
except ovimException as e:
- logger.error("Error adding datacenter-port-mapping " + str(e))
+ # Rollback
+ mydb.update_rows('datacenters', datacenter, where)
+ raise NfvoException("Error adding datacenter-port-mapping " + str(e), HTTP_Conflict)
return datacenter_id
try:
datacenter_sdn_port_mapping_delete(mydb, None, datacenter_dict['uuid'])
except ovimException as e:
- logger.error("Error deleting datacenter-port-mapping " + str(e))
+ raise NfvoException("Error deleting datacenter-port-mapping " + str(e))
return datacenter_dict['uuid'] + " " + datacenter_dict['name']
with self.db_lock:
vims = self.db.get_rows(FROM=from_, SELECT=select_, WHERE=where_)
vim = vims[0]
- extra = {'datacenter_tenant_id': vim.get('datacenter_tenant_id'),
- 'datacenter_id': vim.get('datacenter_id')}
+ vim_config = {}
+ if vim["config"]:
+ vim_config.update(yaml.load(vim["config"]))
+ if vim["dt_config"]:
+ vim_config.update(yaml.load(vim["dt_config"]))
+ vim_config['datacenter_tenant_id'] = vim.get('datacenter_tenant_id')
+ vim_config['datacenter_id'] = vim.get('datacenter_id')
self.vim = vim_module[vim["type"]].vimconnector(
uuid=vim['datacenter_id'], name=vim['datacenter_name'],
tenant_id=vim['vim_tenant_id'], tenant_name=vim['vim_tenant_name'],
url=vim['vim_url'], url_admin=vim['vim_url_admin'],
user=vim['user'], passwd=vim['passwd'],
- config=extra, persistent_info=self.vim_persistent_info
+ config=vim_config, persistent_info=self.vim_persistent_info
)
self.error_status = None
except Exception as e: