fix error ns_instances_content when not instantiated, rollback problems and pdu usage...
[osm/NBI.git] / osm_nbi / engine.py
index 4713b89..38cc08e 100644 (file)
@@ -1,5 +1,18 @@
 # -*- coding: utf-8 -*-
 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 import logging
 from osm_common import dbmongo, dbmemory, fslocal, msglocal, msgkafka, version as common_version
 from osm_common.dbbase import DbException
@@ -7,7 +20,7 @@ from osm_common.fsbase import FsException
 from osm_common.msgbase import MsgException
 from http import HTTPStatus
 from base_topic import EngineException, versiontuple
-from admin_topics import UserTopic, ProjectTopic, VimAccountTopic, SdnTopic
+from admin_topics import UserTopic, ProjectTopic, VimAccountTopic, WimAccountTopic, SdnTopic
 from descriptor_topics import VnfdTopic, NsdTopic, PduTopic, NstTopic
 from instance_topics import NsrTopic, VnfrTopic, NsLcmOpTopic, NsiTopic, NsiLcmOpTopic
 from base64 import b64encode
@@ -27,6 +40,7 @@ class Engine(object):
         "vnfrs": VnfrTopic,
         "nslcmops": NsLcmOpTopic,
         "vim_accounts": VimAccountTopic,
+        "wim_accounts": WimAccountTopic,
         "sdns": SdnTopic,
         "users": UserTopic,
         "projects": ProjectTopic,
@@ -212,13 +226,6 @@ class Engine(object):
             raise EngineException("Unknown topic {}!!!".format(topic), HTTPStatus.INTERNAL_SERVER_ERROR)
         return self.map_topic[topic].edit(session, _id, indata, kwargs, force)
 
-    def prune(self):
-        """
-        Prune database not needed content
-        :return: None
-        """
-        return self.db.del_list("nsrs", {"_admin.to_delete": True})
-
     def create_admin(self):
         """
         Creates a new user admin/admin into database if database is empty. Useful for initialization