Skip to content

Commit d8ab897

Browse files
author
mtirum011
committed
RDK-59249 [RDKE][RDM] Added rdmFileupload.js File and Log Changes for RDM
1 parent ad45f6d commit d8ab897

File tree

6 files changed

+50
-12
lines changed

6 files changed

+50
-12
lines changed

.github/workflows/verify-build.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Verify building of test containers
22

33
on:
44
pull_request:
5-
branches: [ "develop" , "topic/RDKE-765" ]
5+
branches: [ develop , topic/RDK-59249 ]
66

77
env:
88
REGISTRY_ROOT: ghcr.io
@@ -110,12 +110,33 @@ jobs:
110110
111111
- name: Start mock-xconf service
112112
run: |
113-
docker run -d --name mockxconf -p 50050:50050 -p 50051:50051 -p 50052:50052 -p 50053:50053 -p 50054:50054 -v ${{ github.workspace }}:/mnt/L2_CONTAINER_SHARED_VOLUME ghcr.io/rdkcentral/docker-device-mgt-service-test/mockxconf:latest
113+
docker run -d --name mockxconf -p 50050:50050 -p 50051:50051 -p 50052:50052 -p 50053:50053 -p 50054:50054 -p 50055:50055 -v ${{ github.workspace }}:/mnt/L2_CONTAINER_SHARED_VOLUME ghcr.io/rdkcentral/docker-device-mgt-service-test/mockxconf:latest
114114
115115
- name: Start native-platform service
116116
run: |
117117
docker run -d --name native-platform -p 9090:9090 --link mockxconf -v ${{ github.workspace }}:/mnt/L2_CONTAINER_SHARED_VOLUME ghcr.io/rdkcentral/docker-device-mgt-service-test/native-platform:latest
118118
119+
- name: Check rdmFileupload.js
120+
run: docker exec mockxconf ls -l /usr/local/bin/rdmFileupload.js || echo "Script missing"
121+
122+
- name: Run rdmFileupload.js
123+
run: docker exec -d mockxconf node /usr/local/bin/rdmFileupload.js || echo "Background start failed"
124+
125+
- name: Verify rdmFileupload.js process
126+
run: |
127+
echo "Checking background processes..."
128+
docker exec mockxconf ps aux | grep rdmFileupload || echo "rdmFileupload.js not running"
129+
130+
- name: Show mockxconf container logs
131+
run: docker logs mockxconf
132+
133+
- name: Install net-tools in mockxconf
134+
run: |
135+
echo "Installing net-tools inside mockxconf..."
136+
docker exec mockxconf apt-get update -y
137+
docker exec mockxconf apt-get install -y net-tools
138+
docker exec mockxconf netstat -tuln | head -n 10
139+
119140
- name: Start Testing
120141
run: |
121142
docker ps && docker ps -a

compose.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ services:
88
- "50051:50051"
99
- "50052:50052"
1010
- "50053:50053"
11+
- "50055:50055"
1112
volumes:
1213
- ../:/mnt/L2_CONTAINER_SHARED_VOLUME
14+
environment:
15+
- ENABLE_MTLS=true
1316

1417

1518
l2-container:
@@ -26,7 +29,9 @@ services:
2629
- SYS_ADMIN
2730
security_opt:
2831
- seccomp=unconfined
29-
- apparmor=unconfined
32+
- apparmor=unconfined
33+
environment:
34+
- ENABLE_MTLS=true
3035

3136
nmap-container:
3237
image: "ghcr.io/rdkcentral/docker-device-mgt-service-test/native-platform:latest"

mock-xconf/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ EXPOSE 50051
9494
EXPOSE 50052
9595
EXPOSE 50053
9696
EXPOSE 50054
97-
97+
EXPOSE 50055

mock-xconf/entrypoint.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,7 @@ node /usr/local/bin/rfcData.js &
4343

4444
node /usr/local/bin/rrdFileupload.js &
4545

46+
node /usr/local/bin/rdmFileupload.js &
47+
4648
## Keep the container running . Running an independent process will help in simulating scenarios of webservices going down and coming up
47-
while true ; do echo "Mocked webservice heartbeat ..." && sleep 5 ; done
49+
while true ; do echo "Mocked webservice heartbeat Updated for RDM AGENT..." && sleep 5 ; done

mock-xconf/rdmFileupload.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
console.log('Start of RDM Upload js file');
2+
13
const https = require('node:https');
24
const path = require('node:path');
35
const fs = require('node:fs');
46
const url = require('node:url');
7+
const { applyMtlsConfig } = require('./server-utils');
58

69
const pathupdated = require('path');
710
const FILE_ROOT = '/tmp/RDM';
@@ -12,12 +15,17 @@ let saved_XconfJson = {};
1215
let saveReportJson = false;
1316
let saved_ReportJson = {};
1417

18+
console.log('Before of applymtls js file');
19+
1520
const options = {
1621
key: fs.readFileSync(path.join('/etc/xconf/certs/mock-xconf-server-key.pem')),
1722
cert: fs.readFileSync(path.join('/etc/xconf/certs/mock-xconf-server-cert.pem')),
18-
port: 50056
23+
port: 50055
1924
};
2025

26+
// Apply mTLS settings if enabled using the centralized utility
27+
applyMtlsConfig(options);
28+
2129
function handleAdminSupportReport(req, res) {
2230
const queryObject = url.parse(req.url, true).query;
2331
if (queryObject.saveRequest === 'true') {
@@ -150,9 +158,11 @@ function requestHandler(req, res) {
150158
}
151159
}
152160

161+
console.log('End of rdm upload js file');
162+
153163
const serverinstance = https.createServer(options, requestHandler);
154-
serverinstance.listen(options.port, () => {
155-
console.log('RDM Data Upload Mock Server running at https://localhost:50056/');
164+
serverinstance.listen(options.port, '0.0.0.0', () => {
165+
console.log(`RDM Data Upload Mock Server running at https://0.0.0.0:${options.port}/`);
156166
});
157167

158168
serverinstance.on('error', (err) => {

test_docker.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
CONTAINERS = ["mockxconf", "native-platform"]
1010

1111
# Define expected open ports for mockxconf only (since you want IPv6 check for mockxconf)
12-
MOCKXCONF_EXPECTED_PORTS = [50050, 50051, 50052, 50053, 50054] # Example IPv6 ports for mockxconf
12+
MOCKXCONF_EXPECTED_PORTS = [50050, 50051, 50052, 50053, 50054, 50055] # Example IPv6 ports for mockxconf
1313

1414
# Define expected files in each container
1515
EXPECTED_FILES = {
@@ -46,7 +46,7 @@ def test_ports_are_open_ipv6_mockxconf(container):
4646
print(f"✅ Port {port} is open in {container.name}")
4747

4848
def test_node_processes_running_mockxconf(container):
49-
"""Ensure exactly 5 Node.js processes are running inside mockxconf."""
49+
"""Ensure exactly 6 Node.js processes are running inside mockxconf."""
5050
if container.name != "mockxconf":
5151
pytest.skip(f"Skipping Node.js process check for {container.name}")
5252

@@ -60,8 +60,8 @@ def test_node_processes_running_mockxconf(container):
6060
node_process_count = int(output.strip()) # Convert output to integer
6161
print(f"Found {node_process_count} Node.js processes running in {container.name}")
6262

63-
assert node_process_count == 5, f"Expected 5 Node.js processes, but found {node_process_count}!"
64-
print(f"✅ All 5 Node.js processes are running in {container.name}")
63+
assert node_process_count == 6, f"Expected 6 Node.js processes, but found {node_process_count}!"
64+
print(f"✅ All 6 Node.js processes are running in {container.name}")
6565

6666
def test_files_exist(container):
6767
"""Verify that expected files exist in the respective container."""

0 commit comments

Comments
 (0)