Skip to content

Commit

Permalink
Added documentation for Transparent HelloWorld
Browse files Browse the repository at this point in the history
Signed-off-by: Fulvio Risso <[email protected]>
  • Loading branch information
frisso committed Jul 28, 2019
1 parent 96d3a4c commit b8eff81
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 6 deletions.
1 change: 1 addition & 0 deletions Documentation/services/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This folder contains the list of services (a.k.a. *cubes*) currently available i
pcn-ddosmitigator/ddosmitigator
pcn-firewall/firewall
pcn-helloworld/helloworld
pcn-transparenthelloworld/transparenthelloworld
pcn-iptables/iptables
pcn-k8sfilter/k8sfilter
pcn-k8switch/k8switch
Expand Down
13 changes: 7 additions & 6 deletions Documentation/services/pcn-helloworld/helloworld.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
Helloworld
==========

**Note**: documentation of the current release is focused on the final user and not in developers. This service is intended to be used only by developers, so this documentation could be incomplete and have some inacuracies.

This service demonstrates how to create a minimal cube, which includes both the dataplane `fast path` and the control/management `slow path` parts
This service is oriented to demonstrate to developers how to create a minimal cube, which includes both the dataplane `fast path` and the control/management `slow path`.

Helloworld is a simple service that receives the traffic on a network interface and can either:

Expand All @@ -18,8 +16,10 @@ How to use

::

# create network namespaces
# TODO.
# create network namespaces with usual commands
# we assume you have two interfaces (veth1
# and veth2 already working here)


# create the instance
polycubectl helloworld add hw0
Expand All @@ -33,7 +33,7 @@ How to use

# send packets to the service

# try another actions, forward, slowpath
# try another action, such as forward
polycubectl hw0 set action=forward


Expand All @@ -49,6 +49,7 @@ Helloworld includes the minimum amount of code that a service requires to be run
- **src/helloworld-lib.cpp** contains the implementation of interface that is used when the service is compiled as a shared library.
- **datamodel/helloworld.yang** contains the service datamodel.


Compile and install
-------------------

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Transparent Helloworld
======================

This service is oriented to demonstrate to developers how to create a minimal transparent cube, which includes both the dataplane `fast path` and the control/management `slow path`.

The behaviour of this service is very similar as :doc:`Helloworld <services/pcn-helloworld/helloworld>`; however, it attaches to an existing interface (in fact, it is *transparent*) instead of having its own set of interfaces.
From the developer point of view, it inherits from the ``polycube-transparent-base`` datamodel instead of ``polycube-standard-base``.

Transparent Helloworld is a simple service that receives the traffic on a network interface and can either:

- allow packets to pass
- send packets to the slow path
- drop packets

The behavior of this service can be changed by setting the ``ingress-action`` and ``egress-action`` flags, which tell the data plane how packets have to be processed.
In fact, this service can distinguish between *ingress* (i.e., from the network device up to the TCP/IP stack) or *egress* (vice versa) packets, enabling to set different actions for them.


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

::

# we assume a physical interface named 'eth0'
# is available in the system

# create a transparent hello world
polycubectl transparenthelloworld add thw0

# attach to eth0
polycubectl attach thw0 eth0

# you can ping the Internet from your host
# e.g., ping 8.8.8.8
# and see that the ping works properly

# now let's change action in the ingress-path
polycubectl thw0 set ingress-action=slowpath

# now you can see that the ping does no longer work
#
# in exchange, polycubed prints a log message each
# time it receives a new packet in the slow path

# restore 'pass' behavior
polycubectl thw0 set ingress-action=pass

# now the 'ping' works again


0 comments on commit b8eff81

Please sign in to comment.