Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
enshat opened this issue Apr 24, 2024 · 1 comment
Assignees

Comments

@enshat
Copy link

enshat commented Apr 24, 2024

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!

@dineshbaburam91
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants