Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Ivan Tyagov
slapos
Commits
7c3dee84
Commit
7c3dee84
authored
Jul 03, 2024
by
Ivan Tyagov
Committed by
Ivan Tyagov
Jul 30, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial import of oi-sensor from OSIE project repository.
parent
805c4dd2
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
279 additions
and
0 deletions
+279
-0
software/oi-sensor/buildout.hash.cfg
software/oi-sensor/buildout.hash.cfg
+3
-0
software/oi-sensor/instance-input-schema.json
software/oi-sensor/instance-input-schema.json
+22
-0
software/oi-sensor/instance-output-schema.json
software/oi-sensor/instance-output-schema.json
+7
-0
software/oi-sensor/instance.cfg.in
software/oi-sensor/instance.cfg.in
+52
-0
software/oi-sensor/software.cfg
software/oi-sensor/software.cfg
+60
-0
software/oi-sensor/software.cfg.json
software/oi-sensor/software.cfg.json
+14
-0
software/oi-sensor/test/README.md
software/oi-sensor/test/README.md
+1
-0
software/oi-sensor/test/setup.py
software/oi-sensor/test/setup.py
+52
-0
software/oi-sensor/test/test.py
software/oi-sensor/test/test.py
+61
-0
software/slapos-sr-testing/software.cfg
software/slapos-sr-testing/software.cfg
+7
-0
No files found.
software/oi-sensor/buildout.hash.cfg
0 → 100644
View file @
7c3dee84
[instance-profile]
filename = instance.cfg.in
md5sum = f190737372572aca2b726aa06fcf7345
software/oi-sensor/instance-input-schema.json
0 → 100644
View file @
7c3dee84
{
"$schema"
:
"https://json-schema.org/draft/2019-09/schema"
,
"description"
:
"Parameters to instantiate an Optical Inspection OPCUA sensor"
,
"type"
:
"object"
,
"configuration"
:
{
"headless"
:
{
"description"
:
"Run in a headless (without a X server)."
,
"type"
:
"int"
,
"default"
:
"1"
},
"camera"
:
{
"description"
:
"The index of the camera USB device represented as /dev/videoX."
,
"type"
:
"string"
,
"default"
:
""
},
"mode"
:
{
"description"
:
"The mode of operation of sensor. 0 - with camera support, 1 - no camera support (virtual mode)."
,
"type"
:
"int"
,
"default"
:
"0"
}
}
}
software/oi-sensor/instance-output-schema.json
0 → 100644
View file @
7c3dee84
{
"$schema"
:
"https://json-schema.org/draft/2019-09/schema"
,
"description"
:
"Values returned by oi-sensors's instantiation."
,
"additionalProperties"
:
false
,
"properties"
:
{},
"type"
:
"object"
}
software/oi-sensor/instance.cfg.in
0 → 100644
View file @
7c3dee84
[buildout]
parts =
promises
directory
oi-sensor-service
eggs-directory = {{ buildout["eggs-directory"] }}
develop-eggs-directory = {{ buildout["develop-eggs-directory"] }}
offline = true
[check-port-listening-promise]
recipe = slapos.cookbook:check_port_listening
path = ${directory:promise}/${:_buildout_section_name_}
[directory]
recipe = slapos.cookbook:mkdirectory
home = ${buildout:directory}
etc = ${:home}/etc
var = ${:home}/var
script = ${:etc}/run/
service = ${:etc}/service
promise = ${:etc}/promise/
log = ${:var}/log
bin = ${:home}/bin
[instance-parameter]
recipe = slapos.cookbook:slapconfiguration
computer = ${slap-connection:computer-id}
partition = ${slap-connection:partition-id}
url = ${slap-connection:server-url}
key = ${slap-connection:key-file}
cert = ${slap-connection:cert-file}
configuration.camera = 0
configuration.headless = 1
configuration.mode = 0
configuration.port = 4840
[oi-sensor-service]
recipe = slapos.cookbook:wrapper
command-line = {{ interpreter_location }}/py {{ osie_repository_location }}/oi-sensor/oi-sensor.py --headless ${instance-parameter:configuration.headless} --camera ${instance-parameter:configuration.camera} --mode ${instance-parameter:configuration.mode} --port ${instance-parameter:configuration.port}
wrapper-path = ${directory:service}/oi-sensor-service
output = $${:wrapper-path}
[oi-sensor-service-listen-promise-ipv4]
<= check-port-listening-promise
hostname = 0.0.0.0
port = ${instance-parameter:configuration.port}
[promises]
recipe =
instance-promises =
${oi-sensor-service-listen-promise-ipv4:path}
software/oi-sensor/software.cfg
0 → 100644
View file @
7c3dee84
[buildout]
allow-picked-versions = true
extends =
buildout.hash.cfg
../../stack/monitor/buildout.cfg
../../stack/slapos.cfg
../../component/python3/buildout.cfg
../../component/git/buildout.cfg
../../component/numpy/buildout.cfg
../../component/zlib/buildout.cfg
parts =
interpreter
slapos-cookbook
osie-repository
instance-profile
[opencv-python]
recipe = zc.recipe.egg:custom
egg = opencv-python-headless
rpath =
${zlib:location}/lib/
library-dirs =
${:rpath}
[interpreter]
recipe = zc.recipe.egg:scripts
interpreter = py
eggs =
${python-cffi:egg}
asyncua
${opencv-python:egg}
pyopenssl
${numpy:egg}
[osie-repository]
recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git
repository = https://lab.nexedi.com/nexedi/osie.git
revision = 02b7b07
[versions]
# XXX: using a wheel / binary code might be considered unsafe
# ideally we can compile this package in future.
cryptography = 42.0.8:whl
PyYAML = 6.0.1
aiosqlite = 0.20.0
aiofiles = 24.1.0
pyOpenSSL = 24.1.0
opencv-python-headless = 4.10.0.84
[instance-profile]
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/instance.cfg.in
rendered = ${buildout:directory}/instance.cfg
context =
section buildout buildout
key interpreter_location buildout:bin-directory
key osie_repository_location osie-repository:location
software/oi-sensor/software.cfg.json
0 → 100644
View file @
7c3dee84
{
"name"
:
"OSIE coupler"
,
"description"
:
"Coupler is an open source thin C client application supporting OPC UA protocol and used in conjunction with beremiz-ide / beremiz-runtime to control industrial processes on the shop field."
,
"serialisation"
:
"xml"
,
"software-type"
:
{
"default"
:
{
"title"
:
"Default"
,
"software-type"
:
"default"
,
"description"
:
"Default"
,
"request"
:
"instance-input-schema.json"
,
"response"
:
"instance-output-schema.json"
}
}
}
software/oi-sensor/test/README.md
0 → 100644
View file @
7c3dee84
Tests for oi-sensor software release
software/oi-sensor/test/setup.py
0 → 100644
View file @
7c3dee84
##############################################################################
#
# Copyright (c) 2018 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
setuptools
import
setup
,
find_packages
version
=
'0.0.1.dev0'
name
=
'slapos.test.oi-sensor'
with
open
(
"README.md"
)
as
f
:
long_description
=
f
.
read
()
setup
(
name
=
name
,
version
=
version
,
description
=
"Test for SlapOS' oi-sensor"
,
long_description
=
long_description
,
long_description_content_type
=
'text/markdown'
,
maintainer
=
"Nexedi"
,
maintainer_email
=
"info@nexedi.com"
,
url
=
"https://lab.nexedi.com/nexedi/slapos"
,
packages
=
find_packages
(),
install_requires
=
[
'slapos.core'
,
'slapos.libnetworkcache'
,
'erp5.util'
,
'psutil'
,
],
zip_safe
=
True
,
test_suite
=
'test'
,
)
software/oi-sensor/test/test.py
0 → 100644
View file @
7c3dee84
##############################################################################
# coding: utf-8
#
# Copyright (c) 2022 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import
os
import
psutil
from
slapos.testing.testcase
import
installSoftwareUrlList
,
makeModuleSetUpAndTestCaseClass
oi_sensor_software_release_url
=
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'software.cfg'
))
setUpModule
,
SlapOSInstanceTestCase
=
makeModuleSetUpAndTestCaseClass
(
os
.
path
.
abspath
(
oi_sensor_software_release_url
),
# skip software checks
skip_software_check
=
True
)
class
OISensorTestCase
(
SlapOSInstanceTestCase
):
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'headless'
:
1
,
'mode'
:
1
,
'port'
:
4840
}
def
test_process
(
self
):
with
self
.
slap
.
instance_supervisor_rpc
as
supervisor
:
process_names
=
[
process
[
'name'
]
for
process
in
supervisor
.
getAllProcessInfo
()]
self
.
assertIn
(
'oi-sensor-service-on-watch'
,
process_names
)
def
check_connection
(
self
,
ip
,
port
):
for
connection
in
psutil
.
net_connections
(
kind
=
'tcp4'
):
if
connection
.
laddr
.
ip
==
ip
and
connection
.
laddr
.
port
==
port
and
connection
.
status
==
'LISTEN'
:
return
True
return
False
def
test_opc_ua
(
self
):
self
.
assertTrue
(
self
.
check_connection
(
'0.0.0.0'
,
4840
))
software/slapos-sr-testing/software.cfg
View file @
7c3dee84
...
...
@@ -267,6 +267,11 @@ setup = ${slapos-repository:location}/software/js-drone/test/
egg = slapos.test.osie_coupler
setup = ${slapos-repository:location}/software/osie-coupler/test/
[slapos.test.oi-sensor-setup]
<= setup-develop-egg
egg = slapos.test.oi_sensor
setup = ${slapos-repository:location}/software/oi-sensor/test/
[slapos.core-repository]
<= git-clone-repository
repository = https://lab.nexedi.com/nexedi/slapos.core.git
...
...
@@ -378,6 +383,7 @@ eggs +=
${slapos.test.nginx-push-stream-setup:egg}
${slapos.test.ors-amarisoft-setup:egg}
${slapos.test.osie-coupler-setup:egg}
${slapos.test.oi-sensor-setup:egg}
${slapos.test.peertube-setup:egg}
${slapos.test.plantuml-setup:egg}
${slapos.test.powerdns-setup:egg}
...
...
@@ -473,6 +479,7 @@ tests =
nginx-push-stream ${slapos.test.nginx-push-stream-setup:setup}
ors-amarisoft ${slapos.test.ors-amarisoft-setup:setup}
osie-coupler ${slapos.test.osie-coupler-setup:setup}
oi-sensor ${slapos.test.oi-sensor-setup:setup}
peertube ${slapos.test.peertube-setup:setup}
plantuml ${slapos.test.plantuml-setup:setup}
powerdns ${slapos.test.powerdns-setup:setup}
...
...
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