From: Felipe Vicens Date: Wed, 6 May 2020 08:11:00 +0000 (+0200) Subject: Feature 8178 VNF Repositories X-Git-Tag: release-v8.0-start~17 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=commitdiff_plain;h=refs%2Fchanges%2F54%2F8854%2F4;hp=f1509b299d7453b9095487346ddc223cda97e470 Feature 8178 VNF Repositories Change-Id: Ifdd15c294331838dd3b18d89dc009bfc54827871 Signed-off-by: Felipe Vicens --- diff --git a/osm_nbi/admin_topics.py b/osm_nbi/admin_topics.py index bc13c9f..26c44d2 100644 --- a/osm_nbi/admin_topics.py +++ b/osm_nbi/admin_topics.py @@ -22,7 +22,8 @@ from osm_nbi.validation import user_new_schema, user_edit_schema, project_new_sc vim_account_new_schema, vim_account_edit_schema, sdn_new_schema, sdn_edit_schema, \ wim_account_new_schema, wim_account_edit_schema, roles_new_schema, roles_edit_schema, \ k8scluster_new_schema, k8scluster_edit_schema, k8srepo_new_schema, k8srepo_edit_schema, \ - validate_input, ValidationError, is_valid_uuid # To check that User/Project Names don't look like UUIDs + osmrepo_new_schema, osmrepo_edit_schema, \ + validate_input, ValidationError, is_valid_uuid # To check that User/Project Names don't look like UUIDs from osm_nbi.base_topic import BaseTopic, EngineException from osm_nbi.authconn import AuthconnNotFoundException, AuthconnConflictException from osm_common.dbbase import deep_update_rfc7396 @@ -520,6 +521,15 @@ class K8sRepoTopic(CommonVimWimSdn): return oid +class OsmRepoTopic(BaseTopic): + topic = "osmrepos" + topic_msg = "osmrepos" + schema_new = osmrepo_new_schema + schema_edit = osmrepo_edit_schema + multiproject = True + # TODO: Implement user/password + + class UserTopicAuth(UserTopic): # topic = "users" # topic_msg = "users" diff --git a/osm_nbi/engine.py b/osm_nbi/engine.py index 34f0f14..8f70bb6 100644 --- a/osm_nbi/engine.py +++ b/osm_nbi/engine.py @@ -25,7 +25,7 @@ from osm_nbi.authconn_keystone import AuthconnKeystone from osm_nbi.authconn_internal import AuthconnInternal from osm_nbi.base_topic import EngineException, versiontuple from osm_nbi.admin_topics import VimAccountTopic, WimAccountTopic, SdnTopic -from osm_nbi.admin_topics import K8sClusterTopic, K8sRepoTopic +from osm_nbi.admin_topics import K8sClusterTopic, K8sRepoTopic, OsmRepoTopic from osm_nbi.admin_topics import UserTopicAuth, ProjectTopicAuth, RoleTopicAuth from osm_nbi.descriptor_topics import VnfdTopic, NsdTopic, PduTopic, NstTopic, VnfPkgOpTopic from osm_nbi.instance_topics import NsrTopic, VnfrTopic, NsLcmOpTopic, NsiTopic, NsiLcmOpTopic @@ -52,6 +52,7 @@ class Engine(object): "sdns": SdnTopic, "k8sclusters": K8sClusterTopic, "k8srepos": K8sRepoTopic, + "osmrepos": OsmRepoTopic, "users": UserTopicAuth, # Valid for both internal and keystone authentication backends "projects": ProjectTopicAuth, # Valid for both internal and keystone authentication backends "roles": RoleTopicAuth, # Valid for both internal and keystone authentication backends diff --git a/osm_nbi/nbi.py b/osm_nbi/nbi.py index 3a23a1a..3172846 100644 --- a/osm_nbi/nbi.py +++ b/osm_nbi/nbi.py @@ -115,6 +115,8 @@ URL: /osm GET POST / O O O /k8srepos O O / O O + /osmrepos O O + / O O /nst/v1 O O /netslice_templates_content O O @@ -266,6 +268,12 @@ valid_url_methods = { "ROLE_PERMISSION": "k8srepos:id:" } }, + "osmrepos": {"METHODS": ("GET", "POST"), + "ROLE_PERMISSION": "osmrepos:", + "": {"METHODS": ("GET", "DELETE", "PATCH"), + "ROLE_PERMISSION": "osmrepos:id:" + } + }, "domains": {"METHODS": ("GET", ), "ROLE_PERMISSION": "domains:", }, diff --git a/osm_nbi/validation.py b/osm_nbi/validation.py index 9ff90db..f8b91d8 100644 --- a/osm_nbi/validation.py +++ b/osm_nbi/validation.py @@ -657,6 +657,32 @@ k8srepo_edit_schema = { "additionalProperties": False } +# OSM Repos +osmrepo_types = {"enum": ["osm"]} +osmrepo_properties = { + "name": name_schema, + "description": description_schema, + "type": osmrepo_types, + "url": description_schema + # "user": shortname_schema, + # "password": passwd_schema +} +osmrepo_new_schema = { + "title": "osm repo creation input schema", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": osmrepo_properties, + "required": ["name", "type", "url"], + "additionalProperties": False +} +osmrepo_edit_schema = { + "title": "osm repo edit input schema", + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": osmrepo_properties, + "additionalProperties": False +} + # PDUs pdu_interface = { "type": "object",