Skip to content

Commit

Permalink
Update schema to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
manali-deshmukh committed Apr 29, 2019
1 parent 49c37a3 commit 9417e48
Show file tree
Hide file tree
Showing 70 changed files with 13,482 additions and 236 deletions.
5 changes: 5 additions & 0 deletions oneview_redfish_toolkit/api/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def __init__(self, oneview_message):
self.redfish["@odata.type"] = self.get_odata_type()
self.redfish["@odata.context"] = "/redfish/v1/$metadata#Event.Event"
self.redfish["[email protected]"] = 1
self.redfish["@odata.id"] = "/redfish/v1/EventService/Event"
self.redfish["Events"] = list()

if (category == "alerts"):
Expand All @@ -76,6 +77,8 @@ def build_event_from_alert(self, oneview_alert):
event_record["EventTimestamp"] = oneview_alert["timestamp"]
event_record["EventType"] = "Alert"
event_record["MessageId"] = "Base.1.1.Success"
event_record["@odata.id"] = "/redfish/v1/EventService/Event/1"
event_record["MemberId"] = "1"
# TODO(svoboda) add link to Redfish resource
# event_record["OriginOfCondition"] = origin_of_condition

Expand All @@ -92,6 +95,8 @@ def build_event_from_task(self, oneview_task):
event_record["EventType"] = \
ONEVIEW_TO_REDFISH_EVENTS[oneview_task["changeType"]]
event_record["MessageId"] = "Base.1.1.Success"
event_record["@odata.id"] = "/redfish/v1/EventService/Event/1"
event_record["MemberId"] = "1"
# TODO(svoboda) add link to Redfish resource
# event_record["OriginOfCondition"] = origin_of_condition

Expand Down
4 changes: 2 additions & 2 deletions oneview_redfish_toolkit/api/redfish_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class RedfishError(RedfishJsonValidator):
"""

SCHEMA_NAME = None
SCHEMA_NAME = "Message"

def __init__(self, code, message):
"""Constructor
Expand Down Expand Up @@ -103,7 +103,7 @@ def add_extended_info(

# Construct the dict
extended_info = collections.OrderedDict()
extended_info["@odata.type"] = "#Message.v1_0_5.Message"
extended_info["@odata.type"] = self.get_odata_type() + ".Message"
extended_info["MessageId"] = "Base.1.1." + message_id
extended_info["Message"] = message
extended_info["RelatedProperties"] = related_properties
Expand Down
48 changes: 24 additions & 24 deletions oneview_redfish_toolkit/api/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,45 +20,45 @@
"""

SCHEMAS = {
"ServiceRoot": "ServiceRoot.v1_3_1.json",
"ServiceRoot": "ServiceRoot.v1_5_0.json",
"ChassisCollection": "ChassisCollection.json",
"Chassis": "Chassis.v1_7_0.json",
"CollectionCapabilities": "CollectionCapabilities.v1_0_0.json",
"CompositionService": "CompositionService.v1_0_1.json",
"Chassis": "Chassis.v1_9_0.json",
"CollectionCapabilities": "CollectionCapabilities.v1_1_1.json",
"CompositionService": "CompositionService.v1_1_0.json",
"ComputerSystemCollection": "ComputerSystemCollection.json",
"ComputerSystem": "ComputerSystem.v1_5_0.json",
"Drive": "Drive.v1_4_0.json",
"ComputerSystem": "ComputerSystem.v1_6_0.json",
"Drive": "Drive.v1_5_1.json",
"ManagerCollection": "ManagerCollection.json",
"Manager": "Manager.v1_4_0.json",
"EthernetInterface": "EthernetInterface.v1_4_0.json",
"Manager": "Manager.v1_5_1.json",
"EthernetInterface": "EthernetInterface.v1_4_1.json",
"EthernetInterfaceCollection": "EthernetInterfaceCollection.json",
"EventService": "EventService.v1_1_0.json",
"EventDestination": "EventDestination.v1_3_0.json",
"Event": "Event.v1_2_1.json",
"Thermal": "Thermal.v1_4_0.json",
"EventService": "EventService.v1_2_0.json",
"EventDestination": "EventDestination.v1_4_0.json",
"Event": "Event.v1_3_1.json",
"Thermal": "Thermal.v1_5_1.json",
"StorageCollection": "StorageCollection.json",
"Storage": "Storage.v1_4_0.json",
"Message": "Message.v1_0_5.json",
"Storage": "Storage.v1_6_0.json",
"Message": "Message.v1_0_6.json",
"NetworkInterfaceCollection": "NetworkInterfaceCollection.json",
"NetworkPortCollection": "NetworkPortCollection.json",
"NetworkDeviceFunctionCollection": "NetworkDeviceFunctionCollection.json",
"NetworkDeviceFunction": "NetworkDeviceFunction.v1_2_1.json",
"NetworkInterface": "NetworkInterface.v1_1_0.json",
"NetworkDeviceFunction": "NetworkDeviceFunction.v1_3_1.json",
"NetworkInterface": "NetworkInterface.v1_1_1.json",
"NetworkAdapterCollection": "NetworkAdapterCollection.json",
"NetworkAdapter": "NetworkAdapter.v1_1_0.json",
"NetworkPort": "NetworkPort.v1_1_0.json",
"Processor": "Processor.v1_3_0.json",
"NetworkAdapter": "NetworkAdapter.v1_2_0.json",
"NetworkPort": "NetworkPort.v1_2_1.json",
"Processor": "Processor.v1_4_0.json",
"ProcessorCollection": "ProcessorCollection.json",
"ResourceBlockCollection": "ResourceBlockCollection.json",
"ResourceBlock": "ResourceBlock.v1_1_0.json",
"VLanNetworkInterface": "VLanNetworkInterface.v1_1_1.json",
"ResourceBlock": "ResourceBlock.v1_3_0.json",
"VLanNetworkInterface": "VLanNetworkInterface.v1_1_2.json",
"VLanNetworkInterfaceCollection": "VLanNetworkInterfaceCollection.json",
"ZoneCollection": "ZoneCollection.json",
"Zone": "Zone.v1_2_0.json",
"Session": "Session.v1_1_0.json",
"Zone": "Zone.v1_2_1.json",
"Session": "Session.v1_1_1.json",
"SessionCollection": "SessionCollection.json",
"EventDestinationCollection": "EventDestinationCollection.json",
"SessionService": "SessionService.v1_1_3.json",
"SessionService": "SessionService.v1_1_4.json",
"VolumeCollection": "VolumeCollection.json",
"Volume": "Volume.v1_0_3.json"
}
Expand Down
10 changes: 9 additions & 1 deletion oneview_redfish_toolkit/api/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,27 @@ def build_for_composed_system(server_profile, server_hardware_type,
attrs["Status"]["Health"] = ok_struct["Health"]
attrs["StorageControllers"] = list()

storage_controller_count = 0
# adapter storage capabilities (if any)
for adapter in server_hardware_type['adapters']:
if adapter['storageCapabilities']:
new_capability = collections.OrderedDict()
new_capability["SupportedDeviceProtocols"] = sorted(
Storage._map_supported_device_protos(drive_technologies))
new_capability["@odata.id"] = attrs["@odata.id"] + \
"#/StorageControllers/" + str(storage_controller_count)
new_capability["MemberId"] = str(storage_controller_count)
storage_controller_count = storage_controller_count + 1
attrs["StorageControllers"].append(new_capability)

# internal storage capabilities
storage_controllers = collections.OrderedDict()
storage_controllers["Manufacturer"] = "HPE"
storage_controllers["SupportedDeviceProtocols"] = \
sorted(Storage._map_supported_device_protos(drive_technologies))
storage_controllers["@odata.id"] = attrs["@odata.id"] + \
"#/StorageControllers/" + str(storage_controller_count)
storage_controllers["MemberId"] = str(storage_controller_count)
attrs["StorageControllers"].append(storage_controllers)

count_drives_by_jbod = \
Expand Down Expand Up @@ -158,7 +166,7 @@ def build_for_resource_block(storage_block):

if storage_block["category"] == "storage-volumes":
attrs["Volumes"] = {
"@data.id": odata_id + "/Volumes/1"
"@odata.id": odata_id + "/Volumes/1"
}
else:
attrs["Drives"] = [
Expand Down
2 changes: 2 additions & 0 deletions oneview_redfish_toolkit/api/thermal.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def __init__(self, utilization, uuid, name):
self.redfish["Name"] = name + " Thermal"
self.redfish["Temperatures"] = list()
self.redfish["Temperatures"].append(collections.OrderedDict())
self.redfish["Temperatures"][0]["@odata.id"] = "/redfish/v1/" + \
"Chassis/" + uuid + "/Thermal#/Temperatures/1"
self.redfish["Temperatures"][0]["MemberId"] = "1"
self.redfish["Temperatures"][0]["Name"] = "AmbientTemperature"
self.redfish["Temperatures"][0]["Status"] = collections.OrderedDict()
Expand Down
3 changes: 3 additions & 0 deletions oneview_redfish_toolkit/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ def load_schemas(schema_dir):
file_name = path.split('\\')[-1]
else:
file_name = path.split('/')[-1]
if file_name == "VolumeCollection.json" or "Volume.json":
stored_schemas["http://redfish.dmtf.org/schemas/swordfish/v1/" +
file_name] = json_schema
stored_schemas["http://redfish.dmtf.org/schemas/v1/" + file_name] = \
json_schema

Expand Down
2 changes: 1 addition & 1 deletion oneview_redfish_toolkit/mockups/errors/Error500.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"message": "An exception has occurred",
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_0_5.Message",
"@odata.type": "#Message.v1_0_6.Message",
"MessageId": "Base.1.1.InternalError",
"Message": "The request failed due to an internal service error. The service is still operational.",
"RelatedProperties": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"message": "A general error has occurred. See ExtendedInfo for more information.",
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_0_5.Message",
"@odata.type": "#Message.v1_0_6.Message",
"MessageId": "Base.1.1.PropertyValueNotInList",
"Message": "The value RED for the property IndicatorLED is not in the list of acceptable values.",
"RelatedProperties": [
Expand All @@ -18,7 +18,7 @@
"Resolution": "Choose a value from the enumeration list that the implementation can support and resubmit the request if the operation failed."
},
{
"@odata.type": "#Message.v1_0_5.Message",
"@odata.type": "#Message.v1_0_6.Message",
"MessageId": "Base.1.1.PropertyNotWritable",
"Message": "The property SKU is a read only property and cannot be assigned a value.",
"RelatedProperties": [
Expand Down
9 changes: 6 additions & 3 deletions oneview_redfish_toolkit/mockups/redfish/Alert.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{
"@odata.type": "#Event.v1_2_0.Event",
"@odata.type": "#Event.v1_3_1.Event",
"@odata.context": "/redfish/v1/$metadata#Event.Event",
"[email protected]": 1,
"[email protected]": 1,
"@odata.id": "/redfish/v1/EventService/Event",
"Events": [{
"MemberId": "1",
"EventType": "Alert",
"EventTimestamp": "2018-02-12T20:12:03.231Z",
"@odata.id": "/redfish/v1/EventService/Event/1",
"MessageId": "Base.1.1.Success"
}],
"Id": "30373737-3237-4D32-3230-313530314752",
"Name": "0000A66101, bay 3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"Name": "Blade Thermal",
"Temperatures": [
{
"@odata.id": "/redfish/v1/Chassis/36343537-3338-4448-3538-4E5030333434/Thermal#/Temperatures/1",
"MemberId": "1",
"Name": "AmbientTemperature",
"Status": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
}
}
],
"@odata.type": "#CollectionCapabilities.v1_0_0"
"@odata.type": "#CollectionCapabilities.v1_1_1"
},
"@odata.context": "/redfish/v1/$metadata#ComputerSystemCollection.ComputerSystemCollection",
"@odata.id": "/redfish/v1/Systems"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"Members": [],
"@Redfish.CollectionCapabilities": {
"Capabilities": [],
"@odata.type": "#CollectionCapabilities.v1_0_0"
"@odata.type": "#CollectionCapabilities.v1_1_1"
},
"@odata.context": "/redfish/v1/$metadata#ComputerSystemCollection.ComputerSystemCollection",
"@odata.id": "/redfish/v1/Systems"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"Name": "Enclosure Thermal",
"Temperatures": [
{
"@odata.id": "/redfish/v1/Chassis/0000000000A66101/Thermal#/Temperatures/1",
"MemberId": "1",
"Name": "AmbientTemperature",
"Status": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Name": "externalVolume",
"Id": "1",
"Volumes": {
"@data.id": "/redfish/v1/CompositionService/ResourceBlocks/B526F59E-9BC7-467F-9205-A9F4015CE296/Storage/1/Volumes/1"
"@odata.id": "/redfish/v1/CompositionService/ResourceBlocks/B526F59E-9BC7-467F-9205-A9F4015CE296/Storage/1/Volumes/1"
},
"@odata.id": "/redfish/v1/CompositionService/ResourceBlocks/B526F59E-9BC7-467F-9205-A9F4015CE296/Storage/1",
"Status": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"Id": "1f0ca9ef-7f81-45e3-9d64-341b46cf87e0",
"Name": "Composed System Using Redfish",
"Description": "Description for Composed System",
"@odata.id": "/redfish/v1/Systems",
"@odata.type": "#ComputerSystemCollection.ComputerSystemCollection",
"Links": {
"ResourceBlocks": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"Id": "75871d70-789e-4cf9-8bc8-6f4d73193578",
"Description": "Description for Composed System",
"Name": "Composed System Using Redfish",
"@odata.id": "/redfish/v1/Systems",
"@odata.type": "#ComputerSystemCollection.ComputerSystemCollection",
"Links": {
"ResourceBlocks": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"Name": "Rack Thermal",
"Temperatures": [
{
"@odata.id": "/redfish/v1/Chassis/2AB100LMNB/Thermal#/Temperatures/1",
"MemberId": "1",
"Name": "AmbientTemperature",
"Status": {
Expand Down
10 changes: 7 additions & 3 deletions oneview_redfish_toolkit/mockups/redfish/Storage.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"@odata.id": "/redfish/v1/Systems/b425802b-a6a5-4941-8885-aab68dfa2ee2/Storage/1",
"@odata.context": "/redfish/v1/$metadata#Storage.Storage",
"@odata.type": "#Storage.v1_4_0.Storage",
"@odata.type": "#Storage.v1_6_0.Storage",
"[email protected]": 1,
"Id": "1",
"Name": "Storage Controller",
Expand All @@ -14,14 +14,18 @@
"SupportedDeviceProtocols": [
"SAS",
"SATA"
]
],
"@odata.id": "/redfish/v1/Systems/b425802b-a6a5-4941-8885-aab68dfa2ee2/Storage/1#/StorageControllers/0",
"MemberId": "0"
},
{
"Manufacturer": "HPE",
"SupportedDeviceProtocols": [
"SAS",
"SATA"
]
],
"@odata.id": "/redfish/v1/Systems/b425802b-a6a5-4941-8885-aab68dfa2ee2/Storage/1#/StorageControllers/1",
"MemberId": "1"
}
],
"[email protected]": 4,
Expand Down
4 changes: 2 additions & 2 deletions oneview_redfish_toolkit/mockups/redfish/Zone.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@odata.type": "#Zone.v1_1_0.Zone",
"@odata.type": "#Zone.v1_2_1.Zone",
"Id": "1f0ca9ef-7f81-45e3-9d64-341b46cf87e0-0000000000A66101",
"Name": "Apache_Template - 0000A66101",
"Status": {
Expand Down Expand Up @@ -41,7 +41,7 @@
]
},
"@Redfish.CollectionCapabilities": {
"@odata.type": "#CollectionCapabilities.v1_0_0",
"@odata.type": "#CollectionCapabilities.v1_1_1",
"Capabilities": [
{
"CapabilitiesObject": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@odata.type": "#Zone.v1_2_0.Zone",
"@odata.type": "#Zone.v1_2_1.Zone",
"Id": "1f0ca9ef-7f81-45e3-9d64-341b46cf87e0-0000000000A66101",
"Name": "Apache_Template - 0000A66101",
"Status": {
Expand Down Expand Up @@ -44,7 +44,7 @@
]
},
"@Redfish.CollectionCapabilities": {
"@odata.type": "#CollectionCapabilities.v1_0_0",
"@odata.type": "#CollectionCapabilities.v1_1_1",
"Capabilities": [
{
"CapabilitiesObject": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@odata.type": "#Zone.v1_1_0.Zone",
"@odata.type": "#Zone.v1_2_1.Zone",
"Id": "1f0ca9ef-7f81-45e3-9d64-341b46cf87e0",
"Name": "Apache_Template",
"Status": {
Expand All @@ -26,7 +26,7 @@
]
},
"@Redfish.CollectionCapabilities": {
"@odata.type": "#CollectionCapabilities.v1_0_0",
"@odata.type": "#CollectionCapabilities.v1_1_1",
"Capabilities": [
{
"CapabilitiesObject": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"@odata.type": "#Zone.v1_1_0.Zone",
"@odata.type": "#Zone.v1_2_1.Zone",
"Id": "1f0ca9ef-7f81-45e3-9d64-341b46cf87e0-0000000000A66101",
"Name": "Apache_Template - 0000A66101",
"Status": {
Expand All @@ -26,7 +26,7 @@
]
},
"@Redfish.CollectionCapabilities": {
"@odata.type": "#CollectionCapabilities.v1_0_0",
"@odata.type": "#CollectionCapabilities.v1_1_1",
"Capabilities": [
{
"CapabilitiesObject": {
Expand Down
Loading

0 comments on commit 9417e48

Please sign in to comment.