nornir-collection 0.0.22__py3-none-any.whl → 0.0.23__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.
- nornir_collection/cisco/configuration_management/netconf/config_tasks.py +37 -25
- {nornir_collection-0.0.22.dist-info → nornir_collection-0.0.23.dist-info}/METADATA +1 -1
- {nornir_collection-0.0.22.dist-info → nornir_collection-0.0.23.dist-info}/RECORD +6 -6
- {nornir_collection-0.0.22.dist-info → nornir_collection-0.0.23.dist-info}/LICENSE +0 -0
- {nornir_collection-0.0.22.dist-info → nornir_collection-0.0.23.dist-info}/WHEEL +0 -0
- {nornir_collection-0.0.22.dist-info → nornir_collection-0.0.23.dist-info}/top_level.txt +0 -0
@@ -413,6 +413,7 @@ def nc_edit_tpl_int_config(task: Task, tpl_startswith: str, verbose: bool = Fals
|
|
413
413
|
|
414
414
|
#### Configure each interface with the Jinja2 rendered template #########################################
|
415
415
|
|
416
|
+
j2_task_text = "Render Jinja2 NETCONF interface payload template"
|
416
417
|
# Track if the overall task has failed
|
417
418
|
task_failed = False
|
418
419
|
# The custom_result list will be filled with the result of each interface
|
@@ -426,33 +427,44 @@ def nc_edit_tpl_int_config(task: Task, tpl_startswith: str, verbose: bool = Fals
|
|
426
427
|
for interface in interfaces:
|
427
428
|
# Set the interface template name
|
428
429
|
tpl_name = interface["int_template"]
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
430
|
+
# Check if the interface template name is in the host inventory
|
431
|
+
if tpl_name in task.host:
|
432
|
+
# Set the interface template path
|
433
|
+
tpl_path = task.host[tpl_name]
|
434
|
+
|
435
|
+
# Add additional interface data for Jinja2 **kwargs
|
436
|
+
interface = add_interface_data(task=task, interface=interface)
|
437
|
+
# Extract the interface name and the interface number into a variable and add the current
|
438
|
+
# interface details for the Jinja2 **kwargs
|
439
|
+
j2_kwargs = {
|
440
|
+
"interface": {
|
441
|
+
"interface_name": extract_interface_name(interface["name"]),
|
442
|
+
"interface_number": extract_interface_number(interface["name"]),
|
443
|
+
**interface,
|
444
|
+
}
|
440
445
|
}
|
441
|
-
}
|
442
446
|
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
447
|
+
# Render the Jinja2 payload template and configure the NETCONF candidate datastore
|
448
|
+
custom_result, task_failed = netconf_configure_jinja2_rendered_payload_template(
|
449
|
+
task=task,
|
450
|
+
j2_task_text=j2_task_text,
|
451
|
+
j2_tpl_path=tpl_path,
|
452
|
+
custom_result=custom_result,
|
453
|
+
task_failed=task_failed,
|
454
|
+
info_msg=tpl_path,
|
455
|
+
verbose=verbose,
|
456
|
+
int_name=interface["name"],
|
457
|
+
j2_tpl_name=tpl_name,
|
458
|
+
j2_kwargs=j2_kwargs,
|
459
|
+
)
|
460
|
+
# Else the interface template name is not in the host inventory
|
461
|
+
else:
|
462
|
+
custom_result.append(
|
463
|
+
f"{task_result(text=j2_task_text, changed=False, level_name='ERROR', failed=True)}\n"
|
464
|
+
f"'{interface['name']} ({tpl_name})' -> NornirResponse <Success: False>\n"
|
465
|
+
f"-> Interface template '{tpl_name}' not found in the host inventory"
|
466
|
+
)
|
467
|
+
task_failed = True
|
456
468
|
|
457
469
|
# Return the Nornir NETCONF result
|
458
470
|
return Result(host=task.host, custom_result=custom_result, failed=task_failed)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: nornir-collection
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.23
|
4
4
|
Summary: Nornir-Collection contains network automation functions and complete IaC workflows with Nornir and other python libraries. It contains Nornir tasks and general functions in Nornir style.
|
5
5
|
Author: Willi Kubny
|
6
6
|
Author-email: willi.kubny@gmail.ch
|
@@ -14,7 +14,7 @@ nornir_collection/cisco/configuration_management/cli/config_tasks.py,sha256=mWXy
|
|
14
14
|
nornir_collection/cisco/configuration_management/cli/config_workflow.py,sha256=GIka5SPLZ7M2zCFv8Jadl73QC-InnGopzI8xQt36MfM,3459
|
15
15
|
nornir_collection/cisco/configuration_management/cli/show_tasks.py,sha256=w9p2Iks33-pE4-YztH6vj-eI0MuPI7YD6gZhRcpQF7M,27971
|
16
16
|
nornir_collection/cisco/configuration_management/netconf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
|
-
nornir_collection/cisco/configuration_management/netconf/config_tasks.py,sha256=
|
17
|
+
nornir_collection/cisco/configuration_management/netconf/config_tasks.py,sha256=wcrAuijvMZMe7dbGwtKzRgAlWsbxVJSup65yJda_930,22995
|
18
18
|
nornir_collection/cisco/configuration_management/netconf/config_workflow.py,sha256=qxB4DolQL2WJO9JRATzANhIwYPNuKyuN0hI9-ABzJq8,14557
|
19
19
|
nornir_collection/cisco/configuration_management/netconf/nr_cfg_iosxe_netconf.py,sha256=qKb1EeiYbCO96AE6ETaNxRrM2nCfsbX00nwcPK9ZSkc,8629
|
20
20
|
nornir_collection/cisco/configuration_management/netconf/ops_tasks.py,sha256=cj7cpJNvY2bytv9VOqwg_7qOekL-cIL0EjML2KT4TQM,10659
|
@@ -52,8 +52,8 @@ nornir_collection/nornir_plugins/inventory/staggered_yaml.py,sha256=nBvUFq7U5zVT
|
|
52
52
|
nornir_collection/nornir_plugins/inventory/utils.py,sha256=mxIlKK-4PHqCnFKn7Oozu1RW_JB5z1TgEYc-ave70nE,11822
|
53
53
|
nornir_collection/purestorage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
54
54
|
nornir_collection/purestorage/utils.py,sha256=TqU2sKz0ENnmSDEBcSvXPnVkI1DVHOogI68D7l32g7I,1730
|
55
|
-
nornir_collection-0.0.
|
56
|
-
nornir_collection-0.0.
|
57
|
-
nornir_collection-0.0.
|
58
|
-
nornir_collection-0.0.
|
59
|
-
nornir_collection-0.0.
|
55
|
+
nornir_collection-0.0.23.dist-info/LICENSE,sha256=bOPVh1OVNwz2tCjkLaChWT6AoXdtqye3aua5l0tgYJo,1068
|
56
|
+
nornir_collection-0.0.23.dist-info/METADATA,sha256=2pKMwHDmdthAjlvEixjw5ZWVqfGfHNS4NE7Nnyk_2DE,7169
|
57
|
+
nornir_collection-0.0.23.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
58
|
+
nornir_collection-0.0.23.dist-info/top_level.txt,sha256=OyCzPWABf-D0AOHm9ihrwdk5eq200BnKna6gIDspwsE,18
|
59
|
+
nornir_collection-0.0.23.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|