X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FRO.git;a=blobdiff_plain;f=RO%2Fosm_ro%2Fopenmanod.py;h=e5a5ae1b358a61ab7e03983c1c15f57beee2ae6f;hp=cdf451a198b895c698f637ed1c273f5a417a82aa;hb=69647795675df7357a9aeddaa5aba15c6f92b065;hpb=7d782eff123e5b44d41437377ccca66ad1e8b21b diff --git a/RO/osm_ro/openmanod.py b/RO/osm_ro/openmanod.py index cdf451a1..e5a5ae1b 100755 --- a/RO/osm_ro/openmanod.py +++ b/RO/osm_ro/openmanod.py @@ -53,9 +53,9 @@ import osm_ro __author__ = "Alfonso Tierno, Gerardo Garcia, Pablo Montes" __date__ = "$26-aug-2014 11:09:29$" -__version__ = "6.0.3.post5" -version_date = "Oct 2019" -database_version = 39 # expected database schema version +__version__ = "7.0.0.post13" +version_date = "Jan 2019" +database_version = 40 # expected database schema version global global_config global logger @@ -157,6 +157,20 @@ def set_logging_file(log_file): "Cannot open logging file '{}': {}. Check folder exist and permissions".format(log_file, e)) +def _get_version(): + """ + Try to get version from package using pkg_resources (available with setuptools) + """ + global __version__ + ro_version = __version__ + try: + from pkg_resources import get_distribution + ro_version = get_distribution("osm_ro").version + except Exception: + pass + return ro_version + + if __name__ == "__main__": # env2config contains environ variable names and the correspondence with configuration file openmanod.cfg keys. # If this environ is defined, this value is taken instead of the one at at configuration file @@ -172,6 +186,7 @@ if __name__ == "__main__": 'RO_LOG_LEVEL': 'log_level', 'RO_LOG_FILE': 'log_file', } + ro_version = _get_version() # Configure logging step 1 hostname = socket.gethostname() log_formatter_str = '%(asctime)s.%(msecs)03d00Z[{host}@openmanod] %(filename)s:%(lineno)s severity:%(levelname)s logger:%(name)s log:%(message)s' @@ -200,7 +215,7 @@ if __name__ == "__main__": for o, a in opts: if o in ("-v", "--version"): - print ("openmanod version " + __version__ + ' ' + version_date) + print ("openmanod version {} {}".format(ro_version, version_date)) print ("(c) Copyright Telefonica") sys.exit() elif o in ("-h", "--help"): @@ -227,7 +242,7 @@ if __name__ == "__main__": if log_file: set_logging_file(log_file) global_config = load_configuration(config_file) - global_config["version"] = __version__ + global_config["version"] = ro_version global_config["version_date"] = version_date # Override parameters obtained by command line on ENV if port: @@ -275,9 +290,9 @@ if __name__ == "__main__": logger.setLevel(getattr(logging, global_config['log_level'])) logger.critical("Starting openmano server version: '%s %s' command: '%s'", - __version__, version_date, " ".join(sys.argv)) + ro_version, version_date, " ".join(sys.argv)) - for log_module in ("nfvo", "http", "vim", "wim", "db", "console", "ovim"): + for log_module in ("nfvo", "http", "vim", "wim", "db", "console", "ovim", "sdn", "sdnconn"): log_level_module = "log_level_" + log_module log_file_module = "log_file_" + log_module logger_module = logging.getLogger('openmano.' + log_module) @@ -327,7 +342,7 @@ if __name__ == "__main__": # WIM module wim_persistence = WimPersistence(mydb) - wim_engine = WimEngine(wim_persistence) + wim_engine = WimEngine(wim_persistence, nfvo.plugins) # --- nfvo.start_service(mydb, wim_persistence, wim_engine)