+ "additionalProperties": False,
+ "minProperties": 3,
+}
+k8scluster_nets_schema = {
+ "title": "k8scluster nets input schema",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "patternProperties": {".": {"oneOf": [name_schema, null_schema]}},
+ "minProperties": 1,
+ "additionalProperties": False,
+}
+k8scluster_new_schema = {
+ "title": "k8scluster creation input schema",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "schema_version": schema_version,
+ "schema_type": schema_type,
+ "name": name_schema,
+ "description": description_schema,
+ "credentials": object_schema,
+ "vim_account": id_schema,
+ "vca_id": id_schema,
+ "k8s_version": string_schema,
+ "nets": k8scluster_nets_schema,
+ "deployment_methods": k8scluster_deploy_method_schema,
+ "namespace": name_schema,
+ "cni": nameshort_list_schema,
+ },
+ "required": ["name", "credentials", "vim_account", "k8s_version", "nets"],
+ "additionalProperties": False,
+}
+k8scluster_edit_schema = {
+ "title": "vim_account edit input schema",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "name": name_schema,
+ "description": description_schema,
+ "credentials": object_schema,
+ "vim_account": id_schema,
+ "vca_id": id_schema,
+ "k8s_version": string_schema,
+ "nets": k8scluster_nets_schema,
+ "namespace": name_schema,
+ "cni": nameshort_list_schema,
+ },
+ "additionalProperties": False,
+}
+
+# VCA
+vca_new_schema = {
+ "title": "vca creation input schema",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "schema_version": schema_version,
+ "schema_type": schema_type,
+ "name": name_schema,
+ "description": description_schema,
+ "endpoints": description_list_schema,
+ "user": string_schema,
+ "secret": passwd_schema,
+ "cacert": long_description_schema,
+ "lxd-cloud": shortname_schema,
+ "lxd-credentials": shortname_schema,
+ "k8s-cloud": shortname_schema,
+ "k8s-credentials": shortname_schema,
+ "model-config": object_schema,
+ },
+ "required": [
+ "name",
+ "endpoints",
+ "user",
+ "secret",
+ "cacert",
+ "lxd-cloud",
+ "lxd-credentials",
+ "k8s-cloud",
+ "k8s-credentials",
+ ],
+ "additionalProperties": False,
+}
+vca_edit_schema = {
+ "title": "vca creation input schema",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "name": name_schema,
+ "description": description_schema,
+ "endpoints": description_list_schema,
+ "port": integer1_schema,
+ "user": string_schema,
+ "secret": passwd_schema,
+ "cacert": long_description_schema,
+ "lxd-cloud": shortname_schema,
+ "lxd-credentials": shortname_schema,
+ "k8s-cloud": shortname_schema,
+ "k8s-credentials": shortname_schema,
+ "model-config": object_schema,
+ },
+ "additionalProperties": False,
+}
+
+# K8s Repos
+k8srepo_types = {"enum": ["helm-chart", "juju-bundle"]}
+k8srepo_properties = {
+ "name": name_schema,
+ "description": description_schema,
+ "type": k8srepo_types,
+ "url": description_schema,
+}
+k8srepo_new_schema = {
+ "title": "k8scluster creation input schema",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": k8srepo_properties,
+ "required": ["name", "type", "url"],
+ "additionalProperties": False,
+}
+k8srepo_edit_schema = {
+ "title": "vim_account edit input schema",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": k8srepo_properties,
+ "additionalProperties": False,
+}
+
+# OSM Repos
+osmrepo_types = {"enum": ["osm"]}
+osmrepo_properties = {
+ "name": name_schema,
+ "description": description_schema,
+ "type": osmrepo_types,
+ "url": description_schema
+ # "user": string_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",
+ "properties": {
+ "name": shortname_schema,
+ "mgmt": bool_schema,
+ "type": {"enum": ["overlay", "underlay"]},
+ "ip-address": {"oneOf": [ip_schema, ipv6_schema]},
+ # TODO, add user, password, ssh-key
+ "mac-address": mac_schema,
+ "vim-network-name": shortname_schema, # interface is connected to one vim network, or switch port
+ "vim-network-id": shortname_schema,
+ # # provide this in case SDN assist must deal with this interface
+ # "switch-dpid": dpid_Schema,
+ # "switch-port": shortname_schema,
+ # "switch-mac": shortname_schema,
+ # "switch-vlan": vlan_schema,
+ },
+ "required": ["name", "mgmt", "ip-address"],
+ "additionalProperties": False,
+}
+pdu_new_schema = {
+ "title": "pdu creation input schema",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "name": shortname_schema,
+ "type": shortname_schema,
+ "description": description_schema,
+ "shared": bool_schema,
+ "vims": nameshort_list_schema,
+ "vim_accounts": nameshort_list_schema,
+ "interfaces": {"type": "array", "items": pdu_interface, "minItems": 1},
+ },
+ "required": ["name", "type", "interfaces"],
+ "additionalProperties": False,
+}
+pdu_edit_schema = {
+ "title": "pdu edit input schema",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "name": shortname_schema,
+ "type": shortname_schema,
+ "description": description_schema,
+ "shared": bool_schema,
+ "vims": {"oneOf": [array_edition_schema, nameshort_list_schema]},
+ "vim_accounts": {"oneOf": [array_edition_schema, nameshort_list_schema]},
+ "interfaces": {
+ "oneOf": [
+ array_edition_schema,
+ {"type": "array", "items": pdu_interface, "minItems": 1},
+ ]
+ },
+ },
+ "additionalProperties": False,
+ "minProperties": 1,
+}
+
+# VNF PKG OPERATIONS
+vnfpkgop_new_schema = {
+ "title": "VNF PKG operation creation input schema",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "lcmOperationType": string_schema,
+ "vnfPkgId": id_schema,
+ "kdu_name": name_schema,
+ "primitive": name_schema,
+ "primitive_params": {"type": "object"},
+ },
+ "required": [
+ "lcmOperationType",
+ "vnfPkgId",
+ "kdu_name",
+ "primitive",
+ "primitive_params",
+ ],
+ "additionalProperties": False,
+}
+
+# USERS
+project_role_mappings = {
+ "title": "list pf projects/roles",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {"project": shortname_schema, "role": shortname_schema},
+ "required": ["project", "role"],
+ "additionalProperties": False,
+ },
+ "minItems": 1,
+}
+project_role_mappings_optional = {
+ "title": "list of projects/roles or projects only",
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {"project": shortname_schema, "role": shortname_schema},
+ "required": ["project"],
+ "additionalProperties": False,
+ },
+ "minItems": 1,
+}
+user_new_schema = {
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "title": "New user schema",
+ "type": "object",
+ "properties": {
+ "username": string_schema,
+ "domain_name": shortname_schema,
+ "password": passwd_schema,
+ "projects": nameshort_list_schema,
+ "project_role_mappings": project_role_mappings,
+ },
+ "required": ["username", "password"],
+ "additionalProperties": False,
+}
+user_edit_schema = {
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "title": "User edit schema for administrators",
+ "type": "object",
+ "properties": {
+ "password": passwd_schema,
+ "old_password": passwd_schema,
+ "username": string_schema, # To allow User Name modification
+ "projects": {"oneOf": [nameshort_list_schema, array_edition_schema]},
+ "project_role_mappings": project_role_mappings,
+ "add_project_role_mappings": project_role_mappings,
+ "remove_project_role_mappings": project_role_mappings_optional,
+ },
+ "minProperties": 1,
+ "additionalProperties": False,
+}
+
+# PROJECTS
+topics_with_quota = [
+ "vnfds",
+ "nsds",
+ "slice_templates",
+ "pduds",
+ "ns_instances",
+ "slice_instances",
+ "vim_accounts",
+ "wim_accounts",
+ "sdn_controllers",
+ "k8sclusters",
+ "vca",
+ "k8srepos",
+ "osmrepos",
+ "ns_subscriptions",
+]
+project_new_schema = {
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "title": "New project schema for administrators",
+ "type": "object",
+ "properties": {
+ "name": shortname_schema,
+ "admin": bool_schema,
+ "domain_name": shortname_schema,
+ "quotas": {
+ "type": "object",
+ "properties": {topic: integer0_schema for topic in topics_with_quota},
+ "additionalProperties": False,
+ },
+ },
+ "required": ["name"],
+ "additionalProperties": False,
+}
+project_edit_schema = {
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "title": "Project edit schema for administrators",
+ "type": "object",
+ "properties": {
+ "admin": bool_schema,
+ "name": shortname_schema, # To allow Project Name modification
+ "quotas": {
+ "type": "object",
+ "properties": {
+ topic: {"oneOf": [integer0_schema, null_schema]}
+ for topic in topics_with_quota
+ },
+ "additionalProperties": False,
+ },
+ },
+ "additionalProperties": False,
+ "minProperties": 1,
+}
+
+# ROLES
+roles_new_schema = {
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "title": "New role schema for administrators",
+ "type": "object",
+ "properties": {
+ "name": shortname_schema,
+ "permissions": {
+ "type": "object",
+ "patternProperties": {
+ ".": bool_schema,
+ },
+ # "minProperties": 1,
+ },
+ },
+ "required": ["name"],
+ "additionalProperties": False,
+}
+roles_edit_schema = {
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "title": "Roles edit schema for administrators",
+ "type": "object",
+ "properties": {
+ "name": shortname_schema,
+ "permissions": {
+ "type": "object",
+ "patternProperties": {".": {"oneOf": [bool_schema, null_schema]}},
+ # "minProperties": 1,
+ },
+ },
+ "additionalProperties": False,
+ "minProperties": 1,