nornir-collection 0.0.2__py3-none-any.whl → 0.0.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. nornir_collection/batfish/assert_config.py +1 -5
  2. nornir_collection/batfish/utils.py +0 -2
  3. nornir_collection/cisco/configuration_management/cli/config_tasks.py +0 -8
  4. nornir_collection/cisco/configuration_management/cli/config_workflow.py +0 -1
  5. nornir_collection/cisco/configuration_management/cli/show_tasks.py +3 -7
  6. nornir_collection/cisco/configuration_management/netconf/config_tasks.py +3 -14
  7. nornir_collection/cisco/configuration_management/netconf/config_workflow.py +1 -6
  8. nornir_collection/cisco/configuration_management/netconf/nr_cfg_iosxe_netconf.py +0 -2
  9. nornir_collection/cisco/configuration_management/netconf/ops_tasks.py +2 -7
  10. nornir_collection/cisco/configuration_management/processor.py +2 -3
  11. nornir_collection/cisco/configuration_management/pyats.py +0 -2
  12. nornir_collection/cisco/configuration_management/restconf/cisco_rpc.py +1 -9
  13. nornir_collection/cisco/configuration_management/restconf/config_workflow.py +1 -3
  14. nornir_collection/cisco/configuration_management/restconf/tasks.py +2 -5
  15. nornir_collection/cisco/configuration_management/utils.py +1 -4
  16. nornir_collection/cisco/software_upgrade/cisco_software_upgrade.py +0 -3
  17. nornir_collection/cisco/software_upgrade/utils.py +5 -16
  18. nornir_collection/cisco/support_api/api_calls.py +1 -7
  19. nornir_collection/cisco/support_api/cisco_maintenance_report.py +0 -2
  20. nornir_collection/cisco/support_api/cisco_support.py +0 -9
  21. nornir_collection/cisco/support_api/reports.py +1 -9
  22. nornir_collection/cisco/support_api/utils.py +0 -4
  23. nornir_collection/fortinet/utils.py +0 -1
  24. nornir_collection/git.py +3 -4
  25. nornir_collection/netbox/custom_script.py +1 -4
  26. nornir_collection/netbox/inventory.py +1 -4
  27. nornir_collection/netbox/scan_prefixes_and_update_ip_addresses.py +3 -8
  28. nornir_collection/netbox/set_device_status.py +0 -1
  29. nornir_collection/netbox/sync_datasource.py +0 -1
  30. nornir_collection/netbox/update_cisco_inventory_data.py +1 -3
  31. nornir_collection/netbox/update_cisco_support_plugin_data.py +0 -4
  32. nornir_collection/netbox/update_fortinet_inventory_data.py +1 -3
  33. nornir_collection/netbox/update_purestorage_inventory_data.py +1 -3
  34. nornir_collection/netbox/utils.py +1 -4
  35. nornir_collection/netbox/verify_device_primary_ip.py +1 -4
  36. nornir_collection/nornir_plugins/inventory/netbox.py +4 -9
  37. nornir_collection/nornir_plugins/inventory/staggered_yaml.py +0 -2
  38. nornir_collection/nornir_plugins/inventory/utils.py +1 -3
  39. nornir_collection/purestorage/utils.py +1 -2
  40. nornir_collection/utils.py +8 -14
  41. {nornir_collection-0.0.2.dist-info → nornir_collection-0.0.4.dist-info}/METADATA +3 -4
  42. nornir_collection-0.0.4.dist-info/RECORD +59 -0
  43. nornir_collection-0.0.2.dist-info/RECORD +0 -59
  44. {nornir_collection-0.0.2.dist-info → nornir_collection-0.0.4.dist-info}/LICENSE +0 -0
  45. {nornir_collection-0.0.2.dist-info → nornir_collection-0.0.4.dist-info}/WHEEL +0 -0
  46. {nornir_collection-0.0.2.dist-info → nornir_collection-0.0.4.dist-info}/top_level.txt +0 -0
@@ -39,7 +39,7 @@ def batfish_assert_cfg_prop(task: Task, data: tuple, name_add: str = False) -> l
39
39
  snap_prop = snap_prop.lstrip()
40
40
  # Set the Nornir task failed variable
41
41
  failed = bool(ref_prop != snap_prop)
42
- cfg_result = f"-> Expected: '{ref_prop}'\n" f"-> Configured: '{snap_prop}'"
42
+ cfg_result = f"-> Expected: '{ref_prop}'\n-> Configured: '{snap_prop}'"
43
43
 
44
44
  elif isinstance(ref_prop, list):
45
45
  ref_prop = list_flatten(ref_prop)
@@ -108,7 +108,6 @@ def batfish_assert_cfg_node_property_task(task: Task, nr_inv: bool, data: tuple[
108
108
  "NTP_Source_Interface": ["cfg_ntp", "source"],
109
109
  }
110
110
  """
111
- # pylint: disable=invalid-name
112
111
 
113
112
  # Extract the variables from the data tuple
114
113
  bf, ref_props = data
@@ -181,7 +180,6 @@ def batfish_assert_cfg_interface_property_task(
181
180
  }
182
181
  }
183
182
  """
184
- # pylint: disable=invalid-name
185
183
 
186
184
  # Extract the variables from the data tuple
187
185
  bf, ref_props = data
@@ -252,7 +250,6 @@ def batfish_assert_cfg_switched_vlan_property_task(
252
250
  "VLAN_ID_ADD": ["cfg_vlans_add"],
253
251
  }
254
252
  """
255
- # pylint: disable=invalid-name
256
253
 
257
254
  # Extract the variables from the data tuple
258
255
  bf, ref_props = data
@@ -328,7 +325,6 @@ def batfish_assert_config_property(nr: Nornir, nr_inv: bool, data: tuple, soft:
328
325
  inventory by a dict key map list or are specified already directly correct.
329
326
  The result is printed in Nornir style and in case of an assert error the script exits with error code 1.
330
327
  """
331
- # pylint: disable=invalid-name
332
328
 
333
329
  # Extract the variables from the data tuple
334
330
  bf, bf_question, ref_props = data
@@ -24,7 +24,6 @@ def init_batfish(bf_data: tuple, bf_log_lvl: Literal["WARN", "ERROR"] = "ERROR")
24
24
  """
25
25
  TBD
26
26
  """
27
- # pylint: disable=invalid-name
28
27
 
29
28
  # Extract the variables from the bf_data tuple
30
29
  bf_host, bf_network, SNAPSHOT_DIR, SNAPSHOT_NAME = bf_data
@@ -70,7 +69,6 @@ def batfish_question_failed(task: Task, df: DataFrame, name_add: str = False) ->
70
69
  """
71
70
  TBD
72
71
  """
73
- # pylint: disable=invalid-name
74
72
 
75
73
  # Set the name_add variable if exists, else an empty string
76
74
  name_add = name_add if name_add else ""
@@ -156,7 +156,6 @@ def cli_confirm_or_revert_config(
156
156
  """
157
157
  TBD
158
158
  """
159
- # pylint: disable=invalid-name
160
159
 
161
160
  # Return False if cfg_status argument is False
162
161
  if not cfg_status:
@@ -201,7 +200,6 @@ def save_config_cli(nr: Nornir, name: str, verbose: bool = False) -> bool:
201
200
  This function runs a Nornir task to execute with Netmiko netmiko_save_config a write memory on each device
202
201
  and prints the result to std-out
203
202
  """
204
- # pylint: disable=invalid-name
205
203
 
206
204
  print_task_name(text=name)
207
205
 
@@ -239,7 +237,6 @@ def cfg_eem_replace_config(nr: Nornir, name: str, eem_name: str, file: str, verb
239
237
  specified file path. After this config will be executed to replace the configuration. It's basically a
240
238
  rollback function.
241
239
  """
242
- # pylint: disable=invalid-name
243
240
 
244
241
  print_task_name(text=name)
245
242
 
@@ -344,8 +341,6 @@ def jinja2_generate_config(
344
341
  more hosts failed the function print a error std-out message and terminates the script. Only when all
345
342
  hosts were successful the Nornir AggregatedResult object will be returned
346
343
  """
347
- # pylint: disable=invalid-name
348
-
349
344
  print_task_name(text=name)
350
345
 
351
346
  # Run the Nornir Task template_file
@@ -408,7 +403,6 @@ def cfg_jinja2_config(nr: Nornir, name: str, jinja2_result: AggregatedResult, ve
408
403
  applied to each device. It can continue with the result of the function jinja2_generate_config to apply a
409
404
  Jinja2 config to devices and prints the result is the Nornir style.
410
405
  """
411
- # pylint: disable=invalid-name
412
406
 
413
407
  print_task_name(text=name)
414
408
 
@@ -460,7 +454,6 @@ def cfg_multiline_banner(nr: Nornir, name: str, multiline_banner: str, verbose:
460
454
  line. You should *not* use eager unless you need to and know what you are doing as it basically disables
461
455
  one of the core features that makes scrapli reliable!
462
456
  """
463
- # pylint: disable=invalid-name
464
457
 
465
458
  print_task_name(text=name)
466
459
 
@@ -505,7 +498,6 @@ def cfg_tpl_int_cli(nr: Nornir, name: str, verbose: bool = False) -> bool:
505
498
  This function takes a Nornir object and a filter tag to execute all tasks within this function on the
506
499
  given inventory subset. Each interface group will be configured by Scrapli.
507
500
  """
508
- # pylint: disable=invalid-name
509
501
 
510
502
  # Set the variable to return at the end of the function to True
511
503
  cfg_status = True
@@ -29,7 +29,6 @@ def cli_cfg_network_from_code_01(
29
29
  This function improves modularity as it is used within multiple scripts. The network will be reconfigured
30
30
  to from the day0 config its desired state.
31
31
  """
32
- # pylint: disable=invalid-name
33
32
 
34
33
  print_task_title("Configure network from code")
35
34
 
@@ -316,7 +316,7 @@ def cli_install_one_shot_task(task: Task, issu: bool = False, verbose: bool = Fa
316
316
  return Result(host=task.host, result=result)
317
317
 
318
318
  # Else the cli one-shot software install failed
319
- result = f"'{task.name}' -> CliResponse <Success: False>\n\n" f"{result}"
319
+ result = f"'{task.name}' -> CliResponse <Success: False>\n\n{result}"
320
320
 
321
321
  # Return the custom Nornir result as failed
322
322
  return Result(host=task.host, result=result, failed=True)
@@ -386,7 +386,7 @@ def cli_get_serial_numbers(task: Task, verbose: bool = False) -> Result:
386
386
  result = f"'{task.name}' -> CliResponse <Success: True>"
387
387
  for switch_num, serial in serials.items():
388
388
  result += f"\n-> Device {switch_num}: {serial}"
389
- for serial in add_serials.keys(): # pylint: disable=consider-iterating-dictionary
389
+ for serial in add_serials.keys():
390
390
  result += f"\n-> Sub-Device: {serial}"
391
391
  # Set the result print level to summary or verbose
392
392
  result = result + "\n\n" + verbose_result if verbose else result
@@ -409,7 +409,7 @@ def cli_get_software_version(task: Task, verbose: bool = False) -> Result:
409
409
  return Result(host=task.host, result=result, failed=True)
410
410
 
411
411
  # The software version was found and is not None
412
- result = f"'{task.name}' -> CliResponse <Success: True>\n" f"-> Device software version {version}"
412
+ result = f"'{task.name}' -> CliResponse <Success: True>\n-> Device software version {version}"
413
413
  # Set the result print level to summary or verbose
414
414
  result = result + "\n\n" + verbose_result if verbose else result
415
415
 
@@ -534,7 +534,6 @@ def nr_pre_config_check(nr: Nornir) -> bool:
534
534
  the golden configuration. It prints the task title and the results of the task. If the task fails, it
535
535
  indicates that the running configuration and the golden configuration are not identical.
536
536
  """
537
- # pylint: disable=invalid-name
538
537
 
539
538
  print_task_title("Pre-configuration check")
540
539
 
@@ -560,7 +559,6 @@ def cli_verify_destination_md5_hash(nr):
560
559
  script. It also collects and returns a list of hosts where the destination file MD5 hash does not match
561
560
  or the destination file does not exist.
562
561
  """
563
- # pylint: disable=invalid-name
564
562
 
565
563
  # Run the custom Nornir task verify_destination_md5_hash
566
564
  task_result = nr.run(
@@ -606,7 +604,6 @@ def write_commands_to_file(
606
604
  the output of the commands to that file. The start of the filename is the hostname and as suffix can any
607
605
  text be added.
608
606
  """
609
- # pylint: disable=invalid-name,too-many-arguments,too-many-locals
610
607
 
611
608
  # Set the variable to return at the end of the function to True
612
609
  cfg_status = True
@@ -651,7 +648,6 @@ def write_commands_to_file(
651
648
  # The write_file result is only present if all Scrapli send_command tasks were successful
652
649
  filepath = f"{path}/{host}{filename_suffix}"
653
650
 
654
- # pylint: disable=undefined-loop-variable
655
651
  if [True for result in multi_result if result.name == "write_file"]:
656
652
  # The write_file result is present and no exception exists
657
653
  if result.exception is None:
@@ -90,7 +90,7 @@ def return_result_if_no_template(task: Task, is_iface: bool, tpl_startswith: str
90
90
  return nc_tpl
91
91
 
92
92
 
93
- def netconf_configure_jinja2_rendered_payload_template( # pylint: disable=too-many-arguments,too-many-locals
93
+ def netconf_configure_jinja2_rendered_payload_template(
94
94
  task: Task,
95
95
  j2_task_text: str,
96
96
  j2_tpl_path: str,
@@ -123,7 +123,7 @@ def netconf_configure_jinja2_rendered_payload_template( # pylint: disable=too-m
123
123
  # Add the Jinja2 template result to the result string if verbose is True
124
124
  custom_result.append(msg + f"\n\n{nc_config}" if verbose else msg)
125
125
 
126
- except: # pylint: disable=bare-except # nosec
126
+ except: # noqa: E722
127
127
  task_failed = True
128
128
  # Set the Nornir print result item
129
129
  msg = f"{task_result(text=j2_task_text, changed=False, level_name='ERROR', failed=True)}\n"
@@ -171,7 +171,7 @@ def netconf_configure_jinja2_rendered_payload_template( # pylint: disable=too-m
171
171
  else (msg + f"\n\n{nc_result[0].scrapli_response.result}" if verbose else msg)
172
172
  )
173
173
 
174
- except: # pylint: disable=bare-except # nosec
174
+ except: # noqa: E722
175
175
  task_failed = True
176
176
  # Set the Nornir print result item
177
177
  msg = f"{task_result(text=task.name, changed=False, level_name='ERROR', failed=True)}\n"
@@ -200,8 +200,6 @@ def nc_edit_cleanup_portchannel(task: Task, verbose: bool = False) -> Result:
200
200
  """
201
201
  TBD
202
202
  """
203
- # pylint: disable=too-many-locals
204
-
205
203
  # The custom_result list will be filled with the results
206
204
  custom_result = []
207
205
 
@@ -287,8 +285,6 @@ def nc_edit_cleanup_svi(task: Task, verbose: bool = False) -> Result:
287
285
  """
288
286
  TBD
289
287
  """
290
- # pylint: disable=too-many-locals
291
-
292
288
  # The custom_result list will be filled with the results
293
289
  custom_result = []
294
290
 
@@ -366,8 +362,6 @@ def nc_edit_tpl_config(task: Task, tpl_startswith: str, verbose: bool = False) -
366
362
  """
367
363
  TBD
368
364
  """
369
- # pylint: disable=invalid-name,too-many-locals
370
-
371
365
  # Return the result if no Jinja2 interface templates for a 'tpl_startswith' string were found
372
366
  nc_tpl_result = return_result_if_no_template(task=task, is_iface=False, tpl_startswith=tpl_startswith)
373
367
  # If the return in a string, then it's the custom Nornir result to return
@@ -403,8 +397,6 @@ def nc_edit_tpl_int_config(task: Task, tpl_startswith: str, verbose: bool = Fals
403
397
  """
404
398
  TBD
405
399
  """
406
- # pylint: disable=too-many-locals,invalid-name
407
-
408
400
  # Return the Nornir result as failed if the host have no interfaces
409
401
  iface_result = return_result_if_no_interfaces(task=task)
410
402
  # If the return in not None, then it's the custom Nornir result to return
@@ -471,7 +463,6 @@ def nc_cfg_cleanup(nr: Nornir, cfg_status: bool = True, verbose: bool = False) -
471
463
  """
472
464
  TBD
473
465
  """
474
- # pylint: disable=invalid-name
475
466
 
476
467
  # Return False if cfg_status argument is False
477
468
  if not cfg_status:
@@ -506,7 +497,6 @@ def nc_cfg_tpl(nr: Nornir, cfg_tasks: dict, cfg_status: bool = True, verbose: bo
506
497
  """
507
498
  TBD
508
499
  """
509
- # pylint: disable=invalid-name
510
500
 
511
501
  # Return False if cfg_status argument is False
512
502
  if not cfg_status:
@@ -537,7 +527,6 @@ def nc_cfg_tpl_int(nr: Nornir, cfg_tasks: dict, cfg_status: bool = True, verbose
537
527
  """
538
528
  TBD
539
529
  """
540
- # pylint: disable=invalid-name
541
530
 
542
531
  # Return False if cfg_status argument is False
543
532
  if not cfg_status:
@@ -1,12 +1,11 @@
1
1
  #!/usr/bin/env python3
2
2
  """
3
- This module contains complete NETCONF config workflows from multiple dsc_nornir functions.
3
+ This module contains complete NETCONF config workflows from multiple nornir_collection functions.
4
4
 
5
5
  The functions are ordered as followed:
6
6
  - Complete NETCONF config workflows
7
7
  """
8
8
 
9
-
10
9
  import time
11
10
  from nornir.core import Nornir, Task
12
11
  from nornir_collection.utils import (
@@ -52,7 +51,6 @@ def _nc_exit_dry_run(nr: Task, cfg_status: bool, verbose: bool) -> None:
52
51
 
53
52
  !!! NETCONF lock/unlock rpc have been commented out as the unlock fails since 17.12.X !!!
54
53
  """
55
- # pylint: disable=invalid-name
56
54
 
57
55
  # Discard all changes on the NETCONF candidate datastore
58
56
  nc_discard(nr=nr, verbose=verbose)
@@ -81,7 +79,6 @@ def _nc_commit_confirm_testing(nr: Task) -> bool:
81
79
  complete the tests. If the tests are not successful, it waits for the specified confirm timeout period
82
80
  to expire.
83
81
  """
84
- # pylint: disable=invalid-name
85
82
 
86
83
  # Start a timer to check how long the Nornir TestProcessor Task need
87
84
  timer_start = time.time()
@@ -164,8 +161,6 @@ def nc_cfg_iosxe_netconf_config(
164
161
 
165
162
  !!! NETCONF lock/unlock rpc have been commented out as the unlock fails since 17.12.X !!!
166
163
  """
167
- # pylint: disable=invalid-name,too-many-arguments
168
-
169
164
  print_task_title("Cleanup NETCONF candidate config")
170
165
 
171
166
  # Checks if a datastore sync in ongoing and wait until is finish. Default cfg_status argument is True
@@ -4,7 +4,6 @@ This module is a complete config management inclusive testing and rollback in ca
4
4
  Cisco IOS-XE devices. The Main function is intended to import and execute by other scripts.
5
5
  """
6
6
 
7
-
8
7
  import argparse
9
8
  from nornir.core.filter import F
10
9
  from nornir_collection.nornir_plugins.inventory.utils import init_nornir
@@ -62,7 +61,6 @@ def main(nr_config: str, args: argparse.Namespace) -> None:
62
61
  * Exits:
63
62
  * It exits with appropriate messages and statuses based on the success or failure of each step.
64
63
  """
65
- # pylint: disable=invalid-name
66
64
 
67
65
  #### Initialize Script and Nornir #######################################################################
68
66
 
@@ -19,7 +19,7 @@ from nornir_collection.utils import print_result
19
19
  #### Nornir NETCONF Tasks ###################################################################################
20
20
 
21
21
 
22
- def nc_ops_rpc( # pylint: disable=too-many-arguments,invalid-name,too-many-branches
22
+ def nc_ops_rpc(
23
23
  task: Task,
24
24
  rpc: Literal["lock", "validate", "discard", "commit", "unlock"],
25
25
  datastore: Literal["candidate", "running"] = "candidate",
@@ -72,7 +72,7 @@ def nc_ops_rpc( # pylint: disable=too-many-arguments,invalid-name,too-many-bran
72
72
  else:
73
73
  nc_result = scrapli_conn.commit()
74
74
 
75
- except Exception: # pylint: disable=broad-exception-caught # nosec
75
+ except Exception:
76
76
  result = (
77
77
  f"'{task.name}' -> NetconfResponse <Success: False>\n"
78
78
  + "-> Configuration attempt failed\n"
@@ -129,7 +129,6 @@ def nc_lock(
129
129
  If the `cfg_status` argument is set to False, the function will immediately return False without
130
130
  performing any operations, in order to skip the NETCONF lock operation.
131
131
  """
132
- # pylint: disable=invalid-name
133
132
 
134
133
  # Return False if cfg_status argument is False
135
134
  if not cfg_status:
@@ -166,7 +165,6 @@ def nc_validate(
166
165
  If the `cfg_status` argument is set to False, the function will immediately return False without
167
166
  performing any operations, in order to skip the NETCONF validate operation.
168
167
  """
169
- # pylint: disable=invalid-name
170
168
 
171
169
  # Return False if cfg_status argument is False
172
170
  if not cfg_status:
@@ -206,7 +204,6 @@ def nc_commit(
206
204
  `cfg_status` argument is set to False, the function will immediately return False without performing
207
205
  any operations, in order to skip the NETCONF commit operation.
208
206
  """
209
- # pylint: disable=invalid-name
210
207
 
211
208
  # Return False if cfg_status argument is False
212
209
  if not cfg_status:
@@ -250,7 +247,6 @@ def nc_unlock(
250
247
  If the `cfg_status` argument is set to False, the function will immediately return False without
251
248
  performing any operations, in order to skip the NETCONF unlock operation.
252
249
  """
253
- # pylint: disable=invalid-name
254
250
 
255
251
  # Return False if cfg_status argument is False
256
252
  if not cfg_status:
@@ -282,7 +278,6 @@ def nc_discard(nr: Nornir, cfg_status: bool = False, verbose: bool = False) -> b
282
278
  argument is set to True, the function will immediately return True without performing any operations,
283
279
  as no NETCONF discard is needed.
284
280
  """
285
- # pylint: disable=invalid-name
286
281
 
287
282
  # Return True if cfg_status argument is True
288
283
  if cfg_status:
@@ -39,7 +39,6 @@ def nr_testsprocessor(nr: Nornir, name: str, inv_key: str, role: str = None, tag
39
39
  that all filtered hosts have access to all files or the TestsProcessor task will fail.
40
40
  The test suite yaml file supports all NornirSalt TestsProcessor values including Jinja2 host templating.
41
41
  """
42
- # pylint: disable=invalid-name
43
42
 
44
43
  task_text = f"NORNIR prepare TestsProcessor '{name}'"
45
44
  print_task_name(task_text)
@@ -78,7 +77,7 @@ def nr_testsprocessor(nr: Nornir, name: str, inv_key: str, role: str = None, tag
78
77
  # Collect output from the devices using scrapli send_commands task plugin
79
78
  try:
80
79
  results = nr_with_testsprocessor.run(task=scrapli_send_commands, on_failed=True)
81
- except ValueError: # pylint: disable=broad-except
80
+ except ValueError:
82
81
  print(task_info(text=task_text, changed=False))
83
82
  print(f"'{task_text}' -> NornirResponse <Success: True>")
84
83
  print("-> Test files have no tests or are empty")
@@ -143,7 +142,7 @@ def print_testsprocessor_results(nr_result: AggregatedResult, name: str) -> None
143
142
  )
144
143
  # Print the TestProcessor result as beautifultable
145
144
  print(f"\n{table}")
146
- except: # pylint: disable=bare-except
145
+ except: # noqa: E722
147
146
  # Print the Nornir result to stdout
148
147
  print_result(multiresult)
149
148
 
@@ -36,7 +36,6 @@ def pyats_create_testbed(nr: Nornir, pyats_testbed_file: str) -> None:
36
36
  This function create a pyATS testbed from a nornir inventory. The nornir object can be the whole inventory
37
37
  or a filtered subset.
38
38
  """
39
- # pylint: disable=invalid-name
40
39
 
41
40
  # Create a empty dictionary to populate with every nornir host details
42
41
  pyats_testbed = {}
@@ -159,7 +158,6 @@ def pyats_update_golden_cleanup(
159
158
  This function is used to verify if a new golden config can be created based on the cfg_status boolian.
160
159
  If veriy_status is True a new golden config will be created and the list of artifact files can be deleted.
161
160
  """
162
- # pylint: disable=invalid-name
163
161
 
164
162
  # Verify status of the config results
165
163
  print_task_title("Verify network from code config status")
@@ -22,9 +22,7 @@ from nornir_collection.utils import print_result
22
22
  #### Helper Functions ########################################################################################
23
23
 
24
24
 
25
- def rc_cisco_operation_rpc( # pylint: disable=dangerous-default-value
26
- task_obj: Task, rpc: str, payload: dict = {}
27
- ) -> requests.Response:
25
+ def rc_cisco_operation_rpc(task_obj: Task, rpc: str, payload: dict = {}) -> requests.Response:
28
26
  """
29
27
  TBD
30
28
  """
@@ -349,7 +347,6 @@ def rc_cisco_rpc_is_syncing(nr: Nornir, cfg_status: bool = True, verbose: bool =
349
347
  datastore sync state on a Cisco device with RESTCONF. Its a Cisco specific RPC that is sent to the device.
350
348
  The result will be printed to std-out in custom Nornir style.
351
349
  """
352
- # pylint: disable=invalid-name
353
350
 
354
351
  # Return False if cfg_status argument is False
355
352
  if not cfg_status:
@@ -377,7 +374,6 @@ def rc_cisco_rpc_save_config(nr: Nornir, cfg_status: bool = True, verbose: bool
377
374
  printed to std-out in Nornir style and the function return True or False depending wheather the task was
378
375
  successful.
379
376
  """
380
- # pylint: disable=invalid-name
381
377
 
382
378
  # Return False if cfg_status argument is False
383
379
  if not cfg_status:
@@ -406,7 +402,6 @@ def rc_cisco_rpc_copy_file(
406
402
  device with RESTCONF. Its a Cisco specific RPC that is sent to the device. The result will be printed to
407
403
  std-out in Nornir style and the function return True or False depending wheather the task was successful.
408
404
  """
409
- # pylint: disable=invalid-name
410
405
 
411
406
  # Set a custom task name if the argument name is not None
412
407
  name = name if name else "RESTCONF copy file"
@@ -441,7 +436,6 @@ def rc_cisco_rpc_rollback_config(
441
436
  the device. The result will be printed to std-out in custom Nornir style and the function return True or
442
437
  False depending wheather the task was successful.
443
438
  """
444
- # pylint: disable=invalid-name
445
439
 
446
440
  # Set a custom task name if the argument name is not None
447
441
  name = name if name else "RESTCONF rollback config"
@@ -470,7 +464,6 @@ def rc_software_install_one_shot(nr: Nornir, issu: bool = False, verbose: bool =
470
464
  software version. The result will be printed to std-out in custom Nornir style and the script terminates
471
465
  with an info message in case of an error.
472
466
  """
473
- # pylint: disable=invalid-name
474
467
 
475
468
  # Run the custom Nornir task rc_software_install_one_shot_task
476
469
  task_result = nr.run(
@@ -494,7 +487,6 @@ def rc_install_remove_inactive(nr: Nornir, verbose: bool = False) -> bool:
494
487
  packages and files on the filesystem with RESTCONF. The result will be printed to std-out in custom Nornir
495
488
  style and the script terminates with an info message in case of an error.
496
489
  """
497
- # pylint: disable=invalid-name
498
490
 
499
491
  # Run the custom Nornir task rc_install_remove_inactive_task
500
492
  task_result = nr.run(
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
  """
3
- This module contains complete RESTCONF configuration workflows from multiple dsc_nornir functions.
3
+ This module contains complete RESTCONF configuration workflows from multiple nornir_collection functions.
4
4
 
5
5
  The functions are ordered as followed:
6
6
  - Complete RESTCONF configuration workflows
@@ -30,7 +30,6 @@ def rc_replace_config(
30
30
  This function replaces the current configuration with the golden-config by default or the day0-config
31
31
  if the rebuild argument is set to True. It returns True if the operation was successful, otherwise False.
32
32
  """
33
- # pylint: disable=invalid-name
34
33
 
35
34
  # Return False if cfg_status argument is False
36
35
  if not cfg_status:
@@ -67,7 +66,6 @@ def rc_update_golden_config(nr: Nornir, verbose: bool = False) -> None:
67
66
  3. Saves the current running configuration as the new golden configuration to the local device flash.
68
67
  4. Exits the script if the configuration update fails.
69
68
  """
70
- # pylint: disable=invalid-name
71
69
 
72
70
  # Update golden config
73
71
  task_text = "RESTCONF update golden-config"
@@ -117,9 +117,9 @@ def rc_verify_current_software_version_task(task: Task, verbose=False) -> Result
117
117
  current_version = response.json()["Cisco-IOS-XE-install-oper:install-location-information"][0][
118
118
  "install-version-state-info"
119
119
  ][0]["version"]
120
- except: # pylint: disable=bare-except
120
+ except: # noqa: E722
121
121
  # Define the result as iosxe_c9200 is not implemented yet
122
- custom_result = f"'{task.name}' -> NornirResponse: <Success: False>\n" f"\n{traceback.format_exc()}"
122
+ custom_result = f"'{task.name}' -> NornirResponse: <Success: False>\n\n{traceback.format_exc()}"
123
123
  # Return the custom Nornir result as success
124
124
  return Result(host=task.host, custom_result=custom_result, failed=True, use_fallback=True)
125
125
 
@@ -183,7 +183,6 @@ def rc_verify_current_software_version_fallback_cli(nr: Nornir, verbose=False) -
183
183
  """
184
184
  TBD
185
185
  """
186
- # pylint: disable=invalid-name
187
186
 
188
187
  # Get software version with RESTCONF
189
188
  rc_task_result = nr.run(
@@ -243,7 +242,6 @@ def rc_software_install_one_shot_fallback_cli(nr: Nornir, issu: bool = False, ve
243
242
  """
244
243
  TBD
245
244
  """
246
- # pylint: disable=invalid-name
247
245
 
248
246
  # Run the custom Nornir task rc_software_install_one_shot_task
249
247
  rc_task_result = nr.run(
@@ -288,7 +286,6 @@ def rc_install_remove_inactive_fallback_cli(nr: Nornir, verbose: bool = False) -
288
286
  """
289
287
  TBD
290
288
  """
291
- # pylint: disable=invalid-name
292
289
 
293
290
  # Run the custom Nornir task rc_install_remove_inactive_task
294
291
  rc_task_result = nr.run(
@@ -88,7 +88,6 @@ def index_of_first_number(string: str) -> int:
88
88
  """
89
89
  Return the index of the first number in a string
90
90
  """
91
- # pylint: disable=invalid-name
92
91
 
93
92
  for i, c in enumerate(string):
94
93
  if c.isdigit():
@@ -182,8 +181,6 @@ def create_single_interface_list(interface: str) -> list:
182
181
  Gi1/0/1 - 10 -> GigabitEthernet1/0/1, GigabitEthernet1/0/2, etc.
183
182
  Gi1/0/1 - Gi1/0/10 -> GigabitEthernet1/0/1, GigabitEthernet1/0/2, etc.
184
183
  """
185
- # pylint: disable=redefined-argument-from-local
186
-
187
184
  # Define a list to return at the end of the function
188
185
  single_interface_list = []
189
186
 
@@ -425,7 +422,7 @@ def init_args_for_netconf_cm() -> argparse.Namespace:
425
422
  #### Nornir Result Helper Functions #########################################################################
426
423
 
427
424
 
428
- def set_restconf_result( # pylint: disable=too-many-arguments
425
+ def set_restconf_result(
429
426
  task: Task,
430
427
  task_text: str,
431
428
  yang_query: str,
@@ -4,7 +4,6 @@ This module updates the software version on Cisco IOS-XE devices with Nornir.
4
4
  The Main function is intended to import and execute by other scripts.
5
5
  """
6
6
 
7
-
8
7
  import argparse
9
8
  from nornir.core import Nornir
10
9
  from nornir_collection.nornir_plugins.inventory.utils import init_nornir
@@ -48,7 +47,6 @@ def copy_software(nr: Nornir, args: bool) -> None:
48
47
  Returns:
49
48
  None
50
49
  """
51
- # pylint: disable=invalid-name
52
50
 
53
51
  print_task_title("Verify destination software file md5 hash")
54
52
  # Verify if the destination file exists and verify the md5 hash.
@@ -155,7 +153,6 @@ def main(nr_config: str, args: argparse.Namespace) -> None:
155
153
  * Exits:
156
154
  * It exits with appropriate messages and statuses based on the success or failure of each step.
157
155
  """
158
- # pylint: disable=invalid-name
159
156
 
160
157
  #### Initialize Script and Nornir ######################################################################
161
158