Skip to content

Conversation

@jajeffries
Copy link
Contributor

Co-authored-by: Leonardo Parente 23251360+leoparente@users.noreply.github.com
This pull request refactors and extends the fleet configuration manager to improve MQTT topic management, agent group membership handling, and message dispatching. It moves topic template logic into a dedicated file, introduces new message types for group memberships, and updates the agent's capabilities publishing to use labels. The changes also clean up configuration options and enhance logging and error handling.

MQTT topic management and configuration:

  • Moved topic template logic (fillTopicTemplate, generateTopicsFromTemplate, and topic constants) from jwt_claims.go to a new file topics.go, and added a helper for group topic generation. ([[1]](https://github.com/netboxlabs/orb-agent/pull/192/files#diff-71ab8d441de75b0ed31030ab188e24913c1de913b419c9958e15bea287c55addR1-R40), [[2]](https://github.com/netboxlabs/orb-agent/pull/192/files#diff-e462dde5ad22797f0633447da4325f0b6c054b09248f903a7de98a09e495cdd0L73-L99))
  • Removed unused AgentID and MQTTURL fields from the FleetManager config type, ensuring MQTT URL is only taken from the token response. ([[1]](https://github.com/netboxlabs/orb-agent/pull/192/files#diff-fa50c62688210fe1e87f900fd800e4984fcda45ea46a9ea08ff29558e33f17dbL42-L43), [[2]](https://github.com/netboxlabs/orb-agent/pull/192/files#diff-b0dddd7590e09bc17b468db04b48a21f0d508a17eca4c086eb98c87325e5ba98L133-R148))

Agent group membership handling:

  • Added new message types (GroupMemberships, GroupMembership, RPC, SendGroupMembershipsRequest) to support group membership requests and responses. ([agent/configmgr/messages/fleet_messages.goL87-R110](https://github.com/netboxlabs/orb-agent/pull/192/files#diff-8cf3531ad4e85278f1f915759d83f151021abafa21e10b6f7ce95569537c2543L87-R110))
  • Implemented logic to send group membership requests after capabilities are published, and to handle incoming group membership messages by subscribing to relevant group topics. ([[1]](https://github.com/netboxlabs/orb-agent/pull/192/files#diff-b0dddd7590e09bc17b468db04b48a21f0d508a17eca4c086eb98c87325e5ba98R211-R232), [[2]](https://github.com/netboxlabs/orb-agent/pull/192/files#diff-b0dddd7590e09bc17b468db04b48a21f0d508a17eca4c086eb98c87325e5ba98L270-R314), [[3]](https://github.com/netboxlabs/orb-agent/pull/192/files#diff-b0dddd7590e09bc17b468db04b48a21f0d508a17eca4c086eb98c87325e5ba98L310-R384))

Message dispatching and processing:

  • Refactored message dispatching to work with the new RPC structure, extracting message type and organization ID, and routing group membership messages to their handler. ([[1]](https://github.com/netboxlabs/orb-agent/pull/192/files#diff-b0dddd7590e09bc17b468db04b48a21f0d508a17eca4c086eb98c87325e5ba98L226-R255), [[2]](https://github.com/netboxlabs/orb-agent/pull/192/files#diff-b0dddd7590e09bc17b468db04b48a21f0d508a17eca4c086eb98c87325e5ba98L310-R384))
  • Updated tests to match the new dispatchToHandlers method signature. ([agent/configmgr/fleet_test.goL672-R674](https://github.com/netboxlabs/orb-agent/pull/192/files#diff-ffd2e1a25e0d7ade7e270cdffecf1f765962ee97e5883fa8a1cd39efe5c03e7eL672-R674))

Capabilities publishing and logging:

  • Changed agent capabilities publishing to use AgentLabels instead of AgentTags, and improved logging for publishing actions and errors. ([[1]](https://github.com/netboxlabs/orb-agent/pull/192/files#diff-8cf3531ad4e85278f1f915759d83f151021abafa21e10b6f7ce95569537c2543L87-R110), [[2]](https://github.com/netboxlabs/orb-agent/pull/192/files#diff-b0dddd7590e09bc17b468db04b48a21f0d508a17eca4c086eb98c87325e5ba98L205-R202), [[3]](https://github.com/netboxlabs/orb-agent/pull/192/files#diff-b0dddd7590e09bc17b468db04b48a21f0d508a17eca4c086eb98c87325e5ba98R211-R232))

Miscellaneous cleanup:

  • Removed the redundant test target from the Makefile. ([MakefileL57-L60](https://github.com/netboxlabs/orb-agent/pull/192/files#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52L57-L60))
  • Cleaned up imports and unused code in jwt_claims.go. ([agent/configmgr/jwt_claims.goL5](https://github.com/netboxlabs/orb-agent/pull/192/files#diff-e462dde5ad22797f0633447da4325f0b6c054b09248f903a7de98a09e495cdd0L5))

Let me know if you want to dive deeper into any of these changes!

@github-actions
Copy link

github-actions bot commented Oct 3, 2025

Go test coverage

STATUS ELAPSED PACKAGE COVER PASS FAIL SKIP
🟢 PASS 0.87s github.com/netboxlabs/orb-agent/agent 0.0% 0 0 0
🟢 PASS 0.87s github.com/netboxlabs/orb-agent/agent/backend 0.0% 0 0 0
🟢 PASS 5.03s github.com/netboxlabs/orb-agent/agent/backend/devicediscovery 76.0% 3 0 0
🟢 PASS 0.87s github.com/netboxlabs/orb-agent/agent/backend/mocks 0.0% 0 0 0
🟢 PASS 8.04s github.com/netboxlabs/orb-agent/agent/backend/networkdiscovery 76.2% 7 0 0
🟢 PASS 4.03s github.com/netboxlabs/orb-agent/agent/backend/opentelemetryinfinity 75.9% 2 0 0
🟢 PASS 3.02s github.com/netboxlabs/orb-agent/agent/backend/pktvisor 65.6% 2 0 0
🟢 PASS 8.05s github.com/netboxlabs/orb-agent/agent/backend/snmpdiscovery 75.8% 7 0 0
🟢 PASS 5.03s github.com/netboxlabs/orb-agent/agent/backend/worker 76.0% 3 0 0
🟢 PASS 1.01s github.com/netboxlabs/orb-agent/agent/config 100.0% 6 0 0
🟢 PASS 34.55s github.com/netboxlabs/orb-agent/agent/configmgr 54.8% 56 0 0
🟢 PASS 1.01s github.com/netboxlabs/orb-agent/agent/policies 100.0% 15 0 0
🟢 PASS 1.03s github.com/netboxlabs/orb-agent/agent/policymgr 70.3% 10 0 0
🟢 PASS 24.88s github.com/netboxlabs/orb-agent/agent/secretsmgr 48.9% 54 0 0
🟢 PASS 1.01s github.com/netboxlabs/orb-agent/agent/version 100.0% 1 0 0

Total coverage: 59.4%

Base automatically changed from fleet_manager to develop October 3, 2025 10:32
@jajeffries jajeffries merged commit 3edf718 into develop Oct 3, 2025
5 checks passed
@jajeffries jajeffries deleted the feat/OBS-1420-subscribe-to-groups branch October 3, 2025 13:24
@github-actions
Copy link

github-actions bot commented Nov 3, 2025

🎉 This PR is included in version 2.5.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions
Copy link

github-actions bot commented Nov 4, 2025

🎉 This PR is included in version 2.5.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants