Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
osie
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
osie
Commits
71e9ab4e
Commit
71e9ab4e
authored
Feb 10, 2025
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Plain Diff
Extended testing so it now tests multiple multicast coupler setups.
See merge request
!64
parents
4bbb8569
ceab2c0e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
1 deletion
+65
-1
tests/e2e_tests/test_beremiz.py
tests/e2e_tests/test_beremiz.py
+65
-1
No files found.
tests/e2e_tests/test_beremiz.py
View file @
71e9ab4e
...
...
@@ -6,6 +6,8 @@ import slapos.testing.e2e as e2e
# the OPC UA node of relay0 at I2C0 slave
OPC_UA_IDENTIFIER
=
"ns=1;s=i2c0.relay0"
# the ID of a subscriber heart beat
HEART_BEAT_IDENTIFIER
=
"ns=1;i=50000"
class
BeremizTest
(
e2e
.
EndToEndTestCase
):
"""
...
...
@@ -102,6 +104,37 @@ class BeremizTest(e2e.EndToEndTestCase):
print
(
connection_dict
)
cls
.
coupler_subscriber_url_ipv6
=
connection_dict
.
get
(
"url-ipv6"
)
# request a coupler in a publisher mode (ID=3) with a NEW mulsticast group
print
(
"[New multicast groupd] Pub / Sub coupler instances."
)
instance_name
=
time
.
strftime
(
'e2e-test-coupler-anonymous-publisher-new-%Y-%B-%d-%H:%M:%S'
)
parameter_dict
=
{
"mode"
:
1
,
"opc_ua_port"
:
6842
,
"heart_beat"
:
1
,
"network_address_url_data_type"
:
"opc.udp://224.0.0.22:4841/"
,
"id"
:
3
}
cls
.
request
(
cls
.
coupler_release
,
instance_name
,
partition_parameter_kw
=
parameter_dict
)
cls
.
waitUntilGreen
(
instance_name
,
180
)
connection_dict
=
cls
.
getInstanceInfos
(
instance_name
).
connection_dict
print
(
connection_dict
)
cls
.
coupler_publisher_new_url_ipv6
=
connection_dict
.
get
(
"url-ipv6"
)
# request a coupler in a subscriber mode (ID=2)
instance_name
=
time
.
strftime
(
'e2e-test-coupler-anonymous-subscriber-new-%Y-%B-%d-%H:%M:%S'
)
parameter_dict
=
{
"mode"
:
1
,
"opc_ua_port"
:
6843
,
"heart_beat_id_list"
:
"3"
,
"network_address_url_data_type"
:
"opc.udp://224.0.0.22:4841/"
,
"id"
:
4
}
cls
.
request
(
cls
.
coupler_release
,
instance_name
,
partition_parameter_kw
=
parameter_dict
)
cls
.
waitUntilGreen
(
instance_name
,
180
)
connection_dict
=
cls
.
getInstanceInfos
(
instance_name
).
connection_dict
print
(
connection_dict
)
cls
.
coupler_subscriber_new_url_ipv6
=
connection_dict
.
get
(
"url-ipv6"
)
def
test_01_plc_increment_run
(
self
):
"""
Test that beremiz-runtime can control over OPC UA a slave coupler by incrementing a counter.
...
...
@@ -160,8 +193,8 @@ class BeremizTest(e2e.EndToEndTestCase):
def
test_03_keep_alive_network
(
self
):
"""
Test keep alive network (based on OPC UA Pub / Sub) for coupler.
Test multiple multicast networks can work together.
"""
HEART_BEAT_IDENTIFIER
=
"ns=1;i=50000"
NUMBER_OF_CHECKS
=
10
TIMEOUT
=
3
...
...
@@ -189,7 +222,38 @@ class BeremizTest(e2e.EndToEndTestCase):
if
(
heart_beat_after
<=
heart_beat_before
):
# counter should have been increased, mark failure
test_failures
+=
1
# heart_beat should be a float in this format <id>.<timestamp> to be
# sure that multiple couplers can use different groups check <id> is consistent
if
int
(
heart_beat_before
)
!=
1
or
int
(
heart_beat_after
)
!=
1
:
test_failures
+=
1
finally
:
client
.
disconnect
()
# connect to a session at OPC-UA server
client
=
Client
(
self
.
coupler_subscriber_new_url_ipv6
)
try
:
client
.
connect
()
root
=
client
.
get_root_node
()
children_list
=
root
.
get_children
()
var
=
client
.
get_node
(
HEART_BEAT_IDENTIFIER
)
for
i
in
range
(
0
,
NUMBER_OF_CHECKS
):
heart_beat_before
=
var
.
get_value
()
print
(
"
\
n
heart_beat (before) = "
,
heart_beat_before
)
print
(
"Sleep for %s seconds ..."
%
TIMEOUT
)
time
.
sleep
(
TIMEOUT
)
heart_beat_after
=
var
.
get_value
()
print
(
"heart_beat (after) = "
,
heart_beat_after
)
# for the wait timeout runtime should have increased the value
if
(
heart_beat_after
<=
heart_beat_before
):
# counter should have been increased, mark failure
test_failures
+=
1
# heart_beat should be a float in this format <id>.<timestamp> to be
# sure that multiple couplers can use different groups check <id> is consistent
if
int
(
heart_beat_before
)
!=
3
or
int
(
heart_beat_after
)
!=
3
:
test_failures
+=
1
finally
:
client
.
disconnect
()
# no failures
self
.
assertEqual
(
test_failures
,
0
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment