Skip to content

Conversation

@ljluestc
Copy link

@ljluestc ljluestc commented Dec 1, 2025

PR: Implement RFC 7047 JSON-RPC Client for OVSDB

What this PR does / why we need it:

This PR introduces a native pure-Go JSON-RPC client for OVSDB in vendor/yunion.io/x/ovsdb/client. This implementation adheres to RFC 7047 and allows the application to interact directly with OVN Northbound/Southbound databases without relying on external ovn-nbctl processes. This improves performance, transaction atomicity, and enables real-time state synchronization via OVSDB monitoring.

Key Changes:

  • Native Client: Implemented Client (client.go, rpc.go) which manages persistent TCP/Unix connections and handles the JSON-RPC 1.0 request/response lifecycle, including async notifications.
  • Monitoring: Added MonitorDB (monitor.go) which leverages reflection to map OVSDB table updates directly into the generated Go structs found in yunion.io/x/ovsdb/schema/ovn_nb. This allows for maintaining an automatic, real-time in-memory cache of the database.
  • Transactions: Implemented TransactOps (transact.go) to support atomic operations (Insert, Update, Delete, Mutate) with automatic, schema-aware serialization of Go structs to OVSDB JSON format.
  • Build Fix: Manually registered the new package in vendor/modules.txt to resolve build issues in the vendored environment.
  • Verification: Added a CLI tool cmd/ovsdb-check to verify connection establishment, monitoring synchronization, and transaction execution.
  • Smoke testing completed
  • Unit test written (Validation tool added in cmd/ovsdb-check)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants