示例#1
0
def list_all_tables():
    tables = table_parser.parse_tables(nft_utils.nft_get_json_command())
    chains = chain_wrapper.list_all_chains()
    sets = set_wrapper.list_all_sets()
    dictionaries = dictionary_wrapper.list_all_dictionaries()
    tables = nft_utils.join_tables_with_chains(tables, chains)
    tables = nft_utils.join_tables_with_sets(tables, sets)
    tables = nft_utils.join_tables_with_dictionaries(tables, dictionaries)
    return tables
示例#2
0
def list_all_tables():
    tables = table_parser.parse_tables(nft_utils.nft_get_json_command())
    chains = chain_wrapper.list_all_chains()
    sets = set_wrapper.list_all_sets()
    dictionaries = dictionary_wrapper.list_all_dictionaries()
    tables = nft_utils.join_tables_with_chains(tables, chains)
    tables = nft_utils.join_tables_with_sets(tables, sets)
    tables = nft_utils.join_tables_with_dictionaries(tables, dictionaries)
    return tables
示例#3
0
def sets():
    '''
    GET:
      List all sets in the system
    POST:
      Create a new set in the system
    '''
    if request.method == 'POST':
        try:
            set_json = set_validator.validate_new_set(request.get_json())
            set = set_wrapper.create_set(set_json)
            return jsonify(set=set)
        except NFTValidationError as e:
            return abort(400, e)
        except NFTError as e:
            return abort(500, e)
    else:
        return jsonify(sets=set_wrapper.list_all_sets())