networktocode/ntc-templates

FortiOS 6.4 get ha status

nelsonfree opened this issue · 7 comments

ISSUE TYPE
  • Bug Report
TEMPLATE USING
fortinet_get_system_ha_status.textfsm
SAMPLE COMMAND OUTPUT
No output
SUMMARY
STEPS TO REPRODUCE
Becasue in fortiOS 6.4, the display has been changed.
The "Master" device changed to "Primary"
The "Slave" device changed to "Secondary"
EXPECTED RESULTS
ACTUAL RESULTS

@nelsonfree can you provide the command you ran on the Fortinet to generate the output and the raw output from the device.
We can then use that to add an additional test case.

Hi,

get system ha status

HA Health Status: OK
Model: FortiGate
Mode: HA A-P
Group: 0
Debug: 0
Cluster Uptime: 40 days 19:16:5
Cluster state change time: 2021-10-12 11:24:28
Primary selected using:
<2021/10/12 11:24:28> FGXXXXXXXXXXXXXX is selected as the primary because it has the largest value of uptime.
<2021/09/30 14:23:14> FGXXXXXXXXXXXXXX is selected as the primary because it's the only member in the cluster.
ses_pickup: enable, ses_pickup_delay=disable
override: disable
Configuration Status:
FGXXXXXXXXXXXXXX(updated 5 seconds ago): in-sync
FGXXXXXXXXXXXXXX(updated 4 seconds ago): in-sync
System Usage stats:
FGXXXXXXXXXXXXXX(updated 5 seconds ago):
sessions=31, average-cpu-user/nice/system/idle=0%/0%/0%/99%, memory=21%
FGXXXXXXXXXXXXXX(updated 4 seconds ago):
sessions=1, average-cpu-user/nice/system/idle=0%/0%/0%/99%, memory=19%
HBDEV stats:
FGXXXXXXXXXXXXXX(updated 5 seconds ago):
ha1: physical/1000auto, up, rx-bytes/packets/dropped/errors=2331903443/16290391/0/0, tx=2864477616/16192604/0/0
FGXXXXXXXXXXXXXX(updated 4 seconds ago):
ha1: physical/1000auto, up, rx-bytes/packets/dropped/errors=2903932192/16487841/0/0, tx=2291801577/15994696/0/0
MONDEV stats:
FGXXXXXXXXXXXXXX(updated 5 seconds ago):
LAN: aggregate/00, up, rx-bytes/packets/dropped/errors=515688432/224905809/0/0, tx=973281315/15326089/0/0
WAN: aggregate/00, up, rx-bytes/packets/dropped/errors=2329268140/249384307/0/0, tx=1740434745/10897044/0/0
FGXXXXXXXXXXXXXX(updated 4 seconds ago):
LAN: aggregate/00, up, rx-bytes/packets/dropped/errors=1437258973/405727633/0/0, tx=0/0/0/0
WAN: aggregate/00, up, rx-bytes/packets/dropped/errors=1119476884/410223012/0/0, tx=0/0/0/0
Primary : FW, FGXXXXXXXXXXXXXX, HA cluster index = 0
Secondary : FW, FGXXXXXXXXXXXXXX, HA cluster index = 1
number of vcluster: 1
vcluster 1: work 169.254.0.1
Primary: FGXXXXXXXXXXXXXX, HA operating index = 0
Secondary: FGXXXXXXXXXXXXXX, HA operating index = 1

The above is the result from 6.4

@nelsonfree updated parsing, added test, waiting for PR to be reviewed.
#1041

Hi,
We got error again:
Traceback (most recent call last):
File "check_fw_status.py", line 131, in
result_system_ha.append(print_fortigate_save(command[1],device_name ,device['ip']))
File "check_fw_status.py", line 15, in print_fortigate_save
output=ssh_connect.send_command(command, use_textfsm=True)
File "/home/sxladmin/.local/lib/python3.6/site-packages/netmiko/utilities.py", line 500, in wrapper_decorator
return func(self, *args, **kwargs)
File "/home/sxladmin/.local/lib/python3.6/site-packages/netmiko/base_connection.py", line 1554, in send_command
template=textfsm_template,
File "/home/sxladmin/.local/lib/python3.6/site-packages/netmiko/utilities.py", line 347, in get_structured_data
return _textfsm_parse(textfsm_obj, raw_output, attrs)
File "/home/sxladmin/.local/lib/python3.6/site-packages/netmiko/utilities.py", line 319, in _textfsm_parse
textfsm_obj.ParseCmd(raw_output, attrs)
File "/home/sxladmin/.local/lib/python3.6/site-packages/netmiko/_textfsm/_clitable.py", line 272, in ParseCmd
self.table = self._ParseCmdItem(self.raw, template_file=template_files[0])
File "/home/sxladmin/.local/lib/python3.6/site-packages/netmiko/_textfsm/_clitable.py", line 303, in _ParseCmdItem
for record in fsm.ParseText(cmd_input):
File "/home/sxladmin/.local/lib/python3.6/site-packages/textfsm/parser.py", line 897, in ParseText
self._CheckLine(line)
File "/home/sxladmin/.local/lib/python3.6/site-packages/textfsm/parser.py", line 946, in _CheckLine
if self._Operations(rule, line):
File "/home/sxladmin/.local/lib/python3.6/site-packages/textfsm/parser.py", line 1027, in _Operations
% (rule.line_num, line))
textfsm.parser.TextFSMError: State Error raised. Rule Line: 54. Input Line: Primary selected using:

Hi, We got error again: Traceback (most recent call last): File "check_fw_status.py", line 131, in result_system_ha.append(print_fortigate_save(command[1],device_name ,device['ip'])) File "check_fw_status.py", line 15, in print_fortigate_save output=ssh_connect.send_command(command, use_textfsm=True) File "/home/sxladmin/.local/lib/python3.6/site-packages/netmiko/utilities.py", line 500, in wrapper_decorator return func(self, *args, **kwargs) File "/home/sxladmin/.local/lib/python3.6/site-packages/netmiko/base_connection.py", line 1554, in send_command template=textfsm_template, File "/home/sxladmin/.local/lib/python3.6/site-packages/netmiko/utilities.py", line 347, in get_structured_data return _textfsm_parse(textfsm_obj, raw_output, attrs) File "/home/sxladmin/.local/lib/python3.6/site-packages/netmiko/utilities.py", line 319, in _textfsm_parse textfsm_obj.ParseCmd(raw_output, attrs) File "/home/sxladmin/.local/lib/python3.6/site-packages/netmiko/_textfsm/_clitable.py", line 272, in ParseCmd self.table = self._ParseCmdItem(self.raw, template_file=template_files[0]) File "/home/sxladmin/.local/lib/python3.6/site-packages/netmiko/_textfsm/_clitable.py", line 303, in _ParseCmdItem for record in fsm.ParseText(cmd_input): File "/home/sxladmin/.local/lib/python3.6/site-packages/textfsm/parser.py", line 897, in ParseText self._CheckLine(line) File "/home/sxladmin/.local/lib/python3.6/site-packages/textfsm/parser.py", line 946, in _CheckLine if self._Operations(rule, line): File "/home/sxladmin/.local/lib/python3.6/site-packages/textfsm/parser.py", line 1027, in _Operations % (rule.line_num, line)) textfsm.parser.TextFSMError: State Error raised. Rule Line: 54. Input Line: Primary selected using:

Hi, I have fixed it

Let's track in #1041