ansible-collections / netapp.ontap

Ansible collection to support NetApp ONTAP configuration.
https://galaxy.ansible.com/netapp/ontap
GNU General Public License v3.0
56 stars 36 forks source link

Net Routes module returns inconsistent output and display #99

Closed ndennis-Insight closed 2 years ago

ndennis-Insight commented 2 years ago

Summary

When attempting to create a route, using both ZAPI and REST, I am returned different results every time I run the same task. The true outcome of the task can end up removing the routes, not modifying the routes when the output states it does, or not adding the routes when the output states it does.

When using REST I typically get back large errors that state they're getting "unexpected responses" for only some of my loop iterations but not others when they generally all should be the same. Even then, the ones that return "ok" are not actually creating the route.

When using ZAPI, I add in the "metric" parameter as well as "use_rest: never".

Component Name

na_ontap_net_routes

Ansible Version

$ ansible --version

ansible [core 2.13.2]
  config file = /home/ndennis/_GIT/ansible-netapp-basic/ansible.cfg
  configured module search path = ['/home/ndennis/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/ndennis/.local/lib/python3.8/site-packages/ansible
  ansible collection location = /home/ndennis/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/ndennis/.local/bin/ansible
  python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
  jinja version = 3.1.2
  libyaml = True

ONTAP Collection Version

$ ansible-galaxy collection list

Collection                    Version
----------------------------- -------
amazon.aws                    3.3.1
ansible.netcommon             3.0.1
ansible.posix                 1.4.0
ansible.utils                 2.6.1
ansible.windows               1.10.0
arista.eos                    5.0.1
awx.awx                       21.2.0
azure.azcollection            1.13.0
check_point.mgmt              2.3.0
chocolatey.chocolatey         1.3.0
cisco.aci                     2.2.0
cisco.asa                     3.1.0
cisco.dnac                    6.5.0
cisco.intersight              1.0.19
cisco.ios                     3.2.0
cisco.iosxr                   3.2.0
cisco.ise                     2.5.0
cisco.meraki                  2.10.0
cisco.mso                     2.0.0
cisco.nso                     1.0.3
cisco.nxos                    3.1.0
cisco.ucs                     1.8.0
cloud.common                  2.1.2
cloudscale_ch.cloud           2.2.2
community.aws                 3.4.0
community.azure               1.1.0
community.ciscosmb            1.0.5
community.crypto              2.4.0
community.digitalocean        1.21.0
community.dns                 2.2.1
community.docker              2.7.0
community.fortios             1.0.0
community.general             5.3.0
community.google              1.0.0
community.grafana             1.5.0
community.hashi_vault         3.0.0
community.hrobot              1.4.0
community.libvirt             1.1.0
community.mongodb             1.4.1
community.mysql               3.3.0
community.network             4.0.1
community.okd                 2.2.0
community.postgresql          2.1.5
community.proxysql            1.4.0
community.rabbitmq            1.2.1
community.routeros            2.1.0
community.sap                 1.0.0
community.sap_libs            1.1.0
community.skydive             1.0.0
community.sops                1.2.3
community.vmware              2.7.0
community.windows             1.10.0
community.zabbix              1.7.0
containers.podman             1.9.4
cyberark.conjur               1.1.0
cyberark.pas                  1.0.14
dellemc.enterprise_sonic      1.1.1
dellemc.openmanage            5.5.0
dellemc.os10                  1.1.1
dellemc.os6                   1.0.7
dellemc.os9                   1.0.4
f5networks.f5_modules         1.18.0
fortinet.fortimanager         2.1.5
fortinet.fortios              2.1.6
frr.frr                       2.0.0
gluster.gluster               1.0.2
google.cloud                  1.0.2
hetzner.hcloud                1.8.1
hpe.nimble                    1.1.4
ibm.qradar                    2.0.0
infinidat.infinibox           1.3.3
infoblox.nios_modules         1.3.0
inspur.sm                     2.0.0
junipernetworks.junos         3.1.0
kubernetes.core               2.3.2
mellanox.onyx                 1.0.0
netapp.aws                    21.7.0
netapp.azure                  21.10.0
netapp.cloudmanager           21.18.0
netapp.elementsw              21.7.0
netapp.ontap                  21.20.0
netapp.storagegrid            21.10.0
netapp.um_info                21.8.0
netapp_eseries.santricity     1.3.0
netbox.netbox                 3.7.1
ngine_io.cloudstack           2.2.4
ngine_io.exoscale             1.0.0
ngine_io.vultr                1.1.2
openstack.cloud               1.8.0
openvswitch.openvswitch       2.1.0
ovirt.ovirt                   2.1.0
purestorage.flasharray        1.13.0
purestorage.flashblade        1.9.0
purestorage.fusion            1.0.2
sensu.sensu_go                1.13.1
servicenow.servicenow         1.0.6
splunk.es                     2.0.0
t_systems_mms.icinga_director 1.30.0
theforeman.foreman            3.4.0
vmware.vmware_rest            2.2.0
vyos.vyos                     3.0.1
wti.remote                    1.0.4

# /home/ndennis/.ansible/collections/ansible_collections
Collection         Version
------------------ -------
cloud.common       2.1.2
community.general  5.3.0
community.vmware   2.7.0
netapp.ontap       21.21.0
vmware.vmware_rest 2.2.0

ONTAP Version

AUTOCLUSTER::> version
NetApp Release 9.8P7: Tue Sep 14 18:38:58 UTC 2021

Playbook

- name: Create routes for SVM subnets
      netapp.ontap.na_ontap_net_routes:
        state: present
        #use_rest: never
        vserver: '{{ item.vserver }}'
        destination: '{{ item.destination }}'
        gateway: '{{ item.gateway }}'
        #metric: '{{ item.metric }}'
      loop: '{{ routes }}'
      tags: ['routes']

Steps to Reproduce

ansible-playbook playbook.yaml --tags routes

#Variables used for the routes task
routes:
  - vserver: AUTOSVM
    destination: "0.0.0.0/0"
    gateway: "10.206.13.1"
    metric: 20
  - vserver: AUTOSVM
    destination: "0.0.0.0/0"
    gateway: "10.206.34.1"
    metric: 30
  - vserver: AUTOSVM
    destination: "0.0.0.0/0"
    gateway: "10.206.35.1"
    metric: 30
  - vserver: AUTOSVM
    destination: "0.0.0.0/0"
    gateway: "10.206.50.1"
    metric: 30

Expected Results

I expect to run this command once, and all the routes be created. When I run it a second time, I expect to get back all "ok" output with no changes.

Actual Results

ndennis@e4ubnt1dev01:~/_GIT/ansible-netapp-basic$ ansible-playbook playbook.yaml --tags routes -vvvv
ansible-playbook [core 2.13.2]
  config file = /home/ndennis/_GIT/ansible-netapp-basic/ansible.cfg
  configured module search path = ['/home/ndennis/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/ndennis/.local/lib/python3.8/site-packages/ansible
  ansible collection location = /home/ndennis/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/ndennis/.local/bin/ansible-playbook
  python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
  jinja version = 3.1.2
  libyaml = True
Using /home/ndennis/_GIT/ansible-netapp-basic/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /home/ndennis/_GIT/ansible-netapp-basic/inventory.yaml as it did not pass its verify_file() method
script declined parsing /home/ndennis/_GIT/ansible-netapp-basic/inventory.yaml as it did not pass its verify_file() method
Parsed /home/ndennis/_GIT/ansible-netapp-basic/inventory.yaml inventory source with yaml plugin
[WARNING]: While constructing a mapping from /home/ndennis/_GIT/ansible-netapp-basic/validate-input.yaml, line 59, column 3, found a duplicate dict key (when). Using last defined value only.
statically imported: /home/ndennis/_GIT/ansible-netapp-basic/validate-input.yaml
Loading collection netapp.ontap from /home/ndennis/.ansible/collections/ansible_collections/netapp/ontap
statically imported: /home/ndennis/_GIT/ansible-netapp-basic/validate-input.yaml
Loading callback plugin default of type stdout, v2.0 from /home/ndennis/.local/lib/python3.8/site-packages/ansible/plugins/callback/default.py
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: playbook.yaml **********************************************************************************************************************************************************************************************************
Positional arguments: playbook.yaml
verbosity: 4
connection: smart
timeout: 10
become_method: sudo
tags: ('routes',)
inventory: ('/home/ndennis/_GIT/ansible-netapp-basic/inventory.yaml',)
forks: 5
2 plays in playbook.yaml

PLAY [Configure NetApp ONTAP nodes] **********************************************************************************************************************************************************************************************
Trying secret FileVaultSecret(filename='/home/ndennis/_GIT/ansible-vault-netapp.txt') for vault_id=default
META: ran handlers
META: ran handlers
META: ran handlers

PLAY [Configure NetApp ONTAP cluster] ********************************************************************************************************************************************************************************************
META: ran handlers

TASK [Create routes for SVM subnets] *********************************************************************************************************************************************************************************************
task path: /home/ndennis/_GIT/ansible-netapp-basic/playbook.yaml:136
<cluster> ESTABLISH LOCAL CONNECTION FOR USER: ndennis
<cluster> EXEC /bin/sh -c 'echo ~ndennis && sleep 0'
<cluster> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/ndennis/.ansible/tmp `"&& mkdir "` echo /home/ndennis/.ansible/tmp/ansible-tmp-1661983928.6154995-571276-56454154702103 `" && echo ansible-tmp-1661983928.6154995-76-56454154702103="` echo /home/ndennis/.ansible/tmp/ansible-tmp-1661983928.6154995-571276-56454154702103 `" ) && sleep 0'
<cluster> Attempting python interpreter discovery
<cluster> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'python3.10'"'"'; command -v '"'"'python3.9'"'"'; command -v '"'"'python3.8'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; comm-v '"'"'python3.5'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python'"'"'; echo ENDFOUNDsleep 0'
<cluster> EXEC /bin/sh -c '/usr/bin/python3.8 && sleep 0'
Using module file /home/ndennis/.ansible/collections/ansible_collections/netapp/ontap/plugins/modules/na_ontap_net_routes.py
<cluster> PUT /home/ndennis/.ansible/tmp/ansible-local-571269h00wuegs/tmpqqmrtm59 TO /home/ndennis/.ansible/tmp/ansible-tmp-1661983928.6154995-571276-56454154702103/AnsiballZ_na_ontap_net_routes.py
<cluster> EXEC /bin/sh -c 'chmod u+x /home/ndennis/.ansible/tmp/ansible-tmp-1661983928.6154995-571276-56454154702103/ /home/ndennis/.ansible/tmp/ansible-tmp-1661983928.6154995-571276-56454154702103/AnsiballZ_na_ontap_net_route && sleep 0'
<cluster> EXEC /bin/sh -c '/usr/bin/python3 /home/ndennis/.ansible/tmp/ansible-tmp-1661983928.6154995-571276-56454154702103/AnsiballZ_na_ontap_net_routes.py && sleep 0'
<cluster> EXEC /bin/sh -c 'rm -f -r /home/ndennis/.ansible/tmp/ansible-tmp-1661983928.6154995-571276-56454154702103/ > /dev/null 2>&1 && sleep 0'
failed: [cluster] (item={'vserver': 'AUTOSVM', 'destination': '0.0.0.0/0', 'gateway': '10.206.13.1', 'metric': 20}) => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    },
    "ansible_loop_var": "item",
    "changed": false,
    "invocation": {
        "module_args": {
            "cert_filepath": null,
            "destination": "0.0.0.0/0",
            "feature_flags": {},
            "from_destination": null,
            "from_gateway": null,
            "from_metric": null,
            "gateway": "10.206.13.1",
            "hostname": "e6ntap3c.datalinklabs.local",
            "http_port": null,
            "https": true,
            "key_filepath": null,
            "metric": null,
            "ontapi": null,
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "state": "present",
            "use_rest": "always",
            "username": "admin",
            "validate_certs": false,
            "vserver": "AUTOSVM"
        }
    },
    "item": {
        "destination": "0.0.0.0/0",
        "gateway": "10.206.13.1",
        "metric": 20,
        "vserver": "AUTOSVM"
    },
    "msg": "calling: network/ip/routes: unexpected response {'records': [{'uuid': 'ad24e48e-23f3-11ed-b383-00a098d73412', 'scope': 'svm', 'svm': {'uuid': '925b8890-18cd-11ed-b383-00a098d73412', 'name': 'AUTOSVM', '_links': {'s: {'href': '/api/svm/svms/925b8890-18cd-11ed-b383-00a098d73412'}}}, 'destination': {'address': '0.0.0.0', 'netmask': '0', 'family': 'ipv4'}, 'gateway': '10.206.13.1', '_links': {'self': {'href': '/api/network/ip/routes/ad24e48f3-11ed-b383-00a098d73412'}}}, {'uuid': 'b7824372-2973-11ed-b383-00a098d73412', 'scope': 'svm', 'svm': {'uuid': '925b8890-18cd-11ed-b383-00a098d73412', 'name': 'AUTOSVM', '_links': {'self': {'href': '/api/svm/svms/925b8890-18ced-b383-00a098d73412'}}}, 'destination': {'address': '0.0.0.0', 'netmask': '0', 'family': 'ipv4'}, 'gateway': '10.206.13.1', '_links': {'self': {'href': '/api/network/ip/routes/b7824372-2973-11ed-b383-00a098d73412'}}}], 'num_rds': 2, '_links': {'self': {'href': '/api/network/ip/routes?destination.address=0.0.0.0&gateway=10.206.13.1&scope=svm&svm.name=AUTOSVM&fields=destination%2Cgateway%2Csvm%2Cscope'}}}. for query: {'destination.address': '0.0.0.0gateway': '10.206.13.1', 'scope': 'svm', 'svm.name': 'AUTOSVM', 'fields': 'destination,gateway,svm,scope'}"
}
<cluster> EXEC /bin/sh -c 'echo ~ndennis && sleep 0'
<cluster> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/ndennis/.ansible/tmp `"&& mkdir "` echo /home/ndennis/.ansible/tmp/ansible-tmp-1661983929.2620718-571276-243342407345700 `" && echo ansible-tmp-1661983929.2620718276-243342407345700="` echo /home/ndennis/.ansible/tmp/ansible-tmp-1661983929.2620718-571276-243342407345700 `" ) && sleep 0'
Using module file /home/ndennis/.ansible/collections/ansible_collections/netapp/ontap/plugins/modules/na_ontap_net_routes.py
<cluster> PUT /home/ndennis/.ansible/tmp/ansible-local-571269h00wuegs/tmpj7036hav TO /home/ndennis/.ansible/tmp/ansible-tmp-1661983929.2620718-571276-243342407345700/AnsiballZ_na_ontap_net_routes.py
<cluster> EXEC /bin/sh -c 'chmod u+x /home/ndennis/.ansible/tmp/ansible-tmp-1661983929.2620718-571276-243342407345700/ /home/ndennis/.ansible/tmp/ansible-tmp-1661983929.2620718-571276-243342407345700/AnsiballZ_na_ontap_net_roupy && sleep 0'
<cluster> EXEC /bin/sh -c '/usr/bin/python3 /home/ndennis/.ansible/tmp/ansible-tmp-1661983929.2620718-571276-243342407345700/AnsiballZ_na_ontap_net_routes.py && sleep 0'
<cluster> EXEC /bin/sh -c 'rm -f -r /home/ndennis/.ansible/tmp/ansible-tmp-1661983929.2620718-571276-243342407345700/ > /dev/null 2>&1 && sleep 0'
ok: [cluster] => (item={'vserver': 'AUTOSVM', 'destination': '0.0.0.0/0', 'gateway': '10.206.34.1', 'metric': 30}) => {
    "ansible_loop_var": "item",
    "changed": false,
    "invocation": {
        "module_args": {
            "cert_filepath": null,
            "destination": "0.0.0.0/0",
            "feature_flags": {},
            "from_destination": null,
            "from_gateway": null,
            "from_metric": null,
            "gateway": "10.206.34.1",
            "hostname": "e6ntap3c.datalinklabs.local",
            "http_port": null,
            "https": true,
            "key_filepath": null,
            "metric": null,
            "ontapi": null,
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "state": "present",
            "use_rest": "always",
            "username": "admin",
            "validate_certs": false,
            "vserver": "AUTOSVM"
        }
    },
    "item": {
        "destination": "0.0.0.0/0",
        "gateway": "10.206.34.1",
        "metric": 30,
        "vserver": "AUTOSVM"
    },
    "modify": false,
    "rename": false
}
<cluster> EXEC /bin/sh -c 'echo ~ndennis && sleep 0'
<cluster> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/ndennis/.ansible/tmp `"&& mkdir "` echo /home/ndennis/.ansible/tmp/ansible-tmp-1661983929.6894813-571276-205282702788807 `" && echo ansible-tmp-1661983929.6894813276-205282702788807="` echo /home/ndennis/.ansible/tmp/ansible-tmp-1661983929.6894813-571276-205282702788807 `" ) && sleep 0'
Using module file /home/ndennis/.ansible/collections/ansible_collections/netapp/ontap/plugins/modules/na_ontap_net_routes.py
<cluster> PUT /home/ndennis/.ansible/tmp/ansible-local-571269h00wuegs/tmpbtrr9tqg TO /home/ndennis/.ansible/tmp/ansible-tmp-1661983929.6894813-571276-205282702788807/AnsiballZ_na_ontap_net_routes.py
<cluster> EXEC /bin/sh -c 'chmod u+x /home/ndennis/.ansible/tmp/ansible-tmp-1661983929.6894813-571276-205282702788807/ /home/ndennis/.ansible/tmp/ansible-tmp-1661983929.6894813-571276-205282702788807/AnsiballZ_na_ontap_net_roupy && sleep 0'
<cluster> EXEC /bin/sh -c '/usr/bin/python3 /home/ndennis/.ansible/tmp/ansible-tmp-1661983929.6894813-571276-205282702788807/AnsiballZ_na_ontap_net_routes.py && sleep 0'
<cluster> EXEC /bin/sh -c 'rm -f -r /home/ndennis/.ansible/tmp/ansible-tmp-1661983929.6894813-571276-205282702788807/ > /dev/null 2>&1 && sleep 0'
failed: [cluster] (item={'vserver': 'AUTOSVM', 'destination': '0.0.0.0/0', 'gateway': '10.206.35.1', 'metric': 30}) => {
    "ansible_loop_var": "item",
    "changed": false,
    "invocation": {
        "module_args": {
            "cert_filepath": null,
            "destination": "0.0.0.0/0",
            "feature_flags": {},
            "from_destination": null,
            "from_gateway": null,
            "from_metric": null,
            "gateway": "10.206.35.1",
            "hostname": "e6ntap3c.datalinklabs.local",
            "http_port": null,
            "https": true,
            "key_filepath": null,
            "metric": null,
            "ontapi": null,
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "state": "present",
            "use_rest": "always",
            "username": "admin",
            "validate_certs": false,
            "vserver": "AUTOSVM"
        }
    },
    "item": {
        "destination": "0.0.0.0/0",
        "gateway": "10.206.35.1",
        "metric": 30,
        "vserver": "AUTOSVM"
    },
    "msg": "calling: network/ip/routes: unexpected response {'records': [{'uuid': 'b806d67c-2973-11ed-b383-00a098d73412', 'scope': 'svm', 'svm': {'uuid': '925b8890-18cd-11ed-b383-00a098d73412', 'name': 'AUTOSVM', '_links': {'s: {'href': '/api/svm/svms/925b8890-18cd-11ed-b383-00a098d73412'}}}, 'destination': {'address': '0.0.0.0', 'netmask': '0', 'family': 'ipv4'}, 'gateway': '10.206.35.1', '_links': {'self': {'href': '/api/network/ip/routes/b806d6773-11ed-b383-00a098d73412'}}}, {'uuid': 'fcb96e69-296b-11ed-b383-00a098d73412', 'scope': 'svm', 'svm': {'uuid': '925b8890-18cd-11ed-b383-00a098d73412', 'name': 'AUTOSVM', '_links': {'self': {'href': '/api/svm/svms/925b8890-18ced-b383-00a098d73412'}}}, 'destination': {'address': '0.0.0.0', 'netmask': '24', 'family': 'ipv4'}, 'gateway': '10.206.35.1', '_links': {'self': {'href': '/api/network/ip/routes/fcb96e69-296b-11ed-b383-00a098d73412'}}}], 'num_rds': 2, '_links': {'self': {'href': '/api/network/ip/routes?destination.address=0.0.0.0&gateway=10.206.35.1&scope=svm&svm.name=AUTOSVM&fields=destination%2Cgateway%2Csvm%2Cscope'}}}. for query: {'destination.address': '0.0.0.'gateway': '10.206.35.1', 'scope': 'svm', 'svm.name': 'AUTOSVM', 'fields': 'destination,gateway,svm,scope'}"
}
<cluster> EXEC /bin/sh -c 'echo ~ndennis && sleep 0'
<cluster> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/ndennis/.ansible/tmp `"&& mkdir "` echo /home/ndennis/.ansible/tmp/ansible-tmp-1661983930.1167068-571276-109556114452106 `" && echo ansible-tmp-1661983930.1167068276-109556114452106="` echo /home/ndennis/.ansible/tmp/ansible-tmp-1661983930.1167068-571276-109556114452106 `" ) && sleep 0'
Using module file /home/ndennis/.ansible/collections/ansible_collections/netapp/ontap/plugins/modules/na_ontap_net_routes.py
<cluster> PUT /home/ndennis/.ansible/tmp/ansible-local-571269h00wuegs/tmph15kruit TO /home/ndennis/.ansible/tmp/ansible-tmp-1661983930.1167068-571276-109556114452106/AnsiballZ_na_ontap_net_routes.py
<cluster> EXEC /bin/sh -c 'chmod u+x /home/ndennis/.ansible/tmp/ansible-tmp-1661983930.1167068-571276-109556114452106/ /home/ndennis/.ansible/tmp/ansible-tmp-1661983930.1167068-571276-109556114452106/AnsiballZ_na_ontap_net_roupy && sleep 0'
<cluster> EXEC /bin/sh -c '/usr/bin/python3 /home/ndennis/.ansible/tmp/ansible-tmp-1661983930.1167068-571276-109556114452106/AnsiballZ_na_ontap_net_routes.py && sleep 0'
<cluster> EXEC /bin/sh -c 'rm -f -r /home/ndennis/.ansible/tmp/ansible-tmp-1661983930.1167068-571276-109556114452106/ > /dev/null 2>&1 && sleep 0'
failed: [cluster] (item={'vserver': 'AUTOSVM', 'destination': '0.0.0.0/0', 'gateway': '10.206.50.1', 'metric': 30}) => {
    "ansible_loop_var": "item",
    "changed": false,
    "invocation": {
        "module_args": {
            "cert_filepath": null,
            "destination": "0.0.0.0/0",
            "feature_flags": {},
            "from_destination": null,
            "from_gateway": null,
            "from_metric": null,
            "gateway": "10.206.50.1",
            "hostname": "e6ntap3c.datalinklabs.local",
            "http_port": null,
            "https": true,
            "key_filepath": null,
            "metric": null,
            "ontapi": null,
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "state": "present",
            "use_rest": "always",
            "username": "admin",
            "validate_certs": false,
            "vserver": "AUTOSVM"
        }
    },
    "item": {
        "destination": "0.0.0.0/0",
        "gateway": "10.206.50.1",
        "metric": 30,
        "vserver": "AUTOSVM"
    },
    "msg": "calling: network/ip/routes: unexpected response {'records': [{'uuid': '7924739e-22f6-11ed-8f3e-00a0989ab340', 'scope': 'svm', 'svm': {'uuid': '925b8890-18cd-11ed-b383-00a098d73412', 'name': 'AUTOSVM', '_links': {'s: {'href': '/api/svm/svms/925b8890-18cd-11ed-b383-00a098d73412'}}}, 'destination': {'address': '0.0.0.0', 'netmask': '24', 'family': 'ipv4'}, 'gateway': '10.206.50.1', '_links': {'self': {'href': '/api/network/ip/routes/7924732f6-11ed-8f3e-00a0989ab340'}}}, {'uuid': 'b849b04b-2973-11ed-b383-00a098d73412', 'scope': 'svm', 'svm': {'uuid': '925b8890-18cd-11ed-b383-00a098d73412', 'name': 'AUTOSVM', '_links': {'self': {'href': '/api/svm/svms/925b8890-181ed-b383-00a098d73412'}}}, 'destination': {'address': '0.0.0.0', 'netmask': '0', 'family': 'ipv4'}, 'gateway': '10.206.50.1', '_links': {'self': {'href': '/api/network/ip/routes/b849b04b-2973-11ed-b383-00a098d73412'}}}, {'uuide1961309-2973-11ed-b383-00a098d73412', 'scope': 'svm', 'svm': {'uuid': '925b8890-18cd-11ed-b383-00a098d73412', 'name': 'AUTOSVM', '_links': {'self': {'href': '/api/svm/svms/925b8890-18cd-11ed-b383-00a098d73412'}}}, 'destinatio{'address': '0.0.0.0', 'netmask': '0', 'family': 'ipv4'}, 'gateway': '10.206.50.1', '_links': {'self': {'href': '/api/network/ip/routes/e1961309-2973-11ed-b383-00a098d73412'}}}], 'num_records': 3, '_links': {'self': {'href': '/network/ip/routes?destination.address=0.0.0.0&gateway=10.206.50.1&scope=svm&svm.name=AUTOSVM&fields=destination%2Cgateway%2Csvm%2Cscope'}}}. for query: {'destination.address': '0.0.0.0', 'gateway': '10.206.50.1', 'scope': 'sv'svm.name': 'AUTOSVM', 'fields': 'destination,gateway,svm,scope'}"
}
ndennis-Insight commented 2 years ago

Additionally, this is what is being created right now with the output I sent you:

AUTOCLUSTER::> net route show
  (network route show)
Vserver             Destination     Gateway         Metric
------------------- --------------- --------------- ------
AUTOSVM
                    0.0.0.0/0       10.206.13.1     20
                    0.0.0.0/0       10.206.50.1     30
lonico commented 2 years ago

With REST, the issue is that we are expecting 0 or 1 route to exist with same gateway IP address and address, but we are seeing 3. Two with same netmask, one different:

'destination': {'address': '0.0.0.0', 'netmask': '24', 'family': 'ipv4'}, 'gateway': '10.206.50.1',
'destination': {'address': '0.0.0.0', 'netmask': '0', 'family': 'ipv4'}, 'gateway': '10.206.50.1', 
'destinatio{'address': '0.0.0.0', 'netmask': '0', 'family': 'ipv4'}, 'gateway': '10.206.50.1', 

Some characters are missing, but I assume this a copy/paste issue.

This would explain why the loop works for some IP addresses (no duplication) and fails for others (duplication).

Well, this explains 10.206.13.1 and 10.206.50.1. For 10.206.35.1, REST reports 2 routes. I don't see why 10.206.34.1 is not created if no entry is reported.

We have 3 routes for 10.206.50.1 but ONTAP CLI reports only 1, I wonder if there could be something wrong with the system. The behavior would be explained if there are "hidden" routes (2 each for 10.206.13.1, 10.206.35.1, and 10.206.50.1, and one for 10.206.34.1)

With ZAPI, the logic is a bit different, it will take the first entry that it sees. But if there are multiple entries, this could explain the erratic behavior based on which entry comes back first.

I would suggest to open a case with NetApp as REST is reporting extra routes and is not consistent with the CLI. The 'unexpected response' error message contain the UUIDs of each route and they could identify where they are coming from.

Maybe deleting the SVM and recreating would be a way to start with a clean slate.

lonico commented 2 years ago

could you try:


net route show -vserver AUTOSVM -destination * -gateway 10.206.50.1
ndennis-Insight commented 2 years ago

Hello there!

You hit the nail on the head. During testing it ended up storing one version of the route into the database and then didn't properly remove/overwrite it. So we had a database that would not allow us to delete the route or extra route entries. We ended up wiping the array (it is a test array) and this allowed us to continue without issue. We've run into a similar issue with the database due to some disks being owned by an aggregate that failed to create.

It seems like REST may be causing some unexpected issues with how the database updates tables perhaps. Please feel free to close this since this a known issue with ONTAP.

KB Articles I found on the route issue: https://kb.netapp.com/Advice_and_Troubleshooting/Data_Storage_Software/ONTAP_OS/Not_all_routes_listed_in_%22route_show%22_for_ONTAP_9.7 https://kb.netapp.com/Advice_and_Troubleshooting/Data_Storage_Software/ONTAP_OS/%22Error%3A_show_failed%3A_Loop_detected_in_next()_for_table_vifmgr_vs_routes.%22

lonico commented 2 years ago

Thank you for adding the KB links. Yes, I was thinking of BURT 1323123