> > > These test cases can be used to test upcoming "import json" command. > > > > Here is the short description of the files: > > all_ruleset_list -> contains list of all the individual rules > > Wait. You are generating the JSON files from this ruleset, right? > yes. > > Then, why not simplify the tests by: > > * load a ruleset model (your all_ruleset_list file) > * export it in JSON format (nft export json) > * import it again in JSON format (nft import) > * comparte resulting ruleset (nft list ruleset) with the original > file (all_ruleset_list file) > > This way we test in the same run all the JSON code paths. > > You will need a simple testcase, like this: > > === 8< === > #!/bin/bash > set -e > TMP=$(mktmp) > RULESET="table ip { ... } " > echo $RULESET > $TMP > $NFT -f $TMP > $NFT export json > $TMP > cat $TMP | $NFT import json) > RESULT=$($NFT list ruleset) > # compare result and initial ruleset, if fail show diff > === 8< === > > That was quick and dirty code for you to get the idea. > Please follow the example of other testcases [0] to compare ruleset, > create tempfiles and so on. > One issue with this approach, incase of set rules nft will throw this error "Error: Could not process rule: File exists" So, i need to flush ruleset before import them with json. Is it okay? > > Please, if possible, try to add a testcase that is [OK]. Not sure what > is wrong with the dup statement. > I tried, but they always throw the same error. Shouldn't we keep them in testsuite so that we know that these set of rules needs to be fixed. > > [0] http://git.netfilter.org/nftables/tree/tests/shell/testcases/netns/0001nft-f_0 Thanks, Shyam -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html