Skip to content

Commit 3699a20

Browse files
authored
Changed to support paradise (#13)
Changed version to 1.6.0 Added exception for XD224 Paradise when creating a subscription Paradise does not have the field 'EventTypesForSubscription'. This changes the POST and PUT subscription code to not validate the event type if the field is not present.
1 parent 097ab66 commit 3699a20

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.4
1+
1.6.0

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ Removed - for now removed features
2323
Fixed - for any bug fixes
2424
Security - in case of vulnerabilities
2525
-->
26+
## [1.6.0] - 2024-08-23
27+
28+
### Added
29+
30+
- Added support for XD224 Paradise. The mockup is not included.
31+
2632
## [1.5.3] - 2023-11-02
2733

2834
### Added

src/api_emulator/redfish/event_service_api.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# BSD 3-Clause License
22
#
3-
# Copyright 2022-2023 Hewlett Packard Enterprise Development LP
3+
# Copyright 2022-2024 Hewlett Packard Enterprise Development LP
44
#
55
# Redistribution and use in source and binary forms, with or without
66
# modification, are permitted provided that the following conditions are met:
@@ -59,7 +59,7 @@
5959
s_config = {}
6060
s_generator = None
6161
members = {}
62-
required = {'Destination', 'EventTypes'}
62+
required = {'Destination'} # Fields required for POST subscription
6363
eventTemplates = {}
6464
id = 1
6565

@@ -213,11 +213,13 @@ def post(self):
213213
return simple_error_response('%s is required' % (field) , 400)
214214
ident = '%d' % id
215215

216-
destination = raw_dict['Destination']
217-
event_types = raw_dict['EventTypes']
218-
for evType in event_types:
219-
if evType not in e_config['EventTypesForSubscription']:
220-
return 'Invalid EventType %s' % evType, 400
216+
destination = raw_dict.get('Destination', '')
217+
event_types = raw_dict.get('EventTypes', '')
218+
if 'EventTypesForSubscription' in e_config: # XD224 Paradise does not have this field
219+
for evType in event_types:
220+
if evType not in e_config['EventTypesForSubscription']:
221+
return 'Invalid EventType %s' % evType, 400
222+
221223
if 'Context' in raw_dict:
222224
context = raw_dict['Context']
223225
else:
@@ -305,9 +307,10 @@ def patch(self, ident):
305307
return 'Field %s is not patchable' % field, 400
306308
else:
307309
if field == 'RegistryPrefixes' and value != []:
308-
for evType in value:
309-
if evType not in e_config['EventTypesForSubscription']:
310-
return 'Invalid EventType %s' % evType, 400
310+
if 'EventTypesForSubscription' in e_config: # XD224 Paradise does not have this field
311+
for evType in value:
312+
if evType not in e_config['EventTypesForSubscription']:
313+
return 'Invalid EventType %s' % evType, 400
311314
members[ident][field] = value
312315
resp = success_response('PATCH request successful', 200)
313316
except Exception:

0 commit comments

Comments
 (0)