From 315c8af7ac3bad9a5f44924ba852fc63221b3576 Mon Sep 17 00:00:00 2001
From: Thomas Juerges <4-jurges@users.noreply.git.astron.nl>
Date: Tue, 20 Oct 2020 11:36:17 +0200
Subject: [PATCH] Add quick and dirty first test

---
 RCUSCC-DS/test/test-RCUSCC.py | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100755 RCUSCC-DS/test/test-RCUSCC.py

diff --git a/RCUSCC-DS/test/test-RCUSCC.py b/RCUSCC-DS/test/test-RCUSCC.py
new file mode 100755
index 000000000..16bdf0b47
--- /dev/null
+++ b/RCUSCC-DS/test/test-RCUSCC.py
@@ -0,0 +1,27 @@
+#! /usr/bin/env python3
+
+import opcua
+from time import sleep
+
+port = 4840
+host = "10.87.2.8"
+
+client = opcua.Client("opc.tcp://{}:{}".format(host, port))
+client.connect()
+obj = client.get_objects_node()
+name_space_index = 2
+time_offset = obj.get_child("{}:time_offset".format(name_space_index))
+time_offset_R = time_offset.get_child("{}:monitor_point".format(name_space_index))
+time_offset_RW = time_offset.get_child("{}:control_point".format(name_space_index))
+old_time_offset = time_offset_R.get_value()
+target_time_offset = 1
+new_time_offset = old_time_offset + target_time_offset
+time_offset_RW.set_value(new_time_offset)
+sleep(1.0)
+latest_time_offset = time_offset_R.get_value()
+difference_time_offset = latest_time_offset - old_time_offset
+if difference_time_offset != target_time_offset:
+    print("ERROR:  Setting and reading back time_offset.  old_time_offset = %d, new_time_offset = %d, latest_time_offset = %d, target_time_offset = %d, difference_time_offset = %d." % (old_time_offset, new_time_offset, latest_time_offset, target_time_offset, difference_time_offset))
+else:
+    print("SUCCESS:  Setting and reading back time_offset.")
+client.disconnect()
-- 
GitLab