Skip to content

Commit 46774a3

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents fe7809e + 0ba44f3 commit 46774a3

File tree

5,844 files changed

+33408
-2922112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

5,844 files changed

+33408
-2922112
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ swagger-codegen*
66
.vscode/*
77
.idea/*
88
cmake-build-debug/*
9+
Vagrantfile

AUTHORS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@ The following people, in alphabetical order, have either authored or signed
22
off on commits in the Polycube repository:
33

44
Aasif Shaikh aasif@shaikh.cc
5+
Davide Antonino Giorgio davideantonino94@gmail.com
6+
Elis Lulja elis.lulja@gmail.com
57
Francesco Messina francescomessina92@hotmail.com
68
Fulvio Risso fulvio.risso@polito.it
9+
Gianluca Scopelliti gianlu.1033@gmail.com
710
Jianwen Pi jianwpi@gmail.com
811
Matteo Bertrone m.bertrone@gmail.com
912
Mauricio Vásquez Bernal mauriciovasquezbernal@gmail.com
13+
Nico Caprioli nico.caprioli@gmail.com
14+
Riccardo Marchi riccardo.marchi4@gmail.com
1015
Sebastiano Miano mianosebastiano@gmail.com
16+
Simone Magnani simonemagnani.96@gmail.com
1117
Yunsong Lu roamer@yunsong.lu
1218

1319
The following additional people are mentioned in commit logs as having provided

CI/Jenkinsfile.groovy

Lines changed: 508 additions & 0 deletions
Large diffs are not rendered by default.

CI/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Scripts for Continuous Integration
2+
3+
This folder contains the scripts that are used by Polycube continuous integration system, currently based on Jenkins.
4+
5+
- ``JenkinsfileTestBuild``: checks if the build script works.
6+
- ``JenkinsfileTestCleanInstance``: builds Polycube and runs all tests (both the ones related to the framework and the ones specific for each individual service). Polycubed is restarted at the end of each test.
7+
- ``JenkinsfileTestSameInstance``: builds Polycube and runs all tests (both the ones related to the framework and the ones specific for each individual service). Polycubed is never restarted; a single instance runs all tests.
8+
- ``JenkinsfileTestIptables``: builds pcn-iptables and runs all tests related to this component.
9+

CI/clean_slave.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
# Removing binaries
3+
echo "# Removing binaries"
4+
echo "removing /usr/local/bin/pcn*"
5+
sudo rm -rf /usr/local/bin/pcn*
6+
echo "removing /usr/local/bin/polycube*"
7+
sudo rm -rf /usr/local/bin/polycube*
8+
echo "removing /usr/local/share/polycube"
9+
sudo rm -rf /usr/local/share/polycube
10+
# Removing headers
11+
echo "# Removing headers"
12+
echo "removing /usr/include/polycube"
13+
sudo rm -rf /usr/include/polycube
14+
# Removing libraries
15+
echo "# Removing libraries"
16+
for lib in $(ls /usr/lib | grep "libp"); do
17+
echo "removing /usr/lib/$lib"
18+
sudo rm -rf /usr/lib/$lib
19+
done
20+
for lib in $(ls /usr/local/lib | grep "lib"); do
21+
echo "removing /usr/local/lib/$lib"
22+
sudo rm -rf /usr/local/lib/$lib
23+
done
24+
for lib in $(ls /usr/lib/x86_64-linux-gnu/ | grep -P "libyang|libnl"); do
25+
echo "removing /usr/lib/x86_64-linux-gnu/$lib"
26+
sudo rm -rf /usr/lib/x86_64-linux-gnu/$lib
27+
done
28+
for lib in $(ls /lib/x86_64-linux-gnu/ | grep -P "libnl"); do
29+
echo "removing /lib/x86_64-linux-gnu/$lib"
30+
sudo rm -rf /lib/x86_64-linux-gnu/$lib
31+
done
32+
sudo ldconfig
33+
for namespace in $(ls /var/run/netns/ | grep -Po "ns[0-9]"); do
34+
echo "removing namespace $namespace"
35+
sudo ip netns del $namespace
36+
done

CI/extract_from_docker_image.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
container="polycubed"
3+
if ! test -z "$1"
4+
then
5+
container=$1
6+
fi
7+
# Checking if the container is up
8+
docker ps
9+
# Copying binaries
10+
echo "# Copying binaries"
11+
echo "container content in /usr/local/bin:"
12+
docker exec $container /bin/ls /usr/local/bin
13+
echo "Copying $container:/usr/local/bin to /usr/local"
14+
sudo docker cp -a $container:/usr/local/bin /usr/local
15+
echo "container content in /usr/local/share/polycube:"
16+
docker exec $container /bin/ls /usr/local/share/polycube
17+
echo "Copying $container:/usr/local/share/polycube to /usr/local/share"
18+
sudo docker cp -a $container:/usr/local/share/polycube /usr/local/share
19+
# Copying headers
20+
echo "# Copying headers"
21+
echo "container content in /usr/include/polycube:"
22+
docker exec $container /bin/ls /usr/include/polycube
23+
echo "Copying $container:/usr/include/polycube to /usr/include"
24+
sudo mkdir -p /usr/include/polycube
25+
sudo docker cp -a $container:/usr/include/polycube /usr/include
26+
# Copying libraries
27+
echo "# Copying libraries"
28+
echo "container content in /usr/lib:"
29+
docker exec $container /bin/ls /usr/lib | /bin/grep "libp"
30+
for lib in $(docker exec $container ls /usr/lib | grep "libp"); do
31+
echo "Copying $container:/usr/lib/$lib to /usr/lib/"
32+
sudo docker cp $container:/usr/lib/$lib /usr/lib/
33+
done
34+
echo "container content in /usr/local/lib:"
35+
docker exec $container /bin/ls /usr/local/lib | /bin/grep "lib"
36+
for lib in $(docker exec $container ls /usr/local/lib | grep "lib"); do
37+
echo "Copying $container:/usr/local/lib/$lib to /usr/local/lib"
38+
sudo docker cp $container:/usr/local/lib/$lib /usr/local/lib
39+
done
40+
echo "container content in /usr/lib/x86_64-linux-gnu:"
41+
docker exec $container /bin/ls /usr/lib/x86_64-linux-gnu | /bin/grep -P "libyang|libnl"
42+
for lib in $(docker exec $container ls /usr/lib/x86_64-linux-gnu/ | grep -P "libyang|libnl"); do
43+
echo "Copying $container:/usr/lib/x86_64-linux-gnu/$lib to /usr/lib/x86_64-linux-gnu"
44+
sudo docker cp $container:/usr/lib/x86_64-linux-gnu/$lib /usr/lib/x86_64-linux-gnu
45+
done
46+
echo "container content in /lib/x86_64-linux-gnu:"
47+
docker exec $container /bin/ls /lib/x86_64-linux-gnu | /bin/grep -P "libnl"
48+
for lib in $(docker exec $container ls /lib/x86_64-linux-gnu | grep -P "libnl"); do
49+
echo "Copying $container:/lib/x86_64-linux-gnu/$lib to /lib/x86_64-linux-gnu"
50+
sudo docker cp $container:/lib/x86_64-linux-gnu/$lib /lib/x86_64-linux-gnu
51+
done
52+
# Copying base yang models
53+
echo "# Copying base yang models"
54+
echo "container content in /usr/local/include/polycube:"
55+
docker exec $container /bin/ls /usr/local/include/polycube
56+
sudo mkdir -p /usr/local/include/polycube
57+
echo "Copying $container:/usr/local/include/polycube to /usr/local/include/"
58+
sudo docker cp -a $container:/usr/local/include/polycube /usr/local/include/
59+
sudo ldconfig

Dockerfile

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
11
# syntax = tonistiigi/dockerfile:runmount20180618 # enables --mount option for run
2-
FROM ubuntu:18.04
3-
ARG MODE=default
2+
FROM polycubebot/base_image:latest
3+
ARG DEFAULT_MODE=default
4+
ENV MODE=$DEFAULT_MODE
5+
RUN echo "The mode is $MODE"
6+
RUN rm -rf /tmp/polycube
47
RUN --mount=target=/polycube cp -r /polycube /tmp/polycube && \
58
cd /tmp/polycube && \
6-
SUDO="" WORKDIR="/tmp/dev" ./scripts/install.sh $MODE && \
9+
SUDO="" USER="root" WORKDIR="/tmp/dev" ./scripts/install.sh $MODE && \
710
# install pcn-kubernetes only components
811
if [ "$MODE" = "pcn-k8s" ] ; then \
9-
export GOPATH=$HOME/go && \
10-
go get github.com/containernetworking/plugins/pkg/ip && \
11-
go get k8s.io/client-go/... && \
12-
go get golang.org/x/net/context && \
13-
go get golang.org/x/oauth2 && \
1412
cd /tmp && mkdir -p tmp && cd tmp && \
1513
curl -sS -L https://storage.googleapis.com/kubernetes-release/network-plugins/cni-0799f5732f2a11b329d9e3d51b9c8f2e3759f2ff.tar.gz -o cni.tar.gz && \
1614
tar -xvf cni.tar.gz && \
1715
mkdir /cni && \
1816
cp bin/loopback /cni && \
19-
cd /tmp/polycube/src/components/k8s/cni/ && \
20-
./build.sh && \
21-
cd $HOME/go/src/github.com/polycube-network/polycube/src/components/k8s/cni/conf && \
17+
cd /tmp/polycube/src/components/k8s/cni/polycube && \
18+
GOOS=linux go build -o /opt/cni/bin/polycube . && \
19+
cd /tmp/polycube/src/components/k8s/cni/conf && \
2220
GOOS=linux go build -o /cni-conf . && \
23-
cd $HOME/go/src/github.com/polycube-network/polycube/src/components/k8s/pcn_k8s/ && \
21+
cd /tmp/polycube/src/components/k8s/pcn_k8s/ && \
2422
GOOS=linux go build -o /pcn_k8s . ; \
2523
fi && \
2624
apt-get purge --auto-remove -y git bison cmake flex \
27-
libllvm5.0 llvm-5.0-dev libclang-5.0-dev uuid-dev autoconf \
28-
golang-go libtool curl && \
25+
libllvm5.0 llvm-5.0-dev libclang-5.0-dev uuid-dev autoconf software-properties-common golang-go \
26+
libtool curl && \
2927
apt-get clean && \
30-
rm -fr /root /var/lib/apt/lists/* /tmp/* /var/tmp/*
28+
rm -fr /root /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/local/go/*
3129
# TODO: which other apt-get packages can be removed?
3230

3331
ADD src/components/k8s/cni/cni-install.sh /cni-install.sh
3432
ADD src/components/k8s/cni/cni-uninstall.sh /cni-uninstall.sh
3533
ADD src/components/k8s/pcn_k8s/cleanup.sh /cleanup.sh
3634
ADD src/components/k8s/pcn_k8s/init.sh /init.sh
3735

38-
CMD ["polycubed"]
36+
# by running nsenter --mount=/host/proc/1/ns/mnt polycubed, the daemon has a complete view of the namespaces of the host and it is able to manipulate them (needed for shadow services)
37+
CMD ["nsenter","--mount=/host/proc/1/ns/mnt","polycubed"]

Dockerfile_base_image

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# syntax = tonistiigi/dockerfile:runmount20180618
2+
FROM ubuntu:18.04
3+
COPY scripts/pre-requirements.sh /tmp/
4+
RUN cd /tmp/ && \
5+
apt update && \
6+
SUDO="" WORKDIR="/tmp/dev" ./pre-requirements.sh && \
7+
rm -f /tmp/pre-requirements.sh

Documentation/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
# Polycube Documentation
22

3-
*The polycube documentation is not designed to be read on github, so please see our website: TODO: put link here*
3+
**The polycube documentation is available on [ReadTheDocs](https://polycube-network.readthedocs.io/en/latest/).**
44

5-
## Building the documentation
5+
The instructions below are intended only if you want to generate the documentation locally.
6+
7+
## Building the documentation locally
68

79
### Installing the dependencies
810

911
Our documentation uses `sphinx`.
10-
In order to install the dependencies do
12+
In order to install the dependencies type:
1113

1214
```
1315
cd Documentation
14-
pip install -r Documentation/requirements.txt
16+
pip install -r requirements.txt
1517
```
1618

1719
### Build it

Documentation/architecture.rst

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
Polycube Architecture
22
=====================
33

4-
**NOTE: this file is outdated**
5-
6-
Polycube is a framework to **create** and **deploy** arbitrary virtual network functions, such as bridges, routers, NATs, firewalls and more, and enables the creation of complex **service chains** by connecting together the above modules.
7-
8-
It is based on the eBPF technology available in the Linux kernel and leverages some companion tools developed in the Iovisor community, such as [BCC](https://github.com/iovisor/bcc/).
9-
104
The Polycube architecture is depicted below:
115

126
.. image:: images/architecture_overview.png
@@ -32,6 +26,7 @@ Each network function is implemented as a separated module and multiple flavors
3226
Each service implementation includes the `datapath`, namely the eBPF code to be injected in the kernel, the `control/management plane`, which defines the primitives that allow to configure the service behavior, and the `slow path`, which handles packets that cannot be fully processed in the kernel. While the former code runs in the Linux kernel, the latter components are executed in user-space.
3327
Given the feature-rich nature of the eBPF, the slow path should be rather small; an example can be the implementation of the spanning tree for 802.1Q bridges, which does not make sense to have in the kernel and that can stay in user space.
3428

29+
3530
Polycubectl
3631
-----------
3732
This module implements the service-agnostic command-line interface (CLI) that allows to control the entire system, such as starting/stopping services, creating service instances (e.g., bridges `br1` and `br2`), and configuring / querying the internals of each single service (e.g., enabling the spanning tree on bridge `br1`).

0 commit comments

Comments
 (0)