Fish Trophy

apoorva.sn got a fish trophy!

AE-2177: Reporting Framework and LLB report generation

Review Request #1111 — Created Oct. 23, 2025 and submitted

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

Problem

Reporting Framework changes done for a given from and to time
LLB Reporting logic revamp

Solution

Have made Framework changes to replace the composer part where we are storing the data related to the report in our Postgres DB.
Have made changes for LLB PDF generation logic to get the data send from postgred db now and update the PDF.

Reporting API Responses

Save Report Data:

[root@AN admin]# 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:HdvgwtzOvDqGQHQrxYv92hRrlBkc1zkR' \
-b 'csrftoken=HdvgwtzOvDqGQHQrxYv92hRrlBkc1zkR; hive_key=1; django_language=en; csrf_token= HdvgwtzOvDqGQHQrxYv92hRrlBkc1zkR; current_user=array; hive_sess=5f576def-12b5-4091-9f30-34f2b91f3227' \
--data-raw '{
"name": "LLB_Link_Report",
"subject_type": "service_status",
"subject_name": "llbStats",
"device_ip": "192.168.162.166",
"from_time": "now-20d",
"to_time": "now"
}' \
--insecure
{"message": "Report data saved successfully", "report_id": 5}[root@AN admin]

Update Report Data:

[root@AN admin]# curl 'http://127.0.0.1:8000/report/5' \
-X PUT \
-H 'Accept: application/json, text/plain, /' \
-H 'Content-Type: application/json' \
-H 'X-CSRFToken: SThEgbmN0qUC0RPqEG15BjfvW1MlJ6QX' \
-b 'csrftoken= SThEgbmN0qUC0RPqEG15BjfvW1MlJ6QX; hive_key=1; django_language=en; csrf_token= SThEgbmN0qUC0RPqEG15BjfvW1MlJ6QX; current_user=array; hive_sess=0562e5c8-c837-4a53-87e6-7af74fdd0951' \
--data-raw '{
"name": "LLB_Link_Health_Report",
"subject_type": "service_status",
"subject_name": "llbStats(LLB)",
"device_ip": "192.168.162.166",
"from_time": "now-20d",
"to_time": "now"
}' \
--insecure
{"message": "Report 5 updated successfully"}

Get all Report data

[root@AN admin]# curl 'http://127.0.0.1:8000/report' \
-X GET \
-H 'Accept: application/json' \
-H 'X-CSRFToken:PkaZg4BktJpQSjhB9Fne2mVz4LZVSXbD' \
-b 'csrftoken=PkaZg4BktJpQSjhB9Fne2mVz4LZVSXbD; hive_key=1; django_language=en; csrf_token=PkaZg4BktJpQSjhB9Fne2mVz4LZVSXbD; current_user=array; hive_sess=0ee8403a-b073-46cb-af6e-2e57270d9858' \
--insecure
{"reports": [{"id": 5, "name": "LLB_Link_Health_Report", "subject_type": "service_status", "subject_name": "llbStats(LLB)", "device_ip": "192.168.162.166", "from_time": "now-20d", "to_time": "now", "send_to": null}]}

Generate Report:

[root@AN admin]# curl 'http://127.0.0.1:8000/report/5/generate' \
-X POST \
-H 'Accept: application/json, text/plain, /' \
-H 'Content-Type: application/json' \
-H 'X-CSRFToken:HGGNKyHN8effl6m2YXjClNpZKzJ6KG4H' \
-b 'csrftoken=HGGNKyHN8effl6m2YXjClNpZKzJ6KG4H; hive_key=1; django_language=en; csrf_token=HGGNKyHN8effl6m2YXjClNpZKzJ6KG4H; current_user=array; hive_sess=afd2bc2d-6a5c-4497-9f29-ca7fc995cf6b' \
--data-raw '{}' \
--insecure
{"message": "Report generated successfully", "report_id": 5, "log_id": 16, "file_name": "LLB_Statistics_Report_from_2025_10_03_20_36_20_to_2025_10_23_20_36_20.pdf", "file_size": 96802}

Download Report:

[root@AN admin]# curl 'http://127.0.0.1:8000/report/download?filename=LLB_Statistics_Report_from_2025_10_03_20_36_20_to_2025_10_23_20_36_20.pdf' \
-X GET \
-H 'Accept: application/octet-stream' \
-H 'X-CSRFToken: HGGNKyHN8effl6m2YXjClNpZKzJ6KG4H' \
-b 'csrftoken= HGGNKyHN8effl6m2YXjClNpZKzJ6KG4H; hive_key=1; django_language=en; csrf_token= HGGNKyHN8effl6m2YXjClNpZKzJ6KG4H; current_user=array; hive_sess=afd2bc2d-6a5c-4497-9f29-ca7fc995cf6b' \
--output 'LLB_Statistics_Report2.pdf' \
--insecure
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 96802 0 96802 0 0 30.7M 0 --:--:-- --:--:-- --:--:-- 30.7M

GET the services:

[root@AN admin]# curl 'http://127.0.0.1:8000/cm/services' \
-X POST \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'X-CSRFToken:hftBhPiXdTcDfSz8csfaNyuoqacYIvq8' \
-b 'csrftoken=hftBhPiXdTcDfSz8csfaNyuoqacYIvq8; hive_key=1; django_language=en; csrf_token=hftBhPiXdTcDfSz8csfaNyuoqacYIvq8; current_user=array; hive_sess=9f717a5a-669f-4be6-a21a-b225efc16a65' \
--data-raw '{
"serviceType": "virtualService",
"device_ip": "192.168.162.166"
}' \
--insecure
{"services": ["vs1"]}[root@AN admin]#
[root@AN admin]#

[root@AN admin]# curl 'http://127.0.0.1:8000/cm/services' -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-CSRFToken:hftBhPiXdTcDfSz8csfaNyuoqacYIvq8' -b 'csrftoken=hftBhPiXdTcDfSz8csfaNyuoqacYIvq8; hive_key=1; django_language=en; csrf_token=hftBhPiXdTcDfSz8csfaNyuoqacYIvq8; current_user=array; hive_sess=9f717a5a-669f-4be6-a21a-b225efc16a65' --data-raw '{
"serviceType": "realService",
"device_ip": "192.168.162.166"
}' --insecure
{"services": ["RS1"]}[root@AN admin]#
[root@AN admin]#
[root@AN admin]#
[root@AN admin]#

[root@AN admin]# curl 'http://127.0.0.1:8000/cm/services' -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-CSRFToken:hftBhPiXdTcDfSz8csfaNyuoqacYIvq8' -b 'csrftoken=hftBhPiXdTcDfSz8csfaNyuoqacYIvq8; hive_key=1; django_language=en; csrf_token=hftBhPiXdTcDfSz8csfaNyuoqacYIvq8; current_user=array; hive_sess=9f717a5a-669f-4be6-a21a-b225efc16a65' --data-raw '{
"serviceType": "LLB",
"device_ip": "192.168.162.166"
}' --insecure
{"services": ["VLAN-162", "VLAN-163"]}[root@AN admin]#


Description From Last Updated

are we hardcoding the password here ? is "Array@123$" password is fixed?

pradeeppradeep

yes for now.. once the integration is done for amp4. we can plan to have .env files loaded as part …

apoorva.snapoorva.sn

what will be the report_name if Report generation failed?

pradeeppradeep
apoorva.sn
apoorva.sn
pradeep
  1. 
      
  2. are we hardcoding the password here ? is "Array@123$" password is fixed?

  3. 
      
apoorva.sn
  1. 
      
  2. yes for now.. once the integration is done for amp4. we can plan to have .env files loaded as part of the VM itself.

  3. 
      
pradeep
  1. 
      
  2. what will be the report_name if Report generation failed?

  3. 
      
apoorva.sn
pradeep
  1. Ship It!
  2. 
      
shuinvy
  1. Ship It!
  2. 
      
apoorva.sn
Review request changed

Status: Closed (submitted)

Loading...