Closed sincerywaing closed 7 years ago
I believe this has been discussed before but I can't figure out if there is any workaround.
command line error
dev=device.open() Traceback (most recent call last): File "
", line 1, in File "/usr/local/lib/python2.7/dist-packages/napalm_ios/ios.py", line 123, in open self.dest_file_system = self.device._autodetect_fs() File "/usr/local/lib/python2.7/dist-packages/netmiko/cisco_base_connection.py", line 149, in _autodetect_fs "system: {} {}".format(cmd, output)) ValueError: An error occurred in dynamically determining remote file system: dir router1# router1# router1# router1# router1# quit()
if I specify dest_file_system = ios, it seems to work. but I can't filter any information -
PLAYBOOK: test.yaml **** 1 plays in test.yaml
PLAY [Test Inventory] **
TASK [get facts from device] *** task path: /home/shawn/ansible-workspace/test.yaml:7 Using module file /home/shawn/ansible-workspace/napalm-ansible/library/napalm_get_facts.py
@sincerywaing What does dir
on that router show?
Yes, you can disable the autodetect function by setting the dest_file_system, but you will need to set it to the correct value (if you need any of the NAPALM-IOS config operations).
Thanks Kirk!
Here is the dir
router1#dir Directory of flash0:/
1 drw- 0 Nov 28 2016 11:16:52 +00:00 .Trashes
2 -rw- 16344 Jul 20 2010 19:43:18 +00:00 DOM.JS
3 -rw- 4096 Nov 28 2016 11:16:52 +00:00 ._.Trashes
<snip, total around 120 lines>
429 -rw- 3412 Jul 20 2010 19:43:18 +00:00 xml.template
1023946752 bytes total (592633856 bytes free)
And what should I manually set the dest_file_system for ios?
now my setting is 'dest_file_system':'ios'
@ktbyers
even I specify dest_file_system to flash0:, still get error
fatal: [router1]: FAILED! => { "changed": false, "failed": true, "invocation": { "module_args": { "dev_os": "ios", "filter": [ "facts", "interfaces", "bgp_neighbors" ], "hostname": "router1", "ignore_notimplemented": false, "optional_args": { "dest_file_system": "flash0:" }, "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "provider": null, "timeout": 60, "username": "euser" }, "module_name": "napalm_get_facts" }, "msg": "[interfaces] cannot retrieve device data: Search pattern never detected in send_command_expect: show\ interface\ Gigab" }
@sincerywaing Does it work if you do the following:
"optional_args": {
"dest_file_system": "flash0:",
"global_delay_factor": 2,
},
Try using a value of 2 and a value of 4 (for global_delay_factor)
@ktbyers Thanks Kirk! making global_delay_factor = 4 did the trick!
The only thing I still have concern is bgp_neighbors filter, which always return empty.
I have bgp neighbors in specific vrfs but not in global, does this fuction only search bgp neighbor in global vrf?
Yes, current get_bgp_neighbors only supports 'global' VRF.
Someone needs to write the support to add support for other VRFs.
We have a PR outstanding to add IPv6 AFI support into get_bgp_neighbors, but still don't have support for other VRFs.
Description of Issue/Question
when using ios for ansible, encounter below issue -
fatal: [router1]: FAILED! => {"changed": false, "failed": true, "msg": "cannot connect to device: An error occurred in dynamically determining remote file system: dir router1#\nrouter1#\nrouter1#"}
Did you follow the steps from https://github.com/napalm-automation/napalm#faq
Setup
napalm-ios version
(Paste verbatim output from
pip freeze | grep napalm-ios
between quotes below)napalm-ios==0.6.2 napalm-iosxr==0.4.8
IOS version
(Paste verbatim output from
show version
between quotes below)c3900-universalk9-mz.SPA.151-4.M5.bin
Steps to Reproduce the Issue
Playbook
my user is priviledge 15 (tacacs), not sure why this happens
Python 2.7.12+ (default, Sep 17 2016, 12:08:02) [GCC 6.2.0 20160914] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import napalm_base import napalm_ios napalm_ios.version '0.6.2' netmiko.version u'1.4.0' my playbook
name: Test Inventory #The Task Name hosts: router1 #This will be in your ansible inventory file connection: local #Required gather_facts: no
tasks: #Begin Tasks
name: get facts from device #Task Name napalm_get_facts: #Call the napalm module, in this case napal_get_facts hostname: "{{ hostname }}" #This is a parameter and is derived from your ansible inventory file username: 'user1' #The username to ssh with dev_os: 'ios' #The hardware operating system password: 'pass1' #The line level password optional_args: {'secret': 'pass2'} filter: 'interfaces, bgp_neighbors' #The list of items you want to retrieve. The filter keyword is inclusive of what you want register: result #Ansible function for collecting output
name: print results #Task Name debug: msg= "{{ result }}" #Display the collected output
actually my user is already pri 15 so I don't think secret is needed.
same playbook work for junos.
Error Traceback
(Paste the complete traceback of the exception between quotes below)