noc.cm.validators.base

Module Contents

class noc.cm.validators.base.ValidatorRegistry

Bases: object

load_all(self)
register(self, c)
noc.cm.validators.base.validator_registry
class noc.cm.validators.base.ValidatorBase

Bases: type

classmethod __new__(mcs, name, bases, attrs)
class noc.cm.validators.base.BaseValidator(engine, object=None, config=None, scope=None, rule=None)

Bases: six.with_metaclass()

Validator base class. Preparation call sequence:

validator.is_applicable() validator.get_priority() validator.prepare()
Check call sequence:
for v in validators:
v.check(**v.get_config())

engine.run()

Then errors collected via engine.iter_errors

TITLE
DESCRIPTION
PRIORITY = 1000
CONFIG_FORM
TAGS
restrictions = []
SUBINTERFACE = 1
INTERFACE
OBJECT
TOPOLOGY
SCOPE
object_config
get_priority(self)

Returns rule priority. Determines check order

get_form(self)

Returns JS name of configuration form

get_config(self)

Get validator config

is_applicable(self)

Called to detect whether the validator is applicable to given managed object. When can_run returns True new Validator fact is installed to engine

prepare(self, **config)

Check preparation. Can be used to install rules

check(self, **config)

Validate engine facts and raise error

classmethod is_subinterface(cls)
classmethod is_interface(cls)
classmethod is_object(cls)
classmethod is_topology(cls)
get_interface_config(self, name)

Get interface config section

assert_error(self, type, obj=None, msg=None)