Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

Commit

Permalink
Merge pull request #133 from napalm-automation/develop
Browse files Browse the repository at this point in the history
napalm-nxos release 0.7.0
  • Loading branch information
ktbyers committed Sep 25, 2017
2 parents 2780510 + acdfe1a commit 7550149
Show file tree
Hide file tree
Showing 98 changed files with 19,147 additions and 14 deletions.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include requirements.txt
include napalm_nxos/templates/*.j2
include napalm_nxos/utils/textfsm_templates/*.tpl
include napalm_nxos_ssh/templates/*.j2
include napalm_nxos_ssh/utils/textfsm_templates/*.tpl
20 changes: 16 additions & 4 deletions napalm_nxos/nxos.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def _load_config(self):
return True
except Exception:
return False
if 'Rollback failed.' in rollback_result['msg']:
if 'Rollback failed.' in rollback_result['msg'] or 'ERROR' in rollback_result:
raise ReplaceConfigException(rollback_result['msg'])
return True

Expand Down Expand Up @@ -437,6 +437,15 @@ def get_lldp_neighbors(self):

def get_bgp_neighbors(self):
results = {}
bgp_state_dict = {
'Idle': {'is_up': False, 'is_enabled': True},
'Active': {'is_up': False, 'is_enabled': True},
'Open': {'is_up': False, 'is_enabled': True},
'Established': {'is_up': True, 'is_enabled': True},
'Closing': {'is_up': True, 'is_enabled': True},
'Shutdown': {'is_up': False, 'is_enabled': False},
}

try:
cmd = 'show bgp sessions vrf all'
vrf_list = self._get_command_table(cmd, 'TABLE_vrf', 'ROW_vrf')
Expand All @@ -455,15 +464,18 @@ def get_bgp_neighbors(self):
for neighbor_dict in neighbors_list:
neighborid = napalm_base.helpers.ip(neighbor_dict['neighbor-id'])
remoteas = napalm_base.helpers.as_number(neighbor_dict['remoteas'])
state = py23_compat.text_type(neighbor_dict['state'])

bgp_state = bgp_state_dict[state]

result_peer_dict = {
'local_as': int(vrf_dict['local-as']),
'remote_as': remoteas,
'remote_id': neighborid,
'is_enabled': True,
'is_enabled': bgp_state['is_enabled'],
'uptime': -1,
'description': py23_compat.text_type(''),
'is_up': True
'description': '',
'is_up': bgp_state['is_up'],
}
result_peer_dict['address_family'] = {
'ipv4': {
Expand Down
4 changes: 2 additions & 2 deletions napalm_nxos/utils/textfsm_templates/snmp_config.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Value Location (\S+)
Value Contact (\S+)
Value Location (.*)
Value Contact (.*)
Value Community (\S+)
Value Mode (network\-admin|network\-operator)
Value ACL (\S+)
Expand Down
30 changes: 30 additions & 0 deletions napalm_nxos_ssh/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Dravetech AB. All rights reserved.
#
# The contents of this file are licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

"""napalm_nxos package."""

# Import stdlib
import pkg_resources

# Import local modules
from napalm_nxos_ssh.nxos_ssh import NXOSSSHDriver


try:
__version__ = pkg_resources.get_distribution('napalm-nxos-ssh').version
except pkg_resources.DistributionNotFound:
__version__ = "Not installed"

__all__ = ('NXOSSSHDriver',)

0 comments on commit 7550149

Please sign in to comment.