mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
Merge branch 'master' of github.com:RWTH-ACS/S2SS
This commit is contained in:
commit
5be85c01a5
26 changed files with 162 additions and 511 deletions
|
@ -1,3 +1,5 @@
|
|||
# S2SS clients
|
||||
|
||||
This directory contains code and projects to connect
|
||||
various simulators and tools to the S2SS server.
|
||||
|
|
@ -87,7 +87,6 @@ static void *SendToIPPort(void *arg)
|
|||
|
||||
/* Data from the S2SS server */
|
||||
struct msg msg = MSG_INIT(0);
|
||||
int msg_size;
|
||||
|
||||
#ifdef _DEBUG // TODO: workaround
|
||||
msg_send = &msg;
|
||||
|
@ -96,69 +95,65 @@ static void *SendToIPPort(void *arg)
|
|||
OpalPrint("%s: SendToIPPort thread started\n", PROGNAME);
|
||||
|
||||
OpalGetNbAsyncSendIcon(&nbSend);
|
||||
if (nbSend >= 1) {
|
||||
do {
|
||||
/* This call unblocks when the 'Data Ready' line of a send icon is asserted. */
|
||||
if ((n = OpalWaitForAsyncSendRequest(&SendID)) != EOK) {
|
||||
ModelState = OpalGetAsyncModelState();
|
||||
if ((ModelState != STATE_RESET) && (ModelState != STATE_STOP)) {
|
||||
OpalSetAsyncSendIconError(n, SendID);
|
||||
OpalPrint("%s: OpalWaitForAsyncSendRequest(), errno %d\n", PROGNAME, n);
|
||||
}
|
||||
|
||||
continue;
|
||||
if (nbSend < 1) {
|
||||
OpalPrint("%s: SendToIPPort: No transimission block for this controller. Stopping thread.\n", PROGNAME);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do {
|
||||
/* This call unblocks when the 'Data Ready' line of a send icon is asserted. */
|
||||
if ((n = OpalWaitForAsyncSendRequest(&SendID)) != EOK) {
|
||||
ModelState = OpalGetAsyncModelState();
|
||||
if ((ModelState != STATE_RESET) && (ModelState != STATE_STOP)) {
|
||||
OpalSetAsyncSendIconError(n, SendID);
|
||||
OpalPrint("%s: OpalWaitForAsyncSendRequest(), errno %d\n", PROGNAME, n);
|
||||
}
|
||||
|
||||
/* No errors encountered yet */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* No errors encountered yet */
|
||||
OpalSetAsyncSendIconError(0, SendID);
|
||||
|
||||
/* Get the size of the data being sent by the unblocking SendID */
|
||||
OpalGetAsyncSendIconDataLength(&mdldata_size, SendID);
|
||||
if (mdldata_size / sizeof(double) > MSG_VALUES) {
|
||||
OpalPrint("%s: Number of signals for SendID=%d exceeds allowed maximum (%d)\n",
|
||||
PROGNAME, SendID, MSG_VALUES);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Read data from the model */
|
||||
OpalGetAsyncSendIconData(mdldata, mdldata_size, SendID);
|
||||
|
||||
msg.length = mdldata_size / sizeof(double);
|
||||
for (i = 0; i < msg.length; i++)
|
||||
msg.data[i].f = (float) mdldata[i];
|
||||
|
||||
/* Convert to network byte order */
|
||||
msg.sequence = htonl(seq++);
|
||||
msg.length = htons(msg.length);
|
||||
|
||||
/* Perform the actual write to the ip port */
|
||||
if (SendPacket((char *) &msg, MSG_LEN(&msg)) < 0)
|
||||
OpalSetAsyncSendIconError(errno, SendID);
|
||||
else
|
||||
OpalSetAsyncSendIconError(0, SendID);
|
||||
|
||||
/* Get the size of the data being sent by the unblocking SendID */
|
||||
OpalGetAsyncSendIconDataLength(&mdldata_size, SendID);
|
||||
if (mdldata_size / sizeof(double) > MSG_VALUES) {
|
||||
OpalPrint("%s: Number of signals for SendID=%d exceeds allowed maximum (%d)\n",
|
||||
PROGNAME, SendID, MSG_VALUES);
|
||||
/* This next call allows the execution of the "asynchronous" process
|
||||
* to actually be synchronous with the model. To achieve this, you
|
||||
* should set the "Sending Mode" in the Async_Send block to
|
||||
* NEED_REPLY_BEFORE_NEXT_SEND or NEED_REPLY_NOW. This will force
|
||||
* the model to wait for this process to call this
|
||||
* OpalAsyncSendRequestDone function before continuing. */
|
||||
OpalAsyncSendRequestDone(SendID);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
/* Before continuing, we make sure that the real-time model
|
||||
* has not been stopped. If it has, we quit. */
|
||||
ModelState = OpalGetAsyncModelState();
|
||||
} while ((ModelState != STATE_RESET) && (ModelState != STATE_STOP));
|
||||
|
||||
/* Read data from the model */
|
||||
OpalGetAsyncSendIconData(mdldata, mdldata_size, SendID);
|
||||
|
||||
/******* FORMAT TO SPECIFIC PROTOCOL HERE *****************************/
|
||||
// msg.dev_id = SendID; /* Use the SendID as a device ID here */
|
||||
msg.sequence = htons(seq++);
|
||||
msg.length = mdldata_size / sizeof(double);
|
||||
|
||||
for (i = 0; i < msg.length; i++)
|
||||
msg.data[i].f = (float) mdldata[i];
|
||||
|
||||
msg_size = MSG_LEN(msg.length);
|
||||
/**********************************************************************/
|
||||
|
||||
/* Perform the actual write to the ip port */
|
||||
if (SendPacket((char *) &msg, msg_size) < 0)
|
||||
OpalSetAsyncSendIconError(errno, SendID);
|
||||
else
|
||||
OpalSetAsyncSendIconError(0, SendID);
|
||||
|
||||
/* This next call allows the execution of the "asynchronous" process
|
||||
* to actually be synchronous with the model. To achieve this, you
|
||||
* should set the "Sending Mode" in the Async_Send block to
|
||||
* NEED_REPLY_BEFORE_NEXT_SEND or NEED_REPLY_NOW. This will force
|
||||
* the model to wait for this process to call this
|
||||
* OpalAsyncSendRequestDone function before continuing. */
|
||||
OpalAsyncSendRequestDone(SendID);
|
||||
|
||||
/* Before continuing, we make sure that the real-time model
|
||||
* has not been stopped. If it has, we quit. */
|
||||
ModelState = OpalGetAsyncModelState();
|
||||
} while ((ModelState != STATE_RESET) && (ModelState != STATE_STOP));
|
||||
|
||||
OpalPrint("%s: SendToIPPort: Finished\n", PROGNAME);
|
||||
}
|
||||
else {
|
||||
OpalPrint("%s: SendToIPPort: No transimission block for this controller. Stopping thread.\n", PROGNAME);
|
||||
}
|
||||
OpalPrint("%s: SendToIPPort: Finished\n", PROGNAME);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -176,91 +171,82 @@ static void *RecvFromIPPort(void *arg)
|
|||
|
||||
/* Data from the S2SS server */
|
||||
struct msg msg = MSG_INIT(0);
|
||||
unsigned msg_size;
|
||||
|
||||
OpalPrint("%s: RecvFromIPPort thread started\n", PROGNAME);
|
||||
|
||||
OpalGetNbAsyncRecvIcon(&nbRecv);
|
||||
if (nbRecv >= 1) {
|
||||
do {
|
||||
|
||||
/******* FORMAT TO SPECIFIC PROTOCOL HERE ******************************/
|
||||
n = RecvPacket((char *) &msg, sizeof(msg), 1.0);
|
||||
|
||||
/** @todo: Check and ntohs() sequence number! */
|
||||
|
||||
if (msg.version != MSG_VERSION) {
|
||||
OpalPrint("%s: Received message with unknown version. Skipping..\n", PROGNAME);
|
||||
continue;
|
||||
}
|
||||
else if (msg.type != MSG_TYPE_DATA) {
|
||||
OpalPrint("%s: Received no data. Skipping..\n", PROGNAME);
|
||||
continue;
|
||||
}
|
||||
|
||||
/** @todo: We may check the sequence number here. */
|
||||
|
||||
msg.sequence = ntohs(msg.sequence);
|
||||
|
||||
if (msg.endian != MSG_ENDIAN_HOST)
|
||||
msg_swap(&msg);
|
||||
|
||||
msg_size = MSG_LEN(msg.length);
|
||||
/***********************************************************************/
|
||||
|
||||
if (n < 1) {
|
||||
ModelState = OpalGetAsyncModelState();
|
||||
if ((ModelState != STATE_RESET) && (ModelState != STATE_STOP)) {
|
||||
// n == 0 means timeout, so we continue silently
|
||||
//if (n == 0)
|
||||
// OpalPrint("%s: Timeout while waiting for data\n", PROGNAME, errno);
|
||||
// n == -1 means a more serious error, so we print it
|
||||
if (n == -1)
|
||||
OpalPrint("%s: Error %d while waiting for data\n", PROGNAME, errno);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if (n != msg_size) {
|
||||
OpalPrint("%s: Received incoherent packet (size: %d, complete: %d)\n", PROGNAME, n, msg_size);
|
||||
continue;
|
||||
}
|
||||
|
||||
/******* FORMAT TO SPECIFIC PROTOCOL HERE *******************************/
|
||||
OpalSetAsyncRecvIconStatus(msg.sequence, RecvID); /* Set the Status to the message ID */
|
||||
OpalSetAsyncRecvIconError(0, RecvID); /* Set the Error to 0 */
|
||||
|
||||
/* Get the number of signals to send back to the model */
|
||||
OpalGetAsyncRecvIconDataLength(&mdldata_size, RecvID);
|
||||
|
||||
if (mdldata_size / sizeof(double) > MSG_VALUES) {
|
||||
OpalPrint("%s: Number of signals for RecvID=%d (%d) exceeds allowed maximum (%d)\n",
|
||||
PROGNAME, RecvID, mdldata_size / sizeof(double), MSG_VALUES);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (mdldata_size / sizeof(double) > msg.length) {
|
||||
OpalPrint("%s: Number of signals for RecvID=%d (%d) exceeds what was received (%d)\n",
|
||||
PROGNAME, RecvID, mdldata_size / sizeof(double), msg.length);
|
||||
}
|
||||
|
||||
for (i = 0; i < msg.length; i++)
|
||||
mdldata[i] = (double) msg.data[i].f;
|
||||
/************************************************************************/
|
||||
|
||||
OpalSetAsyncRecvIconData(mdldata, mdldata_size, RecvID);
|
||||
|
||||
/* Before continuing, we make sure that the real-time model
|
||||
* has not been stopped. If it has, we quit. */
|
||||
ModelState = OpalGetAsyncModelState();
|
||||
} while ((ModelState != STATE_RESET) && (ModelState != STATE_STOP));
|
||||
|
||||
OpalPrint("%s: RecvFromIPPort: Finished\n", PROGNAME);
|
||||
}
|
||||
else {
|
||||
if (nbRecv < 1) {
|
||||
OpalPrint("%s: RecvFromIPPort: No reception block for this controller. Stopping thread.\n", PROGNAME);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do {
|
||||
/* Receive message */
|
||||
n = RecvPacket((char *) &msg, sizeof(msg), 1.0);
|
||||
if (n < 1) {
|
||||
ModelState = OpalGetAsyncModelState();
|
||||
if ((ModelState != STATE_RESET) && (ModelState != STATE_STOP)) {
|
||||
if (n == 0) /* timeout, so we continue silently */
|
||||
OpalPrint("%s: Timeout while waiting for data\n", PROGNAME, errno);
|
||||
if (n == -1) /* a more serious error, so we print it */
|
||||
OpalPrint("%s: Error %d while waiting for data\n", PROGNAME, errno);
|
||||
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check message contents */
|
||||
if (msg.version != MSG_VERSION) {
|
||||
OpalPrint("%s: Received message with unknown version. Skipping..\n", PROGNAME);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (msg.type != MSG_TYPE_DATA) {
|
||||
OpalPrint("%s: Received no data. Skipping..\n", PROGNAME);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Convert to host byte order */
|
||||
msg.sequence = ntohl(msg.sequence);
|
||||
msg.length = ntohs(msg.length);
|
||||
|
||||
if (n != MSG_LEN(&msg)) {
|
||||
OpalPrint("%s: Received incoherent packet (size: %d, complete: %d)\n", PROGNAME, n, MSG_LEN(&msg));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (msg.endian != MSG_ENDIAN_HOST)
|
||||
msg_swap(&msg);
|
||||
|
||||
/* Update OPAL model */
|
||||
OpalSetAsyncRecvIconStatus(msg.sequence, RecvID); /* Set the Status to the message ID */
|
||||
OpalSetAsyncRecvIconError(0, RecvID); /* Set the Error to 0 */
|
||||
|
||||
/* Get the number of signals to send back to the model */
|
||||
OpalGetAsyncRecvIconDataLength(&mdldata_size, RecvID);
|
||||
if (mdldata_size / sizeof(double) > MSG_VALUES) {
|
||||
OpalPrint("%s: Number of signals for RecvID=%d (%d) exceeds allowed maximum (%d)\n",
|
||||
PROGNAME, RecvID, mdldata_size / sizeof(double), MSG_VALUES);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (mdldata_size / sizeof(double) > msg.length)
|
||||
OpalPrint("%s: Number of signals for RecvID=%d (%d) exceeds what was received (%d)\n",
|
||||
PROGNAME, RecvID, mdldata_size / sizeof(double), msg.length);
|
||||
|
||||
for (i = 0; i < msg.length; i++)
|
||||
mdldata[i] = (double) msg.data[i].f;
|
||||
|
||||
OpalSetAsyncRecvIconData(mdldata, mdldata_size, RecvID);
|
||||
|
||||
/* Before continuing, we make sure that the real-time model
|
||||
* has not been stopped. If it has, we quit. */
|
||||
ModelState = OpalGetAsyncModelState();
|
||||
} while ((ModelState != STATE_RESET) && (ModelState != STATE_STOP));
|
||||
|
||||
OpalPrint("%s: RecvFromIPPort: Finished\n", PROGNAME);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
mount /dev/sdb1 /media/usb
|
||||
|
||||
for part in dev sys proc; do
|
||||
umount /media/usb/$part
|
||||
mount -o bind /$part /media/usb/$part
|
||||
done
|
||||
|
||||
chroot /media/usb
|
|
@ -1,7 +0,0 @@
|
|||
GRUB_TIMEOUT=5
|
||||
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
|
||||
GRUB_DEFAULT=1
|
||||
GRUB_DISABLE_SUBMENU=false
|
||||
GRUB_TERMINAL_OUTPUT="console"
|
||||
GRUB_CMDLINE_LINUX="isolcpus=6,7 selinux=0 audit=0"
|
||||
GRUB_DISABLE_RECOVERY=true
|
|
@ -1 +0,0 @@
|
|||
unknown-s2ss
|
|
@ -1,10 +0,0 @@
|
|||
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
|
||||
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
|
||||
|
||||
# Orchestrator
|
||||
|
||||
# ACS hosts
|
||||
134.130.169.31 acs-s2ss
|
||||
134.130.169.32 acs-gtfpga
|
||||
137.226.160.69 acs-opal
|
||||
137.226.160.115 acs-workstation
|
|
@ -1 +0,0 @@
|
|||
0.5-turin
|
|
@ -1 +0,0 @@
|
|||
setup.sh
|
|
@ -1,3 +0,0 @@
|
|||
blacklist snd_hda_intel
|
||||
blacklist nouveau
|
||||
blacklist mei_me
|
|
@ -1,3 +0,0 @@
|
|||
# More conservative interrupt throttling for better latency
|
||||
# https://www.kernel.org/doc/Documentation/networking/e1000e.txt
|
||||
option e1000e InterruptThrottleRate=1
|
|
@ -1,31 +0,0 @@
|
|||
*filter
|
||||
:INPUT ACCEPT
|
||||
:FORWARD ACCEPT
|
||||
:OUTPUT ACCEPT
|
||||
|
||||
# Allow loopback traffic
|
||||
-A INPUT -i lo -j ACCEPT
|
||||
|
||||
# Allow established connections, and those not coming from the outside
|
||||
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
|
||||
|
||||
# Allow HTTP
|
||||
-A INPUT -p tcp --dport http -m conntrack --ctstate NEW -j ACCEPT
|
||||
|
||||
# Allow SSH
|
||||
-A INPUT -p tcp --dport ssh -m conntrack --ctstate NEW -j ACCEPT
|
||||
|
||||
# Allow Tinc
|
||||
-A INPUT -p udp --dport tinc -j ACCEPT
|
||||
-A INPUT -p tcp --dport tinc -j ACCEPT
|
||||
|
||||
# Accept Pings
|
||||
-A INPUT -p icmpv6 -j ACCEPT
|
||||
|
||||
# Reject everything else
|
||||
-A INPUT -j REJECT
|
||||
|
||||
# We wont act as a router
|
||||
-A FORWARD -j REJECT
|
||||
|
||||
COMMIT
|
|
@ -1,34 +0,0 @@
|
|||
*filter
|
||||
:INPUT ACCEPT
|
||||
:FORWARD ACCEPT
|
||||
:OUTPUT ACCEPT
|
||||
|
||||
# Allow loopback traffic
|
||||
-A INPUT -i lo -j ACCEPT
|
||||
|
||||
# Allow established connections, and those not coming from the outside
|
||||
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
|
||||
|
||||
# Allow HTTP
|
||||
-A INPUT -p tcp --dport http -m conntrack --ctstate NEW -j ACCEPT
|
||||
|
||||
# Allow VPN
|
||||
-A INPUT -s 10.0.0.0/8 -j ACCEPT
|
||||
|
||||
# Allow SSH
|
||||
-A INPUT -p tcp --dport ssh -m conntrack --ctstate NEW -j ACCEPT
|
||||
|
||||
# Allow Tinc
|
||||
-A INPUT -p udp --dport tinc -j ACCEPT
|
||||
-A INPUT -p tcp --dport tinc -j ACCEPT
|
||||
|
||||
# Accept Pings
|
||||
-A INPUT -p icmp -j ACCEPT
|
||||
|
||||
# Reject everything else
|
||||
-A INPUT -j REJECT
|
||||
|
||||
# We wont act as a router
|
||||
-A FORWARD -j REJECT
|
||||
|
||||
COMMIT
|
|
@ -1 +0,0 @@
|
|||
NETWORKING=yes
|
|
@ -1,15 +0,0 @@
|
|||
[Unit]
|
||||
Description=dhclient on all interfaces
|
||||
Wants=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart=/sbin/dhclient -4 -w
|
||||
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
|
||||
TimeoutSec=60
|
||||
|
||||
[Install]
|
||||
WantedBy=network.target
|
|
@ -1,15 +0,0 @@
|
|||
[Unit]
|
||||
Description=The mongoose Web server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=nobody
|
||||
Group=nobody
|
||||
Restart=always
|
||||
ExecStart=/usr/bin/mongoose -p 80 -r /var/www/
|
||||
StandardOutput=syslog
|
||||
SyslogIdentifier=mongoose
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1,16 +0,0 @@
|
|||
[Unit]
|
||||
Description=S2SS LiveUSB Image setup
|
||||
Requires=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/etc/image/setup.sh
|
||||
RemainAfterExit=yes
|
||||
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
|
||||
TimeoutSec=60
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1 +0,0 @@
|
|||
latency-performance
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
rpm -Uvh http://ccrma.stanford.edu/planetccrma/mirror/fedora/linux/planetccrma/20/i386/planetccrma-repo-1.1-3.fc20.ccrma.noarch.rpm
|
||||
|
||||
yum update
|
||||
|
||||
yum install planetccrma-core
|
||||
|
||||
source update_boot.sh
|
|
@ -1,56 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
RECIPIENTS="stvogel@eonerc.rwth-aachen.de,mstevic@eonerc.rwth-aachen.de"
|
||||
|
||||
SERVER=s2ss.0l.de
|
||||
USER=acs
|
||||
|
||||
PORT=$(shuf -i 60000-65535 -n 1)
|
||||
|
||||
# wait for working network connection
|
||||
while ! curl http://canihazip.com/s &> /dev/null; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
IP=$(curl -s http://canihazip.com/s)
|
||||
HOSTNAME=$(dig +short -x $IP)
|
||||
if [ -z "$HOSTNAME" ]; then
|
||||
HOSTNAME=$(hostname)
|
||||
fi
|
||||
|
||||
# check if system has net connectivity. otherwise die...
|
||||
ssh -q -o ConnectTimeout=2 $USER@$SERVER
|
||||
|
||||
# setup SSH tunnel for mail notification
|
||||
ssh -f -N -L 25:localhost:25 $USER@$SERVER
|
||||
# setup SSH reverse tunnel for remote administration
|
||||
ssh -f -N -R $PORT:localhost:22 $USER@$SERVER
|
||||
|
||||
# send mail with notification about new node
|
||||
sendmail "$RECIPIENTS" <<EOF
|
||||
Subject: New S2SS node alive: $IP ($HOSTNAME)
|
||||
From: Simulator2Simulator Server <acs@0l.de>
|
||||
To: $RECIPIENTS
|
||||
|
||||
There's a new host with the S2SS LiveUSB Image running:
|
||||
|
||||
Version: $(cat /etc/image-release)
|
||||
Reverse SSH tunnel port: $PORT
|
||||
Internet IP: $IP
|
||||
Hostname: $HOSTNAME
|
||||
|
||||
Latency:
|
||||
$(ping -qc 5 $SERVER)
|
||||
|
||||
Traceroute:
|
||||
$(traceroute $SERVER)
|
||||
|
||||
Interfaces:
|
||||
$(ip addr)
|
||||
|
||||
Hardware:
|
||||
$(lshw)
|
||||
|
||||
EOF
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# author: Christian Berendt <mail@cberendt.net>
|
||||
|
||||
set -x
|
||||
|
||||
for kernel in $(find /boot/vmlinuz*); do
|
||||
version=$(basename $kernel)
|
||||
version=${version#*-}
|
||||
if [ ! -e /boot/initramfs-$version.img ]; then
|
||||
sudo /usr/bin/dracut /boot/initramfs-$version.img $version
|
||||
fi
|
||||
done
|
||||
|
||||
for image in $(find /boot/initramfs*); do
|
||||
version=${image%.img}
|
||||
version=${version#*initramfs-}
|
||||
if [ ! -e /boot/vmlinuz-$version ]; then
|
||||
sudo rm $image
|
||||
fi
|
||||
done
|
||||
|
||||
/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
authconfig-6.2.6-4.fc20.x86_64
|
||||
automake-1.13.4-6.fc20.noarch
|
||||
bash-completion-2.1-3.fc20.noarch
|
||||
bind-utils-9.9.4-18.P2.fc20.x86_64
|
||||
biosdevname-0.5.0-2.fc20.x86_64
|
||||
bzip2-1.0.6-9.fc20.x86_64
|
||||
dhclient-4.2.7-2.fc20.x86_64
|
||||
dosfstools-3.0.27-1.fc20.x86_64
|
||||
dracut-config-rescue-037-11.git20140402.fc20.x86_64
|
||||
e2fsprogs-1.42.12-3.fc20.x86_64
|
||||
efibootmgr-0.11.0-1.fc20.x86_64
|
||||
ftp-0.17-65.fc20.x86_64
|
||||
gcc-4.8.3-7.fc20.x86_64
|
||||
gdb-7.7.1-21.fc20.x86_64
|
||||
gdisk-0.8.10-2.fc20.x86_64
|
||||
git-svn-1.9.3-2.fc20.x86_64
|
||||
grub2-2.00-27.fc20.x86_64
|
||||
htop-1.0.3-3.fc20.x86_64
|
||||
iptables-services-1.4.19.1-1.fc20.x86_64
|
||||
kbd-1.15.5-12.fc20.x86_64
|
||||
kernel-modules-extra-3.18.9-100.fc20.x86_64
|
||||
kernel-rt-modules-extra-3.14.29-200.rt26.1.fc20.ccrma.x86_64
|
||||
libconfig-1.4.9-5.fc20.x86_64
|
||||
lshw-B.02.17-2.fc20.x86_64
|
||||
lzo-devel-2.08-1.fc20.x86_64
|
||||
mailx-12.5-11.fc20.x86_64
|
||||
man-db-2.6.5-6.fc20.x86_64
|
||||
minicom-2.6.2-4.fc20.x86_64
|
||||
nano-2.3.2-5.fc20.x86_64
|
||||
nmap-6.45-1.fc20.x86_64
|
||||
ntp-4.2.6p5-20.fc20.x86_64
|
||||
numactl-2.0.9-2.fc20.x86_64
|
||||
openssh-server-6.4p1-8.fc20.x86_64
|
||||
openssl-devel-1.0.1e-41.fc20.x86_64
|
||||
parted-3.1-13.fc20.x86_64
|
||||
passwd-0.79-2.fc20.x86_64
|
||||
patch-2.7.1-7.fc20.x86_64
|
||||
pciutils-devel-3.3.0-1.fc20.x86_64
|
||||
planetccrma-repo-1.1-3.fc20.ccrma.noarch
|
||||
policycoreutils-2.2.5-4.fc20.x86_64
|
||||
psmisc-22.20-3.fc20.x86_64
|
||||
readline-devel-6.2-10.fc20.x86_64
|
||||
rootfiles-8.1-16.fc20.noarch
|
||||
schedtool-1.3.0-9.fc20.x86_64
|
||||
screen-4.1.0-0.19.20120314git3c2946.fc20.x86_64
|
||||
setserial-2.17-34.fc20.x86_64
|
||||
socat-1.7.2.4-1.fc20.x86_64
|
||||
ssmtp-2.64-14.fc20.x86_64
|
||||
sudo-1.8.12-1.fc20.x86_64
|
||||
tar-1.26-31.fc20.x86_64
|
||||
tcpdump-4.5.1-3.fc20.x86_64
|
||||
texinfo-5.1-4.fc20.x86_64
|
||||
traceroute-2.0.20-1.fc20.x86_64
|
||||
tuned-2.4.1-3.fc20.noarch
|
||||
wget-1.16.1-2.fc20.x86_64
|
||||
yum-utils-1.1.31-27.fc20.noarch
|
|
@ -1,45 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# die on error
|
||||
set -e
|
||||
|
||||
if [ "$(hostname)" != "acs-s2ss" ]; then
|
||||
echo "This script has to be run only acs-s2ss!" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo -e "This script must be run as root" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IP=78.91.103.24
|
||||
PORT=12010
|
||||
IPT=iptables
|
||||
RULE1="-p udp --dport $PORT -s $IP -j REJECT"
|
||||
RULE2="-p tcp --dport $PORT -s $IP -j REJECT"
|
||||
|
||||
case $1 in
|
||||
block)
|
||||
$IPT -I INPUT 1 $RULE1
|
||||
$IPT -I INPUT 1 $RULE2
|
||||
service tincd restart
|
||||
;;
|
||||
|
||||
unblock)
|
||||
$IPT -D INPUT $RULE1
|
||||
$IPT -D INPUT $RULE2
|
||||
service tincd restart
|
||||
;;
|
||||
|
||||
status)
|
||||
$IPT -C INPUT $RULE1 && echo "Tinc UDP is blocked"
|
||||
$IPT -C INPUT $RULE2 && echo "Tinc TCP is blocked"
|
||||
|
||||
echo -n "Sintef "
|
||||
tinc -n s2ss info sintef | grep "Reachability"
|
||||
|
||||
echo -n "Frankfurt "
|
||||
tinc -n s2ss info fra | grep "Reachability"
|
||||
;;
|
||||
esac
|
|
@ -12,11 +12,11 @@ Install libraries including developement headers for:
|
|||
|
||||
Use the following command to install the dependencies under Debian-based distributions:
|
||||
|
||||
$ sudo apt-get install libconfig-dev libnl-3-dev libnl-route-3-dev
|
||||
$ sudo apt-get install build-essential pkg-config libconfig-dev libnl-3-dev libnl-route-3-dev libpci-deb libjansson-dev libcurl4-openssl-dev uuid-dev
|
||||
|
||||
or the following line for Fedora / CentOS / Redhat systems:
|
||||
|
||||
$ sudo yum install iproute2 libconfig-devel libnl3-devel
|
||||
$ sudo yum install pkgconfig gcc make libconfig-devel libnl3-devel pciutils-devel libcurl-devel jansson-devel libuuid-devel
|
||||
|
||||
**Important:** Please note that the server requires the
|
||||
[iproute2](http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2)
|
||||
|
|
|
@ -31,7 +31,7 @@ endif
|
|||
# Enable file node type support
|
||||
ifndef DISABLE_FILE
|
||||
override CFLAGS += -DENABLE_FILE
|
||||
OBJS += ngsi.o
|
||||
OBJS += file.o
|
||||
endif
|
||||
|
||||
# Enable Socket node type when libnl3 is available
|
||||
|
|
|
@ -118,6 +118,8 @@ static int ngsi_request(CURL *handle, json_t *content, json_t **response)
|
|||
|
||||
if (response)
|
||||
*response = resp;
|
||||
else
|
||||
json_decref(resp);
|
||||
|
||||
free(post);
|
||||
free(chunk.data);
|
||||
|
@ -129,27 +131,27 @@ void ngsi_prepare_context(struct node *n, config_setting_t *mapping)
|
|||
{
|
||||
struct ngsi *i = n->ngsi;
|
||||
|
||||
i->context = json_object();
|
||||
json_t *elements = json_array();
|
||||
|
||||
json_object_set(i->context, "contextElements", elements);
|
||||
|
||||
i->context = json_object();
|
||||
i->context_len = config_setting_length(mapping);
|
||||
i->context_map = alloc(i->context_len * sizeof(json_t *));
|
||||
|
||||
json_t *elements = json_array();
|
||||
|
||||
for (int j = 0; j < i->context_len; j++) {
|
||||
/* Get token */
|
||||
config_setting_t *ctoken = config_setting_get_elem(mapping, j);
|
||||
|
||||
const char *stoken = config_setting_get_string(ctoken);
|
||||
if (!stoken)
|
||||
cerror(mapping, "Invalid token");
|
||||
|
||||
/* Parse token */
|
||||
char eid[64], etype[64], aname[64], atype[64];
|
||||
if (sscanf(stoken, "%63[^().](%63[^().]).%63[^().](%63[^().])", eid, etype, aname, atype) != 4)
|
||||
cerror(ctoken, "Invalid token: '%s'", stoken);
|
||||
|
||||
/* Create entity */
|
||||
json_t *attributes;
|
||||
json_t *attributes; /* borrowed reference */
|
||||
|
||||
json_t *entity = json_lookup(elements, "id", eid);
|
||||
if (!entity) {
|
||||
entity = json_pack("{ s: s, s: s, s: b }",
|
||||
|
@ -157,10 +159,10 @@ void ngsi_prepare_context(struct node *n, config_setting_t *mapping)
|
|||
"type", etype,
|
||||
"isPattern", 0
|
||||
);
|
||||
json_array_append_new(elements, entity);
|
||||
|
||||
attributes = json_array();
|
||||
json_object_set(entity, "attributes", attributes);
|
||||
json_array_append(elements, entity);
|
||||
json_object_set_new(entity, "attributes", attributes);
|
||||
}
|
||||
else {
|
||||
if (i->structure == NGSI_CHILDREN)
|
||||
|
@ -169,27 +171,19 @@ void ngsi_prepare_context(struct node *n, config_setting_t *mapping)
|
|||
attributes = json_object_get(entity, "attributes");
|
||||
}
|
||||
|
||||
/* Create attribute */
|
||||
/* Create attribute for entity */
|
||||
if (json_lookup(attributes, "name", aname))
|
||||
cerror(ctoken, "Duplicated attribute '%s' in NGSI mapping of node '%s'", aname, n->name);
|
||||
|
||||
json_t *metadatas;
|
||||
json_t *attribute = json_pack("{ s: s, s: s, s: s }",
|
||||
"name", aname,
|
||||
"type", atype,
|
||||
"value", "0"
|
||||
);
|
||||
/* Create Metadata for attribute */
|
||||
json_t *metadatas = json_array();
|
||||
|
||||
metadatas = json_array();
|
||||
json_object_set(attribute, "metadatas", metadatas);
|
||||
|
||||
/* Metadata */
|
||||
json_array_append(metadatas, json_pack("{ s: s, s: s, s: s }",
|
||||
json_array_append_new(metadatas, json_pack("{ s: s, s: s, s: s }",
|
||||
"name", "source",
|
||||
"type", "string",
|
||||
"value", "s2ss"
|
||||
));
|
||||
json_array_append(metadatas, json_pack("{ s: s, s: s, s: i }",
|
||||
json_array_append_new(metadatas, json_pack("{ s: s, s: s, s: i }",
|
||||
"name", "index",
|
||||
"type", "integer",
|
||||
"value", j
|
||||
|
@ -201,28 +195,36 @@ void ngsi_prepare_context(struct node *n, config_setting_t *mapping)
|
|||
));
|
||||
|
||||
if (i->structure == NGSI_CHILDREN) {
|
||||
json_array_append(attributes, json_pack("{ s: s, s: s, s: s }",
|
||||
json_array_append_new(attributes, json_pack("{ s: s, s: s, s: s }",
|
||||
"name", "parentId",
|
||||
"type", "uuid",
|
||||
"value", eid
|
||||
));
|
||||
|
||||
json_array_append(attributes, json_pack("{ s: s, s: s, s: s }",
|
||||
json_array_append_new(attributes, json_pack("{ s: s, s: s, s: s }",
|
||||
"name", "source",
|
||||
"type", "string",
|
||||
"value", "measurement"
|
||||
));
|
||||
|
||||
json_array_append(attributes, json_pack("{ s: s, s: s, s: o }",
|
||||
json_array_append_new(attributes, json_pack("{ s: s, s: s, s: o }",
|
||||
"name", "timestamp",
|
||||
"type", "date",
|
||||
"value", json_date(NULL)
|
||||
));
|
||||
}
|
||||
|
||||
json_array_append(attributes, attribute);
|
||||
i->context_map[j] = attribute;
|
||||
json_t *attribute = i->context_map[j] = json_pack("{ s: s, s: s, s: s }",
|
||||
"name", aname,
|
||||
"type", atype,
|
||||
"value", "0"
|
||||
);
|
||||
|
||||
json_object_set_new(attribute, "metadatas", metadatas);
|
||||
json_array_append_new(attributes, attribute);
|
||||
}
|
||||
|
||||
json_object_set_new(i->context, "contextElements", elements);
|
||||
}
|
||||
|
||||
int ngsi_init(int argc, char *argv[], struct settings *set)
|
||||
|
@ -310,7 +312,7 @@ int ngsi_open(struct node *n)
|
|||
curl_easy_setopt(i->curl, CURLOPT_HTTPHEADER, i->headers);
|
||||
|
||||
/* Create entity and atributes */
|
||||
json_object_set(i->context, "updateAction", json_string("APPEND"));
|
||||
json_object_set_new(i->context, "updateAction", json_string("APPEND"));
|
||||
return ngsi_request(i->curl, i->context, NULL) == 200 ? 0 : -1;
|
||||
}
|
||||
|
||||
|
@ -319,7 +321,7 @@ int ngsi_close(struct node *n)
|
|||
struct ngsi *i = n->ngsi;
|
||||
|
||||
/* Delete attributes */
|
||||
json_object_set(i->context, "updateAction", json_string("DELETE"));
|
||||
json_object_set_new(i->context, "updateAction", json_string("DELETE"));
|
||||
int code = ngsi_request(i->curl, i->context, NULL) == 200 ? 0 : -1;
|
||||
|
||||
curl_easy_cleanup(i->curl);
|
||||
|
@ -363,12 +365,12 @@ int ngsi_write(struct node *n, struct msg *pool, int poolsize, int first, int cn
|
|||
json_t *entity, *elements = json_object_get(i->context, "contextElements");
|
||||
size_t ind;
|
||||
json_array_foreach(elements, ind, entity)
|
||||
json_object_set(entity, "id", json_uuid());
|
||||
json_object_set_new(entity, "id", json_uuid());
|
||||
|
||||
json_object_set(i->context, "updateAction", json_string("APPEND"));
|
||||
json_object_set_new(i->context, "updateAction", json_string("APPEND"));
|
||||
}
|
||||
else
|
||||
json_object_set(i->context, "updateAction", json_string("UPDATE"));
|
||||
json_object_set_new(i->context, "updateAction", json_string("UPDATE"));
|
||||
|
||||
json_t *response;
|
||||
int code = ngsi_request(i->curl, i->context, &response);
|
||||
|
|
|
@ -111,7 +111,7 @@ static void usage(const char *name)
|
|||
#ifdef ENABLE_SOCKET
|
||||
printf(" - socket: Network socket (libnl3)\n");
|
||||
#endif
|
||||
#ifdef ENABLE_PCI
|
||||
#ifdef ENABLE_GTFPGA
|
||||
printf(" - gtfpga: GTFPGA PCIe card (libpci)\n");
|
||||
#endif
|
||||
#ifdef ENABLE_OPAL_ASYNC
|
||||
|
|
Loading…
Add table
Reference in a new issue