1#! /usr/bin/env python3
2#
3# This is a simple reimplementation of the "nft" user-space tool in
4# Python, in order to test language bindings. It does not support any
5# command line argument supported by the nftables "nft" tool, but
6# supports all nftables commands used in the Buildroot runtime test.
7
8import sys
9
10import nftables
11
12
13nft = nftables.nftables.Nftables()
14cmd = " ".join(sys.argv[1:])
15ret_code, output, error = nft.cmd(cmd)
16
17if len(output) > 0:
18    print(output.strip())
19if len(error) > 0:
20    print(error.strip())
21
22sys.exit(ret_code)
23