From 49c9db82e5a7920324c3a79dc509f4a8eef96efd Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 20 Sep 2026 10:44:36 +0700 Subject: [PATCH 1/6] refactor: make GOOSE sniffer observer-only --- apps/ied_simulator/qml/GooseWorkspace.qml | 229 ++++++---------------- 1 file changed, 57 insertions(+), 172 deletions(-) diff --git a/apps/ied_simulator/qml/GooseWorkspace.qml b/apps/ied_simulator/qml/GooseWorkspace.qml index 8dae11cf4..ec32f6bed 100644 --- a/apps/ied_simulator/qml/GooseWorkspace.qml +++ b/apps/ied_simulator/qml/GooseWorkspace.qml @@ -8,15 +8,7 @@ import ARStack.IedSimulator 1.0 Item { id: root required property var theme - required property IedFleetController simulator required property GooseMonitorController monitor - signal openSimulatorRequested() - - IedCommissioningModel { - id: publisherModel - backend: root.simulator - kindFilter: "GOOSE" - } FileDialog { id: savePcapDialog @@ -40,13 +32,13 @@ Item { Layout.fillWidth: true spacing: 2 Label { - text: "GOOSE Monitor + Publisher" + text: "GOOSE Sniffer" color: root.theme.text font.pixelSize: root.theme.titleSize font.weight: Font.DemiBold } Label { - text: "One explicit NIC · EtherType 0x88B8 · canonical publisher state · bounded live supervision" + text: "Passive Layer-2 capture · EtherType 0x88B8 · decode · supervision · bounded PCAP retention" color: root.theme.muted font.pixelSize: root.theme.captionSize } @@ -61,7 +53,7 @@ Item { border.color: root.monitor.capturing ? root.theme.green : root.theme.line Label { anchors.centerIn: parent - text: root.monitor.capturing ? "MONITOR LIVE" : "MONITOR STOPPED" + text: root.monitor.capturing ? "CAPTURE LIVE" : "STOPPED" color: root.monitor.capturing ? root.theme.green : root.theme.textSoft font.pixelSize: 9 font.weight: Font.DemiBold @@ -91,26 +83,20 @@ Item { ComboBox { id: interfaceSelector - Layout.preferredWidth: 220 + Layout.preferredWidth: 240 model: root.monitor.interfaces enabled: !root.monitor.capturing currentIndex: Math.max(0, root.monitor.interfaces.indexOf(root.monitor.interfaceName)) - onActivated: { - const selected = currentText - root.monitor.interfaceName = selected - publisherModel.gooseInterfaceName = selected - } + onActivated: root.monitor.interfaceName = currentText Component.onCompleted: { - if (root.monitor.interfaceName.length === 0 && count > 0) { + if (root.monitor.interfaceName.length === 0 && count > 0) root.monitor.interfaceName = currentText - publisherModel.gooseInterfaceName = currentText - } } } ActionButton { theme: root.theme - text: root.monitor.capturing ? "Stop Monitor" : "Start Monitor" + text: root.monitor.capturing ? "Stop Capture" : "Start Capture" primary: !root.monitor.capturing danger: root.monitor.capturing onClicked: root.monitor.capturing ? root.monitor.stopCapture() : root.monitor.startCapture() @@ -147,7 +133,7 @@ Item { Rectangle { SplitView.fillWidth: true - SplitView.minimumWidth: 560 + SplitView.minimumWidth: 620 color: root.theme.surface border.width: 1 border.color: root.theme.lineSoft @@ -161,7 +147,7 @@ Item { RowLayout { Layout.fillWidth: true Label { - text: "Live Monitor" + text: "Captured streams" color: root.theme.text font.pixelSize: root.theme.subtitleSize font.weight: Font.DemiBold @@ -172,7 +158,7 @@ Item { color: root.monitor.capturing ? root.theme.green : root.theme.muted font.pixelSize: root.theme.captionSize elide: Text.ElideRight - Layout.maximumWidth: 320 + Layout.maximumWidth: 360 } } @@ -287,7 +273,7 @@ Item { spacing: 10 ColumnLayout { - Layout.preferredWidth: 250 + Layout.preferredWidth: 270 Layout.fillHeight: true spacing: 3 Label { text: "Selected stream"; color: root.theme.text; font.pixelSize: 11; font.weight: Font.DemiBold } @@ -329,8 +315,8 @@ Item { } Rectangle { - SplitView.preferredWidth: 430 - SplitView.minimumWidth: 360 + SplitView.preferredWidth: 360 + SplitView.minimumWidth: 320 color: root.theme.surface border.width: 1 border.color: root.theme.lineSoft @@ -341,174 +327,73 @@ Item { anchors.margins: 8 spacing: 8 - RowLayout { - Layout.fillWidth: true - Label { - text: "Publisher" - color: root.theme.text - font.pixelSize: root.theme.subtitleSize - font.weight: Font.DemiBold - } - Item { Layout.fillWidth: true } - Label { - text: publisherModel.goosePublisherCount + " active" - color: publisherModel.goosePublishing ? root.theme.green : root.theme.muted - font.pixelSize: root.theme.captionSize - } - } - Label { - Layout.fillWidth: true - visible: !root.simulator.imported - text: "Load an SCL/CID/SCD in Simulator to expose configured GSEControl publishers. Monitoring remains independent and can run without a simulator model." - wrapMode: Text.WordWrap - color: root.theme.muted - font.pixelSize: root.theme.captionSize + text: "Capture diagnostics" + color: root.theme.text + font.pixelSize: root.theme.subtitleSize + font.weight: Font.DemiBold } - ListView { - id: publisherList + GridLayout { Layout.fillWidth: true - Layout.preferredHeight: Math.min(190, contentHeight) - Layout.minimumHeight: root.simulator.imported ? 72 : 0 - clip: true - reuseItems: true - cacheBuffer: 0 - model: publisherModel.itemCount - delegate: Rectangle { - required property int index - property var itemData: { - publisherModel.revision - return publisherModel.item(index) - } - width: publisherList.width - height: 54 - radius: 5 - color: itemData.selected ? root.theme.accentSoft : root.theme.chrome - border.width: itemData.selected ? 1 : 0 - border.color: root.theme.accent - ColumnLayout { - anchors.fill: parent - anchors.margins: 7 - spacing: 1 - Label { Layout.fillWidth: true; text: itemData.reference || itemData.name || "GOOSE"; color: root.theme.text; font.pixelSize: 10; font.weight: Font.DemiBold; elide: Text.ElideMiddle } - Label { Layout.fillWidth: true; text: (itemData.appId || "APPID —") + " · " + (itemData.mac || "MAC —") + " · " + (itemData.memberCount || 0) + " members"; color: root.theme.muted; font.pixelSize: 9; elide: Text.ElideRight } - } - MouseArea { anchors.fill: parent; onClicked: publisherModel.select(index) } - } + columns: 2 + columnSpacing: 10 + rowSpacing: 4 + Label { text: "Decode errors"; color: root.theme.muted; font.pixelSize: 9 } + Label { text: String(root.monitor.decodeErrorCount); color: root.theme.textSoft; font.pixelSize: 9; Layout.alignment: Qt.AlignRight } + Label { text: "Rejected frames"; color: root.theme.muted; font.pixelSize: 9 } + Label { text: String(root.monitor.rejectedFrameCount); color: root.theme.textSoft; font.pixelSize: 9; Layout.alignment: Qt.AlignRight } + Label { text: "Dropped streams"; color: root.theme.muted; font.pixelSize: 9 } + Label { text: String(root.monitor.droppedStreamCount); color: root.theme.textSoft; font.pixelSize: 9; Layout.alignment: Qt.AlignRight } + Label { text: "Duplicates"; color: root.theme.muted; font.pixelSize: 9 } + Label { text: String(root.monitor.duplicateCount); color: root.theme.textSoft; font.pixelSize: 9; Layout.alignment: Qt.AlignRight } + Label { text: "Retained PCAP"; color: root.theme.muted; font.pixelSize: 9 } + Label { text: root.monitor.retainedPacketCount + "/" + root.monitor.retainedPacketCapacity; color: root.theme.textSoft; font.pixelSize: 9; Layout.alignment: Qt.AlignRight } } - Rectangle { - Layout.fillWidth: true - Layout.preferredHeight: 112 - radius: 6 - color: root.theme.chrome - border.width: 1 - border.color: root.theme.lineSoft - ColumnLayout { - anchors.fill: parent - anchors.margins: 8 - spacing: 3 - Label { text: publisherModel.selectedItem.goId || "No GOOSE publisher selected"; color: root.theme.text; font.pixelSize: 11; font.weight: Font.DemiBold; elide: Text.ElideMiddle; Layout.fillWidth: true } - Label { text: publisherModel.selectedItem.dataSetReference || "—"; color: root.theme.textSoft; font.pixelSize: 9; elide: Text.ElideMiddle; Layout.fillWidth: true } - Label { text: "ConfRev " + (publisherModel.selectedItem.confRev || "—") + " · Min/Max " + (publisherModel.selectedItem.minTimeMs || "—") + "/" + (publisherModel.selectedItem.maxTimeMs || "—") + " ms"; color: root.theme.muted; font.pixelSize: 9 } - Label { text: publisherModel.goosePublicationStatus; color: publisherModel.goosePublishing ? root.theme.green : root.theme.muted; font.pixelSize: 9; elide: Text.ElideRight; Layout.fillWidth: true } - Label { text: "TX " + publisherModel.gooseTransmitCount + " · state changes " + publisherModel.gooseStateChangeCount + " · stNum " + (publisherModel.selectedGooseRuntime.stNum || "—"); color: root.theme.muted; font.pixelSize: 9 } - } - } - - RowLayout { - Layout.fillWidth: true - spacing: 6 - ActionButton { - theme: root.theme - text: publisherModel.selectedGooseRuntime.active ? "Stop Publisher" : "Start Publisher" - primary: !publisherModel.selectedGooseRuntime.active - danger: publisherModel.selectedGooseRuntime.active - enabled: root.simulator.imported && publisherModel.itemCount > 0 - onClicked: publisherModel.selectedGooseRuntime.active - ? publisherModel.stopSelectedGoosePublication() - : publisherModel.startSelectedGoosePublication() - } - ActionButton { - theme: root.theme - text: "Edit Source Value" - enabled: publisherModel.firstDrivableMember() >= 0 - onClicked: { - const row = publisherModel.firstDrivableMember() - if (row >= 0 && publisherModel.focusMemberValue(row)) root.openSimulatorRequested() - } - } - } + Rectangle { Layout.fillWidth: true; height: 1; color: root.theme.lineSoft } Label { - Layout.fillWidth: true - text: "Publisher stimulus always edits the canonical Simulator point store. This workspace does not maintain a GOOSE-only value copy." - wrapMode: Text.WordWrap - color: root.theme.muted - font.pixelSize: 9 - } - - Rectangle { - Layout.fillWidth: true - height: 1 - color: root.theme.lineSoft + text: "Recent events" + color: root.theme.text + font.pixelSize: 11 + font.weight: Font.DemiBold } - Label { text: "Configured DataSet members"; color: root.theme.text; font.pixelSize: 11; font.weight: Font.DemiBold } ListView { + id: eventList Layout.fillWidth: true Layout.fillHeight: true clip: true reuseItems: true cacheBuffer: 0 - model: publisherModel.memberCount - delegate: Rectangle { - required property int index - property var memberData: { - publisherModel.revision - return publisherModel.member(index) - } - width: ListView.view.width - height: 40 - color: "transparent" - ColumnLayout { - anchors.fill: parent - spacing: 0 - Label { Layout.fillWidth: true; text: memberData.reference || memberData.mmsItem || "—"; color: root.theme.textSoft; font.pixelSize: 9; elide: Text.ElideMiddle } - Label { Layout.fillWidth: true; text: (memberData.fc || "—") + " · " + (memberData.type || memberData.cdc || "—"); color: root.theme.muted; font.pixelSize: 8; elide: Text.ElideRight } - } - MouseArea { - anchors.fill: parent - onDoubleClicked: { - if (publisherModel.focusMemberValue(index)) root.openSimulatorRequested() - } - } - } - } + model: root.monitor.recentEvents - Rectangle { - Layout.fillWidth: true - Layout.preferredHeight: 78 - radius: 5 - color: root.theme.navigationDark - ColumnLayout { - anchors.fill: parent - anchors.margins: 7 - spacing: 2 - Label { text: "Monitor events (bounded " + root.monitor.eventCapacity + ")"; color: root.theme.navigationText; font.pixelSize: 9; font.weight: Font.DemiBold } + delegate: Rectangle { + width: eventList.width + height: eventText.implicitHeight + 12 + color: index % 2 ? root.theme.chrome : "transparent" Label { - Layout.fillWidth: true - Layout.fillHeight: true - text: root.monitor.recentEvents.length ? root.monitor.recentEvents[root.monitor.recentEvents.length - 1] : "No events" - color: root.theme.navigationMuted + id: eventText + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: 6 + text: modelData + color: root.theme.textSoft font.pixelSize: 8 wrapMode: Text.Wrap - maximumLineCount: 3 - elide: Text.ElideRight } } } + + Label { + Layout.fillWidth: true + text: "Sniffer is passive. GOOSE publication and stimulation belong to IED Simulator commissioning." + color: root.theme.muted + font.pixelSize: 8 + wrapMode: Text.WordWrap + } } } } From b25fc4bb62165d71ac9294fdb5b6b4a5c57c437a Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 20 Sep 2026 10:44:40 +0700 Subject: [PATCH 2/6] refactor: keep Sniffer independent from Simulator publishing --- apps/ied_simulator/qml/SnifferWorkspace.qml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/apps/ied_simulator/qml/SnifferWorkspace.qml b/apps/ied_simulator/qml/SnifferWorkspace.qml index d09773f23..a7c9b2e52 100644 --- a/apps/ied_simulator/qml/SnifferWorkspace.qml +++ b/apps/ied_simulator/qml/SnifferWorkspace.qml @@ -5,16 +5,11 @@ import ARStack.IedSimulator 1.0 Item { id: root required property var theme - required property IedFleetController simulator required property GooseMonitorController monitor - signal openSimulatorRequested() - GooseWorkspace { anchors.fill: parent theme: root.theme - simulator: root.simulator monitor: root.monitor - onOpenSimulatorRequested: root.openSimulatorRequested() } } From b5ac06b5dc443edfda015927037c1f6623fc5c63 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 20 Sep 2026 10:44:52 +0700 Subject: [PATCH 3/6] refactor: remove Simulator ownership from Sniffer shell --- apps/ied_simulator/qml/Main.qml | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/ied_simulator/qml/Main.qml b/apps/ied_simulator/qml/Main.qml index 31d72cd90..bab8d4a8d 100644 --- a/apps/ied_simulator/qml/Main.qml +++ b/apps/ied_simulator/qml/Main.qml @@ -312,9 +312,7 @@ ApplicationWindow { SnifferWorkspace { theme: appTheme - simulator: simulator monitor: gooseMonitor - onOpenSimulatorRequested: root.workspaceIndex = 2 } } } From e3b465ec8d98c34f1ff943a273c7a255e0c441bc Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 20 Sep 2026 10:45:05 +0700 Subject: [PATCH 4/6] test: lock Sniffer and Simulator GOOSE ownership --- apps/ied_simulator/test_sniffer_ownership.py | 76 ++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 apps/ied_simulator/test_sniffer_ownership.py diff --git a/apps/ied_simulator/test_sniffer_ownership.py b/apps/ied_simulator/test_sniffer_ownership.py new file mode 100644 index 000000000..9458e4d73 --- /dev/null +++ b/apps/ied_simulator/test_sniffer_ownership.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +"""P3 ownership guard for Sniffer vs Simulator GOOSE responsibilities.""" + +from pathlib import Path +import sys + + +def fail(message: str) -> None: + print(f"SNIFFER_OWNERSHIP_FAIL {message}", file=sys.stderr) + raise SystemExit(1) + + +def require(text: str, needle: str, label: str) -> None: + if needle not in text: + fail(f"{label} missing required token: {needle}") + + +def forbid(text: str, needle: str, label: str) -> None: + if needle in text: + fail(f"{label} contains forbidden token: {needle}") + + +def main() -> int: + if len(sys.argv) != 4: + print( + "usage: test_sniffer_ownership.py ", + file=sys.stderr, + ) + return 2 + + sniffer_path, goose_path, commissioning_path = map(Path, sys.argv[1:]) + sniffer = sniffer_path.read_text(encoding="utf-8") + goose = goose_path.read_text(encoding="utf-8") + commissioning = commissioning_path.read_text(encoding="utf-8") + + # Sniffer is passive observation only. It must not depend on the Simulator + # backend or gain access to the GOOSE publisher runtime. + for token in ( + "IedFleetController simulator", + "IedCommissioningModel", + "publisherModel", + "startSelectedGoosePublication", + "stopSelectedGoosePublication", + "stopAllGoosePublication", + "openSimulatorRequested", + ): + forbid(sniffer, token, "SnifferWorkspace") + forbid(goose, token, "GooseWorkspace") + + require(sniffer, "GooseMonitorController monitor", "SnifferWorkspace") + require(goose, "GooseMonitorController monitor", "GooseWorkspace") + require(goose, "root.monitor.startCapture()", "GooseWorkspace") + require(goose, "root.monitor.stopCapture()", "GooseWorkspace") + require(goose, "root.monitor.exportPcap(selectedFile)", "GooseWorkspace") + require(goose, 'text: "GOOSE Sniffer"', "GooseWorkspace") + require( + goose, + "GOOSE publication and stimulation belong to IED Simulator commissioning.", + "GooseWorkspace", + ) + + # Publisher/stimulation remains explicitly owned by Simulator commissioning. + require(commissioning, "startSelectedGoosePublication()", "CommissioningWorkspace") + require(commissioning, "stopSelectedGoosePublication()", "CommissioningWorkspace") + require(commissioning, 'kindFilter: "GOOSE"', "CommissioningWorkspace") + + print( + "SNIFFER_OWNERSHIP_PASS " + "sniffer=passive goose_capture=true pcap=true " + "publisher=simulator_commissioning mms_sniffer=false" + ) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) From 68469dcde7ac1d88aaa36b5c0c1e10c4ba161d11 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 20 Sep 2026 10:45:18 +0700 Subject: [PATCH 5/6] ci: gate passive Sniffer ownership --- .github/workflows/ied-simulator-qt.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ied-simulator-qt.yml b/.github/workflows/ied-simulator-qt.yml index 160ae08c8..69db59ed1 100644 --- a/.github/workflows/ied-simulator-qt.yml +++ b/.github/workflows/ied-simulator-qt.yml @@ -188,11 +188,18 @@ jobs: ./tests/fixtures/scl/minimal-station-brcb.scd ./goose-publication-evidence.pcap - - name: GOOSE monitor + publisher workspace gates + - name: GOOSE Sniffer decode and supervision gates run: >- ./build-ied-simulator-qt/ied_goose_workspace_qa ./goose-publication-evidence.pcap + - name: Sniffer versus Simulator ownership policy + run: >- + python3 apps/ied_simulator/test_sniffer_ownership.py + apps/ied_simulator/qml/SnifferWorkspace.qml + apps/ied_simulator/qml/GooseWorkspace.qml + apps/ied_simulator/qml/CommissioningWorkspace.qml + - name: Upload GOOSE wire evidence uses: actions/upload-artifact@v4 with: From 21a6ce2cf2683a6f74e8c35d7d4a3edee2cd3a0f Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 20 Sep 2026 10:45:37 +0700 Subject: [PATCH 6/6] fix: align Sniffer ownership guard with Simulator filter UI --- apps/ied_simulator/test_sniffer_ownership.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/ied_simulator/test_sniffer_ownership.py b/apps/ied_simulator/test_sniffer_ownership.py index 9458e4d73..66429fc94 100644 --- a/apps/ied_simulator/test_sniffer_ownership.py +++ b/apps/ied_simulator/test_sniffer_ownership.py @@ -62,7 +62,8 @@ def main() -> int: # Publisher/stimulation remains explicitly owned by Simulator commissioning. require(commissioning, "startSelectedGoosePublication()", "CommissioningWorkspace") require(commissioning, "stopSelectedGoosePublication()", "CommissioningWorkspace") - require(commissioning, 'kindFilter: "GOOSE"', "CommissioningWorkspace") + require(commissioning, '"GOOSE"', "CommissioningWorkspace") + require(commissioning, "commissioningModel.kindFilter = currentText", "CommissioningWorkspace") print( "SNIFFER_OWNERSHIP_PASS "