+# PDUs
+pdu_interface = {
+ "type": "object",
+ "properties": {
+ "name": nameshort_schema,
+ "mgmt": bool_schema,
+ "type": {"enum": ["overlay", 'underlay']},
+ "ip_address": ip_schema,
+ # TODO, add user, password, ssh-key
+ "mac_address": mac_schema,
+ "vim_network_name": nameshort_schema, # interface is connected to one vim network, or switch port
+ "vim_network_id": nameshort_schema,
+ # provide this in case SDN assist must deal with this interface
+ "switch_dpid": dpid_Schema,
+ "switch_port": nameshort_schema,
+ "switch_mac": nameshort_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": nameshort_schema,
+ "type": nameshort_schema,
+ "description": description_schema,
+ "shared": bool_schema,
+ "vims": nameshort_list_schema,
+ "vim_accounts": nameshort_list_schema,
+ "interfaces": {
+ "type": "array",
+ "items": {"type": 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": nameshort_schema,
+ "type": nameshort_schema,
+ "description": description_schema,
+ "shared": bool_schema,
+ "vims": {"oneOff": [array_edition_schema, nameshort_list_schema]},
+ "vim_accounts": {"oneOff": [array_edition_schema, nameshort_list_schema]},
+ "interfaces": {"oneOff": [
+ array_edition_schema,
+ {
+ "type": "array",
+ "items": {"type": pdu_interface},
+ "minItems": 1
+ }
+ ]}
+ },
+ "additionalProperties": False,
+ "minProperties": 1
+}
+
+# USERS
+user_new_schema = {
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "title": "New user schema",
+ "type": "object",
+ "properties": {
+ "username": nameshort_schema,
+ "password": passwd_schema,
+ "projects": nameshort_list_schema,
+ },
+ "required": ["username", "password", "projects"],
+ "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,
+ "projects": {
+ "oneOff": [
+ nameshort_list_schema,
+ array_edition_schema
+ ]
+ },
+ },
+ "minProperties": 1,
+ "additionalProperties": False
+}
+
+# PROJECTS
+project_new_schema = {
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "title": "New project schema for administrators",
+ "type": "object",
+ "properties": {
+ "name": nameshort_schema,
+ "admin": bool_schema,
+ },
+ "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,
+ },
+ "additionalProperties": False,
+ "minProperties": 1
+}
+
+# GLOBAL SCHEMAS