Code Monkey home page Code Monkey logo

napalm-eos's People

Contributors

0xmc avatar bewing avatar bholmgren avatar dbarrosop avatar fooelisa avatar inetuid avatar itdependsnetworks avatar jedelman8 avatar kbirkela avatar ktbyers avatar lokespotify avatar lubon avatar marcovespignani avatar mirceaulinic avatar mzbenami avatar ogenstad avatar tehhobbit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

napalm-eos's Issues

`get_bgp_neighbors_detail`: KeyError: u'advertised_prefix_count'

Description of Issue/Question

Unable to execute get_bgp_neighbors_detail.

napalm-eos version

(Paste verbatim output from pip freeze | grep napalm-eos between quotes below)

0.5.2

eOS version

(Paste verbatim output from show version | json between quotes below)

any

Error Traceback

(Paste the complete traceback of the exception between quotes below)

>>> e.get_bgp_neighbors_detail()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/salt/virtualenv/local/lib/python2.7/site-packages/napalm_eos/eos.py", line 1390, in get_bgp_neighbors_detail
    v4_peer_info = _parse_per_peer_bgp_detail(raw_output[0]['output'])
  File "/usr/local/salt/virtualenv/local/lib/python2.7/site-packages/napalm_eos/eos.py", line 1306, in _parse_per_peer_bgp_detail
    item[key] = napalm_base.helpers.convert(int, item[key], 0)
KeyError: u'advertised_prefix_count

get_environment() should not generate an exception on vEOS

Arista vEOS

Traceback (most recent call last):
  File "./test_napalm_get.py", line 103, in <module>
    wrapper_func(conn, napalm_method, banner=banner)
  File "./test_napalm_get.py", line 14, in wrapper_func
    pprint(my_method())
  File "/home/kbyers/applied_python/local/lib/python2.7/site-packages/napalm_eos/eos.py", line 458, in get_environment
    fans_output, temp_output, power_output = self.device.run_commands(command)
  File "/home/kbyers/applied_python/local/lib/python2.7/site-packages/pyeapi/client.py", line 672, in run_commands
    response = self._connection.execute(commands, encoding)
  File "/home/kbyers/applied_python/local/lib/python2.7/site-packages/pyeapi/eapilib.py", line 475, in execute
    response = self.send(request)
  File "/home/kbyers/applied_python/local/lib/python2.7/site-packages/pyeapi/eapilib.py", line 396, in send
    raise CommandError(code, msg, command_error=err, output=out)
pyeapi.eapilib.CommandError: Error [1000]: CLI command 4 of 4 'show environment power' failed: could not run command [There seem to be no power supplies connected.]

Faulty data returned from get_environment()

Description of Issue/Question

get_environment() returns wrong data in the following cases

  • On board sensors was never reported due to the following code piece

except: pass

Cpu usage was only reported for userspace due to the following regex

m = re.search('(\d+.\d+)\%', cpu_output.splitlines()[2])

Total memory was reported instead of available memory due to the following regex

`m = re.search('(\d+)k\W+total\W+(\d+)k\W+used\W+(\d+)k\W+free', cpu_output.splitlines()[3])

environment_counters['memory'] = {
'available_ram': int(m.group(1)),
'used_ram': int(m.group(2))
}`

Setup

napalm-eos version

(Paste verbatim output from pip freeze | grep napalm-eos between quotes below)

napalm-eos==0.4.1

eOS version

(Paste verbatim output from show version | json between quotes below)

{
    "modelName": "DCS-7280SR-48C6-M-R",
    "internalVersion": "4.17.1F-3465508.4171F",
    "systemMacAddress": "44:4c:a8:cd:33:7d",
    "serialNumber": "xxxxx",
    "memTotal": 32472080,
    "bootupTimestamp": 1475664380.55,
    "memFree": 29064052,
    "version": "4.17.1F",
    "architecture": "i386",
    "isIntlVersion": false,
    "internalBuildId": "5b73e68d-e45b-4748-8d38-abf09997c867",
    "hardwareRevision": "11.03"
}

Steps to Reproduce the Issue

Pull environment from any fixed form factor arista and you will see several sensors missing
Pull environment from any arista and you will see only userspace cpu usage being reported
Pulll environment from any arista and total memory will be reported as available memory

Error Traceback

(Paste the complete traceback of the exception between quotes below)


EOSDriver.get_users() returns empty string for sshkeys

Setup

napalm-eos version

(Paste verbatim output from pip freeze | grep napalm-eos between quotes below)

napalm-eos==0.5.6

eOS version

(Paste verbatim output from show version | json between quotes below)

{u'architecture': u'i386',
 u'bootupTimestamp': 1496206084.68,
 u'hardwareRevision': u'02.02',
 u'internalBuildId': u'13357416-6616-4a73-b088-cfbfcedd7078',
 u'internalVersion': u'4.18.2F-2GB-4930939.4182F',
 u'isIntlVersion': False,
 u'memFree': 2299720,
 u'memTotal': 3963676,
 u'modelName': u'DCS-7150S-52-CL-R',
 u'serialNumber': u'JPE15083350',
 u'systemMacAddress': u'00:1c:73:b4:d1:bf',
 u'version': u'4.18.2F-2GB'}

What I would expect

In [11]: d.get_users()['admin']
Out[11]: {u'level': 15, u'password': u'', u'role': u'network-admin', u'sshkeys': []}

What I get

In [11]: d.get_users()['admin']
Out[11]: {u'level': 15, u'password': u'', u'role': u'network-admin', u'sshkeys': [u'']}

Will submit PR in napalm_eos to fix, and update unit test in napalm_base to enumerate sshkeys and confirm the strings are valid keys.

Deprecation of get_ntp_peers

Some time ago I noticed that Aristas are pretty different when it comes to NTP. It is possible to set NTP servers but cannot establish peerings with other devices.
I am going soon enough to propose the method that retrieves the NTP servers configured on the device: get_ntp_servers (base ref: napalm-automation/napalm-base#36).

What would be the best thing to do with the current get_ntp_peers? Should return empty dict or raise NotImplementedError?

LLDP chassisId is converted to a MAC address for non-MAC address chassisId values

Description of Issue/Question

napalm-eos get_lldp_neighbor_detail() tries to convert all chassisId values to a MAC address format but per rfc2992 (under the section for PtopoChassisIdType) chassisId is not required to be a MAC address.

Setup

napalm-eos version

napalm-eos==0.5.3

eOS version

4.15.5

Steps to Reproduce the Issue

Run get_lldp_neighbors_detail() on a switch receiving a chassisId TLV that is not a MAC address.

Error Traceback

Traceback (most recent call last):
  File "napalm_example.py", line 28, in <module>
    main()
  File "napalm_example.py", line 19, in main
    print(json.dumps(device.get_lldp_neighbors_detail(), indent=4))
  File "/home/user/Test/napalm/napalm-eos/napalm_eos/eos.py", line 538, in get_lldp_neighbors_detail
    neighbor.get('chassisId', u'')),
  File "/home/user/Test/napalm/env/local/lib/python2.7/site-packages/napalm_base-0.23.0-py2.7.egg/napalm_base/helpers.py", line 219, in mac
    return py23_compat.text_type(EUI(raw, dialect=_MACFormat))
  File "/home/user/Test/napalm/env/local/lib/python2.7/site-packages/netaddr-0.7.19-py2.7.egg/netaddr/eui/__init__.py", line 387, in __init__
    self.value = addr
  File "/home/user/Test/napalm/env/local/lib/python2.7/site-packages/netaddr-0.7.19-py2.7.egg/netaddr/eui/__init__.py", line 437, in _set_value
    % value)
netaddr.core.AddrFormatError: failed to detect EUI version: u'"AAAA-BBBB"'

Multiple config changes over the same session, before commit

Description of Issue/Question

The current implementation does not allow loading multiple changes over the same session, before committing.
Other drivers (at least napalm-junos, napalm-iosxr, napalm-pluribus and napalm-nxos) do offer this possibility, which is normal and natural.
To be consistent, one should be allowed to apply two or more consecutive changes before a commit.

get_interface_counters fails with stacktrace

Description of Issue/Question

When using get_interfaces_counters() for EOS you will get an error due to the fact that 'show interfaces error countes ' is not supported for port channels

Setup

napalm-eos version

(Paste verbatim output from pip freeze | grep napalm-eos between quotes below)

napalm-eos==0.4.1

eOS version

(Paste verbatim output from show version | json between quotes below)

{
    "modelName": "DCS-7280SR-48C6-M-R",
    "internalVersion": "4.17.1F-3465508.4171F",
    "systemMacAddress": "44:4c:a8:cd:33:7d",
    "serialNumber": "JPE16260700",
    "memTotal": 32472080,
    "bootupTimestamp": 1475664380.55,
    "memFree": 29033616,
    "version": "4.17.1F",
    "architecture": "i386",
    "isIntlVersion": false,
    "internalBuildId": "5b73e68d-e45b-4748-8d38-abf09997c867",
    "hardwareRevision": "11.03"
}

Steps to Reproduce the Issue

Error Traceback

In [4]: dev.get_interfaces_counters()
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-4-2dba5f41065f> in <module>()
----> 1 dev.get_interfaces_counters()

/home/loke/repos/napalm-eos/napalm_eos/eos.py in get_interfaces_counters(self)
    295 
    296             # Errors come from a different command
--> 297             errors = output[1]['interfaceErrorCounters'][interface]
    298             interface_counters[interface]['tx_errors'] = errors.get('outErrors', -1)
    299             interface_counters[interface]['rx_errors'] = errors.get('inErrors', -1)

KeyError: u'Port-Channel2'

KeyError when executing get_bgp_neighbors_detail

Description of Issue/Question

When the BGP session is down, the key representing the IP address of the neighbor is not set in the bgp_summary dictionary, which is the result of retrieving show ipv6 bgp summary vrf all and show ip bgp summary vrf all commands.

napalm-eos version

0.3.0

Network OS version

any

Steps to Reproduce the Issue

Execute get_bgp_neighbors_detail

Error Traceback

(Paste the complete traceback of the exception between quotes below)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/state/home/mircea/napalm-eos/napalm_eos/eos.py", line 1302, in get_bgp_neighbors_detail
    [peer_info['remote_address']]['prefixAccepted'])
KeyError: u'1.2.3.4'

.get_route_to() throwing uncatched errror

Description of Issue/Question

When attempting to get information about a connected route, an error is thrown

Setup

None

napalm-eos version

(Paste verbatim output from pip freeze | grep napalm-eos between quotes below)

napalm-eos==0.5.0

eOS version

(Paste verbatim output from show version | json between quotes below)

{
    "modelName": "vEOS",
    "internalVersion": "4.16.6M-3205780.4166M",
    "systemMacAddress": "00:15:5d:1b:db:cf",
    "serialNumber": "",
    "memTotal": 1897592,
    "bootupTimestamp": 1480670690.0,
    "memFree": 92896,
    "version": "4.16.6M",
    "architecture": "i386",
    "isIntlVersion": false,
    "internalBuildId": "e796e94c-ba3b-4355-afcf-ef0abfbfaee3",
    "hardwareRevision": ""
}

Steps to Reproduce the Issue

Attempt to get_route_to() directly connected route

Error Traceback

(Paste the complete traceback of the exception between quotes below)

Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from napalm_base import get_network_driver
>>> import pprint,getpass
>>> password = getpass.getpass()
Password:
>>> driver = get_network_driver('eos')
>>> device = driver('10.192.100.86', 'bewing', password)
>>> device.open()
>>> device.get_route_to(u'172.16.185.5')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "napalm_eos/eos.py", line 1071, in get_route_to
    'next_hop': napalm_base.helpers.ip(next_hop.get('nexthopAddr')),
  File "/home/bewing/napalm-eos/local/lib/python2.7/site-packages/napalm_base/helpers.py", line 242, in ip
    return py23_compat.text_type(IPAddress(addr))
  File "/home/bewing/napalm-eos/local/lib/python2.7/site-packages/netaddr/ip/__init__.py", line 306, in __init__
    'address from %r' % addr)
netaddr.core.AddrFormatError: failed to detect a valid IP address from None

JSON from the router for "show ip route":

localhost#show ip route 172.16.185.0 | json
{
    "vrfs": {
        "default": {
            "routes": {
                "172.16.185.0/24": {
                    "kernelProgrammed": true,
                    "directlyConnected": true,
                    "routeAction": "forward",
                    "vias": [
                        {
                            "interface": "Ethernet1"
                        }
                    ],
                    "hardwareProgrammed": true,
                    "routeType": "connected"
                }
            },
            "allRoutesProgrammedKernel": true,
            "routingDisabled": false,
            "allRoutesProgrammedHardware": true,
            "defaultRouteState": "reachable"
        }
    }
}

delete_snmp_config template issues

delete_snmp_config currently expects "community" to be a dictionary containing a community key indicating which community to delete.

Additionally, it's missing "snmp-server" in the actual removal line:

root@saltmaster:~# salt veos1 snmp.remove_config community='{blah: test}'
veos1:
    ----------
    already_configured:
        True
    comment:
        Cannot execute "load_template" on veos1 as bewing. Reason: Error [1002]: CLI command 3 of 3 'no community blah' failed: invalid command [Invalid input (at token 1: 'community')]!
        Configuration discarded.
    diff:
    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/dist-packages/napalm_base/base.py", line 125, in load_template
            **template_vars)
          File "/usr/local/lib/python2.7/dist-packages/napalm_base/helpers.py", line 86, in load_template
            return cls.load_merge_candidate(config=configuration)
          File "/usr/local/lib/python2.7/dist-packages/napalm_eos/eos.py", line 170, in load_merge_candidate
            self._load_config(filename, config, False)
          File "/usr/local/lib/python2.7/dist-packages/napalm_eos/eos.py", line 162, in _load_config
            raise MergeConfigException(e.message)
        MergeConfigException: Error [1002]: CLI command 3 of 3 'no community blah' failed: invalid command [Invalid input (at token 1: 'community')]

get_mac_address_table swallowing errors

get_mac_address_table() swallows all errors, and then returns an incorrect type:

In [1]: from napalm_eos import EOSDriver
In [2]: d = EOSDriver("fake", "user", "pass")
In [3]: d.get_mac_address_table()
Out[3]: {}

Notice that we didn't call open(), and that

try:
mac_entries = self.device.run_commands(commands)[0].get(
'unicastTable', {}).get('tableEntries', [])
except Exception:
return {}
eats the exception.

Also note that an empty dictionary is returned, instead of an empty list.

I'm not sure why we're trying to catch exceptions here instead of letting them raise. @mirceaulinic, blame log says you're it, do you remember? I'm tempted to just remove the try/except.

.get_snmp_information() not parsing communities correctly

.get_snmp_information() has a bad TextFSM template

.get_snmp_information on EOS returns {} if TextFSM cannot parse any community strings (other fields never get recorded)

TextFSM template can't parse
snmp-server community blah ro

Need to either:

  • Re-write the TextFSM template to correctly parse SNMP configuration
  • Re-write get_snmp_information to do a line-by-line parse, like the IOS driver.

I'd honestly prefer the latter, TextFSM is in the toolbox for multi-record, multi-line data.

KeyError when executing get_bgp_neighbors

Description of Issue/Question

Same issue as #53, for get_bgp_neighbors this time - I should have thought.

napalm-eos version

0.3.0

Network OS version

any

Steps to Reproduce the Issue

Execute get_bgp_neighbors

Error Traceback

(Paste the complete traceback of the exception between quotes below)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/state/home/mircea/napalm-eos/napalm_eos/eos.py", line 1302, in get_bgp_neighbors
    [peer_info['remote_address']]['prefixAccepted'])
KeyError: u'1.2.3.4'

Transport for eAPI should not be restricted to HTTPS

Description of Issue/Question

eAPI allows the use of UNIX Sockets, HTTP/HTTPS, and HTTP-Local as various transport options to access the device. It would be nice to have the .open() method take an argument specifying the preferred transport method rather than hardcoding https as the only possible mechanism.

Setup

napalm-eos version

(Paste verbatim output from pip freeze | grep napalm-eos between quotes below)


eOS version

(Paste verbatim output from show version | json between quotes below)


Steps to Reproduce the Issue

Error Traceback

(Paste the complete traceback of the exception between quotes below)


get_facts() does report internal OS version, not the OS version.

Description of Issue/Question

get_facts() does report internal OS version, not the OS version.

I assume that is by choice but I believe that is an incorrect behaviour.

Setup

napalm-eos version

(Paste verbatim output from pip freeze | grep napalm-eos between quotes below)

 # pip freeze | grep napalm-eos
napalm-eos==0.6.0

Untested release 0.4.0 blown some getters

Description of Issue/Question

Including get_interfaces, get_interfaces_ip or get_bgp_neighbors_detail.

Setup

napalm-eos version

(Paste verbatim output from pip freeze | grep napalm-eos between quotes below)

napalm-eos==0.4.0

eOS version

(Paste verbatim output from show version | json between quotes below)

any

Steps to Reproduce the Issue

Error Traceback

(Paste the complete traceback of the exception between quotes below)

>>> e.get_interfaces()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/state/home/mircea/napalm/local/lib/python2.7/site-packages/napalm_eos/eos.py", line 249, in get_interfaces
    values.pop('physicalAddress', u'')
  File "/state/home/mircea/napalm/local/lib/python2.7/site-packages/napalm_base/helpers.py", line 217, in mac
    return unicode(EUI(raw, dialect=_MACFormat))
  File "/state/home/mircea/napalm/local/lib/python2.7/site-packages/netaddr/eui/__init__.py", line 387, in __init__
    self.value = addr
  File "/state/home/mircea/napalm/local/lib/python2.7/site-packages/netaddr/eui/__init__.py", line 437, in _set_value
    % value)
netaddr.core.AddrFormatError: failed to detect EUI version: u''
>>>

ping() does not deal with truncated responses

Some destinations truncate payload in echo messages

napalm-eos version

(Paste verbatim output from pip freeze | grep napalm-eos between quotes below)

napalm-base==0.23.2
napalm-eos==0.5.6

eOS version

(Paste verbatim output from show version | json between quotes below)

{u'architecture': u'i386',
  u'bootupTimestamp': 1488060828.73,
  u'hardwareRevision': u'01.03',
  u'internalBuildId': u'8f820a40-8597-41b7-8871-2ba47ffd0aad',
  u'internalVersion': u'4.16.9M-3799680.4169M',
  u'isIntlVersion': False,
  u'memFree': 188640,
  u'memTotal': 3978076,
  u'modelName': u'DCS-7150S-64-CL-R',
  u'version': u'4.16.9M'}

Steps to Reproduce the Issue

import napalm_eos
d = device('veos1', 'admin', 'admin')
d.open()
d.device.run_commands(["ping 8.8.8.8"])[0]
d.ping("8.8.8.8")

Error Traceback

(Paste the complete traceback of the exception between quotes below)

{u'messages': [u'PING 8.8.8.8 (8.8.8.8) 72(100) bytes of data.\n72 bytes from 8.8.8.8: icmp_req=1 ttl=41 (truncated)\n72 bytes from 8.8.8.8: icmp_req=2 ttl=41 (truncated)\n72 bytes from 8.8.8.8: icmp_req=3 ttl=41 (truncated)\n72 bytes from 8.8.8.8: icmp_req=4 ttl=41 (truncated)\n72 bytes from 8.8.8.8: icmp_req=5 ttl=41 (truncated)\n\n--- 8.8.8.8 ping statistics ---\n5 packets transmitted, 5 received, 0% packet loss, time 102ms\nrtt min/avg/max/mdev = 24.904/25.067/25.643/0.305 ms, ipg/ewma 25.507/25.345 ms\n']}
napalm-eos/napalm_eos/eos.pyc in ping(self, destination, source, ttl, timeout, size, count, vrf)
   1685                         m = fields[6][5:]
   1686                         results_array.append({'ip_address': py23_compat.text_type(fields[3]),
-> 1687                                               'rtt': float(m)})
   1688                 elif 'packets transmitted' in line:
   1689                     ping_dict['success']['probes_sent'] = int(fields[0])

ValueError: could not convert string to float: cated)

FYI, Google is appearing to truncate ICMP responses > 64 bytes:

ping -s 80 -c 4 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 80(108) bytes of data.
72 bytes from 8.8.8.8: icmp_seq=1 ttl=44 (truncated)
72 bytes from 8.8.8.8: icmp_seq=2 ttl=44 (truncated)
72 bytes from 8.8.8.8: icmp_seq=3 ttl=44 (truncated)
72 bytes from 8.8.8.8: icmp_seq=4 ttl=44 (truncated)

--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 10.462/10.508/10.530/0.027 ms

ping -s 64 -c 4 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 64(92) bytes of data.
72 bytes from 8.8.8.8: icmp_seq=1 ttl=44 time=10.5 ms
72 bytes from 8.8.8.8: icmp_seq=2 ttl=44 time=10.5 ms
72 bytes from 8.8.8.8: icmp_seq=3 ttl=44 time=10.5 ms
72 bytes from 8.8.8.8: icmp_seq=4 ttl=44 time=10.5 ms

--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 10.505/10.516/10.540/0.126 ms

ping() does not deal with hostnames

Pinging a hostname changes output

napalm-eos version

(Paste verbatim output from pip freeze | grep napalm-eos between quotes below)

napalm-base==0.23.2
napalm-eos==0.5.6

eOS version

(Paste verbatim output from show version | json between quotes below)

{u'architecture': u'i386',
  u'bootupTimestamp': 1488060828.73,
  u'hardwareRevision': u'01.03',
  u'internalBuildId': u'8f820a40-8597-41b7-8871-2ba47ffd0aad',
  u'internalVersion': u'4.16.9M-3799680.4169M',
  u'isIntlVersion': False,
  u'memFree': 188640,
  u'memTotal': 3978076,
  u'modelName': u'DCS-7150S-64-CL-R',
  u'version': u'4.16.9M'}

Steps to Reproduce the Issue

import napalm_eos
d = device('veos1', 'admin', 'admin')
d.open()
d.device.run_commands(["ping 8.8.8.8"])[0]
d.ping("www.google.com")

Error Traceback

(Paste the complete traceback of the exception between quotes below)

{u'success': {u'packet_loss': 0,
  u'probes_sent': 5,
  u'results': [{u'ip_address': u'ord38s09-in-f4.1e100.ne', u'rtt': 0.0},
   {u'ip_address': u'ord38s09-in-f4.1e100.ne', u'rtt': 0.0},
   {u'ip_address': u'ord38s09-in-f4.1e100.ne', u'rtt': 0.0},
   {u'ip_address': u'ord38s09-in-f4.1e100.ne', u'rtt': 0.0},
   {u'ip_address': u'ord38s09-in-f4.1e100.ne', u'rtt': 0.0}],
  u'rtt_avg': 15.18,
  u'rtt_max': 15.21,
  u'rtt_min': 15.153,
  u'rtt_stddev': 0.136}}

Fix setup.cfg and requirements.cfg files

Relates to napalm-automation/napalm#280

Add setup.cfg and requirements-dev.txt file with the following content:

  • `setup.cfg
[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

`ping` fails when executed without explicit arguments

Description of Issue/Question

$ sudo salt 'edge01.evn01' net.ping 8.8.8.8
edge01.evn01:
    ----------
    comment:
        Cannot execute "ping" on None as None. Reason: Error [1002]: CLI command 2 of 2 'ping 8.8.8.8 timeout 0 size 0 repeat 0' failed: invalid command [Invalid input (at token 5: '0')]!
    out:
        ----------
    result:
        False
    traceback:
        Traceback (most recent call last):
          File "/usr/lib/python2.7/site-packages/salt/utils/napalm.py", line 118, in call
            out = getattr(napalm_device.get('DRIVER'), method)(*args, **kwargs)
          File "/usr/lib/python2.7/site-packages/napalm_eos/eos.py", line 1569, in ping
            output = self.device.run_commands([command], encoding='text')[0]['output']
          File "/usr/lib/python2.7/site-packages/pyeapi/client.py", line 672, in run_commands
            response = self._connection.execute(commands, encoding)
          File "/usr/lib/python2.7/site-packages/pyeapi/eapilib.py", line 475, in execute
            response = self.send(request)
          File "/usr/lib/python2.7/site-packages/pyeapi/eapilib.py", line 396, in send
            raise CommandError(code, msg, command_error=err, output=out)
        CommandError: Error [1002]: CLI command 2 of 2 'ping 8.8.8.8 timeout 0 size 0 repeat 0' failed: invalid command [Invalid input (at token 5: '0')]

get_bgp_config not working without peer groups

Description of Issue/Question

get_bgp_config not working without peer groups

Setup

napalm-eos version

(Paste verbatim output from pip freeze | grep napalm-eos between quotes below)

napalm-eos==0.5.1

eOS version

(Paste verbatim output from show version | json between quotes below)

eos-leaf1#show ver | json
{
    "modelName": "vEOS",
    "internalVersion": "4.15.5M-3054042.4155M",
    "systemMacAddress": "08:00:27:76:0f:74",
    "serialNumber": "",
    "memTotal": 1897592,
    "bootupTimestamp": 1484178092.29,
    "memFree": 78320,
    "version": "4.15.5M",
    "architecture": "i386",
    "internalBuildId": "d6560fe3-4c9f-4765-81f0-cba651cf54f8",
    "hardwareRevision": ""
}
eos-leaf1#

Steps to Reproduce the Issue

BGP Configured without the use of peer groups:

router bgp 104
   router-id 10.104.1.1
   timers bgp 5 15
   neighbor 10.10.10.19 remote-as 103
   neighbor 10.10.10.19 description Verizon
   neighbor 10.10.10.19 send-community
   neighbor 10.10.10.19 maximum-routes 12000
   network 10.104.1.0/24
   network 10.104.2.0/24
   network 10.104.3.0/24
   network 10.104.4.0/24

Error Traceback

Inconsistent output of `get_route_to`

Description of Issue/Question

Noticed the following:

>>> j.get_route_to('0.0.0.0/0')
{u'0.0.0.0/0': [{u'protocol': u'EBGP', u'inactive_reason': u'', u'last_active': False, u'age': 0, 
u'routing_table': u'default', u'next_hop': u'1.2.3.4', u'outgoing_interface': u'Ethernet42', 
u'preference': 200, u'current_active': False, u'selected_next_hop': False, u'protocol_attributes': {}}]}
>>> j.get_route_to('0.0.0.0/0', 'bgp')
{u'0.0.0.0/0': [{u'protocol': u'EBGP', u'inactive_reason': u'', u'last_active': True, u'age': 0, 
u'routing_table': u'default', u'next_hop': u'1.2.3.4', u'outgoing_interface': u'', u'preference': 200, 
u'current_active': True, u'selected_next_hop': True, u'protocol_attributes': {u'local_preference': 100, 
u'remote_as': 1234, u'communities': [u'13335:1234', u'13335:5678', u'13335:91011'], u'preference2': 
0, u'metric': 0, u'local_as': 13335, u'as_path': u'1234', u'remote_address': u'1.2.3.4'}}, {u'protocol': 
u'EBGP', u'inactive_reason': u'', u'last_active': False, u'age': 0, u'routing_table': u'default', 
u'next_hop': u'5.6.7.8', u'outgoing_interface': u'', u'preference': 200, u'current_active': False, 
u'selected_next_hop': False, u'protocol_attributes': {u'local_preference': 25, u'remote_as': 5678, 
u'communities': [u'13335:1234', u'13335:5678', u'13335:91011'], u'preference2': 0, u'metric': 0, 
u'local_as': 13335, u'as_path': u'5678', u'remote_address': u'5.6.7.8'}}]}
  • outgoing_interface is empty in j.get_route_to('0.0.0.0/0', 'bgp'), but not in j.get_route_to('0.0.0.0/0') although it's the same route
  • empty inactive_reason although the device provides
  • current_active: False & selected_next_hop: False in j.get_route_to('0.0.0.0/0') but they are current_active: True & selected_next_hop: True

Although they refer to the same route...

Loopback interfaces missing in get_facts()

The show interfaces status command used to populate the interfaces list in get_facts() does not return any loopback interfaces. Is this intentional? Nothing in the docs/mailing list that I found that states they should be excluded.

Disable OC

Remove all old OC implementation references.

get_lldp_neighbors() works but not get_lldp_neighbors_detail()

Description of Issue/Question

I am using get_lldp_neighbors_detail() in my code to gather lldp stats from EOS devices. However, there are challenges in retrieving lldp detail info even though lldp has been enabled on the device and the output can be viewed using the cli command.

Setup

Simple. IP connectivity to the device is available and transport is set to https.

napalm-eos version

(Paste verbatim output from pip freeze | grep napalm-eos between quotes below)

napalm-eos==0.3.0

eOS version

(Paste verbatim output from show version | json between quotes below)
Cannot paste the entire show version output due to legality issues.

"version": "4.15.5FX-7500R"
and
"version": "4.17.3F"

Steps to Reproduce the Issue

Error Traceback

(Paste the complete traceback of the exception between quotes below)

dev.get_lldp_neighbors_detail()

/Library/Python/2.7/site-packages/napalm_eos/eos.pyc in get_lldp_neighbors_detail(self, interface)
    523                         'remote_system_description'     : neighbor.get('systemDescription', u''),
    524                         'remote_chassis_id'             : neighbor.get('chassisId', u''),
--> 525                         'remote_system_capab'           : unicode(', '.join(capabilities)),
    526                         'remote_system_enable_capab'   : unicode(', '.join([capability for capability in capabilities.keys() if capabilities[capability]]))
    527                     }

TypeError: can only join an iterable

Config lock not released in some error cases

Description of Issue/Question

See topic. Will submit PR to resolve.

Setup

This was tested in a virtual salt environtment.

napalm-eos version

(Paste verbatim output from pip freeze | grep napalm-eos between quotes below)

root@saltmaster:/srv/pillar# pip freeze | grep napalm
napalm-base==0.23.0
napalm-eos==0.5.5

Steps to Reproduce the Issue

Create a config session lock
Error out in a new and interesting way, in a thread
Retry your earlier effort, and see that the config is still locked.

Error Traceback

(Paste the complete traceback of the exception between quotes below)

root@saltmaster:/srv/pillar# salt veos2 test.ping
veos2:
    True
root@saltmaster:/srv/pillar# salt veos2 net.load_config "non-existant file"
veos2:
    ----------
    already_configured:
        True
    comment:
        Cannot execute "load_merge_candidate" on veos2 as admin. Reason: [Errno 2] No such file or directory: 'non-existant file'!
        Configuration discarded.
    loaded_config:
    out:
        ----------
    result:
        False
    traceback:
        Traceback (most recent call last):
          File "/usr/lib/python2.7/dist-packages/salt/proxy/napalm.py", line 294, in call
            out = getattr(NETWORK_DEVICE.get('DRIVER'), method)(**params)  # calls the method with the specified parameters
          File "/usr/local/lib/python2.7/dist-packages/napalm_eos/eos.py", line 183, in load_merge_candidate
            self._load_config(filename, config, False)
          File "/usr/local/lib/python2.7/dist-packages/napalm_eos/eos.py", line 150, in _load_config
            with open(filename, 'r') as f:
        IOError: [Errno 2] No such file or directory: 'non-existant file'
root@saltmaster:/srv/pillar# salt veos2 net.load_config "non-existant file"
veos2:
    ----------
    already_configured:
        True
    comment:
        Cannot execute "load_merge_candidate" on veos2 as admin. Reason: Session is already in use by napalm!
        Configuration discarded.
    diff:
    loaded_config:
    result:
        False
    traceback:
        Traceback (most recent call last):
          File "/usr/lib/python2.7/dist-packages/salt/proxy/napalm.py", line 294, in call
            out = getattr(NETWORK_DEVICE.get('DRIVER'), method)(**params)  # calls the method with the specified parameters
          File "/usr/local/lib/python2.7/dist-packages/napalm_eos/eos.py", line 183, in load_merge_candidate
            self._load_config(filename, config, False)
          File "/usr/local/lib/python2.7/dist-packages/napalm_eos/eos.py", line 140, in _load_config
            self._lock()
          File "/usr/local/lib/python2.7/dist-packages/napalm_eos/eos.py", line 131, in _lock
            raise SessionLockedException('Session is already in use by napalm')
        SessionLockedException: Session is already in use by napalm
root@saltmaster:/srv/pillar# ssh admin@veos2
The authenticity of host 'veos2 (192.168.50.12)' can't be established.
RSA key fingerprint is 4d:2c:4b:06:5b:be:68:3e:39:b0:22:bd:b3:b9:67:6f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'veos2,192.168.50.12' (RSA) to the list of known hosts.
Password: 
Last login: Mon Mar  6 22:57:42 2017 from 192.168.50.10
veos2#show configuration sessions 
Maximum number of completed sessions: 1
Maximum number of pending sessions: 5

  Name    State       User    Terminal 
  ---- ----------- ---------- -------- 

veos2#exit
Connection to veos2 closed.

Stacktraces with get_environment()

Description of Issue/Question

get_environment() causes stacktraces on newer versions of EOS due to a to narrow regex

Setup

napalm-eos version

(Paste verbatim output from pip freeze | grep napalm-eos between quotes below)

napalm-eos==0.4.1

eOS version

(Paste verbatim output from show version | json between quotes below)

{
    "modelName": "DCS-7280SR-48C6-M-R",
    "internalVersion": "4.17.1F-3465508.4171F",
    "systemMacAddress": "44:4c:a8:cd:33:7d",
    "serialNumber": "xxxxx",
    "memTotal": 32472080,
    "bootupTimestamp": 1475664380.55,
    "memFree": 29064052,
    "version": "4.17.1F",
    "architecture": "i386",
    "isIntlVersion": false,
    "internalBuildId": "5b73e68d-e45b-4748-8d38-abf09997c867",
    "hardwareRevision": "11.03"
}

Steps to Reproduce the Issue

just run get_environment() against a newer arista

Error Traceback

(Paste the complete traceback of the exception between quotes below)

In [8]: dev.get_environment()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-8-0175c202483a> in <module>()
----> 1 dev.get_environment()

/home/loke/.virtualenvs/monitor/lib/python2.7/site-packages/napalm_eos/eos.pyc in get_environment(self)
    497         m = re.search('(\d+.\d+)\%', cpu_output.splitlines()[2])
    498         environment_counters['cpu'][0] = {
--> 499             '%usage': float(m.group(1))
    500         }
    501         m = re.search('(\d+)k\W+total\W+(\d+)k\W+used\W+(\d+)k\W+free', cpu_output.splitlines()[3])

AttributeError: 'NoneType' object has no attribute 'group'

Faulty data in tests and output

Description of Issue/Question

When polling environment on an arista the following dict is returned

{
'fans': []
'cpu': []
'temperature: []
'power': []
'available_ram': []
'used_ram': []
}

According to https://github.com/napalm-automation/napalm-base/blob/develop/napalm_base/base.py#L325 the dict should look like

{
'fans': []
'cpu': []
'temperature': []
'power': []
}

Setup

napalm-eos version

(Paste verbatim output from pip freeze | grep napalm-eos between quotes below)


eOS version

(Paste verbatim output from show version | json between quotes below)


Steps to Reproduce the Issue

Error Traceback

(Paste the complete traceback of the exception between quotes below)


Failure on calling 'get_interfaces_ip()' with quickstart, 'No IPv6 configured interfaces'

Error: pyeapi.eapilib.CommandError: Error [1000]: CLI command 3 of 3 'show ipv6 interface' failed: could not run command [No IPv6 configured interfaces]

For a work POC, I started looking at creating tutorial material for the various getter methods. I was using the EOS device in a script similar to the load_replace demo (ref napalm-automation/napalm#265), and the script failed on print device.get_interfaces_ip(). Is this intentional, or a bug?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.