Skip to content
Snippets Groups Projects
Commit d0172421 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Monitoring component:

- Enhanced logic to detect enabled endpoints and devices
parent 2859baad
No related branches found
No related tags found
2 merge requests!294Release TeraFlowSDN 4.0,!172Resolve "(CTTC) Extend gNMI-OpenConfig SBI driver"
......@@ -108,12 +108,15 @@ class EventsDeviceCollector:
if config_rule.action != ConfigActionEnum.CONFIGACTION_SET: continue
if config_rule.WhichOneof('config_rule') != 'custom': continue
str_resource_key = str(config_rule.custom.resource_key)
if not str_resource_key.startswith('/interface['): continue
json_resource_value = json.loads(config_rule.custom.resource_value)
if 'name' not in json_resource_value: continue
if 'enabled' not in json_resource_value: continue
if not json_resource_value['enabled']: continue
enabled_endpoint_names.add(json_resource_value['name'])
if str_resource_key.startswith('/interface[') or str_resource_key.startswith('/endpoints/endpoint['):
json_resource_value = json.loads(config_rule.custom.resource_value)
if 'name' not in json_resource_value: continue
if 'enabled' in json_resource_value:
if not json_resource_value['enabled']: continue
enabled_endpoint_names.add(json_resource_value['name'])
if 'oper-status' in json_resource_value:
if str(json_resource_value['oper-status']).upper() != 'UP': continue
enabled_endpoint_names.add(json_resource_value['name'])
endpoints_monitored = self._device_endpoint_monitored.setdefault(device_uuid, dict())
for endpoint in device.device_endpoints:
......@@ -127,7 +130,10 @@ class EventsDeviceCollector:
endpoint_was_monitored = endpoints_monitored.get(endpoint_uuid, False)
endpoint_is_enabled = (endpoint_name_or_uuid in enabled_endpoint_names)
if not endpoint_was_monitored and endpoint_is_enabled:
if not endpoint_was_monitored and not endpoint_is_enabled:
# endpoint is idle, do nothing
pass
elif not endpoint_was_monitored and endpoint_is_enabled:
# activate
for value in endpoint.kpi_sample_types:
if value == KPISAMPLETYPE_UNKNOWN: continue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment