Giter Site home page Giter Site logo

redfish-event-listener's People

Contributors

billdodd avatar hardikspanchal avatar mraineri avatar rgmain avatar tomasg2012 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redfish-event-listener's Issues

REST events not logged with HPE iLO -observed only with Latest available DMTF Listeners

Observing with Latest available DMTF event Listener , when Created the subscription with HPE iLO5 or iLO6 IP ... Initially only few events gets logged .And same single REST event is logged Multiple (around 3-4) times , No any further events getting logged in Listener even there are n-number of state changes. This issue was not observed with Previous DMTF event listener code RedfishEventListener_v1.py , build during 11/26/2021 Time Frame.
In the debugging, Encountered Error as ,
resteven: Event dispatch failed. HTTP:204 for Payload:

{"@odata.context":"/redfish/v1/$metadata#Event.Event","@odata.type":"#Event.v1_2_9.Event","Events":[{"EventId":"8f924994-902e-695f-e40f-c64e4d1a6d5c","EventTimestamp":"2023-05-24T18:24:01Z","EventType":"ResourcFYI(W) resteven: Subscription: 6, Error: 9, HTTP code: 204 Response:

Observing the Event Listener code is returning 204 response. In our iLO code, iLO keeps on retrying till it received 200 OK from Listener . As the Event listener code is returning 204 response consistently for REST events dispatched to Event Listener with POST operation , Connection is getting closed after multiple retires (specified in "DeliveryRetryAttempts") , failing to log further upcoming n -number of REST events

Would need fix from DMTF Event Listener code for this issue, for receiving REST events/Alerts from HPE iLO successfully.

Sample few REST events logged in Listener before closing connection after multiple retries ,
Redfish Event Listener v1.1.3
No subscriptions are specified. Continuing with Listener.
Listening on 16.242.165.180:443 via HTTPS
Press Ctrl-C to close program
..................................................
Socket connected::
headers: IOrderedDict([('HOST', '16.242.165.180'), ('TRANSFER-ENCODING', 'chunked'), ('CONTENT-TYPE', 'application/json'), ('CACHE-CONTROL', 'no-cache'), ('DATE', 'Wed, 24 May 2023 17:47:05 GMT'), ('CONNECTION', 'keep-alive'), ('SENDER-ADDRESS', 'ILOVL9CNP0151.asiapacific.hpqcorp.net')])

bodydata: {"@odata.context":"/redfish/v1/$metadata#Event.Event","@odata.type":"#Event.v1_2_9.Event","Events":[{"EventId":"0ead0a02-b6fa-c759-835c-cbdda6f307a5","EventTimestamp":"2023-05-24T17:47:03Z","EventType":"ResourceAdded","MemberId":"0","MessageId":"iLOEvents.3.9.ResourceAdded","Oem":{"Hpe":{"Hostname":"ILOVL9CNP0151.asiapacific.hpqcorp.net","@odata.context":"/redfish/v1/$metadata#HpeEvent.HpeEvent","@odata.type":"#HpeEvent.v2_2_0.HpeEvent","Resource":"/redfish/v1/EventService/Subscriptions/3"}},"OriginOfCondition":"/redfish/v1/EventService/Subscriptions/3","Severity":"OK"}],"Name":"Events","Context":"ILOVL9CNP0151.asiapacific.hpqcorp.net"}

Server IP Address is 15.119.211.10
Server PORT number is 49556
Listener IP is

Context (ILOVL9CNP0151.asiapacific.hpqcorp.net) does not match with the server (Public123).
Event Counter for Host 15.119.211.10 = 1

..........
Socket connected::
headers: IOrderedDict([('HOST', '16.242.165.180'), ('TRANSFER-ENCODING', 'chunked'), ('CONTENT-TYPE', 'application/json'), ('CACHE-CONTROL', 'no-cache'), ('DATE', 'Wed, 24 May 2023 17:47:36 GMT'), ('CONNECTION', 'keep-alive'), ('SENDER-ADDRESS', 'ILOVL9CNP0151.asiapacific.hpqcorp.net')])

bodydata: {"@odata.context":"/redfish/v1/$metadata#Event.Event","@odata.type":"#Event.v1_2_9.Event","Events":[{"EventId":"0ead0a02-b6fa-c759-835c-cbdda6f307a5","EventTimestamp":"2023-05-24T17:47:03Z","EventType":"ResourceAdded","MemberId":"0","MessageId":"iLOEvents.3.9.ResourceAdded","Oem":{"Hpe":{"Hostname":"ILOVL9CNP0151.asiapacific.hpqcorp.net","@odata.context":"/redfish/v1/$metadata#HpeEvent.HpeEvent","@odata.type":"#HpeEvent.v2_2_0.HpeEvent","Resource":"/redfish/v1/EventService/Subscriptions/3"}},"OriginOfCondition":"/redfish/v1/EventService/Subscriptions/3","Severity":"OK"}],"Name":"Events","Context":"ILOVL9CNP0151.asiapacific.hpqcorp.net"}

Server IP Address is 15.119.211.10
Server PORT number is 54993
Listener IP is

Context (ILOVL9CNP0151.asiapacific.hpqcorp.net) does not match with the server (Public123).
Event Counter for Host 15.119.211.10 = 2

..........
Socket connected::
headers: IOrderedDict([('HOST', '16.242.165.180'), ('TRANSFER-ENCODING', 'chunked'), ('CONTENT-TYPE', 'application/json'), ('CACHE-CONTROL', 'no-cache'), ('DATE', 'Wed, 24 May 2023 17:48:07 GMT'), ('CONNECTION', 'keep-alive'), ('SENDER-ADDRESS', 'ILOVL9CNP0151.asiapacific.hpqcorp.net')])

bodydata: {"@odata.context":"/redfish/v1/$metadata#Event.Event","@odata.type":"#Event.v1_2_9.Event","Events":[{"EventId":"0ead0a02-b6fa-c759-835c-cbdda6f307a5","EventTimestamp":"2023-05-24T17:47:03Z","EventType":"ResourceAdded","MemberId":"0","MessageId":"iLOEvents.3.9.ResourceAdded","Oem":{"Hpe":{"Hostname":"ILOVL9CNP0151.asiapacific.hpqcorp.net","@odata.context":"/redfish/v1/$metadata#HpeEvent.HpeEvent","@odata.type":"#HpeEvent.v2_2_0.HpeEvent","Resource":"/redfish/v1/EventService/Subscriptions/3"}},"OriginOfCondition":"/redfish/v1/EventService/Subscriptions/3","Severity":"OK"}],"Name":"Events","Context":"ILOVL9CNP0151.asiapacific.hpqcorp.net"}

Server IP Address is 15.119.211.10
Server PORT number is 52289
Listener IP is

Context (ILOVL9CNP0151.asiapacific.hpqcorp.net) does not match with the server (Public123).
Event Counter for Host 15.119.211.10 = 3

..........
Socket connected::
headers: IOrderedDict([('HOST', '16.242.165.180'), ('TRANSFER-ENCODING', 'chunked'), ('CONTENT-TYPE', 'application/json'), ('CACHE-CONTROL', 'no-cache'), ('DATE', 'Wed, 24 May 2023 17:48:37 GMT'), ('CONNECTION', 'keep-alive'), ('SENDER-ADDRESS', 'ILOVL9CNP0151.asiapacific.hpqcorp.net')])

bodydata: {"@odata.context":"/redfish/v1/$metadata#Event.Event","@odata.type":"#Event.v1_2_9.Event","Events":[{"EventId":"0ead0a02-b6fa-c759-835c-cbdda6f307a5","EventTimestamp":"2023-05-24T17:47:03Z","EventType":"ResourceAdded","MemberId":"0","MessageId":"iLOEvents.3.9.ResourceAdded","Oem":{"Hpe":{"Hostname":"ILOVL9CNP0151.asiapacific.hpqcorp.net","@odata.context":"/redfish/v1/$metadata#HpeEvent.HpeEvent","@odata.type":"#HpeEvent.v2_2_0.HpeEvent","Resource":"/redfish/v1/EventService/Subscriptions/3"}},"OriginOfCondition":"/redfish/v1/EventService/Subscriptions/3","Severity":"OK"}],"Name":"Events","Context":"ILOVL9CNP0151.asiapacific.hpqcorp.net"}

Server IP Address is 15.119.211.10
Server PORT number is 51998
Listener IP is

Context (ILOVL9CNP0151.asiapacific.hpqcorp.net) does not match with the server (Public123).
Event Counter for Host 15.119.211.10 = 4

...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Server subscription sends deprecated Property EventType deprecated in EventService v1_3_0+

The subscription function attempts to send property EventType, which was deprecated in EventService v1_3_0, so may cause the request to fail on DSP0266 version 1.6.0 compliant servers.

def PerformSubscription():
    global ServerIPs, UserNames, Passwords, Destination, EventTypes, ContextDetail, Protocol, SubscriptionURI, verbose
    ServerIPList = [x for x in ServerIPs.split(",") if x.strip() != '']
    UserNameList = UserNames.split(",")
    PasswordList = Passwords.split(",")
    AttributeNameList = ['Destination', 'EventTypes', 'Context', 'Protocol']
    AttributeValueList = [Destination, EventTypes, ContextDetail, Protocol]

{"@Message.ExtendedInfo":[{"MessageArgs":["EventTypes"],"Resolution":"Remove the unknown property from the request body and resubmit the request if the operation failed.","MessageId":"Base.1.6.PropertyUnknown","Severity":"Warning","Message":"The property EventTypes is not in the list of valid properties for the resource.","@odata.type":"#Message.v1_0_8.Message"}]

Event listener fails to receive redfish event immediately

Redfish event listener is being ran on local machine. A listener is receiving each event after 30s.
System(server) log was analyzed, observed that system was failed to receive a response and enter into retrial mode. Identified an issue about connection. After each response from listener to system(server), connection must be closed and a signal for closing a connection should come form listener.
I checked in POST method section, https://github.com/DMTF/Redfish-Event-Listener/blob/master/RedfishEventListener_v1.py#L122-L123, Status code is sent as response only. Response need to has "Connection: close" message as general-header with status code. I applied the change to this file in my local machine and tested, a connection was closed successfully after response complete.

Applied changed in RedfishEventListener_v1.py:

diff --git a/RedfishEventListener_v1.py b/RedfishEventListener_v1.py
index 40662bc..43c4cdd 100644
--- a/RedfishEventListener_v1.py
+++ b/RedfishEventListener_v1.py
@@ -119,8 +119,10 @@ def process_data(newsocketconn, fromaddr):
                 if config['contextdetail'] is not None and outdata.get('Context', None) != config['contextdetail']:
                     my_logger.info("Context ({}) does not match with the server ({})."
                           .format(outdata.get('Context', None), config['contextdetail']))
-                StatusCode = """HTTP/1.1 200 OK\r\n\r\n"""
-                connstreamout.send(bytes(StatusCode, 'UTF-8'))
+                res = "HTTP/1.1 200 OK\r\n" \
+                      "Connection: close\r\n" \
+                      "\r\n"
+                connstreamout.send(res.encode())

System log after fix:

Apr 05 05:11:47 obmc bmcweb[396]: (2022-04-05 05:11:47) [DEBUG "http_client.hpp":165] SSL Handshake successfull
Apr 05 05:11:47 obmc bmcweb[396]: (2022-04-05 05:11:47) [DEBUG "http_client.hpp":189] sendMessage() bytes transferred: 618
Apr 05 05:11:47 obmc bmcweb[396]: (2022-04-05 05:11:47) [DEBUG "http_client.hpp":224] recvMessage() bytes transferred: 38
Apr 05 05:11:47 obmc bmcweb[396]: (2022-04-05 05:11:47) [DEBUG "http_client.hpp":240] recvMessage() Header Response Code: 200
**Apr 05 05:11:47 obmc bmcweb[396]: (2022-04-05 05:11:47) [DEBUG "http_client.hpp":263] recvMessage() keepalive : 0**
**Apr 05 05:11:47 obmc bmcweb[396]: (2022-04-05 05:11:47) [INFO "http_client.hpp":323] doClose(): Connection closed by server.**
**Apr 05 05:11:47 obmc bmcweb[396]: (2022-04-05 05:11:47) [DEBUG "http_client.hpp":459] requestDataQueue is empty**

System log Before fix

Mar 30 01:05:23 obmc bmcweb[402]: Event subscription added(Id: 1696563194)
Mar 30 01:05:23 obmc bmcweb[402]: (2022-03-30 01:05:23) [DEBUG "http_response.hpp":128] completion handler was valid
Mar 30 01:05:23 obmc bmcweb[402]: (2022-03-30 01:05:23) [INFO "http_connection.hpp":444] Response: 0xdf7128 /redfish/v1/EventService/Subscriptions 201 keepalive=1
Mar 30 01:05:23 obmc bmcweb[402]: (2022-03-30 01:05:23) [DEBUG "http_connection.hpp":641] 0xdf7128 doWrite
Mar 30 01:05:23 obmc bmcweb[402]: (2022-03-30 01:05:23) [DEBUG "http_connection.hpp":650] 0xdf7128 async_write 900 bytes
Mar 30 01:05:23 obmc bmcweb[402]: (2022-03-30 01:05:23) [DEBUG "http_connection.hpp":668] 0xdf7128 Clearing response
Mar 30 01:05:23 obmc bmcweb[402]: (2022-03-30 01:05:23) [DEBUG "http_response.hpp":106] 0xdf9400 Clearing response containers
Mar 30 01:05:23 obmc bmcweb[402]: (2022-03-30 01:05:23) [DEBUG "http_connection.hpp":536] 0xdf7128 doReadHeaders
Mar 30 01:05:23 obmc bmcweb[402]: (2022-03-30 01:05:23) [ERROR "event_service_manager.hpp":862] Map size Before Delete : 1
Mar 30 01:05:23 obmc bmcweb[402]: (2022-03-30 01:05:23) [ERROR "event_service_manager.hpp":917] Map size After Delete : 1
Mar 30 01:05:23 obmc bmcweb[402]: (2022-03-30 01:05:23) [DEBUG "http_client.hpp":96] Trying to resolve: <LISTENER-IP>:5008
Mar 30 01:05:23 obmc bmcweb[402]: (2022-03-30 01:05:23) [DEBUG "async_resolve.hpp":27] Trying to resolve: <LISTENER-IP>:5008
Mar 30 01:05:23 obmc bmcweb[402]: (2022-03-30 01:05:23) [DEBUG "async_resolve.hpp":42] ResolveHostname returned: <LISTENER-IP>:786945
Mar 30 01:05:23 obmc bmcweb[402]: (2022-03-30 01:05:23) [DEBUG "async_resolve.hpp":51] ipv4 address
Mar 30 01:05:23 obmc bmcweb[402]: (2022-03-30 01:05:23) [DEBUG "async_resolve.hpp":86] resolved endpoint is : <LISTENER-IP>:5008
Mar 30 01:05:23 obmc bmcweb[402]: (2022-03-30 01:05:23) [DEBUG "http_client.hpp":110] Resolved
Mar 30 01:05:23 obmc bmcweb[402]: (2022-03-30 01:05:23) [DEBUG "http_client.hpp":122] Trying to connect to: <LISTENER-IP>:5008
Mar 30 01:05:23 obmc bmcweb[402]: (2022-03-30 01:05:23) [DEBUG "http_client.hpp":135] Connected to: <LISTENER-IP>:5008
Mar 30 01:05:24 obmc bmcweb[402]: (2022-03-30 01:05:24) [DEBUG "http_client.hpp":165] SSL Handshake successfull
Mar 30 01:05:24 obmc bmcweb[402]: (2022-03-30 01:05:24) [DEBUG "http_client.hpp":189] sendMessage() bytes transferred: 636
Mar 30 01:05:24 obmc bmcweb[402]: (2022-03-30 01:05:24) [DEBUG "http_client.hpp":224] recvMessage() bytes transferred: 19
Mar 30 01:05:24 obmc bmcweb[402]: (2022-03-30 01:05:24) [DEBUG "http_client.hpp":240] recvMessage() Header Response Code: 200
**Mar 30 01:05:24 obmc bmcweb[402]: (2022-03-30 01:05:24) [DEBUG "http_client.hpp":263] recvMessage() keepalive : 1**
**Mar 30 01:05:24 obmc bmcweb[402]: (2022-03-30 01:05:24) [DEBUG "http_client.hpp":490] requestDataQueue is empty**
Mar 30 01:05:59 obmc bmcweb[402]: (2022-03-30 01:05:59) [ERROR "event_service_manager.hpp":862] Map size Before Delete : 1
Mar 30 01:05:59 obmc bmcweb[402]: (2022-03-30 01:05:59) [ERROR "event_service_manager.hpp":917] Map size After Delete : 1
**Mar 30 01:05:59 obmc bmcweb[402]: (2022-03-30 01:05:59) [DEBUG "http_client.hpp":189] sendMessage() bytes transferred: 618**
**Mar 30 01:05:59 obmc bmcweb[402]: (2022-03-30 01:05:59) [DEBUG "http_client.hpp":224] recvMessage() bytes transferred: 0**
**Mar 30 01:05:59 obmc bmcweb[402]: (2022-03-30 01:05:59) [ERROR "http_client.hpp":232] recvMessage() parser failed to receive response**
**Mar 30 01:05:59 obmc bmcweb[402]: (2022-03-30 01:05:59) [DEBUG "http_client.hpp":408] Attempt retry after 30 seconds. RetryCount = 1**
**Mar 30 01:06:29 obmc bmcweb[402]: (2022-03-30 01:06:29) [ERROR "http_client.hpp":322] doClose() failed: Broken pipe**
Mar 30 01:06:29 obmc bmcweb[402]: (2022-03-30 01:06:29) [DEBUG "http_client.hpp":96] Trying to resolve: <LISTENER-IP>:5008
Mar 30 01:06:29 obmc bmcweb[402]: (2022-03-30 01:06:29) [DEBUG "async_resolve.hpp":27] Trying to resolve: <LISTENER-IP>:5008
Mar 30 01:06:29 obmc bmcweb[402]: (2022-03-30 01:06:29) [DEBUG "async_resolve.hpp":42] ResolveHostname returned: <LISTENER-IP>:786945
Mar 30 01:06:29 obmc bmcweb[402]: (2022-03-30 01:06:29) [DEBUG "async_resolve.hpp":51] ipv4 address
Mar 30 01:06:29 obmc bmcweb[402]: (2022-03-30 01:06:29) [DEBUG "async_resolve.hpp":86] resolved endpoint is : <LISTENER-IP>:5008
Mar 30 01:06:29 obmc bmcweb[402]: (2022-03-30 01:06:29) [DEBUG "http_client.hpp":110] Resolved
Mar 30 01:06:29 obmc bmcweb[402]: (2022-03-30 01:06:29) [DEBUG "http_client.hpp":122] Trying to connect to: <LISTENER-IP>:5008
Mar 30 01:06:29 obmc bmcweb[402]: (2022-03-30 01:06:29) [DEBUG "http_client.hpp":135] Connected to: <LISTENER-IP>:5008
Mar 30 01:06:30 obmc bmcweb[402]: (2022-03-30 01:06:30) [DEBUG "http_client.hpp":165] SSL Handshake successfull
Mar 30 01:06:30 obmc bmcweb[402]: (2022-03-30 01:06:30) [DEBUG "http_client.hpp":189] sendMessage() bytes transferred: 618
Mar 30 01:06:30 obmc bmcweb[402]: (2022-03-30 01:06:30) [DEBUG "http_client.hpp":224] recvMessage() bytes transferred: 19
Mar 30 01:06:30 obmc bmcweb[402]: (2022-03-30 01:06:30) [DEBUG "http_client.hpp":240] recvMessage() Header Response Code: 200
**Mar 30 01:06:30 obmc bmcweb[402]: (2022-03-30 01:06:30) [DEBUG "http_client.hpp":263] recvMessage() keepalive : 1**
**Mar 30 01:06:30 obmc bmcweb[402]: (2022-03-30 01:06:30) [DEBUG "http_client.hpp":490] requestDataQueue is empty**

Here, I need to push these changes on github, but I do not have a permission for this repo. Can I please get a permission to push a change for this repo?
Or Can it be please applied by authorized contributors on this repo?

Event Listener receiving same Redfish events

DMTF Redfish event listener is being ran on local machine. My observations are followed below.

Observation:

  • While receiving events from Redfish event listener it observed that system was repeating the same events after 1-2 mins.
  • Because it gets into retrial mode(DeliveryRetryAttempts) due to absence of content-length header and json response.
  • Identified an issue about the response that is sending from the Redfish event listener does not contain the content-length header and the json response.

I checked in POST method section, https://github.com/DMTF/Redfish-Event-Listener/blob/master/RedfishEventListener_v1.py#L122-L123, Status code and "Connection: close" are sent as response only.
If Response have "Content-length: "+str(len(bodydata))" and json.dumps(bodydata) message with status code and "Connection: close" with these changes, the events are not repeating it's working fine.

 res = "HTTP/1.1 200 OK\n" \
       "Connection: close\n" \
       "Content-length: "+str(len(bodydata)) + "\n" \
       "\n" + json.dumps(bodydata)

If i'm wrong. please let me know.

need help for HPE server

@mraineri I tried this tool for one of HPE ilo5 server. But I take the below outputs;

python3 RedfishEventListener_v1.py
Redfish Event Listener v1.1.2
ServerIP:: https://10.254.254.2
UserName:: hpeadmin
Attempt 1 of /redfish/v1/
Response Time for GET to /redfish/v1/: 0.6701809060004962 seconds.
Attempt 1 of /redfish/v1/SessionService/Sessions/
Response Time for GET to /redfish/v1/SessionService/Sessions/: 0.06997425600002316 seconds.
Attempt 1 of /redfish/v1/
Retrying /redfish/v1/ [('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))]
Attempt 2 of /redfish/v1/
Response Time for GET to /redfish/v1/: 1.0960873180001727 seconds.
Attempt 1 of /redfish/v1/EventService/
Retrying /redfish/v1/EventService/ [('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))]
Attempt 2 of /redfish/v1/EventService/
Response Time for GET to /redfish/v1/EventService/: 0.4261891400001332 seconds.
Attempt 1 of /redfish/v1/EventService/Subscriptions/
Retrying /redfish/v1/EventService/Subscriptions/ [('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))]
Attempt 2 of /redfish/v1/EventService/Subscriptions/
Response Time for POST to /redfish/v1/EventService/Subscriptions/: 0.26587757899960707 seconds.
Unable to subscribe for events with https://10.254.254.2
Traceback (most recent call last):
File "RedfishEventListener_v1.py", line 263, in
response = redfish_utilities.create_event_subscription(my_ctx, config['destination'],
File "/home/cihat/.local/lib/python3.8/site-packages/redfish_utilities/event_service.py", line 212, in create_event_subscription
verify_response( response )
File "/home/cihat/.local/lib/python3.8/site-packages/redfish_utilities/messages.py", line 71, in verify_response
raise RedfishOperationFailedError( "Operation failed: HTTP {}\n{}".format( response.status, exception_string ) )
redfish_utilities.messages.RedfishOperationFailedError: Operation failed: HTTP 400
See @Message.ExtendedInfo for more information.
iLO.2.14.PropertyNotWritableOrUnknown
None
Continuing with Listener.
Listening on 10.254.254.2:443 via HTTP
Press Ctrl-C to close program
Traceback (most recent call last):
File "RedfishEventListener_v1.py", line 311, in
socket_server = socket.create_server(my_host, family=family)
File "/usr/lib/python3.8/socket.py", line 890, in create_server
raise error(err.errno, msg) from None
OSError: [Errno 99] Cannot assign requested address (while attempting to bind on address ('10.254.254.2', 443))

Fail to create a subscription

from tag 1.1.1, start from execution file, it will appear below error

Traceback (most recent call last):
File "/root/Redfish-Event-Listener-1.1.1/RedfishEventListener_v1.py", line 260, in
my_ctx.login(auth=logintype.tolower())
AttributeError: 'str' object has no attribute 'tolower'

not sure if "tolower()" function should replace as "lower()", or we should use specific python version to support it ?
after made simple test to replace it to "lower()", as result, it is workable. thanks your attention

Event listener fails to receive alternate events

I am running Event listener on a machine. Event listener consistently fails to receive alternate event.

Here is my Event listener output.
server sent 3 events with ids 5,6,7 but listener recieved only 5 and 7 where as 6 is not received.
this observation is consistent even with 100 events, every alternate event is missing

python3 RedfishEventListener_v1.py
Redfish Event Listener v1.0.2
RegistryPrefixes: [""]
Connection
Keep-Alive
[{'Connection': 'Keep-Alive'}]
HttpHeaders: [{"Connection": "Keep-Alive"}]
Listening on 0.0.0.0:8080 via HTTPS
Count of Server is 1
Payload details are {"Destination":"https://9.x.x.x:8080/home/test","Context":"Public","Protocol":"Redfish"}
ServerIPList::: https://9.x.x.x
UserNameList::: root
URI is: https://9.x.x.x/redfish/v1/EventService/Subscriptions

Method = POST, status = 201, expected status = [200, 201, 204]
{'Location': '/redfish/v1/EventService/Subscriptions/3622973518', 'Strict-Transport-Security': 'max-age=31536000; includeSubdomains; preload', 'X-Frame-Options': 'DENY', 'Pragma': 'no-cache', 'Cache-Control': 'no-Store,no-Cache', 'X-XSS-Protection': '1; mode=block', 'X-Content-Type-Options': 'nosniff', 'Content-Security-Policy': "default-src 'none'; img-src 'self' data:; font-src 'self'; style-src 'self'; script-src 'self'; connect-src 'self' wss:", 'Content-Type': 'application/json', 'Date': 'Wed, 03 Mar 2021 15:04:15 GMT', 'Content-Length': '283'}
Subcription is successful for https://9.x.x.x

headers: IOrderedDict([('Host', '9.x.x.x'), ('Content-Type', 'application/json'), ('Content-Length', '224')])

bodydata: {"@odata.type":"#Event.v1_4_0.Event","Events":[{"EventId":5,"EventTimestamp":"2021-03-03T15:04:19+00:00","MemberId":0,"Message":"A Test message","OriginOfCondition":"/redfish/v1/xxx/Service"}],"Name":"Event Log"}

Server IP Address is xx.x.x.x
Server PORT number is 59404

Context (None) does not match with the server (Public).
HTTP/1.1 200 OK
Content-Length: 4

Done
response sent
Event Counter for Host 9.3.29.130 = 1

finally block - not closing the connection

headers: IOrderedDict([('Host', 'x.x.x.x'), ('Content-Type', 'application/json'), ('Content-Length', '224')])

bodydata: {"@odata.type":"#Event.v1_4_0.Event","Events":[{"EventId":7,"EventTimestamp":"2021-03-03T15:04:29+00:00","MemberId":0,"Message":"A Test message","OriginOfCondition":"/ibm/v1/xxx/Service"}],"Name":"Event Log"}

Propose to add Redfish Event validation against Event schema

Event listener currently doesn't have the capability to flag errors for below conditions:

  1. Event data is not compliant to the Event schema
  2. Numbers of MessageArgs is not aligned with the numbers specified in the Message Registry

Does it sound like a good idea to add these checking's to the event listener?

Welcome other thoughts as well, thanks.

StatusCode at RedfishEventListener_v1.py#L224 seems incorrect

At RedfishEventListener_v1.py#L224, the value of StatusCode will be returned.

StatusCode = """HTTP/1.1 200 OK\r\n"""

However, in RFC7230, HTTP-message is defined as follows:

HTTP-message = start-line *( header-field CRLF ) CRLF [ message-body]
start-line = request-line / status-line
status-line = HTTP-version SP status-code SP reason-phrase CRLF

It seems that the tool should return status-line + CRLF and therefore StatusCode should look like the following:

StatusCode = """HTTP/1.1 200 OK\r\n\r\n"""

Need support for non-SSL Events

Currently Redfish Event Listener only supports SSL POSTs of Redfish Events. Request support for non-SSL Events sent by Redfish Mockup Server. Whether Event Listener is listening for SSL or non-SSL POSTs should be configurable in the config.ini file.

Support for python3.11

Hi,

When I tried using the Redfish-Event-Listener with python 3.11 , I got the following error during installation of http-parser

#6 14.53 Failed to build http-parser
#6 14.67 Installing collected packages: uwsgi, ply, http-parser, XlsxWriter, urllib3, six, robotframework, pycparser, MarkupSafe, jsonpointer, itsdangerous, idna, decorator, click, charset-normalizer, y
#6 14.73   Running setup.py install for http-parser: started
#6 15.54   Running setup.py install for http-parser: finished with status 'error'
#6 15.55   error: subprocess-exited-with-error
#6 15.55
#6 15.55   × Running setup.py install for http-parser did not run successfully.
#6 15.55   │ exit code: 1
#6 15.55   ╰─> [27 lines of output]
#6 15.55       /tmp/pip-install-fc9hcutp/http-parser_3e7adc6962534c8189a5124f158888f0/setup.py:12: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Pyths
#6 15.55         from imp import load_source
#6 15.55       running install
#6 15.55       /usr/local/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
#6 15.55         warnings.warn(
#6 15.55       running build
#6 15.55       running build_py
#6 15.55       creating build
#6 15.55       creating build/lib.linux-x86_64-cpython-311
#6 15.55       creating build/lib.linux-x86_64-cpython-311/http_parser
#6 15.55       copying http_parser/__init__.py -> build/lib.linux-x86_64-cpython-311/http_parser
#6 15.55       copying http_parser/_socketio.py -> build/lib.linux-x86_64-cpython-311/http_parser
#6 15.55       copying http_parser/http.py -> build/lib.linux-x86_64-cpython-311/http_parser
#6 15.55       copying http_parser/pyparser.py -> build/lib.linux-x86_64-cpython-311/http_parser
#6 15.55       copying http_parser/reader.py -> build/lib.linux-x86_64-cpython-311/http_parser
#6 15.55       copying http_parser/util.py -> build/lib.linux-x86_64-cpython-311/http_parser
#6 15.55       running build_ext
#6 15.55       building 'http_parser.parser' extension
#6 15.55       creating build/temp.linux-x86_64-cpython-311
#6 15.55       creating build/temp.linux-x86_64-cpython-311/http_parser
#6 15.55       gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Iparser -I/usr/local/include/python3.11 -c http_parser/http_parser.c -o build/temp.linux-x86_64-cpython-311/http_parser/ho
#6 15.55       gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Iparser -I/usr/local/include/python3.11 -c http_parser/parser.c -o build/temp.linux-x86_64-cpython-311/http_parser/parsero
#6 15.55       http_parser/parser.c:196:12: fatal error: longintrepr.h: No such file or directory
#6 15.55         196 |   #include "longintrepr.h"
#6 15.55             |            ^~~~~~~~~~~~~~~
#6 15.55       compilation terminated.
#6 15.55       error: command '/usr/bin/gcc' failed with exit code 1
#6 15.55       [end of output]
#6 15.55
#6 15.55   note: This error originates from a subprocess, and is likely not a problem with pip.
#6 15.55 error: legacy-install-failure
#6 15.55
#6 15.55 × Encountered error while trying to install package.
#6 15.55 ╰─> http-parser
#6 15.55
#6 15.55 note: This is an issue with the package mentioned above, not pip.
#6 15.55 hint: See above for output from the failure.

Could you please help here?

subscribing more than one server

It is not possible to subscribe more than one server together.
They need to be subscribed one by one, before merging them in the ServerIPs part of the config.ini file

Https receiving throwing error

Hi DMTF,

I am getting below error while destination is configured with https://:port

The subscription is successful but when I send the event from BMC it is failing.

Please provide the info where I can disable the https handshake but still I should be able to receive the https message.

Attempt 1 of /redfish/v1/
Response Time for GET to /redfish/v1/: 0.03368935314938426 seconds.
Attempt 1 of /redfish/v1/EventService
Response Time for GET to /redfish/v1/EventService: 0.06416380102746189 seconds.
Attempt 1 of /redfish/v1/EventService/Subscriptions
Response Time for POST to /redfish/v1/EventService/Subscriptions: 0.07108544814400375 seconds.
Subscription is successful for https://127.0.0.1:2443, /redfish/v1/EventService/Subscriptions/3072935522
Continuing with Listener.
Listening on 10.41.25.182:1234 via HTTPS
Press Ctrl-C to close program
.............
Socket connected::
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "RedfishEventListener_v1.py", line 52, in process_data
connstreamout = context.wrap_socket(newsocketconn, server_side=True)
File "/usr/lib/python3.8/ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "/usr/lib/python3.8/ssl.py", line 1040, in _create
self.do_handshake()
File "/usr/lib/python3.8/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:1131)

pip3 install http_parser compile issue

c:\Users\Admin\AppData\Local\Programs\Python\Python37-32\Scripts>pip3 install http_parser
Collecting http_parser
Using cached https://files.pythonhosted.org/packages/07/c4/22e3c76c2313c26dd5f84f1205b916ff38ea951aab0c4544b6e2f5920d64/http-parser-0.8.3.tar.gz
Installing collected packages: http-parser
Running setup.py install for http-parser ... error
Complete output from command c:\users\admin\appdata\local\programs\python\python37-32\python.exe -u -c "import setuptools, tokenize;file='C:\Users\Admin\AppData\Local\Temp\pip-install-72tekw08\http-parser\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\Admin\AppData\Local\Temp\pip-record-p2v4v4xy\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\http_parser
copying http_parser\http.py -> build\lib.win32-3.7\http_parser
copying http_parser\pyparser.py -> build\lib.win32-3.7\http_parser
copying http_parser\reader.py -> build\lib.win32-3.7\http_parser
copying http_parser\util.py -> build\lib.win32-3.7\http_parser
copying http_parser_socketio.py -> build\lib.win32-3.7\http_parser
copying http_parser_init_.py -> build\lib.win32-3.7\http_parser
running build_ext
building 'http_parser.parser' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\http_parser
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Iparser -Ic:\users\admin\appdata\local\programs\python\python37-32\include -Ic:\users\admin\appdata\local\programs\python\python37-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tchttp_parser\http_parser.c /Fobuild\temp.win32-3.7\Release\http_parser\http_parser.obj
http_parser.c
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Iparser -Ic:\users\admin\appdata\local\programs\python\python37-32\include -Ic:\users\admin\appdata\local\programs\python\python37-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tchttp_parser\parser.c /Fobuild\temp.win32-3.7\Release\http_parser\parser.obj
parser.c
http_parser\parser.c(6249): error C2039: 'exc_type': is not a member of '_ts'
c:\users\admin\appdata\local\programs\python\python37-32\include\pystate.h(212): note: see declaration of '_ts'
http_parser\parser.c(6250): error C2039: 'exc_value': is not a member of '_ts'
c:\users\admin\appdata\local\programs\python\python37-32\include\pystate.h(212): note: see declaration of '_ts'
http_parser\parser.c(6251): error C2039: 'exc_traceback': is not a member of '_ts'
c:\users\admin\appdata\local\programs\python\python37-32\include\pystate.h(212): note: see declaration of '_ts'
http_parser\parser.c(6252): error C2039: 'exc_type': is not a member of '_ts'
c:\users\admin\appdata\local\programs\python\python37-32\include\pystate.h(212): note: see declaration of '_ts'
http_parser\parser.c(6253): error C2039: 'exc_value': is not a member of '_ts'
c:\users\admin\appdata\local\programs\python\python37-32\include\pystate.h(212): note: see declaration of '_ts'
http_parser\parser.c(6254): error C2039: 'exc_traceback': is not a member of '_ts'
c:\users\admin\appdata\local\programs\python\python37-32\include\pystate.h(212): note: see declaration of '_ts'
http_parser\parser.c(7460): error C2039: 'exc_type': is not a member of '_ts'
c:\users\admin\appdata\local\programs\python\python37-32\include\pystate.h(212): note: see declaration of '_ts'
http_parser\parser.c(7461): error C2039: 'exc_value': is not a member of '_ts'
c:\users\admin\appdata\local\programs\python\python37-32\include\pystate.h(212): note: see declaration of '_ts'
http_parser\parser.c(7462): error C2039: 'exc_traceback': is not a member of '_ts'
c:\users\admin\appdata\local\programs\python\python37-32\include\pystate.h(212): note: see declaration of '_ts'
http_parser\parser.c(7474): error C2039: 'exc_type': is not a member of '_ts'
c:\users\admin\appdata\local\programs\python\python37-32\include\pystate.h(212): note: see declaration of '_ts'
http_parser\parser.c(7475): error C2039: 'exc_value': is not a member of '_ts'
c:\users\admin\appdata\local\programs\python\python37-32\include\pystate.h(212): note: see declaration of '_ts'
http_parser\parser.c(7476): error C2039: 'exc_traceback': is not a member of '_ts'
c:\users\admin\appdata\local\programs\python\python37-32\include\pystate.h(212): note: see declaration of '_ts'
http_parser\parser.c(7477): error C2039: 'exc_type': is not a member of '_ts'
c:\users\admin\appdata\local\programs\python\python37-32\include\pystate.h(212): note: see declaration of '_ts'
http_parser\parser.c(7478): error C2039: 'exc_value': is not a member of '_ts'
c:\users\admin\appdata\local\programs\python\python37-32\include\pystate.h(212): note: see declaration of '_ts'
http_parser\parser.c(7479): error C2039: 'exc_traceback': is not a member of '_ts'
c:\users\admin\appdata\local\programs\python\python37-32\include\pystate.h(212): note: see declaration of '_ts'
error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe' failed with exit status 2

----------------------------------------

Command "c:\users\admin\appdata\local\programs\python\python37-32\python.exe -u -c "import setuptools, tokenize;file='C:\Users\Admin\AppData\Local\Temp\pip-install-72tekw08\http-parser\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\Admin\AppData\Local\Temp\pip-record-p2v4v4xy\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Admin\AppData\Local\Temp\pip-install-72tekw08\http-parser\

c:\Users\Admin\AppData\Local\Programs\Python\Python37-32\Scripts>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.