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
101 changes: 101 additions & 0 deletions .github/workflows/L2-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: L2 Integration Tests

on:
pull_request:
branches: [ develop ]

env:
AUTOMATICS_UNAME: ${{ secrets.AUTOMATICS_UNAME }}
AUTOMATICS_PASSCODE: ${{ secrets.AUTOMATICS_PASSCODE }}

jobs:
execute-L2-tests-on-pr:
name: Execute L2 test suite in L2 container environment
runs-on: ubuntu-latest

steps:
- name: Checkout code rfc code
uses: actions/checkout@v4
with:
path: remote_debugger

- name: Check out dependent repostiories
uses: actions/checkout@v4
with:
repository: 'rdkcentral/rfc'
token: ${{ secrets.GH_ACTION_PULL }}
path: rfc

- name: Check out dependent repostiories
uses: actions/checkout@v4
with:
repository: 'rdkcentral/iarmmgrs'
token: ${{ secrets.GH_ACTION_PULL }}
path: iarmmgrs

- name: Check out dependent repostiories
uses: actions/checkout@v4
with:
repository: 'rdkcentral/iarmbus'
token: ${{ secrets.GH_ACTION_PULL }}
path: iarmbus

- name: Check out dependent repostiories
uses: actions/checkout@v4
with:
repository: 'rdkcentral/tr69hostif'
token: ${{ secrets.GH_ACTION_PULL }}
path: tr69hostif

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Pull docker images
run: |
docker pull ghcr.io/rdkcentral/docker-device-mgt-service-test/mockxconf:latest
docker pull ghcr.io/rdkcentral/docker-device-mgt-service-test/native-platform:latest
docker pull ghcr.io/rdkcentral/docker-rdk-ci:latest

- name: Start mock-xconf service
run: |
docker run -d --name mockxconf -p 50050:50050 -p 50051:50051 -p 50052:50052 -p 50054:50054 -v ${{ github.workspace }}:/mnt/L2_CONTAINER_SHARED_VOLUME ghcr.io/rdkcentral/docker-device-mgt-service-test/mockxconf:latest

- name: Start l2-container service
run: |
docker run -d --name native-platform --link mockxconf -v ${{ github.workspace }}:/mnt/L2_CONTAINER_SHARED_VOLUME ghcr.io/rdkcentral/docker-device-mgt-service-test/native-platform:latest


- name: Move dependent repositories in native-platform container to /usr
run: |
docker exec -i native-platform /bin/bash -c "mv /mnt/L2_CONTAINER_SHARED_VOLUME/rfc /usr/ && mv /mnt/L2_CONTAINER_SHARED_VOLUME/iarmmgrs /usr/ && mv /mnt/L2_CONTAINER_SHARED_VOLUME/iarmbus /usr/ && mv /mnt/L2_CONTAINER_SHARED_VOLUME/tr69hostif /usr/"

- name: Enter Inside Platform native container and run L2 Test
run: |
docker exec -i native-platform /bin/bash -c "cd /mnt/L2_CONTAINER_SHARED_VOLUME/remote_debugger && sh cov_build.sh && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/lib/aarch64-linux-gnu:/usr/local/lib: && find / -name downloadUtil.h && ls -l && sh run_l2.sh"

- name: Copy l2 test results to runner
run: |
docker cp native-platform:/tmp/l2_test_report /tmp/L2_TEST_RESULTS
ls -l
ls -l /tmp/L2_TEST_RESULTS

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
install: true

- name: Run CI container
run: docker run -e AUTOMATICS_UNAME=${{ secrets.AUTOMATICS_UNAME }} -e AUTOMATICS_PASSCODE=${{ secrets.AUTOMATICS_PASSCODE }} -v ${{ github.workspace }}:/mnt/L2_CONTAINER_SHARED_VOLUME --name ci-container -d ghcr.io/rdkcentral/docker-rdk-ci:latest tail -f /dev/null

- name: Upload results
if: github.repository_owner == 'rdkcentral'
run: |
docker cp /tmp/L2_TEST_RESULTS ci-container:/tmp/L2_TEST_RESULTS
docker exec -i ci-container bash -c "echo 'Contents in workspace directory' && ls -l && echo '===============================' && echo 'Contents in /tmp/L2_TEST_RESULTS' && ls -l /tmp/L2_TEST_RESULTS && echo '===============================' && git config --global --add safe.directory /mnt/L2_CONTAINER_SHARED_VOLUME/remote_debugger && gtest-json-result-push.py /tmp/L2_TEST_RESULTS https://rdkeorchestrationservice.apps.cloud.comcast.net/rdke_orchestration_api/push_unit_test_results /mnt/L2_CONTAINER_SHARED_VOLUME/remote_debugger"
46 changes: 43 additions & 3 deletions .github/workflows/native_full_build.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Build Component in Native Environment

on:
pull_request:
branches: [ develop ]
paths: ['**/*.c', '**/*.cpp', '**/*.cc', '**/*.cxx', '**/*.h', '**/*.hpp']
workflow_dispatch:
inputs:
branch:
description: 'Branch to build'
required: true
default: 'develop'

jobs:
build-systemtimemgr-on-pr:
Expand All @@ -15,8 +18,45 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
path: remote_debugger

- name: Checkout code rfc code
uses: actions/checkout@v4
with:
path: remote_debugger

- name: Check out dependent repostiories
uses: actions/checkout@v4
with:
repository: 'rdkcentral/rfc'
token: ${{ secrets.GH_ACTION_PULL }}
path: rfc

- name: Check out dependent repostiories
uses: actions/checkout@v4
with:
repository: 'rdkcentral/iarmmgrs'
token: ${{ secrets.GH_ACTION_PULL }}
path: iarmmgrs

- name: Check out dependent repostiories
uses: actions/checkout@v4
with:
repository: 'rdkcentral/iarmbus'
token: ${{ secrets.GH_ACTION_PULL }}
path: iarmbus

- name: Check out dependent repostiories
uses: actions/checkout@v4
with:
repository: 'rdkcentral/tr69hostif'
token: ${{ secrets.GH_ACTION_PULL }}
path: tr69hostif


- name: native build
run: |
cd remote_debugger
chmod +x cov_build.sh
sh -e cov_build.sh
66 changes: 58 additions & 8 deletions cov_build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,49 @@
##########################################################################
# If not stated otherwise in this file or this component's LICENSE
# file the following copyright and licenses apply:
#
# Copyright 2018 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.
##########################################################################

WORKDIR=`pwd`
# Build and install critical dependency
export ROOT=/usr
export INSTALL_DIR=${ROOT}/local
export INSTALL_DIR=/usr/local
mkdir -p $INSTALL_DIR
#Build rfc


# Build tr181api from rfc source code
cd ${ROOT}
git clone https://github.com/rdkcentral/rfc.git

# Clone all dependencies if not present already
if [ ! -d rfc ]; then
git clone https://github.com/rdkcentral/rfc.git
fi

if [ ! -d iarmmgrs ]; then
git clone https://github.com/rdkcentral/iarmmgrs.git
fi

if [ ! -d iarmbus ]; then
git clone https://github.com/rdkcentral/iarmbus.git
fi

if [ ! -d tr69hostif ]; then
git clone https://github.com/rdkcentral/tr69hostif.git
fi

cd rfc
autoreconf -i
./configure --enable-rfctool=yes --enable-tr181set=yes
Expand All @@ -16,18 +54,30 @@ cd /usr/rfc/tr181api
g++ -fPIC -shared -o libtr181api.so tr181api.cpp -I/usr/local/include/wdmp-c
mv ./libtr181api.so /usr/local/lib
cp ./tr181api.h /usr/local/include

# Install header files alone from armmgrs repositories
cd $ROOT
rm -rf iarmmgrs
rm -rf iarmbus
git clone https://github.com/rdkcentral/iarmmgrs.git

cp /usr/iarmmgrs/rdmmgr/include/rdmMgr.h /usr/local/include
git clone https://github.com/rdkcentral/iarmbus.git

# Install header files alone from iarmbus repositories
cp /usr/iarmbus/core/include/libIBusDaemon.h /usr/local/include
cp /usr/iarmbus/core/include/libIBus.h /usr/local/include
cp /usr/iarmbus/core/libIARMCore.h /usr/local/include
cp /usr/iarmmgrs/hal/include/pwrMgr.h /usr/local/include/

# Build and install stubs from tr69hostif

cd tr69hostif
cd ./src/unittest/stubs
g++ -fPIC -shared -o libIARMBus.so iarm_stubs.cpp -I/usr/tr69hostif/src/hostif/parodusClient/pal -I/usr/tr69hostif/src/unittest/stubs -I/usr/tr69hostif/src/hostif/parodusClient/waldb -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/tr69hostif/src/hostif/include -I/usr/tr69hostif/src/hostif/profiles/DeviceInfo -I/usr/tr69hostif/src/hostif/parodusClient/pal -fpermissive
cp libIARMBus.so /usr/local/lib
cp libIBus.h /usr/local/include
cp libIARM.h /usr/local/include

cd $WORKDIR
autoreconf -i
autoupdate
./configure --prefix=${INSTALL_DIR}
./configure --prefix=${INSTALL_DIR} --enable-iarmbusSupport=yes
make remotedebugger_CFLAGS="-I/usr/include/cjson -I/usr/local/include/wdmp-c -I/usr/local/include/rbus -I/usr/local/include -I/usr/local/include/trower-base64" remotedebugger_LDFLAGS="-L/usr/local/lib -lrdkloggers -lcjson -lrfcapi -lrbus -lmsgpackc -lsecure_wrapper -lwebconfig_framework -lIARMBus -ltr181api -L/usr/local/lib/x86_64-linux-gnu -ltrower-base64 -L/usr/lib/x86_64-linux-gnu"
make install
24 changes: 22 additions & 2 deletions remote_debugger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,27 @@
},
"Sanity": {
"Check" : {
"Commands" : [ "rm -rf ", "kill ", "pkill ", "iptables ", "ip6tables " ]
"Commands" : [ "rm -rf", "kill", "pkill", "iptables", "ip6tables" ]
}
},
"Device" : {
"Info" : {
"Commands": "cat /version.txt;cat /etc/device.properties;uname -r",
"Timeout" : 10
},
"Uptime" : {
"Commands": "uptime",
"Timeout" : 10
},
"Dump" : {
"Commands": "tcpdump -w RRD_LOCATION/capture.pcap &",
"Timeout" : 10
}
},
"Command" : {
"Harm" : {
"Commands": "rm -rf",
"Timeout" : 10
}
},
"Process" : {
Expand All @@ -20,4 +40,4 @@
"Timeout" : 10
}
}
}
}
70 changes: 70 additions & 0 deletions run_l2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/bin/sh
####################################################################################
# If not stated otherwise in this file or this component's Licenses.txt 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.
####################################################################################

RESULT_DIR="/tmp/l2_test_report"
STATIC_PROFILE_DIR="/etc/rrd"
OUTPUT_DIR="/tmp/rrd"
LIB_DIR="/lib/rdk"

mkdir -p "$RESULT_DIR"
mkdir -p "$OUTPUT_DIR"
mkdir -p "$STATIC_PROFILE_DIR"
mkdir -p "$LIB_DIR"

apt-get remove systemd
apt-get update && apt-get install -y tcpdump

echo "LOG_PATH=/opt/logs" >> /etc/include.properties
cp remote_debugger.json /etc/rrd/remote_debugger.json
cp scripts/uploadRRDLogs.sh /lib/rdk/uploadRRDLogs.sh
chmod -R 777 /lib/rdk/uploadRRDLogs.sh
sed -i 's/remote-debugger\.log/remotedebugger\.log\.0/g' /lib/rdk/uploadRRDLogs.sh

cp test/functional-tests/tests/uploadSTBLogs.sh /lib/rdk/uploadSTBLogs.sh
chmod -R 777 /lib/rdk/uploadRRDLogs.sh

cp scripts/systemd-run /usr/local/bin/systemd-run
chmod -R 777 /usr/local/bin/systemd-run
ln -s /usr/local/bin/systemd-run /usr/bin/systemd-run

touch /usr/local/bin/systemctl
chmod -R 777 /usr/local/bin/systemctl
ln -s /usr/local/bin/systemctl /usr/bin/systemctl

touch /usr/local/bin/journalctl
chmod -R 777 /usr/local/bin/journalctl
ln -s /usr/local/bin/journalctl /usr/bin/journalctl

rm -rf /tmp/rrd/*
rm -rf /opt/logs/remotedebugger.log*

# Run L2 Test cases
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rrd_single_instance.json test/functional-tests/tests/test_rrd_single_instance.py
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rrd_start_control.json test/functional-tests/tests/test_rrd_start_control.py
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rrd_start_subscribe_and_wait.json test/functional-tests/tests/test_rrd_start_subscribe_and_wait.py
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rrd_static_profile_report.json test/functional-tests/tests/test_rrd_static_profile_report.py
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rrd_corrupted_static_profile_report.json test/functional-tests/tests/test_rrd_corrupted_static_profile_report.py
cp remote_debugger.json /etc/rrd/
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rrd_harmfull_static_profile_report.json test/functional-tests/tests/test_rrd_harmful_command_static_report.py
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rrd_static_profile_category_report.json test/functional-tests/tests/test_rrd_static_profile_category_report.py
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rrd_empty_event.json test/functional-tests/tests/test_rrd_empty_issuetype_event.py
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rrd_static_profile_missing_command_report.json test/functional-tests/tests/test_rrd_static_profile_missing_command_report.py
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rrd_background_cmd_static_profile_report.json test/functional-tests/tests/test_rrd_background_cmd_static_profile_report.py
pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/rrd_debug_report_upload.json test/functional-tests/tests/test_rrd_debug_report_upload.py
Loading