mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
Added lab for universal API server and client testing
Signed-off-by: pipeacosta <pipeacosta@gmail.com>
This commit is contained in:
parent
e9be876d36
commit
aadf1a8be9
3 changed files with 237 additions and 0 deletions
27
etc/labs/lab18_rest_api/docker-compose.yml
Normal file
27
etc/labs/lab18_rest_api/docker-compose.yml
Normal file
|
@ -0,0 +1,27 @@
|
|||
version: '3.1'
|
||||
|
||||
services:
|
||||
node1:
|
||||
container_name: villas_1
|
||||
# The following image is build from the VILLASnode Github repository, branch rest-api-lab, see:
|
||||
image: node:config-mvp
|
||||
ports:
|
||||
- "8080:8080/tcp"
|
||||
- "4445:4445/udp"
|
||||
volumes:
|
||||
- ./lab18_rest_api_ri1.conf:/etc/node/lab18_rest_api_ri1.conf
|
||||
command:
|
||||
- node
|
||||
- /etc/node/lab18_rest_api_ri1.conf
|
||||
|
||||
# node2:
|
||||
# container_name: villas_2
|
||||
# image: node:config-mvp
|
||||
# ports:
|
||||
# - "8080:8080/tcp"
|
||||
# - "4446:4446/udp"
|
||||
# volumes:
|
||||
# - ./node_ri2.conf:/etc/node/node_ri2.conf
|
||||
# command:
|
||||
# - node
|
||||
# - /etc/node/node_ri2.conf
|
108
etc/labs/lab18_rest_api/lab18_rest_api_ri1.conf
Normal file
108
etc/labs/lab18_rest_api/lab18_rest_api_ri1.conf
Normal file
|
@ -0,0 +1,108 @@
|
|||
http = {
|
||||
port = 8080
|
||||
}
|
||||
|
||||
nodes = {
|
||||
node_ri1_api = {
|
||||
type = "api"
|
||||
|
||||
in = {
|
||||
signals = (
|
||||
{
|
||||
name = "ri2-amp-p",
|
||||
type = "float",
|
||||
unit = "mW",
|
||||
description = "Active power",
|
||||
rate = 1,
|
||||
readable = true,
|
||||
writable = false,
|
||||
payload = "samples"
|
||||
},
|
||||
{
|
||||
name = "ri2-amp-q",
|
||||
type = "float",
|
||||
unit = "pu",
|
||||
description = "Reactive power",
|
||||
rate = 1,
|
||||
readable = true,
|
||||
writable = false,
|
||||
payload = "samples"
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
out = {
|
||||
signals = (
|
||||
# Output signals have no name, type and unit settings as those are implicitly
|
||||
# derived from the signals which are routed to this node
|
||||
{
|
||||
description = "Frequency",
|
||||
rate = 1,
|
||||
readable = true,
|
||||
writable = false,
|
||||
payload = "samples"
|
||||
},
|
||||
{
|
||||
description = "Voltage",
|
||||
rate = 1,
|
||||
readable = true,
|
||||
writable = false,
|
||||
payload = "samples"
|
||||
}
|
||||
)
|
||||
}
|
||||
},
|
||||
|
||||
node_ri1_rtds = {
|
||||
type = "signal.v2"
|
||||
rate = 1.0
|
||||
# signal = "mixed"
|
||||
|
||||
in = {
|
||||
signals = (
|
||||
{ name = "ri1-rtds-f", signal = "constant", amplitude = 1.0, enabled = true },
|
||||
{ name = "ri1-rtds-u", signal = "constant", amplitude = 2.0, enabled = true }
|
||||
)
|
||||
}
|
||||
},
|
||||
|
||||
loopback_node = {
|
||||
type = "loopback",
|
||||
queuelen = 1024
|
||||
}
|
||||
|
||||
# node_ri1_rtds = {
|
||||
# type = "socket",
|
||||
# format = "gtnet",
|
||||
|
||||
# in = {
|
||||
# address = "*:4445",
|
||||
# signals = (
|
||||
# { name = "ri1-rtds-f", type = "float", enabled = true},
|
||||
# { name = "ri1-rtds-u", type = "float", enabled = true}
|
||||
# )
|
||||
# },
|
||||
# out = {
|
||||
# address = "134.130.169.107:4446"
|
||||
# }
|
||||
# }
|
||||
}
|
||||
|
||||
paths = (
|
||||
{
|
||||
in = [
|
||||
"node_ri1_api"
|
||||
]
|
||||
out = [
|
||||
"loopback_node"
|
||||
]
|
||||
},
|
||||
{
|
||||
in = [
|
||||
"node_ri1_rtds"
|
||||
]
|
||||
out = [
|
||||
"node_ri1_api"
|
||||
]
|
||||
}
|
||||
)
|
102
etc/labs/lab18_rest_api/lab18_rest_api_ri2.conf
Normal file
102
etc/labs/lab18_rest_api/lab18_rest_api_ri2.conf
Normal file
|
@ -0,0 +1,102 @@
|
|||
nodes = {
|
||||
node_ri2_client = {
|
||||
type = "api-client",
|
||||
|
||||
# The HTTP REST API endpoint of the uAPI server
|
||||
endpoint = "http://137.226.133.196:8080/api/v2/universal/node_ri1_api",
|
||||
|
||||
rate = 1 # Rate at which we poll the broker for updates
|
||||
timeout = 0.5, # Timeout of HTTP request in seconds (default is 1, must be smaller than 1 / rate)
|
||||
verify_ssl = false, # Verification of SSL server certificates (default is true)
|
||||
|
||||
in = {
|
||||
signals = (
|
||||
{
|
||||
name = "ri1-rtds-f",
|
||||
type = "float",
|
||||
unit = "Hz",
|
||||
description = "Frequency",
|
||||
rate = 1,
|
||||
readable = true,
|
||||
writable = false,
|
||||
payload = "samples"
|
||||
},
|
||||
{
|
||||
name = "ri1-rtds-u",
|
||||
type = "float",
|
||||
unit = "kV",
|
||||
description = "Voltage",
|
||||
rate = 1,
|
||||
readable = true,
|
||||
writable = false,
|
||||
payload = "samples"
|
||||
}
|
||||
)
|
||||
},
|
||||
|
||||
out = {
|
||||
signals = (
|
||||
# Output signals have no name, type and unit settings as those are implicitly
|
||||
# derived from the signals which are routed to this node
|
||||
{
|
||||
description = "Active power",
|
||||
rate = 1,
|
||||
readable = true,
|
||||
writable = false,
|
||||
payload = "samples"
|
||||
},
|
||||
{
|
||||
description = "Reactive power",
|
||||
rate = 1,
|
||||
readable = true,
|
||||
writable = false,
|
||||
payload = "samples"
|
||||
}
|
||||
)
|
||||
}
|
||||
},
|
||||
|
||||
node_ri2_amp = {
|
||||
type = "socket",
|
||||
layer = "udp",
|
||||
|
||||
format = {
|
||||
type = "json",
|
||||
compact = true
|
||||
},
|
||||
|
||||
in = {
|
||||
address = "*:4446",
|
||||
signals = (
|
||||
{ name = "ri2-amp-p", type = "float", enabled = true},
|
||||
{ name = "ri2-amp-q", type = "float", enabled = true}
|
||||
)
|
||||
},
|
||||
|
||||
out = {
|
||||
address = "137.226.133.196:4445"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
paths = (
|
||||
{
|
||||
in = [
|
||||
"node_ri2_client"
|
||||
]
|
||||
out = [
|
||||
"node_ri2_amp"
|
||||
]
|
||||
},
|
||||
{
|
||||
in = [
|
||||
"node_ri2_amp"
|
||||
]
|
||||
out = [
|
||||
"node_ri2_client"
|
||||
],
|
||||
hooks = (
|
||||
{ type = "print" }
|
||||
)
|
||||
}
|
||||
)
|
Loading…
Add table
Reference in a new issue