From: arvindpatel Date: Wed, 2 Dec 2020 12:22:10 +0000 (+0530) Subject: Opc-au client and server added X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=commitdiff_plain;h=68b365b097590f156f08b840fac9953e1e93f379;p=eliot.git Opc-au client and server added Signed-off-by: arvindpatel Change-Id: Iaa210d7662df1c09c0f8af7137597801759895c8 --- diff --git a/blueprints/iotgateway/playbooks/eliot-all.yml b/blueprints/iotgateway/playbooks/eliot-all.yml index 294a138..430ff9d 100644 --- a/blueprints/iotgateway/playbooks/eliot-all.yml +++ b/blueprints/iotgateway/playbooks/eliot-all.yml @@ -117,6 +117,7 @@ - mepkubeconfig - cadvisor - el_edgex + - el_opc-au ### EdgeGallery related ### diff --git a/blueprints/iotgateway/playbooks/roles/el_opc-au/files/deploy/opc-au_client/Dockerfile b/blueprints/iotgateway/playbooks/roles/el_opc-au/files/deploy/opc-au_client/Dockerfile new file mode 100644 index 0000000..33704b5 --- /dev/null +++ b/blueprints/iotgateway/playbooks/roles/el_opc-au/files/deploy/opc-au_client/Dockerfile @@ -0,0 +1,15 @@ +FROM centos:centos7 +ADD ./work/ /root/work +RUN yum install -y gcc git +RUN yum groupinstall -y 'Development Tools' +RUN cd /root/work && ls -al && tar xzf cmake-3.15.2.tar.gz && \ + rpm -Uvh scons-2.3.0-1.el7.centos.noarch.rpm && \ + python get-pip.py && \ + cd cmake-3.15.2 && ./bootstrap && \ + make && \ + make install && \ + cd ../protocol-opcua-c/ && \ + ./build.sh + +# Execute script +ENTRYPOINT ["sh", "./client"] diff --git a/blueprints/iotgateway/playbooks/roles/el_opc-au/files/deploy/opc-au_client/build.sh b/blueprints/iotgateway/playbooks/roles/el_opc-au/files/deploy/opc-au_client/build.sh new file mode 100644 index 0000000..1888565 --- /dev/null +++ b/blueprints/iotgateway/playbooks/roles/el_opc-au/files/deploy/opc-au_client/build.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +############################################################################## +# Copyright (c) 2019 Huawei Tech and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +set -o errexit + +# set the docker name and docker tag when you build +DOCKER_NAME= +DOCKER_TAG= + +export ELIOT_DIR=$(cd $(dirname $0); pwd) +export WORK_DIR=$ELIOT_DIR/work +export CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v3.15.2/cmake-3.15.2.tar.gz +export SCONS_PPA_URL=http://repo.okay.com.mx/centos/7/x86_64/release//scons-2.3.0-1.el7.centos.noarch.rpm +export GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py +export OPCUA_REPO=https://github.com/edgexfoundry-holding/protocol-opcua-c.git +export DOCKER_NAME=${DOCKER_NAME:-"eliot/opc-ua-client"} +export DOCKER_TAG=${DOCKER_TAG:-"latest"} + + +rm -rf $WORK_DIR +mkdir -p $WORK_DIR + +cd $WORK_DIR +wget $CMAKE_URL +wget $SCONS_PPA_URL +wget $GET_PIP_URL +git clone $OPCUA_REPO + +cd $ELIOT_DIR +docker build ./ -t $DOCKER_NAME:$DOCKER_TAG diff --git a/blueprints/iotgateway/playbooks/roles/el_opc-au/files/deploy/opc-au_server/Dockerfile b/blueprints/iotgateway/playbooks/roles/el_opc-au/files/deploy/opc-au_server/Dockerfile new file mode 100644 index 0000000..7a5239a --- /dev/null +++ b/blueprints/iotgateway/playbooks/roles/el_opc-au/files/deploy/opc-au_server/Dockerfile @@ -0,0 +1,15 @@ +FROM centos:centos7 +ADD ./work/ /root/work +RUN yum install -y gcc git +RUN yum groupinstall -y 'Development Tools' +RUN cd /root/work && ls -al && tar xzf cmake-3.15.2.tar.gz && \ + rpm -Uvh scons-2.3.0-1.el7.centos.noarch.rpm && \ + python get-pip.py && \ + cd cmake-3.15.2 && ./bootstrap && \ + make && \ + make install && \ + cd ../protocol-opcua-c/ && \ + ./build.sh + +# Execute script +ENTRYPOINT ["sh", "./server] diff --git a/blueprints/iotgateway/playbooks/roles/el_opc-au/files/deploy/opc-au_server/build.sh b/blueprints/iotgateway/playbooks/roles/el_opc-au/files/deploy/opc-au_server/build.sh new file mode 100644 index 0000000..4ce672f --- /dev/null +++ b/blueprints/iotgateway/playbooks/roles/el_opc-au/files/deploy/opc-au_server/build.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +############################################################################## +# Copyright (c) 2019 Huawei Tech and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +set -o errexit + +# set the docker name and docker tag when you build +DOCKER_NAME= +DOCKER_TAG= + +export ELIOT_DIR=$(cd $(dirname $0); pwd) +export WORK_DIR=$ELIOT_DIR/work +export CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v3.15.2/cmake-3.15.2.tar.gz +export SCONS_PPA_URL=http://repo.okay.com.mx/centos/7/x86_64/release//scons-2.3.0-1.el7.centos.noarch.rpm +export GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py +export OPCUA_REPO=https://github.com/edgexfoundry-holding/protocol-opcua-c.git +export DOCKER_NAME=${DOCKER_NAME:-"eliot/opc-ua-server"} +export DOCKER_TAG=${DOCKER_TAG:-"latest"} + + +rm -rf $WORK_DIR +mkdir -p $WORK_DIR + +cd $WORK_DIR +wget $CMAKE_URL +wget $SCONS_PPA_URL +wget $GET_PIP_URL +git clone $OPCUA_REPO + +cd $ELIOT_DIR +docker build ./ -t $DOCKER_NAME:$DOCKER_TAG diff --git a/blueprints/iotgateway/playbooks/roles/el_opc-au/tasks/install.yml b/blueprints/iotgateway/playbooks/roles/el_opc-au/tasks/install.yml new file mode 100644 index 0000000..4d62990 --- /dev/null +++ b/blueprints/iotgateway/playbooks/roles/el_opc-au/tasks/install.yml @@ -0,0 +1,33 @@ +# +# Copyright 2020 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +--- + +- name: Doing deployment setup for el_opc-au + copy: + src: deploy + dest: /tmp/el_opc-au/ + +- name: Changing permisiion + command: chmod -R 755 /tmp/el_opc-au + +- name: Execute script for install opc-au-server + shell: + cmd: /tmp/el_opc-au/deploy/opc-au_server/build.sh + +- name: Execute script opc-ua-client build + shell: + cmd: /tmp/el_opc-au/deploy/opc-au_client/build.sh diff --git a/blueprints/iotgateway/playbooks/roles/el_opc-au/tasks/main.yml b/blueprints/iotgateway/playbooks/roles/el_opc-au/tasks/main.yml new file mode 100644 index 0000000..ca0b525 --- /dev/null +++ b/blueprints/iotgateway/playbooks/roles/el_opc-au/tasks/main.yml @@ -0,0 +1,26 @@ +# +# Copyright 2020 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +--- + +# tasks file for el_opc-au +- include: "install.yml" + static: false + when: operation == 'install' + +- include: "uninstall.yml" + static: false + when: operation == 'uninstall' diff --git a/blueprints/iotgateway/playbooks/roles/el_opc-au/tasks/uninstall.yml b/blueprints/iotgateway/playbooks/roles/el_opc-au/tasks/uninstall.yml new file mode 100644 index 0000000..b44eb1a --- /dev/null +++ b/blueprints/iotgateway/playbooks/roles/el_opc-au/tasks/uninstall.yml @@ -0,0 +1,24 @@ +# +# Copyright 2020 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +--- + +- name: Remove el_opc-au tmp folder + command: rm -rf /tmp/el_opc-au + args: + chdir: /tmp/ + ignore_errors: yes + no_log: True