# contact with: nfvlabs@tid.es
##
-'''
+"""
openmano server.
Main program that implements a reference NFVO (Network Functions Virtualisation Orchestrator).
It interfaces with an NFV VIM through its API and offers a northbound interface, based on REST (openmano API),
network service templates and network service instances.
It loads the configuration file and launches the http_server thread that will listen requests using openmano API.
-'''
-__author__="Alfonso Tierno, Gerardo Garcia, Pablo Montes"
-__date__ ="$26-aug-2014 11:09:29$"
-__version__="0.5.10-r520"
-version_date="Apr 2017"
-database_version="0.20" #expected database schema version
+"""
import time
import sys
from osm_ro.db_base import db_base_Exception
import osm_ro
+__author__="Alfonso Tierno, Gerardo Garcia, Pablo Montes"
+__date__ ="$26-aug-2014 11:09:29$"
+__version__="0.5.11-r521"
+version_date="Apr 2017"
+database_version="0.20" #expected database schema version
+
global global_config
global logger
datacenter_tenants_dict["uuid"] = id_
#fill tenants_datacenters table
- tenants_datacenter_dict["datacenter_tenant_id"]=datacenter_tenants_dict["uuid"]
+ datacenter_tenant_id = datacenter_tenants_dict["uuid"]
+ tenants_datacenter_dict["datacenter_tenant_id"] = datacenter_tenant_id
mydb.new_row('tenants_datacenters', tenants_datacenter_dict)
# create thread
datacenter_id, myvim = get_datacenter_by_name_uuid(mydb, tenant_dict['uuid'], datacenter_id) # reload data
thread_name = get_non_used_vim_name(datacenter_name, datacenter_id, tenant_dict['name'], tenant_dict['uuid'])
- new_thread = vim_thread.vim_thread(myvim, task_lock, thread_name, datacenter_name, db=db, db_lock=db_lock, ovim=ovim)
+ new_thread = vim_thread.vim_thread(myvim, task_lock, thread_name, datacenter_name, datacenter_tenant_id,
+ db=db, db_lock=db_lock, ovim=ovim)
new_thread.start()
thread_id = datacenter_tenants_dict["uuid"]
vim_threads["running"][thread_id] = new_thread
return datacenter_id
-def edit_datacenter_to_tenant(mydb, nfvo_tenant, datacenter_id, vim_tenant_id=None, vim_tenant_name=None, vim_username=None, vim_password=None, config=None):
+
+def edit_datacenter_to_tenant(mydb, nfvo_tenant, datacenter_id, vim_tenant_id=None, vim_tenant_name=None,
+ vim_username=None, vim_password=None, config=None):
#Obtain the data of this datacenter_tenant_id
vim_data = mydb.get_rows(
SELECT=("datacenter_tenants.vim_tenant_name", "datacenter_tenants.vim_tenant_id", "datacenter_tenants.user",
# contact with: nfvlabs@tid.es
##
-'''
+""""
This is thread that interact with the host and the libvirt to manage VM
One thread will be launched per host
-'''
-__author__ = "Alfonso Tierno, Pablo Montes"
-__date__ = "$10-feb-2017 12:07:15$"
+"""
import threading
import time
from db_base import db_base_Exception
from lib_osm_openvim.ovim import ovimException
+__author__ = "Alfonso Tierno, Pablo Montes"
+__date__ = "$10-feb-2017 12:07:15$"
# from logging import Logger
# import auxiliary_functions as af
-def is_task_id(id):
- return True if id[:5] == "TASK." else False
+def is_task_id(task_id):
+ return True if task_id[:5] == "TASK." else False
class vim_thread(threading.Thread):
- def __init__(self, vimconn, task_lock, name=None, datacenter_name=None, datacenter_tenant_id=None, db=None, db_lock=None, ovim=None):
+ def __init__(self, vimconn, task_lock, name=None, datacenter_name=None, datacenter_tenant_id=None,
+ db=None, db_lock=None, ovim=None):
"""Init a thread.
Arguments:
'id' number of thead
self.logger.error("ovimException deleting external_port={} ".format(
task_interface["sdn_port_id"]) + str(e), exc_info=True)
# TODO Set error_msg at instance_nets
- vim_net_id = interface.pop("vim_net_id")
+ vim_net_id = interface["vim_net_id"]
sdn_net_id = None
sdn_port_name = None
with self.db_lock:
exc_info=True)
# TODO Set error_msg at instance_nets
with self.db_lock:
+ vim_net_id = interface.pop("vim_net_id")
self.db.update_rows('instance_interfaces', UPDATE=interface,
WHERE={'uuid': db_iface["iface_id"]})
+ interface["vim_net_id"] = vim_net_id
# TODO insert instance_id
- interface["vim_net_id"] = vim_net_id
task["vim_info"] = vim_info
if task["vim_info"]["status"] == "BUILD":