Debian Codegraph @

tests/shell/testcases/maps/0024named_objects_1

raw
1 #!/bin/bash
2
3 # This is the test-case:
4 # * creating valid named objects and using map variables in statements
5
6 RULESET='
7 define counter_map = { 192.168.2.2 : "user123", 1.1.1.1 : "user123", 2.2.2.2 : "user123" }
8 define quota_map = { 192.168.2.2 : "user124", 192.168.2.3 : "user124" }
9
10 table inet x {
11 counter user123 {
12 packets 12 bytes 1433
13 }
14 counter user321 {
15 packets 12 bytes 1433
16 }
17 quota user123 {
18 over 2000 bytes
19 }
20 quota user124 {
21 over 2000 bytes
22 }
23 chain y {
24 type filter hook input priority 0; policy accept;
25 counter name ip saddr map $counter_map
26 quota name ip saddr map $quota_map drop
27 }
28 }'
29
30 set -e
31 $NFT -f - <<< "$RULESET"