Correlation Events
An Event contains minimal information about an individual SNMP trap: time, state, and any specific information necessary to construct a relevant alarm description.
Base Class
- class dashboard.correlation.db.events.EndpointEvent(trap=None, cached_params=None)
An EndpointEvent contains minimal information about an individual SNMP trap: time, state, and any specific information necessary to construct a relevant alarm description.
The constructor extracts the standard params from a trap for use with event/flap processing via self.event_history, or loads based on the values in cached_params
Note that in python, abstract methods can have a body. Child classes should add type sanity checking.
- Parameters:
trap – a normal trap dict
cached_params – dict loaded from cache
- TYPE_FAMILY = {}
for sanity checking (cf.
FlapBucketconstructor)
- baseline_fake_trap()
Constructs a trap used create a placeholder event.
- Returns:
a basic snmp trap dict with timestamps based on the current time
- dumpd()
Create a json-serializable dict that can be used with to re-create this object. :return: a json-serializable dict
- classmethod from_cache(trap_or_cached_params)
- classmethod from_trap(trap_or_cached_params)
- abstractmethod load_flap_record(session)
Load the database record from the correct technology-specific table. :param session: :return: a db row record
- abstractmethod new_flap_record(endpoint, dashboard_alarm)
Construct a new database record object for the particular technology. :param endpoint: :param dashboard_alarm: :return:
- abstractmethod update_flap_record(bucket, alarm)
Update the database record with bucket changes.
note: this could be static, but is different per subclass and the type checking would get messy
- Parameters:
bucket
alarm
- Returns:
Juniper Link Events
- class dashboard.correlation.db.events.LinkEndpointEvent(trap=None, cached_params=None)
Bases:
EndpointEventConstruct a Juniper Link up/down event
- Parameters:
trap – a normal trap dict
cached_params – dict loaded from cache
- TYPE_FAMILY = {'LinkEndpointEvent', 'LinkEndpointPlaceholderEvent'}
for sanity checking (cf.
FlapBucketconstructor)
- dumpd()
create a json-serializable dict that can be used to re-create this object :return: a json-serializable dict
- load_flap_record(session)
TODO: add re-saving with a new id whenever there’s a load error :param session: :param event: :return:
- new_flap_record(endpoint, dashboard_alarm)
Construct a new database record object for the particular technology. :param endpoint: :param dashboard_alarm: :return:
- update_flap_record(bucket, juniper_alarm)
Update the database record with bucket changes.
note: this could be static, but is different per subclass and the type checking would get messy
- Parameters:
bucket
alarm
- Returns:
- class dashboard.correlation.db.events.LinkEndpointPlaceholderEvent(down, ref_event)
Bases:
LinkEndpointEventWorkaround for adding a bogus event that is used to represent a missed trap.
- Parameters:
self
down – the state of the trap we believe was missed
ref_event – a previous related link endpoint event
Juniper BGP Events
- class dashboard.correlation.db.events.BGPEndpointEvent(trap=None, cached_params=None)
Bases:
EndpointEventConstruct a Juniper BGP up/down event.
- Parameters:
trap – a normal trap dict
cached_params – dict loaded from cache
- TYPE_FAMILY = {'BGPEndpointEvent', 'BGPEndpointPlaceholderEvent'}
for sanity checking (cf.
FlapBucketconstructor)
- dumpd()
Create a json-serializable dict that can be used to re-create this object. :return: a json-serializable dict
- load_flap_record(session)
TODO: add re-saving with a new id whenever there’s a load error :param session: :param event: :return:
- new_flap_record(endpoint, dashboard_alarm)
Construct a new database record object for the particular technology. :param endpoint: :param dashboard_alarm: :return:
- update_flap_record(bucket, juniper_alarm)
Update the database record with bucket changes.
note: this could be static, but is different per subclass and the type checking would get messy
- Parameters:
bucket
alarm
- Returns:
- class dashboard.correlation.db.events.BGPEndpointPlaceholderEvent(down, ref_event)
Bases:
BGPEndpointEventWorkaround for adding a bogus event that is used to represent a missed trap.
- Parameters:
self
down – the state of the trap we believe was missed
ref_event – a previous related bgp endpoint event
Coriant Events
- class dashboard.correlation.db.events.CoriantEndpointEvent(trap=None, cached_params=None)
Bases:
EndpointEventConstruct a Coriant up/down event
There’s no additional information added to the event than is already computed in the base class … here we just do a sanity check on the trap type.
- Parameters:
trap – a normal trap dict
cached_params – dict loaded from cache
- TYPE_FAMILY = {'CoriantEndpointEvent', 'CoriantEndpointPlaceholderEvent'}
for sanity checking (cf.
FlapBucketconstructor)
- load_flap_record(session)
TODO: add re-saving with a new id whenever there’s a load error :param session: :param event: :return:
- new_flap_record(endpoint, dashboard_alarm)
Construct a new database record object for the particular technology. :param endpoint: :param dashboard_alarm: :return:
- update_flap_record(bucket, coriant_alarm)
Update the database record with bucket changes.
note: this could be static, but is different per subclass and the type checking would get messy
- Parameters:
bucket
alarm
- Returns:
- class dashboard.correlation.db.events.CoriantEndpointPlaceholderEvent(down, ref_event)
Bases:
CoriantEndpointEventworkaround for adding a bogus event that is used to represent a missed trap
- Parameters:
self
down – the state of the trap we believe was missed
ref_event – a previous related coriant endpoint event
Infinera Events
- class dashboard.correlation.db.events.InfineraEndpointEvent(trap=None, cached_params=None)
Bases:
EndpointEventConstruct an Infinera up/down event.
This class is also used for FIBERLINK traps.
- Parameters:
trap – a normal trap dict
cached_params – dict loaded from cache
- TYPE_FAMILY = {'InfineraEndpointEvent', 'InfineraEndpointPlaceholderEvent'}
for sanity checking (cf.
FlapBucketconstructor)
- dumpd()
Create a json-serializable dict that can be used with loadd to re-create this object. :return: a json-serializable dict
- load_flap_record(session)
TODO: add re-saving with a new id whenever there’s a load error :param session: :param event: :return:
- new_flap_record(endpoint, dashboard_alarm)
Construct a new database record object for the particular technology. :param endpoint: :param dashboard_alarm: :return:
- update_flap_record(bucket, infinera_alarm)
Update the database record with bucket changes.
note: this could be static, but is different per subclass and the type checking would get messy
- Parameters:
bucket
alarm
- Returns:
- class dashboard.correlation.db.events.InfineraEndpointPlaceholderEvent(down, ref_event)
Bases:
InfineraEndpointEventWorkaround for adding a bogus event that is used to represent a missed trap.
- Parameters:
down – the state of the trap we believe was missed
ref_event – a previous related infinera endpoint event