diff --git a/.github/workflows/commit.yaml b/.github/workflows/commit.yaml index 7449f1a22..7c6754157 100644 --- a/.github/workflows/commit.yaml +++ b/.github/workflows/commit.yaml @@ -10,7 +10,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: [3.8, 3.9, 3.10.9, 3.11, 3.12.0] + python-version: ["3.9", "3.10.9", "3.11", "3.12", "3.13"] steps: - name: Checkout repository diff --git a/.gitignore b/.gitignore index 87330b57c..184d469e6 100644 --- a/.gitignore +++ b/.gitignore @@ -59,6 +59,7 @@ docs/_static/ .venv .vscode .devcontainer +.python-version env *.swp diff --git a/README.md b/README.md index 764f39bff..8b8bf8b93 100644 --- a/README.md +++ b/README.md @@ -31,15 +31,15 @@ Install pip install napalm ``` +*Note*: Beginning with release 5.1.0 and later, NAPALM offers support for +Python 3.9+ only. + *Note*: Beginning with release 5.0.0 and later, NAPALM offers support for Python 3.8+ only. *Note*: Beginning with release 4.0.0 and later, NAPALM offers support for Python 3.7+ only. -*Note*: Beginning with release 3.0.0 and later, NAPALM offers support for -Python 3.6+ only. - Upgrading ========= diff --git a/docs/requirements.txt b/docs/requirements.txt index e0ea7ee6c..6931bec14 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,8 +1,8 @@ -urllib3==2.2.1 # https://github.com/readthedocs/readthedocs.org/issues/10290 -sphinx==7.2.6 +urllib3==2.3.0 # https://github.com/readthedocs/readthedocs.org/issues/10290 +sphinx==7.4.7 sphinx-rtd-theme==2.0.0 invoke==2.2.0 -jinja2==3.1.3 -MarkupSafe==2.1.5 -pytest==7.3.1 -ansible==9.4.0 +jinja2==3.1.6 +MarkupSafe==3.0.2 +pytest==8.3.5 +ansible==11.3.0 \ No newline at end of file diff --git a/napalm/__init__.py b/napalm/__init__.py index b6dcea664..2b5ce63e2 100644 --- a/napalm/__init__.py +++ b/napalm/__init__.py @@ -1,4 +1,4 @@ -import pkg_resources +from importlib.metadata import version, PackageNotFoundError import sys import logging @@ -17,14 +17,14 @@ # Verify Python Version that is running try: - if not (sys.version_info.major == 3 and sys.version_info.minor >= 7): - raise RuntimeError("NAPALM requires Python 3.7 or greater") + if not (sys.version_info.major == 3 and sys.version_info.minor >= 9): + raise RuntimeError("NAPALM requires Python 3.9 or greater") except AttributeError: - raise RuntimeError("NAPALM requires Python 3.7 or greater") + raise RuntimeError("NAPALM requires Python 3.9 or greater") try: - __version__ = pkg_resources.get_distribution("napalm").version -except pkg_resources.DistributionNotFound: + __version__ = version("napalm") +except PackageNotFoundError: __version__ = "Not installed" __all__ = ("get_network_driver", "SUPPORTED_DRIVERS") diff --git a/napalm/base/base.py b/napalm/base/base.py index 2d3e96a0b..7c69c61b1 100644 --- a/napalm/base/base.py +++ b/napalm/base/base.py @@ -639,7 +639,7 @@ def get_lldp_neighbors_detail( def get_bgp_config( self, group: str = "", neighbor: str = "" - ) -> models.BPGConfigGroupDict: + ) -> models.BGPConfigGroupDict: """ Returns a dictionary containing the BGP configuration. Can return either the whole config, either the config only for a group or neighbor. @@ -921,12 +921,23 @@ def get_ntp_servers(self) -> Dict[str, models.NTPServerDict]: """ Returns the NTP servers configuration as dictionary. The keys of the dictionary represent the IP Addresses of the servers. - Inner dictionaries do not have yet any available keys. + Inner dictionaries MAY contain information regarding per-server configuration. Example:: { - '192.168.0.1': {}, + '192.168.0.1': + { + 'address': '192.168.0.1', + 'port': 123, + 'version': 4, + 'association_type': 'SERVER', + 'iburst': False, + 'prefer': False, + 'network_instance': 'default', + 'source_address': '192.0.2.1', + 'key_id': -1, + }, '17.72.148.53': {}, '37.187.56.220': {}, '162.158.20.18': {} diff --git a/napalm/base/clitools/cl_napalm.py b/napalm/base/clitools/cl_napalm.py index d717f5a07..47c3a8ede 100755 --- a/napalm/base/clitools/cl_napalm.py +++ b/napalm/base/clitools/cl_napalm.py @@ -7,7 +7,8 @@ import logging import argparse import getpass -import pkg_resources +import pkgutil +from importlib.metadata import version from functools import wraps @@ -156,9 +157,9 @@ def check_installed_packages(): logger.debug("Gathering napalm packages") napalm_packages = sorted( [ - "{}=={}".format(i.key, i.version) - for i in pkg_resources.working_set - if i.key.startswith("napalm") + "{}=={}".format(i.name, version(i.name)) + for i in list(pkgutil.iter_modules()) + if i.name.startswith("napalm") ] ) for n in napalm_packages: diff --git a/napalm/base/models.py b/napalm/base/models.py index 9d26e6c71..159c0ac75 100644 --- a/napalm/base/models.py +++ b/napalm/base/models.py @@ -153,8 +153,8 @@ "AFDict", {"sent_prefixes": int, "accepted_prefixes": int, "received_prefixes": int} ) -BPGConfigGroupDict = TypedDict( - "BPGConfigGroupDict", +BGPConfigGroupDict = TypedDict( + "BGPConfigGroupDict", { "type": str, "description": str, @@ -188,8 +188,8 @@ }, ) -BGPStateAdressFamilyDict = TypedDict( - "BGPStateAdressFamilyDict", +BGPStateAddressFamilyDict = TypedDict( + "BGPStateAddressFamilyDict", {"received_prefixes": int, "accepted_prefixes": int, "sent_prefixes": int}, ) @@ -203,7 +203,7 @@ "is_enabled": bool, "description": str, "uptime": int, - "address_family": Dict[str, BGPStateAdressFamilyDict], + "address_family": Dict[str, BGPStateAddressFamilyDict], }, ) @@ -223,16 +223,22 @@ NTPPeerDict = TypedDict( "NTPPeerDict", - { - # will populate it in the future wit potential keys - }, + {}, total=False, ) NTPServerDict = TypedDict( "NTPServerDict", { - # will populate it in the future wit potential keys + "address": str, + "port": int, + "version": int, + "association_type": str, + "iburst": bool, + "prefer": bool, + "network_instance": str, + "source_address": str, + "key_id": int, }, total=False, ) diff --git a/napalm/base/test/base.py b/napalm/base/test/base.py index d46f7ff47..7169f4c8a 100644 --- a/napalm/base/test/base.py +++ b/napalm/base/test/base.py @@ -323,7 +323,7 @@ def test_get_bgp_config(self): result = len(get_bgp_config) > 0 for bgp_group in get_bgp_config.values(): - result = result and self._test_model(models.BPGConfigGroupDict, bgp_group) + result = result and self._test_model(models.BGPConfigGroupDict, bgp_group) for bgp_neighbor in bgp_group.get("neighbors", {}).values(): result = result and self._test_model( models.BGPConfigNeighborDict, bgp_neighbor diff --git a/napalm/base/test/getters.py b/napalm/base/test/getters.py index 3d686cec5..4d79a9ddd 100644 --- a/napalm/base/test/getters.py +++ b/napalm/base/test/getters.py @@ -90,7 +90,7 @@ def mock_wrapper(cls, test_case): attr.current_test = "" # Empty them to avoid side effects attr.current_test_case = "" # Empty them to avoid side effects - return result + return None @functools.wraps(func) def real_wrapper(cls, test_case): @@ -249,7 +249,7 @@ def test_get_bgp_config(self, test_case): assert get_bgp_config == {} or len(get_bgp_config) > 0 for bgp_group in get_bgp_config.values(): - assert helpers.test_model(models.BPGConfigGroupDict, bgp_group) + assert helpers.test_model(models.BGPConfigGroupDict, bgp_group) for bgp_neighbor in bgp_group.get("neighbors", {}).values(): assert helpers.test_model(models.BGPConfigNeighborDict, bgp_neighbor) @@ -311,7 +311,9 @@ def test_get_ntp_peers(self, test_case): for peer, peer_details in get_ntp_peers.items(): assert isinstance(peer, str) - assert helpers.test_model(models.NTPPeerDict, peer_details) + assert helpers.test_model( + models.NTPPeerDict, peer_details, allow_subset=True + ) return get_ntp_peers @@ -323,7 +325,9 @@ def test_get_ntp_servers(self, test_case): for server, server_details in get_ntp_servers.items(): assert isinstance(server, str) - assert helpers.test_model(models.NTPServerDict, server_details) + assert helpers.test_model( + models.NTPServerDict, server_details, allow_subset=True + ) return get_ntp_servers diff --git a/napalm/base/test/helpers.py b/napalm/base/test/helpers.py index de81e48ed..0ce734c34 100644 --- a/napalm/base/test/helpers.py +++ b/napalm/base/test/helpers.py @@ -1,26 +1,31 @@ """Several methods to help with the tests.""" -def test_model(model, data): +def test_model(model, data, allow_subset=False): """Return if the dictionary `data` complies with the `model`.""" # Access the underlying schema for a TypedDict directly - model = model.__annotations__ - same_keys = set(model.keys()) == set(data.keys()) + annotations = model.__annotations__ + if allow_subset: + same_keys = set(data.keys()) <= set(annotations.keys()) + source = data + else: + same_keys = set(annotations.keys()) == set(data.keys()) + source = annotations if not same_keys: print( "model_keys: {}\ndata_keys: {}".format( - sorted(model.keys()), sorted(data.keys()) + sorted(annotations.keys()), sorted(data.keys()) ) ) correct_class = True - for key, instance_class in model.items(): - correct_class = isinstance(data[key], instance_class) and correct_class + for key in source.keys(): + correct_class = isinstance(data[key], annotations[key]) and correct_class if not correct_class: print( "key: {}\nmodel_class: {}\ndata_class: {}".format( - key, instance_class, data[key].__class__ + key, annotations[key], data[key].__class__ ) ) diff --git a/napalm/eos/eos.py b/napalm/eos/eos.py index b0a31ed19..d4b4b0e8c 100644 --- a/napalm/eos/eos.py +++ b/napalm/eos/eos.py @@ -34,11 +34,12 @@ import pyeapi from pyeapi.eapilib import ConnectionError, EapiConnection from netmiko import ConfigInvalidException +from typing import Dict # NAPALM base import napalm.base.helpers from napalm.base.netmiko_helpers import netmiko_args -from napalm.base.base import NetworkDriver +from napalm.base.base import NetworkDriver, models from napalm.base.utils import string_parsers from napalm.base.exceptions import ( CommitError, @@ -420,18 +421,17 @@ def _load_config(self, filename=None, config=None, replace=True): for line in lines: line = line.strip() - if line == "": - continue if line.startswith("!") and not line.startswith("!!"): continue commands.append(line) - for start, depth in [ - (s, d) for (s, d) in self.HEREDOC_COMMANDS if s in commands - ]: - commands = self._multiline_convert(commands, start=start, depth=depth) + if self.transport != "ssh": + for start, depth in [ + (s, d) for (s, d) in self.HEREDOC_COMMANDS if s in commands + ]: + commands = self._multiline_convert(commands, start=start, depth=depth) - commands = self._mode_comment_convert(commands) + commands = self._mode_comment_convert(commands) if self.transport == "ssh": try: @@ -529,7 +529,7 @@ def confirm_commit(self): "configure session {} commit".format(self.config_session), "write memory", ] - self._run_commands(commands) + self._run_commands(commands, encoding="text") self.config_session = None else: raise CommitError("No pending commit-confirm found!") @@ -672,140 +672,84 @@ def get_interfaces_counters(self): ) return interface_counters - def get_bgp_neighbors(self): - def get_re_group(res, key, default=None): - """Small helper to retrieve data from re match groups""" - try: - return res.group(key) - except KeyError: - return default - - NEIGHBOR_FILTER = "vrf all | include IPv[46] (Unicast|6PE):.*[0-9]+ | grep -v ' IPv[46] Unicast:/.' | remote AS |^Local AS|Desc|BGP state |remote router ID" # noqa - output_summary_cmds = self._run_commands( - ["show ipv6 bgp summary vrf all", "show ip bgp summary vrf all"], - encoding="json", - ) - output_neighbor_cmds = self._run_commands( + def get_bgp_neighbors(self) -> Dict[str, models.BGPStateNeighborsPerVRFDict]: + cmd_outputs = self._run_commands( [ - "show ip bgp neighbors " + NEIGHBOR_FILTER, - "show ipv6 bgp peers " + NEIGHBOR_FILTER, + "show ip bgp summary vrf all", + "show ipv6 bgp summary vrf all", + "show ip bgp neighbors vrf all", + "show ipv6 bgp peers vrf all", ], - encoding="text", + encoding="json", ) - bgp_counters = defaultdict(lambda: dict(peers={})) - for summary in output_summary_cmds: - """ - Json output looks as follows - "vrfs": { - "default": { - "routerId": 1, - "asn": 1, - "peers": { - "1.1.1.1": { - "msgSent": 1, - "inMsgQueue": 0, - "prefixReceived": 3926, - "upDownTime": 1449501378.418644, - "version": 4, - "msgReceived": 59616, - "prefixAccepted": 3926, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": 1 - } - } - } - } - """ - for vrf, vrf_data in summary["vrfs"].items(): - bgp_counters[vrf]["router_id"] = vrf_data["routerId"] - for peer, peer_data in vrf_data["peers"].items(): - if peer_data["peerState"] == "Idle": + bgp_counters = defaultdict( + lambda: models.BGPStateNeighborsPerVRFDict( + peers=models.BGPStateNeighborDict() # type: ignore + ) # type: ignore + ) # type: ignore + # Iterate IPv4 and IPv6 neighbor details + for cmd in cmd_outputs[2:]: + for vrf_name, vrf_data in cmd["vrfs"].items(): + vrf = bgp_counters[vrf_name] + for peer in vrf_data["peerList"]: + peer_ip = napalm.base.helpers.ip(peer["peerAddress"]) + v4_summary = cmd_outputs[0]["vrfs"][vrf_name]["peers"].get( + peer_ip, {} + ) + v6_summary = cmd_outputs[1]["vrfs"][vrf_name]["peers"].get( + peer_ip, {} + ) + local_as = napalm.base.helpers.as_number(peer["localAsn"]) + remote_as = napalm.base.helpers.as_number(peer["asn"]) + remote_id = napalm.base.helpers.ip(peer["routerId"]) + if peer["state"] == "Idle": is_enabled = ( True - if peer_data["peerStateIdleReason"] != "Admin" + if peer["idleReason"] != "Administratively shut down" else False ) else: is_enabled = True - peer_info = { - "is_up": peer_data["peerState"] == "Established", - "is_enabled": is_enabled, - "uptime": int(time.time() - float(peer_data["upDownTime"])), - "description": peer_data.get("description", ""), - } - bgp_counters[vrf]["peers"][napalm.base.helpers.ip(peer)] = peer_info - lines = [] - [lines.extend(x["output"].splitlines()) for x in output_neighbor_cmds] - while lines: - """ - Raw output from the command looks like the following: - - BGP neighbor is 1.1.1.1, remote AS 1, external link - Description: Very info such descriptive - BGP version 4, remote router ID 1.1.1.1, VRF my_vrf - BGP state is Idle, Administratively shut down - IPv4 Unicast: 683 78 - IPv6 Unicast: 0 0 - Local AS is 2, local router ID 2.2.2.2 - """ - neighbor_info = re.match(self._RE_BGP_INFO, lines.pop(0)) - # this line can be either description or rid info - next_line = lines.pop(0) - desc = re.match(self._RE_BGP_DESC, next_line) - if desc is None: - rid_info = re.match(self._RE_BGP_RID_INFO, next_line) - desc = "" - else: - rid_info = re.match(self._RE_BGP_RID_INFO, lines.pop(0)) - desc = desc.group("description") - lines.pop(0) - v4_stats = re.match(self._RE_BGP_PREFIX, lines.pop(0)) - v6_stats = re.match(self._RE_BGP_PREFIX, lines.pop(0)) - local_as = re.match(self._RE_BGP_LOCAL, lines.pop(0)) - data = { - "remote_as": napalm.base.helpers.as_number(neighbor_info.group("as")), - "remote_id": napalm.base.helpers.ip( - get_re_group(rid_info, "rid", "0.0.0.0") - ), - "local_as": napalm.base.helpers.as_number(local_as.group("as")), - "description": str(desc), - "address_family": { - "ipv4": { - "sent_prefixes": int(get_re_group(v4_stats, "sent", -1)), - "received_prefixes": int( - get_re_group(v4_stats, "received", -1) + is_up = peer["state"] == "Established" + description = peer.get("description", "") + uptime = int(peer.get("establishedTime", -1)) + v4: models.BGPStateAddressFamilyDict = { + "received_prefixes": peer["prefixesReceived"], + "accepted_prefixes": ( + v4_summary["prefixAccepted"] if v4_summary else 0 ), - "accepted_prefixes": -1, - }, - "ipv6": { - "sent_prefixes": int(get_re_group(v6_stats, "sent", -1)), - "received_prefixes": int( - get_re_group(v6_stats, "received", -1) + "sent_prefixes": peer["prefixesSent"], + } + v6: models.BGPStateAddressFamilyDict = { + "received_prefixes": peer["v6PrefixesReceived"], + "accepted_prefixes": ( + v6_summary["prefixAccepted"] if v6_summary else 0 ), - "accepted_prefixes": -1, - }, - }, - } - peer_addr = napalm.base.helpers.ip(neighbor_info.group("neighbor")) - vrf = rid_info.group("vrf") - if peer_addr not in bgp_counters[vrf]["peers"]: - bgp_counters[vrf]["peers"][peer_addr] = { - "is_up": False, # if not found, means it was not found in the oper stats - # i.e. neighbor down, - "uptime": 0, - "is_enabled": True, - } - if ( - "description" in bgp_counters[vrf]["peers"][peer_addr] - and not data["description"] - ): - data["description"] = bgp_counters[vrf]["peers"][peer_addr][ - "description" - ] - bgp_counters[vrf]["peers"][peer_addr].update(data) + "sent_prefixes": peer["v6PrefixesSent"], + } + peer_data: models.BGPStateNeighborDict = { + "local_as": local_as, + "remote_as": remote_as, + "remote_id": remote_id, + "is_up": is_up, + "is_enabled": is_enabled, + "description": description, + "uptime": uptime, + "address_family": { + "ipv4": v4, + "ipv6": v6, + }, + } + vrf["peers"][peer_ip] = peer_data + + # Iterate IPv4 and IPv6 summary details for router-id assignment + for cmd in cmd_outputs[:2]: + for vrf_name, vrf_data in cmd["vrfs"].items(): + bgp_counters[vrf_name]["router_id"] = napalm.base.helpers.ip( + vrf_data["routerId"] + ) + if "default" in bgp_counters: bgp_counters["global"] = bgp_counters.pop("default") return dict(bgp_counters) @@ -1257,21 +1201,82 @@ def get_arp_table(self, vrf=""): return arp_table def get_ntp_servers(self): - commands = ["show running-config | section ntp"] + result = {} - raw_ntp_config = self._run_commands(commands, encoding="text")[0].get( - "output", "" - ) + commands = ["show running-config | section ntp"] - ntp_config = napalm.base.helpers.textfsm_extractor( - self, "ntp_peers", raw_ntp_config + raw_ntp_config = ( + self._run_commands(commands, encoding="text")[0] + .get("output", "") + .splitlines() ) - return { - str(ntp_peer.get("ntppeer")): {} - for ntp_peer in ntp_config - if ntp_peer.get("ntppeer", "") - } + for server in raw_ntp_config: + details = { + "port": 123, + "version": 4, + "association_type": "SERVER", + "iburst": False, + "prefer": False, + "network_instance": "default", + "source_address": "", + "key_id": -1, + } + tokens = server.split() + if tokens[0] != "ntp": + continue + if tokens[2] == "vrf": + details["network_instance"] = tokens[3] + server_ip = details["address"] = tokens[4] + idx = 5 + else: + server_ip = details["address"] = tokens[2] + idx = 3 + try: + parsed_address = napalm.base.helpers.ipaddress.ip_address(server_ip) + family = parsed_address.version + except ValueError: + # Assume family of 4, unless local-interface has no IPv4 addresses + family = 4 + while idx < len(tokens): + if tokens[idx] == "iburst": + details["iburst"] = True + idx += 1 + + elif tokens[idx] == "key": + details["key_id"] = int(tokens[idx + 1]) + idx += 2 + + elif tokens[idx] == "local-interface": + interfaces = self.get_interfaces_ip() + intf = tokens[idx + 1] + if family == 6 and interfaces[intf]["ipv6"]: + details["source_address"] = list( + interfaces[intf]["ipv6"].keys() + )[0] + elif interfaces[intf]["ipv4"]: + details["source_address"] = list( + interfaces[intf]["ipv4"].keys() + )[0] + elif interfaces[intf]["ipv6"]: + details["source_address"] = list( + interfaces[intf]["ipv6"].keys() + )[0] + idx += 2 + + elif tokens[idx] == "version": + details["version"] = int(tokens[idx + 1]) + idx += 2 + + elif tokens[idx] == "prefer": + details["prefer"] = True + idx += 1 + else: # Shouldn't happen + idx += 1 + + result[server_ip] = details + + return result def get_ntp_stats(self): ntp_stats = [] @@ -1742,7 +1747,7 @@ def traceroute( commands = [] if vrf: - commands.append("routing-context vrf {vrf}".format(vrf=vrf)) + commands.append("cli vrf {vrf}".format(vrf=vrf)) if source: source_opt = "-s {source}".format(source=source) @@ -2248,7 +2253,7 @@ def ping( commands = [] if vrf: - commands.append("routing-context vrf {vrf}".format(vrf=vrf)) + commands.append("cli vrf {vrf}".format(vrf=vrf)) command = "ping {}".format(destination) command += " timeout {}".format(timeout) diff --git a/napalm/eos/utils/textfsm_templates/ntp_peers.tpl b/napalm/eos/utils/textfsm_templates/ntp_peers.tpl deleted file mode 100644 index 58042e0ba..000000000 --- a/napalm/eos/utils/textfsm_templates/ntp_peers.tpl +++ /dev/null @@ -1,6 +0,0 @@ -Value NTPPeer (\w+.*) - -Start - ^ntp\s+server\s+${NTPPeer} -> Record - -EOF diff --git a/napalm/ios/ios.py b/napalm/ios/ios.py index 690322d36..ad35c5a72 100644 --- a/napalm/ios/ios.py +++ b/napalm/ios/ios.py @@ -19,10 +19,9 @@ import os import re import socket -import telnetlib +from netmiko._telnetlib import telnetlib import tempfile import uuid -from collections import defaultdict from netmiko import FileTransfer, InLineTransfer @@ -2076,7 +2075,7 @@ def get_bgp_neighbors(self): return bgp_neighbor_data def get_bgp_neighbors_detail(self, neighbor_address=""): - bgp_detail = defaultdict(lambda: defaultdict(lambda: [])) + bgp_detail = {} raw_bgp_sum = self._send_command("show ip bgp all sum").strip() @@ -2227,6 +2226,14 @@ def get_bgp_neighbors_detail(self, neighbor_address=""): "export_policy": bgp_neigh_afi["policy_out"], } ) + + vrf_name = details["routing_table"] + if vrf_name not in bgp_detail.keys(): + bgp_detail[vrf_name] = {} + remote_as = details["remote_as"] + if remote_as not in bgp_detail[vrf_name].keys(): + bgp_detail[vrf_name][remote_as] = [] + bgp_detail[details["routing_table"]][details["remote_as"]].append(details) return bgp_detail @@ -3796,7 +3803,7 @@ def _get_vlan_from_id(self): output = self._send_command("show vlan id {}".format(vlan_id)) _vlans = self._get_vlan_all_ports(output) if len(_vlans) == 0: - vlans[vlan_id] = {"name": vlan_name, "interfaces": []} + vlans[vlan_id] = {"name": vlan_name.strip(), "interfaces": []} elif len(_vlans) == 1: vlans.update(_vlans) elif len(_vlans.keys()) > 1: diff --git a/napalm/iosxr/__init__.py b/napalm/iosxr/__init__.py index 455b4a616..e7a62bf20 100644 --- a/napalm/iosxr/__init__.py +++ b/napalm/iosxr/__init__.py @@ -15,15 +15,7 @@ """napalm.iosxr package.""" -# Import stdlib -import pkg_resources - # Import local modules from napalm.iosxr.iosxr import IOSXRDriver # noqa __all__ = ("IOSXRDriver",) - -try: - __version__ = pkg_resources.get_distribution("napalm-iosxr").version -except pkg_resources.DistributionNotFound: - __version__ = "Not installed" diff --git a/napalm/iosxr_netconf/__init__.py b/napalm/iosxr_netconf/__init__.py index 2e172d869..87d130e74 100644 --- a/napalm/iosxr_netconf/__init__.py +++ b/napalm/iosxr_netconf/__init__.py @@ -15,15 +15,7 @@ """napalm.iosxr_netconf package.""" -# Import stdlib -import pkg_resources - # Import local modules from napalm.iosxr_netconf.iosxr_netconf import IOSXRNETCONFDriver # noqa __all__ = ("IOSXRNETCONFDriver",) - -try: - __version__ = pkg_resources.get_distribution("napalm-iosxr-netconf").version -except pkg_resources.DistributionNotFound: - __version__ = "Not installed" diff --git a/napalm/iosxr_netconf/iosxr_netconf.py b/napalm/iosxr_netconf/iosxr_netconf.py index 6144869b5..308e9f6f1 100644 --- a/napalm/iosxr_netconf/iosxr_netconf.py +++ b/napalm/iosxr_netconf/iosxr_netconf.py @@ -70,6 +70,8 @@ def __init__(self, hostname, username, password, timeout=60, optional_args=None) self.lock_on_connect = self.optional_args.pop("config_lock", False) self.key_file = self.optional_args.pop("key_file", None) self.config_encoding = self.optional_args.pop("config_encoding", "cli") + if "ssh_config_file" in self.optional_args: + self.optional_args["ssh_config"] = self.optional_args.pop("ssh_config_file") if self.config_encoding not in C.CONFIG_ENCODINGS: raise ValueError(f"config encoding must be one of {C.CONFIG_ENCODINGS}") diff --git a/napalm/nxos/__init__.py b/napalm/nxos/__init__.py index 695c79189..5a2763996 100644 --- a/napalm/nxos/__init__.py +++ b/napalm/nxos/__init__.py @@ -15,16 +15,8 @@ """napalm.nxos package.""" -# Import stdlib -import pkg_resources - # Import local modules from napalm.nxos.nxos import NXOSDriver from napalm.nxos.nxos import NXOSDriverBase -try: - __version__ = pkg_resources.get_distribution("napalm-nxos").version -except pkg_resources.DistributionNotFound: - __version__ = "Not installed" - __all__ = ("NXOSDriver", "NXOSDriverBase") diff --git a/napalm/nxos/nxos.py b/napalm/nxos/nxos.py index 48a67f483..782cf7c1b 100644 --- a/napalm/nxos/nxos.py +++ b/napalm/nxos/nxos.py @@ -1204,27 +1204,32 @@ def get_arp_table(self, vrf: str = "") -> List[models.ARPTableDict]: ) return arp_table - def _get_ntp_entity( - self, peer_type: str - ) -> Dict[str, Union[models.NTPPeerDict, models.NTPServerDict]]: - ntp_entities: Dict[str, Union[models.NTPPeerDict, models.NTPServerDict]] = {} + def _filter_ntp_table(self, peer_type: str) -> List[str]: + ret = [] command = "show ntp peers" ntp_peers_table = self._get_command_table(command, "TABLE_peers", "ROW_peers") - for ntp_peer in ntp_peers_table: if ntp_peer.get("serv_peer", "").strip() != peer_type: continue peer_addr = napalm.base.helpers.ip(ntp_peer.get("PeerIPAddress").strip()) - # Ignore the type of the following line until NTP data is modelled - ntp_entities[peer_addr] = {} # type: ignore - - return ntp_entities + ret.append(peer_addr) + return ret def get_ntp_peers(self) -> Dict[str, models.NTPPeerDict]: - return self._get_ntp_entity("Peer") + ntp_entities: Dict[str, models.NTPPeerDict] = {} + peers = self._filter_ntp_table("Peer") + for peer_addr in peers: + ntp_entities[peer_addr] = {} + + return ntp_entities def get_ntp_servers(self) -> Dict[str, models.NTPServerDict]: - return self._get_ntp_entity("Server") + ntp_entities: Dict[str, models.NTPServerDict] = {} + peers = self._filter_ntp_table("Server") + for peer_addr in peers: + ntp_entities[peer_addr] = {} + + return ntp_entities def get_ntp_stats(self) -> List[models.NTPStats]: ntp_stats: List[models.NTPStats] = [] diff --git a/napalm/nxos_ssh/__init__.py b/napalm/nxos_ssh/__init__.py index 18fdb6746..c9ea28378 100644 --- a/napalm/nxos_ssh/__init__.py +++ b/napalm/nxos_ssh/__init__.py @@ -15,16 +15,7 @@ """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",) diff --git a/napalm/nxos_ssh/nxos_ssh.py b/napalm/nxos_ssh/nxos_ssh.py index fcec00c28..5a71662a8 100644 --- a/napalm/nxos_ssh/nxos_ssh.py +++ b/napalm/nxos_ssh/nxos_ssh.py @@ -168,8 +168,7 @@ def parse_intf_section(interface): mtu = int(speed_data["mtu"]) speed_unit = speed_data["speed_unit"] speed_unit = speed_unit.rstrip(",") - # This was alway in Kbit (in the data I saw) - if speed_unit != "Kbit": + if speed_unit not in ["Kbit", "Kbit/sec"]: msg = "Unexpected speed unit in show interfaces parsing:\n\n{}".format( interface ) @@ -484,7 +483,7 @@ def parse_uptime(uptime_str): Return the uptime in seconds as an integer """ # Initialize to zero - (years, weeks, days, hours, minutes) = (0, 0, 0, 0, 0) + (years, weeks, days, hours, minutes, seconds) = (0, 0, 0, 0, 0, 0) uptime_str = uptime_str.strip() time_list = uptime_str.split(",") @@ -622,7 +621,7 @@ def get_facts(self): _, uptime_str = line.split(" uptime is ") uptime = self.parse_uptime(uptime_str) - if "system: " in line or "NXOS: " in line: + if "system: " in line or line.strip().startswith("NXOS: version"): line = line.strip() os_version = line.split()[2] os_version = os_version.strip() diff --git a/napalm/pyIOSXR/iosxr.py b/napalm/pyIOSXR/iosxr.py index 08e51c173..c514f805a 100644 --- a/napalm/pyIOSXR/iosxr.py +++ b/napalm/pyIOSXR/iosxr.py @@ -510,8 +510,7 @@ def close(self): if self.lock_on_connect or self.locked: self.unlock() # this refers to the config DB self._unlock_xml_agent() # this refers to the XML agent - if hasattr(self.device, "remote_conn"): - self.device.remote_conn.close() # close the underlying SSH session + self.device.disconnect() # close the underlying SSH session def lock(self): """ diff --git a/requirements-dev.txt b/requirements-dev.txt index 83c7115c2..d20d93e9f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,17 +1,17 @@ -black==24.3.0 -coveralls==3.3.1 +black==24.4.2 +# Temp for PY3.13 support +git+https://github.com/TheKevJames/coveralls-python.git@0ff8f20fd57f68486a4127b0b7f88a5922b910c3 ddt==1.7.2 -flake8-import-order==0.18.2 -pytest==7.3.1 -pytest-cov==5.0.0 +flake8-import-order==0.19.2 +pytest==8.4.1 +pytest-cov==6.2.1 pytest-json-report==1.5.0 -pyflakes==3.2.0 +pyflakes==3.4.0 pylama==8.4.1 -mock==5.1.0 -mypy==1.9.0 -types-PyYAML==6.0.12.20240311 -types-requests==2.31.0.20240406 -types-six==1.16.21.20240311 -types-setuptools==69.2.0.20240317 +mypy==1.15.0 +types-PyYAML==6.0.12.20250516 +types-requests==2.32.4.20250611 +types-six==1.17.0.20250515 +types-setuptools==80.9.0.20250801 ttp==0.9.5 -ttp_templates==0.3.6 +ttp_templates==0.3.7 diff --git a/requirements.txt b/requirements.txt index ccd3ef5b2..4e92e1f33 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,9 +7,8 @@ jinja2 netaddr pyYAML pyeapi>=1.0.2 -netmiko>=4.1.0 -junos-eznc>=2.7.0 -scp +netmiko>=4.4.0 +junos-eznc>=2.7.4 lxml>=4.3.0 ncclient ttp diff --git a/setup.cfg b/setup.cfg index 871c4c939..4e3914dd1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -27,8 +27,6 @@ python_files = test_*.py *_test.py tests.py -json_report = report.json -jsonapi = true [coverage:run] include = diff --git a/setup.py b/setup.py index a7e9fa615..224552046 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,11 @@ from setuptools import setup, find_packages with open("requirements.txt", "r") as fs: - reqs = [r for r in fs.read().splitlines() if (len(r) > 0 and not r.startswith("#"))] + reqs = [ + r + for r in fs.read().splitlines() + if (len(r) > 0 and not (r.startswith("#") or r.startswith("git+"))) + ] with open("README.md", "r") as fs: long_description = fs.read() @@ -13,13 +17,16 @@ setup( name="napalm", - version="5.0.0", + version="5.1.0", packages=find_packages(exclude=("test*",)), test_suite="test_base", - author="David Barroso, Kirk Byers, Mircea Ulinic", - author_email="dbarrosop@dravetech.com, ping@mirceaulinic.net, ktbyers@twb-tech.com", + author="David Barroso, Kirk Byers, Mircea Ulinic, Brandon Ewing", + author_email=( + "dbarrosop@dravetech.com, ping@mirceaulinic.net, " + "ktbyers@twb-tech.com, brandon.ewing@warningg.com" + ), description="Network Automation and Programmability Abstraction Layer with Multivendor support", - license="Apache 2.0", + license="Apache-2.0", long_description=long_description, long_description_content_type="text/markdown", classifiers=[ @@ -27,11 +34,11 @@ "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Operating System :: POSIX :: Linux", "Operating System :: MacOS", ], diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue1168/expected_result.json b/test/eos/mocked_data/test_get_bgp_neighbors/issue1168/expected_result.json deleted file mode 100644 index a22cd863f..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue1168/expected_result.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "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 - } - } - } - } - } -} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue1168/show_ip_bgp_neighbors_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_r.text b/test/eos/mocked_data/test_get_bgp_neighbors/issue1168/show_ip_bgp_neighbors_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_r.text deleted file mode 100644 index 270822d7d..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue1168/show_ip_bgp_neighbors_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_r.text +++ /dev/null @@ -1,12 +0,0 @@ -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 Unicast: 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 Unicast: 0 0 -Local AS is 65002, local router ID 192.168.56.2 diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue1168/show_ip_bgp_summary_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/issue1168/show_ip_bgp_summary_vrf_all.json deleted file mode 100644 index 676677875..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue1168/show_ip_bgp_summary_vrf_all.json +++ /dev/null @@ -1,37 +0,0 @@ -{ -"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 -} -} -} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue1168/show_ipv6_bgp_peers_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_rou.text b/test/eos/mocked_data/test_get_bgp_neighbors/issue1168/show_ipv6_bgp_peers_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_rou.text deleted file mode 100644 index 6643bdc03..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue1168/show_ipv6_bgp_peers_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_rou.text +++ /dev/null @@ -1,12 +0,0 @@ -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 diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue1168/show_ipv6_bgp_summary_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/issue1168/show_ipv6_bgp_summary_vrf_all.json deleted file mode 100644 index 3252cda14..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue1168/show_ipv6_bgp_summary_vrf_all.json +++ /dev/null @@ -1,37 +0,0 @@ -{ -"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 -} -} -} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue1356/expected_result.json b/test/eos/mocked_data/test_get_bgp_neighbors/issue1356/expected_result.json deleted file mode 100644 index 60d0b8c4d..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue1356/expected_result.json +++ /dev/null @@ -1,841 +0,0 @@ -{ - "RED": { - "peers": { - "10.10.10.1": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 64804, - "remote_id": "10.10.10.2", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 14, - "received_prefixes": 2, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.3": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 65066, - "remote_id": "10.10.10.4", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 3, - "received_prefixes": 11, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.5": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 64804, - "remote_id": "10.10.10.2", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 12, - "received_prefixes": 2, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - } - }, - "router_id": "10.10.10.7" - }, - "BLUE": { - "peers": { - "10.10.10.8": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 64805, - "remote_id": "10.10.10.9", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 12, - "received_prefixes": 2, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.10": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 64805, - "remote_id": "10.10.10.9", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 14, - "received_prefixes": 2, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.12": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 65066, - "remote_id": "10.10.10.13", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 7, - "received_prefixes": 7, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.14": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 65066, - "remote_id": "10.10.10.15", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 10, - "received_prefixes": 7, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.16": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 65066, - "remote_id": "10.10.10.13", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 14, - "received_prefixes": 7, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - } - }, - "router_id": "10.10.10.18" - }, - "GREEN": { - "peers": { - "10.10.10.19": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 64805, - "remote_id": "10.10.10.20", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 58, - "received_prefixes": 8, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.21": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 64805, - "remote_id": "10.10.10.20", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 58, - "received_prefixes": 8, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.23": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 65066, - "remote_id": "10.10.10.24", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 44, - "received_prefixes": 44, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.25": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 65066, - "remote_id": "10.10.10.26", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 59, - "received_prefixes": 50, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.30": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 64804, - "remote_id": "10.10.10.27", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 53, - "received_prefixes": 8, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.31": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 65066, - "remote_id": "10.10.10.26", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 24, - "received_prefixes": 50, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.32": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 65066, - "remote_id": "10.10.10.26", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 59, - "received_prefixes": 50, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.33": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 64804, - "remote_id": "10.10.10.27", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 59, - "received_prefixes": 8, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - } - }, - "router_id": "10.10.10.28" - }, - "global": { - "peers": { - "10.10.10.34": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 65118, - "remote_id": "10.10.10.29", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 4241, - "received_prefixes": 1620, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.44": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 65118, - "remote_id": "10.10.10.35", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 3701, - "received_prefixes": 1620, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.45": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 65118, - "remote_id": "10.10.10.39", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 3998, - "received_prefixes": 1620, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.46": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 65118, - "remote_id": "10.10.10.38", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 3919, - "received_prefixes": 1620, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.47": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 64805, - "remote_id": "10.10.10.48", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 4369, - "received_prefixes": 4, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.57": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 64805, - "remote_id": "10.10.10.48", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 4368, - "received_prefixes": 4, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.58": { - "is_up": false, - "is_enabled": true, - "uptime": "...", - "remote_as": 64638, - "remote_id": "10.10.10.43", - "local_as": 65101, - "description": "", - "address_family": { - "ipv4": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.59": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 65066, - "remote_id": "10.10.10.37", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 4369, - "received_prefixes": 2721, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.56": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 65066, - "remote_id": "10.10.10.37", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 3048, - "received_prefixes": 2721, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.55": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 65066, - "remote_id": "10.10.10.37", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 4219, - "received_prefixes": 2720, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.54": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 64638, - "remote_id": "10.10.10.43", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 4357, - "received_prefixes": 14, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.53": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 65066, - "remote_id": "10.10.10.37", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 3119, - "received_prefixes": 2721, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.52": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 64804, - "remote_id": "10.10.10.50", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 4366, - "received_prefixes": 4, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.51": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 64804, - "remote_id": "10.10.10.50", - "local_as": 65101, - "description": "TEST_DESCRIPTION", - "address_family": { - "ipv4": { - "sent_prefixes": 4369, - "received_prefixes": 4, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.49": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "remote_as": 64638, - "remote_id": "10.10.10.41", - "local_as": 65101, - "description": "", - "address_family": { - "ipv4": { - "sent_prefixes": 4369, - "received_prefixes": 14, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.43": { - "is_up": false, - "uptime": 0, - "is_enabled": true, - "remote_as": 64638, - "remote_id": "10.10.10.43", - "local_as": 65101, - "description": "", - "address_family": { - "ipv4": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.41": { - "is_up": false, - "uptime": 0, - "is_enabled": true, - "remote_as": 64638, - "remote_id": "10.10.10.41", - "local_as": 65101, - "description": "", - "address_family": { - "ipv4": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.29": { - "is_up": false, - "uptime": 0, - "is_enabled": true, - "remote_as": 65118, - "remote_id": "10.10.10.29", - "local_as": 65101, - "description": "", - "address_family": { - "ipv4": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.35": { - "is_up": false, - "uptime": 0, - "is_enabled": true, - "remote_as": 65118, - "remote_id": "10.10.10.35", - "local_as": 65101, - "description": "", - "address_family": { - "ipv4": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.39": { - "is_up": false, - "uptime": 0, - "is_enabled": true, - "remote_as": 65118, - "remote_id": "10.10.10.39", - "local_as": 65101, - "description": "", - "address_family": { - "ipv4": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.38": { - "is_up": false, - "uptime": 0, - "is_enabled": true, - "remote_as": 65118, - "remote_id": "10.10.10.38", - "local_as": 65101, - "description": "", - "address_family": { - "ipv4": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.37": { - "is_up": false, - "uptime": 0, - "is_enabled": true, - "remote_as": 65066, - "remote_id": "10.10.10.37", - "local_as": 65101, - "description": "", - "address_family": { - "ipv4": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - }, - "10.10.10.36": { - "is_up": false, - "uptime": 0, - "is_enabled": true, - "remote_as": 65066, - "remote_id": "10.10.10.37", - "local_as": 65101, - "description": "", - "address_family": { - "ipv4": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 0, - "received_prefixes": 0, - "accepted_prefixes": -1 - } - } - } - }, - "router_id": "2.2.2.2" - } -} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue1356/show_ip_bgp_neighbors_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_r.text b/test/eos/mocked_data/test_get_bgp_neighbors/issue1356/show_ip_bgp_neighbors_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_r.text deleted file mode 100644 index e8d38e423..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue1356/show_ip_bgp_neighbors_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_r.text +++ /dev/null @@ -1,234 +0,0 @@ -BGP neighbor is 10.10.10.52, remote AS 64804, external link - BGP version 4, remote router ID 10.10.10.50, VRF default - BGP state is Established, up for 55d22h - IPv4 Unicast: 4366 4 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.51, remote AS 64804, external link - BGP version 4, remote router ID 10.10.10.50, VRF default - BGP state is Established, up for 6d01h - IPv4 Unicast: 4369 4 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.47, remote AS 64805, external link - BGP version 4, remote router ID 10.10.10.48, VRF default - BGP state is Established, up for 5d23h - IPv4 Unicast: 4369 4 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.57, remote AS 64805, external link - BGP version 4, remote router ID 10.10.10.48, VRF default - BGP state is Established, up for 5d23h - IPv4 Unicast: 4368 4 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.43, remote AS 64638, external link - BGP version 4, remote router ID 10.10.10.43, VRF default - BGP state is Established, up for 49d06h - IPv4 Unicast: 0 0 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.41, remote AS 64638, external link - BGP version 4, remote router ID 10.10.10.41, VRF default - BGP state is Established, up for 22:42:48 - IPv4 Unicast: 0 0 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.29, remote AS 65118, external link - BGP version 4, remote router ID 10.10.10.29, VRF default - BGP state is Established, up for 97d08h - IPv4 Unicast: 0 0 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.35, remote AS 65118, external link - BGP version 4, remote router ID 10.10.10.35, VRF default - BGP state is Established, up for 134d05h - IPv4 Unicast: 0 0 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.39, remote AS 65118, external link - BGP version 4, remote router ID 10.10.10.39, VRF default - BGP state is Established, up for 82d03h - IPv4 Unicast: 0 0 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.38, remote AS 65118, external link - BGP version 4, remote router ID 10.10.10.38, VRF default - BGP state is Established, up for 128d07h - IPv4 Unicast: 0 0 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.34, remote AS 65118, external link - BGP version 4, remote router ID 10.10.10.29, VRF default - BGP state is Established, up for 4d06h - IPv4 Unicast: 4241 1620 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.44, remote AS 65118, external link - BGP version 4, remote router ID 10.10.10.35, VRF default - BGP state is Established, up for 81d08h - IPv4 Unicast: 3701 1620 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.45, remote AS 65118, external link - BGP version 4, remote router ID 10.10.10.39, VRF default - BGP state is Established, up for 81d08h - IPv4 Unicast: 3998 1620 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.46, remote AS 65118, external link - BGP version 4, remote router ID 10.10.10.38, VRF default - BGP state is Established, up for 124d02h - IPv4 Unicast: 3919 1620 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.58, remote AS 64638, external link - BGP version 4, remote router ID 10.10.10.43, VRF default - BGP state is Idle, Could not find interface for peer - IPv4 Unicast: 0 0 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.49, remote AS 64638, external link - BGP version 4, remote router ID 10.10.10.41, VRF default - BGP state is Established, up for 22:44:04 - IPv4 Unicast: 4369 14 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.54, remote AS 64638, external link - BGP version 4, remote router ID 10.10.10.43, VRF default - BGP state is Established, up for 6d02h - IPv4 Unicast: 4357 14 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.37, remote AS 65066, external link - BGP version 4, remote router ID 10.10.10.37, VRF default - BGP state is Established, up for 96d00h - IPv4 Unicast: 0 0 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.36, remote AS 65066, external link - BGP version 4, remote router ID 10.10.10.37, VRF default - BGP state is Established, up for 90d07h - IPv4 Unicast: 0 0 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.53, remote AS 65066, external link - BGP version 4, remote router ID 10.10.10.37, VRF default - BGP state is Established, up for 81d07h - IPv4 Unicast: 3119 2721 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.59, remote AS 65066, external link - BGP version 4, remote router ID 10.10.10.37, VRF default - BGP state is Established, up for 22d00h - IPv4 Unicast: 4369 2721 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.56, remote AS 65066, external link - BGP version 4, remote router ID 10.10.10.37, VRF default - BGP state is Established, up for 62d07h - IPv4 Unicast: 3048 2721 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.55, remote AS 65066, external link - BGP version 4, remote router ID 10.10.10.37, VRF default - BGP state is Established, up for 62d07h - IPv4 Unicast: 4219 2720 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 2.2.2.2 -BGP neighbor is 10.10.10.8, remote AS 64805, external link - BGP version 4, remote router ID 10.10.10.9, VRF BLUE - BGP state is Established, up for 5d23h - IPv4 Unicast: 12 2 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 10.10.10.18 -BGP neighbor is 10.10.10.10, remote AS 64805, external link - BGP version 4, remote router ID 10.10.10.9, VRF BLUE - BGP state is Established, up for 5d23h - IPv4 Unicast: 14 2 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 10.10.10.18 -BGP neighbor is 10.10.10.16, remote AS 65066, external link - BGP version 4, remote router ID 10.10.10.13, VRF BLUE - BGP state is Established, up for 22d00h - IPv4 Unicast: 14 7 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 10.10.10.18 -BGP neighbor is 10.10.10.12, remote AS 65066, external link - BGP version 4, remote router ID 10.10.10.13, VRF BLUE - BGP state is Established, up for 60d02h - IPv4 Unicast: 7 7 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 10.10.10.18 -BGP neighbor is 10.10.10.14, remote AS 65066, external link - BGP version 4, remote router ID 10.10.10.15, VRF BLUE - BGP state is Established, up for 60d02h - IPv4 Unicast: 10 7 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 10.10.10.18 -BGP neighbor is 10.10.10.30, remote AS 64804, external link - BGP version 4, remote router ID 10.10.10.27, VRF GREEN - BGP state is Established, up for 55d22h - IPv4 Unicast: 53 8 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 10.10.10.28 -BGP neighbor is 10.10.10.33, remote AS 64804, external link - BGP version 4, remote router ID 10.10.10.27, VRF GREEN - BGP state is Established, up for 6d01h - IPv4 Unicast: 59 8 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 10.10.10.28 -BGP neighbor is 10.10.10.21, remote AS 64805, external link - BGP version 4, remote router ID 10.10.10.20, VRF GREEN - BGP state is Established, up for 5d23h - IPv4 Unicast: 58 8 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 10.10.10.28 -BGP neighbor is 10.10.10.19, remote AS 64805, external link - BGP version 4, remote router ID 10.10.10.20, VRF GREEN - BGP state is Established, up for 5d23h - IPv4 Unicast: 58 8 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 10.10.10.28 -BGP neighbor is 10.10.10.31, remote AS 65066, external link - BGP version 4, remote router ID 10.10.10.26, VRF GREEN - BGP state is Established, up for 60d02h - IPv4 Unicast: 24 50 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 10.10.10.28 -BGP neighbor is 10.10.10.32, remote AS 65066, external link - BGP version 4, remote router ID 10.10.10.26, VRF GREEN - BGP state is Established, up for 22d00h - IPv4 Unicast: 59 50 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 10.10.10.28 -BGP neighbor is 10.10.10.25, remote AS 65066, external link - BGP version 4, remote router ID 10.10.10.26, VRF GREEN - BGP state is Established, up for 60d02h - IPv4 Unicast: 59 50 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 10.10.10.28 -BGP neighbor is 10.10.10.23, remote AS 65066, external link - BGP version 4, remote router ID 10.10.10.24, VRF GREEN - BGP state is Established, up for 60d02h - IPv4 Unicast: 44 44 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 10.10.10.28 -BGP neighbor is 10.10.10.5, remote AS 64804, external link - BGP version 4, remote router ID 10.10.10.2, VRF RED - BGP state is Established, up for 55d22h - IPv4 Unicast: 12 2 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 10.10.10.7 -BGP neighbor is 10.10.10.1, remote AS 64804, external link - BGP version 4, remote router ID 10.10.10.2, VRF RED - BGP state is Established, up for 6d01h - IPv4 Unicast: 14 2 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 10.10.10.7 -BGP neighbor is 10.10.10.3, remote AS 65066, external link - BGP version 4, remote router ID 10.10.10.4, VRF RED - BGP state is Established, up for 60d02h - IPv4 Unicast: 3 11 - IPv6 Unicast: 0 0 -Local AS is 65101, local router ID 10.10.10.7 diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue1356/show_ip_bgp_summary_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/issue1356/show_ip_bgp_summary_vrf_all.json deleted file mode 100644 index 3785b9642..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue1356/show_ip_bgp_summary_vrf_all.json +++ /dev/null @@ -1,465 +0,0 @@ -{ - "vrfs": { - "RED": { - "routerId": "10.10.10.7", - "peers": { - "10.10.10.1": { - "description": "TEST_DESCRIPTION", - "msgSent": 364186, - "inMsgQueue": 0, - "prefixReceived": 2, - "upDownTime": 1609977600.0, - "version": 4, - "prefixAccepted": 2, - "msgReceived": 457251, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "64804" - }, - "10.10.10.3": { - "description": "TEST_DESCRIPTION", - "msgSent": 101743, - "inMsgQueue": 0, - "prefixReceived": 11, - "upDownTime": 1605305600.0, - "version": 4, - "prefixAccepted": 11, - "msgReceived": 101674, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65066" - }, - "10.10.10.5": { - "description": "TEST_DESCRIPTION", - "msgSent": 106639, - "inMsgQueue": 0, - "prefixReceived": 2, - "upDownTime": 1605665792.0, - "version": 4, - "prefixAccepted": 2, - "msgReceived": 106358, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "64804" - } - }, - "vrf": "RED", - "asn": "65101" - }, - "BLUE": { - "routerId": "10.10.10.18", - "peers": { - "10.10.10.8": { - "description": "TEST_DESCRIPTION", - "msgSent": 79261, - "inMsgQueue": 0, - "prefixReceived": 2, - "upDownTime": 1609982208.0, - "version": 4, - "prefixAccepted": 2, - "msgReceived": 78617, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "64805" - }, - "10.10.10.10": { - "description": "TEST_DESCRIPTION", - "msgSent": 79191, - "inMsgQueue": 0, - "prefixReceived": 2, - "upDownTime": 1609982208.0, - "version": 4, - "prefixAccepted": 2, - "msgReceived": 78571, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "64805" - }, - "10.10.10.12": { - "description": "TEST_DESCRIPTION", - "msgSent": 101673, - "inMsgQueue": 0, - "prefixReceived": 7, - "upDownTime": 1605305600.0, - "version": 4, - "prefixAccepted": 7, - "msgReceived": 101731, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65066" - }, - "10.10.10.14": { - "description": "TEST_DESCRIPTION", - "msgSent": 101697, - "inMsgQueue": 0, - "prefixReceived": 7, - "upDownTime": 1605306368.0, - "version": 4, - "prefixAccepted": 7, - "msgReceived": 101696, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65066" - }, - "10.10.10.16": { - "description": "TEST_DESCRIPTION", - "msgSent": 101718, - "inMsgQueue": 0, - "prefixReceived": 7, - "upDownTime": 1608598272.0, - "version": 4, - "prefixAccepted": 7, - "msgReceived": 101762, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65066" - } - }, - "vrf": "BLUE", - "asn": "65101" - }, - "GREEN": { - "routerId": "10.10.10.28", - "peers": { - "10.10.10.19": { - "description": "TEST_DESCRIPTION", - "msgSent": 79487, - "inMsgQueue": 0, - "prefixReceived": 8, - "upDownTime": 1609982208.0, - "version": 4, - "prefixAccepted": 8, - "msgReceived": 79021, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "64805" - }, - "10.10.10.21": { - "description": "TEST_DESCRIPTION", - "msgSent": 79500, - "inMsgQueue": 0, - "prefixReceived": 8, - "upDownTime": 1609982208.0, - "version": 4, - "prefixAccepted": 8, - "msgReceived": 78944, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "64805" - }, - "10.10.10.23": { - "description": "TEST_DESCRIPTION", - "msgSent": 101910, - "inMsgQueue": 0, - "prefixReceived": 44, - "upDownTime": 1605306112.0, - "version": 4, - "prefixAccepted": 44, - "msgReceived": 101898, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65066" - }, - "10.10.10.25": { - "description": "TEST_DESCRIPTION", - "msgSent": 101906, - "inMsgQueue": 0, - "prefixReceived": 50, - "upDownTime": 1605305216.0, - "version": 4, - "prefixAccepted": 50, - "msgReceived": 101872, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65066" - }, - "10.10.10.30": { - "description": "TEST_DESCRIPTION", - "msgSent": 106865, - "inMsgQueue": 0, - "prefixReceived": 8, - "upDownTime": 1605665792.0, - "version": 4, - "prefixAccepted": 8, - "msgReceived": 106462, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "64804" - }, - "10.10.10.31": { - "description": "TEST_DESCRIPTION", - "msgSent": 101798, - "inMsgQueue": 0, - "prefixReceived": 50, - "upDownTime": 1605305216.0, - "version": 4, - "prefixAccepted": 50, - "msgReceived": 101891, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65066" - }, - "10.10.10.32": { - "description": "TEST_DESCRIPTION", - "msgSent": 102008, - "inMsgQueue": 0, - "prefixReceived": 50, - "upDownTime": 1608598272.0, - "version": 4, - "prefixAccepted": 50, - "msgReceived": 101927, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65066" - }, - "10.10.10.33": { - "description": "TEST_DESCRIPTION", - "msgSent": 739925, - "inMsgQueue": 0, - "prefixReceived": 8, - "upDownTime": 1609977600.0, - "version": 4, - "prefixAccepted": 8, - "msgReceived": 775079, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "64804" - } - }, - "vrf": "GREEN", - "asn": "65101" - }, - "default": { - "routerId": "2.2.2.2", - "peers": { - "10.10.10.34": { - "description": "TEST_DESCRIPTION", - "msgSent": 2267110, - "inMsgQueue": 0, - "prefixReceived": 1615, - "upDownTime": 1610129536.0, - "version": 4, - "prefixAccepted": 1615, - "msgReceived": 2109321, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65118" - }, - "10.10.10.44": { - "description": "TEST_DESCRIPTION", - "msgSent": 2148074, - "inMsgQueue": 0, - "prefixReceived": 1615, - "upDownTime": 1603470976.0, - "version": 4, - "prefixAccepted": 1615, - "msgReceived": 2121077, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65118" - }, - "10.10.10.45": { - "description": "TEST_DESCRIPTION", - "msgSent": 2044419, - "inMsgQueue": 0, - "prefixReceived": 1615, - "upDownTime": 1603470208.0, - "version": 4, - "prefixAccepted": 1615, - "msgReceived": 2108285, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65118" - }, - "10.10.10.46": { - "description": "TEST_DESCRIPTION", - "msgSent": 2234699, - "inMsgQueue": 0, - "prefixReceived": 1615, - "upDownTime": 1599775616.0, - "version": 4, - "prefixAccepted": 1615, - "msgReceived": 2181235, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65118" - }, - "10.10.10.47": { - "description": "TEST_DESCRIPTION", - "msgSent": 1124065, - "inMsgQueue": 0, - "prefixReceived": 4, - "upDownTime": 1609982208.0, - "version": 4, - "prefixAccepted": 4, - "msgReceived": 126715, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "64805" - }, - "10.10.10.57": { - "description": "TEST_DESCRIPTION", - "msgSent": 1124065, - "inMsgQueue": 0, - "prefixReceived": 4, - "upDownTime": 1609982208.0, - "version": 4, - "prefixAccepted": 4, - "msgReceived": 129890, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "64805" - }, - "10.10.10.58": { - "msgSent": 1159191, - "inMsgQueue": 0, - "peerStateIdleReason": "NoInterface", - "prefixReceived": 0, - "upDownTime": 1609975040.0, - "version": 4, - "msgReceived": 757763, - "prefixAccepted": 0, - "peerState": "Idle", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "64638" - }, - "10.10.10.59": { - "description": "TEST_DESCRIPTION", - "msgSent": 2181044, - "inMsgQueue": 0, - "prefixReceived": 2721, - "upDownTime": 1608598272.0, - "version": 4, - "prefixAccepted": 2721, - "msgReceived": 1728564, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65066" - }, - "10.10.10.56": { - "description": "TEST_DESCRIPTION", - "msgSent": 1931429, - "inMsgQueue": 0, - "prefixReceived": 2721, - "upDownTime": 1605115520.0, - "version": 4, - "prefixAccepted": 2721, - "msgReceived": 1772562, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65066" - }, - "10.10.10.55": { - "description": "TEST_DESCRIPTION", - "msgSent": 1958057, - "inMsgQueue": 0, - "prefixReceived": 2720, - "upDownTime": 1605115520.0, - "version": 4, - "prefixAccepted": 2720, - "msgReceived": 1645064, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65066" - }, - "10.10.10.54": { - "description": "TEST_DESCRIPTION", - "msgSent": 991398, - "inMsgQueue": 0, - "prefixReceived": 14, - "upDownTime": 1609972480.0, - "version": 4, - "prefixAccepted": 14, - "msgReceived": 749926, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "64638" - }, - "10.10.10.53": { - "description": "TEST_DESCRIPTION", - "msgSent": 2271489, - "inMsgQueue": 0, - "prefixReceived": 2721, - "upDownTime": 1603473536.0, - "version": 4, - "prefixAccepted": 2721, - "msgReceived": 2003091, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65066" - }, - "10.10.10.52": { - "description": "TEST_DESCRIPTION", - "msgSent": 1652455, - "inMsgQueue": 0, - "prefixReceived": 4, - "upDownTime": 1605665792.0, - "version": 4, - "prefixAccepted": 4, - "msgReceived": 108253, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "64804" - }, - "10.10.10.51": { - "description": "TEST_DESCRIPTION", - "msgSent": 5587106, - "inMsgQueue": 0, - "prefixReceived": 4, - "upDownTime": 1609977600.0, - "version": 4, - "prefixAccepted": 4, - "msgReceived": 668095, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "64804" - }, - "10.10.10.49": { - "msgSent": 39221, - "inMsgQueue": 0, - "prefixReceived": 14, - "upDownTime": 1610418048.0, - "version": 4, - "prefixAccepted": 14, - "msgReceived": 42632, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "64638" - } - }, - "vrf": "default", - "asn": "65101" - } - } -} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue1356/show_ipv6_bgp_summary_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/issue1356/show_ipv6_bgp_summary_vrf_all.json deleted file mode 100644 index 40ea5266c..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue1356/show_ipv6_bgp_summary_vrf_all.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "vrfs": { - "RED": { - "routerId": "10.10.10.7", - "peers": {}, - "vrf": "RED", - "asn": "65101" - }, - "BLUE": { - "routerId": "10.10.10.18", - "peers": {}, - "vrf": "BLUE", - "asn": "65101" - }, - "GREEN": { - "routerId": "10.10.10.28", - "peers": {}, - "vrf": "GREEN", - "asn": "65101" - }, - "default": { - "routerId": "2.2.2.2", - "peers": {}, - "vrf": "default", - "asn": "65101" - } - } -} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/expected_result.json b/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/expected_result.json index ee7922393..0d84063f8 100644 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/expected_result.json +++ b/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/expected_result.json @@ -1,112 +1,70 @@ { "global": { "peers": { - "fe80::a8c1:abff:fe0b:7b5f%Et5": { + "fe80::a8c1:abff:fe94:4171%Et3": { + "local_as": 4259973120, + "remote_as": 4259906564, + "remote_id": "172.18.4.4", "is_up": true, "is_enabled": true, - "uptime": "...", "description": "", - "remote_as": 4259840008, - "remote_id": "172.18.0.8", - "local_as": 4259906562, + "uptime": 9, "address_family": { "ipv4": { - "sent_prefixes": 9, - "received_prefixes": 2, - "accepted_prefixes": -1 + "received_prefixes": 3, + "accepted_prefixes": 3, + "sent_prefixes": 9 }, "ipv6": { - "sent_prefixes": 9, - "received_prefixes": 2, - "accepted_prefixes": -1 + "received_prefixes": 3, + "accepted_prefixes": 3, + "sent_prefixes": 9 } } }, - "fe80::a8c1:abff:fe27:69e9%Et2": { + "fe80::a8c1:abff:fea1:b618%Et2": { + "local_as": 4259973120, + "remote_as": 4259906563, + "remote_id": "172.18.4.3", "is_up": true, "is_enabled": true, - "uptime": "...", "description": "", - "remote_as": 4259973121, - "remote_id": "172.18.8.1", - "local_as": 4259906562, + "uptime": 9, "address_family": { "ipv4": { - "sent_prefixes": 9, "received_prefixes": 5, - "accepted_prefixes": -1 + "accepted_prefixes": 5, + "sent_prefixes": 8 }, "ipv6": { - "sent_prefixes": 9, "received_prefixes": 5, - "accepted_prefixes": -1 + "accepted_prefixes": 5, + "sent_prefixes": 8 } } }, - "fe80::a8c1:abff:fe35:51d9%Et1": { + "fe80::a8c1:abff:fedc:fb58%Et1": { + "local_as": 4259973120, + "remote_as": 4259906562, + "remote_id": "172.18.4.2", "is_up": true, "is_enabled": true, - "uptime": "...", "description": "", - "remote_as": 4259973120, - "remote_id": "172.18.8.0", - "local_as": 4259906562, + "uptime": 9, "address_family": { "ipv4": { - "sent_prefixes": 6, - "received_prefixes": 5, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 6, - "received_prefixes": 5, - "accepted_prefixes": -1 - } - } - }, - "fe80::a8c1:abff:fe5d:9706%Et4": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "description": "", - "remote_as": 4259840007, - "remote_id": "172.18.0.7", - "local_as": 4259906562, - "address_family": { - "ipv4": { - "sent_prefixes": 9, - "received_prefixes": 2, - "accepted_prefixes": -1 - }, - "ipv6": { - "sent_prefixes": 9, - "received_prefixes": 2, - "accepted_prefixes": -1 - } - } - }, - "fe80::a8c1:abff:fe95:fa49%Et3": { - "is_up": true, - "is_enabled": true, - "uptime": "...", - "description": "", - "remote_as": 4259840005, - "remote_id": "172.18.0.5", - "local_as": 4259906562, - "address_family": { - "ipv4": { - "sent_prefixes": 9, - "received_prefixes": 2, - "accepted_prefixes": -1 + "received_prefixes": 6, + "accepted_prefixes": 6, + "sent_prefixes": 5 }, "ipv6": { - "sent_prefixes": 9, - "received_prefixes": 2, - "accepted_prefixes": -1 + "received_prefixes": 6, + "accepted_prefixes": 6, + "sent_prefixes": 5 } } } }, - "router_id": "172.18.4.2" + "router_id": "172.18.8.0" } } diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ip_bgp_neighbors_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ip_bgp_neighbors_vrf_all.json new file mode 100644 index 000000000..3022e1ca5 --- /dev/null +++ b/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ip_bgp_neighbors_vrf_all.json @@ -0,0 +1,7 @@ +{ + "vrfs": { + "default": { + "peerList": [] + } + } +} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ip_bgp_neighbors_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_r.text b/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ip_bgp_neighbors_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_r.text deleted file mode 100644 index e69de29bb..000000000 diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ip_bgp_summary_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ip_bgp_summary_vrf_all.json index 0155ea42a..631c9f6dc 100644 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ip_bgp_summary_vrf_all.json +++ b/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ip_bgp_summary_vrf_all.json @@ -1,76 +1,50 @@ { - "vrfs": { - "default": { - "routerId": "172.18.4.2", - "peers": { - "fe80::a8c1:abff:fe0b:7b5f%Et5": { - "msgSent": 239229, - "inMsgQueue": 0, - "prefixReceived": 2, - "upDownTime": 1664912777.128896, - "version": 4, - "prefixAccepted": 2, - "msgReceived": 203694, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65000.8" - }, - "fe80::a8c1:abff:fe27:69e9%Et2": { - "msgSent": 11997, - "inMsgQueue": 0, - "prefixReceived": 5, - "upDownTime": 1664912780.356704, - "version": 4, - "prefixAccepted": 5, - "msgReceived": 11972, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65002.2049" - }, - "fe80::a8c1:abff:fe35:51d9%Et1": { - "msgSent": 11984, - "inMsgQueue": 0, - "prefixReceived": 5, - "upDownTime": 1664912783.670673, - "version": 4, - "prefixAccepted": 5, - "msgReceived": 11979, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65002.2048" - }, - "fe80::a8c1:abff:fe5d:9706%Et4": { - "msgSent": 239170, - "inMsgQueue": 0, - "prefixReceived": 2, - "upDownTime": 1664912777.50903, - "version": 4, - "prefixAccepted": 2, - "msgReceived": 203718, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65000.7" - }, - "fe80::a8c1:abff:fe95:fa49%Et3": { - "msgSent": 239116, - "inMsgQueue": 0, - "prefixReceived": 2, - "upDownTime": 1664912777.604791, - "version": 4, - "prefixAccepted": 2, - "msgReceived": 203718, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65000.5" - } - }, - "vrf": "default", - "asn": "65001.1026" + "vrfs": { + "default": { + "vrf": "default", + "routerId": "172.18.8.0", + "asn": "65002.2048", + "peers": { + "fe80::a8c1:abff:fe94:4171%Et3": { + "version": 4, + "msgReceived": 27, + "msgSent": 25, + "inMsgQueue": 0, + "outMsgQueue": 0, + "asn": "65001.1028", + "prefixAccepted": 3, + "prefixReceived": 3, + "upDownTime": 1721149910.529752, + "underMaintenance": false, + "peerState": "Established" + }, + "fe80::a8c1:abff:fea1:b618%Et2": { + "version": 4, + "msgReceived": 15, + "msgSent": 23, + "inMsgQueue": 0, + "outMsgQueue": 0, + "asn": "65001.1027", + "prefixAccepted": 5, + "prefixReceived": 5, + "upDownTime": 1721149910.47622, + "underMaintenance": false, + "peerState": "Established" + }, + "fe80::a8c1:abff:fedc:fb58%Et1": { + "version": 4, + "msgReceived": 21, + "msgSent": 23, + "inMsgQueue": 0, + "outMsgQueue": 0, + "asn": "65001.1026", + "prefixAccepted": 6, + "prefixReceived": 6, + "upDownTime": 1721149910.456982, + "underMaintenance": false, + "peerState": "Established" } + } } + } } diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ipv6_bgp_peers_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ipv6_bgp_peers_vrf_all.json new file mode 100644 index 000000000..04ecf83e7 --- /dev/null +++ b/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ipv6_bgp_peers_vrf_all.json @@ -0,0 +1,717 @@ +{ + "vrfs": { + "default": { + "peerList": [ + { + "peerAddress": "fe80::a8c1:abff:fe94:4171%Et3", + "asn": "65001.1028", + "linkType": "external", + "routerId": "172.18.4.4", + "vrf": "default", + "version": 4, + "lldpNeighbors": [ + { + "device": "node-65001.1028", + "description": "Arista Networks EOS version 4.30.5M-35156751.4305M (engineering build) running on an Arista cEOSLab" + } + ], + "peerGroupName": "LEAVES", + "peerFilter": "ASN4-PRIVATE", + "negotiatedVersion": 4, + "updateGroupIndex": -1, + "lastRcvd": 8, + "lastSent": 8, + "holdTime": 180, + "keepaliveTime": 60, + "configHoldTime": 180, + "configKeepaliveTime": 60, + "minHoldTime": 3, + "configMinHoldTime": 3, + "holdTimeLeft": 0, + "keepaliveTimeLeft": 0, + "state": "Established", + "establishedTime": 9, + "establishedTransitions": 1, + "lastState": "OpenConfirm", + "lastEvent": "RecvKeepAlive", + "enRRefreshstalePathRemoval": false, + "outboundEnRRefreshEnabled": true, + "neighborCapabilities": { + "negotiationDisabled": false, + "unsupportedCapReceived": false, + "multiprotocolCaps": { + "ipv4Unicast": { + "advertised": true, + "received": true, + "enabled": true + }, + "ipv6Unicast": { + "advertised": true, + "received": true, + "enabled": true + } + }, + "fourOctetAsnCap": { + "advertised": true, + "received": true, + "enabled": true + }, + "routeRefreshCap": { + "advertised": true, + "received": true, + "enabled": true + }, + "enhancedRouteRefreshCap": { + "advertised": true, + "received": true, + "enabled": true + }, + "sendEorMessages": { + "advertised": true, + "received": true, + "enabled": true + }, + "addPathsCaps": { + "ipv4Unicast": { + "receivingAddPaths": { + "receiveCapabilityAdvertised": true, + "sendCapabilityReceived": false, + "enabled": false + }, + "sendingAddPaths": { + "sendCapabilityAdvertised": false, + "receiveCapabilityReceived": true, + "enabled": false + } + }, + "ipv6Unicast": { + "receivingAddPaths": { + "receiveCapabilityAdvertised": true, + "sendCapabilityReceived": false, + "enabled": false + }, + "sendingAddPaths": { + "sendCapabilityAdvertised": false, + "receiveCapabilityReceived": true, + "enabled": false + } + } + }, + "extendedNextHopCaps": { + "ipv4UnicastOverIpv6": { + "advertised": true, + "received": true, + "enabled": true + } + } + }, + "endOfRibs": { + "incoming": { + "ipv4Unicast": { + "status": "timeout", + "stalePathsDeleted": 0 + }, + "ipv6Unicast": { + "status": "timeout", + "stalePathsDeleted": 0 + } + } + }, + "nexthopLuOriginateIpv4Uni": false, + "thirdPartyNexthopLuOriginateIpv4Uni": false, + "nexthopLuOriginateLfibBackupIpForwardIpv4Uni": false, + "nexthopLuOriginateIpv6Uni": false, + "thirdPartyNexthopLuOriginateIpv6Uni": false, + "nexthopLuOriginateLfibBackupIpForwardIpv6Uni": false, + "aigpSessionIpv4Uni": false, + "aigpSessionIpv4LabeledUni": false, + "aigpSessionIpv6Uni": false, + "aigpSessionIpv6LabeledUni": false, + "fwdFailoverTriggerSessionIpv6Uni": false, + "fwdFailoverTriggerSessionIpv4Uni": false, + "outMessageStats": { + "opens": 1, + "notifications": 0, + "updates": 20, + "keepalives": 2, + "rtRefreshes": 0, + "beginOfRtRefreshes": 0, + "endOfRtRefreshes": 0 + }, + "inMessageStats": { + "opens": 1, + "notifications": 0, + "updates": 21, + "keepalives": 2, + "rtRefreshes": 0, + "beginOfRtRefreshes": 0, + "endOfRtRefreshes": 0 + }, + "sentMessages": 23, + "receivedMessages": 24, + "prefixesSent": 9, + "prefixesReceived": 3, + "v4BestPaths": 1, + "v4BestEcmpPaths": 0, + "v6PrefixesSent": 9, + "v6PrefixesReceived": 3, + "v6BestPaths": 1, + "v6BestEcmpPaths": 0, + "totalRoutesWarnLimit": 204800, + "maxTotalRoutes": 256000, + "dropStats": { + "inDropAsloop": 0, + "inDropClusterIdLoop": 0, + "inDropMalformedMpbgp": 0, + "inDropOrigId": 0, + "inDropNhLocal": 0, + "inDropNhAfV6": 0, + "prefixDroppedMartianV4": 0, + "prefixDroppedMartianV6": 0, + "prefixLuDroppedV4": 0, + "prefixLuDroppedMartianV4": 0, + "prefixLuDroppedV6": 0, + "prefixLuDroppedMartianV6": 0, + "prefixEvpnDroppedUnsupportedRouteType": 0, + "prefixBgpLsDroppedReceptionUnsupported": 0, + "outDropV4LocalAddr": 0, + "outDropV6LocalAddr": 0, + "prefixVpnIpv4DroppedImportMatchFailure": 0, + "prefixVpnIpv6DroppedImportMatchFailure": 0, + "prefixEvpnDroppedImportMatchFailure": 0, + "prefixRtMembershipDroppedLocalAsReject": 0 + }, + "peerInUpdateErrors": { + "inUpdErrWithdraw": 0, + "inUpdErrIgnore": 0, + "inUpdErrDisableAfiSafi": 0, + "disabledAfiSafi": "None", + "lastUpdErrTime": 0 + }, + "bgpSoftReconfigInbound": "Default", + "rpkiOriginValidationMethod": "disabled", + "rpkiOriginValidationSendExtComm": false, + "rpkiOriginValidationRouteMap": "", + "orrPosition": {}, + "localAsn": "65002.2048", + "localRouterId": "172.18.8.0", + "ttl": 1, + "maxTtlHops": 255, + "updateSource": "fe80::a8c1:abff:fe5a:41a7", + "localPort": 179, + "remotePort": 41861, + "prependOwnDisabled": false, + "peerTcpInfo": { + "state": "ESTABLISHED", + "options": 7, + "sendWindowScale": 7, + "rcvWindowScale": 7, + "retransTimeout": 208000, + "delayedAckTimeout": 40000, + "maxSegmentSize": 1428, + "sndRtt": 5738, + "sndRttVariance": 10800, + "slowStartThreshold": 2147483647, + "congestionWindow": 10, + "rcvRtt": 955000, + "rcvWindow": 14400, + "totalRetrans": 0, + "outputQueueLength": 0, + "outputMaxQueueLength": 87040, + "inputQueueLength": 0, + "inputMaxQueueLength": 32768, + "connectionOptions": { + "timestampsEnabled": true, + "selectiveAcknowledgementsEnabled": true, + "windowScaleEnabled": true, + "ecnEnabled": false + } + }, + "ifName": "Ethernet3", + "afiSafiInfo": { + "ipv4Unicast": { + "localNexthop": "" + }, + "ipv6Unicast": { + "localNexthop": "fe80::a8c1:abff:fe5a:41a7" + } + } + }, + { + "peerAddress": "fe80::a8c1:abff:fea1:b618%Et2", + "asn": "65001.1027", + "linkType": "external", + "routerId": "172.18.4.3", + "vrf": "default", + "version": 4, + "lldpNeighbors": [ + { + "device": "node-65001.1027", + "description": "Arista Networks EOS version 4.30.5M-35156751.4305M (engineering build) running on an Arista cEOSLab" + } + ], + "peerGroupName": "LEAVES", + "peerFilter": "ASN4-PRIVATE", + "negotiatedVersion": 4, + "updateGroupIndex": -1, + "lastRcvd": 8, + "lastSent": 8, + "holdTime": 180, + "keepaliveTime": 60, + "configHoldTime": 180, + "configKeepaliveTime": 60, + "minHoldTime": 3, + "configMinHoldTime": 3, + "holdTimeLeft": 0, + "keepaliveTimeLeft": 0, + "state": "Established", + "establishedTime": 9, + "establishedTransitions": 1, + "lastState": "OpenConfirm", + "lastEvent": "ReapplyInboundPolicy", + "enRRefreshstalePathRemoval": false, + "outboundEnRRefreshEnabled": true, + "neighborCapabilities": { + "negotiationDisabled": false, + "unsupportedCapReceived": false, + "multiprotocolCaps": { + "ipv4Unicast": { + "advertised": true, + "received": true, + "enabled": true + }, + "ipv6Unicast": { + "advertised": true, + "received": true, + "enabled": true + } + }, + "fourOctetAsnCap": { + "advertised": true, + "received": true, + "enabled": true + }, + "routeRefreshCap": { + "advertised": true, + "received": true, + "enabled": true + }, + "enhancedRouteRefreshCap": { + "advertised": true, + "received": true, + "enabled": true + }, + "sendEorMessages": { + "advertised": true, + "received": true, + "enabled": true + }, + "addPathsCaps": { + "ipv4Unicast": { + "receivingAddPaths": { + "receiveCapabilityAdvertised": true, + "sendCapabilityReceived": false, + "enabled": false + }, + "sendingAddPaths": { + "sendCapabilityAdvertised": false, + "receiveCapabilityReceived": true, + "enabled": false + } + }, + "ipv6Unicast": { + "receivingAddPaths": { + "receiveCapabilityAdvertised": true, + "sendCapabilityReceived": false, + "enabled": false + }, + "sendingAddPaths": { + "sendCapabilityAdvertised": false, + "receiveCapabilityReceived": true, + "enabled": false + } + } + }, + "extendedNextHopCaps": { + "ipv4UnicastOverIpv6": { + "advertised": true, + "received": true, + "enabled": true + } + } + }, + "endOfRibs": { + "incoming": { + "ipv4Unicast": { + "status": "received", + "eorReceivedTime": 1721149911.520603, + "stalePathsDeleted": 0 + }, + "ipv6Unicast": { + "status": "received", + "eorReceivedTime": 1721149911.520582, + "stalePathsDeleted": 0 + } + } + }, + "nexthopLuOriginateIpv4Uni": false, + "thirdPartyNexthopLuOriginateIpv4Uni": false, + "nexthopLuOriginateLfibBackupIpForwardIpv4Uni": false, + "nexthopLuOriginateIpv6Uni": false, + "thirdPartyNexthopLuOriginateIpv6Uni": false, + "nexthopLuOriginateLfibBackupIpForwardIpv6Uni": false, + "aigpSessionIpv4Uni": false, + "aigpSessionIpv4LabeledUni": false, + "aigpSessionIpv6Uni": false, + "aigpSessionIpv6LabeledUni": false, + "fwdFailoverTriggerSessionIpv6Uni": false, + "fwdFailoverTriggerSessionIpv4Uni": false, + "outMessageStats": { + "opens": 1, + "notifications": 0, + "updates": 18, + "keepalives": 2, + "rtRefreshes": 0, + "beginOfRtRefreshes": 0, + "endOfRtRefreshes": 0 + }, + "inMessageStats": { + "opens": 1, + "notifications": 0, + "updates": 10, + "keepalives": 2, + "rtRefreshes": 0, + "beginOfRtRefreshes": 0, + "endOfRtRefreshes": 0 + }, + "sentMessages": 21, + "receivedMessages": 13, + "prefixesSent": 8, + "prefixesReceived": 5, + "v4BestPaths": 2, + "v4BestEcmpPaths": 0, + "v6PrefixesSent": 8, + "v6PrefixesReceived": 5, + "v6BestPaths": 2, + "v6BestEcmpPaths": 0, + "totalRoutesWarnLimit": 204800, + "maxTotalRoutes": 256000, + "dropStats": { + "inDropAsloop": 0, + "inDropClusterIdLoop": 0, + "inDropMalformedMpbgp": 0, + "inDropOrigId": 0, + "inDropNhLocal": 0, + "inDropNhAfV6": 0, + "prefixDroppedMartianV4": 0, + "prefixDroppedMartianV6": 0, + "prefixLuDroppedV4": 0, + "prefixLuDroppedMartianV4": 0, + "prefixLuDroppedV6": 0, + "prefixLuDroppedMartianV6": 0, + "prefixEvpnDroppedUnsupportedRouteType": 0, + "prefixBgpLsDroppedReceptionUnsupported": 0, + "outDropV4LocalAddr": 0, + "outDropV6LocalAddr": 0, + "prefixVpnIpv4DroppedImportMatchFailure": 0, + "prefixVpnIpv6DroppedImportMatchFailure": 0, + "prefixEvpnDroppedImportMatchFailure": 0, + "prefixRtMembershipDroppedLocalAsReject": 0 + }, + "peerInUpdateErrors": { + "inUpdErrWithdraw": 0, + "inUpdErrIgnore": 0, + "inUpdErrDisableAfiSafi": 0, + "disabledAfiSafi": "None", + "lastUpdErrTime": 0 + }, + "bgpSoftReconfigInbound": "Default", + "rpkiOriginValidationMethod": "disabled", + "rpkiOriginValidationSendExtComm": false, + "rpkiOriginValidationRouteMap": "", + "orrPosition": {}, + "localAsn": "65002.2048", + "localRouterId": "172.18.8.0", + "ttl": 1, + "maxTtlHops": 255, + "updateSource": "fe80::a8c1:abff:fe85:a217", + "localPort": 179, + "remotePort": 33217, + "prependOwnDisabled": false, + "peerTcpInfo": { + "state": "ESTABLISHED", + "options": 7, + "sendWindowScale": 7, + "rcvWindowScale": 7, + "retransTimeout": 204000, + "delayedAckTimeout": 40000, + "maxSegmentSize": 1428, + "sndRtt": 3481, + "sndRttVariance": 6449, + "slowStartThreshold": 2147483647, + "congestionWindow": 10, + "rcvRtt": 0, + "rcvWindow": 14400, + "totalRetrans": 0, + "outputQueueLength": 0, + "outputMaxQueueLength": 87040, + "inputQueueLength": 0, + "inputMaxQueueLength": 32768, + "connectionOptions": { + "timestampsEnabled": true, + "selectiveAcknowledgementsEnabled": true, + "windowScaleEnabled": true, + "ecnEnabled": false + } + }, + "ifName": "Ethernet2", + "afiSafiInfo": { + "ipv4Unicast": { + "localNexthop": "" + }, + "ipv6Unicast": { + "localNexthop": "fe80::a8c1:abff:fe85:a217" + } + } + }, + { + "peerAddress": "fe80::a8c1:abff:fedc:fb58%Et1", + "asn": "65001.1026", + "linkType": "external", + "routerId": "172.18.4.2", + "vrf": "default", + "version": 4, + "lldpNeighbors": [ + { + "device": "node-65001.1026", + "description": "Arista Networks EOS version 4.30.5M-35156751.4305M (engineering build) running on an Arista cEOSLab" + } + ], + "peerGroupName": "LEAVES", + "peerFilter": "ASN4-PRIVATE", + "negotiatedVersion": 4, + "updateGroupIndex": -1, + "lastRcvd": 8, + "lastSent": 8, + "holdTime": 180, + "keepaliveTime": 60, + "configHoldTime": 180, + "configKeepaliveTime": 60, + "minHoldTime": 3, + "configMinHoldTime": 3, + "holdTimeLeft": 0, + "keepaliveTimeLeft": 0, + "state": "Established", + "establishedTime": 9, + "establishedTransitions": 1, + "lastState": "OpenConfirm", + "lastEvent": "RecvKeepAlive", + "enRRefreshstalePathRemoval": false, + "outboundEnRRefreshEnabled": true, + "neighborCapabilities": { + "negotiationDisabled": false, + "unsupportedCapReceived": false, + "multiprotocolCaps": { + "ipv4Unicast": { + "advertised": true, + "received": true, + "enabled": true + }, + "ipv6Unicast": { + "advertised": true, + "received": true, + "enabled": true + } + }, + "fourOctetAsnCap": { + "advertised": true, + "received": true, + "enabled": true + }, + "routeRefreshCap": { + "advertised": true, + "received": true, + "enabled": true + }, + "enhancedRouteRefreshCap": { + "advertised": true, + "received": true, + "enabled": true + }, + "sendEorMessages": { + "advertised": true, + "received": true, + "enabled": true + }, + "addPathsCaps": { + "ipv4Unicast": { + "receivingAddPaths": { + "receiveCapabilityAdvertised": true, + "sendCapabilityReceived": false, + "enabled": false + }, + "sendingAddPaths": { + "sendCapabilityAdvertised": false, + "receiveCapabilityReceived": true, + "enabled": false + } + }, + "ipv6Unicast": { + "receivingAddPaths": { + "receiveCapabilityAdvertised": true, + "sendCapabilityReceived": false, + "enabled": false + }, + "sendingAddPaths": { + "sendCapabilityAdvertised": false, + "receiveCapabilityReceived": true, + "enabled": false + } + } + }, + "extendedNextHopCaps": { + "ipv4UnicastOverIpv6": { + "advertised": true, + "received": true, + "enabled": true + } + } + }, + "endOfRibs": { + "incoming": { + "ipv4Unicast": { + "status": "received", + "eorReceivedTime": 1721149911.53437, + "stalePathsDeleted": 0 + }, + "ipv6Unicast": { + "status": "received", + "eorReceivedTime": 1721149911.534352, + "stalePathsDeleted": 0 + } + } + }, + "nexthopLuOriginateIpv4Uni": false, + "thirdPartyNexthopLuOriginateIpv4Uni": false, + "nexthopLuOriginateLfibBackupIpForwardIpv4Uni": false, + "nexthopLuOriginateIpv6Uni": false, + "thirdPartyNexthopLuOriginateIpv6Uni": false, + "nexthopLuOriginateLfibBackupIpForwardIpv6Uni": false, + "aigpSessionIpv4Uni": false, + "aigpSessionIpv4LabeledUni": false, + "aigpSessionIpv6Uni": false, + "aigpSessionIpv6LabeledUni": false, + "fwdFailoverTriggerSessionIpv6Uni": false, + "fwdFailoverTriggerSessionIpv4Uni": false, + "outMessageStats": { + "opens": 1, + "notifications": 0, + "updates": 18, + "keepalives": 2, + "rtRefreshes": 0, + "beginOfRtRefreshes": 0, + "endOfRtRefreshes": 0 + }, + "inMessageStats": { + "opens": 1, + "notifications": 0, + "updates": 16, + "keepalives": 2, + "rtRefreshes": 0, + "beginOfRtRefreshes": 0, + "endOfRtRefreshes": 0 + }, + "sentMessages": 21, + "receivedMessages": 19, + "prefixesSent": 5, + "prefixesReceived": 6, + "v4BestPaths": 5, + "v4BestEcmpPaths": 0, + "v6PrefixesSent": 5, + "v6PrefixesReceived": 6, + "v6BestPaths": 5, + "v6BestEcmpPaths": 0, + "totalRoutesWarnLimit": 204800, + "maxTotalRoutes": 256000, + "dropStats": { + "inDropAsloop": 0, + "inDropClusterIdLoop": 0, + "inDropMalformedMpbgp": 0, + "inDropOrigId": 0, + "inDropNhLocal": 0, + "inDropNhAfV6": 0, + "prefixDroppedMartianV4": 0, + "prefixDroppedMartianV6": 0, + "prefixLuDroppedV4": 0, + "prefixLuDroppedMartianV4": 0, + "prefixLuDroppedV6": 0, + "prefixLuDroppedMartianV6": 0, + "prefixEvpnDroppedUnsupportedRouteType": 0, + "prefixBgpLsDroppedReceptionUnsupported": 0, + "outDropV4LocalAddr": 0, + "outDropV6LocalAddr": 0, + "prefixVpnIpv4DroppedImportMatchFailure": 0, + "prefixVpnIpv6DroppedImportMatchFailure": 0, + "prefixEvpnDroppedImportMatchFailure": 0, + "prefixRtMembershipDroppedLocalAsReject": 0 + }, + "peerInUpdateErrors": { + "inUpdErrWithdraw": 0, + "inUpdErrIgnore": 0, + "inUpdErrDisableAfiSafi": 0, + "disabledAfiSafi": "None", + "lastUpdErrTime": 0 + }, + "bgpSoftReconfigInbound": "Default", + "rpkiOriginValidationMethod": "disabled", + "rpkiOriginValidationSendExtComm": false, + "rpkiOriginValidationRouteMap": "", + "orrPosition": {}, + "localAsn": "65002.2048", + "localRouterId": "172.18.8.0", + "ttl": 1, + "maxTtlHops": 255, + "updateSource": "fe80::a8c1:abff:fece:2f12", + "localPort": 46863, + "remotePort": 179, + "prependOwnDisabled": false, + "peerTcpInfo": { + "state": "ESTABLISHED", + "options": 7, + "sendWindowScale": 7, + "rcvWindowScale": 7, + "retransTimeout": 208000, + "delayedAckTimeout": 40000, + "maxSegmentSize": 1428, + "sndRtt": 6920, + "sndRttVariance": 12272, + "slowStartThreshold": 2147483647, + "congestionWindow": 10, + "rcvRtt": 0, + "rcvWindow": 14280, + "totalRetrans": 0, + "outputQueueLength": 0, + "outputMaxQueueLength": 87040, + "inputQueueLength": 0, + "inputMaxQueueLength": 32768, + "connectionOptions": { + "timestampsEnabled": true, + "selectiveAcknowledgementsEnabled": true, + "windowScaleEnabled": true, + "ecnEnabled": false + } + }, + "ifName": "Ethernet1", + "afiSafiInfo": { + "ipv4Unicast": { + "localNexthop": "" + }, + "ipv6Unicast": { + "localNexthop": "fe80::a8c1:abff:fece:2f12" + } + } + } + ] + } + } +} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ipv6_bgp_peers_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_rou.text b/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ipv6_bgp_peers_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_rou.text deleted file mode 100644 index f1d5ed371..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ipv6_bgp_peers_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_rou.text +++ /dev/null @@ -1,30 +0,0 @@ -BGP neighbor is fe80::a8c1:abff:fe0b:7b5f%Et5, remote AS 65000.8, external link - BGP version 4, remote router ID 172.18.0.8, VRF default - BGP state is Established, up for 7d01h - IPv4 Unicast: 9 2 1 0 - IPv6 Unicast: 9 2 1 0 -Local AS is 65001.1026, local router ID 172.18.4.2 -BGP neighbor is fe80::a8c1:abff:fe27:69e9%Et2, remote AS 65002.2049, external link - BGP version 4, remote router ID 172.18.8.1, VRF default - BGP state is Established, up for 7d01h - IPv4 Unicast: 9 5 1 0 - IPv6 Unicast: 9 5 1 0 -Local AS is 65001.1026, local router ID 172.18.4.2 -BGP neighbor is fe80::a8c1:abff:fe35:51d9%Et1, remote AS 65002.2048, external link - BGP version 4, remote router ID 172.18.8.0, VRF default - BGP state is Established, up for 7d01h - IPv4 Unicast: 6 5 4 0 - IPv6 Unicast: 6 5 4 0 -Local AS is 65001.1026, local router ID 172.18.4.2 -BGP neighbor is fe80::a8c1:abff:fe5d:9706%Et4, remote AS 65000.7, external link - BGP version 4, remote router ID 172.18.0.7, VRF default - BGP state is Established, up for 7d01h - IPv4 Unicast: 9 2 1 0 - IPv6 Unicast: 9 2 1 0 -Local AS is 65001.1026, local router ID 172.18.4.2 -BGP neighbor is fe80::a8c1:abff:fe95:fa49%Et3, remote AS 65000.5, external link - BGP version 4, remote router ID 172.18.0.5, VRF default - BGP state is Established, up for 7d01h - IPv4 Unicast: 9 2 1 0 - IPv6 Unicast: 9 2 1 0 -Local AS is 65001.1026, local router ID 172.18.4.2 diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ipv6_bgp_summary_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ipv6_bgp_summary_vrf_all.json index aa96e6d48..b4ddc4c91 100644 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ipv6_bgp_summary_vrf_all.json +++ b/test/eos/mocked_data/test_get_bgp_neighbors/issue1759/show_ipv6_bgp_summary_vrf_all.json @@ -1,76 +1,50 @@ { - "vrfs": { - "default": { - "routerId": "172.18.4.2", - "peers": { - "fe80::a8c1:abff:fe0b:7b5f%Et5": { - "msgSent": 239193, - "inMsgQueue": 0, - "prefixReceived": 2, - "upDownTime": 1664912777.128896, - "version": 4, - "prefixAccepted": 2, - "msgReceived": 203664, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65000.8" - }, - "fe80::a8c1:abff:fe27:69e9%Et2": { - "msgSent": 11995, - "inMsgQueue": 0, - "prefixReceived": 5, - "upDownTime": 1664912780.356703, - "version": 4, - "prefixAccepted": 5, - "msgReceived": 11970, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65002.2049" - }, - "fe80::a8c1:abff:fe35:51d9%Et1": { - "msgSent": 11982, - "inMsgQueue": 0, - "prefixReceived": 5, - "upDownTime": 1664912783.670674, - "version": 4, - "prefixAccepted": 5, - "msgReceived": 11977, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65002.2048" - }, - "fe80::a8c1:abff:fe5d:9706%Et4": { - "msgSent": 239135, - "inMsgQueue": 0, - "prefixReceived": 2, - "upDownTime": 1664912777.50903, - "version": 4, - "prefixAccepted": 2, - "msgReceived": 203688, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65000.7" - }, - "fe80::a8c1:abff:fe95:fa49%Et3": { - "msgSent": 239080, - "inMsgQueue": 0, - "prefixReceived": 2, - "upDownTime": 1664912777.604791, - "version": 4, - "prefixAccepted": 2, - "msgReceived": 203688, - "peerState": "Established", - "outMsgQueue": 0, - "underMaintenance": false, - "asn": "65000.5" - } - }, - "vrf": "default", - "asn": "65001.1026" + "vrfs": { + "default": { + "vrf": "default", + "routerId": "172.18.8.0", + "asn": "65002.2048", + "peers": { + "fe80::a8c1:abff:fe94:4171%Et3": { + "version": 4, + "msgReceived": 25, + "msgSent": 24, + "inMsgQueue": 0, + "outMsgQueue": 0, + "asn": "65001.1028", + "prefixAccepted": 3, + "prefixReceived": 3, + "upDownTime": 1721149910.529753, + "underMaintenance": false, + "peerState": "Established" + }, + "fe80::a8c1:abff:fea1:b618%Et2": { + "version": 4, + "msgReceived": 14, + "msgSent": 22, + "inMsgQueue": 0, + "outMsgQueue": 0, + "asn": "65001.1027", + "prefixAccepted": 5, + "prefixReceived": 5, + "upDownTime": 1721149910.47622, + "underMaintenance": false, + "peerState": "Established" + }, + "fe80::a8c1:abff:fedc:fb58%Et1": { + "version": 4, + "msgReceived": 20, + "msgSent": 22, + "inMsgQueue": 0, + "outMsgQueue": 0, + "asn": "65001.1026", + "prefixAccepted": 6, + "prefixReceived": 6, + "upDownTime": 1721149910.456982, + "underMaintenance": false, + "peerState": "Established" } + } } + } } diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue58_neighbor_down/expected_result.json b/test/eos/mocked_data/test_get_bgp_neighbors/issue58_neighbor_down/expected_result.json deleted file mode 100644 index 26963dca7..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue58_neighbor_down/expected_result.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "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": 0, - "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 - } - } - } - } - } -} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue58_neighbor_down/show_ip_bgp_neighbors_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_r.text b/test/eos/mocked_data/test_get_bgp_neighbors/issue58_neighbor_down/show_ip_bgp_neighbors_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_r.text deleted file mode 100644 index 270822d7d..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue58_neighbor_down/show_ip_bgp_neighbors_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_r.text +++ /dev/null @@ -1,12 +0,0 @@ -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 Unicast: 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 Unicast: 0 0 -Local AS is 65002, local router ID 192.168.56.2 diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue58_neighbor_down/show_ip_bgp_summary_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/issue58_neighbor_down/show_ip_bgp_summary_vrf_all.json deleted file mode 100644 index 850feca5e..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue58_neighbor_down/show_ip_bgp_summary_vrf_all.json +++ /dev/null @@ -1,37 +0,0 @@ -{ -"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 -} -} -} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue58_neighbor_down/show_ipv6_bgp_peers_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_rou.text b/test/eos/mocked_data/test_get_bgp_neighbors/issue58_neighbor_down/show_ipv6_bgp_peers_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_rou.text deleted file mode 100644 index 6643bdc03..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue58_neighbor_down/show_ipv6_bgp_peers_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_rou.text +++ /dev/null @@ -1,12 +0,0 @@ -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 diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue58_neighbor_down/show_ipv6_bgp_summary_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/issue58_neighbor_down/show_ipv6_bgp_summary_vrf_all.json deleted file mode 100644 index 08e5e5c45..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue58_neighbor_down/show_ipv6_bgp_summary_vrf_all.json +++ /dev/null @@ -1,24 +0,0 @@ -{ -"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 -} -}, -"vrf": "default", -"asn": 65001 -} -} -} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue944/expected_result.json b/test/eos/mocked_data/test_get_bgp_neighbors/issue944/expected_result.json deleted file mode 100644 index a22cd863f..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue944/expected_result.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "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 - } - } - } - } - } -} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue944/show_ip_bgp_neighbors_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_r.text b/test/eos/mocked_data/test_get_bgp_neighbors/issue944/show_ip_bgp_neighbors_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_r.text deleted file mode 100644 index 577f118a3..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue944/show_ip_bgp_neighbors_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_r.text +++ /dev/null @@ -1,12 +0,0 @@ -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 diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue944/show_ip_bgp_summary_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/issue944/show_ip_bgp_summary_vrf_all.json deleted file mode 100644 index 850feca5e..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue944/show_ip_bgp_summary_vrf_all.json +++ /dev/null @@ -1,37 +0,0 @@ -{ -"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 -} -} -} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue944/show_ipv6_bgp_peers_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_rou.text b/test/eos/mocked_data/test_get_bgp_neighbors/issue944/show_ipv6_bgp_peers_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_rou.text deleted file mode 100644 index 6643bdc03..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue944/show_ipv6_bgp_peers_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_rou.text +++ /dev/null @@ -1,12 +0,0 @@ -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 diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue944/show_ipv6_bgp_summary_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/issue944/show_ipv6_bgp_summary_vrf_all.json deleted file mode 100644 index a68112c2b..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/issue944/show_ipv6_bgp_summary_vrf_all.json +++ /dev/null @@ -1,37 +0,0 @@ -{ -"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 -} -} -} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/nobgp/expected_result.json b/test/eos/mocked_data/test_get_bgp_neighbors/nobgp/expected_result.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/test/eos/mocked_data/test_get_bgp_neighbors/nobgp/expected_result.json @@ -0,0 +1 @@ +{} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/nobgp/show_ip_bgp_neighbors_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/nobgp/show_ip_bgp_neighbors_vrf_all.json new file mode 100644 index 000000000..796bb60a4 --- /dev/null +++ b/test/eos/mocked_data/test_get_bgp_neighbors/nobgp/show_ip_bgp_neighbors_vrf_all.json @@ -0,0 +1,3 @@ +{ + "vrfs": {} +} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/nobgp/show_ip_bgp_summary_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/nobgp/show_ip_bgp_summary_vrf_all.json new file mode 100644 index 000000000..796bb60a4 --- /dev/null +++ b/test/eos/mocked_data/test_get_bgp_neighbors/nobgp/show_ip_bgp_summary_vrf_all.json @@ -0,0 +1,3 @@ +{ + "vrfs": {} +} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/nobgp/show_ipv6_bgp_peers_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/nobgp/show_ipv6_bgp_peers_vrf_all.json new file mode 100644 index 000000000..796bb60a4 --- /dev/null +++ b/test/eos/mocked_data/test_get_bgp_neighbors/nobgp/show_ipv6_bgp_peers_vrf_all.json @@ -0,0 +1,3 @@ +{ + "vrfs": {} +} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/nobgp/show_ipv6_bgp_summary_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/nobgp/show_ipv6_bgp_summary_vrf_all.json new file mode 100644 index 000000000..796bb60a4 --- /dev/null +++ b/test/eos/mocked_data/test_get_bgp_neighbors/nobgp/show_ipv6_bgp_summary_vrf_all.json @@ -0,0 +1,3 @@ +{ + "vrfs": {} +} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/nopeers/expected_result.json b/test/eos/mocked_data/test_get_bgp_neighbors/nopeers/expected_result.json new file mode 100644 index 000000000..ab8854f5e --- /dev/null +++ b/test/eos/mocked_data/test_get_bgp_neighbors/nopeers/expected_result.json @@ -0,0 +1,6 @@ +{ + "global": { + "peers": {}, + "router_id": "192.168.0.0" + } +} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/nopeers/show_ip_bgp_neighbors_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/nopeers/show_ip_bgp_neighbors_vrf_all.json new file mode 100644 index 000000000..3022e1ca5 --- /dev/null +++ b/test/eos/mocked_data/test_get_bgp_neighbors/nopeers/show_ip_bgp_neighbors_vrf_all.json @@ -0,0 +1,7 @@ +{ + "vrfs": { + "default": { + "peerList": [] + } + } +} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/nopeers/show_ip_bgp_summary_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/nopeers/show_ip_bgp_summary_vrf_all.json new file mode 100644 index 000000000..efacff379 --- /dev/null +++ b/test/eos/mocked_data/test_get_bgp_neighbors/nopeers/show_ip_bgp_summary_vrf_all.json @@ -0,0 +1,10 @@ +{ + "vrfs": { + "default": { + "vrf": "default", + "routerId": "192.168.0.0", + "asn": "65001", + "peers": {} + } + } +} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/nopeers/show_ipv6_bgp_peers_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/nopeers/show_ipv6_bgp_peers_vrf_all.json new file mode 100644 index 000000000..3022e1ca5 --- /dev/null +++ b/test/eos/mocked_data/test_get_bgp_neighbors/nopeers/show_ipv6_bgp_peers_vrf_all.json @@ -0,0 +1,7 @@ +{ + "vrfs": { + "default": { + "peerList": [] + } + } +} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/nopeers/show_ipv6_bgp_summary_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/nopeers/show_ipv6_bgp_summary_vrf_all.json new file mode 100644 index 000000000..efacff379 --- /dev/null +++ b/test/eos/mocked_data/test_get_bgp_neighbors/nopeers/show_ipv6_bgp_summary_vrf_all.json @@ -0,0 +1,10 @@ +{ + "vrfs": { + "default": { + "vrf": "default", + "routerId": "192.168.0.0", + "asn": "65001", + "peers": {} + } + } +} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/normal/expected_result.json b/test/eos/mocked_data/test_get_bgp_neighbors/normal/expected_result.json index a22cd863f..d6e527ded 100644 --- a/test/eos/mocked_data/test_get_bgp_neighbors/normal/expected_result.json +++ b/test/eos/mocked_data/test_get_bgp_neighbors/normal/expected_result.json @@ -1,91 +1,91 @@ { "global": { - "router_id": "192.168.56.3", "peers": { - "192.168.56.4": { + "10.0.0.1": { + "local_as": 65001, + "remote_as": 65002, + "remote_id": "192.168.0.1", + "is_up": true, "is_enabled": true, - "uptime": "...", - "remote_as": 65001, "description": "", - "remote_id": "192.168.56.3", - "local_as": 65002, - "is_up": false, + "uptime": 121, "address_family": { "ipv4": { - "sent_prefixes": 0, - "accepted_prefixes": -1, - "received_prefixes": 0 + "received_prefixes": 3, + "accepted_prefixes": 3, + "sent_prefixes": 4 }, "ipv6": { - "sent_prefixes": 0, - "accepted_prefixes": -1, - "received_prefixes": 0 + "received_prefixes": 0, + "accepted_prefixes": 0, + "sent_prefixes": 0 } } }, - "192.168.56.2": { + "10.0.0.3": { + "local_as": 65001, + "remote_as": 65003, + "remote_id": "0.0.0.0", + "is_up": false, "is_enabled": true, - "uptime": "...", - "remote_as": 65002, "description": "", - "remote_id": "192.168.56.2", - "local_as": 65001, - "is_up": true, + "uptime": -1, "address_family": { "ipv4": { - "sent_prefixes": 0, - "accepted_prefixes": -1, - "received_prefixes": 0 + "received_prefixes": 0, + "accepted_prefixes": 0, + "sent_prefixes": 0 }, "ipv6": { - "sent_prefixes": 0, - "accepted_prefixes": -1, - "received_prefixes": 0 + "received_prefixes": 0, + "accepted_prefixes": 0, + "sent_prefixes": 0 } } }, - "2001:7f8::f10:0:2": { - "is_enabled": true, - "uptime": "...", - "remote_as": 65002, - "description": "", - "remote_id": "192.168.56.2", + "2001:fb8:100::2": { "local_as": 65001, + "remote_as": 65002, + "remote_id": "192.168.0.1", "is_up": true, + "is_enabled": true, + "description": "", + "uptime": 165, "address_family": { "ipv4": { - "sent_prefixes": 0, - "accepted_prefixes": -1, - "received_prefixes": 0 + "received_prefixes": 0, + "accepted_prefixes": 0, + "sent_prefixes": 0 }, "ipv6": { - "sent_prefixes": 0, - "accepted_prefixes": -1, - "received_prefixes": 0 + "received_prefixes": 3, + "accepted_prefixes": 3, + "sent_prefixes": 4 } } }, - "2001:7f8::f10:0:3": { + "2001:fb8:200::2": { + "local_as": 65001, + "remote_as": 65003, + "remote_id": "192.168.0.2", + "is_up": true, "is_enabled": true, - "uptime": "...", - "remote_as": 65001, "description": "", - "remote_id": "192.168.56.3", - "local_as": 65002, - "is_up": false, + "uptime": 165, "address_family": { "ipv4": { - "sent_prefixes": 0, - "accepted_prefixes": -1, - "received_prefixes": 0 + "received_prefixes": 0, + "accepted_prefixes": 0, + "sent_prefixes": 0 }, "ipv6": { - "sent_prefixes": 0, - "accepted_prefixes": -1, - "received_prefixes": 0 + "received_prefixes": 0, + "accepted_prefixes": 0, + "sent_prefixes": 5 } } } - } + }, + "router_id": "192.168.0.0" } } diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ip_bgp_neighbors_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ip_bgp_neighbors_vrf_all.json new file mode 100644 index 000000000..8dfc4ec7b --- /dev/null +++ b/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ip_bgp_neighbors_vrf_all.json @@ -0,0 +1,362 @@ +{ + "vrfs": { + "default": { + "peerList": [ + { + "peerAddress": "10.0.0.1", + "asn": "65002", + "linkType": "external", + "routerId": "192.168.0.1", + "vrf": "default", + "version": 4, + "negotiatedVersion": 4, + "updateGroupIndex": -1, + "lastRcvd": 32, + "lastSent": 31, + "holdTime": 180, + "keepaliveTime": 60, + "configHoldTime": 180, + "configKeepaliveTime": 60, + "minHoldTime": 3, + "configMinHoldTime": 3, + "holdTimeLeft": 0, + "keepaliveTimeLeft": 0, + "state": "Established", + "establishedTime": 121, + "establishedTransitions": 1, + "lastState": "OpenConfirm", + "lastEvent": "ReapplyInboundPolicy", + "enRRefreshstalePathRemoval": false, + "outboundEnRRefreshEnabled": true, + "neighborCapabilities": { + "negotiationDisabled": false, + "unsupportedCapReceived": false, + "multiprotocolCaps": { + "ipv4Unicast": { + "advertised": true, + "received": true, + "enabled": true + } + }, + "fourOctetAsnCap": { + "advertised": true, + "received": true, + "enabled": true + }, + "routeRefreshCap": { + "advertised": true, + "received": true, + "enabled": true + }, + "enhancedRouteRefreshCap": { + "advertised": true, + "received": true, + "enabled": true + }, + "sendEorMessages": { + "advertised": true, + "received": true, + "enabled": true + }, + "addPathsCaps": { + "ipv4Unicast": { + "receivingAddPaths": { + "receiveCapabilityAdvertised": true, + "sendCapabilityReceived": false, + "enabled": false + }, + "sendingAddPaths": { + "sendCapabilityAdvertised": false, + "receiveCapabilityReceived": true, + "enabled": false + } + } + } + }, + "endOfRibs": { + "incoming": { + "ipv4Unicast": { + "status": "received", + "eorReceivedTime": 1721080528.064628, + "stalePathsDeleted": 0 + } + } + }, + "nexthopLuOriginateIpv4Uni": false, + "thirdPartyNexthopLuOriginateIpv4Uni": false, + "nexthopLuOriginateLfibBackupIpForwardIpv4Uni": false, + "nexthopLuOriginateIpv6Uni": false, + "thirdPartyNexthopLuOriginateIpv6Uni": false, + "nexthopLuOriginateLfibBackupIpForwardIpv6Uni": false, + "aigpSessionIpv4Uni": false, + "aigpSessionIpv4LabeledUni": false, + "aigpSessionIpv6Uni": false, + "aigpSessionIpv6LabeledUni": false, + "fwdFailoverTriggerSessionIpv4Uni": false, + "fwdFailoverTriggerSessionIpv6Uni": false, + "outMessageStats": { + "opens": 1, + "notifications": 0, + "updates": 2, + "keepalives": 4, + "rtRefreshes": 0, + "beginOfRtRefreshes": 0, + "endOfRtRefreshes": 0 + }, + "inMessageStats": { + "opens": 1, + "notifications": 0, + "updates": 2, + "keepalives": 4, + "rtRefreshes": 0, + "beginOfRtRefreshes": 0, + "endOfRtRefreshes": 0 + }, + "sentMessages": 7, + "receivedMessages": 7, + "prefixesSent": 4, + "prefixesReceived": 3, + "v4BestPaths": 1, + "v4BestEcmpPaths": 0, + "v6PrefixesSent": 0, + "v6PrefixesReceived": 0, + "v6BestPaths": 0, + "v6BestEcmpPaths": 0, + "totalRoutesWarnLimit": 204800, + "maxTotalRoutes": 256000, + "dropStats": { + "inDropAsloop": 0, + "inDropClusterIdLoop": 0, + "inDropMalformedMpbgp": 0, + "inDropOrigId": 0, + "inDropNhLocal": 0, + "inDropNhAfV6": 0, + "prefixDroppedMartianV4": 0, + "prefixDroppedMartianV6": 0, + "prefixLuDroppedV4": 0, + "prefixLuDroppedMartianV4": 0, + "prefixLuDroppedV6": 0, + "prefixLuDroppedMartianV6": 0, + "prefixEvpnDroppedUnsupportedRouteType": 0, + "prefixBgpLsDroppedReceptionUnsupported": 0, + "outDropV4LocalAddr": 0, + "outDropV6LocalAddr": 0, + "prefixVpnIpv4DroppedImportMatchFailure": 0, + "prefixVpnIpv6DroppedImportMatchFailure": 0, + "prefixEvpnDroppedImportMatchFailure": 0, + "prefixRtMembershipDroppedLocalAsReject": 0 + }, + "peerInUpdateErrors": { + "inUpdErrWithdraw": 0, + "inUpdErrIgnore": 0, + "inUpdErrDisableAfiSafi": 0, + "disabledAfiSafi": "None", + "lastUpdErrTime": 0 + }, + "bgpSoftReconfigInbound": "Default", + "rpkiOriginValidationMethod": "disabled", + "rpkiOriginValidationSendExtComm": false, + "rpkiOriginValidationRouteMap": "", + "orrPosition": {}, + "localAsn": "65001", + "localRouterId": "192.168.0.0", + "ttl": 1, + "maxTtlHops": 255, + "updateSource": "10.0.0.0", + "localPort": 179, + "remotePort": 41273, + "prependOwnDisabled": false, + "peerTcpInfo": { + "state": "ESTABLISHED", + "options": 7, + "sendWindowScale": 7, + "rcvWindowScale": 7, + "retransTimeout": 208000, + "delayedAckTimeout": 40000, + "maxSegmentSize": 1448, + "sndRtt": 4287, + "sndRttVariance": 8486, + "slowStartThreshold": 2147483647, + "congestionWindow": 10, + "rcvRtt": 0, + "rcvWindow": 14600, + "totalRetrans": 0, + "outputQueueLength": 0, + "outputMaxQueueLength": 87040, + "inputQueueLength": 0, + "inputMaxQueueLength": 32768, + "connectionOptions": { + "timestampsEnabled": true, + "selectiveAcknowledgementsEnabled": true, + "windowScaleEnabled": true, + "ecnEnabled": false + } + }, + "ifName": "Ethernet1", + "afiSafiInfo": { + "ipv4Unicast": { + "localNexthop": "10.0.0.0" + } + } + }, + { + "peerAddress": "10.0.0.3", + "asn": "65003", + "linkType": "external", + "routerId": "0.0.0.0", + "vrf": "default", + "version": 4, + "negotiatedVersion": 4, + "updateGroupIndex": -1, + "lastRcvd": 21, + "lastSent": 21, + "holdTime": 0, + "keepaliveTime": 0, + "configHoldTime": 180, + "configKeepaliveTime": 60, + "minHoldTime": 3, + "configMinHoldTime": 3, + "connectTimeLeft": 0, + "connectInterval": 64, + "connectFailed": 7, + "state": "Active", + "establishFailHint": "Cease/connection rejected", + "establishedTransitions": 0, + "lastState": "Idle", + "lastEvent": "Start", + "lastErrorRcvdCode": "Cease", + "lastErrorRcvdSubcode": "connection rejected", + "lastErrorRcvdTimeInfo": { + "time": 21, + "firstTime": 121, + "repeats": 6 + }, + "neighborCapabilities": { + "negotiationDisabled": false, + "unsupportedCapReceived": false, + "multiprotocolCaps": { + "ipv4Unicast": { + "advertised": true, + "received": false, + "enabled": false + } + }, + "fourOctetAsnCap": { + "advertised": true, + "received": false, + "enabled": false + }, + "routeRefreshCap": { + "advertised": true, + "received": false, + "enabled": false + }, + "enhancedRouteRefreshCap": { + "advertised": true, + "received": false, + "enabled": false + }, + "sendEorMessages": { + "advertised": true, + "received": false, + "enabled": false + }, + "addPathsCaps": { + "ipv4Unicast": { + "receivingAddPaths": { + "receiveCapabilityAdvertised": true, + "sendCapabilityReceived": false, + "enabled": false + } + } + } + }, + "endOfRibs": { + "incoming": {} + }, + "nexthopLuOriginateIpv4Uni": false, + "thirdPartyNexthopLuOriginateIpv4Uni": false, + "nexthopLuOriginateLfibBackupIpForwardIpv4Uni": false, + "nexthopLuOriginateIpv6Uni": false, + "thirdPartyNexthopLuOriginateIpv6Uni": false, + "nexthopLuOriginateLfibBackupIpForwardIpv6Uni": false, + "aigpSessionIpv4Uni": false, + "aigpSessionIpv4LabeledUni": false, + "aigpSessionIpv6Uni": false, + "aigpSessionIpv6LabeledUni": false, + "fwdFailoverTriggerSessionIpv4Uni": false, + "fwdFailoverTriggerSessionIpv6Uni": false, + "outMessageStats": { + "opens": 7, + "notifications": 0, + "updates": 0, + "keepalives": 0, + "rtRefreshes": 0 + }, + "inMessageStats": { + "opens": 0, + "notifications": 7, + "updates": 0, + "keepalives": 0, + "rtRefreshes": 0 + }, + "sentMessages": 7, + "receivedMessages": 7, + "prefixesSent": 0, + "prefixesReceived": 0, + "v4BestPaths": 0, + "v4BestEcmpPaths": 0, + "v6PrefixesSent": 0, + "v6PrefixesReceived": 0, + "v6BestPaths": 0, + "v6BestEcmpPaths": 0, + "totalRoutesWarnLimit": 204800, + "maxTotalRoutes": 256000, + "dropStats": { + "inDropAsloop": 0, + "inDropClusterIdLoop": 0, + "inDropMalformedMpbgp": 0, + "inDropOrigId": 0, + "inDropNhLocal": 0, + "inDropNhAfV6": 0, + "prefixDroppedMartianV4": 0, + "prefixDroppedMartianV6": 0, + "prefixLuDroppedV4": 0, + "prefixLuDroppedMartianV4": 0, + "prefixLuDroppedV6": 0, + "prefixLuDroppedMartianV6": 0, + "prefixEvpnDroppedUnsupportedRouteType": 0, + "prefixBgpLsDroppedReceptionUnsupported": 0, + "outDropV4LocalAddr": 0, + "outDropV6LocalAddr": 0, + "prefixVpnIpv4DroppedImportMatchFailure": 0, + "prefixVpnIpv6DroppedImportMatchFailure": 0, + "prefixEvpnDroppedImportMatchFailure": 0, + "prefixRtMembershipDroppedLocalAsReject": 0 + }, + "peerInUpdateErrors": { + "inUpdErrWithdraw": 0, + "inUpdErrIgnore": 0, + "inUpdErrDisableAfiSafi": 0, + "disabledAfiSafi": "None", + "lastUpdErrTime": 0 + }, + "bgpSoftReconfigInbound": "Default", + "rpkiOriginValidationMethod": "disabled", + "rpkiOriginValidationSendExtComm": false, + "rpkiOriginValidationRouteMap": "", + "orrPosition": {}, + "localAsn": "65001", + "localRouterId": "192.168.0.0", + "ttl": 1, + "maxTtlHops": 255, + "updateSource": "10.0.0.2", + "localPort": 0, + "remotePort": 179, + "prependOwnDisabled": false, + "afiSafiInfo": {} + } + ] + } + } +} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ip_bgp_neighbors_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_r.text b/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ip_bgp_neighbors_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_r.text deleted file mode 100644 index 270822d7d..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ip_bgp_neighbors_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_r.text +++ /dev/null @@ -1,12 +0,0 @@ -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 Unicast: 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 Unicast: 0 0 -Local AS is 65002, local router ID 192.168.56.2 diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ip_bgp_summary_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ip_bgp_summary_vrf_all.json index 850feca5e..f1aeeb257 100644 --- a/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ip_bgp_summary_vrf_all.json +++ b/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ip_bgp_summary_vrf_all.json @@ -1,37 +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 -} -} + "vrfs": { + "default": { + "vrf": "default", + "routerId": "192.168.0.0", + "asn": "65001", + "peers": { + "10.0.0.1": { + "version": 4, + "msgReceived": 5, + "msgSent": 4, + "inMsgQueue": 0, + "outMsgQueue": 0, + "asn": "65002", + "prefixAccepted": 3, + "prefixReceived": 3, + "upDownTime": 1721080527.052693, + "underMaintenance": false, + "peerState": "Established" + }, + "10.0.0.3": { + "version": 4, + "msgReceived": 6, + "msgSent": 6, + "inMsgQueue": 0, + "outMsgQueue": 0, + "asn": "65003", + "prefixAccepted": 0, + "prefixReceived": 0, + "upDownTime": 1721080524.898363, + "underMaintenance": false, + "peerState": "Active" + } + } + } + } } diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ipv6_bgp_peers_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ipv6_bgp_peers_vrf_all.json new file mode 100644 index 000000000..db83671ed --- /dev/null +++ b/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ipv6_bgp_peers_vrf_all.json @@ -0,0 +1,415 @@ +{ + "vrfs": { + "default": { + "peerList": [ + { + "peerAddress": "2001:fb8:100::2", + "asn": "65002", + "linkType": "external", + "routerId": "192.168.0.1", + "vrf": "default", + "version": 4, + "negotiatedVersion": 4, + "updateGroupIndex": -1, + "lastRcvd": 33, + "lastSent": 23, + "holdTime": 180, + "keepaliveTime": 60, + "configHoldTime": 180, + "configKeepaliveTime": 60, + "minHoldTime": 3, + "configMinHoldTime": 3, + "holdTimeLeft": 0, + "keepaliveTimeLeft": 0, + "state": "Established", + "establishedTime": 165, + "establishedTransitions": 1, + "lastState": "OpenConfirm", + "lastEvent": "Established", + "lastSocketOutErrorMsg": "Bind (Cannot assign requested address)", + "lastSocketOutErrorTimeInfo": { + "time": 166 + }, + "enRRefreshstalePathRemoval": false, + "outboundEnRRefreshEnabled": true, + "neighborCapabilities": { + "negotiationDisabled": false, + "unsupportedCapReceived": false, + "multiprotocolCaps": { + "ipv6Unicast": { + "advertised": true, + "received": true, + "enabled": true + } + }, + "fourOctetAsnCap": { + "advertised": true, + "received": true, + "enabled": true + }, + "routeRefreshCap": { + "advertised": true, + "received": true, + "enabled": true + }, + "enhancedRouteRefreshCap": { + "advertised": true, + "received": true, + "enabled": true + }, + "sendEorMessages": { + "advertised": true, + "received": true, + "enabled": true + }, + "addPathsCaps": { + "ipv6Unicast": { + "receivingAddPaths": { + "receiveCapabilityAdvertised": true, + "sendCapabilityReceived": false, + "enabled": false + }, + "sendingAddPaths": { + "sendCapabilityAdvertised": false, + "receiveCapabilityReceived": true, + "enabled": false + } + } + } + }, + "endOfRibs": { + "incoming": { + "ipv6Unicast": { + "status": "received", + "eorReceivedTime": 1721080528.104721, + "stalePathsDeleted": 0 + } + } + }, + "nexthopLuOriginateIpv4Uni": false, + "thirdPartyNexthopLuOriginateIpv4Uni": false, + "nexthopLuOriginateLfibBackupIpForwardIpv4Uni": false, + "nexthopLuOriginateIpv6Uni": false, + "thirdPartyNexthopLuOriginateIpv6Uni": false, + "nexthopLuOriginateLfibBackupIpForwardIpv6Uni": false, + "aigpSessionIpv4Uni": false, + "aigpSessionIpv4LabeledUni": false, + "aigpSessionIpv6Uni": false, + "aigpSessionIpv6LabeledUni": false, + "fwdFailoverTriggerSessionIpv4Uni": false, + "fwdFailoverTriggerSessionIpv6Uni": false, + "outMessageStats": { + "opens": 1, + "notifications": 0, + "updates": 2, + "keepalives": 4, + "rtRefreshes": 0, + "beginOfRtRefreshes": 0, + "endOfRtRefreshes": 0 + }, + "inMessageStats": { + "opens": 1, + "notifications": 0, + "updates": 2, + "keepalives": 5, + "rtRefreshes": 0, + "beginOfRtRefreshes": 0, + "endOfRtRefreshes": 0 + }, + "sentMessages": 7, + "receivedMessages": 8, + "prefixesSent": 0, + "prefixesReceived": 0, + "v4BestPaths": 0, + "v4BestEcmpPaths": 0, + "v6PrefixesSent": 4, + "v6PrefixesReceived": 3, + "v6BestPaths": 1, + "v6BestEcmpPaths": 0, + "totalRoutesWarnLimit": 204800, + "maxTotalRoutes": 256000, + "dropStats": { + "inDropAsloop": 0, + "inDropClusterIdLoop": 0, + "inDropMalformedMpbgp": 0, + "inDropOrigId": 0, + "inDropNhLocal": 0, + "inDropNhAfV6": 0, + "prefixDroppedMartianV4": 0, + "prefixDroppedMartianV6": 0, + "prefixLuDroppedV4": 0, + "prefixLuDroppedMartianV4": 0, + "prefixLuDroppedV6": 0, + "prefixLuDroppedMartianV6": 0, + "prefixEvpnDroppedUnsupportedRouteType": 0, + "prefixBgpLsDroppedReceptionUnsupported": 0, + "outDropV4LocalAddr": 0, + "outDropV6LocalAddr": 0, + "prefixVpnIpv4DroppedImportMatchFailure": 0, + "prefixVpnIpv6DroppedImportMatchFailure": 0, + "prefixEvpnDroppedImportMatchFailure": 0, + "prefixRtMembershipDroppedLocalAsReject": 0 + }, + "peerInUpdateErrors": { + "inUpdErrWithdraw": 0, + "inUpdErrIgnore": 0, + "inUpdErrDisableAfiSafi": 0, + "disabledAfiSafi": "None", + "lastUpdErrTime": 0 + }, + "bgpSoftReconfigInbound": "Default", + "rpkiOriginValidationMethod": "disabled", + "rpkiOriginValidationSendExtComm": false, + "rpkiOriginValidationRouteMap": "", + "orrPosition": {}, + "localAsn": "65001", + "localRouterId": "192.168.0.0", + "ttl": 1, + "maxTtlHops": 255, + "updateSource": "2001:fb8:100::1", + "localPort": 42927, + "remotePort": 179, + "prependOwnDisabled": false, + "peerTcpInfo": { + "state": "ESTABLISHED", + "options": 7, + "sendWindowScale": 7, + "rcvWindowScale": 7, + "retransTimeout": 220000, + "delayedAckTimeout": 40000, + "maxSegmentSize": 1428, + "sndRtt": 19886, + "sndRttVariance": 18189, + "slowStartThreshold": 2147483647, + "congestionWindow": 10, + "rcvRtt": 0, + "rcvWindow": 14280, + "totalRetrans": 0, + "outputQueueLength": 0, + "outputMaxQueueLength": 87040, + "inputQueueLength": 0, + "inputMaxQueueLength": 32768, + "connectionOptions": { + "timestampsEnabled": true, + "selectiveAcknowledgementsEnabled": true, + "windowScaleEnabled": true, + "ecnEnabled": false + } + }, + "ifName": "Ethernet1", + "afiSafiInfo": { + "ipv6Unicast": { + "localNexthop": "2001:fb8:100::1" + } + } + }, + { + "peerAddress": "2001:fb8:200::2", + "asn": "65003", + "linkType": "external", + "routerId": "192.168.0.2", + "vrf": "default", + "version": 4, + "negotiatedVersion": 4, + "updateGroupIndex": -1, + "lastRcvd": 27, + "lastSent": 33, + "holdTime": 180, + "keepaliveTime": 60, + "configHoldTime": 180, + "configKeepaliveTime": 60, + "minHoldTime": 3, + "configMinHoldTime": 3, + "holdTimeLeft": 0, + "keepaliveTimeLeft": 0, + "state": "Established", + "establishedTime": 165, + "establishedTransitions": 1, + "lastState": "OpenConfirm", + "lastEvent": "Established", + "lastErrorCode": "Cease", + "lastErrorSubcode": "connection collision resolution", + "lastErrorTimeInfo": { + "time": 165 + }, + "lastSocketOutErrorMsg": "Bind (Cannot assign requested address)", + "lastSocketOutErrorTimeInfo": { + "time": 166 + }, + "enRRefreshstalePathRemoval": false, + "outboundEnRRefreshEnabled": true, + "neighborCapabilities": { + "negotiationDisabled": false, + "unsupportedCapReceived": false, + "multiprotocolCaps": { + "ipv6Unicast": { + "advertised": true, + "received": true, + "enabled": true + } + }, + "fourOctetAsnCap": { + "advertised": true, + "received": true, + "enabled": true + }, + "routeRefreshCap": { + "advertised": true, + "received": true, + "enabled": true + }, + "enhancedRouteRefreshCap": { + "advertised": true, + "received": true, + "enabled": true + }, + "sendEorMessages": { + "advertised": true, + "received": true, + "enabled": true + }, + "addPathsCaps": { + "ipv6Unicast": { + "receivingAddPaths": { + "receiveCapabilityAdvertised": true, + "sendCapabilityReceived": false, + "enabled": false + }, + "sendingAddPaths": { + "sendCapabilityAdvertised": false, + "receiveCapabilityReceived": true, + "enabled": false + } + } + } + }, + "endOfRibs": { + "incoming": { + "ipv6Unicast": { + "status": "received", + "eorReceivedTime": 1721080528.112453, + "stalePathsDeleted": 0 + } + } + }, + "nexthopLuOriginateIpv4Uni": false, + "thirdPartyNexthopLuOriginateIpv4Uni": false, + "nexthopLuOriginateLfibBackupIpForwardIpv4Uni": false, + "nexthopLuOriginateIpv6Uni": false, + "thirdPartyNexthopLuOriginateIpv6Uni": false, + "nexthopLuOriginateLfibBackupIpForwardIpv6Uni": false, + "aigpSessionIpv4Uni": false, + "aigpSessionIpv4LabeledUni": false, + "aigpSessionIpv6Uni": false, + "aigpSessionIpv6LabeledUni": false, + "fwdFailoverTriggerSessionIpv4Uni": false, + "fwdFailoverTriggerSessionIpv6Uni": false, + "outMessageStats": { + "opens": 2, + "notifications": 1, + "updates": 3, + "keepalives": 5, + "rtRefreshes": 0, + "beginOfRtRefreshes": 0, + "endOfRtRefreshes": 0 + }, + "inMessageStats": { + "opens": 1, + "notifications": 0, + "updates": 1, + "keepalives": 5, + "rtRefreshes": 0, + "beginOfRtRefreshes": 0, + "endOfRtRefreshes": 0 + }, + "sentMessages": 11, + "receivedMessages": 7, + "prefixesSent": 0, + "prefixesReceived": 0, + "v4BestPaths": 0, + "v4BestEcmpPaths": 0, + "v6PrefixesSent": 5, + "v6PrefixesReceived": 0, + "v6BestPaths": 0, + "v6BestEcmpPaths": 0, + "totalRoutesWarnLimit": 204800, + "maxTotalRoutes": 256000, + "dropStats": { + "inDropAsloop": 0, + "inDropClusterIdLoop": 0, + "inDropMalformedMpbgp": 0, + "inDropOrigId": 0, + "inDropNhLocal": 0, + "inDropNhAfV6": 0, + "prefixDroppedMartianV4": 0, + "prefixDroppedMartianV6": 0, + "prefixLuDroppedV4": 0, + "prefixLuDroppedMartianV4": 0, + "prefixLuDroppedV6": 0, + "prefixLuDroppedMartianV6": 0, + "prefixEvpnDroppedUnsupportedRouteType": 0, + "prefixBgpLsDroppedReceptionUnsupported": 0, + "outDropV4LocalAddr": 0, + "outDropV6LocalAddr": 0, + "prefixVpnIpv4DroppedImportMatchFailure": 0, + "prefixVpnIpv6DroppedImportMatchFailure": 0, + "prefixEvpnDroppedImportMatchFailure": 0, + "prefixRtMembershipDroppedLocalAsReject": 0 + }, + "peerInUpdateErrors": { + "inUpdErrWithdraw": 0, + "inUpdErrIgnore": 0, + "inUpdErrDisableAfiSafi": 0, + "disabledAfiSafi": "None", + "lastUpdErrTime": 0 + }, + "bgpSoftReconfigInbound": "Default", + "rpkiOriginValidationMethod": "disabled", + "rpkiOriginValidationSendExtComm": false, + "rpkiOriginValidationRouteMap": "", + "orrPosition": {}, + "localAsn": "65001", + "localRouterId": "192.168.0.0", + "ttl": 1, + "maxTtlHops": 255, + "updateSource": "2001:fb8:200::1", + "localPort": 179, + "remotePort": 33055, + "prependOwnDisabled": false, + "peerTcpInfo": { + "state": "ESTABLISHED", + "options": 7, + "sendWindowScale": 7, + "rcvWindowScale": 7, + "retransTimeout": 532000, + "delayedAckTimeout": 40000, + "maxSegmentSize": 1428, + "sndRtt": 71654, + "sndRttVariance": 104009, + "slowStartThreshold": 2147483647, + "congestionWindow": 10, + "rcvRtt": 0, + "rcvWindow": 14400, + "totalRetrans": 0, + "outputQueueLength": 0, + "outputMaxQueueLength": 87040, + "inputQueueLength": 0, + "inputMaxQueueLength": 32768, + "connectionOptions": { + "timestampsEnabled": true, + "selectiveAcknowledgementsEnabled": true, + "windowScaleEnabled": true, + "ecnEnabled": false + } + }, + "ifName": "Ethernet2", + "afiSafiInfo": { + "ipv6Unicast": { + "localNexthop": "2001:fb8:200::1" + } + } + } + ] + } + } +} diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ipv6_bgp_peers_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_rou.text b/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ipv6_bgp_peers_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_rou.text deleted file mode 100644 index 6643bdc03..000000000 --- a/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ipv6_bgp_peers_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_rou.text +++ /dev/null @@ -1,12 +0,0 @@ -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 diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ipv6_bgp_summary_vrf_all.json b/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ipv6_bgp_summary_vrf_all.json index a68112c2b..c86d7bcdb 100644 --- a/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ipv6_bgp_summary_vrf_all.json +++ b/test/eos/mocked_data/test_get_bgp_neighbors/normal/show_ipv6_bgp_summary_vrf_all.json @@ -1,37 +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 -} -} + "vrfs": { + "default": { + "vrf": "default", + "routerId": "192.168.0.0", + "asn": "65001", + "peers": { + "2001:fb8:100::2": { + "version": 4, + "msgReceived": 7, + "msgSent": 5, + "inMsgQueue": 0, + "outMsgQueue": 0, + "asn": "65002", + "prefixAccepted": 3, + "prefixReceived": 3, + "upDownTime": 1721080528.062069, + "underMaintenance": false, + "peerState": "Established" + }, + "2001:fb8:200::2": { + "version": 4, + "msgReceived": 5, + "msgSent": 8, + "inMsgQueue": 0, + "outMsgQueue": 0, + "asn": "65003", + "prefixAccepted": 0, + "prefixReceived": 0, + "upDownTime": 1721080528.069422, + "underMaintenance": false, + "peerState": "Established" + } + } + } + } } diff --git a/test/eos/mocked_data/test_get_ntp_servers/details/expected_result.json b/test/eos/mocked_data/test_get_ntp_servers/details/expected_result.json new file mode 100644 index 000000000..cbdf65d1b --- /dev/null +++ b/test/eos/mocked_data/test_get_ntp_servers/details/expected_result.json @@ -0,0 +1,24 @@ +{ + "1.2.3.4": { + "port": 123, + "version": 4, + "association_type": "SERVER", + "iburst": true, + "prefer": true, + "network_instance": "FOO", + "source_address": "", + "key_id": -1, + "address": "1.2.3.4" + }, + "4.3.2.1": { + "port": 123, + "version": 4, + "association_type": "SERVER", + "iburst": false, + "prefer": false, + "network_instance": "FOO", + "source_address": "172.20.20.2", + "key_id": -1, + "address": "4.3.2.1" + } +} diff --git a/test/eos/mocked_data/test_get_ntp_servers/details/show_ip_interface.json b/test/eos/mocked_data/test_get_ntp_servers/details/show_ip_interface.json new file mode 100644 index 000000000..955643613 --- /dev/null +++ b/test/eos/mocked_data/test_get_ntp_servers/details/show_ip_interface.json @@ -0,0 +1,48 @@ +{ + "interfaces": { + "Management0": { + "name": "Management0", + "lineProtocolStatus": "up", + "interfaceStatus": "connected", + "mtu": 1500, + "interfaceAddressBrief": { + "ipAddr": { + "address": "172.20.20.2", + "maskLen": 24 + } + }, + "ipv4Routable240": false, + "ipv4Routable0": false, + "enabled": true, + "description": "", + "interfaceAddress": { + "primaryIp": { + "address": "172.20.20.2", + "maskLen": 24 + }, + "secondaryIps": {}, + "secondaryIpsOrderedList": [], + "virtualIp": { + "address": "0.0.0.0", + "maskLen": 0 + }, + "virtualSecondaryIps": {}, + "virtualSecondaryIpsOrderedList": [], + "broadcastAddress": "255.255.255.255", + "dhcp": false + }, + "proxyArp": false, + "proxyArpAllowDefault": false, + "localProxyArp": false, + "gratuitousArp": false, + "routedAddr": "00:1c:73:7b:8c:1d", + "isVrrpBackup": false, + "vrf": "default", + "urpf": "disable", + "addresslessForwarding": "isInvalid", + "directedBroadcastEnabled": false, + "maxMssIngress": 0, + "maxMssEgress": 0 + } + } +} diff --git a/test/eos/mocked_data/test_get_ntp_servers/details/show_ipv6_interface.json b/test/eos/mocked_data/test_get_ntp_servers/details/show_ipv6_interface.json new file mode 100644 index 000000000..a4b8142b0 --- /dev/null +++ b/test/eos/mocked_data/test_get_ntp_servers/details/show_ipv6_interface.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "Management0": { + "name": "Management0", + "lineProtocolStatus": "up", + "interfaceStatus": "connected", + "mtu": 1500, + "linkLocal": { + "address": "fe80::21c:73ff:fe7b:8c1d", + "subnet": "fe80::/64", + "active": true, + "leastpref": false, + "dadfailed": false + }, + "state": "enabled", + "addresses": [ + { + "address": "2001:172:20:20::2", + "subnet": "2001:172:20:20::/64", + "active": true, + "leastpref": false, + "dadfailed": false + } + ], + "globalAddressesAreVirtual": false, + "multicastGroupAddresses": [ + "ff02::1", + "ff02::1:ff00:2", + "ff02::1:ff7b:8c1d" + ], + "dadStatus": "unavailable", + "dadAttempts": -1, + "ndReachableTime": 30000, + "ndRetransmitInterval": 1000, + "enhancedDad": false, + "autoConfigStatus": "stateless", + "urpf": "disable", + "urpfV4V6Mismatch": false, + "vrf": "default", + "addrSource": "manual", + "maxMssIngress": 0, + "maxMssEgress": 0, + "acceptUnsolicitedNa": false + } + } +} diff --git a/test/eos/mocked_data/test_get_ntp_servers/details/show_running_config___section_ntp.text b/test/eos/mocked_data/test_get_ntp_servers/details/show_running_config___section_ntp.text new file mode 100644 index 000000000..98a32b9ba --- /dev/null +++ b/test/eos/mocked_data/test_get_ntp_servers/details/show_running_config___section_ntp.text @@ -0,0 +1,2 @@ +ntp server vrf FOO 1.2.3.4 prefer iburst +ntp server vrf FOO 4.3.2.1 local-interface Management0 diff --git a/test/eos/mocked_data/test_get_ntp_servers/extra-output/expected_result.json b/test/eos/mocked_data/test_get_ntp_servers/extra-output/expected_result.json new file mode 100644 index 000000000..d59b3d99e --- /dev/null +++ b/test/eos/mocked_data/test_get_ntp_servers/extra-output/expected_result.json @@ -0,0 +1,35 @@ +{ + "1.2.3.4": { + "port": 123, + "version": 4, + "association_type": "SERVER", + "iburst": false, + "prefer": false, + "network_instance": "default", + "source_address": "", + "key_id": -1, + "address": "1.2.3.4" + }, + "5.6.7.8": { + "port": 123, + "version": 4, + "association_type": "SERVER", + "iburst": false, + "prefer": false, + "network_instance": "default", + "source_address": "", + "key_id": -1, + "address": "5.6.7.8" + }, + "2001:0db8:0a0b:12f0:0000:0000:0000:0001": { + "port": 123, + "version": 4, + "association_type": "SERVER", + "iburst": false, + "prefer": false, + "network_instance": "default", + "source_address": "", + "key_id": -1, + "address": "2001:0db8:0a0b:12f0:0000:0000:0000:0001" + } +} diff --git a/test/eos/mocked_data/test_get_ntp_servers/extra-output/show_running_config___section_ntp.text b/test/eos/mocked_data/test_get_ntp_servers/extra-output/show_running_config___section_ntp.text new file mode 100644 index 000000000..ce7b0cbce --- /dev/null +++ b/test/eos/mocked_data/test_get_ntp_servers/extra-output/show_running_config___section_ntp.text @@ -0,0 +1,7 @@ +ip access-list test-acl + 10 remark ntp + 20 permit udp any eq ntp any + 30 permit udp any any eq ntp +ntp server 1.2.3.4 +ntp server 5.6.7.8 +ntp server 2001:0db8:0a0b:12f0:0000:0000:0000:0001 diff --git a/test/eos/mocked_data/test_get_ntp_servers/normal/expected_result.json b/test/eos/mocked_data/test_get_ntp_servers/normal/expected_result.json index b3a9d7d23..d59b3d99e 100644 --- a/test/eos/mocked_data/test_get_ntp_servers/normal/expected_result.json +++ b/test/eos/mocked_data/test_get_ntp_servers/normal/expected_result.json @@ -1 +1,35 @@ -{"1.2.3.4": {}, "2001:0db8:0a0b:12f0:0000:0000:0000:0001": {}, "5.6.7.8": {}} +{ + "1.2.3.4": { + "port": 123, + "version": 4, + "association_type": "SERVER", + "iburst": false, + "prefer": false, + "network_instance": "default", + "source_address": "", + "key_id": -1, + "address": "1.2.3.4" + }, + "5.6.7.8": { + "port": 123, + "version": 4, + "association_type": "SERVER", + "iburst": false, + "prefer": false, + "network_instance": "default", + "source_address": "", + "key_id": -1, + "address": "5.6.7.8" + }, + "2001:0db8:0a0b:12f0:0000:0000:0000:0001": { + "port": 123, + "version": 4, + "association_type": "SERVER", + "iburst": false, + "prefer": false, + "network_instance": "default", + "source_address": "", + "key_id": -1, + "address": "2001:0db8:0a0b:12f0:0000:0000:0000:0001" + } +} diff --git a/test/eos/test_heredoc.py b/test/eos/test_heredoc.py index cf5d891fa..9a1411762 100644 --- a/test/eos/test_heredoc.py +++ b/test/eos/test_heredoc.py @@ -1,4 +1,4 @@ -import mock +from unittest import mock import pytest from textwrap import dedent @@ -147,3 +147,59 @@ def test_heredoc_with_bangs(self): ] self.device.device.run_commands.assert_called_with(expected_result) + + def test_heredoc_with_blank_lines(self): + raw_config = dedent( + """\ + hostname vEOS + ip name-server 192.0.2.1 + ! + banner login + + This is a banner that spans + multiple lines in order to test + HEREDOC conversion + + EOF + ! + management api http-commands + protocol https certificate + ---BEGIN CERTIFICATE--- + FAKE-CERTIFICATE-DATA + ---END CERTIFICATE--- + EOF + ---BEGIN PRIVATE KEY--- + FAKE-KEY-DATA + ---END PRIVATE KEY--- + EOF + ! + management ssh + idle-timeout 15 + ! + """ + ) + + self.device.device.run_commands = mock.MagicMock() + + self.device._load_config(config=raw_config) + + expected_result = [ + "configure session {}".format(self.device.config_session), + "rollback clean-config", + "hostname vEOS", + "ip name-server 192.0.2.1", + { + "cmd": "banner login", + "input": "\nThis is a banner that spans\nmultiple lines in order to test\nHEREDOC conversion\n", # noqa + }, + "management api http-commands", + { + "cmd": "protocol https certificate", + "input": "---BEGIN CERTIFICATE---\nFAKE-CERTIFICATE-DATA\n---END CERTIFICATE---\nEOF\n---BEGIN PRIVATE KEY---\nFAKE-KEY-DATA\n---END PRIVATE KEY---", # noqa + }, + "management ssh", + "idle-timeout 15", + "end", + ] + + self.device.device.run_commands.assert_called_with(expected_result) diff --git a/test/eos/mocked_data/test_get_bgp_neighbors/issue1356/show_ipv6_bgp_peers_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_rou.text b/test/eos_ssh/__init__.py similarity index 100% rename from test/eos/mocked_data/test_get_bgp_neighbors/issue1356/show_ipv6_bgp_peers_vrf_all___include_IPv_46___Unicast_6PE_____0_9_____grep__v___IPv_46__Unicast_______remote_AS___Local_AS_Desc_BGP_state__remote_rou.text rename to test/eos_ssh/__init__.py diff --git a/test/eos_ssh/conftest.py b/test/eos_ssh/conftest.py new file mode 100644 index 000000000..774d1bf3d --- /dev/null +++ b/test/eos_ssh/conftest.py @@ -0,0 +1,69 @@ +"""Test fixtures.""" + +from builtins import super + +import pytest + +from napalm.base.test import conftest as parent_conftest + +from napalm.base.test.double import BaseTestDouble + +from napalm.eos import eos + + +@pytest.fixture(scope="class") +def set_device_parameters(request): + """Set up the class.""" + + def fin(): + request.cls.device.close() + + request.addfinalizer(fin) + + request.cls.driver = eos.EOSDriver + request.cls.patched_driver = PatchedEOSDriver + request.cls.vendor = "eos" + parent_conftest.set_device_parameters(request) + + +def pytest_generate_tests(metafunc): + """Generate test cases dynamically.""" + parent_conftest.pytest_generate_tests(metafunc, __file__) + + +class PatchedEOSDriver(eos.EOSDriver): + """Patched EOS Driver.""" + + def __init__(self, hostname, username, password, timeout=60, optional_args=None): + + optional_args = {"transport": "ssh"} + + super().__init__( + hostname, username, password, timeout, optional_args=optional_args + ) + + self.patched_attrs = ["device"] + self.device = FakeEOSDevice() + + def _obtain_lock(self, wait_time=None): + pass + + def close(self): + pass + + def open(self): + pass + + +class FakeEOSDevice(BaseTestDouble): + """EOS device test double.""" + + def __init__(self): + super(FakeEOSDevice, self).__init__() + self.connection = object() + + def send_command_expect(self, command, **kwargs): + return self.send_config_set([command]) + + def send_config_set(self, commands, **kwargs): + return self.run_commands(commands) diff --git a/test/eos_ssh/test_heredoc.py b/test/eos_ssh/test_heredoc.py new file mode 100644 index 000000000..c148ffd9c --- /dev/null +++ b/test/eos_ssh/test_heredoc.py @@ -0,0 +1,190 @@ +from unittest import mock +import pytest +from textwrap import dedent + + +@pytest.mark.usefixtures("set_device_parameters") +class TestConfigMangling(object): + def test_heredoc(self): + raw_config = dedent( + """\ + hostname vEOS + ip name-server 192.0.2.1 + ! + banner login + This is a banner that spans + multiple lines in order to test + HEREDOC conversion + EOF + ! + management ssh + idle-timeout 15 + ! + """ + ) + + self.device.device.run_commands = mock.MagicMock() + + self.device._load_config(config=raw_config) + + expected_result = [ + "configure session {}".format(self.device.config_session), + "rollback clean-config", + "hostname vEOS", + "ip name-server 192.0.2.1", + "banner login", + "This is a banner that spans", + "multiple lines in order to test", + "HEREDOC conversion", + "EOF", + "management ssh", + "idle-timeout 15", + ] + + self.device.device.run_commands.assert_called_with(expected_result) + + def test_mode_comment(self): + raw_config = dedent( + """\ + ip access-list standard test1 + !! This is a + !! multiline mode comment + !! for standard ACL test1 + permit host 192.0.2.1 + ! + ip access-list standard test2 + !! This is a single-line mode comment for standard ACL test2 + permit host 192.0.2.2 + ! + ip access-list standard test3 + comment + This is a multi-line HEREDOC + comment for standard ACL test3 + EOF + permit host 192.0.2.3 + ! + """ + ) + + self.device.device.run_commands = mock.MagicMock() + + self.device._load_config(config=raw_config, replace=False) + + expected_result = [ + "configure session {}".format(self.device.config_session), + "ip access-list standard test1", + "!! This is a", + "!! multiline mode comment", + "!! for standard ACL test1", + "permit host 192.0.2.1", + "ip access-list standard test2", + "!! This is a single-line mode comment for standard ACL test2", + "permit host 192.0.2.2", + "ip access-list standard test3", + "comment", + "This is a multi-line HEREDOC", + "comment for standard ACL test3", + "EOF", + "permit host 192.0.2.3", + ] + + self.device.device.run_commands.assert_called_with(expected_result) + + def test_heredoc_with_bangs(self): + raw_config = dedent( + """\ + hostname vEOS + ip name-server 192.0.2.1 + ! + banner login + !! This is a banner that contains + !!!bangs! + EOF + ! + management ssh + idle-timeout 15 + ! + """ + ) + + self.device.device.run_commands = mock.MagicMock() + + self.device._load_config(config=raw_config) + + expected_result = [ + "configure session {}".format(self.device.config_session), + "rollback clean-config", + "hostname vEOS", + "ip name-server 192.0.2.1", + "banner login", + "!! This is a banner that contains", + "!!!bangs!", + "EOF", + "management ssh", + "idle-timeout 15", + ] + + self.device.device.run_commands.assert_called_with(expected_result) + + def test_heredoc_with_blank_lines(self): + raw_config = dedent( + """\ + hostname vEOS + ip name-server 192.0.2.1 + ! + banner login + + This is a banner that spans + multiple lines in order to test + HEREDOC conversion + + EOF + ! + management api http-commands + protocol https certificate + ---BEGIN CERTIFICATE--- + FAKE-CERTIFICATE-DATA + ---END CERTIFICATE--- + EOF + ---BEGIN PRIVATE KEY--- + FAKE-KEY-DATA + ---END PRIVATE KEY--- + EOF + ! + management ssh + idle-timeout 15 + ! + """ + ) + + self.device.device.run_commands = mock.MagicMock() + + self.device._load_config(config=raw_config) + + expected_result = [ + "configure session {}".format(self.device.config_session), + "rollback clean-config", + "hostname vEOS", + "ip name-server 192.0.2.1", + "banner login", + "", + "This is a banner that spans", + "multiple lines in order to test", + "HEREDOC conversion", + "", + "EOF", + "management api http-commands", + "protocol https certificate", + "---BEGIN CERTIFICATE---", + "FAKE-CERTIFICATE-DATA", + "---END CERTIFICATE---", + "EOF", + "---BEGIN PRIVATE KEY---", + "FAKE-KEY-DATA", + "---END PRIVATE KEY---", + "EOF", + "management ssh", + "idle-timeout 15", + ] + + self.device.device.run_commands.assert_called_with(expected_result) diff --git a/test/nxos/test_getters.py b/test/nxos/test_getters.py index 3baa5c4b2..3436051f9 100644 --- a/test/nxos/test_getters.py +++ b/test/nxos/test_getters.py @@ -1,11 +1,12 @@ """Tests for getters.""" +from unittest.mock import patch + from napalm.base.test.getters import BaseTestGetters, wrap_test_cases from napalm.base.test import helpers from napalm.base import models import pytest -from mock import patch def mock_time(): diff --git a/test/nxos_ssh/mocked_data/test_get_facts/issue2151/expected_result.json b/test/nxos_ssh/mocked_data/test_get_facts/issue2151/expected_result.json new file mode 100644 index 000000000..4f2b4860e --- /dev/null +++ b/test/nxos_ssh/mocked_data/test_get_facts/issue2151/expected_result.json @@ -0,0 +1,76 @@ +{ + "os_version": "10.3(5)", + "uptime": 4338547, + "interface_list": [ + "Management0", + "Ethernet1/1", + "Ethernet1/2", + "Ethernet1/3", + "Ethernet1/4", + "Ethernet1/5", + "Ethernet1/6", + "Ethernet1/7", + "Ethernet1/8", + "Ethernet1/9", + "Ethernet1/10", + "Ethernet1/11", + "Ethernet1/12", + "Ethernet1/13", + "Ethernet1/14", + "Ethernet1/15", + "Ethernet1/16", + "Ethernet1/17", + "Ethernet1/18", + "Ethernet1/19", + "Ethernet1/20", + "Ethernet1/21", + "Ethernet1/22", + "Ethernet1/23", + "Ethernet1/24", + "Ethernet1/25", + "Ethernet1/26", + "Ethernet1/27", + "Ethernet1/28", + "Ethernet1/29", + "Ethernet1/30", + "Ethernet1/31", + "Ethernet1/32", + "Ethernet1/33", + "Ethernet1/34", + "Ethernet1/35", + "Ethernet1/36", + "Ethernet1/37", + "Ethernet1/38", + "Ethernet1/39", + "Ethernet1/40", + "Ethernet1/41", + "Ethernet1/42", + "Ethernet1/43", + "Ethernet1/44", + "Ethernet1/45", + "Ethernet1/46", + "Ethernet1/47", + "Ethernet1/48", + "Ethernet1/49", + "Ethernet1/50", + "Ethernet1/51", + "Ethernet1/52", + "Port-channel1", + "Port-channel16", + "Port-channel17", + "Port-channel32", + "Port-channel33", + "Port-channel34", + "Port-channel35", + "Port-channel50", + "Port-channel51", + "Port-channel360", + "Vlan1", + "Vlan351" + ], + "vendor": "Cisco", + "serial_number": "TM6012EC74B", + "model": "Nexus 3048 Chassis", + "hostname": "SWITCH_NXOSv", + "fqdn": "SWITCH_NXOSv.y.z.a.com" +} diff --git a/test/nxos_ssh/mocked_data/test_get_facts/issue2151/show_hostname.txt b/test/nxos_ssh/mocked_data/test_get_facts/issue2151/show_hostname.txt new file mode 100644 index 000000000..c82c8bda3 --- /dev/null +++ b/test/nxos_ssh/mocked_data/test_get_facts/issue2151/show_hostname.txt @@ -0,0 +1 @@ +SWITCH_NXOSv.y.z.a.com \ No newline at end of file diff --git a/test/nxos_ssh/mocked_data/test_get_facts/issue2151/show_hosts.txt b/test/nxos_ssh/mocked_data/test_get_facts/issue2151/show_hosts.txt new file mode 100644 index 000000000..303a24bf1 --- /dev/null +++ b/test/nxos_ssh/mocked_data/test_get_facts/issue2151/show_hosts.txt @@ -0,0 +1,7 @@ +DNS lookup enabled +Vrf Name: default Default domain is y.z.a.com +Name servers are 8.8.8.4 8.8.8.8 + + + +Host Address diff --git a/test/nxos_ssh/mocked_data/test_get_facts/issue2151/show_interface_status.txt b/test/nxos_ssh/mocked_data/test_get_facts/issue2151/show_interface_status.txt new file mode 100644 index 000000000..105efd980 --- /dev/null +++ b/test/nxos_ssh/mocked_data/test_get_facts/issue2151/show_interface_status.txt @@ -0,0 +1,69 @@ + +-------------------------------------------------------------------------------- +Port Name Status Vlan Duplex Speed Type +-------------------------------------------------------------------------------- +mgmt0 -- connected routed full 1000 -- +Eth1/1 -- connected 353 full 100 10/100/1g +Eth1/2 -- notconnec 353 auto auto 10/100/1g +Eth1/3 -- disabled 366 auto auto 10/100/1g +Eth1/4 -- connected 351 full 1000 10/100/1g +Eth1/5 -- connected 351 full 1000 10/100/1g +Eth1/6 -- connected 351 full 1000 10/100/1g +Eth1/7 -- connected 351 full 1000 10/100/1g +Eth1/8 -- connected 351 full 1000 10/100/1g +Eth1/9 -- connected 351 full 1000 10/100/1g +Eth1/10 -- connected 351 full 1000 10/100/1g +Eth1/11 -- connected 351 full 1000 10/100/1g +Eth1/12 -- connected 351 full 1000 10/100/1g +Eth1/13 -- connected 351 full 1000 10/100/1g +Eth1/14 -- connected 351 full 1000 10/100/1g +Eth1/15 -- connected 351 full 1000 10/100/1g +Eth1/16 -- connected trunk full 1000 10/100/1g +Eth1/17 -- connected trunk full 1000 10/100/1g +Eth1/18 -- connected 369 full 1000 10/100/1g +Eth1/19 -- notconnec 351 auto auto 10/100/1g +Eth1/20 -- connected 351 full 100 10/100/1g +Eth1/21 -- connected 351 half 100 10/100/1g +Eth1/22 -- connected 351 half 100 10/100/1g +Eth1/23 -- disabled 366 auto auto 10/100/1g +Eth1/24 -- connected 352 full 1000 10/100/1g +Eth1/25 -- connected 352 half 100 10/100/1g +Eth1/26 -- connected 352 full 1000 10/100/1g +Eth1/27 -- connected 352 half 100 10/100/1g +Eth1/28 -- connected 352 full 100 10/100/1g +Eth1/29 -- connected 352 full 100 10/100/1g +Eth1/30 -- connected 352 full 100 10/100/1g +Eth1/31 -- disabled 366 auto auto 10/100/1g +Eth1/32 -- connected trunk full 1000 10/100/1g +Eth1/33 -- connected trunk full 1000 10/100/1g +Eth1/34 -- connected trunk full 1000 10/100/1g +Eth1/35 -- connected trunk full 1000 10/100/1g +Eth1/36 -- connected 351 full 1000 10/100/1g +Eth1/37 -- connected 351 full 1000 10/100/1g +Eth1/38 -- connected 351 full 1000 10/100/1g +Eth1/39 -- connected 351 full 1000 10/100/1g +Eth1/40 -- connected 351 full 1000 10/100/1g +Eth1/41 -- disabled 350 auto auto 10/100/1g +Eth1/42 -- connected 351 full 1000 10/100/1g +Eth1/43 -- connected 351 full 1000 10/100/1g +Eth1/44 -- connected 351 full 1000 10/100/1g +Eth1/45 -- connected 351 full 1000 10/100/1g +Eth1/46 -- disabled 366 auto auto 10/100/1g +Eth1/47 -- connected trunk full 1000 10/100/1g +Eth1/48 -- connected trunk full 1000 10/100/1g +Eth1/49 -- xcvrAbsen 366 full 10G -- +Eth1/50 -- connected trunk full 1000 1000base-SX +Eth1/51 -- connected trunk full 1000 1000base-SX +Eth1/52 -- connected trunk full 1000 1000base-SX +Po1 -- connected trunk full 1000 -- +Po16 -- connected trunk full 1000 -- +Po17 -- connected trunk full 1000 -- +Po32 -- connected trunk full 1000 -- +Po33 -- connected trunk full 1000 -- +Po34 -- connected trunk full 1000 -- +Po35 -- connected trunk full 1000 -- +Po50 -- connected trunk full 1000 -- +Po51 -- connected trunk full 1000 -- +Po360 -- connected trunk full 1000 -- +Vlan1 -- down routed auto auto -- +Vlan351 -- connected routed auto auto -- \ No newline at end of file diff --git a/test/nxos_ssh/mocked_data/test_get_facts/issue2151/show_inventory___json.txt b/test/nxos_ssh/mocked_data/test_get_facts/issue2151/show_inventory___json.txt new file mode 100644 index 000000000..15cbe724c --- /dev/null +++ b/test/nxos_ssh/mocked_data/test_get_facts/issue2151/show_inventory___json.txt @@ -0,0 +1,34 @@ +{ + "TABLE_inv": { + "ROW_inv": [ + { + "name": "Chassis", + "desc": "Nexus 6001 Chassis", + "productid": "N6K-C6001-64P", + "vendorid": "V01", + "serialnum": "TM6012EC74B" + }, + { + "name": "Module 1", + "desc": "Nexus 64 Supervisor", + "productid": "N6K-C6001-64P", + "vendorid": "V01", + "serialnum": "FOC11111111" + }, + { + "name": "Module 2", + "desc": "Nexus 4xQSFP Ethernet Module", + "productid": "N6K-C6001-M4Q", + "vendorid": "V01", + "serialnum": "FOC11111111" + }, + { + "name": "Fan 1", + "desc": "Chassis fan module", + "productid": "N6K-C6001-FAN-B", + "vendorid": "N/A", + "serialnum": "N/A" + } + ] + } +} diff --git a/test/nxos_ssh/mocked_data/test_get_facts/issue2151/show_version.txt b/test/nxos_ssh/mocked_data/test_get_facts/issue2151/show_version.txt new file mode 100644 index 000000000..cafe1098d --- /dev/null +++ b/test/nxos_ssh/mocked_data/test_get_facts/issue2151/show_version.txt @@ -0,0 +1,50 @@ +Cisco Nexus Operating System (NX-OS) Software +TAC support: http://www.cisco.com/tac +Copyright (C) 2002-2017, Cisco and/or its affiliates. +All rights reserved. +The copyrights to certain works contained in this software are +owned by other third parties and used and distributed under their own +licenses, such as open source. This software is provided "as is," and unless +otherwise stated, there is no warranty, express or implied, including but not +limited to warranties of merchantability and fitness for a particular purpose. +Certain components of this software are licensed under +the GNU General Public License (GPL) version 2.0 or +GNU General Public License (GPL) version 3.0 or the GNU +Lesser General Public License (LGPL) Version 2.1 or +Lesser General Public License (LGPL) Version 2.0. +A copy of each such license is available at +http://www.opensource.org/licenses/gpl-2.0.php and +http://opensource.org/licenses/gpl-3.0.html and +http://www.opensource.org/licenses/lgpl-2.1.php and +http://www.gnu.org/licenses/old-licenses/library.txt. + +Software + BIOS: version 01.09 + NXOS: version 10.3(5) [Maintenance Release] + Host NXOS: version 10.3(5) + BIOS compile time: 10/08/2023 + NXOS image file is: bootflash:///nxos64-cs.10.3.5.M.bin + NXOS compile time: 4/30/2024 12:00:00 [05/08/2024 05:39:13] + NXOS boot mode: LXC + +Hardware + cisco Nexus 3048 Chassis + Intel(R) Celeron(R) CPU P4505 @ 1.87GHz with 3903332 kB of memory. + Processor Board ID TM6012EC74B + + Device name: SWITCH_NXOSv + bootflash: 1848240 kB + usb1: 0 kB (expansion flash) + +Kernel uptime is 50 day(s), 5 hour(s), 9 minute(s), 7 second(s) + +Last reset at 829281 usecs after Thu Oct 26 20:25:34 2017 + + Reason: Reset Requested by CLI command reload + System version: 7.0(3)I4(7) + Service: + +plugin + Core Plugin, Ethernet Plugin + +Active Package(s): diff --git a/test/nxos_ssh/test_getters.py b/test/nxos_ssh/test_getters.py index 3baa5c4b2..3436051f9 100644 --- a/test/nxos_ssh/test_getters.py +++ b/test/nxos_ssh/test_getters.py @@ -1,11 +1,12 @@ """Tests for getters.""" +from unittest.mock import patch + from napalm.base.test.getters import BaseTestGetters, wrap_test_cases from napalm.base.test import helpers from napalm.base import models import pytest -from mock import patch def mock_time(): diff --git a/test/nxos_ssh/test_static_methods.py b/test/nxos_ssh/test_static_methods.py new file mode 100644 index 000000000..9dd066a8f --- /dev/null +++ b/test/nxos_ssh/test_static_methods.py @@ -0,0 +1,20 @@ +"""Tests for uptime utils""" + +from napalm.nxos_ssh import NXOSSSHDriver + + +def test_parse_uptime(): + """ + Test uptime parsing + """ + assert ( + NXOSSSHDriver.parse_uptime("0 day(s), 0 hour(s), 0 minute(s), 1 second(s)") == 1 + ) + assert ( + NXOSSSHDriver.parse_uptime("1 day(s), 0 hour(s), 0 minute(s), 0 second(s)") + == 86400 + ) + assert ( + NXOSSSHDriver.parse_uptime("4 day(s), 15 hour(s), 48 minute(s), 52 second(s)") + == 402532 + ) diff --git a/test/pyiosxr/test_iosxr.py b/test/pyiosxr/test_iosxr.py index bc97b1ca7..9e4ee37e3 100755 --- a/test/pyiosxr/test_iosxr.py +++ b/test/pyiosxr/test_iosxr.py @@ -35,6 +35,9 @@ def close(self): self.remote_conn = _MockedParamikoTransport() + def disconnect(self): + self.remote_conn.close() + @staticmethod def get_mock_file(command, format="xml"): filename = (