BroadbandForum / obuspa

OB-USP-AGENT is a system daemon providing a User Services Platform (USP) Agent. https://github.com/BroadbandForum/obuspa/wiki
BSD 3-Clause "New" or "Revised" License
93 stars 62 forks source link

Stomp Agent #24

Closed RamonRomeroQro closed 3 years ago

RamonRomeroQro commented 3 years ago

Hello!

Can you share an example of factory file for a stomp agent with subscriptions? Or which changes I have to do to the mqtt example beside the protocol?

Thanks for your time

duttajnu commented 3 years ago

Hi @RamonRomeroQro ,

Have you tried adding the subscriptions in factory_reset_example.txt like below:

Device.LocalAgent.Subscription.1.Enable "1"
Device.LocalAgent.Subscription.1.ID "addObj"
Device.LocalAgent.Subscription.1.NotifType "ObjectCreation"
Device.LocalAgent.Subscription.1.ReferenceList "Device.Users.User."
Device.LocalAgent.Subscription.1.Persistent "1"
Device.LocalAgent.Subscription.1.Recipient "Device.LocalAgent.Controller.1"
RamonRomeroQro commented 3 years ago

hello @duttajnu , yes I tried the factory reset example and also added those params, but I am getting this error.


DATABASE_Init: Opening database /usr/local/var/obuspa/usp.db
DM_PRIV_FormDB_FromPath: WARNING: 'Device.STOMP.Connection.{i}.X_ARRIS-COM_EnableEncryption' is deprecated, please use 'Device.STOMP.Connection.{i}.EnableEncryption' instead
LoadClientCert: Not using a device certificate for connections
DEVICE_MQTT_Start: WARNING: No instances in Device.MQTT.Client
Attempting to connect to host=127.0.0.1 (port=61613, unencrypted) from interface=eth0
Connected to 127.0.0.1 (host=127.0.0.1, port=61613) from interface=eth0
Sending STOMP frame to (host=127.0.0.1, port=61613)
STOMP
accept-version:1.2
host:/
heart-beat:30000,300000
endpoint-id:os\c\c012345-025000000001
login:guest
passcode:

Received CONNECTED frame from (host=127.0.0.1, port=61613)
CONNECTED
server:RabbitMQ/3.9.4
session:session-iHTMIgJLAffGRJL5o6DxTA
heart-beat:300000,30000
version:1.2

Sending SUBSCRIBE frame to (host=127.0.0.1, port=61613)
StartSendingFrame_SUBSCRIBE: Unable to get agent queue name for Device.STOMP.Connection.1. Retrying
Error on STOMP connection to (host 127.0.0.1, port 61613). Closing connection.
Disconnecting from (host=127.0.0.1, port=61613)
Retrying STOMP connection to (host 127.0.0.1, port 61613) in 22 seconds (retry_count=1).
Attempting to connect to host=127.0.0.1 (port=61613, unencrypted) from interface=eth0
Connected to 127.0.0.1 (host=127.0.0.1, port=61613) from interface=eth0
Sending STOMP frame to (host=127.0.0.1, port=61613)

I am running the agent and (rabbitmq)[https://hub.docker.com/_/rabbitmq]over docker and getting this from MQ: Any idea on what is the problem?


2021-08-24 19:14:21.141353+00:00 [info] <0.1045.0> accepting STOMP connection <0.1045.0> (172.30.0.1:59002 -> 172.30.0.5:61613)

2021-08-24 19:14:21.147891+00:00 [info] <0.1045.0> closing STOMP connection <0.1045.0> (172.30.0.1:59002 -> 172.30.0.5:61613)
duttajnu commented 3 years ago

Hi @RamonRomeroQro ,

It's just a warning. This parameter recently included in TR-181, just rename Device.STOMP.Connection.{i}.X_ARRIS-COM_EnableEncryption' to 'Device.STOMP.Connection.{i}.EnableEncryption' to fix the warning.

RamonRomeroQro commented 3 years ago

Thanks for the answer @duttajnu. Yes, the warning is solved by changing that parameter. My error is that once started the agent, the connection is intermittent. Is it normal?

Retrying STOMP connection to (host 127.0.0.1, port 61613) in 22 seconds (retry_count=1).

holme-r commented 3 years ago

The reason why OBUSPA is closing the connection is because there is no agent queue name set in Device.LocalAgent.MTP.1.STOMP.Destination (it must be set to something other than an empty string). This is not necessary, if the STOMP broker sends the "subscribe-dest" STOMP header in the STOMP CONNECTED frame, but as RabbitMQ doesn't, you will need to set it.

RamonRomeroQro commented 3 years ago

Thanks, it seems to work now 😁