X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_ro%2Fnfvo_db.py;h=ccba5a31e1ee952c1bebb162b4c6c6e8c6234a30;hb=refs%2Fchanges%2F08%2F2308%2F2;hp=071d03abe5cdcfe3599765d7b9a87615594bd9b3;hpb=5461675ac6705ee92916ed741da1914bd2162482;p=osm%2FRO.git diff --git a/osm_ro/nfvo_db.py b/osm_ro/nfvo_db.py index 071d03ab..ccba5a31 100644 --- a/osm_ro/nfvo_db.py +++ b/osm_ro/nfvo_db.py @@ -580,7 +580,8 @@ class nfvo_db(db_base.db_base): scenario_dict["cloud-config"] = yaml.load(scenario_dict["cloud_config"]) del scenario_dict["cloud_config"] #sce_vnfs - cmd = "SELECT uuid,name,vnf_id,description FROM sce_vnfs WHERE scenario_id='{}' ORDER BY created_at".format(scenario_dict['uuid']) + cmd = "SELECT uuid,name,member_vnf_index,vnf_id,description FROM sce_vnfs WHERE scenario_id='{}' "\ + "ORDER BY created_at".format(scenario_dict['uuid']) self.logger.debug(cmd) self.cur.execute(cmd) scenario_dict['vnfs'] = self.cur.fetchall() @@ -735,6 +736,9 @@ class nfvo_db(db_base.db_base): {"table2": [ {"column1": value, "column2: value, ... }, {"column1": value, "column2: value, ... }, ...], {"table3": {"column1": value, "column2: value, ... } } + If tables does not contain the 'created_at', it is generated incrementally with the order of tables. You can + provide a integer value, that it is an index multiply by 0.00001 to add to the created time to manually set + up and order :param uuid_list: list of created uuids, first one is the root (#TODO to store at uuid table) :return: None if success, raise exception otherwise """ @@ -751,12 +755,15 @@ class nfvo_db(db_base.db_base): row_list = (row_list, ) #create a list with the single value for row in row_list: if table_name in self.tables_with_created_field: - created_time_param = created_time + index*0.00001 + if "created_at" in row: + created_time_param = created_time + row.pop("created_at")*0.00001 + else: + created_time_param = created_time + index*0.00001 + index += 1 else: - created_time_param=0 + created_time_param = 0 self._new_row_internal(table_name, row, add_uuid=False, root_uuid=None, created_time=created_time_param) - index += 1 return except (mdb.Error, AttributeError) as e: self._format_error(e, tries)