Skip to content

Commit

Permalink
Updated with latest Simone's patches (#368)
Browse files Browse the repository at this point in the history
Need to be merged after Simone's PR on Nov 2020.
  • Loading branch information
frisso committed Apr 6, 2021
1 parent e32ee78 commit 4be3461
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
17 changes: 12 additions & 5 deletions Documentation/services/pcn-dynmon/dynmon.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@ Limitations
-----------
- The OpenMetrics format does not support complex data structures, hence the maps are exported only if their value type is a simple type (structs and unions are not supported)
- The OpenMetrics Histogram and Summary metrics are not yet supported
- Data extraction is possible only in the following maps (as listed in [MapExtractor.cpp#L287](https://github.com/polycube-network/polycube/blob/master/src/services/pcn-dynmon/src/extractor/MapExtractor.cpp#L287)):
- BPF_MAP_TYPE_HASH, BPF_MAP_TYPE_PERCPU_HASH
- BPF_MAP_TYPE_LRU_HASH, BPF_MAP_TYPE_LRU_PERCPU_HASH,
- BPF_MAP_TYPE_ARRAY, BPF_MAP_TYPE_PERCPU_ARRAY
- BPF_MAP_TYPE_QUEUE, BPF_MAP_TYPE_STACK

Furthermore, optimized data extraction (the so called *batch operations*), are supported only by BPF_MAP_TYPE_HASH, BPF_MAP_TYPE_LRU_HASH, BPF_MAP_TYPE_ARRAY.


How to use
----------


Creating the service
^^^^^^^^^^^^^^^^^^^^
::
Expand All @@ -43,7 +50,7 @@ Configuration examples can be found in the *examples* directory.


Attaching to a interface
^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^
::

# Attach the service to a network interface
Expand Down Expand Up @@ -234,7 +241,7 @@ There are two different type of compilation:
- PROGRAM_RELOAD

PROGRAM_INDEX_SWAP rewrite
^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^

The PROGRAM_INDEX_SWAP rewrite type is the best you can get from this rewriter by now. It is extremely sophisticated and not easy at all to understand, since we have tried to take into account as many scenarios as possible. This said, let's analyze it.

Expand Down Expand Up @@ -267,8 +274,8 @@ The PIVOTING code simply calls the original/cloned program main function accordi
Thanks to this technique, every time a user requires metrics there's only almost 4ms overhead due to changing the index from ControlPlane, which compared to the 400ms using the PROGRAM_RELOAD compilation, is an extremely advantage we are proud of having developed.


PROGRAM_RELOAD Compilation
^^^^^^^^^^^^^^^^^
PROGRAM_RELOAD compilation
^^^^^^^^^^^^^^^^^^^^^^^^^^

This compilation type is quite simple to understand. It is used as a fallback compilation, since it achieves the map swap function, but in a more time expensive way. In fact, when this option is used, it is generated a new code starting from the original injected one, and then the following steps are followed:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

source "${BASH_SOURCE%/*}/../helpers.bash"

function fwsetup {
polycubectl firewall add fw
polycubectl attach fw veth1
polycubectl firewall fw chain INGRESS set default=DROP
polycubectl firewall fw chain EGRESS set default=DROP
}

function fwcleanup {
set +e
polycubectl firewall del fw
Expand All @@ -12,26 +19,25 @@ function fwcleanup {
trap fwcleanup EXIT
set -e

echo "TCP Conntrack Test (ns2->ns1) [No automatic forward][Interactive mode]"
echo "TCP Conntrack Test (ns2->ns1) [No automatic ACCEPT][Interactive mode]"

create_veth 2

polycubectl firewall add fw loglevel=DEBUG
polycubectl attach fw veth1
fwsetup

# Allowing connections to be started only from NS2 to NS1
polycubectl firewall fw chain INGRESS append l4proto=TCP conntrack=ESTABLISHED action=FORWARD > /dev/null
polycubectl firewall fw chain INGRESS append l4proto=TCP conntrack=ESTABLISHED action=ACCEPT > /dev/null
polycubectl firewall fw chain INGRESS append conntrack=INVALID action=DROP > /dev/null

polycubectl firewall fw chain EGRESS append l4proto=TCP conntrack=NEW action=FORWARD > /dev/null
polycubectl firewall fw chain EGRESS append l4proto=TCP conntrack=ESTABLISHED action=FORWARD > /dev/null
polycubectl firewall fw chain EGRESS append l4proto=TCP conntrack=NEW action=ACCEPT > /dev/null
polycubectl firewall fw chain EGRESS append l4proto=TCP conntrack=ESTABLISHED action=ACCEPT > /dev/null
polycubectl firewall fw chain EGRESS append conntrack=INVALID action=DROP > /dev/null

#listen and connect
set -e

echo "Starting netcat server"
sudo ip netns exec ns1 netcat -l 60123&
sudo ip netns exec ns1 netcat -l 60123 &
sleep 3

echo "Starting netcat client"
Expand Down

0 comments on commit 4be3461

Please sign in to comment.