Module Contents

class noc.core.confdb.engine.base.Engine

Bases: object

compile(self, expr)
_expr_to_python(self, expr)

Convert expression to python expression :param expr: :return:

query(self, expr, **kwargs)
any(self, expr, **kwargs)

Run query and return True if any result found :param expr: :param kwargs: :return:

dump(self, format='tree')
insert_bulk(self, iter)
trim_and_append(self, path, value)

Trim all children nodes of path and append value :param path: Tuple containing path :param value: iterable yielding path :return: True if value replaced, False otherwise

find(self, *args)

Find node by path :param args: Path :return:

rebase(self, src, dst)
with_db(self, db)
iter_product(self, _ctx, **kwargs)
iter_initial(self, **kwargs)
static context_hash(ctx)
static iter_unique(g)

Deduplicate generator :param g: :return:

static resolve_var(ctx, v)

Resolve bound variable if necessary :param ctx: :param v: :return:


Remove temporary nodes :return:

fn_Set(self, _input, **kwargs)

Set(k1=v1, …, kN=vN)

Modify context with additional variables. If v is list, apply all variables product. :param _input: :param kwargs: :return:

fn_Dump(self, _input, message=None)

Dump() Dump(message) Dump current context and pass unmodified :param _input: :param message: :return:

fn_True(self, _input)

Pass context unmodified :param _input: :return:

fn_False(self, _input)

Break predicate chain :param _input: :return:

fn_Var(self, name)

Internal function referring to context variable :param name: :return:

fn_Sprintf(self, _input, name, fmt, *args)
  • _input
  • name
  • fmt
  • args

fn_Match(self, _input, *args)

Match *args against database. Bind unbound variables on match :param _input: :param args: :return:

fn_NotMatch(self, _input, *args)

Check *args is not in database. Bind unbound variables :param _input: :param args: :return:

fn_Re(self, _input, pattern, name, ignore_case=None)

Match variable name against regular expression pattern. Pass context further if matched. If regular expression contains named groups, i.e. (?P<group_name>….), apply them as context variables :param _input: :param pattern: :param name: :return:

op_Not(self, g)

Context negation. Yields empty context if input is empty, Drops input otherwise :param g: :return:

op_Or(self, _input, *args)
fn_Del(self, _input, *args)

Delete variables from context. Deduplicate contexts when necessary :param _input: :param args: String or variable :return:

fn_Fact(self, _input, *args)

Set Fact to database :param _input: :param args: Path of fact, eigther constants or bound variables :return:

fn_HasVLAN(self, _input, vlan_filter, vlan_id)

Check vlan_id is within vlan_filter expression :param _input: :param vlan_filter: :param vlan_id: :return:

fn_Filter(self, _input, expr)

Pass context only if expr is evaluated as true :param _input: :param expr: :return:

fn_Group(self, _input, *args, **kwargs)
_collapse_join(self, values, join)
_collapse_joinrange(self, values, joinrange)
fn_Collapse(self, _input, *args, **kwargs)

Collapse multiple keys to a single one following rules :param _input: :param args: :param kwargs: One of collapse operation should be specified

  • join=<sep> – join lines with separator sep