aboutsummaryrefslogtreecommitdiffstats
path: root/tools/koblingsplan/script.py
diff options
context:
space:
mode:
authorHåkon Solbjørg <hakon@solbj.org>2023-02-23 20:26:23 +0100
committerHåkon Solbjørg <hakon@solbj.org>2023-02-23 21:46:35 +0100
commit2ede2da02763747dd33a781863217b9371737652 (patch)
treee3e62b8cd64203100852875988c178ff49aa9a7d /tools/koblingsplan/script.py
parentbc65590ae96ae5c73a0fd577f71a1340fcc71440 (diff)
feat(netbox): Script to import koblingsplan to netboxkoblingsplan
Diffstat (limited to 'tools/koblingsplan/script.py')
-rw-r--r--tools/koblingsplan/script.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/koblingsplan/script.py b/tools/koblingsplan/script.py
index 755d9bf..e296eae 100644
--- a/tools/koblingsplan/script.py
+++ b/tools/koblingsplan/script.py
@@ -50,7 +50,6 @@ with open('tg23-koblingsplan.csv', newline='') as csvfile:
current_iteration['cable_type'] = row[10] if len(row[10].strip()) > 0 else prev_iteration['cable_type']
# strip trailing data from interface sections and put it in a description field
- extra_info = ""
if (if_data := current_iteration['a']['interface'].split(" ")) and len(if_data) > 1:
current_iteration['a']['interface_description'] = " ".join(if_data[1:])
current_iteration['a']['interface'] = if_data[0]
@@ -58,6 +57,14 @@ with open('tg23-koblingsplan.csv', newline='') as csvfile:
current_iteration['b']['interface_description'] = " ".join(if_data[1:])
current_iteration['b']['interface'] = if_data[0]
+ # strip trailing data from node sections and put it in a description field
+ if (if_data := current_iteration['a']['node'].split(" ")) and len(if_data) > 1:
+ current_iteration['a']['node_description'] = " ".join(if_data[1:])
+ current_iteration['a']['node'] = if_data[0]
+ if (if_data := current_iteration['b']['node'].split(" ")) and len(if_data) > 1:
+ current_iteration['b']['node_description'] = " ".join(if_data[1:])
+ current_iteration['b']['node'] = if_data[0]
+
dataset.append(current_iteration)
with open('tg23-koblingsplan.yml', 'w') as f: