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
a21a1237
Commit
a21a1237
authored
Jul 30, 2018
by
Christian Bergmiller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests refactored
parent
122b99da
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
134 additions
and
160 deletions
+134
-160
opcua/common/node.py
opcua/common/node.py
+1
-0
opcua/server/internal_server.py
opcua/server/internal_server.py
+1
-1
opcua/server/server.py
opcua/server/server.py
+8
-8
tests/test_client.py
tests/test_client.py
+2
-2
tests/test_server.py
tests/test_server.py
+122
-149
No files found.
opcua/common/node.py
View file @
a21a1237
...
@@ -313,6 +313,7 @@ class Node:
...
@@ -313,6 +313,7 @@ class Node:
"""
"""
return properties of node.
return properties of node.
properties are child nodes with a reference of type HasProperty and a NodeClass of Variable
properties are child nodes with a reference of type HasProperty and a NodeClass of Variable
COROUTINE
"""
"""
return
self
.
get_children
(
refs
=
ua
.
ObjectIds
.
HasProperty
,
nodeclassmask
=
ua
.
NodeClass
.
Variable
)
return
self
.
get_children
(
refs
=
ua
.
ObjectIds
.
HasProperty
,
nodeclassmask
=
ua
.
NodeClass
.
Variable
)
...
...
opcua/server/internal_server.py
View file @
a21a1237
...
@@ -345,7 +345,7 @@ class InternalSession(object):
...
@@ -345,7 +345,7 @@ class InternalSession(object):
self
.
subscriptions
.
append
(
result
.
SubscriptionId
)
self
.
subscriptions
.
append
(
result
.
SubscriptionId
)
return
result
return
result
def
create_monitored_items
(
self
,
params
):
async
def
create_monitored_items
(
self
,
params
):
"""Returns Future"""
"""Returns Future"""
subscription_result
=
self
.
subscription_service
.
create_monitored_items
(
params
)
subscription_result
=
self
.
subscription_service
.
create_monitored_items
(
params
)
self
.
iserver
.
server_callback_dispatcher
.
dispatch
(
self
.
iserver
.
server_callback_dispatcher
.
dispatch
(
...
...
opcua/server/server.py
View file @
a21a1237
...
@@ -455,17 +455,17 @@ class Server:
...
@@ -455,17 +455,17 @@ class Server:
await
ev_gen
.
set_source
(
source
)
await
ev_gen
.
set_source
(
source
)
return
ev_gen
return
ev_gen
def
create_custom_data_type
(
self
,
idx
,
name
,
basetype
=
ua
.
ObjectIds
.
BaseDataType
,
properties
=
None
):
async
def
create_custom_data_type
(
self
,
idx
,
name
,
basetype
=
ua
.
ObjectIds
.
BaseDataType
,
properties
=
None
):
if
properties
is
None
:
if
properties
is
None
:
properties
=
[]
properties
=
[]
return
self
.
_create_custom_type
(
idx
,
name
,
basetype
,
properties
,
[],
[])
return
await
self
.
_create_custom_type
(
idx
,
name
,
basetype
,
properties
,
[],
[])
def
create_custom_event_type
(
self
,
idx
,
name
,
basetype
=
ua
.
ObjectIds
.
BaseEventType
,
properties
=
None
):
async
def
create_custom_event_type
(
self
,
idx
,
name
,
basetype
=
ua
.
ObjectIds
.
BaseEventType
,
properties
=
None
):
if
properties
is
None
:
if
properties
is
None
:
properties
=
[]
properties
=
[]
return
self
.
_create_custom_type
(
idx
,
name
,
basetype
,
properties
,
[],
[])
return
await
self
.
_create_custom_type
(
idx
,
name
,
basetype
,
properties
,
[],
[])
def
create_custom_object_type
(
self
,
idx
,
name
,
basetype
=
ua
.
ObjectIds
.
BaseObjectType
,
properties
=
None
,
async
def
create_custom_object_type
(
self
,
idx
,
name
,
basetype
=
ua
.
ObjectIds
.
BaseObjectType
,
properties
=
None
,
variables
=
None
,
methods
=
None
):
variables
=
None
,
methods
=
None
):
if
properties
is
None
:
if
properties
is
None
:
properties
=
[]
properties
=
[]
...
@@ -473,12 +473,12 @@ class Server:
...
@@ -473,12 +473,12 @@ class Server:
variables
=
[]
variables
=
[]
if
methods
is
None
:
if
methods
is
None
:
methods
=
[]
methods
=
[]
return
self
.
_create_custom_type
(
idx
,
name
,
basetype
,
properties
,
variables
,
methods
)
return
await
self
.
_create_custom_type
(
idx
,
name
,
basetype
,
properties
,
variables
,
methods
)
# def create_custom_reference_type(self, idx, name, basetype=ua.ObjectIds.BaseReferenceType, properties=[]):
# def create_custom_reference_type(self, idx, name, basetype=ua.ObjectIds.BaseReferenceType, properties=[]):
# return self._create_custom_type(idx, name, basetype, properties)
# return self._create_custom_type(idx, name, basetype, properties)
def
create_custom_variable_type
(
self
,
idx
,
name
,
basetype
=
ua
.
ObjectIds
.
BaseVariableType
,
properties
=
None
,
async
def
create_custom_variable_type
(
self
,
idx
,
name
,
basetype
=
ua
.
ObjectIds
.
BaseVariableType
,
properties
=
None
,
variables
=
None
,
methods
=
None
):
variables
=
None
,
methods
=
None
):
if
properties
is
None
:
if
properties
is
None
:
properties
=
[]
properties
=
[]
...
@@ -486,7 +486,7 @@ class Server:
...
@@ -486,7 +486,7 @@ class Server:
variables
=
[]
variables
=
[]
if
methods
is
None
:
if
methods
is
None
:
methods
=
[]
methods
=
[]
return
self
.
_create_custom_type
(
idx
,
name
,
basetype
,
properties
,
variables
,
methods
)
return
await
self
.
_create_custom_type
(
idx
,
name
,
basetype
,
properties
,
variables
,
methods
)
async
def
_create_custom_type
(
self
,
idx
,
name
,
basetype
,
properties
,
variables
,
methods
):
async
def
_create_custom_type
(
self
,
idx
,
name
,
basetype
,
properties
,
variables
,
methods
):
if
isinstance
(
basetype
,
Node
):
if
isinstance
(
basetype
,
Node
):
...
...
tests/test_client.py
View file @
a21a1237
...
@@ -62,8 +62,8 @@ async def test_objects_anonymous(server, client):
...
@@ -62,8 +62,8 @@ async def test_objects_anonymous(server, client):
await
objects
.
add_folder
(
3
,
'MyFolder'
)
await
objects
.
add_folder
(
3
,
'MyFolder'
)
async
def
test_folder_anonymous
(
server
,
client
):
async
def
test_folder_anonymous
(
server
,
admin_client
,
client
):
objects
=
client
.
get_objects_node
()
objects
=
admin_
client
.
get_objects_node
()
f
=
await
objects
.
add_folder
(
3
,
'MyFolderRO'
)
f
=
await
objects
.
add_folder
(
3
,
'MyFolderRO'
)
f_ro
=
client
.
get_node
(
f
.
nodeid
)
f_ro
=
client
.
get_node
(
f
.
nodeid
)
assert
f
==
f_ro
assert
f
==
f_ro
...
...
tests/test_server.py
View file @
a21a1237
This diff is collapsed.
Click to expand it.
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