Correct all RSD 2.2 files format
Change-Id: Ica2dfbbd7790b315e65e7fc307c6945341d2fa4f
This commit is contained in:
parent
0d79c5eaa1
commit
fd06e61219
@ -13,48 +13,38 @@
|
||||
# under the License.
|
||||
|
||||
report_definition_req_schema = {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'Name': {'type': 'string'},
|
||||
'Schedule': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'RecurrenceInterval': {'type': 'string'},
|
||||
}
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Name": {"type": "string"},
|
||||
"Schedule": {
|
||||
"type": "object",
|
||||
"properties": {"RecurrenceInterval": {"type": "string"}},
|
||||
},
|
||||
'MetricReportType': {
|
||||
'type': 'string',
|
||||
'enum': ['OnChange', 'Periodic', 'OnRequests']
|
||||
"MetricReportType": {
|
||||
"type": "string",
|
||||
"enum": ["OnChange", "Periodic", "OnRequests"],
|
||||
},
|
||||
'CollectionTimeScope': {
|
||||
'type': 'string',
|
||||
'enum': ['Point', 'Interval', 'StartupInterval']
|
||||
"CollectionTimeScope": {
|
||||
"type": "string",
|
||||
"enum": ["Point", "Interval", "StartupInterval"],
|
||||
},
|
||||
'ReportActions': {
|
||||
'type': 'array',
|
||||
'items': {
|
||||
'type': 'string',
|
||||
'enum': ['Transmit', 'Log']
|
||||
}
|
||||
"ReportActions": {
|
||||
"type": "array",
|
||||
"items": {"type": "string", "enum": ["Transmit", "Log"]},
|
||||
},
|
||||
'MetricReport': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'@odata.id': {'type': 'string'}
|
||||
}
|
||||
"MetricReport": {
|
||||
"type": "object",
|
||||
"properties": {"@odata.id": {"type": "string"}},
|
||||
},
|
||||
'Status': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'State': {'type': 'string'},
|
||||
'Health': {'type': 'string'},
|
||||
'HealthRollup': {'type': 'string'}
|
||||
}
|
||||
"Status": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"State": {"type": "string"},
|
||||
"Health": {"type": "string"},
|
||||
"HealthRollup": {"type": "string"},
|
||||
},
|
||||
},
|
||||
'MetricProperties': {
|
||||
'type': 'array',
|
||||
'items': {'type': 'string'}
|
||||
}
|
||||
"MetricProperties": {"type": "array", "items": {"type": "string"}},
|
||||
},
|
||||
'additionalProperties': False
|
||||
"additionalProperties": False,
|
||||
}
|
||||
|
@ -22,20 +22,23 @@ from rsd_lib.resources.v2_2.fabric import port
|
||||
|
||||
|
||||
class PortTestCase(testtools.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(PortTestCase, self).setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('rsd_lib/tests/unit/json_samples/v2_2/fabrics_port.json',
|
||||
'r') as f:
|
||||
with open(
|
||||
"rsd_lib/tests/unit/json_samples/v2_2/fabrics_port.json", "r"
|
||||
) as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
|
||||
self.port_inst = port.Port(
|
||||
self.conn, '/redfish/v1/Fabrics/PCIe/Switches/1/Ports/Up1',
|
||||
redfish_version='1.0.2')
|
||||
self.conn,
|
||||
"/redfish/v1/Fabrics/PCIe/Switches/1/Ports/Up1",
|
||||
redfish_version="1.0.2",
|
||||
)
|
||||
|
||||
def test__parse_attributes(self):
|
||||
self.port_inst._parse_attributes()
|
||||
self.assertEqual('/redfish/v1/Fabrics/PCIe/Switches/1/'
|
||||
'Ports/Up1/Metrics',
|
||||
self.port_inst.oem.intel_rackscale.metrics)
|
||||
self.assertEqual(
|
||||
"/redfish/v1/Fabrics/PCIe/Switches/1/Ports/Up1/Metrics",
|
||||
self.port_inst.oem.intel_rackscale.metrics,
|
||||
)
|
||||
|
@ -22,18 +22,21 @@ from rsd_lib.resources.v2_2.update_service import action_info
|
||||
|
||||
|
||||
class ActionInfoTestCase(testtools.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ActionInfoTestCase, self).setUp()
|
||||
self.conn = mock.Mock()
|
||||
with open('rsd_lib/tests/unit/json_samples/v2_2/'
|
||||
'update_service_action_info.json',
|
||||
'r') as f:
|
||||
with open(
|
||||
"rsd_lib/tests/unit/json_samples/v2_2/"
|
||||
"update_service_action_info.json",
|
||||
"r",
|
||||
) as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
|
||||
self.action_info_inst = action_info.ActionInfo(
|
||||
self.conn, '/redfish/v1/UpdateService/SimpleUpdateActionInfo',
|
||||
redfish_version='1.1.0')
|
||||
self.conn,
|
||||
"/redfish/v1/UpdateService/SimpleUpdateActionInfo",
|
||||
redfish_version="1.1.0",
|
||||
)
|
||||
|
||||
def test__parse_attributes(self):
|
||||
self.action_info_inst._parse_attributes()
|
||||
@ -44,57 +47,40 @@ class ActionInfoTestCase(testtools.TestCase):
|
||||
actual_parameters = self.action_info_inst.parameters
|
||||
# | THEN |
|
||||
expected = [
|
||||
{
|
||||
"name": "ImageURI",
|
||||
"required": True,
|
||||
"data_type": "String"
|
||||
},
|
||||
{"name": "ImageURI", "required": True, "data_type": "String"},
|
||||
{
|
||||
"name": "TransferProtocol",
|
||||
"required": False,
|
||||
"data_type": "String",
|
||||
"allowable_values": [
|
||||
|
||||
]
|
||||
"allowable_values": [],
|
||||
},
|
||||
{
|
||||
"name": "Targets",
|
||||
"required": False,
|
||||
"data_type": "StringArray",
|
||||
"allowable_values": [
|
||||
|
||||
]
|
||||
}
|
||||
"allowable_values": [],
|
||||
},
|
||||
]
|
||||
self.assertEqual(expected, actual_parameters)
|
||||
|
||||
# tests for same object on invoking subsequently
|
||||
self.assertIs(actual_parameters,
|
||||
self.action_info_inst.parameters)
|
||||
self.assertIs(actual_parameters, self.action_info_inst.parameters)
|
||||
|
||||
def test_parameters_on_refresh(self):
|
||||
expected = [
|
||||
{
|
||||
"name": "ImageURI",
|
||||
"required": True,
|
||||
"data_type": "String"
|
||||
},
|
||||
{"name": "ImageURI", "required": True, "data_type": "String"},
|
||||
{
|
||||
"name": "TransferProtocol",
|
||||
"required": False,
|
||||
"data_type": "String",
|
||||
"allowable_values": [
|
||||
|
||||
]
|
||||
"allowable_values": [],
|
||||
},
|
||||
{
|
||||
"name": "Targets",
|
||||
"required": False,
|
||||
"data_type": "StringArray",
|
||||
"allowable_values": [
|
||||
|
||||
]
|
||||
}
|
||||
"allowable_values": [],
|
||||
},
|
||||
]
|
||||
self.assertEqual(expected, self.action_info_inst.parameters)
|
||||
|
||||
@ -102,8 +88,11 @@ class ActionInfoTestCase(testtools.TestCase):
|
||||
self.action_info_inst.refresh(force=False)
|
||||
|
||||
# | GIVEN |
|
||||
with open('rsd_lib/tests/unit/json_samples/v2_2/'
|
||||
'update_service_action_info.json', 'r') as f:
|
||||
with open(
|
||||
"rsd_lib/tests/unit/json_samples/v2_2/"
|
||||
"update_service_action_info.json",
|
||||
"r",
|
||||
) as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
# | WHEN & THEN |
|
||||
self.assertEqual(expected, self.action_info_inst.parameters)
|
||||
|
Loading…
x
Reference in New Issue
Block a user