napalm-automation / napalm-iosxr Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Any driver based on netmiko should be able to forward the optional args.
See details in the parent issue napalm-automation/napalm-base#65
<Get><Operational><ARP></ARP></Operational></Get>
is preferable to be used instead of
<Get>
<Operational>
<ARP></ARP>
</Operational>
</Get>
This will be part of the cleanup/hackaton too.
I receive the following traceback on the interpreter when I issue a device.get_config() command:
gw.get_config()
---------------------------------------------------------------------------
XMLCLIError Traceback (most recent call last)
<ipython-input-5-05211fb117a8> in <module>()
----> 1 gw.get_config()
/usr/local/lib/python2.7/site-packages/napalm_iosxr/iosxr.pyc in get_config(self, retrieve)
1702 if retrieve.lower() in ['running', 'all']:
1703 config['running'] = py23_compat.text_type(
-> 1704 self.device._execute_config_show('show running-config'))
1705 if retrieve.lower() in ['candidate', 'all']:
1706 config['candidate'] = py23_compat.text_type(
/usr/local/lib/python2.7/site-packages/pyIOSXR/iosxr.pyc in _execute_config_show(self, show_command, delay_factor)
445 show_command=escape_xml(show_command)
446 )
--> 447 response = self._execute_rpc(rpc_command, delay_factor=delay_factor)
448 raw_response = response.xpath('.//CLI/Configuration')[0].text
449 return raw_response.strip() if raw_response else ''
/usr/local/lib/python2.7/site-packages/pyIOSXR/iosxr.pyc in _execute_rpc(self, command_xml, delay_factor)
410
411 error_msg += '\nOriginal call was: %s' % xml_rpc_command
--> 412 raise XMLCLIError(error_msg, self)
413
414 if 'CLI' in childs:
XMLCLIError: 'XML Service Library' detected the 'warning' condition 'An error was encountered in the XML beneath this operation tag'
Original call was: <?xml version="1.0" encoding="UTF-8"?><Request MajorVersion="1" MinorVersion="0"><CLI><Configuration>show running-config</Configuration></CLI></Request>
[X] Yes
[ ] No
(Paste verbatim output from pip freeze | grep napalm-iosxr
between quotes below)
napalm-iosxr==0.4.5
(Paste the complete verbatim output from show version brief
between quotes below)
Cisco IOS XR Software, Version 5.3.3[Default]
Copyright (c) 2016 by Cisco Systems, Inc.
ROM: System Bootstrap, Version 0.73(c) 1994-2012 by Cisco Systems, Inc.
gw1.cjj1 uptime is 31 weeks, 1 day, 10 hours, 10 minutes
System image file is "disk0:asr9k-os-mbi-5.3.3/0x100305/mbiasr9k-rsp3.vm"
cisco ASR9K Series (Intel 686 F6M14S4) processor with 6291456K bytes of memory.
Intel 686 F6M14S4 processor at 2128MHz, Revision 2.174
ASR 9006 4 Line Card Slot Chassis with V2 AC PEM
4 Management Ethernet
40 TenGigE
40 DWDM controller(s)
40 WANPHY controller(s)
503k bytes of non-volatile configuration memory.
6111M bytes of hard disk.
12510192k bytes of disk0: (Sector size 512 bytes).
12510192k bytes of disk1: (Sector size 512 bytes).
In [1]: import napalm
In [2]: dr = napalm.get_network_driver('iosxr')
In [3]: gw = dr('device', 'user', 'passwd')
In [4]: gw.open()
In [5]: gw.get_config()
---------------------------------------------------------------------------
XMLCLIError Traceback (most recent call last)
<ipython-input-5-05211fb117a8> in <module>()
----> 1 gw.get_config()
/usr/local/lib/python2.7/site-packages/napalm_iosxr/iosxr.pyc in get_config(self, retrieve)
1702 if retrieve.lower() in ['running', 'all']:
1703 config['running'] = py23_compat.text_type(
-> 1704 self.device._execute_config_show('show running-config'))
1705 if retrieve.lower() in ['candidate', 'all']:
1706 config['candidate'] = py23_compat.text_type(
/usr/local/lib/python2.7/site-packages/pyIOSXR/iosxr.pyc in _execute_config_show(self, show_command, delay_factor)
445 show_command=escape_xml(show_command)
446 )
--> 447 response = self._execute_rpc(rpc_command, delay_factor=delay_factor)
448 raw_response = response.xpath('.//CLI/Configuration')[0].text
449 return raw_response.strip() if raw_response else ''
/usr/local/lib/python2.7/site-packages/pyIOSXR/iosxr.pyc in _execute_rpc(self, command_xml, delay_factor)
410
411 error_msg += '\nOriginal call was: %s' % xml_rpc_command
--> 412 raise XMLCLIError(error_msg, self)
413
414 if 'CLI' in childs:
XMLCLIError: 'XML Service Library' detected the 'warning' condition 'An error was encountered in the XML beneath this operation tag'
Original call was: <?xml version="1.0" encoding="UTF-8"?><Request MajorVersion="1" MinorVersion="0"><CLI><Configuration>show running-config</Configuration></CLI></Request>
### Error Traceback
(Paste the complete traceback of the exception between quotes below)
[ x ] Yes
[ ] No
(Paste verbatim output from pip freeze | grep napalm-iosxr
between quotes below)
napalm-iosxr==0.2.2
(Paste the complete verbatim output from show version brief
between quotes below)
RP/0/RSP0/CPU0:gw1#sh ver br
Thu Sep 29 10:14:19.003 EDT
Cisco IOS XR Software, Version 5.3.3[Default]
Copyright (c) 2016 by Cisco Systems, Inc.
ROM: System Bootstrap, Version 0.73(c) 1994-2012 by Cisco Systems, Inc.
gw1 uptime is 20 weeks, 6 days, 22 hours, 32 minutes
System image file is "disk0:asr9k-os-mbi-5.3.3/0x100305/mbiasr9k-rsp3.vm"
cisco ASR9K Series (Intel 686 F6M14S4) processor with 6291456K bytes of memory.
Intel 686 F6M14S4 processor at 2135MHz, Revision 2.174
ASR 9006 4 Line Card Slot Chassis with V2 AC PEM
4 Management Ethernet
16 TenGigE
16 DWDM controller(s)
16 WANPHY controller(s)
503k bytes of non-volatile configuration memory.
6111M bytes of hard disk.
12510192k bytes of disk0: (Sector size 512 bytes).
12510192k bytes of disk1: (Sector size 512 bytes).
from napalm import get_network_driver
driver = get_network_driver('iosxr')
gw = driver('device', 'user', 'pass')
gw.open()
gw.get_interfaces()
(Paste the complete traceback of the exception between quotes below)
In [5]: gw.get_interfaces()
---------------------------------------------------------------------------
AddrFormatError Traceback (most recent call last)
<ipython-input-5-e02d8754175e> in <module>()
----> 1 gw.get_interfaces()
/usr/local/lib/python2.7/site-packages/napalm_iosxr/iosxr.pyc in get_interfaces(self)
202 is_up = (find_txt(interface_tree, 'LineState') == 'IM_STATE_UP')
203 is_enabled = (find_txt(interface_tree, 'LineState') == 'IM_STATE_UP')
--> 204 mac_address = mac(find_txt(interface_tree, 'MACAddress/Address'))
205 speed = int(convert(int, find_txt(interface_tree, 'Bandwidth'), 0) * 1e-3)
206 description = find_txt(interface_tree, 'Description')
/usr/local/lib/python2.7/site-packages/napalm_base/helpers.pyc in mac(raw)
215 zeros_stuffed='0'*(12-len(flat_raw))
216 )
--> 217 return unicode(EUI(raw, dialect=_MACFormat))
218
219
/usr/local/lib/python2.7/site-packages/netaddr/eui/__init__.pyc in __init__(self, addr, version, dialect)
385 self._module = _eui64
386
--> 387 self.value = addr
388
389 # Choose a dialect for MAC formatting.
/usr/local/lib/python2.7/site-packages/netaddr/eui/__init__.pyc in _set_value(self, value)
435 if self._module is None:
436 raise AddrFormatError('failed to detect EUI version: %r'
--> 437 % value)
438 else:
439 # EUI version is explicit.
AddrFormatError: failed to detect EUI version: u''
When i try to get_facts I get an error. I'm able to connect and I tested getting bgp neighbor without any issues.
[X ] Yes
[ ] No
(Paste verbatim output from pip freeze | grep napalm-iosxr
between quotes below)
napalm-iosxr (0.4.7)
(Paste the complete verbatim output from show version brief
between quotes below)
Sat Feb 4 20:57:25.341 UTC
Cisco IOS XR Software, Version 6.0.1[Default]
Copyright (c) 2016 by Cisco Systems, Inc.
ROM: GRUB, Version 1.99(0), DEV RELEASE
iosxrv-1 uptime is 1 hour, 10 minutes
System image file is "bootflash:disk0/xrvr-os-mbi-6.0.1/mbixrvr-rp.vm"
cisco IOS XRv Series (Pentium Celeron Stepping 3) processor with 3169791K bytes of memory.
Pentium Celeron Stepping 3 processor at 3113MHz, Revision 2.174
IOS XRv Chassis
1 Management Ethernet
2 GigabitEthernet
97070k bytes of non-volatile configuration memory.
866M bytes of hard disk.
2321392k bytes of disk0: (Sector size 512 bytes).
(Paste the complete traceback of the exception between quotes below)
from napalm import get_network_driver
driver = get_network_driver('iosxr')
device = driver('172.16.1.101', 'cisco', 'cisco')
device.open()
facts=device.get_facts()
>>> device.get_facts()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/napalm_iosxr/iosxr.py", line 154, in get_facts
platform_attr_tree = facts_rpc_reply.xpath(platform_attr_xpath)[0]
IndexError: list index out of range
The is_enabled field always seems to be set to false. Might be that the ConnectionAdminStatus (https://github.com/napalm-automation/napalm-iosxr/blob/develop/napalm_iosxr/iosxr.py#L355-L358) never gets set to "1" in the xml response or that some other field should be used, or different values.
When using napalm methods on iosxr platform & python3, it returns "name 'unicode' is not defined" as unicode does not exist in Python3.
get_interfaces() works whereas get_interfaces_ip() not for example.
napalm-iosxr==0.4.2
Fri Feb 3 11:43:31.498 CEST
Cisco IOS XR Software, Version 5.1.3[Default]
Copyright (c) 2015 by Cisco Systems, Inc.
ROM: System Bootstrap, Version 2.04(20140227:092320) [ASR9K ROMMON],
CORE-01.PAR-3 uptime is 39 weeks, 2 days, 18 hours, 15 minutes
System image file is "bootflash:disk0/asr9k-os-mbi-5.1.3.sp2-1.0.0/0x100000/mbiasr9k-rp.vm"
cisco ASR9K Series (P4040) processor with 8388608K bytes of memory.
P4040 processor at 1500MHz, Revision 2.0
ASR-9001 Chassis
2 Management Ethernet
8 TenGigE
20 GigabitEthernet
8 DWDM controller(s)
8 WANPHY controller(s)
219k bytes of non-volatile configuration memory.
2868M bytes of hard disk.
3915760k bytes of disk0: (Sector size 512 bytes).
driver = get_network_driver('iosxr')
device = driver(node, login, password)
int_l3 = device.get_interfaces_ip()
name 'unicode' is not defined
ASR version 5.1.3, issuing a get_bgp_neighbors_detail
receives an error:
File "", line unknown
^
SyntaxError: unexpected EOF while parsing
[ x ] Yes
[ ] No
napalm-iosxr==0.5.4
napalm-base==0.23.3
pyIOSXR==0.52
(Paste verbatim output from pip freeze | grep napalm-iosxr
between quotes below)
napalm-iosxr==0.5.4
(Paste the complete verbatim output from show version brief
between quotes below)
#sh ver br
Fri Aug 4 14:09:36.675 EDT
Cisco IOS XR Software, Version 5.1.3[Default]
Copyright (c) 2016 by Cisco Systems, Inc.
ROM: System Bootstrap, Version 0.73(c) 1994-2012 by Cisco Systems, Inc.
# uptime is 30 weeks, 7 hours, 4 minutes
System image file is "disk0:asr9k-os-mbi-5.1.3.sp10-1.0.0/0x100305/mbiasr9k-rsp3.vm"
cisco ASR9K Series (Intel 686 F6M14S4) processor with 6291456K bytes of memory.
Intel 686 F6M14S4 processor at 2127MHz, Revision 2.174
ASR 9006 AC Chassis with PEM Version 2
4 Management Ethernet
40 TenGigE
40 DWDM controller(s)
40 WANPHY controller(s)
503k bytes of non-volatile configuration memory.
6111M bytes of hard disk.
12510192k bytes of disk0: (Sector size 512 bytes).
12510192k bytes of disk1: (Sector size 512 bytes).
device.get_bgp_neighbors_detail()
(Paste the complete traceback of the exception between quotes below)
File "<string>", line unknown
^
SyntaxError: unexpected EOF while parsing
See details in the parent issue napalm-automation/napalm-base#107
@dbarrosop Can you assign this to me please?
ZeroDivisionError when there are no results for the IPSLA probes
Noth special
0.3.0
any
Execute get_probes_results
.
(Paste the complete traceback of the exception between quotes below)
>>> e.get_probes_results()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/state/home/mircea/cfnapalm/local/lib/python2.7/site-packages/napalm_iosxr/iosxr.py", line 1467, in get_probes_results
jitter = rtt-(rms/global_test_updates)**0.5
ZeroDivisionError: float division by zero
I was looking to see if I could check to see whether a port was down due to it being disabled, or for another reason, but it looks like even if the port is enabled and down, is_enabled is set to false.
This seems to be because is_enabled is just being copied over from is_up:
https://github.com/napalm-automation/napalm-iosxr/blob/develop/napalm_iosxr/iosxr.py#L203
is_up = (find_txt(interface_tree, 'LineState') == 'IM_STATE_UP')
is_enabled = (find_txt(interface_tree, 'LineState') == 'IM_STATE_UP')
See details in the parent issue napalm-automation/napalm#297
See details in the parent issue napalm-automation/napalm-base#217
bgp.config call doesn't work in salt (but the get_bgp_config method works in python)
[X] Yes
[ ] No
(Paste verbatim output from pip freeze | grep napalm-iosxr
between quotes below)
napalm-iosxr==0.4.2
(Paste the complete verbatim output from show version brief
between quotes below)
show version brief:
Cisco IOS XR Software, Version 5.3.3[Default]
Copyright (c) 2016 by Cisco Systems, Inc.
ROM: System Bootstrap, Version 0.73(c) 1994-2012 by Cisco Systems, Inc.
[device] uptime is 31 weeks, 10 hours, 0 minutes
System image file is "disk0:asr9k-os-mbi-5.3.3/0x100305/mbiasr9k-rsp3.vm"
cisco ASR9K Series (Intel 686 F6M14S4) processor with 6291456K bytes of memory.
Intel 686 F6M14S4 processor at 2128MHz, Revision 2.174
ASR 9006 4 Line Card Slot Chassis with V2 AC PEM
4 Management Ethernet
40 TenGigE
40 DWDM controller(s)
40 WANPHY controller(s)
503k bytes of non-volatile configuration memory.
6111M bytes of hard disk.
12510192k bytes of disk0: (Sector size 512 bytes).
12510192k bytes of disk1: (Sector size 512 bytes).
result:
True
add a proxy-minion then run:
salt device bgp.config
(Paste the complete traceback of the exception between quotes below)
root# salt gw1 bgp.config
gw1:
----------
comment:
Cannot execute "get_bgp_config" on gw1 as user. Reason: 'NoneType' object has no attribute 'lower'!
out:
----------
result:
False
traceback:
Traceback (most recent call last):
File "/var/cache/salt/minion/extmods/proxy/napalm.py", line 284, in call
out = getattr(NETWORK_DEVICE.get('DRIVER'), method)(**params) # calls the method with the specified parameters
File "/usr/local/lib/python2.7/site-packages/napalm_iosxr/iosxr.py", line 706, in get_bgp_config
group = group.lower()
AttributeError: 'NoneType' object has no attribute 'lower'
Verbatim copy from napalm-automation/napalm-base#227
According to the documentation both get_bgp_neighbors() and get_bgp_neighbors_detail() should: "Returns a dictionary of dictionaries. The keys for the first dictionary will be the vrf (global if no vrf)." However different values seem to be returned for the outer keys of each calls. (i.e. one is the vrf the other the routing instance?)
get_bgp_neighbors_detail() appears to return a dictionary of routing instances and not a dictionary containing the VRF as returned in get_bgp_neighbors(); it would seem that the get_bgp_neighbors_detail method should also return 'global' vrf as outer key. (only default/global VRF configured)
neighbor_facts = device.get_bgp_neighbors()
print("get_bgp_neighbors():")
for vrf in neighbor_facts:
print("Outer key values: " + vrf)
detail_facts = device.get_bgp_neighbors_detail()
print("get_bgp_neighbors_detail():")
for vrf in detail_facts:
print("Outer key values: " + vrf)
Results -
Cisco (ASR9010 - 5.3.3):
get_bgp_neighbors():
Outer key values: global
get_bgp_neighbors_detail():
Outer key values: default
JunOS (15.1F5-S4.6)
get_bgp_neighbors():
Outer key values: global
get_bgp_neighbors_detail():
Outer key values: inet6.0
Outer key values: inet.0
Outer key values: inetflow.0
JunOS (12.3R9.4)
get_bgp_neighbors():
Outer key values: global
get_bgp_neighbors_detail():
Outer key values: inet6.0
Outer key values: inet.0
Outer key values: inetflow.0
In examples above outer dict isn't returning the same value for both calls.
The get_route_to command returns an XMLCLIError containing no useful error message when trying to call get_route_to with an IPv6 address.
We could find the real reason by issueing the xml request manually on the xml cli:
<Address ErrorCode="0x4368a800" ErrorMsg="'XMLMDA' detected the 'warning' condition 'The XML request does not conform to the schema. The character data contained in the element does not conform to the XML schema for its datatype. Please check the request against the schema.': Expected data type is an IPV4 address/mask in dotted decimal notation"/>
Why doesn't napalm pass the device response ?
Unfortunately the xml request is hardcoded for IPv4 only.
Maybe someone can help me re-writing the request for IPv6. I couldn't find any details on that so far.
python-napalm-iosxr-0.4.8-4.noarch
(Paste the complete verbatim output from show version brief
between quotes below)
Fri Mar 31 12:34:16.351 CEST
Cisco IOS XR Software, Version 5.3.3[Default]
Copyright (c) 2016 by Cisco Systems, Inc.
ROM: System Bootstrap, Version 2.04(20140424:063844) [ASR9K ROMMON],
rt-1.tt4 uptime is 21 hours, 38 minutes
System image file is "bootflash:disk0/asr9k-os-mbi-5.3.3/0x100000/mbiasr9k-rp.vm"
cisco ASR9K Series (P4040) processor with 8388608K bytes of memory.
P4040 processor at 1500MHz, Revision 3.0
ASR-9001 Chassis
2 Management Ethernet
20 GigabitEthernet
4 TenGigE
4 DWDM controller(s)
4 WANPHY controller(s)
219k bytes of non-volatile configuration memory.
2868M bytes of hard disk.
3915760k bytes of disk0: (Sector size 512 bytes).
call get_route_to with an IPv6 address as argument.
routes_tree = ETREE.fromstring(self.device.make_rpc_call(route_info_rpc_command))
File "/usr/lib/python2.7/site-packages/pyIOSXR/iosxr.py", line 148, in make_rpc_call
result = self._execute_rpc(rpc_command)
File "/usr/lib/python2.7/site-packages/pyIOSXR/iosxr.py", line 412, in _execute_rpc
raise XMLCLIError(error_msg, self)
pyIOSXR.exceptions.XMLCLIError:
Original call was: <?xml version="1.0" encoding="UTF-8"?><Request MajorVersion="1" MinorVersion="0"><Get><Operational><RIB><VRFTable><VRF><Naming><VRFName>default </VRFName></Naming><AFTable><AF><Naming><AFName>IPv4</AFName></Naming><SAFTable><SAF> <Naming><SAFName>Unicast</SAFName></Naming><IP_RIBRouteTable><IP_RIBRoute><Naming> <RouteTableName>default</RouteTableName></Naming><RouteTable><Route><Naming><Address> DEAD:BEEF:210:210::53</Address></Naming></Route></RouteTable></IP_RIBRoute></IP_RIBRouteTable> </SAF></SAFTable></AF></AFTable></VRF></VRFTable></RIB></Operational></Get></Request>
Original issue napalm-automation/napalm#152 created by @ktbyers
@fooelisa Not sure if you want to do anything about this, but since I dug into it a bit I thought I would post what I saw.
This was on a Cisco IOS-XRv device. It would probably be nice to have it pass the unit test (so you could use an IOS-XRv device for testing purposes).
Running .get_environment() method would cause:
$ ./napalm_iosxr_test.py >>>Test device open >>>Test get environment Traceback (most recent call last): File "./napalm_iosxr_test.py", line 38, in env = device.get_environment() File "/home/kbyers/venv/napalm_test/local/lib/python2.7/site-packages/napalm-0.50.3-py2.7.egg/napalm/iosxr.py", line 497, in get_environment if node.find('Naming/NodeName/Slot').text == active_modules['RSP'][0]: # first enabled RSP IndexError: list index out of range
Printing out the XML response from the initial rpc_command in that method:
<Response MajorVersion="1" MinorVersion="0">
<Get ItemNotFound="true">
<AdminOperational>
<PlatformInventory MajorVersion="0" MinorVersion="4">
<RackTable>
<Rack>
<Naming>
<Name>0</Name>
</Naming>
<SlotTable MajorVersion="0" MinorVersion="0" NotFound="true" />
</Rack>
</RackTable>
</PlatformInventory>
</AdminOperational>
</Get>
<ResultSummary ErrorCount="0" ItemNotFound="true" />
</Response>
Unit test will basically fail the same way.
File "/usr/lib/python2.7/dist-packages/salt/utils/napalm.py", line 153, in call
out = getattr(napalm_device.get('DRIVER'), method)(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/napalm_iosxr/iosxr.py", line 113, in is_alive
self.device.device.send_command(null)
File "/usr/local/lib/python2.7/dist-packages/netmiko/base_connection.py", line 815, in send_command
search_pattern))
IOError: Search pattern never detected in send_command_expect: RP\/0\/RSP0\/CPU0\:edge01\.bjm01
It is supposedly faster than TTY agent.
Hola! @mirceaulinic has created a ZenHub account for the napalm-automation organization. ZenHub is the leading team collaboration and project management solution built for GitHub.
To get set up with ZenHub, all you have to do is download the browser extension and log in with your GitHub account. Once you do, you’ll get access to ZenHub’s complete feature-set immediately.
ZenHub adds a series of enhancements directly inside the GitHub UI:
Still curious? See more ZenHub features or read user reviews. This issue was written by your friendly ZenHub bot, posted by request from @mirceaulinic.
get_lldp_neighbors
is still wrongly implemented in the ancient way of scraping the CLI and parsing raw text when all the other methods are using the XML agent.
In XR 6.1.2 seems like they have blocked this kind of requests and we have one more reason to get rid of this.
0.4.7
6.1.2
(Paste the complete traceback of the exception between quotes below)
>>> j.get_lldp_neighbors()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/salt/virtualenv/local/lib/python2.7/site-packages/napalm_iosxr/iosxr.py", line 596, in get_lldp_neighbors
sh_lldp = self.device.show_lldp_neighbors().splitlines()[5:-3]
File "/usr/local/salt/virtualenv/local/lib/python2.7/site-packages/pyIOSXR/iosxr.py", line 123, in _getattr
response = self._execute_show(cmd)
File "/usr/local/salt/virtualenv/local/lib/python2.7/site-packages/pyIOSXR/iosxr.py", line 435, in _execute_show
response = self._execute_rpc(rpc_command)
File "/usr/local/salt/virtualenv/local/lib/python2.7/site-packages/pyIOSXR/iosxr.py", line 412, in _execute_rpc
raise XMLCLIError(error_msg, self)
pyIOSXR.exceptions.XMLCLIError: 'XML Service Library' detected the 'warning' condition 'An error was encountered in the XML beneath this operation tag'
Original call was: <?xml version="1.0" encoding="UTF-8"?><Request MajorVersion="1" MinorVersion="0"><CLI><Exec>show lldp neighbors</Exec></CLI></Request>
See details in the parent issue napalm-automation/napalm#199
See details in the parent issue napalm-automation/napalm-base#71
See details in the parent issue napalm-automation/napalm-base#214
Relates to napalm-automation/napalm#280
Add setup.cfg
and requirements-dev.txt
file with the following content:
[pylama]
linters = mccabe,pep257,pep8,pyflakes,import_order
ignore = D203
[pylama:pep8]
max_line_length = 100
requirements-dev.txt
pytest
pytest-cov
pytest-json
pytest-pythonpath
pylama
flake8-import-order
-r requirements.txt
Referencing an issue that I recently opened with the pyIOSXR project:
It's currently broken:
The command "nosetests -v TestIOSXRDriver:TestGetterIOSXRDriver.test_get_probes_results" exited with 0.
0.16s$ nosetests -v TestIOSXRDriver:TestGetterIOSXRDriver.test_traceroute
test_traceroute (TestIOSXRDriver.TestGetterIOSXRDriver) ... ERROR
======================================================================
ERROR: test_traceroute (TestIOSXRDriver.TestGetterIOSXRDriver)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/napalm_base-0.12.0-py2.7.egg/napalm_base/test/base.py", line 392, in test_traceroute
result = result and self._test_model(models.traceroute, probe_result)
File "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/napalm_base-0.12.0-py2.7.egg/napalm_base/test/base.py", line 147, in _test_model
same_class = isinstance(data[key], instance_class)
KeyError: 'rtt'
-------------------- >> begin captured stdout << ---------------------
model_keys: ['host_name', 'ip_address', 'rtt']
data_keys: ['host_name', 'ip_address']
--------------------- >> end captured stdout << ----------------------
----------------------------------------------------------------------
Ran 1 test in 0.003s
FAILED (errors=1)
Like napalm-automation/napalm-junos#84 for iosxr.
It is very interesting how the napalm-iosxr
library is installed in a different way. Although we fixed get_network_driver
with napalm-automation/napalm-base#24, there are still some serious issues alive (my comments napalm-automation/napalm#232 (comment) and napalm-automation/napalm#232 (comment)).
napalm-iosxr
is the only lib having the egg installed as file, not as directory:
(virtualenv)mircea@36netops1:/usr/local/salt/virtualenv/lib/python2.7/site-packages$ ls -la | grep napalm | grep junos
drwxr-xr-x 3 mircea mircea 60 May 13 11:48 napalm_junos
drwxr-xr-x 4 mircea mircea 80 May 13 10:00 napalm_junos-0.2.0-py2.7.egg
(virtualenv)mircea@36netops1:/usr/local/salt/virtualenv/lib/python2.7/site-packages$ ls -la | grep napalm | grep iosxr
drwxr-xr-x 2 mircea mircea 120 May 13 14:12 napalm_iosxr
-rw-r--r-- 1 mircea mircea 35689 May 12 14:52 napalm_iosxr-0.2.0-py2.7.egg
drwxr-xr-x 2 mircea mircea 140 May 5 09:57 napalm_iosxr-0.2.0-py2.7.egg-info
Which has direct implications in methods such as load_template
:
>>> i.load_template('set_ntp_peers', peers=['192.168.0.1'])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/salt/virtualenv/lib/python2.7/site-packages/napalm_base-0.14.1-py2.7.egg/napalm_base/base.py", line 104, in load_template
**template_vars)
File "/usr/local/salt/virtualenv/lib/python2.7/site-packages/napalm_base-0.14.1-py2.7.egg/napalm_base/helpers.py", line 31, in load_template
path=template_dir_path
napalm_base.exceptions.DriverTemplateNotImplemented: Config template dir does not exist: /usr/local/salt/virtualenv/lib/python2.7/site-packages/napalm_iosxr-0.2.0-py2.7.egg/napalm_iosxr/templates.
Please create it and add driver-specific templates.
Although a detail, ElementTree
is an old class and does not have important methods like xpath
that makes life much easier.
Executing get_route_to
to extract the static route details raises SyntaxError: unexpected EOF while parsing
(Paste verbatim output from pip freeze | grep napalm-iosxr
between quotes below)
napalm-iosxr==0.3.2
(Paste the complete verbatim output from show version brief
between quotes below)
any
Execute get_route_to(<destination>, 'static')
(Paste the complete traceback of the exception between quotes below)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/salt/virtualenv/lib/python2.7/site-packages/napalm_iosxr/iosxr.py", line 1269, in get_route_to
bgp_path, 'PathInformation/IsBestPath', 'false').title())
File "<string>", line 0
^
SyntaxError: unexpected EOF while parsing
See details in the parent issue napalm-automation/napalm-base#137
See details in the parent issue napalm-automation/napalm#327
I'm able to connect to a device successfully but when I issue a method like get_bgp_neighbors or get_facts I get a timeout error. The connection to the device remains active though.
[x ] Yes
[ ] No
(Paste verbatim output from pip freeze | grep napalm-iosxr
between quotes below)
napalm-iosxr==0.5.4
(Paste the complete verbatim output from show version brief
between quotes below)
#sh version brief
Wed Oct 11 16:18:04.270 EDT
Cisco IOS XR Software, Version 5.1.3[Default]
Copyright (c) 2016 by Cisco Systems, Inc.
ROM: System Bootstrap, Version 0.73(c) 1994-2012 by Cisco Systems, Inc.
gw1.fnc1 uptime is 4 weeks, 1 day, 8 hours, 50 minutes
System image file is "disk0:asr9k-os-mbi-5.1.3.sp10-1.0.0/0x100305/mbiasr9k-rsp3.vm"
cisco ASR9K Series (Intel 686 F6M14S4) processor with 6291456K bytes of memory.
Intel 686 F6M14S4 processor at 2127MHz, Revision 2.174
ASR 9006 AC Chassis with PEM Version 2
2 Management Ethernet
2 TenGigE
2 DWDM controller(s)
2 WANPHY controller(s)
503k bytes of non-volatile configuration memory.
6111M bytes of hard disk.
12510192k bytes of disk0: (Sector size 512 bytes).
12510192k bytes of disk1: (Sector size 512 bytes).
Python 2.7.9 (default, Jun 29 2016, 13:08:31)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import napalm
>>> dr = napalm.get_network_driver('iosxr')
>>> gw = dr('dev', 'user', 'passwd')
>>> gw.open()
>>> n = gw.get_bgp_neighbors()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/napalm_iosxr/iosxr.py", line 351, in get_bgp_neighbors
result_tree = ETREE.fromstring(self.device.make_rpc_call(rpc_command))
File "/usr/local/lib/python2.7/dist-packages/pyIOSXR/iosxr.py", line 151, in make_rpc_call
result = self._execute_rpc(rpc_command)
File "/usr/local/lib/python2.7/dist-packages/pyIOSXR/iosxr.py", line 365, in _execute_rpc
response = self._send_command(xml_rpc_command, delay_factor=delay_factor)
File "/usr/local/lib/python2.7/dist-packages/pyIOSXR/iosxr.py", line 301, in _send_command
if not self._timeout_exceeded(start=start):
File "/usr/local/lib/python2.7/dist-packages/pyIOSXR/iosxr.py", line 190, in _timeout_exceeded
raise TimeoutError(msg, self)
pyIOSXR.exceptions.TimeoutError: Timeout exceeded!
>>> gw.close()
>>> gw.open()
>>> facts = gw.get_facts()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/napalm_iosxr/iosxr.py", line 193, in get_facts
facts_rpc_reply = ETREE.fromstring(self.device.make_rpc_call(facts_rpc_request))
File "/usr/local/lib/python2.7/dist-packages/pyIOSXR/iosxr.py", line 151, in make_rpc_call
result = self._execute_rpc(rpc_command)
File "/usr/local/lib/python2.7/dist-packages/pyIOSXR/iosxr.py", line 365, in _execute_rpc
response = self._send_command(xml_rpc_command, delay_factor=delay_factor)
File "/usr/local/lib/python2.7/dist-packages/pyIOSXR/iosxr.py", line 301, in _send_command
if not self._timeout_exceeded(start=start):
File "/usr/local/lib/python2.7/dist-packages/pyIOSXR/iosxr.py", line 190, in _timeout_exceeded
raise TimeoutError(msg, self)
pyIOSXR.exceptions.TimeoutError: Timeout exceeded!
>>> gw.is_alive()
{u'is_alive': True}
>>>
(Paste the complete traceback of the exception between quotes below)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/napalm_iosxr/iosxr.py", line 193, in get_facts
facts_rpc_reply = ETREE.fromstring(self.device.make_rpc_call(facts_rpc_request))
File "/usr/local/lib/python2.7/dist-packages/pyIOSXR/iosxr.py", line 151, in make_rpc_call
result = self._execute_rpc(rpc_command)
File "/usr/local/lib/python2.7/dist-packages/pyIOSXR/iosxr.py", line 365, in _execute_rpc
response = self._send_command(xml_rpc_command, delay_factor=delay_factor)
File "/usr/local/lib/python2.7/dist-packages/pyIOSXR/iosxr.py", line 301, in _send_command
if not self._timeout_exceeded(start=start):
File "/usr/local/lib/python2.7/dist-packages/pyIOSXR/iosxr.py", line 190, in _timeout_exceeded
raise TimeoutError(msg, self)
pyIOSXR.exceptions.TimeoutError: Timeout exceeded!
In reference to napalm-automation/napalm-base#60:
RPC command <Get><Operational><DWDM/></Operational></Get>
provides a detailed output of the dwdm interfaces on the ASR. However, in the output, for instance, the interface names are specified as dwdm0/0/0/0
as opposed to TenGigE0/0/0/0
. Now I am not sure how to validate the actual interface name due to the output of the RPC command.
Instead, if there were a way to retrieve the output provided by show controllers <intf> physical
using an XML RPC, it would really help. I was hoping to have a discussion about this and figure out the way forward.
Must use the helpers ip and mac from napalm-base: napalm-automation/napalm-base#55 resp napalm-automation/napalm-base#54
See details in the parent issue napalm-automation/napalm-base#99
See details in the parent issue napalm-automation/napalm-base#70
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.