Skip to content

Commit a1eab94

Browse files
committed
add set-controller command for ovs-vsctl and SetSSLParam for ovs-ofctl
ovs-ofctl can use controller address to communicate with ovs daemon. it uses ip:port and it does not require sudo. SetSSLParam is used to pass the keys and certs required to make a SSL connection..
1 parent 325d901 commit a1eab94

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

ovs/client.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,14 @@ func Protocols(versions []string) OptionFunc {
308308
}
309309
}
310310

311+
// SetSSLParam allows additional arbitary parameters to be appended in the end
312+
func SetSSLParam(pkey string, cert string, cacert string) OptionFunc {
313+
return func(c *Client) {
314+
c.ofctlFlags = append(c.ofctlFlags, fmt.Sprintf("--private-key=%s", pkey),
315+
fmt.Sprintf("--certificate=%s", cert), fmt.Sprintf("--ca-cert=%s", cacert))
316+
}
317+
}
318+
311319
// Sudo specifies that "sudo" should be prefixed to all OVS commands.
312320
func Sudo() OptionFunc {
313321
return func(c *Client) {

ovs/vswitch.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,13 @@ func (v *VSwitchService) SetFailMode(bridge string, mode FailMode) error {
119119
return err
120120
}
121121

122+
// SetController sets the controller for this bridge so that ovs-ofctl
123+
// can use this address to communicate.
124+
func (v *VSwitchService) SetController(bridge string, address string) error {
125+
_, err := v.exec("set-controller", bridge, address)
126+
return err
127+
}
128+
122129
// exec executes an ExecFunc using 'ovs-vsctl'.
123130
func (v *VSwitchService) exec(args ...string) ([]byte, error) {
124131
return v.c.exec("ovs-vsctl", args...)

0 commit comments

Comments
 (0)