Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions Tests/vDeviceTests/HdmiCecSourceApis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
send_standby_message = (
'curl --max-time 5 '
'--header "Content-Type: application/json" '
'--request POST '
'-d \'{"jsonrpc":"2.0","id":42,"method":"org.rdk.HdmiCecSource.sendStandbyMessage"}\' '
'http://127.0.0.1:9998/jsonrpc'
)


get_device_list = (
'curl --max-time 5 '
'--header "Content-Type: application/json" '
'--request POST '
'-d \'{"jsonrpc":"2.0","id":42,"method":"org.rdk.HdmiCecSource.getDeviceList"}\' '
'http://127.0.0.1:9998/jsonrpc'
)


get_enabled = (
'curl --max-time 5 '
'--header "Content-Type: application/json" '
'--request POST '
'-d \'{"jsonrpc":"2.0","id":42,"method":"org.rdk.HdmiCecSource.getEnabled"}\' '
'http://127.0.0.1:9998/jsonrpc'
)


get_osd_name = (
'curl --max-time 5 '
'--header "Content-Type: application/json" '
'--request POST '
'-d \'{"jsonrpc":"2.0","id":42,"method":"org.rdk.HdmiCecSource.getOSDName"}\' '
'http://127.0.0.1:9998/jsonrpc'
)


get_otp_enabled = (
'curl --max-time 5 '
'--header "Content-Type: application/json" '
'--request POST '
'-d \'{"jsonrpc":"2.0","id":42,"method":"org.rdk.HdmiCecSource.getOTPEnabled"}\' '
'http://127.0.0.1:9998/jsonrpc'
)


get_vendor_id = (
'curl --max-time 5 '
'--header "Content-Type: application/json" '
'--request POST '
'-d \'{"jsonrpc":"2.0","id":42,"method":"org.rdk.HdmiCecSource.getVendorId"}\' '
'http://127.0.0.1:9998/jsonrpc'
)



perform_otp_action = (
'curl --max-time 8 '
'--header "Content-Type: application/json" '
'--request POST '
'-d \'{"jsonrpc":"2.0","id":42,"method":"org.rdk.HdmiCecSource.performOTPAction"}\' '
'http://127.0.0.1:9998/jsonrpc'
)


send_key_press_event = (
'curl --max-time 5 '
'--header "Content-Type: application/json" '
'--request POST '
'-d \'{"jsonrpc":"2.0","id":42,'
'"method":"org.rdk.HdmiCecSource.sendKeyPressEvent",'
'"params":{"logicalAddress":0,"keyCode":65}}\' '
'http://127.0.0.1:9998/jsonrpc'
)


set_enabled_false = (
'curl --max-time 8 '
'--header "Content-Type: application/json" '
'--request POST '
'-d \'{"jsonrpc":"2.0","id":42,'
'"method":"org.rdk.HdmiCecSource.setEnabled",'
'"params":{"enabled":false}}\' '
'http://127.0.0.1:9998/jsonrpc'
)


set_enabled_true = (
'curl --max-time 5 '
'--header "Content-Type: application/json" '
'--request POST '
'-d \'{"jsonrpc":"2.0","id":42,'
'"method":"org.rdk.HdmiCecSource.setEnabled",'
'"params":{"enabled":true}}\' '
'http://127.0.0.1:9998/jsonrpc'
)

set_osd_name = (
'curl --max-time 5 '
'--header "Content-Type: application/json" '
'--request POST '
'-d \'{"jsonrpc":"2.0","id":42,'
'"method":"org.rdk.HdmiCecSource.setOSDName",'
'"params":{"name":"Sky TV"}}\' '
'http://127.0.0.1:9998/jsonrpc'
)


set_otp_enabled_true = (
'curl --max-time 5 '
'--header "Content-Type: application/json" '
'--request POST '
'-d \'{"jsonrpc":"2.0","id":42,'
'"method":"org.rdk.HdmiCecSource.setOTPEnabled",'
'"params":{"enabled":true}}\' '
'http://127.0.0.1:9998/jsonrpc'
)


set_vendor_id = (
'curl --max-time 5 '
'--header "Content-Type: application/json" '
'--request POST '
'-d \'{"jsonrpc":"2.0","id":42,'
'"method":"org.rdk.HdmiCecSource.setVendorId",'
'"params":{"vendorid":"0x0019FB"}}\' '
'http://127.0.0.1:9998/jsonrpc'
)


set_otp_enabled_false = (
'curl --max-time 5 '
'--header "Content-Type: application/json" '
'--request POST '
'-d \'{"jsonrpc":"2.0","id":42,'
'"method":"org.rdk.HdmiCecSource.setOTPEnabled",'
'"params":{"enabled":false}}\' '
'http://127.0.0.1:9998/jsonrpc'
)
19 changes: 19 additions & 0 deletions Tests/vDeviceTests/README.txt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
To execute the cases inside qemu

cd /tmp

git clone git@github.com:rdkcentral/entservices-inputoutput.git

cd entservices-inputoutput/vDeviceTests

python3 suiteManager.py Hdmicecsource # to execute hdmicecsource testcases


python3 suiteManager.py ledindicator


errors incase if any:-

hdmicec_post_command.sh not found -
here in the testcases add the path where hdmicec_post_command.sh script is present inside the qemu
for eg tmp/vDeviceTests/vHdmiCec/vComponent_configurations/hdmicec_post_command.sh
Comment on lines +7 to +19
44 changes: 44 additions & 0 deletions Tests/vDeviceTests/TCID001.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import json
from utils import (
send_curl_command,
log_info,
log_success,
log_error,
log_warning
)
import HdmiCecSourceApis


def run_test():
expected_output_response = {
"jsonrpc": "2.0",
"id": 42,
"result": {
"success": True
}
}

log_info("Executing the curl command send standby message")

curl_response = send_curl_command(
HdmiCecSourceApis.send_standby_message
)

if not curl_response:
log_error("✖ curl command not sent")
return False

log_success("✔ curl command sent")
log_warning(f"Response: {curl_response}")

try:
if json.loads(curl_response) == expected_output_response:
log_success("TCID001 Passed ✅")
return True
else:
log_error("TCID001 Failed ❌")
return False
except json.JSONDecodeError:
log_error("Invalid JSON response")
log_error("TCID001 Failed ❌")
return False
86 changes: 86 additions & 0 deletions Tests/vDeviceTests/TCID002.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import json
from utils import (
send_curl_command,
log_info,
log_success,
log_error,
log_warning
)
import HdmiCecSourceApis


def run_test():
expected_output_response = {
"jsonrpc": "2.0",
"id": 42,
"result": {
"numberofdevices": 5,
"deviceList": [
{
"logicalAddress": 1,
"vendorID": "0099",
"osdName": "CECAdapter"
},
{
"logicalAddress": 4,
"vendorID": "0e036",
"osdName": "PIONEER"
},
{
"logicalAddress": 5,
"vendorID": "0a0de",
"osdName": "YAMAHA"
},
{
"logicalAddress": 6,
"vendorID": "01a11",
"osdName": "GOOGLE"
},
{
"logicalAddress": 7,
"vendorID": "00a1",
"osdName": "IPSTB"
},
{
"logicalAddress": 8,
"vendorID": "000",
"osdName": "Kishore"
}
],
Comment on lines +13 to +49
"success": True
}
}
log_info("Executing the curl command get device list")

curl_response = send_curl_command(
HdmiCecSourceApis.get_device_list
)

if not curl_response:
log_error("✖ curl command not sent")
return False

log_success("✔ curl command sent")
log_warning(f"Response: {curl_response}")

try:
actual_output_response = json.loads(curl_response)
expected_normalized = json.dumps(expected_output_response, sort_keys=True)
actual_normalized = json.dumps(actual_output_response, sort_keys=True)

if actual_normalized == expected_normalized:
log_success("TCID002 Passed ✅")
return True
else:
log_warning(
f"Expected: {json.dumps(expected_output_response, indent=2, sort_keys=True)}"
)
log_warning(
f"Actual : {json.dumps(actual_output_response, indent=2, sort_keys=True)}"
)
log_error("TCID002 Failed ❌")
return False
except json.JSONDecodeError:
log_error("Invalid JSON response")
log_error("TCID002 Failed ❌")
return False
45 changes: 45 additions & 0 deletions Tests/vDeviceTests/TCID003.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import json
from utils import (
send_curl_command,
log_info,
log_success,
log_error,
log_warning
)
import HdmiCecSourceApis


def run_test():
expected_output_response = {
"jsonrpc": "2.0",
"id": 42,
"result": {
"enabled": True,
"success": True
}
}

log_info("Executing the curl command get enabled Driver status")

curl_response = send_curl_command(
HdmiCecSourceApis.get_enabled
)

if not curl_response:
log_error("✖ curl command not sent")
return False

log_success("✔ curl command sent")
log_warning(f"Response: {curl_response}")

try:
if json.loads(curl_response) == expected_output_response:
log_success("TCID003 Passed ✅")
return True
else:
log_error("TCID003 Failed ❌")
return False
except json.JSONDecodeError:
log_error("Invalid JSON response")
log_error("TCID003 Failed ❌")
return False
45 changes: 45 additions & 0 deletions Tests/vDeviceTests/TCID004.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import json
from utils import (
send_curl_command,
log_info,
log_success,
log_error,
log_warning
)
import HdmiCecSourceApis


def run_test():
expected_output_response = {
"jsonrpc": "2.0",
"id": 42,
"result": {
"enabled": True,
"success": True
}
}

log_info("Executing the curl command get OTP enabled")

curl_response = send_curl_command(
HdmiCecSourceApis.get_otp_enabled
)

if not curl_response:
log_error("✖ curl command not sent")
return False

log_success("✔ curl command sent")
log_warning(f"Response: {curl_response}")

try:
if json.loads(curl_response) == expected_output_response:
log_success("TCID004 Passed ✅")
return True
else:
log_error("TCID004 Failed ❌")
return False
except json.JSONDecodeError:
log_error("Invalid JSON response")
log_error("TCID001 Failed ❌")
return False
Loading
Loading