Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TFS
controller
Commits
215d6026
Commit
215d6026
authored
1 year ago
by
Lluis Gifre Renom
Browse files
Options
Downloads
Patches
Plain Diff
Monitoring component:
- Only monitor enabled endpoints
parent
ec4d1fa3
No related branches found
No related tags found
3 merge requests
!142
Release TeraFlowSDN 2.1
,
!132
NetSoft Hackfest extensions, gNMI Driver, gNMI L3NM Service Handler, multiple fixes
,
!113
Draft: NetSoft Hackfest extensions
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/monitoring/service/EventTools.py
+16
-2
16 additions, 2 deletions
src/monitoring/service/EventTools.py
with
16 additions
and
2 deletions
src/monitoring/service/EventTools.py
+
16
−
2
View file @
215d6026
...
...
@@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
grpc
,
json
,
logging
,
queue
,
threading
from
typing
import
Dict
import
grpc
,
logging
,
queue
,
threading
from
common.method_wrappers.ServiceExceptions
import
ServiceException
from
common.proto
import
monitoring_pb2
from
common.proto.context_pb2
import
DeviceOperationalStatusEnum
,
Empty
,
EventTypeEnum
from
common.proto.context_pb2
import
ConfigActionEnum
,
DeviceOperationalStatusEnum
,
Empty
,
EventTypeEnum
from
common.proto.kpi_sample_types_pb2
import
KpiSampleType
from
context.client.ContextClient
import
ContextClient
from
monitoring.client.MonitoringClient
import
MonitoringClient
...
...
@@ -108,7 +108,21 @@ class EventsDeviceCollector:
# device is not ready for monitoring
continue
enabled_endpoint_names
=
set
()
for
config_rule
in
device
.
device_config
.
config_rules
:
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
'
])
for
endpoint
in
device
.
device_endpoints
:
if
endpoint
.
name
not
in
enabled_endpoint_names
:
continue
endpoint_uuid
=
endpoint
.
endpoint_id
.
endpoint_uuid
.
uuid
self
.
_name_mapping
.
set_endpoint_name
(
endpoint_uuid
,
endpoint
.
name
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment