Skip to content

Conversation

@jajeffries
Copy link
Contributor

This pull request introduces support for handling group removal events in the MQTT fleet connection and messaging system. It refactors how topic actions (subscribe, publish, unsubscribe) are passed around, and adds logic to properly unsubscribe from topics and clean up associated policies when a group is removed.

Key changes include:

Support for Group Removal and Policy Cleanup:

  • Added a new handler handleAgentGroupRemoval in Messaging to process group removal events. This handler unsubscribes from the relevant MQTT topic and removes or updates policies that are no longer associated with any group or dataset.
  • Added support for the GroupRemovedRPCFunc message type in the dispatcher, invoking the new handler when such a message is received.

Refactoring of Topic Actions:

  • Introduced a new TopicActions struct to encapsulate subscribe, publish, and unsubscribe functions, simplifying how these actions are passed between components. [1] [2]
  • Updated the MQTT connection logic to use the new TopicActions struct, including adding an unsubscribeFromTopic method to handle topic unsubscriptions. [1] [2]

Message Payload Changes:

  • Removed the unused ChannelID field from the GroupRemovedRPCPayload struct, streamlining the payload for group removal events.

Dependency Update:

  • Added a missing import for the backend package in from_rpc.go to support backend-specific operations in policy cleanup.

@github-actions
Copy link

Go test coverage

STATUS ELAPSED PACKAGE COVER PASS FAIL SKIP
🟢 PASS 0.01s github.com/netboxlabs/orb-agent/agent 0.0% 0 0 0
🟢 PASS 0.01s github.com/netboxlabs/orb-agent/agent/backend 0.0% 0 0 0
🟢 PASS 4.03s github.com/netboxlabs/orb-agent/agent/backend/devicediscovery 79.4% 2 0 0
🟢 PASS 0.00s github.com/netboxlabs/orb-agent/agent/backend/mocks 0.0% 0 0 0
🟢 PASS 4.03s github.com/netboxlabs/orb-agent/agent/backend/networkdiscovery 80.6% 2 0 0
🟢 PASS 4.03s github.com/netboxlabs/orb-agent/agent/backend/opentelemetryinfinity 74.1% 2 0 0
🟢 PASS 4.03s github.com/netboxlabs/orb-agent/agent/backend/pktvisor 71.7% 2 0 0
🟢 PASS 4.03s github.com/netboxlabs/orb-agent/agent/backend/snmpdiscovery 80.2% 2 0 0
🟢 PASS 5.04s github.com/netboxlabs/orb-agent/agent/backend/worker 80.6% 3 0 0
🟢 PASS 1.01s github.com/netboxlabs/orb-agent/agent/config 100.0% 6 0 0
🟢 PASS 31.15s github.com/netboxlabs/orb-agent/agent/configmgr 51.5% 13 0 0
🟢 PASS 4.42s github.com/netboxlabs/orb-agent/agent/configmgr/fleet 66.0% 69 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 31.60s 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: 62.1%

@jajeffries jajeffries merged commit 927275a into develop Oct 10, 2025
5 checks passed
@jajeffries jajeffries deleted the feat/OBS-1490-remove-group branch October 10, 2025 12:30
@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