Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device Discovery should use EndpointReference for uniqueness #2

Closed
ajcasagrande opened this issue Feb 16, 2022 · 3 comments · Fixed by #7
Closed

Device Discovery should use EndpointReference for uniqueness #2

ajcasagrande opened this issue Feb 16, 2022 · 3 comments · Fixed by #7
Assignees

Comments

@ajcasagrande
Copy link
Contributor

Observation
We have discovered that our Tapo C200 cameras all return the same serial number when queried via GetDeviceInformation.
We have also learned that the happytime-multi-onvif-server sets all camera serial numbers to 123456 by default.

Problem
Only 1 device of each type Tapo C200 and happytime can be added to EdgeX due to name conflicts.

Proposed Solution

Use the Endpoint Reference as specified in the ONVIF spec. This is available during WS-Discovery:

7.3.1 Endpoint reference
A device or an endpoint that takes the client role should use a URN:UUID [RFC4122] as the address property
of its endpoint reference.

The device or an endpoint that takes the client role shall use a stable, globally unique identifier that is constant
across network interfaces
as part of its endpoint reference property. The combination of an wsadis:Address
and wsadis:ReferenceProperties provide a stable and globally-unique identifier.

Source

We have indeed confirmed that even when the device IP address changes, the EndpointReference stays the same, and is unique to all of our cameras.

@weichou1229
Copy link
Member

@ajcasagrande
The modification can be done with the following steps:

  1. Parse the EndpointReference from the probe response. https://github.com/IOTechSystems/onvif/blob/master/ws-discovery/networking.go#L43-L56
  2. Replace the serial number with EndpointReference when discovering the device. https://github.com/edgexfoundry-holding/device-onvif-camera/blob/main/internal/driver/driver.go#L328

@cloudxxx8
Copy link
Member

@ajcasagrande do you agree with Bruce's solution?

@weichou1229
Copy link
Member

weichou1229 commented Feb 23, 2022

@ajcasagrande

I can get the EndpointReference from probe message as below two cameras:

TAPO C200

<wsdd:ProbeMatch>
  <wsa:EndpointReference>
    <wsa:Address>uuid:3fa1fe68-b915-4053-a3e1-c006c3afec0e</wsa:Address>
     <wsa:ReferenceProperties></wsa:ReferenceProperties><wsa:PortType>ttl</wsa:PortType>
  </wsa:EndpointReference>
  <wsdd:XAddrs>http://192.168.12.128:2020/onvif/device_service</wsdd:XAddrs>
  ...
</wsdd:ProbeMatch>

HIKVISION

<d:ProbeMatch>
 <wsadis:EndpointReference>
    <wsadis:Address>urn:uuid:cea94000-fb96-11b3-8260-686dbc5cb15d</wsadis:Address>
 </wsadis:EndpointReference>
 <d:XAddrs>http://192.168.12.123/onvif/device_service</d:XAddrs>
 ...
</d:ProbeMatch>

So we need to extract the uuid value 3fa1fe68-b915-4053-a3e1-c006c3afec0e and cea94000-fb96-11b3-8260-686dbc5cb15d to replace the serial number. Is that correct?

The PRs opened, could you help verify that?
#7
IOTechSystems/onvif#8

weichou1229 added a commit to weichou1229/device-onvif-camera that referenced this issue Feb 23, 2022
Replace the serial number with EndpointReference Address UUID as the part of device name

Close edgexfoundry#2

Signed-off-by: bruce <weichou1229@gmail.com>
weichou1229 added a commit to weichou1229/device-onvif-camera that referenced this issue Feb 23, 2022
Replace the serial number with EndpointReference Address UUID as the part of device name

Close edgexfoundry#2

Signed-off-by: bruce <weichou1229@gmail.com>
weichou1229 added a commit to weichou1229/device-onvif-camera that referenced this issue Feb 25, 2022
Replace the serial number with EndpointReference Address as the part of device name

Close edgexfoundry#2

Signed-off-by: bruce <weichou1229@gmail.com>
weichou1229 added a commit to weichou1229/device-onvif-camera that referenced this issue Mar 1, 2022
Replace the serial number with EndpointReference Address as the part of device name

Close edgexfoundry#2

Signed-off-by: bruce <weichou1229@gmail.com>
weichou1229 added a commit to weichou1229/device-onvif-camera that referenced this issue Mar 1, 2022
Replace the serial number with EndpointReference Address as the part of device name

Close edgexfoundry#2

Signed-off-by: bruce <weichou1229@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants