From 5aa3ace7780c951ac8cc7d34b9f087d5dbd30ccc Mon Sep 17 00:00:00 2001 From: Thomas Juerges <203795-tjuerges@users.noreply.gitlab.com> Date: Tue, 27 Oct 2020 13:41:06 +0100 Subject: [PATCH] Add variables for host and port --- test/Client.py | 8 +++++++- test/MCU_debug_access.py | 8 +++++++- test/{M&C_client.py => MnC_client.py} | 11 ++++++----- 3 files changed, 20 insertions(+), 7 deletions(-) mode change 100644 => 100755 test/Client.py mode change 100644 => 100755 test/MCU_debug_access.py rename test/{M&C_client.py => MnC_client.py} (97%) mode change 100644 => 100755 diff --git a/test/Client.py b/test/Client.py old mode 100644 new mode 100755 index ffa8885..3b3fc04 --- a/test/Client.py +++ b/test/Client.py @@ -1,6 +1,12 @@ +#! /usr/bin/env python3 + import sys import time import logging + +host = "localhost" +port = 62000 + sys.path.insert(0, "..") Temp_only = True @@ -57,7 +63,7 @@ if __name__ == "__main__": # logger.setLevel(logging.DEBUG) # client = Client("opc.tcp://LAPTOP-N0VQ3UDT:4840/") - client = Client("opc.tcp://192.168.137.102:4840/") + client = Client("opc.tcp://{}:{}/".format(host, port)) # client = Client("opc.tcp://169.254.91.66:4840/") # I hope this is secure, because I have zero clue about security # client.set_security_string("Basic256Sha256,SignAndEncrypt,certificate-example.der,private-key-example.pem") diff --git a/test/MCU_debug_access.py b/test/MCU_debug_access.py old mode 100644 new mode 100755 index 60a47c4..ae31e39 --- a/test/MCU_debug_access.py +++ b/test/MCU_debug_access.py @@ -1,3 +1,5 @@ +#! /usr/bin/env python3 + # this script connects to a server (specified in this file) and prints any debug messages the server has # The server stores its most recent degug messages in a buffer. This client polls that buffer every 2 seconds # The client checks for duplicates and prints any new debug messages. @@ -6,6 +8,10 @@ import sys import time import logging + +host = "localhost" +port = 62000 + sys.path.insert(0, "..") from opcua import Client @@ -14,7 +20,7 @@ if __name__ == "__main__": logging.basicConfig(level=logging.WARNING) #INFO ERROR WARNING NOTSET DEBUG # for now, just connect to this client - client = Client("opc.tcp://192.168.137.102:4840/") + client = Client("opc.tcp://{}:{}/".format(host, port)) try: # connect to client diff --git a/test/M&C_client.py b/test/MnC_client.py old mode 100644 new mode 100755 similarity index 97% rename from test/M&C_client.py rename to test/MnC_client.py index 10b145c..7c54ae3 --- a/test/M&C_client.py +++ b/test/MnC_client.py @@ -1,10 +1,14 @@ - +#! /usr/bin/env python3 import signal import sys import time import datetime import logging + +host = "localhost" +port = 62000 + sys.path.insert(0, "..") @@ -101,9 +105,7 @@ if __name__ == "__main__": # logger = logging.getLogger("KeepAlive") # logger.setLevel(logging.DEBUG) - # client = Client("opc.tcp://LAPTOP-N0VQ3UDT:4840/") - client = Client("opc.tcp://192.168.137.102:4840/") - # client = Client("opc.tcp://169.254.91.66:4840/") + client = Client("opc.tcp://{}:{}/".format(host, port)) # I hope this is secure, because I have zero clue about security # client.set_security_string("Basic256Sha256,SignAndEncrypt,certificate-example.der,private-key-example.pem") @@ -185,4 +187,3 @@ if __name__ == "__main__": finally: print(" disconnect") client.disconnect() - -- GitLab