Skip to content

Commit

Permalink
Kollaps 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiaoamaro committed Jun 15, 2022
1 parent f593f11 commit c414025
Show file tree
Hide file tree
Showing 633 changed files with 293,495 additions and 2,054 deletions.
Binary file added baremetal/communicationmanager
Binary file not shown.
Binary file added baremetal/controller
Binary file not shown.
Binary file added baremetal/emulationcore
Binary file not shown.
18 changes: 18 additions & 0 deletions baremetal/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#! /bin/sh
sudo rm /remote_ips.txt
sudo rm /tmp/topoinfo
sudo rm /tmp/topoinfodashboard
sudo rm /tmp/pipe*
sudo rm /tmp/logs.txt
sudo rm /logs.txt
sudo rm /ips.txt
# cd kollaps/emulationcore
# cargo build --release
# cd ..
# cd ..
# cd kollaps/controller
# cargo build --release
# cd ..
# cd ..
sudo cp libTCAL.so /usr/local/bin/libTCAL.so
sudo ./emulationcore $1 communicationmanager eno1 baremetal
29 changes: 17 additions & 12 deletions dockerfiles/DeploymentGenerator
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
FROM archlinux:latest
FROM ubuntu:21.10

WORKDIR /

RUN pacman -Sy --noconfirm \
archlinux-keyring && \
pacman -Sy --noconfirm \
bison \
flex \
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y\
gcc \
glibc \
flex \
bison \
gettext \
grep \
iproute2 \
iptables \
make \
pkgconf \
python \
python-pip
python3-pip \
&& apt-get clean -y

ADD ./kollaps /Kollaps/kollaps

ADD ./setup.py /Kollaps/setup.py

ADD ./ /Kollaps/
ADD /kube/ /root/.kube

RUN pip3 --no-cache-dir install wheel dnspython flask docker kubernetes netifaces && \
RUN pip3 --no-cache-dir install wheel dnspython flask docker kubernetes netifaces netaddr pyroute2 && \
pip3 --no-cache-dir wheel --no-deps -w /Kollaps /Kollaps && \
pip3 --no-cache-dir install /Kollaps/kollaps-1.0-py3-none-any.whl && \
rm -rf /Kollaps && \
mkdir /result && \
pip3 --no-cache-dir uninstall -y setuptools wheel pip
#pacman -R --noconfirm make gcc flex bison pkgconf && \
#pacman -Scc --noconfirm
66 changes: 42 additions & 24 deletions dockerfiles/Kollaps
Original file line number Diff line number Diff line change
@@ -1,48 +1,66 @@
FROM archlinux:latest
FROM ubuntu:21.10

WORKDIR /

# Location of netem distribution files on archlinux
ENV TC_LIB_DIR "/usr/share/tc/"

RUN pacman -Sy --noconfirm \
archlinux-keyring && \
pacman -Sy --noconfirm \
bison \
flex \
ARG openssl_arch=linux-x86_64
ENV DEBIAN_FRONTEND=noninteractive \
TC_LIB_DIR=/usr/lib/tc/
#JEMALLOC_SYS_WITH_MALLOC_CONF=background_thread:true,narenas:1,tcache:false,dirty_decay_ms:0,muzzy_decay_ms:0,abort_conf:true

RUN CONFIG_BPF=y \
CONFIG_BPF_SYSCALL=y \
CONFIG_NET_CLS_BPF=m \
CONFIG_NET_ACT_BPF=m \
CONFIG_BPF_JIT=y \
CONFIG_HAVE_BPF_JIT=y \
CONFIG_HAVE_EBPF_JIT=y \
CONFIG_BPF_EVENTS=y \
CONFIG_IKHEADERS=y \
CONFIG_NET_SCH_SFQ=m \
CONFIG_NET_ACT_POLICE=m \
CONFIG_NET_ACT_GACT=m \
CONFIG_DUMMY=m \
CONFIG_VXLAN=m


RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y\
gcc \
flex \
bison \
gettext \
glibc \
grep \
iproute2 \
iputils \
iptables \
make \
pkgconf \
python \
python-pip \
tcpdump
python3-pip \
vim \
&& apt-get clean -y

ADD ./pid1 /Kollaps/pid1

ADD ./ /Kollaps/
ADD ./kollaps/ /Kollaps/kollaps

RUN tar -C /Kollaps/ -zxvf Kollaps/Aeron.tar.gz && \
cp -r /Kollaps/Aeron/binaries /usr/bin/Aeron && \
mkdir -p /home/daedalus/Documents/aeron4need/cppbuild/Release/ && \
cp -r /Kollaps/Aeron/lib /home/daedalus/Documents/aeron4need/cppbuild/Release/lib && \
cp /Kollaps/Aeron/usr/lib/libbsd.so.0.9.1 /usr/lib/libbsd.so.0.9.1 && \
cp /Kollaps/Aeron/usr/lib/libbsd.so.0 /usr/lib/libbsd.so.0 && \
rm -f Aeron.tar.gz
ADD ./setup.py /Kollaps/setup.py

# LL: only added kubernetes in l.33
RUN make -C /Kollaps/pid1 && \
cp /Kollaps/pid1/pid1 /usr/bin/pid1 && \
make -C /Kollaps/kollaps/TCAL -j8 && \
pip3 --no-cache-dir install wheel dnspython flask docker kubernetes netifaces && \
pip3 --no-cache-dir install wheel dnspython flask docker kubernetes netifaces openssh_wrapper netaddr && \
pip3 --no-cache-dir wheel --no-deps -w /Kollaps /Kollaps && \
pip3 --no-cache-dir install /Kollaps/kollaps-1.0-py3-none-any.whl && \
cp /Kollaps/kollaps/TCAL/libTCAL.so /usr/local/bin/libTCAL.so && \
cp -R /Kollaps/kollaps/rustbinaries/communicationmanager /usr/bin/communicationmanager && \
cp -R /Kollaps/kollaps/rustbinaries/emulationcore /usr/bin/emulationcore && \
cp /Kollaps/kollaps/rustbinaries/libcommunicationcore.so /usr/local/bin/libcommunicationcore.so && \
rm -rf /Kollaps && \
pip3 --no-cache-dir uninstall -y setuptools wheel pip
#pacman -R --noconfirm make gcc flex bison pkgconf && \
#pacman -Scc --noconfirm
pip3 --no-cache-dir uninstall -y setuptools wheel pip3


WORKDIR /

ENTRYPOINT ["/usr/bin/pid1", "/usr/bin/python3", "-m", "kollaps.bootstrapper"]
4 changes: 2 additions & 2 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export DOCKER_BUILDKIT=1
docker build --rm -f dockerfiles/Kollaps -t kollaps:1.0 .
docker build -f dockerfiles/DeploymentGenerator -t kollaps-deployment-generator:1.0 .
```
Now you are ready to test [some applications](examples/).
Now you are ready to test [some applications](../examples/).

### Installation from Source <a name="source">

Expand All @@ -40,4 +40,4 @@ This installs the following tools:
- `ThunderstormTranslator` command, which lets you declare an experiment in a language with higher-level concepts which are then translated into XML topology descriptions.
Note that the examples below assume both tools are in your PATH, which might require restarting your shell.

The rest of the procedure to test applications is described [here](examples/).
The rest of the procedure to test applications is described [here](../examples/).
28 changes: 26 additions & 2 deletions docs/orchestrators.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,28 @@ docker network create --driver=overlay --subnet=10.1.0.0/24 kollaps_network
(Make sure to define a subnet that does not collide with other networks on your setup.)


### Setting up Baremetal

To create a baremetal deployment, a specific topology file has to be created, steps are described [here](https://github.com/miguelammatos/kollaps-private/wiki/Baremetal-experiments#topology-description)

After creating the topology file, you must put the baremetal folder (kollaps/baremetal) in the directories specified in the .xml on the remote machines

After setting up the remote machines, install Kollaps locally running:

```
sh localinstall.sh
```

And now you are ready to emulate network states on your remote machines, start the Dashboard with

```
python3 kollaps/Dashboard *directory of topology*
```


The dashboard has small differences in baremetal, the commands description can be seen [here](https://github.com/miguelammatos/kollaps-private/wiki/Baremetal-experiments#dashboard)

If in the remote machines the network devices have names different than eth0, please change it in the start.sh script located inside the baremetal folder.

### Setting up Kubernetes

Expand Down Expand Up @@ -45,8 +67,8 @@ Do this on all nodes.
Only on the master node, execute:

```
$sudo sysctl net.bridge.bridge-nf-call-iptables=1
$sudo kubeadm init --token-ttl=0
sudo sysctl net.bridge.bridge-nf-call-iptables=1
sudo kubeadm init --token-ttl=0
```

The `kubeadm init` command tells you to execute the following statements:
Expand All @@ -55,6 +77,8 @@ The `kubeadm init` command tells you to execute the following statements:
$mkdir -p $HOME/.kube && \
sudo cp /etc/kubernetes/admin.conf $HOME/.kube/config && \
sudo chown $(id -u):$(id -g) $HOME/.kube/config
mkdir kube
cp $HOME/.kube/config kube/config
```

It also gives you a join command like this: `sudo kubeadm join <IP>:<PORT> --token <TOKEN> --discovery-token-ca-cert-hash sha256:<HASH>`. Use this on the worker nodes to join the cluster.
Expand Down
10 changes: 9 additions & 1 deletion examples/KollapsAppBuilder
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SCRIPT_NAME=$0

function usage {
echo "usage: $SCRIPT_NAME <app_dir>"
echo " -app_dir name of the app to build: redis, iperf3"
echo " -app_dir name of the app to build: redis, iperf3,memcached and ping"
echo " -h/--help display this help message."
exit 1
}
Expand Down Expand Up @@ -32,6 +32,10 @@ case $1 in
docker build -f iperf3/iperf3-client/Dockerfile -t kollaps/iperf3-client:1.0 iperf3/iperf3-client
docker build -f iperf3/iperf3-server/Dockerfile -t kollaps/iperf3-server:1.0 iperf3/iperf3-server
;;
"iperf3network")
echo "Building images for the iPerf3network application..."
docker build -f iperf3network/Dockerfile -t kollaps/iperf3-network:1.0 iperf3network/
;;

"memcached")
echo "Building images for the memcacehd application..."
Expand All @@ -42,6 +46,10 @@ case $1 in
"redis")
echo "Building images for the Redis application..."
;;
"ping")
echo "Building images for the ping application..."
docker build -f ping/Dockerfile -t kollaps/ping-client:1.0 ping
;;

*)
echo "Not supported app: $1."
Expand Down
4 changes: 4 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,7 @@ Check the shell scripts under the *iperf3-client* and *iperf3-server* directory
#### Redis: <a name="redis"/>

redis: experiment that uses the Redis database

#### Ping: <a name="ping"/>

In this experiment nodes will ping each other.
47 changes: 47 additions & 0 deletions examples/iperf3/complextopology.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" ?>
<experiment boot="kollaps:1.0">
<services>
<!-- definition of the services (containers), -->
<!-- kollaps dashboard to controll the experiments, should be present in all deployments -->
<service name="dashboard" image="kollaps/dashboard:1.0" supervisor="true" port="8088"/>
<!-- iperf clients -->
<!-- <service name="client1" image="kollaps/iperf3-client:1.0" command="['server', '0', '0']"/> -->

<!-- the "command" can be used to pass parameters to the container entrypoints.
In this example we are passsing "server" which will be used to discover the IPs
of the servers at run time -->
<service name="client1" image="kollaps/iperf3-client:1.0" command="['server','1']"/>
<service name="client2" image="kollaps/iperf3-client:1.0" command="['server','2']"/>
<service name="client3" image="kollaps/iperf3-client:1.0" command="['server','3']"/>
<service name="client4" image="kollaps/iperf3-client:1.0" command="['server','3']"/>
<!-- iperf server, declared once, but three instances will be started, see below -->
<service name="server" image="kollaps/iperf3-server:1.0" share="false"/>
</services>
<bridges>
<!-- definition of the network elements (routers and switches) -->
<bridge name="s1"/>
<bridge name="s2"/>
<bridge name="s3"/>
</bridges>
<links>
<!-- definition of the links, the "network" should match the name of an existing container network -->
<link origin="client1" dest="s3" latency="5" upload="100Mbps" download="100Mbps" jitter = "0.3" drop="0.1" network="kollaps_network"/>
<link origin="client2" dest="s3" latency="5" upload="100Mbps" download="100Mbps" jitter = "0.3" drop="0.1" network="kollaps_network"/>
<link origin="client3" dest="s1" latency="5" upload="100Mbps" download="100Mbps" jitter = "0.3" drop="0.1" network="kollaps_network"/>
<link origin="client4" dest="server" latency="5" upload="10Mbps" download="10Mbps" jitter = "0.3" drop="0.1" network="kollaps_network"/>
<link origin="s1" dest="s2" latency="10" upload="60Mbps" download="60Mbps" jitter = "0.5" drop="0.1" network="kollaps_network"/>
<link origin="s2" dest="s3" latency="15" upload="20Mbps" download="20Mbps" jitter = "0.5" drop="0.1" network="kollaps_network"/>
<link origin="s3" dest="server" latency="5" upload="5Mbps" download="5Mbps" jitter = "0.5" drop="0.1" network="kollaps_network"/>
</links>
<dynamic>
<!-- schedulle the dynamics of the experiment. These apply to services and links, see documentation for more details.
This section can be ommited in which case all the services will be started at the beginning of the experiment -->
<schedule name="client1" time="0.0" action="join"/>
<schedule name="client2" time="0.0" action="join"/>
<schedule name="client3" time="0.0" action="join"/>
<schedule name="client4" time="0.0" action="join"/>
<!-- were we start three instances of the "server" service -->
<schedule name="server" time="0.0" action="join" amount="4"/>
<schedule name="server" time="120.0" action="leave" amount="4"/>
</dynamic>
</experiment>
56 changes: 56 additions & 0 deletions examples/iperf3/dynamic.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8" ?>
<experiment boot="kollaps:1.0">
<services>
<!-- definition of the services (containers), -->
<!-- kollaps dashboard to controll the experiments, should be present in all deployments -->
<service name="dashboard" image="kollaps/dashboard:1.0" supervisor="true" port="8088"/>
<!-- iperf clients -->
<!-- <service name="client1" image="kollaps/iperf3-client:1.0" command="['server', '0', '0']"/> -->

<!-- the "command" can be used to pass parameters to the container entrypoints.
In this example we are passsing "server" which will be used to discover the IPs
of the servers at run time -->
<service name="client1" image="kollaps/iperf3-client:1.0" command="['server','1']"/>
<service name="client2" image="kollaps/iperf3-client:1.0" command="['server','2']"/>
<service name="client3" image="kollaps/iperf3-client:1.0" command="['server','3']"/>
<!-- iperf server, declared once, but three instances will be started, see below -->
<service name="server" image="kollaps/iperf3-server:1.0" share="false"/>
</services>
<bridges>
<!-- definition of the network elements (routers and switches) -->
<bridge name="s1"/>
<bridge name="s2"/>
</bridges>
<links>
<!-- definition of the links, the "network" should match the name of an existing container network -->
<link origin="client1" dest="s1" latency="10" upload="100Mbps" download="100Mbps" network="kollaps_network"/>
<link origin="client2" dest="s1" latency="10" upload="100Mbps" download="100Mbps" network="kollaps_network"/>
<link origin="client3" dest="s1" latency="10" upload="100Mbps" download="100Mbps" network="kollaps_network"/>
<link origin="s1" dest="s2" latency="10" upload="60Mbps" download="60Mbps" network="kollaps_network"/>
<link origin="s2" dest="server" latency="5" upload="100Mbps" download="100Mbps" network="kollaps_network"/>
</links>
<dynamic>
<!-- schedulle the dynamics of the experiment. These apply to services and links, see documentation for more details.
This section can be ommited in which case all the services will be started at the beginning of the experiment -->
<schedule name="client1" time="0.0" action="join"/>
<schedule name="client2" time="0.0" action="join"/>
<schedule name="client3" time="0.0" action="join"/>
<!-- were we start three instances of the "server" service -->
<schedule name="server" time="0.0" action="join" amount="3"/>

<schedule origin="client1" dest="s1" time="5.0" latency="10" upload="5Mbps" download="100Mbps"/>
<schedule origin="client2" dest="s1" time="15.0" latency="10" upload="5Mbps" download="100Mbps"/>
<schedule origin="client3" dest="s1" time="25.0" latency="10" upload="5Mbps" download="100Mbps"/>

<schedule origin="s1" dest="s2" time="35.0" upload="5Mbps" download="5Mbps"/>

<schedule origin="client3" dest="s1" time="45.0" action="leave"/>

<schedule name="client1" time="60.0" action="crash"/>

<schedule name="client2" time="70.0" action="crash"/>
<schedule name="client3" time="80.0" action="crash"/>

<schedule name="server" time="120.0" action="leave" amount="3"/>
</dynamic>
</experiment>
2 changes: 1 addition & 1 deletion examples/iperf3/iperf3-client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM alpine:3.9
RUN apk add --no-cache \
bind-tools \
bash \
iperf3
iperf3

ADD ./client.sh /

Expand Down
10 changes: 5 additions & 5 deletions examples/iperf3/iperf3-client/client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ sleep 2
echo $1 >> /tmp/log

echo "Launched!"
host=$(hostname)
n=$((${#host}-1))
host_id="${host:$n:1}"
#host=$(hostname)
#n=$((${#host}-1))
host_id="$2"

#obtain the service identifier
service="$1-$KOLLAPS_UUID"
Expand All @@ -21,7 +21,7 @@ echo Service $service >> /tmp/log
server_ip=$(host $service | grep -oE '\d+\.\d+\.\d+\.\d+' | sort -u | sed -n ${host_id}p)
echo SERVER_IP $server_ip >> /tmp/log
iperf3 \
-J -c $server_ip \
-t 100 \
-c $server_ip \
-t 120 \
-p 6001 \
--logfile "/var/log/KOLLAPS_client$host_id.log" &
Loading

0 comments on commit c414025

Please sign in to comment.