-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: mock device extension #238
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
satlead
reviewed
Sep 25, 2023
satlead
reviewed
Sep 25, 2023
device/thunder_ripple_sdk/src/processors/thunder_device_info.rs
Outdated
Show resolved
Hide resolved
Vinodsathyaseelan
approved these changes
Mar 15, 2024
Nv-Delle1416
approved these changes
Apr 2, 2024
Minimum allowed line rate is |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
A ripple extension that supports setting up a WebSocket server to stand in for a device.
Thunder connection retries during boot
Why
To support unit, component and (contract) provider verification testing in a containerised or desktop environment without access to a hardware device.
Additionally to support development of certain features which do not rely on a real device to function but require certain responses from the lower layers of the software stack.
How
The premise of the mock device is simple. A WebSocket server with a registry of known requests and the responses we expect for each of those requests. When a request is made to the WebSocket server the incoming request is compared to the registry and if found the corresponding responses are sent back. If the request is unrecognised then nothing is sent back.
The extension is presented in two parts: a channel and a JSON-RPC extension. The channel holds the running WebSocket server that acts as the device and the JSON-RPC extension offers a control plane for the data within the server.
During extension loading a WebSocket server is started listening on the same port that the Thunder extension expects Thunder to be present on. In order to support this, connection retries have added to the Thunder SDK so that if the WebSocket server is not available immediately additional attempts to connect will be made.
The extension loads the initial state from a JSON file found in at a predetermined location. This is essential to get Ripple to boot up without crashing as certain requests and made to a device immediately after establishing the connection.
Once Ripple is running there are JSON-RPC methods which can be used to:
emit an eventnot yet implmentedTest
Set up a manifest as per the included docs.
See docs for usage and try some of the patterns.
Checklist