|
| 1 | +#! /bin/bash |
| 2 | + |
| 3 | +# check that the services are actually transverse on the right order |
| 4 | + |
| 5 | +source "${BASH_SOURCE%/*}/../helpers.bash" |
| 6 | + |
| 7 | +set -e |
| 8 | +set -x |
| 9 | + |
| 10 | +function cleanup { |
| 11 | + set +e |
| 12 | + polycubectl del th1 |
| 13 | + polycubectl del th2 |
| 14 | + polycubectl del th3 |
| 15 | + polycubectl del th4 |
| 16 | + polycubectl del th5 |
| 17 | + delete_veth 1 |
| 18 | + echo "FAIL" |
| 19 | +} |
| 20 | +trap cleanup EXIT |
| 21 | + |
| 22 | +create_veth 1 |
| 23 | + |
| 24 | +polycubectl transparenthelloworld add th1 loglevel=TRACE |
| 25 | +polycubectl transparenthelloworld add th2 loglevel=TRACE |
| 26 | +polycubectl transparenthelloworld add th3 loglevel=TRACE |
| 27 | +polycubectl transparenthelloworld add th4 loglevel=TRACE |
| 28 | +polycubectl transparenthelloworld add th5 loglevel=TRACE |
| 29 | + |
| 30 | +polycubectl attach th3 veth1 |
| 31 | +polycubectl attach th1 veth1 position=first |
| 32 | +polycubectl attach th5 veth1 position=last |
| 33 | +polycubectl attach th2 veth1 after=th1 |
| 34 | +polycubectl attach th4 veth1 before=th5 |
| 35 | + |
| 36 | +# verfiy the service chain order |
| 37 | +polycubectl topology show veth1 | egrep "ingress service chain: th1 ---> th2 ---> th3 ---> th4 ---> th5 ---> stack" |
| 38 | +polycubectl topology show veth1 | egrep "egress service chain: th5 ---> th4 ---> th3 ---> th2 ---> th1 ---> stack" |
| 39 | + |
| 40 | +# sudo ip netns exec ns1 ping 10.0.0.2 -c 1 |
| 41 | + |
| 42 | +#TODO: verify the log output, expected log output |
| 43 | +#[2019-12-06 11:39:20.512] [Transparenthelloworld] [th1] [debug] Ingress: passing packet |
| 44 | +#[2019-12-06 11:39:20.512] [Transparenthelloworld] [th2] [debug] Ingress: passing packet |
| 45 | +#[2019-12-06 11:39:20.512] [Transparenthelloworld] [th3] [debug] Ingress: passing packet |
| 46 | +#[2019-12-06 11:39:20.512] [Transparenthelloworld] [th4] [debug] Ingress: passing packet |
| 47 | +#[2019-12-06 11:39:20.512] [Transparenthelloworld] [th5] [debug] Ingress: passing packet |
| 48 | +#[2019-12-06 11:39:20.512] [Transparenthelloworld] [th5] [debug] Egress: passing packet |
| 49 | +#[2019-12-06 11:39:20.512] [Transparenthelloworld] [th4] [debug] Egress: passing packet |
| 50 | +#[2019-12-06 11:39:20.512] [Transparenthelloworld] [th3] [debug] Egress: passing packet |
| 51 | +#[2019-12-06 11:39:20.512] [Transparenthelloworld] [th2] [debug] Egress: passing packet |
| 52 | +#[2019-12-06 11:39:20.512] [Transparenthelloworld] [th1] [debug] Egress: passing packet |
| 53 | + |
| 54 | +polycubectl del th1 |
| 55 | +polycubectl del th2 |
| 56 | +polycubectl del th3 |
| 57 | +polycubectl del th4 |
| 58 | +polycubectl del th5 |
| 59 | +delete_veth 1 |
| 60 | + |
| 61 | +set +x |
| 62 | +trap - EXIT |
| 63 | +echo "SUCCESS" |
0 commit comments