diff --git a/napalm/base/base.py b/napalm/base/base.py
index 7410bf6a8..b1b56040d 100644
--- a/napalm/base/base.py
+++ b/napalm/base/base.py
@@ -742,7 +742,6 @@ def get_bgp_config(
def cli(
self, commands: List[str], encoding: str = "text"
) -> Dict[str, Union[str, Dict[str, Any]]]:
-
"""
Will execute a list of commands and return the output in a dictionary format.
@@ -772,7 +771,6 @@ def cli(
def get_bgp_neighbors_detail(
self, neighbor_address: str = ""
) -> Dict[str, models.PeerDetailsDict]:
-
"""
Returns a detailed view of the BGP neighbors as a dictionary of lists.
@@ -867,7 +865,6 @@ def get_bgp_neighbors_detail(
raise NotImplementedError
def get_arp_table(self, vrf: str = "") -> List[models.ARPTableDict]:
-
"""
Returns a list of dictionaries having the following set of keys:
* interface (string)
@@ -902,7 +899,6 @@ def get_arp_table(self, vrf: str = "") -> List[models.ARPTableDict]:
raise NotImplementedError
def get_ntp_peers(self) -> Dict[str, models.NTPPeerDict]:
-
"""
Returns the NTP peers configuration as dictionary.
The keys of the dictionary represent the IP Addresses of the peers.
@@ -922,7 +918,6 @@ def get_ntp_peers(self) -> Dict[str, models.NTPPeerDict]:
raise NotImplementedError
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.
@@ -942,7 +937,6 @@ def get_ntp_servers(self) -> Dict[str, models.NTPServerDict]:
raise NotImplementedError
def get_ntp_stats(self) -> List[models.NTPStats]:
-
"""
Returns a list of NTP synchronization statistics.
@@ -979,7 +973,6 @@ def get_ntp_stats(self) -> List[models.NTPStats]:
raise NotImplementedError
def get_interfaces_ip(self) -> Dict[str, models.InterfacesIPDict]:
-
"""
Returns all configured IP addresses on all interfaces as a dictionary of dictionaries.
Keys of the main dictionary represent the name of the interface.
@@ -1033,7 +1026,6 @@ def get_interfaces_ip(self) -> Dict[str, models.InterfacesIPDict]:
raise NotImplementedError
def get_mac_address_table(self) -> List[models.MACAdressTable]:
-
"""
Returns a lists of dictionaries. Each dictionary represents an entry in the MAC Address
Table, having the following keys:
@@ -1086,7 +1078,6 @@ def get_mac_address_table(self) -> List[models.MACAdressTable]:
def get_route_to(
self, destination: str = "", protocol: str = "", longer: bool = False
) -> Dict[str, models.RouteDict]:
-
"""
Returns a dictionary of dictionaries containing details of all available routes to a
destination.
@@ -1161,7 +1152,6 @@ def get_route_to(
raise NotImplementedError
def get_snmp_information(self) -> models.SNMPDict:
-
"""
Returns a dict of dicts containing SNMP configuration.
Each inner dictionary contains these fields
diff --git a/napalm/base/clitools/cl_napalm_configure.py b/napalm/base/clitools/cl_napalm_configure.py
index 85752359e..f259209c7 100644
--- a/napalm/base/clitools/cl_napalm_configure.py
+++ b/napalm/base/clitools/cl_napalm_configure.py
@@ -22,7 +22,6 @@
def run(
vendor, hostname, user, password, strategy, optional_args, config_file, dry_run
):
-
logger.debug('Getting driver for OS "{driver}"'.format(driver=vendor))
driver = get_network_driver(vendor)
diff --git a/napalm/base/test/base.py b/napalm/base/test/base.py
index 4d59ec0db..d46f7ff47 100644
--- a/napalm/base/test/base.py
+++ b/napalm/base/test/base.py
@@ -529,7 +529,6 @@ def test_ping(self):
self.assertTrue(result)
def test_traceroute(self):
-
destination = "8.8.8.8"
try:
get_traceroute = self.device.traceroute(destination)
@@ -547,7 +546,6 @@ def test_traceroute(self):
self.assertTrue(result)
def test_get_users(self):
-
try:
get_users = self.device.get_users()
except NotImplementedError:
@@ -561,7 +559,6 @@ def test_get_users(self):
self.assertTrue(result)
def test_get_optics(self):
-
try:
get_optics = self.device.get_optics()
except NotImplementedError:
@@ -575,7 +572,6 @@ def test_get_optics(self):
assert len(channel) == 2
assert isinstance(channel["index"], int)
for field in ["input_power", "output_power", "laser_bias_current"]:
-
assert len(channel["state"][field]) == 4
assert isinstance(channel["state"][field]["instant"], float)
assert isinstance(channel["state"][field]["avg"], float)
diff --git a/napalm/base/test/getters.py b/napalm/base/test/getters.py
index 0a2e47a66..5c660ab21 100644
--- a/napalm/base/test/getters.py
+++ b/napalm/base/test/getters.py
@@ -112,7 +112,8 @@ def test_method_signatures(self):
"""
Test that all methods have the same signature.
- The type hint annotations are ignored here because the import paths might differ."""
+ The type hint annotations are ignored here because the import paths might differ.
+ """
errors = {}
cls = self.driver
# Create fictional driver instance (py3 needs bound methods)
@@ -493,7 +494,6 @@ def test_get_optics(self, test_case):
assert len(channel) == 2
assert isinstance(channel["index"], int)
for field in ["input_power", "output_power", "laser_bias_current"]:
-
assert len(channel["state"][field]) == 4
assert isinstance(channel["state"][field]["instant"], float)
assert isinstance(channel["state"][field]["avg"], float)
diff --git a/napalm/eos/eos.py b/napalm/eos/eos.py
index d5554f434..52db5463b 100644
--- a/napalm/eos/eos.py
+++ b/napalm/eos/eos.py
@@ -907,7 +907,6 @@ def _transform_lldp_capab(self, capabilities):
return sorted([LLDP_CAPAB_TRANFORM_TABLE[c.lower()] for c in capabilities])
def get_lldp_neighbors_detail(self, interface=""):
-
lldp_neighbors_out = {}
filters = []
@@ -1085,7 +1084,6 @@ def default_neighbor_dict(local_as, group_dict):
return neighbor_dict
def parse_options(options, default_value=False):
-
if not options:
return {}
@@ -1330,7 +1328,6 @@ def get_ntp_stats(self):
return ntp_stats
def get_interfaces_ip(self):
-
interfaces_ip = {}
interfaces_ipv4_out = self._run_commands(["show ip interface"])[0]["interfaces"]
@@ -1427,7 +1424,6 @@ def get_interfaces_ip(self):
return interfaces_ip
def get_mac_address_table(self):
-
mac_table = []
commands = ["show mac address-table"]
@@ -1725,7 +1721,6 @@ def traceroute(
timeout=c.TRACEROUTE_TIMEOUT,
vrf=c.TRACEROUTE_VRF,
):
-
_HOP_ENTRY_PROBE = [
r"\s+",
r"(", # beginning of host_name (ip_address) RTT group
@@ -1882,7 +1877,6 @@ def _parse_per_peer_bgp_detail(peer_output):
)
for item in peer_info:
-
# Determining a few other fields in the final peer_info
item["up"] = True if item["up"] == "up" else False
item["local_address_configured"] = (
@@ -1942,7 +1936,6 @@ def _parse_per_peer_bgp_detail(peer_output):
return peer_details
def _append(bgp_dict, peer_info):
-
remote_as = peer_info["remote_as"]
vrf_name = peer_info["routing_table"]
@@ -1995,7 +1988,6 @@ def _append(bgp_dict, peer_info):
v6_peer_info = _parse_per_peer_bgp_detail(raw_output[1]["output"])
for peer_info in v4_peer_info:
-
vrf_name = peer_info["routing_table"]
peer_remote_addr = peer_info["remote_address"]
peer_info["accepted_prefix_count"] = (
@@ -2009,7 +2001,6 @@ def _append(bgp_dict, peer_info):
_append(bgp_detail_info, peer_info)
for peer_info in v6_peer_info:
-
vrf_name = peer_info["routing_table"]
peer_remote_addr = peer_info["remote_address"]
peer_info["accepted_prefix_count"] = (
@@ -2025,7 +2016,6 @@ def _append(bgp_dict, peer_info):
return bgp_detail_info
def get_optics(self):
-
command = ["show interfaces transceiver"]
output = self._run_commands(command, encoding="json")[0]["interfaces"]
diff --git a/napalm/ios/ios.py b/napalm/ios/ios.py
index 5e31c49f8..df7a78400 100644
--- a/napalm/ios/ios.py
+++ b/napalm/ios/ios.py
@@ -783,7 +783,6 @@ def _xfer_file(
use_scp = False
with TransferClass(**kwargs) as transfer:
-
# Check if file already exists and has correct MD5
if transfer.check_file_exists() and transfer.compare_md5():
msg = "File already exists and has correct MD5: no SCP needed"
@@ -1220,7 +1219,6 @@ def get_interfaces(self):
interface_dict = {}
for line in output.splitlines():
-
interface_regex_1 = r"^(\S+?)\s+is\s+(.+?),\s+line\s+protocol\s+is\s+(\S+)"
interface_regex_2 = r"^(\S+)\s+is\s+(up|down)"
interface_regex_3 = (
@@ -3135,7 +3133,7 @@ def get_route_to(self, destination="", protocol="", longer=False):
for cmditem in commands:
outvrf = self._send_command(cmditem)
output.append(outvrf)
- for (outitem, _vrf) in zip(output, vrfs): # for all VRFs
+ for outitem, _vrf in zip(output, vrfs): # for all VRFs
route_proto_regex = RE_RP_FROM.search(outitem)
if route_proto_regex:
route_match = destination
@@ -3550,7 +3548,6 @@ def traceroute(
return traceroute_dict
def get_network_instances(self, name=""):
-
instances = {}
sh_vrf_detail = self._send_command("show vrf detail")
show_ip_int_br = self._send_command("show ip interface brief")
@@ -3583,7 +3580,6 @@ def get_network_instances(self, name=""):
return instances
for vrf in sh_vrf_detail.split("\n\n"):
-
first_part = vrf.split("Address family")[0]
# retrieve the name of the VRF and the Route Distinguisher
diff --git a/napalm/iosxr/iosxr.py b/napalm/iosxr/iosxr.py
index 383e8ae00..475ad3484 100644
--- a/napalm/iosxr/iosxr.py
+++ b/napalm/iosxr/iosxr.py
@@ -152,7 +152,6 @@ def rollback(self):
self.device.rollback()
def get_facts(self):
-
facts = {
"vendor": "Cisco",
"os_version": "",
@@ -256,7 +255,6 @@ def get_facts(self):
return facts
def get_interfaces(self):
-
interfaces = {}
INTERFACE_DEFAULTS = {
@@ -844,7 +842,6 @@ def get_module_xml_query(module, selection):
return environment_status
def get_lldp_neighbors(self):
-
# init result dict
lldp = {}
sh_lldp = self.device.show_lldp_neighbors().splitlines()[5:-3]
@@ -864,7 +861,6 @@ def get_lldp_neighbors(self):
return lldp
def get_lldp_neighbors_detail(self, interface=""):
-
lldp_neighbors = {}
rpc_command = (
@@ -953,7 +949,6 @@ def cli(self, commands, encoding="text"):
return cli_output
def get_bgp_config(self, group="", neighbor=""):
-
bgp_config = {}
# a helper
@@ -1202,7 +1197,6 @@ def build_prefix_limit(af_table, limit, prefix_percent, prefix_timeout):
return bgp_config
def get_bgp_neighbors_detail(self, neighbor_address=""):
-
bgp_neighbors_detail = {}
active_vrfs = ["default"]
@@ -1504,7 +1498,6 @@ def get_arp_table(self, vrf=""):
return arp_table
def get_ntp_peers(self):
-
ntp_peers = {}
rpc_command = ""
@@ -1529,7 +1522,6 @@ def get_ntp_peers(self):
return ntp_peers
def get_ntp_servers(self):
-
ntp_servers = {}
rpc_command = ""
@@ -1554,7 +1546,6 @@ def get_ntp_servers(self):
return ntp_servers
def get_ntp_stats(self):
-
ntp_stats = []
rpc_command = (
@@ -1607,7 +1598,6 @@ def get_ntp_stats(self):
return ntp_stats
def get_interfaces_ip(self):
-
interfaces_ip = {}
rpc_command_ipv4_ipv6 = "\
@@ -1688,7 +1678,6 @@ def get_interfaces_ip(self):
return interfaces_ip
def get_mac_address_table(self):
-
mac_table = []
rpc_command = (
@@ -1725,7 +1714,6 @@ def get_mac_address_table(self):
return mac_table
def get_route_to(self, destination="", protocol="", longer=False):
-
routes = {}
global IP_RIBRoute
@@ -1936,7 +1924,6 @@ def get_route_to(self, destination="", protocol="", longer=False):
return routes
def get_snmp_information(self):
-
snmp_information = {}
snmp_rpc_command = ""
@@ -1966,7 +1953,6 @@ def get_snmp_information(self):
return snmp_information
def get_probes_config(self):
-
sla_config = {}
_PROBE_TYPE_XML_TAG_MAP_ = {
@@ -2014,7 +2000,6 @@ def get_probes_config(self):
return sla_config
def get_probes_results(self):
-
sla_results = {}
_PROBE_TYPE_XML_TAG_MAP_ = {
@@ -2198,7 +2183,6 @@ def traceroute(
timeout=C.TRACEROUTE_TIMEOUT,
vrf=C.TRACEROUTE_VRF,
):
-
traceroute_result = {}
ipv = 4
@@ -2305,7 +2289,6 @@ def traceroute(
return traceroute_result
def get_users(self):
-
users = {}
_CISCO_GROUP_TO_CISCO_PRIVILEGE_MAP = {
@@ -2336,7 +2319,6 @@ def get_users(self):
return users
def get_config(self, retrieve="all", full=False, sanitized=False):
-
config = {"startup": "", "running": "", "candidate": ""} # default values
# IOS-XR only supports "all" on "show run"
diff --git a/napalm/iosxr_netconf/iosxr_netconf.py b/napalm/iosxr_netconf/iosxr_netconf.py
index ff7a06ef8..6f224e46a 100644
--- a/napalm/iosxr_netconf/iosxr_netconf.py
+++ b/napalm/iosxr_netconf/iosxr_netconf.py
@@ -451,7 +451,7 @@ def get_interfaces(self):
interfaces_rpc_reply_etree = ETREE.fromstring(interfaces_rpc_reply)
# Retrieves interfaces details
- for (interface_tree, description_tree) in zip(
+ for interface_tree, description_tree in zip(
interfaces_rpc_reply_etree.xpath(
".//int:interfaces/int:interface-xr/int:interface", namespaces=C.NS
),
@@ -459,7 +459,6 @@ def get_interfaces(self):
".//int:interfaces/int:interfaces/int:interface", namespaces=C.NS
),
):
-
interface_name = self._find_txt(
interface_tree, "./int:interface-name", default="", namespaces=C.NS
)
@@ -680,7 +679,6 @@ def get_vrf_neighbors(rpc_reply_etree, xpath):
neighbors = {}
for neighbor in rpc_reply_etree.xpath(xpath, namespaces=C.NS):
-
this_neighbor = {}
this_neighbor["local_as"] = napalm.base.helpers.convert(
int,
diff --git a/napalm/junos/junos.py b/napalm/junos/junos.py
index 74b6e5efe..b12d09774 100644
--- a/napalm/junos/junos.py
+++ b/napalm/junos/junos.py
@@ -2128,7 +2128,6 @@ def ping(
vrf=C.PING_VRF,
source_interface=C.PING_SOURCE_INTERFACE,
):
-
ping_dict = {}
source_str = ""
@@ -2458,7 +2457,6 @@ def get_config(self, retrieve="all", full=False, sanitized=False):
return rv
def get_network_instances(self, name=""):
-
network_instances = {}
ri_table = junos_views.junos_nw_instances_table(self.device)
diff --git a/napalm/nxapi_plumbing/api_client.py b/napalm/nxapi_plumbing/api_client.py
index a813ec716..52e28357b 100644
--- a/napalm/nxapi_plumbing/api_client.py
+++ b/napalm/nxapi_plumbing/api_client.py
@@ -185,7 +185,6 @@ def _process_api_response(
new_response = []
for response in response_list:
-
# Detect errors
self._error_check(response)
diff --git a/napalm/nxos/nxos.py b/napalm/nxos/nxos.py
index 9668569ff..09170074d 100644
--- a/napalm/nxos/nxos.py
+++ b/napalm/nxos/nxos.py
@@ -133,7 +133,6 @@ def __init__(
def load_replace_candidate(
self, filename: Optional[str] = None, config: Optional[str] = None
) -> None:
-
if not filename and not config:
raise ReplaceConfigException(
"filename or config parameter must be provided."
@@ -444,7 +443,6 @@ def traceroute(
timeout: int = c.TRACEROUTE_TIMEOUT,
vrf: str = c.TRACEROUTE_VRF,
) -> models.TracerouteResultDict:
-
_HOP_ENTRY_PROBE = [
r"\s+",
r"(", # beginning of host_name (ip_address) RTT group
@@ -587,7 +585,6 @@ def _disable_confirmation(self) -> None:
def get_config(
self, retrieve: str = "all", full: bool = False, sanitized: bool = False
) -> models.ConfigDict:
-
# NX-OS adds some extra, unneeded lines that should be filtered.
filter_strings = [
r"!Command: show .*$",
diff --git a/napalm/pyIOSXR/exceptions.py b/napalm/pyIOSXR/exceptions.py
index 0a854c33d..96de83d3e 100644
--- a/napalm/pyIOSXR/exceptions.py
+++ b/napalm/pyIOSXR/exceptions.py
@@ -24,7 +24,6 @@
class IOSXRException(Exception):
def __init__(self, msg=None, dev=None):
-
super(IOSXRException, self).__init__(msg)
if dev:
self._xr = dev
diff --git a/napalm/pyIOSXR/iosxr.py b/napalm/pyIOSXR/iosxr.py
index a1ddc2215..08e51c173 100644
--- a/napalm/pyIOSXR/iosxr.py
+++ b/napalm/pyIOSXR/iosxr.py
@@ -132,7 +132,6 @@ def __getattr__(self, item):
"""
def _getattr(*args, **kwargs):
-
cmd = item.replace("_", " ")
for arg in args:
cmd += " %s" % arg
@@ -244,7 +243,6 @@ def _send_command_timing(self, command):
)
def _in_cli_mode(self):
-
out = self._send_command_timing("\n")
if not out:
return False
@@ -253,7 +251,6 @@ def _in_cli_mode(self):
return False
def _enter_xml_mode(self):
-
self._unlock_xml_agent()
# release - other commands should not have anyway access to the XML agent
# when not in XML mode
@@ -283,7 +280,6 @@ def _send_command(
read_output=None,
receive=False,
):
-
if not expect_string:
expect_string = self._XML_MODE_PROMPT
@@ -405,7 +401,6 @@ def _send_command(
# previous module function __execute_rpc__
def _execute_rpc(self, command_xml, delay_factor=0.1):
-
xml_rpc_command = (
''
+ command_xml
@@ -433,7 +428,6 @@ def _execute_rpc(self, command_xml, delay_factor=0.1):
result_summary = root.find("ResultSummary")
if result_summary is not None and int(result_summary.get("ErrorCount", 0)) > 0:
-
if "CLI" in childs:
error_msg = root.find("CLI").get("ErrorMsg") or ""
elif "Commit" in childs:
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 62923790b..3b479bec5 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1,4 +1,4 @@
-black==22.6.0
+black==23.3.0
coveralls==3.3.1
ddt==1.6.0
flake8-import-order==0.18.2
diff --git a/test/base/test_helpers.py b/test/base/test_helpers.py
index cd2226877..3f1a86eee 100644
--- a/test/base/test_helpers.py
+++ b/test/base/test_helpers.py
@@ -265,7 +265,6 @@ def test_convert(self):
# should return empty unicode
def test_find_txt(self):
-
"""
Tests helper function ```find_txt```:
@@ -352,7 +351,6 @@ def test_find_txt(self):
self.assertTrue(len(napalm.base.helpers.find_txt(_NOT_SPECIAL_CHILD2, ".")) > 0)
def test_mac(self):
-
"""
Tests the helper function ```mac```:
diff --git a/test/eos/test_heredoc.py b/test/eos/test_heredoc.py
index a7b46cbfd..9190ff67e 100644
--- a/test/eos/test_heredoc.py
+++ b/test/eos/test_heredoc.py
@@ -6,7 +6,6 @@
@pytest.mark.usefixtures("set_device_parameters")
class TestConfigMangling(object):
def test_heredoc(self):
-
raw_config = dedent(
"""\
hostname vEOS
@@ -117,7 +116,6 @@ def test_mode_comment(self):
)
def test_heredoc_with_bangs(self):
-
raw_config = dedent(
"""\
hostname vEOS
diff --git a/test/ios/conftest.py b/test/ios/conftest.py
index 7fa26bd21..948b986f3 100644
--- a/test/ios/conftest.py
+++ b/test/ios/conftest.py
@@ -32,7 +32,6 @@ class PatchedIOSDriver(ios.IOSDriver):
"""Patched IOS Driver."""
def __init__(self, hostname, username, password, timeout=60, optional_args=None):
-
super().__init__(hostname, username, password, timeout, optional_args)
self.patched_attrs = ["device"]
diff --git a/test/iosxr/conftest.py b/test/iosxr/conftest.py
index a8b40d83b..7ef92f9d6 100644
--- a/test/iosxr/conftest.py
+++ b/test/iosxr/conftest.py
@@ -32,7 +32,6 @@ class PatchedIOSXRDriver(iosxr.IOSXRDriver):
"""Patched IOS Driver."""
def __init__(self, hostname, username, password, timeout=60, optional_args=None):
-
super().__init__(hostname, username, password, timeout, optional_args)
self.patched_attrs = ["device"]
diff --git a/test/iosxr_netconf/conftest.py b/test/iosxr_netconf/conftest.py
index 20207985e..f623ee649 100644
--- a/test/iosxr_netconf/conftest.py
+++ b/test/iosxr_netconf/conftest.py
@@ -32,7 +32,6 @@ class PatchedIOSXRNETCONFDriver(iosxr_netconf.IOSXRNETCONFDriver):
"""Patched IOSXR NETCONF Driver."""
def __init__(self, hostname, username, password, timeout=60, optional_args=None):
-
super().__init__(hostname, username, password, timeout, optional_args)
self.patched_attrs = ["device"]
diff --git a/test/junos/TestJunOSDriver.py b/test/junos/TestJunOSDriver.py
index c477bc541..fc1394803 100644
--- a/test/junos/TestJunOSDriver.py
+++ b/test/junos/TestJunOSDriver.py
@@ -116,7 +116,6 @@ def response(self, **rpc_args):
return lxml.etree.fromstring(xml_string)
def get_config(self, get_cmd=None, filter_xml=None, options={}):
-
# get_cmd is an XML tree that requests a specific part of the config
# E.g.:
diff --git a/test/junos/conftest.py b/test/junos/conftest.py
index dc21dce60..31a7cad14 100644
--- a/test/junos/conftest.py
+++ b/test/junos/conftest.py
@@ -147,7 +147,6 @@ def response(self, **rpc_args):
return lxml.etree.fromstring(xml_string)
def get_config(self, get_cmd=None, filter_xml=None, options={}):
-
# get_cmd is an XML tree that requests a specific part of the config
# E.g.:
diff --git a/test/pyiosxr/test_iosxr.py b/test/pyiosxr/test_iosxr.py
index b8485659d..1eedaeeec 100755
--- a/test/pyiosxr/test_iosxr.py
+++ b/test/pyiosxr/test_iosxr.py
@@ -142,7 +142,6 @@ def __repr__(self):
@classmethod
def setUpClass(cls):
-
"""
Opens the connection with the IOS-XR device.
"""
@@ -165,7 +164,6 @@ def setUpClass(cls):
@classmethod
def tearDownClass(cls):
-
"""
Closes the connection with the device.
"""
@@ -173,7 +171,6 @@ def tearDownClass(cls):
cls.device.close()
def test_mock_lock_connection_open(self):
-
if self.MOCK:
self.device.lock_on_connect = True
# because there's one single mock file
@@ -184,7 +181,6 @@ def test_mock_lock_connection_open(self):
# enough to see that will try to lock during connect
def test_mock_close(self):
-
"""Testing if unlocking when connection is closed"""
if self.MOCK:
@@ -193,7 +189,6 @@ def test_mock_close(self):
self.assertFalse(self.device.locked, msg="Cannot unlock the DB.")
def test_execute_rpc_method(self):
-
"""Testing private method _execute_rpc"""
self.assertIsInstance(
@@ -205,7 +200,6 @@ def test_execute_rpc_method(self):
)
def test__getttr__show_(self):
-
"""Testing special attribute __getattr___ against valid show command"""
self.assertIsInstance(
@@ -215,13 +209,11 @@ def test__getttr__show_(self):
)
def test__getttr__show_args(self):
-
"""Testing special attribute __getattr___ against valid show command with arguments"""
self.assertIsInstance(self.device.show_ntp("ass"), str)
def test_acquire_xml_agent(self):
-
"""Testing if able to acquire the XML agent."""
self.device._lock_xml_agent(time.time())
@@ -250,13 +242,11 @@ def test_in_cli_mode(self):
self.assertTrue(self.device._in_cli_mode())
def test__getattr_show_config(self):
-
"""Testing special attribute __getattr___ against valid show config command"""
self.assertIsInstance(self.device.show_run_ntp(config=True), str)
def test__getattr__no_show(self):
-
"""Test special attribute __getattr__ against a no-show command"""
raised = False
@@ -269,7 +259,6 @@ def test__getattr__no_show(self):
self.assertTrue(raised)
def test_make_rpc_call_returns_XML(self):
-
"""Test if public method make_rpc_call returns str"""
self.assertIsInstance(
@@ -298,7 +287,6 @@ def test_acquired_xml_agent(self):
) # Exception raised => xml agent released
def test_try_to_read_till_timeout(self):
-
"""Testing if will try to read from the device till time out"""
if self.MOCK:
@@ -309,7 +297,6 @@ def test_try_to_read_till_timeout(self):
)
def test_multiple_read_attempts_till_timeout(self):
-
"""Testing if will try to read non-empty replies from the device till time out"""
if self.MOCK:
@@ -320,7 +307,6 @@ def test_multiple_read_attempts_till_timeout(self):
)
def test_iterator_id_raises_IteratorIDError(self):
-
"""Testing if reply containing the IteratorID attribute raises IteratorIDError"""
self.device.load_candidate_config(config="xml agent tty iteration on size 1")
@@ -340,7 +326,6 @@ def test_iterator_id_raises_IteratorIDError(self):
# going to prev state
def test_channel_acquired_enter_xml_mode(self):
-
"""Test if not raises ConnectError when the channel is busy with other requests"""
self.device._lock_xml_agent()
@@ -348,7 +333,6 @@ def test_channel_acquired_enter_xml_mode(self):
self.assertIsNone(self.device._enter_xml_mode())
def test_truncated_response_raises_InvalidXMLResponse(self):
-
"""Testing if truncated XML reply raises InvalidXMLResponse"""
if self.MOCK:
@@ -361,7 +345,6 @@ def test_truncated_response_raises_InvalidXMLResponse(self):
)
def test_iosxr_bug_0x44318c06(self):
-
"""Tests if IOS-XR bug returns error 0x44318c06 and raise XMLCLIError"""
if self.MOCK:
@@ -374,7 +357,6 @@ def test_iosxr_bug_0x44318c06(self):
)
def test_empty_reply_raises_TimeoutError(self):
-
"""Testing if empty reply raises TimeoutError"""
if self.MOCK:
@@ -383,7 +365,6 @@ def test_empty_reply_raises_TimeoutError(self):
self.assertRaises(TimeoutError, self.device._execute_rpc, "")
def test_multiple_requests_raise_0xa3679e00(self):
-
"""Testing if simultaneuous requests trigger XMLCLIError"""
if self.MOCK:
@@ -397,25 +378,21 @@ def test_multiple_requests_raise_0xa3679e00(self):
pass
def test_execute_show(self):
-
"""Testing private method _execute_show"""
self.assertIsInstance(self.device._execute_show("show ntp ass"), str)
def test_execute_invalid_show_raises_InvalidInputError(self):
-
"""Testing if invalid show command raises InvalidInputError"""
self.assertRaises(InvalidInputError, self.device._execute_show, "sh fake")
def test_execute_config_show(self):
-
"""Testing private method _execute_config_show"""
self.assertIsInstance(self.device._execute_config_show("show run ntp"), str)
def test_execute_invalid_config_show_raises_InvalidInputError(self):
-
"""Testing if invalid config show command raises InvalidInputError"""
self.assertRaises(
@@ -423,7 +400,6 @@ def test_execute_invalid_config_show_raises_InvalidInputError(self):
)
def test_lock_raises_LockError(self):
-
"""Tests if DB already locked raises LockError"""
if self.MOCK:
@@ -455,7 +431,6 @@ def test_lock_raises_LockError(self):
same_device.close()
def test_unlock(self):
-
"""Testing unlock feature"""
if self.MOCK:
@@ -475,7 +450,6 @@ def test_unlock(self):
self.assertFalse(self.device.locked)
def _load_dummy_config(self):
-
"""Helper that loads some dummy data before committing."""
config = """
@@ -485,7 +459,6 @@ def _load_dummy_config(self):
return self.device.load_candidate_config(config=config)
def test_load_invalid_config_raises_InvalidInputError(self):
-
"""Testing if loading config with mistakes raises InvalidInputError"""
self.assertRaises(
@@ -496,7 +469,6 @@ def test_load_invalid_config_raises_InvalidInputError(self):
self.device.discard_config()
def test_load_candidate_config_file(self):
-
"""Testing loading candidate config from file"""
self.assertIsNone(
@@ -508,7 +480,6 @@ def test_load_candidate_config_file(self):
)
def test_load_invalid_candidate_config_file_raises_InvalidInputError(self):
-
"""Testing if loading invalid config from a file raises InvalidInputError"""
self.assertRaises(
@@ -520,7 +491,6 @@ def test_load_invalid_candidate_config_file_raises_InvalidInputError(self):
)
def test_load_config(self):
-
"""Testing if able to load candidate config, then check commit diff and discard changes"""
self._load_dummy_config()
@@ -563,7 +533,6 @@ def test_load_config(self):
)
def test_commit_config(self):
-
"""Testing commit config"""
self._load_dummy_config()
@@ -573,7 +542,6 @@ def test_commit_config(self):
self.device.rollback()
def test_commit_config_message(self):
-
"""Testing commit config with comment message"""
self._load_dummy_config()
@@ -583,7 +551,6 @@ def test_commit_config_message(self):
self.device.rollback()
def test_commit_config_label(self):
-
"""Testing commit config with label"""
self._load_dummy_config()
@@ -593,7 +560,6 @@ def test_commit_config_label(self):
self.device.rollback()
def test_commit_config_confirmed(self):
-
"""Testing commit confirmed"""
self._load_dummy_config()
@@ -603,19 +569,16 @@ def test_commit_config_confirmed(self):
self.device.rollback()
def test_commit_config_confirmed_raise_InvalidInputError(self):
-
"""Testing if incorrect value for confirm time raises InvalidInputError"""
self.assertRaises(InvalidInputError, self.device.commit_config, confirmed=1)
def test_commit_empty_buffer_raises(self):
-
"""Testing if trying to commit empty changes raises CommitError"""
self.assertRaises(CommitError, self.device.commit_config, comment="empty")
def test_commit_after_other_session_commit(self):
-
"""Testing if trying to commit after another process commited does not raise CommitError"""
if self.MOCK:
@@ -658,7 +621,6 @@ def test_commit_after_other_session_commit(self):
self.device.open()
def _prefetch_running_config_and_append(self):
-
"""Helper method to be used in the config-replace tests below"""
running_config = "".join(self.device.show_run().splitlines(1)[3:])
@@ -666,7 +628,6 @@ def _prefetch_running_config_and_append(self):
self.device.load_candidate_config(config="ntp server 8.8.8.8")
def test_compare_replace_config(self):
-
"""Testing compare replace config"""
self._prefetch_running_config_and_append()
@@ -674,7 +635,6 @@ def test_compare_replace_config(self):
self.assertIsInstance(self.device.compare_replace_config(), str)
def test_commit_replace_config(self):
-
"""Testing commit replace config"""
self._prefetch_running_config_and_append()
@@ -682,7 +642,6 @@ def test_commit_replace_config(self):
self.assertIsNone(self.device.commit_replace_config())
def test_commit_replace_config_message(self):
-
"""Testing commit replace config with comment message"""
self._prefetch_running_config_and_append()
@@ -690,7 +649,6 @@ def test_commit_replace_config_message(self):
self.assertIsNone(self.device.commit_replace_config(comment="good"))
def test_commit_replace_config_label(self):
-
"""Testing commit replace config with label"""
self._prefetch_running_config_and_append()
@@ -698,7 +656,6 @@ def test_commit_replace_config_label(self):
self.assertIsNone(self.device.commit_replace_config(label="test"))
def test_commit_replace_config_confirmed(self):
-
"""Testing commit replace confirmed"""
self._prefetch_running_config_and_append()
@@ -706,7 +663,6 @@ def test_commit_replace_config_confirmed(self):
self.assertIsNone(self.device.commit_replace_config(confirmed=60))
def test_commit_replace_config_confirmed_raise_InvalidInputError(self):
-
"""Testing if incorrect value for confirmed replace commit time raises InvalidInputError"""
self.assertRaises(