Skip to main content



      Home
Home » Eclipse Projects » Kura » Bundle Remote Update(Gateway is another network.)
Bundle Remote Update [message #1734200] Mon, 06 June 2016 03:02 Go to next message
Eclipse UserFriend
Hi,

I need to find a way to update my Kura bundle[1] (deployed on RaspberryPi) remotely. I know the kura's web gui is works perfect but the point is, the device is not my network. Simply, I can't reach my device. But luckily, device can connect to the internet (mosquitto broker).

So, I thought that if I write another bundle[2] that listens specific mqtt-topic for my commands. And if I need to update bundle[1], I can talk my device via bundle[2] , update my bundle or change settings of Kura.

I want to hear your thoughts. Maybe I'm missing some point.

Thanks,
Said.
Re: Bundle Remote Update [message #1734481 is a reply to message #1734200] Wed, 08 June 2016 11:50 Go to previous messageGo to next message
Eclipse UserFriend
Hello Said,

Configuring Kura via MQTT is already supported in Kura. Take a look at this document [1] and let me know if you have any questions.

[1] http://eclipse.github.io/kura/ref/mqtt-namespace.html

Thanks,
--Dave
Re: Bundle Remote Update [message #1734537 is a reply to message #1734481] Thu, 09 June 2016 05:22 Go to previous messageGo to next message
Eclipse UserFriend
Hi Dave,

This document really saved my days. I took a look before but not completed, my bad Sad

Here what I understand. I need to write a bundle to control my all bundles in all devices. Simply I need "account_name" and "client_id" to send directives to device. But what I don't understand is, how can I set the topic name with my CloudClient instance? To make a request to this topic "$EDC/[account_name]/[client_id]/DEPLOY-V2/GET/download" in example. When I use my CloudClient's controlPublish method, it always add bundles name to topic. Without CloudClient, I don't know how to send KuraPayload object as a payload.

Thanks,
Said.

Re: Bundle Remote Update [message #1734593 is a reply to message #1734537] Thu, 09 June 2016 11:37 Go to previous messageGo to next message
Eclipse UserFriend
Hi again,

I made some progress today. I noticed Amit's application [1]. I tried to use DEPLOY-V2 to update deployment package but I didn't achieve.
Here is what i add to payload beyond request.id and requester.client.id;
payload.addMetric("dp.uri", "https://s3-us-west-2.amazonaws.com/dzmtzxbieb/terminator.dp");
payload.addMetric("dp.name", "terminator");
payload.addMetric("dp.version", "1.0.0");
payload.addMetric("dp.download.protocol", "HTTPS");


Here is the log;
2016-06-09 17:37:43,578 [MQTT Call: B8:27:EB:19:50:BC] INFO  o.e.k.c.c.CloudServiceImpl - Message arrived on topic: $EDC/test/B8:27:EB:19:50:BC/DEPLOY-V2/EXEC/download
2016-06-09 17:37:43,640 [pool-1-thread-1] INFO  o.e.k.c.d.CloudDeploymentHandlerV2 - Malformed download request!
2016-06-09 17:37:43,648 [pool-1-thread-1] ERROR o.e.k.c.c.CloudPayloadProtoBufEncoderImpl - During serialization, ignoring metric named: response.exception.message. The value is null.


[1] = https://github.com/amitjoy/Kura-MQTT-Client-Utility
Re: Bundle Remote Update [message #1734608 is a reply to message #1734593] Thu, 09 June 2016 16:26 Go to previous messageGo to next message
Eclipse UserFriend
Hello Said,

As you found out, the CloudClient will not work for this. If you want to use Kura you would need to use the DataService. This gives you complete control over the topic structure.

That said, there may be a bug in our documentation. Looking at the code, it appears two other fields are mandatory for the payload. Can you try adding these:
// Job ID, data type is long
payload.addMetric("job.id", "12345891011") ;
// System update, data type is boolean, set to false for now
payload.addMetric("dp.install.system.update", false);


Let me know if this works. If so, I will update the documentation and explain the addition properties.

Thanks,
--Dave
Re: Bundle Remote Update [message #1734626 is a reply to message #1734608] Fri, 10 June 2016 02:14 Go to previous messageGo to next message
Eclipse UserFriend
Hi Dave,

Thank you again for your help. I added "job.id" and it works now. You did a little typo, as you said the data type should be long, not string. And "dp.install.system.update" is a mandatory field also.

// Job ID, data type is long
payload.addMetric("job.id", 12345891011L) ;
// System update, data type is boolean, set to false for now
payload.addMetric("dp.install.system.update", false);


Thanks,
Said.

[Updated on: Fri, 10 June 2016 02:15] by Moderator

Re: Bundle Remote Update [message #1734712 is a reply to message #1734626] Fri, 10 June 2016 09:43 Go to previous messageGo to next message
Eclipse UserFriend
Hello Said,

Thanks for catching the typo! And yes, the dp.install.system.update is not required, it does have a default value. I will update the documentation to indicate the need for a "job.id" metric.

Thanks,
--Dave
Re: Bundle Remote Update [message #1735084 is a reply to message #1734712] Wed, 15 June 2016 08:45 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
From above details I downloaded amitjoy Kura Mqtt utility from github . But while importing as plugins all folder are not importing.
com.amitinside.mqtt.client.kura.feature
com.amitinside.mqtt.client.kura.product
these two folders are not importing please help me how to import all folders.
Regards,
K.Tejram.
Re: Bundle Remote Update [message #1745716 is a reply to message #1735084] Sat, 15 October 2016 16:48 Go to previous messageGo to next message
Eclipse UserFriend
Hello,
I'm also trying to use the DEPLOY-V2 to update deployment package but when I'm sending MQTT call I'm getting no message at all. Also, I'm not getting any errors in the log as descriped in the above comments.
2016-10-15 20:35:50,003 [MQTT Call: raspberry] INFO  o.e.k.c.c.CloudServiceImpl - Message arrived on topic: EDC/guest/raspberry/DEPLOY-V2/EXEC/download

Since I'm using an MQTT broker that doesn't support $ in topic names, I have renamed the 'topic.control-prefix*' parameter to simply 'EDC' in the Kura web admins CloudService page. It looks like this works, as it appears that the call is arrived in the above log.
This is what I'm sending with the Kura MQTT client:
Topic: EDC/guest/raspberry/DEPLOY-V2/EXEC/download
Request ID: REQUEST_VE0US84QLJ3KLDS2HABCHVHC5D
Requester Client ID: CLIENT_90VKK2HU5LUKTM1SSPN8HSUDQT
Request payload:
dp.uri=https://s3-us-west-2.amazonaws.com/dzmtzxbieb/terminator.dp
dp.name=terminator
dp.version=1.0.0
db.download.protocol=HTTPS
job.id=121321
dp.install.system.update=false

I've also subscribed to 'EDC/guest/CLIENT_90VKK2HU5LUKTM1SSPN8HSUDQT/DEPLOY-V2/REPLY/REQUEST_VE0US84QLJ3KLDS2HABCHVHC5D', but there is no response there.
What I find strange is that I'm getting no error logs from CloudDeploymentHandlerV2. I have Kura 2.0.1 installed on my Pi2. Do you have any suggestion?

EDIT:
Trying to use the CONF-V1 service the same way.
After setting the Kura logger to debug, I'm getting this:
2016-10-15 21:38:04,931 [MQTT Call: raspberry] DEBUG o.e.k.c.d.t.m.MqttDataTransport - Message arrived on topic: EDC/guest/raspberry/CONF-V1/GET/configurations
2016-10-15 21:38:04,932 [MQTT Call: raspberry] DEBUG o.e.k.c.d.t.m.DataTransportListenerS - No registered listener services. Ignoring onMessageArrived

I don't understand, isn't this CONF-V1 is a default installed Kura service? Or I'm getting this entirely wrong.

[Updated on: Sat, 15 October 2016 17:45] by Moderator

Re: Bundle Remote Update [message #1745957 is a reply to message #1745716] Wed, 19 October 2016 16:09 Go to previous messageGo to next message
Eclipse UserFriend
Hello,
I thought I'm rephrasing my problem in some questions:
After I clean Install Kura and deploy any deployment package which is configurable, can I set it's configuration via MQTT call to the CONF-V1 service? Does this service should run and listen to MQTT calls by default? Does any configurable package which can be reconfigured also via GUI can be reconfigured via MQTT calls without any further development?

If you know the answers, any help or a simple yes/no would be greatly appreciated Smile .
Re: Bundle Remote Update [message #1746051 is a reply to message #1745957] Thu, 20 October 2016 16:45 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

Yes, all services running in Kura are available to be configured over MQTT. I am assuming you have reviewed: http://eclipse.github.io/kura/ref/mqtt-namespace.html . The section "Remote OSGi ConfigurationAdmin Interactions via MQTT" is the most relevant to what you are trying to do. Is this not working for you?

Thanks,
--Dave
Re: Bundle Remote Update [message #1746140 is a reply to message #1746051] Sun, 23 October 2016 08:46 Go to previous messageGo to next message
Eclipse UserFriend
Yes, I'm trying to do this tutorial but doesn't seems to work. Using MQTT Client Utility, I'm publishing to EDC/guest/raspberry/CONF-V1/GET/configurations . I've changed "$EDC" to "EDC" in Kura web admin, and also set up the client-id and account name. I'm using an MQTT broker started on my local network. There is nor response on topic 'EDC/guest/CLIENT_LLR5FI9SEFKBN7SUGVB4MURSSU/CONF-V1/REPLY/REQUEST_PV4G16CEUIFDTFIQ82025E70VR' and here is the debug log of Kura:

2016-10-23 12:36:13,545 [MQTT Call: raspberry] DEBUG o.e.k.c.d.t.m.MqttDataTransport - Message arrived on topic: EDC/guest/raspberry/CONF-V1/GET/configurations
2016-10-23 12:36:13,545 [MQTT Call: raspberry] DEBUG o.e.k.c.d.t.m.DataTransportListenerS - No registered listener services. Ignoring onMessageArrived
2016-10-23 12:36:13,546 [MQTT Call: raspberry] DEBUG o.e.k.c.d.DataServiceImpl - Message arrived on topic: EDC/guest/raspberry/CONF-V1/GET/configurations
2016-10-23 12:36:13,546 [MQTT Call: raspberry] DEBUG o.e.k.c.d.DataServiceListenerS - No registered listener services. Ignoring onMessageArrived
2016-10-23 12:36:13,546 [MQTT Call: raspberry] DEBUG o.e.k.c.c.c.CloudCallServiceImpl - Message arrived on topic: 'EDC/guest/raspberry/CONF-V1/GET/configurations'
2016-10-23 12:36:13,546 [MQTT Call: raspberry] INFO  o.e.k.c.c.CloudServiceImpl - Message arrived on topic: EDC/guest/raspberry/CONF-V1/GET/configurations
Re: Bundle Remote Update [message #1746246 is a reply to message #1746140] Tue, 25 October 2016 17:19 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

So the debug messages you posted seem okay, the CloudService is what will hold the registered listeners. Do you see something in the log after that? Below is an example of my test run. I have omitted account names and device IDs.

2016-10-25 21:03:14,352 [MQTT Call: --omitted--] DEBUG o.e.k.c.d.t.m.MqttDataTransport - Message arrived on topic: $EDC/--omitted--/--omitted--/CONF-V1/GET/configurations
2016-10-25 21:03:14,353 [MQTT Call: --omitted--] DEBUG o.e.k.c.d.t.m.DataTransportListenerS - No registered listener services. Ignoring onMessageArrived
2016-10-25 21:03:14,353 [MQTT Call: --omitted--] DEBUG o.e.k.c.d.DataServiceImpl - Message arrived on topic: $EDC/--omitted--/--omitted--/CONF-V1/GET/configurations
2016-10-25 21:03:14,354 [MQTT Call: --omitted--] DEBUG o.e.k.c.d.DataServiceListenerS - No registered listener services. Ignoring onMessageArrived
2016-10-25 21:03:14,354 [MQTT Call: --omitted--] DEBUG o.e.k.c.c.c.CloudCallServiceImpl - Message arrived on topic: '$EDC/--omitted--/--omitted--/CONF-V1/GET/configurations'
2016-10-25 21:03:14,354 [MQTT Call: --omitted--] INFO  o.e.k.c.c.CloudServiceImpl - Message arrived on topic: $EDC/--omitted--/--omitted--/CONF-V1/GET/configurations
2016-10-25 21:03:14,402 [MQTT Call: --omitted--] DEBUG o.e.k.c.Cloudlet - Control Arrived on topic: GET/configurations
2016-10-25 21:03:14,410 [pool-4-thread-2] DEBUG o.e.k.c.MessageHandlerCallable - Control Arrived on topic: GET/configurations
2016-10-25 21:03:14,421 [pool-4-thread-2] DEBUG o.e.k.c.MessageHandlerCallable - Handling GET request topic: GET/configurations
2016-10-25 21:03:14,674 [pool-4-thread-2] DEBUG o.e.k.c.MessageHandlerCallable - Publishing response topic: REPLY/-2235377569487582835-1477429394775
2016-10-25 21:03:14,691 [pool-4-thread-2] INFO  o.e.k.c.d.DataServiceImpl - Storing message on topic :$EDC/#account-name/--omitted--/CONF-V1/REPLY/-2235377569487582835-1477429394775, priority: 1
2016-10-25 21:03:14,699 [pool-4-thread-2] INFO  o.e.k.c.d.DataServiceImpl - Stored message on topic :$EDC/#account-name/--omitted--/CONF-V1/REPLY/-2235377569487582835-1477429394775, priority: 1
2016-10-25 21:03:14,707 [DataServiceImpl:Submit] DEBUG o.e.k.c.d.DataServiceImpl - Publishing message with ID: 1 on topic: $EDC/#account-name/--omitted--/CONF-V1/REPLY/-2235377569487582835-1477429394775, priority: 1
2016-10-25 21:03:14,709 [DataServiceImpl:Submit] DEBUG o.e.k.c.d.t.m.MqttDataTransport - Replaced tokens in topic $EDC/#account-name/--omitted--/CONF-V1/REPLY/-2235377569487582835-1477429394775 with: $EDC/--omitted--/--omitted--/CONF-V1/REPLY/-2235377569487582835-1477429394775
Re: Bundle Remote Update [message #1746248 is a reply to message #1746246] Tue, 25 October 2016 17:34 Go to previous messageGo to next message
Eclipse UserFriend
No, there is no such logs in my device. I've even searched for "Control Arrived on topic" message in my kura.log and there was no such result. Also I've never seen a log message about publishing to the REPLY topic (not even on DEBUG level).
I don't understand what I could be missing but it's have to be some basic stuff.
If I don't have any own cloudlet bundles installed, this still should work and return with an empty configuration list, right?

My service class declaration starts like:
public class MyService implements ConfigurableComponent, CloudClientListener
{ (...)

My OSGI component xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
 name="org.eclipse.kura.MyService"
 activate="activate"
 configuration-policy="require"
 deactivate="deactivate"
 enabled="true"
 immediate="true"
 modified="updated" >
   <implementation class="org.eclipse.kura.MyService"/>
   <property name="service.pid" type="String" value="org.eclipse.kura.MyService"/>

   <reference name="CloudService"
              policy="static"
              bind="setCloudService"
              unbind="unsetCloudService"
              cardinality="1..1"
              interface="org.eclipse.kura.MyService"/>
   <service>
      <provide interface="org.eclipse.kura.MyService"/>
   </service>
</scr:component>

[Updated on: Thu, 27 October 2016 14:41] by Moderator

Re: Bundle Remote Update [message #1746374 is a reply to message #1746248] Thu, 27 October 2016 13:48 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

There does appear to be a bug when changing the "$EDC" to something else. Let me check into this and I will report back.

Thanks,
--Dave
Re: Bundle Remote Update [message #1746378 is a reply to message #1746374] Thu, 27 October 2016 14:39 Go to previous messageGo to next message
Eclipse UserFriend
Huh, thanks. Meanwhile could you please tell me the MQTT broker and version which can be used with the $ prefix? I've read it somewhere but I can't find it...

[Updated on: Thu, 27 October 2016 14:42] by Moderator

Re: Bundle Remote Update [message #1746381 is a reply to message #1746378] Thu, 27 October 2016 16:39 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

I have created an issue here [1]. I hope we can get this resolved in the next release.

I can't speak to all brokers, but I know ActiveMQ and Eclipse Mosquitto can handle the '$'. If you want to try it out, Eclipse host a public Mosquitto broker at iot.eclipse.org:1883. I just tried and the '$' works on this broker.

[1] https://github.com/eclipse/kura/issues/683
Re: Bundle Remote Update [message #1746382 is a reply to message #1746381] Thu, 27 October 2016 17:12 Go to previous messageGo to next message
Eclipse UserFriend
Thank you very much. I'll try with that broker meanwhile.
Re: Bundle Remote Update [message #1760919 is a reply to message #1734200] Thu, 04 May 2017 07:04 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I am new to kura and I have been trying to remotely uninstall a deployment package using Amit's MQTT application[1], but I am unable to do so. This is the request payload I send from the application-

dp.name=hello_osgi
job.id=12345891011L
dp.version=1.0.0

I get the following error in the response topic-
-- listing properties --
response.code=500
{response.exception.message=java.lang.String cannot be cast to java.lang.Long,
response.exception.stack=java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long           
                at org.eclipse.kura.core.deployment.uninstall.DeploymentPackageUninstallOptions.
                <init>(DeploymentPackageUninstallOptions.java:38)     
                at org.eclipse.kura.core.deployment.CloudDeploymentHandlerV2.doExecUninstall(CloudDeploymentHandlerV2.java:594)                
                at org.eclipse.kura.core.deployment.CloudDeploymentHandlerV2.doExec(CloudDeploymentHandlerV2.java:343)                
                at org.eclipse.kura.cloud.MessageHandlerCallable.call(Cloudlet.java:270)            
                at org.eclipse.kura.cloud.MessageHandlerCallable.call(Cloudlet.java:1)
                at java.util.concurrent.FutureTask.run(FutureTask.java:266)      
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)               
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)               
                at java.lang.Thread.run(Thread.java:745) ,
response.code=500}

Malformed uninstall request


Following is the kura console-
16:12:04,707 [MQTT Call: test-client] INFO  CloudServiceImpl:440  - Message arrived on topic: $EDC/amir-kura/test-client/DEPLOY-V2/EXEC/uninstall
16:12:04,709 [pool-3-thread-2] ERROR CloudDeploymentHandlerV2:597  - Malformed uninstall request!
16:12:04,710 [pool-3-thread-2] INFO  DataServiceImpl:441  - Storing message on topic :$EDC/#account-name/CLIENT_QED0U1F74NLHA7M0Q5KI606QAU/DEPLOY-V2/REPLY/REQUEST_OTFGFHBKFSCVOI156408A4SU26, priority: 1
16:12:04,733 [DataServiceImpl:Submit] INFO  MqttDataTransport:512  - Publishing message on topic: $EDC/amir-kura/CLIENT_QED0U1F74NLHA7M0Q5KI606QAU/DEPLOY-V2/REPLY/REQUEST_OTFGFHBKFSCVOI156408A4SU26 with QoS: 0
16:12:04,745 [pool-3-thread-2] INFO  DataServiceImpl:444  - Stored message on topic :$EDC/#account-name/CLIENT_QED0U1F74NLHA7M0Q5KI606QAU/DEPLOY-V2/REPLY/REQUEST_OTFGFHBKFSCVOI156408A4SU26, priority: 1


Is there some other way to send the request payload ?
[1]=https://github.com/amitjoy/Kura-MQTT-Client-Utility
Re: Bundle Remote Update [message #1763308 is a reply to message #1760919] Fri, 12 May 2017 09:54 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

It looks like you got assistance here [1]. Did this answer your questions?

[1] http://stackoverflow.com/questions/43841141/kura-cannot-uninstall-deployment-package-remotelydeploy-v2

Thanks,
--Dave
Re: Bundle Remote Update [message #1763380 is a reply to message #1763308] Sun, 14 May 2017 15:23 Go to previous message
Eclipse UserFriend
Hello Dave,

My goal is to develop a web application capable of Remote OSGi DeploymentAdmin Interactions via MQTT, according to the assistance I got from the above mentioned link I am trying to achieve my goal by understanding how Amit's MQTT application [1] works and eventually start with my application accordingly.

While debugging Amit's application I have found out that code identifies the value of 'job.id' as String instead of long and sends it to kura and hence the error, as of now I am attempting to fix this bug.

So I have 2 questions-
Q1. Am I giving the input correctly in the application?
Q2. Is there a better approach to achieve my goal ?

[1]=https://github.com/amitjoy/Kura-MQTT-Client-Utility

Thanks
-Amir
Previous Topic:org.eclipse.kura.example.camel.publisher does not build from sources (KURA_2.1.0_RELEASE)
Next Topic:Kura's data that sent to broker Problem
Goto Forum:
  


Current Time: Wed Jul 30 11:48:17 EDT 2025

Powered by FUDForum. Page generated in 0.09896 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top