1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Migrate CablePath to use two-dimensional array

This commit is contained in:
jeremystretch
2022-05-03 11:32:52 -04:00
parent c22007939b
commit 82706eb3a6
11 changed files with 183 additions and 55 deletions

View File

@ -29,6 +29,16 @@ def path_node_to_object(repr):
return ct.model_class().objects.get(pk=object_id)
def flatten_path(path):
"""
Flatten a two-dimensional array (list of lists) into a flat list.
"""
ret = []
for step in path:
ret.extend(step)
return ret
def create_cablepath(node):
"""
Create CablePaths for all paths originating from the specified node.