Registry / http-networking / ovs
library3.7.1pypypi✓ verified 90d ago

Official Python bindings for Open vSwitch (OVS), version 3.7.1. Provides APIs for interacting with OVS daemons via JSON-RPC, managing OpenFlow, and configuring virtual switches. Released quarterly, used primarily in SDN/NFV environments.

pip install ovs
INSTALL
IMPORT
SIG · OVS
O
ovs
http-networkingpythonv3.7.1
Install
2.8s avg
Import
37ms
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v3.7.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.039s · 21MB
glibc
py 3.10–3.910 runs
installs and imports cleanly · install 2.8s · import 0.034s · 22MB
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

vlog
✓ from ovs import vlog
vlog is a top-level module for logging
jsonrpc
✓ from ovs import jsonrpc
JSON-RPC utilities
db
✓ from ovs import db
Database access (OVSDB)
ovsdb
✓ from ovs import ovsdb
High-level OVSDB client
flow
✓ from ovs import flow
Flow table utilities
poll_loop
✓ from ovs import poll_loop
Event loop
posix
✓ from ovs import posix
POSIX socket helpers
poller
✓ from ovs import poller
Polling utilities
process
✓ from ovs import process
Process management
sFlow
✓ from ovs import sFlow
sFlow remote configuration
stream
✓ from ovs import stream
Stream abstraction (TCP/SSL/Unix)
timeval
✓ from ovs import timeval
Time utilities
unixctl
✓ from ovs import unixctl
Unix control socket
util
✓ from ovs import util
Miscellaneous utilities
version
✓ from ovs import version
Version info

Minimal example connecting to OVSDB via JSON-RPC and sending an echo request.

from ovs import vlog from ovs import jsonrpc from ovs import stream import ovs.unixctl import sys # Example: connect to a remote OVSDB server via JSON-RPC if __name__ == '__main__': # Initialize logging vlog.init() # Create a stream to OVSDB (passing connection string) # For SSL: ssl:127.0.0.1:6632 # For TCP: tcp:127.0.0.1:6640 # For Unix: unix:/var/run/openvswitch/db.sock remote = 'tcp:127.0.0.1:6640' new_stream, error = stream.Stream.open_block( stream.Stream.open(remote)) if error: sys.stderr.write('Failed to connect: %s\n' % error) sys.exit(1) rpc = jsonrpc.Connection(new_stream) # Send a JSON-RPC echo request request = jsonrpc.Message.create_request('echo', []) rpc.send(request) reply, error = rpc.recv_block() if error: sys.stderr.write('Error: %s\n' % error) else: print('Reply: %s' % reply) rpc.close()
ovs-vsctl --version
Debug
Known issues
gotchaThe ovs library is not a high-level Python SDK. It is a thin wrapper around OVS internal C libraries. Many functions require deep understanding of OVS internals. Do not expect a user-friendly API.
fix
For simpler OVS interactions, consider using ovsdb-client (command-line) or a third-party library like python-ovs.
affects: all
deprecatedThe ovs.appctl and ovs.daemon modules are deprecated and may be removed in future versions. Use ovs.unixctl instead.
fix
Replace 'from ovs import appctl' with 'from ovs import unixctl'.
affects: >=3.0
breakingPython 2 support removed in ovs 3.0. If you are on Python 2, you must use ovs 2.x.
fix
Upgrade to Python 3.6+ and use ovs>=3.0.
affects: >=3.0
gotchaThe ovs library uses a custom event loop (poll_loop). Mixing with other event loops (e.g., asyncio, gevent) requires careful integration. Do not assume thread safety.
fix
Use ovs event loop exclusively or offload OVS operations to a separate process.
affects: all
gotchaAll OVS library functions expecting a 'bridge' name or 'port' name assume the exact OVS internal naming. Renaming a bridge via the library after creation is not supported.
fix
Use the OVS command-line tools for management operations like bridge renaming.
affects: all
Errors
Common errors & fixes
AttributeError: module 'ovs' has no attribute 'appctl'
The appctl module was deprecated and removed in ovs 3.0.
fix
Use 'from ovs import unixctl' instead.
ImportError: cannot import name 'ovsdb' from 'ovs' (unknown location)
The ovsdb module is not always included in pip packages; it is part of the full OVS source distribution.
fix
Install OVS from source or use 'from ovs import db' for lower-level OVSDB access.
OSError: [Errno 2] No such file or directory: '/var/run/openvswitch/db.sock'
The OVS daemon (ovsdb-server) is not running or the socket path is wrong.
fix
Start ovsdb-server: 'sudo service openvswitch-switch start'. Then check socket location with 'ovsdb-tool show-log'.
AttributeError: 'NoneType' object has no attribute 'recv_block'
Stream.open_block() returned an error, and rpc is None.
fix
Check the connection parameters. Use 'tcp:127.0.0.1:6640' or 'unix:/var/run/openvswitch/db.sock'.
Upgrade
Version history
3.7.1latest on PyPI · released Mar 31, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
Anthropic
1
Resources
ovs — pip install ovs · libregistry