AE-2291: Reporting for Device Metrics for APV, ASF and AG

Review Request #1240 — Created Dec. 17, 2025 and submitted — Latest diff uploaded

apoorva.sn
AMP
amp_4_0
AE-2291
mmiriam, ngurunathan, pmurugaiyan, pradeep, shuinvy

Problem

Reporting for Device Metrics for APV, ASF and AG devices

Solution

Implemented the logic to create PDF report for Device status

Added changes to get the report info w.r.t report_id

Device Metrics

Save Report Data:

curl 'http://127.0.0.1:8000/report/save' \
-X POST \
-H 'Accept: application/json, text/plain, /' \
-H 'Content-Type: application/json' \
-H 'X-CSRFToken:2LdInH7Xqanl5jr5OzLow9ZrJOmVVvy5' \
-b 'csrftoken=2LdInH7Xqanl5jr5OzLow9ZrJOmVVvy5; hive_key=1; django_language=en; csrf_token=2LdInH7Xqanl5jr5OzLow9ZrJOmVVvy5; current_user=array; hive_sess=b594e7ee-fade-4af5-a35c-749fa58b9001' \
--data-raw '{
"name": "apv_device_metric_166",
"subject_type": "device_status",
"subject_name": "APV-166",
"device_ip": "192.168.162.166",
"device_type": "vAPV",
"from_time": "now-20d",
"to_time": "now"
}' \
--insecure

Response: {"message": "Report data saved successfully", "report_id": 3}

Generate Report:
[root@AN admin]# curl 'http://127.0.0.1:8000/report/3/generate' \
-X POST \
-H 'Accept: application/json, text/plain, /' \
-H 'Content-Type: application/json' \
-H 'X-CSRFToken:fmzGhuC0JpgfMfqtdrf9V7oksM5fZDy9' \
-b 'csrftoken=fmzGhuC0JpgfMfqtdrf9V7oksM5fZDy9; hive_key=1; django_language=en; csrf_token=fmzGhuC0JpgfMfqtdrf9V7oksM5fZDy9; current_user=array; hive_sess=08520a4c-02b3-484a-96f2-54b99b5ef13c' \
--data-raw '{}' \
--insecure
{"message": "Report generated successfully", "report_id": 3, "log_id": 31, "file_name": "Device_Status_Report_192.168.162.166_from_2025_11_27_21_02_32_to_2025_12_17_21_02_32.pdf", "file_size": 95853}[root@AN admin]#


    Loading...