X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_nbi%2Fadmin_topics.py;h=9f6f6d7de0ec75485da62deeeec221514b0a20b6;hb=7802ff80245ba7ba6055bc927b91e4f8b1f42542;hp=0006917cd513abe0d69ab1e18549feb493f614e2;hpb=4568a372eb5a204e04d917213de03ec51f9110c1;p=osm%2FNBI.git diff --git a/osm_nbi/admin_topics.py b/osm_nbi/admin_topics.py index 0006917..9f6f6d7 100644 --- a/osm_nbi/admin_topics.py +++ b/osm_nbi/admin_topics.py @@ -345,7 +345,6 @@ class CommonVimWimSdn(BaseTopic): schema_version ) or self.config_to_encrypt.get("default") if edit_content.get("config") and config_to_encrypt_keys: - for p in config_to_encrypt_keys: if edit_content["config"].get(p): final_content["config"][p] = self.db.encrypt( @@ -395,6 +394,29 @@ class CommonVimWimSdn(BaseTopic): # create operation content["_admin"]["operations"] = [self._create_operation("create")] content["_admin"]["current_operation"] = None + # create Resource in Openstack based VIM + if content.get("vim_type"): + if content["vim_type"] == "openstack": + compute = { + "ram": {"total": None, "used": None}, + "vcpus": {"total": None, "used": None}, + "instances": {"total": None, "used": None}, + } + storage = { + "volumes": {"total": None, "used": None}, + "snapshots": {"total": None, "used": None}, + "storage": {"total": None, "used": None}, + } + network = { + "networks": {"total": None, "used": None}, + "subnets": {"total": None, "used": None}, + "floating_ips": {"total": None, "used": None}, + } + content["resources"] = { + "compute": compute, + "storage": storage, + "network": network, + } return "{}:0".format(content["_id"]) @@ -522,7 +544,7 @@ class WimAccountTopic(CommonVimWimSdn): schema_new = wim_account_new_schema schema_edit = wim_account_edit_schema multiproject = True - password_to_encrypt = "wim_password" + password_to_encrypt = "password" config_to_encrypt = {} @@ -922,12 +944,13 @@ class UserTopicAuth(UserTopic): except ValidationError as e: raise EngineException(e, HTTPStatus.UNPROCESSABLE_ENTITY) - def show(self, session, _id, api_req=False): + def show(self, session, _id, filter_q=None, api_req=False): """ Get complete information on an topic :param session: contains "username", "admin", "force", "public", "project_id", "set_project" :param _id: server internal id or username + :param filter_q: dict: query parameter :param api_req: True if this call is serving an external API request. False if serving internal request. :return: dictionary, raise exception if not found. """ @@ -1050,7 +1073,6 @@ class UserTopicAuth(UserTopic): mapping["role"], mapping["role_name"], ): - if mapping in mappings_to_remove: # do not remove mappings_to_remove.remove(mapping) break # do not add, it is already at user @@ -1097,6 +1119,7 @@ class UserTopicAuth(UserTopic): "_id": _id, "username": indata.get("username"), "password": indata.get("password"), + "old_password": indata.get("old_password"), "add_project_role_mappings": mappings_to_add, "remove_project_role_mappings": mappings_to_remove, } @@ -1295,12 +1318,13 @@ class ProjectTopicAuth(ProjectTopic): except ValidationError as e: raise EngineException(e, HTTPStatus.UNPROCESSABLE_ENTITY) - def show(self, session, _id, api_req=False): + def show(self, session, _id, filter_q=None, api_req=False): """ Get complete information on an topic :param session: contains "username", "admin", "force", "public", "project_id", "set_project" :param _id: server internal id + :param filter_q: dict: query parameter :param api_req: True if this call is serving an external API request. False if serving internal request. :return: dictionary, raise exception if not found. """ @@ -1594,12 +1618,13 @@ class RoleTopicAuth(BaseTopic): final_content["permissions"]["admin"] = False return None - def show(self, session, _id, api_req=False): + def show(self, session, _id, filter_q=None, api_req=False): """ Get complete information on an topic :param session: contains "username", "admin", "force", "public", "project_id", "set_project" :param _id: server internal id + :param filter_q: dict: query parameter :param api_req: True if this call is serving an external API request. False if serving internal request. :return: dictionary, raise exception if not found. """