7 WebSocket Test Cases
7.1 Session Establishment
Purpose
The purpose of this test is to ensure the EUT can establish a session using WebSocket as the MTP.
Functionality Tags
Conditional Mandatory (supports the WebSocket MTP)
Test Setup
- Ensure the EUT is configured to use WebSocket and to communicate to the controller that exists in the test environment.
Test Procedure
Reboot the EUT.
Wait for the EUT to reconnect to the controller.
Send a Get message to the EUT with the following structure:
header { msg_id: '<msg_id>' msg_type: GET } body { request { get { param_paths: 'Device.DeviceInfo.' } } }
Wait for a GetResponse from the EUT
Test Metrics
- The EUT is able to establish a WebSocket connection to the controller
- The EUT sends a GetResponse to the Get message sent in step 3
7.2 Use of only one session
Purpose
The purpose of this test is to ensure the EUT maintains only one WebSocket connection to a controller at a time.
Functionality Tags
Conditional Mandatory (supports the WebSocket MTP with requirement R-WS.6)
Test Setup
- Ensure the EUT is configured to use WebSocket and to communicate to the controller that exists in the test environment.
Test Procedure
Send a Get message to the EUT using the following structure:
header { msg_id: '<msg_id>' msg_type: GET } body { request { get { param_paths: 'Device.DeviceInfo.' } } }
Attempt to open a second WebSocket connection to the EUT.
Send the Get message outlined in step 1 over the new connection.
Test Metrics
- Either the first WebSocket connection closes when the second is opened, or the second connection is rejected.
7.3 Agent session acceptance from Controller
Purpose
This test has been DEPRECATED as of version 1.0.1 of this test plan.
Functionality Tags
N/A
Test Setup
N/A
Test Procedure
N/A
Test Metrics
N/A
7.4 Closing a WebSocket Connection
Purpose
The purpose of this test is to ensure the EUT correctly implements the procedure to close a WebSocket connection.
Functionality Tags
Conditional Mandatory (supports the WebSocket MTP)
Test Setup
- Ensure the EUT is configured to use WebSocket.
- Ensure there is an active WebSocket connection between the EUT and the controller that was initiated by the EUT.
Test Procedure
- Send a
Close
WebSocket control frame to the EUT. - Wait for the EUT to close the underlying TCP session.
Test Metrics
- The EUT sends a WebSocket Close frame.
7.5 Rejection of Session Establishment
Purpose
The purpose of this test is to ensure the EUT will correctly reject WebSocket sessions.
Functionality Tags
Conditional Mandatory (supports the WebSocket MTP)
Test Setup
- Ensure the EUT is configured to use WebSocket.
- Configure the controller to reject WebSocket connections from the EUT.
Test Procedure
- Configure the controller to not include the
Sec-WebSocket-Protocol
when opening new WebSocket connections. - Reboot the EUT
- Attempt to start a WebSocket connection to the EUT.
Test Metrics
- The EUT rejects the WebSocket connection with the missing
Sec-WebSocket-Protocol
header.
7.6 Error Handling - Unprocessed Records
Purpose
The purpose of this test is to ensure the EUT correctly closes the WebSocket connection when a malformed USP Record is received.
Functionality Tags
Conditional Mandatory (supports the WebSocket MTP)
Test Setup
- Ensure the EUT is configured to use WebSocket
- Ensure there is an active WebSocket connection between the EUT and controller.
Test Procedure
- Send a malformed USP record to the EUT.
Test Metrics
- After step 1 the EUT closes the WebSocket connection with a
WebSocket
Close
control frame containing status code 1003.
7.7 Use of Ping and Pong frames
Purpose
The purpose of this test is to ensure the EUT correctly uses
Ping
and Pong
control frames to keep the
WebSocket session alive.
Functionality Tags
Conditional Mandatory (supports the WebSocket MTP)
Test Setup
- Ensure the EUT is configured to use WebSocket
- Ensure there is an active WebSocket session between the EUT and the Controller.
Test Procedure
- Send a
Ping
control frame to the EUT. - Wait up to 60 seconds for a
Pong
control frame from the EUT. - Send a
Pong
control frame to the EUT.
Test Metrics
- The EUT sends a
Pong
control frame in response to thePing
control frame. - The EUT doesn’t terminate the WebSocket connection after receiving
an unsolicited
Pong
control frame.
7.8 WebSocket Session Retry
Purpose
The purpose of this test is to ensure the EUT will correctly attempt to reestablish a WebSocket session if a session is unexpectedly closed.
Functionality Tags
Conditional Mandatory (supports the WebSocket MTP)
Test Setup
- Ensure the EUT is configured to use WebSocket.
- Ensure there is an active WebSocket connection between the EUT and controller.
Test Procedure
Send a Get message to the EUT with the following structure:
header { msg_id: '<msg_id>' msg_type: GET } body { request { get { param_paths: 'Device.LocalAgent.Controller.<test controller instance>.MTP.<active MTP instance>.' } } }
Configure the controller to reject new WebSocket connections.
Terminate the underlying TCP connection on the existing WebSocket connection.
Wait for the EUT to attempt to establish a WebSocket connection.
Configure the controller to accept new WebSocket connections.
Wait for the EUT to attempt to establish a WebSocket connection.
Test Metrics
- The EUT attempts to start a new WebSocket connection in conformance
with the
SessionRetryMinimumWaitInterval
parameter. - The EUT makes a second attempt to start a new WebSocket connection
in conformance with the
SessionRetryMinimumWaitInterval
andSessionRetryIntervalMultiplier
parameters.
7.9 Use of TLS
Purpose
The purpose of this test is to ensure the EUT can establish and use a secure WebSocket connection.
Functionality Tags
Conditional Mandatory (supports the WebSocket MTP)
Test Setup
- Ensure the EUT is configured to use WebSocket.
- Ensure the EUT and controller both have the required certificates to secure a websocket connection.
Test Procedure
Reboot the EUT.
Wait for the EUT to connect to the controller.
Send a Get message to the EUT with the following structure:
header { msg_id: '<msg_id>' msg_type: GET } body { request { get { param_paths: 'Device.DeviceInfo.' } } }
Wait for GetResponse from the EUT.
Test Metrics
- The EUT starts a WebSocket connection with the controller using TLS.
- The EUT sends a GetResponse in step 4.
7.10 WebSocket - Use of Connect Record
Purpose
The purpose of this test is to ensure the EUT correctly sends a Connect Record after it has established a WebSocket connection to the Controller.
Functionality Tags
Conditional Mandatory (supports the WebSocket MTP)
Test Setup
- Ensure the EUT is configured to connect to the test controller using WebSocket.
Test Procedure
- Reboot the EUT.
- Wait for the EUT to reconnect to the test controller.
Test Metrics
- After reconnecting to the test controller the EUT transmits a WebSocketConnectRecord to the test controller within 30 seconds.