Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adds option to use different datapath #126

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gruyaume
Copy link

Description

OVS can operate entirely in user space, provided the datapath_type parameter when creating bridge. This PR adds support for the netdev datapath.

Usage

package main

import (
	"log"

	"github.com/digitalocean/go-openvswitch/ovs"
)

func main() {
	var ovsBridge string = "br0"

	ovsClient := ovs.New(
		ovs.Sudo(),
	)

	// sudo ovs-vsctl add-br br0
	if err := ovsClient.VSwitch.AddBridge(ovsBridge); err != nil {
		log.Fatalf("failed to add bridge: %v", err)
	}

	// sudo ovs-vsctl set bridge br0 datapath_type=netdev
	if err := ovsClient.VSwitch.Set.Bridge(ovsBridge, ovs.BridgeOptions{
		DataPathType: ovs.DataPathTypeNetDev,
	}); err != nil {
		log.Fatalf("failed to set bridge: %v", err)
	}

}

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant