Move openvim version/date/db_version to ovim 79/1379/1
authormirabal <leonardo.mirabal@altran.com>
Mon, 27 Mar 2017 16:08:07 +0000 (18:08 +0200)
committermirabal <leonardo.mirabal@altran.com>
Mon, 27 Mar 2017 16:23:12 +0000 (18:23 +0200)
Change-Id: Ia4740a7eebb09ab537d099dbd79cf44796a7979e
Signed-off-by: mirabal <leonardo.mirabal@altran.com>
openvimd.py
ovim.py

index 6090741..3acbedf 100755 (executable)
@@ -30,9 +30,7 @@ and host controllers
 
 __author__ = "Alfonso Tierno"
 __date__ = "$10-jul-2014 12:07:15$"
-__version__ = "0.5.8-r524"
-version_date = "March 2017"
-database_version = "0.15"      #expected database schema version
+
 
 import httpserver
 import auxiliary_functions as af
@@ -150,7 +148,7 @@ if __name__=="__main__":
 
     for o, a in opts:
         if o in ("-v", "--version"):
-            print "openvimd version", __version__, version_date
+            print "openvimd version", ovim.ovim.get_version(), ovim.ovim.get_version_date()
             print "(c) Copyright Telefonica"
             sys.exit(0)
         elif o in ("-h", "--help"):
@@ -219,9 +217,9 @@ if __name__=="__main__":
             print '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
             print "!! Warning, openvimd in TEST mode '%s'" % config_dic['mode']
             print '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
-        config_dic['version'] = __version__
+        config_dic['version'] = ovim.get_version()
 
-        config_dic["database_version"] = database_version
+        config_dic["database_version"] = ovim.ovim.get_database_version()
         config_dic["logger_name"] = "openvim"
 
         engine = ovim.ovim(config_dic)
diff --git a/ovim.py b/ovim.py
index 6e8f8da..edd0b4c 100644 (file)
--- a/ovim.py
+++ b/ovim.py
@@ -28,6 +28,9 @@ Two thread will be launched, with normal and administrative permissions.
 
 __author__ = "Alfonso Tierno, Leonardo Mirabal"
 __date__ = "$06-Feb-2017 12:07:15$"
+__version__ = "0.5.8-r524"
+version_date = "March 2017"
+database_version = "0.15"      #expected database schema version
 
 import threading
 import vim_db
@@ -109,6 +112,18 @@ class ovim():
                                                                                 self.config['db_host']) )
         return db
 
+    @staticmethod
+    def get_version():
+        return __version__
+
+    @staticmethod
+    def get_version_date():
+        return version_date
+
+    @staticmethod
+    def get_database_version():
+        return database_version
+
     @staticmethod
     def _check_dhcp_data_integrity(network):
         """