X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=ovim.py;h=965cf30919047bc196186d4250eb7431c2a4329c;hb=refs%2Fchanges%2F97%2F1397%2F2;hp=6e8f8dae0c74dba1e3cf931c9ac437a5e6c817ac;hpb=82232585e3ee87fd3228e7814f393a7d6c05fc79;p=osm%2Fopenvim.git diff --git a/ovim.py b/ovim.py index 6e8f8da..965cf30 100644 --- 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): """ @@ -149,15 +164,16 @@ class ovim(): Start ovim services :return: """ + global database_version # if self.running_info: # return #TODO service can be checked and rebuild broken threads r = self.db.get_db_version() if r[0] < 0: raise ovimException("DATABASE is not a VIM one or it is a '0.0' version. Try to upgrade to version '{}' with "\ - "'./database_utils/migrate_vim_db.sh'".format(self.config["database_version"]) ) - elif r[1] != self.config["database_version"]: + "'./database_utils/migrate_vim_db.sh'".format(database_version) ) + elif r[1] != database_version: raise ovimException("DATABASE wrong version '{}'. Try to upgrade/downgrade to version '{}' with "\ - "'./database_utils/migrate_vim_db.sh'".format(r[1], self.config["database_version"]) ) + "'./database_utils/migrate_vim_db.sh'".format(r[1], database_version) ) # create database connection for openflow threads self.db_of = self._create_database_connection() @@ -335,6 +351,8 @@ class ovim(): temp_dict['of_port'] = db_config['port'] temp_dict['of_dpid'] = db_config['dpid'] temp_dict['of_controller'] = db_config['type'] + temp_dict['of_user'] = db_config['user'] + temp_dict['of_password'] = db_config['password'] temp_dict['of_debug'] = self.config['log_level_of'] @@ -884,9 +902,12 @@ class ovim(): port_data['switch_mac'] = port_mapping_data[0]['switch_mac'] # remove from compute_node, region and pci of_port_data to adapt to 'ports' structure - del port_data['compute_node'] - del port_data['region'] - del port_data['pci'] + if 'region' in port_data: + del port_data['region'] + if 'pci' in port_data: + del port_data['pci'] + if 'compute_node' in port_data: + del port_data['compute_node'] result, uuid = self.db.new_row('ports', port_data, True, True) if result > 0: