Skip to content

Commit c43ff88

Browse files
RDK-55408: RDKE Services L2 Test Suite Development (#30)
* L2HalMock Intergration * UTILS_PATH in env.sh * Add files via upload * iarmmgr build update * Added Test folder * Removed Patch files * iarmbus Build path added * Update on L2HalMock * Removed other plugins --------- Co-authored-by: apatel859 <[email protected]>
1 parent 666e185 commit c43ff88

File tree

147 files changed

+16481
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+16481
-0
lines changed

L2HalMock/README.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
2+
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
3+
4+
5+
6+
# Utils dependencis for ubuntu 22.04 machine
7+
------------------------------------------------
8+
9+
10+
11+
12+
## Generic dependencies
13+
---------------------
14+
sudo apt install -y git
15+
16+
pip install flake8
17+
18+
sudo pip install peru
19+
20+
sudo apt-get install -y libtool
21+
22+
suod apt install -y autoconf
23+
24+
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa -y
25+
26+
sudo apt update
27+
28+
sudo apt install -y g++-9 gcc-9
29+
30+
sudo apt-get install -y libglib2.0-dev
31+
32+
sudo apt-get install -y libdbus-1-dev
33+
34+
sudo apt-get install -y curl
35+
36+
37+
# Install system-level dependencies
38+
RUN apt-get update && \
39+
apt-get install -y \
40+
git \
41+
wget \
42+
vim \
43+
build-essential \
44+
libtool \
45+
autoconf \
46+
g++-9 \
47+
gcc-9 \
48+
libglib2.0-dev \
49+
libdbus-1-dev \
50+
curl \
51+
cmake \
52+
ninja-build \
53+
net-tools \
54+
netcat \
55+
psmisc \
56+
libusb-1.0-0-dev \
57+
zlib1g-dev \
58+
libssl-dev \
59+
python3-pip \
60+
libjsoncpp-dev \
61+
libjansson4 \
62+
libjansson-dev \
63+
libcurl4-openssl-dev \
64+
libwebsocketpp-dev \
65+
libwebsockets-dev \
66+
libboost-all-dev
67+
68+
# Create a directory in the image where you want to copy the files
69+
RUN mkdir -p /usr/lib/aarch64-linux-gnu/
70+
71+
# Copy files from the host machine to the image
72+
RUN cp -r /usr/lib/x86_64-linux-gnu/dbus-1.0 /usr/lib/aarch64-linux-gnu/
73+
74+
# Copy the custom config files to the appropriate location in the image
75+
COPY dbus/system.conf /usr/share/dbus-1/system.conf
76+
COPY dbus/session.conf /usr/share/dbus-1/session.conf
77+
78+
79+
## Thuder dependencies
80+
--------------------
81+
sudo apt install -y build-essential cmake ninja-build libusb-1.0-0-dev zlib1g-dev libssl-dev
82+
83+
sudo apt install -y python3-pip
84+
85+
pip install jsonref
86+
87+
## Hdmicec emulator hal dependencies
88+
----------------------------------
89+
sudo apt-get install -y libjsoncpp-dev
90+
91+
sudo apt-get install -y libjansson4 libjansson-dev
92+
93+
sudo apt-get install -y libcurl4-openssl-dev
94+
95+
sudo apt-get install -y libwebsocketpp-dev
96+
97+
sudo apt-get install -y libwebsockets-dev
98+
99+
pip install websockets
100+
101+
sudo apt-get install -y libboost-all-dev
102+
103+
## flask server dependencies
104+
----------------------------
105+
sudo pip install pandas
106+
107+
sudo pip install beautifulsoup4
108+
109+
sudo pip install flask
110+
111+
sudo pip install colorama
112+
113+
--------------------------------------------------
114+
# pre-setup
115+
# clone rdk-e/rdkservices repository
116+
# After cloning rdkservices.git, clone the repository https://github.com/rdk-e/FLASK-FOR-HAL-MOCK
117+
# switch to branch peru, copy the peru.yaml file present insde the repo to L2HalMock folder inside rdkservices
118+
119+
# Build step
120+
-----------------------------------------------
121+
./build.sh
122+
123+
# Using Debug Build we can build individual modules
124+
-----------------------------------------------
125+
./debug_build.sh
126+
127+
# Execute the framework
128+
-----------------------------------------------
129+
./run.sh
130+
131+
# For executing test scripts
132+
-----------------------------------------------
133+
cd workspace/deps/rdk/flask/Test_Framework
134+
135+
update details in Config.py
136+
137+
python3 TestManager.py
138+
139+

L2HalMock/README_CICD

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
README FOR CI CD HAL MOCK WORKFLOW
2+
3+
4+
5+
--> 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.
6+
--> A pull request/push on from a branch to sprint,release,develop and main triggers the HAL_MOCK yml.
7+
--> 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.
8+
--> 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.
9+
--> Workflow steps are:-
10+
--> pull the customized docker from JFROG artifactory.
11+
--> clone and build the required binaries for the mock environment inside docker.
12+
--> make all services up
13+
--> execute the currently developed testcases (L2) on Hdmicec source.
14+
--> generate a test report containing the execution details.
15+
--> fetch the report, upload it as an artifact.
16+
--> users can download this test report artifact from the executed job summary.
17+
--> stop all services
18+
--> Destroy the container/Docker

L2HalMock/Sample_Flask_Script.py

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
#** *****************************************************************************
2+
# *
3+
# * If not stated otherwise in this file or this component's LICENSE file the
4+
# * following copyright and licenses apply:
5+
# *
6+
# * Copyright 2024 RDK Management
7+
# *
8+
# * Licensed under the Apache License, Version 2.0 (the "License");
9+
# * you may not use this file except in compliance with the License.
10+
# * You may obtain a copy of the License at
11+
# *
12+
# *
13+
# http://www.apache.org/licenses/LICENSE-2.0
14+
# *
15+
# * Unless required by applicable law or agreed to in writing, software
16+
# * distributed under the License is distributed on an "AS IS" BASIS,
17+
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
# * See the License for the specific language governing permissions and
19+
# * limitations under the License.
20+
# *
21+
#* ******************************************************************************
22+
23+
import requests
24+
import json
25+
26+
flask_server = "127.0.0.1:8000"
27+
28+
config_data = {
29+
"apiName": "setDeviceConfig",
30+
"arguments": {
31+
"devices": [
32+
{
33+
"device": [
34+
{"name": "xione_uk"},
35+
{"islocal": 1},
36+
{"type": "source"},
37+
{"powerState": 1},
38+
{"physicalAddress": "301"},
39+
{"logicalAddress": "3"},
40+
{"vendorId": "4567"},
41+
{"osdName": "404753747265616D696E672054776F"},
42+
{"optionalProperty1": "value1"},
43+
{"optionalProperty2": "value2"}
44+
]
45+
},
46+
{
47+
"device": [
48+
{"name": "amazon fire stick"},
49+
{"islocal": 0},
50+
{"type": "source"},
51+
{"powerState": 1},
52+
{"physicalAddress": "304"},
53+
{"logicalAddress": "4"},
54+
{"vendorId": "4567"},
55+
{"osdName": "53747265616D696E67204F6E65"},
56+
{"optionalProperty1": "value1"},
57+
{"optionalProperty2": "value2"}
58+
]
59+
},
60+
{
61+
"device": [
62+
{"name": "amazon fire stick"},
63+
{"islocal": 0},
64+
{"type": "source"},
65+
{"powerState": 1},
66+
{"physicalAddress": "304"},
67+
{"logicalAddress": "9"},
68+
{"vendorId": "4567"},
69+
{"osdName": "53747265616D696E67204F6E65"},
70+
{"optionalProperty1": "value1"},
71+
{"optionalProperty2": "value2"}
72+
]
73+
},
74+
{
75+
"device": [
76+
{"name": "hisense"},
77+
{"islocal": 0},
78+
{"type": "sink"},
79+
{"powerState": 1},
80+
{"physicalAddress": "0"},
81+
{"logicalAddress": "0"},
82+
{"vendorId": "0x4567"},
83+
{"osdName": "545620426F78"},
84+
{"optionalProperty1": "value1"},
85+
{"optionalProperty2": "value2"}
86+
]
87+
}
88+
]
89+
}
90+
}
91+
92+
api_data = {
93+
"apiName": "setAPIConfig",
94+
"arguments": {
95+
"apiOverrides": [
96+
{
97+
"HdmiCecOpen": [
98+
{ "return": 1 },
99+
{ "outParams": [{"handle": 2345678}] }
100+
]
101+
},
102+
{
103+
"HdmiCecGetLogicalAddress": [
104+
{ "return": 0 },
105+
{ "outParams": [{"logicalAddress": "0x4"}] }
106+
]
107+
},
108+
{
109+
"HdmiCecGetPhysicalAddress": [
110+
{ "return": 0 },
111+
{ "outParams": [{"physicalAddress": "0x304"}] }
112+
]
113+
}
114+
]
115+
}
116+
}
117+
118+
119+
# fetch the cec network data from flask using http get requests
120+
createDevice_response = requests.get("http://{}/Database.setDeviceConfig/{}".format(flask_server, json.dumps(config_data)))
121+
print(createDevice_response.text)
122+
123+
# fetch the api overrides data from flask using http get requests
124+
createApiOverrides_response = requests.get("http://{}/Hdmicec.setAPIConfig/{}".format(flask_server, json.dumps(api_data)))
125+
print(createApiOverrides_response.text)
126+
127+

0 commit comments

Comments
 (0)