From a5c4a90b7b002b7b8ae7cf350e912ea426c0ff8b Mon Sep 17 00:00:00 2001 From: Andrew Cornford Date: Wed, 11 Feb 2026 17:13:57 +0000 Subject: [PATCH 1/3] Add property to get module number in vertices --- .../apps/topology/model/n_graph_elements/topology_vertex.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/videoipath_automation_tool/apps/topology/model/n_graph_elements/topology_vertex.py b/src/videoipath_automation_tool/apps/topology/model/n_graph_elements/topology_vertex.py index bb1cc65..c0ce5f0 100644 --- a/src/videoipath_automation_tool/apps/topology/model/n_graph_elements/topology_vertex.py +++ b/src/videoipath_automation_tool/apps/topology/model/n_graph_elements/topology_vertex.py @@ -119,6 +119,10 @@ def device_id(self) -> str: """ID of the corresponding base device""" return self.deviceId + @property + def module_number(self) -> int: + return int(self.id.split(".")[2]) + @property def is_virtual(self) -> bool: """Indicates if the vertex is virtual""" From 259380ad3dc0a6ac4337e35e0f681cf9bcbdb96b Mon Sep 17 00:00:00 2001 From: Andrew Cornford Date: Wed, 11 Feb 2026 17:22:23 +0000 Subject: [PATCH 2/3] Added documentation to module_number property --- .../apps/topology/model/n_graph_elements/topology_vertex.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/videoipath_automation_tool/apps/topology/model/n_graph_elements/topology_vertex.py b/src/videoipath_automation_tool/apps/topology/model/n_graph_elements/topology_vertex.py index c0ce5f0..5e87c78 100644 --- a/src/videoipath_automation_tool/apps/topology/model/n_graph_elements/topology_vertex.py +++ b/src/videoipath_automation_tool/apps/topology/model/n_graph_elements/topology_vertex.py @@ -121,6 +121,7 @@ def device_id(self) -> str: @property def module_number(self) -> int: + """Module number that this vertex is part of""" return int(self.id.split(".")[2]) @property From aa874cdd85492750b16cfd7f24c71077335c265a Mon Sep 17 00:00:00 2001 From: Andrew Cornford Date: Fri, 13 Feb 2026 10:20:14 +0000 Subject: [PATCH 3/3] Added suggested changes by @PaulWinterstein --- .../model/n_graph_elements/topology_vertex.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/videoipath_automation_tool/apps/topology/model/n_graph_elements/topology_vertex.py b/src/videoipath_automation_tool/apps/topology/model/n_graph_elements/topology_vertex.py index 5e87c78..68a9087 100644 --- a/src/videoipath_automation_tool/apps/topology/model/n_graph_elements/topology_vertex.py +++ b/src/videoipath_automation_tool/apps/topology/model/n_graph_elements/topology_vertex.py @@ -1,4 +1,4 @@ -from typing import Union +from typing import Union, Optional from pydantic import Field, field_validator @@ -120,9 +120,12 @@ def device_id(self) -> str: return self.deviceId @property - def module_number(self) -> int: - """Module number that this vertex is part of""" - return int(self.id.split(".")[2]) + def module_id(self) -> Optional[str]: + """Module identifier this vertex belongs to, or None for common vertices (e.g. SwitchingCore).""" + pid = self.gpid.pointId + if len(pid) >= 4 and pid[1] in ("dev", "virt"): + return pid[2] + return None @property def is_virtual(self) -> bool: