nornir-collection 0.0.20__py3-none-any.whl → 0.0.21__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 +17 -16
- {nornir_collection-0.0.20.dist-info → nornir_collection-0.0.21.dist-info}/METADATA +1 -1
- {nornir_collection-0.0.20.dist-info → nornir_collection-0.0.21.dist-info}/RECORD +6 -6
- {nornir_collection-0.0.20.dist-info → nornir_collection-0.0.21.dist-info}/LICENSE +0 -0
- {nornir_collection-0.0.20.dist-info → nornir_collection-0.0.21.dist-info}/WHEEL +0 -0
- {nornir_collection-0.0.20.dist-info → nornir_collection-0.0.21.dist-info}/top_level.txt +0 -0
@@ -236,22 +236,23 @@ def nc_edit_cleanup_portchannel(task: Task, verbose: bool = False) -> Result:
|
|
236
236
|
|
237
237
|
# Create a empty list to add all current configured Port-channels and their associated interfaces
|
238
238
|
current_po = {}
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
for
|
244
|
-
|
245
|
-
if i
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
239
|
+
if "Port-channel" in response["json"]["Cisco-IOS-XE-native:interface"]:
|
240
|
+
# Loop through all Port-channels and add them and their associated interfaces as a list to the dict
|
241
|
+
for po in response["json"]["Cisco-IOS-XE-native:interface"]["Port-channel"]:
|
242
|
+
current_po[po["name"]] = []
|
243
|
+
for i_name, i_detail in response["json"]["Cisco-IOS-XE-native:interface"].items():
|
244
|
+
for i in i_detail:
|
245
|
+
if i.get("Cisco-IOS-XE-ethernet:channel-group"):
|
246
|
+
if i["Cisco-IOS-XE-ethernet:channel-group"]["number"] == po["name"]:
|
247
|
+
current_po[po["name"]].append({"name": i_name, "number": i["name"]})
|
248
|
+
|
249
|
+
# Exclude NoneType or empty string interface template names
|
250
|
+
# Select only the interface name and convert it to lowercase
|
251
|
+
ifaces = [i["name"].lower() for i in task.host["interfaces"] if i["int_template"]]
|
252
|
+
# Include interfaces name starts with 'port-channel' and replace to only have the Port-channel number
|
253
|
+
inventory_po = [int(i.replace("port-channel", "")) for i in ifaces if i.startswith("port-channel")]
|
254
|
+
# Create a dict with all configured Port-channel which are not part of the inventoryp
|
255
|
+
remove_po = {k: v for k, v in current_po.items() if k not in inventory_po}
|
255
256
|
|
256
257
|
# If there are no Port-channel to remove, return the Nornir result
|
257
258
|
if not remove_po:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: nornir-collection
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.21
|
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=kdnBYqI9YGCUisybRCzrK7TLpvO1EkQLTW-On_NkrXE,22248
|
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.21.dist-info/LICENSE,sha256=bOPVh1OVNwz2tCjkLaChWT6AoXdtqye3aua5l0tgYJo,1068
|
56
|
+
nornir_collection-0.0.21.dist-info/METADATA,sha256=4jxaac2fRsbrJrqlc_qA7lFzhPp-HQrbf9X66lmHmy0,7169
|
57
|
+
nornir_collection-0.0.21.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
58
|
+
nornir_collection-0.0.21.dist-info/top_level.txt,sha256=OyCzPWABf-D0AOHm9ihrwdk5eq200BnKna6gIDspwsE,18
|
59
|
+
nornir_collection-0.0.21.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|