Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 3
0
def chains():
    '''
    GET:
      List all chains in the system
    POST:
      Create a new chain in the system
    '''
    if request.method == 'POST':
        try:
            chain_json = chain_validator.validate_new_chain(request.get_json())
            chain = chain_wrapper.create_chain(chain_json)
            r = jsonify(chain=chain)
            r.status_code = 201
            return r
        except NFTValidationError as e:
            return abort(400, e)
        except NFTError as e:
            return abort(500, e)
    else:
        return jsonify(chains=chain_wrapper.list_all_chains())