Skip to content

Conversation

esmith1729
Copy link
Contributor

Initial commit and skeletal structure of files needed for OPC UA lewis emulator.

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

from ..lewis_versions import LEWIS_LATEST
from .device import SimulatedFinsPLC

framework_version = LEWIS_LATEST

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'framework_version' is not used.

Copilot Autofix

AI 4 months ago

To fix the issue, we need to either:

  1. Rename the variable to indicate that it is intentionally unused (e.g., _unused_framework_version), or
  2. Remove the assignment entirely if it is not needed.

Since there is no indication that the variable is intentionally unused or required for documentation purposes, the best approach is to remove the assignment entirely. This ensures the code remains clean and avoids confusion about the purpose of the variable.


Suggested changeset 1
lewis_emulators/opcua/__init__.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/lewis_emulators/opcua/__init__.py b/lewis_emulators/opcua/__init__.py
--- a/lewis_emulators/opcua/__init__.py
+++ b/lewis_emulators/opcua/__init__.py
@@ -3,3 +3,3 @@
 
-framework_version = LEWIS_LATEST
+
 __all__ = ["SimulatedFinsPLC"]
EOF
@@ -3,3 +3,3 @@

framework_version = LEWIS_LATEST

__all__ = ["SimulatedFinsPLC"]
Copilot is powered by AI and may make mistakes. Always verify output.
from collections import OrderedDict

from lewis.devices import StateMachineDevice
from lewis.core.statemachine import State

Check notice

Code scanning / CodeQL

Unused import Note

Import of 'State' is not used.

Copilot Autofix

AI 4 months ago

To fix the problem, we will remove the unused import statement from lewis.core.statemachine import State on line 4. This will eliminate the unnecessary dependency and improve code readability. No other changes are required, as the removal of this import does not affect the functionality of the code.

Suggested changeset 1
lewis_emulators/opcua/device.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/lewis_emulators/opcua/device.py b/lewis_emulators/opcua/device.py
--- a/lewis_emulators/opcua/device.py
+++ b/lewis_emulators/opcua/device.py
@@ -3,3 +3,3 @@
 from lewis.devices import StateMachineDevice
-from lewis.core.statemachine import State
+
 
EOF
@@ -3,3 +3,3 @@
from lewis.devices import StateMachineDevice
from lewis.core.statemachine import State


Copilot is powered by AI and may make mistakes. Always verify output.
from lewis.devices import StateMachineDevice
from lewis.core.statemachine import State

from .states import DefaultState

Check notice

Code scanning / CodeQL

Unused import Note

Import of 'DefaultState' is not used.

Copilot Autofix

AI 4 months ago

To fix the problem, we will remove the unused import statement from .states import DefaultState from the file lewis_emulators/opcua/device.py. This will clean up the code and eliminate the unnecessary dependency.

Suggested changeset 1
lewis_emulators/opcua/device.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/lewis_emulators/opcua/device.py b/lewis_emulators/opcua/device.py
--- a/lewis_emulators/opcua/device.py
+++ b/lewis_emulators/opcua/device.py
@@ -5,3 +5,3 @@
 
-from .states import DefaultState
+
 
EOF
@@ -5,3 +5,3 @@

from .states import DefaultState


Copilot is powered by AI and may make mistakes. Always verify output.
@@ -0,0 +1,54 @@
from lewis.adapters import opcua

Check notice

Code scanning / CodeQL

Unused import Note

Import of 'opcua' is not used.

Copilot Autofix

AI 4 months ago

To fix the issue, the unused import statement from lewis.adapters import opcua on line 1 should be removed. This will eliminate the unnecessary dependency and improve the clarity of the code. No other changes are required, as the removal of this import does not affect the functionality of the program.

Suggested changeset 1
lewis_emulators/opcua/interfaces/opcua_interface.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/lewis_emulators/opcua/interfaces/opcua_interface.py b/lewis_emulators/opcua/interfaces/opcua_interface.py
--- a/lewis_emulators/opcua/interfaces/opcua_interface.py
+++ b/lewis_emulators/opcua/interfaces/opcua_interface.py
@@ -1,2 +1 @@
-from lewis.adapters import opcua
 
EOF
@@ -1,2 +1 @@
from lewis.adapters import opcua

Copilot is powered by AI and may make mistakes. Always verify output.
@esmith1729 esmith1729 linked an issue Jun 24, 2025 that may be closed by this pull request
@pull-request-size pull-request-size bot added size/L and removed size/M labels Jun 24, 2025
@esmith1729
Copy link
Contributor Author

esmith1729 commented Jul 4, 2025

simple_test contains the python OPC server basic emulator from this tutorial: https://opcua-asyncio.readthedocs.io/en/latest/usage/get-started/minimal-server.html
It's recommended to use this format, in conjuction with a python script that opens a port and listens to the traffic between this server and the client (OPCUA IOC), in order to have the same functionality needed for unit tests of our OPCUA IOC.

The goal is to have format similar to the mezei_flipper emulator.

@esmith1729 esmith1729 linked an issue Jul 4, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OPCUA emulator (Lewis or otherwise) OPC UA emulator and system tests
1 participant