noc.core.confdb.normalizer.base

Module Contents

noc.core.confdb.normalizer.base._match_seq
noc.core.confdb.normalizer.base.ANY
noc.core.confdb.normalizer.base.REST
class noc.core.confdb.normalizer.base.Node(token)

Bases: object

__slots__ = ['token', 'handler', 'children', 'matcher']
__repr__(self)
get_children(self, token)

Find children by token :param token: :return: Node instance or None

match(self, token)
iter_matched(self, tokens)
append(self, pattern, handler, matcher=None)
class noc.core.confdb.normalizer.base.BaseNormalizerMetaclass

Bases: type

classmethod __new__(mcs, name, bases, attrs)
classmethod parse_syntax(mcs, ncls, syntax)
classmethod process_token(mcs, ncls, sdef, path)
classmethod contribute_gen(mcs, ncls, path, replace=False)
class noc.core.confdb.normalizer.base.BaseNormalizer(object, tokenizer)

Bases: six.with_metaclass()

SYNTAX = []
set_context(self, name, value)
get_context(self, name, default=None)
has_context(self, name)
interface_name(self, *args)
to_prefix(self, address, netmask)

Convert address and netmask to prefix form :param address: :param netmask: :return:

__iter__(self)
defer(self, context, gen=None, **kwargs)
_resolve_vars(self, ctx, d_map)

Resolve deferable variables mapping :param ctx: Context :param d_map: name -> context name mapping :return: Dict if fully resolved, None otherwise

rebase(self, src, dst)

Mark the part of tree to be rebased to new location

Usage: yield self.rebase(src, dst):

Parameters:
  • src – Source path
  • dst – Destination path
Returns:

noc.core.confdb.normalizer.base.match(*args, **kwargs)