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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 139 additions & 0 deletions L2HalMock/README.md
Original file line number Diff line number Diff line change
@@ -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


18 changes: 18 additions & 0 deletions L2HalMock/README_CICD
Original file line number Diff line number Diff line change
@@ -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
127 changes: 127 additions & 0 deletions L2HalMock/Sample_Flask_Script.py
Original file line number Diff line number Diff line change
@@ -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)


Loading
Loading