feat(agent): websockets obuspa run

This commit is contained in:
leandrofars 2024-04-02 07:23:52 -03:00
parent f3ada68c84
commit 4fc992d536
3 changed files with 13 additions and 18 deletions

View File

@ -79,13 +79,10 @@ user@user-laptop:~/oktopus/deploy/compose$ COMPOSE_PROFILES=nats,controller,mqtt
</li> </li>
<li> <li>
<h4>Device test agent (obuspa):</h4> <h4>Device test agent (obuspa):</h4>
<p>Follow the instructions to build <a href="https://github.com/BroadbandForum/obuspa">obuspa</a> at their repo QUICK_START_GUIDE.md and remember to define 'INCLUDE_PROGRAMMATIC_FACTORY_RESET' at <a href="https://github.com/BroadbandForum/obuspa/blob/master/src/vendor/vendor_defs.h">'vendor_defs.h'</a> inside src/vendor folder, also advice you to build it with make tool.</p>
<p>You can customize <a href="https://github.com/OktopUSP/oktopus/tree/main/agent/oktopus-mqtt-obuspa.txt">'oktopus-mqtt-obuspa.txt'</a> accordingly to your needs, there you can change broker address, client password, and etc. '-i' option defines the interface your usp packets will go through, in this case it's localhost, also keep in mind that after you run obuspa if you made a change to 'oktopus-mqtt-obuspa.txt' and want it to take effect you must delete '/usr/local/var/obuspa/usp.db' file before running the agent again (docs provide you other methods to do it too).'-r' option defines the config file you want the agent to use. </p>
<p>Run MQTT agent:</p> <p>Run MQTT agent:</p>
<pre>user@user-laptop:~/oktopus$ obuspa -p -v 4 -r agent/oktopus-mqtt-obuspa.txt -i lo</pre> <pre>user@user-laptop:~/oktopus$ docker run -d -v $(pwd)/agent/oktopus-mqtt-obuspa.txt:/obuspa/oktopus-mqtt-obuspa.txt --network host --name obuspa-mqtt oktopusp/obuspa:latest obuspa -r /obuspa/oktopus-mqtt-obuspa.txt -p -v4 -i lo</pre>
<p>Run Websockets agent:</p> <p>Run Websockets agent:</p>
<pre>user@user-laptop:~/oktopus$ obuspa -p -v 4 -r agent/oktopus-websockets-obuspa.txt -i lo</pre> <pre>user@user-laptop:~/oktopus$ docker run -d -v $(pwd)/agent/oktopus-websockets-obuspa.txt:/obuspa/oktopus-websockets-obuspa.txt --network host --name obuspa-websockets oktopusp/obuspa:latest obuspa -r /obuspa/oktopus-websockets-obuspa.txt -p -v4 -i lo && docker logs -f obuspa-websockets</pre>
<p>Obuspa has a lot of info and docs at their repo, which shows you many options to set your environment and customize agent to your embedded project. This basic agent has the purpose to test oktopus connection and shows an idea of how it's like with true devices, although with those, you're able to explore much more parameters and execute lots of configurations. Obuspa has default parameters and mocked info:</p>
<img src="https://github.com/OktopUSP/oktopus/assets/83298718/4599d566-eada-4313-8ae1-31dae82391de"/> <img src="https://github.com/OktopUSP/oktopus/assets/83298718/4599d566-eada-4313-8ae1-31dae82391de"/>
<img src="https://github.com/OktopUSP/oktopus/assets/83298718/501b4ccd-6147-4957-9096-695134e34b5e"/> <img src="https://github.com/OktopUSP/oktopus/assets/83298718/501b4ccd-6147-4957-9096-695134e34b5e"/>
</li> </li>

View File

@ -17,8 +17,7 @@
# Adding MQTT parameters to test the datamodel interface # Adding MQTT parameters to test the datamodel interface
# #
Device.LocalAgent.EndpointID "oktopus-agent-test" Device.LocalAgent.EndpointID "oktopus-0-mqtt"
## Adding boot params ## Adding boot params
Device.LocalAgent.Controller.1.BootParameter.1.Enable true Device.LocalAgent.Controller.1.BootParameter.1.Enable true

View File

@ -22,17 +22,19 @@
Device.LocalAgent.EndpointID "oktopus-0-ws" Device.LocalAgent.EndpointID "oktopus-0-ws"
# Controller's websocket server (for agent initiated sessions) # Controller's websocket server (for agent initiated sessions)
Device.LocalAgent.Controller.1.EndpointID "oktopusController"
Device.LocalAgent.Controller.1.MTP.1.WebSocket.Host "127.0.0.1" Device.LocalAgent.Controller.1.MTP.1.WebSocket.Host "127.0.0.1"
Device.LocalAgent.Controller.1.MTP.1.WebSocket.Port "8080" Device.LocalAgent.Controller.1.MTP.1.WebSocket.Port "8080"
Device.LocalAgent.Controller.1.MTP.1.WebSocket.Path "ws/agent" Device.LocalAgent.Controller.1.MTP.1.WebSocket.Path "/ws/agent"
Device.LocalAgent.Controller.1.MTP.1.WebSocket.EnableEncryption "false" Device.LocalAgent.Controller.1.MTP.1.WebSocket.EnableEncryption "false"
Device.LocalAgent.Controller.1.MTP.1.WebSocket.KeepAliveInterval "30"
Device.LocalAgent.Controller.1.MTP.1.WebSocket.SessionRetryMinimumWaitInterval "5"
Device.LocalAgent.Controller.1.MTP.1.WebSocket.SessionRetryMinimumWaitInterval "2000"
# Agent's websocket server (for controller initiated sessions) # Agent's websocket server (for controller initiated sessions)
Device.LocalAgent.MTP.1.WebSocket.Port "8080" Device.LocalAgent.MTP.1.WebSocket.Port "5683"
Device.LocalAgent.MTP.1.WebSocket.Path "/usp" Device.LocalAgent.MTP.1.WebSocket.Path ""
Device.LocalAgent.MTP.1.WebSocket.EnableEncryption "false" Device.LocalAgent.MTP.1.WebSocket.EnableEncryption "true"
Device.LocalAgent.MTP.1.WebSocket.KeepAliveInterval "30"
# #
# The following parameters may be modified # The following parameters may be modified
@ -40,7 +42,6 @@ Device.LocalAgent.MTP.1.WebSocket.EnableEncryption "false"
Device.LocalAgent.MTP.1.Alias "cpe-1" Device.LocalAgent.MTP.1.Alias "cpe-1"
Device.LocalAgent.MTP.1.Enable "true" Device.LocalAgent.MTP.1.Enable "true"
Device.LocalAgent.MTP.1.Protocol "WebSocket" Device.LocalAgent.MTP.1.Protocol "WebSocket"
Device.LocalAgent.MTP.1.WebSocket.KeepAliveInterval "30"
Device.LocalAgent.Controller.1.Alias "cpe-1" Device.LocalAgent.Controller.1.Alias "cpe-1"
Device.LocalAgent.Controller.1.Enable "true" Device.LocalAgent.Controller.1.Enable "true"
Device.LocalAgent.Controller.1.AssignedRole "Device.LocalAgent.ControllerTrust.Role.1" Device.LocalAgent.Controller.1.AssignedRole "Device.LocalAgent.ControllerTrust.Role.1"
@ -49,11 +50,9 @@ Device.LocalAgent.Controller.1.PeriodicNotifTime "0001-01-01T00:00:00Z"
Device.LocalAgent.Controller.1.USPNotifRetryMinimumWaitInterval "5" Device.LocalAgent.Controller.1.USPNotifRetryMinimumWaitInterval "5"
Device.LocalAgent.Controller.1.USPNotifRetryIntervalMultiplier "2000" Device.LocalAgent.Controller.1.USPNotifRetryIntervalMultiplier "2000"
Device.LocalAgent.Controller.1.ControllerCode "" Device.LocalAgent.Controller.1.ControllerCode ""
Device.LocalAgent.Controller.1.MTP.1.Alias "oktopus0" Device.LocalAgent.Controller.1.EndpointID "oktopusController"
Device.LocalAgent.Controller.1.MTP.1.Alias "cpe-1"
Device.LocalAgent.Controller.1.MTP.1.Enable "true" Device.LocalAgent.Controller.1.MTP.1.Enable "true"
Device.LocalAgent.Controller.1.MTP.1.Protocol "WebSocket" Device.LocalAgent.Controller.1.MTP.1.Protocol "WebSocket"
Device.LocalAgent.Controller.1.MTP.1.WebSocket.KeepAliveInterval "30"
Device.LocalAgent.Controller.1.MTP.1.WebSocket.SessionRetryMinimumWaitInterval "5"
Device.LocalAgent.Controller.1.MTP.1.WebSocket.SessionRetryIntervalMultiplier "2000"
Internal.Reboot.Cause "LocalFactoryReset" Internal.Reboot.Cause "LocalFactoryReset"