Allow compose node without properties

Valence should allow user to compose node without properties, and
let podm to assign one by default, but validation schema block it. So
fix it in schema for node composition.

Change-Id: I00e08aae3d33bbd37c0bac633345c09eb19342af
Closes-Bug: #1701122
This commit is contained in:
Lin Yang 2017-06-28 16:05:26 -07:00
parent 5c1f116c7f
commit 4d5a93a2a1
2 changed files with 34 additions and 1 deletions

View File

@ -168,6 +168,7 @@ class TestNodeApi(TestApiValidation):
def test_compose_request_invalid_params(self):
req = {
"name": "test_request1",
"properties": {"invalid_key": "invalid_value"}
}
resp = self.app.post('/v1/nodes',
content_type='application/json',

View File

@ -95,10 +95,42 @@ compose_node_with_flavor = {
'additionalProperties': False,
}
compose_node_with_properties = {
'type': 'object',
'properties': {
'name': {'type': 'string'},
'description': {'type': 'string'},
'properties': {
'type': 'object',
'properties': {
'memory': {
'type': 'object',
'properties': {
'capacity_mib': {'type': 'string'},
'type': {'type': 'string'}
},
'additionalProperties': False,
},
'processor': {
'type': 'object',
'properties': {
'total_cores': {'type': 'string'},
'model': {'type': 'string'},
},
'additionalProperties': False,
},
},
'additionalProperties': False,
},
},
'required': ['name'],
'additionalProperties': False,
}
compose_node_schema = {
'anyOf': [
compose_node_with_flavor,
flavor_schema,
compose_node_with_properties
]
}