napalm-automation-community / napalm-arubaos-switch

NAPALM driver for ArubaOS-Switch
MIT License
16 stars 9 forks source link

method "get_facts" fails if no ip dns domain-name is configured on Aruba Switch #11

Closed saruter closed 2 years ago

saruter commented 3 years ago

Expected Behavior

Getting the facts from Aruba Switch shows Firmware, Hostname etc.

Actual Behavior

Napalm is failing with error:

`2021-10-20 17:28:43,604 - napalm - ERROR - method - Failed: list index out of range

================= Traceback =================

Traceback (most recent call last): File "/home/username/napalm/bin/napalm", line 8, in sys.exit(main()) File "/home/username/napalm/lib64/python3.6/site-packages/napalm/base/clitools/cl_napalm.py", line 308, in main run_tests(args) File "/home/username/napalm/lib64/python3.6/site-packages/napalm/base/clitools/cl_napalm.py", line 291, in run_tests call_getter(device, args.method, *method_kwargs) File "/home/username/napalm/lib64/python3.6/site-packages/napalm/base/clitools/cl_napalm.py", line 27, in wrapper r = func(args, kwargs) File "/home/username/napalm/lib64/python3.6/site-packages/napalm/base/clitools/cl_napalm.py", line 255, in call_getter r = func(kwargs) File "/home/username/napalm/lib64/python3.6/site-packages/napalm_arubaoss/ArubaOS.py", line 260, in get_facts rest_out['dns_domain_names'][0] IndexError: list index out of range `

Steps to Reproduce the Problem

  1. Configure Aruba Switch with no set "ip dns domain-name "
  2. Excecute napalm --user <username --password <password --vendor arubaoss <hostname> call get_facts
  3. Error shown above.
  4. get_facts works when configuring ip dns domain-name <yourdomainnamehere>

Specifications

Aruba Switch: JL320A 2930M-24G-PoE+ Software Version: WC.16.10.0016

Output of API Endpoint /dns which is crawled via get_facts:

Output from debug Ansible URI Module: When "ip dns domain-name is configured:

"output.json": {
        "dns_config_mode": "DCM_MANUAL",
        "dns_domain_names": [
            "mylocaldomain.de"
        ],
        "server_1": null,
        "server_2": null,
        "server_3": null,
        "server_4": null,
        "uri": "/dns"
    }

When ip dns domain-name is not configured:

"output.json": {
        "dns_config_mode": "DCM_DHCP",
        "dns_domain_names": [],
        "server_1": null,
        "server_2": null,
        "server_3": null,
        "server_4": null,
        "uri": "/dns"
    }
gcotone commented 3 years ago

Hi @saruter ,

Thanks for the bug report. We'll look into it. Which version are you using?

saruter commented 3 years ago

Hi, version of switch firmware is WC.16.10.0016, versions of all Python-Modules are as follows (created a fresh venv and installed only napalm and napalm-arubaoss and its dependencies via pip):

napalm: 3.3.1 napalm-arubaos-switch: 0.1.1

(napalm) [user@server napalm]$ pip freeze
aiocontextvars==0.2.2
bcrypt==3.2.0
certifi==2021.10.8
cffi==1.15.0
charset-normalizer==2.0.7
ciscoconfparse==1.5.50
colorama==0.4.4
contextvars==2.4
cryptography==35.0.0
dnspython==2.1.0
future==0.18.2
idna==3.3
immutables==0.16
importlib-resources==5.3.0
Jinja2==3.0.2
junos-eznc==2.6.3
loguru==0.5.3
lxml==4.6.3
MarkupSafe==2.0.1
napalm==3.3.1
napalm-arubaos-switch==0.1.1
ncclient==0.6.9
netaddr==0.8.0
netmiko==3.4.0
ntc-templates==2.3.2
paramiko==2.8.0
passlib==1.7.4
pycparser==2.20
pyeapi==0.8.4
PyNaCl==1.4.0
pyparsing==2.4.7
pyserial==3.5
PyYAML==6.0
requests==2.26.0
requests-toolbelt==0.9.1
scp==0.14.1
six==1.16.0
tenacity==8.0.1
textfsm==1.1.2
transitions==0.8.10
typing-extensions==3.10.0.2
urllib3==1.26.7
yamlordereddictloader==0.4.0
zipp==3.6.0
gcotone commented 2 years ago

This should be fixed in v0.2.0