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

feat: Implement Device Profile System Events #4336

Merged
merged 1 commit into from
Feb 8, 2023

Conversation

jinlinGuan
Copy link
Contributor

@jinlinGuan jinlinGuan commented Feb 8, 2023

  • publish system events for device profile add/update/delete
  • remove the update device profile REST callback

close #4273
Signed-off-by: Ginny Guan ginny@iotechsys.com

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/edgex-go/blob/main/.github/Contributing.md

PR Checklist

Please check if your PR fulfills the following requirements:

  • I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • I am not introducing a new dependency (add notes below if you are)
  • I have added unit tests for the new feature or bug fix (if not, why?)
  • I have fully tested (add details below) this the new feature or bug fix (if not, why?)
  • I have opened a PR for the related docs change (if not, why?)
    feat: Update Core Metadata Device System Event DTO edgex-docs#960

Testing Instructions

  1. build and run core-metadata with other services
  2. find the correct logs
  3. (optional) subscribe the redis messagebus system event topic and receive the correct messages
  • add a device profile
    curl -ki -X POST http://localhost:59881/api/v2/deviceprofile -d '[   
      {
        "apiVersion": "v2",
        "profile": {
                "name": "test-1"
        }
      }
    ]'
    
    # logs
    level=DEBUG ts=2023-02-08T08:21:58.005126Z app=core-metadata source=deviceprofile.go:43 msg="DeviceProfile created on DB successfully. DeviceProfile-id: 49db0c5b-0b05-4c29-b190-d40c8c966d72, Correlation-id: 73cd4036-c747-480e-ba57-b5f91006c228 "
    level=DEBUG ts=2023-02-08T08:21:58.007451Z app=core-metadata source=notify.go:197 msg="Published the 'add' System Event for deviceprofile 'test-1' to topic 'edgex/system-events/core-metadata/deviceprofile/add/core-metadata/test-1'"
    
  • update a device profile (add a device resource)
    curl -ki -X POST http://localhost:59881/api/v2/deviceprofile/resource -d '[  
      { 
        "apiVersion": "v2",
        "profileName":"test-1",
        "resource": {
                "name": "resource-1", 
                "properties": {"valueType": "String","readWrite": "RW"}}
      }
    ]'
    
    # logs
    level=DEBUG ts=2023-02-08T08:25:46.249157Z app=core-metadata source=deviceresource.go:82 msg="DeviceProfile deviceResources added on DB successfully. Correlation-id: 43b54bb5-0dea-411d-919a-6ce53a57573a "
    level=DEBUG ts=2023-02-08T08:25:46.251096Z app=core-metadata source=notify.go:197 msg="Published the 'update' System Event for deviceprofile 'test-1' to topic 'edgex/system-events/core-metadata/deviceprofile/update/core-metadata/test-1'"
    
  • delete a device profile
    curl -ki -X DELETE http://localhost:59881/api/v2/deviceprofile/name/test-1
    
    # logs
    level=DEBUG ts=2023-02-08T08:28:08.594946Z app=core-metadata source=notify.go:197 msg="Published the 'delete' System Event for deviceprofile 'test-1' to topic 'edgex/system-events/core-metadata/deviceprofile/delete/core-metadata/test-1'"
    

New Dependency Instructions (If applicable)

- publish system events for device profile add/update/delete
- remove the update device profile REST callback

close edgexfoundry#4273
Signed-off-by: Ginny Guan <ginny@iotechsys.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 8, 2023

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
3.5% 3.5% Duplication

Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

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

LGTM

@lenny-goodell lenny-goodell merged commit 966ddbc into edgexfoundry:main Feb 8, 2023
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.

Replace device profile callback with system event
2 participants