diff --git a/L2HalMock/README.md b/L2HalMock/README.md new file mode 100644 index 00000000..1a089217 --- /dev/null +++ b/L2HalMock/README.md @@ -0,0 +1,139 @@ + +README contains all the dependencies based on the peru yml file and steps to build the emulator binaries.All the run time instructions ,VM setup instructions and package dependency instructions are captured in this repo + + + +# Utils dependencis for ubuntu 22.04 machine +------------------------------------------------ + + + + +## Generic dependencies +--------------------- +sudo apt install -y git + +pip install flake8 + +sudo pip install peru + +sudo apt-get install -y libtool + +suod apt install -y autoconf + +sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa -y + +sudo apt update + +sudo apt install -y g++-9 gcc-9 + +sudo apt-get install -y libglib2.0-dev + +sudo apt-get install -y libdbus-1-dev + +sudo apt-get install -y curl + + +# Install system-level dependencies +RUN apt-get update && \ + apt-get install -y \ + git \ + wget \ + vim \ + build-essential \ + libtool \ + autoconf \ + g++-9 \ + gcc-9 \ + libglib2.0-dev \ + libdbus-1-dev \ + curl \ + cmake \ + ninja-build \ + net-tools \ + netcat \ + psmisc \ + libusb-1.0-0-dev \ + zlib1g-dev \ + libssl-dev \ + python3-pip \ + libjsoncpp-dev \ + libjansson4 \ + libjansson-dev \ + libcurl4-openssl-dev \ + libwebsocketpp-dev \ + libwebsockets-dev \ + libboost-all-dev + +# Create a directory in the image where you want to copy the files +RUN mkdir -p /usr/lib/aarch64-linux-gnu/ + +# Copy files from the host machine to the image +RUN cp -r /usr/lib/x86_64-linux-gnu/dbus-1.0 /usr/lib/aarch64-linux-gnu/ + +# Copy the custom config files to the appropriate location in the image +COPY dbus/system.conf /usr/share/dbus-1/system.conf +COPY dbus/session.conf /usr/share/dbus-1/session.conf + + +## Thuder dependencies +-------------------- +sudo apt install -y build-essential cmake ninja-build libusb-1.0-0-dev zlib1g-dev libssl-dev + +sudo apt install -y python3-pip + +pip install jsonref + +## Hdmicec emulator hal dependencies +---------------------------------- +sudo apt-get install -y libjsoncpp-dev + +sudo apt-get install -y libjansson4 libjansson-dev + +sudo apt-get install -y libcurl4-openssl-dev + +sudo apt-get install -y libwebsocketpp-dev + +sudo apt-get install -y libwebsockets-dev + +pip install websockets + +sudo apt-get install -y libboost-all-dev + +## flask server dependencies +---------------------------- +sudo pip install pandas + +sudo pip install beautifulsoup4 + +sudo pip install flask + +sudo pip install colorama + +-------------------------------------------------- +# pre-setup +# clone rdk-e/rdkservices repository +# After cloning rdkservices.git, clone the repository https://github.com/rdk-e/FLASK-FOR-HAL-MOCK +# switch to branch peru, copy the peru.yaml file present insde the repo to L2HalMock folder inside rdkservices + +# Build step +----------------------------------------------- +./build.sh + +# Using Debug Build we can build individual modules +----------------------------------------------- +./debug_build.sh + +# Execute the framework +----------------------------------------------- +./run.sh + +# For executing test scripts +----------------------------------------------- +cd workspace/deps/rdk/flask/Test_Framework + +update details in Config.py + +python3 TestManager.py + + diff --git a/L2HalMock/README_CICD b/L2HalMock/README_CICD new file mode 100644 index 00000000..ffebc8c9 --- /dev/null +++ b/L2HalMock/README_CICD @@ -0,0 +1,18 @@ + README FOR CI CD HAL MOCK WORKFLOW + + + +--> HAL_MOCK yml is the workflow file designed to pull/setup the container/docker, build the binaries and execute testcases on the hal mock virtual environment. +--> A pull request/push on from a branch to sprint,release,develop and main triggers the HAL_MOCK yml. +--> Paths excluded in the yaml file are tools,tests,.github workflows and readme docs. Which makes the workflow to not trigger job when changes happens in any of these files. +--> Conditional commit message check has also been enabled in the workflow,which allows the user to trigger the hal mock environment job only when user specifies hdmicecsource_halmock in the commit message. +--> Workflow steps are:- + --> pull the customized docker from JFROG artifactory. + --> clone and build the required binaries for the mock environment inside docker. + --> make all services up + --> execute the currently developed testcases (L2) on Hdmicec source. + --> generate a test report containing the execution details. + --> fetch the report, upload it as an artifact. + --> users can download this test report artifact from the executed job summary. + --> stop all services +--> Destroy the container/Docker diff --git a/L2HalMock/Sample_Flask_Script.py b/L2HalMock/Sample_Flask_Script.py new file mode 100644 index 00000000..705bee3d --- /dev/null +++ b/L2HalMock/Sample_Flask_Script.py @@ -0,0 +1,127 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +import requests +import json + +flask_server = "127.0.0.1:8000" + +config_data = { + "apiName": "setDeviceConfig", + "arguments": { + "devices": [ + { + "device": [ + {"name": "xione_uk"}, + {"islocal": 1}, + {"type": "source"}, + {"powerState": 1}, + {"physicalAddress": "301"}, + {"logicalAddress": "3"}, + {"vendorId": "4567"}, + {"osdName": "404753747265616D696E672054776F"}, + {"optionalProperty1": "value1"}, + {"optionalProperty2": "value2"} + ] + }, + { + "device": [ + {"name": "amazon fire stick"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 1}, + {"physicalAddress": "304"}, + {"logicalAddress": "4"}, + {"vendorId": "4567"}, + {"osdName": "53747265616D696E67204F6E65"}, + {"optionalProperty1": "value1"}, + {"optionalProperty2": "value2"} + ] + }, + { + "device": [ + {"name": "amazon fire stick"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 1}, + {"physicalAddress": "304"}, + {"logicalAddress": "9"}, + {"vendorId": "4567"}, + {"osdName": "53747265616D696E67204F6E65"}, + {"optionalProperty1": "value1"}, + {"optionalProperty2": "value2"} + ] + }, + { + "device": [ + {"name": "hisense"}, + {"islocal": 0}, + {"type": "sink"}, + {"powerState": 1}, + {"physicalAddress": "0"}, + {"logicalAddress": "0"}, + {"vendorId": "0x4567"}, + {"osdName": "545620426F78"}, + {"optionalProperty1": "value1"}, + {"optionalProperty2": "value2"} + ] + } + ] + } + } + +api_data = { + "apiName": "setAPIConfig", + "arguments": { + "apiOverrides": [ + { + "HdmiCecOpen": [ + { "return": 1 }, + { "outParams": [{"handle": 2345678}] } + ] + }, + { + "HdmiCecGetLogicalAddress": [ + { "return": 0 }, + { "outParams": [{"logicalAddress": "0x4"}] } + ] + }, + { + "HdmiCecGetPhysicalAddress": [ + { "return": 0 }, + { "outParams": [{"physicalAddress": "0x304"}] } + ] + } + ] + } + } + + +# fetch the cec network data from flask using http get requests +createDevice_response = requests.get("http://{}/Database.setDeviceConfig/{}".format(flask_server, json.dumps(config_data))) +print(createDevice_response.text) + +# fetch the api overrides data from flask using http get requests +createApiOverrides_response = requests.get("http://{}/Hdmicec.setAPIConfig/{}".format(flask_server, json.dumps(api_data))) +print(createApiOverrides_response.text) + + diff --git a/L2HalMock/build.sh b/L2HalMock/build.sh new file mode 100644 index 00000000..31ab3ef5 --- /dev/null +++ b/L2HalMock/build.sh @@ -0,0 +1,222 @@ +#!/bin/bash + +# Access the passed plugins inside the script +SelectedPlugins="$1" + +echo "Building for Plugins: $SelectedPlugins" + +# Check for the presence of "string to find" +if grep -q "HdmiCecSource" <<< "$SelectedPlugins"; then + echo "Found: $SelectedPlugins" + HdmiCecSource="ON" +fi + +if grep -q "HdmiCecSink" <<< "$SelectedPlugins"; then + echo "Found: $SelectedPlugins" + HdmiCecSink="ON" +fi + +# Define ANSI color codes for green +GREEN='\033[0;32m' # Green text +NC='\033[0m' # No color (resets to default) + +SCRIPT=$(readlink -f "$0") +SCRIPTS_DIR=`dirname "$SCRIPT"` +RDK_DIR=$SCRIPTS_DIR/../ +WORKSPACE=$SCRIPTS_DIR/workspace +rm -rf $WORKSPACE; +mkdir $WORKSPACE; + +cd $WORKSPACE +echo -e "${GREEN}========================================Building thunder tools===============================================${NC}" +git clone -b R4_4 https://github.com/rdkcentral/ThunderTools.git +cmake -G Ninja -S ThunderTools -B $WORKSPACE/build/ThunderTools -DCMAKE_INSTALL_PREFIX="$WORKSPACE/install/usr" +cmake --build $WORKSPACE/build/ThunderTools --target install + +cd $WORKSPACE +echo -e "${GREEN}========================================Building Thunder===============================================${NC}" +git clone -b R4_4 https://github.com/rdkcentral/Thunder.git +cmake -G Ninja -S Thunder -B $WORKSPACE/build/Thunder -DBINDING="127.0.0.1" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_INSTALL_PREFIX="$WORKSPACE/install/usr" -DCMAKE_MODULE_PATH="${WORKSPACE}/install/usr/include/WPEFramework/Modules" -DDATA_PATH="${WORKSPACE}/install/usr/share/WPEFramework" -DPERSISTENT_PATH="${WORKSPACE}/install/var/wpeframework" -DPORT="55555" -DPROXYSTUB_PATH="${WORKSPACE}/install/usr/lib/wpeframework/proxystubs" -DSYSTEM_PATH="${WORKSPACE}/install/usr/lib/wpeframework/plugins" -DVOLATILE_PATH="tmp" +cmake --build $WORKSPACE/build/Thunder --target install + +echo -e "${GREEN}========================================Do peru sync===============================================${NC}" +(cp $SCRIPTS_DIR/peru.yaml . && peru sync && peru sync --no-cache) + + +echo -e "${GREEN}========================================Building flux===============================================${NC}" +(cd $WORKSPACE/deps/third-party/flux && autoreconf; autoreconf -f -i && ./configure && make && make install && cd -) + + +echo -e "${GREEN}========================================Building directfb===============================================${NC}" +(cd $WORKSPACE/deps/third-party/directfb && autoreconf; autoreconf -f -i && ./configure && make && make install && cd -) + + +echo -e "${GREEN}========================================Building log4c===============================================${NC}" +(cd $WORKSPACE/deps/third-party/log4c && autoreconf; autoreconf -f -i && ./configure && make && make install && cd -) + +set +e #exit on error +echo -e "${GREEN}========================================Building safeclib===============================================${NC}" +(cd $WORKSPACE/deps/third-party/safeclib && autoreconf; autoreconf -f -i && ./configure && make && make install && cd -) + +echo -e "${GREEN}========================================Building dbus===============================================${NC}" +(cd $WORKSPACE/deps/third-party/dbus/ && autoreconf; autoreconf -f -i && ./configure && make && make install && cd -) + +echo -e "${GREEN}========================================Build glib===============================================${NC}" +(cd $WORKSPACE/deps/third-party/glib && meson _build && ninja -C _build ) + +echo -e "${GREEN}========================================SafeC header===============================================${NC}" +# cp -r $WORKSPACE/deps/rdk/safec/recipes-common/safec-common-wrapper/files/safec_lib.h /usr/include +cp -r $SCRIPTS_DIR/patches/rdkservices/iarmbus/safec_lib.h /usr/include +cd $WORKSPACE/deps/rdk/safec/recipes-common/safec-common-wrapper/files +# ls +cp -r $WORKSPACE/deps/third-party/safeclib/include/safe_str_lib.h /usr/include +# cp -r $SCRIPTS_DIR/patches/rdkservices/iarmbus/safe_str_lib.h /usr/include +cp -r $WORKSPACE/deps/third-party/safeclib/include/safe_config.h /usr/include +cp -r $WORKSPACE/deps/third-party/safeclib/include/safe_lib_errno.h /usr/include +cp -r $WORKSPACE/deps/third-party/safeclib/include/safe_types.h /usr/include +cp -r $WORKSPACE/deps/third-party/safeclib/include/safe_compile.h /usr/include +cp -r $WORKSPACE/deps/third-party/safeclib/include/safe_mem_lib.h /usr/include +cp -r $WORKSPACE/deps/third-party/dbus/dbus/*.h /usr/include/dbus-1.0/dbus +cp -r /usr/local/lib/libsafec* /usr/lib/ +cp -r $WORKSPACE/deps/third-party/glib/_build/glib/glibconfig.h /usr/include +cp -r $WORKSPACE/deps/rdk/halif-power_manager/include/*.h /usr/include +cp -r $WORKSPACE/deps/rdk/halif-deepsleep_manager/include/deepSleepMgr.h /usr/include +cp -r $WORKSPACE/deps/rdk/SyscallWrapper/source/secure_wrapper.h /usr/include +cp -r $WORKSPACE/deps/rdk/iarmmgrs/mfr/include/*.h /usr/include +cp -r $WORKSPACE/deps/rdk/iarmmgrs/hal/include/*.h /usr/include +cp -r $WORKSPACE/deps/rdk/iarmmgrs/sysmgr/include/*.h /usr/include +set +e #exit on error + + +echo -e "${GREEN}========================================iarmmgrs-emulator===============================================${NC}" +(cd $WORKSPACE/deps/rdk/iarmmgrs-emulator && ./build.sh) +mkdir -p $WORKSPACE/deps/rdk/iarmmgrs/install/lib +cp -r $WORKSPACE/deps/rdk/iarmmgrs-emulator/power/*.so $WORKSPACE/deps/rdk/iarmmgrs/install/lib +cp -r $WORKSPACE/deps/rdk/iarmmgrs-emulator/ir/*.so $WORKSPACE/deps/rdk/iarmmgrs/install/lib + +echo "Entering directory $PWD" +cp $SCRIPTS_DIR/env.sh $WORKSPACE/env.sh +cp $SCRIPTS_DIR/invokeEnv.sh $WORKSPACE/deps/rdk/env.sh +cd $WORKSPACE +set -e #exit on error +source ./env.sh + +set -x #enable debugging mode +# Build IARM +echo -e "${GREEN}========================================Build IARM===============================================${NC}" +cd $WORKSPACE/deps/rdk/iarmbus/ +rm build.sh +cp $SCRIPTS_DIR/patches/rdkservices/iarmbus/build.sh $WORKSPACE/deps/rdk/iarmbus/ +(cd $WORKSPACE/deps/rdk/iarmbus/ && ./build.sh) + +# Build DSHalMrg +echo -e "${GREEN}========================================Build DSHalMrg===============================================${NC}" +# Build DSHalMrg +(cd $WORKSPACE/deps/rdk/devicesettings/hal && make && make install) + +echo -e "${GREEN}========================================Build DeviceSettings===============================================${NC}" +# Build DeviceSettings +cd /usr/include/ +mkdir wdmp-c +cp $SCRIPTS_DIR/patches/rdkservices/files/wdmp-c.h /usr/include/wdmp-c +cp $SCRIPTS_DIR/patches/rdkservices/rfcapi.h /usr/include +cp $WORKSPACE/deps/rdk/halif-deepsleep_manager/include/deepSleepMgr.h /usr/include +(cd $WORKSPACE/deps/rdk/devicesettings/ && ./build.sh) + +echo -e "${GREEN}========================================Build glib===============================================${NC}" +(cd $WORKSPACE/deps/third-party/glib && meson _build && ninja -C _build && ninja -C _build install) +cp $WORKSPACE/deps/third-party/glib/_build/glib/glibconfig.h /usr/include/glib-2.0 + +echo -e "${GREEN}========================================iarm_event_Sender===============================================${NC}" +(cd $WORKSPACE/deps/rdk/sender/ && ./build.sh) + + +echo -e "${GREEN}========================================Build iarmmgr===============================================${NC}" +# Build iarmmgr +cd $WORKSPACE/deps/rdk/iarmmgrs +patch -s -p1 < $SCRIPTS_DIR/patches/rdkservices/iarmmgrs/ds.patch +rm build.sh +cp $SCRIPTS_DIR/patches/rdkservices/iarmmgrs/build.sh $WORKSPACE/deps/rdk/iarmmgrs +(cd $WORKSPACE/deps/rdk/iarmmgrs && ./build.sh) + +echo -e "${GREEN}========================================Build HdmiCec===============================================${NC}" +# Build HdmiCec +mv $WORKSPACE/deps/rdk/hdmicec/soc/L2HalMock/common $WORKSPACE/deps/rdk/hdmicec/soc/L2HalMock/common_bkp; +mv $WORKSPACE/deps/rdk/hdmicec/soc/L2HalMock/hdmicec-hal-emulator $WORKSPACE/deps/rdk/hdmicec/soc/L2HalMock/common +(cd $WORKSPACE/deps/rdk/hdmicec/ && ./build.sh) + +echo -e "${GREEN}========================================Build HdmiCecSource===============================================${NC}" +# Build HdmiCecSource +cd $WORKSPACE/install/usr/include/WPEFramework/Modules/ +patch -s -p0 < $SCRIPTS_DIR/patches/rdkservices/FindConfigGenerator_cmake.patch + +if grep -q "HdmiCecSource" <<< "$SelectedPlugins"; then +cp $SCRIPTS_DIR/patches/rdkservices/properties/HdmiCecSource/device.properties /etc/ +fi + +if grep -q "HdmiCecSink" <<< "$SelectedPlugins"; then +cp $SCRIPTS_DIR/patches/rdkservices/properties/HdmiCecSink/device.properties /etc/ +fi + +cd $WORKSPACE/ +#Run time dependency +mkdir -p $WORKSPACE/install/etc/WPEFramework/plugins +cp $SCRIPTS_DIR/patches/rdkservices/files/HdmiCecSource.json $WORKSPACE/install/etc/WPEFramework/plugins/ +cp $SCRIPTS_DIR/patches/rdkservices/files/HdmiCecSink.json $WORKSPACE/install/etc/WPEFramework/plugins/ + +#Code Coverage patch +# cd $RDK_DIR +# patch -s -p1 < $SCRIPTS_DIR/patches/rdkservices/HdmiCecSource.patch +# patch -s -p1 < $SCRIPTS_DIR/patches/rdkservices/HdmiCecSink.patch +# patch -s -p1 < $SCRIPTS_DIR/patches/rdkservices/FrontPanel.patch +# patch -s -p1 < $SCRIPTS_DIR/patches/rdkservices/Hdcp_Profile.patch + +#included CmakeHelperFunctions.cmake instead to during in CMakeLists.txt +cp ${WORKSPACE}/install/usr/lib/cmake/WPEFramework/common/CmakeHelperFunctions.cmake $WORKSPACE/install/usr/include/WPEFramework/Modules +cp -r $RDK_DIR/Tests/L2HALMockTests/. $WORKSPACE/deps/rdk/flask +cp $RDK_DIR/L2HalMock/patches/rdkservices/files/rfcapi.h $RDK_DIR/helpers + +#wdmp dependency +cd /usr/local/include/ +mkdir wdmp-c +cp $SCRIPTS_DIR/patches/rdkservices/files/wdmp-c.h /usr/local/include/wdmp-c + +cd /usr/include/ +mkdir rdk +cd /usr/include/rdk +mkdir iarmmgrs-hal +cp $WORKSPACE/deps/rdk/iarmmgrs/hal/include/pwrMgr.h /usr/include/rdk/iarmmgrs-hal + +sed -i 's/sendNotify/Notify/g' $RDK_DIR/HdmiCecSource/HdmiCecSource.cpp +sed -i 's/sendNotify/Notify/g' $RDK_DIR/HdmiCecSink/HdmiCecSink.cpp +sed -i 's/sendNotify/Notify/g' $RDK_DIR/HdcpProfile/HdcpProfile.cpp + +cd $RDK_DIR; +cmake -S . -B build \ +-DCMAKE_INSTALL_PREFIX="$WORKSPACE/install/usr" \ +-DCMAKE_MODULE_PATH="$WORKSPACE/install/usr/include/WPEFramework/Modules" \ +-DRDK_SERVICE_L2HALMOCK=ON \ +-DUSE_THUNDER_R4=ON \ +-DPLUGIN_HDMICECSOURCE=$HdmiCecSource \ +-DPLUGIN_HDMICECSINK=$HdmiCecSink \ +-DCOMCAST_CONFIG=OFF \ +-DCEC_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/ccec/include" \ +-DOSAL_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/osal/include" \ +-DCEC_HOST_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/host/include" \ +-DDS_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/install/lib/libds.so" \ +-DDS_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/ds/include" \ +-DDSHAL_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/hal/include" \ +-DDSRPC_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/rpc/include" \ +-DIARMBUS_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/iarmbus/core/include" \ +-DIARMRECEIVER_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/iarmmgrs/receiver/include" \ +-DIARMPWR_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/iarmmgrs/hal/include" \ +-DCEC_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/install/lib/libRCEC.so" \ +-DIARMBUS_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/iarmbus/install/libIARMBus.so" \ +-DDSHAL_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/install/lib/libdshalcli.so" \ +-DCEC_HAL_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/install/lib/libRCECHal.so" \ +-DOSAL_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/install/lib/libRCECOSHal.so" \ +-DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -Wall -Werror -Wno-error=format=-Wl,-wrap,system -Wl,-wrap,popen -Wl,-wrap,syslog" + +(cd $RDK_DIR && cmake --build build --target install) + +set +x #disable debugging mode diff --git a/L2HalMock/dbus/session.conf b/L2HalMock/dbus/session.conf new file mode 100644 index 00000000..cf9662c1 --- /dev/null +++ b/L2HalMock/dbus/session.conf @@ -0,0 +1,81 @@ + + + + + + session + + + + + unix:tmpdir=/tmp + + + EXTERNAL + + + + + + + + + + + + + + /etc/dbus-1/session.conf + + + session.d + + /etc/dbus-1/session.d + + + /etc/dbus-1/session-local.conf + + contexts/dbus_contexts + + + + + 1000000000 + 250000000 + 1000000000 + 250000000 + 1000000000 + + 120000 + 240000 + 150000 + 100000 + 10000 + 100000 + 10000 + 50000 + 50000 + 50000 + + diff --git a/L2HalMock/dbus/system.conf b/L2HalMock/dbus/system.conf new file mode 100644 index 00000000..c7314d51 --- /dev/null +++ b/L2HalMock/dbus/system.conf @@ -0,0 +1,229 @@ + + + + + + + + + + + system + + + + messagebus + + + + + + + + + + + + /usr/libexec/dbus-daemon-launch-helper + + + + /var/run/dbus/pid + + + + + + + + EXTERNAL + + + + unix:path=/run/dbus/system_bus_socket + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /etc/dbus-1/system.conf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + system.d + + /etc/dbus-1/system.d + + + + /etc/dbus-1/system-local.conf + + contexts/dbus_contexts + + + + diff --git a/L2HalMock/debug_build.sh b/L2HalMock/debug_build.sh new file mode 100644 index 00000000..4c1fd789 --- /dev/null +++ b/L2HalMock/debug_build.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +# Define ANSI color codes for green +GREEN='\033[0;32m' # Green text +YELLOW='\033[0;33m' # Yellow text +NC='\033[0m' # No color (resets to default) + +SCRIPT=$(readlink -f "$0") +SCRIPTS_DIR=`dirname "$SCRIPT"` +RDK_DIR=$SCRIPTS_DIR/../ +WORKSPACE=$SCRIPTS_DIR/workspace + +PS3='Please enter your choice: ' +options=("Build IARM" "Build DeviceSettings" "Build HdmiCec" "Build rdkservices" "Build All" "Quit") +# set -x #enable debugging mode +select opt in "${options[@]}" +do + case $opt in + "Build IARM") + echo "you chose choice $opt" + # Build IARM + echo -e "${GREEN}========================================Build IARM===============================================${NC}" + (cd $WORKSPACE/deps/rdk/iarmbus/ && ./build.sh) + ;; + "Build DeviceSettings") + echo "you chose choice $opt" + echo -e "${GREEN}========================================Build DeviceSettings===============================================${NC}" + # Build DeviceSettings + (cd $WORKSPACE/deps/rdk/devicesettings/ && ./build.sh) + ;; + + "Build HdmiCec") + echo "you chose choice $opt" + echo -e "${GREEN}========================================Build HdmiCec===============================================${NC}" + # Build HdmiCec + (cd $WORKSPACE/deps/rdk/hdmicec/ && ./build.sh) + ;; + + "Build rdkservices") + echo "you chose choice $opt" + echo -e "${GREEN}========================================Build rdkservices===============================================${NC}" + cd $RDK_DIR; + + cmake -S . -B build \ + -DCMAKE_INSTALL_PREFIX="$WORKSPACE/install/usr" \ + -DCMAKE_MODULE_PATH="$WORKSPACE/install/usr/include/WPEFramework/Modules" \ + -DPLUGIN_HDMICECSOURCE=ON \ + -DPLUGIN_HDMICECSINK=ON \ + -DUSE_THUNDER_R4=ON \ + -DCOMCAST_CONFIG=OFF \ + -DCEC_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/ccec/include" \ + -DOSAL_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/osal/include" \ + -DCEC_HOST_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/host/include" \ + -DDS_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/install/lib/libds.so" \ + -DDS_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/ds/include" \ + -DDSHAL_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/hal/include" \ + -DDSRPC_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/rpc/include" \ + -DIARMBUS_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/iarmbus/core/include" \ + -DIARMRECEIVER_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/iarmmgrs/receiver/include" \ + -DIARMPWR_INCLUDE_DIRS="$SCRIPTS_DIR/workspace/deps/rdk/iarmmgrs/hal/include" \ + -DCEC_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/install/lib/libRCEC.so" \ + -DIARMBUS_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/iarmbus/install/libIARMBus.so" \ + -DDSHAL_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/devicesettings/install/lib/libdshalcli.so" \ + -DCEC_HAL_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/install/lib/libRCECHal.so" \ + -DOSAL_LIBRARIES="$SCRIPTS_DIR/workspace/deps/rdk/hdmicec/install/lib/libRCECOSHal.so" \ + -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -Wall -Werror -Wno-error=format=-Wl,-wrap,system -Wl,-wrap,popen -Wl,-wrap,syslog" + + (cd $RDK_DIR && cmake --build build --target install) + ;; + + "Build All") + echo "you chose choice $opt" + echo -e "${GREEN}========================================Building All===============================================${NC}" + ./build.sh + ;; + + "Quit") + break + ;; + *) echo "invalid option $REPLY";; + esac + echo -e "${YELLOW}1) Build IARM 2) Build DeviceSettings 3) Build HdmiCec 4) Build rdkservices 5) Build All 6) Quit${NC}" +done + +set +x #disable debugging mode diff --git a/L2HalMock/env.sh b/L2HalMock/env.sh new file mode 100644 index 00000000..fa684191 --- /dev/null +++ b/L2HalMock/env.sh @@ -0,0 +1,91 @@ +set -x #enable debugging mode + +source /root/.bashrc +#If Local compliation enable below +# source ~/.bashrc + +export PLATFORM_SOC=intel + +SCRIPT=$(readlink -f "$0") +#SCRIPTS_DIR=`dirname "$SCRIPT"` +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +export BUILDS_DIR=$SCRIPT_DIR/workspace +export RDK_PROJECT_ROOT_PATH=$SCRIPT_DIR/workspace/deps/rdk +export COMBINED_ROOT=$BUILDS_DIR +export NUM_DIR=$BUILDS_DIR/96e2377 +export DS_PATH=$BUILDS_DIR/deps/rdk/devicesettings +export USE_DBUS=y +export TOOLCHAIN_DIR=$COMBINED_ROOT/sdk/toolchain/staging_dir +export CROSS_TOOLCHAIN=/usr +export CROSS_COMPILE=$CROSS_TOOLCHAIN/bin/i686-cm-linux +export CC=gcc-9 +export CXX=g++-9 +export OPENSOURCE_BASE=/usr +#export DFB_ROOT=$TOOLCHAIN_DIR +export DFB_LIB=$TOOLCHAIN_DIR/lib +export IARM_PATH=$BUILDS_DIR/deps/rdk/iarmbus +export FUSION_PATH=$BUILDS_DIR/deps/rdk/fusiondale +export SDK_FSROOT=$COMBINED_ROOT/sdk/fsroot/ramdisk +export FSROOT=$COMBINED_ROOT +export GLIB_INCLUDE_PATH=$CROSS_TOOLCHAIN/include/glib-2.0 +export GLIB_LIBRARY_PATH=/usr/local/lib +# export GLIB_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu +export GLIB_CONFIG_INCLUDE_PATH=$GLIB_LIBRARY_PATH/glib-2.0 +export GLIB_CONFIG_PATH=$GLIB_LIBRARY_PATH/glib-2.0 +export GLIBS='-lglib-2.0 -lz' + +export MFR_PATH=$COMBINED_ROOT/ri/mpe_os/platforms/intel/groveland/mfrlibs +export MFR_FPD_PATH=$COMBINED_ROOT/mfrlibs +export _ENABLE_WAKEUP_KEY=-D_ENABLE_WAKEUP_KEY +export RF4CE_PATH=$COMBINED_ROOT/rf4ce/ +export USE_GREEN_PEAK_RF4CE_INTERFACE=-DUSE_GREEN_PEAK_RF4CE_INTERFACE + +export IARM_LIB_PATH=$BUILDS_DIR/deps/rdk/iarmbus/install +THUNDER_LIB_PATH=$BUILDS_DIR/install/usr/lib +THUNDER_PATH=$BUILDS_DIR/install/usr/bin + +export SAFEC_INCLUDE_PATH=$BUILDS_DIR/deps/third-party/safeclib/src/.libs/ + +#export SAFECLIB_PATH=$BUILDS_DIR/deps/third-party/safeclib/include/ +export SAFEC_INCLUDE_PATH=/usr/local/include/libsafec + +export DFB_INCLUDE_PATH=/usr/local/include/directfb + +export HDMICEC_PATH=$BUILDS_DIR/deps/rdk/hdmicec +#export CCEC_HOST=${HDMICEC_PATH}/host/include/ccec/host +#export INCLUDE_DRI_IARMBUS=${HDMICEC_PATH}/ccec/drivers/include/ccec/drivers/iarmbus +#export CCEC_INCLUDE_CCEC=${HDMICEC_PATH}/ccec/include/ccec +#export DS_HAL_INCLUDE=${DS_PATH}/hal/include +#export DS_RPC_INCLUDE=${DS_PATH}/rpc/include +#export DS_DS_INCLUDE=${DS_PATH}/ds/include +#export IARM_CORE_INC=$BUILDS_DIR/deps/rdk/iarmbus/core/include +#export INCLUDE_OSAL=$BUILDS_DIR/deps/rdk/hdmicec/osal/include/osal +#export NUM_HAL_INCLUDE=$BUILDS_DIR/96e2377/hal/include +#export NUM_COMMON_INC=$NUM_DIR/mfr/common/include +#export NUM_IR_INC=$NUM_DIR/ir/include +#export NUM_POW_INC=$NUM_DIR/power/include +#export NUM_PWMGR_INC=$NUM_DIR/pwrmgr2/include +#export NUM_REC_INC=$NUM_DIR/receiver/include +HDMICEC_LIB_PATH=${HDMICEC_PATH}/install/lib + +DS_LIB_PATH=${DS_PATH}/install/lib + +export LD_LIBRARY_PATH=${THUNDER_LIB_PATH}:${IARM_LIB_PATH}:${HDMICEC_LIB_PATH}:${DS_LIB_PATH} + +DS_INCLUDE_PATH=${DS_PATH}/ds/include +IARM_INCLUDE_PATH=${IARM_PATH}/core/include +IARM_LIB_PATH=${IARM_PATH}/install +export IARM_MGRS_PATH=$BUILDS_DIR/deps/rdk/iarmmgrs +export IARM_MGRS=$BUILDS_DIR/deps/rdk/iarmmgrs +export GLIB_HEADER_PATH=$CROSS_TOOLCHAIN/include/glib-2.0 +export PLATFORM_SOC=L2HalMock +export UTILS_PATH=$IARM_MGRS/utils + +# Temporary +PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin + +export PATH=${IARM_MGRS}:${HDMICEC_PATH}:${HDMICEC_LIB_PATH}:${DS_PATH}:${IARM_PATH}:${IARM_LIB_PATH}:${DS_INCLUDE_PATH}:${DS_LIB_PATH}:${THUNDER_PATH}:${PATH} + +set +x #disable debugging mode + +echo "Done!" diff --git a/L2HalMock/generate_coveragereport.sh b/L2HalMock/generate_coveragereport.sh new file mode 100644 index 00000000..853a6568 --- /dev/null +++ b/L2HalMock/generate_coveragereport.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Define ANSI color codes for green +GREEN='\033[0;32m' # Green text +NC='\033[0m' # No color (resets to default) + +SCRIPT=$(readlink -f "$0") +SCRIPTS_DIR=`dirname "$SCRIPT"` +RDK_DIR=$SCRIPTS_DIR/../ + +echo -e "${GREEN}======================== Kill WPEFramework ====================================${NC}" +killall -QUIT WPEFramework +sleep 5 +echo -e "${GREEN}======================== Generate coverage Report ====================================${NC}" +cp ${RDK_DIR}/Tests/L2HALMockTests/Test_Framework/.lcovrc_halmock ~/.lcovrc + +lcov -c -o coverage.info -d ${RDK_DIR}/build/ +lcov -r coverage.info '/usr/include/*' '*/install/usr/include/*' '*/ccec/*' '*/helpers/*' -o filtered_coverage.info + +genhtml -o coverage -t "HALMock RDKServices Coverage" filtered_coverage.info \ No newline at end of file diff --git a/L2HalMock/invokeEnv.sh b/L2HalMock/invokeEnv.sh new file mode 100644 index 00000000..779c9c05 --- /dev/null +++ b/L2HalMock/invokeEnv.sh @@ -0,0 +1,4 @@ +set -x #enable debugging mode + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source $SCRIPT_DIR/../../../env.sh diff --git a/L2HalMock/manifest.txt b/L2HalMock/manifest.txt new file mode 100644 index 00000000..370998f9 --- /dev/null +++ b/L2HalMock/manifest.txt @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + +# + +# + + + +# + + + + + + diff --git a/L2HalMock/manifest.xml b/L2HalMock/manifest.xml new file mode 100644 index 00000000..f79b9287 --- /dev/null +++ b/L2HalMock/manifest.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + +# + +# + + +--- +diff --git a/FrontPanel/FrontPanel.cpp b/FrontPanel/FrontPanel.cpp +index e8a1dc5a..25bd6bf3 100644 +--- a/FrontPanel/FrontPanel.cpp ++++ b/FrontPanel/FrontPanel.cpp +@@ -67,6 +67,7 @@ + #define API_VERSION_NUMBER_MINOR 0 + #define API_VERSION_NUMBER_PATCH 6 + ++extern "C" void __gcov_exit(); + namespace + { + +@@ -224,6 +225,7 @@ namespace WPEFramework + patternUpdateTimer.Revoke(m_updateTimer); + + DeinitializeIARM(); ++ __gcov_exit(); + } + void FrontPanel::powerModeChange(const char *owner, IARM_EventId_t eventId, void *data, size_t len) + { diff --git a/L2HalMock/patches/rdkservices/Hdcp_Profile.patch b/L2HalMock/patches/rdkservices/Hdcp_Profile.patch new file mode 100644 index 00000000..d017c75d --- /dev/null +++ b/L2HalMock/patches/rdkservices/Hdcp_Profile.patch @@ -0,0 +1,23 @@ +Signed-off-by: Kishore Darmaradje +--- +diff --git a/HdcpProfile/HdcpProfile.cpp b/HdcpProfile/HdcpProfile.cpp +index 4eb5a3b0..40ec7c6c 100644 +--- a/HdcpProfile/HdcpProfile.cpp ++++ b/HdcpProfile/HdcpProfile.cpp +@@ -46,7 +46,7 @@ + #define API_VERSION_NUMBER_MAJOR 1 + #define API_VERSION_NUMBER_MINOR 0 + #define API_VERSION_NUMBER_PATCH 9 +- ++extern "C" void __gcov_exit(); + namespace WPEFramework + { + namespace { +@@ -102,6 +102,7 @@ namespace WPEFramework + //No need to run device::Manager::DeInitialize for individual plugin. As it is a singleton instance + //and shared among all wpeframework plugins + DeinitializeIARM(); ++ __gcov_exit(); + } + + void HdcpProfile::InitializeIARM() diff --git a/L2HalMock/patches/rdkservices/HdmiCecSink.json b/L2HalMock/patches/rdkservices/HdmiCecSink.json new file mode 100644 index 00000000..1fa25207 --- /dev/null +++ b/L2HalMock/patches/rdkservices/HdmiCecSink.json @@ -0,0 +1,10 @@ +{ + "locator":"libWPEFrameworkHdmiCecSink.so", + "classname":"HdmiCecSink", + "precondition":[ + "Platform" + ], + "callsign":"org.rdk.HdmiCecSink", + "autostart":true +} + diff --git a/L2HalMock/patches/rdkservices/HdmiCecSink.patch b/L2HalMock/patches/rdkservices/HdmiCecSink.patch new file mode 100644 index 00000000..066c274b --- /dev/null +++ b/L2HalMock/patches/rdkservices/HdmiCecSink.patch @@ -0,0 +1,33 @@ +Signed-off-by: Kishore Darmaradje +--- +diff --git a/HdmiCecSink/HdmiCecSink.cpp b/HdmiCecSink/HdmiCecSink.cpp +index 6dd5c229..ac078ca0 100644 +--- a/HdmiCecSink/HdmiCecSink.cpp ++++ b/HdmiCecSink/HdmiCecSink.cpp +@@ -172,7 +172,7 @@ static float cecVersion = 1.4; + static AllDeviceTypes allDevicetype = ALL_DEVICE_TYPES; + static std::vector rcProfile = {RC_PROFILE_TV}; + static std::vector deviceFeatures = {DEVICE_FEATURES_TV}; +- ++extern "C" void __gcov_exit(); + #define API_VERSION_NUMBER_MAJOR 1 + #define API_VERSION_NUMBER_MINOR 3 + #define API_VERSION_NUMBER_PATCH 7 +@@ -848,6 +848,7 @@ namespace WPEFramework + HdmiCecSink::_instance = nullptr; + DeinitializeIARM(); + LOGWARN(" HdmiCecSink Deinitialize() Done"); ++ __gcov_exit(); + } + + const void HdmiCecSink::InitializeIARM() +@@ -3418,7 +3419,8 @@ namespace WPEFramework + void HdmiCecSink::getCecVersion() + { + RFC_ParamData_t param = {0}; +- WDMP_STATUS status = getRFCParameter((char*)"thunderapi", TR181_HDMICECSINK_CEC_VERSION, ¶m); ++ // WDMP_STATUS status = getRFCParameter((char*)"thunderapi", TR181_HDMICECSINK_CEC_VERSION, ¶m); ++ WDMP_STATUS status = WDMP_FAILURE; + if(WDMP_SUCCESS == status && param.type == WDMP_STRING) { + LOGINFO("CEC Version from RFC = [%s] \n", param.value); + cecVersion = atof(param.value); diff --git a/L2HalMock/patches/rdkservices/HdmiCecSource.patch b/L2HalMock/patches/rdkservices/HdmiCecSource.patch new file mode 100644 index 00000000..24384b01 --- /dev/null +++ b/L2HalMock/patches/rdkservices/HdmiCecSource.patch @@ -0,0 +1,21 @@ +diff --git a/HdmiCecSource/HdmiCecSource.cpp b/HdmiCecSource/HdmiCecSource.cpp +index dbefbd1d..c9480ebc 100644 +--- a/HdmiCecSource/HdmiCecSource.cpp ++++ b/HdmiCecSource/HdmiCecSource.cpp +@@ -91,7 +91,7 @@ static int32_t powerState = 1; + static PowerStatus tvPowerState = 1; + static bool isDeviceActiveSource = false; + static bool isLGTvConnected = false; +- ++extern "C" void __gcov_exit(); + namespace WPEFramework + { + namespace { +@@ -521,6 +521,7 @@ namespace WPEFramework + smConnection = NULL; + + DeinitializeIARM(); ++ __gcov_exit(); + } + + void HdmiCecSource::sendKeyPressEvent(const int logicalAddress, int keyCode) diff --git a/L2HalMock/patches/rdkservices/SinkCoverage.patch b/L2HalMock/patches/rdkservices/SinkCoverage.patch new file mode 100644 index 00000000..9e01e5c1 --- /dev/null +++ b/L2HalMock/patches/rdkservices/SinkCoverage.patch @@ -0,0 +1,23 @@ +Signed-off-by: Kishore Darmaradje +--- +diff --git a/HdmiCecSink/HdmiCecSink.cpp b/HdmiCecSink/HdmiCecSink.cpp +index 6dd5c229..9d6dbb93 100644 +--- a/HdmiCecSink/HdmiCecSink.cpp ++++ b/HdmiCecSink/HdmiCecSink.cpp +@@ -172,7 +172,7 @@ static float cecVersion = 1.4; + static AllDeviceTypes allDevicetype = ALL_DEVICE_TYPES; + static std::vector rcProfile = {RC_PROFILE_TV}; + static std::vector deviceFeatures = {DEVICE_FEATURES_TV}; +- ++extern "C" void __gcov_exit(); + #define API_VERSION_NUMBER_MAJOR 1 + #define API_VERSION_NUMBER_MINOR 3 + #define API_VERSION_NUMBER_PATCH 7 +@@ -848,6 +848,7 @@ namespace WPEFramework + HdmiCecSink::_instance = nullptr; + DeinitializeIARM(); + LOGWARN(" HdmiCecSink Deinitialize() Done"); ++ __gcov_exit(); + } + + const void HdmiCecSink::InitializeIARM() diff --git a/L2HalMock/patches/rdkservices/files/CMakeLists.txt b/L2HalMock/patches/rdkservices/files/CMakeLists.txt new file mode 100644 index 00000000..969a3c63 --- /dev/null +++ b/L2HalMock/patches/rdkservices/files/CMakeLists.txt @@ -0,0 +1,70 @@ +### +# If not stated otherwise in this file or this component's LICENSE +# file the following copyright and licenses apply: +# +# Copyright 2023 RDK Management +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +### + +cmake_minimum_required(VERSION 3.3) +project(halmock) +find_package(WPEFramework PATHS ${WORKSPACE}/install/usr/lib/cmake/WPEFramework) +set(CMAKE_ROOT_DIR "${WORKSPACE}") +set(URL_INCLUDE_DIR "${WORKSPACE}/Thunder/Source/websocket") +# All packages that did not deliver a CMake Find script (and some deprecated scripts that need to be removed) +# are located in the cmake directory. Include it in the search. +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/") + +option(COMCAST_CONFIG "Comcast services configuration" ON) +if(COMCAST_CONFIG) + include(services.cmake) +endif() + +option(PLUGIN_OCICONTAINER "Include OCIContainer plugin" OFF) +option(PLUGIN_RUSTBRIDGE "Include RustBridge plugin" OFF) + +if(RDK_SERVICES_TEST) + include(tests.cmake) +endif() + +# Library installation section +string(TOLOWER ${NAMESPACE} STORAGE_DIRECTORY) + +# for writing pc and config files +include(${WORKSPACE}/install/usr/lib/cmake/WPEFramework/common/CmakeHelperFunctions.cmake) + +if(PLUGIN_HDMICECSOURCE) + add_subdirectory(HdmiCecSource) +endif() + +if(WPEFRAMEWORK_CREATE_IPKG_TARGETS) + set(CPACK_GENERATOR "DEB") + set(CPACK_DEB_COMPONENT_INSTALL ON) + set(CPACK_COMPONENTS_GROUPING IGNORE) + + set(CPACK_DEBIAN_PACKAGE_NAME "${WPEFRAMEWORK_PLUGINS_OPKG_NAME}") + set(CPACK_DEBIAN_PACKAGE_VERSION "${WPEFRAMEWORK_PLUGINS_OPKG_VERSION}") + set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${WPEFRAMEWORK_PLUGINS_OPKG_ARCHITECTURE}") + set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${WPEFRAMEWORK_PLUGINS_OPKG_MAINTAINER}") + set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${WPEFRAMEWORK_PLUGINS_OPKG_DESCRIPTION}") + set(CPACK_PACKAGE_FILE_NAME "${WPEFRAMEWORK_PLUGINS_OPKG_FILE_NAME}") + + # list of components from which packages will be generated + set(CPACK_COMPONENTS_ALL + ${NAMESPACE}WebKitBrowser + WPEInjectedBundle + ) + + include(CPack) +endif() diff --git a/L2HalMock/patches/rdkservices/files/FrontPanel.json b/L2HalMock/patches/rdkservices/files/FrontPanel.json new file mode 100644 index 00000000..dd829935 --- /dev/null +++ b/L2HalMock/patches/rdkservices/files/FrontPanel.json @@ -0,0 +1,9 @@ +{ + "locator":"libWPEFrameworkFrontPanel.so", + "classname":"FrontPanel", + "precondition":[ + "Platform" + ], + "callsign":"org.rdk.FrontPanel", + "autostart":true +} diff --git a/L2HalMock/patches/rdkservices/files/HdcpProfile.json b/L2HalMock/patches/rdkservices/files/HdcpProfile.json new file mode 100644 index 00000000..e69f0317 --- /dev/null +++ b/L2HalMock/patches/rdkservices/files/HdcpProfile.json @@ -0,0 +1,9 @@ +{ + "locator":"libWPEFrameworkHdcpProfile.so", + "classname":"HdcpProfile", + "precondition":[ + "Platform" + ], + "callsign":"org.rdk.HdcpProfile", + "autostart":true +} diff --git a/L2HalMock/patches/rdkservices/files/HdmiCecSink.json b/L2HalMock/patches/rdkservices/files/HdmiCecSink.json new file mode 100644 index 00000000..1fa25207 --- /dev/null +++ b/L2HalMock/patches/rdkservices/files/HdmiCecSink.json @@ -0,0 +1,10 @@ +{ + "locator":"libWPEFrameworkHdmiCecSink.so", + "classname":"HdmiCecSink", + "precondition":[ + "Platform" + ], + "callsign":"org.rdk.HdmiCecSink", + "autostart":true +} + diff --git a/L2HalMock/patches/rdkservices/files/HdmiCecSource.json b/L2HalMock/patches/rdkservices/files/HdmiCecSource.json new file mode 100644 index 00000000..45476e24 --- /dev/null +++ b/L2HalMock/patches/rdkservices/files/HdmiCecSource.json @@ -0,0 +1,9 @@ +{ + "locator":"libWPEFrameworkHdmiCecSource.so", + "classname":"HdmiCecSource", + "precondition":[ + "Platform" + ], + "callsign":"org.rdk.HdmiCecSource", + "autostart":true +} diff --git a/L2HalMock/patches/rdkservices/files/HdmiCecSource/CMakeLists.txt b/L2HalMock/patches/rdkservices/files/HdmiCecSource/CMakeLists.txt new file mode 100644 index 00000000..d5360e1d --- /dev/null +++ b/L2HalMock/patches/rdkservices/files/HdmiCecSource/CMakeLists.txt @@ -0,0 +1,73 @@ +# If not stated otherwise in this file or this component's license file the +# following copyright and licenses apply: +# +# Copyright 2020 RDK Management +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +set(PLUGIN_NAME HdmiCecSource) +set(MODULE_NAME ${NAMESPACE}${PLUGIN_NAME}) + +set(PLUGIN_HDMICECSOURCE_STARTUPORDER "" CACHE STRING "To configure startup order of HdmiCecSource plugin") +set_source_files_properties(HdmiCecSource.cpp PROPERTIES COMPILE_FLAGS "-fexceptions") + +find_package(${NAMESPACE}Plugins REQUIRED) + +add_library(${MODULE_NAME} SHARED + HdmiCecSource.cpp + Module.cpp) + +set_target_properties(${MODULE_NAME} PROPERTIES + CXX_STANDARD 11 + CXX_STANDARD_REQUIRED YES) + +find_package(DS) +find_package(IARMBus) +find_package(CEC) + +target_include_directories(${MODULE_NAME} PUBLIC ${URL_INCLUDE_DIR}) +target_include_directories(${MODULE_NAME} PUBLIC ${DS_INCLUDE_DIRS}) +target_include_directories(${MODULE_NAME} PUBLIC ${DSHAL_INCLUDE_DIRS}) +target_include_directories(${MODULE_NAME} PUBLIC ${DSRPC_INCLUDE_DIRS}) +target_include_directories(${MODULE_NAME} PUBLIC ${CEC_INCLUDE_DIRS}) +target_include_directories(${MODULE_NAME} PUBLIC ${OSAL_INCLUDE_DIRS}) +target_include_directories(${MODULE_NAME} PUBLIC ${CEC_HOST_INCLUDE_DIRS}) +target_include_directories(${MODULE_NAME} PUBLIC ${CEC_IARM_INCLUDE_DIRS}) +target_include_directories(${MODULE_NAME} PUBLIC ${IARMBUS_INCLUDE_DIRS}) +target_include_directories(${MODULE_NAME} PUBLIC ${IARMIR_INCLUDE_DIRS}) +target_include_directories(${MODULE_NAME} PUBLIC ${IARMRECEIVER_INCLUDE_DIRS}) +target_include_directories(${MODULE_NAME} PUBLIC ${IARMPWR_INCLUDE_DIRS}) +target_include_directories(${MODULE_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/helpers) + +file(GLOB libraries ${DS_LIBRARIES}/*.so) +foreach(lib ${libraries}) + target_link_libraries(${MODULE_NAME} PUBLIC ${NAMESPACE}Plugins::${NAMESPACE}Plugins ${lib}) +endforeach(lib) + +file(GLOB libraries ${IARM_LIBRARIES}/*.so) +foreach(lib ${libraries}) + target_link_libraries(${MODULE_NAME} PUBLIC ${NAMESPACE}Plugins::${NAMESPACE}Plugins ${lib}) +endforeach(lib) + +file(GLOB libraries ${CEC_LIBRARIES}/*.so) +foreach(lib ${libraries}) + target_link_libraries(${MODULE_NAME} PUBLIC ${NAMESPACE}Plugins::${NAMESPACE}Plugins ${lib}) +endforeach(lib) + +if (NOT RDK_SERVICES_TEST) + target_compile_options(${MODULE_NAME} PRIVATE -Wno-error=deprecated) +endif () + +install(TARGETS ${MODULE_NAME} + DESTINATION lib/${STORAGE_DIRECTORY}/plugins) + +write_config(${PLUGIN_NAME}) diff --git a/L2HalMock/patches/rdkservices/files/cmake/FindCEC.cmake b/L2HalMock/patches/rdkservices/files/cmake/FindCEC.cmake new file mode 100644 index 00000000..eddd7ebd --- /dev/null +++ b/L2HalMock/patches/rdkservices/files/cmake/FindCEC.cmake @@ -0,0 +1,62 @@ +# If not stated otherwise in this file or this component's license file the +# following copyright and licenses apply: +# +# Copyright 2020 RDK Management +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# - Try to find IARMBus +# Once done this will define +# IARMBUS_FOUND - System has IARMBus +# IARMBUS_INCLUDE_DIRS - The IARMBus include directories +# IARMBUS_LIBRARIES - The libraries needed to use IARMBus +# IARMBUS_FLAGS - The flags needed to use IARMBus +# + +find_package(PkgConfig) + +#find_library(CEC_LIBRARIES NAMES RCEC) +#find_library(CEC_IARM_LIBRARIES NAMES RCECIARMBusHal) +#find_library(OSAL_LIBRARIES NAMES RCECOSHal) + +#find_path(CEC_INCLUDE_DIRS NAMES ccec PATH_SUFFIXES ccec/include) +#find_path(OSAL_INCLUDE_DIRS NAMES osal PATH_SUFFIXES osal/include) +#find_path(CEC_HOST_INCLUDE_DIRS NAMES ccec/host PATH_SUFFIXES host/include) +#find_path(CEC_IARM_INCLUDE_DIRS NAMES ccec/drivers/iarmbus PATH_SUFFIXES ccec/drivers/include) + +#set(CEC_LIBRARIES "-Wl,--no-as-needed" ${CEC_LIBRARIES} ${CEC_IARM_LIBRARIES} ${OSAL_LIBRARIES} "-Wl,--as-needed") + +#set(CEC_LIBRARIES ${CEC_LIBRARIES} CACHE PATH "Path to library") + +#set(CEC_INCLUDE_DIRS ${CEC_INCLUDE_DIRS} ${OSAL_INCLUDE_DIRS} ${CEC_HOST_INCLUDE_DIRS} ${CEC_IARM_INCLUDE_DIRS}) +#set(CEC_INCLUDE_DIRS ${CEC_INCLUDE_DIRS} CACHE PATH "Path to include directories") + +set(CEC_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/hdmicec/ccec/include) +set(OSAL_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/hdmicec/osal/include) +set(CEC_HOST_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/hdmicec/host/include) +set(CEC_IARM_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/hdmicec/ccec/drivers/include) +message(STATUS "Anooj CEC_INCLUDE_DIRS: ${CEC_INCLUDE_DIRS}") +set(CEC_DIRS ${CEC_INCLUDE_DIRS} ${OSAL_INCLUDE_DIRS} ${CEC_HOST_INCLUDE_DIRS} ${CEC_IARM_INCLUDE_DIRS}) +message(STATUS "Anooj CEC_DIRS: ${CEC_DIRS}") +set(CEC_INCLUDE_DIRS ${CEC_INCLUDE_DIRS} CACHE PATH "Path to include directories") +set(CEC_LIBRARIES ${CMAKE_ROOT_DIR}/deps/rdk/hdmicec/install/lib) + +include(FindPackageHandleStandardArgs) +#FIND_PACKAGE_HANDLE_STANDARD_ARGS(IARMBUS DEFAULT_MSG IARMBUS_INCLUDE_DIRS IARMBUS_LIBRARIES) + +mark_as_advanced( + CEC_FOUND + CEC_INCLUDE_DIRS + CEC_LIBRARIES + CEC_LIBRARY_DIRS + CEC_FLAGS) diff --git a/L2HalMock/patches/rdkservices/files/cmake/FindDS.cmake b/L2HalMock/patches/rdkservices/files/cmake/FindDS.cmake new file mode 100644 index 00000000..49ce8de9 --- /dev/null +++ b/L2HalMock/patches/rdkservices/files/cmake/FindDS.cmake @@ -0,0 +1,57 @@ +# If not stated otherwise in this file or this component's license file the +# following copyright and licenses apply: +# +# Copyright 2020 RDK Management +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# - Try to find Display Settings library +# Once done this will define +# DS_FOUND - System has DS +# DS_INCLUDE_DIRS - The DS include directories +# DS_LIBRARIES - The libraries needed to use DS +# DS_FLAGS - The flags needed to use DS +# + +find_package(PkgConfig) + +#find_library(DS_LIBRARIES NAMES ds) +#find_library(DSHAL_LIBRARIES NAMES dshalcli) +#find_library(OEMHAL_LIBRARIES NAMES ds-hal) +#find_library(IARMBUS_LIBRARIES NAMES IARMBus) +#find_path(DS_INCLUDE_DIRS NAMES manager.hpp PATH_SUFFIXES ds/include) +#find_path(DSHAL_INCLUDE_DIRS NAMES dsTypes.h PATHS hal/include/) +#find_path(DSRPC_INCLUDE_DIRS NAMES dsMgr.h PATH_SUFFIXES rpc/include) + +#set(DS_LIBRARIES ${DS_LIBRARIES} ${DSHAL_LIBRARIES}) +#set(DS_LIBRARIES ${DS_LIBRARIES} CACHE PATH "Path to DS library") +#set(DS_INCLUDE_DIRS ${DS_INCLUDE_DIRS} ${DSHAL_INCLUDE_DIRS} ${DSRPC_INCLUDE_DIRS}) +set(DS_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/devicesettings/ds/include) +set(DSHAL_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/devicesettings/hal/include) +set(DSRPC_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/devicesettings/rpc/include) +set(DS_DIRS ${DS_INCLUDE_DIRS} ${DSHAL_INCLUDE_DIRS} ${DSRPC_INCLUDE_DIRS}) +set(DS_LIBRARIES ${CMAKE_ROOT_DIR}/deps/rdk/devicesettings/install/lib) +#set(DS_INCLUDE_DIRS ${DSHAL_INCLUDE_DIRS}) +#set(DS_INCLUDE_DIRS ${DS_INCLUDE_DIRS} CACHE PATH "Path to DS include") + + + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(DS DEFAULT_MSG DS_INCLUDE_DIRS DS_LIBRARIES) + +mark_as_advanced( + DS_FOUND + DS_INCLUDE_DIRS + DS_LIBRARIES + DS_LIBRARY_DIRS + DS_FLAGS) diff --git a/L2HalMock/patches/rdkservices/files/cmake/FindIARMBus.cmake b/L2HalMock/patches/rdkservices/files/cmake/FindIARMBus.cmake new file mode 100644 index 00000000..acede449 --- /dev/null +++ b/L2HalMock/patches/rdkservices/files/cmake/FindIARMBus.cmake @@ -0,0 +1,43 @@ +# If not stated otherwise in this file or this component's license file the +# following copyright and licenses apply: +# +# Copyright 2020 RDK Management +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# - Try to find IARMBus +# Once done this will define +# IARMBUS_FOUND - System has IARMBus +# IARMBUS_INCLUDE_DIRS - The IARMBus include directories +# IARMBUS_LIBRARIES - The libraries needed to use IARMBus +# IARMBUS_FLAGS - The flags needed to use IARMBus +# + +find_package(PkgConfig) + +set(IARMBUS_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/iarmbus/core/include) +set(IARMIR_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/iarmmgrs/ir/include) +set(IARMRECEIVER_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/iarmmgrs/receiver/include) +set(IARMPWR_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/iarmmgrs/hal/include) +set(IARM_DIRS ${IARMBUS_INCLUDE_DIRS} ${IARMIR_INCLUDE_DIRS} ${IARMRECEIVER_INCLUDE_DIRS} ${IARMPWR_INCLUDE_DIRS}) +set(IARM_LIBRARIES ${CMAKE_ROOT_DIR}/deps/rdk/iarmbus/install/) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(IARMBUS DEFAULT_MSG IARMBUS_INCLUDE_DIRS IARMBUS_LIBRARIES) + +mark_as_advanced( + IARMBUS_FOUND + IARMBUS_INCLUDE_DIRS + IARMBUS_LIBRARIES + IARMBUS_LIBRARY_DIRS + IARMBUS_FLAGS) diff --git a/L2HalMock/patches/rdkservices/files/rfcapi.h b/L2HalMock/patches/rdkservices/files/rfcapi.h new file mode 100644 index 00000000..d92f6d15 --- /dev/null +++ b/L2HalMock/patches/rdkservices/files/rfcapi.h @@ -0,0 +1,75 @@ +/* + * If not stated otherwise in this file or this component's Licenses.txt file the + * following copyright and licenses apply: + * + * Copyright 2016 RDK Management + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +#ifndef RFCAPI_H_ +#define RFCAPI_H_ + +#include +#include + +#define RFCVAR_FILE "/opt/secure/RFC/rfcVariable.ini" +#define TR181STORE_FILE "/opt/secure/RFC/tr181store.ini" + +#ifdef __cplusplus +extern "C" +{ +#endif +#ifndef RDKC +#include +#endif + +#define MAX_PARAM_LEN (2*1024) + +#ifdef RDKC +typedef enum +{ + SUCCESS=0, + FAILURE, + NONE, + EMPTY +}DATATYPE; +#endif + +#ifdef RDKC +typedef struct _RFC_Param_t { + char name[MAX_PARAM_LEN]; + char value[MAX_PARAM_LEN]; + DATATYPE type; +} RFC_ParamData_t; +#else +typedef struct _RFC_Param_t { + char name[MAX_PARAM_LEN]; + char value[MAX_PARAM_LEN]; + DATA_TYPE type; +} RFC_ParamData_t; +#endif +#ifdef RDKC +int getRFCParameter(const char* pcParameterName, RFC_ParamData_t *pstParamData); +#else +WDMP_STATUS getRFCParameter(const char *pcCallerID, const char* pcParameterName, RFC_ParamData_t *pstParamData); +WDMP_STATUS setRFCParameter(const char *pcCallerID, const char* pcParameterName, const char* pcParameterValue, DATA_TYPE eDataType); +const char* getRFCErrorString(WDMP_STATUS code); +bool isRFCEnabled(const char *); +bool isFileInDirectory(const char *, const char *); +#endif +#ifdef __cplusplus +} +#endif + +#endif diff --git a/L2HalMock/patches/rdkservices/files/wdmp-c.h b/L2HalMock/patches/rdkservices/files/wdmp-c.h new file mode 100644 index 00000000..b339e5c0 --- /dev/null +++ b/L2HalMock/patches/rdkservices/files/wdmp-c.h @@ -0,0 +1,261 @@ +/** +* Copyright 2016 Comcast Cable Communications Management, LLC +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +#ifndef __WDMP_C_H__ +#define __WDMP_C_H__ + +#include +#include + + +typedef enum +{ + WDMP_STRING = 0, + WDMP_INT, + WDMP_UINT, + WDMP_BOOLEAN, + WDMP_DATETIME, + WDMP_BASE64, + WDMP_LONG, + WDMP_ULONG, + WDMP_FLOAT, + WDMP_DOUBLE, + WDMP_BYTE, + WDMP_NONE +} DATA_TYPE; + +typedef enum +{ + WDMP_SUCCESS = 0, /**< Success. */ + WDMP_FAILURE, /**< General Failure */ + WDMP_ERR_TIMEOUT, + WDMP_ERR_NOT_EXIST, + WDMP_ERR_INVALID_PARAMETER_NAME, + WDMP_ERR_INVALID_PARAMETER_TYPE, + WDMP_ERR_INVALID_PARAMETER_VALUE, + WDMP_ERR_NOT_WRITABLE, + WDMP_ERR_SETATTRIBUTE_REJECTED, + WDMP_ERR_NAMESPACE_OVERLAP, + WDMP_ERR_UNKNOWN_COMPONENT, + WDMP_ERR_NAMESPACE_MISMATCH, + WDMP_ERR_UNSUPPORTED_NAMESPACE, + WDMP_ERR_DP_COMPONENT_VERSION_MISMATCH, + WDMP_ERR_INVALID_PARAM, + WDMP_ERR_UNSUPPORTED_DATATYPE, + WDMP_STATUS_RESOURCES, + WDMP_ERR_WIFI_BUSY, + WDMP_ERR_INVALID_ATTRIBUTES, + WDMP_ERR_WILDCARD_NOT_SUPPORTED, + WDMP_ERR_SET_OF_CMC_OR_CID_NOT_SUPPORTED, + WDMP_ERR_VALUE_IS_EMPTY, + WDMP_ERR_VALUE_IS_NULL, + WDMP_ERR_DATATYPE_IS_NULL, + WDMP_ERR_CMC_TEST_FAILED, + WDMP_ERR_NEW_CID_IS_MISSING, + WDMP_ERR_CID_TEST_FAILED, + WDMP_ERR_SETTING_CMC_OR_CID, + WDMP_ERR_INVALID_INPUT_PARAMETER, + WDMP_ERR_ATTRIBUTES_IS_NULL, + WDMP_ERR_NOTIFY_IS_NULL, + WDMP_ERR_INVALID_WIFI_INDEX, + WDMP_ERR_INVALID_RADIO_INDEX, + WDMP_ERR_ATOMIC_GET_SET_FAILED, + WDMP_ERR_DEFAULT_VALUE +} WDMP_STATUS; + +typedef struct +{ + char *name; + char *value; + DATA_TYPE type; +} param_t; + +typedef enum +{ + GET = 0, + GET_ATTRIBUTES, + SET, + SET_ATTRIBUTES, + TEST_AND_SET, + REPLACE_ROWS, + ADD_ROWS, + DELETE_ROW +} REQ_TYPE; + +typedef struct +{ + char *paramNames[512]; + size_t paramCnt; +} get_req_t; + +typedef struct +{ + param_t *param; + size_t paramCnt; +} set_req_t; + +typedef struct +{ + param_t *param; + char *newCid; + char *oldCid; + char *syncCmc; + size_t paramCnt; +} test_set_req_t; + + +typedef struct +{ + size_t paramCnt; + char **names; + char **values; +} TableData; + +typedef struct +{ + char *objectName; + TableData *rows; + size_t rowCnt; +} table_req_t; + +typedef struct { + REQ_TYPE reqType; + union { + get_req_t *getReq; + set_req_t *setReq; + table_req_t *tableReq; + test_set_req_t *testSetReq; + } u; +} req_struct; + +typedef struct +{ + char *name; + uint64_t start; + uint32_t duration; +} money_trace_span; + +typedef struct +{ + money_trace_span *spans; + size_t count; +} money_trace_spans; + +typedef struct +{ + char **paramNames; + size_t paramCnt; + param_t **params; + size_t *retParamCnt; +} get_res_t; + +typedef struct +{ + char *syncCMC; + char *syncCID; + param_t *params; +} param_res_t; + +typedef struct +{ + char *newObj; +} table_res_t; + +typedef struct +{ + REQ_TYPE reqType; + union { + get_res_t *getRes; + param_res_t *paramRes; + table_res_t *tableRes; + } u; + money_trace_spans *timeSpan; + WDMP_STATUS *retStatus; + size_t paramCnt; +} res_struct; + +/*----------------------------------------------------------------------------*/ +/* Macros */ +/*----------------------------------------------------------------------------*/ +/* none */ + +/*----------------------------------------------------------------------------*/ +/* Data Structures */ +/*----------------------------------------------------------------------------*/ +/* none */ + +/*----------------------------------------------------------------------------*/ +/* File Scoped Variables */ +/*----------------------------------------------------------------------------*/ +/* none */ + +/*----------------------------------------------------------------------------*/ +/* Function Prototypes */ +/*----------------------------------------------------------------------------*/ +/* none */ + +/*----------------------------------------------------------------------------*/ +/* External Functions */ +/*----------------------------------------------------------------------------*/ + +/** +* To convert json string to struct +* +* @note If the reqObj returned is not NULL, the value pointed at by +* bytes must be freed using wdmp_free_req_struct() by the caller. +* +* @param payload [in] payload JSON string to be converted +* @param reqObj [out] the resulting req_struct structure if successful +*/ + +void wdmp_parse_request(char * payload, req_struct **reqObj); + + +/** +* To convert response struct to json string + +* @param resObj [in] the response structure to be converted +* @param payload [out] the resulting payload string if successful +*/ + +void wdmp_form_response(res_struct *resObj, char **payload); + +/** +* Free the req_struct structure if allocated by the wdmp-c library. +* +* @note Do not call this function on the req_struct structure if the wdmp-c +* library did not create the structure! +* +* @param msg [in] the req_struct structure to free +*/ +void wdmp_free_req_struct( req_struct *reqObj ); + +/** +* Free the res_struct structure if allocated by the wdmp-c library. +* +* @note Do not call this function on the res_struct structure if the wdmp-c +* library did not create the structure! +* +* @param msg [in] the res_struct structure to free +*/ +void wdmp_free_res_struct( res_struct *resObj ); + +/*----------------------------------------------------------------------------*/ +/* Internal functions */ +/*----------------------------------------------------------------------------*/ +/* none */ + +#endif diff --git a/L2HalMock/patches/rdkservices/iarmbus/build.sh b/L2HalMock/patches/rdkservices/iarmbus/build.sh new file mode 100755 index 00000000..34c29ea9 --- /dev/null +++ b/L2HalMock/patches/rdkservices/iarmbus/build.sh @@ -0,0 +1,35 @@ +#!/bin/bash +########################################################################## +# If not stated otherwise in this file or this component's Licenses.txt +# file the following copyright and licenses apply: +# +# Copyright 2016 RDK Management +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +########################################################################## +# +set -x + +source $PWD/../env.sh + +export LDFLAGS="`pkg-config --libs libsafec`" +export USE_DBUS=y +export CXX=g++ +make +if [ $? -ne 0 ] ; then + echo IarmBus Build Failed + exit 1 +else + echo IarmBus Build Success + exit 0 +fi diff --git a/L2HalMock/patches/rdkservices/iarmmgrs/Makefile b/L2HalMock/patches/rdkservices/iarmmgrs/Makefile new file mode 100644 index 00000000..0e3bd8b7 --- /dev/null +++ b/L2HalMock/patches/rdkservices/iarmmgrs/Makefile @@ -0,0 +1,44 @@ +########################################################################## +# If not stated otherwise in this file or this component's Licenses.txt +# file the following copyright and licenses apply: +# +# Copyright 2016 RDK Management +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +########################################################################## +# +# List of Libraries +install_dir := ../install/bin +install_lib_dir := ../install/lib + +exe_ds := dsmgr + +executable := $(exe_ds) + +.PHONY: clean all $(executable) install + +all: clean $(executable) install + +$(executable): + $(MAKE) -C $@ + +install: + echo "Creating directory.." + mkdir -p $(install_dir) + mkdir -p $(install_lib_dir) + echo "Copying files now.." + cp $(exe_ds)/*Main $(install_dir) + +clean: + rm -rf $(install_dir) + rm -rf $(install_lib_dir) \ No newline at end of file diff --git a/L2HalMock/patches/rdkservices/iarmmgrs/build.sh b/L2HalMock/patches/rdkservices/iarmmgrs/build.sh new file mode 100644 index 00000000..a708a63e --- /dev/null +++ b/L2HalMock/patches/rdkservices/iarmmgrs/build.sh @@ -0,0 +1,34 @@ +#!/bin/bash +########################################################################## +# If not stated otherwise in this file or this component's Licenses.txt +# file the following copyright and licenses apply: +# +# Copyright 2016 RDK Management +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +########################################################################## +# +set -x + +source $PWD/../env.sh + +export USE_DBUS=y +# export CXX=g++ +make +if [ $? -ne 0 ] ; then + echo iarmmgr Build Failed + exit 1 +else + echo iarmmgr Build Success + exit 0 +fi \ No newline at end of file diff --git a/L2HalMock/patches/rdkservices/iarmmgrs/ds.patch b/L2HalMock/patches/rdkservices/iarmmgrs/ds.patch new file mode 100644 index 00000000..0d55a76d --- /dev/null +++ b/L2HalMock/patches/rdkservices/iarmmgrs/ds.patch @@ -0,0 +1,36 @@ +diff --git a/dsmgr/dsMgrPwrEventListener.c b/dsmgr/dsMgrPwrEventListener.c +index 034b733..90674d0 100644 +--- a/dsmgr/dsMgrPwrEventListener.c ++++ b/dsmgr/dsMgrPwrEventListener.c +@@ -117,7 +117,7 @@ void initPwrEventListner() + } + + try { +- device::Manager::load(); ++ device::Manager::Initialize(); + INT_DEBUG("device::Manager::load success.\n"); + } + catch (...){ +diff --git a/power/pwrMgr.c b/power/pwrMgr.c +index 550df26..df0e80b 100755 +--- a/power/pwrMgr.c ++++ b/power/pwrMgr.c +@@ -845,15 +845,15 @@ void performReboot(const char * requestor, const char * reboot_reason_custom, co + char * reboot_reason_other_cpy = strdup(reboot_reason_other); + + std::thread async_reboot_thread([requestor_cpy, reboot_reason_custom_cpy, reboot_reason_other_cpy] () { +- v_secure_system("echo 0 > /opt/.rebootFlag"); ++ // v_secure_system("echo 0 > /opt/.rebootFlag"); + sleep(5); + if(0 == access("/rebootNow.sh", F_OK)) + { +- v_secure_system("/rebootNow.sh -s '%s' -r '%s' -o '%s'", requestor_cpy, reboot_reason_custom_cpy, reboot_reason_other_cpy); ++ // v_secure_system("/rebootNow.sh -s '%s' -r '%s' -o '%s'", requestor_cpy, reboot_reason_custom_cpy, reboot_reason_other_cpy); + } + else + { +- v_secure_system("/lib/rdk/rebootNow.sh -s '%s' -r '%s' -o '%s'", requestor_cpy, reboot_reason_custom_cpy, reboot_reason_other_cpy); ++ // v_secure_system("/lib/rdk/rebootNow.sh -s '%s' -r '%s' -o '%s'", requestor_cpy, reboot_reason_custom_cpy, reboot_reason_other_cpy); + } + free(requestor_cpy); + free(reboot_reason_custom_cpy); diff --git a/L2HalMock/patches/rdkservices/iarmmgrs/dsmgr/Makefile b/L2HalMock/patches/rdkservices/iarmmgrs/dsmgr/Makefile new file mode 100644 index 00000000..de4f5d5a --- /dev/null +++ b/L2HalMock/patches/rdkservices/iarmmgrs/dsmgr/Makefile @@ -0,0 +1,75 @@ +### +# If not stated otherwise in this file or this component's LICENSE +# file the following copyright and licenses apply: +# +# Copyright 2024 RDK Management +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +### + +RM := rm -rf +CFLAGS := -g -fPIC -D_REENTRANT -Wall +OBJS := $(patsubst %.c,%.o,$(wildcard *.c)) +CPPLAGS := -g -fPIC -D_REENTRANT -Wall +EXECUTABLE = dsSrvMain +INCLUDE = -I. \ + -I$(IARM_PATH)/core/ \ + -I$(IARM_PATH)/core/include \ + -I$(IARM_MGRS)/sysmgr/include \ + -I$(IARM_MGRS)/hal/include \ + -I$(IARM_MGRS)/mfr/include \ + -I$(DS_PATH)/rpc/include \ + -I$(DS_PATH)/hal/include \ + -I$(DS_PATH)/ds/include \ + -I$(DS_PATH)/hal/src \ + -I$(GLIB_HEADER_PATH)/ \ + -I$(GLIB_HEADER_PATH)/glib/ \ + -I$(GLIB_CONFIG_PATH)/../lib/glib-2.0/include/ \ + -I$(GLIB_INCLUDE_PATH)/ \ + -I$(DFB_ROOT)/usr/local/include/directfb \ + -I$(SAFEC_INCLUDE_PATH) + +INSTALL := $(PWD)/install + +CFLAGS += $(INCLUDE) + +# LDFLAGS +=-Wl,--copy-dt-needed-entries,-rpath,$(SDK_FSROOT)/usr/local/lib +# LDFLAGS += -L$(IARM_PATH)/install -lIARMBus +# LDFLAGS += -L$(DS_PATH)/install/lib -lds -ldshalcli + +# LDFLAGS := -L$(CEC_ROOT)/ccec/drivers/iarmbus/install/lib -L$(CEC_ROOT)/osal/src/install/lib -L$(CEC_ROOT)/soc/$(PLATFORM_SOC)/common/install/lib -L$(CEC_ROOT)/ccec/src/install/lib +LDFLAGS += -L$(IARM_PATH)/install -L$(CEC_ROOT)/ccec/iarmbus +LDFLAGS += -L$(FUSION_PATH) -L$(DFB_LIB) -L$(OPENSOURCE_BASE)/lib -L$(GLIB_LIBRARY_PATH) -L$(DS_PATH)/install/lib -L$(SAFEC_LIB_PATH) $(GLIBS) -lIARMBus -lpthread -ldirect -lfusion -ldshalsrv -lds -lds-hal -lsafec-3.5 -lglib-2.0 +# LDFLAGS += -lnexus # couldn't find nexus and not sure if it is really needed yet. +# LDFLAGS += -L$(DS_PATH)/install/lib -lds -ldshalcli + +# LDFLAGS += -L /home/administrator/PROJECT/GIT_COMMIT/work/LATEST_COMMIT/rdkservices/L2HalMock/workspace/deps/rdk/iarmbus/install -lIARMBus +# LDFLAGS += -L /home/administrator/PROJECT/GIT_COMMIT/work/LATEST_COMMIT/rdkservices/L2HalMock/workspace/deps/rdk/devicesettings/install/lib -ldshalcli -ldshalsrv -lds + +all:clean executable + @echo "Build Finished...." + +executable: $(OBJS) + $(CXX) $(CFLAGS) $(OBJS) -o $(EXECUTABLE) $(LDFLAGS) + +%.o: %.c + @echo "Building $@ ...." + $(CXX) -c $< $(CFLAGS) -o $@ + +%.o: %.cpp + @echo "Building $@ ...." + $(CXX) -c $< $(CFLAGS) -o $@ + +clean: + @echo "Cleaning the directory..." + @$(RM) $(OBJS) $(EXECUTABLE) \ No newline at end of file diff --git a/L2HalMock/patches/rdkservices/iarmmgrs/dsmgr/dsMgr.c b/L2HalMock/patches/rdkservices/iarmmgrs/dsmgr/dsMgr.c new file mode 100644 index 00000000..d7cc18ad --- /dev/null +++ b/L2HalMock/patches/rdkservices/iarmmgrs/dsmgr/dsMgr.c @@ -0,0 +1,1035 @@ +/* + * If not stated otherwise in this file or this component's Licenses.txt file the + * following copyright and licenses apply: + * + * Copyright 2016 RDK Management + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + + + +/** +* @defgroup iarmmgrs +* @{ +* @defgroup dsmgr +* @{ +**/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "libIARM.h" +#include "libIBusDaemon.h" +#include "dsMgrInternal.h" +#include "libIBus.h" +#include "iarmUtil.h" + +#include "sysMgr.h" + +#include "dsMgr.h" +#include "dsUtl.h" +#include "dsError.h" +#include "dsTypes.h" +#include "dsRpc.h" +#include "dsVideoPort.h" +#include "dsVideoResolutionSettings.h" +#include "dsDisplay.h" +#include "dsAudioSettings.h" +#include "dsAudio.h" +#include "safec_lib.h" +#include "rfcapi.h" +#include "dsMgrPwrEventListener.h" + +extern IARM_Result_t _dsSetResolution(void *arg); +extern IARM_Result_t _dsGetResolution(void *arg); +extern IARM_Result_t _dsInitResolution(void *arg); +extern IARM_Result_t _dsGetAudioPort(void *arg); +extern IARM_Result_t _dsGetStereoMode(void *arg); +extern IARM_Result_t _dsSetStereoMode(void *arg); +extern IARM_Result_t _dsGetEDID(void *arg); +extern IARM_Result_t _dsGetEDIDBytes(void *arg); +extern IARM_Result_t _dsGetVideoPort(void *arg); +extern IARM_Result_t _dsIsDisplayConnected(void *arg); +extern IARM_Result_t _dsGetStereoAuto(void *arg); +extern IARM_Result_t _dsIsDisplaySurround(void *arg); +extern IARM_Result_t _dsGetForceDisable4K(void *arg); +extern IARM_Result_t _dsSetBackgroundColor(void *arg); +extern IARM_Result_t _dsGetIgnoreEDIDStatus(void *arg); +extern bool isComponentPortPresent(); + +extern bool dsGetHDMIDDCLineStatus(void); +static int _SetVideoPortResolution(); +static int _SetResolution(intptr_t* handle,dsVideoPortType_t PortType); +static void _EventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len); +static IARM_Result_t _SysModeChange(void *arg); +static void dumpHdmiEdidInfo(dsDisplayEDID_t* pedidData); +static int iTuneReady = 0; +static dsDisplayEvent_t edisplayEventStatus = dsDISPLAY_EVENT_MAX; +static pthread_t edsHDMIHPDThreadID; // HDMI HPD - HDMI Hot Plug detect events +static pthread_mutex_t tdsMutexLock; +static pthread_cond_t tdsMutexCond; +static void* _DSMgrResnThreadFunc(void *arg); +static void _setAudioMode(); +void _setEASAudioMode(); +static int iResnCount = 5; +static int iInitResnFlag = 0; +static bool bHDCPAuthenticated = false; +static bool bPwrMgeRFCEnabled = false; +IARM_Bus_Daemon_SysMode_t isEAS = IARM_BUS_SYS_MODE_NORMAL; // Default is Normal Mode + +#define RFC_PWRMGR2 "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.Power.PwrMgr2.Enable" + +/*DSMgr Glib variables */ +/* For glib APIs*/ +#include +GMainLoop *dsMgr_Gloop = NULL; +static gboolean heartbeatMsg(gpointer data); +static gboolean _SetResolutionHandler(gpointer data); +static guint hotplug_event_src = 0; +static gboolean dumpEdidOnChecksumDiff(gpointer data); +static bool IsIgnoreEdid_gs = false; + +static intptr_t getVideoPortHandle(_dsVideoPortType_t port) +{ + /* Get the HDMI Video Port Parameter */ + dsVideoPortGetHandleParam_t vidPortParam; + memset(&vidPortParam, 0, sizeof(vidPortParam)); + vidPortParam.type = port; + vidPortParam.index = 0; + _dsGetVideoPort(&vidPortParam); + return vidPortParam.handle; +} + +static bool isHDMIConnected() +{ + /* Get the Display connection status */ + dsVideoPortIsDisplayConnectedParam_t ConParam; + memset(&ConParam, 0, sizeof(ConParam)); + ConParam.handle = getVideoPortHandle(dsVIDEOPORT_TYPE_HDMI); + _dsIsDisplayConnected(&ConParam); + return ConParam.connected; +} + +IARM_Result_t DSMgr_Start() +{ + FILE *fDSCtrptr = NULL; + IARM_Bus_SYSMgr_GetSystemStates_Param_t tuneReadyParam; + + + setvbuf(stdout, NULL, _IOLBF, 0); + INT_INFO("Entering [%s] - [%s] - disabling io redirect buf \r\n", __FUNCTION__, IARM_BUS_DSMGR_NAME); + + /* Register with IARM Libs and Connect */ + IARM_Bus_Init(IARM_BUS_DSMGR_NAME); + IARM_Bus_Connect(); + IARM_Bus_RegisterEvent(IARM_BUS_DSMGR_EVENT_MAX); + + /*Initialize the DS Manager - DS Srv and DS HAL */ + dsMgr_init(); + + iInitResnFlag = 1; + dsEdidIgnoreParam_t ignoreEdidParam; + memset(&ignoreEdidParam,0,sizeof(ignoreEdidParam)); + ignoreEdidParam.handle = dsVIDEOPORT_TYPE_HDMI; + _dsGetIgnoreEDIDStatus(&ignoreEdidParam); + IsIgnoreEdid_gs = ignoreEdidParam.ignoreEDID; + __TIMESTAMP();printf("ResOverride DSMgr_Start IsIgnoreEdid_gs: %d\n", IsIgnoreEdid_gs); + /*Register the Events */ + IARM_Bus_RegisterEventHandler(IARM_BUS_SYSMGR_NAME,IARM_BUS_SYSMGR_EVENT_SYSTEMSTATE,_EventHandler); + IARM_Bus_RegisterEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG,_EventHandler); + IARM_Bus_RegisterEventHandler(IARM_BUS_DSMGR_NAME,IARM_BUS_DSMGR_EVENT_HDCP_STATUS,_EventHandler); + + /*Register EAS handler so that we can ensure audio settings for EAS */ + IARM_Bus_RegisterCall(IARM_BUS_COMMON_API_SysModeChange, _SysModeChange); + + RFC_ParamData_t rfcParam; + // WDMP_STATUS status = getRFCParameter("dsMgr", RFC_PWRMGR2, &rfcParam); + WDMP_STATUS status = WDMP_SUCCESS; + if(strncmp(rfcParam.value, "true",4) == 0) + { + bPwrMgeRFCEnabled= true; + __TIMESTAMP(); printf("dsMgr:RFC PwrMgr2 feature enabled \r\n"); + } + + if(bPwrMgeRFCEnabled) + { + /*Refactored dsMGR code*/ + initPwrEventListner(); + } + /* Create Thread for listening Hot Plug events */ + pthread_mutex_init (&tdsMutexLock, NULL); + pthread_cond_init (&tdsMutexCond, NULL); + pthread_create (&edsHDMIHPDThreadID, NULL, _DSMgrResnThreadFunc, NULL); + + /* Read the HDMI DDC Line delay to be introduced + * for setting the resolution + * The DDC line is used for EDID and HDCP Negotiation + */ + fDSCtrptr = fopen("/opt/ddcDelay","r"); + if (NULL != fDSCtrptr) + { + if(0 > fscanf(fDSCtrptr,"%d",&iResnCount)) + { + INT_INFO("Error: fscanf on ddcDelay failed"); + } + fclose (fDSCtrptr); + } + __TIMESTAMP(); printf("Retry DS manager Resolution count is iResnCount = %d \r\n",iResnCount); + + + IARM_Bus_Call(IARM_BUS_SYSMGR_NAME, IARM_BUS_SYSMGR_API_GetSystemStates, &tuneReadyParam, sizeof(tuneReadyParam)); + __TIMESTAMP(); printf("Tune Ready Status on start up is %d \r\n",tuneReadyParam.TuneReadyStatus.state); + + /* Read the Tune Ready status on startup and update the tune ready flag */ + if(1 == tuneReadyParam.TuneReadyStatus.state) + { + iTuneReady = 1; + } + + /* Create Main loop for DS Manager */ + dsMgr_Gloop = g_main_loop_new ( NULL , FALSE ); + if(dsMgr_Gloop != NULL){ + g_timeout_add_seconds (300 , heartbeatMsg , dsMgr_Gloop); + } + else { + INT_INFO("Fails to Create a main Loop for [%s] \r\n",IARM_BUS_DSMGR_NAME); + } + + if(!isHDMIConnected()) + { + __TIMESTAMP();printf("HDMI not connected at bootup -Schedule a handler to set the resolution .. \r\n"); + _SetVideoPortResolution(); + } + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t DSMgr_Loop() +{ + + /* DS Mgr loop */ + if(dsMgr_Gloop) + { + g_main_loop_run (dsMgr_Gloop); + g_main_loop_unref(dsMgr_Gloop); + } + return IARM_RESULT_SUCCESS; +} + +static gboolean heartbeatMsg(gpointer data) +{ + time_t curr = 0; + time(&curr); + INT_INFO("I-ARM BUS DS Mgr: HeartBeat at %s\r\n", ctime(&curr)); + return TRUE; +} + +IARM_Result_t DSMgr_Stop() +{ + + if(dsMgr_Gloop) + { + g_main_loop_quit(dsMgr_Gloop); + } + + IARM_Bus_Disconnect(); + IARM_Bus_Term(); + pthread_mutex_destroy (&tdsMutexLock); + pthread_cond_destroy (&tdsMutexCond); + + return IARM_RESULT_SUCCESS; +} + +/** + * @fn static IARM_Result_t _SysModeChange(void *arg){ + * @brief This function is a event handler which returns current system + * mode using IARM. It returns mode as "NORMAL", "WAREHOUSE","EAS" or "UNKNOWN". + * + * @param[in] void pointer to void, containing IARM_Bus_CommonAPI_SysModeChange_Param_t data. + * + * @return variable of IARM_Result_t type. + * @retval IARM_RESULT_SUCCESS On function completion. + */ +static IARM_Result_t _SysModeChange(void *arg) +{ + IARM_Bus_CommonAPI_SysModeChange_Param_t *param = (IARM_Bus_CommonAPI_SysModeChange_Param_t *)arg; + IARM_Bus_Daemon_SysMode_t isNextEAS = IARM_BUS_SYS_MODE_NORMAL; + + __TIMESTAMP();printf("[DSMgr] Recvd Sysmode Change::New mode --> %d,Old mode --> %d",param->newMode,param->oldMode); + + if ((param->newMode == IARM_BUS_SYS_MODE_EAS) || + (param->newMode == IARM_BUS_SYS_MODE_NORMAL)) + { + isNextEAS = param->newMode; + } + else + { + /* Do not process any other mode change as of now for DS Manager.. */ + return IARM_RESULT_SUCCESS; + } + + if ((isEAS == IARM_BUS_SYS_MODE_EAS) && (isNextEAS == IARM_BUS_SYS_MODE_NORMAL) ) { + isEAS = IARM_BUS_SYS_MODE_NORMAL; + _setAudioMode(); + } + else if ((isEAS == IARM_BUS_SYS_MODE_NORMAL) && (isNextEAS == IARM_BUS_SYS_MODE_EAS) ) { + /* + * Change the Audio Mode to Stereo if Current Audio Setting is Paasthrough + */ + isEAS = IARM_BUS_SYS_MODE_EAS; + _setEASAudioMode(); + + } + else { + /* no op for no mode change */ + } + return IARM_RESULT_SUCCESS; +} + +static void setBGColor(dsVideoBackgroundColor_t color) +{ + /* Get the HDMI Video Port Parameter */ + dsVideoPortGetHandleParam_t vidPortParam; + memset(&vidPortParam, 0, sizeof(vidPortParam)); + vidPortParam.type = dsVIDEOPORT_TYPE_HDMI; + vidPortParam.index = 0; + _dsGetVideoPort(&vidPortParam); + vidPortParam.handle; + + if(vidPortParam.handle != NULL) + { + dsSetBackgroundColorParam_t setBGColorParam; + memset(&setBGColorParam, 0, sizeof(setBGColorParam)); + setBGColorParam.color = color; + setBGColorParam.handle= vidPortParam.handle; + _dsSetBackgroundColor(&setBGColorParam); + } +} + + +/*Event Handler for DS Manager And Sys Manager Events */ +static void _EventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len) +{ + /*Handle only Sys Manager Events */ + if (strcmp(owner, IARM_BUS_SYSMGR_NAME) == 0) + { + /* Only handle state events */ + if (eventId != IARM_BUS_SYSMGR_EVENT_SYSTEMSTATE) return; + // __TIMESTAMP();printf("_sysMgrEventHandler invoked in DS Manager\r\n"); + IARM_Bus_SYSMgr_EventData_t *sysEventData = (IARM_Bus_SYSMgr_EventData_t*)data; + IARM_Bus_SYSMgr_SystemState_t stateId = sysEventData->data.systemStates.stateId; + int state = sysEventData->data.systemStates.state; + __TIMESTAMP();printf("_sysEventHandler invoked for stateid %d of state %d \r\n", stateId, state); + switch(stateId) { + case IARM_BUS_SYSMGR_SYSSTATE_TUNEREADY: + __TIMESTAMP();printf("Tune Ready Evenets in DS Manager \r\n"); + + if (0 == iTuneReady) + { + iTuneReady = 1; + + /* Set audio mode from persistent */ + _setAudioMode(); + + /* Un-block the Resolution Settings Thread */ + pthread_mutex_lock(&tdsMutexLock); + pthread_cond_signal(&tdsMutexCond); + pthread_mutex_unlock(&tdsMutexLock); + } + break; + default: + break; + } + }else if (strcmp(owner,IARM_BUS_DSMGR_NAME) == 0) + { + switch (eventId) { + case IARM_BUS_DSMGR_EVENT_HDMI_HOTPLUG: + { + + IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data; + + __TIMESTAMP();printf("[DsMgr] Got HDMI %s Event \r\n",(eventData->data.hdmi_hpd.event == dsDISPLAY_EVENT_CONNECTED ? "Connect" : "Disconnect")); + + setBGColor(dsVIDEO_BGCOLOR_NONE); + + /* Un-Block the Resolution Settings Thread */ + pthread_mutex_lock(&tdsMutexLock); + edisplayEventStatus = ((eventData->data.hdmi_hpd.event == dsDISPLAY_EVENT_CONNECTED) ? dsDISPLAY_EVENT_CONNECTED : dsDISPLAY_EVENT_DISCONNECTED); + pthread_cond_signal(&tdsMutexCond); + pthread_mutex_unlock(&tdsMutexLock); + + } + break; + case IARM_BUS_DSMGR_EVENT_HDCP_STATUS: + { + IARM_Bus_DSMgr_EventData_t *eventData = (IARM_Bus_DSMgr_EventData_t *)data; + IARM_Bus_SYSMgr_EventData_t HDCPeventData; + int status = eventData->data.hdmi_hdcp.hdcpStatus; + //__TIMESTAMP();printf("%s: IARM_BUS_DSMGR_EVENT_HDCP_STATUS event status :%d \r\n",__FUNCTION__, status); + + /* HDCP is enabled */ + HDCPeventData.data.systemStates.stateId = IARM_BUS_SYSMGR_SYSSTATE_HDCP_ENABLED; + HDCPeventData.data.systemStates.state = 1; + if (status == dsHDCP_STATUS_AUTHENTICATED ) + { + __TIMESTAMP();printf("Changed status to HDCP Authentication Pass !!!!!!!! ..\r\n"); + HDCPeventData.data.systemStates.state = 1; + bHDCPAuthenticated = true; + __TIMESTAMP();printf("HDCP success - Removed hotplug_event_src Time source %d and set resolution immediately \r\n",hotplug_event_src); + if(hotplug_event_src) + { + g_source_remove(hotplug_event_src); + hotplug_event_src = 0; + } + setBGColor(dsVIDEO_BGCOLOR_NONE); + if (!IsIgnoreEdid_gs) { + _SetVideoPortResolution(); + } + g_timeout_add_seconds((guint)1,dumpEdidOnChecksumDiff,NULL); + } + else if (status == dsHDCP_STATUS_AUTHENTICATIONFAILURE ) + { + __TIMESTAMP();printf("Changed status to HDCP Authentication Fail !!!!!!!! ..\r\n"); + HDCPeventData.data.systemStates.state = 0; + setBGColor(dsVIDEO_BGCOLOR_BLUE); + bHDCPAuthenticated = false; + if (!IsIgnoreEdid_gs) { + _SetVideoPortResolution(); + } + g_timeout_add_seconds((guint)1,dumpEdidOnChecksumDiff,NULL); + } + + IARM_Bus_BroadcastEvent(IARM_BUS_SYSMGR_NAME, (IARM_EventId_t) IARM_BUS_SYSMGR_EVENT_SYSTEMSTATE, (void *)&HDCPeventData, sizeof(HDCPeventData)); + + } + break; + default: + break; + } + } +} + +/* Set Video resolution on HDMI Hot Plug or Tune Ready events */ +static int _SetVideoPortResolution() +{ + intptr_t _hdmihandle = 0; + intptr_t _comphandle = 0; + bool connected=false; + int iCount = 0; + + + __TIMESTAMP(); printf("%s:Enter \r\n",__FUNCTION__); + + _hdmihandle = getVideoPortHandle(dsVIDEOPORT_TYPE_HDMI); + if(_hdmihandle != NULL) + { + + usleep(100*1000); //wait for 100 milli seconds + + + /* + * Check for HDMI DDC Line when HDMI is connected. + */ + connected = isHDMIConnected(); + if(iInitResnFlag && connected) + { + + #ifdef _INIT_RESN_SETTINGS + /*Wait for iResnCount*/ + while(iCount < iResnCount) + { + sleep(1); //wait for 1 sec + if (dsGetHDMIDDCLineStatus()) + { + break; + } + __TIMESTAMP(); printf ("Waiting for HDMI DDC Line to be ready for resolution Change...\r\n"); + iCount++; + } + #endif + } + + /*Set HDMI Resolution if Connected else COomponent or Composite Resolution */ + if(connected){ + + __TIMESTAMP(); printf("Setting HDMI resolution.......... \r\n"); + _SetResolution(&_hdmihandle,dsVIDEOPORT_TYPE_HDMI); + } + else { + _comphandle = getVideoPortHandle(dsVIDEOPORT_TYPE_COMPONENT); + + if (NULL != _comphandle) + { + __TIMESTAMP();printf("Setting Component/Composite Resolution.......... \r\n"); + _SetResolution(&_comphandle,dsVIDEOPORT_TYPE_COMPONENT); + } + else + { + __TIMESTAMP();printf("%s: NULL Handle for component\r\n",__FUNCTION__); + + intptr_t _compositehandle = getVideoPortHandle(dsVIDEOPORT_TYPE_BB); + + if (NULL != _compositehandle) + { + __TIMESTAMP();printf("Setting BB Composite Resolution.......... \r\n"); + _SetResolution(&_compositehandle,dsVIDEOPORT_TYPE_BB); + } + else + { + __TIMESTAMP();printf("%s: NULL Handle for Composite \r\n",__FUNCTION__); + intptr_t _rfhandle = getVideoPortHandle(dsVIDEOPORT_TYPE_RF); + if (NULL != _rfhandle) + { + __TIMESTAMP();printf("Setting RF Resolution.......... \r\n"); + _SetResolution(&_rfhandle,dsVIDEOPORT_TYPE_RF); + } + else + { + __TIMESTAMP();printf("%s: NULL Handle for RF \r\n",__FUNCTION__); + } + } + } + + } + } + else + { + __TIMESTAMP();printf("%s: NULL Handle for HDMI \r\n",__FUNCTION__); + } + __TIMESTAMP();printf("%s:Exit \r\n",__FUNCTION__); + return 0; +} + +/** + * @brief This Function does following : + * Read Persisted resolution + * Verify Persisted resolution with Platform and EDID resolution + * If fails set best EDID resolution supported by platform + * If fails Default to 720P + * If 720p is not supported by TV , Default to 480p + * @param void pointer Device Handle + * * @param Connection Status + ** @return void pointer (NULL) + */ +static int _SetResolution(intptr_t* handle,dsVideoPortType_t PortType) +{ + errno_t rc = -1; + intptr_t _displayHandle = 0; + int numResolutions = 0,i=0; + intptr_t _handle = *handle; + bool IsValidResolution = false; + dsVideoPortSetResolutionParam_t Setparam; + dsVideoPortGetResolutionParam_t Getparam; + dsVideoPortResolution_t *setResn = NULL; + dsDisplayEDID_t edidData; + dsDisplayGetEDIDParam_t Edidparam; + /* + * Default Resolution Compatible check is false - Do not Force compatible resolution on startup + */ + Setparam.forceCompatible = false; + + /*Initialize the struct*/ + memset(&edidData, 0, sizeof(edidData)); + + /* Return if Handle is NULL */ + if (_handle == NULL) + { + __TIMESTAMP();printf("_SetResolution - Got NULL Handle ..\r\n"); + return 0; + } + + /*Get the User Persisted Resolution Based on Handle */ + memset(&Getparam,0,sizeof(Getparam)); + Getparam.handle = _handle; + Getparam.toPersist = true; + _dsGetResolution(&Getparam); + dsVideoPortResolution_t *presolution = &Getparam.resolution; + __TIMESTAMP();printf("Got User Persisted Resolution - %s..\r\n",presolution->name); + + + if (PortType == dsVIDEOPORT_TYPE_HDMI) { + /*Get The Display Handle */ + dsGetDisplay(dsVIDEOPORT_TYPE_HDMI, 0, &_displayHandle); + if (_displayHandle) + { + /* Get the EDID Display Handle */ + memset(&Edidparam,0,sizeof(Edidparam)); + Edidparam.handle = _displayHandle; + _dsGetEDID(&Edidparam); + rc = memcpy_s(&edidData,sizeof(edidData), &Edidparam.edid, sizeof(Edidparam.edid)); + if(rc!=EOK) + { + ERR_CHK(rc); + } + dumpHdmiEdidInfo(&edidData); + numResolutions = edidData.numOfSupportedResolution; + __TIMESTAMP();printf("numResolutions is %d \r\n",numResolutions); + + /* If HDMI is connected and Low power Mode. + The TV might not Transmit the EDID information + Change the Resolution in Next Hot plug + DO not set the Resolution if TV is in DVI mode. + */ + if ((0 == numResolutions) || (!(edidData.hdmiDeviceType))) + { + + __TIMESTAMP();printf("Do not Set Resolution..The HDMI is not Ready !! \r\n"); + __TIMESTAMP();printf("numResolutions = %d edidData.hdmiDeviceType = %d !! \r\n",numResolutions,edidData.hdmiDeviceType); + return 0; + } + + /* + * Check if Persisted Resolution matches with + * TV Resolution list + */ + for (i = 0; i < numResolutions; i++) + { + setResn = &(edidData.suppResolutionList[i]); + printf("presolution->name : %s, resolution->name : %s\r\n",presolution->name,setResn->name); + if ((strcmp(presolution->name,setResn->name) == 0 )) + { + __TIMESTAMP();printf("Breaking..Got Platform Resolution - %s..\r\n",setResn->name); + IsValidResolution = true; + Setparam.forceCompatible = true; + break; + } + } + /* + * The Persisted Resolution Does not matches with TV resolution list + * Set the Best Resolution Supported by TV and Platform + */ + if (false == IsValidResolution) + { + /* Set the Best Resolution Supported by TV and Platform*/ + for (i = numResolutions-1; i >= 0; i--) + { + setResn = &(edidData.suppResolutionList[i]); + int pNumResolutions = dsUTL_DIM(kResolutions); + for (int j = pNumResolutions-1; j >=0; j--) + { + dsVideoPortResolution_t *pfResolution = &kResolutions[j]; + if (0 == (strcmp(pfResolution->name,setResn->name))) + { + __TIMESTAMP();printf("[DsMgr] Set Best TV Supported Resolution %s \r\n",pfResolution->name); + IsValidResolution = true; + break; + } + } + if (IsValidResolution) + { + break; + } + } + } + /* + * The Persisted Resolution Does not matches with TV and Platform + * Resolution List + * Force PLatform Default Resolution + */ + if (false == IsValidResolution) + { + /* Check if the Default platform resolution is supported by Platfrom resolution List i.e 720p */ + dsVideoPortResolution_t *defaultResn; + defaultResn = &kResolutions[kDefaultResIndex]; + for (i = 0; i < numResolutions; i++) + { + setResn = &(edidData.suppResolutionList[i]); + //printf("\n presolution->name : %s, resolution->name : %s\n",defaultResn->name,setResn->name); + if ((strcmp(defaultResn->name,setResn->name) == 0 )) + { + IsValidResolution = true; + __TIMESTAMP();printf("Breaking..Got Default Platform Resolution - %s..\r\n",setResn->name); + break; + } + } + } + + if (false == IsValidResolution) + { + /*Take 480p as resolution if both above cases fail */ + for (i = 0; i < numResolutions; i++) + { + setResn = &(edidData.suppResolutionList[i]); + if ((strcmp("480p",setResn->name) == 0 )) + { + __TIMESTAMP();printf("Breaking..Default to 480p Resolution - %s..\r\n",setResn->name); + IsValidResolution = true; + break; + } + } + } + + if (false == IsValidResolution) + { + /* Boot with the Resolution Supported by TV and Platform*/ + for (i = 0; i < numResolutions; i++) + { + setResn = &(edidData.suppResolutionList[i]); + size_t numResolutions = dsUTL_DIM(kResolutions); + for (size_t j = 0; j < numResolutions; j++) + { + dsVideoPortResolution_t *pfResolution = &kResolutions[j]; + if (0 == (strcmp(pfResolution->name,setResn->name))) + { + __TIMESTAMP();printf("[DsMgr] Boot with TV Supported Resolution %s \r\n",pfResolution->name); + IsValidResolution = true; + break; + } + } + } + } + } + } + else if (PortType == dsVIDEOPORT_TYPE_COMPONENT || PortType == dsVIDEOPORT_TYPE_BB || PortType == dsVIDEOPORT_TYPE_RF) + { + /* Set the Component / Composite Resolution */ + numResolutions = dsUTL_DIM(kResolutions); + for (i = 0; i < numResolutions; i++) + { + setResn = &kResolutions[i]; + if ((strcmp(presolution->name,setResn->name) == 0 )) + { + __TIMESTAMP();printf("Breaking..Got Platform Resolution - %s..\r\n",setResn->name); + IsValidResolution = true; + break; + } + } + } + /* If the Persisted Resolution settings does not matches with Platform Resolution - + Force Default on Component/Composite + This is to keep upward compatible and if we intend to + remove any resolution from Dynamic Resolution List + */ + if(false == IsValidResolution) + { + setResn = &kResolutions[kDefaultResIndex]; + } + + /* Set The Video Port Resolution in Requested Handle */ + Setparam.handle = _handle; + Setparam.toPersist = false; + + /* If 4K support is disabled and last known resolution is 4K, default to 720p (aka default resolution) */ + dsForceDisable4KParam_t res_4K_override; + memset(&res_4K_override, 0, sizeof(res_4K_override)); + _dsGetForceDisable4K((void *) &res_4K_override); + if(true == res_4K_override.disable) + { + if(0 == strncmp(presolution->name, "2160", 4)) + { + __TIMESTAMP();printf("User persisted 4K resolution. Now limiting to default (720p?) as 4K support is now disabled.\n"); + setResn = &kResolutions[kDefaultResIndex]; + } + } + + Setparam.resolution = *setResn; + + /* Call during Init*/ + #ifdef _INIT_RESN_SETTINGS + if(0 == iInitResnFlag) + { + printf("Init Platform Resolution - %s..\r\n",setResn->name); + _dsInitResolution(&Setparam); + return 0 ; + } + #endif + + _dsSetResolution(&Setparam); + return 0 ; +} + +/** + * @brief Thread entry fuction to post Resolution on Hot Plug and Tune ready Events + * + * This functions changes the device resolution on Hot Plug and Tune ready Events + * + * @param void pointer (NULL) + * + * @return void pointer (NULL) + */ +static void* _DSMgrResnThreadFunc(void *arg) +{ + + /* Loop */ + while (1) + { + __TIMESTAMP(); printf ("_DSMgrResnThreadFunc... wait for for HDMI or Tune Ready Events \r\n"); + + /*Wait for the Event*/ + pthread_mutex_lock(&tdsMutexLock); + pthread_cond_wait(&tdsMutexCond, &tdsMutexLock); + pthread_mutex_unlock(&tdsMutexLock); + + __TIMESTAMP();printf("%s: Setting Resolution On:: HDMI %s Event with TuneReady status = %d \r\n",__FUNCTION__, (edisplayEventStatus == dsDISPLAY_EVENT_CONNECTED ? "Connect" : "Disconnect"),iTuneReady); + + + //On hot plug event , Remove event source + if(hotplug_event_src) + { + g_source_remove(hotplug_event_src); + __TIMESTAMP();printf("Removed Hot Plug Event Time source %d \r\n",hotplug_event_src); + hotplug_event_src = 0; + } + + /*Set the Resolution only on HDMI Hot plug Connect and Tune Ready events */ + if((1 == iTuneReady) && (dsDISPLAY_EVENT_CONNECTED == edisplayEventStatus)) { + /*Set Video Output Port Resolution */ + if(bHDCPAuthenticated) + { + _SetVideoPortResolution(); + } + /* Set audio mode on HDMI hot plug */ + _setAudioMode(); + }/*Set the Resolution only on HDMI Hot plug - Disconnect and Tune Ready event */ + else if((1 == iTuneReady) && (dsDISPLAY_EVENT_DISCONNECTED == edisplayEventStatus)) { + /* * To avoid reoslution settings of HDMI hot plug when TV goes from power OFF to ON condition + * Delay the setting of resolution by 5 sec. This will help to filter out un-necessary + * resolution settings on HDMI hot plug. + */ + bHDCPAuthenticated = false; + if(isComponentPortPresent()) + { + hotplug_event_src = g_timeout_add_seconds((guint)5,_SetResolutionHandler,dsMgr_Gloop); + __TIMESTAMP();printf("Schedule a handler to set the resolution after 5 sec for %d time src.. \r\n",hotplug_event_src); + } + } + + } + return arg; +} + + +static gboolean _SetResolutionHandler(gpointer data) +{ + __TIMESTAMP();printf("Set Video Resolution after delayed time .. \r\n"); + _SetVideoPortResolution(); + hotplug_event_src = 0; + return FALSE; +} + + +void _setEASAudioMode() +{ + + if (isEAS != IARM_BUS_SYS_MODE_EAS) { + __TIMESTAMP();printf("EAS Not In progress..Do not Modify Audio \r\n"); + return; + } + + dsAudioGetHandleParam_t getHandle; + dsAudioSetStereoModeParam_t setMode; + int numPorts, i = 0; + + numPorts = dsUTL_DIM(kSupportedPortTypes); + for (i=0; i < numPorts; i++) + { + const dsAudioPortType_t *audioPort = &kSupportedPortTypes[i]; + memset(&getHandle, 0, sizeof(getHandle)); + getHandle.type = *audioPort; + getHandle.index = 0; + _dsGetAudioPort (&getHandle); + + memset(&setMode, 0, sizeof(setMode)); + setMode.handle = getHandle.handle; + setMode.toPersist = false; + _dsGetStereoMode(&setMode); + + if (setMode.mode == dsAUDIO_STEREO_PASSTHRU) { + /* In EAS, fallsback to Stereo */ + setMode.mode = dsAUDIO_STEREO_STEREO; + } + + __TIMESTAMP();printf("EAS Audio mode for audio port %d is : %d \r\n",getHandle.type, setMode.mode); + setMode.toPersist = false; + _dsSetStereoMode (&setMode); + } +} +/** + * @brief Local function to get and set audio mode + * + * This functions gets the audio mode from persistent and sets it + * + * @param NULL + * + * @return NULL + */ +static void _setAudioMode() +{ + if (isEAS == IARM_BUS_SYS_MODE_EAS) { + __TIMESTAMP();printf("EAS In progress..Do not Modify Audio \r\n"); + return; + } + + dsAudioGetHandleParam_t getHandle; + dsAudioSetStereoModeParam_t setMode; + int numPorts, i = 0; + + numPorts = dsUTL_DIM(kSupportedPortTypes); + for (i=0; i < numPorts; i++) + { + const dsAudioPortType_t *audioPort = &kSupportedPortTypes[i]; + memset(&getHandle, 0, sizeof(getHandle)); + getHandle.type = *audioPort; + getHandle.index = 0; + _dsGetAudioPort (&getHandle); + + memset(&setMode, 0, sizeof(setMode)); + setMode.handle = getHandle.handle; + setMode.toPersist = true; + _dsGetStereoMode(&setMode); + if (getHandle.type == dsAUDIOPORT_TYPE_SPDIF) { + } + else if (getHandle.type == dsAUDIOPORT_TYPE_HDMI) { + //check if it is connected + intptr_t vHandle = 0; + int autoMode = 0; + bool connected = 0; + bool IsSurround = false; + { + dsVideoPortGetHandleParam_t param; + memset(¶m, 0, sizeof(param)); + param.type = dsVIDEOPORT_TYPE_HDMI; + param.index = 0; + _dsGetVideoPort(¶m); + vHandle = param.handle; + //printf("Audio port has HDMI handle\r\n"); + } + { + dsVideoPortIsDisplayConnectedParam_t param; + memset(¶m, 0, sizeof(param)); + param.handle = vHandle; + _dsIsDisplayConnected(¶m); + connected = param.connected; + //printf("Audio port HDMI is connected to sink %d\r\n", connected); + } + + if (!(connected)) { + __TIMESTAMP();printf("HDMI Not Connected ..Do not Set Audio on HDMI !!! \r\n"); + continue; + } + + { + dsAudioSetStereoAutoParam_t param; + memset(¶m, 0, sizeof(param)); + param.handle = getHandle.handle; + _dsGetStereoAuto(¶m); + autoMode = param.autoMode; + //printf("Audio port HDMI is Auto mode %d\r\n", autoMode); + } + + //printf("Audio port HDMI %d is connected %d Auto mode %d\r\n", vHandle, connected, autoMode); + if (autoMode) { + /* If auto, then force surround */ + setMode.mode = dsAUDIO_STEREO_SURROUND; + } + + if (0) /* Do not enforce surround protection, let HAL do it*/ + { + dsVideoPortIsDisplaySurroundParam_t param; + param.handle = vHandle; + param.surround = false; + _dsIsDisplaySurround(¶m); + IsSurround = param.surround; + } + else + { + IsSurround = true; + } + if (!(IsSurround)) { + /* If Surround not supported , then force Stereo */ + setMode.mode = dsAUDIO_STEREO_STEREO; + __TIMESTAMP();printf("Surround mode not Supported on HDMI ..Set Stereo \r\n"); + } + } + __TIMESTAMP();printf("Audio mode for audio port %d is : %d \r\n",getHandle.type, setMode.mode); + setMode.toPersist = false; + _dsSetStereoMode (&setMode); + } +} + +/* This functions Dump the HDMI EDID Information of the box. + * + * @param NULL + * + * @return NULL + */ +static void dumpHdmiEdidInfo(dsDisplayEDID_t* pedidData) +{ + __TIMESTAMP();printf("Connected HDMI Display Device Info !!!!!\r\n"); + + if (NULL == pedidData) { + __TIMESTAMP(); printf("Received EDID is NULL \r\n"); + return; + } + + if(pedidData->monitorName) + printf("HDMI Monitor Name is %s \r\n",pedidData->monitorName); + printf("HDMI Manufacturing ID is %d \r\n",pedidData->serialNumber); + printf("HDMI Product Code is %d \r\n",pedidData->productCode); + printf("HDMI Device Type is %s \r\n",pedidData->hdmiDeviceType?"HDMI":"DVI"); + printf("HDMI Sink Device %s a Repeater \r\n",pedidData->isRepeater?"is":"is not"); + printf("HDMI Physical Address is %d:%d:%d:%d \r\n",pedidData->physicalAddressA, + pedidData->physicalAddressB,pedidData->physicalAddressC,pedidData->physicalAddressD); +} + + +static gboolean dumpEdidOnChecksumDiff(gpointer data) { + __TIMESTAMP();printf("dumpEdidOnChecksumDiff HDMI-EDID Dump>>>>>>>>>>>>>>\r\n"); + intptr_t _displayHandle = 0; + dsGetDisplay(dsVIDEOPORT_TYPE_HDMI, 0, &_displayHandle); + if (_displayHandle) { + int length = 0; + dsDisplayGetEDIDBytesParam_t EdidBytesParam; + static int cached_EDID_checksum = 0; + int current_EDID_checksum = 0; + memset(&EdidBytesParam,0,sizeof(EdidBytesParam)); + EdidBytesParam.handle = _displayHandle; + _dsGetEDIDBytes(&EdidBytesParam); + length = EdidBytesParam.length; + + if((length > 0) && (length <= 512)) { + unsigned char* edidBytes = EdidBytesParam.bytes; + for (int i = 0; i < (length / 128); i++) + current_EDID_checksum += edidBytes[(i+1)*128 - 1]; + + if((cached_EDID_checksum == 0) || (current_EDID_checksum != cached_EDID_checksum)) { + cached_EDID_checksum = current_EDID_checksum; + __TIMESTAMP();printf("HDMI-EDID Dump BEGIN>>>>>>>>>>>>>>\r\n"); + for (int i = 0; i < length; i++) { + if (i % 16 == 0) { + printf("\r\n"); + } + if (i % 128 == 0) { + printf("\r\n"); + } + printf("%02X ", edidBytes[i]); + } + printf("\nHDMI-EDID Dump END>>>>>>>>>>>>>>\r\n"); + } + } + } + return false; +} + +/** @} */ +/** @} */ diff --git a/L2HalMock/patches/rdkservices/patchRemove.patch b/L2HalMock/patches/rdkservices/patchRemove.patch new file mode 100644 index 00000000..7fa5a114 --- /dev/null +++ b/L2HalMock/patches/rdkservices/patchRemove.patch @@ -0,0 +1,58 @@ +Signed-off-by: Kishore Darmaradje +--- +diff --git a/HdmiCecSource/CMakeLists.txt b/HdmiCecSource/CMakeLists.txt +index daabbee3..bd14cca5 100644 +--- a/HdmiCecSource/CMakeLists.txt ++++ b/HdmiCecSource/CMakeLists.txt +@@ -40,6 +40,23 @@ target_include_directories(${MODULE_NAME} PRIVATE ${DS_INCLUDE_DIRS}) + + target_link_libraries(${MODULE_NAME} PUBLIC ${NAMESPACE}Plugins::${NAMESPACE}Plugins ${IARMBUS_LIBRARIES} ${CEC_LIBRARIES} ${DS_LIBRARIES} ) + ++if(HALMOCK_PROJECT) ++file(GLOB libraries ${DS_LIBRARIES}/*.so) ++foreach(lib ${libraries}) ++ target_link_libraries(${MODULE_NAME} PUBLIC ${NAMESPACE}Plugins::${NAMESPACE}Plugins ${lib}) ++endforeach(lib) ++ ++file(GLOB libraries ${IARM_LIBRARIES}/*.so) ++foreach(lib ${libraries}) ++ target_link_libraries(${MODULE_NAME} PUBLIC ${NAMESPACE}Plugins::${NAMESPACE}Plugins ${lib}) ++endforeach(lib) ++ ++file(GLOB libraries ${CEC_LIBRARIES}/*.so) ++foreach(lib ${libraries}) ++ target_link_libraries(${MODULE_NAME} PUBLIC ${NAMESPACE}Plugins::${NAMESPACE}Plugins ${lib}) ++endforeach(lib) ++endif() ++ + if (NOT RDK_SERVICES_TEST) + target_compile_options(${MODULE_NAME} PRIVATE -Wno-error=deprecated) + endif () +diff --git a/cmake/FindCEC.cmake b/cmake/FindCEC.cmake +index a55dbbd2..e9c2b3b5 100644 +--- a/cmake/FindCEC.cmake ++++ b/cmake/FindCEC.cmake +@@ -34,7 +34,9 @@ find_path(OSAL_INCLUDE_DIRS NAMES osal/Mutex.hpp PATH_SUFFIXES osal/include) + find_path(CEC_HOST_INCLUDE_DIRS NAMES ccec/host/RDK.hpp PATH_SUFFIXES host/include) + find_path(CEC_IARM_INCLUDE_DIRS NAMES ccec/drivers/iarmbus/CecIARMBusMgr.h PATH_SUFFIXES ccec/drivers/include) + ++if(NOT HALMOCK_PROJECT) + set(CEC_LIBRARIES "-Wl,--no-as-needed" ${CEC_LIBRARIES} ${CEC_IARM_LIBRARIES} ${OSAL_LIBRARIES} "-Wl,--as-needed") ++endif() + + set(CEC_LIBRARIES ${CEC_LIBRARIES} CACHE PATH "Path to CEC library") + +diff --git a/cmake/FindDS.cmake b/cmake/FindDS.cmake +index b858fffc..15ea879c 100644 +--- a/cmake/FindDS.cmake ++++ b/cmake/FindDS.cmake +@@ -33,7 +33,9 @@ find_path(DS_INCLUDE_DIRS NAMES manager.hpp PATH_SUFFIXES rdk/ds) + find_path(DSHAL_INCLUDE_DIRS NAMES dsTypes.h PATH_SUFFIXES rdk/ds-hal) + find_path(DSRPC_INCLUDE_DIRS NAMES dsMgr.h PATH_SUFFIXES rdk/ds-rpc) + ++if(NOT HALMOCK_PROJECT) + set(DS_LIBRARIES ${DS_LIBRARIES} ${DSHAL_LIBRARIES}) ++endif() + set(DS_LIBRARIES ${DS_LIBRARIES} CACHE PATH "Path to DS library") + set(DS_INCLUDE_DIRS ${DS_INCLUDE_DIRS} ${DSHAL_INCLUDE_DIRS} ${DSRPC_INCLUDE_DIRS}) + set(DS_INCLUDE_DIRS ${DS_INCLUDE_DIRS} CACHE PATH "Path to DS include") diff --git a/L2HalMock/patches/rdkservices/properties/HdmiCecSink/device.properties b/L2HalMock/patches/rdkservices/properties/HdmiCecSink/device.properties new file mode 100644 index 00000000..97edd191 --- /dev/null +++ b/L2HalMock/patches/rdkservices/properties/HdmiCecSink/device.properties @@ -0,0 +1 @@ +RDK_PROFILE=TV diff --git a/L2HalMock/patches/rdkservices/properties/HdmiCecSource/device.properties b/L2HalMock/patches/rdkservices/properties/HdmiCecSource/device.properties new file mode 100644 index 00000000..2170d504 --- /dev/null +++ b/L2HalMock/patches/rdkservices/properties/HdmiCecSource/device.properties @@ -0,0 +1 @@ +RDK_PROFILE=STB diff --git a/L2HalMock/patches/rdkservices/rdkservices_patch.patch b/L2HalMock/patches/rdkservices/rdkservices_patch.patch new file mode 100644 index 00000000..896d9dce --- /dev/null +++ b/L2HalMock/patches/rdkservices/rdkservices_patch.patch @@ -0,0 +1,276 @@ +Signed-off-by: Kishore Darmaradje +--- +diff -Naur rdkservices_org/cmake/FindCEC.cmake rdkservices/cmake/FindCEC.cmake +--- rdkservices_org/cmake/FindCEC.cmake 2024-01-23 09:20:14.254329106 -0500 ++++ rdkservices/cmake/FindCEC.cmake 2024-01-23 09:38:36.752032679 -0500 +@@ -25,21 +25,31 @@ + + find_package(PkgConfig) + +-find_library(CEC_LIBRARIES NAMES RCEC) +-find_library(CEC_IARM_LIBRARIES NAMES RCECIARMBusHal) +-find_library(OSAL_LIBRARIES NAMES RCECOSHal) +- +-find_path(CEC_INCLUDE_DIRS NAMES ccec/Connection.hpp PATH_SUFFIXES ccec/include) +-find_path(OSAL_INCLUDE_DIRS NAMES osal/Mutex.hpp PATH_SUFFIXES osal/include) +-find_path(CEC_HOST_INCLUDE_DIRS NAMES ccec/host/RDK.hpp PATH_SUFFIXES host/include) +-find_path(CEC_IARM_INCLUDE_DIRS NAMES ccec/drivers/iarmbus/CecIARMBusMgr.h PATH_SUFFIXES ccec/drivers/include) +- +-set(CEC_LIBRARIES "-Wl,--no-as-needed" ${CEC_LIBRARIES} ${CEC_IARM_LIBRARIES} ${OSAL_LIBRARIES} "-Wl,--as-needed") +- +-set(CEC_LIBRARIES ${CEC_LIBRARIES} CACHE PATH "Path to CEC library") +- +-set(CEC_INCLUDE_DIRS ${CEC_INCLUDE_DIRS} ${OSAL_INCLUDE_DIRS} ${CEC_HOST_INCLUDE_DIRS} ${CEC_IARM_INCLUDE_DIRS}) +-set(CEC_INCLUDE_DIRS ${CEC_INCLUDE_DIRS} CACHE PATH "Path to CEC include") ++#find_library(CEC_LIBRARIES NAMES RCEC) ++#find_library(CEC_IARM_LIBRARIES NAMES RCECIARMBusHal) ++#find_library(OSAL_LIBRARIES NAMES RCECOSHal) ++ ++#find_path(CEC_INCLUDE_DIRS NAMES ccec PATH_SUFFIXES ccec/include) ++#find_path(OSAL_INCLUDE_DIRS NAMES osal PATH_SUFFIXES osal/include) ++#find_path(CEC_HOST_INCLUDE_DIRS NAMES ccec/host PATH_SUFFIXES host/include) ++#find_path(CEC_IARM_INCLUDE_DIRS NAMES ccec/drivers/iarmbus PATH_SUFFIXES ccec/drivers/include) ++ ++#set(CEC_LIBRARIES "-Wl,--no-as-needed" ${CEC_LIBRARIES} ${CEC_IARM_LIBRARIES} ${OSAL_LIBRARIES} "-Wl,--as-needed") ++ ++#set(CEC_LIBRARIES ${CEC_LIBRARIES} CACHE PATH "Path to library") ++ ++#set(CEC_INCLUDE_DIRS ${CEC_INCLUDE_DIRS} ${OSAL_INCLUDE_DIRS} ${CEC_HOST_INCLUDE_DIRS} ${CEC_IARM_INCLUDE_DIRS}) ++#set(CEC_INCLUDE_DIRS ${CEC_INCLUDE_DIRS} CACHE PATH "Path to include directories") ++ ++set(CEC_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/hdmicec/ccec/include) ++set(OSAL_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/hdmicec/osal/include) ++set(CEC_HOST_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/hdmicec/host/include) ++set(CEC_IARM_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/hdmicec/ccec/drivers/include) ++message(STATUS "Anooj CEC_INCLUDE_DIRS: ${CEC_INCLUDE_DIRS}") ++set(CEC_DIRS ${CEC_INCLUDE_DIRS} ${OSAL_INCLUDE_DIRS} ${CEC_HOST_INCLUDE_DIRS} ${CEC_IARM_INCLUDE_DIRS}) ++message(STATUS "Anooj CEC_DIRS: ${CEC_DIRS}") ++set(CEC_INCLUDE_DIRS ${CEC_INCLUDE_DIRS} CACHE PATH "Path to include directories") ++set(CEC_LIBRARIES ${CMAKE_ROOT_DIR}/deps/rdk/hdmicec/install/lib) + + include(FindPackageHandleStandardArgs) + #FIND_PACKAGE_HANDLE_STANDARD_ARGS(IARMBUS DEFAULT_MSG IARMBUS_INCLUDE_DIRS IARMBUS_LIBRARIES) +diff -Naur rdkservices_org/cmake/FindDS.cmake rdkservices/cmake/FindDS.cmake +--- rdkservices_org/cmake/FindDS.cmake 2024-01-23 09:20:14.254329106 -0500 ++++ rdkservices/cmake/FindDS.cmake 2024-01-23 09:20:26.374459926 -0500 +@@ -25,18 +25,24 @@ + + find_package(PkgConfig) + +-find_library(DS_LIBRARIES NAMES ds) +-find_library(DSHAL_LIBRARIES NAMES dshalcli) +-find_library(OEMHAL_LIBRARIES NAMES ds-hal) +-find_library(IARMBUS_LIBRARIES NAMES IARMBus) +-find_path(DS_INCLUDE_DIRS NAMES manager.hpp PATH_SUFFIXES ds/include) +-find_path(DSHAL_INCLUDE_DIRS NAMES dsTypes.h PATH_SUFFIXES hal/include) +-find_path(DSRPC_INCLUDE_DIRS NAMES dsMgr.h PATH_SUFFIXES rpc/include) +- +-set(DS_LIBRARIES ${DS_LIBRARIES} ${DSHAL_LIBRARIES}) +-set(DS_LIBRARIES ${DS_LIBRARIES} CACHE PATH "Path to DS library") +-set(DS_INCLUDE_DIRS ${DS_INCLUDE_DIRS} ${DSHAL_INCLUDE_DIRS} ${DSRPC_INCLUDE_DIRS}) +-set(DS_INCLUDE_DIRS ${DS_INCLUDE_DIRS} CACHE PATH "Path to DS include") ++#find_library(DS_LIBRARIES NAMES ds) ++#find_library(DSHAL_LIBRARIES NAMES dshalcli) ++#find_library(OEMHAL_LIBRARIES NAMES ds-hal) ++#find_library(IARMBUS_LIBRARIES NAMES IARMBus) ++#find_path(DS_INCLUDE_DIRS NAMES manager.hpp PATH_SUFFIXES ds/include) ++#find_path(DSHAL_INCLUDE_DIRS NAMES dsTypes.h PATHS hal/include/) ++#find_path(DSRPC_INCLUDE_DIRS NAMES dsMgr.h PATH_SUFFIXES rpc/include) ++ ++#set(DS_LIBRARIES ${DS_LIBRARIES} ${DSHAL_LIBRARIES}) ++#set(DS_LIBRARIES ${DS_LIBRARIES} CACHE PATH "Path to DS library") ++#set(DS_INCLUDE_DIRS ${DS_INCLUDE_DIRS} ${DSHAL_INCLUDE_DIRS} ${DSRPC_INCLUDE_DIRS}) ++set(DS_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/devicesettings/ds/include) ++set(DSHAL_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/devicesettings/hal/include) ++set(DSRPC_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/devicesettings/rpc/include) ++set(DS_DIRS ${DS_INCLUDE_DIRS} ${DSHAL_INCLUDE_DIRS} ${DSRPC_INCLUDE_DIRS}) ++set(DS_LIBRARIES ${CMAKE_ROOT_DIR}/deps/rdk/devicesettings/install/lib) ++#set(DS_INCLUDE_DIRS ${DSHAL_INCLUDE_DIRS}) ++#set(DS_INCLUDE_DIRS ${DS_INCLUDE_DIRS} CACHE PATH "Path to DS include") + + + +diff -Naur rdkservices_org/cmake/FindIARMBus.cmake rdkservices/cmake/FindIARMBus.cmake +--- rdkservices_org/cmake/FindIARMBus.cmake 2024-01-23 09:20:14.254329106 -0500 ++++ rdkservices/cmake/FindIARMBus.cmake 2024-01-23 09:20:26.374459926 -0500 +@@ -25,15 +25,12 @@ + + find_package(PkgConfig) + +-find_library(IARMBUS_LIBRARIES NAMES IARMBus) +-find_path(IARMBUS_INCLUDE_DIRS NAMES libIARM.h PATH_SUFFIXES core/include) +-find_path(IARMIR_INCLUDE_DIRS NAMES irMgr.h PATH_SUFFIXES ir/include) +-find_path(IARMRECEIVER_INCLUDE_DIRS NAMES receiverMgr.h PATH_SUFFIXES receiver/include) +-find_path(IARMPWR_INCLUDE_DIRS NAMES pwrMgr.h PATH_SUFFIXES hal/include) +- +-set(IARMBUS_LIBRARIES ${IARMBUS_LIBRARIES} CACHE PATH "Path to IARMBus library") +-set(IARMBUS_INCLUDE_DIRS ${IARMBUS_INCLUDE_DIRS} ${IARMIR_INCLUDE_DIRS} ${IARMRECEIVER_INCLUDE_DIRS} ${IARMPWR_INCLUDE_DIRS}) +-set(IARMBUS_INCLUDE_DIRS ${IARMBUS_INCLUDE_DIRS} ${IARMIR_INCLUDE_DIRS} ${IARMRECEIVER_INCLUDE_DIRS} ${IARMPWR_INCLUDE_DIRS} CACHE PATH "Path to IARMBus include") ++set(IARMBUS_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/iarmbus/core/include) ++set(IARMIR_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/iarmmgrs/ir/include) ++set(IARMRECEIVER_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/iarmmgrs/receiver/include) ++set(IARMPWR_INCLUDE_DIRS ${CMAKE_ROOT_DIR}/deps/rdk/iarmmgrs/hal/include) ++set(IARM_DIRS ${IARMBUS_INCLUDE_DIRS} ${IARMIR_INCLUDE_DIRS} ${IARMRECEIVER_INCLUDE_DIRS} ${IARMPWR_INCLUDE_DIRS}) ++set(IARM_LIBRARIES ${CMAKE_ROOT_DIR}/deps/rdk/iarmbus/install/) + + include(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(IARMBUS DEFAULT_MSG IARMBUS_INCLUDE_DIRS IARMBUS_LIBRARIES) +diff -Naur rdkservices_org/CMakeLists.txt rdkservices/CMakeLists.txt +--- rdkservices_org/CMakeLists.txt 2024-01-23 09:20:14.254329106 -0500 ++++ rdkservices/CMakeLists.txt 2024-01-23 09:20:26.378459949 -0500 +@@ -1,69 +1,70 @@ +-### +-# If not stated otherwise in this file or this component's LICENSE +-# file the following copyright and licenses apply: +-# +-# Copyright 2023 RDK Management +-# +-# Licensed under the Apache License, Version 2.0 (the "License"); +-# you may not use this file except in compliance with the License. +-# You may obtain a copy of the License at +-# +-# http://www.apache.org/licenses/LICENSE-2.0 +-# +-# Unless required by applicable law or agreed to in writing, software +-# distributed under the License is distributed on an "AS IS" BASIS, +-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-# See the License for the specific language governing permissions and +-# limitations under the License. +-### +- +-cmake_minimum_required(VERSION 3.3) +- +-find_package(WPEFramework) +- +-# All packages that did not deliver a CMake Find script (and some deprecated scripts that need to be removed) +-# are located in the cmake directory. Include it in the search. +-list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/") +- +-option(COMCAST_CONFIG "Comcast services configuration" ON) +-if(COMCAST_CONFIG) +- include(services.cmake) +-endif() +- +-option(PLUGIN_OCICONTAINER "Include OCIContainer plugin" OFF) +-option(PLUGIN_RUSTBRIDGE "Include RustBridge plugin" OFF) +- +-if(RDK_SERVICES_TEST) +- include(tests.cmake) +-endif() +- +-# Library installation section +-string(TOLOWER ${NAMESPACE} STORAGE_DIRECTORY) +- +-# for writing pc and config files +-include(CmakeHelperFunctions) +- +-if(PLUGIN_HDMICECSOURCE) +- add_subdirectory(HdmiCecSource) +-endif() +- +-if(WPEFRAMEWORK_CREATE_IPKG_TARGETS) +- set(CPACK_GENERATOR "DEB") +- set(CPACK_DEB_COMPONENT_INSTALL ON) +- set(CPACK_COMPONENTS_GROUPING IGNORE) +- +- set(CPACK_DEBIAN_PACKAGE_NAME "${WPEFRAMEWORK_PLUGINS_OPKG_NAME}") +- set(CPACK_DEBIAN_PACKAGE_VERSION "${WPEFRAMEWORK_PLUGINS_OPKG_VERSION}") +- set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${WPEFRAMEWORK_PLUGINS_OPKG_ARCHITECTURE}") +- set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${WPEFRAMEWORK_PLUGINS_OPKG_MAINTAINER}") +- set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${WPEFRAMEWORK_PLUGINS_OPKG_DESCRIPTION}") +- set(CPACK_PACKAGE_FILE_NAME "${WPEFRAMEWORK_PLUGINS_OPKG_FILE_NAME}") +- +- # list of components from which packages will be generated +- set(CPACK_COMPONENTS_ALL +- ${NAMESPACE}WebKitBrowser +- WPEInjectedBundle +- ) +- +- include(CPack) +-endif() ++### ++# If not stated otherwise in this file or this component's LICENSE ++# file the following copyright and licenses apply: ++# ++# Copyright 2023 RDK Management ++# ++# Licensed under the Apache License, Version 2.0 (the "License"); ++# you may not use this file except in compliance with the License. ++# You may obtain a copy of the License at ++# ++# http://www.apache.org/licenses/LICENSE-2.0 ++# ++# Unless required by applicable law or agreed to in writing, software ++# distributed under the License is distributed on an "AS IS" BASIS, ++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++# See the License for the specific language governing permissions and ++# limitations under the License. ++### ++ ++cmake_minimum_required(VERSION 3.3) ++project(halmock) ++find_package(WPEFramework PATHS ${WORKSPACE}/install/usr/lib/cmake/WPEFramework) ++set(CMAKE_ROOT_DIR "${WORKSPACE}") ++set(URL_INCLUDE_DIR "${WORKSPACE}/Thunder/Source/websocket") ++# All packages that did not deliver a CMake Find script (and some deprecated scripts that need to be removed) ++# are located in the cmake directory. Include it in the search. ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/") ++ ++option(COMCAST_CONFIG "Comcast services configuration" ON) ++if(COMCAST_CONFIG) ++ include(services.cmake) ++endif() ++ ++option(PLUGIN_OCICONTAINER "Include OCIContainer plugin" OFF) ++option(PLUGIN_RUSTBRIDGE "Include RustBridge plugin" OFF) ++ ++if(RDK_SERVICES_TEST) ++ include(tests.cmake) ++endif() ++ ++# Library installation section ++string(TOLOWER ${NAMESPACE} STORAGE_DIRECTORY) ++ ++# for writing pc and config files ++include(${WORKSPACE}/install/usr/lib/cmake/WPEFramework/common/CmakeHelperFunctions.cmake) ++ ++if(PLUGIN_HDMICECSOURCE) ++ add_subdirectory(HdmiCecSource) ++endif() ++ ++if(WPEFRAMEWORK_CREATE_IPKG_TARGETS) ++ set(CPACK_GENERATOR "DEB") ++ set(CPACK_DEB_COMPONENT_INSTALL ON) ++ set(CPACK_COMPONENTS_GROUPING IGNORE) ++ ++ set(CPACK_DEBIAN_PACKAGE_NAME "${WPEFRAMEWORK_PLUGINS_OPKG_NAME}") ++ set(CPACK_DEBIAN_PACKAGE_VERSION "${WPEFRAMEWORK_PLUGINS_OPKG_VERSION}") ++ set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${WPEFRAMEWORK_PLUGINS_OPKG_ARCHITECTURE}") ++ set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${WPEFRAMEWORK_PLUGINS_OPKG_MAINTAINER}") ++ set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${WPEFRAMEWORK_PLUGINS_OPKG_DESCRIPTION}") ++ set(CPACK_PACKAGE_FILE_NAME "${WPEFRAMEWORK_PLUGINS_OPKG_FILE_NAME}") ++ ++ # list of components from which packages will be generated ++ set(CPACK_COMPONENTS_ALL ++ ${NAMESPACE}WebKitBrowser ++ WPEInjectedBundle ++ ) ++ ++ include(CPack) ++endif() +diff -Naur rdkservices_org/HdmiCecSource/CMakeLists.txt rdkservices/HdmiCecSource/CMakeLists.txt +--- rdkservices_org/HdmiCecSource/CMakeLists.txt 2024-01-23 09:20:14.194328162 -0500 ++++ rdkservices/HdmiCecSource/CMakeLists.txt 2024-01-23 09:40:13.224387067 -0500 +@@ -34,9 +34,9 @@ + find_package(IARMBus) + find_package(CEC) + +-target_include_directories(${MODULE_NAME} PRIVATE ${IARMBUS_INCLUDE_DIRS} ../helpers) +-target_include_directories(${MODULE_NAME} PRIVATE ${CEC_INCLUDE_DIRS}) +-target_include_directories(${MODULE_NAME} PRIVATE ${DS_INCLUDE_DIRS}) ++target_include_directories(${MODULE_NAME} PRIVATE ${IARM_DIRS} ../helpers) ++target_include_directories(${MODULE_NAME} PRIVATE ${CEC_DIRS}) ++target_include_directories(${MODULE_NAME} PRIVATE ${DS_DIRS}) + + target_link_libraries(${MODULE_NAME} PUBLIC ${NAMESPACE}Plugins::${NAMESPACE}Plugins ${IARMBUS_LIBRARIES} ${CEC_LIBRARIES} ${DS_LIBRARIES} ) + diff --git a/L2HalMock/patches/rdkservices/rfcapi.h b/L2HalMock/patches/rdkservices/rfcapi.h new file mode 100644 index 00000000..d92f6d15 --- /dev/null +++ b/L2HalMock/patches/rdkservices/rfcapi.h @@ -0,0 +1,75 @@ +/* + * If not stated otherwise in this file or this component's Licenses.txt file the + * following copyright and licenses apply: + * + * Copyright 2016 RDK Management + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +#ifndef RFCAPI_H_ +#define RFCAPI_H_ + +#include +#include + +#define RFCVAR_FILE "/opt/secure/RFC/rfcVariable.ini" +#define TR181STORE_FILE "/opt/secure/RFC/tr181store.ini" + +#ifdef __cplusplus +extern "C" +{ +#endif +#ifndef RDKC +#include +#endif + +#define MAX_PARAM_LEN (2*1024) + +#ifdef RDKC +typedef enum +{ + SUCCESS=0, + FAILURE, + NONE, + EMPTY +}DATATYPE; +#endif + +#ifdef RDKC +typedef struct _RFC_Param_t { + char name[MAX_PARAM_LEN]; + char value[MAX_PARAM_LEN]; + DATATYPE type; +} RFC_ParamData_t; +#else +typedef struct _RFC_Param_t { + char name[MAX_PARAM_LEN]; + char value[MAX_PARAM_LEN]; + DATA_TYPE type; +} RFC_ParamData_t; +#endif +#ifdef RDKC +int getRFCParameter(const char* pcParameterName, RFC_ParamData_t *pstParamData); +#else +WDMP_STATUS getRFCParameter(const char *pcCallerID, const char* pcParameterName, RFC_ParamData_t *pstParamData); +WDMP_STATUS setRFCParameter(const char *pcCallerID, const char* pcParameterName, const char* pcParameterValue, DATA_TYPE eDataType); +const char* getRFCErrorString(WDMP_STATUS code); +bool isRFCEnabled(const char *); +bool isFileInDirectory(const char *, const char *); +#endif +#ifdef __cplusplus +} +#endif + +#endif diff --git a/L2HalMock/patches/thunder/JSON_Value.patch b/L2HalMock/patches/thunder/JSON_Value.patch new file mode 100644 index 00000000..35d3e7de --- /dev/null +++ b/L2HalMock/patches/thunder/JSON_Value.patch @@ -0,0 +1,16 @@ +Signed-off-by: Kishore Darmaradje +--- +diff --git a/Source/core/JSONRPC.h b/Source/core/JSONRPC.h +index 7b48a579..015c18b8 100644 +--- a/Source/core/JSONRPC.h ++++ b/Source/core/JSONRPC.h +@@ -149,7 +149,8 @@ namespace Core { + Text = _T("Requested service is not available."); + break; + default: +- Code = ApplicationErrorCodeBase - static_cast(frameworkError); ++ // Code = ApplicationErrorCodeBase - static_cast(frameworkError); ++ Code = frameworkError; + Text = Core::ErrorToString(frameworkError); + break; + } diff --git a/L2HalMock/run.sh b/L2HalMock/run.sh new file mode 100644 index 00000000..4f33bdb1 --- /dev/null +++ b/L2HalMock/run.sh @@ -0,0 +1,106 @@ +#!/bin/bash + +#Fetch the Args +GivenPlugins="$1" + +echo "Starting Services for Plugins: $GivenPlugins" + +echo "Found: $GivenPlugins" + + +# Define ANSI color codes for green +GREEN='\033[0;32m' # Green text +NC='\033[0m' # No color (resets to default) + +# Define ANSI color codes for green +GREEN='\033[0;32m' # Green text +NC='\033[0m' # No color (resets to default) + +SCRIPT=$(readlink -f "$0") +SCRIPTS_DIR=`dirname "$SCRIPT"` +WORKSPACE=$SCRIPTS_DIR/workspace + +# Define the port to check and maximum number of seconds to wait +flask_port=8000 +timeout_duration=60 + +# Function to wait for a port to become available +wait_for_port() { + local port="$1" + local timeout="$2" + + for ((i=0; i peru_temp.yaml +echo "Substituted peru.yaml:" +cat peru_temp.yaml +# Move the substituted file to replace the original peru.yaml +chmod 777 peru_temp.yaml +rm -rf peru.yaml +mv peru_temp.yaml peru.yaml +cat peru.yaml + +chmod 644 peru.yaml +# Run peru commands +echo "Running peru sync..." +#peru sync --no-cache -v + +#peru sync && peru sync --no-cache +#peru sync --no-cache + +# Clean up +#rm peru.yaml diff --git a/L2HalMock/sendEvents.sh b/L2HalMock/sendEvents.sh new file mode 100644 index 00000000..1e3e398c --- /dev/null +++ b/L2HalMock/sendEvents.sh @@ -0,0 +1,28 @@ +#!/bin/bash + + +# Define ANSI color codes for green +GREEN='\033[0;32m' # Green text +NC='\033[0m' # No color (resets to default) + +# Define ANSI color codes for green +GREEN='\033[0;32m' # Green text +NC='\033[0m' # No color (resets to default) + +SCRIPT=$(readlink -f "$0") +SCRIPTS_DIR=`dirname "$SCRIPT"` +WORKSPACE=$SCRIPTS_DIR/workspace +SENDER=$WORKSPACE/deps/rdk/sender/ + +echo -e "${GREEN}========================================Run IARM_event_sender===============================================${NC}" +cd $SENDER +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:$WORKSPACE/deps/rdk/iarm_event_sender:$WORKSPACE/deps/rdk/iarmbus/install +./IARM_event_sender cecmgrstatus +./IARM_event_sender dsmrghotplug 0 +./IARM_event_sender dsmrghotplug 1 +./IARM_event_sender dsmrgInhotplug 0 +./IARM_event_sender dsmrgInhotplug 1 +./IARM_event_sender powerModeUpdate 0 1 +./IARM_event_sender hdcpstatusEvent 1 + + diff --git a/L2HalMock/startCEC.sh b/L2HalMock/startCEC.sh new file mode 100644 index 00000000..729a62f3 --- /dev/null +++ b/L2HalMock/startCEC.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# Define ANSI color codes for green +GREEN='\033[0;32m' # Green text +NC='\033[0m' # No color (resets to default) + +# Define ANSI color codes for green +GREEN='\033[0;32m' # Green text +NC='\033[0m' # No color (resets to default) + +SCRIPT=$(readlink -f "$0") +SCRIPTS_DIR=`dirname "$SCRIPT"` +WORKSPACE=$SCRIPTS_DIR/workspace + +echo -e "${GREEN}========================================Stop all existing services===============================================${NC}" + +killall -9 IARMDaemonMain +killall -9 CecDaemonMain +killall -9 WPEFramework + +pkill IARMDaemonMain +pkill CecDaemonMain +pkill WPEFramework + +echo -e "${GREEN}========================================Run iarmbus===============================================${NC}" +cd $WORKSPACE +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/ +deps/rdk/iarmbus/install/bin/IARMDaemonMain & + +unset LD_LIBRARY_PATH + +echo -e "${GREEN}========================================Run cec deamon===============================================${NC}" +cd $WORKSPACE +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/:$WORKSPACE/deps/rdk/hdmicec/install/lib:$WORKSPACE/deps/rdk/hdmicec/ccec/drivers/test:$WORKSPACE/deps/rdk/iarmbus/install/ +deps/rdk/hdmicec/install/bin/CecDaemonMain & + + +echo -e "${GREEN}========================================Run rdkservices===============================================${NC}" +cd $WORKSPACE +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH/usr/local/lib/:$WORKSPACE/deps/rdk/hdmicec/install/lib:$WORKSPACE/deps/rdk/hdmicec/ccec/drivers/test:$WORKSPACE/deps/rdk/iarmbus/install/:$WORKSPACE/install/usr/lib:$WORKSPACE/deps/rdk/devicesettings/install/lib +$WORKSPACE/install/usr/bin/WPEFramework -f -c $WORKSPACE/install/etc/WPEFramework/config.json & diff --git a/L2HalMock/start_services/CecDaemon.py b/L2HalMock/start_services/CecDaemon.py new file mode 100644 index 00000000..b7245d15 --- /dev/null +++ b/L2HalMock/start_services/CecDaemon.py @@ -0,0 +1,32 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +import os +import sys +import subprocess +directory_path_cec_daemon = "/home/teuser/.local/bin/act-hdmicecsource-test-poc/deps/rdk/hdmicec/install/bin" + +# Change the current working directory +os.chdir(directory_path_cec_daemon) +result_cec = subprocess.run(['./CecDaemonMain'], stdout=subprocess.PIPE) +output_cec = result_cec.communicate()[0].decode() +sys.stdout.write(output_cec) diff --git a/L2HalMock/start_services/IarmDaemon.py b/L2HalMock/start_services/IarmDaemon.py new file mode 100644 index 00000000..a5f1d503 --- /dev/null +++ b/L2HalMock/start_services/IarmDaemon.py @@ -0,0 +1,35 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +import subprocess +import sys +import os +directory_path_iarm = "/home/teuser/.local/bin/act-hdmicecsource-test-poc/deps/rdk/iarmbus/install/bin" +directory_path_cec_daemon = "/home/teuser/.local/bin/act-hdmicecsource-test-poc/deps/rdk/hdmicec/install/bin" + +# Change the current working directory +os.chdir(directory_path_iarm) +result = subprocess.run(['./IARMDaemonMain'], stdout=subprocess.PIPE) +output = result.communicate()[0].decode() +print(result.stdout.decode()) +print(result.stdout.read().decode()) +sys.stdout.write(output) diff --git a/L2HalMock/start_services/ReadMe.txt b/L2HalMock/start_services/ReadMe.txt new file mode 100644 index 00000000..af5b1aaf --- /dev/null +++ b/L2HalMock/start_services/ReadMe.txt @@ -0,0 +1,16 @@ +Repository has 6 files + +1. start_run.py to start all the services +2. stop_run.py to stop all the services +3. To run start_run.py use the command python3 start_tun.py +4. The logs wrt each services will be appended to the respective paths given in start_run.py + +Instructions to be followed while running start_run.py + +1. Open IarmDaemon.py & cecDaemon.py file and in the working directory variable, update the relative path till the act-hdmicecsource-test-poc (the path to this folder) from your local VM in the variables directory_iarm & directory_cec_daemon respectively + +2.Open Thunder.py file and update the path of WPEFramework/config.json in the variable directory_thunder + +3. Open start_run.py file , check if all the scripts that are called here are present in the same directory hierarchy. + + \ No newline at end of file diff --git a/L2HalMock/start_services/Thunder.py b/L2HalMock/start_services/Thunder.py new file mode 100644 index 00000000..7d32bdc3 --- /dev/null +++ b/L2HalMock/start_services/Thunder.py @@ -0,0 +1,37 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +import subprocess +import sys +import os + +directory_thunder = "/home/teuser/.local/bin/thunder/install/etc/WPEFramework" #update the path to WPEFramework/config.json here + +# Change the current working directory +#os.chdir(directory_thunder) + +# Open a file for writing the output and error +with open("log_file", "w") as logfile: + # Run the command and redirect the output and error to the file + result = subprocess.run(["WPEFramework", "-f", "-c", "config.json"], cwd=directory_thunder, stdout=logfile, stderr=logfile) + +print(result) diff --git a/L2HalMock/start_services/start_run.py b/L2HalMock/start_services/start_run.py new file mode 100644 index 00000000..08aaf901 --- /dev/null +++ b/L2HalMock/start_services/start_run.py @@ -0,0 +1,60 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +import subprocess +import logging +import time +# Configure logging +logging.basicConfig(level=logging.DEBUG) +# Run first Python script + + +# Run the script with arguments + +Flask = subprocess.Popen(['python3', 'startup.py'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + +if Flask: + print("$$$ Flask service is UP $$$") + +time.sleep(2) + +processA = subprocess.Popen(['python3', 'IarmDaemon.py'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + +time.sleep(2) +if processA: + print("$$$ IarmDaemon is up $$$") + +processB = subprocess.Popen(['python3', 'CecDaemon.py'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + +time.sleep(5) + +if processB: + print("$$$ CecDaemon is up $$$") + +processC = subprocess.Popen(['python3','Thunder.py'], stdout = subprocess.PIPE, stderr=subprocess.STDOUT) + +if processC: + print("$$$ WPEFramework is up $$$") + +time.sleep(5) + + diff --git a/L2HalMock/start_services/startup.py b/L2HalMock/start_services/startup.py new file mode 100644 index 00000000..8a9fa3f5 --- /dev/null +++ b/L2HalMock/start_services/startup.py @@ -0,0 +1,36 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +import subprocess +import sys +import os + +directory_path_flask = "/home/teuser/L2Testing/Flask" #update the path to FLASK repository here (wherever its being cloned in the VM) + +# Change the current working directory +os.chdir(directory_path_flask) + +with open("log_file_flask", "w") as logfile: + # Run the command and redirect the output and error to the file + result = subprocess.run(["python3", "startup.py"], cwd=directory_path_flask, stdout=logfile, stderr=logfile) + +print(result) diff --git a/L2HalMock/start_services/stop_run.py b/L2HalMock/start_services/stop_run.py new file mode 100644 index 00000000..c1d14b9b --- /dev/null +++ b/L2HalMock/start_services/stop_run.py @@ -0,0 +1,75 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +import subprocess +import os +import signal + +process_name = "python3" +process_name_thunder = "WPEFramework" +process_name_iARM ="IARMDaemonMain" +process_name_cec ="CecDaemonMain" +output = subprocess.check_output(["ps", "aux"]) +try: + pids = [] + # Parse the output to find the PID + for line in output.decode().splitlines(): + if process_name in line: + + pid = int(line.split()[1]) + pids.append(pid) + else: + pass + if process_name_thunder in line: + pid = int(line.split()[1]) + pids.append(pid) + print("Killing WPEFramework service") + else: + pass + if process_name_iARM in line: + pid = int(line.split()[1]) + pids.append(pid) + print("Killing IARM Daemon") + else: + pass + if process_name_cec in line: + pid = int(line.split()[1]) + pids.append(pid) + print("killing CEC Daemon") + else: + pass + if pids is not None: + for each_pid in pids: + # os.system("sudo kill %s" % (each_pid, )) + try: + os.system("kill -9 %s" % (each_pid, )) + except: + print("process already killed") + else: + print("They are no services up wrt HAL Mock setup") +except: + pass + # os.kill(each_pid, signal.SIGTERM) + + +#kill /home/teuser/.local/bin/start_shell_Script.py +#time.sleep(5) diff --git a/L2HalMock/stop.sh b/L2HalMock/stop.sh new file mode 100644 index 00000000..c41001de --- /dev/null +++ b/L2HalMock/stop.sh @@ -0,0 +1,30 @@ +#!/bin/bash + + +# Define ANSI color codes for green +GREEN='\033[0;32m' # Green text +NC='\033[0m' # No color (resets to default) + +# Define ANSI color codes for green +GREEN='\033[0;32m' # Green text +NC='\033[0m' # No color (resets to default) + +SCRIPT=$(readlink -f "$0") +SCRIPTS_DIR=`dirname "$SCRIPT"` +WORKSPACE=$SCRIPTS_DIR/workspace + +# Define the port to check and maximum number of seconds to wait +flask_port=8000 +timeout_duration=60 +echo -e "${GREEN}========================================Stop all existing services===============================================${NC}" +#Stop flask +fuser -k ${flask_port}/tcp +killall -9 python3 +killall -9 IARMDaemonMain +killall -9 CecDaemonMain +killall -9 WPEFramework + +pkill python3 +pkill IARMDaemonMain +pkill CecDaemonMain +pkill WPEFramework diff --git a/L2HalMock/temp.txt b/L2HalMock/temp.txt new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/L2HalMock/temp.txt @@ -0,0 +1 @@ + diff --git a/L2HalMock/workflowConfig.env b/L2HalMock/workflowConfig.env new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/L2HalMock/workflowConfig.env @@ -0,0 +1 @@ + diff --git a/L2HalMock/workspace/deps/rdk/flask/Test_Framework/Config.py b/L2HalMock/workspace/deps/rdk/flask/Test_Framework/Config.py new file mode 100644 index 00000000..8c17e131 --- /dev/null +++ b/L2HalMock/workspace/deps/rdk/flask/Test_Framework/Config.py @@ -0,0 +1,259 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# This config file contains all the configurable parameters required for Test Framework +import os +# IP & port details of Flask server +flask_server_ip = "127.0.0.1:8000" + +# Define the paths of Websocket server & WPEFramework +# Define the paths of Websocket server & WPEFramework +WPEFramework_restart = os.getcwd() +os.chdir("../Flask") + +directory_websocket = os.getcwd() +os.chdir("../../../../install/etc/WPEFramework") + +directory_thunder = os.getcwd() +os.chdir(WPEFramework_restart) + +# Define the path where WPEFramework logs needs to be stored +file_name = 'log_file.txt' +WPEFramework_logs_path = os.path.abspath(file_name) + +# Data required for setDeviceConfig api +config_data = { + "apiName": "setDeviceConfig", + "arguments": { + "devices": [ + { + "device": [ + {"name": "xione_uk"}, + {"islocal": 1}, + {"type": "source"}, + {"powerState": 0}, + {"physicalAddress": "301"}, + {"logicalAddress": "3"}, + {"vendorId": "4567"}, + {"osdName": "404753747265616D696E672054776F"}, + {"optionalProperty1": "value1"}, + {"optionalProperty2": "value2"} + ] + }, + { + "device": [ + {"name": "amazon fire stick"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 0}, + {"physicalAddress": "304"}, + {"logicalAddress": "4"}, + {"vendorId": "4567"}, + {"osdName": "53747265616D696E67204F6E65"}, + {"optionalProperty1": "value1"}, + {"optionalProperty2": "value2"} + ] + }, + { + "device": [ + {"name": "amazon fire stick"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 0}, + {"physicalAddress": "304"}, + {"logicalAddress": "9"}, + {"vendorId": "4567"}, + {"osdName": "53747265616D696E67204F6E65"}, + {"optionalProperty1": "value1"}, + {"optionalProperty2": "value2"} + ] + } + ] + } + } + +# Data required for setAPIConfig api +api_data = { + "apiName": "setAPIConfig", + "arguments": { + "apiOverrides": [ + { + "HdmiCecOpen": [ + { "return": 0 }, + { "outParams": [{"handle": 2345678}] } + ] + }, + { + "HdmiCecGetLogicalAddress": [ + { "return": 0 }, + { "outParams": [{"logicalAddress": "0x3"}] } + ] + }, + { + "HdmiCecGetPhysicalAddress": [ + { "return": 0 }, + { "outParams": [{"physicalAddress": "0x304"}] } + ] + } + ] + } + } + +# Device data for HiSense TV +hisense_device_data = { + "device": [ + {"name": "hisense"}, + {"islocal": 0}, + {"type": "sink"}, + {"powerState": 0}, + {"physicalAddress": "0"}, + {"logicalAddress": "6"}, + {"vendorId": "0x4567"}, + {"osdName": "545620426F78"}, + {"optionalProperty1": "value1"}, + {"optionalProperty2": "value2"} + ] + } + +# Invalid device data for Xione US +invalid_device_data = { + "device": [ + {"name": "xione_us"}, + {"islocal": 0}, + {"type": "sink"}, + {"powerState": 0}, + {"physicalAddress": "333"}, + {"logicalAddress": "77"}, + {"vendorId": "4444"}, + {"osdName": "3333"}, + {"optionalProperty1": "value1"}, + {"optionalProperty2": "value2"} + ] + } + +# Send message data for sendStandbyMessage +sendStandbyMessage = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x03", + "0x36" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } + } + +# message send to know the current power status of device +getPowerStatusMessage = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x03", + "0x8F" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } + } + +# message for perform OTP Action +performOTPActionMessage = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x03", + "0x04" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } + } + +# api overrides data in which return value for HdmiCecOpen is set to -1 +cec_minus_one = { + "apiName": "setAPIConfig", + "arguments": { + "apiOverrides": [ + { + "HdmiCecOpen": [ + {"return": -1}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecGetLogicalAddress": [ + {"return": 0}, + {"outParams": [{"logicalAddress": "0x3"}]} + ] + }, + { + "HdmiCecGetPhysicalAddress": [ + {"return": 0}, + {"outParams": [{"physicalAddress": "0x304"}]} + ] + } + ] + } + } diff --git a/L2HalMock/workspace/deps/rdk/flask/Test_Framework/HdmiCecSource/Testcases/TCID004.py b/L2HalMock/workspace/deps/rdk/flask/Test_Framework/HdmiCecSource/Testcases/TCID004.py new file mode 100644 index 00000000..a1f91b10 --- /dev/null +++ b/L2HalMock/workspace/deps/rdk/flask/Test_Framework/HdmiCecSource/Testcases/TCID004.py @@ -0,0 +1,117 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID004 +# Testcase Description : To verify that standby message is successfully triggered +# and got proper logs in thunder. Hit the curl command for sendStandbyMessage and send the corresponding +# messages to hal. Verify the output response. Also, wake up the devices by sending cec message as post condition + +import json +import requests +import time +import Config +import subprocess +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +op=subprocess.run(['netstat', '-ntlp'],capture_output=True,text=True) +print(op.stdout) +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' + +print("TC Description - To verify that standby message is successfully triggered and get proper logs in thunder. Hit the curl command for sendStandbyMessage and send the corresponding messages to hal. Verify the output response. Also, wake up the devices by sending cec message as post condition") +#send messages required for getting power status of device +print("---------------------------------------------------------------------------------------------------------------------------") +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.getPowerStatusMessage))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the powerstatus of local device") +else: + Utils.error_log("sendMessage emulation failed for querying the powerstatus of local device") +time.sleep(3) +print("") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.send_standby_message) +if curl_response: + Utils.warning_log("send_standby_message curl command sent from the test runner") +else: + Utils.error_log("send_standby_message curl command failed") +# send messages required for sendStandbyMessage method +message2_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.sendStandbyMessage))) +if "200" in str(message2_response): + Utils.info_log("sendMessage emulation success for sending the remote device state as standby to local device") +else: + Utils.error_log("sendMessage emulation failed for sending the remote device state as standby to local device") +time.sleep(3) +print("") + +# send messages required for getting power status of device +message3_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.getPowerStatusMessage))) +time.sleep(3) +if "200" in str(message3_response): + Utils.info_log("sendMessage emulation success for querying the powerstatus of local device") +else: + Utils.error_log("sendMessage emulation failed for querying the powerstatus of local device") + +print("---------------------------------------------------------------------------------------------------------------------------") + +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. We are expecting opcode : 36 in thunder logs' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID004' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) + +# wake up the device from standby as post condition by sending message +message4_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.performOTPActionMessage))) +Utils.warning_log("Reset the device state to ON from standby") +time.sleep(3) + +# send messages required for getting power status of device +message5_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.getPowerStatusMessage))) +time.sleep(3) +Utils.info_log("send the emulated message to get the power status of local device") +op=subprocess.run(['netstat', '-ntlp'],capture_output=True,text=True) +print(op.stdout) + diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/HdmiCecSinkApis.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/HdmiCecSinkApis.py new file mode 100644 index 00000000..342bb239 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/HdmiCecSinkApis.py @@ -0,0 +1,356 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Curl command for activating HdmiCecSink plugin +activate_command = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc":"2.0","id":"3" +,"method": "Controller.1.activate", "params":{"callsign":"org.rdk.HdmiCecSource"}}' http://127.0.0.1:55555/jsonrpc''' + +# Curl command for deactivating HdmiCecSink plugin +deactivate_command = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc":"2.0","id":"3" +,"method": "Controller.1.deactivate", "params":{"callsign":"org.rdk.HdmiCecSource"}}' http://127.0.0.1:55555/jsonrpc''' + +# Store the expected output response for activate & deactivate curl command +expected_output_response = '{"jsonrpc":"2.0","id":3,"result":null}' + +###################################################################################### + +# HdmiCecSink Methods : + +#Gets the number of connected source devices and system information for each device +get_device_list = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.getDeviceList"}' http://127.0.0.1:55555/jsonrpc''' + +#Sends a CEC message to the logical address of the device +send_standby_message = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", +"id": 42,"method":"org.rdk.HdmiCecSink.sendStandbyMessage"}' http://127.0.0.1:55555/jsonrpc''' + +#Gets the current vendor ID used by host device +get_vendor_id = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.getVendorId"}' http://127.0.0.1:55555/jsonrpc''' + +#Sets a vendor ID used by host device +set_vendor_id = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setVendorId","params": {"vendorid": "0x4455"}}' http://127.0.0.1:55555/jsonrpc''' + +#Sets an undefined vendor ID(not following the standard data type) used by host device +set_vendor_id_with_undefined_datatype = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setVendorId","params": {"vendorid": "12345"}}' http://127.0.0.1:55555/jsonrpc''' + +#Returns the OSD name used by host device +get_osd_name = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.getOSDName"}' http://127.0.0.1:55555/jsonrpc''' + +#Sets the OSD Name used by host device +set_osd_name = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setOSDName","params": {"name": "Sky TV"}}' http://127.0.0.1:55555/jsonrpc''' + +#Sets the an OSD Name which is not in the correct format used by host device +set_osd_name_with_undefined_datatype = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setOSDName","params": {"name": "ABC TV"}}' http://127.0.0.1:55555/jsonrpc''' + +#Returns whether HDMI-CEC is enabled on platform or not +get_enabled = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.getEnabled"}' http://127.0.0.1:55555/jsonrpc''' + +#Disables HDMI-CEC support in the platform as enabled is FALSE +set_enabled_false = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setEnabled","params": {"enabled": false}}' http://127.0.0.1:55555/jsonrpc''' + +#Enables HDMI-CEC support in the platform +set_enabled_true = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setEnabled","params": {"enabled": true}}' http://127.0.0.1:55555/jsonrpc''' + +#Disables HDMI-CEC support in the platform, by passing a value other than boolean to get an error response +set_enabled_with_undefined_datatype = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setEnabled","params": {"enabled": 1234}}' http://127.0.0.1:55555/jsonrpc''' + +#Gets the current active source +get_active_source_status = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", +"id": 42,"method":"org.rdk.HdmiCecSink.getActiveSourceStatus","params": {"status": true}}' http://127.0.0.1:55555/jsonrpc''' + + +get_otp_enabled = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.getOTPEnabled"}' http://127.0.0.1:55555/jsonrpc''' + +set_otp_enabled_false = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setOTPEnabled","params": {"enabled": false}}' http://127.0.0.1:55555/jsonrpc''' + +set_otp_enabled_true = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setOTPEnabled","params": {"enabled": true}}' http://127.0.0.1:55555/jsonrpc''' + +set_otp_enabled_true_with_undefined_datatype = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setOTPEnabled","params": {"enabled": 1234}}' http://127.0.0.1:55555/jsonrpc''' + +#Sends the CEC message when TV remote key is pressed and all the key events are defined here +send_keypress_VOLUME_UP = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 65}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_VOLUME_DOWN = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 66}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_MUTE = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 67}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_UP = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 1}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_DOWN = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 2}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_LEFT = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 3}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_RIGHT = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 4}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_SELECT = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 0}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_HOME = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 9}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_BACK = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 13}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_0 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 32}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_1 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 33}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_2 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 34}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_3 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 35}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_4 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 36}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_5 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 37}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_6 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 38}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_7 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 39}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_8 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 40}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_9 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 41}}' http://127.0.0.1:55555/jsonrpc''' + + +#Sends the CEC message when TV remote key is pressed +send_keypress_VOLUME_UP_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 65}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_VOLUME_DOWN_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 66}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_MUTE_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 67}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_UP_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 1}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_DOWN_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 2}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_LEFT_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 3}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_RIGHT_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 4}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_SELECT_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 0}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_HOME_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 9}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_BACK_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 13}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_0_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 32}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_1_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 33}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_2_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 34}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_3_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 35}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_4_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 36}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_5_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 37}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_6_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 38}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_7_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 39}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_8_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 40}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_9_USER_Press = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed", "params": {"logicalAddress": 0,"keyCode": 41}}' http://127.0.0.1:55555/jsonrpc''' + + +#Sends the CEC message when TV remote key is released +send_keypress_VOLUME_UP_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 65}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_VOLUME_DOWN_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 66}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_MUTE_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 67}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_UP_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 1}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_DOWN_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 2}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_LEFT_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 3}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_RIGHT_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 4}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_SELECT_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 0}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_HOME_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 9}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_BACK_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 13}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_0_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 32}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_1_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 33}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_2_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 34}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_3_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 35}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_4_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 36}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_5_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 37}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_6_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 38}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_7_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 39}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_8_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 40}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_9_USER_Release = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased", "params": {"logicalAddress": 0,"keyCode": 41}}' http://127.0.0.1:55555/jsonrpc''' + + +#waking up the device from standby +perform_otp_action = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.performOTPAction"}' http://127.0.0.1:55555/jsonrpc''' + +#Sends the CEC Request Short Audio Descriptor (SAD) message as an event +request_short_audio_descriptor = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.requestShortAudioDescriptor"}' http://127.0.0.1:55555/jsonrpc''' + +#This message is used to power on the connected audio device +send_audio_device_power_on_message = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.sendAudioDevicePowerOnMessage"}' http://127.0.0.1:55555/jsonrpc''' + +#Sends the CEC message to request the audio status +get_audio_status_message = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.getAudioStatusMessage"}' http://127.0.0.1:55555/jsonrpc''' + +#Requests the active source in the network +request_active_source = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.requestActiveSource"}' http://127.0.0.1:55555/jsonrpc''' + +#Get status of audio device connection +get_audio_device_connected_status = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.getAudioDeviceConnectedStatus"}' http://127.0.0.1:55555/jsonrpc''' + +#enabling otp with undefined data types +set_otp_enabled_with_undefined_datatype = '''curl --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0","id": 42,"method": "org.rdk.HdmiCecSink.setOTPEnabled","params": {"ennable": true}}' http://127.0.0.1:55555/jsonrpc''' + +set_osd_name_invalid = '''curl --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0","id": 42,"method": "org.rdk.HdmiCecSink.setOSDName","params": {"nnamme": "LG TV"}}' http://127.0.0.1:55555/jsonrpc''' + +set_vendor_id_invalid_1 = '''curl --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0","id": 42,"method": "org.rdk.HdmiCecSink.setVendorId","params": {"vendorid": "]]"}}' http://127.0.0.1:55555/jsonrpc''' + +set_vendor_id_invalid_2 = '''curl --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0","id": 42,"method": "org.rdk.HdmiCecSink.setVendorId","params": {"vllendorid": "]]"}}' http://127.0.0.1:55555/jsonrpc''' + +#Gets details for the current route from the source to sink devices +get_active_route = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.getActiveRoute"}' http://127.0.0.1:55555/jsonrpc''' + +#Sets the source device to active (setStreamPath) +set_active_path = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42,"method":"org.rdk.HdmiCecSink.setActivePath", "params": {"activePath": "1.0.0.0"}}' http://127.0.0.1:55555/jsonrpc''' + +#Sets the current active source as TV (physical address 0 +set_active_source = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.setActiveSource"}' http://127.0.0.1:55555/jsonrpc''' + +#Updates the internal data structure with the new menu Language and also broadcasts the CEC message.Events +set_menu_language = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setMenuLanguage","params": {"language": "chi"}}' http://127.0.0.1:55555/jsonrpc''' + +#Updates the internal data structure with the new wrong menu Language and also broadcasts the CEC message.Events +set_menu_language_with_undefined_datatype = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setMenuLanguage","params": {"language": "abc"}}' http://127.0.0.1:55555/jsonrpc''' + +#Sets the Current Latency Values such as Video Latency, Latency Flags,Audio Output Compensated value and Audio Output Delay by sending message for Dynamic Auto LipSync Feature. +set_latency_info ='''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setLatencyInfo","params": {"videoLatency": "2","lowLatencyMode": "1","audioOutputCompensated": "1","audioOutputDelay": "20"}}' http://127.0.0.1:55555/jsonrpc''' + +#Sets the Current Latency Values such as invalid which includes Video Latency, Latency Flags,Audio Output Compensated value and Audio Output Delay by sending message for Dynamic Auto LipSync Feature. +set_latency_info_with_undefinedLatencyMode ='''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setLatencyInfo","params": {"videoLatency": "987666","lowLatencyMode": "888888","audioOutputCompensated": "abc","audioOutputDelay": "invalid"}}' http://127.0.0.1:55555/jsonrpc''' + +#Changes routing while switching between HDMI inputs and TV +set_routing_change = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setRoutingChange","params": {"oldPort": "HDMI0","newPort":"TV"}}' http://127.0.0.1:55555/jsonrpc''' + +#Changes routing while switching between HDMI inputs and TV with new ports +set_routing_change_nav = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setRoutingChange","params": {"oldPort": "HDMI0","newPort":"TV"}}' http://127.0.0.1:55555/jsonrpc''' + +#Changes routing while switching between unknown devices/port +set_routing_change_with_undefined_datatype = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setRoutingChange","params": {"oldPort": "ABCD","newPort":"zxcv"}}' http://127.0.0.1:55555/jsonrpc''' + +#Enable (or disable) HDMI-CEC Audio Return Channel (ARC) routing +set_arc_routing_params_enabled = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setupARCRouting","params":{"enabled":true}' http://127.0.0.1:55555/jsonrpc''' + +set_arc_routing_params_disabled = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setupARCRouting","params":{"enabled":false}' http://127.0.0.1:55555/jsonrpc''' + +#It prints the list of connected devices and properties of connected devices like deviceType, VendorID, CEC version, PowerStatus, OSDName, PhysicalAddress etc. +print_device_list = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.printDeviceList"}' http://127.0.0.1:55555/jsonrpc''' + +#Get status of audio device connection +request_audio_device_power_status = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.requestAudioDevicePowerStatus"}' http://127.0.0.1:55555/jsonrpc''' + +#Gets the current active source +get_Active_Source = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.getActiveSource"}' http://127.0.0.1:55555/jsonrpc''' + +#Sends the CEC message to request the audio status. +sendGetAudioStatusMessage = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendGetAudioStatusMessage"}' http://127.0.0.1:55555/jsonrpc''' + +#Set an invalid/undefined vendor ID in the format of INT instead of hexa +set_vendor_id_invalid_2 = '''curl --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0","id": 42,"method": "org.rdk.HdmiCecSource.setVendorId","params": {"vllendorid": "]]"}}' http://127.0.0.1:55555/jsonrpc''' + +#Routing change api from Hdmi to an undefined device for failing the scenario +set_routing_change_negative = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSink.setRoutingChange","params": {"oldPort": "HDMI0","newPort":"NEW"}}' http://127.0.0.1:55555/jsonrpc''' + +#All set curl command Json RPC request without params for negtaive scenarios +sendKeyPress_withoutParams = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendKeyPressEvent"}' http://127.0.0.1:55555/jsonrpc''' +senduserContolledPress_withoutParams = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlPressed"}' http://127.0.0.1:55555/jsonrpc''' +sendusercontrolledReleased_withoutParams = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.sendUserControlReleased"}' http://127.0.0.1:55555/jsonrpc''' +setActivepath_withoutParams = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.setActivePath"}' http://127.0.0.1:55555/jsonrpc''' +setEnabled_withoutParams = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.setEnabled"}' http://127.0.0.1:55555/jsonrpc''' +setMenuLanguage_withoutParams = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.setMenuLanguage"}' http://127.0.0.1:55555/jsonrpc''' +setOSDName_withoutParams = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.setOSDName"}' http://127.0.0.1:55555/jsonrpc''' +setRoutingChange_withoutParams = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.setRoutingChange"}' http://127.0.0.1:55555/jsonrpc''' +setupARCRouting_withoutParams = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.setupARCRouting"}' http://127.0.0.1:55555/jsonrpc''' +setvendorID_withoutParams = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.setVentorId"}' http://127.0.0.1:55555/jsonrpc''' +setLatencyInfo_withoutParams = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSink.setLatencyInfo"}' http://127.0.0.1:55555/jsonrpc''' diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_001_HDMICECSINK_getEnabled.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_001_HDMICECSINK_getEnabled.py new file mode 100644 index 00000000..333be0be --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_001_HDMICECSINK_getEnabled.py @@ -0,0 +1,66 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID001_getEnabled_001 +# Testcase Description : Returns HDMI-CEC driver enabled status + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis + +print("TC Description - Returns whether HDMI-CEC is enabled on platform or not.") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"enabled":true,"success":true}}' + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.get_enabled) +if curl_response: + Utils.info_log("curl command to get enabled is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The default driver status ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID001_HdmiCecSink_getEnabled' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_002_HDMICECSINK_setEnabled.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_002_HDMICECSINK_setEnabled.py new file mode 100644 index 00000000..221a7dc3 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_002_HDMICECSINK_setEnabled.py @@ -0,0 +1,77 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID002 +# Testcase Description : Set the cec enable status to false and verify that cec enable +# status is false in output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis + +print(" TC Description - Set the cec enable status to false and verify that cec enable status is false in output response") +# send the curl command to set the cec enable status to false +Utils.initialize_flask() +print("---------------------------------------------------------------------------------------------------------------------------") +set_response = Utils.send_curl_command(HdmiCecSinkApis.set_enabled_false) +if set_response: + Utils.warning_log("send the curl command to set the cec enable status to false is success") +else: + Utils.error_log("send the curl command to set the cec enable status to false failed") +print("") +# store the expected output response of testcase +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"enabled":false,"success":true}}' + +# send the curl command to get enable status of cec and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.get_enabled) +if curl_response: + Utils.info_log("send the curl command to get enable status of cec and fetch the output json response is success") +else: + Utils.error_log("send the curl command to get enable status of cec and fetch the output json response is failed") +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The cec enabled status is obtained ' \ + 'as false in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# set the cec enable status to true as a post condition +Utils.send_curl_command(HdmiCecSinkApis.set_enabled_true) +Utils.info_log("Reset the set enabled to TRUE") + +# generate logs in terminal +tc_id = 'TCID002_HdmiCecSink_setEnabled_CEC_False' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_003_HDMICECSINK_getOSDName.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_003_HDMICECSINK_getOSDName.py new file mode 100644 index 00000000..ed98e275 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_003_HDMICECSINK_getOSDName.py @@ -0,0 +1,65 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID003 +# Testcase Description : Verify that default OSD Name is obtained in output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"name":"TV Box","success":true}}' +Utils.initialize_flask() +print("TC Description - Verify that default OSD Name is obtained in output response") +# send the curl command and fetch the output json response +print("---------------------------------------------------------------------------------------------------------------------------") +curl_response = Utils.send_curl_command(HdmiCecSinkApis.get_osd_name) +if curl_response: + Utils.info_log("curl command send for get_osd_name") +else: + Utils.error_log("curl command send for get_osd_name failed") +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The default OSD Name is obtained ' \ + 'in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID004_HdmiCecSink_getOSDName_default' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) +Utils.initialize_flask() diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_004_HDMICECSINK_setOSDName.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_004_HDMICECSINK_setOSDName.py new file mode 100644 index 00000000..1a374af4 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_004_HDMICECSINK_setOSDName.py @@ -0,0 +1,88 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID004 +# Testcase Description : Set the OSD Name to new one using curl command and verify that new +# OSD Name set by the test user is obtained in output response +import requests +import Config +import json +import time + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis + +print("TC Description - Set the OSD Name to new one using curl command and verify that new OSD Name set by the test user is obtained in output response") +Utils.initialize_flask() +print("---------------------------------------------------------------------------------------------------------------------------") +# send the curl command to set the new OSD Name +set_response = Utils.send_curl_command(HdmiCecSinkApis.set_osd_name) +if set_response: + Utils.info_log(" sent the curl command to set the new OSD Name") +else: + Utils.error_log("curl command sent to get the new OSD name failed") +print("") +# store the expected output response of testcase +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"name":"CUSTOM8 TV","success":true}}' + +# send the curl command to get OSD Name and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.get_osd_name) +if curl_response: + Utils.warning_log("send the curl command to get_osd_name") +else: + Utils.warning_log("curl command send failed to get_osd_name") + +#send messages required for osd string +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.set_osd_string))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the set_osd_string") +else: + Utils.error_log("sendMessage emulation failed for requesting the set_osd_string") +time.sleep(3) +print("") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The new OSD Name given by user ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' +Utils.initialize_flask() +# generate logs in terminal +tc_id = 'TCID005_HdmiCecSink_setOSDName' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_005_HDMICECSINK_getVendorID.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_005_HDMICECSINK_getVendorID.py new file mode 100644 index 00000000..f3409153 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_005_HDMICECSINK_getVendorID.py @@ -0,0 +1,66 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID005 +# Testcase Description : Verify that default vendor id is obtained in output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis + +print("TC Description - Verify that default vendor id is obtained in output response") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"vendorid":"019fb","success":true}}' + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.get_vendor_id) +if curl_response: + Utils.info_log("curl command to get vendorID is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The default vendor id ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID005_HdmiCecSink_getVendorId' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_006_HDMICECSINK_setVendorID.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_006_HDMICECSINK_setVendorID.py new file mode 100644 index 00000000..dc9049c7 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_006_HDMICECSINK_setVendorID.py @@ -0,0 +1,87 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID006 +# Testcase Description : Set the cec enable status to false and verify that cec enable +# status is false in output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +import json + +print(" TC Description - Sets a vendor ID used by host device.") +# send the curl command to set the cec enable status to false +Utils.initialize_flask() +print("---------------------------------------------------------------------------------------------------------------------------") +pre_expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"vendorid":"019fb","success":true}}' +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"vendorid":"04455","success":true}}' + +pre_get_response = Utils.send_curl_command(HdmiCecSinkApis.get_vendor_id) +if pre_get_response: + Utils.warning_log("send curl command to get the vendor id is success") +else: + Utils.error_log("send curl command to get the vendor id is false failed") +print("") + +set_response = Utils.send_curl_command(HdmiCecSinkApis.set_vendor_id) +print("---------------------------------------------------------------------------------------------------------------------------") +if set_response: + Utils.warning_log("send the curl command to set the vendor id is success") +else: + Utils.error_log("send the curl command to set the vendor id to false failed") +print("") + +get_response = Utils.send_curl_command(HdmiCecSinkApis.get_vendor_id) +if get_response: + Utils.warning_log("send curl command to get the vendor id is success") +else: + Utils.error_log("send curl command to get the vendor id is false failed") +print("") + +# compare both expected and received output responses +if str(pre_get_response) == str(pre_expected_output_response) or str(get_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The cec enabled status is obtained ' \ + 'as false in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# set the cec enable status to true as a post condition +Utils.send_curl_command(HdmiCecSinkApis.set_enabled_true) +Utils.info_log("Reset the set enabled to TRUE") + +# generate logs in terminal +tc_id = 'TCID006_setVendorid' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + set_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, set_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_007_HDMICECSINK_getActiveRoute.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_007_HDMICECSINK_getActiveRoute.py new file mode 100644 index 00000000..5818be3f --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_007_HDMICECSINK_getActiveRoute.py @@ -0,0 +1,101 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID007 +# Testcase Description : Gets details for the current route from the source to sink devices, and bverify the output response +import requests +import Config +import json +import time + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +from HdmiCecSource import HdmiCecSourceApis + +print("TC Description - Gets details for the current route from the source to sink devices") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' +expected_output_response_ = '{"jsonrpc":"2.0","id":42,"result":{"available":true,"ActiveRoute":"TV","success":true}}' + + +#send messages required for image and text view in active device making sink device active +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.imageViewON))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the imageViewON") +else: + Utils.error_log("sendMessage emulation failed for requesting the imageViewON") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.textViewON))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the textViewON") +else: + Utils.error_log("sendMessage emulation failed for requesting the textViewON") +time.sleep(3) +print("") + +curl_response1 = Utils.send_curl_command(HdmiCecSinkApis.set_routing_change) +if curl_response1: + Utils.info_log("curl command to set routing change is success") +else: + Utils.error_log("curl command to set routing change is failed") + +# send the curl command and fetch the output json response +curl_response2 = Utils.send_curl_command(HdmiCecSinkApis.get_active_route) +if curl_response2: + Utils.info_log("curl command to get ActiveRoute is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + + + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response1) == str(expected_output_response) and str(curl_response2) == str(expected_output_response_): + status = 'Pass' + message = 'Output response is matching with expected one. The default vendor id ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID007_HdmiCecSink_getActiveRoute' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response2) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response2, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_008_HDMICECSINK_getActiveSource.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_008_HDMICECSINK_getActiveSource.py new file mode 100644 index 00000000..c4089101 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_008_HDMICECSINK_getActiveSource.py @@ -0,0 +1,78 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID008 +# Testcase Description : Hit the curl command for getActiveSourceStatus method and +# verify that status is obtained as false in output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"error":{"code":-32601,"message":"Unknown method."}}' + +print("TC Description - Hit the curl command for getActiveSourceStatus method and verify that status is obtained as false in output response") + +print("---------------------------------------------------------------------------------------------------------------------------") +# send the curl command and fetch the output json response +Utils.initialize_flask() +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_routing_change) +if curl_response: + Utils.info_log("curl command send for set routing change") + status = 'Pass' + message = 'Output response is matching with expected one. The set latency info ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.set_latency_info)) + status = 'False' + message = 'Output response is not matching with expected one' + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.get_active_source_status) +if curl_response: + Utils.info_log("curl command send for get_active_source") +else: + Utils.error_log("curl command send failed for get_active_source") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID008_getActiveSourceStatus_false' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_009_HDMICECSINK_getAudioDeviceConnectedStatus.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_009_HDMICECSINK_getAudioDeviceConnectedStatus.py new file mode 100644 index 00000000..8b70f08b --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_009_HDMICECSINK_getAudioDeviceConnectedStatus.py @@ -0,0 +1,68 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID009 +# Testcase Description : Verify that default vendor id is obtained in output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis + +print("TC Description - Get status of audio device connection.") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"connected":true,"success":true}}' + +#ToDo - Send Message emulation to connect an audio device and send its status message with sink device or give it from device config by specifying the exact logical address required. + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.get_audio_device_connected_status) +if curl_response: + Utils.info_log("curl command to get audio device connected status is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The default vendor id ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID009_HdmiCecSink_getAudioDeviceConnectedStatus' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_010_HDMICECSINK_getDeviceList.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_010_HDMICECSINK_getDeviceList.py new file mode 100644 index 00000000..75788072 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_010_HDMICECSINK_getDeviceList.py @@ -0,0 +1,68 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID010 +# Testcase Description : Gets the number of connected source devices and system information for each device. The information includes device type, physical address, CEC version, vendor ID, power status and OSD name., and verify the output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +import time + +print("TC Description - Gets the number of connected source devices and system information for each device. The information includes device type, physical address, CEC version, vendor ID, power status and OSD name.") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +time.sleep(6) +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"numberofdevices":3,"deviceList":[{"logicalAddress":3,"physicalAddress":"15.15.15.15","deviceType":"Reserved","cecVersion":"Version 1.3a","osdName":"@GStreaming Tw","vendorID":"000","powerStatus":"On","portNumber":-1},{"logicalAddress":5,"physicalAddress":"15.15.15.15","deviceType":"TV","cecVersion":"Unknown","osdName":"","vendorID":"000","powerStatus":"On","portNumber":-1},{"logicalAddress":9,"physicalAddress":"15.15.15.15","deviceType":"TV","cecVersion":"Unknown","osdName":"","vendorID":"000","powerStatus":"On","portNumber":-1}],"success":true}}' + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.get_device_list) +if curl_response: + Utils.info_log("curl command to get devicelist is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The default vendor id ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID005_HdmiCecSink_getDevicelist' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_011_HDMICECSINK_requestActiveSource.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_011_HDMICECSINK_requestActiveSource.py new file mode 100644 index 00000000..3f1db7c6 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_011_HDMICECSINK_requestActiveSource.py @@ -0,0 +1,178 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID011 +# Testcase Description : Requests the active source in the network., verify the output response +import subprocess +import json +import requests +import time +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +from HdmiCecSource import HdmiCecSourceApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' + +print("TC Description - Hit the curl command for getActiveSourceStatus method and verify that status is obtained as true in output response") + +print("---------------------------------------------------------------------------------------------------------------------------") +# send the curl command and fetch the output json response +Utils.initialize_flask() +time.sleep(3) +#send messages required for getting inactive source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.inactive_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the inactive source") +else: + Utils.error_log("sendMessage emulation failed for querying the inactive source") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.request_active_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the active source") +else: + Utils.error_log("sendMessage emulation failed for requesting the active source") +time.sleep(3) +print("") + +#send messages required for getting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.active_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the active source") +else: + Utils.error_log("sendMessage emulation failed for querying the active source") +time.sleep(3) +print("") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.send_standby_message) +if curl_response: + Utils.warning_log("send_standby_message curl command sent from the test runner") +else: + Utils.error_log("send_standby_message curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.perform_otp_action) +if curl_response: + Utils.warning_log("perform_otp_action curl command sent from the test runner") +else: + Utils.error_log("perform_otp_action curl command failed") + +#send messages required for getting inactive source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.inactive_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the inactive source") +else: + Utils.error_log("sendMessage emulation failed for querying the inactive source") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.request_active_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the active source") +else: + Utils.error_log("sendMessage emulation failed for requesting the active source") +time.sleep(3) +print("") + +#send messages required for set stream path +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.set_stream_path_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for set stream path to hisense") +else: + Utils.error_log("sendMessage emulation failed for set stream path to hisense") +time.sleep(3) +print("") + +#send messages required for routing change +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.routing_change))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for routing change to hisense") +else: + Utils.error_log("sendMessage emulation failed for routing change to hisense") +time.sleep(3) +print("") + +#send messages required for routing information +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.routing_information_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying routing information from hisense") +else: + Utils.error_log("sendMessage emulation failed for querying routing information from hisense") +time.sleep(3) +print("") + +#send messages required for getting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.active_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the active source") +else: + Utils.error_log("sendMessage emulation failed for querying the active source") +time.sleep(3) +print("") + +#ToDo - send message emulation for onActiveSourceChange Triggered with the active source device changes. + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.request_active_source) +if curl_response: + Utils.info_log("curl command send for get_active_source") +else: + Utils.error_log("curl command send failed for get_active_source") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID011_requestActiveSource' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_012_HDMICECSINK_requestShortAudioDescriptor.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_012_HDMICECSINK_requestShortAudioDescriptor.py new file mode 100644 index 00000000..83bfd764 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_012_HDMICECSINK_requestShortAudioDescriptor.py @@ -0,0 +1,82 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID012_requestShortAudioDescriptor +# Testcase Description : Sends the CEC Request Short Audio Descriptor (SAD) message as an event and verify the output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +import Config +import requests +import json +import time + +print("TC Description - Sends the CEC Request Short Audio Descriptor (SAD) message,and verify the output response") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.request_short_audio_descriptor) +if curl_response: + Utils.info_log("curl command to request short audio descriptor is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +time.sleep(3) +#ToDo - sendMessage emulation for shortAudio descriptor event [Triggered when SAD is received from the connected audio device.] +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportShortAudioDes))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the reportShortAudioDes") +else: + Utils.error_log("sendMessage emulation failed for requesting the reportShortAudioDes") +time.sleep(3) +print("") + + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The default vendor id ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID012_HDMICECSINK_requestShortAudioDescriptor' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_013_HDMICECSINK_sendAudioDevicePowerOnMessage.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_013_HDMICECSINK_sendAudioDevicePowerOnMessage.py new file mode 100644 index 00000000..5f9308c3 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_013_HDMICECSINK_sendAudioDevicePowerOnMessage.py @@ -0,0 +1,100 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID013_sendAudioDevicePowerOnMessage +# Testcase Description : This message is used to power on the connected audio device. Usually sent by the TV when it comes out of standby and detects audio device connected in the network. +import requests +import Config +import json +import time + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +from HdmiCecSource import HdmiCecSourceApis + +print("TC Description - This message is used to power on the connected audio device. Usually sent by the TV when it comes out of standby and detects audio device connected in the network.") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' + + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.send_standby_message) +if curl_response: + Utils.warning_log("send_standby_message curl command sent from the test runner") +else: + Utils.error_log("send_standby_message curl command failed") + +time.sleep(3) #3 second wait to turn on sink device + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.perform_otp_action) +if curl_response: + Utils.warning_log("perform_otp_action curl command sent from the test runner") +else: + Utils.error_log("perform_otp_action curl command failed") + +time.sleep(3) + +#send messages required for reporting audio power mode +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportAudioMode))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the reportAudioMode") +else: + Utils.error_log("sendMessage emulation failed for requesting the reportAudioMode") +time.sleep(3) +print("") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.send_audio_device_power_on_message) +if curl_response: + Utils.info_log("curl command to send audio device power on message is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The send audio device power on message' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID013_HdmiCecSink_sendAudioDevicePowerOnMessage' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_014_HDMICECSINK_getAudioStatusMessage.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_014_HDMICECSINK_getAudioStatusMessage.py new file mode 100644 index 00000000..2a9070de --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_014_HDMICECSINK_getAudioStatusMessage.py @@ -0,0 +1,96 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID014_getAudioStatusMessage +# Testcase Description : Sends the CEC message to request the audio status., and verify the output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +from HdmiCecSource import HdmiCecSourceApis +import Config +import requests +import json +import time + +print("TC Description - Sends the CEC message to request the audio status.") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' + + + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.sendGetAudioStatusMessage) +if curl_response: + Utils.info_log("curl command to send audio status message is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +time.sleep(3) + +#ToDo - send message emulation for report audio status message event[reportAudioStatusEvent Triggered when CEC message of device is received.] +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportShortAudioDes))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the reportShortAudioDes") +else: + Utils.error_log("sendMessage emulation failed for requesting the reportShortAudioDes") +time.sleep(3) +print("") + +time.sleep(3) + +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportAudioMode))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the reportAudioMode") +else: + Utils.error_log("sendMessage emulation failed for requesting the reportAudioMode") +time.sleep(3) +print("") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The send audio status message and report audio sytatus event ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID014_HdmiCecSink_getAudioStatusMessage' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_015_HDMICECSINK_sendKeyPressEvent.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_015_HDMICECSINK_sendKeyPressEvent.py new file mode 100644 index 00000000..8d42655e --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_015_HDMICECSINK_sendKeyPressEvent.py @@ -0,0 +1,83 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID015 +# Testcase Description : Hit the curl command for sendKeyPressEvent and +# verify that output response is correct + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' +Utils.initialize_flask() + +keypress = [HdmiCecSinkApis.send_keypress_VOLUME_UP, HdmiCecSinkApis.send_keypress_VOLUME_DOWN, + HdmiCecSinkApis.send_keypress_MUTE, + HdmiCecSinkApis.send_keypress_UP, HdmiCecSinkApis.send_keypress_DOWN, + HdmiCecSinkApis.send_keypress_LEFT, + HdmiCecSinkApis.send_keypress_RIGHT, HdmiCecSinkApis.send_keypress_SELECT, + HdmiCecSinkApis.send_keypress_HOME, + HdmiCecSinkApis.send_keypress_BACK, HdmiCecSinkApis.send_keypress_NUMBER_0, + HdmiCecSinkApis.send_keypress_NUMBER_1, + HdmiCecSinkApis.send_keypress_NUMBER_2, HdmiCecSinkApis.send_keypress_NUMBER_3, + HdmiCecSinkApis.send_keypress_NUMBER_4, + HdmiCecSinkApis.send_keypress_NUMBER_5, HdmiCecSinkApis.send_keypress_NUMBER_6, + HdmiCecSinkApis.send_keypress_NUMBER_7, + HdmiCecSinkApis.send_keypress_NUMBER_8, HdmiCecSinkApis.send_keypress_NUMBER_9] +print("TC Description - Hit the curl command for sendKeyPressEvent and verify that output response is correct") +print( + "---------------------------------------------------------------------------------------------------------------------------") +# send the curl command and fetch the output json response +for command in keypress: + curl_response = Utils.send_curl_command(command) + +if curl_response: + Utils.info_log("curl command send for send_keypress_event") +else: + Utils.error_log("curl command send failed") +print("") +# compare both expected and received output responses +print( + "---------------------------------------------------------------------------------------------------------------------------") +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID015_sendKeyPressEvent' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_016_HDMICECSINK_sendUserControlPressed.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_016_HDMICECSINK_sendUserControlPressed.py new file mode 100644 index 00000000..3497a9d8 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_016_HDMICECSINK_sendUserControlPressed.py @@ -0,0 +1,83 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID016 +# Testcase Description : Hit the curl command for sendUserControlledPressEvent and +# verify that output response is correct + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' +Utils.initialize_flask() + +keypress = [HdmiCecSinkApis.send_keypress_VOLUME_UP_USER_Press, HdmiCecSinkApis.send_keypress_VOLUME_DOWN_USER_Press, + HdmiCecSinkApis.send_keypress_MUTE_USER_Press, + HdmiCecSinkApis.send_keypress_UP_USER_Press, HdmiCecSinkApis.send_keypress_DOWN_USER_Press, + HdmiCecSinkApis.send_keypress_LEFT_USER_Press, + HdmiCecSinkApis.send_keypress_RIGHT_USER_Press, HdmiCecSinkApis.send_keypress_SELECT_USER_Press, + HdmiCecSinkApis.send_keypress_HOME_USER_Press, + HdmiCecSinkApis.send_keypress_BACK_USER_Press, HdmiCecSinkApis.send_keypress_NUMBER_0_USER_Press, + HdmiCecSinkApis.send_keypress_NUMBER_1_USER_Press, + HdmiCecSinkApis.send_keypress_NUMBER_2_USER_Press, HdmiCecSinkApis.send_keypress_NUMBER_3_USER_Press, + HdmiCecSinkApis.send_keypress_NUMBER_4_USER_Press, + HdmiCecSinkApis.send_keypress_NUMBER_5_USER_Press, HdmiCecSinkApis.send_keypress_NUMBER_6_USER_Press, + HdmiCecSinkApis.send_keypress_NUMBER_7_USER_Press, + HdmiCecSinkApis.send_keypress_NUMBER_8_USER_Press, HdmiCecSinkApis.send_keypress_NUMBER_9_USER_Press] +print("TC Description - Hit the curl command for sendUserControlPressed and verify that output response is correct") +print( + "---------------------------------------------------------------------------------------------------------------------------") +# send the curl command and fetch the output json response +for command in keypress: + curl_response = Utils.send_curl_command(command) + +if curl_response: + Utils.info_log("curl command send for send_user_control_pressed") +else: + Utils.error_log("curl command send failed") +print("") +# compare both expected and received output responses +print( + "---------------------------------------------------------------------------------------------------------------------------") +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID016_sendUserControlPressed' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_017_HDMICECSINK_sendUserControlReleased.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_017_HDMICECSINK_sendUserControlReleased.py new file mode 100644 index 00000000..8688f3c0 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_017_HDMICECSINK_sendUserControlReleased.py @@ -0,0 +1,83 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID017 +# Testcase Description : Hit the curl command for sendUserControlledReleaseEvent and +# verify that output response is correct + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' +Utils.initialize_flask() + +keypress = [HdmiCecSinkApis.send_keypress_VOLUME_UP_USER_Release, HdmiCecSinkApis.send_keypress_VOLUME_DOWN_USER_Release, + HdmiCecSinkApis.send_keypress_MUTE_USER_Release, + HdmiCecSinkApis.send_keypress_UP_USER_Release, HdmiCecSinkApis.send_keypress_DOWN_USER_Release, + HdmiCecSinkApis.send_keypress_LEFT_USER_Release, + HdmiCecSinkApis.send_keypress_RIGHT_USER_Release, HdmiCecSinkApis.send_keypress_SELECT_USER_Release, + HdmiCecSinkApis.send_keypress_HOME_USER_Release, + HdmiCecSinkApis.send_keypress_BACK_USER_Release, HdmiCecSinkApis.send_keypress_NUMBER_0_USER_Release, + HdmiCecSinkApis.send_keypress_NUMBER_1_USER_Release, + HdmiCecSinkApis.send_keypress_NUMBER_2_USER_Release, HdmiCecSinkApis.send_keypress_NUMBER_3_USER_Release, + HdmiCecSinkApis.send_keypress_NUMBER_4_USER_Release, + HdmiCecSinkApis.send_keypress_NUMBER_5_USER_Release, HdmiCecSinkApis.send_keypress_NUMBER_6_USER_Release, + HdmiCecSinkApis.send_keypress_NUMBER_7_USER_Release, + HdmiCecSinkApis.send_keypress_NUMBER_8_USER_Release, HdmiCecSinkApis.send_keypress_NUMBER_9_USER_Release] +print("TC Description - Hit the curl command for sendUserControlReleased and verify that output response is correct") +print( + "---------------------------------------------------------------------------------------------------------------------------") +# send the curl command and fetch the output json response +for command in keypress: + curl_response = Utils.send_curl_command(command) + +if curl_response: + Utils.info_log("curl command send for send_user_control_released") +else: + Utils.error_log("curl command send failed") +print("") +# compare both expected and received output responses +print( + "---------------------------------------------------------------------------------------------------------------------------") +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID017_sendUserControlReleased' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_018_HDMICECSINK_sendStandbyMessage.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_018_HDMICECSINK_sendStandbyMessage.py new file mode 100644 index 00000000..183b314b --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_018_HDMICECSINK_sendStandbyMessage.py @@ -0,0 +1,65 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID018_sendStandbyMessage +# Testcase Description : Sends a CEC message to the logical address of the device. and verify the outpu response +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis + +print("TC Description - Sends a CEC message to the logical address of the device. and verify the outpu response.") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.send_standby_message) +if curl_response: + Utils.info_log("curl command to send standby message is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The default vendor id ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID018_HdmiCecSink_sendStandbyMessage' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_019_HDMICECSINK_setActivePath.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_019_HDMICECSINK_setActivePath.py new file mode 100644 index 00000000..c96c4b6e --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_019_HDMICECSINK_setActivePath.py @@ -0,0 +1,77 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID019_HDMICECSINK_setActivePath +# Testcase Description : Sets the source device to active (setStreamPath), and verify the outpu response +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis + +print("TC Description - Sets the source device to active (setStreamPath)") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.send_standby_message) +if curl_response: + Utils.info_log("curl command to send standby message is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_routing_change) +if curl_response: + Utils.info_log("Routing change set to active path") +else: + Utils.info_log("Routing change set to active path failed") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_active_path) +if curl_response: + Utils.info_log("curl command sent for set active path") +else: + Utils.error_log("Curl command not send {}" .format(HdmiCecSinkApis.set_active_path)) + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The active path ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID019_HdmiCecSink_setActivePath' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_020_HDMICECSINK_setActiveSource.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_020_HDMICECSINK_setActiveSource.py new file mode 100644 index 00000000..f6b3cd1d --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_020_HDMICECSINK_setActiveSource.py @@ -0,0 +1,65 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID020_setActiveSource +# Testcase Description : Sets the current active source as TV (physical address 0.0.0.0). This call needs to be made when the TV switches to internal tuner or any apps. and verify the outpu response +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis + +print("TC Description - Sets the current active source as TV (physical address 0.0.0.0). This call needs to be made when the TV switches to internal tuner or any apps. and verify the outpu response") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' + + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_active_source) +if curl_response: + Utils.info_log("curl command sent for set active source") +else: + Utils.error_log("Curl command not send {}" .format(HdmiCecSinkApis.set_active_path)) + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The set active source ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID020_HdmiCecSink_setActiveSource' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_021_HDMICECSINK_setmenuLanguage.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_021_HDMICECSINK_setmenuLanguage.py new file mode 100644 index 00000000..983bc26d --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_021_HDMICECSINK_setmenuLanguage.py @@ -0,0 +1,88 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID021_setMenuLanguage +# Testcase Description : Updates the internal data structure with the new menu Language and also broadcasts the CEC message.and verify the outpu response +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +import json +import requests +import time +import Config + +Utils.initialize_flask() +#send messages required for getting physical address +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.give_physical_address_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the physical address") +else: + Utils.error_log("sendMessage emulation failed for querying the physical address") +time.sleep(3) +print("") + +#send messages required for getting menu language +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.get_menu_language_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the menu language") +else: + Utils.error_log("sendMessage emulation failed for querying the menu language") +time.sleep(3) +print("") + +#send messages required for setting menu language +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.set_menu_language))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for setting the menu language") +else: + Utils.error_log("sendMessage emulation failed for setting the menu language") +time.sleep(3) +print("") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_menu_language) +if curl_response: + Utils.info_log("curl command send for set menu language") + status = 'Pass' + message = 'Output response is matching with expected one. The set menu language ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.set_menu_language)) + status = 'False' + message = 'Output response is not matching with expected one' + +# generate logs in terminal +tc_id = 'TCID021_HdmiCecSink_setMenuLanguage' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_022_HDMICECSINK_setLatencyInfo.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_022_HDMICECSINK_setLatencyInfo.py new file mode 100644 index 00000000..e6c6d821 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_022_HDMICECSINK_setLatencyInfo.py @@ -0,0 +1,90 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID022_setLatencyInfo +# Testcase Description : Sets the Current Latency Values such as Video Latency, Latency Flags,Audio Output Compensated value and Audio Output Delay by sending message for Dynamic Auto LipSync Feature. Verify the output response +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +import json +import requests +import time +import Config + +Utils.initialize_flask() +#ToDo - send messages required for reporting current latency info +#send messages required for reporting current latency +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.requestcurrentlatency))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the requestcurrentlatency") +else: + Utils.error_log("sendMessage emulation failed for requesting the requestcurrentlatency") +time.sleep(3) +print("") + + +#send messages required for getting menu language +#message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( +# Config.flask_server_ip, json.dumps(Config.get_menu_language_hisense))) +#if "200" in str(message1_response): +# Utils.info_log("sendMessage emulation success for querying the menu language") +#else: +# Utils.error_log("sendMessage emulation failed for querying the menu language") +#time.sleep(3) +#print("") + +#send messages required for setting menu language +#message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( +# Config.flask_server_ip, json.dumps(Config.set_menu_language))) +#if "200" in str(message1_response): +# Utils.info_log("sendMessage emulation success for setting the menu language") +#else: +# Utils.error_log("sendMessage emulation failed for setting the menu language") +#time.sleep(3) +#print("") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_latency_info) +if curl_response: + Utils.info_log("curl command send for set latency info") + status = 'Pass' + message = 'Output response is matching with expected one. The set latency info ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.set_latency_info)) + status = 'False' + message = 'Output response is not matching with expected one' + +# generate logs in terminal +tc_id = 'TCID022_HdmiCecSink_setLatencyInfo' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_023_HDMICECSINK_setRoutingChange.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_023_HDMICECSINK_setRoutingChange.py new file mode 100644 index 00000000..bebdc9a4 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_023_HDMICECSINK_setRoutingChange.py @@ -0,0 +1,186 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID023_setRoutingChange +# Testcase Description : Changes routing while switching between HDMI inputs and TV. Verify the output response +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +from HdmiCecSource import HdmiCecSourceApis +import json +import requests +import time +import Config + +Utils.initialize_flask() + +print("TC Description - Changes routing while switching between HDMI inputs and TV. Verify the output response") +#ToDo - send messages required for switching inputs between hdmi and TV, by sending active source message emulation. +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.inactive_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the inactive source") +else: + Utils.error_log("sendMessage emulation failed for querying the inactive source") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.request_active_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the active source") +else: + Utils.error_log("sendMessage emulation failed for requesting the active source") +time.sleep(3) +print("") + +#send messages required for getting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.active_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the active source") +else: + Utils.error_log("sendMessage emulation failed for querying the active source") +time.sleep(3) +print("") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.send_standby_message) +if curl_response: + Utils.warning_log("send_standby_message curl command sent from the test runner") +else: + Utils.error_log("send_standby_message curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.perform_otp_action) +if curl_response: + Utils.warning_log("perform_otp_action curl command sent from the test runner") +else: + Utils.error_log("perform_otp_action curl command failed") + +#send messages required for getting inactive source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.inactive_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the inactive source") +else: + Utils.error_log("sendMessage emulation failed for querying the inactive source") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.request_active_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the active source") +else: + Utils.error_log("sendMessage emulation failed for requesting the active source") +time.sleep(3) +print("") + +#send messages required for set stream path +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.set_stream_path_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for set stream path to hisense") +else: + Utils.error_log("sendMessage emulation failed for set stream path to hisense") +time.sleep(3) +print("") + +#send messages required for routing change +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.routing_change))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for routing change to hisense") +else: + Utils.error_log("sendMessage emulation failed for routing change to hisense") +time.sleep(3) +print("") + +#send messages required for routing information +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.routing_information_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying routing information from hisense") +else: + Utils.error_log("sendMessage emulation failed for querying routing information from hisense") +time.sleep(3) +print("") + +#send messages required for getting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.active_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the active source") +else: + Utils.error_log("sendMessage emulation failed for querying the active source") +time.sleep(3) +print("") + + +#send messages required for getting menu language +#message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( +# Config.flask_server_ip, json.dumps(Config.get_menu_language_hisense))) +#if "200" in str(message1_response): +# Utils.info_log("sendMessage emulation success for querying the menu language") +#else: +# Utils.error_log("sendMessage emulation failed for querying the menu language") +#time.sleep(3) +#print("") + +#send messages required for setting menu language +#message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( +# Config.flask_server_ip, json.dumps(Config.set_menu_language))) +#if "200" in str(message1_response): +# Utils.info_log("sendMessage emulation success for setting the menu language") +#else: +# Utils.error_log("sendMessage emulation failed for setting the menu language") +#time.sleep(3) +#print("") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_routing_change) +if curl_response: + Utils.info_log("curl command send for set routing change") + status = 'Pass' + message = 'Output response is matching with expected one. The set latency info ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.set_latency_info)) + status = 'False' + message = 'Output response is not matching with expected one' + +# generate logs in terminal +tc_id = 'TCID023_HdmiCecSink_setRoutingChange' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_024_HDMICECSINK_setupArcRouting.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_024_HDMICECSINK_setupArcRouting.py new file mode 100644 index 00000000..753df876 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_024_HDMICECSINK_setupArcRouting.py @@ -0,0 +1,95 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID024_setupArcRoutingChange +# Testcase Description :Enable (or disable) HDMI-CEC Audio Return Channel (ARC) routing. Upon enabling, triggers arcInitiationEvent and upon disabling, triggers arcTerminationEvent. Verify the output response +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +import json +import requests +import time +import Config + +Utils.initialize_flask() +print("TC - Description : Enable (or disable) HDMI-CEC Audio Return Channel (ARC) routing. Upon enabling, triggers arcInitiationEvent and upon disabling, triggers arcTerminationEvent. Verify the output response") +#ToDo - send messages required for arpc routing with different params + + +#ToDo - SendMessage emulation for arcInitiationEvent[[enabled, the CEC and messages are sent]] Triggered when routing though the HDMI ARC port is successfully established. +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.initiateArc))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for initiating arc event") +else: + Utils.error_log("sendMessage emulation failed for initiating arc event") +time.sleep(3) +print("") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_arc_routing_params_disabled) +if curl_response: + Utils.info_log("curl command send for arc routing") + status = 'Pass' + message = 'Output response is matching with expected one. The arc routing ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.set_arc_routing_params_disabled)) + status = 'False' + message = 'Output response is not matching with expected one' + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_arc_routing_params_enabled) +if curl_response: + Utils.info_log("curl command send for arc routing") + status = 'Pass' + message = 'Output response is matching with expected one. The arc routing ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.set_arc_routing_params_enabled)) + status = 'False' + message = 'Output response is not matching with expected one' + + +#ToDo - SendMessage emulation for arcTerminationEvent[[If disabled, the CEC and messages are sent.]].Triggered when routing though the HDMI ARC port terminates. +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.terminateArc))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for terminating Arc Event") +else: + Utils.error_log("sendMessage emulation failed for terminating Arc Event") +time.sleep(3) +print("") + + +# generate logs in terminal +tc_id = 'TCID024_HdmiCecSink_setArcRouting' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_025_HDMICECSINK_printDeviceList.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_025_HDMICECSINK_printDeviceList.py new file mode 100644 index 00000000..e2b4edd8 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_025_HDMICECSINK_printDeviceList.py @@ -0,0 +1,66 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID025 +# Testcase Description : This is a helper debug command for developers. It prints the list of connected devices and properties of connected devices like deviceType, VendorID, CEC version, PowerStatus, OSDName, PhysicalAddress etc and ,verify the output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis + +print("TC Description - This is a helper debug command for developers. It prints the list of connected devices and properties of connected devices like deviceType, VendorID, CEC version, PowerStatus, OSDName, PhysicalAddress etc.") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"printed":true,"success":true}}' + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.print_device_list) +if curl_response: + Utils.info_log("curl command to print devicelist is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The print device list details ' \ + 'are obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID025_HdmiCecSink_printDevicelist' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_026_HDMICECSINK_requestAudioDevicePowerStatus.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_026_HDMICECSINK_requestAudioDevicePowerStatus.py new file mode 100644 index 00000000..5cf7bcb8 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_026_HDMICECSINK_requestAudioDevicePowerStatus.py @@ -0,0 +1,119 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID026 +# Testcase Description : requesting the audio device power status +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +import time +import Config +import json +import requests + +print("TC Description - Requesting the audio device power status") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.request_audio_device_power_status) +if curl_response: + Utils.info_log("curl command to request audio device power status is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportShortAudioDes))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the reportShortAudioDes") +else: + Utils.error_log("sendMessage emulation failed for requesting the reportShortAudioDes") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.setSystemAudioMode))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the setSystemAudioMode") +else: + Utils.error_log("sendMessage emulation failed for requesting the setSystemAudioMode") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportAudioMode))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the reportAudioMode") +else: + Utils.error_log("sendMessage emulation failed for requesting the reportAudioMode") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.givefeatures))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the givefeatures") +else: + Utils.error_log("sendMessage emulation failed for requesting the givefeatures") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.requestcurrentlatency))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the requestcurrentlatency") +else: + Utils.error_log("sendMessage emulation failed for requesting the requestcurrentlatency") +time.sleep(3) +print("") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The audio power device power status details ' \ + 'are obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID026_HdmiCecSink_requestAudioDevicePowerStatus' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_028_HDMICECSINK_abortCombinationsEmulation.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_028_HDMICECSINK_abortCombinationsEmulation.py new file mode 100644 index 00000000..04fe6b40 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_028_HDMICECSINK_abortCombinationsEmulation.py @@ -0,0 +1,186 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID028 +# Testcase Description : Emulating abort feature with several combinations.Here emulating with invalid vendorId +import time +import json +import Config +import requests +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +from HdmiCecSource import HdmiCecSourceApis + +print("TC Description - Emulating abort feature with several combinations.Here emulating the feature abort trigger message by giving an invalid vendor ID ,so that system doesnt support") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"vendorid":"019fb","success":true}}' + + +def update_config(data): + time.sleep(10) + Utils.abort_data(data) + +def feature_abort(): + message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.feature_abort))) + if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the feature_abort") + else: + Utils.error_log("sendMessage emulation failed for requesting the feature_abort") + time.sleep(3) + print("") + +#send messages required for requesting active source +def abort_hisense(): + message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.abort_hisense))) + if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the abort_hisense") + else: + Utils.error_log("sendMessage emulation failed for requesting the abort_hisense") + time.sleep(3) + print("") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_vendor_id_invalid_2) +if curl_response: + Utils.warning_log("set vendor id invalid curl command sent from the test runner") + Utils.info_log("curl command send for arc routing") + status = 'Pass' + message = 'Output response is matching with expected one. The arc routing ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}".format(HdmiCecSinkApis.set_arc_routing_params_enabled)) + status = 'False' + message = 'Output response is not matching with expected one' + + + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.get_vendor_id) +if curl_response == expected_output_response: + Utils.warning_log("get vendor id curl command sent from the test runner") + Utils.info_log("curl command send for arc routing") + status = 'Pass' + message = 'Output response is matching with expected one. ' +else: + Utils.error_log("get vendor id curl command failed") + status = 'Fail' + message = 'Output response is not matching with expected one. The arc routing ' + + +Utils.initialize_flask() +time.sleep(2) +#calling feature abort with existing config +feature_abort() +time.sleep(3) + +#calling abort hisense with exsiting config +abort_hisense() +time.sleep(2) + +#send the second config data for feature abort + +update_config(Config.abort_data_1) + +time.sleep(2) +feature_abort() +time.sleep(3) + +abort_hisense() +time.sleep(2) + +#send the third config data for feature abort + + +update_config(Config.abort_data_2) + +time.sleep(2) +feature_abort() +time.sleep(3) + +abort_hisense() +time.sleep(2) + +#send the forth config data for feature abort + + +update_config(Config.abort_data_3) + +time.sleep(2) +feature_abort() +time.sleep(3) + +abort_hisense() +time.sleep(2) + +#send the fifth config data for feature abort + +update_config(Config.abort_data_4) + +time.sleep(2) +feature_abort() +time.sleep(3) + +abort_hisense() +time.sleep(2) + +#send the sixth config data for feature abort + + +update_config(Config.abort_data_5) + +time.sleep(2) +feature_abort() +time.sleep(3) + +abort_hisense() +time.sleep(2) + + + +# generate logs in terminal +tc_id = 'TCID_028_HDMICECSINK_abortCombinationsEmulation' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) + + + + + + + + + + diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_029_HDMICECSINK_getActiveSourcewithroutingChange.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_029_HDMICECSINK_getActiveSourcewithroutingChange.py new file mode 100644 index 00000000..9ff32609 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_029_HDMICECSINK_getActiveSourcewithroutingChange.py @@ -0,0 +1,112 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID029 +# Testcase Description : Verify the current active source and its output response +import time +import json +import Config +import requests +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +from HdmiCecSource import HdmiCecSourceApis + +print("TC Description - Verify the current active source and its output response") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +#expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"available":true,"logicalAddress":0,"physicalAddress":"0.0.1.0","deviceType":"TV","cecVersion":"Version 1.4","osdName":"TV Box","vendorID":"019fb","powerStatus":"On","port":"TV","success":true}}' +expected_output_response_with_aud_phyAddr = '{"jsonrpc":"2.0","id":42,"result":{"available":true,"logicalAddress":0,"physicalAddress":"0.0.0.0","deviceType":"TV","cecVersion":"Version 1.4","osdName":"TV Box","vendorID":"019fb","powerStatus":"Standby","port":"TV","success":true}}' +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_routing_change) +if curl_response: + Utils.info_log("curl command send for set routing change") + status = 'Pass' + message = 'Output response is matching with expected one. The set latency info ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.set_routing_change)) + status = 'False' + message = 'Output response is not matching with expected one' +time.sleep(3) + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.get_Active_Source) +if curl_response: + Utils.info_log("curl command sent for get active source") +else: + Utils.error_log("Curl command not send {}" .format(HdmiCecSinkApis.get_Active_Source)) + +#sendMessage emulations for image view on and text view on +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.imageViewON))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the imageViewON") +else: + Utils.error_log("sendMessage emulation failed for requesting the imageViewON") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.textViewON))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the textViewON") +else: + Utils.error_log("sendMessage emulation failed for requesting the textViewON") +time.sleep(3) +print("") + +#send messages required for osd string +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.set_osd_string))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the set_osd_string") +else: + Utils.error_log("sendMessage emulation failed for requesting the set_osd_string") +time.sleep(3) +print("") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response_with_aud_phyAddr): + status = 'Pass' + message = 'Output response is matching with expected one. current active source status ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID_029_HDMICECSINK_getActiveSourcewithroutingChange.py' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_030_HDMICECSINK_sendGetAudioStatusMessage.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_030_HDMICECSINK_sendGetAudioStatusMessage.py new file mode 100644 index 00000000..71f6262e --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_030_HDMICECSINK_sendGetAudioStatusMessage.py @@ -0,0 +1,84 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID030 +# Testcase Description : Verify the send get audio status message and its output response +import time +import json +import Config +import requests +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +from HdmiCecSource import HdmiCecSourceApis + +print("TC Description - Verify the send get audio status message and its output response") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.sendGetAudioStatusMessage) +if curl_response: + Utils.info_log("curl command send for send get audio status message") + status = 'Pass' + message = 'Output response is matching with expected one. The send get audio status message ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.sendGetAudioStatusMessage)) + status = 'False' + message = 'Output response is not matching with expected one' + +#Report SAD (short Audio Descriptor) +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportShortAudioDes))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the reportShortAudioDes") +else: + Utils.error_log("sendMessage emulation failed for requesting the reportShortAudioDes") +time.sleep(3) +print("") + +#send messages required for setting system audio mode +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.setSystemAudioMode))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the setSystemAudioMode") +else: + Utils.error_log("sendMessage emulation failed for requesting the setSystemAudioMode") +time.sleep(3) +print("") + +# generate logs in terminal +tc_id = 'TCID_030_HDMICECSINK_sendGetAudioStatusMessage' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_031_HDMICECSINK_getEnabled_HAL_False.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_031_HDMICECSINK_getEnabled_HAL_False.py new file mode 100644 index 00000000..c0af14ca --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_031_HDMICECSINK_getEnabled_HAL_False.py @@ -0,0 +1,124 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID031_getEnabled_HAL_False +# Testcase Description : Verify the driver enabled status, with different enum values for HDMICECGETLOGICALADDRESS HAL API + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +from HdmiCecSource import CecUtils,HdmiCecSourceApis +import Config +import time + +print("TC Description - Returns HDMI-CEC enabled status with different enum values for HDMICECGETLOGICALADDRESS HAL API") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +time.sleep(3) + #ToDo- how to dynamically pass the config here find a way config already written in python side , to do changes in hal c side. +def sink_update(data): + CecUtils.cec_sink_tx_fail(data) + Utils.info_log("Updated Outparams result with next enum combination") +#CecUtils.cec_sink_tx_fail(Config.api_data_sink) +#Utils.info_log("Updated HdmiCecOpen HAL API return values to -1") +# store the expected output response +#expected_output_response = '{"jsonrpc":"2.0","id":42,"error":{"code":1,"message":"ERROR_GENERAL"}}' + +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"enabled":true,"success":true}}' + +def main_scenario(): + curl_response1 = Utils.send_curl_command(HdmiCecSinkApis.get_enabled) + if curl_response1: + Utils.info_log("curl command to get enabled is sent from the test runner") + else: + Utils.error_log("curl command invoke failed") + +# send the curl command and fetch the output json response + curl_response = Utils.send_curl_command(HdmiCecSinkApis.get_enabled) + if curl_response: + Utils.info_log("curl command to get enabled is sent from the test runner") + else: + Utils.error_log("curl command invoke failed") + + return curl_response1 +sink_update(Config.api_data_sink_1) +time.sleep(2) +curl_response1 = main_scenario() + + +sink_update(Config.api_data_sink_2) +time.sleep(2) +curl_response1 = main_scenario() + + +sink_update(Config.api_data_sink_3) +time.sleep(2) +curl_response1 = main_scenario() + + +sink_update(Config.api_data_sink_4) +time.sleep(2) +curl_response1 = main_scenario() + + +sink_update(Config.api_data_sink_5) +time.sleep(2) +curl_response1 = main_scenario() + + +sink_update(Config.api_data_sink_6) +time.sleep(2) +curl_response1 = main_scenario() + + +sink_update(Config.api_data_sink_7) +time.sleep(2) +curl_response1 = main_scenario() + + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response1) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The driver enabled status ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +Utils.info_log("Bringing the system state back to normal") +Utils.initialize_flask() +# generate logs in terminal +tc_id = 'TCID031_HdmiCecSink_getEnabled_HAL_False' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response1) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response1, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_032_HDMICECSINK_EmulateTextViewONStandbyBy.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_032_HDMICECSINK_EmulateTextViewONStandbyBy.py new file mode 100644 index 00000000..a7c02df1 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_032_HDMICECSINK_EmulateTextViewONStandbyBy.py @@ -0,0 +1,91 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID032_EmulateText view On process with sendStandby Message +# Testcase Description : Touch the process text view on on a sink device(as tv views on the text), then Sends a CEC message to the logical address of the device. and verify the outpu response and then trigger the text view on process again +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +import requests +import Config +import json +import time + +print("Testcase Description : Touch the process text view on on a sink device(as tv views on the text), then Sends a CEC message to the logical address of the device. and verify the outpu response and then trigger the text view on process again") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' + +#Emulate TextViewOn Process +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.textViewON))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the textViewON") +else: + Utils.error_log("sendMessage emulation failed for requesting the textViewON") +time.sleep(3) +print("") + + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.send_standby_message) +if curl_response: + Utils.info_log("curl command to send standby message is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + + +#Emulate textviewON +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.textViewON))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the textViewON") +else: + Utils.error_log("sendMessage emulation failed for requesting the textViewON") +time.sleep(3) +print("") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The default vendor id ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID032_EmulateText_view_on_process_with_sendStandby_Message' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_033_HDMICECSINK_setRoutingChangeNegative.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_033_HDMICECSINK_setRoutingChangeNegative.py new file mode 100644 index 00000000..e0a4aeee --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_033_HDMICECSINK_setRoutingChangeNegative.py @@ -0,0 +1,170 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID033_setRoutingChange_negative +# Testcase Description : Changes routing while switching between HDMI inputs and TV. Verify the output response +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +from HdmiCecSource import HdmiCecSourceApis +import json +import requests +import time +import Config + +Utils.initialize_flask() + +expected_output_response = '{"jsonrpc":"2.0","id":42,"error":{"code":1,"message":"ERROR_GENERAL"}}' + +#ToDo - send messages required for switching inputs between hdmi and TV, by sending active source message emulation. +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.inactive_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the inactive source") +else: + Utils.error_log("sendMessage emulation failed for querying the inactive source") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.request_active_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the active source") +else: + Utils.error_log("sendMessage emulation failed for requesting the active source") +time.sleep(3) +print("") + +#send messages required for getting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.active_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the active source") +else: + Utils.error_log("sendMessage emulation failed for querying the active source") +time.sleep(3) +print("") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.send_standby_message) +if curl_response: + Utils.warning_log("send_standby_message curl command sent from the test runner") +else: + Utils.error_log("send_standby_message curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.perform_otp_action) +if curl_response: + Utils.warning_log("perform_otp_action curl command sent from the test runner") +else: + Utils.error_log("perform_otp_action curl command failed") + +#send messages required for getting inactive source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.inactive_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the inactive source") +else: + Utils.error_log("sendMessage emulation failed for querying the inactive source") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.request_active_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the active source") +else: + Utils.error_log("sendMessage emulation failed for requesting the active source") +time.sleep(3) +print("") + +#send messages required for set stream path +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.set_stream_path_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for set stream path to hisense") +else: + Utils.error_log("sendMessage emulation failed for set stream path to hisense") +time.sleep(3) +print("") + +#send messages required for routing change +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.routing_change))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for routing change to hisense") +else: + Utils.error_log("sendMessage emulation failed for routing change to hisense") +time.sleep(3) +print("") + +#send messages required for routing information +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.routing_information_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying routing information from hisense") +else: + Utils.error_log("sendMessage emulation failed for querying routing information from hisense") +time.sleep(3) +print("") + +#send messages required for getting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.active_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the active source") +else: + Utils.error_log("sendMessage emulation failed for querying the active source") +time.sleep(3) +print("") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_routing_change_negative) +if curl_response: + Utils.info_log("curl command send for set routing change") + status = 'Pass' + message = 'Output response is matching with expected one. The set latency info ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.set_routing_change_negative)) + status = 'False' + message = 'Output response is not matching with expected one' + +if str(curl_response) == str(expected_output_response): + Utils.info_log("Test Case Passed") +else: + Utils.error_log("Test Case Failed") +# generate logs in terminal +tc_id = 'TCID033_setRoutingChange_negative' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_034_HDMICECSINK_active_source.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_034_HDMICECSINK_active_source.py new file mode 100644 index 00000000..97dc3ae1 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_034_HDMICECSINK_active_source.py @@ -0,0 +1,74 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID005 +# Testcase Description : Verify that default vendor id is obtained in output response +import time +import json +import Config +import requests +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +from HdmiCecSource import HdmiCecSourceApis + +print("TC Description - Verify that getActiveSource is obtained in output response") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +# Utils.initialize_flask() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' + +#send messages required for getting inactive source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.active_source_xione_uk))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the inactive source") +else: + Utils.error_log("sendMessage emulation failed for querying the inactive source") +time.sleep(3) +print("") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.get_active_route) +if curl_response: + Utils.info_log("curl command send for send get audio status message") + status = 'Pass' + message = 'Output response is matching with expected one. The send get audio status message ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.get_active_route)) + status = 'False' + message = 'Output response is not matching with expected one' + +# generate logs in terminal +tc_id = 'TCID_034_HDMICECSINK_active_source' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_035_Arc_start_stop.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_035_Arc_start_stop.py new file mode 100644 index 00000000..dd38b197 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_035_Arc_start_stop.py @@ -0,0 +1,204 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID035 +# Testcase Description :Emulating osd string, and arc events +import time +import json +import Config +import requests +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +from HdmiCecSource import HdmiCecSourceApis + +print("TC Description - Emulating osd string, and arc events") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask_without_audio_device() +time.sleep(3) +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' + + +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportPhysicalAdd))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for reporting the physical address") +else: + Utils.error_log("sendMessage emulation failed for reporting the physical address") +time.sleep(3) +print("") +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.imageViewON))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the imageViewON") +else: + Utils.error_log("sendMessage emulation failed for requesting the imageViewON") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.textViewON))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the textViewON") +else: + Utils.error_log("sendMessage emulation failed for requesting the textViewON") +time.sleep(3) +print("") + +Utils.initialize_flask() +time.sleep(3) +#Emulation curl command +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_arc_routing_params_enabled) +if curl_response: + Utils.info_log("curl command send for arc routing") + status = 'Pass' + message = 'Output response is matching with expected one. The arc routing ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.set_arc_routing_params_enabled)) + status = 'False' + message = 'Output response is not matching with expected one' + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.routing_change))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the routing_change") +else: + Utils.error_log("sendMessage emulation failed for requesting the routing_change") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.feature_abort))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the feature_abort") +else: + Utils.error_log("sendMessage emulation failed for requesting the feature_abort") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.abort_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the abort_hisense") +else: + Utils.error_log("sendMessage emulation failed for requesting the abort_hisense") +time.sleep(3) +print("") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_routing_change_nav) +if curl_response: + Utils.info_log("curl command send for set routing change") + status = 'Pass' + message = 'Output response is matching with expected one. The set latency info ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.set_routing_change_nav)) + status = 'False' + message = 'Output response is not matching with expected one' +time.sleep(3) + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.initiateArc))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the initiateArc") +else: + Utils.error_log("sendMessage emulation failed for requesting the initiateArc") +time.sleep(3) +print("") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_arc_routing_params_disabled) +if curl_response: + Utils.info_log("curl command send for set routing change") + status = 'Pass' + message = 'Output response is matching with expected one. The set latency info ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.set_arc_routing_params_disabled)) + status = 'False' + message = 'Output response is not matching with expected one' + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.terminateArc))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the terminateArc") +else: + Utils.error_log("sendMessage emulation failed for requesting the terminateArc") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportShortAudioDes))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the reportShortAudioDes") +else: + Utils.error_log("sendMessage emulation failed for requesting the reportShortAudioDes") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.setSystemAudioMode))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the setSystemAudioMode") +else: + Utils.error_log("sendMessage emulation failed for requesting the setSystemAudioMode") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportAudioMode))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the reportAudioMode") +else: + Utils.error_log("sendMessage emulation failed for requesting the reportAudioMode") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.givefeatures))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the givefeatures") +else: + Utils.error_log("sendMessage emulation failed for requesting the givefeatures") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.requestcurrentlatency))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the requestcurrentlatency") +else: + Utils.error_log("sendMessage emulation failed for requesting the requestcurrentlatency") +time.sleep(3) +print("") diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_036_HDMICECSINK_OSDStringMenuLanguageEmulation.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_036_HDMICECSINK_OSDStringMenuLanguageEmulation.py new file mode 100644 index 00000000..8950a9d0 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_036_HDMICECSINK_OSDStringMenuLanguageEmulation.py @@ -0,0 +1,107 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID036 +# Testcase Description : Verify the memu language and OsdString set emulation +import time +import json +import Config +import requests +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +from HdmiCecSource import HdmiCecSourceApis + +print("TC Description - Verify the memu language and OsdString set emulation") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportPhysicalAdd))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the reportPhysicalAdd") +else: + Utils.error_log("sendMessage emulation failed for requesting the reportPhysicalAdd") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.ignore_set_menu_language))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the ignore_set_menu_language") +else: + Utils.error_log("sendMessage emulation failed for requesting the ignore_set_menu_language") +time.sleep(3) +print("") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_menu_language) +if curl_response: + Utils.info_log("curl command send for set menu language") + status = 'Pass' + message = 'Output response is matching with expected one. The set menu language ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.set_menu_language)) + status = 'False' + message = 'Output response is not matching with expected one' + + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.set_osd_string))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the set_osd_string") +else: + Utils.error_log("sendMessage emulation failed for requesting the set_osd_string") +time.sleep(3) +print("") + + + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.get_menu_language_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the get_menu_language_hisense") +else: + Utils.error_log("sendMessage emulation failed for requesting the get_menu_language_hisense") +time.sleep(3) +print("") + +# generate logs in terminal +tc_id = 'TCID036_HdmiCecSink_osdStringMenuLanguage_emulation' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_037_HDMICECSINK_sendEvents.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_037_HDMICECSINK_sendEvents.py new file mode 100644 index 00000000..7a25c246 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_037_HDMICECSINK_sendEvents.py @@ -0,0 +1,87 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID037 +# Testcase Description : To verify the emulation of sending of events + +import subprocess +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis +from HdmiCecSink import HdmiCecSinkApis +import time + + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"enabled":true,"success":true}}' + +print("TC Description - To verify the emulation of sending of events.") +Utils.initialize_flask() +time.sleep(3) +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.get_enabled) +time.sleep(1) +if curl_response: + Utils.warning_log("activate curl command sent from the test runner") +else: + Utils.error_log("activate curl command failed") + +#Define the script to be executed +execute_script = '../../../../../sendEvents.sh' + + +#Execute the script +try: + result = subprocess.run(['/bin/bash', execute_script], check=True, capture_output=True, text=True) + print("sendEvents.sh executed successfully.") + print("Output:\n", result.stdout) + +except subprocess.CalledProcessError as e: + print("Error occured while executing the shell script.") + print("Error message:\n", e.stderr) + +print("---------------------------------------------------------------------------------------------------------------------------") + +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one.' +else: + status = 'Fail' + message = 'Output response is different from expected one.' + +# generate logs in terminal +tc_id = 'TCID025_sending events' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) + diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_038_HDMICECSINK_undefinedDatatypesInSetApis.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_038_HDMICECSINK_undefinedDatatypesInSetApis.py new file mode 100644 index 00000000..cfd4b7ef --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_038_HDMICECSINK_undefinedDatatypesInSetApis.py @@ -0,0 +1,54 @@ +# Testcase ID : TCID005 +# Testcase Description : Verify that default vendor id is obtained in output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis + +print("TC Description - Verify that default vendor id AND default OSD name is obtained in output response") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +count = 0 +expected_output_response_vendor_id = '{"jsonrpc":"2.0","id":42,"result":{"vendorid":"019fb","success":true}}' +expected_output_response_osd_name = '{"jsonrpc":"2.0","id":42,"result":{"name":"TV Box","success":true}}' +# send the curl command and fetch the output json response +curl_response_vendor_id = Utils.send_curl_command(HdmiCecSinkApis.set_vendor_id_with_undefined_datatype) +curl_response_vendor_id = Utils.send_curl_command(HdmiCecSinkApis.get_vendor_id) +if curl_response_vendor_id: + Utils.info_log("curl command to get vendorID is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +curl_response_osd_name = Utils.send_curl_command(HdmiCecSinkApis.set_osd_name_with_undefined_datatype) +curl_response_osd_name = Utils.send_curl_command(HdmiCecSinkApis.get_osd_name) +if curl_response_osd_name: + Utils.info_log("curl command to set OSD name is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response_vendor_id) == str(expected_output_response_vendor_id) and (curl_response_osd_name) == str(expected_output_response_osd_name): + count = count+1 + status = 'Pass' + message = 'Output response is matching with expected one. The default vendor id ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID005_HdmiCecSink_getVendorId' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response_osd_name) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response_osd_name, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_039_HDMICECSINK_undefinedBooleanforSetApis.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_039_HDMICECSINK_undefinedBooleanforSetApis.py new file mode 100644 index 00000000..7043de71 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_039_HDMICECSINK_undefinedBooleanforSetApis.py @@ -0,0 +1,164 @@ +# Testcase ID : TCID023_setRoutingChange +# Testcase Description : Changes routing while switching between HDMI inputs and TV. Verify the output response +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +from HdmiCecSource import HdmiCecSourceApis +import json +import requests +import time +import Config + +Utils.initialize_flask() + +print("TC Description - Changes routing while switching between HDMI inputs and TV. Verify the output response") +#ToDo - send messages required for switching inputs between hdmi and TV, by sending active source message emulation. +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.inactive_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the inactive source") +else: + Utils.error_log("sendMessage emulation failed for querying the inactive source") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.request_active_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the active source") +else: + Utils.error_log("sendMessage emulation failed for requesting the active source") +time.sleep(3) +print("") + +#send messages required for getting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.active_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the active source") +else: + Utils.error_log("sendMessage emulation failed for querying the active source") +time.sleep(3) +print("") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.send_standby_message) +if curl_response: + Utils.warning_log("send_standby_message curl command sent from the test runner") +else: + Utils.error_log("send_standby_message curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.perform_otp_action) +if curl_response: + Utils.warning_log("perform_otp_action curl command sent from the test runner") +else: + Utils.error_log("perform_otp_action curl command failed") + +#send messages required for getting inactive source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.inactive_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the inactive source") +else: + Utils.error_log("sendMessage emulation failed for querying the inactive source") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.request_active_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the active source") +else: + Utils.error_log("sendMessage emulation failed for requesting the active source") +time.sleep(3) +print("") + +#send messages required for set stream path +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.set_stream_path_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for set stream path to hisense") +else: + Utils.error_log("sendMessage emulation failed for set stream path to hisense") +time.sleep(3) +print("") + +#send messages required for routing change +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.routing_change))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for routing change to hisense") +else: + Utils.error_log("sendMessage emulation failed for routing change to hisense") +time.sleep(3) +print("") + +#send messages required for routing information +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.routing_information_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying routing information from hisense") +else: + Utils.error_log("sendMessage emulation failed for querying routing information from hisense") +time.sleep(3) +print("") + +#send messages required for getting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.active_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the active source") +else: + Utils.error_log("sendMessage emulation failed for querying the active source") +time.sleep(3) +print("") + + +#send messages required for getting menu language +#message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( +# Config.flask_server_ip, json.dumps(Config.get_menu_language_hisense))) +#if "200" in str(message1_response): +# Utils.info_log("sendMessage emulation success for querying the menu language") +#else: +# Utils.error_log("sendMessage emulation failed for querying the menu language") +#time.sleep(3) +#print("") + +#send messages required for setting menu language +#message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( +# Config.flask_server_ip, json.dumps(Config.set_menu_language))) +#if "200" in str(message1_response): +# Utils.info_log("sendMessage emulation success for setting the menu language") +#else: +# Utils.error_log("sendMessage emulation failed for setting the menu language") +#time.sleep(3) +#print("") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_routing_change_with_undefined_datatype ) +if curl_response: + Utils.info_log("curl command send for set routing change") + status = 'Pass' + message = 'Output response is matching with expected one. The set latency info ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.set_routing_change_with_undefined_datatype)) + status = 'False' + message = 'Output response is not matching with expected one' + +# generate logs in terminal +tc_id = 'TCID039_HdmiCecSink_setRoutingChange_with_undefinedDatatypesandRoutingInformation' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_040_HDMICECSINK_undefinedDatatypeForSetLatencyInfo.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_040_HDMICECSINK_undefinedDatatypeForSetLatencyInfo.py new file mode 100644 index 00000000..23a64104 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_040_HDMICECSINK_undefinedDatatypeForSetLatencyInfo.py @@ -0,0 +1,135 @@ +# Testcase ID : TCID022_setLatencyInfo +# Testcase Description : Sets the Current Latency Values such as Video Latency, Latency Flags,Audio Output Compensated value and Audio Output Delay by sending message for Dynamic Auto LipSync Feature. Verify the output response +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +import json +import requests +import time +import Config + +Utils.initialize_flask() +#ToDo - send messages required for reporting current latency info +#send messages required for reporting current latency +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.requestcurrentlatency))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the requestcurrentlatency") +else: + Utils.error_log("sendMessage emulation failed for requesting the requestcurrentlatency") +time.sleep(3) +print("") + + +#send messages required for getting menu language +#message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( +# Config.flask_server_ip, json.dumps(Config.get_menu_language_hisense))) +#if "200" in str(message1_response): +# Utils.info_log("sendMessage emulation success for querying the menu language") +#else: +# Utils.error_log("sendMessage emulation failed for querying the menu language") +#time.sleep(3) +#print("") + +#send messages required for setting menu language +#message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( +# Config.flask_server_ip, json.dumps(Config.set_menu_language))) +#if "200" in str(message1_response): +# Utils.info_log("sendMessage emulation success for setting the menu language") +#else: +# Utils.error_log("sendMessage emulation failed for setting the menu language") +#time.sleep(3) +#print("") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_latency_info) +if curl_response: + Utils.info_log("curl command send for set latency info") + status = 'Pass' + message = 'Output response is matching with expected one. The set latency info ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.set_latency_info)) + status = 'False' + message = 'Output response is not matching with expected one' + +# generate logs in terminal +tc_id = 'TCID022_HdmiCecSink_setLatencyInfo' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message)# Testcase ID : TCID022_setLatencyInfo +# Testcase Description : Sets the Current Latency Values such as Video Latency, Latency Flags,Audio Output Compensated value and Audio Output Delay by sending message for Dynamic Auto LipSync Feature. Verify the output response +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +import json +import requests +import time +import Config + +Utils.initialize_flask() +#ToDo - send messages required for reporting current latency info +#send messages required for reporting current latency +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.requestcurrentlatency))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the requestcurrentlatency") +else: + Utils.error_log("sendMessage emulation failed for requesting the requestcurrentlatency") +time.sleep(3) +print("") + + +#send messages required for getting menu language +#message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( +# Config.flask_server_ip, json.dumps(Config.get_menu_language_hisense))) +#if "200" in str(message1_response): +# Utils.info_log("sendMessage emulation success for querying the menu language") +#else: +# Utils.error_log("sendMessage emulation failed for querying the menu language") +#time.sleep(3) +#print("") + +#send messages required for setting menu language +#message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( +# Config.flask_server_ip, json.dumps(Config.set_menu_language))) +#if "200" in str(message1_response): +# Utils.info_log("sendMessage emulation success for setting the menu language") +#else: +# Utils.error_log("sendMessage emulation failed for setting the menu language") +#time.sleep(3) +#print("") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_latency_info_with_undefinedLatencyMode) +if curl_response: + Utils.info_log("curl command send for set latency info") + status = 'Pass' + message = 'Output response is matching with expected one. The set latency info ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.set_latency_info_with_undefinedLatencyMode)) + status = 'False' + message = 'Output response is not matching with expected one' + +# generate logs in terminal +tc_id = 'TCID040_HdmiCecSink_setLatencyInfo_with_erroneousLatencyModes' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_041_HDMICECSINK_setRoutingChange_with_undefinedRoutingParams.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_041_HDMICECSINK_setRoutingChange_with_undefinedRoutingParams.py new file mode 100644 index 00000000..da66e44a --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_041_HDMICECSINK_setRoutingChange_with_undefinedRoutingParams.py @@ -0,0 +1,164 @@ +# Testcase ID : TCID041_setRoutingChange_withUndefinedDatatypes +# Testcase Description : Changes routing while switching between error inputs and TV. Verify the erroneuos output response +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +from HdmiCecSource import HdmiCecSourceApis +import json +import requests +import time +import Config + +Utils.initialize_flask() + +print("TC Description - Changes routing while switching between error inputs and TV. Verify the erroneuos output response") +#ToDo - send messages required for switching inputs between hdmi and TV, by sending active source message emulation. +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.inactive_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the inactive source") +else: + Utils.error_log("sendMessage emulation failed for querying the inactive source") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.request_active_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the active source") +else: + Utils.error_log("sendMessage emulation failed for requesting the active source") +time.sleep(3) +print("") + +#send messages required for getting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.active_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the active source") +else: + Utils.error_log("sendMessage emulation failed for querying the active source") +time.sleep(3) +print("") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.send_standby_message) +if curl_response: + Utils.warning_log("send_standby_message curl command sent from the test runner") +else: + Utils.error_log("send_standby_message curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.perform_otp_action) +if curl_response: + Utils.warning_log("perform_otp_action curl command sent from the test runner") +else: + Utils.error_log("perform_otp_action curl command failed") + +#send messages required for getting inactive source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.inactive_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the inactive source") +else: + Utils.error_log("sendMessage emulation failed for querying the inactive source") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.request_active_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the active source") +else: + Utils.error_log("sendMessage emulation failed for requesting the active source") +time.sleep(3) +print("") + +#send messages required for set stream path +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.set_stream_path_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for set stream path to hisense") +else: + Utils.error_log("sendMessage emulation failed for set stream path to hisense") +time.sleep(3) +print("") + +#send messages required for routing change +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.routing_change))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for routing change to hisense") +else: + Utils.error_log("sendMessage emulation failed for routing change to hisense") +time.sleep(3) +print("") + +#send messages required for routing information +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.routing_information_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying routing information from hisense") +else: + Utils.error_log("sendMessage emulation failed for querying routing information from hisense") +time.sleep(3) +print("") + +#send messages required for getting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.active_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the active source") +else: + Utils.error_log("sendMessage emulation failed for querying the active source") +time.sleep(3) +print("") + + +#send messages required for getting menu language +#message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( +# Config.flask_server_ip, json.dumps(Config.get_menu_language_hisense))) +#if "200" in str(message1_response): +# Utils.info_log("sendMessage emulation success for querying the menu language") +#else: +# Utils.error_log("sendMessage emulation failed for querying the menu language") +#time.sleep(3) +#print("") + +#send messages required for setting menu language +#message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( +# Config.flask_server_ip, json.dumps(Config.set_menu_language))) +#if "200" in str(message1_response): +# Utils.info_log("sendMessage emulation success for setting the menu language") +#else: +# Utils.error_log("sendMessage emulation failed for setting the menu language") +#time.sleep(3) +#print("") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_routing_change_with_undefined_datatype) +if curl_response: + Utils.info_log("curl command send for set routing change") + status = 'Pass' + message = 'Output response is matching with expected one. The set latency info ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.set_latency_info)) + status = 'False' + message = 'Output response is not matching with expected one' + +# generate logs in terminal +tc_id = 'TCID041_HdmiCecSink_setRoutingChange_with_erroneousRoutingParams' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_042_HDMICECSINK_PassingNegativeConfigurationsfromHalside.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_042_HDMICECSINK_PassingNegativeConfigurationsfromHalside.py new file mode 100644 index 00000000..32a3981a --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_042_HDMICECSINK_PassingNegativeConfigurationsfromHalside.py @@ -0,0 +1,66 @@ +# Testcase ID : TCID021_setMenuLanguage +# Testcase Description : Updates the internal data structure with the new menu Language and also broadcasts the CEC message.and verify the outpu response +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +import json +import requests +import time +import Config + +Utils.initialize_flask_with_HalApiNegativeValues() +#send messages required for getting physical address +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.give_physical_address_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the physical address") +else: + Utils.error_log("sendMessage emulation failed for querying the physical address") +time.sleep(3) +print("") + +#send messages required for getting menu language +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.get_menu_language_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the menu language") +else: + Utils.error_log("sendMessage emulation failed for querying the menu language") +time.sleep(3) +print("") + +#send messages required for setting menu language +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.set_menu_language))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for setting the menu language") +else: + Utils.error_log("sendMessage emulation failed for setting the menu language") +time.sleep(3) +print("") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.set_menu_language) +if curl_response: + Utils.info_log("curl command send for set menu language") + status = 'Pass' + message = 'Output response is matching with expected one. The set menu language ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.set_menu_language)) + status = 'False' + message = 'Output response is not matching with expected one' + +# generate logs in terminal +tc_id = 'TCID021_HdmiCecSink_setMenuLanguage_withNegativeHapApis' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_043_HDMICECSINK_getDeviceListwithHalApisNegativeReturn.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_043_HDMICECSINK_getDeviceListwithHalApisNegativeReturn.py new file mode 100644 index 00000000..1ab48d58 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_043_HDMICECSINK_getDeviceListwithHalApisNegativeReturn.py @@ -0,0 +1,47 @@ +# Testcase ID : TCID010 +# Testcase Description : Gets the number of connected source devices and system information for each device. The information includes device type, physical address, CEC version, vendor ID, power status and OSD name., and verify the output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +import time + +print("TC Description - Gets the number of connected source devices and system information for each device. The information includes device type, physical address, CEC version, vendor ID, power status and OSD name.Here an error value is passed to all HAL APIs for the system to return erroneous response") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask_with_HalApiNegativeValues() +time.sleep(6) +expected_output_response = '{"jsonrpc":"2.0","id":42,"error":{"code":1,"message":"ERROR_GENERAL"}}' + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.get_device_list) +if curl_response: + Utils.info_log("curl command to get devicelist is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The default vendor id ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID005_HdmiCecSink_getDevicelist' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +#restoring to working state +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_044_HDMICECSINK_getActiveRouteNegativeHal.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_044_HDMICECSINK_getActiveRouteNegativeHal.py new file mode 100644 index 00000000..54024114 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_044_HDMICECSINK_getActiveRouteNegativeHal.py @@ -0,0 +1,52 @@ +# Testcase ID : TCID005 +# Testcase Description : Verify that default vendor id is obtained in output response +import time +import json +import Config +import requests +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +from HdmiCecSource import HdmiCecSourceApis + +print("TC Description - Verify that getActiveSource error is obtained in output response as HAL Api values has been given erroneous") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask_with_HalApiNegativeValues() +expected_output_response = '{"jsonrpc":"2.0","id":42,"error":{"code":1,"message":"ERROR_GENERAL"}}' + +#send messages required for getting inactive source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.active_source_xione_uk))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the inactive source") +else: + Utils.error_log("sendMessage emulation failed for querying the inactive source") +time.sleep(3) +print("") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.get_active_route) +if curl_response: + Utils.info_log("curl command send for send get audio status message") + status = 'Pass' + message = 'Output response is matching with expected one. The send get audio status message ' \ + 'is obtained in output response' +else: + Utils.error_log("curl command send failed {}" .format(HdmiCecSinkApis.get_active_route)) + status = 'False' + message = 'Output response is not matching with expected one' + +# generate logs in terminal +tc_id = 'TCID_044_HDMICECSINK_active_route_HAL_False' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_045_HDMICECSINK_AudioStatusNegative.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_045_HDMICECSINK_AudioStatusNegative.py new file mode 100644 index 00000000..78c92eb6 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_045_HDMICECSINK_AudioStatusNegative.py @@ -0,0 +1,74 @@ +# Testcase ID : TCID014_getAudioStatusMessage +# Testcase Description : Sends the CEC message to request the audio status., and verify the output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +from HdmiCecSource import HdmiCecSourceApis +import Config +import requests +import json +import time + +print("TC Description - To check if mngr Sends the CEC message to request the audio status if HAL Api values are passed negative") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask_with_HalApiNegativeValues() +expected_output_response = '{"jsonrpc":"2.0","id":42,"error":{"code":1,"message":"ERROR_GENERAL"}}' + + + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.sendGetAudioStatusMessage) +if curl_response: + Utils.info_log("curl command to send audio status message is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +time.sleep(3) + +#ToDo - send message emulation for report audio status message event[reportAudioStatusEvent Triggered when CEC message of device is received.] +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportShortAudioDes))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the reportShortAudioDes") +else: + Utils.error_log("sendMessage emulation failed for requesting the reportShortAudioDes") +time.sleep(3) +print("") + +time.sleep(3) + +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportAudioMode))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the reportAudioMode") +else: + Utils.error_log("sendMessage emulation failed for requesting the reportAudioMode") +time.sleep(3) +print("") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The send audio status message and report audio sytatus event ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID045_HdmiCecSink_getAudioStatusMessageNegative' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_046_HDMICECSINK_HALNegativeReturn.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_046_HDMICECSINK_HALNegativeReturn.py new file mode 100644 index 00000000..f2aecd44 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_046_HDMICECSINK_HALNegativeReturn.py @@ -0,0 +1,43 @@ +# Testcase ID : TCID046_HalNegative +# Testcase Description : Returns HDMI-CEC driver enabled status + +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis + +print("TC Description - Returns whether HDMI-CEC is enabled on platform or not.") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_hal_apis_with_negative_values() +expected_output_response = '{"jsonrpc":"2.0","id":42,"error":{"code":1,"message":"ERROR_GENERAL"}}' +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.get_enabled) +if curl_response: + Utils.info_log("curl command to get enabled is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The default driver status ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID046_HdmiCecSink_HAL_ReturnsNegative_and_string' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_047_HDMICECSINK_SetApisWithoutParamsNegative.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_047_HDMICECSINK_SetApisWithoutParamsNegative.py new file mode 100644 index 00000000..30f94566 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_047_HDMICECSINK_SetApisWithoutParamsNegative.py @@ -0,0 +1,144 @@ +# Testcase ID : TCID047_setApisWithoutParams +# Testcase Description : send all set apis with default HAL values and without params in json rpc request +import time +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis + +print("TC Description - send all set apis with default HAL values and without params in json rpc request") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() + +def wait(): + time.sleep(2) + +expected_output_response = '{"jsonrpc":"2.0","id":42,"error":{"code":1,"message":"ERROR_GENERAL"}}' +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSinkApis.sendKeyPress_withoutParams) +if curl_response: + Utils.info_log("curl command to send key press without params is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +wait() + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.senduserContolledPress_withoutParams ) +if curl_response: + Utils.info_log("curl command to send usercontrol key press without params is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.sendusercontrolledReleased_withoutParams ) +if curl_response: + Utils.info_log("curl command to send user key release without params is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +wait() + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.setActivepath_withoutParams ) +if curl_response: + Utils.info_log("curl command to set active path without params is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +wait() + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.setEnabled_withoutParams ) +if curl_response: + Utils.info_log("curl command to set enable the driver without params is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +wait() + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.setMenuLanguage_withoutParams ) +if curl_response: + Utils.info_log("curl command to set menu language without params is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +wait() + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.setMenuLanguage_withoutParams ) +if curl_response: + Utils.info_log("curl command to set menu language without params is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +wait() + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.setOSDName_withoutParams ) +if curl_response: + Utils.info_log("curl command to set OSD name without params is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +wait() + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.setRoutingChange_withoutParams ) +if curl_response: + Utils.info_log("curl command to set routing change without params is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +wait() + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.setupARCRouting_withoutParams ) +if curl_response: + Utils.info_log("curl command to setup ARC routing without params is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +wait() + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.setvendorID_withoutParams ) +if curl_response: + Utils.info_log("curl command to set vendor id without params is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +wait() + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.setMenuLanguage_withoutParams ) +if curl_response: + Utils.info_log("curl command to set menu language without params is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +wait() + +curl_response = Utils.send_curl_command(HdmiCecSinkApis.setLatencyInfo_withoutParams ) +if curl_response: + Utils.info_log("curl command to set latency info without params is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. error value ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID047_HdmiCecSink_setApis_withoutParams_Negative' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +#Reset the state of the mock system to original +Utils.initialize_flask() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_Emulate.py b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_Emulate.py new file mode 100644 index 00000000..aa1c14b6 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSink/TCID_Emulate.py @@ -0,0 +1,205 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID005 +# Testcase Description : Verify that default vendor id is obtained in output response +import time +import json +import Config +import requests +from Utilities import Utils, ReportGenerator +from HdmiCecSink import HdmiCecSinkApis +from HdmiCecSource import HdmiCecSourceApis + +print("TC Description - Verify that default vendor id is obtained in output response") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initialize_flask() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' + +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportPhysicalAdd))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for reporting the physical address") +else: + Utils.error_log("sendMessage emulation failed for reporting the physical address") +time.sleep(3) +print("") + +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.DeviceVendorID))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for reporting the DeviceVendorID") +else: + Utils.error_log("sendMessage emulation failed for reporting the DeviceVendorID") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.imageViewON))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the imageViewON") +else: + Utils.error_log("sendMessage emulation failed for requesting the imageViewON") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.textViewON))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the textViewON") +else: + Utils.error_log("sendMessage emulation failed for requesting the textViewON") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.routing_change))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the routing_change") +else: + Utils.error_log("sendMessage emulation failed for requesting the routing_change") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.ignore_set_menu_language))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the ignore_set_menu_language") +else: + Utils.error_log("sendMessage emulation failed for requesting the ignore_set_menu_language") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.set_osd_string))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the set_osd_string") +else: + Utils.error_log("sendMessage emulation failed for requesting the set_osd_string") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.get_menu_language_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the get_menu_language_hisense") +else: + Utils.error_log("sendMessage emulation failed for requesting the get_menu_language_hisense") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.feature_abort))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the feature_abort") +else: + Utils.error_log("sendMessage emulation failed for requesting the feature_abort") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.abort_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the abort_hisense") +else: + Utils.error_log("sendMessage emulation failed for requesting the abort_hisense") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.initiateArc))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the initiateArc") +else: + Utils.error_log("sendMessage emulation failed for requesting the initiateArc") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.terminateArc))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the terminateArc") +else: + Utils.error_log("sendMessage emulation failed for requesting the terminateArc") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportShortAudioDes))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the reportShortAudioDes") +else: + Utils.error_log("sendMessage emulation failed for requesting the reportShortAudioDes") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.setSystemAudioMode))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the setSystemAudioMode") +else: + Utils.error_log("sendMessage emulation failed for requesting the setSystemAudioMode") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportAudioMode))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the reportAudioMode") +else: + Utils.error_log("sendMessage emulation failed for requesting the reportAudioMode") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.givefeatures))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the givefeatures") +else: + Utils.error_log("sendMessage emulation failed for requesting the givefeatures") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.requestcurrentlatency))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the requestcurrentlatency") +else: + Utils.error_log("sendMessage emulation failed for requesting the requestcurrentlatency") +time.sleep(3) +print("") diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/CecUtils.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/CecUtils.py new file mode 100644 index 00000000..f6a2322f --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/CecUtils.py @@ -0,0 +1,117 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# This file contains all the common functions required for test framework + +import requests +import json +import time +import Config +from Utilities import Utils +from HdmiCecSource import HdmiCecSourceApis + + +def cec_update_api_overrides(data): + '''This function is used to update the api overrides data. After updating the data we will + deactivate and then reactivate the HdmiCecSource plugin to reflect pushed changes''' + try: + # Change the values of api overrides for hdmi-cec plugin using updateAPIConfig API + api_overrides_response = requests.get("http://{}/Hdmicec.updateAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(data))) + print("Inside CecUtils.py : " + api_overrides_response.text + " : " + str(data)) + time.sleep(3) + + # Deactivate the plugin using curl command + Utils.send_curl_command(HdmiCecSourceApis.deactivate_command) + + # Activate the plugin using curl command + Utils.send_curl_command(HdmiCecSourceApis.activate_command) + except: + print("Inside CecUtils.py : Exception in cec_update_api_overrides function") + + +def cec_sink_tx_fail(data): + '''This function is used to update the api overrides data. After updating the data we will + deactivate and then reactivate the HdmiCecSource plugin to reflect pushed changes''' + try: + # Change the values of api overrides for hdmi-cec plugin using updateAPIConfig API + api_overrides_response = requests.get("http://{}/Hdmicec.updateAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(data))) + print("Inside CecUtils.py : " + api_overrides_response.text + " : " + str(data)) + time.sleep(3) + + # Deactivate the plugin using curl command + Utils.send_curl_command(HdmiCecSourceApis.deactivate_command) + + # Activate the plugin using curl command + Utils.send_curl_command(HdmiCecSourceApis.activate_command) + time.sleep(5) + except: + print("Inside CecUtils.py : Exception in cec_update_api_overrides function") + + + +def cec_post_condition_for_negative_scenarios(): + '''This function is used to update the api overrides data back to default. After updating the data + we will restart WPEFramework & Websocket services and then activate the HdmiCecSource plugin + again to reflect pushed changes''' + try: + # Change the values of api overrides data for hdmi-cec plugin back to default 0 + api_overrides_response = requests.get("http://{}/Hdmicec.updateAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.api_data))) + print("Inside CecUtils.py : Post-condition : " + api_overrides_response.text + " : " + str(Config.api_data)) + # time.sleep(3) + + # Restart the WPEFramework & Websocket services + Utils.restart_services() + # time.sleep(3) + + # Store the expected output response for activate command + expected_output_response = '{"jsonrpc":"2.0","id":3,"result":null}' + + # Send the controller activate curl command and fetch the output json response + curl_response = Utils.send_curl_command(HdmiCecSourceApis.activate_command) + + # Compare both expected and received output responses + if str(curl_response) == str(expected_output_response): + print("Inside CecUtils.py : Post-condition : Successfully restarted the WPEFramework & " + "Websocket server services. Successfully activated the HdmiCecSource plugin") + else: + print("Inside CecUtils.py : Post-condition : Failed to restart the WPEFramework & " + "Websocket server services. Failed to activate the HdmiCecSource plugin") + except: + print("Inside CecUtils.py : Post-condition : Exception in cec_post_condition_for_negative_scenarios function") + + +def activate_cec(): + '''This function is used to activate the HdmiCecSource plugin''' + try: + # send the controller activate curl command and fetch the output json response + curl_response = Utils.send_curl_command(HdmiCecSourceApis.activate_command) + + # compare both expected and received output responses + if str(curl_response) == str(HdmiCecSourceApis.expected_output_response): + print("Inside CecUtils.py : Successfully activated the HdmiCecSource plugin") + else: + print("Inside CecUtils.py : Failed to activate the HdmiCecSource plugin") + except: + print("Inside CecUtils.py : Exception in activate_cec function") diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/HdmiCecSourceApis.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/HdmiCecSourceApis.py new file mode 100644 index 00000000..0c51dd6a --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/HdmiCecSourceApis.py @@ -0,0 +1,129 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Curl command for activating HdmiCecSource plugin +activate_command = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc":"2.0","id":"3" +,"method": "Controller.1.activate", "params":{"callsign":"org.rdk.HdmiCecSource"}}' http://127.0.0.1:55555/jsonrpc''' + +# Curl command for deactivating HdmiCecSource plugin +deactivate_command = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc":"2.0","id":"3" +,"method": "Controller.1.deactivate", "params":{"callsign":"org.rdk.HdmiCecSource"}}' http://127.0.0.1:55555/jsonrpc''' + +# Store the expected output response for activate & deactivate curl command +expected_output_response = '{"jsonrpc":"2.0","id":3,"result":null}' + +###################################################################################### + +# HdmiCecSource Methods : + +get_device_list = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.getDeviceList"}' http://127.0.0.1:55555/jsonrpc''' + +send_standby_message = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", +"id": 42,"method":"org.rdk.HdmiCecSource.sendStandbyMessage"}' http://127.0.0.1:55555/jsonrpc''' + +get_vendor_id = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.getVendorId"}' http://127.0.0.1:55555/jsonrpc''' + +set_vendor_id = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSource.setVendorId","params": {"vendorid": "0x4455"}}' http://127.0.0.1:55555/jsonrpc''' + +get_osd_name = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.getOSDName"}' http://127.0.0.1:55555/jsonrpc''' + +set_osd_name = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSource.setOSDName","params": {"name": "CUSTOM8 TV"}}' http://127.0.0.1:55555/jsonrpc''' + +get_enabled = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.getEnabled"}' http://127.0.0.1:55555/jsonrpc''' + +set_enabled_false = '''curl --silent --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:55555/jsonrpc''' + +set_enabled_true = '''curl --silent --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:55555/jsonrpc''' + +get_active_source_status = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", +"id": 42,"method":"org.rdk.HdmiCecSource.getActiveSourceStatus","params": {"status": true}}' http://127.0.0.1:55555/jsonrpc''' + +get_otp_enabled = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.getOTPEnabled"}' http://127.0.0.1:55555/jsonrpc''' + +set_otp_enabled_false = '''curl --silent --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:55555/jsonrpc''' + +set_otp_enabled_true = '''curl --silent --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:55555/jsonrpc''' + +send_keypress_VOLUME_UP = '''curl --silent --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:55555/jsonrpc''' +send_keypress_VOLUME_DOWN = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 66}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_MUTE = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 67}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_UP = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 1}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_DOWN = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 2}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_LEFT = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 3}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_RIGHT = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 4}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_SELECT = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 0}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_HOME = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 9}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_BACK = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 13}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_0 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 32}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_1 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 33}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_2 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 34}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_3 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 35}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_4 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 36}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_5 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 37}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_6 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 38}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_7 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 39}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_8 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 40}}' http://127.0.0.1:55555/jsonrpc''' +send_keypress_NUMBER_9 = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id": 42, +"method":"org.rdk.HdmiCecSource.sendKeyPressEvent", "params": {"logicalAddress": 0,"keyCode": 41}}' http://127.0.0.1:55555/jsonrpc''' + +perform_otp_action = '''curl --silent --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0", "id":42, +"method":"org.rdk.HdmiCecSource.performOTPAction"}' http://127.0.0.1:55555/jsonrpc''' + +set_otp_enabled_invalid = '''curl --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0","id": 42,"method": "org.rdk.HdmiCecSource.setOTPEnabled","params": {"ennable": true}}' http://127.0.0.1:55555/jsonrpc''' + +set_osd_name_invalid = '''curl --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0","id": 42,"method": "org.rdk.HdmiCecSource.setOSDName","params": {"nnamme": "LG TV"}}' http://127.0.0.1:55555/jsonrpc''' + +set_vendor_id_invalid_1 = '''curl --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0","id": 42,"method": "org.rdk.HdmiCecSource.setVendorId","params": {"vendorid": "]]"}}' http://127.0.0.1:55555/jsonrpc''' + +set_vendor_id_invalid_2 = '''curl --header "Content-Type: application/json" --request POST -d '{"jsonrpc": "2.0","id": 42,"method": "org.rdk.HdmiCecSource.setVendorId","params": {"vllendorid": "]]"}}' http://127.0.0.1:55555/jsonrpc''' + + diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID001.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID001.py new file mode 100644 index 00000000..c7dab53d --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID001.py @@ -0,0 +1,146 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID001 +# Testcase Description : To verify that standby message is successfully triggered +# and got proper logs in thunder. Hit the curl command for sendStandbyMessage and send the corresponding +# messages to hal. Verify the output response. Also, wake up the devices by sending cec message as post condition +import subprocess +import json +import requests +import time +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' + +print("TC Description - To verify that standby message is successfully triggered and get proper logs in thunder. Hit the curl command for sendStandbyMessage and send the corresponding messages to hal. Verify the output response. Also, wake up the devices by sending cec message as post condition") +#send messages required for getting power status of device +print("---------------------------------------------------------------------------------------------------------------------------") +Utils.initiliaze_flask_for_HdmiCecSource() +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.getPowerStatusMessage))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the powerstatus of TV") +else: + Utils.error_log("sendMessage emulation failed for querying the powerstatus of TV") +time.sleep(3) +print("") + +#send messages required for reporting power status of device +print("---------------------------------------------------------------------------------------------------------------------------") +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportPowerStatusMessage))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for reporting the powerstatus of TV") +else: + Utils.error_log("sendMessage emulation failed for reporting the powerstatus of TV") +time.sleep(3) +print("") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.send_standby_message) +if curl_response: + Utils.warning_log("send_standby_message curl command sent from the test runner") +else: + Utils.error_log("send_standby_message curl command failed") + +# send messages required for getting power status of device +print("---------------------------------------------------------------------------------------------------------------------------") +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.getPowerStatusMessage))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the powerstatus of TV") +else: + Utils.error_log("sendMessage emulation failed for querying the powerstatus of TV") +time.sleep(3) +print("") + +#send messages required for reporting power status of device +print("---------------------------------------------------------------------------------------------------------------------------") +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportPowerStatusMessage))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for reporting the powerstatus of TV") +else: + Utils.error_log("sendMessage emulation failed for reporting the powerstatus of TV") +time.sleep(3) +print("") + +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. We are expecting opcode : 36 in thunder logs' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID001_sendStandbyMessage' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) + +# wake up the device from standby as post condition by sending message +print("---------------------------------------------------------------------------------------------------------------------------") +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.performOTPActionMessage))) +Utils.warning_log("Reset the device state to ON from standby") +time.sleep(3) + +# send messages required for getting power status of device +print("---------------------------------------------------------------------------------------------------------------------------") +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.getPowerStatusMessage))) +time.sleep(3) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the powerstatus of TV") +else: + Utils.error_log("sendMessage emulation failed for querying the powerstatus of TV") +time.sleep(3) +print("") + +#send messages required for reporting power status of device +print("---------------------------------------------------------------------------------------------------------------------------") +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportPowerStatusMessage))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for reporting the powerstatus of TV") +else: + Utils.error_log("sendMessage emulation failed for reporting the powerstatus of TV") +time.sleep(3) +print("") +Utils.initiliaze_flask_for_HdmiCecSource() + + diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID002.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID002.py new file mode 100644 index 00000000..12c601f4 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID002.py @@ -0,0 +1,66 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID002 +# Testcase Description : Verify that default vendor id is obtained in output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +print("TC Description - Verify that default vendor id is obtained in output response") +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +Utils.initiliaze_flask_for_HdmiCecSource() +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"vendorid":"019fb","success":true}}' + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_vendor_id) +if curl_response: + Utils.info_log("curl command to get vendorID is sent from the test runner") +else: + Utils.error_log("curl command invoke failed") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The default vendor id ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID002_getVendorId' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initiliaze_flask_for_HdmiCecSource() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID003.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID003.py new file mode 100644 index 00000000..f4a8c13c --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID003.py @@ -0,0 +1,75 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID003 +# Testcase Description : Set the vendor id to new one using curl command and verify that new +# vendor id set by the test user is obtained in output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +print("TC Description - Set the vendor id to new one using curl command and verify that new vendor id set by the test user is obtained in output response") +# send the curl command to set the new vendor id +print("---------------------------------------------------------------------------------------------------------------------------") +Utils.initiliaze_flask_for_HdmiCecSource() +set_response = Utils.send_curl_command(HdmiCecSourceApis.set_vendor_id) +if set_response: + Utils.info_log("curl command sent for setting the vendorID") +else: + Utils.error_log("set vendor_id failed") +print("") + +# store the expected output response of testcase +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"vendorid":"04455","success":true}}' + +# send the curl command to get vendor id and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_vendor_id) +if curl_response: + Utils.info_log("curl command send for getting the vendor id") +else: + Utils.error_log("curl command send failed for getting the vendor id") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The new vendor id ' \ + 'given by user is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID003_setVendorId_set_a_vendorID' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initiliaze_flask_for_HdmiCecSource() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID004.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID004.py new file mode 100644 index 00000000..de327e6f --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID004.py @@ -0,0 +1,65 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID004 +# Testcase Description : Verify that default OSD Name is obtained in output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"name":"TV Box","success":true}}' +Utils.initiliaze_flask_for_HdmiCecSource() +print("TC Description - Verify that default OSD Name is obtained in output response") +# send the curl command and fetch the output json response +print("---------------------------------------------------------------------------------------------------------------------------") +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_osd_name) +if curl_response: + Utils.info_log("curl command send for get_osd_name") +else: + Utils.error_log("curl command send for get_osd_name failed") +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The default OSD Name is obtained ' \ + 'in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID004_getOSDName_default' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) +Utils.initiliaze_flask_for_HdmiCecSource() diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID005.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID005.py new file mode 100644 index 00000000..590a4238 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID005.py @@ -0,0 +1,74 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID005 +# Testcase Description : Set the OSD Name to new one using curl command and verify that new +# OSD Name set by the test user is obtained in output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +print("TC Description - Set the OSD Name to new one using curl command and verify that new OSD Name set by the test user is obtained in output response") +Utils.initiliaze_flask_for_HdmiCecSource() +print("---------------------------------------------------------------------------------------------------------------------------") +# send the curl command to set the new OSD Name +set_response = Utils.send_curl_command(HdmiCecSourceApis.set_osd_name) +if set_response: + Utils.info_log(" sent the curl command to set the new OSD Name") +else: + Utils.error_log("curl command sent to get the new OSD name failed") +print("") +# store the expected output response of testcase +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"name":"CUSTOM8 TV","success":true}}' + +# send the curl command to get OSD Name and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_osd_name) +if curl_response: + Utils.warning_log("send the curl command to get_osd_name") +else: + Utils.warning_log("curl command send failed to get_osd_name") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The new OSD Name given by user ' \ + 'is obtained in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' +Utils.initiliaze_flask_for_HdmiCecSource() +# generate logs in terminal +tc_id = 'TCID005_setOSDName_to_new' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID006.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID006.py new file mode 100644 index 00000000..8eae87b8 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID006.py @@ -0,0 +1,65 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID006 +# Testcase Description : Verify that cec enable status is true in output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"enabled":true,"success":true}}' + +print("TC Description - Verify that cec enable status is true in output response") +print("---------------------------------------------------------------------------------------------------------------------------") +Utils.initiliaze_flask_for_HdmiCecSource() +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_enabled) +if curl_response: + Utils.info_log("curl command send for get_enabled") +else: + Utils.error_log("curl command send failed for get_enabled") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The cec enable status is true' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID006_getEnabled_CEC_enabled' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initiliaze_flask_for_HdmiCecSource() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID007.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID007.py new file mode 100644 index 00000000..83e9b8d0 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID007.py @@ -0,0 +1,77 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID007 +# Testcase Description : Set the cec enable status to false and verify that cec enable +# status is false in output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +print(" TC Description - Set the cec enable status to false and verify that cec enable status is false in output response") +# send the curl command to set the cec enable status to false +Utils.initiliaze_flask_for_HdmiCecSource() +print("---------------------------------------------------------------------------------------------------------------------------") +set_response = Utils.send_curl_command(HdmiCecSourceApis.set_enabled_false) +if set_response: + Utils.warning_log("send the curl command to set the cec enable status to false is success") +else: + Utils.error_log("send the curl command to set the cec enable status to false failed") +print("") +# store the expected output response of testcase +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"enabled":false,"success":true}}' + +# send the curl command to get enable status of cec and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_enabled) +if curl_response: + Utils.info_log("send the curl command to get enable status of cec and fetch the output json response is success") +else: + Utils.error_log("send the curl command to get enable status of cec and fetch the output json response is failed") +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The cec enabled status is obtained ' \ + 'as false in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# set the cec enable status to true as a post condition +Utils.send_curl_command(HdmiCecSourceApis.set_enabled_true) +Utils.info_log("Reset the set enabled to TRUE") + +# generate logs in terminal +tc_id = 'TCID007_setEnabled_CEC_False' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initiliaze_flask_for_HdmiCecSource() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID008.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID008.py new file mode 100644 index 00000000..5b7925f1 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID008.py @@ -0,0 +1,67 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID008 +# Testcase Description : Hit the curl command for getActiveSourceStatus method and +# verify that status is obtained as false in output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"status":false,"success":true}}' + +print("TC Description - Hit the curl command for getActiveSourceStatus method and verify that status is obtained as false in output response") + +print("---------------------------------------------------------------------------------------------------------------------------") +# send the curl command and fetch the output json response +Utils.initiliaze_flask_for_HdmiCecSource() +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_active_source_status) +if curl_response: + Utils.info_log("curl command send for get_active_source") +else: + Utils.error_log("curl command send failed for get_active_source") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID008_getActiveSourceStatus_false' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initiliaze_flask_for_HdmiCecSource() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID009.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID009.py new file mode 100644 index 00000000..62ef669e --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID009.py @@ -0,0 +1,67 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID009 +# Testcase Description : Verify that otp enabled status is true in output response + +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"enabled":true,"success":true}}' + +print("TC Description - Verify that otp enabled status is true in output response") +Utils.initiliaze_flask_for_HdmiCecSource() +print("---------------------------------------------------------------------------------------------------------------------------") +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_otp_enabled) +if curl_response: + Utils.info_log("curl command send for get_otp_enabled") +else: + Utils.error_log("curl command send for get_otp_enabled failed") +print("") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The otp enabled status is true' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID009_getOTPEnabled_true' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +Utils.initiliaze_flask_for_HdmiCecSource() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID010.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID010.py new file mode 100644 index 00000000..65e19906 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID010.py @@ -0,0 +1,76 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID010 +# Testcase Description : Set the OTP enabled status to false and verify that otp enabled +# status is false in output response. Change the OTP enabled status back to true as post condition + +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +print("TC Description - Set the OTP enabled status to false and verify that otp enabled status is false in output response. Change the OTP enabled status back to true as post condition") +print("---------------------------------------------------------------------------------------------------------------------------") +# send the curl command to set the otp enabled status to false +set_response = Utils.send_curl_command(HdmiCecSourceApis.set_otp_enabled_false) +if set_response: + Utils.warning_log("send the curl command to set the otp enabled status to false is success") +else: + Utils.error_log("send the curl command to set the otp enabled status to false is failed") +print("") +# store the expected output response of testcase +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"enabled":false,"success":true}}' + +# send the curl command to get enabled status of otp and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_otp_enabled) +if curl_response: + Utils.info_log("curl command send for get_otp_enabled") +else: + Utils.error_log("curl command send for get_otp_enabled failed") +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The otp enabled status is obtained ' \ + 'as false in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' +print("") +# set the otp enable status to true as a post condition +Utils.send_curl_command(HdmiCecSourceApis.set_otp_enabled_true) +Utils.info_log("Reset OTP to its initial state") + +# generate logs in terminal +tc_id = 'TCID010_setOTPEnabled_false' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID011.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID011.py new file mode 100644 index 00000000..c2ffa8bd --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID011.py @@ -0,0 +1,75 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID011 +# Testcase Description : Hit the curl command for sendKeyPressEvent and +# verify that output response is correct + +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' +Utils.initiliaze_flask_for_HdmiCecSource() + +keypress = [HdmiCecSourceApis.send_keypress_VOLUME_UP, HdmiCecSourceApis.send_keypress_VOLUME_DOWN, HdmiCecSourceApis.send_keypress_MUTE, + HdmiCecSourceApis.send_keypress_UP, HdmiCecSourceApis.send_keypress_DOWN, HdmiCecSourceApis.send_keypress_LEFT, + HdmiCecSourceApis.send_keypress_RIGHT, HdmiCecSourceApis.send_keypress_SELECT, HdmiCecSourceApis.send_keypress_HOME, + HdmiCecSourceApis.send_keypress_BACK, HdmiCecSourceApis.send_keypress_NUMBER_0, HdmiCecSourceApis.send_keypress_NUMBER_1, + HdmiCecSourceApis.send_keypress_NUMBER_2, HdmiCecSourceApis.send_keypress_NUMBER_3, HdmiCecSourceApis.send_keypress_NUMBER_4, + HdmiCecSourceApis.send_keypress_NUMBER_5, HdmiCecSourceApis.send_keypress_NUMBER_6, HdmiCecSourceApis.send_keypress_NUMBER_7, + HdmiCecSourceApis.send_keypress_NUMBER_8, HdmiCecSourceApis.send_keypress_NUMBER_9] +print("TC Description - Hit the curl command for sendKeyPressEvent and verify that output response is correct") +print("---------------------------------------------------------------------------------------------------------------------------") +# send the curl command and fetch the output json response +for command in keypress: + curl_response = Utils.send_curl_command(command) + +if curl_response: + Utils.info_log("curl command send for send_keypress_event") +else: + Utils.error_log("curl command send failed") +print("") +# compare both expected and received output responses +print("---------------------------------------------------------------------------------------------------------------------------") +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID011_sendKeyPressEvent' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initiliaze_flask_for_HdmiCecSource() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID012.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID012.py new file mode 100644 index 00000000..c51729f2 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID012.py @@ -0,0 +1,150 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID012 +# Testcase Description : Set the devices to standby mode and wake up the remote device using otp feature +# Hit the curl command for sendStandbyMessage and send corresponding cec messages using sendMessage API +# to hal. Then hit the curl command for perform OTP Action and send corresponding cec messages to hal. +# Then hit the curl command for getActiveSourceStatus and verify that status is true in output response. +# Deactivate and reactivate the HdmiCecSource plugin. Then hit the curl command for getActiveSourceStatus +# and verify that status is back to default(false) in output response.Verify the thunder logs for more info. + +import json +import requests +import time +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +# Utils.restart_services() +print(" TC Description - Set the devices to standby mode and wake up the remote device using otp feature.Hit the curl command for sendStandbyMessage and send corresponding cec messages using sendMessage API to hal. Then hit the curl command for perform OTP Action and send corresponding cec messages to hal.Then hit the curl command for getActiveSourceStatus and verify that status is true in output response.Deactivate and reactivate the HdmiCecSource plugin. Then hit the curl command for getActiveSourceStatus and verify that status is back to default(false) in output response.Verify the thunder logs for more info. send the curl command to send the standby messages to devices") +Utils.initiliaze_flask_for_HdmiCecSource() +print("---------------------------------------------------------------------------------------------------------------------------") +set_response = Utils.send_curl_command(HdmiCecSourceApis.send_standby_message) +if set_response: + Utils.info_log("curl command send for standby_message") +else: + Utils.error_log("curl command send failed for sending standby_message") +print("") + +# send messages required for getting power status of device +print("---------------------------------------------------------------------------------------------------------------------------") +message2_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.getPowerStatusMessage))) +time.sleep(3) +if "200" in str(message2_response): + Utils.info_log("send the emulated message for get power status success") +else: + Utils.error_log("emulated message for get power status is failed") +print("") + +# send messages required for reporting power status of device +print("---------------------------------------------------------------------------------------------------------------------------") +message2_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportPowerStatusMessage))) +time.sleep(3) +if "200" in str(message2_response): + Utils.info_log("send the emulated message for report power status success") +else: + Utils.error_log("emulated message for report power status is failed") +print("") + +# send the curl command to perform OTP action +print("---------------------------------------------------------------------------------------------------------------------------") +curl_response = Utils.send_curl_command(HdmiCecSourceApis.perform_otp_action) +if curl_response: + Utils.warning_log("curl command send for perform_otp_action") +else: + Utils.error_log("curl command send failed for perform_otp_action") +print("") + +# send messages required for getting power status of device +print("---------------------------------------------------------------------------------------------------------------------------") +message4_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.getPowerStatusMessage))) +time.sleep(3) +if "200" in str(message4_response): + Utils.info_log("send emulated message for get power status success") +else: + Utils.error_log("send emulated message for get power status failed") +print("") + +# send messages required for reporting power status of device +print("---------------------------------------------------------------------------------------------------------------------------") +message4_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportPowerStatusMessage))) +time.sleep(3) +if "200" in str(message2_response): + Utils.info_log("send the emulated message for report power status success") +else: + Utils.error_log("emulated message for report power status is failed") +print("") + +# store the expected output response of testcase before deactivating plugin +expected_output_response1 = '{"jsonrpc":"2.0","id":42,"result":{"status":true,"success":true}}' + +# store the expected output response of testcase after deactivating and reactivating plugin +expected_output_response2 = '{"jsonrpc":"2.0","id":42,"result":{"status":false,"success":true}}' + +# send the curl command for getActiveSourceStatus before deactivating plugin +curl_response1 = Utils.send_curl_command(HdmiCecSourceApis.get_active_source_status) + +if curl_response1: + Utils.info_log("send the curl command for getActiveSourceStatus before deactivating plugin success") +else: + Utils.error_log("send the curl command for getActiveSourceStatus before deactivating plugin failed") +print("") + +Utils.warning_log("deactivate and activate the plugin") +Utils.send_curl_command(HdmiCecSourceApis.deactivate_command) +Utils.send_curl_command(HdmiCecSourceApis.activate_command) + +# send the curl command for getActiveSourceStatus after deactivating and reactivating plugin +curl_response2 = Utils.send_curl_command(HdmiCecSourceApis.get_active_source_status) +if curl_response2: + Utils.info_log("send the curl command for getActiveSourceStatus after deactivating and reactivating plugin success") +else: + Utils.error_log("send the curl command for getActiveSourceStatus after deactivating and reactivating plugin failed") +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response1) == str(expected_output_response1) and str(curl_response2) == str(expected_output_response2): + status = 'Pass' + message = 'Output response is matching with expected one. The active source status is switching properly' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID012_sendStandbyMessage_performOTPAction_getActiveSourceStatus' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response1) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initiliaze_flask_for_HdmiCecSource() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response1, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID013.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID013.py new file mode 100644 index 00000000..da0e4006 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID013.py @@ -0,0 +1,69 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID013 +# Testcase Description : To verify all remote devices given by test user during hal initialization +# is present in output response with device details + +import time +from HdmiCecSource import HdmiCecSourceApis +from Utilities import Utils, ReportGenerator + +# Utils.restart_services() +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"numberofdevices":3,"deviceList":[{"logicalAddress":0,"osdName":"TV Box","vendorID":"04567"},{"logicalAddress":5,"osdName":"","vendorID":"4567"},{"logicalAddress":9,"osdName":"Streaming One","vendorID":"4567"}],"success":true}}' + +# send the curl command and fetch the output json response +# Utils.send_curl_command(HdmiCecSourceApis.get_device_list) +# time.sleep(10) +# Utils.send_curl_command(HdmiCecSourceApis.get_device_list) +# time.sleep(10) +Utils.send_curl_command(HdmiCecSourceApis.get_device_list) +time.sleep(3) +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_device_list) + +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID013_getDeviceList_verify_all_remote_devices' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) + + + diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID014.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID014.py new file mode 100644 index 00000000..12ae2462 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID014.py @@ -0,0 +1,76 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID014 +# Testcase Description : Add a new device to cec network and verify that new device data is listing +# in output response + +import requests +import json +import time +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +# Utils.restart_services() +# add afs device to network +add_device_response = requests.get("http://{}/Database.updateDeviceConfig/addDevice/{}".format( + Config.flask_server_ip, json.dumps(Config.hisense_device_data))) +print("Inside TCID014 : " + add_device_response.text + " : " + str(Config.hisense_device_data)) +time.sleep(3) + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"numberofdevices":4,"deviceList":[{"logicalAddress":0,"osdName":"TV Box","vendorID":"04567"},{"logicalAddress":5,"osdName":"","vendorID":"4567"},{"logicalAddress":6,"osdName":"TV Box","vendorID":"04567"},{"logicalAddress":9,"osdName":"Streaming One","vendorID":"4567"}],"success":true}}' + +# send the curl command and fetch the output json response +# Utils.send_curl_command(HdmiCecSourceApis.get_device_list) +# time.sleep(10) +# Utils.send_curl_command(HdmiCecSourceApis.get_device_list) +# time.sleep(10) +Utils.send_curl_command(HdmiCecSourceApis.get_device_list) +time.sleep(3) +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_device_list) + +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The newly added HiSense device is ' \ + 'listed in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID014_getDeviceList_Add_new_device' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID015.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID015.py new file mode 100644 index 00000000..5e4933c4 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID015.py @@ -0,0 +1,83 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID015 +# Testcase Description : Add a new invalid device to cec network and verify that invalid device data +# is ignored in output response + +import requests +import json +import time +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis +from HdmiCecSource import CecUtils + +# store the expected output response before adding invalid device data +expected_output_response = Utils.send_curl_command(HdmiCecSourceApis.get_device_list) + +# add an invalid device to network +add_device_response = requests.get("http://{}/Database.updateDeviceConfig/addDevice/{}".format( + Config.flask_server_ip, json.dumps(Config.invalid_device_data))) +print("Inside TCID015 : " + add_device_response.text + " : " + str(Config.invalid_device_data)) +time.sleep(3) + +# send the curl command after adding invalid device data and fetch the output json response +# Utils.send_curl_command(HdmiCecSourceApis.get_device_list) +# time.sleep(10) +# Utils.send_curl_command(HdmiCecSourceApis.get_device_list) +# time.sleep(10) +Utils.send_curl_command(HdmiCecSourceApis.get_device_list) +time.sleep(3) +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_device_list) + +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response) and len(curl_response) > 5: + status = 'Pass' + message = 'Output response is matching with expected one. The newly added invalid device ' \ + 'is not listed in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID015_getDeviceList_Add_an_invalid_device' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) + +# post condition - restart thunder & websocket - then activate plugin again +# time.sleep(15) +# Utils.restart_services() +# time.sleep(15) +# CecUtils.activate_cec() +# time.sleep(15) +print("") diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID016.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID016.py new file mode 100644 index 00000000..ac5114ef --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID016.py @@ -0,0 +1,91 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID016 +# Testcase Description : Verify that cec enable status is true initially. Then we change the return value +# of HdmiCecOpen as -1 using updateAPIConfig. Deactivate and reactivate the HdmiCecSource plugin. +# After that hit the curl command and verify that cec enable status changed to false. Perform the post-condition +# to revert the changes back to default state + +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import CecUtils +from HdmiCecSource import HdmiCecSourceApis + +print("Testcase Description - Verify that cec enable status is true initially. Then we change the return value of HdmiCecOpen as -1 using updateAPIConfig. Deactivate and reactivate the HdmiCecSource plugin. After that hit the curl command and verify that cec enable status changed to false. Perform the post-condition to revert the changes back to default state store the expected output response with HdmiCecOpen return value as 0") +print("---------------------------------------------------------------------------------------------------------------------------") +expected_output_response1 = '{"jsonrpc":"2.0","id":42,"result":{"enabled":true,"success":true}}' + +# store the expected output response with HdmiCecOpen return value as -1 +expected_output_response2 = '{"jsonrpc":"2.0","id":42,"result":{"enabled":false,"success":true}}' +Utils.initiliaze_flask_for_HdmiCecSource() +# send the curl command and fetch the output json response with HdmiCecOpen return value as 0 +curl_response1 = Utils.send_curl_command(HdmiCecSourceApis.get_enabled) +if curl_response1: + Utils.info_log("send the curl command for get_enabled") +else: + Utils.error_log("send curl command for get_enabled failed") +print("") +# change the return value of HdmiCecOpen hal API to -1 using updateAPIConfig API +update_api=CecUtils.cec_update_api_overrides(Config.cec_minus_one) +if update_api: + Utils.info_log("configuring the return value of HdmiCecOpen as -1 using flask api") +else: + Utils.error_log("failed to configure the return value of HdmiCecOpen as -1") +print("") +# send the curl command and fetch the output json response with HdmiCecOpen return value as -1 +curl_response2 = Utils.send_curl_command(HdmiCecSourceApis.get_enabled) +if curl_response2: + Utils.info_log("curl command send for get_enabled") +else: + Utils.error_log("curl command send for get_enabled failed") +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response1) == str(expected_output_response1) and str(curl_response2) == str(expected_output_response2): + status = 'Pass' + message = 'Output response is matching with expected one. The cec enable status is true initially and ' \ + 'after changing the return value, cec enable status changed to false' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID016_getEnabled_False_HAL_value' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response2) +print("Testcase Status : " + status) +print("Testcase Message : " + message) + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response2, status, message) + +# post condition : change the return value of HdmiCecOpen hal API back to 0 +# post = CecUtils.cec_post_condition_for_negative_scenarios() +print("") +Utils.initiliaze_flask_for_HdmiCecSource() +Utils.warning_log("Reset - changed the return value of HdmiCecOpen hal API back to 0") + diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID017.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID017.py new file mode 100644 index 00000000..1b350a1c --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID017.py @@ -0,0 +1,79 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID017 +# Testcase Description : To verify that standby message is throwing error when return value for +# HdmiCecOpen is changed to -1. Change the return value of HdmiCecOpen as -1 using updateAPIConfig. +# Deactivate and reactivate the HdmiCecSource plugin. After that hit the curl command and verify +# that output is having error message. Perform the post-condition to revert the changes back to default state + +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import CecUtils +from HdmiCecSource import HdmiCecSourceApis + +post = CecUtils.cec_post_condition_for_negative_scenarios() +print("TC Description - To verify that standby message is throwing error when return value for HdmiCecOpen is changed to -1. Change the return value of HdmiCecOpen as -1 using updateAPIConfig. Deactivate and reactivate the HdmiCecSource plugin. After that hit the curl command and verify that output is having error message. Perform the post-condition to revert the changes back to default state change the return value of HdmiCecOpen hal API to -1 using updateAPIConfig API") +print("---------------------------------------------------------------------------------------------------------------------------") +Utils.initiliaze_flask_for_HdmiCecSource() +CecUtils.cec_update_api_overrides(Config.cec_minus_one) +Utils.info_log("Updating HdmiCecOpen HAL API return value to -1") +print("") +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"error":{"code":1,"message":"ERROR_GENERAL"}}' + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.send_standby_message) +if curl_response: + Utils.info_log("curl command sent with return value -1 on HdmiCecOpen HAL api") +else: + Utils.error_log("curl command sent failed with return value -1 on HdmiCecOpen HAL api") +print("") +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. We are getting error in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID017_sendStandbyMessage_HAL_False' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) +Utils.initiliaze_flask_for_HdmiCecSource() + +# post condition : change the return value of HdmiCecOpen hal API back to 0 +# CecUtils.cec_post_condition_for_negative_scenarios() +Utils.warning_log("Reset - change the return value of HdmiCecOpen hal API back to 0") +print("") diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID018.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID018.py new file mode 100644 index 00000000..5d4ccd38 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID018.py @@ -0,0 +1,77 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID018 +# Testcase Description : To verify that perform OTP Action is throwing error when return value for +# HdmiCecOpen is changed to -1. Change the return value of HdmiCecOpen as -1 using updateAPIConfig. +# Deactivate and reactivate the HdmiCecSource plugin. After that hit the curl command and verify +# that output is having error message. Perform the post-condition to revert the changes back to default state + +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import CecUtils +from HdmiCecSource import HdmiCecSourceApis + +post = CecUtils.cec_post_condition_for_negative_scenarios() +print("TC Description - To verify that perform OTP Action is throwing error when return value for HdmiCecOpen is changed to -1. Change the return value of HdmiCecOpen as -1 using updateAPIConfig. Deactivate and reactivate the HdmiCecSource plugin. After that hit the curl command and verify that output is having error message. Perform the post-condition to revert the changes back to default state change the return value of HdmiCecOpen hal API to -1 using updateAPIConfig API") +print("---------------------------------------------------------------------------------------------------------------------------") +Utils.initiliaze_flask_for_HdmiCecSource() +CecUtils.cec_update_api_overrides(Config.cec_minus_one) +Utils.info_log("Updated HdmiCecOpen HAL API return values to -1") +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"error":{"code":1,"message":"ERROR_GENERAL"}}' + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.perform_otp_action) +if curl_response: + Utils.info_log("sending the curl command for perform_otp_action") +else: + Utils.error_log("curl command send failed for perform_otp_action") +print("") +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. We are getting error in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID018_performOTPAction_HAL_False' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) +Utils.initiliaze_flask_for_HdmiCecSource() +# post condition : change the return value of HdmiCecOpen hal API back to 0 +# CecUtils.cec_post_condition_for_negative_scenarios() +Utils.warning_log("Reset- change the return value of HAL APIs back to 0") +print("") diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID019.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID019.py new file mode 100644 index 00000000..306dc5d4 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID019.py @@ -0,0 +1,84 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID019 +# Testcase Description : To verify the device list is empty and number of devices is 0 in output response +# for getDeviceList curl command when return value of HdmiCecOpen is changed to -1. Change the return +# value of HdmiCecOpen as -1 using updateAPIConfig. Deactivate and reactivate the HdmiCecSource plugin. +# After that hit the curl command and verify that the device list is empty. Perform the post-condition +# to revert the changes back to default state + +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import CecUtils +from HdmiCecSource import HdmiCecSourceApis + +post = CecUtils.cec_post_condition_for_negative_scenarios() +# change the return value of HdmiCecOpen hal API to -1 using updateAPIConfig API +print("TC Description - To verify the device list is empty and number of devices is 0 in output response for getDeviceList curl command when return value of HdmiCecOpen is changed to -1. Change the return value of HdmiCecOpen as -1 using updateAPIConfig. Deactivate and reactivate the HdmiCecSource plugin. After that hit the curl command and verify that the device list is empty. Perform the post-condition to revert the changes back to default state") +Utils.initiliaze_flask_for_HdmiCecSource() +CecUtils.cec_update_api_overrides(Config.cec_minus_one) +Utils.info_log("change the return value of HdmiCecOpen hal API to -1 using updateAPIConfig API") +print("") + +print("---------------------------------------------------------------------------------------------------------------------------") +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"numberofdevices":0,"deviceList":[],"success":true}}' + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_device_list) +if curl_response: + Utils.info_log("curl command send for get_device_list") +else: + Utils.error_log("curl command send failed for get_device_list") +print("") +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. The device list is empty and number of devices' \ + 'is 0 in output response' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID019_getDeviceList_HAL_False' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) + +# post condition : change the return value of HdmiCecOpen hal API back to 0 +CecUtils.cec_post_condition_for_negative_scenarios() +Utils.initiliaze_flask_for_HdmiCecSource() +Utils.warning_log("Reset - change the return values of HAL APIs back to 0") +print("") + diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID020.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID020.py new file mode 100644 index 00000000..19ffe8e6 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID020.py @@ -0,0 +1,95 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID020 +# Testcase Description : getVendorId - Invalid data + +import json +import requests +import time +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"vendorid":"019fb","success":true}}' + +print("TC Description - getVendorId - Invalid data") +Utils.initiliaze_flask_for_HdmiCecSource() +time.sleep(3) +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.set_vendor_id) +if curl_response: + Utils.warning_log("set vendor id curl command sent from the test runner") +else: + Utils.error_log("set vendor id curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_vendor_id) +if curl_response: + Utils.warning_log("get vendor id curl command sent from the test runner") +else: + Utils.error_log("get vendor id curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.set_vendor_id_invalid_1) +if curl_response: + Utils.warning_log("set vendor id invalid curl command sent from the test runner") +else: + Utils.error_log("set vendor id invalid curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_vendor_id) +if curl_response: + Utils.warning_log("get vendor id curl command sent from the test runner") +else: + Utils.error_log("get vendor id curl command failed") + +post_condition = Utils.send_curl_command(HdmiCecSourceApis.set_vendor_id) + +print("---------------------------------------------------------------------------------------------------------------------------") + +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one.' +else: + status = 'Fail' + message = 'Output response is different from expected one.' + +# generate logs in terminal +tc_id = 'TCID020_getVendorId - Invalid data' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) +Utils.initiliaze_flask_for_HdmiCecSource() + diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID021.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID021.py new file mode 100644 index 00000000..2f48bfc6 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID021.py @@ -0,0 +1,107 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID021 +# Testcase Description : Coverage enhancements + +import subprocess +import os +import signal +import json +import requests +import time +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + + +process_name_cec ="CecDaemonMain" +output = subprocess.check_output(["ps", "aux"]) + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":3,"result":null}' + +print("TC Description - To verify coverage enhancements") +Utils.initiliaze_flask_for_HdmiCecSource() +time.sleep(3) +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.deactivate_command) +if curl_response: + Utils.warning_log("Deactivate curl command sent from the test runner") +else: + Utils.error_log("Deactivate curl command failed") + +try: + pids = [] + # Parse the output to find the PID + for line in output.decode().splitlines(): + if process_name_cec in line: + pid = int(line.split()[1]) + pids.append(pid) + print("killing CEC Daemon") + else: + pass + + if pids is not None: + for each_pid in pids: + try: + os.system("kill -9 %s" % (each_pid, )) + except: + print("process already killed") + else: + print("They are no services up wrt HAL Mock setup") +except: + pass + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.activate_command) +if curl_response: + Utils.warning_log("activate curl command sent from the test runner") +else: + Utils.error_log("activate curl command failed") + +print("---------------------------------------------------------------------------------------------------------------------------") + +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one. We are expecting opcode : 36 in thunder logs' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID021_coverage enhancements' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initiliaze_flask_for_HdmiCecSource() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) + diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID022.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID022.py new file mode 100644 index 00000000..6e93d8b5 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID022.py @@ -0,0 +1,230 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID022 +# Testcase Description : To verify the emulation of the processes which are triggered when 3 devices are connected. +# Initially, when all the devices are on,one device will be an inactive source and another will be an active source. +# After that, the devices go into standby and the user sets the the other device into active source. The devices are then woken up using the one-touch play feature. +# After waking up, one device will be an active source, while the other will be an inactive source. +# As the device enters the active state, it may trigger the text view on and image view on processes also as a result. +import subprocess +import json +import requests +import time +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' + +print("TC Description - To verify the emulation of the processes which are triggered when 3 devices are connected. Send the corresponding messages for HAL. Hit the curlcommand for sendStandbyMessage and performOTPAction. Send the corresponding messages to hal. Verify the output response. One source will be active and the other inactive and vice-versa. Verify that the text view on and the image view on processes are also triggered.") + +Utils.initiliaze_flask_for_HdmiCecSource() +time.sleep(3) +#send messages required for getting inactive source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.inactive_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the inactive source") +else: + Utils.error_log("sendMessage emulation failed for querying the inactive source") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.request_active_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the active source") +else: + Utils.error_log("sendMessage emulation failed for requesting the active source") +time.sleep(3) +print("") + +#send messages required for getting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.active_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the active source") +else: + Utils.error_log("sendMessage emulation failed for querying the active source") +time.sleep(3) +print("") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.send_standby_message) +if curl_response: + Utils.warning_log("send_standby_message curl command sent from the test runner") +else: + Utils.error_log("send_standby_message curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.perform_otp_action) +if curl_response: + Utils.warning_log("perform_otp_action curl command sent from the test runner") +else: + Utils.error_log("perform_otp_action curl command failed") + +#send messages required for getting inactive source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.inactive_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the inactive source") +else: + Utils.error_log("sendMessage emulation failed for querying the inactive source") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.request_active_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the active source") +else: + Utils.error_log("sendMessage emulation failed for requesting the active source") +time.sleep(3) +print("") + +#send messages required for set stream path +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.set_stream_path_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for set stream path to hisense") +else: + Utils.error_log("sendMessage emulation failed for set stream path to hisense") +time.sleep(3) +print("") + +#send messages required for routing change +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.routing_change))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for routing change to hisense") +else: + Utils.error_log("sendMessage emulation failed for routing change to hisense") +time.sleep(3) +print("") + +#send messages required for routing information +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.routing_information_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying routing information from hisense") +else: + Utils.error_log("sendMessage emulation failed for querying routing information from hisense") +time.sleep(3) +print("") + +#send messages required for getting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.active_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the active source") +else: + Utils.error_log("sendMessage emulation failed for querying the active source") +time.sleep(3) +print("") + +#send messages required for image view on +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.image_view_on))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the image view on") +else: + Utils.error_log("sendMessage emulation failed for querying the image view on") +time.sleep(3) +print("") + +#send messages required for getting text view on +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.text_view_on))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the text view on") +else: + Utils.error_log("sendMessage emulation failed for querying the text view on") +time.sleep(3) +print("") + +#send messages required for getting osd string +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.set_osd_string))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for getting the osd string") +else: + Utils.error_log("sendMessage emulation failed for getting the osd string") +time.sleep(3) +print("") + + +#send messages required for getting device power status +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.give_device_power_status_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the power status") +else: + Utils.error_log("sendMessage emulation failed for querying the power status") +time.sleep(3) +print("") + +#send messages required for getting osd name +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.give_osd_name_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the osd name") +else: + Utils.error_log("sendMessage emulation failed for querying the osd name") +time.sleep(3) +print("") + + +print("---------------------------------------------------------------------------------------------------------------------------") + +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one.' +else: + status = 'Fail' + message = 'Output response is different from expected one.' + +# generate logs in terminal +tc_id = 'TCID022_process emulation' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) +Utils.initiliaze_flask_for_HdmiCecSource() +op=Utils.netstat_output() +print(op) + + + diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID023.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID023.py new file mode 100644 index 00000000..7ff13589 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID023.py @@ -0,0 +1,135 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID023 +# Testcase Description : To verify the emulation of the processes which are triggered when 3 devices are connected. +# Initially, when all the devices are on,one device will be querying the menu language of another device. The device will be setting the menu language. Also the cec version will be queried. +import subprocess +import json +import requests +import time +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":3,"result":null}' + +print("TC Description - To verify the emulation of the processes which are triggered when 3 devices are connected. Send the corresponding messages for HAL. Hit the curlcommand for plugin activation. Verify the output response. The menu language and the cec version will be queried and the messages which are given will be returned.") +Utils.initiliaze_flask_for_HdmiCecSource() +time.sleep(3) +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.activate_command) +if curl_response: + Utils.warning_log("activate curl command sent from the test runner") +else: + Utils.error_log("activate curl command failed") + +#send messages required for getting physical address +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.give_physical_address_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the physical address") +else: + Utils.error_log("sendMessage emulation failed for querying the physical address") +time.sleep(3) +print("") + +#send messages required for getting menu language +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.get_menu_language_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the menu language") +else: + Utils.error_log("sendMessage emulation failed for querying the menu language") +time.sleep(3) +print("") + +#send messages required for setting menu language +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.set_menu_language))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for setting the menu language") +else: + Utils.error_log("sendMessage emulation failed for setting the menu language") +time.sleep(3) +print("") + +#send messages required for ignoring a menu language of another device +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.ignore_set_menu_language))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for ignoring the menu language") +else: + Utils.error_log("sendMessage emulation failed for ignoring the menu language") +time.sleep(3) +print("") + +#send messages required for getting cec version +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.get_cec_version))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the cec version") +else: + Utils.error_log("sendMessage emulation failed for querying the cec version") +time.sleep(3) +print("") + +#send messages required for returning the cec version +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.cec_version))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for giving the cec version") +else: + Utils.error_log("sendMessage emulation failed for giving the cec version") +time.sleep(3) +print("") + +print("---------------------------------------------------------------------------------------------------------------------------") + +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one.' +else: + status = 'Fail' + message = 'Output response is different from expected one.' + +# generate logs in terminal +tc_id = 'TCID023_process emulation' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) +Utils.initiliaze_flask_for_HdmiCecSource() +op=Utils.netstat_output() +print(op) + diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID024.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID024.py new file mode 100644 index 00000000..814ce87a --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID024.py @@ -0,0 +1,95 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID024 +# Testcase Description : To verify the emulation processes - abort and feature abort +import subprocess +import json +import requests +import time +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":3,"result":null}' + +print("TC Description - To verify the emulation of the processes - abort and feature abort.") +Utils.initiliaze_flask_for_HdmiCecSource() +time.sleep(3) +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.activate_command) +if curl_response: + Utils.warning_log("activate curl command sent from the test runner") +else: + Utils.error_log("activate curl command failed") + +#send messages required for abort +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.abort_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for abort") +else: + Utils.error_log("sendMessage emulation failed for abort") +time.sleep(3) +print("") + +#send messages required for feature abort +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.feature_abort_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the abort reason") +else: + Utils.error_log("sendMessage emulation failed for querying the abort reason") +time.sleep(3) +print("") + +print("---------------------------------------------------------------------------------------------------------------------------") + +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one.' +else: + status = 'Fail' + message = 'Output response is different from expected one.' + +# generate logs in terminal +tc_id = 'TCID024_process emulation' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) + +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) +Utils.initiliaze_flask_for_HdmiCecSource() +op=Utils.netstat_output() +print(op) + + diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID025.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID025.py new file mode 100644 index 00000000..9bb0e616 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID025.py @@ -0,0 +1,86 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID025 +# Testcase Description : To verify the emulation of sending of events + +import subprocess +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis +import time + + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":3,"result":null}' + +print("TC Description - To verify the emulation of sending of events.") +Utils.initiliaze_flask_for_HdmiCecSource() +time.sleep(3) +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.activate_command) +time.sleep(1) +if curl_response: + Utils.warning_log("activate curl command sent from the test runner") +else: + Utils.error_log("activate curl command failed") + +#Define the script to be executed +execute_script = '../../../../../sendEvents.sh' + + +#Execute the script +try: + result = subprocess.run(['/bin/bash', execute_script], check=True, capture_output=True, text=True) + print("sendEvents.sh executed successfully.") + print("Output:\n", result.stdout) + +except subprocess.CalledProcessError as e: + print("Error occured while executing the shell script.") + print("Error message:\n", e.stderr) + +print("---------------------------------------------------------------------------------------------------------------------------") + +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one.' +else: + status = 'Fail' + message = 'Output response is different from expected one.' + +# generate logs in terminal +tc_id = 'TCID025_sending events' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initiliaze_flask_for_HdmiCecSource() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) + diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID026.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID026.py new file mode 100644 index 00000000..9831b492 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID026.py @@ -0,0 +1,161 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +#TCID026 - standby scenario. Device already set on standby and again set to standby. + +import subprocess +import json +import requests +import time +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +print(" TC Description - Set the devices to standby mode and hit the sendStandbyMessage curl command again. Then wake up the remote device using otp feature.First, set the device to standby mode via emulation. Next, hit the curl command for sendStandbyMessage and send corresponding cec messages using sendMessage API to hal. Then hit the curl command for perform OTP Action and send corresponding cec messages to hal.Verify the thunder logs for more info.") + +Utils.initiliaze_flask_for_HdmiCecSource() +time.sleep(3) +# send messages required for getting power status of device +print("---------------------------------------------------------------------------------------------------------------------------") + +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"success":true}}' + +message2_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.sendStandbyMessage))) +time.sleep(3) +if "200" in str(message2_response): + Utils.info_log("send the emulated message for standby success") +else: + Utils.error_log("emulated message for standby failed") +print("") + + + +# send messages required for getting power status of device +print("---------------------------------------------------------------------------------------------------------------------------") +message2_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.getPowerStatusMessage))) +time.sleep(3) +if "200" in str(message2_response): + Utils.info_log("send the emulated message for get power status success") +else: + Utils.error_log("emulated message for get power status is failed") +print("") + +# send messages required for reporting power status of device +print("---------------------------------------------------------------------------------------------------------------------------") +message2_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportPowerStatusMessage))) +time.sleep(3) +if "200" in str(message2_response): + Utils.info_log("send the emulated message for report power status success") +else: + Utils.error_log("emulated message for report power status is failed") +print("") + + +print("---------------------------------------------------------------------------------------------------------------------------") +#curl command for send standby message +set_response = Utils.send_curl_command(HdmiCecSourceApis.send_standby_message) +if set_response: + Utils.info_log("curl command send for standby_message") +else: + Utils.error_log("curl command send failed for sending standby_message") +print("") + +# send messages required for getting power status of device +print("---------------------------------------------------------------------------------------------------------------------------") +message2_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.getPowerStatusMessage))) +time.sleep(3) +if "200" in str(message2_response): + Utils.info_log("send the emulated message for get power status success") +else: + Utils.error_log("emulated message for get power status is failed") +print("") + +# send messages required for reporting power status of device +print("---------------------------------------------------------------------------------------------------------------------------") +message2_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportPowerStatusMessage))) +time.sleep(3) +if "200" in str(message2_response): + Utils.info_log("send the emulated message for report power status success") +else: + Utils.error_log("emulated message for report power status is failed") +print("") + +# send the curl command to perform OTP action +print("---------------------------------------------------------------------------------------------------------------------------") +curl_response = Utils.send_curl_command(HdmiCecSourceApis.perform_otp_action) +if curl_response: + Utils.warning_log("curl command send for perform_otp_action") +else: + Utils.error_log("curl command send failed for perform_otp_action") +print("") + +# send messages required for getting power status of device +print("---------------------------------------------------------------------------------------------------------------------------") +message4_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.getPowerStatusMessage))) +time.sleep(3) +if "200" in str(message4_response): + Utils.info_log("send emulated message for get power status success") +else: + Utils.error_log("send emulated message for get power status failed") +print("") + +# send messages required for reporting power status of device +print("---------------------------------------------------------------------------------------------------------------------------") +message4_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.reportPowerStatusMessage))) +time.sleep(3) +if "200" in str(message2_response): + Utils.info_log("send the emulated message for report power status success") +else: + Utils.error_log("emulated message for report power status is failed") +print("") + +print("---------------------------------------------------------------------------------------------------------------------------") +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID026_sendStandbyMessage_performOTPAction_fromStandby' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initiliaze_flask_for_HdmiCecSource() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID027.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID027.py new file mode 100644 index 00000000..c5827751 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID027.py @@ -0,0 +1,156 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID027 +# Testcase Description : To verify that the getActiveourceStatus scenario is true after set stream path and routing change. +# Initially, the getActiveSourceStatus curl command will return a false status. When all the devices are on,one device will be an inactive source and another will be an active source. +# After that, the stream path and routing is changed. The device which was inactive becomes active and vice-versa. The devices are then woken up using the one-touch play feature. +# After waking up, the getActiveSourceStatus curl command will return a true status. + +import subprocess +import json +import requests +import time +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"status":true,"success":true}}' + +print("TC Description - To verify that the getActiveSourceStatus curl command returns a true status after set stream path and routing change.") +Utils.initiliaze_flask_for_HdmiCecSource() +time.sleep(3) +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_active_source_status) +if curl_response: + Utils.info_log("curl command send for get_active_source") +else: + Utils.error_log("curl command send failed for get_active_source") + +#send messages required for getting inactive source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.inactive_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the inactive source") +else: + Utils.error_log("sendMessage emulation failed for querying the inactive source") +time.sleep(3) +print("") + +#send messages required for requesting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.request_active_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for requesting the active source") +else: + Utils.error_log("sendMessage emulation failed for requesting the active source") +time.sleep(3) +print("") +#send messages required for getting active source +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.active_source_firestick1))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the active source") +else: + Utils.error_log("sendMessage emulation failed for querying the active source") +time.sleep(3) +print("") + +#send messages required for set stream path +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.set_stream_path_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for set stream path to hisense") +else: + Utils.error_log("sendMessage emulation failed for set stream path to hisense") +time.sleep(3) +print("") + +#send messages required for routing change +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.routing_change))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for routing change to hisense") +else: + Utils.error_log("sendMessage emulation failed for routing change to hisense") +time.sleep(3) +print("") + +#send messages required for routing information +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.routing_information_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying routing information from hisense") +else: + Utils.error_log("sendMessage emulation failed for querying routing information from hisense") +time.sleep(3) +print("") + + +message1_response = requests.get("http://{}/Hdmicec.sendMessage/{}".format( + Config.flask_server_ip, json.dumps(Config.active_source_hisense))) +if "200" in str(message1_response): + Utils.info_log("sendMessage emulation success for querying the active source") +else: + Utils.error_log("sendMessage emulation failed for querying the active source") +time.sleep(3) +print("") + +curl_response = Utils.send_curl_command(HdmiCecSourceApis.perform_otp_action) +if curl_response: + Utils.info_log("curl command send for perform_otp_action") +else: + Utils.error_log("curl command send failed for perform_otp_action") + + +print("---------------------------------------------------------------------------------------------------------------------------") +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_active_source_status) +if curl_response: + Utils.info_log("curl command send for get_active_source") +else: + Utils.error_log("curl command send failed for get_active_source") + +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one' +else: + status = 'Fail' + message = 'Output response is different from expected one' + +# generate logs in terminal +tc_id = 'TCID027_getActiveSourceStatus_True' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initiliaze_flask_for_HdmiCecSource() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID028.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID028.py new file mode 100644 index 00000000..a1cf7ce9 --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID028.py @@ -0,0 +1,95 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID028 +# Testcase Description : Invalid curl command - getVendorId + +import json +import requests +import time +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"vendorid":"04455","success":true}}' + +print("Invalid curl command - getVendorId") +Utils.initiliaze_flask_for_HdmiCecSource() +time.sleep(3) +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.set_vendor_id) +if curl_response: + Utils.warning_log("set vendor id curl command sent from the test runner") +else: + Utils.error_log("set vendor id curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_vendor_id) +if curl_response: + Utils.warning_log("get vendor id curl command sent from the test runner") +else: + Utils.error_log("get vendor id curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.set_vendor_id_invalid_2) +if curl_response: + Utils.warning_log("set vendor id invalid curl command sent from the test runner") +else: + Utils.error_log("set vendor id invalid curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_vendor_id) +if curl_response: + Utils.warning_log("get vendor id curl command sent from the test runner") +else: + Utils.error_log("get vendor id curl command failed") + +post_condition = Utils.send_curl_command(HdmiCecSourceApis.set_vendor_id) + +print("---------------------------------------------------------------------------------------------------------------------------") + +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one.' +else: + status = 'Fail' + message = 'Output response is different from expected one.' + +# generate logs in terminal +tc_id = 'TCID028_getVendorId - Invalid curl command' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initiliaze_flask_for_HdmiCecSource() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) + + diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID029.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID029.py new file mode 100644 index 00000000..5dfe8eae --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID029.py @@ -0,0 +1,95 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID029 +# Testcase Description : getEnabled - CEC Already Disabled + +import json +import requests +import time +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"enabled":false,"success":true}}' + +print("getEnabled - CEC Already Disabled") +Utils.initiliaze_flask_for_HdmiCecSource() +time.sleep(3) +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.set_enabled_false) +if curl_response: + Utils.warning_log("set enabled curl command sent from the test runner") +else: + Utils.error_log("set enabled curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_enabled) +if curl_response: + Utils.warning_log("get enabled curl command sent from the test runner") +else: + Utils.error_log("get enabled curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.set_enabled_false) +if curl_response: + Utils.warning_log("set enabled curl command sent from the test runner") +else: + Utils.error_log("set enabled curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_enabled) +if curl_response: + Utils.warning_log("get enabled curl command sent from the test runner") +else: + Utils.error_log("get enabled curl command failed") + +post_condition = Utils.send_curl_command(HdmiCecSourceApis.set_enabled_true) + +print("---------------------------------------------------------------------------------------------------------------------------") + +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one.' +else: + status = 'Fail' + message = 'Output response is different from expected one.' + +# generate logs in terminal +tc_id = 'TCID029_getEnabled - CEC Already Disabled' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initiliaze_flask_for_HdmiCecSource() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) + + diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID030.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID030.py new file mode 100644 index 00000000..8be9a58b --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID030.py @@ -0,0 +1,93 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID030 +# Testcase Description : getEnabled - CEC Already Enabled + +import json +import requests +import time +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"enabled":true,"success":true}}' +Utils.initiliaze_flask_for_HdmiCecSource() +time.sleep(3) +print("getEnabled - CEC Already Enabled") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.set_enabled_true) +if curl_response: + Utils.warning_log("set enabled curl command sent from the test runner") +else: + Utils.error_log("set enabled curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_enabled) +if curl_response: + Utils.warning_log("get enabled curl command sent from the test runner") +else: + Utils.error_log("get enabled curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.set_enabled_true) +if curl_response: + Utils.warning_log("set enabled curl command sent from the test runner") +else: + Utils.error_log("set enabled curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_enabled) +if curl_response: + Utils.warning_log("get enabled curl command sent from the test runner") +else: + Utils.error_log("get enabled curl command failed") + +print("---------------------------------------------------------------------------------------------------------------------------") + +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one.' +else: + status = 'Fail' + message = 'Output response is different from expected one.' + +# generate logs in terminal +tc_id = 'TCID030_getEnabled - CEC Already Enabled' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initiliaze_flask_for_HdmiCecSource() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) + + diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID031.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID031.py new file mode 100644 index 00000000..7109c6fd --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID031.py @@ -0,0 +1,92 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID031 +# Testcase Description : getOTPEnabled - Invalid curl command + +import json +import requests +import time +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"enabled":true,"success":true}}' + +print("getOTPEnabled - Invalid curl command") +Utils.initiliaze_flask_for_HdmiCecSource() +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.set_otp_enabled_true) +if curl_response: + Utils.warning_log("set otp enabled curl command sent from the test runner") +else: + Utils.error_log("set otp enabled curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_otp_enabled) +if curl_response: + Utils.warning_log("get otp enabled curl command sent from the test runner") +else: + Utils.error_log("get otp enabled curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.set_otp_enabled_invalid) +if curl_response: + Utils.warning_log("set otp enabled curl command sent from the test runner") +else: + Utils.error_log("set otp enabled curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_otp_enabled) +if curl_response: + Utils.warning_log("get otp enabled curl command sent from the test runner") +else: + Utils.error_log("get otp enabled curl command failed") + +print("---------------------------------------------------------------------------------------------------------------------------") + +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one.' +else: + status = 'Fail' + message = 'Output response is different from expected one.' + +# generate logs in terminal +tc_id = 'TCID031_getOTPEnabled - Invalid curl command' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initiliaze_flask_for_HdmiCecSource() +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) + + diff --git a/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID032.py b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID032.py new file mode 100644 index 00000000..484ff71b --- /dev/null +++ b/Tests/L2HALMockTests/TestCases/HdmiCecSource/TCID032.py @@ -0,0 +1,93 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# Testcase ID : TCID032 +# Testcase Description : getOSDName - Invalid curl command + +import json +import requests +import time +import Config +from Utilities import Utils, ReportGenerator +from HdmiCecSource import HdmiCecSourceApis + +# store the expected output response +expected_output_response = '{"jsonrpc":"2.0","id":42,"result":{"name":"CUSTOM8 TV","success":true}}' +Utils.initiliaze_flask_for_HdmiCecSource() +print("getOSDName - Invalid curl command") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.set_osd_name) +if curl_response: + Utils.warning_log("set osd name curl command sent from the test runner") +else: + Utils.error_log("set osd name curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_osd_name) +if curl_response: + Utils.warning_log("get osd name curl command sent from the test runner") +else: + Utils.error_log("get osd name curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.set_osd_name_invalid) +if curl_response: + Utils.warning_log("set osd name invalid curl command sent from the test runner") +else: + Utils.error_log("set osd name invalid curl command failed") + +# send the curl command and fetch the output json response +curl_response = Utils.send_curl_command(HdmiCecSourceApis.get_osd_name) +if curl_response: + Utils.warning_log("get osd name curl command sent from the test runner") +else: + Utils.error_log("get osd name curl command failed") + +print("---------------------------------------------------------------------------------------------------------------------------") + +# compare both expected and received output responses +if str(curl_response) == str(expected_output_response): + status = 'Pass' + message = 'Output response is matching with expected one.' +else: + status = 'Fail' + message = 'Output response is different from expected one.' + +# generate logs in terminal +tc_id = 'TCID032_getOSDName - Invalid curl command' +print("Testcase ID : " + tc_id) +print("Testcase Output Response : " + curl_response) +print("Testcase Status : " + status) +print("Testcase Message : " + message) +print("") + +if status == 'Pass': + ReportGenerator.passed_tc_list.append(tc_id) +else: + ReportGenerator.failed_tc_list.append(tc_id) +Utils.initiliaze_flask_for_HdmiCecSource() +post_condition = Utils.send_curl_command(HdmiCecSourceApis.set_osd_name) +# push the testcase execution details to report file +ReportGenerator.append_test_results_to_csv(tc_id, curl_response, status, message) + + diff --git a/Tests/L2HALMockTests/Test_Framework/Config.py b/Tests/L2HALMockTests/Test_Framework/Config.py new file mode 100644 index 00000000..026990e4 --- /dev/null +++ b/Tests/L2HALMockTests/Test_Framework/Config.py @@ -0,0 +1,2105 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# This config file contains all the configurable parameters required for Test Framework +import os + +# IP & port details of Flask server +flask_server_ip = "127.0.0.1:8000" + +# Define the paths of Websocket server & WPEFramework +# Define the paths of Websocket server & WPEFramework +WPEFramework_restart = os.getcwd() +os.chdir("../Flask") + +directory_websocket = os.getcwd() +os.chdir("../../../../install/etc/WPEFramework") + +directory_thunder = os.getcwd() +os.chdir(WPEFramework_restart) + +# Define the path where WPEFramework logs needs to be stored +file_name = 'log_file.txt' +WPEFramework_logs_path = os.path.abspath(file_name) + +# Data required for setDeviceConfig api +config_data = { + "apiName": "setDeviceConfig", + "arguments": { + "devices": [ + { + "device": [ + {"name": "xione_uk"}, + {"islocal": 1}, + {"type": "source"}, + {"powerState": 0}, + {"physicalAddress": "19"}, + {"logicalAddress": "3"}, + {"vendorId": "4567"}, + {"osdName": "404753747265616D696E672054776F"}, + {"menuLanguage": "454E47"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "04"} + ] + }, + { + "device": [ + {"name": "Audio Device"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 0}, + {"physicalAddress": "304"}, + {"logicalAddress": "5"}, + {"vendorId": "4567"}, + {"osdName": "0053616d73756e67"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "04"} + ] + }, + { + "device": [ + {"name": "amazon fire stick"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 1}, + {"physicalAddress": "304"}, + {"logicalAddress": "9"}, + {"vendorId": "4567"}, + {"osdName": "53747265616D696E67204F6E65"}, + {"osdString": "48656C6C6F"}, + {"cecVersion": "04"}, + {"abortReason": "04"} + ] + }, + { + "device": [ + {"name": "hisense"}, + {"islocal": 0}, + {"type": "sink"}, + {"powerState": 0}, + {"physicalAddress": "0"}, + {"logicalAddress": "0"}, + {"vendorId": "0x4567"}, + {"osdName": "545620426F78"}, + {"menuLanguage": "454E47"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "04"} + + ] + } + ] + } +} + +config_data_no_audio = { + "apiName": "setDeviceConfig", + "arguments": { + "devices": [ + { + "device": [ + {"name": "xione_uk"}, + {"islocal": 1}, + {"type": "source"}, + {"powerState": 0}, + {"physicalAddress": "301"}, + {"logicalAddress": "3"}, + {"vendorId": "4567"}, + {"osdName": "404753747265616D696E672054776F"}, + {"menuLanguage": "454E47"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "04"} + ] + }, + { + "device": [ + {"name": "amazon fire stick"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 1}, + {"physicalAddress": "304"}, + {"logicalAddress": "9"}, + {"vendorId": "4567"}, + {"osdName": "53747265616D696E67204F6E65"}, + {"osdString": "48656C6C6F"}, + {"cecVersion": "04"}, + {"abortReason": "04"} + ] + }, + { + "device": [ + {"name": "hisense"}, + {"islocal": 0}, + {"type": "sink"}, + {"powerState": 0}, + {"physicalAddress": "0"}, + {"logicalAddress": "0"}, + {"vendorId": "0x4567"}, + {"osdName": "545620426F78"}, + {"menuLanguage": "454E47"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "04"} + + ] + } + ] + } +} + + +# Data required for setAPIConfig api +api_data = { + "apiName": "setAPIConfig", + "arguments": { + "apiOverrides": [ + { + "HdmiCecOpen": [ + {"return": 0}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecGetLogicalAddress": [ + {"return": 0}, + {"outParams": [{"logicalAddress": "0x3"}]} + ] + }, + { + "HdmiCecGetPhysicalAddress": [ + {"return": 0}, + {"outParams": [{"physicalAddress": "0x304"}]} + ] + } + ] + } +} + +#Hal Api Data for error scenarios +api_data_negative = { + "apiName": "setAPIConfig", + "arguments": { + "apiOverrides": [ + { + "HdmiCecOpen": [ + {"return": -1}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecGetLogicalAddress": [ + {"return": -1}, + {"outParams": [{"logicalAddress": "0x3"}]} + ] + }, + { + "HdmiCecGetPhysicalAddress": [ + {"return": -1}, + {"outParams": [{"physicalAddress": "0x304"}]} + ] + } + ] + } +} + + +abort_data_1 = { + "apiName": "setDeviceConfig", + "arguments": { + "devices": [ + { + "device": [ + {"name": "xione_uk"}, + {"islocal": 1}, + {"type": "source"}, + {"powerState": 0}, + {"physicalAddress": "301"}, + {"logicalAddress": "3"}, + {"vendorId": "4567"}, + {"osdName": "404753747265616D696E672054776F"}, + {"menuLanguage": "454E47"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "159"} + ] + }, + { + "device": [ + {"name": "Audio Device"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 0}, + {"physicalAddress": "304"}, + {"logicalAddress": "5"}, + {"vendorId": "4567"}, + {"osdName": "0053616d73756e67"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "159"} + ] + }, + { + "device": [ + {"name": "amazon fire stick"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 1}, + {"physicalAddress": "304"}, + {"logicalAddress": "9"}, + {"vendorId": "4567"}, + {"osdName": "53747265616D696E67204F6E65"}, + {"osdString": "48656C6C6F"}, + {"cecVersion": "04"}, + {"abortReason": "159"} + ] + }, + { + "device": [ + {"name": "hisense"}, + {"islocal": 0}, + {"type": "sink"}, + {"powerState": 0}, + {"physicalAddress": "0"}, + {"logicalAddress": "0"}, + {"vendorId": "0x4567"}, + {"osdName": "545620426F78"}, + {"menuLanguage": "454E47"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "159"} + + ] + } + ] + } +} + +abort_data_2 = { + "apiName": "setDeviceConfig", + "arguments": { + "devices": [ + { + "device": [ + {"name": "xione_uk"}, + {"islocal": 1}, + {"type": "source"}, + {"powerState": 0}, + {"physicalAddress": "301"}, + {"logicalAddress": "3"}, + {"vendorId": "4567"}, + {"osdName": "404753747265616D696E672054776F"}, + {"menuLanguage": "454E47"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "140"} + ] + }, + { + "device": [ + {"name": "Audio Device"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 0}, + {"physicalAddress": "304"}, + {"logicalAddress": "5"}, + {"vendorId": "4567"}, + {"osdName": "0053616d73756e67"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "140"} + ] + }, + { + "device": [ + {"name": "amazon fire stick"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 1}, + {"physicalAddress": "304"}, + {"logicalAddress": "9"}, + {"vendorId": "4567"}, + {"osdName": "53747265616D696E67204F6E65"}, + {"osdString": "48656C6C6F"}, + {"cecVersion": "04"}, + {"abortReason": "140"} + ] + }, + { + "device": [ + {"name": "hisense"}, + {"islocal": 0}, + {"type": "sink"}, + {"powerState": 0}, + {"physicalAddress": "0"}, + {"logicalAddress": "0"}, + {"vendorId": "0x4567"}, + {"osdName": "545620426F78"}, + {"menuLanguage": "454E47"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "140"} + + ] + } + ] + } +} + +abort_data_3 = { + "apiName": "setDeviceConfig", + "arguments": { + "devices": [ + { + "device": [ + {"name": "xione_uk"}, + {"islocal": 1}, + {"type": "source"}, + {"powerState": 0}, + {"physicalAddress": "301"}, + {"logicalAddress": "3"}, + {"vendorId": "4567"}, + {"osdName": "404753747265616D696E672054776F"}, + {"menuLanguage": "454E47"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "70"} + ] + }, + { + "device": [ + {"name": "Audio Device"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 0}, + {"physicalAddress": "304"}, + {"logicalAddress": "5"}, + {"vendorId": "4567"}, + {"osdName": "0053616d73756e67"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "70"} + ] + }, + { + "device": [ + {"name": "amazon fire stick"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 1}, + {"physicalAddress": "304"}, + {"logicalAddress": "9"}, + {"vendorId": "4567"}, + {"osdName": "53747265616D696E67204F6E65"}, + {"osdString": "48656C6C6F"}, + {"cecVersion": "04"}, + {"abortReason": "70"} + ] + }, + { + "device": [ + {"name": "hisense"}, + {"islocal": 0}, + {"type": "sink"}, + {"powerState": 0}, + {"physicalAddress": "0"}, + {"logicalAddress": "0"}, + {"vendorId": "0x4567"}, + {"osdName": "545620426F78"}, + {"menuLanguage": "454E47"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "70"} + + ] + } + ] + } +} + +abort_data_4 = { + "apiName": "setDeviceConfig", + "arguments": { + "devices": [ + { + "device": [ + {"name": "xione_uk"}, + {"islocal": 1}, + {"type": "source"}, + {"powerState": 0}, + {"physicalAddress": "301"}, + {"logicalAddress": "3"}, + {"vendorId": "4567"}, + {"osdName": "404753747265616D696E672054776F"}, + {"menuLanguage": "454E47"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "143"} + ] + }, + { + "device": [ + {"name": "Audio Device"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 0}, + {"physicalAddress": "304"}, + {"logicalAddress": "5"}, + {"vendorId": "4567"}, + {"osdName": "0053616d73756e67"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "143"} + ] + }, + { + "device": [ + {"name": "amazon fire stick"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 1}, + {"physicalAddress": "304"}, + {"logicalAddress": "9"}, + {"vendorId": "4567"}, + {"osdName": "53747265616D696E67204F6E65"}, + {"osdString": "48656C6C6F"}, + {"cecVersion": "04"}, + {"abortReason": "143"} + ] + }, + { + "device": [ + {"name": "hisense"}, + {"islocal": 0}, + {"type": "sink"}, + {"powerState": 0}, + {"physicalAddress": "0"}, + {"logicalAddress": "0"}, + {"vendorId": "0x4567"}, + {"osdName": "545620426F78"}, + {"menuLanguage": "454E47"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "143"} + + ] + } + ] + } +} + +abort_data_5 = { + "apiName": "setDeviceConfig", + "arguments": { + "devices": [ + { + "device": [ + {"name": "xione_uk"}, + {"islocal": 1}, + {"type": "source"}, + {"powerState": 0}, + {"physicalAddress": "301"}, + {"logicalAddress": "3"}, + {"vendorId": "4567"}, + {"osdName": "404753747265616D696E672054776F"}, + {"menuLanguage": "454E47"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "164"} + ] + }, + { + "device": [ + {"name": "Audio Device"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 0}, + {"physicalAddress": "304"}, + {"logicalAddress": "5"}, + {"vendorId": "4567"}, + {"osdName": "0053616d73756e67"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "164"} + ] + }, + { + "device": [ + {"name": "amazon fire stick"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 1}, + {"physicalAddress": "304"}, + {"logicalAddress": "9"}, + {"vendorId": "4567"}, + {"osdName": "53747265616D696E67204F6E65"}, + {"osdString": "48656C6C6F"}, + {"cecVersion": "04"}, + {"abortReason": "164"} + ] + }, + { + "device": [ + {"name": "hisense"}, + {"islocal": 0}, + {"type": "sink"}, + {"powerState": 0}, + {"physicalAddress": "0"}, + {"logicalAddress": "0"}, + {"vendorId": "0x4567"}, + {"osdName": "545620426F78"}, + {"menuLanguage": "454E47"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "164"} + + ] + } + ] + } +} + + +# Device data for HiSense TV +hisense_device_data = { + "device": [ + {"name": "hisense"}, + {"islocal": 0}, + {"type": "sink"}, + {"powerState": 0}, + {"physicalAddress": "0"}, + {"logicalAddress": "6"}, + {"vendorId": "0x4567"}, + {"osdName": "545620426F78"}, + # {"optionalProperty1": "value1"}, + # {"optionalProperty2": "value2"} + ] +} + +api_data_sink = { + "apiName": "setAPIConfig", + "arguments": { + "apiOverrides": [ + { + "HdmiCecTx": [ + {"return": -1}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecOpen": [ + {"return": -1}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecGetLogicalAddress": [ + {"return": -1}, + {"outParams": [{"logicalAddress": "0x3"}]} + ] + }, + { + "HdmiCecGetPhysicalAddress": [ + {"return": -1}, + {"outParams": [{"physicalAddress": "0x304"}]} + ] + } + ] + } +} + + + +# Invalid device data for Xione US +invalid_device_data = { + "device": [ + {"name": "xione_us"}, + {"islocal": 0}, + {"type": "sink"}, + {"powerState": 0}, + {"physicalAddress": "333"}, + {"logicalAddress": "77"}, + {"vendorId": "4444"}, + {"osdName": "3333"}, + # {"optionalProperty1": "value1"}, + # {"optionalProperty2": "value2"} + ] +} + +# Send message data for sendStandbyMessage +sendStandbyMessage = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x36" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +# message send to know the current power status of device +getPowerStatusMessage = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x03", + "0x8F" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +# message send to know the current power status of device +reportPowerStatusMessage = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x90" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +# message for perform OTP Action +performOTPActionMessage = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x04" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +# api overrides data in which return value for HdmiCecOpen is set to -1 +cec_minus_one = { + "apiName": "setAPIConfig", + "arguments": { + "apiOverrides": [ + { + "HdmiCecOpen": [ + {"return": -1}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecGetLogicalAddress": [ + {"return": 0}, + {"outParams": [{"logicalAddress": "0x3"}]} + ] + }, + { + "HdmiCecGetPhysicalAddress": [ + {"return": 0}, + {"outParams": [{"physicalAddress": "0x304"}]} + ] + } + ] + } +} + +# messages for active source +active_source_firestick1 = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "amazon fire stick", + "messages": [ + { + "message1": { + "buf": [ + "0x34", + "0x82" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +active_source_hisense = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x82" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +active_source_xione_uk = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0xF3", + "0x82" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} +# messages for inactive source +inactive_source_firestick1 = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "amazon fire stick", + "messages": [ + { + "message1": { + "buf": [ + "0x34", + "0x9D" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +inactive_source_hisense = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x9D" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +# messages for request active source +request_active_source_firestick1 = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "amazon fire stick", + "messages": [ + { + "message1": { + "buf": [ + "0x34", + "0x85" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +request_active_source_hisense = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x85" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +image_view_on = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x04" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +text_view_on = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x0D" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +routing_change = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "amazon fire stick", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x80" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +set_stream_path_hisense = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x86" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +routing_information_hisense = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x81" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +give_device_power_status_hisense = { + + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x8F" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +set_menu_language = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x32" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +ignore_set_menu_language = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x34", + "0x32" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +get_menu_language_hisense = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x91" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +get_cec_version = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x9F" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +cec_version = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x9E" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +give_physical_address_hisense = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x83" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +give_osd_name_hisense = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x46" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +set_osd_string = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x64" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +feature_abort = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x00" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +abort_hisense = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0xFF" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +feature_abort_hisense = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x00" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +polling = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x200" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +sinkActiveSource = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x50", + "0x04" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +sinkActiveSource = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x50", + "0x04" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +imageViewON = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x50", + "0x04" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +textViewON = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x30", + "0x0D" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +reportPhysicalAdd = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0xF0", + "0x84" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +DeviceVendorID = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0xF0", + "0x87" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +initiateArc = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x05", + "0xC0" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +terminateArc = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x05", + "0xC5" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +reportShortAudioDes = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x05", + "0xA3" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +setSystemAudioMode = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x50", + "0x72" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +reportAudioMode = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x50", + "0x7A" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +givefeatures = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x50", + "0xA5" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + +requestcurrentlatency = { + "apiName": "sendMessage", + "arguments": { + "remoteDevices": [ + { + "device": { + "name": "hisense", + "messages": [ + { + "message1": { + "buf": [ + "0x50", + "0xA7" + ], + "len": 2, + "repeat": 2, + "delay": 1 + } + } + ] + } + } + ] + } +} + + +api_data_sink_1 = { + "apiName": "setAPIConfig", + "arguments": { + "apiOverrides": [ + { + "HdmiCecTx": [ + {"return": 0}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecOpen": [ + {"return": 0}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecGetLogicalAddress": [ + {"return": 0}, + {"outParams": [{"logicalAddress": "0x3"},{"result":0}]} + ] + }, + { + "HdmiCecGetPhysicalAddress": [ + {"return": -1}, + {"outParams": [{"physicalAddress": "0x304"}]} + ] + } + ] + } +} + + +api_data_sink_2 = { + "apiName": "setAPIConfig", + "arguments": { + "apiOverrides": [ + { + "HdmiCecTx": [ + {"return": 0}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecOpen": [ + {"return": 0}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecGetLogicalAddress": [ + {"return": 0}, + {"outParams": [{"logicalAddress": "0x3"},{"result":1}]} + ] + }, + { + "HdmiCecGetPhysicalAddress": [ + {"return": 0}, + {"outParams": [{"physicalAddress": "0x304"}]} + ] + } + ] + } +} + + +api_data_sink_3 = { + "apiName": "setAPIConfig", + "arguments": { + "apiOverrides": [ + { + "HdmiCecTx": [ + {"return": 0}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecOpen": [ + {"return": 0}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecGetLogicalAddress": [ + {"return": 0}, + {"outParams": [{"logicalAddress": "0x3"},{"result":2}]} + ] + }, + { + "HdmiCecGetPhysicalAddress": [ + {"return": 0}, + {"outParams": [{"physicalAddress": "0x304"}]} + ] + } + ] + } +} + + +api_data_sink_4 = { + "apiName": "setAPIConfig", + "arguments": { + "apiOverrides": [ + { + "HdmiCecTx": [ + {"return": 0}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecOpen": [ + {"return": 0}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecGetLogicalAddress": [ + {"return": 0}, + {"outParams": [{"logicalAddress": "0x3"},{"result":3}]} + ] + }, + { + "HdmiCecGetPhysicalAddress": [ + {"return": 0}, + {"outParams": [{"physicalAddress": "0x304"}]} + ] + } + ] + } +} + + +api_data_sink_5 = { + "apiName": "setAPIConfig", + "arguments": { + "apiOverrides": [ + { + "HdmiCecTx": [ + {"return": 0}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecOpen": [ + {"return": 0}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecGetLogicalAddress": [ + {"return": 0}, + {"outParams": [{"logicalAddress": "0x3"},{"result":4}]} + ] + }, + { + "HdmiCecGetPhysicalAddress": [ + {"return": 0}, + {"outParams": [{"physicalAddress": "0x304"}]} + ] + } + ] + } +} + + +api_data_sink_6 = { + "apiName": "setAPIConfig", + "arguments": { + "apiOverrides": [ + { + "HdmiCecTx": [ + {"return": 0}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecOpen": [ + {"return": 0}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecGetLogicalAddress": [ + {"return": 0}, + {"outParams": [{"logicalAddress": "0x3"},{"result":5}]} + ] + }, + { + "HdmiCecGetPhysicalAddress": [ + {"return": 0}, + {"outParams": [{"physicalAddress": "0x304"}]} + ] + } + ] + } +} + + +api_data_sink_7 = { + "apiName": "setAPIConfig", + "arguments": { + "apiOverrides": [ + { + "HdmiCecTx": [ + {"return": 0}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecOpen": [ + {"return": 0}, + {"outParams": [{"handle": 2345678}]} + ] + }, + { + "HdmiCecGetLogicalAddress": [ + {"return": 0}, + {"outParams": [{"logicalAddress": "0x3"},{"result":6}]} + ] + }, + { + "HdmiCecGetPhysicalAddress": [ + {"return": 0}, + {"outParams": [{"physicalAddress": "0x304"}]} + ] + } + ] + } +} + + +# Data required for setDeviceConfig api HdmiCecSource +config_data_hdmicecsource = { + "apiName": "setDeviceConfig", + "arguments": { + "devices": [ + { + "device": [ + {"name": "xione_uk"}, + {"islocal": 1}, + {"type": "source"}, + {"powerState": 0}, + {"physicalAddress": "301"}, + {"logicalAddress": "3"}, + {"vendorId": "4567"}, + {"osdName": "404753747265616D696E672054776F"}, + {"menuLanguage": "454E47"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "04"} + ] + }, + { + "device": [ + {"name": "amazon fire stick"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 0}, + {"physicalAddress": "304"}, + {"logicalAddress": "4"}, + {"vendorId": "4567"}, + {"osdName": "53747265616D696E67204F6E65"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "04"} + ] + }, + { + "device": [ + {"name": "amazon fire stick"}, + {"islocal": 0}, + {"type": "source"}, + {"powerState": 1}, + {"physicalAddress": "304"}, + {"logicalAddress": "9"}, + {"vendorId": "4567"}, + {"osdName": "53747265616D696E67204F6E65"}, + {"osdString": "48656C6C6F"}, + {"cecVersion": "04"}, + {"abortReason": "04"} + ] + }, + { + "device": [ + {"name": "hisense"}, + {"islocal": 0}, + {"type": "sink"}, + {"powerState": 0}, + {"physicalAddress": "0"}, + {"logicalAddress": "0"}, + {"vendorId": "0x4567"}, + {"osdName": "545620426F78"}, + {"menuLanguage": "454E47"}, + {"osdString": "484953454E5345"}, + {"cecVersion": "04"}, + {"abortReason": "04"} + + ] + } + ] + } + } + +# Data required for setAPIConfig api HdmiCecSource +api_data_hdmicecsource = { + "apiName": "setAPIConfig", + "arguments": { + "apiOverrides": [ + { + "HdmiCecOpen": [ + { "return": 0 }, + { "outParams": [{"handle": 2345678}] } + ] + }, + { + "HdmiCecGetLogicalAddress": [ + { "return": 0 }, + { "outParams": [{"logicalAddress": "0x3"}] } + ] + }, + { + "HdmiCecGetPhysicalAddress": [ + { "return": 0 }, + { "outParams": [{"physicalAddress": "0x304"}] } + ] + } + ] + } + } diff --git a/Tests/L2HALMockTests/Test_Framework/Test Execution Reports/TestReport_23Q4-HAL-MOCK-TEST_05-02-2024_16h10m12s.html b/Tests/L2HALMockTests/Test_Framework/Test Execution Reports/TestReport_23Q4-HAL-MOCK-TEST_05-02-2024_16h10m12s.html new file mode 100644 index 00000000..725cb331 --- /dev/null +++ b/Tests/L2HALMockTests/Test_Framework/Test Execution Reports/TestReport_23Q4-HAL-MOCK-TEST_05-02-2024_16h10m12s.html @@ -0,0 +1,63 @@ +

+ Build Name: 23Q4-HAL-MOCK-TEST +

+

+ Date of Execution: 05/02/2024 +

+

+ Time of Execution: 16:10:12 +

+

+ Number of Testcases Passed: 2 +

+

+ Number of Testcases Failed: 0 +

+ + + + + + + + + + + + + + + + + + + + + + + +
+ TC ID + + Output Response + + TC Status + + TC Message +
+ TCID004 + + {"jsonrpc":"2.0","id":42,"result":{"success":true}} + + Pass + + Output response is matching with expected one. We are expecting opcode : 36 in thunder logs +
+ TCID016 + + {"jsonrpc":"2.0","id":42,"result":{"enabled":false,"success":true}} + + Pass + + Output response is matching with expected one. The cec enable status is true initially and after changing the return value, cec enable status changed to false +
\ No newline at end of file diff --git a/Tests/L2HALMockTests/Test_Framework/TestManager.py b/Tests/L2HALMockTests/Test_Framework/TestManager.py new file mode 100644 index 00000000..f24d6b6b --- /dev/null +++ b/Tests/L2HALMockTests/Test_Framework/TestManager.py @@ -0,0 +1,750 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +import sys +import datetime +import time +sys.path.append("../TestCases") +from HdmiCecSource import CecUtils +from FrontPanel import FPUtils +from HDCPProfile import HdcpUtils +from Utilities import Utils, ReportGenerator + +sys.path.append("Utilities") +sys.path.append("../TestCases/HdmiCecSource") +sys.path.append("../TestCases/HdmiCecSink") +sys.path.append("../TestCases/FrontPanel") +sys.path.append("../TestCases/HDCPProfile") + +# Define the build name of current build being tested +build_name = "23Q4-HAL-MOCK-TEST" + +# Get the date and time of execution +now = datetime.datetime.now() + +# clear the previous test results +ReportGenerator.passed_tc_list.clear() +ReportGenerator.failed_tc_list.clear() + +print("") +print("Inside TestManager.py : Initializing Python Test Framework......................!") +print("") +argument = sys.argv[1:3] +result = ' '.join(argument) +if len(sys.argv) >= 2: + second_argument = sys.argv[1] + print(f"Two plugins are given: {second_argument}") +elif len(sys.argv) >= 3: + third_argument = sys.argv[2] + print(f"three plugins are given: {third_argument}") +elif len(sys.argv) >= 4: + forth_argument = sys.argv[3] + print(f"4 plugins are given: {argument}") +else: + print("No second argument provided.") + +print("GIVEN PLUGIN NAMES/TC NAME {}" .format(argument)) +# Pushing the initial configuration (cec network data & +# Pushing the initial configuration (cec network data & api override data) to Flask +#Utils.initialize_flask() +print("") + +# Activating the HdmiCecSource plugin using controller1.activate curl command +#CecUtils.activate_cec() +#time.sleep(5) + +print("") +print("***** Test Execution Starts *****") +print("") + +tc_name = result +flag = 0 +track = 0 + +list_of_plugins = ['HdmiCecSource','HdmiCecSink','FrontPanel','HdcpProfile'] + +plugin_name = [] + +for each in list_of_plugins: + if each in argument or each in result: + plugin_name.append(each) + track = track + 1 + +if track == 2 or track > 2: + Utils.info_log("Executing Testcases for the given plugins") + if "HdmiCecSource" in plugin_name or "HdmiCecSink" in plugin_name: + Utils.initialize_flask() + print("") + +# Activating the HdmiCecSource plugin using controller1.activate curl command + CecUtils.activate_cec() + time.sleep(5) + else: + print("Plugins changed does not require FLASK HTTP Server for execution and build") + + if "HdmiCecSource" in plugin_name: + # Execute the testcases + import TCID013 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID014 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID015 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID022 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID023 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID024 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID001 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID002 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID003 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID004 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID005 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID006 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID007 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID008 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID009 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID010 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID011 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID012 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID016 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID017 + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID018 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID019 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID020 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID026 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID027 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID032 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID031 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID030 + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID029 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID028 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID025 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID021 + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + else: + print("Skipping HdmiCecSource as no changes are added") + + if "HdmiCecSink" in plugin_name: + import TCID_031_HDMICECSINK_getEnabled_HAL_False + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_Emulate + import TCID_035_Arc_start_stop + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_028_HDMICECSINK_abortCombinationsEmulation + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_036_HDMICECSINK_OSDStringMenuLanguageEmulation + import TCID_037_HDMICECSINK_sendEvents + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_032_HDMICECSINK_EmulateTextViewONStandbyBy + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_001_HDMICECSINK_getEnabled + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_002_HDMICECSINK_setEnabled + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_003_HDMICECSINK_getOSDName + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_005_HDMICECSINK_getVendorID + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_004_HDMICECSINK_setOSDName + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_006_HDMICECSINK_setVendorID + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_008_HDMICECSINK_getActiveSource + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_007_HDMICECSINK_getActiveRoute + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_009_HDMICECSINK_getAudioDeviceConnectedStatus + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_010_HDMICECSINK_getDeviceList + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_011_HDMICECSINK_requestActiveSource + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_012_HDMICECSINK_requestShortAudioDescriptor + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_013_HDMICECSINK_sendAudioDevicePowerOnMessage + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_014_HDMICECSINK_getAudioStatusMessage + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_015_HDMICECSINK_sendKeyPressEvent + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_016_HDMICECSINK_sendUserControlPressed + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_017_HDMICECSINK_sendUserControlReleased + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_018_HDMICECSINK_sendStandbyMessage + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_019_HDMICECSINK_setActivePath + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_020_HDMICECSINK_setActiveSource + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_021_HDMICECSINK_setmenuLanguage + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_022_HDMICECSINK_setLatencyInfo + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_023_HDMICECSINK_setRoutingChange + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_024_HDMICECSINK_setupArcRouting + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_025_HDMICECSINK_printDeviceList + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_026_HDMICECSINK_requestAudioDevicePowerStatus + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_029_HDMICECSINK_getActiveSourcewithroutingChange + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_030_HDMICECSINK_sendGetAudioStatusMessage + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_033_HDMICECSINK_setRoutingChangeNegative + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_034_HDMICECSINK_active_source + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + else: + print("Skipping HDMICECSINK as no changes are added") + + + if "FrontPanel" in plugin_name: + #Utils.initialize_flask() + print("Executing Test Framework without HTTP server and Websocket") + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_001_DS_FrontPanel_getBrightness + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_011_DS_FrontPanel_setPreferences #commented as its descoped in source code + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_002_DS_FrontPanel_getPreferences + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_003_DS_FrontPanel_is24HourClock + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_014_DS_FrontPanel_setClockBrightness #commented as its descoped in source code + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_004_DS_FrontPanel_getClockBrightness #commented as its descoped in source code + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_005_DS_FrontPanel_powerLedOff + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_006_DS_FrontPanel_powerLedOn + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_007_DS_FrontPanel_set24HourClock + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_008_DS_FrontPanel_setBlink + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_009_DS_FrontPanel_setClockTestPattern + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_010_DS_FrontPanel_setLED + print("\033[32m------########################################################################################################################---------.\033[0m") + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_013_DS_FrontPanel_setBrightness + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_015_DS_FrontPanel_getSetbrightnesscombination + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_012_DS_FrontPanel_getFrontPanelLights + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_017_DS_FrontPanel_sendEventsSimulation + import TCID_016_DS_FrontPanel_Deactivate + else: + print("Skipping FrontPanel as no changes are added") + + if "HdcpProfile" in plugin_name: + print("Detected change in HdcpProfile") + import TCID_001_HDCPProfile_getHDCPStatus + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_002_HDCPProfile_getSettopHDCPSupport #commented as its descoped in source code + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_004_HDCPProfile_Events + time.sleep(2) + import TCID_003_HDCPProfile_ActivateDeactivateSimulation + + else: + print("skipping HdcpProfile as no changes are required") +else: + track = 1 +if "HdmiCecSource" in argument or "HdmiCecSource" in result: + if track < 2: + flag = 1 + if flag == 1 or flag == 15: + Utils.initialize_flask() + print("") + +# Activating the HdmiCecSource plugin using controller1.activate curl command + CecUtils.activate_cec() + time.sleep(5) + + # Execute the testcases for HdmiCecSource + Utils.info_log("Executing Testcases for HdmiCecSource") + # Execute the testcases + import TCID013 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID014 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID015 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID022 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID023 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID024 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID001 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID002 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID003 + import TCID004 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID005 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID006 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID007 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID008 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID009 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID010 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID011 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID012 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID016 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID017 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID018 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID019 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID020 + import TCID020 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID026 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID027 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID032 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID031 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID030 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID029 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID028 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID025 + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID021 + print("\033[32m------########################################################################################################################---------.\033[0m") + else: + print("Executed HdmiCecSource TestCases") +if "HdmiCecSink" in argument or "HdmiCecSink" in result: + if track < 2: + flag = 2 + Utils.info_log("Executing HdmiCecSink Test suite") + Utils.initialize_flask() + print("") + +# Activating the HdmiCecSource plugin using controller1.activate curl command + CecUtils.activate_cec() + time.sleep(5) + + import TCID_031_HDMICECSINK_getEnabled_HAL_False + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_Emulate + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_035_Arc_start_stop + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_028_HDMICECSINK_abortCombinationsEmulation + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_036_HDMICECSINK_OSDStringMenuLanguageEmulation + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_037_HDMICECSINK_sendEvents + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_032_HDMICECSINK_EmulateTextViewONStandbyBy + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_001_HDMICECSINK_getEnabled + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_002_HDMICECSINK_setEnabled + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_003_HDMICECSINK_getOSDName + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_005_HDMICECSINK_getVendorID + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_004_HDMICECSINK_setOSDName + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_006_HDMICECSINK_setVendorID + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_008_HDMICECSINK_getActiveSource + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_007_HDMICECSINK_getActiveRoute + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_009_HDMICECSINK_getAudioDeviceConnectedStatus + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_010_HDMICECSINK_getDeviceList + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_011_HDMICECSINK_requestActiveSource + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_012_HDMICECSINK_requestShortAudioDescriptor + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_013_HDMICECSINK_sendAudioDevicePowerOnMessage + import TCID_014_HDMICECSINK_getAudioStatusMessage + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_015_HDMICECSINK_sendKeyPressEvent + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_016_HDMICECSINK_sendUserControlPressed + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_017_HDMICECSINK_sendUserControlReleased + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_018_HDMICECSINK_sendStandbyMessage + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_019_HDMICECSINK_setActivePath + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_020_HDMICECSINK_setActiveSource + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_021_HDMICECSINK_setmenuLanguage + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_022_HDMICECSINK_setLatencyInfo + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_023_HDMICECSINK_setRoutingChange + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_024_HDMICECSINK_setupArcRouting + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_025_HDMICECSINK_printDeviceList + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_026_HDMICECSINK_requestAudioDevicePowerStatus + + print( + "\033[32m------########################################################################################################################---------.\033[0m") + import TCID_029_HDMICECSINK_getActiveSourcewithroutingChange + import TCID_030_HDMICECSINK_sendGetAudioStatusMessage + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_033_HDMICECSINK_setRoutingChangeNegative + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_034_HDMICECSINK_active_source + print("\033[32m------########################################################################################################################---------.\033[0m") + else: + print("Executed HdmiCecSink TestCases") +if "FrontPanel" in argument or "FrontPanel" in result: + if track < 2: + flag = 3 + Utils.info_log("Executing FrontPanel Test suite") + print("\033[32m------########################################################################################################################---------.\033[0m") + + #Utils.initialize_flask() + print("Executing Test Framework without HTTP server and Websocket") + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_001_DS_FrontPanel_getBrightness + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_011_DS_FrontPanel_setPreferences #commented as its descoped in source code + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_002_DS_FrontPanel_getPreferences + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_003_DS_FrontPanel_is24HourClock + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_014_DS_FrontPanel_setClockBrightness #commented as its descoped in source code + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_004_DS_FrontPanel_getClockBrightness #commented as its descoped in source code + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_005_DS_FrontPanel_powerLedOff + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_006_DS_FrontPanel_powerLedOn + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_007_DS_FrontPanel_set24HourClock + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_008_DS_FrontPanel_setBlink + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_009_DS_FrontPanel_setClockTestPattern + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_010_DS_FrontPanel_setLED + print("\033[32m------########################################################################################################################---------.\033[0m") + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_013_DS_FrontPanel_setBrightness + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_015_DS_FrontPanel_getSetbrightnesscombination + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_012_DS_FrontPanel_getFrontPanelLights + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_017_DS_FrontPanel_sendEventsSimulation + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_018_DS_FrontPanel_negative + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_020_DS_FrontPanel_powerLed_invalid + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_021_DS_FrontPanel_LEDBrightnessNegative + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_022_DS_FrontPanel_24HrClock_invalid + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_016_DS_FrontPanel_Deactivate + +# Activating the HdmiCecSource plugin using controller1.activate curl command + #CecUtils.activate_cec() + #time.sleep(5) +if "HdcpProfile" in argument or "HdcpProfile" in result: + if track < 2: + flag = 4 + Utils.info_log("Executing HDCPProfile Test suite") + print("\033[32m------########################################################################################################################---------.\033[0m") + time.sleep(30) + #Utils.initialize_flask() + print("Executing Test Framework without HTTP server and Websocket") + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_001_HDCPProfile_getHDCPStatus + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_002_HDCPProfile_getSettopHDCPSupport #commented as its descoped in source code + print("\033[32m------########################################################################################################################---------.\033[0m") + import TCID_004_HDCPProfile_Events + time.sleep(28) + import TCID_003_HDCPProfile_ActivateDeactivateSimulation + #import TCID_003_HDCPProfile_ActivateDeactivateSimulation + +if argument == "DeviceSettings": + flag = 3 + Utils.highlight_log("Executing DeviceSettings Test suite") +if argument == "Bluetooth": + flag = 4 + Utils.highlight_log("Executing Bluetooth Test Suite") +if argument == "Wifi": + flag = 5 + Utils.highlight_log("Executing Wifi Test Suite") +if argument == "HdmiInput": + flag = 6 +if argument == "all": + flag = 15 + Utils.highlight_log("Executing Complete Test Suite for all plugins") +if "TCID" in result: + flag = 0 + print( + "\033[32m------########################################################################################################################---------.\033[0m") + print("Execution of testcase {}".format(argument)) + __import__(tc_name) + +if argument != "HdmiCecSource" or argument != "HdmiCecSink" or argument != "all": + print("Execution of testcase {}" .format(argument)) +if flag == 2 or flag == 15: + Utils.info_log("Executed HdmiCecSinkTestcases") +if flag == 15: + Utils.info_log("Executed Complete Test suite") +else: + print("Executed TestManager") + +print("***** Test Execution Ends *****") + +# Generate a html report file with all testcase execution details +ReportGenerator.generate_html_report(build_name, now) diff --git a/Tests/L2HALMockTests/Test_Framework/Utilities/ReportGenerator.py b/Tests/L2HALMockTests/Test_Framework/Utilities/ReportGenerator.py new file mode 100644 index 00000000..4739fb0f --- /dev/null +++ b/Tests/L2HALMockTests/Test_Framework/Utilities/ReportGenerator.py @@ -0,0 +1,186 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +import csv +import os +import pandas as pd +from bs4 import BeautifulSoup + +passed_tc_list = [] +failed_tc_list = [] + + +def append_test_results_to_csv(tc_id, output, status, message): + + # Assign the headers for report file + headers = ["Curl API/TC Name", "Output Response", " TC Status ", " Remarks "] + + # Open the report file in append mode + with open("TestReport.csv", "a", newline="") as csvfile: + writer = csv.writer(csvfile) + + # Write headers if the headers in report file is empty + if csvfile.tell() == 0: + writer.writerow(headers) + + # Write the testcase details to a new row + writer.writerow([tc_id, output, status, message]) + + + +# Report Generation in .html file format +def generate_html_report(build_name, now): + + # To read csv file named "TestReport" + a = pd.read_csv("TestReport.csv") + + # Format the date and time as strings to generate the test report file + date = now.strftime("%d-%m-%Y") + time = now.strftime("%Hh%Mm%Ss") + + # To save as html file with build name, execution data and time + a.to_html("TestReport_{}_{}_{}.html".format(build_name, date, time), index=False) + # To remove the TestReport.csv file + #os.remove("TestReport.csv") + + # Add custom CSS style for a black background + # Read the HTML file + with open("TestReport_{}_{}_{}.html".format(build_name, date, time), "r") as f: + html = f.read() + + styled_html = f""" + + {html} + """ + + # Parse the HTML using BeautifulSoup + soup = BeautifulSoup(html, "html.parser") + + # Find the table element + table = soup.find("table") + + # Create a list of elements with the data + + # Calculate the length of the failed_tc_list string + failed_tc_length = str(len(failed_tc_list)) + passed_tc_length = str(len(passed_tc_list)) + + # Create a formatted string with the length in red + #formatted_length_failed = f"\033[91m{failed_tc_length}\033[0m" + #formatted_length_passed = f"\033[92m{passed_tc_length}\033[0m" + formatted_length_failed = failed_tc_length + formatted_length_passed = passed_tc_length + + current_date = now.strftime("%d/%m/%Y") + current_time = now.strftime("%H:%M:%S") + data = [soup.new_tag("p")] + # Now you can use the formatted_length wherever you need it + ##data[-1].string = f"Number of Testcases Failed: {str(formatted_length_failed)}" + #data[-1].string = f"Number of Testcases Failed: {str(len(failed_tc_list))}" + ##data.append(soup.new_tag("p")) + #data[-1].string = f"Number of Testcases Passed: {str(len(passed_tc_list))}" + ##data[-1].string = f"Number of Testcases Passed: {str(formatted_length_passed)}" + ##data.append(soup.new_tag("p")) + ##data[-1].string = f"Time of Execution: {current_time}" + ##data.append(soup.new_tag("p")) + ##data[-1].string = f"Date of Execution: {current_date}" + ##data.append(soup.new_tag("p")) + ##data[-1].string = f"Build Name: {build_name}" + + styled_html = f""" + + + + + +

L2 Test Execution Report

+ {html} +

Execution Summary

+

Number of Testcases Failed: {str(formatted_length_failed)}

+

Number of Testcases Passed: {str(formatted_length_passed)}

+

Time of Execution: {current_time}

+

Date of Execution: {current_date}

+

Build Name: {build_name}

+ + + """ + + + # Insert the data elements before the table element + for element in reversed(data): + table.insert_before(element) + + + # Replace the old html file with new one + with open("TestReport_{}_{}_{}.html".format(build_name, date, time), "w") as f: + f.write(str(soup)) + + # Read the html file + with open("TestReport_{}_{}_{}.html".format(build_name, date, time)) as html_file: + soup = BeautifulSoup(html_file, "html.parser") + + # Find all the elements + headers = soup.find_all("th") + + # Add the style attribute to each element + for header in headers: + header["style"] = "text-align: center" + + + # Write the modified html to a same report file + with open("TestReport_{}_{}_{}.html".format(build_name, date, time), "w") as html_file: + #html_file.write(soup.prettify()) + html_file.write(styled_html) + # Move the html file to the 'Test Execution Reports' Directory + os.rename("TestReport_{}_{}_{}.html".format(build_name, date, time), + "Test Execution Reports/TestReport_{}_{}_{}.html".format( + build_name, date, time)) diff --git a/Tests/L2HALMockTests/Test_Framework/Utilities/Utils.py b/Tests/L2HALMockTests/Test_Framework/Utilities/Utils.py new file mode 100644 index 00000000..462c5af2 --- /dev/null +++ b/Tests/L2HALMockTests/Test_Framework/Utilities/Utils.py @@ -0,0 +1,261 @@ +#** ***************************************************************************** +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2024 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * +# http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * +#* ****************************************************************************** + +# This file contains all the common functions required for test framework + +import subprocess +import os +import json +import requests +import Config +from os import path +import logging +from colorama import Fore, Style +import time + + +def error_log(message): + print(Fore.RED + f"ERROR: {message}" + Style.RESET_ALL) + +def warning_log(message): + print(Fore.YELLOW + f"LOGGER: {message}" + Style.RESET_ALL) + +def info_log(message): + print(Fore.CYAN + f"INFO: {message}" + Style.RESET_ALL) + +def initiliaze_flask_for_HdmiCecSource(): + '''This function is used to push the initial data towards the Flask server''' + try: + # Push the initial cec network data to Flask using http get requests - setDeviceConfig API + create_device_response = requests.get("http://{}/Database.setDeviceConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.config_data_hdmicecsource))) + print("Inside Utils.py : " + create_device_response.text + " : " + str(Config.config_data_hdmicecsource)) + print("configured device data using - http://{}/Database.setDeviceConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.config_data_hdmicecsource))) + print("") + + # Push the api overrides data to Flask using http get requests - setAPIConfig API + create_api_overrides_response = requests.get("http://{}/Hdmicec.setAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.api_data_hdmicecsource))) + print("Inside Utils.py : " + create_api_overrides_response.text + " : " + str(Config.api_data_hdmicecsource)) + print("configured hal api data using - http://{}/Hdmicec.setAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.api_data_hdmicecsource))) + print("") + + # Compare the obtained response with actual response + if "Success" in str(create_device_response.text) and "Success" in str(create_api_overrides_response.text): + print("Inside Utils.py : Successfully pushed the initial data (setDeviceConfig & setAPIConfig) to Flask") + else: + print("Inside Utils.py : Failed to push the initial data (setDeviceConfig & setAPIConfig) to Flask") + + except: + print("Inside Utils.py : Exception in initialize_flask function") + +def initialize_flask(): + '''This function is used to push the initial data towards the Flask server''' + try: + # Push the initial cec network data to Flask using http get requests - setDeviceConfig API + create_device_response = requests.get("http://{}/Database.setDeviceConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.config_data))) + print("Inside Utils.py : " + create_device_response.text + " : " + str(Config.config_data)) + print("configured device data using - http://{}/Database.setDeviceConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.config_data))) + print("") + + # Push the api overrides data to Flask using http get requests - setAPIConfig API + create_api_overrides_response = requests.get("http://{}/Hdmicec.setAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.api_data))) + print("Inside Utils.py : " + create_api_overrides_response.text + " : " + str(Config.api_data)) + print("configured hal api data using - http://{}/Hdmicec.setAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.api_data))) + print("") + + # Compare the obtained response with actual response + if "Success" in str(create_device_response.text) and "Success" in str(create_api_overrides_response.text): + print("Inside Utils.py : Successfully pushed the initial data (setDeviceConfig & setAPIConfig) to Flask") + else: + print("Inside Utils.py : Failed to push the initial data (setDeviceConfig & setAPIConfig) to Flask") + + except: + print("Inside Utils.py : Exception in initialize_flask function") + +def initialize_hal_apis_with_negative_values(): + '''This function is used to push the initial data towards the Flask server''' + try: + # Push the initial cec network data to Flask using http get requests - setDeviceConfig API + create_device_response = requests.get("http://{}/Database.setDeviceConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.config_data))) + print("Inside Utils.py : " + create_device_response.text + " : " + str(Config.config_data)) + print("configured device data using - http://{}/Database.setDeviceConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.config_data))) + print("") + + # Push the api overrides data to Flask using http get requests - setAPIConfig API + create_api_overrides_response = requests.get("http://{}/Hdmicec.setAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.api_data_crash_instance))) + print("Inside Utils.py : " + create_api_overrides_response.text + " : " + str(Config.api_data_crash_instance)) + print("configured hal api data using - http://{}/Hdmicec.setAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.api_data_crash_instance))) + print("") + + # Compare the obtained response with actual response + if "Success" in str(create_device_response.text) and "Success" in str(create_api_overrides_response.text): + print("Inside Utils.py : Successfully pushed the initial data (setDeviceConfig & setAPIConfig) to Flask") + else: + print("Inside Utils.py : Failed to push the initial data (setDeviceConfig & setAPIConfig) to Flask") + + except: + print("Inside Utils.py : Exception in initialize_flask function") + +def send_curl_command(curl_command): + '''This function is used to send the curl commands to get the output response using os module''' + output_response = "" + try: + # Send the curl command using os.system module + response = os.popen(curl_command) + + # Find the line that is a valid JSON for extracting only the json response + for line in response.readlines(): + try: + # Try to parse the current line as JSON + json.loads(line) + output_response = line + # Exit the loop as we found the JSON line + break + except json.JSONDecodeError: + # If current line is not a valid JSON, just pass and continue with the next line + pass + + # Check the output response and add a message if the obtained output response is null + if len(output_response) < 5: + output_response = "< No response from WPEFramework >" + except: + print("Inside Utils.py : Exception in send_curl_command function") + finally: + # Return the output json response of given curl command as a string + return output_response + +#abort Device config with 5 different device configurations. +def abort_data(data): + print("Sending abort configurations") + create_device_response = requests.get("http://{}/Database.setDeviceConfig/{}".format(Config.flask_server_ip, json.dumps(data))) + print("Inside Utils.py : " + create_device_response.text + " : " + str(data)) + print("configured device data using - http://{}/Database.setDeviceConfig/{}".format( + Config.flask_server_ip, json.dumps(data))) + print("") + +def initialize_flask_without_audio_device(): + '''This function is used to push the initial data towards the Flask server''' + try: + # Push the initial cec network data to Flask using http get requests - setDeviceConfig API + create_device_response = requests.get("http://{}/Database.setDeviceConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.config_data_no_audio))) + print("Inside Utils.py : " + create_device_response.text + " : " + str(Config.config_data)) + print("configured device data using - http://{}/Database.setDeviceConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.config_data_no_audio))) + print("") + + # Push the api overrides data to Flask using http get requests - setAPIConfig API + create_api_overrides_response = requests.get("http://{}/Hdmicec.setAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.api_data))) + print("Inside Utils.py : " + create_api_overrides_response.text + " : " + str(Config.api_data)) + print("configured hal api data using - http://{}/Hdmicec.setAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.api_data))) + print("") + + # Compare the obtained response with actual response + if "Success" in str(create_device_response.text) and "Success" in str(create_api_overrides_response.text): + print( + "Inside Utils.py : Successfully pushed the initial data (setDeviceConfig & setAPIConfig) to Flask") + else: + print("Inside Utils.py : Failed to push the initial data (setDeviceConfig & setAPIConfig) to Flask") + + except: + print("Inside Utils.py : Exception in initialize_flask function") + +def restart_services(): + '''This function is used to kill the WPEFramework & Websocket services and to restart those''' + try: + # Kill the port WPEFramework with -QUIT to generate .gcda filek + os.system("killall -QUIT WPEFramework") + + # Kill the port 55555 which runs the WPEFramework + os.system("fuser -k 55555/tcp") + + # Kill the port 9000 which runs the Websocket server + os.system("fuser -k 9000/tcp") + + # Start the websocket server using python subprocess module + subprocess.Popen(["python3", "websocket_server.py"], cwd=Config.directory_websocket) + time.sleep(5) + subprocess.run(["chmod", "+x", "restart.sh"], check=True) + subprocess.Popen(["./restart.sh"], cwd=Config.WPEFramework_restart) + time.sleep(5) + # file_path = path.relpath(Config.WPEFramework_logs_path) + + # Open a file for writing the output and error of WPEFramework process + # with open(file_path, "w") as logfile: + + # Run the command to start the WPEFramework and redirect the output and error to the file + # subprocess.Popen(["WPEFramework", "-f", "-c", "config.json"], + # cwd=Config.directory_thunder, stdout=logfile, stderr=logfile) + # subprocess.Popen(["./restart.sh"], cwd=Config.WPEFramework_restart, stdout=logfile, stderr=logfile) + except: + print("Inside Utils.py : Exception in restart_services function") + +def netstat_output(): + + #Run the netstat -ntlp command + + output = subprocess.run(['netstat','-ntlp'],capture_output=True,text=True) + + #Return the output as a string + + return output.stdout + +def initialize_flask_with_HalApiNegativeValues(): + '''This function is used to push the initial data towards the Flask server''' + try: + # Push the initial cec network data to Flask using http get requests - setDeviceConfig API + create_device_response = requests.get("http://{}/Database.setDeviceConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.config_data))) + print("Inside Utils.py : " + create_device_response.text + " : " + str(Config.config_data)) + print("configured device data using - http://{}/Database.setDeviceConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.config_data))) + print("") + + # Push the api overrides data to Flask using http get requests - setAPIConfig API + create_api_overrides_response = requests.get("http://{}/Hdmicec.setAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.api_data_negative))) + print("Inside Utils.py : " + create_api_overrides_response.text + " : " + str(Config.api_data_negative)) + print("configured hal api data using - http://{}/Hdmicec.setAPIConfig/{}".format( + Config.flask_server_ip, json.dumps(Config.api_data_negative))) + print("") + + # Compare the obtained response with actual response + if "Success" in str(create_device_response.text) and "Success" in str(create_api_overrides_response.text): + print("Inside Utils.py : Successfully pushed the initial data (setDeviceConfig & setAPIConfig) to Flask") + else: + print("Inside Utils.py : Failed to push the initial data (setDeviceConfig & setAPIConfig) to Flask") + + except: + print("Inside Utils.py : Exception in initialize_flask function") diff --git a/Tests/L2HALMockTests/Test_Framework/lcovrc_halmock b/Tests/L2HALMockTests/Test_Framework/lcovrc_halmock new file mode 100644 index 00000000..879fe2ce --- /dev/null +++ b/Tests/L2HALMockTests/Test_Framework/lcovrc_halmock @@ -0,0 +1,181 @@ +# +# /etc/lcovrc - system-wide defaults for LCOV +# +# To change settings for a single user, place a customized copy of this file +# at location ~/.lcovrc +# + +# Specify an external style sheet file (same as --css-file option of genhtml) +#genhtml_css_file = gcov.css + +# Specify coverage rate limits (in %) for classifying file entries +# HI: hi_limit <= rate <= 100 graph color: green +# MED: med_limit <= rate < hi_limit graph color: orange +# LO: 0 <= rate < med_limit graph color: red +genhtml_hi_limit = 75 +genhtml_med_limit = 50 + +# Width of line coverage field in source code view +genhtml_line_field_width = 12 + +# Width of branch coverage field in source code view +genhtml_branch_field_width = 16 + +# Width of overview image (used by --frames option of genhtml) +genhtml_overview_width = 80 + +# Resolution of overview navigation: this number specifies the maximum +# difference in lines between the position a user selected from the overview +# and the position the source code window is scrolled to (used by --frames +# option of genhtml) +genhtml_nav_resolution = 4 + +# Clicking a line in the overview image should show the source code view at +# a position a bit further up so that the requested line is not the first +# line in the window. This number specifies that offset in lines (used by +# --frames option of genhtml) +genhtml_nav_offset = 10 + +# Do not remove unused test descriptions if non-zero (same as +# --keep-descriptions option of genhtml) +genhtml_keep_descriptions = 0 + +# Do not remove prefix from directory names if non-zero (same as --no-prefix +# option of genhtml) +genhtml_no_prefix = 0 + +# Do not create source code view if non-zero (same as --no-source option of +# genhtml) +genhtml_no_source = 0 + +# Replace tabs with number of spaces in source view (same as --num-spaces +# option of genhtml) +genhtml_num_spaces = 8 + +# Highlight lines with converted-only data if non-zero (same as --highlight +# option of genhtml) +genhtml_highlight = 0 + +# Include color legend in HTML output if non-zero (same as --legend option of +# genhtml) +genhtml_legend = 0 + +# Use FILE as HTML prolog for generated pages (same as --html-prolog option of +# genhtml) +#genhtml_html_prolog = FILE + +# Use FILE as HTML epilog for generated pages (same as --html-epilog option of +# genhtml) +#genhtml_html_epilog = FILE + +# Use custom filename extension for pages (same as --html-extension option of +# genhtml) +#genhtml_html_extension = html + +# Compress all generated html files with gzip. +#genhtml_html_gzip = 1 + +# Include sorted overview pages (can be disabled by the --no-sort option of +# genhtml) +genhtml_sort = 1 + +# Include function coverage data display (can be disabled by the +# --no-func-coverage option of genhtml) +#genhtml_function_coverage = 1 + +# Include branch coverage data display (can be disabled by the +# --no-branch-coverage option of genhtml) +#genhtml_branch_coverage = 1 + +# Specify the character set of all generated HTML pages +genhtml_charset=UTF-8 + +# Allow HTML markup in test case description text if non-zero +genhtml_desc_html=0 + +# Specify the precision for coverage rates +#genhtml_precision=1 + +# Show missed counts instead of hit counts +#genhtml_missed=1 + +# Demangle C++ symbols +#genhtml_demangle_cpp=1 + +# Name of the tool used for demangling C++ function names +#genhtml_demangle_cpp_tool = c++filt + +# Specify extra parameters to be passed to the demangling tool +#genhtml_demangle_cpp_params = "" + +# Location of the gcov tool (same as --gcov-info option of geninfo) +#geninfo_gcov_tool = gcov + +# Adjust test names to include operating system information if non-zero +#geninfo_adjust_testname = 0 + +# Calculate checksum for each source code line if non-zero (same as --checksum +# option of geninfo if non-zero, same as --no-checksum if zero) +#geninfo_checksum = 1 + +# Specify whether to capture coverage data for external source files (can +# be overridden by the --external and --no-external options of geninfo/lcov) +#geninfo_external = 1 + +# Enable libtool compatibility mode if non-zero (same as --compat-libtool option +# of geninfo if non-zero, same as --no-compat-libtool if zero) +#geninfo_compat_libtool = 0 + +# Use gcov's --all-blocks option if non-zero +#geninfo_gcov_all_blocks = 1 + +# Specify compatiblity modes (same as --compat option of geninfo). +#geninfo_compat = libtool=on, hammer=auto, split_crc=auto + +# Adjust path to source files by removing or changing path components that +# match the specified pattern (Perl regular expression format) +#geninfo_adjust_src_path = /tmp/build => /usr/src + +# Specify if geninfo should try to automatically determine the base-directory +# when collecting coverage data. +geninfo_auto_base = 1 + +# Use gcov intermediate format? Valid values are 0, 1, auto +geninfo_intermediate = auto + +# Specify if exception branches should be excluded from branch coverage. +geninfo_no_exception_branch = 0 + +# Directory containing gcov kernel files +# lcov_gcov_dir = /proc/gcov + +# Location of the insmod tool +lcov_insmod_tool = /sbin/insmod + +# Location of the modprobe tool +lcov_modprobe_tool = /sbin/modprobe + +# Location of the rmmod tool +lcov_rmmod_tool = /sbin/rmmod + +# Location for temporary directories +lcov_tmp_dir = /tmp + +# Show full paths during list operation if non-zero (same as --list-full-path +# option of lcov) +lcov_list_full_path = 0 + +# Specify the maximum width for list output. This value is ignored when +# lcov_list_full_path is non-zero. +lcov_list_width = 80 + +# Specify the maximum percentage of file names which may be truncated when +# choosing a directory prefix in list output. This value is ignored when +# lcov_list_full_path is non-zero. +lcov_list_truncate_max = 20 + +# Specify if function coverage data should be collected and processed. +lcov_function_coverage = 1 + +# Specify if branch coverage data should be collected and processed. +lcov_branch_coverage = 0 diff --git a/Tests/L2HALMockTests/Test_Framework/restart.sh b/Tests/L2HALMockTests/Test_Framework/restart.sh new file mode 100755 index 00000000..42b1ef67 --- /dev/null +++ b/Tests/L2HALMockTests/Test_Framework/restart.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +SCRIPT=$(readlink -f "$0") +SCRIPTS_DIR=`dirname "$SCRIPT"` +WORKSPACE=$SCRIPTS_DIR/../../../.. + +echo -e "${GREEN}========================================Run rdkservices===============================================${NC}" +cd $WORKSPACE +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH/usr/local/lib/:$WORKSPACE/deps/rdk/hdmicec/install/lib:$WORKSPACE/deps/rdk/hdmicec/ccec/drivers/test:$WORKSPACE/deps/rdk/iarmbus/install/:$WORKSPACE/install/usr/lib:$WORKSPACE/deps/rdk/devicesettings/install/lib +$WORKSPACE/install/usr/bin/WPEFramework -f -c $WORKSPACE/install/etc/WPEFramework/config.json & \ No newline at end of file