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
0c6d1123
Commit
0c6d1123
authored
Oct 06, 2021
by
oroulet
Committed by
oroulet
Oct 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correctly import/export BytestringNodeId
parent
dd351f57
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
asyncua/ua/uatypes.py
asyncua/ua/uatypes.py
+4
-2
tests/test_unit.py
tests/test_unit.py
+9
-1
No files found.
asyncua/ua/uatypes.py
View file @
0c6d1123
...
...
@@ -487,7 +487,7 @@ class NodeId:
identifier
=
uuid
.
UUID
(
f"urn:uuid:
{
v
}
"
)
elif
k
==
"b"
:
ntype
=
NodeIdType
.
ByteString
identifier
=
v
identifier
=
bytes
(
v
,
'utf-8'
)
elif
k
==
"srv"
:
srv
=
int
(
v
)
elif
k
==
"nsu"
:
...
...
@@ -502,6 +502,7 @@ class NodeId:
string
=
[]
if
self
.
NamespaceIndex
!=
0
:
string
.
append
(
f"ns=
{
self
.
NamespaceIndex
}
"
)
identifier
=
self
.
Identifier
ntype
=
None
if
self
.
NodeIdType
==
NodeIdType
.
Numeric
:
ntype
=
"i"
...
...
@@ -515,7 +516,8 @@ class NodeId:
ntype
=
"g"
elif
self
.
NodeIdType
==
NodeIdType
.
ByteString
:
ntype
=
"b"
string
.
append
(
f"
{
ntype
}
=
{
self
.
Identifier
}
"
)
identifier
=
identifier
.
decode
()
string
.
append
(
f"
{
ntype
}
=
{
identifier
}
"
)
return
";"
.
join
(
string
)
def
to_binary
(
self
):
...
...
tests/test_unit.py
View file @
0c6d1123
...
...
@@ -337,7 +337,15 @@ def test_nodeid_guid_string():
s
=
n
.
to_string
()
n2
=
ua
.
NodeId
.
from_string
(
s
)
s2
=
n2
.
to_string
()
print
(
n
,
n2
,
s
,
s2
)
assert
n
==
n2
assert
s
==
s2
def
test_nodeid_bytestring
():
n
=
ua
.
ByteStringNodeId
(
Identifier
=
b"qwerty"
,
NamespaceIndex
=
1
)
s
=
n
.
to_string
()
n2
=
ua
.
NodeId
.
from_string
(
s
)
s2
=
n2
.
to_string
()
assert
n
==
n2
assert
s
==
s2
...
...
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