device-automation-bus / dab-adapter-rs

Apache License 2.0
2 stars 8 forks source link

Updated version to 0.5.2, Optimized API calls to fetch static details #47

Closed arun-madhavan-013 closed 9 months ago

arun-madhavan-013 commented 9 months ago

This change has the following:

Test Details: For a "release" type build; the static hashmap triggered APIs will cause Complaince Suite error response if not supported by platform.

d35@d35:~/Desktop/dab-compliance-suite$ mosquitto_sub -h 10.0.0.88 -v -t '#' | ts '[%Y%b%d %H:%M:%.S]'
[2024Feb25 21:59:35.065458] dab/02AD3201C835/messages {"timestamp":1708916375,"level":"info","ip":"10.0.0.88","message":"DAB started successfully"}
[2024Feb25 21:59:48.067326] dab/02AD3201C835/device/info {}
[2024Feb25 21:59:48.085023] dab/_response/dab/02AD3201C835/device/info {"status":500,"error":"{\"status\":500,\"error\":\"Error; no match for property manufacturer.\"}"}

For a "non-release" type build; they won't cause Complaince Suite error as its not DAB integration error; instead platform API integration error.

d35@d35:~/Desktop/dab-compliance-suite$ mosquitto_sub -h 10.0.0.88 -v -t '#' | ts '[%Y%b%d %H:%M:%.S]'
[2024Feb25 21:53:04.545627] dab/02AD3201C835/messages {"timestamp":1708915984,"level":"info","ip":"localhost","message":"DAB started successfully"}
[2024Feb25 21:55:18.294410] dab/02AD3201C835/device/info {}
[2024Feb25 21:55:18.960095] dab/_response/dab/02AD3201C835/device/info {"chipset":"Amlogic S905X4","deviceId":"02AD3201C835","displayType":"External","firmwareBuild":"lib32-rdk-generic-mediaclient-image_FBT_rdk-next_20240219155433","firmwareVersion":"lib32-rdk-generic-mediaclient-image_FBT_rdk-next_20240219155433","manufacturer":"Dummy response for make.","model":"Dummy response for sku.","networkInterfaces":[{"connected":true,"dns":[],"ipAddress":"2601:41:c300:1bc0:ad:32ff:fe01:c835","macAddress":"02:ad:32:01:c8:35","type":"Ethernet"},{"connected":false,"dns":[],"ipAddress":"","macAddress":"a0:9d:c1:6e:b2:c6","type":"Wifi"}],"screenHeightPixels":1080,"screenWidthPixels":1920,"serialNumber":"320b0205000000000808104731c7d900","status":200,"uptimeSince":1708903311000}
arun-madhavan-013 commented 9 months ago

Added missing uptime fetch API changes as well without using a struct based parsing logic because it will fail when more properties gets added to same method response.

arun-madhavan-013 commented 9 months ago

Test Details: dab-adapter logs:

d35@d35:~/Desktop/dab-works/dab-adapter-rs$ ./target/debug/dab-adapter -b 10.0.0.81 -d 10.0.0.81 --debug true
DAB<->RDK Adapter [4fe230a4135bc95e74483f4a41a6abb2bdd30445]
RDK request: {"jsonrpc":"2.0","id":1,"method":"org.rdk.System.getDeviceInfo","params":{"params":["estb_mac"]}}
RDK response: {"jsonrpc":"2.0","id":1,"result":{"estb_mac":"00:10:20:30:7E:C5","success":true}}
DAB Device ID: 001020307EC5
Ready to process DAB requests

OK: device/info
RDK request: {"jsonrpc":"2.0","id":3,"method":"org.rdk.DisplaySettings.getConnectedVideoDisplays"}
RDK response: {"jsonrpc":"2.0","id":3,"result":{"connectedVideoDisplays":["HDMI0"],"success":true}}
RDK request: {"jsonrpc":"2.0","id":1,"method":"DeviceInfo.make"}
RDK response: {"jsonrpc":"2.0","id":1,"error":{"code":1,"message":"ERROR_GENERAL"}}
Key 'make' not found in response.
RDK request: {"jsonrpc":"2.0","id":1,"method":"DeviceInfo.modelid"}
RDK response: {"jsonrpc":"2.0","id":1,"result":{"sku":"REALTEKHANK"}}
RDK request: {"jsonrpc":"2.0","id":1,"method":"DeviceInfo.serialnumber"}
RDK response: {"jsonrpc":"2.0","id":1,"result":{"serialnumber":"hanke500"}}
RDK request: {"jsonrpc":"2.0","id":1,"method":"DeviceIdentification.deviceidentification"}
RDK response: {"jsonrpc":"2.0","id":1,"result":{"firmwareversion":"REALTEK_SDK-6.3.0::READWRITE:WPE_R4:RDK_NEXT","chipset":"Realtek Hank","deviceid":"OEaGFua2U1MDA"}}
RDK request: {"jsonrpc":"2.0","id":1,"method":"DeviceInfo.firmwareversion"}
RDK response: {"jsonrpc":"2.0","id":1,"result":{"imagename":"rdk-generic-mediaclient-westeros-wpe-image_FBT_nightly-20240226-dunfell_20240226060227","yocto":"dunfell"}}
RDK request: {"jsonrpc":"2.0","id":3,"method":"org.rdk.RDKShell.getScreenResolution"}
RDK response: {"jsonrpc":"2.0","id":3,"result":{"w":1920,"h":1080,"success":true}}
RDK request: {"jsonrpc":"2.0","id":3,"method":"org.rdk.Network.getInterfaces"}
RDK response: {"jsonrpc":"2.0","id":3,"result":{"interfaces":[{"interface":"ETHERNET","macAddress":"00:10:20:30:7e:c5","enabled":true,"connected":true},{"interface":"WIFI","macAddress":"ec:9c:32:aa:c5:d4","enabled":true,"connected":false}],"success":true}}
RDK request: {"jsonrpc":"2.0","id":1,"method":"DeviceInfo.systeminfo"}
RDK response: {"jsonrpc":"2.0","id":1,"result":{"version":"4.2.#R4.2","uptime":1240,"totalram":1881755648,"freeram":981381120,"totalswap":0,"freeswap":0,"devicename":"mediaclient-mediabox","cpuload":"12","cpuloadavg":{"avg1min":37920,"avg5min":50336,"avg15min":43456},"serialnumber":"","time":"Tue, 27 Feb 2024 15:33:49"}}
RDK request: {"jsonrpc":"2.0","id":3,"method":"org.rdk.Network.getIPSettings","params":{"interface":"ETHERNET"}}
RDK response: {"jsonrpc":"2.0","id":3,"result":{"interface":"ETHERNET","ipversion":"IPV6","autoconfig":true,"ipaddr":"2601:4c:0:420:210:20ff:fe30:7ec5","netmask":"ffff:ff00::","gateway":"fe80::be9b:68ff:fec0:272b","primarydns":"","secondarydns":"","success":true}}
RDK request: {"jsonrpc":"2.0","id":3,"method":"org.rdk.Network.getIPSettings","params":{"interface":"WIFI"}}
RDK response: {"jsonrpc":"2.0","id":3,"result":{"success":false}}
RDK request: {"jsonrpc":"2.0","id":1,"method":"org.rdk.System.getDeviceInfo","params":{"params":["estb_mac"]}}
RDK response: {"jsonrpc":"2.0","id":1,"result":{"estb_mac":"00:10:20:30:7E:C5","success":true}}
OK: device/info
RDK request: {"jsonrpc":"2.0","id":3,"method":"org.rdk.DisplaySettings.getConnectedVideoDisplays"}
RDK response: {"jsonrpc":"2.0","id":3,"result":{"connectedVideoDisplays":["HDMI0"],"success":true}}
RDK request: {"jsonrpc":"2.0","id":3,"method":"org.rdk.RDKShell.getScreenResolution"}
RDK response: {"jsonrpc":"2.0","id":3,"result":{"w":1920,"h":1080,"success":true}}
RDK request: {"jsonrpc":"2.0","id":3,"method":"org.rdk.Network.getInterfaces"}
RDK response: {"jsonrpc":"2.0","id":3,"result":{"interfaces":[{"interface":"ETHERNET","macAddress":"00:10:20:30:7e:c5","enabled":true,"connected":true},{"interface":"WIFI","macAddress":"ec:9c:32:aa:c5:d4","enabled":true,"connected":false}],"success":true}}
RDK request: {"jsonrpc":"2.0","id":1,"method":"DeviceInfo.systeminfo"}
RDK response: {"jsonrpc":"2.0","id":1,"result":{"version":"4.2.#R4.2","uptime":1242,"totalram":1881755648,"freeram":980897792,"totalswap":0,"freeswap":0,"devicename":"mediaclient-mediabox","cpuload":"13","cpuloadavg":{"avg1min":40160,"avg5min":50592,"avg15min":43584},"serialnumber":"","time":"Tue, 27 Feb 2024 15:33:52"}}
RDK request: {"jsonrpc":"2.0","id":3,"method":"org.rdk.Network.getIPSettings","params":{"interface":"ETHERNET"}}
RDK response: {"jsonrpc":"2.0","id":3,"result":{"interface":"ETHERNET","ipversion":"IPV6","autoconfig":true,"ipaddr":"2601:4c:0:420:210:20ff:fe30:7ec5","netmask":"ffff:ff00::","gateway":"fe80::be9b:68ff:fec0:272b","primarydns":"","secondarydns":"","success":true}}
RDK request: {"jsonrpc":"2.0","id":3,"method":"org.rdk.Network.getIPSettings","params":{"interface":"WIFI"}}
RDK response: {"jsonrpc":"2.0","id":3,"result":{"success":false}}
RDK request: {"jsonrpc":"2.0","id":1,"method":"org.rdk.System.getDeviceInfo","params":{"params":["estb_mac"]}}
RDK response: {"jsonrpc":"2.0","id":1,"result":{"estb_mac":"00:10:20:30:7E:C5","success":true}}

^C
d35@d35:~/Desktop/dab-works/dab-adapter-rs$

MQTT Listener logs:

d35@d35:~/Desktop/dab-works/dab-adapter-rs$ mosquitto_sub -h 10.0.0.81 -v -t '#' | ts '[%Y%b%d %H:%M:%.S]'
[2024Feb27 10:33:49.056845] dab/001020307EC5/device/info {}
[2024Feb27 10:33:49.671539] dab/_response/dab/001020307EC5/device/info {"chipset":"Realtek Hank","deviceId":"001020307EC5","displayType":"External","firmwareBuild":"rdk-generic-mediaclient-westeros-wpe-image_FBT_nightly-20240226-dunfell_20240226060227","firmwareVersion":"rdk-generic-mediaclient-westeros-wpe-image_FBT_nightly-20240226-dunfell_20240226060227","manufacturer":"Dummy response for make.","model":"REALTEKHANK","networkInterfaces":[{"connected":true,"dns":[],"ipAddress":"2601:4c:0:420:210:20ff:fe30:7ec5","macAddress":"00:10:20:30:7e:c5","type":"Ethernet"},{"connected":false,"dns":[],"ipAddress":"","macAddress":"ec:9c:32:aa:c5:d4","type":"Wifi"}],"screenHeightPixels":1080,"screenWidthPixels":1920,"serialNumber":"hanke500","status":200,"uptimeSince":1709046789000}
[2024Feb27 10:33:52.044567] dab/001020307EC5/device/info {}
[2024Feb27 10:33:52.444488] dab/_response/dab/001020307EC5/device/info {"chipset":"Realtek Hank","deviceId":"001020307EC5","displayType":"External","firmwareBuild":"rdk-generic-mediaclient-westeros-wpe-image_FBT_nightly-20240226-dunfell_20240226060227","firmwareVersion":"rdk-generic-mediaclient-westeros-wpe-image_FBT_nightly-20240226-dunfell_20240226060227","manufacturer":"Dummy response for make.","model":"REALTEKHANK","networkInterfaces":[{"connected":true,"dns":[],"ipAddress":"2601:4c:0:420:210:20ff:fe30:7ec5","macAddress":"00:10:20:30:7e:c5","type":"Ethernet"},{"connected":false,"dns":[],"ipAddress":"","macAddress":"ec:9c:32:aa:c5:d4","type":"Wifi"}],"screenHeightPixels":1080,"screenWidthPixels":1920,"serialNumber":"hanke500","status":200,"uptimeSince":1709046790000}

Compliance Suite Response Init call takes 600ms but subsequent ones about 400ms

d35@d35:~/Desktop/dab-works/dab-compliance-suite$ dabSingleTest DeviceInfoConformance

testing device/info   {} ... 
device/info Latency, Expected: 200 ms, Actual: 626 ms

device/info took more time than expected.

[ FAILED ]
{
  "chipset": "Realtek Hank",
  "deviceId": "001020307EC5",
  "displayType": "External",
  "firmwareBuild": "rdk-generic-mediaclient-westeros-wpe-image_FBT_nightly-20240226-dunfell_20240226060227",
  "firmwareVersion": "rdk-generic-mediaclient-westeros-wpe-image_FBT_nightly-20240226-dunfell_20240226060227",
  "manufacturer": "Dummy response for make.",
  "model": "REALTEKHANK",
  "networkInterfaces": [
    {
      "connected": true,
      "dns": [],
      "ipAddress": "2601:4c:0:420:210:20ff:fe30:7ec5",
      "macAddress": "00:10:20:30:7e:c5",
      "type": "Ethernet"
    },
    {
      "connected": false,
      "dns": [],
      "ipAddress": "",
      "macAddress": "ec:9c:32:aa:c5:d4",
      "type": "Wifi"
    }
  ],
  "screenHeightPixels": 1080,
  "screenWidthPixels": 1920,
  "serialNumber": "hanke500",
  "status": 200,
  "uptimeSince": 1709046789000
}
d35@d35:~/Desktop/dab-works/dab-compliance-suite$ 
d35@d35:~/Desktop/dab-works/dab-compliance-suite$ dabSingleTest DeviceInfoConformance

testing device/info   {} ... 
device/info Latency, Expected: 200 ms, Actual: 412 ms

device/info took more time than expected.

[ FAILED ]
{
  "chipset": "Realtek Hank",
  "deviceId": "001020307EC5",
  "displayType": "External",
  "firmwareBuild": "rdk-generic-mediaclient-westeros-wpe-image_FBT_nightly-20240226-dunfell_20240226060227",
  "firmwareVersion": "rdk-generic-mediaclient-westeros-wpe-image_FBT_nightly-20240226-dunfell_20240226060227",
  "manufacturer": "Dummy response for make.",
  "model": "REALTEKHANK",
  "networkInterfaces": [
    {
      "connected": true,
      "dns": [],
      "ipAddress": "2601:4c:0:420:210:20ff:fe30:7ec5",
      "macAddress": "00:10:20:30:7e:c5",
      "type": "Ethernet"
    },
    {
      "connected": false,
      "dns": [],
      "ipAddress": "",
      "macAddress": "ec:9c:32:aa:c5:d4",
      "type": "Wifi"
    }
  ],
  "screenHeightPixels": 1080,
  "screenWidthPixels": 1920,
  "serialNumber": "hanke500",
  "status": 200,
  "uptimeSince": 1709046790000
}
d35@d35:~/Desktop/dab-works/dab-compliance-suite$