Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
opcua-asyncio
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
Nikola Balog
opcua-asyncio
Commits
3355eb8e
Commit
3355eb8e
authored
Jul 28, 2020
by
oroulet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add first simple tests for data_type_definitions
parent
f08c39b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
asyncua/server/server.py
asyncua/server/server.py
+11
-0
tests/test_common.py
tests/test_common.py
+5
-0
No files found.
asyncua/server/server.py
View file @
3355eb8e
...
...
@@ -21,6 +21,7 @@ from ..common.manage_nodes import delete_nodes
from
..common.event_objects
import
BaseEvent
from
..common.shortcuts
import
Shortcuts
from
..common.structures
import
load_type_definitions
,
load_enums
from
..common.structures104
import
load_data_type_definitions
from
..common.ua_utils
import
get_nodes_of_namespace
from
..crypto
import
security_policies
,
uacrypto
...
...
@@ -618,12 +619,22 @@ class Server:
Server side this can be used to create python objects from custom structures
imported through xml into server
"""
_logger
.
warning
(
"Deprecated since spec 1.04, call load_data_type_definitions"
)
return
await
load_type_definitions
(
self
,
nodes
)
async
def
load_data_type_definitions
(
self
,
node
=
None
):
"""
Load custom types (custom structures/extension objects) definition from server
Generate Python classes for custom structures/extension objects defined in server
These classes will be available in ua module
"""
return
await
load_data_type_definitions
(
self
,
node
)
async
def
load_enums
(
self
)
->
Coroutine
:
"""
load UA structures and generate python Enums in ua module for custom enums in server
"""
_logger
.
warning
(
"Deprecated since spec 1.04, call load_data_type_definitions"
)
return
await
load_enums
(
self
)
async
def
write_attribute_value
(
self
,
nodeid
,
datavalue
,
attr
=
ua
.
AttributeIds
.
Value
):
...
...
tests/test_common.py
View file @
3355eb8e
...
...
@@ -982,3 +982,8 @@ async def test_guid_node_id():
node
=
Node
(
None
,
"ns=4;g=35d5f86f-2777-4550-9d48-b098f5ee285c"
)
binary_node_id
=
ua
.
ua_binary
.
nodeid_to_binary
(
node
.
nodeid
)
assert
type
(
binary_node_id
)
is
bytes
async
def
test_import_xml_data_type_definition
(
opc
):
nodes
=
await
opc
.
opc
.
import_xml
(
"tests/substructs.xml"
)
await
opc
.
opc
.
load_data_type_definitions
()
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