Commit 3ba38a18 authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾

Move osie-coupler in a component

See merge request !1592
parents 9ff41437 e454f525
......@@ -5,9 +5,10 @@ parts =
open62541
extends =
../cmake/buildout.cfg
../git/buildout.cfg
../mbedtls/buildout.cfg
../patch/buildout.cfg
../python3/buildout.cfg
../gcc/buildout.cfg
../defaults.cfg
[gcc]
......@@ -27,6 +28,7 @@ pre-configure =
# remove old FindPython3 which does not know about python > 3.8 to
# use FindPython3 bundled with slapos' cmake
rm tools/cmake/FindPython3.cmake tools/cmake/FindPython/Support.cmake
${git:location}/bin/git clone -b v1.1.6 https://github.com/LiamBindle/MQTT-C.git deps/mqtt-c
configure-command =
${cmake:location}/bin/cmake
configure-options =
......@@ -34,9 +36,20 @@ configure-options =
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=@@LOCATION@@
-DUA_ENABLE_PUBSUB=ON
-DUA_ENABLE_PUBSUB_MONITORING=ON
-DUA_ENABLE_PUBSUB_ETH_UADP=ON
-DUA_ENABLE_SUBSCRIPTIONS=ON
-DUA_NAMESPACE_ZERO=REDUCED
-DUA_ENABLE_ENCRYPTION=MBEDTLS
-DUA_ENABLE_ENCRYPTION_MBEDTLS=ON
-DMBEDTLS_INCLUDE_DIRS=${mbedtls:location}/include
-DMBEDTLS_LIBRARY=${mbedtls:location}/lib/libmbedtls.so
-DMBEDX509_LIBRARY=${mbedtls:location}/lib/libmbedx509.so
-DMBEDCRYPTO_LIBRARY=${mbedtls:location}/lib/libmbedcrypto.so
-DUA_ENABLE_PUBSUB_INFORMATIONMODEL=ON
-DUA_ENABLE_PUBSUB_MQTT=ON
post-install =
cp src/pubsub/*.h deps/open62541_queue.h @@LOCATION@@/include
environment =
PATH=${gcc:prefix}/bin:${python3:location}/bin:${patch:location}/bin:%(PATH)s
LDFLAGS=-L${mbedtls:location}/lib -Wl,-rpath=${mbedtls:location}/lib
[buildout]
extends =
../git/buildout.cfg
../mbedtls/buildout.cfg
../open62541/buildout.cfg
../defaults.cfg
parts = osie-coupler
[gcc]
# we want this SR to use a fixed gcc (so that we have the same gcc as open62541 component)
max_version = 0
[osie-repository]
recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git
repository = https://lab.nexedi.com/nexedi/osie.git
revision = dd9aea8
[osie-coupler]
recipe = slapos.recipe.cmmi
path = ${osie-repository:location}/coupler
bin_dir = ${:path}/bin/
environment =
PATH=${gcc:prefix}/bin:/usr/bin
C_INCLUDE_PATH=${open62541:location}/include:${open62541:location}/deps:${open62541:location}/src/pubsub
LDFLAGS=-L${open62541:location}/lib -Wl,-rpath=${open62541:location}/lib -L ${mbedtls:location}/lib -Wl,-rpath=${mbedtls:location}/lib
configure-command = true
[instance-profile]
filename = instance.cfg.in
md5sum = 17549c62b5ad20cfe2520fb2ef133c22
md5sum = 5bff4e422a2b22bec348bc5e4cb2f3b7
......@@ -16,8 +16,6 @@ extends = {{ template_monitor }}
[coupler-opc-ua]
recipe = slapos.cookbook:wrapper
environment =
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:{{ open62541_location }}/lib:{{ mbedtls_location }}/lib
command-line =
{{ coupler_location }}server -d ${instance-parameter:configuration.coupler_block_device} -s ${instance-parameter:configuration.coupler_i2c_slave_list} -p ${instance-parameter:configuration.opc_ua_port} -u ${instance-parameter:configuration.username} -w ${instance-parameter:configuration.password} -b ${instance-parameter:configuration.heart_beat} -t ${instance-parameter:configuration.heart_beat_interval} -l ${instance-parameter:configuration.heart_beat_id_list} -n ${instance-parameter:configuration.network_address_url_data_type} -o ${instance-parameter:configuration.heart_beat_timeout_interval} -i ${instance-parameter:configuration.id} -m ${instance-parameter:configuration.mode} -j ${instance-parameter:configuration.network_interface}
wrapper-path = ${directory:service}/coupler-opc-ua
......
[buildout]
parts =
open62541
compile-coupler
slapos-cookbook
instance-profile
extends =
../../component/git/buildout.cfg
../../component/mbedtls/buildout.cfg
../../component/open62541/buildout.cfg
../../stack/monitor/buildout.cfg
../../stack/slapos.cfg
../../component/defaults.cfg
../../component/osie-coupler/buildout.cfg
[gcc]
# we want this SR to use a fixed gcc (so that we have the same gcc as open62541 component)
max_version = 0
[open62541]
pre-configure +=
${git:location}/bin/git clone -b v1.1.6 https://github.com/LiamBindle/MQTT-C.git deps/mqtt-c
configure-options =
-DBUILD_SHARED_LIBS=ON
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=@@LOCATION@@
-DUA_ENABLE_PUBSUB=ON
-DUA_ENABLE_PUBSUB_MONITORING=ON
-DUA_ENABLE_PUBSUB_ETH_UADP=ON
-DUA_NAMESPACE_ZERO=REDUCED
-DUA_ENABLE_ENCRYPTION=MBEDTLS
-DUA_ENABLE_ENCRYPTION_MBEDTLS=ON
-DMBEDTLS_INCLUDE_DIRS=${mbedtls:location}/include
-DMBEDTLS_LIBRARY=${mbedtls:location}/lib/libmbedtls.so
-DMBEDX509_LIBRARY=${mbedtls:location}/lib/libmbedx509.so
-DMBEDCRYPTO_LIBRARY=${mbedtls:location}/lib/libmbedcrypto.so
-DUA_ENABLE_PUBSUB_INFORMATIONMODEL=ON
-DUA_ENABLE_PUBSUB_MQTT=ON
environment +=
LDFLAGS=-L${mbedtls:location}/lib -Wl,-rpath=${mbedtls:location}/lib
# we need open62541's sources even after compiling and linking in [open62541]
# section. Reasons is that coupler's C application depends on it.
keep-compile-dir = true
source-location = @@LOCATION@@/.build/open62541-pack-${open62541:tag}
[osie-repository]
recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git
repository = https://lab.nexedi.com/nexedi/osie.git
revision = 5d193e57b50a7ebb3df147e403917201eb9cb6c6
[compile-coupler]
recipe = slapos.recipe.cmmi
path = ${osie-repository:location}/coupler
bin_dir = ${:path}/bin/
environment =
PATH=${gcc:prefix}/bin:/usr/bin
OPEN62541_HOME = ${open62541:location}
OPEN62541_SOURCE_HOME = ${open62541:source-location}
C_COMPILER_EXTRA_FLAGS = -L ${mbedtls:location}/lib -Wl,-rpath=${mbedtls:location}/lib -l:libopen62541.so -L${open62541:location}/lib -Wl,-rpath=${open62541:location}/lib -I${open62541:location}/include -I${open62541:source-location}/src/pubsub/ -I${open62541:source-location}/deps
configure-command = true
[instance-profile]
recipe = slapos.recipe.template:jinja2
......@@ -69,6 +18,4 @@ extensions = jinja2.ext.do
context =
section buildout buildout
raw template_monitor ${monitor2-template:output}
key open62541_location open62541:location
key mbedtls_location mbedtls:location
key coupler_location compile-coupler:bin_dir
key coupler_location osie-coupler:bin_dir
......@@ -35,10 +35,37 @@ setUpModule, SlapOSInstanceTestCase = makeModuleSetUpAndTestCaseClass(
class OsieTestCase(SlapOSInstanceTestCase):
MULTICAST_INTERFACE = 'lo'
MULTICAST_GROUP_COUNT = 2
MULTICAST_GROUP = '224.0.0.22'
@classmethod
def getInstanceParameterDict(cls):
return {"mode": 1}
return {"mode": 1, "network_interface": "127.0.0.1", "heart_beat_id_list": "1"}
def test(self):
parameter_dict = self.computer_partition.getConnectionParameterDict()
self.assertIn('url-ipv6', parameter_dict)
def test_process(self):
with self.slap.instance_supervisor_rpc as supervisor:
process_names = [process['name']
for process in supervisor.getAllProcessInfo()]
self.assertIn('coupler-opc-ua-on-watch', process_names)
def IPV4_to_little_endian_hex_str(self, ipv4_str):
hex_str_list = []
for int_str in ipv4_str.split('.'):
hex_str_list.append('%0.2X' % int(int_str))
return ''.join(reversed(hex_str_list))
def test_joined_multicast_grp(self):
with open('/proc/net/igmp') as f:
igmp_content = f.readlines()
for igmp_line in (
'1\t%s : %s V3\n' % (self.MULTICAST_INTERFACE, self.MULTICAST_GROUP_COUNT),
'\t\t\t\t%s 1 0:00000000\t\t0\n' % self.IPV4_to_little_endian_hex_str(self.MULTICAST_GROUP),
):
self.assertIn(igmp_line, igmp_content)
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