Skip to content
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

Task: Add support for control_plane to support GET commands #65

Open
Ulrond opened this issue Dec 31, 2024 · 3 comments · May be fixed by #68
Open

Task: Add support for control_plane to support GET commands #65

Ulrond opened this issue Dec 31, 2024 · 3 comments · May be fixed by #68
Assignees
Labels
enhancement New feature or request

Comments

@Ulrond
Copy link
Collaborator

Ulrond commented Dec 31, 2024

Goal

  • Add a callback to the control plane to support GET commands

Problem

For the use case where the control module has to support / mimics external subsystems, you need to be able to extract the data from the REST_API..

E.g. the HDMI CEC Use-case where GET internal control logic from the network on the HDMI CEC and mimic the support that a HDMI CEC Controller would have, e.g. the Pulse 8.

self.hdmiCECController.checkMessageReceived(deviceLogicalAddress, destinationLogicalAddress, cec, payload=payload)
  • When you perform a HTTP GET on the websocket, from the server side ,you need to implement a callback to decode the request, fill it out, and return the data as requested back through the websocket to the client.

Notes (Optional)

  • Write test cases to support the GET send receive decoding as required
  • In the callback for the GET command you have to encode a YAML / JSON response, ( depending on the GET Request because it sends in a specific format ), you need to create a response in the format based on the GET request.
  • Consider kvp may need to be upgraded so that you can created YAML / JSON data to send back as an object? -> Spin off new ticket for this
@kanjoe24
Copy link
Contributor

kanjoe24 commented Feb 3, 2025

Control Plane Sequence Diagram for POST and GET Requests

Image

@kanjoe24
Copy link
Contributor

kanjoe24 commented Feb 3, 2025

sequenceDiagram
    title Control Plane POST Sequence

    participant Rest Api Client
    participant Server as UT Control Server
    participant Service

    Service ->> Server: Register Key Pattern
    Rest Api Client ->> Server: Send POST /api/postRequest (DATA)
    
    loop Accumulate body data
        Server ->> Server: LWS_CALLBACK_HTTP_BODY
    end

    Server ->> Server: LWS_CALLBACK_HTTP_BODY_COMPLETION
    Server ->> Server: Search key patterns
    Server -->> Service: trigger Callback on match
Loading

@kanjoe24
Copy link
Contributor

kanjoe24 commented Feb 3, 2025

sequenceDiagram
    title Control Plane GET Sequence

    participant Rest Api Client
    participant Server as UT Control Server
    participant Service

    Service ->> Server: Register with control plane (<REST_API_NAME> KEY)
    Rest Api Client ->> Server: Send GET /api/<REST_API_NAME> (KEY)
    
    alt Search for REST_API_NAME (Pass)
        Server ->> Service: API found, trigger callback
        Service -->> Server: Response data from callback(JSON/YAML)
        Server -> Server : process callback to DATA
        Server ->> Rest Api Client: Send success response with DATA
    else Search for REST_API_NAME (Fail)
        Server ->> Rest Api Client: Send error response
    end
Loading

@kanjoe24 kanjoe24 moved this from Todo to Review Requested in UT-Core Roadmap Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Review Requested
Development

Successfully merging a pull request may close this issue.

2 participants