1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

Merge branch 'master' into dftHook

Conflicts:
	.gitlab-ci.yml
This commit is contained in:
Steffen Vogel 2021-02-19 01:40:17 +01:00
commit a2b5f1abb2
10 changed files with 143 additions and 84 deletions

View file

@ -24,7 +24,7 @@ stages:
# Build docker image which is used to build & test VILLASnode
prepare:docker:
stage: prepare
image: docker:19.03
image: docker:20.10
script:
- docker build ${DOCKER_OPTS}
--file ${DOCKER_FILE}
@ -206,17 +206,18 @@ pkg:rpm:
pkg:alpine:
stage: packaging
image: docker:19.03
image: docker:20.10
before_script:
- mkdir -p ~/.docker/cli-plugins/
- wget -O ~/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/v0.4.2/buildx-v0.4.2.linux-amd64
- chmod a+x ~/.docker/cli-plugins/docker-buildx
- docker buildx create --use --name cross-platform-build
- docker buildx create --use --name cross-platform-build --buildkitd-flags "--allow-insecure-entitlement security.insecure"
- docker buildx inspect --bootstrap cross-platform-build
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
script:
- docker buildx build ${DOCKER_OPTS}
--pull
--allow security.insecure
--output type=docker
--target app
--build-arg ARCH=${ARCH}
@ -267,7 +268,7 @@ deploy:web:
deploy:docker:
stage: deploy
image: docker:19.03
image: docker:20.10
variables:
DOCKER_CLI_EXPERIMENTAL: enabled
before_script:
@ -324,7 +325,7 @@ deploy:packages:tags:
.latest:docker:latest: &deploy_latest_docker
stage: latest
image: docker:19.03
image: docker:20.10
before_script:
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
script:

View file

@ -311,10 +311,6 @@ int websocket_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, voi
int avail, enqueued;
struct websocket *w = (struct websocket *) n->_vd;
struct sample *smps[cnt];
if (!smps) {
warning("Failed to allocate memory for connection: %s", websocket_connection_name(c));
break;
}
avail = sample_alloc_many(&w->pool, smps, cnt);
if (avail < cnt)

View file

@ -1,12 +1,5 @@
# Dockerfile for VILLASnode development.
#
# This Dockerfile builds an image which contains all library dependencies
# and tools to build VILLASnode.
# However, VILLASnode itself it not part of the image.
#
# This image can be used for developing VILLASnode
# by running:
# make docker-dev
#syntax=docker/dockerfile:1.2-labs
# Alpine Dockerfile
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC
@ -87,7 +80,8 @@ ADD packaging/deps.sh /
# https://github.com/creytiv/re/issues/256
# https://github.com/mz-automation/libiec61850/issues/279
RUN export SKIP_CRITERION=1; \
RUN --security=insecure \
export SKIP_CRITERION=1; \
export SKIP_ETHERLAB=1; \
export SKIP_LIBRE=1; \
if [ "${ARCH}" == "armv6" -o "${ARCH}" == "armv7" ]; then \
@ -103,9 +97,10 @@ COPY . /villas/
RUN mkdir -p /villas/build
WORKDIR /villas/build
RUN cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} \
RUN --security=insecure \
cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DCMAKE_PREFIX_PATH=${PREFIX} .. && \
make -j$(nproc) install
make -j8 install
FROM alpine:edge AS app
@ -115,22 +110,23 @@ ARG TRIPLET=x86_64-alpine-linux-musl
RUN echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN apk update
RUN apk add \
openssl \
ossp-uuid@testing \
libconfig \
curl \
jansson \
spdlog \
fmt \
libnl3 \
graphviz \
protobuf \
protobuf-c \
zeromq \
rabbitmq-c \
mosquitto \
libusb
openssl \
libconfig \
curl \
jansson \
spdlog \
fmt \
libnl3 \
graphviz \
protobuf \
protobuf-c \
zeromq \
rabbitmq-c \
mosquitto \
libusb \
ossp-uuid@testing
RUN if [ "${ARCH}" != "armv6" -a "${ARCH}" != "armv7" ]; then \
apk add \
@ -144,7 +140,7 @@ ENV LD_LIBRARY_PATH=/app/lib:/app/lib64
ENV PATH=/app/bin:${PATH}
# Test if it runs
RUN villas node -h 2&>1 > /dev/null
RUN /app/bin/villas-node -h 2>&1 > /dev/null
ARG GIT_REV=unknown
ARG GIT_BRANCH=unknown

View file

@ -1,12 +1,4 @@
# Dockerfile for VILLASnode development.
#
# This Dockerfile builds an image which contains all library dependencies
# and tools to build VILLASnode.
# However, VILLASnode itself it not part of the image.
#
# This image can be used for developing VILLASnode
# by running:
# make docker
# CentOS Dockerfile
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC
@ -39,7 +31,7 @@ USER root
# Enable Extra Packages for Enterprise Linux (EPEL) repo and PowerTools
RUN dnf -y install epel-release dnf-plugins-core
RUN dnf config-manager --set-enabled PowerTools
RUN dnf config-manager --set-enabled powertools
# Toolchain
RUN dnf -y install \

View file

@ -1,12 +1,4 @@
# Dockerfile for VILLASnode development.
#
# This Dockerfile builds an image which contains all library dependencies
# and tools to build VILLASnode.
# However, VILLASnode itself it not part of the image.
#
# This image can be used for developing VILLASnode
# by running:
# make docker
# Debian Dockerfile
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC

View file

@ -1,12 +1,4 @@
# Dockerfile for VILLASnode development.
#
# This Dockerfile builds an image which contains all library dependencies
# and tools to build VILLASnode.
# However, VILLASnode itself it not part of the image.
#
# This image can be used for developing VILLASnode
# by running:
# make docker
# Debian Multiarch Dockerfile
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC

View file

@ -1,12 +1,4 @@
# Dockerfile for VILLASnode development.
#
# This Dockerfile builds an image which contains all library dependencies
# and tools to build VILLASnode.
# However, VILLASnode itself it not part of the image.
#
# This image can be used for developing VILLASnode
# by running:
# make docker-dev
# Fedora Dockerfile
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC

View file

@ -1,4 +1,4 @@
# Minimal Dockerfile for building VILLASnode
# Minimal Fedora Dockerfile
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC

View file

@ -1,12 +1,4 @@
# Dockerfile for VILLASnode development.
#
# This Dockerfile builds an image which contains all library dependencies
# and tools to build VILLASnode.
# However, VILLASnode itself it not part of the image.
#
# This image can be used for developing VILLASnode
# by running:
# make docker
# Ubuntu Dockerfile
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC

View file

@ -0,0 +1,106 @@
import time
from villas.node.node import Node as VILLASnode
# This could be moved to the DPsim Python code later
def get_dpsim_shmem_interface_signals():
""" It would be nice if the DPsim Shmem interface could
build-up a list of actual signal descriptions
(names, units, etc..) which attributes are exported.
This would eliviate the user from manually configuring
signal mappings """
signals = []
for i in range(0, 30):
signals.append({
'name': f'signal_{i}',
'type': 'float',
'unit': 'volts'
})
return signals
def get_dpsim_shmem_interface_config():
return {
'type': 'shmem',
'in': {
'name': '/dpsim1-villas',
'hooks': [
{
'type': 'stats'
}
],
'signals': get_dpsim_shmem_interface_signals()
},
'out': {
'name': '/villas-dpsim1'
}
}
def get_villas_config():
return {
'nodes': {
'broker1': {
'type': 'mqtt',
'format': 'json',
'host': '172.17.0.1',
'in': {
'subscribe': '/powerflow-dpsim'},
'out': {
'publish': '/dpsim-powerflow'
}
},
'dpsim1': get_dpsim_shmem_interface_config(),
},
'paths': [
{
'in': 'dpsim1',
'out': 'broker1',
'hooks': [
{
'type': 'limit_rate',
'rate': 50
}
]
}
]
}
def main():
node = VILLASnode(
config=get_villas_config()
)
node.start() # VILLASnode starts running in the background from here..
# Some infos from the running VILLASnode instance queried via its REST API
print('VILLASnode running?: ', node.is_running())
print('VILLASnode status: ', node.status)
print('VILLASnode nodes: ', node.nodes)
print('VILLASnode paths: ', node.paths)
print('VILLASnode config: ', node.active_config)
print('VILLASnode version: ', node.get_version())
# Load a new config into the running
# VILLASnode instance (old config will be replaced)
new_config = node.active_config
new_config['paths'].append({
'out': 'dpsim1',
'in': 'broker1'
})
node.load_config(new_config)
time.sleep(100)
node.stop()
if __name__ == 'main':
main()