edgexfoundry / edgexfoundry/device-sdk-go

ProvisionWatcher support regex for blockingIdentifiers

Open
#1,111 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
106
Forks
136
Avg merge
1h 36m
Merged PRs (30d)
1

Description

# 🚀 Feature Request

### Description [**REQUIRED**]
Currently, Provision Watchers support regex matching for `identifiers`, but not for `blockingIdentifiers`.

In [edgexfoundry-holding/device-onvif-camera](https://github.com/edgexfoundry-holding/device-onvif-camera), an example would be to create a provision watcher for any ONVIF device that is unknown. The idea would be to match any ONVIF camera without a `Manufacturer` attribute.

```json
"provisionwatcher":{
"apiVersion":"v2",
"name":"Provision-Watcher-Unknown",
"adminState":"UNLOCKED",
"identifiers":{
"Address": "."
},
"blockingIdentifiers":{
"Manufacturer": [ ".+" ]
},
"serviceName": "device-onvif-camera",
"profileName": "onvif-camera"
}
```

### Describe the solution you'd like
Unfortunately because it is already implemented using pure string matches, switching to regex could cause unintended side-effects. One option is to use a function that implements exact regex match (versus substring match) (ie. equivalent to `^regex$`).

Another option would be to make it an explicit extra field, like so:

```json
"regexBlockingIdentifiers":{
"Manufacturer": "."
},
```

### Describe alternatives you've considered
Create a provision watcher that blocks all `Manufacturer` values that are already defined in other provision watchers. This is harder to keep track of, as it would need to be updated on a per-install basis based on the other registered provision watchers.

```json
"provisionwatcher":{
"apiVersion":"v2",
"name":"Provision-Watcher-Unknown",
"adminState":"UNLOCKED",
"identifiers":{
"Address": "."
},
"blockingIdentifiers":{
"Manufacturer": [ "HIKVISION", "Tapo", "GeoVision", ... ]
},
"serviceName": "device-onvif-camera",
"profileName": "onvif-camera"
}
```

Contributor guide

Open the contributing guide

Research direction

Start by locating the Provision Watcher identifier-matching implementation and its existing tests; the issue names no files or tests. Compare the current identifiers behavior with blockingIdentifiers and determine the compatibility-preserving form to support. Done means the chosen configuration is covered by tests without changing existing exact-match behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.