|
| 1 | +# PING testing rule appending |
| 2 | + |
| 3 | +source "${BASH_SOURCE%/*}/../helpers.bash" |
| 4 | + |
| 5 | +function fwcleanup { |
| 6 | + set +e |
| 7 | + polycubectl firewall del fw |
| 8 | + delete_veth 2 |
| 9 | +} |
| 10 | +trap fwcleanup EXIT |
| 11 | + |
| 12 | +echo -e '\nTest wrong position \n' |
| 13 | +set -e |
| 14 | +set -x |
| 15 | + |
| 16 | +create_veth 2 |
| 17 | + |
| 18 | +polycubectl firewall add fw loglevel=DEBUG |
| 19 | +polycubectl attach fw veth1 |
| 20 | + |
| 21 | +# INGRESS one rule |
| 22 | +polycubectl firewall fw chain INGRESS append src=10.0.0.1 dst=10.0.0.2 l4proto=ICMP action=FORWARD |
| 23 | + |
| 24 | +#EGRESS multiple rules |
| 25 | +polycubectl firewall fw chain EGRESS append src=10.0.0.2/32 dst=10.0.0.1/32 l4proto=ICMP action=FORWARD |
| 26 | +polycubectl firewall fw chain EGRESS append src=10.0.0.2/32 dst=10.0.0.1/32 l4proto=ICMP action=FORWARD |
| 27 | +polycubectl firewall fw chain EGRESS append src=10.0.0.2/32 dst=10.0.0.1/32 l4proto=ICMP action=FORWARD |
| 28 | +polycubectl firewall fw chain EGRESS append src=10.0.0.2/32 dst=10.0.0.1/32 l4proto=ICMP action=FORWARD |
| 29 | + |
| 30 | +# Test out of bound access |
| 31 | +set +e |
| 32 | +polycubectl fw chain EGRESS rule del -1 |
| 33 | +polycubectl fw chain EGRESS rule del 4 |
| 34 | +polycubectl fw chain EGRESS rule del 5 |
| 35 | +polycubectl fw chain EGRESS rule del 10 |
| 36 | +set -e |
| 37 | + |
| 38 | +# test fw to be still alive |
| 39 | +polycubectl fw chain EGRESS show |
| 40 | + |
| 41 | +set +e |
| 42 | +polycubectl fw chain EGRESS rule show -1 |
| 43 | +polycubectl fw chain EGRESS rule show 4 |
| 44 | +polycubectl fw chain EGRESS rule show 5 |
| 45 | +polycubectl fw chain EGRESS rule show 10 |
| 46 | +set -e |
| 47 | + |
| 48 | +# test fw to be still alive |
| 49 | +polycubectl fw chain EGRESS show |
| 50 | + |
| 51 | +set +e |
| 52 | +polycubectl fw chain INGRESS rule del -1 |
| 53 | +polycubectl fw chain INGRESS rule del 1 |
| 54 | +polycubectl fw chain INGRESS rule del 2 |
| 55 | +polycubectl fw chain INGRESS rule del 10 |
| 56 | + |
| 57 | +polycubectl fw chain INGRESS rule show -1 |
| 58 | +polycubectl fw chain INGRESS rule show 1 |
| 59 | +polycubectl fw chain INGRESS rule show 2 |
| 60 | +polycubectl fw chain INGRESS rule show 10 |
| 61 | +set -e |
| 62 | + |
| 63 | +# test fw to be still alive |
| 64 | +polycubectl fw chain EGRESS show |
| 65 | + |
| 66 | +polycubectl fw chain EGRESS show rule 0 |
| 67 | +polycubectl fw chain EGRESS show rule 1 |
| 68 | +polycubectl fw chain EGRESS show rule 2 |
| 69 | +polycubectl fw chain EGRESS show rule 3 |
| 70 | + |
| 71 | +polycubectl fw chain INGRESS show rule 0 |
| 72 | + |
| 73 | + |
| 74 | + |
0 commit comments