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

[DataStorage] BugFix for Device not found in cache(Issue #312) #374

Closed
wants to merge 1 commit into from

Conversation

nitu-s-gupta
Copy link
Contributor

Signed-off-by: Nitu Gupta nitu.gupta@samsung.com

Description

Bug: The edge-orchestration can not find the device in the cache if edge-orchestration registers device configuration to edgex for the first time. It works after reboot.
Reason:
When running metadata, coredata in dockers, these services are unable to reach device service when device gets added. Hence callback is not invoked and so cache is not updated.
Solution: Replace the HostIP of metadata, coredata and device service to docker0 IP in confuguration.toml file

Fixes #312

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  1. Clear redis database
  2. Run edge-orchestration with DataStorage configuration files
  3. Call an API in terms of uploading Int value

curl -X POST "localhost:49986/api/v1/resource/datastorage/int" -H "accept: text/plain" -H "Content-Type: text/plain" -d 123

The value gets uploaded successfully.

Test Configuration:

  • Firmware version: Ubuntu 20.04
  • Hardware: x86-64
  • Edge Orchestration Release: 1.0.0

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Signed-off-by: Nitu Gupta <nitu.gupta@samsung.com>
@sonarcloud
Copy link

sonarcloud bot commented Aug 25, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Contributor

@tiokim tiokim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your efforts. I have a question about this approach.
Assume that we have two devices, Device A(enp4s0:192.168.0.7, docker0:172.17.0.1) and B(enp4s0:192.168.0.8, docker0:172.17.0.1).
EdgeX containers are running on Device A and Edge Orchestration on Device B tries to connect to the EdgeX containers on Device A.
If we set the Host to 172.17.0.1 in Device B's configuration.toml, can Device B receive the callback from Device A?

@nitu-s-gupta
Copy link
Contributor Author

Thanks for your efforts. I have a question about this approach.
Assume that we have two devices, Device A(enp4s0:192.168.0.7, docker0:172.17.0.1) and B(enp4s0:192.168.0.8, docker0:172.17.0.1).
EdgeX containers are running on Device A and Edge Orchestration on Device B tries to connect to the EdgeX containers on Device A.
If we set the Host to 172.17.0.1 in Device B's configuration.toml, can Device B receive the callback from Device A?

docker0 is for local machines. For different machine you can use the real ip address, but you need to configure your docker network properly. https://docs.docker.com/network/

@tiokim
Copy link
Contributor

tiokim commented Aug 30, 2021

docker0 is for local machines. For different machine you can use the real ip address, but you need to configure your docker network properly. https://docs.docker.com/network/

Could you explain a bit more on what "properly" means?

@nitu-s-gupta
Copy link
Contributor Author

docker0 is for local machines. For different machine you can use the real ip address, but you need to configure your docker network properly. https://docs.docker.com/network/

Could you explain a bit more on what "properly" means?

An overlay network has to be setup for docker communication between multiple host. https://docs.docker.com/network/
Since we are making docker containers similar overlay network should work for communication scenario mentioned by you

@tiokim
Copy link
Contributor

tiokim commented Sep 4, 2021

docker0 is for local machines. For different machine you can use the real ip address, but you need to configure your docker network properly. https://docs.docker.com/network/

Could you explain a bit more on what "properly" means?

An overlay network has to be setup for docker communication between multiple host. https://docs.docker.com/network/
Since we are making docker containers similar overlay network should work for communication scenario mentioned by you

Is it right to configure an overlay network with multiple devices to our Home IoT scenario?
If the approach is right, can you explain about how to configure the overlay network in detail? Assume that you have 3 devices like below.

  • A with edgex container (enp4s0:192.168.0.7)
  • B(enp4s0:192.168.0.8)
  • C(enp4s0:192.168.0.9)

@nitu-s-gupta
Copy link
Contributor Author

docker0 is for local machines. For different machine you can use the real ip address, but you need to configure your docker network properly. https://docs.docker.com/network/

Could you explain a bit more on what "properly" means?

An overlay network has to be setup for docker communication between multiple host. https://docs.docker.com/network/
Since we are making docker containers similar overlay network should work for communication scenario mentioned by you

Is it right to configure an overlay network with multiple devices to our Home IoT scenario?
If the approach is right, can you explain about how to configure the overlay network in detail? Assume that you have 3 devices like below.

  • A with edgex container (enp4s0:192.168.0.7)
  • B(enp4s0:192.168.0.8)
  • C(enp4s0:192.168.0.9)

Hello, I have tested with A running the edgex containers and B running the edge orchestration. I have replaced the host as A machine IP except for device service with B machine IP in configuration toml and i observed the device was detected and was able to post data from B to coredata. So considering the scenario it should work fine with 3 machines also.

@tiokim
Copy link
Contributor

tiokim commented Sep 21, 2021

docker0 is for local machines. For different machine you can use the real ip address, but you need to configure your docker network properly. https://docs.docker.com/network/

Could you explain a bit more on what "properly" means?

An overlay network has to be setup for docker communication between multiple host. https://docs.docker.com/network/
Since we are making docker containers similar overlay network should work for communication scenario mentioned by you

Is it right to configure an overlay network with multiple devices to our Home IoT scenario?
If the approach is right, can you explain about how to configure the overlay network in detail? Assume that you have 3 devices like below.

  • A with edgex container (enp4s0:192.168.0.7)
  • B(enp4s0:192.168.0.8)
  • C(enp4s0:192.168.0.9)

Hello, I have tested with A running the edgex containers and B running the edge orchestration. I have replaced the host as A machine IP except for device service with B machine IP in configuration toml and i observed the device was detected and was able to post data from B to coredata. So considering the scenario it should work fine with 3 machines also.

This is very good news!
How should we modify the source code?

@nitu-s-gupta
Copy link
Contributor Author

docker0 is for local machines. For different machine you can use the real ip address, but you need to configure your docker network properly. https://docs.docker.com/network/

Could you explain a bit more on what "properly" means?

An overlay network has to be setup for docker communication between multiple host. https://docs.docker.com/network/
Since we are making docker containers similar overlay network should work for communication scenario mentioned by you

Is it right to configure an overlay network with multiple devices to our Home IoT scenario?
If the approach is right, can you explain about how to configure the overlay network in detail? Assume that you have 3 devices like below.

  • A with edgex container (enp4s0:192.168.0.7)
  • B(enp4s0:192.168.0.8)
  • C(enp4s0:192.168.0.9)

Hello, I have tested with A running the edgex containers and B running the edge orchestration. I have replaced the host as A machine IP except for device service with B machine IP in configuration toml and i observed the device was detected and was able to post data from B to coredata. So considering the scenario it should work fine with 3 machines also.

This is very good news!
How should we modify the source code?

I would prefer modifying the document since the issue is of setup. How about providing info about both setups like localhost and different machine in datatstorage setup.md file so that user can configure on their own. Please provide your suggestion :)

@tdrozdovsky
Copy link
Contributor

I would prefer modifying the document since the issue is of setup. How about providing info about both setups like localhost and different machine in datatstorage setup.md file so that user can configure on their own. Please provide your suggestion :)

I think you need to add a description as a separate item/paragraph in the datastorage.md

@tiokim
Copy link
Contributor

tiokim commented Sep 22, 2021

I would prefer modifying the document since the issue is of setup. How about providing info about both setups like localhost and different machine in datatstorage setup.md file so that user can configure on their own. Please provide your suggestion :)

I can't decide which one is right since the setup is very vague to me. As you can see from How to Run, I want to configure the configuration.toml automatically. If the user has to revise configuration.toml, please modify the source code. If that is not the case, you may write down the info on the document instead.

@nitu-s-gupta
Copy link
Contributor Author

I would prefer modifying the document since the issue is of setup. How about providing info about both setups like localhost and different machine in datatstorage setup.md file so that user can configure on their own. Please provide your suggestion :)

I can't decide which one is right since the setup is very vague to me. As you can see from How to Run, I want to configure the configuration.toml automatically. If the user has to revise configuration.toml, please modify the source code. If that is not the case, you may write down the info on the document instead.

ok will raise a separate PR for the same!

@nitu-s-gupta nitu-s-gupta deleted the bugfix branch October 12, 2021 08:52
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 this pull request may close these issues.

[DataStorage] can not find device in cache
3 participants