|
| 1 | +Transparent Helloworld |
| 2 | +====================== |
| 3 | + |
| 4 | +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`. |
| 5 | + |
| 6 | +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. |
| 7 | +From the developer point of view, it inherits from the ``polycube-transparent-base`` datamodel instead of ``polycube-standard-base``. |
| 8 | + |
| 9 | +Transparent Helloworld is a simple service that receives the traffic on a network interface and can either: |
| 10 | + |
| 11 | +- allow packets to pass |
| 12 | +- send packets to the slow path |
| 13 | +- drop packets |
| 14 | + |
| 15 | +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. |
| 16 | +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. |
| 17 | + |
| 18 | + |
| 19 | +How to use |
| 20 | +---------- |
| 21 | + |
| 22 | +:: |
| 23 | + |
| 24 | + # we assume a physical interface named 'eth0' |
| 25 | + # is available in the system |
| 26 | + |
| 27 | + # create a transparent hello world |
| 28 | + polycubectl transparenthelloworld add thw0 |
| 29 | + |
| 30 | + # attach to eth0 |
| 31 | + polycubectl attach thw0 eth0 |
| 32 | + |
| 33 | + # you can ping the Internet from your host |
| 34 | + # e.g., ping 8.8.8.8 |
| 35 | + # and see that the ping works properly |
| 36 | + |
| 37 | + # now let's change action in the ingress-path |
| 38 | + polycubectl thw0 set ingress-action=slowpath |
| 39 | + |
| 40 | + # now you can see that the ping does no longer work |
| 41 | + # |
| 42 | + # in exchange, polycubed prints a log message each |
| 43 | + # time it receives a new packet in the slow path |
| 44 | + |
| 45 | + # restore 'pass' behavior |
| 46 | + polycubectl thw0 set ingress-action=pass |
| 47 | + |
| 48 | + # now the 'ping' works again |
| 49 | + |
| 50 | + |
0 commit comments