Test on board

Created on June 21, 2022


Setup SSH on a board

To setup the ssh server it is necessary to connect via minicom (serial port) and pass the comands below.

dropbearkey -t rsa -f /tmp/data/sky-ssh-hostkey
dropbear -p :<SSH_PORT> -P /var/run/dropbear2.pid -r /tmp/data/sky-ssh-hostkey -B
 
iptables -I INPUT 1 -p tcp --dport <SSH_PORT> -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
iptables -I OUTPUT 1 -p tcp --sport <SSH_PORT> -m conntrack --ctstate ESTABLISHED -j ACCEPT

With suggestet SSH_PORT = 10022

dropbearkey -t rsa -f /tmp/data/sky-ssh-hostkey
dropbear -p :10022 -P /var/run/dropbear2.pid -r /tmp/data/sky-ssh-hostkey -B
 
iptables -I INPUT 1 -p tcp --dport 10022 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
iptables -I OUTPUT 1 -p tcp --sport 10022 -m conntrack --ctstate ESTABLISHED -j ACCEPT

Redirect ports

The command below will log into the box via ssh and redirect the ports between local machine and box.

ssh -L <LOCAL_PORT>:localhost:<THUNDER_PORT> -p <SSH_PORT> root@<IP>

In my case (I’m relying on local port 9000, ssh port is equal to 10022, thunder port is default 9998, and box ip equals 10.42.0.212.

ssh -L 9000:localhost:9998 -p 10022 root@10.42.0.21

Send HTTP request to the Thunder

I’m using the Postman, but even curl can be fine enough.

BOX example

 Expand source
curl http://127.0.0.1:9998/Service/Controller
 
curl http://127.0.0.1:9998/Service/Controller  
{"plugins":[{"callsign":"ActivityMonitor","locator":"libWPEFrameworkActivityMonitor.so","classname":"ActivityMonitor","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"CoPilot","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"CoPilot","locator":"libWPEFrameworkCoPilot.so","classname":"CoPilot","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"CoPilot","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"Controller","classname":"Controller","configuration":{
    "subsystems":[
     "Decryption",
     "Location",
     "Time",
     "Internet"
    ],
    "resumes":null
   }
,"state":"activated","processedrequests":3,"processedobjects":0,"observers":0},{"callsign":"DeviceDiagnostics","locator":"libWPEFrameworkDeviceDiagnostics.so","classname":"DeviceDiagnostics","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"DeviceDiagnostics","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"DeviceInfo","locator":"libWPEFrameworkDeviceInfo.so","classname":"DeviceInfo","autostart":true,"state":"activated","processedrequests":1,"processedobjects":0,"observers":0,"module":"Plugin_DeviceInfo","hash":"8e91331a4ac0191264a9523a3ab9a04c0435f700"},{"callsign":"DeviceProvisioning","locator":"libWPEFrameworkDeviceProvisioning.so","classname":"DeviceProvisioning","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"DeviceProvisioning","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"DisplaySettings","locator":"libWPEFrameworkDisplaySettings.so","classname":"DisplaySettings","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"DisplaySettings","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"FrameRate","locator":"libWPEFrameworkFrameRate.so","classname":"FrameRate","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"FrameRate","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"FrontPanel","locator":"libWPEFrameworkFrontPanel.so","classname":"FrontPanel","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"FrontPanel","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"HdcpProfile","locator":"libWPEFrameworkHdcpProfile.so","classname":"HdcpProfile","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"HdcpProfile","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"HdmiCec","locator":"libWPEFrameworkHdmiCec.so","classname":"HdmiCec","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"HdmiCec","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"Monitor","locator":"libWPEFrameworkMonitor.so","classname":"Monitor","autostart":true,"configuration":{
  "observables":[
   {
    "callsign":"UX",
    "memory":5,
    "memorylimit":null,
    "operational":1,
    "restart":{
# curl http://127.0.0.1:9998/Service/Controller
{"plugins":[{"callsign":"ActivityMonitor","locator":"libWPEFrameworkActivityMonitor.so","classname":"ActivityMonitor","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"CoPilot","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"CoPilot","locator":"libWPEFrameworkCoPilot.so","classname":"CoPilot","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"CoPilot","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"Controller","classname":"Controller","configuration":{
    "subsystems":[
     "Decryption",
     "Location",
     "Time",
     "Internet"
    ],
    "resumes":null
   }
,"state":"activated","processedrequests":4,"processedobjects":0,"observers":0},{"callsign":"DeviceDiagnostics","locator":"libWPEFrameworkDeviceDiagnostics.so","classname":"DeviceDiagnostics","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"DeviceDiagnostics","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"DeviceInfo","locator":"libWPEFrameworkDeviceInfo.so","classname":"DeviceInfo","autostart":true,"state":"activated","processedrequests":1,"processedobjects":0,"observers":0,"module":"Plugin_DeviceInfo","hash":"8e91331a4ac0191264a9523a3ab9a04c0435f700"},{"callsign":"DeviceProvisioning","locator":"libWPEFrameworkDeviceProvisioning.so","classname":"DeviceProvisioning","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"DeviceProvisioning","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"DisplaySettings","locator":"libWPEFrameworkDisplaySettings.so","classname":"DisplaySettings","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"DisplaySettings","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"FrameRate","locator":"libWPEFrameworkFrameRate.so","classname":"FrameRate","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"FrameRate","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"FrontPanel","locator":"libWPEFrameworkFrontPanel.so","classname":"FrontPanel","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"FrontPanel","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"HdcpProfile","locator":"libWPEFrameworkHdcpProfile.so","classname":"HdcpProfile","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"HdcpProfile","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"HdmiCec","locator":"libWPEFrameworkHdmiCec.so","classname":"HdmiCec","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"HdmiCec","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"Monitor","locator":"libWPEFrameworkMonitor.so","classname":"Monitor","autostart":true,"configuration":{
  "observables":[
   {
    "callsign":"UX",
    "memory":5,
    "memorylimit":null,
    "operational":1,
    "restart":{
     "memory":{
      "window":0,
      "limit":0
     },
     "operational":{
      "window":60,
      "limit":3
     }
    }
   },
   {
    "callsign":"OCDM",
    "operational":1,
    "restart":{
     "operational":{
      "window":60,
      "limit":3
     }
    }
   }
  ]
 }
,"state":"activated","processedrequests":2,"processedobjects":0,"observers":0,"module":"Plugin_Monitor","hash":"8e91331a4ac0191264a9523a3ab9a04c0435f700"},{"callsign":"OCDM","locator":"libWPEFrameworkOCDM.so","classname":"OCDM","autostart":true,"precondition":["Provisioning"],"configuration":{
  "systems":[
   {
    "name":"PlayReady",
    "designators":[
     "com.youtube.playready",
     "com.microsoft.playready",
     "com.netflix.playready"
    ],
    "configuration":{
     "read-dir":"/opt/drm/playready",
     "store-location":"/opt/drm/playready/drmstore.dat"
    }
   },
   {
    "name":"WideVine",
    "designators":[
     "com.widevine.alpha"
    ]
   }
  ],
  "root":{
   "outofprocess":true
  }
 }
,"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"Plugin_OCDM","hash":"8e91331a4ac0191264a9523a3ab9a04c0435f700"},{"callsign":"SleepTimer","locator":"libWPEFrameworkSleepTimer.so","classname":"SleepTimer","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"SleepTimer","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"SystemdConnector","locator":"libWPEFrameworkSystemdConnector.so","classname":"SystemdConnector","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"Plugin_SystemdConnector","hash":"8e91331a4ac0191264a9523a3ab9a04c0435f700"},{"callsign":"TTSResource","locator":"libWPEFrameworkTTSResource.so","classname":"TTSResource","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"TTSResource","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"TTSSessionService","locator":"libWPEFrameworkTTSSessionService.so","classname":"TTSSessionService","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"TTSSessionService","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"TTSSettings","locator":"libWPEFrameworkTTSSettings.so","classname":"TTSSettings","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"TTSSettings","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"TraceControl","locator":"libWPEFrameworkTraceControl.so","classname":"TraceControl","autostart":true,"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"Plugin_TraceControl","hash":"8e91331a4ac0191264a9523a3ab9a04c0435f700"},{"callsign":"Warehouse","locator":"libWPEFrameworkWarehouse.so","classname":"Warehouse","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"Warehouse","hash":"engineering_build_for_debug_purpose_only"}],"channel":[{"remote":"localhost.localdomain:48983","state":"WebServer","activity":true,"id":2},{"remote":"localhost.localdomain:48984","state":"WebServer","activity":true,"id":3},{"remote":"localhost.localdomain:48986","state":"WebServer","activity":true,"id":4}],"server":{"threads":[651,672,682,677],"pending":0,"occupation":1}}

Local machine example

 Expand source
curl http://127.0.0.1:9000/Service/Controller
{"plugins":[{"callsign":"ActivityMonitor","locator":"libWPEFrameworkActivityMonitor.so","classname":"ActivityMonitor","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"CoPilot","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"CoPilot","locator":"libWPEFrameworkCoPilot.so","classname":"CoPilot","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"CoPilot","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"Controller","classname":"Controller","configuration":{
    "subsystems":[
     "Decryption",
     "Location",
     "Time",
     "Internet"
    ],
    "resumes":null
   }
,"state":"activated","processedrequests":5,"processedobjects":0,"observers":0},{"callsign":"DeviceDiagnostics","locator":"libWPEFrameworkDeviceDiagnostics.so","classname":"DeviceDiagnostics","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"DeviceDiagnostics","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"DeviceInfo","locator":"libWPEFrameworkDeviceInfo.so","classname":"DeviceInfo","autostart":true,"state":"activated","processedrequests":1,"processedobjects":0,"observers":0,"module":"Plugin_DeviceInfo","hash":"8e91331a4ac0191264a9523a3ab9a04c0435f700"},{"callsign":"DeviceProvisioning","locator":"libWPEFrameworkDeviceProvisioning.so","classname":"DeviceProvisioning","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"DeviceProvisioning","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"DisplaySettings","locator":"libWPEFrameworkDisplaySettings.so","classname":"DisplaySettings","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"DisplaySettings","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"FrameRate","locator":"libWPEFrameworkFrameRate.so","classname":"FrameRate","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"FrameRate","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"FrontPanel","locator":"libWPEFrameworkFrontPanel.so","classname":"FrontPanel","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"FrontPanel","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"HdcpProfile","locator":"libWPEFrameworkHdcpProfile.so","classname":"HdcpProfile","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"HdcpProfile","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"HdmiCec","locator":"libWPEFrameworkHdmiCec.so","classname":"HdmiCec","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"HdmiCec","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"Monitor","locator":"libWPEFrameworkMonitor.so","classname":"Monitor","autostart":true,"configuration":{
  "observables":[
   {
    "callsign":"UX",
    "memory":5,
    "memorylimit":null,
    "operational":1,
    "restart":{
     "memory":{
      "window":0,
      "limit":0
     },
     "operational":{
      "window":60,
      "limit":3
     }
    }
   },
   {
    "callsign":"OCDM",
    "operational":1,
    "restart":{
     "operational":{
      "window":60,
      "limit":3
     }
    }
   }
  ]
 }
,"state":"activated","processedrequests":2,"processedobjects":0,"observers":0,"module":"Plugin_Monitor","hash":"8e91331a4ac0191264a9523a3ab9a04c0435f700"},{"callsign":"OCDM","locator":"libWPEFrameworkOCDM.so","classname":"OCDM","autostart":true,"precondition":["Provisioning"],"configuration":{
  "systems":[
   {
    "name":"PlayReady",
    "designators":[
     "com.youtube.playready",
     "com.microsoft.playready",
     "com.netflix.playready"
    ],
    "configuration":{
     "read-dir":"/opt/drm/playready",
     "store-location":"/opt/drm/playready/drmstore.dat"
    }
   },
   {
    "name":"WideVine",
    "designators":[
     "com.widevine.alpha"
    ]
   }
  ],
  "root":{
   "outofprocess":true
  }
 }
,"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"Plugin_OCDM","hash":"8e91331a4ac0191264a9523a3ab9a04c0435f700"},{"callsign":"SleepTimer","locator":"libWPEFrameworkSleepTimer.so","classname":"SleepTimer","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"SleepTimer","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"SystemdConnector","locator":"libWPEFrameworkSystemdConnector.so","classname":"SystemdConnector","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"Plugin_SystemdConnector","hash":"8e91331a4ac0191264a9523a3ab9a04c0435f700"},{"callsign":"TTSResource","locator":"libWPEFrameworkTTSResource.so","classname":"TTSResource","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"TTSResource","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"TTSSessionService","locator":"libWPEFrameworkTTSSessionService.so","classname":"TTSSessionService","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"TTSSessionService","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"TTSSettings","locator":"libWPEFrameworkTTSSettings.so","classname":"TTSSettings","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"TTSSettings","hash":"engineering_build_for_debug_purpose_only"},{"callsign":"TraceControl","locator":"libWPEFrameworkTraceControl.so","classname":"TraceControl","autostart":true,"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"Plugin_TraceControl","hash":"8e91331a4ac0191264a9523a3ab9a04c0435f700"},{"callsign":"Warehouse","locator":"libWPEFrameworkWarehouse.so","classname":"Warehouse","autostart":true,"precondition":["Platform"],"state":"activated","processedrequests":0,"processedobjects":0,"observers":0,"module":"Warehouse","hash":"engineering_build_for_debug_purpose_only"}],"channel":[{"remote":"localhost.localdomain:48983","state":"WebServer","activity":true,"id":2},{"remote":"localhost.localdomain:48984","state":"WebServer","activity":true,"id":3},{"remote":"localhost.localdomain:48986","state":"WebServer","activity":true,"id":4},{"remote":"localhost.localdomain:48987","state":"WebServer","activity":true,"id":5}],"server":{"threads":[665,688,699,695],"pending":0,"occupation":1}}

Postman example

Send JSON RPC request to the Thunder

BOX example

curl -X POST http://127.0.0.1:9998/Service/ -d '{"jsonrpc": "2.0", "id": 1234567890, "method": "DisplaySettings.1.getConnectedVideoDisplays"}'
{"jsonrpc":"2.0","id":1234567890,"result":{"connectedVideoDisplays":["HDMI0"],"success":true}}

Local machine example

curl -X POST http://127.0.0.1:9000/Service/ -d '{"jsonrpc": "2.0", "id": 1234567890, "method": "DisplaySettings.1.getConnectedVideoDisplays"}'
{"jsonrpc":"2.0","id":1234567890,"result":{"connectedVideoDisplays":["HDMI0"],"success":true}}

Postman example


Sending/Receiving message with Browser WebSocket Client

  1. Make sure that you have SSH enabled, and redirected ports (look above in this page)
  2. From chrome extenstion download “Browser WebSocket Client”
  3. URL and Protocol can be taken from “thunder-wifimanager-test.js”, when creating this instruction it was:

    ws = new WebSocket('ws://localhost:9998/jsonrpc', 'notification');
  4. Going with this example our URL should be ‘ws://localhost:9000/jsonrpc‘ (NOTICE: port is different as we redirected it before), and Protocol should be ‘notification’. All those fields should not have [ ‘ ] characters.

  5. Now we can register to get some message, In Send a Message field just paste request, i.e.

    {
        "jsonrpc": "2.0",
        "id": 123123123,
        "method": "Controller.1.register",
        "params": {
            "event": "all",
            "id": "client.events.1"
        }
    }

    and press Send. In reveived Messages should be shown response.

  6. Then we can check if we will get new message if registered even appeard. We can do it be i.e.

    {
        "jsonrpc": "2.0",
        "id": 1234567890,
        "method": "Controller.1.deactivate",
        "params": {
            "callsign": "DeviceInfo"
        }
    }

    We should get 2 messages. One about success of this operation and second about event that we are registered.

Getting events from desired service

To get event from specific service we need to set service name and event that we want to catch. So if we want i.e. get from HomeNetworking, get event deviceDiscoveryUpdate. We need to

{
    "jsonrpc": "2.0",
    "id": 123123123,
    "method": "org.rdk.HomeNetworking.1.register",
    "params": {
        "event": "deviceDiscoveryUpdate",
        "id": "client.events.1"
    }
}

Important: name of service can be different on the box (here “org.rdk.” was prefixed) to check how service is called in the box use command:

curl --location --request GET 'http://127.0.0.1:9998/Service/Controller' | json_reformat

There you can find all services.

Go To Top