Forbid additional properties in schemas, add missing ones.

pull/21/head^2
grossmj 10 years ago
parent b42d751e89
commit 3d6ec140b7

@ -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)

@ -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"]
}

@ -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"]
}

@ -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"]
}

@ -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"]
}

@ -38,6 +38,7 @@ IOU_CREATE_SCHEMA = {
"minLength": 1,
}
},
"additionalProperties": False,
"required": ["path"],
}
@ -51,6 +52,7 @@ IOU_DELETE_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id"]
}
@ -117,6 +119,7 @@ IOU_UPDATE_SCHEMA = {
"type": "string"
},
},
"additionalProperties": False,
"required": ["id"]
}
@ -130,6 +133,7 @@ IOU_START_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id"]
}
@ -143,6 +147,7 @@ IOU_STOP_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id"]
}
@ -156,6 +161,7 @@ IOU_RELOAD_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id"]
}
@ -173,6 +179,7 @@ IOU_ALLOCATE_UDP_PORT_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id", "port_id"]
}
@ -341,6 +348,7 @@ IOU_ADD_NIO_SCHEMA = {
]
},
},
"additionalProperties": False,
"required": ["id", "port_id", "slot", "port", "nio"]
}
@ -367,5 +375,6 @@ IOU_DELETE_NIO_SCHEMA = {
"maximum": 3
},
},
"additionalProperties": False,
"required": ["id", "slot", "port"]
}

@ -33,6 +33,7 @@ VPCS_CREATE_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
}
VPCS_DELETE_SCHEMA = {
@ -45,6 +46,7 @@ VPCS_DELETE_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id"]
}
@ -78,6 +80,7 @@ VPCS_UPDATE_SCHEMA = {
"type": "string"
},
},
"additionalProperties": False,
"required": ["id"]
}
@ -91,6 +94,7 @@ VPCS_START_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id"]
}
@ -104,6 +108,7 @@ VPCS_STOP_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id"]
}
@ -117,6 +122,7 @@ VPCS_RELOAD_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id"]
}
@ -134,6 +140,7 @@ VPCS_ALLOCATE_UDP_PORT_SCHEMA = {
"type": "integer"
},
},
"additionalProperties": False,
"required": ["id", "port_id"]
}
@ -296,6 +303,7 @@ VPCS_ADD_NIO_SCHEMA = {
]
},
},
"additionalProperties": False,
"required": ["id", "port_id", "port", "nio"]
}
@ -315,5 +323,6 @@ VPCS_DELETE_NIO_SCHEMA = {
"maximum": 0
},
},
"additionalProperties": False,
"required": ["id", "port"]
}

@ -23,5 +23,5 @@
# or negative for a release candidate or beta (after the base version
# number has been incremented)
__version__ = "1.0a5.dev2"
__version__ = "1.0a5.dev3"
__version_info__ = (1, 0, 0, -99)

Loading…
Cancel
Save