HewlettPackard / oneview-redfish-toolkit

HPE OneView Redfish Toolkit provides a REST service to answer DMTF's Redfish compliant requests by querying HPE OneView
Apache License 2.0
18 stars 21 forks source link

Feature/garbage collector for expired sessions #442

Closed ricardogpsf closed 6 years ago

ricardogpsf commented 6 years ago

Closes #441

How test the solution?

You can change the expiration time of a specific session in Oneview, just apply a request like below (changing the ONEVIEW_IP and ONEVIEW_TOKEN to valid values):

curl -X POST \
  https://ONEVIEW_IP/rest/sessions/idle-timeout \
  -H 'auth: ONEVIEW_TOKEN' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'session-id: ONEVIEW_TOKEN' \
  -H 'x-api-version: 600' \
  -d '{ "idleTimeout": 60000 }'

The idleTimeout is the value in milliseconds to keep alive the session. For our example above, 60000 is the time to keep alive during 1 minute.

Steps to test: 1) Create more than one session on Redfish server. 2) List the Redfish sessions accessing /redfish/v1/SessionService/Sessions 3) Post a request to change the session idleTimeout to the Oneview server 4) Wait the time to expire Oneview session based on idleTimeout 5) List the Redfish sessions again. You should see one session less than previously.