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] Device Not found in Cache Issue #396

Merged
merged 1 commit into from Oct 14, 2021

Conversation

nitu-s-gupta
Copy link
Contributor

@nitu-s-gupta nitu-s-gupta commented Oct 12, 2021

Signed-off-by: Nitu Sajjanlal 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.

Solution: The configuration toml file is generated automatically, so the ip of edge-orchestration resolves the issue and callbacks are recieved.

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 the docker-compose up -d from deployments/datatsorage
  3. Run edge-orchestration with datastorage service
  4. Call an API in terms of uploading Int value

curl -X POST "{ip of edge-orchestration}:49986/api/v1/resource/int" -H "accept: text/plain" -H "Content-Type: text/plain" -d 123
For example:
curl -X POST "107.108.70.126:49986/api/v1/resource/int" -H "accept: text/plain" -H "Content-Type: text/plain" -d 123
The value gets uploaded successfully. which is verified with GET command

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

@tiokim tiokim added the bug Something isn't working label Oct 12, 2021
@tiokim tiokim added this to In progress in DataStorage via automation Oct 12, 2021
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 the contribution!
Pleaset take a look at my comment.

internal/controller/storagemgr/storage.go Outdated Show resolved Hide resolved
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.

Host of Service in configuration.toml is empty with this PR.
Please refer to the log below.

$ docker exec -ti edge-orchestration /bin/bash
root@t25kim:/edge-orchestration# cat res/configuration.toml

[Clients]

  [Clients.Data]
    Host = "10.113.70.227"
    Port = 48080
    Protocol = "http"
    Timeout = 5000

  [Clients.Metadata]
    Host = "10.113.70.227"
    Port = 48081
    Protocol = "http"
    Timeout = 5000

[Device]
  DataTransform = true
  InitCmd = ""
  InitCmdArgs = ""
  MaxCmdOps = 128
  MaxCmdValueLen = 256
  ProfilesDir = "./res"
  RemoveCmd = ""
  RemoveCmdArgs = ""

[[DeviceList]]
  Description = "RESTful Device"
  Labels = ["rest","json"]
  Name = "edge-orchestration-c1b23cc6-0767-400a-9cf0-36e1b3902da2"
  Profile = "edge-orchestration-c1b23cc6-0767-400a-9cf0-36e1b3902da2"

  [DeviceList.Protocols]

    [DeviceList.Protocols.other]

[Registry]
  CheckInterval = "10s"
  FailLimit = 3
  FailWaitTime = 10
  Host = "10.113.70.227"
  Port = 8500
  Type = "consul"

[Service]
  AsyncBufferSize = 16
  ConnectionRetries = 20
  EnableAsyncReadings = true
  Host = ""
  Labels = []
  OpenMsg = "REST device started"
  Port = 49986
  Timeout = 5000

[Writable]
  LogLevel = "DEBUG"

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

sonarcloud bot commented Oct 13, 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
0.0% 0.0% Duplication

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.

LGTM Thanks for the contribution!

DataStorage automation moved this from In progress to Reviewer approved Oct 13, 2021
Copy link
Contributor

@MoonkiHong MoonkiHong left a comment

Choose a reason for hiding this comment

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

Seems good to me. Appreciate for your contribution to resolve the issue. 💯

Copy link
Contributor

@tdrozdovsky tdrozdovsky left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@NiranjanPatil25 NiranjanPatil25 left a comment

Choose a reason for hiding this comment

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

okay

@@ -22,19 +22,19 @@ FailWaitTime = 10
[Clients]
[Clients.Data]
Protocol = "http"
Host = "localhost"
Host = '172.17.0.1'
Port = 48080
Timeout = 5000

Choose a reason for hiding this comment

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

Pls add code comments briefing the rationale behind using values 16 , 20 , 10s etc ..for future maintainability

Copy link
Contributor

@suresh-lc suresh-lc left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the quick fix before the release

@MoonkiHong MoonkiHong merged commit ef60688 into lf-edge:master Oct 14, 2021
DataStorage automation moved this from Reviewer approved to Done Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging this pull request may close these issues.

[DataStorage] can not find device in cache
6 participants