noc.sa.models.managedobject

Module Contents

noc.sa.models.managedobject.MANAGEDOBJECT_CACHE_VERSION = 19
noc.sa.models.managedobject.Credentials
noc.sa.models.managedobject.id_lock
noc.sa.models.managedobject.logger
class noc.sa.models.managedobject.ManagedObject

Bases: noc.core.model.base.NOCModel

Managed Object

class Meta

Bases: object

verbose_name = Managed Object
verbose_name_plural = Managed Objects
db_table = sa_managedobject
app_label = sa
name
is_managed
container
administrative_domain
segment
pool
profile
vendor
platform
version
next_version
object_profile
description
auth_profile
scheme
address
port
user
password
super_password
remote_path
trap_source_type
trap_source_ip
syslog_source_type
syslog_source_ip
trap_community
snmp_ro
snmp_rw
access_preference
fqdn
address_resolution_policy
vc_domain
config
vrf
controller
local_cpe_id
global_cpe_id
last_seen
shape
time_pattern
config_filter_handler
config_diff_filter_handler
config_validation_handler
max_scripts
x
y
default_zoom
software_image
remote_system
remote_id
bi_id
escalation_policy
box_discovery_running_policy
periodic_discovery_running_policy
box_discovery_alarm_policy
periodic_discovery_alarm_policy
box_discovery_telemetry_policy
box_discovery_telemetry_sample
periodic_discovery_telemetry_policy
periodic_discovery_telemetry_sample
tt_system
tt_queue
tt_system_id
cli_session_policy
cli_privilege_policy
config_policy
config_fetch_policy
interface_discovery_policy
caps_discovery_policy
vlan_discovery_policy
autosegmentation_policy
event_processing_policy
syslog_archive_policy
denied_firmware_policy
confdb_raw_policy
static_service_groups
effective_service_groups
static_client_groups
effective_client_groups
tags
EV_CONFIG_CHANGED = config_changed
EV_ALARM_RISEN = alarm_risen
EV_ALARM_REOPENED = alarm_reopened
EV_ALARM_CLEARED = alarm_cleared
EV_ALARM_COMMENTED = alarm_commented
EV_NEW = new
EV_DELETED = deleted
EV_VERSION_CHANGED = version_changed
EV_INTERFACE_CHANGED = interface_changed
EV_SCRIPT_FAILED = script_failed
EV_CONFIG_POLICY_VIOLATION = config_policy_violation
BOX_DISCOVERY_JOB = noc.services.discovery.jobs.box.job.BoxDiscoveryJob
PERIODIC_DISCOVERY_JOB = noc.services.discovery.jobs.periodic.job.PeriodicDiscoveryJob
_id_cache
_bi_id_cache
data
scripts
actions
matchers
granted_users

Get list of user granted access to object

Return type:List of User instancies
granted_groups

Get list of groups granted access to object

Return type:List of Group instancies
is_router

Returns True if Managed Object presents in more than one networks :return:

credentials

Get effective credentials

scripts_limit
box_telemetry_sample
periodic_telemetry_sample
management_vlan

Return management vlan settings :return: Vlan id or None

multicast_vlan

Return multicast vlan settings :return: Vlan id or None

escalator_shard

Returns escalator shard name :return:

to_raise_privileges
enable_autosegmentation
allow_autosegmentation
metrics
has_confdb_support
__str__(self)
classmethod get_by_id(cls, id)

Get ManagedObject by id. Cache returned instance for future use.

Parameters:id – Managed Object’s id
Returns:ManagedObject instance
classmethod get_by_bi_id(cls, id)
iter_changed_datastream(self, changed_fields=None)
set_scripts_caller(self, caller)

Override default scripts caller :param caller: callabler :return:

reset_matchers(self)
get_absolute_url(self)
classmethod user_objects(cls, user)

Get objects available to user

Parameters:user (User instance) – User
Return type:Queryset instance
has_access(self, user)

Check user has access to object

Parameters:user (User instance) – User
Return type:Bool
on_save(self)
on_delete(self)
get_index(self)

Get FTS index

classmethod get_search_result_url(cls, obj_id)
get_attr(self, name, default=None)

Return attribute as string :param name: :param default: :return:

get_attr_bool(self, name, default=False)

Return attribute as bool :param name: :param default: :return:

get_attr_int(self, name, default=0)

Return attribute as integer :param name: :param default: :return:

set_attr(self, name, value)

Set attribute :param name: :param value: :return:

update_attributes(self, attr)
is_ignored_interface(self, interface)
get_status(self)
get_last_status(self)
set_status(self, status, ts=None)

Update managed object status :param status: new status :param ts: status change time :return: False if out-of-order update, True otherwise

get_inventory(self)

Retuns a list of inventory Objects managed by this managed object

run_discovery(self, delta=0)

Schedule box discovery

event(self, event_id, data=None, delay=None, tag=None)

Process object-related event :param event_id: ManagedObject.EV_* :param data: Event context to render :param delay: Notification delay in seconds :param tag: Notification tag

save_config(self, data, validate=True)

Save new configuration to GridVCS :param data: config :param validate: Run config validation :return: True if config has been changed, False otherwise

notify_config_changes(self, is_new, data, diff)

Notify about config changes :param is_new: :param data: :param diff: :return:

write_config(self, data)

Save config to GridVCS :param data: Config data :return:

mirror_config(self, data, changed)

Save config to mirror :param data: Config data :param changed: True if config has been changed :return:

to_validate(self, changed)

Check if config is to be validated

Parameters:changed – True if config has been changed
Returns:Boolean
validate_config(self, changed)

Apply config validation rules (Legacy CLIPS path)

Parameters:changed
Returns:
iter_validation_problems(self, changed)

Yield validation problems

Parameters:changed – True if config has been changed
Returns:
iter_recursive_objects(self)

Generator yilding all recursive objects for effective PM settings

get_caps(self)

Returns a dict of effective object capabilities

update_caps(self, caps, source)

Update existing capabilities with a new ones. :param caps: dict of caps name -> caps value :param source: Source name

disable_discovery(self)

Disable all discovery methods related with managed object

get_profile(self)

Getting profile methods Exa:

mo.get_profile().convert_interface_name(i)
Returns:
get_parser(self)

Return parser instance or None. Depends on version_discovery

get_interface(self, name)
get_linecard(self, ifname)

Returns linecard number related to interface :param name: :return:

ensure_discovery_jobs(self)

Check and schedule discovery jobs

update_topology(self)

Rebuild topology caches

classmethod get_search_Q(cls, query)

Filters type: #1 IP address regexp - if .* in query #2 Name regexp - if “+*[]()” in query #3 IPv4 query - if query is valid IPv4 address #4 IPv4 prefix - if query is valid prefix from /16 to /32 (192.168.0.0/16, 192.168.0.0/g, 192.168.0.0/-1) #5 Discovery ID query - Find on MAC Discovery ID :param query: Query from __query request field :return: Django Q filter (Use it: ManagedObject.objects.filter(q))

open_session(self, idle_timeout=None)
can_escalate(self, depended=False)

Check alarm can be escalated :return:

can_notify(self, depended=False)

Check alarm can be notified via escalation :param depended: :return:

can_create_box_alarms(self)
can_create_periodic_alarms(self)
can_cli_session(self)
get_autosegmentation_policy(self)
get_access_preference(self)
get_event_processing_policy(self)
get_address_resolution_policy(self)
get_denied_firmware_policy(self)
get_confdb_raw_policy(self)
get_config_policy(self)
get_config_fetch_policy(self)
get_interface_discovery_policy(self)
get_caps_discovery_policy(self)
get_vlan_discovery_policy(self)
get_effective_box_discovery_running_policy(self)
get_effective_periodic_discovery_running_policy(self)
get_full_fqdn(self)
resolve_fqdn(self)

Resolve FQDN to address :param fqdn: :return:

classmethod get_bi_selector(cls, cfg)
iter_config_tokens(self, config=None)
iter_normalized_tokens(self, config=None)
get_confdb(self, config=None, cleanup=True)

Returns ready ConfDB engine instance

Parameters:
  • config – Configuration data
  • cleanup – Remove temporary nodes if True
Returns:

confdb.Engine instance

classmethod mock_object(cls, profile=None)

Return mock object for tests

Parameters:profile – Profile name
Returns:
class noc.sa.models.managedobject.ManagedObjectAttribute

Bases: noc.core.model.base.NOCModel

class Meta

Bases: object

verbose_name = Managed Object Attribute
verbose_name_plural = Managed Object Attributes
db_table = sa_managedobjectattribute
app_label = sa
unique_together = [['managed_object', 'key']]
ordering = ['managed_object', 'key']
managed_object
key
value
__str__(self)
on_save(self)
class noc.sa.models.managedobject.ScriptsProxy(obj, caller=None)

Bases: object

__getattr__(self, name)
__getitem__(self, item)
__contains__(self, item)

Check object has script name

__iter__(self)
class noc.sa.models.managedobject.ActionsProxy(obj)

Bases: object

class CallWrapper(obj, name, action)

Bases: object

__call__(self, **kwargs)
__getattr__(self, name)
class noc.sa.models.managedobject.MatchersProxy(obj)

Bases: object

_rebuild(self)
__getattr__(self, name)
__contains__(self, item)