npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@sourceregistry/node-ovsdb

v1.0.2

Published

Open vSwitch Database Management Protocol typescript client

Readme

@sourceregistry/node-ovsdb

License Release to NPM

A lightweight, typesafe TypeScript client for the Open vSwitch Database (OVSDB) Management Protocol, as defined in RFC 7047.

This library provides a low-level wrapper to interact with the OVSDB over a Unix socket, enabling programmatic configuration and management of Open vSwitch instances.

Installation

Install the package using npm:

npm install @sourceregistry/node-ovsdb

Usage

Getting Started

The primary class is OVSDBClient, which handles the connection to the OVSDB server (typically located at /var/run/openvswitch/db.sock).

import { OVSDBClient } from '@sourceregistry/node-ovsdb';

async function main() {
  // Create a new client instance
  const client = new OVSDBClient();

  try {
    // Connect to the OVSDB Unix socket
    await client.connect();
    console.log('Connected to OVSDB');

    // Example: Get the list of available databases
    const databases = await client.listDbs();
    console.log('Databases:', databases);

    // Example: Get the schema of the 'Open_vSwitch' database
    const schema = await client.getSchema('Open_vSwitch');
    console.log('OVS Version:', schema.version);

    // Example: Perform a transaction to select all bridges
    const operations = [
      {
        op: 'select',
        table: 'Bridge',
        where: [],
        columns: ['name']
      }
    ];

    const result = await client.transact('Open_vSwitch', operations);
    console.log('Bridges:', result);

  } catch (error) {
    console.error('An error occurred:', error.message);
  } finally {
    // Always close the connection
    client.close();
  }
}

main();

Using Async Disposable (Recommended)

For guaranteed resource cleanup, use the client with the using statement (requires Node.js 18+ or the --harmony-explicit-resource-management flag):

import { OVSDBClient } from '@sourceregistry/node-ovsdb';

async function main() {
  // The 'using' statement ensures the client is closed even if an error occurs
  using client = new OVSDBClient();

  await client.connect();
  console.log('Connected to OVSDB');

  const dbs = await client.listDbs();
  console.log('Available databases:', dbs);
}

main();

Core Methods

The OVSDBClient class provides direct access to the core OVSDB RPC methods:

  • connect(): Establishes a connection to the Unix socket.
  • listDbs(): Retrieves the names of available databases.
  • getSchema(dbName): Retrieves the schema for a specific database.
  • transact(dbName, operations): Executes a series of database operations atomically.
  • monitor(...): Subscribes to database change notifications.
  • echo(): Tests the connection liveness.
  • close(): Closes the connection.

Advanced: Entity Wrappers (Coming Soon)

For higher-level operations (e.g., createBridge, addPort), consider building wrapper classes on top of OVSDBClient. A future version of this library may include these.

Development

Prerequisites

  • Node.js (v18 or higher recommended)

Scripts

  • npm run dev: Start the development server.
  • npm run build: Compile the TypeScript code and generate the distribution files in the dist/ directory.
  • npm run preview: Preview the built application.
  • npm run test: Run the test suite with Vitest.

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

License

This project is licensed under the Apache-2.0 License. See the LICENSE file for details.