#!/bin/bash set -e $NFT add table test-ip $NFT add set test-ip x { type ipv4_addr\; } $NFT add set test-ip y { type inet_service \; timeout 3h45s \;} $NFT add set test-ip z { type ipv4_addr\; flags constant , interval\;} $NFT add set test-ip c {type ipv4_addr \; flags timeout \; elements={192.168.1.1 timeout 10s, 192.168.1.2 timeout 30s} \;} set_handle=$($NFT -a list ruleset | awk '/set c/{print $NF}') $NFT delete set test-ip handle $set_handle EXPECTED="table ip test-ip { set x { type ipv4_addr } set y { type inet_service timeout 3h45s } set z { type ipv4_addr flags constant,interval } }" GET="$($NFT list ruleset)" if [ "$EXPECTED" != "$GET" ] ; then $DIFF -u <(echo "$EXPECTED") <(echo "$GET") exit 1 fi