Skip to content

Commit

Permalink
Fix broken get_bgp_neighbors when 6PE configured on eos (napalm-autom…
Browse files Browse the repository at this point in the history
…ation#945)

* fix _RE_BGP_PREFIX and NEIGHBOR_FILTER for 6PE into eos

* add testcase for 6PE version

* Renamed testcase mocked file for regexp syntax change
  • Loading branch information
Mabuchin authored and ExaneServerTeam committed Mar 4, 2020
1 parent abd5af0 commit ece9a35
Show file tree
Hide file tree
Showing 10 changed files with 191 additions and 2 deletions.
4 changes: 2 additions & 2 deletions napalm/eos/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class EOSDriver(NetworkDriver):
_RE_BGP_DESC = re.compile(r"\s+Description: (?P<description>.*?)$")
_RE_BGP_LOCAL = re.compile(r"Local AS is (?P<as>.*?),.*")
_RE_BGP_PREFIX = re.compile(
r"(\s*?)(?P<af>IPv[46]) Unicast:\s*(?P<sent>\d+)\s*(?P<received>\d+)"
r"(\s*?)(?P<af>IPv[46]) (Unicast|6PE):\s*(?P<sent>\d+)\s*(?P<received>\d+)"
) # noqa
_RE_SNMP_COMM = re.compile(
r"""^snmp-server\s+community\s+(?P<community>\S+)
Expand Down Expand Up @@ -426,7 +426,7 @@ def get_re_group(res, key, default=None):
except KeyError:
return default

NEIGHBOR_FILTER = "bgp neighbors vrf all | include remote AS | remote router ID |IPv[46] Unicast:.*[0-9]+|^Local AS|Desc|BGP state" # noqa
NEIGHBOR_FILTER = "bgp neighbors vrf all | include remote AS | remote router ID |IPv[46] (Unicast|6PE):.*[0-9]+|^Local AS|Desc|BGP state" # noqa
output_summary_cmds = self.device.run_commands(
["show ipv6 bgp summary vrf all", "show ip bgp summary vrf all"],
encoding="json",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"global": {
"router_id": "192.168.56.3",
"peers": {
"192.168.56.4": {
"is_enabled": true,
"uptime": "...",
"remote_as": 65001,
"description": "",
"remote_id": "192.168.56.3",
"local_as": 65002,
"is_up": false,
"address_family": {
"ipv4": {
"sent_prefixes": 0,
"accepted_prefixes": -1,
"received_prefixes": 0
},
"ipv6": {
"sent_prefixes": 0,
"accepted_prefixes": -1,
"received_prefixes": 0
}
}
},
"192.168.56.2": {
"is_enabled": true,
"uptime": "...",
"remote_as": 65002,
"description": "",
"remote_id": "192.168.56.2",
"local_as": 65001,
"is_up": true,
"address_family": {
"ipv4": {
"sent_prefixes": 0,
"accepted_prefixes": -1,
"received_prefixes": 0
},
"ipv6": {
"sent_prefixes": 0,
"accepted_prefixes": -1,
"received_prefixes": 0
}
}
},
"2001:7f8::f10:0:2": {
"is_enabled": true,
"uptime": "...",
"remote_as": 65002,
"description": "",
"remote_id": "192.168.56.2",
"local_as": 65001,
"is_up": true,
"address_family": {
"ipv4": {
"sent_prefixes": 0,
"accepted_prefixes": -1,
"received_prefixes": 0
},
"ipv6": {
"sent_prefixes": 0,
"accepted_prefixes": -1,
"received_prefixes": 0
}
}
},
"2001:7f8::f10:0:3": {
"is_enabled": true,
"uptime": "...",
"remote_as": 65001,
"description": "",
"remote_id": "192.168.56.3",
"local_as": 65002,
"is_up": false,
"address_family": {
"ipv4": {
"sent_prefixes": 0,
"accepted_prefixes": -1,
"received_prefixes": 0
},
"ipv6": {
"sent_prefixes": 0,
"accepted_prefixes": -1,
"received_prefixes": 0
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
BGP neighbor is 192.168.56.2, remote AS 65002, external link
BGP version 4, remote router ID 192.168.56.2, VRF default
BGP state is Established, up for 32d16h
IPv4 Unicast: 0 0
IPv6 6PE: 0 0
Local AS is 65001, local router ID 192.168.56.3
BGP neighbor is 192.168.56.4, remote AS 65001, external link
BGP version 4, remote router ID 192.168.56.3, VRF default
BGP state is Established, up for 32d16h
IPv4 Unicast: 0 0
IPv6 6PE: 0 0
Local AS is 65002, local router ID 192.168.56.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"vrfs": {
"default": {
"routerId": "192.168.56.3",
"peers": {
"192.168.56.2": {
"msgSent": 6,
"inMsgQueue": 0,
"prefixReceived": 0,
"upDownTime": 1452680643.198489,
"version": 4,
"msgReceived": 5,
"prefixAccepted": 0,
"peerState": "Established",
"outMsgQueue": 0,
"underMaintenance": false,
"asn": 65002
},
"192.168.56.4": {
"msgSent": 267,
"inMsgQueue": 0,
"prefixReceived": 0,
"upDownTime": 1452696202.499104,
"version": 4,
"msgReceived": 263,
"prefixAccepted": 0,
"peerState": "Active",
"outMsgQueue": 0,
"underMaintenance": false,
"asn": 65001
}
},
"vrf": "default",
"asn": 65001
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"vrfs": {
"default": {
"routerId": "192.168.56.3",
"peers": {
"2001:7f8::f10:0:2": {
"msgSent": 5,
"inMsgQueue": 0,
"prefixReceived": 0,
"upDownTime": 1452681618.167685,
"version": 4,
"msgReceived": 5,
"prefixAccepted": 0,
"peerState": "Established",
"outMsgQueue": 0,
"underMaintenance": false,
"asn": 65002
},
"2001:7f8::f10:0:3": {
"msgSent": 267,
"inMsgQueue": 0,
"prefixReceived": 0,
"upDownTime": 1452696202.499104,
"version": 4,
"msgReceived": 263,
"prefixAccepted": 0,
"peerState": "Active",
"outMsgQueue": 0,
"underMaintenance": false,
"asn": 65001
}
},
"vrf": "default",
"asn": 65001
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
BGP neighbor is 2001:7f8::f10:0:2, remote AS 65002, external link
BGP version 4, remote router ID 192.168.56.2, VRF default
BGP state is Established, up for 32d16h
IPv4 Unicast: 0 0
IPv6 Unicast: 0 0
Local AS is 65001, local router ID 192.168.56.3
BGP neighbor is 2001:7f8::f10:0:3, remote AS 65001, external link
BGP version 4, remote router ID 192.168.56.3, VRF default
BGP state is Established, up for 32d16h
IPv4 Unicast: 0 0
IPv6 Unicast: 0 0
Local AS is 65002, local router ID 192.168.56.2

0 comments on commit ece9a35

Please sign in to comment.