Commit 352a84fb authored by Levin Zimmermann's avatar Levin Zimmermann

stack/erp5 += opcua-server

Now the ERP5 SR creates an OPC UA server as an additional service which
runs on the default ipv4/ipv6 on port 4840.

This service notifies ERP5 whenever any read or write operation happened
on any OPC UA node. It also notifies ERP5 if any other OPC UA event
happens. It does so by calling the ERP5 script "opcua_test".
parent 9c321528
...@@ -90,6 +90,8 @@ eggs += ...@@ -90,6 +90,8 @@ eggs +=
## Python 3 variant ## Python 3 variant
SOAPpy-py3 SOAPpy-py3
suds-py3 suds-py3
# opcua-poc
asyncua
eggs -= eggs -=
## Python 2 only ## Python 2 only
ZServer ZServer
...@@ -217,3 +219,9 @@ suds-py3 = 1.4.5.0 ...@@ -217,3 +219,9 @@ suds-py3 = 1.4.5.0
wstools-py3 = 0.54.4 wstools-py3 = 0.54.4
toml = 0.10.2 toml = 0.10.2
soupsieve = 2.3.2.post1:whl soupsieve = 2.3.2.post1:whl
# opcua-asyncio
asyncua = 1.0.1
sortedcontainers = 2.4.0
aiosqlite = 0.18.0:whl
aiofiles = 23.1.0
python-dateutil = 2.8.2:whl
...@@ -63,6 +63,7 @@ extends = ...@@ -63,6 +63,7 @@ extends =
../../component/pygolang/buildout.cfg ../../component/pygolang/buildout.cfg
../../component/bcrypt/buildout.cfg ../../component/bcrypt/buildout.cfg
../../component/python-pynacl/buildout.cfg ../../component/python-pynacl/buildout.cfg
../../component/opcua-server/buildout.cfg
../../stack/caucase/buildout.cfg ../../stack/caucase/buildout.cfg
../../software/neoppod/software-common.cfg ../../software/neoppod/software-common.cfg
# keep neoppod extends last # keep neoppod extends last
...@@ -91,6 +92,9 @@ parts += ...@@ -91,6 +92,9 @@ parts +=
# jupyter # jupyter
# jupyter-notebook-initialized-scripts # jupyter-notebook-initialized-scripts
# opcua-server
opcua-server
# override instance-jupyter-notebook not to render into default template.cfg # override instance-jupyter-notebook not to render into default template.cfg
[instance-jupyter-notebook] [instance-jupyter-notebook]
output = ${buildout:directory}/template-jupyter.cfg output = ${buildout:directory}/template-jupyter.cfg
...@@ -221,6 +225,8 @@ context = ...@@ -221,6 +225,8 @@ context =
key template_postfix_main_cf template-postfix-main-cf:target key template_postfix_main_cf template-postfix-main-cf:target
key template_postfix_master_cf template-postfix-master-cf:target key template_postfix_master_cf template-postfix-master-cf:target
key instance_wcfs_cfg_in instance-wcfs.cfg.in:target key instance_wcfs_cfg_in instance-wcfs.cfg.in:target
key instance_opcua_server_cfg_in instance-opcua-server.cfg.in:target
key opcua_server_config_xml opcua-server-config.xml:target
key template_zeo template-zeo:target key template_zeo template-zeo:target
key template_zodb_base template-zodb-base:target key template_zodb_base template-zodb-base:target
key template_zope template-zope:target key template_zope template-zope:target
...@@ -293,6 +299,14 @@ fontconfig-includes = ...@@ -293,6 +299,14 @@ fontconfig-includes =
[instance-wcfs.cfg.in] [instance-wcfs.cfg.in]
<= download-base <= download-base
[instance-opcua-server.cfg.in]
<= download-base
[opcua-server-config.xml]
<= download-base-neo
url = https://lab.nexedi.com/levin.zimmermann/slapos/raw/e45e11a0/stack/erp5/opcua-server-config.xml
md5sum = 09f5d87b8bd5b508458ac24e4f541767
[erp5-bin] [erp5-bin]
<= erp5 <= erp5
repository = https://lab.nexedi.com/nexedi/erp5-bin.git repository = https://lab.nexedi.com/nexedi/erp5-bin.git
......
...@@ -70,11 +70,11 @@ md5sum = b95084ae9eed95a68eada45e28ef0c04 ...@@ -70,11 +70,11 @@ md5sum = b95084ae9eed95a68eada45e28ef0c04
[template] [template]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = a75e8cf8fd664de164a88a680ddd2c9e md5sum = eacf1b6a5ab577100660b441bcccd397
[template-erp5] [template-erp5]
filename = instance-erp5.cfg.in filename = instance-erp5.cfg.in
md5sum = 3d8f3a440b7423c3b947c6ea4d775c6e md5sum = 1204f50c488d929711719e2e66e71e1a
[template-zeo] [template-zeo]
filename = instance-zeo.cfg.in filename = instance-zeo.cfg.in
...@@ -94,7 +94,7 @@ md5sum = b0751d3d12cfcc8934cb1027190f5e5e ...@@ -94,7 +94,7 @@ md5sum = b0751d3d12cfcc8934cb1027190f5e5e
[template-haproxy-cfg] [template-haproxy-cfg]
filename = haproxy.cfg.in filename = haproxy.cfg.in
md5sum = 1645ef8990ab2b50f91a4c02f0cf8882 md5sum = 5860c4869d2d383b41c384d11ca36f35
[template-rsyslogd-cfg] [template-rsyslogd-cfg]
filename = rsyslogd.cfg.in filename = rsyslogd.cfg.in
...@@ -103,3 +103,7 @@ md5sum = 5cf0316fdd17a940031e4083bbededd8 ...@@ -103,3 +103,7 @@ md5sum = 5cf0316fdd17a940031e4083bbededd8
[instance-wcfs.cfg.in] [instance-wcfs.cfg.in]
filename = instance-wcfs.cfg.in filename = instance-wcfs.cfg.in
md5sum = eb4be2669a9a56187cc4366272e11d18 md5sum = eb4be2669a9a56187cc4366272e11d18
[instance-opcua-server.cfg.in]
filename = instance-opcua-server.cfg.in
md5sum = c20c924f3ddce8f762316352085cbd6a
...@@ -224,3 +224,17 @@ backend backend_{{ group_name }}_{{ name }} ...@@ -224,3 +224,17 @@ backend backend_{{ group_name }}_{{ name }}
server {{ name }} {{ urllib_parse.urlparse(url).netloc }} server {{ name }} {{ urllib_parse.urlparse(url).netloc }}
{%- endfor %} {%- endfor %}
{% endfor %} {% endfor %}
# <<<<<<
# Adhoc added opcua server listener
{% set opcua_port = 4840 %}
frontend opcuaFrontend
mode tcp
bind {{ parameter_dict['ipv6'] }}:{{ opcua_port }}
default_backend opcuaBackend
backend opcuaBackend
mode tcp
server server1 {{ parameter_dict['ipv4'] }}:{{ opcua_port }}
# >>>>>>
...@@ -427,6 +427,16 @@ config-url = ${request-jupyter:connection-url} ...@@ -427,6 +427,16 @@ config-url = ${request-jupyter:connection-url}
key_config=balancer_key_config_dict, key_config=balancer_key_config_dict,
) }} ) }}
{{ request(
'opcua-server',
'opcua-server',
'opcua-server',
{},
{}
) }}
{% do root_common.section('request-opcua-server') -%}
[request-frontend-base] [request-frontend-base]
{% if has_frontend -%} {% if has_frontend -%}
<= request-common <= request-common
......
{% set ipv4 = (ipv4_set | list)[0] -%}
{# port is hard coded here + in stack/erp5/haproxy.cfg.in #}
{% set port = 4840 %}
{% set opcua_server_config = parameter_dict["opcua_server_config_xml"] %}
{# erp5 port hard coded for now. #}
{# see https://lab.nexedi.com/nexedi/slapos/blob/a729a677/stack/erp5/instance-erp5.cfg.in#L310 #}
{% set erp5_port = "2200" %}
[buildout]
extends = {{ template_monitor }}
parts +=
opcua-server
[directory]
recipe = slapos.cookbook:mkdirectory
etc = ${buildout:directory}/etc
log = ${:var}/log
run = ${:var}/run
services = ${:etc}/run
service-on-watch = ${:etc}/service
srv = ${buildout:directory}/srv
tmp = ${buildout:directory}/tmp
var = ${buildout:directory}/var
[opcua-server]
recipe = slapos.cookbook:wrapper
command-line =
{{ bin_directory }}/opcua-server --ip {{ ipv4 }} --port {{ port }} --xml {{ opcua_server_config }} --erp5-ip {{ ipv4 }} --erp5-port {{ erp5_port }}
wrapper-path = ${directory:service-on-watch}/opcua-server
...@@ -209,6 +209,16 @@ extra-context = ...@@ -209,6 +209,16 @@ extra-context =
import-list = import-list =
file instance_zodb_base context:template-zodb-base file instance_zodb_base context:template-zodb-base
[dynamic-template-opcua-server-parameters]
opcua_server_config_xml = {{ opcua_server_config_xml }}
[dynamic-template-opcua-server]
<= jinja2-template-base
url = {{ instance_opcua_server_cfg_in }}
filename = instance_opcua_server.cfg
extra-context =
section parameter_dict dynamic-template-opcua-server-parameters
[switch-softwaretype] [switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype recipe = slapos.cookbook:switch-softwaretype
override = {{ dumps(override_switch_softwaretype |default) }} override = {{ dumps(override_switch_softwaretype |default) }}
...@@ -228,6 +238,7 @@ zodb-neo = neo:output ...@@ -228,6 +238,7 @@ zodb-neo = neo:output
zope = dynamic-template-zope:output zope = dynamic-template-zope:output
jupyter = dynamic-template-jupyter:output jupyter = dynamic-template-jupyter:output
wcfs = dynamic-template-wcfs:output wcfs = dynamic-template-wcfs:output
opcua-server = dynamic-template-opcua-server:output
# Keep cloudooo backward compatibility # Keep cloudooo backward compatibility
cloudooo = dynamic-template-legacy:output cloudooo = dynamic-template-legacy:output
......
<?xml version='1.0' encoding='utf-8'?>
<UANodeSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:uax="http://opcfoundation.org/UA/2008/02/Types.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd">
<NamespaceUris>
<Uri>http://erp5.com</Uri>
</NamespaceUris>
<Aliases>
<Alias Alias="Int64">i=8</Alias>
<Alias Alias="Organizes">i=35</Alias>
<Alias Alias="HasTypeDefinition">i=40</Alias>
<Alias Alias="HasComponent">i=47</Alias>
</Aliases>
<UAObject NodeId="ns=1;i=1" BrowseName="1:erp5-test-object-0" ParentNodeId="i=85">
<DisplayName>erp5-test-object-0</DisplayName>
<Description>erp5-test-object-0</Description>
<References>
<Reference ReferenceType="Organizes" IsForward="false">i=85</Reference>
<Reference ReferenceType="HasTypeDefinition">i=58</Reference>
<Reference ReferenceType="HasComponent">ns=1;i=2</Reference>
</References>
</UAObject>
<UAVariable NodeId="ns=1;i=2" BrowseName="1:erp5-variable" ParentNodeId="ns=1;i=1" DataType="Int64" AccessLevel="3" UserAccessLevel="3">
<DisplayName>erp5-variable</DisplayName>
<Description>erp5-variable</Description>
<References>
<Reference ReferenceType="HasComponent" IsForward="false">ns=1;i=1</Reference>
<Reference ReferenceType="HasTypeDefinition">i=63</Reference>
</References>
</UAVariable>
<UAObject NodeId="ns=1;i=3" BrowseName="1:erp5-test-object-1" ParentNodeId="i=85">
<DisplayName>erp5-test-object-1</DisplayName>
<Description>erp5-test-object-1</Description>
<References>
<Reference ReferenceType="Organizes" IsForward="false">i=85</Reference>
<Reference ReferenceType="HasTypeDefinition">i=58</Reference>
<Reference ReferenceType="HasComponent">ns=1;i=4</Reference>
</References>
</UAObject>
<UAVariable NodeId="ns=1;i=4" BrowseName="1:erp5-variable" ParentNodeId="ns=1;i=3" DataType="Int64" AccessLevel="3" UserAccessLevel="3">
<DisplayName>erp5-variable</DisplayName>
<Description>erp5-variable</Description>
<References>
<Reference ReferenceType="HasComponent" IsForward="false">ns=1;i=3</Reference>
<Reference ReferenceType="HasTypeDefinition">i=63</Reference>
</References>
</UAVariable>
<UAObject NodeId="ns=1;i=5" BrowseName="1:erp5-test-object-2" ParentNodeId="i=85">
<DisplayName>erp5-test-object-2</DisplayName>
<Description>erp5-test-object-2</Description>
<References>
<Reference ReferenceType="Organizes" IsForward="false">i=85</Reference>
<Reference ReferenceType="HasTypeDefinition">i=58</Reference>
<Reference ReferenceType="HasComponent">ns=1;i=6</Reference>
</References>
</UAObject>
<UAVariable NodeId="ns=1;i=6" BrowseName="1:erp5-variable" ParentNodeId="ns=1;i=5" DataType="Int64" AccessLevel="3" UserAccessLevel="3">
<DisplayName>erp5-variable</DisplayName>
<Description>erp5-variable</Description>
<References>
<Reference ReferenceType="HasComponent" IsForward="false">ns=1;i=5</Reference>
<Reference ReferenceType="HasTypeDefinition">i=63</Reference>
</References>
</UAVariable>
<UAObject NodeId="ns=1;i=7" BrowseName="1:erp5-test-object-3" ParentNodeId="i=85">
<DisplayName>erp5-test-object-3</DisplayName>
<Description>erp5-test-object-3</Description>
<References>
<Reference ReferenceType="Organizes" IsForward="false">i=85</Reference>
<Reference ReferenceType="HasTypeDefinition">i=58</Reference>
<Reference ReferenceType="HasComponent">ns=1;i=8</Reference>
</References>
</UAObject>
<UAVariable NodeId="ns=1;i=8" BrowseName="1:erp5-variable" ParentNodeId="ns=1;i=7" DataType="Int64" AccessLevel="3" UserAccessLevel="3">
<DisplayName>erp5-variable</DisplayName>
<Description>erp5-variable</Description>
<References>
<Reference ReferenceType="HasComponent" IsForward="false">ns=1;i=7</Reference>
<Reference ReferenceType="HasTypeDefinition">i=63</Reference>
</References>
</UAVariable>
<UAObject NodeId="ns=1;i=9" BrowseName="1:erp5-test-object-4" ParentNodeId="i=85">
<DisplayName>erp5-test-object-4</DisplayName>
<Description>erp5-test-object-4</Description>
<References>
<Reference ReferenceType="Organizes" IsForward="false">i=85</Reference>
<Reference ReferenceType="HasTypeDefinition">i=58</Reference>
<Reference ReferenceType="HasComponent">ns=1;i=10</Reference>
</References>
</UAObject>
<UAVariable NodeId="ns=1;i=10" BrowseName="1:erp5-variable" ParentNodeId="ns=1;i=9" DataType="Int64" AccessLevel="3" UserAccessLevel="3">
<DisplayName>erp5-variable</DisplayName>
<Description>erp5-variable</Description>
<References>
<Reference ReferenceType="HasComponent" IsForward="false">ns=1;i=9</Reference>
<Reference ReferenceType="HasTypeDefinition">i=63</Reference>
</References>
</UAVariable>
</UANodeSet>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment