Implement feature 5949
Enable dynamic connectivity setup in multi-site Network Services
The code required to implement the feature is contained in `osm_ro/wim`
as much as possible.
* `wim/engine.py` works together with `nfvo.py` to implement the
feature
* `wim/persistence.py` is equivalent to `nfvo_db.py` and try to
encapsulate most of the SQL-specific code, implementing a persistence
layer
* `wim/http_handler.py` extends `httpserver.py` adding WIM-related HTTP
routes
* `wim/wim_thread.py` is similar to `vim_thread.py` and controls the
execution of WIM-related tasks
* `wim/actions.py` and `wim/wan_link_actions.py` implement the action
handling specific code, calling instances of the `wim/wimconn.py`
subclasses
WIM connectors are still a work in progress
Individual change details (newer to older)
- Add errors for inconsistent state
- Delay re-scheduled tasks
- Move lock to inside the persistence object
- Better errors for connector failures
- Try to cache the wan_link information before it is deleted from the database
- Integrate WanLinkDelete to NFVO
- Add WanLinkDelete implementation draft with some tests
- Add basic wim network creation
- Add minimal documentation for actions
- Add checks to the create action
- Improve documentation, rearrange insert_pending and remove unused functions on WimThread
- Integrate Action classes in refresh_tasks
- Add Action classes to avoid intricate conditions
- Adding Proposed License
- Move grouping of actions to persistence
- Change WimThread to use SQL to do the heavy lifting
- Simplify WimThread reload_actions
- Add tests for derive_wan_links
- Implement find_common_wim(s)
- Add tests for create_wim_account
- Add migration scripts for version 33
- Changes to WIM and VIM threads for vim_wim_actions
- Implement wim_account management according to the discussion
- Add WimHandler integration inside httpserver
- Add quick instructions to run the tests
- Add WIM functional tests using real database
- Add DB WIM port mapping
- RO WIM-related console scripts
- Add WIM integration to NFVO
- Improve database support focusing on tests
- RO NBI WIM-related commands in HTTP server
- Adding WIM tables to MANO DB
- Add wim http handler initial implementation
- Move http utility functions to separated files
This separation allows the code to be reused more easily and avoids
circular dependencies.
(The httpserver can import other modules implementing http routes,
and those modules can then use the utility functions without having
to import back httpserver)
- Add a HTTP handler class and custom route decorator
These tools can be used to create independent groups of bottle
routes/callbacks in a OOP fashion
- Extract http error codes and related logic to separated file
Change-Id: Icd5fc9fa345852b8cf571e48f427dc10bdbd24c5
Signed-off-by: Anderson Bravalheri <a.bravalheri@bristol.ac.uk>
diff --git a/osm_ro/vim_thread.py b/osm_ro/vim_thread.py
index c981e31..2713c76 100644
--- a/osm_ro/vim_thread.py
+++ b/osm_ro/vim_thread.py
@@ -23,7 +23,7 @@
""""
This is thread that interacts with a VIM. It processes TASKs sequentially against a single VIM.
-The tasks are stored at database in table vim_actions
+The tasks are stored at database in table vim_wim_actions
The task content is (M: stored at memory, D: stored at database):
MD instance_action_id: reference a global action over an instance-scenario: database instance_actions
MD task_index: index number of the task. This together with the previous forms a unique key identifier
@@ -49,8 +49,8 @@
vim_status: VIM status of the element. Stored also at database in the instance_XXX
M depends: dict with task_index(from depends_on) to task class
M params: same as extra[params] but with the resolved dependencies
- M vim_interfaces: similar to extra[interfaces] but with VIM information. Stored at database in the instance_XXX but not at vim_actions
- M vim_info: Detailed information of a vm,net from the VIM. Stored at database in the instance_XXX but not at vim_actions
+ M vim_interfaces: similar to extra[interfaces] but with VIM information. Stored at database in the instance_XXX but not at vim_wim_actions
+ M vim_info: Detailed information of a vm,net from the VIM. Stored at database in the instance_XXX but not at vim_wim_actions
MD error_msg: descriptive text upon an error.Stored also at database instance_XXX
MD created_at: task creation time
MD modified_at: last task update time. On refresh it contains when this task need to be refreshed
@@ -189,7 +189,7 @@
while True:
# get 200 (database_limit) entries each time
with self.db_lock:
- vim_actions = self.db.get_rows(FROM="vim_actions",
+ vim_actions = self.db.get_rows(FROM="vim_wim_actions",
WHERE={"datacenter_vim_id": self.datacenter_tenant_id,
"item_id>=": old_item_id},
ORDER_BY=("item_id", "item", "created_at",),
@@ -393,7 +393,7 @@
if task_need_update:
with self.db_lock:
self.db.update_rows(
- 'vim_actions',
+ 'vim_wim_actions',
UPDATE={"extra": yaml.safe_dump(task["extra"], default_flow_style=True, width=256),
"error_msg": task.get("error_msg"), "modified_at": now},
WHERE={'instance_action_id': task['instance_action_id'],
@@ -463,7 +463,7 @@
with self.db_lock:
self.db.update_rows('instance_nets', UPDATE=temp_dict, WHERE={"uuid": task["item_id"]})
self.db.update_rows(
- 'vim_actions',
+ 'vim_wim_actions',
UPDATE={"extra": yaml.safe_dump(task["extra"], default_flow_style=True, width=256),
"error_msg": task.get("error_msg"), "modified_at": now},
WHERE={'instance_action_id': task['instance_action_id'],
@@ -644,7 +644,7 @@
now = time.time()
with self.db_lock:
self.db.update_rows(
- table="vim_actions",
+ table="vim_wim_actions",
UPDATE={"status": task["status"], "vim_id": task.get("vim_id"), "modified_at": now,
"error_msg": task["error_msg"],
"extra": yaml.safe_dump(task["extra"], default_flow_style=True, width=256)},
@@ -811,7 +811,7 @@
instance_action_id = ins_action_id
with self.db_lock:
- tasks = self.db.get_rows(FROM="vim_actions", WHERE={"instance_action_id": instance_action_id,
+ tasks = self.db.get_rows(FROM="vim_wim_actions", WHERE={"instance_action_id": instance_action_id,
"task_index": task_index})
if not tasks:
return None