aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHåkon Solbjørg <hakon@solbj.org>2023-02-23 19:04:31 +0100
committerHåkon Solbjørg <hakon@solbj.org>2023-02-23 19:04:31 +0100
commit01ce44904bdec7ec1c1d3cadcfd1e26c5d083d21 (patch)
tree446ef109e5644fd3bc962623573b55fb49db0b4e
parentee9d93f1d31d259c0e2502894051c03eea3f553a (diff)
fix(koblingsplan): Move extra info about interface from if name
-rw-r--r--tools/koblingsplan/script.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/koblingsplan/script.py b/tools/koblingsplan/script.py
index 7fa12b6..20396bc 100644
--- a/tools/koblingsplan/script.py
+++ b/tools/koblingsplan/script.py
@@ -42,6 +42,16 @@ with open('tg23-koblingsplan.csv', newline='') as csvfile:
current_iteration['b_interface'] = row[8].strip() if len(row[8].strip()) > 0 else prev_iteration['b_interface']
current_iteration['b_ae'] = row[9] if len(row[9].strip()) > 0 else prev_iteration['b_ae']
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]
+ if (if_data := current_iteration['b_interface'].split(" ")) and len(if_data) > 1:
+ current_iteration['b_interface_description'] = " ".join(if_data[1:])
+ current_iteration['b_interface'] = if_data[0]
+
dataset.append(current_iteration)
print(yaml.dump(dataset, default_flow_style=False, sort_keys=False))