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

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

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]#


Description From Last Updated

Are we scheduling the report generation tasks or it will be direct execution of report generation? I mean a user …

pmurugaiyanpmurugaiyan
shuinvy
  1. Ship It!
  2. 
      
pmurugaiyan
  1. 
      
  2. Are we scheduling the report generation tasks or it will be direct execution of report generation?

    I mean a user requests for last 1hr data - we can process it in seconds. But the longer duration data takes time to process, in that case how we are handling! If already handled via tasks, can you share the example to create, check status and download report (when available)!

    1. It is the same behaviour as before. We are saving the report details and then user can get the list of the report and also report details of with a particular report id also can be fetched.
      You can check this as part of the review https://reviewboard.arraynetworks.net/r/1111/.
      When user wants to generate report for a particular id, he can do that as shown the Testing section.
      All the report logs also can be fetched. Will create a design doc for this too

  3. 
      
apoorva.sn
Review request changed

Status: Closed (submitted)

Loading...