Add Oem parameter in node composition schema
Change-Id: I9f57e3d36068ebf5500585d40cca3ce588585af4
This commit is contained in:
parent
f8ef9f903f
commit
f63fb959f3
@ -25,6 +25,20 @@ processor_req_schema = {
|
|||||||
'enum': ['x86', 'x86-64', 'IA-64', 'ARM-A32',
|
'enum': ['x86', 'x86-64', 'IA-64', 'ARM-A32',
|
||||||
'ARM-A64', 'MIPS32', 'MIPS64', 'OEM']
|
'ARM-A64', 'MIPS32', 'MIPS64', 'OEM']
|
||||||
},
|
},
|
||||||
|
'Oem': {
|
||||||
|
'type': 'object',
|
||||||
|
'properties': {
|
||||||
|
'Brand': {
|
||||||
|
'type': 'string',
|
||||||
|
'enum': ['E3', 'E5', 'E7', 'X3', 'X5', 'X7', 'I3',
|
||||||
|
'I5', 'I7', 'Unknown']
|
||||||
|
},
|
||||||
|
'Capabilities': {
|
||||||
|
'type': 'array',
|
||||||
|
'items': [{'type': 'string'}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
'Resource': {
|
'Resource': {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
'properties': {
|
'properties': {
|
||||||
|
@ -25,6 +25,21 @@ processor_req_schema = {
|
|||||||
'enum': ['x86', 'x86-64', 'IA-64', 'ARM-A32',
|
'enum': ['x86', 'x86-64', 'IA-64', 'ARM-A32',
|
||||||
'ARM-A64', 'MIPS32', 'MIPS64', 'OEM']
|
'ARM-A64', 'MIPS32', 'MIPS64', 'OEM']
|
||||||
},
|
},
|
||||||
|
'Oem': {
|
||||||
|
'type': 'object',
|
||||||
|
'properties': {
|
||||||
|
'Brand': {
|
||||||
|
'type': 'string',
|
||||||
|
'enum': ['E3', 'E5', 'E7', 'X3', 'X5', 'X7', 'I3',
|
||||||
|
'I5', 'I7', 'Silver', 'Gold', 'Platinum',
|
||||||
|
'Unknown']
|
||||||
|
},
|
||||||
|
'Capabilities': {
|
||||||
|
'type': 'array',
|
||||||
|
'items': [{'type': 'string'}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
'Resource': {
|
'Resource': {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
'properties': {
|
'properties': {
|
||||||
|
@ -486,7 +486,11 @@ class NodeCollectionTestCase(testtools.TestCase):
|
|||||||
'Name': 'test',
|
'Name': 'test',
|
||||||
'Description': 'this is a test node',
|
'Description': 'this is a test node',
|
||||||
'Processors': [{
|
'Processors': [{
|
||||||
'TotalCores': 4
|
'TotalCores': 4,
|
||||||
|
'Oem': {
|
||||||
|
'Brand': 'E7',
|
||||||
|
'Capabilities': ['sse']
|
||||||
|
}
|
||||||
}],
|
}],
|
||||||
'Memory': [{
|
'Memory': [{
|
||||||
'CapacityMiB': 8000
|
'CapacityMiB': 8000
|
||||||
@ -496,7 +500,13 @@ class NodeCollectionTestCase(testtools.TestCase):
|
|||||||
}
|
}
|
||||||
result = self.node_col.compose_node(
|
result = self.node_col.compose_node(
|
||||||
name='test', description='this is a test node',
|
name='test', description='this is a test node',
|
||||||
processor_req=[{'TotalCores': 4}],
|
processor_req=[{
|
||||||
|
'TotalCores': 4,
|
||||||
|
'Oem': {
|
||||||
|
'Brand': 'E7',
|
||||||
|
'Capabilities': ['sse']
|
||||||
|
}
|
||||||
|
}],
|
||||||
memory_req=[{'CapacityMiB': 8000}],
|
memory_req=[{'CapacityMiB': 8000}],
|
||||||
total_system_core_req=8,
|
total_system_core_req=8,
|
||||||
total_system_memory_req=16000)
|
total_system_memory_req=16000)
|
||||||
@ -508,3 +518,48 @@ class NodeCollectionTestCase(testtools.TestCase):
|
|||||||
self.assertRaises(jsonschema.exceptions.ValidationError,
|
self.assertRaises(jsonschema.exceptions.ValidationError,
|
||||||
self.node_col.compose_node,
|
self.node_col.compose_node,
|
||||||
processor_req='invalid')
|
processor_req='invalid')
|
||||||
|
|
||||||
|
# Wrong processor Oem Brand
|
||||||
|
with self.assertRaisesRegex(
|
||||||
|
jsonschema.exceptions.ValidationError,
|
||||||
|
("'Platinum' is not one of \['E3', 'E5'")):
|
||||||
|
|
||||||
|
self.node_col.compose_node(
|
||||||
|
name='test', description='this is a test node',
|
||||||
|
processor_req=[{
|
||||||
|
'TotalCores': 4,
|
||||||
|
'Oem': {
|
||||||
|
'Brand': 'Platinum',
|
||||||
|
'Capabilities': ['sse']
|
||||||
|
}
|
||||||
|
}])
|
||||||
|
|
||||||
|
# Wrong processor Oem Capabilities
|
||||||
|
with self.assertRaisesRegex(
|
||||||
|
jsonschema.exceptions.ValidationError,
|
||||||
|
("'sse' is not of type 'array'")):
|
||||||
|
|
||||||
|
self.node_col.compose_node(
|
||||||
|
name='test', description='this is a test node',
|
||||||
|
processor_req=[{
|
||||||
|
'TotalCores': 4,
|
||||||
|
'Oem': {
|
||||||
|
'Brand': 'E3',
|
||||||
|
'Capabilities': 'sse'
|
||||||
|
}
|
||||||
|
}])
|
||||||
|
|
||||||
|
# Wrong processor Oem Capabilities
|
||||||
|
with self.assertRaisesRegex(
|
||||||
|
jsonschema.exceptions.ValidationError,
|
||||||
|
("0 is not of type 'string'")):
|
||||||
|
|
||||||
|
self.node_col.compose_node(
|
||||||
|
name='test', description='this is a test node',
|
||||||
|
processor_req=[{
|
||||||
|
'TotalCores': 4,
|
||||||
|
'Oem': {
|
||||||
|
'Brand': 'E3',
|
||||||
|
'Capabilities': [0]
|
||||||
|
}
|
||||||
|
}])
|
||||||
|
@ -43,7 +43,11 @@ class NodeCollectionTestCase(testtools.TestCase):
|
|||||||
'Description': 'this is a test node',
|
'Description': 'this is a test node',
|
||||||
'Processors': [{
|
'Processors': [{
|
||||||
'TotalCores': 4,
|
'TotalCores': 4,
|
||||||
'ProcessorType': 'FPGA'
|
'ProcessorType': 'FPGA',
|
||||||
|
'Oem': {
|
||||||
|
'Brand': 'Platinum',
|
||||||
|
'Capabilities': ['sse']
|
||||||
|
}
|
||||||
}],
|
}],
|
||||||
'Memory': [{
|
'Memory': [{
|
||||||
'CapacityMiB': 8000
|
'CapacityMiB': 8000
|
||||||
@ -60,7 +64,12 @@ class NodeCollectionTestCase(testtools.TestCase):
|
|||||||
name='test', description='this is a test node',
|
name='test', description='this is a test node',
|
||||||
processor_req=[{
|
processor_req=[{
|
||||||
'TotalCores': 4,
|
'TotalCores': 4,
|
||||||
'ProcessorType': 'FPGA'}],
|
'ProcessorType': 'FPGA',
|
||||||
|
'Oem': {
|
||||||
|
'Brand': 'Platinum',
|
||||||
|
'Capabilities': ['sse']
|
||||||
|
}
|
||||||
|
}],
|
||||||
memory_req=[{'CapacityMiB': 8000}],
|
memory_req=[{'CapacityMiB': 8000}],
|
||||||
security_req={
|
security_req={
|
||||||
'TpmPresent': True,
|
'TpmPresent': True,
|
||||||
@ -86,6 +95,51 @@ class NodeCollectionTestCase(testtools.TestCase):
|
|||||||
'TotalCores': 4,
|
'TotalCores': 4,
|
||||||
'ProcessorType': 'invalid'}])
|
'ProcessorType': 'invalid'}])
|
||||||
|
|
||||||
|
# Wrong processor Oem Brand
|
||||||
|
with self.assertRaisesRegex(
|
||||||
|
jsonschema.exceptions.ValidationError,
|
||||||
|
("'invalid' is not one of \['E3', 'E5'")):
|
||||||
|
|
||||||
|
self.node_col.compose_node(
|
||||||
|
name='test', description='this is a test node',
|
||||||
|
processor_req=[{
|
||||||
|
'TotalCores': 4,
|
||||||
|
'Oem': {
|
||||||
|
'Brand': 'invalid',
|
||||||
|
'Capabilities': ['sse']
|
||||||
|
}
|
||||||
|
}])
|
||||||
|
|
||||||
|
# Wrong processor Oem Capabilities
|
||||||
|
with self.assertRaisesRegex(
|
||||||
|
jsonschema.exceptions.ValidationError,
|
||||||
|
("'sse' is not of type 'array'")):
|
||||||
|
|
||||||
|
self.node_col.compose_node(
|
||||||
|
name='test', description='this is a test node',
|
||||||
|
processor_req=[{
|
||||||
|
'TotalCores': 4,
|
||||||
|
'Oem': {
|
||||||
|
'Brand': 'E3',
|
||||||
|
'Capabilities': 'sse'
|
||||||
|
}
|
||||||
|
}])
|
||||||
|
|
||||||
|
# Wrong processor Oem Capabilities
|
||||||
|
with self.assertRaisesRegex(
|
||||||
|
jsonschema.exceptions.ValidationError,
|
||||||
|
("0 is not of type 'string'")):
|
||||||
|
|
||||||
|
self.node_col.compose_node(
|
||||||
|
name='test', description='this is a test node',
|
||||||
|
processor_req=[{
|
||||||
|
'TotalCores': 4,
|
||||||
|
'Oem': {
|
||||||
|
'Brand': 'E3',
|
||||||
|
'Capabilities': [0]
|
||||||
|
}
|
||||||
|
}])
|
||||||
|
|
||||||
# Wrong security parameter "TpmPresent"
|
# Wrong security parameter "TpmPresent"
|
||||||
with self.assertRaisesRegex(
|
with self.assertRaisesRegex(
|
||||||
jsonschema.exceptions.ValidationError,
|
jsonschema.exceptions.ValidationError,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user