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
0
Merge Requests
0
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
Martin Manchev
osie
Commits
2b59f3dc
Commit
2b59f3dc
authored
Nov 08, 2023
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Plain Diff
OPCUA
See merge request
!36
parents
d400872e
a8e27c60
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
5 deletions
+37
-5
opcua-to-http-gw/opcua-to-http-gw.py
opcua-to-http-gw/opcua-to-http-gw.py
+11
-3
slapos/software/opcua-to-http-gw/buildout.hash.cfg
slapos/software/opcua-to-http-gw/buildout.hash.cfg
+1
-1
slapos/software/opcua-to-http-gw/instance-input-schema.json
slapos/software/opcua-to-http-gw/instance-input-schema.json
+10
-0
slapos/software/opcua-to-http-gw/instance.cfg.in
slapos/software/opcua-to-http-gw/instance.cfg.in
+15
-1
No files found.
opcua-to-http-gw/opcua-to-http-gw.py
View file @
2b59f3dc
...
@@ -17,14 +17,18 @@ import __main__
...
@@ -17,14 +17,18 @@ import __main__
# command line handling
# command line handling
parser
=
argparse
.
ArgumentParser
(
description
=
'Run OPCUA Server.'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'Run OPCUA Server.'
)
a
=
parser
.
add_argument
a
=
parser
.
add_argument
a
(
'--ip'
,
help
=
'The IP address on which the OPCUA Server runs'
,
default
=
"127.0.0.1"
)
a
(
'--ipv4'
,
help
=
'The IPv4 address on which the OPCUA Server runs'
,
default
=
"0.0.0.0"
)
a
(
'--ipv6'
,
help
=
'The IPv6 address on which the OPCUA Server runs'
,
default
=
"::"
)
a
(
'--ipv6-enabled'
,
help
=
'The IPv6 address check whether it is enabled or disabled'
,
default
=
"1"
)
a
(
'--port'
,
help
=
'The port on which the OPCUA Server runs'
,
default
=
"4840"
)
a
(
'--port'
,
help
=
'The port on which the OPCUA Server runs'
,
default
=
"4840"
)
a
(
'--xml'
,
help
=
'Path of XML to configure Server. See asyncua doc for more details.'
,
default
=
None
)
a
(
'--xml'
,
help
=
'Path of XML to configure Server. See asyncua doc for more details.'
,
default
=
None
)
a
(
'--erp5-url'
,
help
=
'URL of ERP5 instance to which data shall be send.'
,
default
=
None
)
a
(
'--erp5-url'
,
help
=
'URL of ERP5 instance to which data shall be send.'
,
default
=
None
)
a
(
'--erp5-username'
,
help
=
'Username of ERP5 instance to which data shall be send.'
,
default
=
None
)
a
(
'--erp5-username'
,
help
=
'Username of ERP5 instance to which data shall be send.'
,
default
=
None
)
a
(
'--erp5-password'
,
help
=
'Password of ERP5 instance to which data shall be send.'
,
default
=
None
)
a
(
'--erp5-password'
,
help
=
'Password of ERP5 instance to which data shall be send.'
,
default
=
None
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
ip
=
args
.
ip
ipv4
=
args
.
ipv4
ipv6
=
args
.
ipv6
ipv6_enabled
=
args
.
ipv6_enabled
port
=
args
.
port
port
=
args
.
port
xml
=
args
.
xml
xml
=
args
.
xml
erp5_url
=
args
.
erp5_url
erp5_url
=
args
.
erp5_url
...
@@ -73,7 +77,11 @@ async def main():
...
@@ -73,7 +77,11 @@ async def main():
# setup our server
# setup our server
server
=
asyncua
.
Server
()
server
=
asyncua
.
Server
()
await
server
.
init
()
await
server
.
init
()
server
.
set_endpoint
(
f"opc.tcp://
{
ip
}
:
{
port
}
/freeopcua/server/"
)
if
bool
(
int
(
ipv6_enabled
)):
server
.
set_endpoint
(
f"opc.tcp://[
{
ipv6
}
]:
{
port
}
/freeopcua/server/"
)
else
:
server
.
set_endpoint
(
f"opc.tcp://
{
ipv4
}
:
{
port
}
/freeopcua/server/"
)
if
xml
is
not
None
:
if
xml
is
not
None
:
await
server
.
import_xml
(
xml
)
await
server
.
import_xml
(
xml
)
...
...
slapos/software/opcua-to-http-gw/buildout.hash.cfg
View file @
2b59f3dc
[instance-profile]
[instance-profile]
filename = instance.cfg.in
filename = instance.cfg.in
md5sum =
6fbae8f850e2c38b9b9990bf9c087505
md5sum =
3d548477bd7a4b37a0b5a9877a321dff
slapos/software/opcua-to-http-gw/instance-input-schema.json
View file @
2b59f3dc
...
@@ -22,6 +22,16 @@
...
@@ -22,6 +22,16 @@
"description"
:
"The port for OPCUA server."
,
"description"
:
"The port for OPCUA server."
,
"type"
:
"int"
,
"type"
:
"int"
,
"default"
:
"4840"
"default"
:
"4840"
},
"ipv6-enabled"
:
{
"description"
:
"The IPv6 Support variable for OPCUA server."
,
"type"
:
"int"
,
"default"
:
"1"
},
"opcua-xml-url"
:
{
"description"
:
"The XML Schema URL for OPCUA server."
,
"type"
:
"string"
,
"default"
:
""
}
}
}
}
}
}
slapos/software/opcua-to-http-gw/instance.cfg.in
View file @
2b59f3dc
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
parts =
parts =
promises
promises
directory
directory
opcua-xml-url
opcua-to-http-gw-service
opcua-to-http-gw-service
publish-connection-parameter
publish-connection-parameter
...
@@ -33,9 +34,15 @@ key = ${slap-connection:key-file}
...
@@ -33,9 +34,15 @@ key = ${slap-connection:key-file}
cert = ${slap-connection:cert-file}
cert = ${slap-connection:cert-file}
configuration.opcua-port = 4840
configuration.opcua-port = 4840
[opcua-xml-url]
recipe = slapos.recipe.build:download
url = ${instance-parameter:configuration.opcua-xml-url}
offline = false
destination = ${directory:etc}/schema.xml
[opcua-to-http-gw-service]
[opcua-to-http-gw-service]
recipe = slapos.cookbook:wrapper
recipe = slapos.cookbook:wrapper
command-line = {{ interpreter_location }}/py {{ osie_repository_location }}/opcua-to-http-gw/opcua-to-http-gw.py --xml
{{ osie_repository_location }}/opcua-to-http-gw/opcua-server-config.xml --erp5-url ${instance-parameter:configuration.erp5-url} --erp5-username ${instance-parameter:configuration.erp5-username} --erp5-password ${instance-parameter:configuration.erp5-password} --port ${instance-parameter:configuration.opcua-port} --ip ${instance-parameter:ipv4-random
}
command-line = {{ interpreter_location }}/py {{ osie_repository_location }}/opcua-to-http-gw/opcua-to-http-gw.py --xml
${opcua-xml-url:destination} --erp5-url ${instance-parameter:configuration.erp5-url} --erp5-username ${instance-parameter:configuration.erp5-username} --erp5-password ${instance-parameter:configuration.erp5-password} --port ${instance-parameter:configuration.opcua-port} --ipv4 ${instance-parameter:ipv4-random} --ipv6 ${instance-parameter:ipv6-random} --ipv6-enabled ${instance-parameter:configuration.ipv6-enabled
}
wrapper-path = ${directory:service}/opcua-to-http-gw-service
wrapper-path = ${directory:service}/opcua-to-http-gw-service
output = $${:wrapper-path}
output = $${:wrapper-path}
...
@@ -44,11 +51,18 @@ output = $${:wrapper-path}
...
@@ -44,11 +51,18 @@ output = $${:wrapper-path}
hostname = ${instance-parameter:ipv4-random}
hostname = ${instance-parameter:ipv4-random}
port = ${instance-parameter:configuration.opcua-port}
port = ${instance-parameter:configuration.opcua-port}
[opcua-to-http-gw-listen-promise-ipv6]
<= check-port-listening-promise
hostname = ${instance-parameter:ipv6-random}
port = ${instance-parameter:configuration.opcua-port}
[promises]
[promises]
recipe =
recipe =
instance-promises =
instance-promises =
${opcua-to-http-gw-listen-promise-ipv4:path}
${opcua-to-http-gw-listen-promise-ipv4:path}
${opcua-to-http-gw-listen-promise-ipv6:path}
[publish-connection-parameter]
[publish-connection-parameter]
recipe = slapos.cookbook:publish
recipe = slapos.cookbook:publish
ipv4 = ${instance-parameter:ipv4-random}
ipv4 = ${instance-parameter:ipv4-random}
ipv6 = ${instance-parameter:ipv6-random}
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