Openflow controller abstract connector

	- Add openflow_conn abstract impletation for all openflow connectors
	- Refactor all existing conenctor to Inherit la clase abstracta
	- Now all of connector raise an exeption in case of faliure
	- As OF_connector raise an expection, all code that make use of this class now capture the execption.
	- Add to ofc DB table last_error and status column
 	- Check for each operation if an error exist an update DB ofc status and last error column info

Change-Id: Ia3d3bf63fee79dd18d61aeeb08a983dfcb88b729
Signed-off-by: mirabal <leonardo.mirabal@altran.com>
diff --git a/database_utils/migrate_vim_db.sh b/database_utils/migrate_vim_db.sh
index a3d96e8..1d24867 100755
--- a/database_utils/migrate_vim_db.sh
+++ b/database_utils/migrate_vim_db.sh
@@ -183,6 +183,7 @@
 [ $OPENVIM_VER_NUM -ge 5006 ] && DATABASE_TARGET_VER_NUM=13  #0.5.6   => 13
 [ $OPENVIM_VER_NUM -ge 5007 ] && DATABASE_TARGET_VER_NUM=14  #0.5.7   => 14
 [ $OPENVIM_VER_NUM -ge 5008 ] && DATABASE_TARGET_VER_NUM=15  #0.5.8   => 15
+[ $OPENVIM_VER_NUM -ge 5009 ] && DATABASE_TARGET_VER_NUM=16  #0.5.9   => 16
 #TODO ... put next versions here
 
 function upgrade_to_1(){
@@ -603,6 +604,22 @@
     echo "DELETE FROM schema_version WHERE version_int = '15';" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1
 }
 
+
+function upgrade_to_16(){
+    echo "    upgrade database from version 0.15 to version 0.16"
+    echo "    Add last_error and status colum to 'ofcs'"
+    echo "ALTER TABLE ofcs
+	ADD COLUMN last_error VARCHAR(255) NULL DEFAULT NULL AFTER password,
+	ADD COLUMN status ENUM('ACTIVE','INACTIVE','ERROR') NULL DEFAULT 'ACTIVE' AFTER last_error;"| $DBCMD || ! echo "ERROR. Aborted!" || exit -1
+    echo "INSERT INTO schema_version (version_int, version, openvim_ver, comments, date) VALUES (16, '0.16', '0.5.9', 'Add last_error and status colum to ofcs', '2017-03-17');"| $DBCMD || ! echo "ERROR. Aborted!" || exit -1
+}
+
+function downgrade_from_16(){
+    echo "    downgrade database from version 0.16 to version 0.15"
+    echo "    Delete last_error and status colum to 'ofcs'"
+    echo "ALTER TABLE ofcs DROP COLUMN last_error, DROP COLUMN status;	" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1
+    echo "DELETE FROM schema_version WHERE version_int = '16';" | $DBCMD || ! echo "ERROR. Aborted!" || exit -1
+}
 #TODO ... put funtions here
 
 echo "db version = "${DATABASE_VER_NUM}