Skip to content

Commit

Permalink
Merge 7e8c2e3 into 698cfd7
Browse files Browse the repository at this point in the history
  • Loading branch information
bewing committed Oct 29, 2019
2 parents 698cfd7 + 7e8c2e3 commit ce0702b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion napalm/base/test/getters.py
Expand Up @@ -211,7 +211,8 @@ def test_get_environment(self, test_case):
def test_get_bgp_neighbors(self, test_case):
"""Test get_bgp_neighbors."""
get_bgp_neighbors = self.device.get_bgp_neighbors()
assert "global" in get_bgp_neighbors.keys()
if len(get_bgp_neighbors) > 0:
assert "global" in get_bgp_neighbors.keys()

for vrf, vrf_data in get_bgp_neighbors.items():
assert isinstance(vrf_data["router_id"], str)
Expand Down
6 changes: 3 additions & 3 deletions napalm/ios/ios.py
Expand Up @@ -1497,9 +1497,9 @@ def get_bgp_neighbors(self):
# get summary output from device
cmd_bgp_all_sum = "show bgp all summary"
summary_output = self._send_command(cmd_bgp_all_sum).strip()

if "Invalid input detected" in summary_output:
raise CommandErrorException("BGP is not running on this device")
bgp_not_running = ["Invalid input", "BGP not active"]
if any((s in summary_output for s in bgp_not_running)):
return {}

# get neighbor output from device
neighbor_output = ""
Expand Down
@@ -0,0 +1 @@
{}
@@ -0,0 +1 @@
% BGP not active

0 comments on commit ce0702b

Please sign in to comment.