Forbid additional properties in schemas, add missing ones.

This commit is contained in:
grossmj committed 2014-05-20 18:06:28 -06:00
1 parent b42d751e89
commit 3d6ec140b7
9 files changed
+102 -13

No files matched your search

+5 -1
View File
@@ -479,7 +479,11 @@ class VM(object):
# Update the ghost IOS file in case the RAM size has changed
if self._hypervisor_manager.ghost_ios_support:
self.set_ghost_ios(router)
try:
self.set_ghost_ios(router)
except DynamipsError as e:
self.send_custom_error(str(e))
return
self.send_response(response)
+8 -2
View File
@@ -24,8 +24,9 @@ ATMSW_CREATE_SCHEMA = {
"description": "ATM switch name",
"type": "string",
"minLength": 1,
}
}
},
},
"additionalProperties": False,
}
ATMSW_DELETE_SCHEMA = {
@@ -38,6 +39,7 @@ ATMSW_DELETE_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id"]
}
@@ -56,6 +58,7 @@ ATMSW_UPDATE_SCHEMA = {
"minLength": 1,
},
},
"additionalProperties": False,
"required": ["id"]
}
@@ -73,6 +76,7 @@ ATMSW_ALLOCATE_UDP_PORT_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id", "port_id"]
}
@@ -237,6 +241,7 @@ ATMSW_ADD_NIO_SCHEMA = {
]
},
},
"additionalProperties": False,
"required": ["id", "port", "port_id", "mappings", "nio"],
}
@@ -255,5 +260,6 @@ ATMSW_DELETE_NIO_SCHEMA = {
"minimum": 1,
},
},
"additionalProperties": False,
"required": ["id", "port"]
}
@@ -24,8 +24,9 @@ ETHHUB_CREATE_SCHEMA = {
"description": "Ethernet hub name",
"type": "string",
"minLength": 1,
}
}
},
},
"additionalProperties": False,
}
ETHHUB_DELETE_SCHEMA = {
@@ -38,6 +39,7 @@ ETHHUB_DELETE_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id"]
}
@@ -56,6 +58,7 @@ ETHHUB_UPDATE_SCHEMA = {
"minLength": 1,
},
},
"additionalProperties": False,
"required": ["id"]
}
@@ -73,6 +76,7 @@ ETHHUB_ALLOCATE_UDP_PORT_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id", "port_id"]
}
@@ -234,6 +238,7 @@ ETHHUB_ADD_NIO_SCHEMA = {
]
},
},
"additionalProperties": False,
"required": ["id", "port_id", "port", "nio"]
}
@@ -252,5 +257,6 @@ ETHHUB_DELETE_NIO_SCHEMA = {
"minimum": 1,
},
},
"additionalProperties": False,
"required": ["id", "port"]
}
+8 -2
View File
@@ -24,8 +24,9 @@ ETHSW_CREATE_SCHEMA = {
"description": "Ethernet switch name",
"type": "string",
"minLength": 1,
}
}
},
},
"additionalProperties": False,
}
ETHSW_DELETE_SCHEMA = {
@@ -38,6 +39,7 @@ ETHSW_DELETE_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id"]
}
@@ -71,6 +73,7 @@ ETHSW_UPDATE_SCHEMA = {
# },
# },
},
#"additionalProperties": False,
"required": ["id"]
}
@@ -88,6 +91,7 @@ ETHSW_ALLOCATE_UDP_PORT_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id", "port_id"]
}
@@ -258,6 +262,7 @@ ETHSW_ADD_NIO_SCHEMA = {
]
},
},
"additionalProperties": False,
"required": ["id", "port_id", "port", "port_type", "vlan", "nio"],
"dependencies": {
@@ -281,5 +286,6 @@ ETHSW_DELETE_NIO_SCHEMA = {
"minimum": 1,
},
},
"additionalProperties": False,
"required": ["id", "port"]
}
+8 -2
View File
@@ -24,8 +24,9 @@ FRSW_CREATE_SCHEMA = {
"description": "Frame relay switch name",
"type": "string",
"minLength": 1,
}
}
},
},
"additionalProperties": False,
}
FRSW_DELETE_SCHEMA = {
@@ -38,6 +39,7 @@ FRSW_DELETE_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id"]
}
@@ -56,6 +58,7 @@ FRSW_UPDATE_SCHEMA = {
"minLength": 1,
},
},
"additionalProperties": False,
"required": ["id"]
}
@@ -73,6 +76,7 @@ FRSW_ALLOCATE_UDP_PORT_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id", "port_id"]
}
@@ -237,6 +241,7 @@ FRSW_ADD_NIO_SCHEMA = {
]
},
},
"additionalProperties": False,
"required": ["id", "port", "port_id", "mappings", "nio"],
}
@@ -255,5 +260,6 @@ FRSW_DELETE_NIO_SCHEMA = {
"minimum": 1,
},
},
"additionalProperties": False,
"required": ["id", "port"]
}
+46 -3
View File
@@ -58,13 +58,14 @@ VM_CREATE_SCHEMA = {
"minimum": 1,
"maximum": 65535
},
"mac_address": {
"mac_addr": {
"description": "base MAC address",
"type": "string",
"minLength": 1,
"pattern": "^([0-9a-fA-F]{4}\\.){2}[0-9a-fA-F]{4}$"
}
},
"additionalProperties": False,
"required": ["platform", "image", "ram"]
}
@@ -78,6 +79,7 @@ VM_DELETE_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id"]
}
@@ -91,6 +93,7 @@ VM_START_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id"]
}
@@ -104,6 +107,7 @@ VM_STOP_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id"]
}
@@ -117,6 +121,7 @@ VM_SUSPEND_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id"]
}
@@ -130,10 +135,11 @@ VM_RELOAD_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id"]
}
#TODO: platform specific properties?
#TODO: improve platform specific properties (dependencies?)
VM_UPDATE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Request validation to update a VM instance",
@@ -237,7 +243,7 @@ VM_UPDATE_SCHEMA = {
"minimum": 1,
"maximum": 65535
},
"mac_address": {
"mac_addr": {
"description": "base MAC address",
"type": "string",
"minLength": 1,
@@ -326,7 +332,39 @@ VM_UPDATE_SCHEMA = {
"description": "private configuration base64 encoded",
"type": "string"
},
# C7200 properties
"npe": {
"description": "NPE model",
"enum": ["npe-100",
"npe-150",
"npe-175",
"npe-200",
"npe-225",
"npe-300",
"npe-400",
"npe-g2"]
},
"midplane": {
"description": "Midplane model",
"enum": ["std", "vxr"]
},
"sensors": {
"description": "Temperature sensors",
"type": "array"
},
"power_supplies": {
"description": "Power supplies status",
"type": "array"
},
# I/O memory property for all platforms but C7200
"iomem": {
"description": "I/O memory percentage",
"type": "integer",
"minimum": 0,
"maximum": 100
},
},
"additionalProperties": False,
"required": ["id"]
}
@@ -340,6 +378,7 @@ VM_SAVE_CONFIG_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id"]
}
@@ -357,6 +396,7 @@ VM_IDLEPCS_SCHEMA = {
"type": "boolean"
},
},
"additionalProperties": False,
"required": ["id"]
}
@@ -374,6 +414,7 @@ VM_ALLOCATE_UDP_PORT_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id", "port_id"]
}
@@ -542,6 +583,7 @@ VM_ADD_NIO_SCHEMA = {
]
},
},
"additionalProperties": False,
"required": ["id", "port_id", "slot", "port", "nio"]
}
@@ -567,5 +609,6 @@ VM_DELETE_NIO_SCHEMA = {
"maximum": 49 # maximum is 16 for regular port numbers, WICs port numbers start at 16, 32 or 48
},
},
"additionalProperties": False,
"required": ["id", "slot", "port"]
}