-
Notifications
You must be signed in to change notification settings - Fork 438
/
ovn.go
54 lines (49 loc) · 1.65 KB
/
ovn.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package ovs
import (
"errors"
)
var (
ErrNoAddr = errors.New("no address")
ErrNotFound = errors.New("not found")
)
// Client is the ovn client
type Client struct {
OvnNbAddress string
OvnTimeout int
OvnSbAddress string
OVNIcNBAddress string
ClusterRouter string
ClusterTcpLoadBalancer string
ClusterUdpLoadBalancer string
ClusterTcpSessionLoadBalancer string
ClusterUdpSessionLoadBalancer string
NodeSwitch string
NodeSwitchCIDR string
ExternalGatewayType string
}
const (
OvnNbCtl = "ovn-nbctl"
OvnSbCtl = "ovn-sbctl"
OVNIcNbCtl = "ovn-ic-nbctl"
OvsVsCtl = "ovs-vsctl"
MayExist = "--may-exist"
IfExists = "--if-exists"
Policy = "--policy"
PolicyDstIP = "dst-ip"
PolicySrcIP = "src-ip"
)
// NewClient init an ovn client
func NewClient(ovnNbAddr string, ovnNbTimeout int, ovnSbAddr, clusterRouter, clusterTcpLoadBalancer, clusterUdpLoadBalancer, clusterTcpSessionLoadBalancer, clusterUdpSessionLoadBalancer, nodeSwitch, nodeSwitchCIDR string) *Client {
return &Client{
OvnNbAddress: ovnNbAddr,
OvnSbAddress: ovnSbAddr,
OvnTimeout: ovnNbTimeout,
ClusterRouter: clusterRouter,
ClusterTcpLoadBalancer: clusterTcpLoadBalancer,
ClusterUdpLoadBalancer: clusterUdpLoadBalancer,
ClusterTcpSessionLoadBalancer: clusterTcpSessionLoadBalancer,
ClusterUdpSessionLoadBalancer: clusterUdpSessionLoadBalancer,
NodeSwitch: nodeSwitch,
NodeSwitchCIDR: nodeSwitchCIDR,
}
}