TWSD-1381 - TCP module PDF output is not displayed in the expected format.

Review Request #1225 — Created Dec. 12, 2025 and submitted — Latest diff uploaded

shuinvy
APV10
rel_apv_10_7
TWSD-1381
austin, mingji, peteryeh, weikai

Prevent empty data cause the format of the PDF is incorrect.

The ticket link: https://arraynetworks.atlassian.net/browse/TWSD-1381

This ticket is difficult to reproduce, so I just added preventing exception mechanism.
What I did in this changes are:
In report.py:
1. Modify aligning logic for data of PDF. If the length of data list is greater than or equal the length of time list, then the data list will only return same length of time list.
For example:
data_list = [23, 20, 99]
time_list = ["2025-12-12 01:23:23", "2025-12-12 01:23:24"]
Because the length of time_list is 2,
the data_list will only return:
data_list = [23, 20]
Another example:
data_list = [23, 20]
time_list = ["2025-12-12 01:23:23", "2025-12-12 01:23:24", "2025-12-12 01:23:25", "2025-12-12 01:23:26"]
Because the length of time_list is 4,
the data_list will only return:
data_list = [23, 20, 0, 0]
2. Remove the condition, the original logic is: of there is none in the data_list, then we will return empty list [] for data_list.
After the changes, if the time_list is valid, then the data_list will return list based on the length of the time_list.
In write_monitor_to_db.py:
1. I just changed the regular expression pattern to prevent there are not only 1 space between the fields and the data.
The data like:
`AN#show statistics tcp all
Global Failed Connections Statistics:
0 port allocation failures
drop 0 syns by ours in use
drop 0 syns by over max connection
drop 0 syns by get mss error
drop 0 syns by bad mss size
drop 0 syns by eroute error
route 264 syns to system stack
0 syns was reset
0 connection confilicts
0 connection failures for connection table full
0 connection failures for fail to open local port
0 connection failures for fail to send syn

Global Statistics:
LISTEN: 4
SYN_SENT: 0
SYN_RCVD: 0
ESTABLISHED: 0
CLOSE_WAIT: 0
FIN_WAIT_1: 0
CLOSING: 0
LAST_ACK: 0
FIN_WAIT_2: 0
TIME_WAIT: 0

virtual service: vs_https
LISTEN: 0
SYN_SENT: 0
SYN_RCVD: 0
ESTABLISHED: 0
CLOSE_WAIT: 0
FIN_WAIT_1: 0
CLOSING: 0
LAST_ACK: 0
FIN_WAIT_2: 0
TIME_WAIT: 0
Original, I thought the space will only 1 before the data:LISTEN: 4Actually, there are 2 spaces before the data:LISTEN: 0`
So I changed the regex to catch the data no matter how many spaces before it.

    Loading...