py-junos-eznc icon indicating copy to clipboard operation
py-junos-eznc copied to clipboard

get_facts() returns 'None' for some values in host info for MX with dual-re, when re0 in 'Present' state

Open enshat opened this issue 2 months ago • 1 comments

I have a dual-re mx104. Re0 failed and primary role transited to re1. I'm gathering correct information about re states and who's master, but not for the following values:

 'fqdn': None,
 'hostname': None,
 'model': None,
 'personality': None,

This is an example of the correct information collected:

{'2RE': True,
 'HOME': '/var/home/user',
 'RE0': {'last_reboot_reason': None,
         'mastership_state': 'Present',
         'model': None,
         'status': None,
         'up_time': None},
 'RE1': {'last_reboot_reason': 'Router rebooted after a normal shutdown.',
         'mastership_state': 'master',
         'model': 'RE-MX-104',
         'status': 'OK',
         'up_time': '2612 days, 13 hours, 18 minutes, 1 second'},
 'RE_hw_mi': False,
 'current_re': ['re1', 'master', 'node', 'fwdd', 'member', 'pfem'],
 'master': 'RE1',
 'model_info': {'re0': 'MX104'},
 're_info': {'default': {'0': {'last_reboot_reason': None,
                               'mastership_state': 'Present',
                               'model': None,
                               'status': None},
                         '1': {'last_reboot_reason': 'Router rebooted after a '
                                                     'normal shutdown.',
                               'mastership_state': 'master',
                               'model': 'RE-MX-104',
                               'status': 'OK'},
                         'default': {'last_reboot_reason': None,
                                     'mastership_state': 'Present',
                                     'model': None,
                                     'status': None}}},
 're_master': {'default': '1'},

I modified junos/facts/get_software_information.py by adding one more check if re_name is the RE we are currently connected to into get_facts(device)

        # 2) re_name is in the current_re fact. The easy case.
        elif re_name in device.facts['current_re']:
            this_re = True
        # 2.5) Check when 're0' inserted and in 'Present' state, 're1' is master and in the current_re fact.
        elif (re_name == 're0' and 're1' in device.facts['current_re'] and
              'master' in device.facts['current_re']):
            this_re = True
            re_name = 're1'

Please let me know if you need the entire output of print(dev.facts) or any other details.

Thanks!

enshat avatar Apr 24 '24 15:04 enshat

Kindly update the version of the device and complete gather_fact output.

dineshbaburam91 avatar May 03 '24 09:05 dineshbaburam91