Feature 8178 VNF Repositories 34/8934/1 v7.1.0rc1
authorFelipe Vicens <felipe.vicens@atos.net>
Wed, 6 May 2020 08:11:00 +0000 (10:11 +0200)
committervicens <felipe.vicens@atos.net>
Mon, 18 May 2020 15:52:47 +0000 (17:52 +0200)
Change-Id: Ifdd15c294331838dd3b18d89dc009bfc54827871
Signed-off-by: Felipe Vicens <felipe.vicens@atos.net>
osm_nbi/admin_topics.py
osm_nbi/engine.py
osm_nbi/nbi.py
osm_nbi/validation.py

index bc13c9f..26c44d2 100644 (file)
@@ -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"
index 34f0f14..8f70bb6 100644 (file)
@@ -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
index 3a23a1a..3172846 100644 (file)
@@ -115,6 +115,8 @@ URL: /osm                                                       GET     POST
                 /<id>                                           O                       O       O
             /k8srepos                                           O       O
                 /<id>                                           O                               O
+            /osmrepos                                           O       O
+                /<id>                                           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:",
+                         "<ID>": {"METHODS": ("GET", "DELETE", "PATCH"),
+                                  "ROLE_PERMISSION": "osmrepos:id:"
+                                  }
+                         },
             "domains": {"METHODS": ("GET", ),
                         "ROLE_PERMISSION": "domains:",
                         },
index 9ff90db..f8b91d8 100644 (file)
@@ -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",