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

[CloudSync] Base Code to connect to MQTT broker running on AWS #436

Merged
merged 1 commit into from
Dec 20, 2021

Conversation

nitu-s-gupta
Copy link
Contributor

@nitu-s-gupta nitu-s-gupta commented Dec 10, 2021

Signed-off-by: Nitu Gupta [email protected]

Description

Provide mechanism to connect to MQTT mosquitto broker running in the AWS endpoint and publish the data

Fixes # (#382)

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  1. MQTT mosquitto broker is configured to be running in the AWS endpoint.
  2. The endpoint url is entered in the brokerURL field for connection
  3. The edge orchestration is build and run using following command with option CLOUD_SYNC set to url of broker
docker run -it -d --privileged --network="host" --name edge-orchestration -e CLOUD_SYNC="ec2-54-175-241-64.compute-1.amazonaws.com"  -v /var/edge-orchestration/:/var/edge-orchestration/:rw -v /var/run/docker.sock:/var/run/docker.sock:rw           -v /proc/:/process/:ro  lfedge/edge-home-orchestration-go:latest

  1. The logs are checked which states the client is connected to the broker and data is published.
INFO[2021-12-14T12:13:05Z]mqttconnection.go:53 StartMQTTClient [MQTTConnectionMgr] The broker istcp://ec2-54-175-241-64.compute-1.amazonaws.com:1883 
INFO[2021-12-14T12:13:05Z]mqttconnection.go:24 Connect [MQTTConnectionMgr]MQTT Connected  
  1. For testing a test client is run subscribing to same topic and we can see data received by the client.
nitup@sagar-HP-Notebook:~/HOMEEDGE/CloudSync_Test/ClientTest$ go run main.go 
Connected to server
MSG: {"AppID":"testid","Payload":"test message to check the Payload"}

Test Configuration:

  • OS type & version: (Ubuntu 20.04)
  • Hardware: (x86-64)
  • Edge Orchestration Release: (v1.1.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

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.

Looks good

cmd/edge-orchestration/main.go Outdated Show resolved Hide resolved
internal/controller/cloudsyncmgr/mqttconfig.go Outdated Show resolved Hide resolved
internal/controller/cloudsyncmgr/mqttconfig.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.

Thanks for the great contribution! Please take a look my comments.

cmd/edge-orchestration/main.go Outdated Show resolved Hide resolved
cmd/edge-orchestration/main.go Outdated Show resolved Hide resolved
internal/controller/cloudsyncmgr/mqttconfig.go Outdated Show resolved Hide resolved
internal/controller/cloudsyncmgr/cloudsync.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.

Thanks for the quick update. Please take a look at my comments.

cmd/edge-orchestration/main.go Outdated Show resolved Hide resolved
internal/controller/cloudsyncmgr/cloudsync.go Outdated Show resolved Hide resolved
@nitu-s-gupta nitu-s-gupta force-pushed the CloudSync branch 3 times, most recently from 27f0914 to f47bf45 Compare December 15, 2021 12:32
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 your great contribution!!

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.

PTAL. Several new files need a copyright / license statement at the top.

internal/common/mqtt/mqttconfig.go Show resolved Hide resolved
internal/common/mqtt/mqttconnection.go Show resolved Hide resolved
internal/common/mqtt/mqttconnection_test.go Show resolved Hide resolved
internal/controller/cloudsyncmgr/cloudsync.go Show resolved Hide resolved
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.

LGTM.

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.

Thanks for the contribution, this is base code for cloud sync

Makefile Outdated Show resolved Hide resolved
@sonarqubecloud
Copy link

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

Makefile Show resolved Hide resolved
@tdrozdovsky tdrozdovsky self-requested a review December 17, 2021 08:36
@MoonkiHong MoonkiHong merged commit fbaadad into lf-edge:master Dec 20, 2021
@nitu-s-gupta nitu-s-gupta deleted the CloudSync branch December 20, 2021 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Cloud Synchronization] Method to send/receive data with cloud infrastructure
6 participants