diff options
author | Albin Suresh <albin.suresh@softwareag.com> | 2022-04-04 22:13:16 +0530 |
---|---|---|
committer | Albin Suresh <albin.suresh@softwareag.com> | 2022-04-07 14:06:33 +0530 |
commit | 7ae0eeffc51acc9500441ef5b46cf6eee1b822b3 (patch) | |
tree | a506924c5a6ee93c48b667a2303c00f45c0e7593 /crates/core/tedge | |
parent | ba619f6bacca6d9f41aa21a0aa88f290d18798db (diff) |
Closes #862 Report mosquitto cloud bridge health status via MQTT
Diffstat (limited to 'crates/core/tedge')
-rw-r--r-- | crates/core/tedge/src/cli/connect/bridge_config.rs | 22 | ||||
-rw-r--r-- | crates/core/tedge/src/cli/connect/bridge_config_azure.rs | 8 | ||||
-rw-r--r-- | crates/core/tedge/src/cli/connect/bridge_config_c8y.rs | 8 |
3 files changed, 34 insertions, 4 deletions
diff --git a/crates/core/tedge/src/cli/connect/bridge_config.rs b/crates/core/tedge/src/cli/connect/bridge_config.rs index b819a64b..bb4a7930 100644 --- a/crates/core/tedge/src/cli/connect/bridge_config.rs +++ b/crates/core/tedge/src/cli/connect/bridge_config.rs @@ -21,6 +21,8 @@ pub struct BridgeConfig { pub start_type: String, pub clean_session: bool, pub notifications: bool, + pub notifications_local_only: bool, + pub notification_topic: String, pub bridge_attempt_unsubscribe: bool, pub topics: Vec<String>, } @@ -54,6 +56,12 @@ impl BridgeConfig { writeln!(writer, "notifications {}", self.notifications)?; writeln!( writer, + "notifications_local_only {}", + self.notifications_local_only + )?; + writeln!(writer, "notification_topic {}", self.notification_topic)?; + writeln!( + writer, "bridge_attempt_unsubscribe {}", self.bridge_attempt_unsubscribe )?; @@ -115,6 +123,8 @@ mod test { start_type: "automatic".into(), clean_session: true, notifications: false, + notifications_local_only: false, + notification_topic: "test_topic".into(), bridge_attempt_unsubscribe: false, }; @@ -139,6 +149,8 @@ try_private false start_type automatic cleansession true notifications false +notifications_local_only false +notification_topic test_topic bridge_attempt_unsubscribe false ### Topics @@ -173,6 +185,8 @@ bridge_attempt_unsubscribe false start_type: "automatic".into(), clean_session: true, notifications: false, + notifications_local_only: false, + notification_topic: "test_topic".into(), bridge_attempt_unsubscribe: false, }; let mut serialized_config = Vec::<u8>::new(); @@ -196,6 +210,8 @@ try_private false start_type automatic cleansession true notifications false +notifications_local_only false +notification_topic test_topic bridge_attempt_unsubscribe false ### Topics @@ -233,6 +249,8 @@ bridge_attempt_unsubscribe false start_type: "automatic".into(), clean_session: true, notifications: false, + notifications_local_only: false, + notification_topic: "test_topic".into(), bridge_attempt_unsubscribe: false, }; @@ -259,6 +277,8 @@ bridge_attempt_unsubscribe false expected.insert("try_private false"); expected.insert("cleansession true"); expected.insert("notifications false"); + expected.insert("notifications_local_only false"); + expected.insert("notification_topic test_topic"); expected.insert("bridge_attempt_unsubscribe false"); expected.insert("topic messages/events/ out 1 az/ devices/alpha/"); @@ -362,6 +382,8 @@ bridge_attempt_unsubscribe false start_type: "automatic".into(), clean_session: true, notifications: false, + notifications_local_only: false, + notification_topic: "test_topic".into(), bridge_attempt_unsubscribe: false, topics: vec![], } diff --git a/crates/core/tedge/src/cli/connect/bridge_config_azure.rs b/crates/core/tedge/src/cli/connect/bridge_config_azure.rs index 0aa5ac1b..4182335e 100644 --- a/crates/core/tedge/src/cli/connect/bridge_config_azure.rs +++ b/crates/core/tedge/src/cli/connect/bridge_config_azure.rs @@ -51,7 +51,9 @@ impl From<BridgeConfigAzureParams> for BridgeConfig { try_private: false, start_type: "automatic".into(), clean_session: false, - notifications: false, + notifications: true, + notifications_local_only: true, + notification_topic: "tedge/health/mosquitto-az-bridge".into(), bridge_attempt_unsubscribe: false, topics: vec![ pub_msg_topic, @@ -101,7 +103,9 @@ fn test_bridge_config_from_azure_params() -> anyhow::Result<()> { try_private: false, start_type: "automatic".into(), clean_session: false, - notifications: false, + notifications: true, + notifications_local_only: true, + notification_topic: "tedge/health/mosquitto-az-bridge".into(), bridge_attempt_unsubscribe: false, }; diff --git a/crates/core/tedge/src/cli/connect/bridge_config_c8y.rs b/crates/core/tedge/src/cli/connect/bridge_config_c8y.rs index ff880e65..90fdab7e 100644 --- a/crates/core/tedge/src/cli/connect/bridge_config_c8y.rs +++ b/crates/core/tedge/src/cli/connect/bridge_config_c8y.rs @@ -41,7 +41,9 @@ impl From<BridgeConfigC8yParams> for BridgeConfig { try_private: false, start_type: "automatic".into(), clean_session: false, - notifications: false, + notifications: true, + notifications_local_only: true, + notification_topic: "tedge/health/mosquitto-c8y-bridge".into(), bridge_attempt_unsubscribe: false, topics: vec![ // Registration @@ -138,7 +140,9 @@ fn test_bridge_config_from_c8y_params() -> anyhow::Result<()> { try_private: false, start_type: "automatic".into(), clean_session: false, - notifications: false, + notifications: true, + notifications_local_only: true, + notification_topic: "tedge/health/mosquitto-c8y-bridge".into(), bridge_attempt_unsubscribe: false, }; |