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
f2ed26c6
Commit
f2ed26c6
authored
Aug 07, 2016
by
olivier R-D
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support deleting all nodes on server side. Needed by opcua-modeler
parent
7e9f42f2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
12 deletions
+32
-12
opcua/server/address_space.py
opcua/server/address_space.py
+7
-0
opcua/server/internal_server.py
opcua/server/internal_server.py
+25
-12
No files found.
opcua/server/address_space.py
View file @
f2ed26c6
...
...
@@ -473,6 +473,13 @@ class AddressSpace(object):
with
self
.
_lock
:
return
self
.
_nodes
.
keys
()
def
empty
(
self
):
"""
Delete all nodes in address space
"""
with
self
.
_lock
:
self
.
_nodes
=
{}
def
dump
(
self
,
path
):
"""
dump address space as binary to file
...
...
opcua/server/internal_server.py
View file @
f2ed26c6
...
...
@@ -64,18 +64,7 @@ class InternalServer(object):
self
.
method_service
=
MethodService
(
self
.
aspace
)
self
.
node_mgt_service
=
NodeManagementService
(
self
.
aspace
)
if
cacheFile
and
path
.
isfile
(
cacheFile
):
# import address space from shelve
self
.
aspace
.
load
(
cacheFile
)
else
:
# import address space from code generated from xml
standard_address_space
.
fill_address_space
(
self
.
node_mgt_service
)
# import address space directly from xml, this has preformance impact so disabled
# importer = xmlimporter.XmlImporter(self.node_mgt_service)
# importer.import_xml("/path/to/python-opcua/schemas/Opc.Ua.NodeSet2.xml", self)
if
cacheFile
:
self
.
aspace
.
dump
(
cacheFile
)
self
.
load_standard_address_space
(
cacheFile
)
self
.
loop
=
utils
.
ThreadLoop
()
self
.
asyncio_transports
=
[]
...
...
@@ -85,15 +74,39 @@ class InternalServer(object):
# create a session to use on server side
self
.
isession
=
InternalSession
(
self
,
self
.
aspace
,
self
.
subscription_service
,
"Internal"
,
user
=
User
.
Admin
)
self
.
current_time_node
=
Node
(
self
.
isession
,
ua
.
NodeId
(
ua
.
ObjectIds
.
Server_ServerStatus_CurrentTime
))
self
.
setup_nodes
()
def
setup_nodes
(
self
):
"""
Set up some nodes as defined by spec
"""
uries
=
[
"http://opcfoundation.org/UA/"
]
ns_node
=
Node
(
self
.
isession
,
ua
.
NodeId
(
ua
.
ObjectIds
.
Server_NamespaceArray
))
ns_node
.
set_value
(
uries
)
def
load_standard_address_space
(
self
,
cacheFile
=
None
):
if
cacheFile
and
path
.
isfile
(
cacheFile
):
# import address space from shelve
self
.
aspace
.
load
(
cacheFile
)
else
:
# import address space from code generated from xml
standard_address_space
.
fill_address_space
(
self
.
node_mgt_service
)
# import address space directly from xml, this has preformance impact so disabled
# importer = xmlimporter.XmlImporter(self.node_mgt_service)
# importer.import_xml("/path/to/python-opcua/schemas/Opc.Ua.NodeSet2.xml", self)
def
load_address_space
(
self
,
path
):
"""
Load address space frfrom path
"""
self
.
aspace
.
load
(
path
)
def
dump_address_space
(
self
,
path
):
"""
Dump current address space to path
"""
self
.
aspace
.
dump
(
path
)
def
start
(
self
):
...
...
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